I'm trying to work on individual sections of a paper separately. In order to do this, I need to wrap the text in
\begin{document}
...
\bibliography{bib}
\end{document}
The main file looks similar:
\begin{document}
\include{A}
\include{B}
...
\bibliography{bib}
\end{document}
However, with the bibliography included in the sub-file and the main file, I end up with these errors: Illegal, another \bibstyle command
, Illegal, another \bibdata command
. I think, had the builds worked, I would also have a duplicate bibliography.
So, the question: How can I keep the individual sub-documents compileable (with bibliography), but also have the "main" document compile with a working bibliography?
Best Answer
Assuming you are using the
standalone
bundle here then you can use the\ifstandalone
switch around the\bibliography{..}
command to ignore it if the sub-file is compiled as part of the main document. This switch is set to\iftrue
by thestandalone
class, but to\iffalse
by thestandalone
package in the main document. See thestandalone
package manual for more details.