[Tips] Mac 下vs code無法找到latex命令


vs code中安裝了latex language support和latex workshop,配置了setting json后, 運行編譯latex無反應,檢查log發現有如下報錯:

Does the executable exist? PATH: /usr/bin:/bin:/usr/sbin:/sbin

這是因為vscode的PATH讀取的不完整,找不到用戶后期(主要在/.bashrc或/.zshrc)添加的PATH信息。
可以如下修改setting json,將latex的命令路徑補充完整,從而避免這個問題:

"latex-workshop.latex.tools": [
        {
            "name": "xelatex",
            "command": "/Library/TeX/texbin/xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "%DOC%"
            ]
        },
        {
            "name": "latexmk",
            "command": "/Library/TeX/texbin/latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "%DOC%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "/Library/TeX/texbin/pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        },
        {
            "name": "bibtex",
            "command": "/Library/TeX/texbin/bibtex",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "xelatex",
            "tools": [
                "xelatex"
            ]
        },
        {
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        }
    ],


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM