由于安装mactex默认的是pdftex,该解释器不支持中文所以需要xetex解释器
在settings.json的配置文件中需要加上下面这段代码配置文件
{
"editor.mouseWheelZoom": true,
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
],
},
{
"name": "pdflatex",
"tools": [
"pdflatex"
]
},
{
"name": "xe->bib->xe->xe",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdf->bib->pdf->pdf",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
}
该配置代码可以将pdftex转变为更为丰富的xetex。同时还有多种个性化配置
{
"workbench.colorTheme": "Default Light Modern"
// 禁止自动编译
"latex-workshop.latex.autoBuild.run": "never",
// 编译后自动清理无用文件
"latex-workshop.latex.autoClean.run": "onBuilt",
"latex-workshop.latex.clean.subfolder.enabled": true,
// 自动使用上一次的编译器
"latex-workshop.latex.recipe.default": "lastUsed",
// 根据使用的包自动补全
"latex-workshop.intellisense.package.enabled": true,
// 不弹窗显示错误和告警信息
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
}
如有别的个性化配置会持续更新。