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
    Nov 24 '12 at 0:21
  • 2
    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... Nov 24 '12 at 0:45
  • 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! Nov 24 '12 at 0:59

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. Nov 24 '12 at 1:39

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.