然后每次开始新环境时,首先执行一下clean_env.bat文件即可.
{
"workbench.colorTheme": "Default Dark+",
"latex-workshop.latex.outDir": "%DIR%/.build",
"latex-workshop.latex.tools": [
{
// 编译工具和命令
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
//"-pdf",
"--shell-escape",
"--output-directory=%OUTDIR%",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"--output-directory=%OUTDIR%",
"%DOCFILE%"
],
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%OUTDIR%/%DOCFILE%"
],
"env": {
"TEXMFOUTPUT": "%OUTDIR%",
}
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "pdflatex",
"tools": [
"pdflatex"
]
},
{
"name": "xe->bib->xe->xe",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdf->bib->pdf->pdf",
"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",
"*.pdf",
"*.gz",
"*.fdb_latexmk",
],
// 使用内置的pdf阅读器
"latex-workshop.view.pdf.viewer": "tab",
// 使用Acrobat打开pdf
//"latex-workshop.view.pdf.viewer": "external",
//"latex-workshop.view.pdf.external.viewer.command": "D:/software/Adobe/Acrobat/Acrobat.exe", //自己的安装位置
//"latex-workshop.view.pdf.external.viewer.args": [
// "%PDF%"
//],
}
TeXLive : 2021版本.
模板文件: scu_thesis_2022_03_23.zip
https://github.com/kevinleeex/scu_thesis_2020/releases/download/v2022.03.23/scu_thesis_2022_03_23.zip
发现论文中参考文献只有最初的两个引用,添加其他引用都不行,在Log中报以下类似的错误:
Package natbib Warning: Citation `laibson1997golden' on page 1 undefined on input line 44.
折腾了1天,终于发现问题所在:
Chapters目录下老的.aux文件没有删除,在bibtex的时候,还是用的这些.aux文件,导致新的引用无法加入.
解决办法:
方法1:
删除Chapters目录下老的.aux文件即可.
方法2:
在项目根目录编写一个clean_env.bat文件
内容:
REM @echo off
REM 删除指定字符串的文件夹和文件
for /f "delims=" %%i in ('dir /s /a /b build') do (
rd /s/q "%%~i"
del /s/q "%%~i"
)
REM 删除指定字符串的文件夹和文件
for /f "delims=" %%i in ('dir /s /a /b *.log') do (
rd /s/q "%%~i"
del /s/q "%%~i"
)
REM 删除指定字符串的文件夹和文件
for /f "delims=" %%i in ('dir /s /a /b *.aux') do (
rd /s/q "%%~i"
del /s/q "%%~i"
)
pause
然后每次开始新环境时,首先执行一下clean_env.bat文件即可.
这里顺便分享一下setting.json的配置