VScode+latex+Sumatra 环境配置

目录

  • [安装Tex Live 及Vscode](#安装Tex Live 及Vscode)

安装Tex Live 及Vscode

此处参考博客:VScode+latex+Sumatra PDF环境配置(步步到位)进行安装。

本文主要记录配置的json文件设置。

复制代码
{
    "latex-workshop.latex.autoBuild.run": "never",
    "latex-workshop.synctex.afterBuild.enabled":true,
    "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",
                "%DOC%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        },
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "XeLaTeX",
            "tools": [
                "xelatex"
            ]
        },
        {
            "name": "PDFLaTeX",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "BibTeX",
            "tools": [
                "bibtex"
            ]
        },
        {
            "name": "LaTeXmk",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "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",
    
    // 设置VScode内部查看生成的pdf文件
    "latex-workshop.view.pdf.viewer": "external",
    // PDF查看器用于在\ref上的[View on PDF]链接
    "latex-workshop.view.pdf.ref.viewer":"auto",
    // 使用外部查看器时要执行的命令。此功能不受官方支持。
    "latex-workshop.view.pdf.external.viewer.command": "D:/Program Files/SumatraPDF/SumatraPDF.exe", // 注意修改路径
    // 使用外部查看器时,latex-workshop.view.pdf.external.view .command的参数。此功能不受官方支持。%PDF%是用于生成PDF文件的绝对路径的占位符。
    "latex-workshop.view.pdf.external.viewer.args": [
        "%PDF%"
    ],
    // 将synctex转发到外部查看器时要执行的命令。此功能不受官方支持。
    "latex-workshop.view.pdf.external.synctex.command": "D:/Program Files/SumatraPDF/SumatraPDF.exe", // 注意修改路径
    // latex-workshop.view.pdf.external.synctex的参数。当同步到外部查看器时。%LINE%是行号,%PDF%是生成PDF文件的绝对路径的占位符,%TEX%是触发syncTeX的扩展名为.tex的LaTeX文件路径。
    "latex-workshop.view.pdf.external.synctex.args": [
        "-forward-search",
        "%TEX%",
        "%LINE%",
        "-reuse-instance",
        "-inverse-search",
        "\"D:\\Program Files\\Microsoft VS Code\\Code.exe\" \"D:\\Program Files\\Microsoft VS Code\\resources\\app\\out\\cli.js\" --ms-enable-electron-run-as-node -r -g \"%f:%l\"",
    ], 
}

其中指令行表示编译完成后自动打开pdf。

"latex-workshop.synctex.afterBuild.enabled":true,

相关推荐
kooboo china.2 小时前
JSON 编辑器:从语法到数据处理(二)
编辑器·json
ScilogyHunter8 小时前
vscode的c工程配置文件详解
c语言·ide·vscode
摆渡搜不到你9 小时前
Visual Studio Code 1.101.0 官方版
ide·vscode·编辑器
亦良Cool9 小时前
如何让 VS Code 仅通过滚轮放大字体,而不缩放整个界面?
vscode
菜鸟阿达11 小时前
Idea 2025 commit 关闭侧边栏 开启探框
java·ide·intellij-idea
C++ 老炮儿的技术栈13 小时前
visual studio 2022更改主题为深色
c语言·开发语言·c++·ide·windows·git·visual studio
_刘文凯_15 小时前
【无标题】
vscode
wsdchong之小马过河15 小时前
2025虚幻5蓝图编辑器的细节面板调不出来
ue5·编辑器
陶甜也15 小时前
vscode界面设置透明度--插件Glasslt-VSC
vscode·编辑器
南菠湾17 小时前
如何在 Visual Studio Code 中配置SSH、Git 和 Copilot插件
git·vscode·ssh