Latex+VsCode+Win10搭建

发布于:2025-02-11 ⋅ 阅读:(41) ⋅ 点赞:(0)

最近在写论文,overleaf的免费使用次数受限,因此需要使用本地的形式进行编译。

安装TEXLive

下载地址:https://mirror-hk.koddos.net/CTAN/systems/texlive/Images/

在这里插入图片描述

下载完成直接点击iso进行安装操作。

安装LATEX Workshop插件

在这里插入图片描述

设置VsCode文件

点击vscode右下角的设置按钮,然后进入setting

在这里插入图片描述
搜索框里输入recipe,然后找到Edit_in_settings.json,点击进入。
将下面的内容复制进行重新启动即可。

setting.json

{
    "latex-workshop.latex.autoBuild.run": "onSave",
    "latex-workshop.showContextMenu": true,
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,
    "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": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOCFILE%"
            ]
        },
        {
            "name": "biber",
            "command": "biber",
            "args": [
                "%DOCFILE%"
            ]
        },
          {
            "name": "bibtex",
            "command": "bibtex",
            "args": ["%DOCFILE%"]
          },
          {
            "name": "bibtex",
            "command": "bibtex",
            "args": ["%DOCFILE%"]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "XeLaTeX",
            "tools": [
                "xelatex"
            ]
        },
        {
            "name": "PDFLaTeX",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "LaTeXmk",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "xelatex -> biber -> xelatex",
            "tools": ["xelatex", "biber", "xelatex"]
        },
        {
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
              "pdflatex",
              "bibtex",
              "pdflatex",
              "pdflatex"
            ]
        },
    ],
    "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.autoClean.run": "onFailed",
    "latex-workshop.latex.recipe.default": "lastUsed",
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
    "explorer.confirmDelete": false
}

可能会遇到的问题

  • 参考文献编译不进去
    在这里插入图片描述
    那么就采用命令的形式进行编译
xelatex main.tex
biber main
xelatex main.tex

手动的话,这里选
在这里插入图片描述

  • 参考文献编译两遍

使用info/bib-resource={./refs.bib},就不要使用% \printbibliography

参考资料


网站公告

今日签到

点亮在社区的每一天
去签到