仅为编辑器启用 biblatex 中的“firstinits”

仅为编辑器启用 biblatex 中的“firstinits”

biblatex有一个选项firstinits,可以在参考书目中缩写名字和中间名。有没有办法将此行为editor仅限于该字段,以便它不会缩写author字段中的名字?

在下面的例子中,作者应该显示为Lennon, John,但编辑应该显示为P. McCartney, J. Lennon, G. Harrison, and R. Starkey

\documentclass{article}
\usepackage[style = authoryear-comp, maxnames = 99]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{lennon1965,
    AUTHOR = "John Lennon",
    BOOKTITLE = "A book with articles",
    EDITOR = "Paul McCartney and John Lennon and George Harrison and Richard Starkey",
    TITLE = "This is my article in this book",
    YEAR = "1965",
    LOCATION = "Liverpool",
    PAGES = "65--87",
    PUBLISHER = "Cavern Club"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

答案1

那里使用的名称格式是byeditor,所以只需使用

\DeclareNameAlias{byeditor}{first-last-inits}

\DeclareNameFormat{first-last-inits}{%
  \usebibmacro{name:first-last}{#1}{#4}{#5}{#7}%
  \usebibmacro{name:andothers}}

平均能量损失

\documentclass{article}
\usepackage[style = authoryear-comp, maxnames = 99]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{lennon1965,
    AUTHOR = "John Lennon",
    BOOKTITLE = "A book with articles",
    EDITOR = "Paul McCartney and John Lennon and George Harrison and Richard Starkey",
    TITLE = "This is my article in this book",
    YEAR = "1965",
    LOCATION = "Liverpool",
    PAGES = "65--87",
    PUBLISHER = "Cavern Club"}
\end{filecontents}
\addbibresource{\jobname.bib}

\DeclareNameAlias{byeditor}{first-last-inits}

\DeclareNameFormat{first-last-inits}{%
  \usebibmacro{name:first-last}{#1}{#4}{#5}{#7}%
  \usebibmacro{name:andothers}}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

在此处输入图片描述

相关内容