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

  • 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.) – marmot Dec 24 '18 at 2:52
3

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

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.