Visual Studio Code 上未安装 Pygmentize 的错误

Visual Studio Code 上未安装 Pygmentize 的错误

去年我一直在使用 VS Code + Latex Workshop 来编写我的 tex 文档,但是今天我尝试使用minted我安装在/usr/local/bin/pygmentize

在我的序言中,我使用了这一行\usepackage{minted},当我尝试生成 pdf 时,我的.log文件中出现了这个错误:

Package minted Error: You must have `pygmentize' installed 
to use this package.

我该如何解决?

答案1

您可以尝试@David Carlisle 的评论,通过--shell-escape在 LaTeX Workshop 的偏好设置中添加编译命令,如下所示:

// in USER SETTINGS add the following
"latex-workshop.latex.tools": [
    {
        "name": "latexmk",
        "command": "latexmk",
        "args": [
            "--shell-escape", // added arg to default
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "-pdf",
            "%DOC%"
        ]
    },
    {
        "name": "pdflatex",
        "command": "pdflatex",
        "args": [
            "--shell-escape", // added arg to default
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOC%"
        ]
    },
    {
        "name": "bibtex",
        "command": "bibtex",
        "args": [
            "%DOCFILE%"
        ]
    }
]

这对我来说适用于 VS Code 1.24.1 和 LaTeX Workshop 5.5.1。

相关内容