latex 是一款功能强大的排版系统,广泛应用于学术论文的排版,许多西方高校和期刊都提供了各自的 latex 模板,方便论文提交。尽管 latex 有许多相关的 ide,如 texstudio、bakoma 和 lyx 等,但它们往往给人一种笨重的感觉。如今,vscode 为我们提供了一种更轻便的选择。
安装 LaTeX有两种安装 LaTeX 的方法。
1.手动安装对于 LaTeX 的常见版本,推荐使用 MiKTeX,它是最小安装版本,Windows 安装包约 200 多 MB,MacOS 安装包约 50 多 MB。相比于许多人推荐的 TeXLive(3.7 G)和 MacTeX(4.0 G),它要轻便得多。官方下载地址如下:https://www.php.cn/link/db1f6a0fc31f5666393cd306d561885f
2.自动安装即使用包管理器进行安装。
对于 Windows 用户,可以使用 Scoop 或 Chocolatey:
scoop install latex choco install miktex
对于 MacOS 用户,可以使用 Homebrew:
brew cask install basictex
扩展配置LaTeX Workshop 是 VSCode 中编写 LaTeX 的必备扩展。安装后,按 "ctrl"+"," 打开配置,并在搜索框中输入 "json",打开配置的 .json 文件。

对于 MacOS 用户,加入以下配置:
{
"latex-workshop.latex.recipes": [
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"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%"
]
}
],
"latex-workshop.view.pdf.viewer": "tab",
}对于 Windows 用户,加入以下配置:
{
"latex-workshop.latex.recipes": [
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"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%"
]
}
],
"latex-workshop.view.pdf.viewer": "tab",
}LaTeX Utilities 是 LaTeX Workshop 的补充扩展。其功能包括:

功能扩展拼写检查对于使用 LaTeX 进行英文写作的用户,拼写检查是必不可少的。Street Side Software 公司在 VSCode 中提供了一系列相关的扩展,涵盖了 20 多种主要西方语言,可以根据需要进行安装。

安装拼写检查扩展后,需要在 setting.json 中进行一些配置,如拼写检查针对的语言、文件类型以及是否忽略组合词(compound words)。
{
"cSpell.language": "en,es,fr",
"cSpell.enableFiletypes": [
"!asciidoc",
"!haskell",
"!javascriptreact",
"!scss",
"!typescriptreact",
"fsharp",
"lua",
"mermaid",
"perl",
"powershell",
"r",
"rmd",
"tex",
"toml",
"vue",
"xml",
"lrc",
"py",
"md"
],
"cSpell.allowCompoundWords": true,
"cSpell.enabled": true,
}格式转换推荐使用文档格式转换的瑞士军刀 Pandoc。可以从官网手动下载:
https://www.php.cn/link/d454766e392ac21320cccd0b55ecba00
也可以使用包管理器自动下载。
对于 Windows 用户,可以使用 Scoop 或 Chocolatey:
scoop install pandoc choco install pandoc
对于 MacOS 用户,可以使用 Homebrew:
brew install pandoc brew install pandoc-citeproc
宏包管理基本操作对于 Windows 用户,不需要特别管理包,当在文档中导入未安装的包时,LaTeX 会自动弹出窗口,询问是否安装。
对于 MacOS 用户,需要使用包管理器 tlmgr 管理 LaTeX 包。
# 升级自身 sudo tlmgr update --self # 升级所有包 sudo tlmgr update --all # 列出已安装包 sudo tlmgr list --only-installed
☆ END ☆
以上就是如何快速搭建 LaTeX 轻量级写作环境(VSCode)?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号