I use Atom and have a main.tex file and use input to add text, which I write in separate .tex document, e.g. \input{sections/introduction.tex} occurs in the main.tex-file. If I am writing in a section, say introduction.tex and want to compile, then I need to open main.tex and build.

However, I would like to use a shortcut, such that I can compile from a section, e.g. introduction.tex, without changing to main.tex.


1 Answer 1


One can add the following at the top of the .tex-file one wish to compile from: % !TEX root = ../main.tex

  • A note for anyone else not understanding why it doesn't work: the feature !TEX is not included in the basic LaTeX packages, one needs one of the "fancier" ones like latexer.
    – Léo S.
    Aug 31, 2021 at 16:15

You must log in to answer this question.

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