I posted once before about this issue, here, but would like to start a new thread with more information and a MWE. I hope that's OK. (In the old post I did not very adequately explain the situation, and forgot an MWE, for which I apologize. But it means there were some comments based on inaccurate info, which makes it a less useful thread.)
The issue is that in sv classes like svmono, adding the envcountsame option causes cleveref to not correctly identify the namerefs of environments. Everything appears as "Theorem", regardless of environment.
One workaround, which I found here, is to define a custom \label command. That works mostly, but not completely. Some environments, for whatever reason, continue not to show correctly.
Examples of environments that work: proposition, lemma, corollary, remark
Examples of environments that don't work: exercise, question
I cannot find anything in the svmono class itself that would account for this. As far as I can tell, they are all defined identically.
Specifying \Crefname for these environments does not seem to help. In fact, it does not seem to be a cleveref issue, at least not entirely. For example, for the environments that don't work, \namecref and \labelcref still work, and pick up the information correctly.
Would anyone have any insights on what might be going on, and even better, any ideas on how to fix this behavior?
I attached the MWE below.
EDITS: spelling, fixes to MWE
\documentclass[envcountsame]{svmono}
\usepackage[capitalise]{cleveref}
\usepackage{thmtools}
\makeatletter
\newcommand{\labelx}[1]{
\relax
\ifmmode
\label{#1}
\else
\ifnum\pdfstrcmp{\@currenvir}{document}=0
\label{#1}
\else
\label[\@currenvir]{#1}
\fi
\fi
}
\makeatother
\begin{document}
\crefname{exercise}{Exercise}{Exercise}
\Crefname{exercise}{Exercise}{Exercise}
\crefname{question}{Question}{Question}
\Crefname{question}{Question}{Question}
\begin{proposition}\label{prop_with_label}
Proposition with label.
\end{proposition}
\begin{proposition}\labelx{prop_with_labelx}
Proposition with labelX.
\end{proposition}
\begin{corollary}\label{cor_with_label}
Corollary with label.
\end{corollary}
\begin{corollary}\labelx{cor_with_labelx}
Corollary with labelX.
\end{corollary}
\begin{exercise}\label{exer_with_label}
Exercise with label.
\end{exercise}
\begin{exercise}\labelx{exer_with_labelx}
Exercise with labelX.
\end{exercise}
\begin{question}\label{quest_with_label}
Test
\end{question}
\begin{question}\labelx{quest_with_labelx}
Test
\end{question}
Let's cite these, now.
With label, nothing works right: \Cref{prop_with_label}, \Cref{cor_with_label}, \Cref{exer_with_label}, \Cref{quest_with_label}.
With labelX, some things work: \Cref{prop_with_labelx}, \Cref{cor_with_labelx}.
But some things still don't: \Cref{exer_with_labelx}, \Cref{quest_with_labelx}.
\end{document}
envcountsame
class option altogether, and enforce the desired behavior in your preamble. To makecleveref
work, clone the counters withaliascnt
.