In TeXShop, is it possible to use the ctrl/cmd+T hotkey to compile a different file than the one that's open?

When distributing the project into multiple files, it would be nice to have a hotkey which always compiles the associated main.tex file. Normally, I have main.tex open in the first tab of the window, and a hotkey for compiling the first tab would be nice.

1 Answer 1


I made two files

File estenmain.tex





File estensecondary.tex

% !TEX root = estenmain.tex

Hello world.

Then clicking “Typeset” in the window of the second file, the root file is compiled.

The “magic line” can be added with a choice from the menu “Macros > Root”. A box for choosing a file will appear and you'll be given the choice between a relative path or an absolute path. The former is best.

  • Please also read Help->TeXShop Tips and Tricks. Sep 27, 2019 at 0:42
  • Amazing, thank you!
    – esten
    Sep 27, 2019 at 7:29

You must log in to answer this question.

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