梦入琼楼寒有月,行过石树冻无烟

📖 earlier posts 📖

LaTex and VSCode

LeTex 是一个基于 TEX 的排版系统,由美国计算机科学家 Leslie Lamport 在20世纪80年代初期开发,这种格式与 Markdown 类似,两者的区别在于 LeTex 发展至今,主要面向期刊、论文和科技、数学、物理等文档的写作。

而至于 Markdown 则更加面向开发人员和其他写作类需求的群体来进行文档的编写,之后导出的文件形式诸如 html\img\pdf 等,而 LeTex 更多的则面向 pdf。在 LaTex 中,我们可以深刻的体验到学院派的作风是多么的令人敬佩。

Install LaTex

安装 LaTex 的方式有很多,通常使用的是通过 ISO 来进行安装的,这种方式安装主要原因是因为 LaTex 他很大,一共有 4g 左右,即使下载后他也要解压信息,整个安装过程需要半个小时左右。

你可以通过 CTAN 来进行下载,你可以选择其中的 texlive2022.iso 直接进行下载,之后拿到 ISO 文件后直接查看文件内容,选择 EXE 文件运行即可,Next 到安装过程(当然也可以选择安装位置进行安装)

1
CTAN(Comprehensive TeX Archive Network) 是一个主要的 Tex 资源搜集站点, 搜集了各种 Tex 的软件和文章等。

安装完后,使用 tex -v 来查看是否有正确的输出,如果成功输出则表示 LaTex Live 安装完成。

在此之后你需要决定,你是使用 LaTex 还是对于开发者更加友好的 VSCode 了,在本文中,我们主要使用 VSCode 开始编写 LaTex 文章。

VSCode config

安装完之后,我们还需要对 VSCode 来进行设置,中的 setting.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
{

    "security.workspace.trust.untrustedFiles": "open",

    "editor.minimap.enabled": false,

    "window.zoomLevel": 3,

    "latex-workshop.view.pdf.viewer": "external",

    "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",

            "tools": [

                "xelatex"

            ]

        },

        {

            "name": "PDFLaTeX",

            "tools": [

                "pdflatex"

            ]

        },

        {

            "name": "BibTeX",

            "tools": [

                "bibtex"

            ]

        },

        {

            "name": "LaTeXmk",

            "tools": [

                "latexmk"

            ]

        },

        {

            "name": "xelatex -> bibtex -> xelatex*2",

            "tools": [

                "xelatex",

                "bibtex",

                "xelatex",

                "xelatex"

            ]

        },

        {

            "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",

    "workbench.colorTheme": "Eva Light Bold"

}

在这之后,我们可以通过在 overleaf 选择一个 laTex 模板来进行使用测试下,也可以直接手动创建,主动权在你。如果是第一次接触 LaTex,个人建议可以在 overleaf 中找到一个模板。

之后配合 Latex 的中文文档来进行阅读,当然 LaTex 发展至今,文档生态和使用者已经遍布了很多领域和正式的报告中,我们需要知道的是,在编译的过程中。

很有可能会出现参考文献不出现等情况,我们可以尝试下多编译几次或直接使用 latexmk 来处理所有步骤,至于 LaTex,我们也可以使用 texdoc lshort-chinese 来翻阅 LaTex 的中文文档。

📕 end of posts 📕