6

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

output

Desired output

desired output

7

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

Sample output

\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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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