I observe the style of a theorem that uses a shared counter being changed unexpectedly when cleveref
is used.
I expect all new theorems to have the default style plain
as in asmbook
, with small caption title font and italic body font.
However, when cleveref
is used, the fact
theorem, which shares a counter with the lemma
theorem, changes its style unexpectedly.
I attempt to fix it by explicitly stating \theoremstyle{plain}
before creating fact
. However, it does not work.
Then, I create a new theorem style factstyle
and hardcode the plain
style in it. This can fix the issue.
I notice that if the document class is just document
, there is no such issue. I also acknowledge that hyperref
needs to be declared before cleveref
and all \newtheorem
definitions must be placed after the cleveref
package is loaded.
What is going on here? Does cleveref
have conflict with asmbook
style?
Here are the code to reproduce the issue and the fixes:
\documentclass[a4paper,oneside,11pt,reqno]{amsbook}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{amsthm}
\DeclareOption*
\ProcessOptions
\theoremstyle{plain}
\newtheorem{lemma}{Lemma}
% Plain style
\newtheorem{remark}{remark}
%%%%%%
% Style Fix
% \newtheoremstyle{factstyle}% name of the style to be used
% {}% measure of space to leave above the theorem. E.g.: 3pt
% {}% measure of space to leave below the theorem. E.g.: 3pt
% {\itshape}% name of font to use in the body of the theorem
% {1.5em}% measure of space to indent
% {\scshape}% name of head font
% {.}% punctuation between head and body
% { }% space after theorem head; " " = normal interword space
% {\thmname{#1}\thmnumber{ #2}\textnormal{\thmnote{ (#3)}}}
% \theoremstyle{factstyle}
%%%%%%
% Should be Plain style but changed by cleveref?
\theoremstyle{plain}
\newtheorem{fact}[lemma]{Fact}
\begin{document}
\section{Cleveref changes theorem style unexpectedly}
\begin{lemma}
This is a lemma.
\end{lemma}
\begin{remark}
This is a remark.
\end{remark}
\begin{fact}
This is a fact.
This should look like remark however it looks differently.
When Fact shares the counter with Lemma, its style changes if cleveref is used.
To fix: Uncomment "Style Fix", or stop using cleveref.
\end{fact}
\end{document}