使用“使用python脚本编译LaTeX”里的方法2把LaTeX的编译器改成了latexmk,但是一直报错,参考文献生成不了。先是XeLaTeX编译的时候报下面的警告:
Warning: Citation xxx on page xxx undefined on input line xxx
Warning: Citation xxx on page xxx undefined on input line xxx.
…
然后就是Biber报错:
Latexmk: List of undefined refs and citations:
Citation ‘xxx’ on page xx undefined on input line xx
Citation ‘xxx’ on page xx undefined on input line xx
…
Latex failed to resolve xxx citation(s)
按理说Latexmk可以自动编译参考文献,不需要向.latexmkrc
中添加相关命令。所以不是.latexmkrc
配置的问题。
仔细读了下输出的errors和log,发现问题出在输出文件的路径上。其中有两条log是:
Latexmk: Found input bbl file ‘xxx.bbl’
Latexmk: Log file says output to ‘out/xxx.xdv’
而.latexmkrc
文件中已经将输出路径更改为子目录out\
,但是Latexmk编译的时候依然先读取根目录中的.bbl
文件,而根目录中的.bbl
文件是更改输出路径之前的编译生成的,所以造成了参考文献无法编译成功。
解决方法:
把根目录中的所有编译生成的文件删除即可。
Latexmk: Found input bbl file ‘out/xxx.bbl’
Latexmk: Log file says output to ‘out/xxx.xdv’