1

When I make a citation like \cite{a,b} the result is [a,b]. However, how can I make the following command \cite{a,b} produce the citation [1-2]?

This same question was answered for the natbib package in: Cite like [1-2] instead of [1, 2]

imnothere
  • 14,215

1 Answers1

3

You can use \renewcommand\citepunct{-} from the cite package. It replaces all commas by -. But this would be weird if you have more than 2 citations in your \cite command (if you cite reference 1 and reference 3, you obtain [1-3] which reads: reference 1 to reference 3, with reference 2 included).

In the below code, the \usepackage{filecontents} can be omitted in recent LaTeX versions (eg 2022 version).

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{bibliotest.bib} @book{Knu86, author = {Knuth, Donald E.}, year = {1986}, title = {The \TeX book}, }

@book{Lam86, title = {LaTeX: a document preparation system}, author = {Lamport, Leslie}, year = {1986}, }

\end{filecontents}

\usepackage{cite} \renewcommand\citepunct{-}

\begin{document}

\cite{Knu86,Lam86}

\bibliographystyle{plain} \bibliography{bibliotest} \end{document}

enter image description here

quark67
  • 4,166