修改 vscode 中的 settings.json 以在 Latex Workshop 中为 pdflatex 添加 shell 转义标志

Chr*_*ens 4 json latex pdflatex visual-studio-code

我是 VSCode 的新手,我正在设置 LaTeX。我正在尝试编译一个使用 minted 的 .tex 文档,因此 pdflatex 需要 --shell-escape 标志。我正在尝试修改 settings.json 来做到这一点。

我尝试添加以下内容(在互联网上找到)

 {
    "latex-workshop.latex.tools": {
        "name": "pdflatex",
        "command": "pdflatex",
        "args": [
            "--shell-escape", 
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOC%"
        ]
    }
}
Run Code Online (Sandbox Code Playgroud)

但是它出现了一个错误:类型不正确。预期的“数组”。这甚至不会让我尝试使用乳胶车间进行构建。帮助将不胜感激。

Gui*_*rmo 6

我遇到了同样的问题,在互联网上看起来很疯狂后,我找到了解决方案。您在那里拥有的代码段格式错误,这就是抱怨的原因。并且仅适用于 pdf 乳胶配方。这是需要添加到settings.json.

{
  ...,

  "latex-workshop.latex.tools": [
      {
        "name": "latexmk",
        "command": "latexmk",
        "args": [
          "-synctex=1",
          "-interaction=nonstopmode",
          "-file-line-error",
          "--shell-escape",
          "-pdf",
          "%DOC%"
        ]
      },
      {
        "name": "pdflatex",
        "command": "pdflatex",
        "args": [
          "--shell-escape",
          "-synctex=1",
          "-interaction=nonstopmode",
          "-file-line-error",
          "%DOC%"
        ]
      },
      {
        "name": "bibtex",
        "command": "bibtex",
        "args": [
          "%DOCFILE%"
        ],
        "env": {}
      }
    ],

  ...
}

Run Code Online (Sandbox Code Playgroud)

我找到了解决这里的相关pygmentize包问题