标签:dir lis exe app odi 扩展 trap vsc 一个
ctrl+shift+x
调出应用商店,搜索并安装如下扩展:
LaTeX Workshop
;LaTeX Workshop
LaTeX文件.tex
的编译、预览、辅助文件的清理等都在扩展latex workshop
中设置。
LaTeX Workshop
中,编译LaTeX文件时顺序执行的一系列/组命令称为LaTeX食谱(recipes),定义在latex-workshop.latex.recipes
。缺省情况,LaTeX Workshop包含2个基本的食谱,分别由latex-workshop.latex.recipes
和latex-workshop.latex.Tools
定义。第一个食谱的tools
域中的工具定义在第二个食谱。latex workshop
的参数含义见LaTeX Workshop
的配置文件"package.json"或https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile#latex-recipes了解配置情况。
LaTeX Workshop
默认的编译方式为latexmk
和pdflatex
。如下配置修改了latex workshop
的编译方式、预览、辅助文件等。特别添加了xelatex及包含bib时的编译。
ctrl+shift+p ->settings->首选项:打开用户设置(Json)
,在settings.json中添加如下内容:
"latex-workshop.intellisense.package.enabled": true, //根据加载的包,自动完成命令或包
"latex-workshop.latex.autoBuild.run": "never", //禁止保存文件时自动build
"latex-workshop.latex.recipes": [
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "PDFlatex",
"tools": [
"pdflatex"
]
},
{
"name": "pdflatex ->?? bibtex ->?? pdflatex2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "xelatex -> bibtex -> xelatex",
"tools": [
"xelatex",
"bibtex",
"xelatex",
]
}
],
"latex-workshop.latex.tools":[
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
],
"env": {}
},
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
],
"env": {}
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
],
"env": {}
}
],
"latex-workshop.view.pdf.viewer":"tab", //pdf文件的预览方式
"latex-workshop.view.pdf.external.synctex": {
"command": "SumatraPDF.exe",
"args": [
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
"-inverse-search",
"D:\\ProgramFiles\\Coding\\VSCode\\Code.exe D:\\ProgramFiles\\Coding\\VSCode\\resources\\app\\ut\\cli.js -r -g \"%f:%l\"",
"%PDF%"
]
},
//"latex-workshop.latex.autoClean.run": "onBuilt", //设置自动清理方式
"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",
"*.nav",
"*.snm",
"*.synctex.gz"
],
ctrl+k,ctrl+b
打开键盘快捷方式面板:
latex build
,将默认的ctrl+alt+b
替换为ctrl+b
(与Sublime Text 3统一)latex recipe
,设置快捷键为ctlr+r
,方便点菜!(ST3中是显示文档大纲)ctrl+alt+c
:清除辅助文件ctrl+alt+v
:查看编译的pdf文件根据latex-workshop.latex.recipes
中的name
段设定,可在.tex
文件首行指定编译方式。如%!TEX program = xelatex
表示用xelatex编译文件,而%!TEX program = PDFlatex
表示用latexpdf编译文件。多个文件情况,还可以用% !TEX root
指定主文件。
%! TeX program = pdflatex
\documentclass{article}
\begin{document}
press ctrl+b to complie,press ctrl+alt+v to view pdf
\end{document}
参考文章
使用VSCode编写LaTeX
标签:dir lis exe app odi 扩展 trap vsc 一个
原文地址:https://www.cnblogs.com/ourweiguan/p/11785660.html