整个文章分为以下几个内容,打 * 的是必须要安装的
- LaTex 安装*
- VSCode 安装*
- 在 VSCode 中配置 LaTex
- Grammarly语法检测插件
LaTex 安装*
latex的下载安装可参考:LaTex(2021)安装教程
VSCode 安装*
VSCode下载:VSCode官网
VSCode的安装非常简单,几乎不需要什么操作
先把中文包下载下来,重启生效
在 VSCode 中配置 LaTex
- 下载 LaTex Workshop
- 下载完之后,在界面下按下 Ctrl+Shift+P,然后键入“setjson”,点击“首选项: 打开设置(JSON)”
把下面这段代码复制进去
"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": "bibtex","command": "bibtex","args": ["%DOCFILE%"]}
],
"latex-workshop.latex.recipes": [{"name": "xelatex","tools": ["xelatex"],},{"name": "pdflatex","tools": ["pdflatex"]},{"name": "xelatex->bibtex->xelatex*2","tools": ["xelatex","bibtex","xelatex","xelatex"]},{"name": "pdflatex->bibtex->pdflatex*2","tools": ["pdflatex","bibtex","pdflatex","pdflatex"]}
],
"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"
],
//pdf浏览器,如果用外部浏览器则用 "external"
"latex-workshop.view.pdf.viewer": "tab",
//自动编译tex
"latex-workshop.latex.autoBuild.run": "onFileChange",
//显示内容菜单:(1)编译文件;(2)定位游标
"latex-workshop.showContextMenu": true,
//显示错误
"latex-workshop.message.error.show": true,
//显示警告
"latex-workshop.message.warning.show": true,
//从使用的包中自动补全命令和环境
"latex-workshop.intellisense.package.enabled": true,
//设置为never,为不清除辅助文件
"latex-workshop.latex.autoClean.run": "never",
//设置vscode编译tex文档时的默认编译链
"latex-workshop.latex.recipe.default": "lastUsed",
// 用于反向同步的内部查看器的键绑定。ctrl/cmd +点击(默认)或双击
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
添加完了之后我们发现这边已经有编译按钮了
xelatex 和 pdflatex 的作用差不多,都是用于编译tex文本,但是前者更新,用的更多
bibtex一般用于编译一些引用,比如参考文献
xelatex->bibtex->xelatex*2 一般写完之后对全文所有内容进行整编,下面那个也是一样的
用的最多的还是xelatex
同样,我们选择好一种方式,比如xelatex,然后在菜单栏下面的绿色三角编译即可
界面下方有编译成功的标志,如果失败就是个红叉,我们也可以通过点击错误和警告按钮查看报错的地方
Grammarly语法检测插件
和上面一样的操作,在插件里面搜索 Grammarly,然后安装