当前位置:   article > 正文

论文排版神器VSCode+LaTeX最新保姆级图文配置教程_vscode latex(1)

vscode latex

LATE​X插件

在这里插入图片描述

  • 打开VSCode setting.json追加以下配置
{
    // 设置是否自动编译
    "latex-workshop.latex.autoBuild.run":"onFileChange",
    //右键菜单
    "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": "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"
    ],
    //设置为onFaild 在构建失败后清除辅助文件
    "latex-workshop.latex.autoClean.run": "onFailed",
    // 使用上次的recipe编译组合
    "latex-workshop.latex.recipe.default": "lastUsed",
    // 用于反向同步的内部查看器的键绑定。ctrl/cmd +点击(默认)或双击
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
	
    //使用 SumatraPDF 预览编译好的PDF文件
    // 设置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:/LaTex/textlive/pdfViewer/SumatraPDF/SumatraPDF.exe", 
    "latex-workshop.view.pdf.external.viewer.args": [
        "%PDF%"
    ],
    "latex-workshop.view.pdf.external.synctex.command": "D:/LaTex/textlive/pdfViewer/SumatraPDF/SumatraPDF.exe",
    "latex-workshop.view.pdf.external.synctex.args": [
        "-forward-search",
        "%TEX%",
        "%LINE%",
        "-reuse-instance",
        "-inverse-search",
        "\"D:/Vscode/Microsoft VS Code/Code.exe\" \"D:/Vscode/Microsoft VS Code/resources/app/out/cli.js\" --ms-enable-electron-run-as-node -r -g \"%f:%l\"", 
        "%PDF%"
    ]
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147

**注意:**其中涉及到VSCode与外部PDF软件的路径需要修改为自己本地的路径。

5 配置正反向搜索

所谓正反向搜索指的是:

  • **正向搜索:**从代码定位到PDF页面相应位置
  • **反向搜索:**从PDF页面定位到代码相应位置

正向搜索功能在VSCode中已经配置过,具体为

"latex-workshop.view.pdf.ref.viewer":"auto",
"latex-workshop.view.pdf.external.viewer.command": "D:/LaTex/textlive/pdfViewer/SumatraPDF/SumatraPDF.exe", 
"latex-workshop.view.pdf.external.viewer.args": [
   "%PDF%"
],
"latex-workshop.view.pdf.external.synctex.command": "D:/LaTex/textlive/pdfViewer/SumatraPDF/SumatraPDF.exe",
"latex-workshop.view.pdf.external.synctex.args": [
   "-forward-search",
   "%TEX%",
   "%LINE%",
   "-reuse-instance",
   "-inverse-search",
   "\"D:/Vscode/Microsoft VS Code/Code.exe\" \"D:/Vscode/Microsoft VS Code/resources/app/out/cli.js\" --ms-enable-electron-run-as-node -r -g \"%f:%l\"", 
   "%PDF%"
]

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

默认快捷键为Ctrl+Alt+J

在这里插入图片描述

Sumatra PDF的反向搜索与VSCode

LaTeX

\LaTeX

LATE​X插件有兼容问题,最新的解决方案是在Sumatra PDF中进行高级设置,输入

InverseSearchCmdLine = "D:/Vscode/Microsoft VS Code/Code.exe" "D:/Vscode/Microsoft VS Code/resources/app/out/cli.js"  --ms-enable-electron-run-as-node -r -g "%f:%l"
EnableTeXEnhancements = true

  • 1
  • 2
  • 3

即可解决反向搜索问题。

6 快捷键模板

将下面的命令插入keysettings.json中即可

{
        "key": "ctrl",
        "command": "latex-workshop.synctex",
        "when": "config.latex-workshop.bind.altKeymap.enabled && editorTextFocus && editorLangId == 'latex'"
    },   
        {
        "key": "ctrl+m",
        "command": "editor.action.insertSnippet",
        "when": "editorTextFocus",
        "args": {
            "snippet": "$$\n\t${TM\_SELECTED\_TEXT}$1\n$$ $0" 
        }
    },
    {
        "key": "ctrl+shift+m",
        "command": "editor.action.insertSnippet",
        "when": "editorTextFocus",
        "args": {
            "snippet": "$ ${TM\_SELECTED\_TEXT}$1 $ $0" 
        }
    },
    {
        "key": "ctrl+shift+d",
        "command": "editor.action.insertSnippet",
        "when": "editorTextFocus",
        "args": {
            "snippet": "\_{$1} $0" 
        }
    },
    {
        "key": "ctrl+shift+u",
        "command": "editor.action.insertSnippet",
        "when": "editorTextFocus",
        "args": {
            "snippet": "^{$1} $0" 
        }
    },
    {
        "key": "ctrl+shift+q",
        "command": "editor.action.insertSnippet",
        "when": "editorTextFocus",
        "args": {
            "snippet": "\\sqrt{$1} $0" 
        }


**自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。**

**深知大多数同学面临毕业设计项目选题时,很多人都会感到无从下手,尤其是对于计算机专业的学生来说,选择一个合适的题目尤为重要。因为毕业设计不仅是我们在大学四年学习的一个总结,更是展示自己能力的重要机会。**

**因此收集整理了一份《2024年计算机毕业设计项目大全》,初衷也很简单,就是希望能够帮助提高效率,同时减轻大家的负担。**
![img](https://img-blog.csdnimg.cn/img_convert/136990acdadfc451b422f3e61339581b.jpeg)
![img](https://img-blog.csdnimg.cn/img_convert/1d65208bfca5931dca6d07263552280c.png)
![img](https://img-blog.csdnimg.cn/img_convert/dffaee4a9d3b92ca224fd1e479a3fbae.png)

**既有Java、Web、PHP、也有C、小程序、Python等项目供你选择,真正体系化!**

**由于项目比较多,这里只是将部分目录截图出来,每个节点里面都包含素材文档、项目源码、讲解视频**

**如果你觉得这些内容对你有帮助,可以添加VX:vip1024c (备注项目大全获取)**
![img](https://img-blog.csdnimg.cn/img_convert/a62c5f310ed4eee0a83d63d225536b2a.png)

2590255764)]
[外链图片转存中...(img-j1n4ViNR-1712590255765)]
[外链图片转存中...(img-glUHZHvF-1712590255765)]

**既有Java、Web、PHP、也有C、小程序、Python等项目供你选择,真正体系化!**

**由于项目比较多,这里只是将部分目录截图出来,每个节点里面都包含素材文档、项目源码、讲解视频**

**如果你觉得这些内容对你有帮助,可以添加VX:vip1024c (备注项目大全获取)**
[外链图片转存中...(img-p8NXt5GS-1712590255765)]

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号