TexLive&VSCode安装配置教程
Posted hit-tengjun
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TexLive&VSCode安装配置教程相关的知识,希望对你有一定的参考价值。
一、TexLive安装
1. 下载
- 打开清华镜像网站:https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/;
下载texlive.iso文件,大约3.2G;

2. 安装
- 双击打开
texlive.iso
文件,双击install-tl-windows.bat
;

- 选择安装目录,其他默认即可;

3. 等待
- 约1个小时即可安装完成;

二、 VSCode安装
1. 下载
- 直接去官网下载安装包:https://code.visualstudio.com/

2. 安装
- 双击下载的
VSCodeUserSetup-x64-x.xx.x.exe
文件,按照提示安装即可。

三、Latex Workshop插件安装
LaTex Workshop是VSCode的插件,这个插件为VSCode提供了LaTeX语言支持。
1. 搜索并安装
- 在VSCode的扩展管理中,搜索
latex
,点击下面的install
按钮,即可自动安装(下图由于我已经安装了,所以没有install
按钮);

四、Sumatra PDF安装
Sumatra Pdf 是一款轻量级的 PDF 阅读器,类型为开放软件,并且有安装版和便携版两个版本。 VSCode 内置的 PDF 查看器功能比较简单,而且不太方便,而 Adobe Reader 则相对体积大,打开速度慢。Sumatra PDF 小巧强大,启动速度快,作为本方案的 PDF 阅读器最合适不过,而且还可以和源码之间实现定位跳转,弥补 LaTex “所见非所得”的劣势。
1. 下载

2. 安装
- 双击下载的
SumatraPDF-x.x.x-64-install.exe
文件,按照提示安装即可;

五、配置VSCode
1. 打开配置文件
- 在VSCode里面按住快捷键,CTRL+SHIFT+P,然后输入
Open Settings
,用ENTER键选择第一个。

2. 写入配置参数
- 在
settings.json
写入如下配置参数:
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
],
},
{
"name": "pdflatex",
"tools": [
"pdflatex"
]
},
{
"name": "xe->bib->xe->xe",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdf->bib->pdf->pdf",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.autoClean.run": "onBuilt",
"latex-workshop.latex.autoBuild.run": "never",
"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.external.viewer.command": "D:/Program Files/SumatraPDF/SumatraPDF.exe",
"latex-workshop.view.pdf.external.viewer.args": [
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
"-inverse-search",
""D:/Program Files/Microsoft VS Code/Code.exe" "D:/Program Files/Microsoft VS Code/resources/app/out/cli.js" -gr "%f":"%l"",
"%PDF%"
],
"latex-workshop.view.pdf.external.synctex.command": "D:/Program Files/SumatraPDF/SumatraPDF.exe",
"latex-workshop.view.pdf.external.synctex.args": [
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
"-inverse-search",
"code "D:/Program Files/Microsoft VS Code/resources/app/out/cli.js" -gr "%f":"%l"",
"%PDF%",
],
2. 配置说明
- 当将上述配置文件写入并保存后,即已完成了所有安装和配置步骤。下述的说明是用于理解配置参数:
latex-workshop.latex.tools
主要用于配置编译工具和命令, LaTeX Workshop默认的编译工具是latexmk,可根据需要修改所需的工具和命令。
latex-workshop.latex.recipes
主要用于配置编译链,第一个recipe为默认的编译工具;
latex-workshop.latex.autoClean.run
用于设置在PDF文件生成后自动清除LaTex编译过程产生的一些辅助文件。
latex-workshop.latex.autoBuild.run
用于设置保存时是否自动编译LaTex文件(VSCode 有自动保存功能,所以每次自动保存都会编译 LaTex 文件,这样就会导致电脑每隔一段时间就会自动编译文档);
latex-workshop.view.pdf.viewer
用于选择使用外置阅读器;
latex-workshop.view.pdf.external.viewer.command
后跟的参数为SumatraPDF.exe所在的路径;
latex-workshop.view.pdf.external.viewer.args
为配置外置阅读器各类参数;
latex-workshop.view.pdf.external.synctex.command
和latex-workshop.view.pdf.external.synctex.args
用于配置SumatraPDF的正向和方向搜索;
五、注意事项
1. 在安装新字体时,应右击选择为所有用户安装(A)
;
以上是关于TexLive&VSCode安装配置教程的主要内容,如果未能解决你的问题,请参考以下文章