# Biblatex: Filter out cloned entry from bibliography iff source entry also appears

In my custom biblatex style, I have some bibliography entries that use the related field in such a way that the related entry should appear in the bibliography. This is achieved by setting relatedoptions = {dataonly,skipbib=false}.

It is also possible for the related entry to be cited directly in the same document.

In this case, the entry will appear twice in the bibliography: once for the actual entry and once for the cloned entry created by the related field.

How can I filter out one of these duplicate entries without the end-user having to worry about what they cite and make manual adjustments?

In the following MWE, the list of references in both sections should be the same (matching the Cite b only list of references):

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{a,
author = {Name, A. N.},
title = {A Book}
}
@book{b,
author = {Name, Another},
title = {A Different Book},
related = {a},
relatedstring = {Related Book:},
relatedoptions = {dataonly,skipbib=false}
}
\end{filecontents}
\usepackage[style=verbose]{biblatex}
\usepackage{parskip}
\begin{document}
\section*{Cite a and b}
\cite{a}\par\cite{b}
\printbibliography
\vspace{1cm}
\section*{Cite b only}
\newrefsection
\cite{b}
\printbibliography
\end{document}


I consider this a biber bug which is fixed in 2.6 DEV (which I can't currently upload but will update here when done). I think skipbib/skipbiblist should always be forced on a related clone if a related clone is also directly cited.

• PLK, you're a champ! I've never known a developer to be so willing and quick to add features and fix things. Works perfectly with my MWE above. – David Purton May 18 '16 at 13:00
• Actually, this has introduced a regression. I'll open an issue on github. – David Purton May 18 '16 at 13:51
• – David Purton May 18 '16 at 14:05
• Please try now, also 2.6 DEV binaries are uploaded with the fix. Regression tests are in place for this too now. – PLK May 18 '16 at 18:03

Sigh. Always answering my own questions.

Here's a way that works. I can use \defbibcheck to check cloned entries against real entries. It's easy to make this check happen by default by redefining \printbibliography. It needs something similar to work with the list of shorthands.

Any better suggestions?

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{a,
author = {Name, A. N.},
title = {A Book}
}
@book{b,
author = {Name, Another},
title = {A Different Book},
related = {a},
relatedstring = {Related Book:},
relatedoptions = {dataonly,skipbib=false}
}
\end{filecontents}
\usepackage[style=verbose]{biblatex}
\usepackage{parskip}
\pagestyle{empty}
\defbibcheck{uniqueclones}{%
\iffieldundef{clonesourcekey}
{\ifcsdef{sbl@entrykey@\therefsection\strfield{entrykey}}
{\skipentry}
{\savefieldcs{entrykey}{sbl@entrykey@\therefsection\strfield{entrykey}}}}
{\ifcsdef{sbl@entrykey@\therefsection\strfield{clonesourcekey}}
{\skipentry}
{\savefieldcs{clonesourcekey}{sbl@entrykey@\therefsection\strfield{clonesourcekey}}}}}
\begin{document}
\section*{Cite a and b}
\cite{a}\par\cite{b}
\printbibliography[check=uniqueclones]
\vspace{1cm}
\section*{Cite b only}
\newrefsection
\cite{b}
\printbibliography[check=uniqueclones]
\end{document}

• "Sigh. Always answering my own questions." Sure, but without the question there just would be no answer :-) I have experienced this myself a couple of times: Stating the question, carefully crafting the MWE, and so on appears to start some background process in your brain that – sometimes – brings up the answer. Thanks for sharing it with us! – Daniel May 18 '16 at 8:42