tags:

views:

120

answers:

4

Yeah, the title says it all.

I just want to have a .tex file which I compile with pdflatex and end up with a .pdf file. I don't want all the other .aux, .log and .synctex.gz files. pdflatex doesn't seem to have arguments for this but I hope you can help.

+1  A: 

Write a shell-script wrapper which removes the files:

#!/bin/sh
pdflatex "$@" && rm -f *.aux *.log *.synctex.gz

Bonus-assignment: modifying the script to only remove the files actually created by pdflatex.

JesperE
Why not move all of the log files into a directory named `log` instead? There must be some reason that those files get created.
Hamish Grubijan
This doesn't work. Sometimes LaTeX needs to be run multiple times, where it takes data from *.aux to complete it's task (updating references...)
harper
+2  A: 

Have you thought of using TeXworks?

It has a menu item for this:

File -> Remove Aux Files...

I appreciate this may not be exactly what you want -- you probably have another preferred editor, and would prefer to have it done automatically -- but this answer's here for anyone with whom it might resonate.

Brent.Longborough
A: 

Use pdflatex with -enable-write18 option and write at the end of your LaTeX file

\write18{del *.aux}
\write18{del *.log}
\write18{del *.gz}

or more pricise

\write18{del \jobname.aux}
\write18{del \jobname.log}
\write18{del \jobname.synctex.gz}
\write18{del \jobname.toc}
\write18{del \jobname.loc}

del is a DOS-function. Use rm for UNIX.

Alexey Malistov
A: 

For MikTeX:

texify -cp  file.tex

It will run pdflatex as many times as necessairy and clean temp files afterwards. Very useful.

Boocko