Latex 文档中奇怪的 Bibtex 行为

发布于 2024-07-18 00:17:38 字数 371 浏览 6 评论 0原文

我在我的工作 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

旧时浪漫 2024-07-25 00:17:38

我认为您被 LaTex 加 Bibtex 的多通道性质绊倒了。 如果您查看本讨论中的第 3 步,您会看到下列:

第一次运行(通过乳胶)
生成一个辅助文件,
paper.aux,包含信息
关于引文(以及其他类型的
参考文献),参考书目风格
使用的,以及 bibtex 的名称
数据库。 第二次运行(通过
bibtex)使用中的信息
辅助文件以及数据
包含在 bibtex 数据库中,
创建文件 paper.bbl。 这个文件
包含参考书目环境
带有格式化的 \bibitem 条目
根据参考书目风格
指定。

因此,我认为正在发生的情况是您的 name_of_my_file.aux 文件仍然包含占位符 \cite{test}。 如果删除辅助文件,您应该能够重新开始:

latex name_of_my_file
bibtex name_of_my_file
latex name_of_my_file
latex name_of_my_file

[根据附加信息更新]:问题是您的文件中有一个 .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:

The first run (through latex)
generates an auxiliary file,
paper.aux, containing information
about citations (and other types of
references), the bibliography style
used, and the name of the bibtex
database. The second run (through
bibtex) uses the information in the
auxiliary file, along with the data
contained in the bibtex database, to
create a file paper.bbl. This file
contains a thebibliography environment
with \bibitem entries formatted
according to the bibliography style
specified.

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:

latex name_of_my_file
bibtex name_of_my_file
latex name_of_my_file
latex name_of_my_file

[Update based on additional info]: The problem was that you had a .aux file with your \cite{} still embedded. The second time that you ran latex, you overrode the old file with the new. That's why the complete set of steps includes an initial latex call, a bibtex call and two follow-up latex calls. Think of it as a multi-pass compiler and it might be more intuitive.

夏有森光若流苏 2024-07-25 00:17:38

您可以查看 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.

二货你真萌 2024-07-25 00:17:38

重新运行 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...)

长安忆 2024-07-25 00:17:38

检查您的 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.

茶花眉 2024-07-25 00:17:38

删除所有 .aux 和临时文件,用 Latex 重新运行,然后用 bibtex 运行,然后用 Latex 运行两次。

delete all your .aux and temporal files, re run with latex and then bibtex and then latex twice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文