latexmk
For complex LaTeX projects, the compiler command (e.g. pdflatex
or
xelatex
) must be invoked multiple times to get things like
references right. latexmk
is a Perl script (available in most
repos) that automatically calls the compiler enough times. The following
configuration (to be put in ~/.config/latexmk/latexmkrc
) makes
this process even easier:
$pdflatex = 'xelatex %O %S'; $pdf_mode = 1; $preview_continuous_mode = 1; add_cus_dep('glo', 'gls', 0, 'makeglo2gls'); add_cus_dep('acn', 'acr', 0, 'makeglo2gls'); sub makeglo2gls { system("makeglossaries $_[0]"); }
This will:
xelatex
as the compiler and pass the command line options and file name to it;
LaTeX produces many build files, especially when using bibliographies,
glossaries or packages like minted
. Cleaning scripts are rarely
exhaustive, leading to a lot of frustration.
One solution to that problem is tracking all source files and resources (such
as pictures, bibliography files, etc.) using git. Then, git clean
-xf
will remove all untracked files, leaving only the relevant ones.