I am writing my Ph.D. thesis in XeLaTeX with Biblatex, and there are times when I need to compile individual chapters, and times when I need to compile the entire document, so I use subfiles, which works wonderfully. However, in each of these chapters I have a \printbibliography
command, which I would like to turn off when compiling the final document, so that only the \printbibliography
command is run in the mainfile.
The file structure is something like:
Main.tex
:
\usepackage{subfiles, biblatex}
\begin{document}
\subfile{Chapter1.tex}
\printbibliography
\end{document}
Chapter1.tex
:
\documentclass[Main.tex]{subfiles}
\begin{document}
\cite{Someguy1981}
\printbibliography
\end{document}
Best Answer
From
subfiles.sty
the\subfile
command is defined as:So it is straightforward to hook in some code to locally redefine
\printbibliography
to do nothing. For an example add the following to the preamble of the main file:Note that
biblatex
makes bibliographic data available via citation commands. So unless you want to view the bibliography entries outside the main file, the subfiles need not invoke\printbibliography
.