該文最於的時候是,2018年12月左右,vscode 的latex workshop版本爲5.0。
當vs code的latex workshop更新到5.0之後,原來的toolchain屬性沒了,變成了tools 和recipes 兩個屬性。請注意對照自己的workshop版本號。
在該版本中,在VScode中通過cmd+,
快捷鍵調出配置文件。
// "latex-workshop.view.pdf.viewer": "browser",//瀏覽器中打開
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%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 -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
]
在vscode配置好了,之後可以就選擇自己需要的編譯方式了。
2019年6月更新
vscode 版本: 1.35.0 (1.35.0)
tex workshop 版本:7.0.2
這次更新vs之後,按cmd+,
調出來的偏好設置頁面如下。tex的配置需要到Latex插件的配置文件setting.json
裏面進行配置。
打開setting.json
把上面的配置粘貼保存,就可以了。