8

I am using \input{chapterXX} to include different chapters in the main tex file, and use \includeonly{chapterXX} with several tex files, each time compiling only a single chapter, so I have multiple PDFs (one per chapter).

However, the tex files for the different chapters naturally include citation commands, and the citation commands are not ignored by the \includeonly. This means that when finally trying to print the bibliography for each chapter, the bibliography for the whole manuscript is printed. Is there a way to make the \includeonly{} command also include only citation commands from the specific chapter?

  • 1
    That is by design and the use-case for includeonly, to keep references and cites intact. How are you citing? This is an important fact, i think the modern biblatex can handle the situation. – Johannes_B Dec 24 '14 at 19:13
  • Fairly straightforward with biblatex as @Johannes_B says. Or I think chapterbib or similar can handle this with bibtex. – cfr Dec 24 '14 at 20:10
  • Have a look for refsection in biblatex, I'm sure that I've answered a similar question on this site somewhere... – cmhughes Dec 24 '14 at 20:38
  • presumably you are using \include{chapterXX} not \input{chapterXX} since includepnly would have no effect otherwise. – David Carlisle Dec 24 '14 at 21:53
1

As mentioned in the comments, very straight forward using the modern package biblatex along with biber.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.