Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
and this is the second equation
\begin{equation}
\label{test}
\alpha^2 + \beta^2 = \gamma^2
\end{equation}
Referring to second equation here: \eqref{test}.
\end{document}
share|improve this question
5  
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
1  
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
1  
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

1 Answer

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.

(More of a comment, but enabling the question to be answered.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.