之前用VScode配置了Latex(原来的配置均从网络汇总),但是换了一台电脑,重新从网上找的配置不太满意,所以把原来的copy过来了,感觉还是原来的顺手呀。就当给自己存个档,顺便留给大家,有需要自取。
- 安装texlive
- 安装vscode
- 在vscode中安装latex workshop 插件
- 在vscode-setting.json中复制如下代码
完成!
另外可能存在一些些问题,譬如评论区有位小伙伴
”build的时候显示Recipe terminated with fatal error: spawn xelatex ENOENT.怎么办“
大概这也是我没想过的问题,我搜了一下,可能的解决方案是
把安装路径加入到系统环境变量path里重启,我的就是 D:texlive2020binwin32
以及如果点了半天Recipe:xelatex或者Recipe:pdflatex等没反应,一定要检查自己的latex框架写对了没有
documentclass[UTF8]{ctexart}
begin{document}
begin{equation}
a^2+b^2=c^2
end{equation}
end{document}
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"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": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.clean.enabled": false,
"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"
],
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.autoClean.run": "onBuilt"
}