参考资料:
如何使用VSCode编写Latex?
概要
先安装texlive,然后安装VSCode.
我这里步骤是全的,但说的不那么细。
只介绍VSCode中的配置方法。
VSCode配置步骤
1. 安装LaTex Workshop插件
2. 配置Latex编译环境
将下列配置粘入settings.json
文件中。
{"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","%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"],"latex-workshop.latex.autoClean.run": "onFailed","latex-workshop.latex.recipe.default": "lastUsed","latex-workshop.view.pdf.internal.synctex.keybinding": "double-click"
}
3. 下载安装SumatraPDF
SumatraPDF官网链接
而后在settings.json
中加入下列配置文件(注意修改第4行和第11行路径)
"latex-workshop.view.pdf.external.viewer.args": ["%PDF%"],"latex-workshop.view.pdf.external.synctex.command": "C:/Users/dell/AppData/Local/SumatraPDF/SumatraPDF.exe", // 注意修改路径"latex-workshop.view.pdf.external.synctex.args": ["-forward-search","%TEX%","%LINE%","-reuse-instance","-inverse-search","\"C:/Users/dell/AppData/Local/Programs/Microsoft VS Code/Code.exe\" \"C:/Users/dell/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js\" -r -g \"%f:%l\"", // 注意修改路径"%PDF%"]