1

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.

AndréC
  • 24,137
Raibyo
  • 141
  • Welcome to the site! Is it an option to use arara? If so, perhaps https://tex.stackexchange.com/questions/100585/arara-making-a-rule-to-compile-the-main-file-from-a-chapter-file might be helpful? – cmhughes Aug 26 '18 at 09:00

1 Answers1

3

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

Raibyo
  • 141
  • 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 '21 at 16:15