1.环境配置
latex使用texlive,安装完成texlive后,在系统环境变量中添加texlive路径,并在vs code里加入json字段。同时,为了方便使用,在vs code里添加latex workshope插件,可以看到目录,以及添加公式和特殊符号。
python
"latex-workshop.latex.tools": [
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "biber",
"command": "biber",
"args": [
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "XeLaTeX + Biber (推荐)",
"tools": [
"xelatex",
"biber",
"xelatex",
"xelatex"
]
},
{
"name": "XeLaTeX 单次编译",
"tools": [
"xelatex"
]
},
{
"name": "PDFLaTeX + BibTeX",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "PDFLaTeX 单次编译",
"tools": [
"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",
"*.synctex.gz",
"*.run.xml" // 新增Biber生成的辅助文件
],
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.autoBuild.run": "onSave", // 改为保存时自动编译(减少频繁编译)
"latex-workshop.showContextMenu": true,
"latex-workshop.message.error.show": true, // 恢复错误提示(便于排查问题)
"latex-workshop.message.warning.show": true, // 恢复警告提示(便于排查问题)
"latex-workshop.intellisense.package.enabled": true,
"latex-workshop.latex.autoClean.run": "onSuccessfulBuild", // 编译成功后自动清理辅助文件
"latex-workshop.latex.recipe.default": "XeLaTeX + Biber (推荐)", // 默认使用XeLaTeX+Biber编译
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
"latex-workshop.latex.compile.trigger": "onSave" // 明确编译触发时机为保存
2.使用攻略
2.1 latex换行:
1.换行(三个方法)
\newline
另起一段是空一行
\
2.分段
\par
3.换页
\newpage
2.2 vs code编译器自动换行
在设置中选择 Word Wrap