如何只使用參考書目的子集來編譯不同的章節?

如何只使用參考書目的子集來編譯不同的章節?

我習慣\input{chapterXX}在主 tex 檔案中包含不同的章節,並\includeonly{chapterXX}與多個 tex 檔案一起使用,每次僅編譯一個章節,因此我有多個 PDF(每章一個)。

然而,不同章節的 tex 檔案自然包含引用命令,並且\includeonly.這意味著當最終嘗試列印每章的參考書目時,將列印整個手稿的參考書目。有沒有辦法讓\includeonly{}指令也只包含特定章節中的引用指令?

答案1

正如評論中提到的,使用現代包biblatexbiber.

\documentclass{report}
\usepackage[refsection=chapter]{biblatex}
\addbibresource{biblatex-examples.bib}
\includeonly{\jobname-mary,\jobname-peter}
\begin{filecontents}{\jobname-peter.tex}
    \cite{ctan,companion}
\end{filecontents}
\begin{filecontents}{\jobname-paul.tex}
    \cite{aristotle:physics,westfahl:space}
\end{filecontents}
\begin{filecontents}{\jobname-mary.tex}
    \cite{herrmann,shore}
\end{filecontents}

\begin{document}
\include{\jobname-peter}
\include{\jobname-paul}
\include{\jobname-mary}
\printbibliography
\end{document}

相關內容