I've been using TextMate and TextMate 2 for years writing LaTeX. I recently switched to Sublime Text, but still miss a key feature there.

The LaTeX package of TextMate 2 has the Watch Document function, which is "[...] a live pdf preview of the LaTeX document you're editing that automatically updates while you make changes." (Source).

These changes do not only include any Tex file included in a master document, but also extends to changes in images and other files included in the document.

I've already learned that it is possible in LaTeXTools for Sublime Text to build a project consisting of many files by including %!TEX root = MyMasterFile.tex on top of each document. However, I really do not like the tedious workflow of always triggering the build process by hand. I want LaTeXTools to rebuild my document as soon as any file associated with it changes.

My current workflow is triggering the Watch Document using Textmate 2 and then switching over to Sublime Text 3 to work on the project.

Is it possible to achieve this functionality with Sublime Text and LaTeXTools only?

  • 2
    You could always run latexmk -pvc main which will recompile whenever any file changes
    – Bordaigorl
    Dec 4, 2015 at 18:56
  • This works exactly as I want it to. I've created a proper makefile using this example. If you want to, you can add your comment as answer and I will accept it.
    – Paul Klemm
    Dec 10, 2015 at 15:37

2 Answers 2


One approach is to simply launch latexmk -pvc main in your working directory. From the manual:

-pvc Run a file previewer and continually update the .dvi, .ps, and/or .pdf files whenever changes are made to source files (see the Description above).

latexmk is included in all modern TeX distributions.


You could always just use a different ST plugin, like OnSaveBuild which would work if you change its filename_filter setting to something like "\\.tex$".

  • This is a very good idea. The solution of @Bordaigorl, however, does exactly what I want and I think that his approach is more versatile.
    – Paul Klemm
    Dec 10, 2015 at 15:39

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.