Latex 文档中奇怪的 Bibtex 行为
我在我的工作 Latex 文档中添加了一行“\cite{test}”作为测试。 当我编译 bibtex "!bibtex name_of_my_file 时,我得到了预期的错误:
警告--我没有找到“test”的数据库条目
然后,我删除了该行并再次编译了 bibtex,希望再次有一个可用的 Latex 文件。 然而,即使使用新的外壳,也会发生同样的错误。 我无法理解这种行为。 逻辑是什么? 如何让我的 Latex 文档再次工作?
[更新信息] 问题出人意料地消失了,就像它出现一样。 我不知道为什么,但现在可以了。 你知道奇怪行为的原因吗?
I added a line "\cite{test}" as a test to my working Latex document. When I compiled the bibtex "!bibtex name_of_my_file, I got the expected error:
Warning--I didn't find a database entry for "test"
Then, I removed the line and compiled the bibtex again, hoping to have a working Latex file again. However, the same error occurs, even with a fresh shell. I cannot understand the behaviour. What is the logic? How can I get my Latex document working again?
[Updated Info]
The problem dissapeared as unexpectedly as it emerged. I have no idea why but it works now. Do you know the reason for the odd behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我认为您被 LaTex 加 Bibtex 的多通道性质绊倒了。 如果您查看本讨论中的第 3 步,您会看到下列:
因此,我认为正在发生的情况是您的
name_of_my_file.aux
文件仍然包含占位符\cite{test}
。 如果删除辅助文件,您应该能够重新开始:[根据附加信息更新]:问题是您的文件中有一个
.aux
文件\cite{}
仍然嵌入。 第二次运行latex
时,您用新文件覆盖了旧文件。 这就是为什么完整的步骤集包括初始latex
调用、bibtex
调用和两个后续latex
调用。 将其视为多遍编译器,可能会更直观。I think you are tripping over the multi-pass nature of LaTex plus Bibtex. If you look at Step 3 in this discussion, you'll see the following:
So, what I think is happening is that your
name_of_my_file.aux
file still contains your placeholder\cite{test}
. If you remove the auxiliary file, you should be able to start over with:[Update based on additional info]: The problem was that you had a
.aux
file with your\cite{}
still embedded. The second time that you ranlatex
, you overrode the old file with the new. That's why the complete set of steps includes an initiallatex
call, abibtex
call and two follow-uplatex
calls. Think of it as a multi-pass compiler and it might be more intuitive.您可以查看 latexmk,它将负责修复为您点编译。
无论如何,即使您缺少参考书目项目,您也应该能够构建文档(pdflatex blah.tex)。 相应的参考文献将在 PDF 中仅显示为问号。
You could have a look at latexmk, which will take care of the fix point compilation for you.
Anyway, you should be able to build the document (pdflatex blah.tex), even if you're missing a bibliography item. The corresponding references will just appear as question marks in the PDF.
重新运行 Latex 以重新生成 aux 文件。
请查看此讨论以获取更多信息。 基本上,您可能已从 .tex 文件中取出引文,但它仍然存在于派生文件之一中(aux、bbl,等等......)
Rerun latex to regenerate the aux file.
Have a look at this discussion for pointers to a bit more information. Basically, you may have taken your citation out of the .tex file, but it still exists in one of the derived files (aux, bbl, whatever...)
检查您的 bib 文件的扩展名是否为 .bib 而不是 .tex。
如果是 .tex,只需将其更改为 .bib 即可。
有一次我意外地将其更改为 tex,通过添加一些引用,并使用“另存为”选项保存它,而不指定书目扩展名。 事情就是这样突然发生的。
Check if your bib file has the extension .bib and not .tex.
If it is .tex, just change it to .bib and that should do it.
Once I changed it accidentally to tex, by adding some references, and saving it with the "save as" option, without specifying the bib extension. That's how it can happen all of a sudden.
删除所有 .aux 和临时文件,用 Latex 重新运行,然后用 bibtex 运行,然后用 Latex 运行两次。
delete all your .aux and temporal files, re run with latex and then bibtex and then latex twice.