通过VS CODE+LaTeX 双向搜索机制 提高论文书写、排版效率

VScode中\(\LaTeX\)编译环境配置留档。

  • ctrl + shift + p \(\rightrightarrows\) Preferences :open settings(json)
{
  "latex-workshop.showContextMenu":true,                //右键菜单
  "latex-workshop.intellisense.package.enabled": true,  //根据加载的包,自动完成命令或包  
  "latex-workshop.latex.autoBuild.run": "never",        //禁止保存文件时自动build  
  "latex-workshop.latex.recipes": [  
    {  
      "name": "xelatex",  
      "tools": [  
        "xelatex"  
      ]  
    }, 
    {  
      "name": "latexmk",  
      "tools": [  
        "latexmk"  
      ]  
    },  
    {  
      "name": "PDFlatex",  
      "tools": [  
        "pdflatex"  
      ]  
    },    
    {  
      "name": "xelatex -> bibtex -> xelatex",  
      "tools": [  
        "xelatex",  
        "bibtex",  
        "xelatex",  
      ]  
    },
    {  
      "name": "pdflatex ->žž bibtex ->žž pdflatex2",  
      "tools": [  
        "pdflatex",  
        "bibtex",  
        "pdflatex",  
        "pdflatex"  
      ]  
    }  
  ],  
  "latex-workshop.latex.tools":[  
    {  
      "name": "xelatex",  
      "command": "xelatex",  
      "args": [  
        "-synctex=1",  
        "-interaction=nonstopmode",  
        "-file-line-error",  
        "%DOC%"  
      ],  
      "env": {}  
      }, 
    {  
      "name": "latexmk",  
      "command": "latexmk",  
      "args": [  
        "-synctex=1",  
        "-interaction=nonstopmode",  
        "-file-line-error",  
        "-pdf",  
        "-outdir=%OUTDIR%",  
        "%DOC%"  
      ],  
      "env": {}  
      },  
      {  
      "name": "pdflatex",  
      "command": "pdflatex",  
      "args": [  
        "-synctex=1",  
        "-interaction=nonstopmode",  
        "-file-line-error",  
        "%DOC%"  
      ],  
      "env": {}  
      },   
      {  
      "name": "bibtex",  
      "command": "bibtex",  
      "args": [  
        "%DOCFILE%"  
      ],  
      "env": {}  
      }  
  ],  
  "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",  
    "*.nav",  
    "*.snm",  
    "*.synctex.gz"  
  ],  
   // 设置预览方式
   "latex-workshop.view.pdf.viewer":"external",
   "latex-workshop.view.pdf.ref.viewer":"external",
   // 设置外部PDF预览器
   "latex-workshop.view.pdf.external.viewer.command": "D:/SumatraPDF/SumatraPDF.exe",
   "latex-workshop.view.pdf.external.viewer.args": [
       "%PDF%"
   ],
   // 配置Syntex的正向搜索(这是官网的)
   "latex-workshop.view.pdf.external.synctex.command": "D:/SumatraPDF/SumatraPDF.exe",
   "latex-workshop.view.pdf.external.synctex.args": [
       "-forward-search",
       "%TEX%",
       "%LINE%",
       "-reuse-instance",
       "-inverse-search",
       "D:/Microsoft VS Code D:/Microsoft VS Code/resources/app/out/cli.js -r -g %f:%l",
       "%PDF%"
   ],
    "workbench.colorTheme": "Eva Dark",
}
  • SumatraPDF端设置
  1. "EnableTeXEnhancements = true" in "SumatraPDF-settings.txt";
  2. "D:\Program Files\Microsoft VS Code\Code.exe" "D:\Program Files\Microsoft VS Code\resources\app\out\cli.js" -g "%f":"%l".
    通过VS CODE+LaTeX 双向搜索机制 提高论文书写、排版效率
上一篇:VSCode + LaTeX Workshop 环境配置


下一篇:Mac OS X + MacTex + VSCode构建Latex平台