\nocite{*}
将我的 MiKTeX 安装从 KOMA-script v3.31 更新到 v3.32 后,我在将包中的命令biblatex
与\renewcaptionname
from结合使用时遇到了问题KOMA-script
。
在我的原始文档版本中,该命令\renewcaptionname{ngerman}{\figurename}{Abb.}
位于行之前\usepackage[defernumbers=true]{biblatex}
。 在过去,直到 KOMA-script 版本 v3.31 为止,此方法都运行良好。
编译是通过以下命令序列完成的:
pdflatex MWE
biber MWE
pdflatex MWE
pdflatex MWE
但是,更新到 KOMA-script v3.32 后,上次运行过程中出现以下警告并失败pdflatex MWE
。
LaTeX Warning: There were undefined references.
Package biblatex Warning: Please (re)run Biber on the file:
(biblatex) MWE
(biblatex) and rerun LaTeX afterwards.
此外,所有参考文献和引文都以 和 进行编号[0]
,而不是[1]-[6]
。参考书目仅包含实际引用的参考文献,而不是预期的所有六篇参考文献(因为这些参考文献\nocite{*}
已被使用)。
我可以通过将行移动到序言\renewcaptionname{ngerman}{\figurename}{Abb.}
之后\usepackage[defernumbers=true]{biblatex}
或之后的任意位置(例如,直接移动到之前)来解决此问题\begin{document}
,如 MWE 的注释行所示。
序言的这种安排可以与 KOMA-script v3.31 和 v3.32 两个版本兼容。
我的问题是:
这种行为改变是 KOMA-script v3.32 有意为之吗?还是这只是 v3.32 中出现的一些不必要的故障?
\figurename
使用记录的 KOMA 脚本方式来指定事物的规则是什么?
这是 MWE
\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage{lmodern}
% using this line:
\renewcaptionname{ngerman}{\figurename}{Abb.}
%
% only references Author1, Author2 and Author4 are included
% all references and citations are numbered with [0]
%
% LaTeX Warning: There were undefined references.
% Package biblatex Warning: Please (re)run Biber on the file:
% (biblatex) MWE
% (biblatex) and rerun LaTeX afterwards.
\usepackage[defernumbers=true]{biblatex}
\addbibresource{Bibliography.bib}
\begin{filecontents*}{Bibliography.bib}
@book{Author1,
author = {A. Author1},
title = {Titel 1}
}
@book{Author2,
author = {B. Author2},
title = {Titel 2}
}
@book{Author3,
author = {C. Author3},
title = {Titel 3}
}
@book{Author4,
author = {D. Author4},
title = {Titel 4}
}
@book{Author5,
author = {E. Author5},
title = {Titel 5}
}
@book{Author6,
author = {F. Author6},
title = {Titel 6}
}
\end{filecontents*}
\DeclareBibliographyCategory{BibCat_1}
\DeclareBibliographyCategory{BibCat_2}
\addtocategory{BibCat_1}{Author1, Author2, Author3}
\addtocategory{BibCat_2}{Author4, Author5, Author6}
\nocite{*}
% using this line instead:
%\renewcaptionname{ngerman}{\figurename}{Abb.}
%
% works as expected
% all 6 references are included and correctly numbered as [1] - [6]
% no warnings
\begin{document}
Zitate: \cite{Author1} \cite{Author4} \cite{Author2}
\appendix
\printbibheading
\printbibliography[
heading=subbibliography,
category=BibCat_1,
title=BibCat 1]
\printbibliography[
heading=subbibliography,
category=BibCat_2,
title=BibCat 2]
\end{document}
当不使用参考书目类别时,引用和参考文献不会用 [0] 编号,但仍然\nocite{*}
不会将未引用的参考文献纳入参考书目。
这是第二个没有类别的 MWE:
\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage{lmodern}
% using this line:
\renewcaptionname{ngerman}{\figurename}{Abb.}
%
% only references Author1, Author2 and Author4 are included
%
% LaTeX Warning: There were undefined references.
% Package biblatex Warning: Please (re)run Biber on the file:
% (biblatex) MWE
% (biblatex) and rerun LaTeX afterwards.
\usepackage{biblatex}
\addbibresource{Bibliography.bib}
\begin{filecontents*}{Bibliography.bib}
@book{Author1,
author = {A. Author1},
title = {Titel 1}
}
@book{Author2,
author = {B. Author2},
title = {Titel 2}
}
@book{Author3,
author = {C. Author3},
title = {Titel 3}
}
@book{Author4,
author = {D. Author4},
title = {Titel 4}
}
@book{Author5,
author = {E. Author5},
title = {Titel 5}
}
@book{Author6,
author = {F. Author6},
title = {Titel 6}
}
\end{filecontents*}
\nocite{*}
% using this line instead:
%\renewcaptionname{ngerman}{\figurename}{Abb.}
%
% works as expected
% all 6 references are included and correctly numbered as [1] - [6]
% no warnings
\begin{document}
Zitate: \cite{Author1} \cite{Author4} \cite{Author2}
\appendix
\printbibliography
\end{document}
答案1
这是使用新 LaTeX 钩子系统时出现的问题biblatex
(至少在 LaTeX 2020-10-01 PL3 发布之前)。新的 LaTeX 钩子将不再保证\AtBeginDocument
/\AfterPreamble
调用按照它们在代码中出现的准确顺序执行(参见https://github.com/latex3/latex2e/issues/441)。biblatex
依赖于以前的情况。
在 LaTeX 2020-10-01 补丁级别 3 中,我们做出了一些努力来使\AtBeginDocument
调用在排序方面更加可靠,并单独biblatex
解决了该问题https://github.com/plk/biblatex/issues/1066。
该问题肯定会在biblatex
v3.16(2020-12-31 发布)中得到解决,但也可能会通过更新到 LaTeX 2020-10-01 PL3(2020-12-31 发布)来解决。
作为乌尔丽克·菲舍尔 评论中提到:一种解决方法是将其移至\nocite{*}
文档主体中。但是,如果您更新 TeX 系统,则不再需要此解决方法。