Citing a range of papers using numeric keys as in \cite{a, b, c} -> [1-3]
The cite
, natbib
, and biblatex
packages, at least, will all do this.
A minimal example which demonstrates the behaviour is:
\documentclass{article}
\begin{document}
hello \cite{article-full,book-full,mastersthesis-full}
\bibliographystyle{unsrt}
\bibliography{xampl}
\end{document}
If you have basic bibliography needs, adding \usepackage{cite}
will produce the desired behaviour.
If you have more complex bibliography needs, nowadays I recommend biblatex
as a first choice, although natbib
has a long and distinguished history in this space and is possibly a better option if you want a more ‘stable’ solution.
For biblatex
, you would now write this example as:
\documentclass{article}
\usepackage[style=numeric-comp]{biblatex}
\bibliography{xampl}
\begin{document}
hello \cite{article-full,book-full,mastersthesis-full}
\printbibliography
\end{document}
Noting that you need to process the bibliography using biber
instead of bibtex
. (You can use bibtex
by adding backend=bibtex
to the package options, but I'm not sure if that is currently recommended for new documents.)
If you are using natbib
, a minimal example would be:
\documentclass{article}
\usepackage[numbers,sort&compress]{natbib}
\begin{document}
hello \citep{article-full,booklet-full,mastersthesis-full}
\bibliographystyle{unsrtnat}
\bibliography{xampl}
\end{document}
if you add
\usepackage[numbers,sort&compress]{natbib}
to your preamble, you should get the expected result.
Using biblatex
, sorting and compressing numeric keys is achieved with
\usepackage[style=numeric-comp]{biblatex}