# cleveref and amsthm -- incorrect environment name

I have theorem environments that have the same theoremstyle which I define through amsthm. I want them all to share the same counter. This way, a lemma that follows theorem 1.2.6 will have the number 1.2.7. I would like to use cleveref to refer to this environments. I use the memoir documentclass.

However, the output does not correctly reference the environment name. Does this have to do with the fact that I use the optional [theorem] in the \newtheorem{lemma} definition?

MWE

\documentclass{memoir}
\usepackage{amsthm}

% Defining a theorem style that has bold head and italic body
\newtheoremstyle{italic}{5pt}{5pt}{\itshape}{}{}{}{.5em}
{\bfseries{\thmname{#1}~\thmnumber{#2}.}\thmnote{~\textnormal{(#3)}}}

\theoremstyle{italic}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}

\usepackage[capitalise]{cleveref}

\begin{document}

\begin{theorem}\label{thm1}
This is a theorem.
\end{theorem}

\begin{lemma}\label{lem1}
This is a lemma.
\end{lemma}

\cref{thm1} \cref{lem1}

\end{document}


Output

Desired output

You just need to move the definitions of your theorem-like environments to after the loading of cleveref package:

\documentclass{memoir}

\usepackage{amsthm}

\usepackage[capitalise]{cleveref}

% Defining a theorem style that has bold head and italic body
\newtheoremstyle{italic}{5pt}{5pt}{\itshape}{}{}{}{.5em}
{\bfseries{\thmname{#1}~\thmnumber{#2}.}\thmnote{~\textnormal{(#3)}}}

\theoremstyle{italic}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}

\begin{document}

\begin{theorem}\label{thm1}
This is a theorem.
\end{theorem}

\begin{lemma}\label{lem1}
This is a lemma.
\end{lemma}

\cref{thm1} \cref{lem1}

\end{document}


See section 14.1 Non-bugs of the cleveref manual.

As usual remember that cleveref should be loaded as the last package in your preamble, see section 13 Interaction with Other Packages in the manual. In particular, it has to come after later than the loading of amsthm in this example.