下载 TeX Live
安装
安装 LaTeX Workshop 插件
{//这个大括号本来就有,内含一些之前的配置,以下配置只是添加到 setting.json
//禁止自动编译
"latex-workshop.latex.autoBuild.run": "never",
//不弹出报错、警告窗
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
//pdf预览
"latex-workshop.view.pdf.viewer": "tab",
//自动删除一些过程文件
"latex-workshop.latex.autoClean.run": "onBuilt",
//指出编译后删除的文件种类
"latex-workshop.latex.clean.fileTypes":[
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk",
"*.gz"
],
//定义编译策略,默认首个,xelatex支持中文,故放在第一个
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],
//LaTeX tools
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-preview.command": "xelatex",
//自定义PDF预览工具,这里使用 SumatraPDF.exe,记得改路径
"latex-workshop.view.pdf.external.viewer.command": "G:/R/RStudio/bin/sumatra/SumatraPDF.exe",
//前向搜索,后向搜索,记得改文件的路径
"latex-workshop.view.pdf.external.viewer.args": [
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
"-inverse-search",
"\"E:/.../Microsoft VS Code/Code.exe\" \"E:/.../Microsoft VS Code/resources/app/out/cli.js\" -gr \"%f\":\"%l\"",
"%PDF%"
],
"latex-workshop.view.pdf.external.synctex.command": "G:/R/RStudio/bin/sumatra/SumatraPDF.exe",
"latex-workshop.view.pdf.external.synctex.args": [
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
"-inverse-search",
"code \"E:/.../Microsoft VS Code/resources/app/out/cli.js\" -gr \"%f\":\"%l\"",
"%PDF%",
]
}
.tex
文件;pdf
文件;注意
:新版本的 LaTeX Workshop 在打开 View log messages
界面后会出现编译失败的问题,出现 Cannot find LaTeX root file
的错误;pdf
文件;注意
:新版本的 LaTeX Workshop 在打开 View log messages
界面后会出现编译失败的问题,出现 Cannot find LaTeX root file
的错误;log
界面仍出现 Cannot find LaTeX root file
错误,请检查 TeX Live
是否安装正确,并检查环境变量是否配置好。