LaTeX——Win10下 texlive + Visual Studio Code 环境配置

  1. 到清华镜像源下载texlive并安装,注意texlive的安装路径不能包括中文
  2. 到VS Code官网下载并安装
  3. 在VS Code的扩展插件中搜索LaTex Workshop并安装LaTeX——Win10下 texlive + Visual Studio Code 环境配置_第1张图片
  4. 在VS Code中安装ctrl + shift + p, 输入set,然后选择Open Settings(JSON)LaTeX——Win10下 texlive + Visual Studio Code 环境配置_第2张图片
  5. 将下面的代码复制到里面并保存。(这套配置是我目前正在用的,具体参数对应的作用我暂时不能很好的阐述清楚,但这套配置在科研论文使用过程中未出现问题,缺点是编译速度稍慢)
{
    "latex-workshop.latex.recipes": [
    {
        "name": "xelatex ->bibtex -> xelatex*2",
        "tools": [
            "xelatex",
            "bibtex",
            "xelatex",
            "xelatex"
        ]
    },
    {
        "name": "pdflatex -> bibtex -> pdflatex*2",
        "tools": [
            "pdflatex",
            "bibtex",
            "pdflatex",
            "pdflatex"
        ]
    }
],
    "latex-workshop.latex.tools": [{
        "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%"
        ]
    }
],  
}
  1. 如果不使用参考文献(.bib文件),上面那个配置会报错,可以采用以下配置,来自知乎专栏,侵删
"latex-workshop.latex.recipes": [{
        "name": "xelatex",
        "tools": [
            "xelatex"
        ]
    },
    {
        "name": "xelatex ->bibtex -> xelatex*2",
        "tools": [
            "xelatex",
            "bibtex",
            "xelatex",
            "xelatex"
        ]
    },
    {
        "name": "pdflatex",
        "tools": [
            "pdflatex"
        ]
    }
],
"latex-workshop.latex.tools": [{
        "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)