3

I have a "master file" called subfile_biber.tex, as follows:

\documentclass{book}

\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{subfiles}

\usepackage[backend=biber,
            hyperref=false,
            url=false,
            isbn=false,
            backref=false,
            style=numeric,
            defernumbers=true,
            citereset=chapter,
            maxcitenames=9,
            maxbibnames=100]{biblatex}

\bibliography{biblatex-examples}

\DeclareBibliographyCategory{mypapers}
\addtocategory{mypapers}{westfahl:space, set}

\begin{document}

\subfile{bibhere}
\subfile{nobibhere}

\end{document}

In particular, the master file is including two subfiles, namely bibhere.tex and nobibhere.tex. The idea is that a bibliography is printed in bibhere.tex, while there are some citing commands from nobibhere.tex. The files are as follows:

\documentclass[subfile_biber.tex]{subfiles}

\begin{document}

All good papers are here.

%\printbibliography % OK

% ... but not OK?!
\begin{refcontext}[sorting=none]
\printbibliography[category=mypapers,heading=none]
\end{refcontext}

\end{document}

Finally, nobibhere.tex:

\documentclass[subfile_biber.tex]{subfiles}

\begin{document}

How about~\cite{westfahl:space},~\cite{set} or even~\cite{nokeylikethis}.

\end{document}

I've actually highlighted by comments the problem apparently arising from the use of a category in bibhere.tex. If I use the print out the bibliography defined by the category mypapers, the cite commands ends up producing [0] and [0]. However, if I comment out the refcontext block and instead just do \printbibliography, the output looks fine. (In particular, the output is then [2] and [1], as expected).

I do however wish to use a category. How could this be fixed?

  • 1
    It works for me. What you have to do is to use the following workflow: pdflatex, biber, pdflatex, pdflatex. Alterntively, you can remove the defernumbers option. – Guido Jun 25 '16 at 9:52
  • Your MWE seems to do the right thing when I just tested it. (That is I didn't get any "[0]"s.) I ran LaTeX, Biber, LaTeX, LaTeX. – moewe Jun 26 '16 at 11:29
2
+50

You did not mention which TeX distribution and version number you use.

Based on your given code I prepared the following MWE (using package filecontents to include all subfiles and the main tex code into one compilable MWE). There I added the input encoding with \usepackage[utf8]{inputenc} and changed the filenames to have documented in the file names which files belongs to this code.

I guess, you have a problem with your TeX distribution, probably it is a little bit outdated. Therefore I added command \listfiles to get a complete list of used class and packages including version numbers. Please compare the list below with your resulting list on your computer. I'm sure there are differences! BTW: I'm compiling with an current MiKTeX 2.9, exactly: pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2016.5.24)

The MWE:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname-bib.tex}
\documentclass[\jobname.tex]{subfiles}
\begin{document}

All good papers are here.

%\printbibliography % OK

% ... but not OK?!
\begin{refcontext}[sorting=none]
\printbibliography[category=mypapers,heading=none]
\end{refcontext}
End of file withbibliography. 
\end{document}
\end{filecontents*}

\begin{filecontents*}{\jobname-nobib.tex}
\documentclass[\jobname.tex]{subfiles}
\begin{document}
Start of citing:

How about~\cite{westfahl:space},~\cite{set} or even~\cite{nokeylikethis}.

End of file without bib file.
\end{document}
\end{filecontents*}


\listfiles
\documentclass{book}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{subfiles}

\usepackage{csquotes}
\usepackage[%
  backend=biber,
  hyperref=false,
  url=false,
  isbn=false,
  backref=false,
  style=numeric,
  defernumbers=true,
  citereset=chapter,
  maxcitenames=9,
  maxbibnames=100
]{biblatex}
\bibliography{biblatex-examples}

\DeclareBibliographyCategory{mypapers}
\addtocategory{mypapers}{westfahl:space, set}


\begin{document}

\subfile{\jobname-bib}

\subfile{\jobname-nobib}

\end{document}

gives the following resulting PDF:

enter image description here

with the following list of packages and version numbers used to compile:

 *File List*
filecontents.sty    2011/10/08 v1.3 Create an external file from within a LaTeX document
    book.cls    2014/09/29 v1.4h Standard LaTeX document class
    bk10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
inputenc.sty    2015/03/17 v1.2c Input encoding file
    utf8.def    2016/02/28 v1.1s UTF-8 support for inputenc
   t1enc.dfu    2016/02/28 v1.1s UTF-8 support for inputenc
  ot1enc.dfu    2016/02/28 v1.1s UTF-8 support for inputenc
  omsenc.dfu    2016/02/28 v1.1s UTF-8 support for inputenc
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
   babel.sty    2016/04/23 3.9r The Babel package
 bblopts.cfg    2005/09/08 v0.1 add Arabic and Farsi to "declared" options of babel
 english.ldf    2012/08/20 v3.3p English support from the babel system
