I'm aware that some LaTeX editors provide some "magic comments" to indentify the root document from within a child file \inlude{}-ed in the root.

Examples are the % !TEX root = <rootfile> comments of Atom LaTeX and Texstudio.

Since I prefer not to use a IDE, is there package or feature in MikTeX that mimics these magic comments?

Some context: I my editor (Notepad++) I can bind custom commands to shortcuts. Currently I have two of those: the first runs latexmk main.tex to compile the main file and I use it whenever editing the main file or its chapter subfiles. The second command runs latexmk <current-file> and I use it to compile TikZ source files into PDFs which I later include in my main file.

I would prefer to get rid of the first shortcut and simply run latexmk <current-file> on either file and have latex figure out wether to compile the file directly or redirect to the root file.

  • 4
    your question isn't very clear miktex is a distribution of tex-related programs but the comment syntax has to be understood by whatever you use to launch tex, either your editor or a tool such as arara , if you are simply calling tex from the commandline there isn't really anything needed as you just specify the root document to the tex command. – David Carlisle Jan 13 '18 at 14:13
  • Welcome to TeX.Stackexchange! – user36296 Jan 13 '18 at 14:16
  • True, but since there already is a kind of magic comment to specify a precompiled preamble file in MikTeX pdflatex, I was wondering wether there are more.. – Arne Jan 13 '18 at 14:17
  • 3
    you mean a line starting with & to specify a format? Your question would be clearer if you described the interaction you have in mind. If you are just typing pdflatex myfile in a command window then tex will process myfile and there isn't really anywhere to specify anything different, or any need to do so? – David Carlisle Jan 13 '18 at 14:21
  • I usually have a Makefile in the project root (where the root document lies) and open the editor (VIM) so it has that folder as the working directory. I start compilation with :!make (or a shortcut to that), so no matter which file I'm working on, the correct one is processed. But since you're using MikTeX I guess your on MS Windoof, which would require you to install some stuff to use a similar approach (namely a GNU make). – Skillmon Jan 13 '18 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.