vscode中关于lateX的setting.json配置文件后编译不生效的问题

修改过程:

大家在第一次使用vscode中的latex_workshop插件时肯定会对setting.json文件进行环境配置,但本人按照教程配置结束后发现还是编译不了.tex文件,搜索过后还是无果,查看log信息后发现报告了两处可疑信息:

第一处:

 error: spawn xelatex ENOEN

第二处:

Does the executable exist? $PATH: undefined,

这两处报告信息都说明是路径问题,搜索过后网上的修改意见有两点:

第一点:检查环境变量是否添加了texlive的bin文件路径,在这里笔者将系统和用户变量路径都添加过了,依旧无效。

第二点:与anaconda环境变量冲突,IDE先搜索的是anaconda的bin路径,笔者将texlive的bin路径移动到anaconda前面还是无效。

最终结果:

笔者最后尝试修改setting.json文件中的信息:

教程部分代码如下:

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

这是用来链接texlive中latex工具的代码,笔者尝试将其中的路径修改为绝对路径,即修改成:

"latex-workshop.latex.tools": [
        {
            "name": "xelatex",
            "command": "C:\\texlive\\2024\\bin\\windows\\xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "C:\\texlive\\2024\\bin\\windows\\pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "latexmk",
            "command": "C:\\texlive\\2024\\bin\\windows\\latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOCFILE%"
            ]
        },
        {
            "name": "bibtex",
            "command": "C:\\texlive\\2024\\bin\\windows\\bibtex",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],

测试之后发现可以成功编译测试文件,测试文件下载地址:Click here to download the LaTeX testfile for vscode

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值