对于大学,我必须使用特定的格式来参考:
(1)如果只有两位作者,我必须在他们之间写上“和”(我明白了),
(2)但如果有三位或更多作者,我只需在第一和第二作者之间写一个逗号。
我已经为此准备了 MWE,但它不包括第二条规则:
\documentclass[a4paper,10pt]{article}
\usepackage[ansinew]{inputenc}
\usepackage{csquotes}
\usepackage[style=authoryear,
sorting=nyt,
natbib=true,
giveninits=true, %to shorten the first names
maxcitenames=2, %I use these two options to produce the short form with 'et al' for citations with 3 or more authors
mincitenames=1 %see above
]{biblatex}
\begin{filecontents}{references.bib}
@article{AB.2022,
title = {Test Title},
volume = {128},
journaltitle = {Journal ab},
author = {AuthorA, A. and AuthorB, B.},
date = {2022},
pages = {62--69},}
@article{C+.2022,
title = {Another Test Title},
volume = {182},
journaltitle = {Journal cde},
author = {AuthorC, C. and AuthorD, D. and AuthorE, E.},
date = {2022},
pages = {58--93},}
\end{filecontents}
\addbibresource{references.bib}
\DeclareNameAlias{sortname}{family-given} %order of sirname and first name in the bibliography
\begin{document}
First citation \parencite{AB.2022}.
And second citation \parencite{C+.2022}.
\printbibliography
\end{document}
我最终得到这个:
作者A,A.和作者 B,B. (2022)。“测试标题”。在:期刊 ab 128,第 62-69 页。
作者C, C., 作者D, D.,和作者 E,E. (2022)。“另一个测试标题”。在:期刊 cde 182,第 58-93 页。
我需要第一个“and”(斜体),但我不想要第二个“and”(粗体),就像这样:
AuthorC, C.、AuthorD, D.、AuthorE, E. (2022)。“另一个测试标题”。在:期刊 cde 182,第 58-93 页。
您认为这可能吗?我已经搜索过解决方案,但没有找到任何有用的方法。我知道有类似的东西,
\DeclareDelimFormat[bib]{finalnamedelim}{\space\&\space}
但这意味着您将两个引用的“and”更改为您想要的任何内容。我只是希望如果有三位或更多作者,它会改变。
我希望你能帮助我,所以我提前感谢你!
答案1
你的方向非常正确。事实上,如果你看一下格式的默认定义finalnamedelim
,你会发现它已经区分了列表中最多有两个名称和有更多名称的情况,这是为了处理连续逗号。因此,调整默认定义以达到你想要的效果非常简单:
\documentclass[a4paper,10pt]{article}
\usepackage[ansinew]{inputenc}
\usepackage{csquotes}
\usepackage[style=authoryear,
sorting=nyt,
natbib=true,
giveninits=true, %to shorten the first names
maxcitenames=2, %I use these two options to produce the short form with 'et al' for citations with 3 or more authors
mincitenames=1 %see above
]{biblatex}
\begin{filecontents}{references.bib}
@article{AB.2022,
title = {Test Title},
volume = {128},
journaltitle = {Journal ab},
author = {AuthorA, A. and AuthorB, B.},
date = {2022},
pages = {62--69},}
@article{C+.2022,
title = {Another Test Title},
volume = {182},
journaltitle = {Journal cde},
author = {AuthorC, C. and AuthorD, D. and AuthorE, E.},
date = {2022},
pages = {58--93},}
\end{filecontents}
\addbibresource{references.bib}
\DeclareNameAlias{sortname}{family-given} %order of sirname and first name in the bibliography
\DeclareDelimFormat{finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{%
\printdelim{multinamedelim}}{\addspace\bibstring{and}\space}}
\begin{document}
First citation \parencite{AB.2022}.
And second citation \parencite{C+.2022}.
\printbibliography
\end{document}