3

I am using the nameaddon field to include death dates of certain authors in my bibliography (biblatex-chicago with Biber backend). Thanks to @moewe I am using \AtEveryCitekey{\clearfield{nameaddon}} to suppress this information in the footnotes. As a follow on question:

If my bibliography contains multiple works from the same author, the nameaddon information is repeated for each of his works in the bibliography. I only need the nameaddon info in the first entry.

Related to this, is there a way to change the standard square brackets in the bibliography to parentheses?

\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}
JohnW
  • 83

1 Answers1

2

We can use an approach similar to the dashing macro

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

We then only need to make the drivers use that macro, because we have a bare \printfield{nameaddon} in the drivers, we need to patch all drivers manually with xpatch.

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

And then for each entry type you want to use this

\patchnameaddon{book}

MWE

\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}

enter image description here

moewe
  • 175,683