vscode compile Latex configuration.
This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!
Originally, I didn't want to write an article about configuring the local LaTeX environment because there are already many related blogs and articles online. However, my junior sister made a mistake by copying the wrong configuration from the internet when setting up vscode, which caused the bibliography to fail to compile for half a day and was difficult to locate the problem. Therefore, I wrote this configuration guide to maintain a correct configuration and avoid similar issues in the future.
LaTeX Environment Configuration
Download the LaTeX compilation tool, it is recommended to use texlive
After the package is downloaded, click on install
Confirm the installation, after texlive is installed, type
tex
in the command line, if you get the following result, it means the system environment variable configuration is successful
vscode Configuration
Install the
latex-workshop
pluginPress
Ctrl+Shift+P
, typeopen user settings
to open the user configuration filesettings.json
Add the following content to the user configuration file
settings.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
// Definition of xelatex tool here
{
"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%"
]
},
{
"name": "biber",
"command": "biber",
"args": [
"%DOCFILE%"
]
},
],
// Set xelatex as the default first preferred compiler in the compilation chain
"latex-workshop.latex.recipes": [
{
"name": "pdflatex -> bibtex -> pdflatex",
"tools": [
"pdflatex",
"bibtex",
"pdflatex"
]
},
{
"name": "pdflatex -> biber -> pdflatex",
"tools": [
"pdflatex",
"biber",
"pdflatex"
]
},
{
"name": "pdflatex",
"tools": [
"pdflatex",
]
},
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],Open a
*.tex
file, if you see theTEX
icon on the left, it means the configuration was successful