I am writing my thesis in LaTeX with Biblatex. I made the stupid decision to update Biblatex just before finsihing, and now I have a problem with the bibliography with the new 'context logic' in Biblatex, replacing the previous method to make bibliographies and citations with pre-labels.
I have multiple bibliographies in my thesis, one for references (unlabeled), and two others for my publications (labeled with T and A). Previously, I used prefixnumbers with printbibliography to put different labels to different bibliographies, but with the new Biblatex it is deprecated, and labelprefix should be used with \newrefcontext.
I tried to modify my LaTeX source according to this simple solution: labelprefix to newrefcontext replacing prefixnumbers to printbibliography not working
The problem is that I have text both before and after the bibliographies. If I just do it like in the linked example, the citations of references from the first bibliography are labeled incorrectly after the bibliographies (the labels of the citations from the first bibliography appear all as 'A0'). If I put \endrefcontext after the last bibliography, then everything except the references from the global context (first bibliography) are labelled incorrectly (all appear as '0' in the whole text).
An MWE:
\documentclass[]{report}
\usepackage{filecontents}
\usepackage{hyperref}
\begin{filecontents}{refs.bib}
@article{r1,
title={r-title1},
author={authors1},
}
@article{r2,
title={r-title2},
author={authors2},
}
\end{filecontents}
\begin{filecontents}{thesis.bib}
@article{t1,
title={t-title1},
author={authors1},
}
@article{t2,
title={t-title2},
author={authors2},
}
\end{filecontents}
\begin{filecontents}{articles.bib}
@article{a1,
title={a-title1},
author={authors1},
}
@article{a2,
title={a-title2},
author={authors2},
}
\end{filecontents}
\usepackage[
style=numeric-comp,
backend=biber,
defernumbers=true,
]{biblatex}
\addbibresource{refs.bib}
\addbibresource{thesis.bib}
\addbibresource{articles.bib}
\DeclareBibliographyCategory{thesis}
\DeclareBibliographyCategory{articles}
\addtocategory{thesis}{t1,t2}
\addtocategory{articles}{a1,a2}
\begin{document}
%\assignrefcontextcats[labelprefix=T]{thesis}
%\assignrefcontextcats[labelprefix=A]{articles}
Some text. \cite{r1,r2,t1,t2,a1,a2}
\printbibliography[notcategory=thesis, notcategory=articles, title=References]
\newrefcontext[labelprefix=T]
\printbibliography[category=thesis,title={Publications related to the thesis}]
\newrefcontext[labelprefix=A]
\printbibliography[category=articles,title={Other publications}]
\endrefcontext
Some text. \cite{r1,r2,t1,t2,a1,a2}
\end{document}
With the above I get
Some text. [0, 1, 0, 2, 0]
both before and after bibliographies. By uncommenting the lines with \assignrefcontextcats I can override the default context, and get
Some text. [A1, 1, T1, A2, 2, T2]
Which at least gives good labels, but the ordering is messed up.
Previously with prefixnumbers it worked perfectly, every citation label was correct in all the text, before or after bibliographies. How to do this with the new Biblatex? Thanks!
labelprefixandcitestyle=numeric-comp(from memory if you just usecitestyle=numericit will work). Found the bug report, does this describe the same problem? https://github.com/plk/biblatex/issues/442 – Dai Bowen Sep 10 '16 at 21:37biblatex3.5 there is a new scheme to assign refcontexts to certain entries dynamically within the document. But in order to test if that works for you, we really need to see a short MWE. – moewe Sep 11 '16 at 05:42style=numericthere is no issue. According to the state of teh bug report, this should be fixed in the most recent version. I just need to check if I can updatebiblatexandbiber. Thanks! – Balazs Sep 11 '16 at 09:37biblatex3.5/Biber 2.6 (available now in both MikTeX and TeX live) your MWE looks just fine, so I suppose your problem should be fixed with an update. – moewe Sep 11 '16 at 10:02biblatexpackage that has been resolved, an update fixed the problem. – moewe Sep 11 '16 at 10:24