1

I’m using the \newtcbtheorem in tcolorbox package to produce my environments for theorem, lemma and proposition. I want these three environements be numbered by a same counter, producing a result like

Theorem 1.1

Proposition 1.2

Lemma 1.3

Theorem 1.4

So I write essentially

\newtcbtheorem[number within=section]{theorem}{Theorem}{}{th}
\newtcbtheorem[use counter=tcb@cnt@theorem, number within=section]{proposition}{Proposition}{}{pr}
\newtcbtheorem[use counter=tcb@cnt@theorem, number within=section]{lemma}{Lemma}{}{le}

However, when I want to refer these using \cref in cleveref package, I find that if I use \crefname to define the text in \cref, then the code should be like

\crefname{counter name of theorem}{theorem}{theorems}
\crefname{counter name of proposition}{proposition}{propositions}
\crefname{counter name of lemma}{lemma}{lemmas}

so with these three using a same counter, the last command takes place of the two before it, so whenever I refer to a theorem or proposition by

\cref{th:label}

the text before the number appears to be ``lemma’’.

Is there any way to fix this, without abandoning the usage of \cref?

Thanks in advance for any help.

3
  • 2
    You need tcolorbox option label type, see the package manual and tex.stackexchange.com/a/179962. Sep 14, 2021 at 20:52
  • @muzimuzhiZ It works! Thank you so much.
    – Shana
    Sep 15, 2021 at 1:11
  • Perhaps you can post an answer yourself then accept it, so that the question would be well closed. Sep 15, 2021 at 4:00

1 Answer 1

3

Thanks to @muzimuzhiZ 's comment, I find that adding a ``label type=name'' in the option fixes this.

Codes:

\newtcbtheorem[number within=section]{theorem}{Theorem}{label type=theorem}{th}
\newtcbtheorem[use counter=tcb@cnt@theorem, number within=section]{proposition{Proposition}{label type=proposition}{pr}
\newtcbtheorem[use counter=tcb@cnt@theorem, number within=section]{lemma} {Lemma}{label type=proposition=lemma}{le}
\crefname{theorem}{theorem}{theorems}
\crefname{proposition}{proposition}{propositions}
\crefname{lemma}{lemma}{lemmas}

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.