My LaTeX workflow involves frequent recompiles (good ol' C-c C-c in AucTeX). Right now I'm working on a large document that's composed of chapters, each in an individual file. I would like to use the \input{}
or \include{}
mechanism to compile the final document, however that involves stripping the chapters sources from the preamble.
I could create a "main" file (a chapter-main.tex for every chapter.tex) with the preamble and \include{chapter.tex}
, but this means that as I'm editing an individual chapter, I need to switch to a different file for a recompilation, which breaks my workflow.
Are there any ways to use the \include{}
mechanism that don't get in the way of editing files individually?..
Best Answer
There are several solutions for working with multiple files; I prefer
subfiles
. If you merely want to indicate which file is the "master", insert the following at the top of the file (and replace "rootfile" as appropriate):