First, apologies if this is a duplicate: I have genuinely searched for the question, but haven't been able to find it!
I am using the same counter for my theorems, lemmas, propositions, etc. I want to use \autoref
(or another package) in the following way: upon calling \autoref{result1}
, I get back Theorem 1
, but upon calling \autoref{result2}
I get Lemma 2
. This probably isn't particularly clear, so I've put in a MWE, using autoref
and cleveref
. In both cases, I always get the word 'Theorem' where I want 'Lemma'.
\documentclass[]{article}
\usepackage[UKenglish]{babel}
\usepackage{hyperref, cleveref}
\newtheorem{thm} {Theorem}
\newtheorem{lem}[thm]{Lemma}
\def\thmautorefname{Theorem}
\def\lemautorefname{Lemma}
\begin{document}
\begin{thm} \label{T1} Theorem 1... \end{thm}
\begin{lem} \label{L2} Lemma 2... \end{lem}
\autoref{T1} \autoref{L2}
\Cref{T1} \Cref{L2}
\end{document}
I want the output to be "Theorem 1 Lemma 2", but at the moment it's "Theorem 1 Theorem 2".
cleveref
this works if you use e.g. theamsthm
package for your theorems.amsthm
to the above preamble, then this doesn't solve my issue... would you care to elaborate?