3

How can I reference multiple list items, in a single parentheses, e.g. "(1-3)"?

For example, I have

\usepackage[shortlabels]{enumitem}

\begin{enumerate}[(1)]
\item \label{itm:1} more than 100
\item \label{itm:2} less than three
\item \label{itm:3} much less than ten
\end{enumerate}

How can I use \ref or something similar to reference items 1 through 3?

2 Answers 2

2

Completely removing the intervening parentheses is potentially confusing and not easy to implement. Placing a range marker automatically in between whilst retaining the parentheses is easy, using cleveref, and clearer:

Sample output

\documentclass{article}

\usepackage[shortlabels]{enumitem}
\usepackage{cleveref}

\crefrangeformat{enumi}{items #3#1#4--#5#2#6}

\begin{document}

\begin{enumerate}[(1)]
\item \label{itm:1} more than 100
\item \label{itm:2} less than three
\item \label{itm:3} much less than ten
\end{enumerate}

Referencing \cref{itm:1,itm:2,itm:3}.

\Cref{itm:1,itm:2} are just two items and \cref{itm:3} is another.

\end{document}
2

You can specify a separate label and ref for items via enumitem which then allows you to construct your reference as needed:

enter image description here

\documentclass{article}

\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label=(\arabic*),ref=\arabic*]
  \item \label{itm:1} more than 100
  \item \label{itm:2} less than three
  \item \label{itm:3} much less than ten
\end{enumerate}

\noindent
See (\ref{itm:1}--\ref{itm:3}).

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .