Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In my kile documents, I want to add multiple citations. For this I use the command

\cite{cristo,taylor,polgar,phillips,speirs,simoes,roberto}

The names in this command give numeric references, which is what I wanted, but not in the way I want it. It gives [1,2,3,4,5,6,7] instead of [1,2,4-8]. Is there any other way to manage this? My bibliography style is elsarticle-num, and I use bibtex for the bibliography.

I use this preamble in my document:

\documentclass[review,preprint,twocolumn,3p]{elsarticle}
\usepackage{graphicx}
\usepackage{color}
\usepackage{url}
\usepackage{ctable}
\usepackage{booktabs}
\usepackage{cite}
\usepackage{tabularx}
\usepackage{array}
\usepackage{soul}
\usepackage{multirow}
\usepackage{lineno}
\usepackage{subfigure}
\usepackage{amssymb,amsmath}
\newcommand{\tab}{\hspace{5mm}}
share|improve this question
    
Welcome to TeX.sx! Your comment to Mico's answer would probably be added by a minimal working example (MWE): could you edit one into the question? You don't have to sign with your name since it automatically appears in the lower right corner of your post: I'll edit it out. –  Joseph Wright Nov 11 '12 at 13:13
add comment

2 Answers

up vote 6 down vote accepted

You could load the package called cite. With this package, sorting and compressing of numeric ranges of citations is made possible automatically.

Addendum, inserted after the OP provided additional, crucial information about the document's setup: Since you're using the elsarticle document class, which loads the natbib citation manager package, do not load the cite package. Instead, issue the command

\biboptions{numbers,sort&compress}

in the preamble. This should suffice to instruct natbib to sort and compress numeric-style citations. (Note that there seems to be a typo in the documentation of the elsarticle document class: The option should be spelled numbers rather than number.)

share|improve this answer
    
Thanks for the reply Mico. I checked that cite package already is installed under texlive. However, I got this error when multiple citations are given with the cite command: paragraph ended befor \@citex was complete ? –  Rıza Bayoğlu Nov 11 '12 at 13:03
    
@RızaBayoğlu - please augment your question with some code that demonstrates what exactly you're doing. Without such information, it's going to be virtually impossible to come up with a solution. Thanks. –  Mico Nov 11 '12 at 13:30
    
\documentclass[review,preprint,twocolumn,3p]{elsarticle} \usepackage{graphicx} \usepackage{color} \usepackage{url} \usepackage{ctable} \usepackage{booktabs} % \usepackage{cite} \usepackage{tabularx} \usepackage{array} \usepackage{soul} \usepackage{multirow} \usepackage{lineno} \usepackage{subfigure} \usepackage{amssymb,amsmath} \newcommand{\tab}{\hspace{5mm}} –  Rıza Bayoğlu Nov 11 '12 at 13:38
    
I use the command in introduction part of my document in kile: \cite{cristo,taylor,polgar,phillips,speirs,simoes,roberto}. But the names in this command gives numeric refecences which is what I wanted, but not in the way I mentioned in my question. I mean it gives [1,2,3,4,5,6,7]. I hope that information is adequate. @Micho –  Rıza Bayoğlu Nov 11 '12 at 13:44
1  
@RızaBayoğlu - Hmm, there seems to be a typo in the documentation for the elsarticle document class: the option should be spelled numbers and not number! I'm updating my answer accordingly. –  Mico Nov 11 '12 at 16:15
show 5 more comments

put the command sort&compress in the documentclass options: \documentclass[3p,sort&compress]{elsarticle}

share|improve this answer
1  
Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. Your "answer" would be better as a comment on Mico's answer. All you are saying is that option can be passed to the class rather using the \biboptions command. –  Andrew Swann Jun 4 '13 at 10:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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