Latex: Package natbib Warning: Citation xxx undefined解决

这篇博客介绍了如何解决使用Texlive2021在本地编译LaTeX文件时出现的引用未定义警告及?号问题。通过调整编译步骤,先用BibTeX生成.bbl文件,然后两次运行pdfLaTeX,最终成功解决了引用显示问题。

Latex: Package natbib Warning: Citation xxx undefined解决

1 问题描述

前两天从这里下载并安装了Texlive 2021,但是发现在Overleaf上没有任何问题的Latex文件在本地用Texlive 2021编译会出现Package natbib Warning: Citation xxx on page xx undefined on input line xxxx.的问题,同时论文中所有的引用都是?,具体报错如下图:
Texlive 2021本地编译错误
我的编译方式就是直接点击下图红框中的按钮。
在这里插入图片描述

2 解决方案

就是修改编译的步骤,首先编译产生.bbl文件,然后再重新编译。具体步骤如下:
步骤1:使用BibTex生成bbl文件
在这里插入图片描述
结果如下:
在这里插入图片描述
步骤2: 使用pdfLatex编译
这个步骤完成后会发现生成的pdf依然是有问题的(也就是citation没有编号),如下图:
在这里插入图片描述
步骤3: 再次使用pdfLatex编译
这一步完成后就一切正常了,结果如下:
在这里插入图片描述

