![如何抑制 biblatex-chicago 书目中 \nameaddon 信息的重复?](https://linux22.com/image/311336/%E5%A6%82%E4%BD%95%E6%8A%91%E5%88%B6%20biblatex-chicago%20%E4%B9%A6%E7%9B%AE%E4%B8%AD%20%5Cnameaddon%20%E4%BF%A1%E6%81%AF%E7%9A%84%E9%87%8D%E5%A4%8D%EF%BC%9F.png)
我正在使用该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}