1

I have been doing citations using natbib without bibtex and manually entering citations. I keep getting an issue when compiling stating "Citation 'all citations' on page # undefined on input line #"

\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}

This is an example of the full document used. When I try and place my citations in alphabetical order the output is more and includes "Citation '(all citations)' on page # undefined on input line #". At the moment I only have three citations and am intending on including more and have them in alphabetical order. When i rearrange in the order i placed the citations in the text it compiles just fine.

  • Works for me once I correct the typo at the end of the bibliography environment. At least, I don't get complaints about undefined citations. I don't get any labels in the bibliography either. – cfr Nov 4 '14 at 2:04
  • Yea I rearranged and placed last citation on top, still not alphabetical, it works, however when i rearrange all i get the complaints again. The typo was also fixed. – Alexander Cerra Nov 4 '14 at 2:11
  • 1
    @AlexanderCerra: I don't receive any problems. Admittedly, I removed mathtools, float and graphicx, since they have nothing to do with this. Could you please provide the problem code and then the code that compiles without problem? I can't seem to replicate your problem as it stands. Also, why not just let bibtex take care of the sorting? – Werner Nov 4 '14 at 2:17
  • So the code you posted does not reproduce the problem? You should post an MWE which produces the problem. No point posting code which works fine. I don't know why it would not be alphabetical D -> Hob -> Hoo so, as included, the list will be alphabetical and since that code works, I'm not sure what the problem is. – cfr Nov 4 '14 at 2:18
  • Is there any point in specifying a bibliography style if you are not using bibTeX? The .bst files are not LaTeX's business as far as I know. – cfr Nov 4 '14 at 2:20
2

What you're trying to do is typeset the bibliography manually. This is manageable, but then you have to do all the sorting yourself. Here is the output when compiling a minimal example:

enter image description here

\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}

If you now switch around some of the bibliography items, LaTeX will just again typeset it as is:

enter image description here

\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}

You mention that you'll be adding references to the bibliography, making it grow. Then I suggest you use the power of BibTeX to actually sort it for you. For that, you can use the following template as a base (I used the following, perhaps fake, references: Hobbs & Huennke, Daehler and Hooper, et al):

\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}

So, instead of manually creating a thebibliography environment with \bibitems, you create a .bib file and input the contents using a specific BibTeX syntax, and include this bibliography using \bibliography{<bib source>}.

Compile the above use pdfLaTeX, followed by a compiling using BibTeX, then twice again using pdfLaTeX and the output would be:

enter image description here

Note how, even though we cited in the order Hooper, Hobbs, Daehler and source.bib has the order Hobbs, Daehler, Hooper, the output has the alphabetical order Dahler, Hobbs, Hooper. That's because BibTeX read the citation information as well as a .bst (referenced using \bibliographystyle{plainnat} - plainnat.bst) and sorted the contents accordingly (outside of LaTeX). BibTeX also created a .bbl file, which is then included with your call to \bibliography{<bib source>}.

  • Thanks much! helped a lot. I was able to solve my problem last night and all i did was compilepdf a few times and every 2nd time it gives no warnings with desired output. may be weird but it worked. Im doing it manually because this is a small project for a class not closely related to my field so didn't feel the need to save the references hence doing them manually. however I do still see the usefulness of bibtex. will be the next on the list to learn – Alexander Cerra Nov 4 '14 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.