# natbib: Error when citing paper with similar authors and same year

I get a strange error when I try cite two certain papers in the same document, when I use the natbib package (with numbers option enabled). If I trim the author list or change the year of either paper, then it works.

The error is:

...
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/natbib/natbib.sty) (./test.aux)
! Missing = inserted for \ifnum.
<to be read again>
\def
l.5 ...p{mieghem10assortativity,mieghem10rewiring}
says


I've confirmed this happens with other people's installations too. So it's not specific to my machine.

What am I doing wrong, or is this a bug in natbib? If a bug, is there a workaround?

Here's a simple test-case:

test.bib:

@article{mieghem10assortativity,
Month = {{Nov}},
Numpages = {{11}},
Publisher = {{American Physical Society}},
author = {Van Mieghem, P. and Ge, X. and Schumm, P. and Trajanovski, S. and Wang, H.},
title = {{Spectral graph analysis of modularity and assortativity}},
journal = {{Physical Review E}},
volume = {{82}},
number = {{5}},
pages = {056-113},
year = {{2010}},
doi = {{10.1103/PhysRevE.82.056113}},
}

@article{mieghem10rewiring,
author = {Van Mieghem, P. and Wang, H. and Ge, X. and Tang, S. and Kuipers, F. A.},
title = {{Influence of assortativity and degree-preserving rewiring on the spectra of networks}},
journal = {{European Physical Journal B}},
volume = {{76}},
number = {{4}},
pages = {643-652},
year = {{2010}},
doi = {{10.1140/epjb/e2010-00219-x}},
}


test.tex:

\documentclass[a4paper]{article}
\usepackage[numbers]{natbib}

\begin{document}
blah. \citep{mieghem10assortativity,mieghem10rewiring} says
blah blah

\bibliographystyle{plainnat}
\bibliography{test}

\end{document}

-
+1 for the minimal example –  domwass Feb 8 '11 at 12:12

The error occurs because of the double braces in the bib file (especially in cases, where just a number is expected). Why do you have double braces around nearly every field in the bib file? If I change them to single braces, everything works fine.

\documentclass[a4paper]{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{mieghem10assortativity,
Month = {Nov},
Numpages = {11},
Publisher = {American Physical Society},
author = {Van Mieghem, P. and Ge, X. and Schumm, P. and Trajanovski, S. and Wang, H.},
title = {Spectral graph analysis of modularity and assortativity},
journal = {Physical Review E},
volume = {82},
number = {5},
pages = {056-113},
year = {2010},
doi = {10.1103/PhysRevE.82.056113},
}

@article{mieghem10rewiring,
author = {Van Mieghem, P. and Wang, H. and Ge, X. and Tang, S. and Kuipers, F. A.},
title = {Influence of assortativity and degree-preserving rewiring on the spectra of networks},
journal = {European Physical Journal B},
volume = {76},
number = {4},
pages = {643-652},
year = {2010},
doi = {10.1140/epjb/e2010-00219-x},
}
\end{filecontents}
\usepackage[numbers]{natbib}

\begin{document}
blah. \citep{mieghem10assortativity,mieghem10rewiring} says
blah blah

\bibliographystyle{plainnat}
\bibliography{\jobname}

\end{document}


(Note: the filecontents package and environment are just for producing the bib file, they are not part of the solution.)

-
+1, I was just starting to type the same answer. I think for values with integer numbers, no braces should be used, e.g. simply volume = 76, number = 4, year = 2010 –  Martin Scharrer Feb 8 '11 at 12:14
@Martin Scharrer: I think it does no harm to use braces around values with integer numbers, though. –  domwass Feb 8 '11 at 12:21
@Domwass: I remember reading something about it is better to not use braces somehow, but can't remember where and why right now. –  Martin Scharrer Feb 8 '11 at 12:27
@Martin: defined abbreviations have to be and numbers can be written without braces. See texdoc bibtex –  Herbert Feb 8 '11 at 12:37
That fixes it for me! The extra braces were added by my bibliography management tool, to protect capitalisation in titles. It double-braces everything then though. I can tell it to disable that for now. –  paulj Feb 8 '11 at 13:40