场景:
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": {}
}
]
}
1万+

被折叠的 条评论
为什么被折叠?



