更新 MikTex 2.9 后,biblatex
使用时出现以下错误消息:
\printbibliography[prenote=conference, keyword=C, prefixnumbers={C}]
包 biblatex 警告:\printbibliography 的 prefixnumbers 选项不再受支持,请使用 \newrefcontext 的 'labelprefix' 选项。
但是,当我使用时:
%...
\newrefcontext[labelprefix=C]
\printbibliography[prenote=conference, keyword=C]
我收到以下错误消息(第 17 行是 \printbibliography...):
LaTeX 警告:输入第 17 行的参考书目为空。
下面是包含两个变体的完整的最小工作示例(一个被注释掉了):
\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}
我错过了什么?
更新:感谢 Guido 的建议,在我将后端选项更改为 biber 后,它(几乎)可以正常工作,如下所示。我现在可以按需要获得带有前缀的参考书目。但是,在我引用参考文献的文档中,我得到的是 [0],而不是 [C1] 或 [W1]。有趣的是,编译期间 pdflatex 没有出现任何错误消息或警告。
\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}
是什么原因造成的?
答案1
数学家协会
\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}
产生期望和预期的输出
但你必须使用 Biber 而不是 BibTeX,因为只有 Biber 可以labelprefix
正确支持。(从biblatex
3.13开始,labelprefix
,但与 Biber 提供的正确/完整实现存在一些差异,请参阅https://github.com/plk/biblatex/issues/852。一般来说,您只能biblatex
通过 Biber 使用 的所有功能,因此,无论如何,切换到 Biber 都是一个非常好的主意。)
由于需要使用这个 MWE,defernumbers
因此引用编号可能会卡在“[0]”或其他不需要的编号中。在这些情况下,删除临时文件(、、、.aux
... )并从头开始重新编译会有所帮助。.bbl
.bcf
在非常特殊的情况下,你可能必须确保条目属于正确的参考部分,即使在引用中也是如此。但通常不需要这样做。
然后你会使用\assignrefcontextkeyws
它来确保引用正确。请参阅 §3.7.10参考上下文的biblatex
文档,特别是第 94-99 页。
答案2
这应该可以正常工作。默认情况下,引文中的标签会选择打印参考文献的最后一个参考书目中的标签。这几乎总是你想要的,而且有了这个 MWE,对我来说,它工作得很好。也许是 ieee 样式的问题?
\documentclass{article}
\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=numeric, 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}
\newrefcontext[labelprefix=C]
\printbibliography[prenote=conference, keyword=C]
\newrefcontext[labelprefix=W]
\printbibliography[prenote=workshop, keyword=W]
\end{document}