如何在 Linux 中隐藏由 pdflatex 生成的 extra/auxiliary 文件

How to hide extra/auxiliary files generated by pdflatex in Linux

我在 Visual Studio 代码中看到 this similar question which suggest using latexmk -c or pdflatex -aux-directory=/some/temp/dir <additional options>. I prefer the latter because you can create a subdirectory without having to remove and generate files repeatidly. Currenlty, this option is "only implemented on the MiKTeX version of (pdf)latex". On the other hand, the former approach does not seem to work properly. I use LaTeX Workshop 的答案,默认情况下使用 latexmk。为了添加 -c 标志,我创建了以下 receipe:

"latex-workshop.latex.tools": [
        {
            "name": "latexmk -c",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-c",
                "%DOC%"
            ]
        }
      ],

    "latex-workshop.latex.recipes": [
        {
            "name": "latexmk -c",
            "tools": [
              "latexmk -c"
            ]
        }
      ]

如果我首先从乳胶源文件创建 pdf 文件,然后为下一次编译添加 -c 标志,它会正确删除其他文件。但是,如果您是第一次编译(当没有可用的 pdf 或辅助文件时),它不会生成任何 pdf 文件,我应该考虑删除 -c 标志。即使您已经拥有可用的 pdf 文件及其相关文件,一旦您仅从文件夹中删除 pdf 文件,也会出现同样的问题。有没有一种有效的方法可以在 Linux(或 vscode)中隐藏此类辅助文件(通过删除它们或最好将它们放在子文件夹中)?

我在 .vscode/settings.json 中有以下条目:

"latex-workshop.latex.outDir": "%DIR%/aux",

效果很好。所有临时文件都保存在 aux 中,因此编译速度很快但不会污染我的 .tex 文件

您可以在 VSCode 的 LaTex Workshop 选项中进行设置。

启用该选项后,编译成功后,所有辅助文件都会自动删除。