步骤:
https://code.visualstudio.com/Download
http://www.tug.org/texlive/acquire-netinstall.html
打开VSCode,点击View -> Extension,在左边的搜索栏中搜索LaTex Workshop, 点击install即可安装
Ctrl+Shift+P打开搜索栏输入setting.json,打开配置文件
在setting.json里加上如下行配置代码
其中,"latex-workshop.latex.tools"中定义了编译工具,如latexmk,xelatex,pdflatex等等
"latex-workshop.latex.recipes"中定义了编译流程,即各种tool的编译顺序。第一个即为默认的编译方式。
在recipes中也可以定义自己的编译方式。
"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": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "pdflatex -> bibtex",
"tools": [
"pdflatex",
"bibtex"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],
"latex-workshop.view.pdf.viewer": "tab",
"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"
]
点击最左边的TEX标签,在Commands里面先选择“Build LaTex project”里的编译方式,再点击“View LaTex PDF”中的任一选项查看PDF。