![biblatex chem-acs:在页面和 doi 之间使用点而不是逗号](https://linux22.com/image/467943/biblatex%20chem-acs%EF%BC%9A%E5%9C%A8%E9%A1%B5%E9%9D%A2%E5%92%8C%20doi%20%E4%B9%8B%E9%97%B4%E4%BD%BF%E7%94%A8%E7%82%B9%E8%80%8C%E4%B8%8D%E6%98%AF%E9%80%97%E5%8F%B7.png)
我一直在使用这里的例子(biblatex chem-acs:包括发行号) 以获取 ACS 快速样式指南中的期刊文章引用。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=chem-acs, articletitle=true, doi=true]{biblatex}
\DeclareFieldFormat[article,periodical]{number}{\mkbibparens{#1}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\addspace}%
\printfield{number}%
\setunit*{\addspace}%
\printfield{eid}%
}
\begin{filecontents}{\jobname.bib}
@article{clusters,
author = {Johnathan P.K. Doyle and David J. Wales and Mark A. Miller},
title = {Thermodynamics and the Global Optimization of Lennard-Jones Clusters},
journal = {J. Chem. Phys.},
date = {1998},
volume = {109},
number = {19},
pages = {8143-8153},
doi = {10.1063/1.477477},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
Lorem \autocite{clusters}
\printbibliography
\end{document}
但我想在页面和 doi 之间用点代替逗号,并且我还想删除 doi 后的点:
如....8143-8153。DOI:10.1063/1.477477
我将非常感谢有关如何实现这一目标的任何建议!
答案1
你可以重新定义文献宏 doi+eprint+url
通过手动插入点和一个空间\printunit{\adddot\addspace}
在调用的命令前面加上多伊。在大多数情况下,这应该会覆盖您使用的样式的标准标点符号。此外,artcile
我还对进行了测试book
,如下所示。它插入了一个点在......面前多伊在两种情况下。
只需使用编辑后的 MWE 进行测试即可。对我来说,到目前为止,它有效:
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=chem-acs, articletitle=true, doi=true]{biblatex}
\DeclareFieldFormat[article,periodical]{number}{\mkbibparens{#1}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\addspace}%
\printfield{number}%
\setunit*{\addspace}%
\printfield{eid}%
}
\begin{filecontents}{\jobname.bib}
@article{clusters,
author = {Johnathan P.K. Doyle and David J. Wales and Mark A. Miller},
title = {Thermodynamics and the Global Optimization of Lennard-Jones Clusters},
journal = {J. Chem. Phys.},
date = {1998},
volume = {109},
number = {19},
pages = {8143-8153},
doi = {10.1063/1.477477},
}
@book{bernal2001,
author = {Bernal, Martin},
editor = {Moore, David Chioni},
publisher = {Duke University Press},
title = {Black Athena Writes Back},
year = {2001},
address = {New York},
subtitle = {Martin Bernal Responds to His Critics},
url = {https://www.wikipedia.org/},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:doi}
{\iffieldundef{doi}{}{\printunit{\adddot\addspace}}
\printfield{doi}
\ifboolexpr{ (not test {\iffieldundef{doi}}
and
test {\iffieldundef{eprint}}
and
test {\iffieldundef{url}}
and
test {\iffieldundef{addendum}}
and
test {\iffieldundef{pubstate}}
and
test {\iffieldundef{related}})
}{\nopunct}{}
}
{}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}}
\begin{document}
Lorem \autocite{clusters}
Lorem \autocite{bernal2001}
\printbibliography
\end{document}
编辑:
为了实现 OP 所要求的 DOI 后面没有点,我添加了一个doi+eprint+url
宏的新定义。使用两个或多或少复杂的布尔表达式它会测试字段是否doi
已定义,以及所有后续字段是否未定义。如果doi
已定义,它会在前面插入一个点而不是逗号,否则会保留它(更精确\newblockpunct
,这种样式会使用逗号)。此外,如果所有后续字段都未定义,它会在没有任何标点符号的情况下结束 bibentry。但如果字段跟在后面doi
(例如url
),它会保留在两个字段之间插入逗号的标准行为。
说实话,我不确定是否有更简单的代码解决方案。但我用包含不同字段变体的几个条目进行了测试,至少效果很好。