The point is simple, how to set the "master file" that always will be compiled in Sublime Text 3 editor using standard Ctrl-b command (it could using sublime's projects).

Additional feature I'm looking for is setting compilation directory. Where it should be specified?

2 Answers 2


I'm the developer of LaTeXTools. To set the master file, you need to add the following line at the very top (i.e. as the first line) of any included files:

%!TEX root = yourmasterfile.tex

The README has further details.

Right now there is no support for setting a compilation directory other than the one where the master file resides. It's something a few users have requested, so I may get to it eventually, but it will require some pretty extensive changes (I think).

Update: If you're using a .sublime-project file, you can add the master file under the settings property. See the official README.

  "settings": {
      "TEXroot": "yourfilename.tex"

In my case I had to provide the absolute path for the TEXroot file.

  • 6
    Kudos for creating LatexTools - really awesome work, and I use your stuff all the time. I have a my_thesis.tex file with include directives to main/xyz.tex files. I've tried putting both %!TEX root = my_thesis.tex and ../my_thesis.tex. At first it didn't work, but when I put the bibliography command directly into my_thesis.tex it started working great.
    – axel22
    Commented Jul 31, 2014 at 15:46
  • I should add that I only noticed this on Windows with MikTex. On linux and osx, the bibliography command did not have to be in the main my_thesis.tex file.
    – axel22
    Commented Aug 1, 2014 at 9:09
  • I just realized how many hours I could have saved if I had known that when starting my thesis. Thank you!!! It also jumps right to the edited part in the pdf when you build it. Commented Nov 7, 2015 at 9:12
  • The Latextools documentation says to use the key "latextools.tex_root" instead of "TEXroot" as in comment above. The latter works and the former doesnt for me. Any ideas whats going on there?
    – oweydd
    Commented Sep 3, 2021 at 16:36

It seems the developer has archived the LaTextools. Following oweydd, I met the same condition using ST 4. The solution is to replace "latextools.tex_root" with "TEXroot". Anyway, much appreciate the developer's contribution.

You must log in to answer this question.

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