我刚开始使用 Latex 几天,所以我是个初学者。但是,我成功地设置和自定义了我写书所需的一切……除了参考书目。我对参考书目的几种编写方式以及在 Latex 文档中包含的方式感到非常困惑。
我在 Mac 上使用 TexShop 编写包含多个章节的主文件。我尝试使用 natbib 包,并且我有一个 .bib 文件,它是从 Mendeley 导出我的参考书目后生成的。我的文件如下:
\documentclass[a4paper,11pt, twoside, openright]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[a4paper,top=3.5cm,bottom=2.5cm,left=3cm,right=3cm]{geometry}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{caption}
\captionsetup{font=small}
\usepackage{topfront}
\usepackage{emptypage}
\usepackage{natbib}
\begin{document}
\mainmatter
\input{capitoli/Results1.tex}
\end{document}
我的 results1.tex 文件是:
\begin{document}
\chapter{Results part I}
orem ipsum dolor sit amet, consectetuer adipiscing elit\cite{Author2015a}
\bibliography{library}
\bibliographystyle{plainnat}
最后是我的 .bib 文件(一个示例条目),它与其他文件位于同一目录中
@article{Author2015a,
author = {Author, Elizabeth C},
doi = {10.1016/j.apgeog.2014.12.002},
file = {:Users/Giovanna/Documents/phd/letteratura phd/author 2015 Five decades of neighborhood classifications and their transitions.pdf:pdf},
issn = {0143-6228},
journal = {Applied Geography},
pages = {1--11},
publisher = {Elsevier Ltd},
title = {{Five decades of neighborhood classi fi cations and their transitions : A comparison of four US cities , 1970 e 2010}},
url = {http://dx.doi.org/10.1016/j.apgeog.2014.12.002},
volume = {57},
year = {2015}
},
但是,我在最终的 pfd 中得到的是“?”而不是参考文献。问题出在哪里?现在我也下载了 Bibdesk 来尝试解决问题,但我不明白如何解决。我知道这可能是一个基本问题,但我真的无法解决它(即使已经阅读了几篇关于它的文章和教程。谢谢
答案1
这是几个问题的组合:
\bibliography{library}
应该不使用文件扩展名 -> 删除.bib
\bibliography{library} \bibliographystyle{plainnat}
只能在应该插入参考书目的地方使用一次。结尾
]
处缺失\usepackage[a4paper,top=3.5cm,bottom=2.5cm,left=3cm,right=3cm]{geometry}
\begin{document}
必须只写一次,在文档开头,而不是在包含的文件中(有例外,但不适用于此处)编译应该是 (pdf)latex、bibtex、(pdf)latex、(pdf)latex,并且检查文档编译时没有错误是很重要的,上面的一些问题很可能是由错误引起的。
最小工作示例
\documentclass[a4paper,11pt, twoside, openright]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[a4paper,top=3.5cm,bottom=2.5cm,left=3cm,right=3cm]{geometry}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{caption}
\captionsetup{font=small}
\usepackage{topfront}
%
\usepackage{emptypage}
\usepackage{natbib}
\usepackage{filecontents} % <- Just for the MWE, in real live have a seperate .bib file
\begin{filecontents*}{\jobname.bib}% <- Just for the MWE, in real live have a seperate .bib file
@article{Author2015a,
author = {Author, Elizabeth C},
doi = {10.1016/j.apgeog.2014.12.002},
file = {:Users/Giovanna/Documents/phd/letteratura phd/author 2015 Five decades of neighborhood classifications and their transitions.pdf:pdf},
issn = {0143-6228},
journal = {Applied Geography},
pages = {1--11},
publisher = {Elsevier Ltd},
title = {{Five decades of neighborhood classi fi cations and their transitions : A comparison of four US cities , 1970 e 2010}},
url = {http://dx.doi.org/10.1016/j.apgeog.2014.12.002},
volume = {57},
year = {2015}
},
\end{filecontents*}% <- Just for the MWE, in real live have a seperate .bib file
\begin{document}
\mainmatter
\chapter{Results part I}
orem ipsum dolor sit amet, consectetuer adipiscing elit\cite{Author2015a}
\bibliography{\jobname}
\bibliographystyle{plainnat}
\end{document}