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).

If you might need to make hyperreferences to your citations, cite isn't adequate. If you add the hypernat package:

  \usepackage[...]{hyperref}
  \usepackage[numbers,sort&compress]{natbib}
  \usepackage{hypernat}
  ...
  \bibliographystyle{plainnat}
the natbib and hyperref packages will interwork.
cite.sty
macros/latex/contrib/cite (zip, browse)
hypernat.sty
macros/latex/contrib/misc/hypernat.sty
hyperref.sty
macros/latex/contrib/hyperref (zip, browse)
plainnat.bst
Distributed with macros/latex/contrib/natbib (zip, browse)
unsrtnat.bst
Distributed with macros/latex/contrib/natbib (zip, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=citesort