# How to cite multiple reference in latex to apper as [1-4,6,7]

I have to cite a list papers in elsarticle template such as

[1,[2],[3],[4],[6],[7]


I want to see in latex such as

[1-4,6,7]


I found that we can use the packet cite (as \usepackage{cite}). However, when I used, it had error.

! Paragraph ended before \@citex was complete.<to be read again>\par


I think it conflict with natbib package. Actually, I cannot found where I used the natbib package. This is my configuration

\documentclass[preprint,12pt]{elsarticle}
\def\bibsection{\section*{References}}
%% Use the option review to obtain double line spacing
%% \documentclass[authoryear,preprint,review,12pt]{elsarticle}

%% Use the options 1p,twocolumn; 3p; 3p,twocolumn; 5p; or 5p,twocolumn
%% for a journal layout:
%% \documentclass[final,1p,times]{elsarticle}
%% \documentclass[final,1p,times,twocolumn]{elsarticle}
%% \documentclass[final,3p,times]{elsarticle}
%% \documentclass[final,3p,times,twocolumn]{elsarticle}
%% \documentclass[final,5p,times]{elsarticle}
%% \documentclass[final,5p,times,twocolumn]{elsarticle}

%% For including figures, graphicx.sty has been loaded in
%% elsarticle.cls. If you prefer to use the old commands

%% The amssymb package provides various useful mathematical symbols
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage[mathscr]{euscript}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[numbers,sort&compress]{natbib}
%% The amsthm package provides extended theorem environments
%% \usepackage{amsthm}

%% The lineno packages adds line numbers. Start line numbering with
%% \begin{linenumbers}, end it with \end{linenumbers}. Or switch it on
%% for the whole article with \linenumbers.
%% \usepackage{lineno}

\journal{Journal name}

\begin{document}


The template file is downloaded at here. Could you suggest to me the way to achieve the above cite?

• Load hyperref last. Nov 6 '15 at 7:04
• I added it as your comment. It has error as ! LaTeX Error: Option clash for package natbib.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help....
– Jame
Nov 6 '15 at 7:11
• If you read elsarticle documentation (2nd page), you'll see that it already uses natbib and that you must use options numbers and sort&compress in class options or through \biboptions command. By the way, using elsarticle is a significant information for your question, so it should be mentioned there and not as a comment. Nov 6 '15 at 7:59
• Could you show us something to work with? The best would be a Minimal Working Example (meta.tex.stackexchange.com/questions/228/…). If it's not possible, at least show us your complete preamble from \documentclass to \begin{document}. Nov 6 '15 at 8:33
• As I told you numbers and sort&compress should go in elsarticle options: \documentclass[preprint,12pt,numbers,sort&compress]{elsarticle} because elsarticle already loads it. So, delete \usepackage{natbib} from your preamble. Nov 6 '15 at 10:58

From 1st page of elsarticle documentation:
All together means that we don't have to include \usepackage{natbib} in our preamble because elsarticle already does it and that first line should be like \documentclass[12pt,number,sort&compress]{elsarticle} (I've deleted preprint because it's also a default option).
graphicx package can also be deleted from your preamble.
And as Joseph suggest, load hyperref as the last package.