I'm working on a large document, and for that reason I'm using a main.tex file and including several files like chapterX.tex etc. Problem is that only my main.tex file has the bibliography in the preamble, TeXStudio doesn't give me the list of references when I type \cite{

The workaround I've been using is to add


to the chapterX.tex documents while typing so it shows me the list, and then removing these lines again when I compile the main document.

Is here a better way to solve this problem?

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 6 '14 at 10:14
  • The document is made up out of several different files – Dr. Hoenikker Apr 6 '14 at 10:47

Make sure that you use TeXStudio in master mode. To cite the manual of TeXStudio section 4.1:

TeXstudio allows you to work onto documents separated in several files. To include a TeX file into your document, just use the "\include{file}" command in the "LaTeX" menu. The file will appear in the "Structure View". With a click on his name, TeXstudio will open it.

TeXstudio now understands parent/child relations of loaded documents (1 level only !). Therefore, as in "master document mode", only the parent document is compiled if compilation is tarted while working on a child document. Likewise labels and usercommands are known in all corresponding documents.

You can still define your "master document" with the "Options" menu. All the commands of the "Tools" menu will apply only to this document even when working on the "children" documents (you can even close the "master" document). If a master document is set, labels and usercommands which are defined in any open document, can be used for completion in any open document. Thus you can insert easily a reference to a label which is defined in another subdocument, as long as that document is open in TeXstudio. Note : you can leave the "master" mode with the "Options" menu.

  • 1
    Thank you! Setting main.tex as the master document solved the problem. – Dr. Hoenikker Apr 6 '14 at 11:02
  • The 1 level only part is crucial here. Had created deeper nesting and it was not working – ijuneja Sep 13 '20 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.