6

I'd like to have two lists of references in my document. However, I want each reference to appear only once in the entire document.

\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\bibliography{foo}
\begin{document}
\begin{refsection}

\section{Previous Track Record}
I am an acknowledged authority on aardvarks \cite{mynature}.
\printbibliography[prefixnumbers=A,heading=subbibliography]
\end{refsection}

\section{Research}

\begin{refsection}
I will use the methods developed in \cite{mynature} to address
the questions raised in \cite{other}.
\printbibliography[heading=subbibliography]
\end{refsection}    
\end{document}

Here are the contents of foo.bib:

@article{mynature,
author={Ego Sum},
journal={Nature Soundbites},
title={Aardvarks are artistic},
year={2013}
}

@article{other,
author={Tu Es},
journal={Gnu Letters},
title={Gnus gnaw gnomes},
year={2014}
}

In the two bibliographies, I only want the paper in Nature Soundbites to appear once, and be cited in both places as [A1].

Any suggestions welcome!

5

You cannot use refsection here, because the contents of refsections are kept completely separate and independent of each other, "synchronising" labels between them is therefore not possible.

Here we can use refsegments instead, they are not kept local, but work together.

A \printbibliography does not automatically restrict itself to the current refsegment, it needs to be told to do so with segment=\therefsegment, for example. Your first section then looks like this

\begin{refsegment}
\defbibfilter{notother}{not segment=\therefsegment}
\section{Previous Track Record}
I am an acknowledged authority on aardvarks \cite{sigfridsson}.
\printbibliography[prefixnumbers=A,heading=subbibliography,segment=\therefsegment]
\end{refsegment}

For the second section, we want to ignore those entries from the other segment, this can be done via a filter

\defbibfilter{notother}{not segment=\therefsegment}

issued in the first segment.

Then the second section becomes

\begin{refsegment}
\section{Research}
I will use the methods developed in \cite{sigfridsson} to address
the questions raised in \cite{geer}.
\printbibliography[heading=subbibliography,segment=\therefsegment,filter=notother]
\end{refsegment}  

Or use \printbibliography[heading=subbibliography, filter=notother] which only ignores the entries from segment one (and does not additionally restrict itself to the current segment - with your set-up there is no difference, but with a bigger document there could be).

MWE

\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}
\begin{refsegment}
\defbibfilter{notother}{not segment=\therefsegment}
\section{Previous Track Record}
I am an acknowledged authority on aardvarks \cite{sigfridsson}.
\printbibliography[prefixnumbers=A,heading=subbibliography,segment=\therefsegment]
\end{refsegment}

\begin{refsegment}
\section{Research}
I will use the methods developed in \cite{sigfridsson} to address
the questions raised in \cite{geer}.
\printbibliography[heading=subbibliography,segment=\therefsegment,filter=notother]
\end{refsegment}    
\end{document}

example output

You can let the numbering in the second list start anew by adding resetnumbers=true to the \printbibliography call.


Another solution that does not require you to know the number of the segment in advance uses bibliography categories and a modification of \AtEveryCitekey that is kept local.

\makeatletter
\newrobustcmd*{\AtEveryCitekeyLocal}{\appto\blx@hook@citekey}
\makeatother

and

\DeclareBibliographyCategory{firstsection}

Then we use \AtEveryCitekeyLocal{\addtocategory{firstsection}{\thefield{entrykey}}} from within the first segment. This assignment is kept local such that only citations within this group (i.e. within this refsegment) get added to the category.

\begin{refsegment}
\section{Previous Track Record}
\AtEveryCitekeyLocal{\addtocategory{firstsection}{\thefield{entrykey}}}
I am an acknowledged authority on aardvarks \cite{sigfridsson}.
\printbibliography[prefixnumbers=A,heading=subbibliography,segment=\therefsegment]
\end{refsegment}

The second segment bibliography simply needs to filter those works with notcategory=firstsection

MWE

\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareBibliographyCategory{firstsection}
\makeatletter
\newrobustcmd*{\AtEveryCitekeyLocal}{\appto\blx@hook@citekey}
\makeatother

\begin{document}
\begin{refsegment}
\section{Previous Track Record}
\AtEveryCitekeyLocal{\addtocategory{firstsection}{\thefield{entrykey}}}
I am an acknowledged authority on aardvarks \cite{sigfridsson}.
\printbibliography[prefixnumbers=A,heading=subbibliography,segment=\therefsegment]
\end{refsegment}

\begin{refsegment}
\section{Research}
I will use the methods developed in \cite{sigfridsson} to address
the questions raised in \cite{geer}.
\printbibliography[heading=subbibliography,segment=\therefsegment,notcategory=firstsection]
\end{refsegment}    
\end{document}
  • Credits go to PLK for telling me how to use \defbibfilter more effectively (here). – moewe Oct 21 '15 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.