lirundong / shtthesis

An unofficial LaTeX thesis template for ShanghaiTech University.
https://ctan.org/pkg/shtthesis
GNU General Public License v3.0
79 stars 19 forks source link

本地编译文献引用报错 #12

Open 1985312383 opened 7 months ago

1985312383 commented 7 months ago

Hi,润东 我现在遇见了个奇怪的问题,使用了很多办法都没解决,但是我也不会修改你的模板 我在texpage在线渲染的时候,引用正确且带有颜色,如图

image

但是当我在本地的texlive以及本地的overleaf中渲染都会出现同样的错误,如图

image

两者都是XeLatex编译 我不明白是什么原因导致的这个问题,但由于后面篇幅过长,即便付费,在线也最多只有5分钟的编译时间,故急需本地编译,所以希望润东可以帮助解决这个问题

lirundong commented 7 months ago

看起来像是后者的完整编译流程没有走完就被进程中止了,所以文献引用还没来得及被正确排版。LaTeX make/XeLaTeX 其实是会跑好几趟 xelatex -> xelatex -> biblatex -> xelatex 流程来逐步增加上下文信息完成完整排版的。

@1985312383 慕灵你可以把你本地编译

latexmk -C
latexmk --xelatex

的完整日志上传一下嘛?

1985312383 commented 7 months ago

震惊,运行这个命令行编译居然正确出来了! texlive还是老样子,应该是他的xelatex不是xelatex -> bibtex -> xelatex*2编译链,而是单独的 然后我在vscode中编译这个编译链,会在bibtex报错并停止编译,报错信息为:

This is BibTeX, Version 0.99d (TeX Live 2023) The top-level auxiliary file: shtthesis-user-guide.aux I found no \citation commands---while reading file shtthesis-user-guide.aux I found no \bibdata command---while reading file shtthesis-user-guide.aux I found no \bibstyle command---while reading file shtthesis-user-guide.aux (There were 3 error messages)

hushidong commented 7 months ago

科技大模板好像要用biber而不是bibtex吧。所以使用bibtex自然会报错的。

1985312383 commented 7 months ago

非常感谢! @hushidong 的回答解决了我的困惑,竟然真的是,我在texstudio和vscode都设置为xelatex -> biber -> xelatex2,都可以成功的将结果编译出来 而使用常规的xelatex -> bibtex -> xelatex2是编译不出来的,

lirundong commented 7 months ago

多谢 @hushidong 的答疑!

latexmk 会自动调用 biber 来编译包含 biblatex 的文档,所以

运行这个命令行编译居然正确出来了!

是符合预期的。

@1985312383 的编译错误

This is BibTeX, Version 0.99d (TeX Live 2023) The top-level auxiliary file: shtthesis-user-guide.aux I found no \citation commands---while reading file shtthesis-user-guide.aux I found no \bibdata command---while reading file shtthesis-user-guide.aux I found no \bibstyle command---while reading file shtthesis-user-guide.aux (There were 3 error messages)

应该就是 bibtex 不能正确处理 biblatex 导致的。

在vscode中编译这个编译链

其实 shtthesis 是提供了 VSCode 编译配置的(LaTeX recipes here),在 VSCode-LaTeX 插件中先清理编译缓存,再选择使用 latexmk (xelatex)latexmk (lualatex) 编辑即可。

image
lirundong commented 7 months ago

奇怪,我在 Windows 环境下试了下,用 VSCode 的 latexmk (xelatex) recipe 会调用 bibtex 而不是 biber。可能需要验证项目里提供的 VSCode recipes 的泛用性

1985312383 commented 7 months ago

是的 @lirundong ,我也尝试了latexmk,应该是不同环境下的 latexmk 调用的编译链不同导致的,不过 xelatex -> biber -> xelatex*2lualatex -> biber -> lualatex*2都是可以正确编译的,可以在recipe中加入对应编译链应该可以解决这个问题,正好大多数人更喜欢vscode+texlive的组合 为此,我提交了一版 #13 ,尝试了一下在本地是正常的

YutingXiao commented 6 months ago

非常感谢! @hushidong 的回答解决了我的困惑,竟然真的是,我在texstudio和vscode都设置为xelatex -> biber -> xelatex2,都可以成功的将结果编译出来 而使用常规的xelatex -> bibtex -> xelatex2是编译不出来的,

请问下,texstudio在哪里设置*xelatex -> biber -> xelatex2** ???

hushidong commented 6 months ago

图片

hushidong commented 6 months ago

默认编译器也请改为xelatex。

1985312383 commented 6 months ago

非常感谢! @hushidong 的回答解决了我的困惑,竟然真的是,我在texstudio和vscode都设置为xelatex -> biber -> xelatex2,都可以成功的将结果编译出来 而使用常规的xelatex -> bibtex -> xelatex2是编译不出来的,

请问下,texstudio在哪里设置*xelatex -> biber -> xelatex2** ???

image