I want to be able to print the names of my own theorems with autoref. E.g. on
\begin{lemma}
\label{lemma_foo}
Some lemma
\end{lemma}
\autoref{lemma_foo}
I want something like "Lemma 3.2" being printed.
My current approach is:
\newtheorem{lemma}{Lemma}[chapter]
\newcommand{\lemmaautorefname}{Lemma}
\newtheorem{definition}[lemma]{Definition}
\newcommand{\definitionautorefname}{Definition}
Definition shares the counter with lemma, which is intended, however it has the side effect, that referencing definitions results in them being called lemmas.
How do I fix this?
cleveref
package does better in these cases.lemma
anddefinition
environments before or after loadinghyperref
andcleveref
?cleveref
package provides labels for environments namedlemma
anddefinition
. It shouldn't be necessary to execute\crefname
directives for them.