子文件和 biber:引文输出未使用类别更新,但其他方面都很好

子文件和 biber:引文输出未使用类别更新,但其他方面都很好

我有一个名为的“主文件” subfile_biber.tex,内容如下:

\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}

具体来说,主文件包括两个子文件,分别是bibhere.texnobibhere.tex。其思想是将参考书目打印在 中bibhere.tex,而 中有一些引用命令nobibhere.tex。文件如下:

\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}

最后,nobibhere.tex

\documentclass[subfile_biber.tex]{subfiles}

\begin{document}

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

\end{document}

实际上,我已经通过注释强调了显然是由于使用类别而引起的问题bibhere.tex。如果我使用打印出类别定义的参考书目mypapers,则引用命令最终会产生 [0] 和 [0]。但是,如果我注释掉 refcontext 块并只执行\printbibliography,则输出看起来不错。(特别是,输出是 [2] 和 [1],正如预期的那样)。

但我希望使用类别。如何解决这个问题?

答案1

您没有提及您使用哪个 TeX 发行版和版本号。

根据您提供的代码,我准备了以下 MWE(使用包filecontents将所有子文件和主 tex 代码包含到一个可编译的 MWE 中)。在那里,我添加了输入编码\usepackage[utf8]{inputenc}并更改了文件名,以便在文件名中记录哪些文件属于此代码。

我猜,你的 TeX 发行版有问题,可能有点过时了。因此我添加了命令\listfiles来获取使用过的类和包的完整列表,包括版本号。请将下面的列表与你电脑上的结果列表进行比较。我确信有区别!顺便说一句:我正在使用当前的 MiKTeX 2.9 进行编译,确切地说:pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2016.5.24)

妇女权利委员会:

\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}

得到以下 PDF 结果:

在此处输入图片描述

使用以下软件包和版本号列表来编译:

 *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
 ***********

生成的blgbiber 日志文件是:

[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

该警告是可以的,因为键nokeylikethis未定义......

相关内容