Let assume that I want to compile the document doc.tex with latexmk and clear the processing files. When I do latexmk -c doc.tex, it gives me the following output :

Latexmk: This is Latexmk, John Collins, 11 Nov. 2012, version: 4.35.
**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
Latexmk: Examining log file 'doc.log' for generated files...

and nothing, the document isn't compiled. But if I do successively do latexmk doc.tex then latexmk -c doc.tex, the document is compiled at the first step and the processing files are removed at the second step.

So my question is, why the first method doesn't work, and how to do it in only one step ?

1 Answer 1


from texdoc latexmk

Clean up (remove) all regeneratable files generated by latex and bibtex or biber except dvi,
postscript and pdf. These files are a combination of log files, aux files, latexmk’s database file of
source file information, and those with extensions specified in the @generated_exts configuration
variable. In addition, files specified by the $clean_ext configuration variable are removed.

This cleanup is instead of a regular make. See the -gg option if you want to do a cleanup then a make.

The keyword is instead in the last sentence.

  • Thank for your answer. So I understand why my first command doesn't work. But is it any way to compile and then clean up in only one command ?
    – P.-A.
    May 24, 2016 at 9:02
  • @P.-A. AFAIK there isn't, btw why do it that way? Then next time you compile it has to compile several times because you deleted the auxiliary files
    – daleif
    May 24, 2016 at 9:05
  • 1
    @P.-A. You may try latexmk doc.tex && latexmk -c doc.tex... May 24, 2016 at 9:05
  • please read the latexmk manual, I know it is impressive but to understand the -gg option it will be worthwhile May 24, 2016 at 9:06
  • @PaulGaborit I was looking for a more "compact" solution, but it seems to do not exist. Thank you for the answer.
    – P.-A.
    May 24, 2016 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .