使用VSCode编写LaTeX

  1. 使用VSCode编写LaTeX–知乎
  2. 打开vscode设置文件
  3. 在 SumatraPDF 反向搜索时复用 VSCode 窗口
  4. SumatraPDF反向搜索命令行设置

vscode中settings.json的设置

//latex的设置,参考 https://zhuanlan.zhihu.com/p/38178015

    "latex-workshop.latex.tools": [
        {
            // 编译工具和命令
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "%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": "xe->bib->xe->xe",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        }
    ],
    "latex-workshop.view.pdf.viewer": "external",

    "latex-workshop.view.pdf.external.viewer.command": "D:/Program Files/SumatraPDF/SumatraPDF.exe",

    //配置正向搜索
    "latex-workshop.view.pdf.external.synctex": {
        "command": "D:/Program Files/SumatraPDF/SumatraPDF.exe",
        "args": [
        "-forward-search",
        "%TEX%",
        "%LINE%",
        "-reuse-instance",
        "-inverse-search",
        "\"D:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\" \"D:\\Program Files (x86)\\Microsoft VS Code\\resources\\app\\out\\cli.js\" -r -g \"%f:%l\"",
        "%PDF%"
        ]
    },

SumatraPDF中反向搜索设置

"D:\Program Files (x86)\Microsoft VS Code\Code.exe"  "D:\Program Files (x86)\Microsoft VS Code\resources\app\out\cli.js" -r -g "%f:%l"

注意要点,就是要在vscdoe中打开pdf文件,而不是先独立打开。
第二,在vscode中打开latex文件后,找到其中文字,而不是修饰词,点击Ctrl+Alt+J,就可以转到SumatraPDF中相应的文字。

你可能感兴趣的:(技术,latex)