VSCode配置Latex

因为CTeX套装自带WinEdt编辑器难用、收费且不能实时编译显示pdf效果,本笔记主要记录如何在VSCode中编辑Tex文件,实现代码自动补全及实时查看文本编辑效果等功能。

1、软件下载

CTEX下载地址:http://www.ctex.org/HomePage,建议下载完整版套装。

VSCode下载地址:https://code.visualstudio.com/

2、软件配置

在VSCode中安装对应的插件

更改配置文件

file >> preferences >> setting >> User Setting >> Extensions >> LaTex Workshop configuration >> active 中,打开 Edit in setting.json 文件。在文件中添加如下字段:

1
2
3
4
5
6
7
8
9
10
"latex-workshop.latex.recipes": [{
"name": "xelatex",
"tools": ["xelatex"]
}, {
"name": "latexmk",
"tools": ["latexmk"]
}, {
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": ["pdflatex", "bibtex", "pdflatex", "pdflatex"]
}],
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"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%"]
}],
1
"latex-workshop.view.pdf.viewer": "tab",
1
"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"],
1
"latex-workshop.latex.clean.enabled": false,

添加后的效果如下图所示:

3、开启自动保存,实时查看编辑效果

file中将 auto saved勾选上即可。效果如下图:

-------------本文结束感谢您的阅读-------------
您的鼓励就是我创作的动力,求打赏买面包~~
0%