LaTeX生成的PDF中参考文献完全不显示问题求助
解决LaTeX参考文献不显示的问题
核心原因与分步解决方案
1. 必须引用或声明显示全部参考文献条目
BibTeX默认仅会将正文中被引用的文献条目纳入参考文献列表。你的文档未添加任何\cite{...}引用命令,因此即便.bib文件有内容,也不会生成参考文献。
两种解决方式:
- 在正文合适位置添加针对性引用:比如在章节内插入
\cite{openflights}、\cite{openflightsDatabases} - 若要显示所有未引用的条目,在
\bibliography{bibliography}前添加\nocite{*}
2. 执行正确的多轮编译流程
LaTeX处理参考文献需要多轮编译才能完成交叉引用与格式渲染,正确步骤为:
- 编译
main.tex(生成.aux文件,告知BibTeX需处理的引用条目) - 用BibTeX编译
main.bib(生成.bbl文件,包含格式化后的参考文献内容) - 再次编译
main.tex(加载.bbl文件并插入参考文献) - 第三次编译
main.tex(更新目录、交叉引用等关联内容)
3. 修复过时包与潜在冲突
你的代码存在几个非最优或过时设置,可优化以避免潜在问题:
subfigure包已停止维护,替换为subcaption包utf8x不如标准utf8可靠(当前主流LaTeX发行版已默认支持UTF-8,甚至可省略inputenc)hyperref包建议放在所有包的最后加载,减少与其他包的冲突
优化后的main.tex示例:
\documentclass[12pt,a4paper,openany,oneside]{book} \usepackage[italian]{babel} \usepackage{subcaption} % 替换过时的subfigure \usepackage{graphicx} \usepackage[font=small,labelfont=bf,tableposition=top]{caption} \usepackage{listings} \usepackage{courier} \usepackage{color} \lstset{ language=R, basicstyle=\footnotesize\ttfamily, numbers=left, numberstyle=\tiny, numbersep=5pt, tabsize=4, extendedchars=true, breaklines=true, keywordstyle=\textbf, stringstyle=\color{black}\ttfamily, showspaces=false, showtabs=false, xleftmargin=17pt, framexleftmargin=17pt, framexrightmargin=5pt, framexbottommargin=4pt, showstringspaces=false } \addto\captionsitalian{% \renewcommand{\lstlistingname}{Codice}} \setcounter{tocdepth}{3} \setcounter{secnumdepth}{3} \usepackage[export]{adjustbox} \usepackage{amsmath} \usepackage{framed} \usepackage{hyperref} % 移至所有包最后加载 \begin{document} \title{Some Thing} \author{Some One} \maketitle % 补充生成标题,原代码遗漏该命令 \tableofcontents \newpage \addcontentsline{toc}{chapter}{Bibliografia} \nocite{*} % 显示所有参考文献条目 \bibliographystyle{unsrt} \bibliography{bibliography} \end{document}
4. 优化.bib文件格式
你的.bib文件可简化冗余内容,让结构更规范:
@misc{openflights, title = {OpenFlights}, author = {Jani Patokallio}, howpublished = {\url{https://openflights.org/about}} } @misc{openflightsDatabases, title = {OpenFlights Databases Documentation}, author = {Jani Patokallio; ContentShare}, howpublished = {\url{https://openflights.org/data.html}} } @misc{passengerChart, title = {World air passenger traffic evolution, 1980-2020}, author = {IEA}, howpublished = {\url{https://www.iea.org/data-and-statistics/charts/world-air-passenger-traffic-evolution-1980-2020}}, note = {Paris: IEA. Licence: CC BY 4.0} }
内容的提问来源于stack exchange,提问作者xSamx02
相关产品推荐
相关产品推荐

