[Tex/LaTex] Clean-up temporary files after PDF is generated

aquamacsauctexauxiliary-filescleanup

Possible Duplicate:
Deleting external/auxiliary files?

Is anyone aware of a way of how to cleanup temporary files generated by pdflatex during the generation of the PDF file? I came across the pdflatex parameter -aux-directory= but I cannot find where to set it. I also came across some sort of macro called LaTeX-clean-intermediate-suffixes, but neither am I sure how I can execute it manually or even better automatically after the compilation.

Best Answer

I don't think this is possible with pdflatex but it is with latexmk by using the option -c as in

latexmk -c foo.tex

See Prevent pdflatex from writing a bunch of files for details.


Why use latemk instead of pdflatex? Because it makes compilation easier. You just have to issue latexmk once and it runs pdflatex, bibtex or biber and makeindex as many times as it takes for the document to be fully compiled. It has several other features you might like too.