Bootstrap

LaTex在vscode的相关配置笔记

1. 下载配置 LaTex 相关环境文件


  • 双击install-tl-windows进行安装
    并选择相关安装路径
    在这里插入图片描述
    安装完成后,按win + R,输入cmd打开命令行,输入 latex -v验证安装是否完成。

2. 下载相关 vscode 插件

在这里插入图片描述


3. 相关配置文件

Ctrl + Shift + P 搜索json,打开用户设置(JSON)进行添加配置,如下图所示。
在这里插入图片描述
将下列相关配置复制进json文件

{
    // Start LaTex Config
    // 编译方案配置
    "latex-workshop.latex.recipes": [
      {
        "name": "pdflatex -> bibtex -> pdflatex*2",
        "tools": [
            "pdflatex",
            "bibtex",
            "pdflatex",
            "pdflatex"
        ]
      },
    
      {
        "name": "xelatex",
        "tools": [
            "xelatex"
        ]
      }, 

	  {
        "name": "latexmk",
        "tools": [
            "latexmk"
        ]
      },
    
      {
          "name": "xe->bib->xe->xe",
     "tools": [
              "xelatex",
              "bibtex",
              "xelatex",
              "xelatex"
        ]
      }
      ],
      // 编译工具配置
      "latex-workshop.latex.tools": [{
      "name": "latexmk",
      "command": "latexmk",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "-pdf",
        "%DOC%"
      ]
      }, {
      "name": "xelatex",
      "command": "xelatex",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "%DOC%"
      ]
      }, {
      "name": "pdflatex",
      "command": "pdflatex",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "%DOC%"
      ]
      }, {
      "name": "bibtex",
      "command": "bibtex",
      "args": [
        "%DOCFILE%"
      ]
      }],
      
      "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"
      ],

      "latex-workshop.latex.autoBuild.run": "onFileChange",  //保存时自动编译,不想自动编译 never
      "latex-workshop.message.error.show": false,   //隐藏在编译出现错误或者警告时自动弹出的提示窗口
      "latex-workshop.message.warning.show": false,

      "latex-workshop.latex.autoClean.run": "onFailed",
      "latex-workshop.latex.recipe.default": "lastUsed",
      
      "latex-workshop.synctex.afterBuild.enabled": true,
      "latex-workshop.view.pdf.internal.synctex.keybinding": "ctrl-click",  //使用 Alt+Ctrl+J 正向搜索,使用 Ctrl+单击PDF 反向搜索
      
      "latex-workshop.view.pdf.viewer": "tab",  //使用内置的PDF阅读器查看
      "latex-workshop.showContextMenu":true,    //右键菜单
      "latex-workshop.intellisense.package.enabled": true,  //从使用的包中自动补全命令和环境
      "editor.wordWrap": "on", // 显示时自动换行


    // End LaTex Config
}
;