I have a main document calling on several different chapter files. What I would like to do is have split-screen open with one chapter tex file on one side and a compiled pdf on the other side that I can update as I go using the keyboard shortcuts from my chapter tex file instead of having to exit, go find my main file and compile it from there, and then come back to my chapter file.

I've seen plenty of answers instructing how to compile the main document to show only a single chapter by using include instead of input. But that doesn't solve the issue of compiling the chapter file while working on it. Those answers still require going back to the main document to compile.

As a bad hack right now, I've input my preamble file into my chapter file and written begin{document} stuff etc while I'm working on it so that I can just get it to compile temporarily. The issue is that I have to % out the begin{document} and preamble stuff if I ever want to compile my main document and I'm certain there has to be a better way to do it.

Please help!

  • 1
    It is not what you ask, but you should take a look to the docmute package.
    – Fran
    Aug 10, 2020 at 21:52
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – TobiBS
    Aug 10, 2020 at 21:53

1 Answer 1


I have a separate onechapter.tex that has the same preamble and then includes whatever chapter I'm currently working on. That solves the problem with your bad hack that you have a file that doesn't compile.

To avoid switching from the chapter's source to onechapter.tex, you could begin the chapter with
% !TEX root = onechapter.tex
See When and why should I use % !TEX TS-program and % !TEX encoding?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .