LaTeX在vscode上的编辑与预览环境配置
MCM 的准备工作
- VSCode
- Windows11
- LaTeX
- Reference: [Zhui Hu]Visual Studio Code (vscode)配置 LaTeX - Ali-loner
TeX Live 的下载与安装
下载 TeX Live
使用 TeX Live 是为了编译 .tex
也就是 LaTeX 源文件
download TeX-Live

点击截图中高亮标出的,从上往下第一个链接,
第二个链接mirror list
是为了自动选择 mirror
较慢时人工选择一个 mirror
- 这里用的是 iso,后续的步骤也是根据 iso 的,你也可以选择联网下载版
安装 TeX Live
在下载完 .iso
文件后

在右键菜单中选择装载或者使用上面的工具菜单中的选项

打开装载到的驱动器,选中.bat
文件,
右键,并在右键菜单中选择以管理员身份运行
在一个欢迎页面后

我选择 advanced 选项

同时修改安装路径,且取消安装 TeX 前端

因为我们使用 vscode 作为前端。接下来点击安装并等待一安装完成,这个安装也是相当的慢,主要是 TeX Live 带着所有 package 然后安装也没有并行,CPU 和硬盘的利用率其实都不高。

文件解压完成之后会进行配置操作,等几分钟就好了

看到这个页面说明安装完成了

VSCode 的 LaTeX 环境配置
安装 LaTeX Workshop 插件
- 注意,选择 James Yu 的版本,点击 Install

然后如图所示,进入插件的设置页面

然后打开 json 文件

在右花括号的上面添加以下代码
注意,代码块中为了高亮,带上了前后花括号,请在添加时去除。
1 | { |
测试 LaTeX
随后,为了测试 LaTeX 配置情况,下载一份 LaTeX 样例进行测试Ali-loner/Ali-loner.github.io
可以选择 Git Clone 或者 Download zip,然后在 VSCode 中打开这个项目的文件夹

如图进行操作,如果编译正常,status bar 将会出现 √,反之则是 x

随后我们选择在 VSCode 内预览 PDF

如果结果像图片所示,那么你的环境应该是配置成功了。
参考
- 大部分流程来源于 [Zhui Hu]Visual Studio Code (vscode)配置 LaTeX - Ali-loner
- 一些具体的配置细节也可以参考该文,其中部分细节可能与当前不同