latex写作环境搭建问题汇总 win10+VsCode+Sumatra PDF+latex workshop

配置教程网上众多,但总遇到问题,该文仅针对个人情况

  1. vscode下载版本问题
    注意,应该下载system installer那个版本,安装在c:/program files的那个,不知道为啥我安装userinstaller版本无法实现与sumatra PDF的正向搜索和预览
    在这里插入图片描述
  2. sumatra PDF配置反向搜索,没有该选项
    在软件的左上角点 设置->高级设置,找到
EnableTeXEnhancements = true

把默认的参数false改为true即可

  1. sumatra PDF配置反向搜索双击会打开新的vscode软件窗口,而不是定位
    命令出错,在网上有人写的命令是
"C:\Program Files\Microsoft VS Code\Code.exe" "C:\Program Files\Microsoft VS Code\resources\app\out\cli.js" -g "%f":%l

但是我觉得这是不对的,他会直接执行"C:\Program Files\Microsoft VS Code\Code.exe" 也就是打开应用程序,所以我把它改为

"C:\Program Files\Microsoft VS Code\Code.exe" -g "%f":%l 

就没问题了

  1. 关于配置
    ctrl+shift+p打开 preference:open settings(JSON)
    摘抄自知乎一个回答:
{
    "latex-workshop.latex.tools": [
        // {
        //     "name": "latexmk",
        //     "command": "latexmk",
        //     "args": [
        //         "-pdfxe",
        //         "--shell-escape",
        //         "-pvc",
        //         "-cd",
        //         "-time",
        //         "%DOCFILE%"
        //     ]
        // },
        {
            "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": "makeindex",
            "command": "makeindex",
            "args": [
                "%DOCFILE%.nlo",
                "-s",
                "nomencl.ist",
                "-o",
                "%DOCFILE%.nls"
            ]
        },
        {
            "name": "biber",
            "command": "biber",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],

    "latex-workshop.latex.recipes": [
        // {
        //     "name": "latexmk",
        //     "tools": [
        //         "latexmk"
        //     ]
        // },
        {
            "name": "xelatex",
            "tools": [
                "xelatex"
            ]
        },
        {
            "name": "xe->mkind->bib->xe*2",
            "tools": [
                "xelatex",
                "makeindex",
                "biber",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdf->mkind->bib->pdf*2",
            "tools": [
                "pdflatex",
                "makeindex",
                "biber",
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "xe->bib->xe->xe",
            "tools": [
                "xelatex",
                "biber",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdflatex",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "pdf->bib->pdf->pdf",
            "tools": [
                "pdflatex",
                "biber",
                "pdflatex",
                "pdflatex"
            ]
        }
    ],
    "latex-workshop.view.pdf.viewer": "external",
    "latex-workshop.view.pdf.external.viewer.command": "C:/Program Files/SumatraPDF/SumatraPDF.exe", // 注意修改路径
    "latex-workshop.view.pdf.external.viewer.args": [
        "%PDF%"
    ],
    "latex-workshop.view.pdf.external.synctex.command": "C:/Program Files/SumatraPDF/SumatraPDF.exe", // 注意修改路径
    "latex-workshop.view.pdf.external.synctex.args": [
        "-forward-search",
        "%TEX%",
        "%LINE%",
        "-reuse-instance",
        "-inverse-search",
        "code \"C:\\Program Files\\Microsoft VS Code\\resources\\app\\out\\cli.js\" -r -g \"%f:%l\"",
        "%PDF%",
    ],
  
}

你可能感兴趣的:(latex写作环境搭建问题汇总 win10+VsCode+Sumatra PDF+latex workshop)