1

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!

closed as off-topic by moewe, Johannes_B, Jesse, Heiko Oberdiek, Andrew Sep 11 '16 at 12:19

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Probably need an MWE but I think there's some bug with using labelprefix and citestyle=numeric-comp (from memory if you just use citestyle=numeric it will work). Found the bug report, does this describe the same problem? github.com/plk/biblatex/issues/442 – Dai Bowen Sep 10 '16 at 21:37
  • With the new biblatex 3.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 5:42
  • 1
    With biblatex 3.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:02
  • 1
    Yes, the update solved the isssue. I see that the new packaging of MikTex just came out yesterday, and I did my update leading to the error yesterday morning. So it was just "perfect" timing... No, the ordering does not really matter in the real thesis. Many thanks for your help moewe! – Balazs Sep 11 '16 at 10:19
  • 4
    I'm voting to close this question as off-topic because it was about a bug in the biblatex package that has been resolved, an update fixed the problem. – moewe Sep 11 '16 at 10:24

Browse other questions tagged or ask your own question.