我的 MWE 如下:
\documentclass[letterpaper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[style=phys,articletitle=true,biblabel=brackets,%
chaptertitle=false,pageranges=false,eprint=true,backend=biber,%
natbib=true,maxbibnames=10,giveninits=true,sorting=none]{biblatex}
\DeclareFieldFormat[article]{journaltitle}{\textit{#1\isdot}}
\renewcommand*{\finalnamedelim}{\addcomma\space}
\urlstyle{same}
\addbibresource{References.bib}
\begin{document}
This is a test.
\nocite{*}
\printbibliography
\end{document}
我的References.bib
文件是
@article{rs11999,
Archiveprefix = {arXiv},
Author = {Randall, Lisa and Sundrum, Raman},
Doi = {10.1103/PhysRevLett.83.3370},
Eprint = {hep-ph/9905221},
Journal = {Phys. Rev. Lett.},
Pages = {3370},
Title = {{A Large Mass Hierarchy from a Small Extra Dimension}},
Volume = {83},
Year = {1999},
Bdsk-Url-1 = {http://dx.doi.org/10.1103/PhysRevLett.83.3370}}
在输出中,参考书目如下所示
我想删除最后一个逗号,并用方括号括住 arXiv 标识符。有人能帮我吗?谢谢。
编辑
将以下文章添加到References.bib
文件中会出现我在评论中提到的两个问题:
@article{bhj2017,
Archiveprefix = {arXiv},
Author = {Bunk, Don and Hubisz, Jay and Jain, Bithika},
Eprint = {1705.00001},
Primaryclass = {hep-ph},
Title = {{A Perturbative RS I Cosmological Phase Transition}}}
答案1
假设你只想在 arXiv 中使用括号中的 eprint 字段,你需要
\documentclass[letterpaper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[style=phys, articletitle=true, biblabel=brackets,%
chaptertitle=false, pageranges=false, eprint=true, backend=biber,%
natbib=true, maxbibnames=10, giveninits=true, sorting=none]{biblatex}
\DeclareFieldFormat[article]{journaltitle}{\mkbibitalic{#1\isdot}}% I'd even use \mkbibemph
\renewcommand*{\finalnamedelim}{\addcomma\space}
\urlstyle{same}
\makeatletter
\newrobustcmd{\mkbibfixedbrackets}[1]{%
\begingroup
\blx@blxinit
\blx@setsfcodes
\bibleftbracket#1\bibrightbracket
\endgroup}
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:doi}
{\printfield{doi}}
{}%
\ifboolexpr{test {\iffieldequalstr{eprinttype}{arxiv}} or test {\iffieldequalstr{eprinttype}{arXiv}}}
{\setunit{\addspace}\newblock}
{\newunit\newblock}%
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}}
\usepackage{xpatch}
\xpatchbibdriver{online}
{\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}}
{\ifboolexpr{test {\iffieldequalstr{eprinttype}{arxiv}} or test {\iffieldequalstr{eprinttype}{arXiv}}}
{\setunit{\addspace}\newblock}
{\newunit\newblock}%
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}}
{}{}
\DeclareFieldFormat{eprint:arxiv}{%
\mkbibbrackets{%
\ifhyperref
{\href{http://arxiv.org/\abx@arxivpath/#1}{%
arXiv\addcolon
\nolinkurl{#1}%
\iffieldundef{eprintclass}
{}
{\addspace\UrlFont{\mkbibfixedbrackets{\thefield{eprintclass}}}}}}
{arXiv\addcolon
\nolinkurl{#1}%
\iffieldundef{eprintclass}
{}
{\addspace\UrlFont{\mkbibfixedbrackets{\thefield{eprintclass}}}}}}}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{itzhaki,baez/article}
\printbibliography
\end{document}
N.伊扎基,关于 't Hooft 黑洞 S 矩阵的一些注记,版本 1,(1996 年 3 月 11 日)[arXiv:hep-th/9603067]。
JC Baez、AD Lauda,“高维代数 V:2-群”,第 3 版,范畴理论及其应用 12,423 (2004) [arXiv:math/0307200v3]。
如果你想要eprint
括号中的所有 s,你只需要
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:doi}
{\printfield{doi}}
{}%
\setunit{\addspace}\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}}
\renewbibmacro*{eprint}{%
\iffieldundef{eprint}
{}
{\printtext[brackets]{%
\iffieldundef{eprinttype}
{\printfield{eprint}}
{\printfield[eprint:\strfield{eprinttype}]{eprint}}}}}
biblatex
但目前在和中有一个小错误biblatex-phys
,导致此处出现不必要的空格。这两个问题都已得到解决(plk/biblatex@36a0833
和josephwright/biblatex-phys@e8a8410
),修复内容将包含在这两个软件包的后续版本中。