9

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):

main.fdb_latexmk
main.fls
main.log
main.nav
main.out
main.snm
main.toc
main.vrb

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

main.nav
main.snm
main.vrb

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

6
  • 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
    Commented Jul 2, 2019 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
    Commented Jul 2, 2019 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
    Commented Jul 2, 2019 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
    Commented Jul 2, 2019 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. Commented Jul 2, 2019 at 14:58

1 Answer 1

11

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)

3
  • I have kept the .latexmkrc file in my project directory. It working properly on the directory, but not on the sub-directories. What should I change to enable it in the subdirectories too?
    – raf
    Commented Sep 10, 2021 at 10:07
  • @raf your question is not related to this answer, please post your own question. Note that I keep mine in the root of my home directory or use a custom one via -r file.rc
    – daleif
    Commented Sep 10, 2021 at 10:34
  • 1
    It is worth noting that clean_ext defines additional extensions to what is built into latexmk. As your example shows, you don't need to put in things like .aux or .toc etc. Commented Mar 7, 2022 at 19:48

You must log in to answer this question.

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