LaTeX + vscode 安装配置详细步骤
安装LaTeX
下载ISO
使用清华开源平台tuna可快速下载。搭配IDM使用效果更佳(使用校园网搭配IDM下载约20分钟)
- 进入
https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/
- 下载
texlive.iso
安装
- 将下载好的iso文件解压
- 运行
install-tl-windows.bat
- 注意 不是运行.exe文件
- 注意 在安装过程中不要关闭自动打开的cmd和窗口
- 选择安装路径,建议安装到C盘,避免以后使用中不必要的麻烦(但安装体积较,应根据自身情况酌情考虑)
- 等待安装完成,共约4100个包,安装时间约1~2小时。(机械硬盘,网速不佳会更久)
换源
-
使用管理员身份打开PowerShell或cmd:(win)右键左下角
win徽标
,选择PowerShell(管理员)
即可 -
复制下面指令并运行
tlmgr option repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet
配置vscode
-
安装插件
-
Ctrl+shift+P
输入settings,打开工作区配置文件 -
在{}中复制一下代码
方法来自b站:-老湿基-
// ======================== LaTeX 设置 BEGIN ======================== // bibtex 格式 "latex-workshop.bibtex-format.tab": "tab", // 自动编译,全部关闭,当且仅当你认为有需要的时候才会去做编译 "latex-workshop.latex.autoBuild.run": "never", "latex-workshop.latex.autoBuild.cleanAndRetry.enabled": false, // 设置 latex-workshop 的 PDF 预览程序,external 指的是外部程序 "latex-workshop.view.pdf.viewer": "external", "latex-workshop.view.pdf.ref.viewer": "external", "latex-workshop.view.pdf.external.viewer.command": "D:/Users/newton/Documents/Softwares/software_windows/design/SumatraPDF-3.2-64.exe", "latex-workshop.view.pdf.external.viewer.args": [ "%PDF%" ], // 配置正向、反向搜索:.tex -> .pdf "latex-workshop.view.pdf.external.synctex.command": "D:/Users/newton/Documents/Softwares/software_windows/design/SumatraPDF-3.2-64.exe", "latex-workshop.view.pdf.external.synctex.args": [ // 正向搜索 "-forward-search", "%TEX%", "%LINE%", "-reuse-instance", // 反向搜索 "-inverse-search", "\"C:/Program Files/Microsoft VS Code/Code.exe\" \"C:/Program Files/Microsoft VS Code/resources/app/out/cli.js\" -gr %f:%l", "%PDF%" ], // 这是一些独立的编译选项,可以作为工具被编译方案调用 "latex-workshop.latex.tools": [ { // Windows 原生安装 TeX Live 2021 的编译选项 "name": "Windows XeLaTeX", "command": "xelatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdf", "%DOCFILE%" ] }, { // Windows Biber 编译 "name": "Windows Biber", "command": "biber", "args": [ "%DOCFILE%" ] }, { // WSL XeLaTeX 编译一般的含有中文字符的文档 "name": "WSL XeLaTeX", "command": "wsl", "args": [ "/usr/local/texlive/2021/bin/x86_64-linux/xelatex", "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdf", //"-output-directory=%OUTDIR%", //"-aux-directory=%OUTDIR%", "%DOCFILE%" ] }, { // WSL biber / bibtex 编译带有 citation 标记项目的文档 "name": "WSL Biber", "command": "wsl", "args": [ "/usr/local/texlive/2021/bin/x86_64-linux/biber", "%DOCFILE%" ] }, { // macOS 或者 Linux 的简单编译 // 两种操作系统的操作方式相同 "name": "macOS / Linux XeLaTeX", "commmand": "xelatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdf", "%DOCFILE%" ] }, { // macOS 或者 Linux 的索引编译 // 两种操作系统的操作方式相同 "name": "macOS / Linux Biber", "command": "biber", "args": [ "%DOCFILE%" ] } ], // 这是一些编译方案,会出现在 GUI 菜单里 "latex-workshop.latex.recipes": [ { // 1.1 Windows 编译简单的小文档,这个选项不太常用,因为绝大多数文章都需要有参考文献索引 "name": "Windows XeLaTeX 简单编译", "tools": [ "Windows XeLaTeX" ] }, { // 1.2 Windows 编译带有索引的论文,需要进行四次编译;-> 符号只是一种标记而已,没有程序上的意义 "name": "Windows xe->bib->xe->xe 复杂编译", "tools": [ "Windows XeLaTeX", "Windows Biber", "Windows XeLaTeX", "Windows XeLaTeX" ] }, { // 2.1 WSL 编译简单的小文档,这个选项不太常用,因为我绝大多数文章都需要有引用。 "name": "XeLaTeX 简单编译", "tools": [ "WSL XeLaTeX" ] }, { // 2.2 带有 citation 索引的文档,需要进行四次编译;-> 符号只是一种标记而已,没有程序上的意义 "name": "xe->bib->xe->xe 复杂编译", "tools": [ "WSL XeLaTeX", "WSL Biber", "WSL XeLaTeX", "WSL XeLaTeX" ] }, { // 3.1 macOS 简单 小文档 "name": "macOS XeLaTeX 简单编译", "tools": [ "macOS XeLaTeX" ] }, { // 3.2 macOS 四次编译 "name": "macOS xe->bib->xe->xe 复杂编译", "tools": [ "macOS / Linux XeLaTeX", "macOS / Linux Biber", "macOS / Linux XeLaTeX", "macOS / Linux XeLaTeX" ] } ], // 清空中间文件 "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", "*.bcf", "*.run.xml", "*.synctex.gz" ],
运行
方法来自b站:-老湿基-
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix