前言

利用 VSCode 在本地配置 LaTex 编译环境。

Overleaf 编译太慢了,经常超时。

操作系统:Windows 11 家庭中文版

参考文档

  1. LaTeX环境的安装和配置 (vscode版)
  2. 利用VSCode进行Latex内容的编写开发
  3. 利用VScode编写Latex,用bib文件导入参考文献一直不显示,应该怎么解决?

步骤

  1. 清华大学开源软件镜像站上选择后缀名为 .iso 的文件进行下载即可(如 texlive.iso)。

  1. 双击打开 texlive.iso 文件,点击文件里面的 .bat 批处理文件即可打开图形化安装界面。

  1. 修改安装位置,然后点击 Advanced 进入高级界面,只安装英语和汉语。

  1. 点击安装,需要较长时间。

  1. win + r 打开控制界面,输入 cmd,在命令窗口写入命令检查是否安装完成:
1
tex -v

  1. 为 VSCode 安装如下插件 (LaTeX Workshop):

  1. 安装后,左侧出现一个 TEX 标志。

  2. 创建一个 .tex 文件:

1
2
3
4
5
6
7
\documentclass{article}
\usepackage{ctex}
\begin{document}

hello,\LaTeX

\end{document}
  1. 点击右上角绿色的运行按钮,即可编译出 pdf 文件。

  1. 进行中文的编译需要导入 ctex 包。
1
2
3
4
5
6
7
8
9
\documentclass{article}
\usepackage{ctex}
\begin{document}

hello,\LaTeX

你好,世界!

\end{document}

  1. 配置 json 文件(输入 Ctrl+Shift+p,在搜索框输入 user 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
105
106
107
108
109
110
111
112
113
114
115
116
{
"latex-workshop.latex.autoBuild.run": "never",
"latex-workshop.showContextMenu": true,
"latex-workshop.intellisense.package.enabled": true,
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"name": "PDFLaTeX",
"tools": [
"pdflatex"
]
},
{
"name": "BibTeX",
"tools": [
"bibtex"
]
},
{
"name": "LaTeXmk",
"tools": [
"latexmk"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
],
"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"
],
"latex-workshop.latex.autoClean.run": "onFailed",
"latex-workshop.latex.recipe.default": "lastUsed",
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click"
}

结语

第一百一十八篇博文写完,开心!!!!

今天,也是充满希望的一天。