Welcome to the UK List of
TeX Frequently Asked Questions
on the Web

Searching

The index of Frequently Asked Questions about TeX is searchable.

Please enter your keyword here:   then press here: ,    or:
Google

Sorting and compressing citations

If you give LaTeX \cite{fred,joe,harry,min}, its default commands could give something like “[2,6,4,3]”; this looks awful. One can of course get the things in order by rearranging the keys in the \cite command, but who wants to do that sort of thing for no more improvement than “[2,3,4,6]”?

The cite package sorts the numbers and detects consecutive sequences, so creating “[2–4,6]”. The natbib package, with the numbers and sort&compress options, will do the same when working with its own numeric bibliography styles (plainnat.bst and unsrtnat.bst).

The package biblatex has a built-in style numeric-comp for its bibliographies.

biblatex.sty
macros/latex/contrib/biblatex (or browse the directory); catalogue entry
cite.sty
macros/latex/contrib/cite (or browse the directory); catalogue entry
hypernat.sty
macros/latex/contrib/hypernat (or browse the directory); catalogue entry
hyperref.sty
macros/latex/contrib/hyperref (or browse the directory); catalogue entry
plainnat.bst
Distributed with macros/latex/contrib/natbib (or browse the directory); catalogue entry
unsrtnat.bst
Distributed with macros/latex/contrib/natbib (or browse the directory); catalogue entry

This answer last edited: 2012-02-10


Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=citesort

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.27, released on 2013-06-07.