64: Unicode character 张 (U+5F20) not set up for use with LaTeX. \oauthor{\bsnm{张虎成}} 64: Unicode character 虎 (U+864E) not set up for use with LaTeX. \oauthor{\bsnm{张虎成}} 64: Unicode character 成 (U+6210) not set up for use with LaTeX. \oauthor{\bsnm{张虎成}} 65: Unicode character 李 (U+674E) not set up for use with LaTeX. \oauthor{\bsnm{李雷孝}} 65: Unicode character 雷 (U+96F7) not set up for use with LaTeX. \oauthor{\bsnm{李雷孝}} 65: Unicode character 孝 (U+5B5D) not set up for use with LaTeX. \oauthor{\bsnm{李雷孝}} 66: Unicode character 刘 (U+5218) not set up for use with LaTeX. \oauthor{\bsnm{刘东江}} 66: Unicode character 东 (U+4E1C) not set up for use with LaTeX. \oauthor{\bsnm{刘东江}} 66: Unicode character 江 (U+6C5F) not set up for use with LaTeX. \oauthor{\bsnm{刘东江}} 67: Unicode character 多 (U+591A) not set up for use with LaTeX. 多 67: Unicode character 模 (U+6A21) not set up for use with LaTeX. 多模 67: Unicode character 态 (U+6001) not set up for use with LaTeX. 多模态 67: Unicode character 数 (U+6570) not set up for use with LaTeX. 多模态数 67: Unicode character 据 (U+636E) not set up for use with LaTeX. 多模态数据 67: Unicode character 融 (U+878D) not set up for use with LaTeX. 多模态数据融 67: Unicode character 合 (U+5408) not set up for use with LaTeX. 多模态数据融合 67: Unicode character 研 (U+7814) not set up for use with LaTeX. 多模态数据融合研 67: Unicode character 究 (U+7A76) not set up for use with LaTeX. 多模态数据融合研究 67: Unicode character 综 (U+7EFC) not set up for use with LaTeX. 多模态数据融合研究综 67: Unicode character 述 (U+8FF0) not set up for use with LaTeX. 多模态数据融合研究综述 : example' multiply defined. : example' multiply defined. 143: Font shape `U/rsfs/m/n' in size <8.43146> not available(Font) size <8> substituted 143: Font shape `U/rsfs/m/n' in size <5.52061> not available(Font) size <6> substituted : Underfull \vbox (badness 10000) has occurred while \output is active [] : Underfull \vbox (badness 10000) has occurred while \output is active [] : destination with the same identifier (name{figure.1}) has been already used, duplicate ignored<argument> ...shipout:D \box_use:N \l_shipout_box \__shipout_drop_firstpage_... : destination with the same identifier (name{figure.2}) has been already used, duplicate ignored<argument> ...shipout:D \box_use:N \l_shipout_box \__shipout_drop_firstpage_... : multiple pdfs with page group included in a single page>]<fazhan (1).pdf, id=125, page=2, 963.6pt x 542.025pt>File: fazhan (1).pdf Graphic file (type pdf)<use fazhan (1).pdf, page 2> 176: Citation `pearson1901liii' on page 3 undefined 176: Citation `blei2003latent' on page 3 undefined 176: Citation `thompson2000canonical' on page 3 undefined 176: Citation `hinton2006reducing' on page 3 undefined 176: Citation `graves2012long' on page 3 undefined 176: Citation `vaswani2017attention' on page 3 undefined 176: Citation `krizhevsky2012imagenet' on page 3 undefined : Underfull \vbox (badness 10000) has occurred while \output is active [] : destination with the same identifier (name{figure.3}) has been already used, duplicate ignored<argument> ...shipout:D \box_use:N \l_shipout_box \__shipout_drop_firstpage_... : Underfull \vbox (badness 10000) has occurred while \output is active [] 227: Font shape `U/rsfs/m/n' in size <4.015> not available(Font) size <5> substituted : Underfull \vbox (badness 10000) has occurred while \output is active [] : destination with the same identifier (name{table.1}) has been already used, duplicate ignored<argument> ...shipout:D \box_use:N \l_shipout_box \__shipout_drop_firstpage_... : No positions in optional float specifier. : Underfull \vbox (badness 10000) has occurred while \output is active [] : destination with the same identifier (name{table.2}) has been already used, duplicate ignored<argument> ...shipout:D \box_use:N \l_shipout_box \__shipout_drop_firstpage_... : Underfull \vbox (badness 10000) has occurred while \output is active [] : destination with the same identifier (name{table.3}) has been already used, duplicate ignored<argument> ...shipout:D \box_use:N \l_shipout_box \__shipout_drop_firstpage_... : Underfull \vbox (badness 10000) has occurred while \output is active [] : destination with the same identifier (name{figure.4}) has been already used, duplicate ignored<argument> ...shipout:D \box_use:N \l_shipout_box \__shipout_drop_firstpage_... 384: Font shape `OMS/cmss/m/n' undefined(Font) using `OMS/cmsy/m/n' instead(Font) for symbol `textbraceleft' 420: Overfull \hbox (7.55843pt too wide) in paragraph : Underfull \vbox (badness 10000) has occurred while \output is active [] 451: Citation `bib1' on page 10 undefined 451: Citation `bib2' on page 10 undefined 453: Citation `bib3' on page 10 undefined 453: Citation `bib4' on page 10 undefined 453: Citation `bib5' on page 10 undefined : Underfull \vbox (badness 10000) has occurred while \output is active [] : Underfull \vbox (badness 10000) has occurred while \output is active [] 548: Underfull \hbox (badness 1859) in paragraph 548: Underfull \hbox (badness 10000) in paragraph 548: Underfull \hbox (badness 10000) in paragraph 548: Underfull \hbox (badness 4634) in paragraph 548: Underfull \hbox (badness 10000) in paragraph : Underfull \vbox (badness 10000) has occurred while \output is active [] 564: Difference (4) between bookmark levels is greater than one, level fixed 572: Difference (3) between bookmark levels is greater than one, level fixed : Underfull \vbox (badness 10000) has occurred while \output is active [] : Underfull \vbox (badness 10000) has occurred while \output is active [] : There were undefined citations. : Underfull \vbox (badness 10000) has occurred while \output is active [] : Size substitutions with differences(Font) up to 0.985pt have occurred. : Some font shapes were not available, defaults substituted. : There were multiply-defined labels.
08-08
在Overleaf在线编写LaTeX使用`natbib`时出现 “Citation xxx undefined” 警告,通常是由以下几种原因导致的,下面是对应的解决办法: ### 未正确包含参考文献文件 需要确保 `.bib` 文件已正确上传到 Overleaf 项目中,并且在 `.tex` 文件里正确引用。例如,若 `.bib` 文件名为 `references.bib`,则在 `.tex` 文件中需添加如下代码: ```latex \bibliographystyle{plainnat} % 使用 natbib 兼容的样式 \bibliography{references} % 引用参考文献文件 ``` ### 编译顺序有误 在使用 `natbib` 时,正确的编译顺序一般为:LaTeX → BibTeX → LaTeXLaTeX。在 Overleaf 中,可通过以下操作实现: 1. 点击 Overleaf 界面左上角的 “Recompile” 按钮进行第一次 LaTeX 编译。 2. 点击界面左侧菜单栏的 “Tools”,选择 “BibTeX” 进行 BibTeX 编译。 3. 再次点击 “Recompile” 按钮进行第二次 LaTeX 编译。 4. 最后再点击一次 “Recompile” 按钮进行第三次 LaTeX 编译。 ### 引用键拼写错误 要保证在 `.tex` 文件里使用的引用键和 `.bib` 文件中的条目键完全一致。例如,在 `.bib` 文件中有如下条目: ```bibtex @article{example2023, author = {Author, A.}, title = {Example Title}, journal = {Example Journal}, year = {2023}, } ``` 那么在 `.tex` 文件中引用时需使用正确的键: ```latex \cite{example2023} ``` ### 缓存问题 有时候 Overleaf 的缓存可能会引发问题。可以尝试清除缓存,点击 Overleaf 界面右上角的 “Menu”,选择 “Clear cache and recompile”。 ### `.bib` 文件格式错误 检查 `.bib` 文件是否存在格式错误,比如缺失逗号、引号不匹配等。可使用在线的 BibTeX 验证工具来检查 `.bib` 文件的格式。 ### 包冲突 确保没有其他包与 `natbib` 产生冲突。若使用了其他与引用相关的包,尝试移除这些包或者调整加载顺序。 ### 项目文件结构问题 确认项目文件结构清晰,所有文件都在正确的位置。有时候文件位置不正确也可能导致引用失败。 ### 服务器问题 若上述方法都无法解决问题,可能是 Overleaf 服务器出现了临时故障。可以稍后再尝试编译,或者联系 Overleaf 官方支持团队。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值