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.
\printbibliographyin the main file, thereby removing the bibliography from the subfiles. What was your problem with that solution? – Dolphin Dec 11 '14 at 19:22natbibthroughout my thesis (also using\citaltetc.). Therefore, switching back to thebiblatexpackage is not a real option... :( Do you think, the proposed boolean-solution could work out? – Klaster Dec 12 '14 at 12:39xemacsand Auc-TeX this works without a hitch if the right trailers (giving the master file) are included in each piece. – vonbrand Jan 27 '16 at 02:39