I am a newbie, and I have been looking for the solution for a while. But if I use subfile for separate files, how can I do citations in the subfiles that refer to the global bibliography? Like if I insert a bibliography in the main tex file, that will include every citation I have in every subfiles?
Thank you very much!
Best Answer
Citations in subfiles that refer to a global bibliography that is set up in the main file work exactly as if there was no subfile.
The following is the file
main.tex
which does not contain any\cite
commands, but prints the bibliography.The following is the file
chapter1.tex
which contains the only\cite
command.To get the desired result, you can compile
main.tex
using PDFLaTeX, BibTeX, PDFLaTeX, PDFLaTeX.Alternative approach using
\include
instead of thesubfiles
package:The following is a MWE that uses
\include{filename}
commands instead of thesubfiles
package:main.tex
:chapter1.tex
:Using this approach, TeXMaker auto completes
\cite
and\ref
commands in both files equally.Please note the differences in the chapter files in comparison to the
subfiles
approach. And please also keep in mind that\include{filename}
does a\clearpage
before and after\include{filename}
.Further information: When should I use \input vs. \include?