I have a problem very similar to the question being asked in Bibliographies when using subfiles . My .bib
is references in main.tex
. When compiling main, everything works like a charm. Working on the subfiles, I have two issues though (which are most likely related):
- I can't access the bib with auto-completion
- When compiling the subfile, it doesn't insert the citations.
I tried including
\bibliographystyle{plainnat}
\bibliography{mybib}
in the subfiles, which also worked smoothly. Obviously, the bibs are included in every chapter of the document when compiling main.tex
, then. I tried setting a global boolean in main.tex
:
\newboolean{printBibInSubfiles}
\setboolean{printBibInSubfiles}{false}
and in the subfiles:
\ifthenelse{\boolean{printBibInSubfiles}}
{}
{\bibliographystyle{plainnat}
\bibliography{../betterbib.bib}}
For some reason, then setting the boolean to false
, the "bibliography"-header was printed in the subfiles as well as for the main file, but there was no output of citations under any of the "bibliography"-headers. Furthermore, compiling only the subfiles didn't work correctly.
My document structure is the following:
main.tex
:
\begin[document]
...
\subfile{sub/dataprocessing}
...
\bibliographystyle{plainnat}
\bibliography{mybib}
\end{document}
the subfiles:
\documentclass[../main.tex]{subfiles}
\begin{document}
...
\cite{Random2014}
...
\end{document}
After all this explanation: the only thing I want is to access the .bib
from the subfiles without having to manually uncommenting something when compiling the main file. Any takers?
PS: Obviously, I also tried the solution provided in "Bibliographies when using subfiles" but couldn't get it to work. I don't know whether that would solve my problem anyway, since I don't have the \printbibliography
-issue of the thread opener.
\printbibliography
in the main file, thereby removing the bibliography from the subfiles. What was your problem with that solution?natbib
throughout my thesis (also using\citalt
etc.). Therefore, switching back to thebiblatex
package is not a real option... :( Do you think, the proposed boolean-solution could work out?xemacs
and Auc-TeX this works without a hitch if the right trailers (giving the master file) are included in each piece.