[Tex/LaTex] Problems with cite package

cite-packageelsarticlenatbib

I am using natbib for managing references. But I wanted to get compressed or grouped references, so I switched to cite package. I deleted all the .aux files generated by latex and recompiled after changing the code. When cite package is used I'm getting an error message which looks like:

File ended while scanning use of \org@@citex.
<inserted text>
\par

And:

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.

Which is the error you usually get if you have missed a } somewhere. But the same code compiles without the cite package, so it seems there is nothing actually wrong with it. Here is a MWE:

 \documentclass[preprint,review,12pt]{elsarticle}
%\usepackage{cite}
\usepackage{natbib}
\begin{document}
This is a test document. \cite{Ghasemi-Mobarakeh2011,Zhao19994942,Robinson1985}
\end{document}

Code without package which doesn't give the error. But references appear as [1,2,3]

\documentclass[preprint,review,12pt]{elsarticle}
\usepackage{cite}
%\usepackage{natbib}
\begin{document}
This is a test document. \cite{Ghasemi-Mobarakeh2011,Zhao19994942,Robinson1985}
\end{document}

Code with cite package which gives the error mentioned earlier.
I've checked that I'm using the latest version of cite package, I'm not able to find the source of the error.

Best Answer

The elsarticle class automatically loads natbib. As described in the class manual, options for natbib should then be set using \biboptions: you want \biboptions{sort&compress}.

Related Question