mac搭建latex

场景:

mac上安装latex和Visual Studio Code

安装步骤

下载mactex

https://www.tug.org/mactex/

下载Visual Studio Code

https://code.visualstudio.com/

添加环境变量

usr/local/texlive/2024/bin/universal-darwin
/Library/Tex/texbin

修改VSCode的Settings文件(见下面)

问题描述

recipe terminated with fatal error: spawn latexmk enoent.

# 添加环境变量
usr/local/texlive/2024/bin/universal-darwin
/Library/Tex/texbin

cannot find latex root file. see https://github.com/james-yu/latex-workshop/wiki/compile#the-root-file

# 在Visual Studio Code中的Settings文件中写上以下内容,然后关闭VSCode,使其生效
{
     //LaTex配置
    "editor.language.brackets": [],
    "[latex]": {
        "editor.quickSuggestions": {
        "comments": "on",
        "strings": "on",
        "other": "on"
        }
    },
    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-xelatex",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "lualatexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-lualatex",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "xelatexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-xelatex",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "latexmk_rconly",
            "command": "latexmk",
            "args": ["%DOC%"],
            "env": {}
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": ["%DOCFILE%"],
            "env": {}
        },
        {
            "name": "rnw2tex",
            "command": "Rscript",
            "args": [
                "-e",
                "knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')"
            ],
            "env": {}
        },
        {
            "name": "jnw2tex",
            "command": "julia",
            "args": ["-e", "using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")"],
            "env": {}
        },
        {
            "name": "jnw2texminted",
            "command": "julia",
            "args": [
                "-e",
                "using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")"
            ],
            "env": {}
        },
        {
            "name": "pnw2tex",
            "command": "pweave",
            "args": ["-f", "tex", "%DOC_EXT%"],
            "env": {}
        },
        {
            "name": "pnw2texminted",
            "command": "pweave",
            "args": ["-f", "texminted", "%DOC_EXT%"],
            "env": {}
        },
        {
            "name": "tectonic",
            "command": "tectonic",
            "args": ["--synctex", "--keep-logs", "%DOC%.tex"],
            "env": {}
        }
    ]
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值