# How to best use and compile multiple .tex files as part of same final document? (Part 2)

I have a question about the top answer by R. Schumacher for this question about being able to compile a tree-structured document (main folder, chapters folder, etc.) while viewing an individual chapter. (I would have just asked in a comment in the same thread, but I don't have enough forum points to do that.)

My question:

The top answer indeed does work for compiling the main.tex file while viewing any chapter_X.tex file. However, it seems you have to set the root document as the main tex file each time you open your tex editor.

Is there a way to automate this process? For example, is there anything I can place at the top of each chapter_X.tex file so that it knows to compile the main.tex file in a different directory?

Here is my example directory structure:

• Thesis
• chapters
• chapter_1.tex
• chapter_2.tex
• images
• image1.eps
• image2.eps
• main
• main.tex
• presentation
• presentation.tex

I ask because my presentation.tex file is a separate document from the main.tex file. However, if I wanted to compile presentation.tex, I would need to change the root directory setting back to default.

Edit:

I am using TeXstudio 2.11.0

Replay

Category: chapters Time: 2016-07-29 Views: 1