Latexmk:不允许切换输出文件,因为与文件请求不兼容

Latexmk:不允许切换输出文件,因为与文件请求不兼容

我使用该命令编译源代码:

$ latexmk -pdf main.tex

稍后我想清理该文件夹(确实这是规则的一部分make clean,但是没关系)。

$ latexmk -C
Latexmk: This is Latexmk, John Collins, 17 March 2019, version: 4.63b.
Latexmk: Disallowing switch of output file as incompatible
    with file requests.

为什么会产生该警告信息(第2和第3)?

答案1

latexmk在生成此警告消息的代码中搜索显示以下注释:

if ( $dvi_mode || $postscript_mode
     || ( $printout_mode && ($print_type eq 'ps') || ($print_type eq 'dvi') )
     || ( ($preview_mode || $preview_continuous_mode)  &&  ( ($view eq 'ps') || ($view eq 'dvi') ) )
   ) {
    # Automatic switching (e.g., pdf<->dvi o/p) requires pdf files to be
    # the only destinations.  So if ps or dvi files needed, we cannot
    # allow switching.  (There will then be an error condition if a TeX
    # engine fails to produce the correct type of output file.)
    warn "$My_name: Disallowing switch of output file as incompatible\n",
         "    with file requests.\n";
    $can_switch = 0;
}

因此,不要只是说要latexmk清理,而是指定您希望它清理编译为 PDF 时生成的所有文件:

$ latexmk -pdf -C
Latexmk: This is Latexmk, John Collins, 17 March 2019, version: 4.63b.

(添加-quiet到命令以删除最后一行,这只是一个信息而不是警告。)

相关内容