Is there a way to make TeX delete files?
In my document a lot of auxiliary files are created and it would be wonderful to have them removed after their content has been used.
|
Is there a way to make TeX delete files? In my document a lot of auxiliary files are created and it would be wonderful to have them removed after their content has been used. |
||||
|
No, TeX itself can't delete files, just create or overwrite them. You need to use an external tool, like a LaTeX editor or Makefile to delete it for you. For example I also use Makefiles under Linux which contain a However, you should note that removing auxiliary files often will have an negative impact on compile time. You will then be forced to compile your document 2-3 times or sometimes more often. Some (La)TeX compilers (e.g. MikTeX) also offer to place the auxiliary files in a different folder. This way they don't annoy you in your main folder. |
||||
|
|
if you want get rid of those files in your document directory then use the optional argument
then my |
||||
|
|
|
Another solution is to use the
Let's say I have a
besides of course of
only two files remain:
If I want to have only According to the manual:
In case you need some "advanced" cleanup process, there's also a
The line must begin with a Lets say we have a
Now, when running
There we go, a clean project folder. |
|||
|
|
|
Unfortunately, I managed to have
In general, though, I prefer using the solution of Herbert, the |
|||||||
|
|
A variant of Herbert's answer: In MiKTeX, you can specify an pdflatex foo.tex --aux-directory="C:\Users\JaneDoe\Documents\LaTeX\auxiliaries-global" As a result you'll get foo.pdf in whatever directory foo.tex is; foo.aux, foo.out and whatnot go in the As has been noted, it's not recommended to delete the auxiliary files every time, but this is a neat way of "hiding" them and keeping your working directories from getting cluttered. Since I don't use TeX Live (yet), I don't know if there's a comparable tweak for it. |
|||||||||||
|
|
In case you are using Emacs with AucTeX, just run
This does not get rid of any temporary directories that are created, just files |
|||
|
|
|
FWIW, in ConTeXT you can delete the temporary files by passing
will run context multiple times and then delete the auxiliary and log files. |
|||
|
|
|
A TeXShop solution (Mac OS) As others have mentioned, deleting auxiliary files as a matter of course is not usually a good idea, especially for complex documents. However, it is useful to be able to delete them manually when needed. I use the following Applescript (written by Claus Gerhardt) saved as a macro in TeXShop. The script could also be adapted to other Mac editors. What I like about this script is that I can add new aux file extensions when needed, and it is able to deal with multiple part aux extensions such as
|
|||||||||
|
|
For manual deletion, the latex editor TeXstudio (and probably its parent TeXmaker as well) contains an option "Clean Auxiliary Files" in the Edit menu. As advised in other answers, aux file deletion should only be done manually when document no loner needs any further editing. |
|||
|
|
.gitignore, and easily get rid of them withgit clean -x -f. But check first withgit clean -x -n! – naught101 Jul 19 '12 at 5:43cleanutility. – Harish Kumar Dec 29 '12 at 1:40