如何抑制 biblatex-chicago 书目中 \nameaddon 信息的重复?

如何抑制 biblatex-chicago 书目中 \nameaddon 信息的重复?

我正在使用该nameaddon字段将某些作者的死亡日期包含在我的参考书目中(biblatex-chicago 带有 Biber 后端)。感谢 @moewe,我正在使用\AtEveryCitekey{\clearfield{nameaddon}}该字段在脚注中隐藏此信息。作为后续问题:

如果我的书目包含同一作者的多部作品,则nameaddon书目中每部作品的信息都会重复。我只需要nameaddon第一条中的信息。

与此相关,有没有办法将参考书目中的标准方括号改为圆括号?

\documentclass{article}
\usepackage[notes,isbn=false,backend=biber]{biblatex-chicago}
\usepackage{filecontents} 
\begin{filecontents}{\jobname.bib}
@book{A01,
    author = {Author, A.},
    year = {2001},
    nameaddon = {d. 243/857--8},
    title = {Alpha},
}
@book{B02,
    author = {Author, A.},
    year = {2002},
    nameaddon = {d. 243/857--8},
    title = {Bravo},
}
@misc{C03,
    author = {Cuthor, C.},
    year = {2003},
    title = {Charlie},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}


Some text \autocite{A01}.

Some text \autocite{B02}.

Some text \autocite{B02}.

Some text \autocite{C03}.

\printbibliography

\end{document}

答案1

我们可以使用类似于 dashing 宏的方法

\makeatletter
\let\bbx@na@lasthash\undefined
\newbibmacro*{nameaddon}{%
  \iffieldequals{namehash}{\bbx@na@lasthash}
    {}
    {\printfield{nameaddon}}%
  \iffieldundef{nameaddon}
    {}  
    {\savefield{namehash}{\bbx@na@lasthash}}%
}
\makeatother

然后我们只需要让驱动程序使用该宏,因为我们的\printfield{nameaddon}驱动程序中有一个裸机,我们需要手动修补所有驱动程序xpatch

\newcommand*\patchnameaddon[1]{%
  \xpatchbibdriver{#1}
    {\printfield{nameaddon}}
    {\usebibmacro{nameaddon}}
    {}{\typeout{biblatex warning: failed to patch nameaddon in driver #1}}}

然后对于每个要使用的条目类型

\patchnameaddon{book}

平均能量损失

\documentclass{article}
\usepackage[notes,isbn=false,backend=biber]{biblatex-chicago}
\usepackage{filecontents} 
\begin{filecontents}{\jobname.bib}
@book{A01,
    author = {Author, A.},
    year = {2001},
    nameaddon = {d. 243/857--8},
    title = {Alpha},
}
@book{B02,
    author = {Author, A.},
    year = {2002},
    nameaddon = {d. 243/857--8},
    title = {Bravo},
}
@misc{C03,
    author = {Cuthor, C.},
    year = {2003},
    title = {Charlie},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\usepackage{xpatch}

\newcommand*\patchnameaddon[1]{%
  \xpatchbibdriver{#1}
    {\printfield{nameaddon}}
    {\usebibmacro{nameaddon}}
    {}{\typeout{biblatex warning: failed to patch nameaddon in driver #1}}}

\makeatletter
\let\bbx@na@lasthash\undefined
\newbibmacro*{nameaddon}{%
  \iffieldequals{namehash}{\bbx@na@lasthash}
    {}
    {\printfield{nameaddon}}%
  \iffieldundef{nameaddon}
    {}  
    {\savefield{namehash}{\bbx@na@lasthash}}%
}
\makeatother

\patchnameaddon{book}

\begin{document}
Some text \autocite{A01}.

Some text \autocite{B02}.

Some text \autocite{B02}.

Some text \autocite{C03}.

\printbibliography
\end{document}

在此处输入图片描述

相关内容