subfiles.sty    2012/05/23 Federico Garcia
verbatim.sty    2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
csquotes.sty    2016/01/31 v5.1g context-sensitive quotations (JAW)
etoolbox.sty    2015/08/02 v2.2a e-TeX tools for LaTeX (JAW)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
csquotes.def    2016/01/31 v5.1g csquotes generic definitions (JAW)
csquotes.cfg    
biblatex.sty    2016/05/14 v3.4 programmable bibliographies (PK/JW/AB)
   iftex.sty    2013/04/04 v0.2 Provides if(tex) conditional for PDFTeX, XeTeX, and LuaTeX
pdftexcmds.sty    2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
   ifpdf.sty    2016/05/14 v3.1 Provides the ifpdf switch
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
  logreq.sty    2010/08/04 v1.0 xml request logger
  logreq.def    2010/08/04 v1.0 logreq spec v1.0
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 xstring.sty    2013/10/13  v1.7c  String manipulations (C Tellechea)
  blx-dm.def
 numeric.dbx
biblatex-dm.cfg
blx-compat.def    2016/05/14 v3.4 biblatex compatibility (PK/JW/AB)
biblatex.def    2016/05/14 v3.4 biblatex compatibility (PK/JW/AB)
standard.bbx    2016/05/14 v3.4 biblatex bibliography style (PK/JW/AB)
 numeric.bbx    2016/05/14 v3.4 biblatex bibliography style (PK/JW/AB)
 numeric.cbx    2016/05/14 v3.4 biblatex citation style (PK/JW/AB)
biblatex.cfg    
 english.lbx    2016/05/14 v3.4 biblatex localization (PK/JW/AB)
  316156.bbl
316156-bib.tex
316156-nobib.tex
 ***********

The resulting blg biber log file is:

[0] Config.pm:343> INFO - This is Biber 2.5
[0] Config.pm:346> INFO - Logfile is '316156.blg'
[43] biber-MSWIN64:290> INFO - === 
[72] Biber.pm:351> INFO - Reading '316156.bcf'
[180] Biber.pm:776> INFO - Found 3 citekeys in bib section 0
[203] Biber.pm:3493> INFO - Processing section 0
[231] Biber.pm:3657> INFO - Looking for bibtex format file 'biblatex-examples.bib' for section 0
[545] bibtex.pm:1187> INFO - Decoding LaTeX character macros into UTF-8
[560] bibtex.pm:1048> INFO - Found BibTeX data source 'C:/Program Files/MiKTeX 2.9/bibtex/bib/biblatex/biblatex-examples.bib'
[577] Utils.pm:149> WARN - I didn't find a database entry for 'nokeylikethis' (section 0)
[863] UCollate.pm:66> INFO - Overriding locale 'en-US' defaults 'normalization = NFD' with 'normalization = prenormalized'
[863] UCollate.pm:66> INFO - Overriding locale 'en-US' defaults 'variable = shifted' with 'variable = non-ignorable'
[863] Biber.pm:3306> INFO - Sorting list 'none/global/' of type 'entry' with scheme 'none' and locale 'en-US'
[863] Biber.pm:3310> INFO - No sort tailoring available for locale 'en-US'
[877] UCollate.pm:66> INFO - Overriding locale 'en-US' defaults 'normalization = NFD' with 'normalization = prenormalized'
[877] UCollate.pm:66> INFO - Overriding locale 'en-US' defaults 'variable = shifted' with 'variable = non-ignorable'
[877] Biber.pm:3306> INFO - Sorting list 'nty/global/' of type 'entry' with scheme 'nty' and locale 'en-US'
[877] Biber.pm:3310> INFO - No sort tailoring available for locale 'en-US'
[886] bbl.pm:526> INFO - Writing '316156.bbl' with encoding 'UTF-8'
[889] bbl.pm:619> INFO - Output to 316156.bbl
[890] Biber.pm:108> INFO - WARNINGS: 1

The warning is okay, because key nokeylikethis is not defined ...

  • 1
    This was incredibly helpful. Also, I can't believe it really was this easy (I updated everything that was outdated, not sure which package exactly was causing the problem). In fact, everything I had was only very slightly outdated when I made a diff to your filelist. Thank you for putting in the work :) – mrm Jun 28 '16 at 6:11

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.