# Multiple references with \autoref

I am currently using the \autoref command from the hyperref package to refer to my theorems etc. However, I want to be able to (easily) refer to two or more theorems/lemmas/..., e.g. by calling something like \autoref{lemma1,lemma2,lemma5} -- where of course lemmas 1, 2 and 5 are labeled lemma1, lemma2 and lemma5 respectively -- so that the reference shows: "Lemmas 1, 2 and 5".

Can anyone help me with this? It doesn't seem to me like the hyperref package provides this functionality.

Minimal example

\documentclass{memoir}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}
\usepackage{cleveref}
\mathtoolsset{showonlyrefs,showmanualtags}
\begin{document}
This is the first equation
$$a^2 + b^2 = c^2$$
and this is the second equation
$$\label{test} \alpha^2 + \beta^2 = \gamma^2$$
Referring to second equation here: \eqref{test}.
\end{document}

-
Have you checked out the cleveref package? It allows multiple references, with sorting and collapsing (e.g. turns "1,3,2,7" into "1--3 and 7"), among other nice things. –  Aaron Apr 13 '11 at 17:47
Yes, I have. But it doesn't seem to work well in my document. See an example here: codeviewer.org/view/code:197c If I remove the cleveref package, the reference works. It seems to conflict with mathtools' showonlyrefs option. –  smlange Apr 13 '11 at 20:06
Yes, mathtools redefines the eqref command to do some extra things (writing to the aux file, specifically). Cleveref also wants to patch the reference system, and the two don't play well together. I think that it would be non-trivial to graft them together, because you'd need to pull apart a comma-separated list of label names then write them all to the aux file to make mathtools happy. –  Aaron Apr 13 '11 at 22:40
The mathtool package does a lot of redefinition of referencing internals, meaning that other reference-related packages (such as cleveref) cannot do their changes as well. So with the set up as given, this is not really possible. You will have to choose between convenient referencing using cleveref and using the mathtool package.