VScode配置Latex

最近开始要写课程论文了,想着要用latex的模板直接写会方便,又懒得下overleaf,话不多说开始配置

下载与安装

  1. 可以从该镜像下载 [Index of CTAN-local/systems/texlive/Images](https://mirrors.huaweicloud.com/CTAN/systems/texlive/Images/

    mac用户可配置MacTeX - TeX Users Group

  2. 安装vscode插件 LaTeX Workshop

配置

配置latex-workshop

不包含外部 pdf 查看器设置的配置

  1 "latex-workshop.latex.autoBuild.run": "never",
  2    "latex-workshop.showContextMenu": true,
  3    "latex-workshop.intellisense.package.enabled": true,
  4    "latex-workshop.message.error.show": false,
  5    "latex-workshop.message.warning.show": false,
  6    "latex-workshop.latex.tools": [
  7        {
  8            "name": "xelatex",
  9            "command": "xelatex",
 10            "args": [
 11                "-synctex=1",
 12                "-interaction=nonstopmode",
 13                "-file-line-error",
 14                "%DOCFILE%"
 15            ]
 16        },
 17        {
 18            "name": "pdflatex",
 19            "command": "pdflatex",
 20            "args": [
 21                "-synctex=1",
 22                "-interaction=nonstopmode",
 23                "-file-line-error",
 24                "%DOCFILE%"
 25            ]
 26        },
 27        {
 28            "name": "latexmk",
 29            "command": "latexmk",
 30            "args": [
 31                "-synctex=1",
 32                "-interaction=nonstopmode",
 33                "-file-line-error",
 34                "-pdf",
 35                "-outdir=%OUTDIR%",
 36                "%DOCFILE%"
 37            ]
 38        },
 39        {
 40            "name": "bibtex",
 41            "command": "bibtex",
 42            "args": [
 43                "%DOCFILE%"
 44            ]
 45        }
 46    ],
 47    "latex-workshop.latex.recipes": [
 48        {
 49            "name": "XeLaTeX",
 50            "tools": [
 51                "xelatex"
 52            ]
 53        },
 54        {
 55            "name": "PDFLaTeX",
 56            "tools": [
 57                "pdflatex"
 58            ]
 59        },
 60        {
 61            "name": "BibTeX",
 62            "tools": [
 63                "bibtex"
 64            ]
 65        },
 66        {
 67            "name": "LaTeXmk",
 68            "tools": [
 69                "latexmk"
 70            ]
 71        },
 72        {
 73            "name": "xelatex -> bibtex -> xelatex*2",
 74            "tools": [
 75                "xelatex",
 76                "bibtex",
 77                "xelatex",
 78                "xelatex"
 79            ]
 80        },
 81        {
 82            "name": "pdflatex -> bibtex -> pdflatex*2",
 83            "tools": [
 84                "pdflatex",
 85                "bibtex",
 86                "pdflatex",
 87                "pdflatex"
 88            ]
 89        },
 90    ],
 91    "latex-workshop.latex.clean.fileTypes": [
 92        "*.aux",
 93        "*.bbl",
 94        "*.blg",
 95        "*.idx",
 96        "*.ind",
 97        "*.lof",
 98        "*.lot",
 99        "*.out",
100        "*.toc",
101        "*.acn",
102        "*.acr",
103        "*.alg",
104        "*.glg",
105        "*.glo",
106        "*.gls",
107        "*.ist",
108        "*.fls",
109        "*.log",
110        "*.fdb_latexmk"
111    ],
112    "latex-workshop.latex.autoClean.run": "onFailed",
113    "latex-workshop.latex.recipe.default": "lastUsed",
114    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click"

SumatraPDF 安装设置

因为vscode内置的pdf查看器不太好用,可以配置别的pdf查看器。具体配置参考Visual Studio Code (vscode)配置LaTeX - 知乎

常用latex模板

Licensed under CC BY-NC-SA 4.0