I'm trying to use latexmk -c (or latexmk -C) to clean a directory, but when I run any of these two commands, I get the following:

Latexmk: This is Latexmk, John Collins, 21 May 2019, version: 4.64a.
Latexmk: Disallowing switch of output file as incompatible
    with file requests.

The "Disallowing switch..." message seems to be related to the -pdf option. If added (as in, latexmk -c -pdf), the message disappears, and there are no visible effects on the amount of deleted files.

I have a main.tex which contains Beamer code, and when I run latexmk -pdf main.tex, the following files are produced (besides main.pdf itself):


If I run latexmk -c, most of the files are cleaned, but the following remain:


How can I remove these Beamer-related files using latexmk?

  • 2
    exactly how are you running the command? I normally run it as latexmk -c file.tex to clean everything related to file.tex – daleif Jul 2 '19 at 10:28
  • I supposed just running latexmk -c without arguments would suffice, removing *.aux and similar files. However, even if I run latexmk -c main.tex, I get the same result. – anol Jul 2 '19 at 12:23
  • Interesting, exactly which version are you running (latexmk -version) and which operating system? Using 4.65 on linux latexmk -c with no args works fine. – daleif Jul 2 '19 at 12:34
  • I posted an answer from what I realized, the warning threw me off but it does not affect the behavior. I believe a feature request for latexmk to include vrb, snm and nav files would be helpful. – anol Jul 2 '19 at 12:47
  • 2
    Just to reinforce the information about the warning message: It's purely informational, and can be ignored here. See the section "ALLOWING FOR CHANGE OF OUTPUT FILE TYPE" in the latexmk documentation to understand what it's about. – John Collins Jul 2 '19 at 14:58

latexmk has an internal list of extensions that are known to be safe to delete. But it does not know all extensions used by all LaTeX packages or which of them are safe to delete.

latexmk can read configuration files (you'll have to look up where they are located for your self), in there you can give a space separated list of save extensions for latexmk -c to delete. I have the following in my global latexmkrc:

$clean_ext = "synctex.gz nav snm thm soc loc glg acn";

Latexmk manual: https://mg.readthedocs.io/latexmk.html (not sure how up to date it is, but it does mention the locations of the configuration 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.