Autocompiling LaTeX-files under Linux

To automatically compile files under Linux there are several options available: Gummi (gummi.midnightcoding.org/) is an editor that compiles the LaTeX file whenever it is modified; latexmk (http://www.ctan.org/pkg/latexmk) is another option.

A third option uses Linux‘ inotify, part of the Linux kernel. It tracks changes to files or directories on the filesystem level. For more information see the wikipedia entry: http://en.wikipedia.org/wiki/Inotify

Here’s a short tutorial how to get it to work under Ubuntu/Debian:

  1. Install inotify-tools using sudo apt-get install inotify-tools
  2. Run the following line from the terminal to tell inotify to watch for any changes of the TeX-file (change the name if necessary). I use a simple pdflatex here, make or arara are of course fine as well.
while true; do inotifywait -e modify autocomp1.tex && pdflatex autocomp1.tex; done

Unfortunately it does not work with TeXworks‘ built-in document viewer, it does not recognize that the PDF has been modified externally.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website