LaTeX编辑器之前用过Texsudio
,Texmaker
,Texworks
以及一点点的WinEdt
.
但是觉得颜值最高,功能最完善的还是VSCode
其深色主题
![3fa6ffe3380fc2885565be63db1d4a03.png](https://i-blog.csdnimg.cn/blog_migrate/8dc3547b356e2021b975f257d169f8ba.jpeg)
以及浅色主题
![9cbc4ef6d2419a415b507835b0f6bbab.png](https://i-blog.csdnimg.cn/blog_migrate/b21aa265a6c9821882e669bfea5c278a.jpeg)
有关VSCode的安装及相关配置就不赘述了, 可以参考
张敬信:2020搭建Latex环境:Texlive+VScodezhuanlan.zhihu.com![b5387d89743d2af0d5bc45f3150b2040.png](https://i-blog.csdnimg.cn/blog_migrate/eeeec79162c0fded9dc137b0c93c16f8.jpeg)
此外, 之前习惯了使用代码和预览左右分屏, 了解过SumatraPDF
但一直没入坑, 究其原因还是LaTeX不够熟练, 编译过于频繁.
事实上, 左右分屏带来的代价就是界面过于逼仄:
![9d7138c3812c738b36656e429d602d02.png](https://i-blog.csdnimg.cn/blog_migrate/6056ff5698eb4f41ade68a93ceba72e3.jpeg)
对于较为熟练(即编译次数不频繁)的用户而言,SumatraPDF
就比较合适
VSCode+Texlive+SumatraPDF 配置在网上有不少帖子,但由于VSCode升级改版,很多配置方法已经失效了,经过实验, 以下配置亲测有效(Windows版本):
{
// Latex workshop
"latex-workshop.latex.recipes": [
{
"name": "xe->xe",
"tools": [
"xelatex",
"xelatex"
]
},
{
"name": "xe->bib->xe->xe",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdf->pdf",
"tools": [
"pdflatex",
"pdflatex"
]
},
{
"name": "pdf->bib->pdf->pdf",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.tools": [
{
// 编译工具和命令
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
// 其它配置
"latex-workshop.showContextMenu": true, //右键菜单
"latex-workshop.intellisense.package.enabled": true, //自动完成命令或包
"latex-workshop.latex.autoClean.run": "onBuilt", //自动清除辅助文件
"latex-workshop.latex.autoBuild.run": "never", //禁止保存文件时自动编译 LaTeX 文件
"editor.wordWrap": "on", // 自动换行
"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.external.viewer.command": "E:/TeX/software/SumatraPDF/SumatraPDF.exe",
"latex-workshop.view.pdf.external.viewer.args": [
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
"-inverse-search",
""F:Microsoft VS CodeCode.exe" "F:Microsoft VS Coderesourcesappoutcli.js" -r -g "%f:%l"",
"%PDF%",
],
//tab是软件内打开,推荐external是用pdf打开
}
需要注意的是
- 相关路径需要修改成适应自己的
- 上述配置包含了组合编译(recipe)方式, 可根据自己的需求更改.
- 在
SumatraPDF
需设置反向搜索,方法是
设置选项
设置反向搜索命令行
"F:Microsoft VS CodeCode.exe" "F:Microsoft VS Coderesourcesappoutcli.js" -r -g "%f:%l"
相关路径同样需要修改成适应自己的
![94640b816da7519da68f55ae09cdfa29.png](https://i-blog.csdnimg.cn/blog_migrate/943577151d5b7f66ac488448d39c7c95.jpeg)