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.

Possible Duplicate:
Citing a range of papers (using numeric keys)?

Quick question. Let's say I have five references to cite which are A to E. Currently, I'm using \cite{A,B,C,D,E} which produces

[1,2,3,8,11]

How do I modify it so that it produces the output of

[1-3,8,11]

or at least it groups the consecutive references together so as not to have a very long output format? I hope this is possible.

share|improve this question

marked as duplicate by lockstep, Stefan Kottwitz Nov 20 '12 at 15:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Welcome to TeX.sx! This question is very similar to tex.stackexchange.com/questions/3871/…. Please take a look at it as the information there might help you. If so, that's great, and we'll probably close this question as a duplicate just to keep the place tidy and to help people find answers quickly. If not, please edit your question here to explain why so that people can better focus their attention to help you. –  lockstep Nov 19 '12 at 19:04
1  
Thanks for the link. I tried \usepackage[numbers,sort&compress]{natbib} as suggested in the link and continue to use \cite{A,B,C,D,E} in the body. However, it did not do the job. I wonder if I missed out something. –  Ivan Nov 19 '12 at 19:22
1  
Without a minimal working example that shows the problem, it's hard to say. –  lockstep Nov 19 '12 at 20:07
1  
Without loading natbib you can try with \usepackage{cite} –  egreg Nov 20 '12 at 0:10
    
This is what I had in my latex file --> "....balance data rate and complexity \cite{Lee,Li,Manchon}" and it comes out "....balance data rate and complexity [27, 28, 29]" although I declared the natbib package with the preambles as above. @egreg, must I include any preambles for the cite package? Thanks for you help. Appreciate it. –  Ivan Nov 20 '12 at 14:34

1 Answer 1

Ok I have found the complete solution to my question. I will share it here just in case it is useful to others as most sites do not provide the answer explicitly. Special thanks to @lockstep and @egreg for providing helpful comments.

I will use the cite package as the solution. Just include the following statements when you declare your latex packages.

\usepackage{cite} \def\citepunct{], [} \def\citedash{]--[}

To utilize it, simply use \cite{} for your references. Taking the alphabets to mean numerical progression, we have the following examples:

\cite{RefA, RefB, RefC, RefD} --> [1]-[4]

while,

\cite{RefA, RefC, RefD, RefE, RefG} --> [1],[3]-[5],[7]

Hope this helps.

share|improve this answer

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