0

Is there a command to delete all auxiliary files within the terminal without compiling the tex-file first?

There is such an option for latexmk but then I have to build the pdf first.

Edit

Ok, I try to be more explicit: Sometimes things go wrong and one has to delete all the aux, bbl, bcf etc. files. Some editor have this option but since we can compile a tex file with the terminal I was wondering whether there is also a function/program which would delete all those created auxiliary files automatically; e.g. $ cleartex . for all auxiliary files in that directory.

As moewe suggests such a program could have the gitignore list as base to work with.

6
  • 2
    I assume you would have to have a list of extensions of temporary files and then go through it and delete files you find with the extensions listed there. A start could be github.com/github/gitignore/blob/master/TeX.gitignore. I think I remember a different list with comments hosted on github, can't find it though.
    – moewe
    Jun 28, 2018 at 7:34
  • 1
    erh, not understod, there are no aux files if the PDF has not been build. latexmk -c *.tex will remove all aux files generated from the given .tex files.
    – daleif
    Jun 28, 2018 at 7:34
  • It isn't clear what you mean but rm *.aux removes all aux files from the current directory (or del rather than rm in windows cmd prompt) Jun 28, 2018 at 8:10
  • What would be the reason to delete the auxiliary files before running TeX? They are essential for the next run of TeX to be correct (or, at least, more correct than the previous one).
    – egreg
    Jun 28, 2018 at 8:23
  • 2
    yes, they are essential, but I might start compiling from scratch and having all auxiliary files deleted before compiling (and then keep them for the next rounds compiling). Jun 28, 2018 at 11:44

1 Answer 1

1

Ok, easiest method I can up with so far is

latexmk -C my-file.tex

I quote from the manual of latexmk for the flag -C:

Clean up (remove) all regeneratable files generated by latex and bibtex or biber. This is the same as the -c option with the addition of dvi, postscript and pdf files, and those specified in the $clean_full_ext configuration variable. This cleanup is instead of a regular make ...

4
  • This command does not delete the bibtex aux files (.bib, .brf, .aux). Is there a way to do that too?
    – Kolja
    Mar 25 at 10:59
  • I hope you do not really want to delete your bibliography file. That is something you do need. For the others you still can run rm *.{brf,aux} in your command line. Mar 25 at 19:03
  • That was a mistake, I meant .bbl instead of .bib. I am aware of basic terminal commands, I just wanted to know if there was a latexmk or bibtex argument that would take care of that.
    – Kolja
    Mar 25 at 19:30
  • 1
    Yeah, somehow not all of the aux/log/etc-files are deleted by latexmk -C. I ended up using a makefile and have a command like rm $(PROJECT)*.{blg,run.xml,toc,dep,fls,log,oai,bcf,bbl,aux,fdb_latexmk} to get all or at least most of those files. Mar 25 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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