Possible Duplicate:
Prevent pdflatex from writing a bunch of files.

Every time I generate the PDF in TexMakerX 2.1 for Windows, it also generates the log, aux and gz files, in which I have no interest. How can I stop that?

  • 1
    You can't. Those file are necessary for typesetting the file. – egreg Nov 15 '12 at 16:49
  • @egreg can't I make it auto-delete after the PDF is ready? O create those in a temp folder and move the PDF to my desktop (automatically)? – Tom Brito Nov 15 '12 at 16:53
  • Welcome to TeX.SE. Yes you can delete them, but that will just slow down your next compilation (assuming you want all the references). I fought this battle a while ago and learned to just live with them, and clean them up every once in a while, but if you are using a script to build, then remove them from there. – Peter Grill Nov 15 '12 at 18:58
  • 1
    TeXmakerX is pretty outdated. That very same program has been called "TeXstudio" since June last year, and its current version is 2.5. – doncherry Nov 15 '12 at 19:05

As egreg already mentioned, the auxiliary files are needed for typesetting your document. You can remove the auxiliary files only after the "complete" PDF output is generated. The "complete" means that the cross-reference is properly typeset.

Removing the auxiliary files will be easier if you create a make file (in Linux) or a batch file (in Windows).


An example of batch file (for Windows user) that not only compiles the input file 3 times (3 times should be enough) and but also removes the auxiliary files at the end.

echo off

rem %1 TeX input filename without extension

if exist "%~1.pdf" del "%~1.pdf"

if exist "%~1.tex" pdflatex --shell-escape -draftmode -interaction=batchmode "%~1.tex"
if exist "%~1.tex" pdflatex --shell-escape -draftmode -interaction=batchmode "%~1.tex"
if exist "%~1.tex" pdflatex --shell-escape -draftmode -interaction=batchmode "%~1.tex"
if exist "%~1.tex" pdflatex --shell-escape "%~1.tex"

for %%x in (aux log out toc nav snm) do (if exist "%~1.%%x" del "%~1.%%x")
  • To complete your answer, there should be a command that will clean old the auxiliary files. I don't have TexmakerX installed, but in Texmaker there is a entry "clean" or "cleanup" (sorry, my menu is not in english...) in the menu "Tools" that does the job. – Lionel MANSUY Nov 15 '12 at 17:12
  • @LionelMANSUY: See my last edit. This comment will be deleted shortly, unless I forget to do so. – kiss my armpit Nov 16 '12 at 8:38
  • do you really need to test 4 times the existence of the tex file? The structures if then else end if does not exist on windows? – Lionel MANSUY Nov 16 '12 at 8:53
  • @LionelMANSUY: I don't know the details. I just learnt it instantly. – kiss my armpit Nov 16 '12 at 8:57
  • For a more flexible batch file, see this. – kiss my armpit Jan 3 '13 at 14:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.