# latexmk and auctex

Compiling LaTeX is a pain. LaTeXmk is a Perl script (eww) which iterates compilations, including of the bibliography, until complete.

auctex-latexmk integrates it with AucTeX’s `C-c C-c` cycle. You need to add the following to `.latexmkrc` (the former to stop the compilation process hanging when you make a mistake, and the latter because emacs doesn’t know how to tell latexmk to compile pdfs).

``````\$pdflatex = 'pdflatex --shell-escape -interaction=nonstopmode -file-line-error -synctex=1 %O %S';
\$pdf_mode = 1;
``````

Other useful commands include

• `latexmk -C` removes all automatically generated files
• `latexmk -pvc` continuously recompiles