Can I compile my document with other tools and use latexmk -C only for cleaning up?

One application could be to use it then in the clean: section of a Makefile that uses pdflatex for make pdf.

  • 1
    I don't understand your question. Is there a certain functionality of latexmk -C you're missing, or some part of it that you don't understand? Generally, such questions will probably be answered by the documentation/manual; if not, you could refer to an unclear passage in the manual here and ask for clarification. texdoc.net/pkg/latexmk (page 3)
    – doncherry
    Commented Nov 24, 2012 at 0:21
  • 3
    I think the OP does not want to build the document using latexmk, only to invoke it to delete the generated files, having compiled the document using different tools. In this case I believe the answer is no, because latexmk only builds the list of removable files when it processes the job, so it won't have this to hand if it does not process the job itself. But one can perhaps provide a less clever cleanup script that just deletes files with certain extensions... Commented Nov 24, 2012 at 0:45
  • 1
    Actually, maybe yes. Looking at latexmk.pl, it has a branch No fdb file, so do inferior job by parse_log. Trying this out on a small example might also be a quick way to answer the question! Commented Nov 24, 2012 at 0:59

1 Answer 1


Yes, you can use latexmk -C (or -c) just to clean up auxiliary files. By default, -c cleans up the following files types:

@generated_exts = ( 'aux', 'bcf', 'fls', 'idx', 'ind', 'lof', 'lot', 
                'out', 'toc' );

(latexmk.pl, l. 1088f)

-C also cleans up the actual output, i.e pdf, dvi, or what have you. If you want to add more file extensions to this list, have a look at https://tex.stackexchange.com/a/83386/4012.

latexmk -C / -c can be run no matter how you initially compiled your document, and may very well be used only for cleanup.

  • 2
    Also, on line 2165 of v4.35, the additional types 'blg', 'ilg', 'log', 'aux.bak', 'idx.bak' are cleaned up, but these are not part of @generated_exts as that variable also serves other purposes for which these entries would not be appropriate! A little later, line 2169, texput.log and texput.aux are taken care of also. Commented Nov 24, 2012 at 1:39

You must log in to answer this question.

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