[Tex/LaTex] latexmk cleanup


When I do latexmk -c foo.tex, latexmk cleans up as expected. I tried to configure latexmkrc so that this would happen automatically. Here's my latexmkrc file:

$pdf_mode = 1;
$silent = 1;
$cleanup_mode = 2;

However, when I run latexmk, all of the other files (foo.log, foo.aux, etc) are still there. What am I doing wrong?

Best Answer

The documentation is out-of-date and wrong. Currently, when you specify $cleanup_mode=2, the cleanup action is done first, and then a regular run is done. That's different from what happens when you run latexmk -c foo.tex, which only does the cleanup.

The documentation wasn't updated to reflect a code change many versions ago. I need to correct the documentation (and probably improve the code).

Perhaps you actually want latexmk to do an automatic cleanup after compiling your document. That is a sensible idea, but it's not currently implemented.

Related Question