1

I have two different types of tcbtheorems: theorem and lemma, defined as below.

\newtcbtheorem[number within=section]{theorem}{Theorem}{some config options}{thm}
\newtcbtheorem[number within=section]{lemma}{Lemma}{some config options}{lem}

If I, somewhere in my document, have

\begin{theorem}{}{}
theorem
\end{theorem}

\begin{lemma}{}{}
lemma
\end{lemma}

It produces "Theorem 1.1" and "Lemma 1.1," whereas I'd like it to produce "Theorem 1.1" and then "Lemma 1.2."

1
  • 2
    Please provide us with a complete compilable example, which starts with \documentclass and ends with \end{document}. (And if I am not mistaken this has not too much to do with tcolorbox, rather you have to use a shared counter for your theorems.)
    – user121799
    Dec 24, 2018 at 2:52

1 Answer 1

5

Just add the option use counter from=theorem when defining the new lemma \newtcbtheorem

\documentclass{article}
    \usepackage{tcolorbox}
    \tcbuselibrary{theorems}
    \newtcbtheorem[number within=section]{theorem}{Theorem}{}{thm}
    \newtcbtheorem[number within=section,
                  use counter from=theorem % <----------------
                  ]{lemma}{Lemma}{}{lem}

\begin{document}
\section{title section}
\begin{theorem}{}{}
theorem
\end{theorem}

\begin{lemma}{}{}
lemma
\end{lemma}
\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .