biblatex 不会省略重复作者的 shortauthor

biblatex 不会省略重复作者的 shortauthor

我在 biblatex authoryear 中添加了对 shortauthors 的支持。当一个作者有多个条目时,authorname 会被省略,但 shortauthor 不会。我该如何解决这个问题? 例子

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{filecontents}{filename.bib} 
@Electronic{ilo2015,
  Title                    = {World Employment and Social Outlook},
  Author                   = {{Internationale Arbeitsorganisation}},
  Shortauthor              = {ILO},
}
@Electronic{ilo2013,
  Title                    = {Beschaftigung, Wachstum und soziale Gerechtigkeit. Bericht des Generaldirektors.},
  Author                   = {{Internationale Arbeitsorganisation}},
  Shortauthor              = {ILO},
}
\end{filecontents}
\usepackage[backend=biber, style=authoryear]{biblatex}

% Show shortauthor
\renewbibmacro*{begentry}{%
    \ifnameundef{shortauthor}
        {}
        {\printnames{shortauthor}%
         \addspace\textendash\space}}

\addbibresource{filename.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

答案1

在阅读 biblatex-authoryear 的来源后,我发现这\usebibmacro{bbx:dashcheck}就是解决方案

\renewbibmacro*{begentry}{%
  \ifnameundef{shortauthor}
  {}
  {\usebibmacro{bbx:dashcheck}{}
    {\printnames{shortauthor}%
    \addspace\textendash\space}}
}

相关内容