
texlivevscode安装说明https://blog.csdn.net/Echo_Code/article/details/1080831931、安装TexLive清华镜像源下载安装https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/安装路径必须是英文。安装完成后打开cmd输入tex --version能显示安装版本则表示安装成功。否则需要添加路径设置 → 系统 → 系统信息 → 高级系统设置 → 环境变量 → 用户变量Path → 编辑 → 新建 → 输入 E:\Asoftware\texlive\2023\bin\windows#安装目录按需修改2、安装VScode下载安装vscode在Extension扩展中搜索安装LaTeX Workshop与latex language support3、安装SumatraPDFSumatraPDF是一个PDF阅读器也可以不安装而用vscode内部的PDFviewer但是实现不了正反向搜索功能。sumatraPDF安装地址Sumatra PDF reader download page4、正反向搜索注意最新的latex workshop自带的internal PDF viewer已经支持正反向搜索不再需要用sumatraPDF外部PDF浏览器了。点击vscode左下角齿轮选择设置然后点击右上方小图标“Open Settings(JSON)将下面的内容复制进去并修改两处vscode和两处sumatraPDF的路径为实际安装路径{ //------------------------------LaTeX 配置---------------------------------- // 设置是否自动编译 onFileChange onSave never latex-workshop.latex.autoBuild.run:onSave, //右键菜单 latex-workshop.showContextMenu:true, //从使用的包中自动补全命令和环境 latex-workshop.intellisense.package.enabled: true, //编译出错时设置是否弹出气泡设置 latex-workshop.message.error.show: true, latex-workshop.message.warning.show: true, // 编译工具和命令 latex-workshop.latex.tools: [ { name: pdflatex, command: pdflatex, args: [ -synctex1, -interactionnonstopmode, -file-line-error, %DOCFILE% //使用%DOCFILE可以将文件所在路径设置为中文,或者%DOC ] }, { name: xelatex, command: xelatex, args: [ -synctex1, -interactionnonstopmode, -file-line-error, %DOCFILE% //使用%DOCFILE可以将文件所在路径设置为中文,或者%DOC ] }, { name: latexmk, command: latexmk, args: [ -synctex1, -interactionnonstopmode, -file-line-error, -pdf, -outdir%OUTDIR%, %DOCFILE% ] }, { name: bibtex, command: bibtex, args: [ %DOCFILE% ] } ], // 用于配置编译链 latex-workshop.latex.recipes: [ { name: PDFLaTeX, //适合英文排版 tools: [ pdflatex ] }, { name: XeLaTeX, //适合中文排版 tools: [ xelatex ] }, { 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 ], //设置为onFailed 在构建失败后清除辅助文件 onBuilt onFailed never latex-workshop.latex.autoClean.run: onFailed, // 使用上次的recipe编译组合 first lastUsed latex-workshop.latex.recipe.default: lastUsed, // 用于反向同步的内部查看器的键绑定。ctrl-click(默认)或double-click latex-workshop.view.pdf.internal.synctex.keybinding: ctrl-click, editor.wordWrap: wordWrapColumn, //使用 SumatraPDF 预览编译好的PDF文件 // 设置VScode内部查看生成的pdf文件 tab browser external latex-workshop.view.pdf.viewer: external, //tab是用vscode默认阅读器external是外部阅读器 // PDF查看器用于在\ref上的[View on PDF]链接 latex-workshop.view.pdf.ref.viewer:auto, // 使用外部查看器时要执行的命令。此功能不受官方支持。 latex-workshop.view.pdf.external.viewer.command: C:/Users/admin/AppData/Local/SumatraPDF/SumatraPDF.exe, // 注意修改路径 // 使用外部查看器时latex-workshop.view.pdf.external.view .command的参数。此功能不受官方支持。%PDF%是用于生成PDF文件的绝对路径的占位符。 latex-workshop.view.pdf.external.viewer.args: [ %PDF% ], // 将synctex转发到外部查看器时要执行的命令。此功能不受官方支持。 latex-workshop.view.pdf.external.synctex.command: C:/Users/admin/AppData/Local/SumatraPDF/SumatraPDF.exe, // 注意修改路径 // latex-workshop.view.pdf.external.synctex的参数。当同步到外部查看器时。%LINE%是行号%PDF%是生成PDF文件的绝对路径的占位符%TEX%是触发syncTeX的扩展名为.tex的LaTeX文件路径。 latex-workshop.view.pdf.external.synctex.args: [ -forward-search, %TEX%, %LINE%, -reuse-instance, -inverse-search, \D:/Microsoft VS Code/Code.exe\ \D:/Microsoft VS Code/resources/app/out/cli.js\ -r -g \%f:%l\, // 注意修改路径 %PDF% ], explorer.confirmDelete: false, security.workspace.trust.untrustedFiles: open }然后打开sumatraPDF设置-选项 最下面输入D:/Microsoft VS Code/Code.exe -r -g %f:%l #修改路径为vscode的安装路径。正向搜索vscode中 ctrlaltJ 或者鼠标右键选择syncTex from cursor反向搜索先打开SumatraPDF再在vscode中 ctrlaltV 打开PDF然后在sumatraPDF中双击注意如果不先打开SumatraPDF而是直接在vscode中 ctrlaltV 打开SumatraPDF反向搜索会失效。