前言
换了新电脑,刚好配一下LaTeX环境,以便后面写毕设论文。实在用不惯Word,告辞。
LaTeX配置
镜像下载
搜索texlive2025.iso
,各大高校镜像站都能下到。比如:texlive2025.iso - 清华大学开源软件镜像站或者是texlive2025.iso - 西安交通大学软件镜像站。
Win10及以上自带了虚拟光驱,直接双击打开就行。
安装设置
打开挂载后的镜像,选择install-tl-windows.bat
,运行后会得到下面的GUI安装界面:
可以修改安装位置。这里点进去Advanced,展开高级设置:
然后点开N. of collections
,选择一下语言。这里就选中文和英语,应该够了吧。此外,安装位置也可以选。全套装完大约占用10G的空间,C盘不够的就移到别的盘里安装。
之后开始安装即可。等待时间有点长,显示的一刻钟就好,实际上大约半个小时。
听说第一步选择管理员身份运行也可以,但是后面每次更新包都要以管理员身份运行。但我测试了一下,正常运行tlshell
更新库好像没问题?
不选择管理员身份安装只是不能装到C盘根目录下罢了。
小BUG
安装时出现卡在running package-specific postactions
的问题:
查看安装日志install-tl.log
:
可以发现有安装完毕的欢迎语。应该是BUG了。
添加PATH
去高级系统设置里将安装目录下的bin/windows
加到用户变量。我的是C:\texlive\2025\bin\windows
。
包管理器
在终端执行tlshell
即可。开启后先在选项-Repositories中换一下源,清华和USTC都可。为什么不用交大源?是不想吗?
VSCode配置
VSCode安装过程略。
插件安装
在VSCode插件市场中搜索:LaTeX Workshop
,安装:
之后打开任意TeX模板,在左边就会显示LaTeX选项卡。
自定义编译选项
有些模板需要多次编译,比如pdflatex->pdflatex
,或是xelatex x3
。这时候需要自定义编译选项。
Ctrl+Shift+P
或者F1
打开命令面板,输入“用户设置”,找到那个preferences: Open User Settings (JSON)
。
打开后编辑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
| { "latex-workshop.latex.tools": [ { "name": "pdflatex", "command": "pdflatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "xelatex", "command": "xelatex", "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*3", "tools": [ "xelatex", "xelatex", "xelatex" ] }, { "name": "xelatex -> bibtex -> xelatex*2", "tools": [ "xelatex", "bibtex", "xelatex", "xelatex" ] }, { "name": "pdflatex -> bibtex -> pdflatex*2", "tools": [ "pdflatex", "bibtex", "pdflatex", "pdflatex" ] }, { "name": "xelatex -> biber -> xelatex*2", "tools": [ "xelatex", "biber", "xelatex", "xelatex" ] }, ] }
|
就可以在你的编译选项中看到自定义编译方案了。
我还加了以下设置:
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
| { "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.clean.fileTypes": [ "*.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", "latex-workshop.view.pdf.viewer": "tab", "latex-workshop.synctex.afterBuild.enabled": true, "latex-workshop.view.outline.sync.viewer": true, "[bibtex]": { "editor.defaultFormatter": "James-Yu.latex-workshop" }, "latex-workshop.formatting.latex": "latexindent", }
|