//------------------------------LaTeX 配置----------------------------------
// 1. 设置输出目录为 .output
// %DIR% 代表当前 tex 文件所在目录
"latex-workshop.latex.outDir": "./.output",
// 设置是否自动编译
"latex-workshop.latex.autoBuild.run": "onFileChange",
// 右键菜单
"latex-workshop.showContextMenu": true,
// 智能提示
"latex-workshop.latex.intellisense.package.enabled": true,
// 报错弹窗设置
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
// 2. 编译工具配置 (已修复 command 写法并使用 %OUTDIR% 变量)
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex", // 修正:命令中只写程序名
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-output-directory=%OUTDIR%", // 这里引用上面设置的 output
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex", // 修正:命令中只写程序名
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-output-directory=%OUTDIR%", // 这里引用上面设置的 output
"%DOCFILE%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%", // latexmk 也要指向 output
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%OUTDIR%/%DOCFILE%" // BibTeX 需要去 output 文件夹找 .aux 文件
]
}
],
// 编译链 (保持不变)
"latex-workshop.latex.recipes": [
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"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"
],
"latex-workshop.latex.autoClean.run": "onFailed",
"latex-workshop.latex.recipe.default": "lastUsed",
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click"