I'd like to have different theorem environments share the same counter using tcolorbox in beamer. However cleveref
doesn't seem to pick up their names correctly. Can anyone point me to what I'm doing wrong?
Here's a MWE:
\documentclass[10pt,aspectratio=169]{beamer}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[most]{tcolorbox}
\tcbuselibrary{theorems}
\usepackage{cleveref}
\crefname{lemma}{lemma}{lemmas}
\crefname{theorem}{theorem}{theorems}
\renewtcolorbox[use counter=theorem]{theorem}[1][]{
title={\thetheorem. Theorem.},
before upper={\tcbtitle\;\itshape},
#1
}
\renewtcolorbox[use counter=theorem]{lemma}[1][]{
title={\thetheorem. Lemma.},
before upper={\tcbtitle\;\itshape},
#1
}
\begin{document}
\begin{frame}{Blah}
\begin{theorem}[label=bar]
Blah blah.
\end{theorem}
\cref{bar}
\begin{lemma}[label=foo]{}{}
Blah blah.
\end{lemma}
\cref{foo}
\end{frame}
\end{document}
I would like "lemma 2" instead of "theorem 2". I tried adding label type = lemma
as suggested here, but without any success.
beamer
loadshyperref
with package optionimplicit=false
,cleveref
doesn't work withbeamer
(as can be seen from thePackage cleveref warning
in log) and there seems to be no easy workaround. Similar: tex.stackexchange.com/a/481055.hyperref
's anchors (the links will all point to DocStart). See tex.stackexchange.com/a/266109/105447 for a (partial) work-around. However, are your sure it affects the reference counter/type too?beamer
can't handle the optional argument to\label
whichcleveref
adds andtcolorbox
uses to implementlabel type
...