在Vscode里配置Latex

// LaTeX

        "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": "bibtex",
                    "command": "bibtex",
                    "args": [
                        "%DOCFILE%"
                    ]
                }
            ],
        
            "latex-workshop.latex.recipes": [
                {
                    "name": "xelatex",
                    "tools": [
                        "xelatex"
                    ]
                },
                {
                    "name": "pdflatex",
                    "tools": [
                        "pdflatex"
                    ]
                },
                {
                    "name": "bibtex",
                    "tools": [
                        "bibtex"
                    ],
                },
                {
                    "name": "pdf->bib->pdf->pdf",
                    "tools": [
                        "pdflatex",
                        "bibtex",
                        "pdflatex",
                        "pdflatex"
                    ]
                },
                {
                    "name": "xe->bib->xe->xe",
                    "tools": [
                        "xelatex",
                        "bibtex",
                        "xelatex",
                        "xelatex"
                    ]
                },
            ],
            "latex-workshop.latex.autoClean.run": "onBuilt",
            "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 的 PDF 预览程序,external 指的是外部程序
        "latex-workshop.view.pdf.viewer": "external",
        "latex-workshop.view.pdf.ref.viewer": "external",
        "latex-workshop.view.pdf.external.viewer.command": "C:/Users/USER/AppData/Local/SumatraPDF/SumatraPDF.exe", // 注意修改路径
        "latex-workshop.view.pdf.external.viewer.args": [
            "%PDF%"
        ],

        // 配置正向、反向搜索:.tex -> .pdf
        "latex-workshop.view.pdf.external.synctex.command": "C:/Users/USER/AppData/Local/SumatraPDF/SumatraPDF.exe", // 注意修改路径
        "latex-workshop.view.pdf.external.synctex.args": [
            // 正向搜索
            "-forward-search",
            "%TEX%",
            "%LINE%",
            "-reuse-instance",
            // 反向搜索
            "-inverse-search",
            "\"E:/Users/USER/AppData/Local/Programs/Microsoft VS Code/Code.exe\" \"E:/Users/USER/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js\" -gr \"%f\":\"%l\"",
            "%PDF%"
        ]

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
要在 VSCode配置 LaTeX 版本,首先需要安装 LaTeX 工具链。如果你已经安装了 LaTeX 工具链,请跳过第一步。 1. 安装 LaTeX 工具链 可以选择安装以下其中一个 LaTeX 工具链: - TeX Live:在大多数 Linux 发行版上都可用,并且也有 macOS 和 Windows 版本。 - MacTeX:专门为 macOS 设计的 TeX Live 发行版。 - MikTeX:适用于 Windows 系统的 TeX 发行版。 在安装完成后,打开终端或命令行窗口,输入 `pdflatex --version` 命令,检查是否成功安装了 LaTeX 工具链。 2. 安装 LaTeX Workshop 插件 在 VSCode 中,可以使用 LaTeX Workshop 插件来编写 LaTeX 文档。打开 VSCode,点击左侧菜单栏中的 Extensions,搜索 LaTeX Workshop 并安装。 3. 配置 LaTeX 工具链路径 打开 VSCode,点击左侧菜单栏中的 Settings,在搜索框中输入 latex,找到 LaTeX Workshop 的设置选项,找到 "LaTeX › Workshop: TeXpath" 选项,点击 "Edit in settings.json",在打开的 settings.json 文件中添加以下代码: ``` "latex-workshop.latex.tools": [ { "name": "latexmk", "command": "latexmk", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdf", "%DOC%" ] }, { "name": "pdflatex", "command": "pdflatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOC%" ] }, { "name": "bibtex", "command": "bibtex", "args": [ "%DOCFILE%" ] } ], "latex-workshop.latex.toolsPath": "/usr/local/texlive/2020basic/bin/x86_64-darwin", "latex-workshop.latex.build.executablePath": "/usr/local/texlive/2020basic/bin/x86_64-darwin/latexmk" ``` 其中,"latex-workshop.latex.toolsPath" 的值应该是你安装 LaTeX 工具链的路径,"latex-workshop.latex.build.executablePath" 的值应该是你要使用的 LaTeX 工具链的可执行文件路径。在 macOS 上,LaTeX 工具链的默认路径是 /Library/TeX/texbin。 4. 配置编译器 打开一个 LaTeX 文件,按下快捷键 Ctrl+Shift+P(或者在 macOS 上是 Command+Shift+P),输入 "LaTeX Workshop: Select LaTeX compiler" 并选择你要使用的编译器。常用的编译器有 pdflatexlatexmk,选择后,就可以使用 VSCode 中的 LaTeX Workshop 插件编译 LaTeX 文档了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

leetteel

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值