There are many different ways to automate the compilation of a LaTeX project.
I would like to start a discussion, what would be the most flexible and elegant and omnipotent way to provide a project which is compilable quickly on all operation systems, in most programs and for all users.
The example scenario: I am uploading a "super complex project" to BitBucket or alike. I want to work on it on Linux and Windows. If others want to contribute something, they just have to read my README.md
saying for example "Install arara
and make
, open main.tex
in vim and run :make
on Linux or :! make
on Windows! Ready!"
I have not used rubber or latexmk but am keen to learn about. Please comment on that, if you like it.
My routine for now is:
Using arara in the main.tex
% arara: lualatex: { shell: yes }
% arara: biber
% arara: makeglossaries
% !arara: indent: { overwrite : yes, trace : yes, files: [ header.tex, main.tex, chapter/Foo.tex, chapter/Bar.tex] }
Edit this file in vim and run :make
with the following Makefile
(excerpt)
target = main
all: ararabuild
full:
ararabuild
ararabuild
ararabuild
ararabuild:
arara --log --verbose $(target)
view: ararabuild viewonly
viewonly:
evince $(target).pdf || AcroRd32.exe $(target).pdf
bib:
biber $(target)
%.pdf: %.tex
ararabuild $<
clean:
find . -name "*.log" | xargs rm -vf
find . -name "*.aux" | xargs rm -vf
find . -name "*.toc" | xargs rm -vf
find . -name "*.blg" | xargs rm -vf
find . -name "*.out" | xargs rm -vf
find . -name "build" | xargs rm -vf
This runs good for me (except the cross-platform view
stuff). But I just would like to see what techniques are around, what is best practice... or simple: How to get rid of all the configurations of different LaTeX
-programs, the explanations of compiling routines and so on. Just imagine a TeX
-template for a company. Much easier to provide if they just have to input their text using some familiar editor and then (for example) double click on some batch file...
I hope it is allowed to start such a discussion here. TeX automation tools are cool, but their use isn't that popular until now and cool using examples are still missing i.m.o.
make
on Unix but batch files on Windows. The batch files are calledmake.bat
, so the interface is platform-independent.latexmk
is an appropriate tool. It automatically determines dependencies and the necessary number of repeated runs (ofpdflatex
orlualatex
, or whatever). All you do is run the command aslatexmk main
. Since you uselualatex
andmakeglossaries
, you'll need alatexmrc
file to configurelatexmk
appropriately (it would be about 4 lines). This is all platform independent.