Compiling TeX documents by hand is tedious1 and with all the output a pain to watch at. For a long time, I used latex-makefile that tries to solve both problems. However, it is a huge beast which broke compilation from time to time.
After looking around a bit, I came to latexmk which almost fit the bill.
The Perl script does what it has to do but requires patching latexmk itself
.latexmkrc file just for compiling XeLaTeX sources.
So, I looked a little further and found rubber. I knew it already from Gedit’s LaTeX plugin but I wasn’t really aware that one could use it as a standalone solution. Anyway, for simple projects calling
$ rubber --pdf doc
doc with pdfLaTeX, strips out unnecessary debug output and
pre-processes things like the BibTeX bibliography. To compile XeLaTeX sources,
you could either write a rubber module and distribute it with your document,
or simply add
% rubber: set program xelatex
on top of your source file. That’s it.
Now, instead of the huge latex-makefile or a hand-written Makefile, I use this little baby for all my TeX documents:
SRC=$(wildcard *.tex) OPTS=--pdf .PHONY: clean all: $(patsubst %.tex,%.pdf,$(SRC)) %.pdf: %.tex @rubber $(OPTS) $< clean: @rubber --clean $(OPTS) $(SRC)
More information about rubber can be found in an entry of the TeX SE community blog.
pdflatex && bibtex && pdflatex && pdflatex… seriously? ↩
This post might also have some comments at Google+.