为VSCode的Latex Workshop插件添加用户定义的编译recipe
上图所示,装了Tex Live和VSCode插件Latex Workshop之后,默认会有红框内的编译方案。但是,网上下载的其他latex模板需要其他编译方式,比如
xelatex -> bibtex -> xelatex -> xelatex
这时候需要我们手动添加这个编译顺序,操作如下:
- 在现有的latex模板文件夹下新建一个.vscode文件夹,再在此文件夹中新建一个settings.json。
- 把自定义的编译顺序写进json文件,保存。
- 重新用VSCode打开该文件夹,即可见到下图效果注意,settings.json中的内容将完全覆盖之前的默认编译顺序。移除settings.json后即恢复到上图的情况。
settings.json
实例:
{
// Latex workshop
"latex-workshop.latex.recipes": [
{
"name": "xe->bib->xe->xe",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],
"latex-workshop.latex.tools": [
{
"name": "texify",
"command": "texify",
"args": [
"--synctex",
"--pdf",
"--tex-option=\"-interaction=nonstopmode\"",
"--tex-option=\"-file-line-error\"",
"%DOC%.tex"
]
},
{
// 编译工具和命令
"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%"
]
}
]
}