使用VSCode撰写Latex文档
发布时间
阅读量:
阅读量
参考资料:
文章目录
-
- 简介
-
VSCode配置步骤如下:
-
第一步是安装LaTeX Workshop插件
-
第二步是配置LaTeX编译环境
-
第三步是下载并安装SumatraPDF
- 可能遇到的问题
概要
依次设置TeX Live环境和Visual Studio Code开发工具。
详细说明整个流程,并未进行充分描述。
仅涉及如何配置Visual Studio Code开发环境的相关细节。
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"
}
AI写代码bash


3. 下载安装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%"
]
AI写代码bash

可能遇到的问题
- 编译错误,或无法编译
出现的主要问题有两个原因:其一是系统变量配置未正确设置导致编译时无法识别编译器路径;其二是settings.json文件配置不完善。通过从这两个方面入手查阅相关资料来解决问题。
全部评论 (0)
还没有任何评论哟~
