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 mag LaTeX und Python, auch gern in Kombination. Hat Dir dieser Beitrag geholfen und möchtest Du Dich dafür bedanken? Dann unterstütze doch vielleicht die Dingfabrik Köln e.V. mit einem kleinen Beitrag. Details zur Bezahlung findest Du unter Spenden für die Dingfabrik.

More Posts - Website