3

I'm using natbib and plainnat as the bibliography style.

\documentclass[a4paper,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[round]{natbib}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\begin{document}
\citet{DIJKSTRA1959}   
\bibliographystyle{plainnat}
\bibliography{mybib}
\end{document}

where mybib.bib contains

@article{DIJKSTRA1959,
   author    = {Dijkstra, E. W.},
   title     = {A note on two problems in connection with graphs},
   journal   = {Numer. Math.},
   pages     = {269-271}
   year      = {1959},
   volume    = 1
}

I don't know why \citet{DIJKSTRA1959} does not print the year. The result is:

Dijkstra

E. W. Dijkstra. A note on two problems in connection with graphs. Numer.Math., pages 269271.

Is there a problem with the word "note" in the article's title?

4

When you do

pdflatex file
bibtex file

you get an error from BibTeX:

The style file: plainnat.bst
Database file #1: mybib.bib
I was expecting a `,' or a `}'---line 6 of file mybib.bib
 :    
 :    year      = {1959},
(Error may have been on previous line)
I'm skipping whatever remains of this entry
Warning--empty year in DIJKSTRA1959
Warning--empty year in DIJKSTRA1959

and indeed the .bbl file shows

\bibitem[Dijkstra()]{DIJKSTRA1959}
E.~W. Dijkstra.
\newblock A note on two problems in connection with graphs.
\newblock \emph{Numer. Math.}, pages 269--271.

but only because of the error. If you add the missing comma at the end of the pages field

@article{DIJKSTRA1959,
   author    = {Dijkstra, E. W.},
   title     = {A note on two problems in connection with graphs},
   journal   = {Numer. Math.},
   pages     = {269-271},
   year      = {1959},
   volume    = 1
}

there will be no error by BibTeX and the .bbl file will have

\bibitem[Dijkstra(1959)]{DIJKSTRA1959}
E.~W. Dijkstra.
\newblock A note on two problems in connection with graphs.
\newblock \emph{Numer. Math.}, 1:\penalty0 269--271, 1959.

so that natbib will give the correct result for the citation, to wit

enter image description here

and also for the reference

enter image description here

Moral

Always end fields in the .bib files with a comma.

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.