How can I have LaTeX automatically delete the .aux file following an error I made? I may have missed a } for example.

Any error I make stops the compile. After I fix the error and re-run, LaTeX fails to compile and warns me about a corrupt .aux file. Then I need to delete the old .aux file and run LaTeX a third time. To get all of the references correct, I need to run it a fourth time. All for one missing }.

I am working on a huge document so this takes a while to perform. Also, I am running Windows so (please!) no solutions in Linux.

  • I seldom get a corrupted aux after an error. How do you stop latex when you get an error? Do you kill the application? – Ulrike Fischer Nov 6 '17 at 7:33
  • Maybe the first step is to speed up compilation. E.g. writing draft into the global options, comment out hyperref, use lmodern as font. Especially the hyperref package may lead to error messages about the aux-file and require a second run. – Keks Dose Nov 6 '17 at 14:55

You can install LaTeXmk (can be done on Windows (http://mg.readthedocs.io/latexmk.html).

Then go into your editors settings, there you should find a compile command somewhere.

Change this command to latexmk -pdf -c This should run all Texfiles in the directory. If your editor has a way of specifying which file to come pile, change the command to latexmk -pdf -c your-editors-way-of-specifying-file.

The -pdf ensures that you get a pdf and the -c deletes all the generated files.

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.