Natbib 给出的引用未定义

Natbib 给出的引用未定义

我一直在使用 natbib 进行引用,而不是 bibtex,而是手动输入引用。编译时,我不断遇到问题,提示“第 # 页上的引用‘所有引用’在输入行 # 上未定义”

\documentclass{article}
\usepackage{graphicx}
\usepackage[round]{natbib}
\usepackage{mathtools}
\usepackage{float}

\begin{document}
\bibliographystyle{plainnat}

\title{my title}
\author{my name}
\date{some date}
\maketitle

\section*{section title}
some text some more text and more \citep{hooper05} and then more \citep{hobbs92}. 
And last but not least more and more text \citep{da05}.

\begin{thebibliography}{99}

\bibitem[Daehler,(2005)]{da05} CSE citation here
\bibitem[Hobbs \& Huennke(1992)]{hobbs92} CSE citation here
\bibitem[Hooper et al.(2005)]{hooper05} CSE citation here



\end{thebibliography}

\end{document}

这是使用的完整文档的示例。当我尝试按字母顺序排列引文时,输出结果更多,包括“引文‘(所有引文)’在第 # 页上未定义在输入行 # 上”。目前,我只有三个引文,打算包括更多,并按字母顺序排列。当我按照我在文本中放置引文的顺序重新排列时,它可以很好地编译。

答案1

你正在尝试做的是排版参考书目手动。这是可以管理的,但你必须自己进行所有排序。这是编译最小示例时的输出:

在此处输入图片描述

\documentclass{article}
\usepackage[round]{natbib}
\begin{document}

\section*{section title}
some text some more text and more \citep{hooper05} and then more \citep{hobbs92}. 
And last but not least more and more text \citep{da05}.

\begin{thebibliography}{99}
  \bibitem[Daehler,(2005)]{da05} Daehler, CSE citation here
  \bibitem[Hooper et al.(2005)]{hooper05} Hooper, CSE citation here
  \bibitem[Hobbs \& Huennke(1992)]{hobbs92} Hobbs, CSE citation here
\end{thebibliography}

\end{document}

如果你现在切换一些参考书目项目,LaTeX 将再次按原样排版:

在此处输入图片描述

\documentclass{article}
\usepackage[round]{natbib}
\begin{document}

\section*{section title}
some text some more text and more \citep{hooper05} and then more \citep{hobbs92}. 
And last but not least more and more text \citep{da05}.

\begin{thebibliography}{99}
  \bibitem[Hobbs \& Huennke(1992)]{hobbs92} Hobbs, CSE citation here
  \bibitem[Hooper et al.(2005)]{hooper05} Hooper, CSE citation here
  \bibitem[Daehler,(2005)]{da05} Daehler, CSE citation here
\end{thebibliography}

\end{document}

您提到您将向参考书目添加参考文献,使其不断增长。那么我建议您使用 BibTeX 的强大功能来为您进行实际排序。为此,您可以使用以下模板作为基础(我使用了以下可能是假的参考文献:霍布斯和胡恩克德勒Hooper 等人):

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{source.bib}
@article {hobbs92,
  author = {Hobbs, Richard J. and Huenneke, Laura F.},
  title = {Disturbance, Diversity, and Invasion: Implications for Conservation},
  journal = {Conservation Biology},
  volume = {6},
  number = {3},
  publisher = {Blackwell Science Inc},
  issn = {1523-1739},
  url = {http://dx.doi.org/10.1046/j.1523-1739.1992.06030324.x},
  doi = {10.1046/j.1523-1739.1992.06030324.x},
  pages = {324--337},
  year = {1992},
}
@article {da05,
  author = {Daehler, Curtis C. and Goergen, Erin M.},
  title = {Experimental Restoration of an Indigenous Hawaiian Grassland after Invasion by Buffel Grass (Cenchrus ciliaris)},
  journal = {Restoration Ecology},
  volume = {13},
  number = {2},
  publisher = {Blackwell Science Inc},
  issn = {1526-100X},
  url = {http://dx.doi.org/10.1111/j.1526-100X.2005.00047.x},
  doi = {10.1111/j.1526-100X.2005.00047.x},
  pages = {380--389},
  keywords = {Cenchrus ciliaris, grassland, Hawaii, Heteropogon contortus, invasive grasses, priority effects},
  year = {2005},
}
@article{hooper05,
  author = {Hooper, PA and Blackman, BRK and Dear, JP},
  pages = {3564--3576},
  title = {The mechanical behaviour of poly(vinyl butyral) at different strain magnitudes and strain rates},
  volume = {47},
  year = {2012}
}
\end{filecontents*}

\usepackage[round]{natbib}
\begin{document}

\section*{section title}
some text some more text and more \citep{hooper05} and then more \citep{hobbs92}. 
And last but not least more and more text \citep{da05}.

\bibliographystyle{plainnat}
\bibliography{source}

\end{document}

因此,您无需thebibliography使用 s 手动创建环境,而是创建一个文件并使用特定的 BibTeX 语法输入内容,然后使用 包含该参考书目。\bibitem.bib\bibliography{<bib source>}

使用 pdfLaTeX 编译上述内容,然后使用 BibTeX 编译,然后再使用 pdfLaTeX 编译两次,输出为:

在此处输入图片描述

请注意,尽管我们引用的顺序是 Hooper、Hobbs、Daehler,并且source.bib顺序为 Hobbs、Daehler、Hooper,但输出却有按字母顺序顺序为 Dahler、Hobbs、Hooper。这是因为 BibTeX 读取了引文信息以及(使用-.bst引用)并相应地对内容进行了排序(在 LaTeX 之外)。BibTeX 还创建了一个文件,然后将其包含在您对 的调用中。\bibliographystyle{plainnat}plainnat.bst.bbl\bibliography{<bib source>}

相关内容