BibLaTeX – Labelprefix to Newrefcontext Replacing Prefixnumbers for Printbibliography Not Working in BibLaTeX?

biblatexbibtex

After updating biblatex of MikTex 2.9 I get the following error message when using:

\printbibliography[prenote=conference, keyword=C, prefixnumbers={C}]

Package biblatex Warning: prefixnumbers option to \printbibliography
is no longer supported, use 'labelprefix' option to \newrefcontext.

However, when I use instead:

%...
\newrefcontext[labelprefix=C]
\printbibliography[prenote=conference, keyword=C]

I get the following error message (line 17 being the \printbibliography…):

LaTeX Warning: Empty bibliography on input line 17.

Here is a complete minimal working example with both variants (one is commented out):

\documentclass[11pt, a4paper, twoside, cleardoublepage=plain, openright]{scrbook}

\usepackage{filecontents}
\begin{filecontents}{references.bib}
  @inproceedings{test-conference,
    author = {Test Author 1},
    title = {Test Title 1},
    booktitle = {Test Booktitle 1},
    year = {2016},
    keywords = {C}
  }
  @inproceedings{test-workshop,
    author = {Test Author 2},
    title = {Test Title 2},
    booktitle = {Test Booktitle 2},
    year = {2016},
    keywords = {W}
  }
\end{filecontents}

\usepackage[style=ieee, backend=bibtex, bibencoding=ascii, defernumbers=true, maxnames=10]{biblatex}
\addbibresource{references.bib}


\begin{document}

  Conference paper: \cite{test-conference}
  Workshop paper: \cite{test-workshop}.

  \defbibnote{conference}{Conference Papers}
  \defbibnote{workshop}{Workshop Papers}


  % #### Variant 1 ####
  % ## Producing error: Package biblatex Warning: prefixnumbers option to \printbibliography is no longer supported, use 'labelprefix' option to \newrefcontext.
  % ## Generating output with bibliography but without C or W as prefix.
  \printbibliography[prenote=conference, keyword=C, prefixnumbers={C}]
  \printbibliography[prenote=workshop, keyword=W, prefixnumbers={W}]

  % #### Variant 2 ####
  % ## Producing error: LaTeX Warning: Empty bibliography on input line ...
  % ## Generating output completely without bibliography.
  % \newrefcontext[labelprefix=C]
  % \printbibliography[prenote=conference, keyword=C] 
  % \newrefcontext[labelprefix=W]
  % \printbibliography[prenote=workshop, keyword=W] 

\end{document}

What am I missing?

UPDATE: Thanks to Guido's advise, it (almost) works after I changed the backend option to biber as shown below. I now get the bibliographies with the prefixes as desired. However, in the document where I cite the references, I get [0] instead of [C1] or [W1], respectively. Interestingly, there is no error message or warning from pdflatex during compilation.

\usepackage[style=ieee, backend=biber, bibencoding=ascii, defernumbers=true, maxnames=10]{biblatex}
\addbibresource{references.bib}

\begin{document}

  Conference paper: \cite{test-conference} should be [C1] but is [0].
  Workshop paper: \cite{test-workshop} should be [W1] but is [0].

  \defbibnote{conference}{Conference Papers}
  \defbibnote{workshop}{Workshop Papers}

  \newrefcontext[labelprefix=C]
  \printbibliography[prenote=conference, keyword=C] 
  \newrefcontext[labelprefix=W]
  \printbibliography[prenote=workshop, keyword=W] 

\end{document}

enter image description here

What's causing this?

Best Answer

The MWE

\documentclass{article}

\usepackage[style=ieee, backend=biber, defernumbers=true, maxnames=10]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{test-conference,
  author    = {Test Author 1},
  title     = {Test Title 1},
  booktitle = {Test Booktitle 1},
  year      = {2016},
  keywords  = {C},
}
@inproceedings{test-workshop,
  author    = {Test Author 2},
  title     = {Test Title 2},
  booktitle = {Test Booktitle 2},
  year      = {2016},
  keywords  = {W},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Conference paper: \cite{test-conference}
Workshop paper: \cite{test-workshop}.

\defbibnote{conference}{Conference Papers}
\defbibnote{workshop}{Workshop Papers}

\newrefcontext[labelprefix=C]
\printbibliography[prenote=conference, keyword=C] 
\newrefcontext[labelprefix=W]
\printbibliography[prenote=workshop, keyword=W] 
\end{document}

produces the desired and expected output

Conference paper: [C1] Workshop paper: [W1].

But you will have to use Biber instead of BibTeX, because only Biber supports labelprefix properly. (Starting with biblatex 3.13 a rudimentary version of labelprefix is supported even with the BibTeX backend, but there are some differences to the proper/full implementation available with Biber, see https://github.com/plk/biblatex/issues/852. In general you can only use all of biblatex's features with Biber, so it is a very good idea to switch to Biber anyway.)

Since this MWE needs to use defernumbers it may happen that the citation numbers get stuck at "[0]" or in a different unwanted numbering. In those cases it helps to remove the temporary files (.aux, .bbl, .bcf, ...) and recompile from scratch.


In very specific situations you may have to have to make sure that the entries belong to the correct refsection even in the citations. Usually this should not be needed, though.

Then you would use \assignrefcontextkeyws to make sure the citations get it right. See ยง3.7.10 Reference Contexts of the biblatex documentation, especially pp. 94-99.