I'm trying to use biblatex to produce two different bibliographies. The first one should contains only my papers, sorted in order of appearance in the text, and with some special prefix. The second bibliography should contain the general references, sorted in some different order (say, name-title-year), and with no special prefix.
Notice that the two bibliographies DO NOT INTERSECT (i.e. they do not have common entries).
I use this MTW:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{ref.bib}
@ARTICLE{Pub1,
author = {A. R},
title = {My best paper},
year = {2013},
journal = C,
keywords = {publication}
}
@ARTICLE{Pub2,
author = {A. R},
title = {My second best paper},
year = {2013},
journal = C,
keywords = {publication}
}
@ARTICLE{Nopub1,
author = {A. R},
title = {Not my paper 1},
year = {2012},
journal = I,
keywords = {general}
}
@ARTICLE{Nopub2,
author = {A. R},
title = {Not my paper 2},
year = {2012},
journal = I,
keywords = {general}
}
\end{filecontents}
\usepackage[style=numeric, sorting=none, defernumbers=true, backend=biber]{biblatex}
\addbibresource{ref.bib}
\pagestyle{empty}
\begin{document}
This is my first publication : \cite{Pub1}
These are not my publications: \cite{Nopub1,Nopub2}
This is my second publication: \cite{Pub2}
\printbibliography[keyword=publication, prefixnumbers=R, title=My papers]
\begin{refcontext}[sorting=nty]
\printbibliography[notkeyword=publication, prefixnumbers=, title=Not my papers]
\end{refcontext}
\end{document}
OUTPUT (after pdflatex + biber + pdflatex + pdflatex):
Both bibliographies are printed correctly and well ordered, but text citations referring to the second bibliography are wrong (they are all [0]). I tried to check other related posts, but no one mentioned this specific problem.
Thanks!
Best Answer
I don't think that currently there is a good solution. But I will try to explain some background. In your example the wanted output looks obvious as your two bibliographies don't overlap. But this doesn't need to be the case. In different refcontexts entries can be repeated. So lets look what happens if you remove the filters:
As you can see every bibentry has two labels and biblatex has to choose which one to use. Sensibly it uses for the first block of cites the labels from the first (default) refcontext, and for the second block the labels from the second block.
This explains why you get zeros: In the first block the cites don't have a label and biblatex has no chance to guess that you want a label from another refcontext as fallback -- after all there could be more than one suitable label.
The label biblatex will use for a cite depends on the current value of
\blx@refcontext@sorting
. So you can locally force biblatex to use labels from another refcontext by doingThen you can get something like this:
But this solution wouldn't work for mixed cites like
\cite{Nopub1,pub1}
. And the "logical" solutiondoesn't work either as the code for refcontext is executed before \AtEveryCitekey can kick in. So probably you will have to make a feature request ...
Edit
You could try this. But be warned: It is a hack, and it is quite possible that it confuse biblatex. So test and check carefully with more data.