编辑器 vs code 的设置 ( Mac 版 )

编辑器 VS Code 的设置 Mac 版 #

作者:二花

关键词:vs code, Mac

Visual Studio Code (VS Code) 是一个轻量级、功能强大的源代码编辑器,支持 Windows、macOS 和 Linux,且免费、开源。其有丰富的扩展,可用于编写大部分语言代码。配合插件,我们甚至可以在本地计算机的 VS Code 中远程编辑服务器中的代码。 本文主要介绍如何使用 VS Code 并搭配 LaTeX Workshop 插件来编写 LaTeX 文档,并介绍如何进行配置。

VS Code 编辑 LaTeX 文档 Sample #

下面的图展示了如何在 VS Code 中编辑 LaTeX 文档。并且简单展示了各个工作区的作用.

安装 VS Code #

下载地址:https://code.visualstudio.com/

插件的搜索与安装 #

LaTeX Workshop 插件与配置 #

详细的配置文件如下:

{
    "latex-workshop.latex.autoBuild.run": "never",
    "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": [
                "%DOC%"
            ]
        }
    ],
    "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",
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.view.pdf.ref.viewer":"auto",
}

注意:当把配置文件添加好后,需要 ctrl + p 打开命令面板,然后输入 > reload window,或者点击查看,选择命令面板,然后输入 reload window 让配置文件生效.