附录:

附录:

附录:

@PLK 在下面评论了此举的可行性:

我看不出这是如何工作的——\includeonly必须进行更改以了解 biblatex 特定的内部结构,例如段/部分创建宏,以便在卸载的文件中跟踪这些内容。

我不确定这有多复杂,所以我为任何愿意研究这个问题的人提供小额赏金。


biblatex打印每个部分参考书目的\printbibliography[segment=x]选项与的使用之间存在冲突\includeonly

据我所知,这是由于未包含节而导致段号被重新排列所致。因此,如果包含两个节,而第二个节使用\printbibliography[segment=2],则当您这样做时将不再起作用,\includeonly{section2}因为该节的段号现在是segment=1

! Package biblatex Error: Segment '2' not found in Section '0'.

当然,segment每次都进行更改即可解决这个问题,但这会使使用变得\includeonly更加麻烦。有什么想法可以解决这个问题吗?

梅威瑟:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{bibliography.bib}
@Article{gob,
  title           = {I've Made a Huge Mistake},
  author          = {Bluth, Gob},
  journal         = {Journal of Magicians},
  year            = {2003},
  volume          = {1},
  number          = {1},
  pages           = {1--10},
}

@Article{michael,
  title           = {Her?},
  author          = {Bluth, Michael},
  journal         = {Sudden Valley},
  year            = {2003},
  volume          = {1},
  number          = {1},
  pages           = {1--10},
}

@Article{tobias,
  title           = {Never-nudism},
  author          = {F{\"u}nke, Tobias},
  journal         = {Blue Man Group},
  year            = {2003},
  volume          = {1},
  number          = {1},
  pages           = {1--10},
}
\end{filecontents}

\begin{filecontents}{section1.tex}
\section{First section}
Check this out~\cite{gob}.
\printbibliography[heading=subbibliography,segment=1,]
\end{filecontents}

\begin{filecontents}{section2.tex}
\section{Second section}
Check this out~\cite{michael}.
\printbibliography[heading=subbibliography,segment=2,]
\end{filecontents}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[%
  backend=biber,
  refsegment=section,
]{biblatex}
\addbibresource{bibliography.bib}

\includeonly{%
  % section1,% % This always works because its segment number is constant at 1.
  section2,%
}

\begin{document}
\include{section1}
\include{section2}
\nocite{tobias}
\printbibliography
\end{document}

答案1

通过使用\printbibliography[heading=subbibliography,segment=\therefsegment]而不是明确设置段号,后续pdflatex调用不会因Segment not found错误而终止。

如果清理辅助文件或biber重新运行,文档仍可成功编译,但排版的参考书目可能不是您期望在最终文档中看到的内容(排序和/或编号)。尽管如此,这仍可使用,\includeonly因为不会因缺少段而出现重新编译错误。

相关内容