[Tex/LaTex] Remove temporary files

auxiliary-filesbuild-system

I have just started working with LaTeX. I am using Sublime as my editor and have installed the Latextools package (https://github.com/SublimeText/LaTeXTools).

This works just fine although it is producing various files (.aux, .lof etc.). As I understand these files are required for different functionalities however as I see it these could be removed once the PDF file has been generated. If this is true I would appreciate if someone could give some advice on how to automatically accomplish this when building the PDF file.

Best Answer

I do not know Sublime, but some LaTeX editors like TeXworks have the option of remove auxiliary files at any time. Others as TeXmaker have an option to use the -output-directory= option, others as LaTeXila optionally clean these files when the .tex file is closed, an others as Gummi or Lyx use the temporal directory (/tmp in Linux) instead of your working directory, so after a reboot your lost these files. At worse, you can make your own script to delete these files in the working directory.

So yes, you can safely remove auxiliary files once the PDF was fully generated. Sometimes you must do so when there are compilation problems. As long as you maintain all the source code (.tex, . bib, any local .cls and .sty file, images, etc.) all is fine, excepting that you could need again these files in the future, so premature cleaning have the risk enlarge the build process (may be a lot of time for complex documents).

Related Question