tikz.dev / tcolorbox Manual

The tcolorbox package

Libraries

18 Library theorems

The library is loaded by a package option or inside the preamble by:

This also loads the package amsmath.

Denis Bitouzé, Yukai Chou, and many others provided very valuable input for this library.

18.1 Macros of the Library
  • \NewTcbTheorem[⟨init options⟩]{⟨name⟩}{⟨display name⟩}{⟨options⟩}{⟨prefix⟩}Updated: 2022-07-18

  • \newtcbtheorem[⟨init options⟩]{⟨name⟩}{⟨display name⟩}{⟨options⟩}{⟨prefix⟩}Updated: 2022-07-18

  • Creates new environments ⟨name⟩ and ⟨name⟩* based on tcolorbox to frame a (mathematical) theorem. The ⟨display name⟩ is used in the title line with a number, e. g. «Theorem 5.1». The ⟨options⟩ are given to the underlying tcolorbox to control the appearance. The ⟨init options⟩ allow setting up automatic numbering, see Section 5.

    If ⟨name⟩ is chosen as footheorem, the new environments are described by

    • \begin{footheorem}[⟨keys⟩][⟨short⟩]{⟨title⟩}{⟨marker⟩}
      ⟨environment content⟩
      \end{footheorem}

    • Here, ⟨title⟩ is the title text for the theorem and is also set as /tcb/nameref identifier. Optionally, the ⟨short⟩ title used instead as /tcb/nameref identifier and in lists of theorems. ⟨keys⟩ supplement the ⟨options⟩ and may be used only in rare cases. The theorem is automatically labeled with ⟨prefix⟩⟨separator⟩⟨marker⟩ where ⟨separator⟩ is predefined as “:”, see /tcb/label separator.

    • \begin{footheorem*}[⟨keys⟩]{⟨title⟩}
      ⟨environment content⟩
      \end{footheorem*}

    • This represents an unnumbered variant. Again, ⟨title⟩ is the title text for the theorem and ⟨keys⟩ supplement the ⟨options⟩. This variant is not labeled and not listed in lists of theorems.

    \NewTcbTheorem and \newtcbtheorem are identical and both rely on \NewTColorBox based on \NewDocumentCommand.

    Definition in the preamble:
    \NewTcbTheorem[counter within=section]{mytheo}{My Theorem}%
    {colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}

    Compiled output

    % usage of `\nameref' needs `nameref' or `hyperref' to be loaded
    \begin{mytheo}{This is my title}{theoexample}
    This is the text of the theorem. The counter is automatically assigned and,
    in this example, prefixed with the section number. This theorem is numbered with
    \ref{th:theoexample}, it is given on page~\pageref{th:theoexample},
    and it is titled \flqq\nameref{th:theoexample}\frqq.
    \end{mytheo}

    Compiled output

    % usage of `\nameref' needs `nameref' or `hyperref' to be loaded
    \begin{mytheo}[][Concise title]{This my very long theorem title with
    too much words}{theoexample2}
    Here we have a long and a short title. This theorem is numbered with
    \ref{th:theoexample2}, it is given on page~\pageref{th:theoexample2},
    and it is titled \flqq\nameref{th:theoexample2}\frqq.
    \end{mytheo}

    Compiled output

    \begin{mytheo}[label=myownlabel]{This is my title}{}
    The label parameter can be left empty without \LaTeX\ error.
    Or you may use an own label to reference Theorem \ref{myownlabel}.
    \end{mytheo}

    Compiled output

    \begin{mytheo}{}{}
    The title can also be left empty without problem. Note that the \enquote{:}
    vanished magically.
    \end{mytheo}

    Compiled output

    \begin{mytheo*}{Unnumbered Theorem}
    This theorem is not numbered.
    \end{mytheo*}

    Compiled output

    \begin{mytheo*}{}
    This theorem has no number and no title.
    \end{mytheo*}

    To switch off the nameref feature permanently, add nameref/.style={} inside the ⟨options⟩ list.

  • \RenewTcbTheorem[⟨init options⟩]{⟨name⟩}{⟨display name⟩}{⟨options⟩}{⟨prefix⟩}Updated: 2022-07-18

  • \renewtcbtheorem[⟨init options⟩]{⟨name⟩}{⟨display name⟩}{⟨options⟩}{⟨prefix⟩}Updated: 2022-07-18

  • Operates like \NewTcbTheorem, but based on \RenewDocumentEnvironment instead of \NewDocumentEnvironment. Existing environments are redefined.

  • \ProvideTcbTheorem[⟨init options⟩]{⟨name⟩}{⟨display name⟩}{⟨options⟩}{⟨prefix⟩}New: 2022-07-18

  • Operates like \NewTcbTheorem, but based on \ProvideDocumentEnvironment instead of \NewDocumentEnvironment. New environments are only created if they are not already defined.

  • \DeclareTcbTheorem[⟨init options⟩]{⟨name⟩}{⟨display name⟩}{⟨options⟩}{⟨prefix⟩}New: 2022-07-18

  • Operates like \NewTcbTheorem, but based on \DeclareDocumentEnvironment instead of \NewDocumentEnvironment. New environments are always created and possibly redefine existing ones.

  • \tcboxmath[⟨options⟩]{⟨mathematical box content⟩}

  • Creates a tcolorbox which is fitted to the width of the given ⟨mathematical box content⟩. This box is intended to be applied as part of a larger formula and may be used as replacement for the \boxed macro of amsmath.

    Compiled output

    \begin{equation}
    \tcbset{fonttitle=\scriptsize}
    \tcboxmath[colback=LightBlue!25!white,colframe=blue]{ a^2 = 16 }
    \quad \Rightarrow \quad
    \tcboxmath[colback=Salmon!25!white,colframe=red,title=Implication]%
    { a = 4 ~\vee~ a=-4. }
    \end{equation}
18.2 Option Keys of the Library
  • /tcb/separator sign=⟨sign⟩(no default, initially :)

  • The given ⟨sign⟩ is used inside the title text of a theorem as separator between display name combined with number and the specific title text. It is omitted, if there is no specific title text.

    Compiled output

    % \usepackage{amssymb}
    \newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}%
    {colback=white,colframe=red!50!black,fonttitle=\bfseries,
    separator sign={\ $\blacktriangleright$}}{theo}
    \begin{sometheorem}{My example}{}
    My theorem text.
    \end{sometheorem}
  • /tcb/separator sign colon(style, no value, initially set)

  • Sets /tcb/separator sign to the default colon : sign.

  • /tcb/description delimiters={⟨left⟩}{⟨right⟩}(no default, initially empty)

  • The given ⟨left⟩ and ⟨right⟩ delimiter signs are used to frame the descriptive title text of a theorem.

    Compiled output

    \newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}%
    {colback=white,colframe=red!50!black,fonttitle=\bfseries,
    description delimiters={\flqq}{\frqq}}{theo}
    \begin{sometheorem}{My example}{}
    My theorem text.
    \end{sometheorem}
  • /tcb/terminator sign=⟨sign⟩(no default, initially empty)

  • The given ⟨sign⟩ is used as terminator at the end of the title text of a theorem.

    Compiled output

    \newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}%
    {colback=white,colframe=red!50!black,fonttitle=\bfseries,
    terminator sign={.}}{theo}
    \begin{sometheorem}{My example}{}
    My theorem text.
    \end{sometheorem}
  • /tcb/label separator=⟨separator⟩(no default, initially :)New: 2016-04-19

  • The given ⟨separator⟩ is used for labels created with environments which are defined themselves by \newtcbtheorem. This ⟨separator⟩ is put between ⟨prefix⟩ (defined by \newtcbtheorem) and ⟨marker⟩ (defined by an actual theorem environment).

    Compiled output

    \newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}%
    {colback=white,colframe=red!50!black,fonttitle=\bfseries,
    label separator=*}{theo}
    \begin{sometheorem}{My example}{myex}
    My theorem text.
    \end{sometheorem}
    See Example~\ref{theo*myex}.
  • /tcb/theorem full label supplement={⟨style⟩}(no default, initially empty)New: 2018-01-12

  • The given ⟨style⟩ is used in connection with labels created with environments which are defined themselves by \newtcbtheorem. This ⟨style⟩ uses one argument which is automatically set to the full label marker of the environment, i. e., a text consisting of ⟨prefix⟩ (defined by \newtcbtheorem), /tcb/label separator, and ⟨marker⟩ (defined by an actual theorem environment).

    Compiled output

    % The following adds a hyper target to all environments
    % created with \newtcbtheorem
    \tcbset{theorem full label supplement={hypertarget={#1}}}

    \newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}%
    {colback=white,colframe=red!50!black,fonttitle=\bfseries}{theo}
    \begin{sometheorem}{My example}{myex2}
    My theorem text.
    \end{sometheorem}
    This automated \hyperlink{theo:myex2}{hyper target can be linked to with a
    hyper link}.

    A second usage of /tcb/theorem full label supplement overwrites the first setting.

  • /tcb/theorem hanging indent=auto|⟨length⟩(default auto, initially auto)New: 2020-10-21

  • Sets the hanging indent of the theorem title to auto or the given ⟨length⟩. For auto, the hanging indent matches the display name, number and separator sign of the theorem. If ⟨length⟩ is negative, the theorem title is indented positively without hanging indent.

    Compiled output

    \newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}%
    {colback=white,colframe=red!50!black,fonttitle=\bfseries}{theo}

    \begin{sometheorem}{This is a very long and complicated title for a quite
    short and nearly empty theorem}{myexA1}
    My theorem text.
    \end{sometheorem}

    \begin{sometheorem}[theorem hanging indent=5mm]{This is a very long and
    complicated title for a quite short and nearly empty theorem}{myexA2}
    My theorem text.
    \end{sometheorem}

    \begin{sometheorem}[theorem hanging indent=0pt]{This is a very long and
    complicated title for a quite short and nearly empty theorem}{myexA3}
    My theorem text.
    \end{sometheorem}

    \begin{sometheorem}[theorem hanging indent=-5mm]{This is a very long and
    complicated title for a quite short and nearly empty theorem}{myexA4}
    My theorem text.
    \end{sometheorem}
  • /tcb/theorem={⟨display name⟩}{⟨counter⟩}{⟨title⟩}{⟨marker⟩}(no default)

  • This key can be used directly in a tcolorbox for a more flexible approach to create a theorem type box. The ⟨display name⟩ is used together with the increased ⟨counter⟩ value and the ⟨title⟩ for the title line of the box. Additionally, a \label with the given ⟨marker⟩ is created.

    Compiled output

    % \newcounter{texercise}% preamble
    \begin{tcolorbox}[colback=green!10,colframe=green!50!black,arc=4mm,
    theorem={Test}{texercise}{Direct usage}{myMarker}]
    Here, we see the test \ref{myMarker}.
    \end{tcolorbox}

    For a common appearance inside the document, the key theorem should not be used directly as in the example above, but as part of a new environment created by hand or using \newtcbtheorem.

  • /tcb/math upper(style, no value)

  • Sets the upper part to mathematical mode with font \displaystyle.

  • /tcb/math lower(style, no value)

  • Sets the lower part to mathematical mode with font \displaystyle.

  • /tcb/math(style, no value)

  • Sets the upper part and lower part to mathematical mode with font \displaystyle.

    Compiled output

    \begin{tcolorbox}[math,colback=yellow!10!white,colframe=red!50!black]
    \sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.
    \end{tcolorbox}

The following styles are only tested to work with the original amsmath environments. If e. g. the equation environment is redefined as gather, then /tcb/ams equation should / could not be used. Obviously, you are encouraged to use /tcb/ams gather in this case.

  • /tcb/ams equation upper(style, no value)Updated: 2014-10-30

  • Adds an amsmath equation environment to the start and end of the upper part.

  • /tcb/ams equation lower(style, no value)Updated: 2014-10-30

  • Adds an amsmath equation environment to the start and end of the lower part.

  • /tcb/ams equation(style, no value)Updated: 2014-10-30

  • Adds an amsmath equation environment to the start and end of the upper and lower part.

    Compiled output

    \begin{tcolorbox}[ams equation,colback=yellow!10!white,colframe=red!50!black]
    \sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.
    \end{tcolorbox}
  • /tcb/ams equation* upper(style, no value)Updated: 2014-10-30

  • Adds an amsmath equation* environment to the start and end of the upper part.

  • /tcb/ams equation* lower(style, no value)Updated: 2014-10-30

  • Adds an amsmath equation* environment to the start and end of the lower part.

  • /tcb/ams equation*(style, no value)Updated: 2014-10-30

  • Adds an amsmath equation* environment to the start and end of the upper and lower part.

    Compiled output

    \begin{tcolorbox}[ams equation*,colback=yellow!10!white,colframe=red!50!black]
    \sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.
    \end{tcolorbox}
  • /tcb/ams align lower(style, no value)

  • Adds an amsmath align environment to the start and end of the lower part.

  • /tcb/ams align* lower(style, no value)

  • Adds an amsmath align* environment to the start and end of the lower part.

  • /tcb/ams gather lower(style, no value)

  • Adds an amsmath gather environment to the start and end of the lower part.

  • /tcb/ams gather* lower(style, no value)

  • Adds an amsmath gather* environment to the start and end of the lower part.

  • /tcb/ams subequations upper(style, no value)New: 2026-05-04

  • Adds an amsmath subequations environment to the start and end of the upper part.

  • /tcb/ams subequations lower(style, no value)New: 2026-05-04

  • Adds an amsmath subequations environment to the start and end of the lower part.

  • /tcb/ams subequations(style, no value)New: 2026-05-04

  • Adds an amsmath subequations environment to the start and end of the upper and lower part.

    Compiled output

    \begin{tcolorbox}[ams subequations,colback=yellow!10!white,colframe=red!50!black]
    \begin{align}
    \sum\limits_{n=1}^{\infty} \frac{1}{n} &= \infty.\\
    \int x^2 ~\text{d}x &= \frac13 x^3 + c.
    \end{align}
    \end{tcolorbox}
  • /tcb/ams subequations align lower(style, no value)

  • Adds an amsmath subequations and an align environment to the start and end of the lower part.

  • /tcb/ams subequations gather lower(style, no value)

  • Adds an amsmath subequations and a gather environment to the start and end of the lower part.

  • /tcb/ams nodisplayskip upper(style, no value)

  • Neutralizes the \abovedisplayskip of a following align or gather environment for the upper part. Note that the text content has to start with such a formula.

  • /tcb/ams nodisplayskip lower(style, no value)

  • Neutralizes the \abovedisplayskip of a following align or gather environment for the lower part. Note that the text content has to start with such a formula.

  • /tcb/ams nodisplayskip(style, no value)

  • Neutralizes the \abovedisplayskip of a following align or gather environment for the upper part and lower part. Note that the text content has to start with such a formula.

    Compiled output

    \begin{tcolorbox}[ams nodisplayskip,colback=yellow!10!white,colframe=red!50!black]
    \begin{gather}
    \sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.\\
    \int x^2 ~\text{d}x = \frac13 x^3 + c.
    \end{gather}
    And now for something completely different.
    \end{tcolorbox}

New colored mathematical environments are easily created using \newtcolorbox:

Compiled output

\newtcolorbox{mymath}{ams gather*,colback=yellow!10!white,colframe=red!50!black}

\begin{mymath}
\sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.\\
\int x^2 ~\text{d}x = \frac13 x^3 + c.
\end{mymath}

All described options like /tcb/ams gather upper, /tcb/ams gather lower, /tcb/ams gather are (partially) setting (overwriting) the keys /tcb/before upper, /tcb/after upper, /tcb/before lower, /tcb/after lower. Therefore, e. g. \tcbset{ams gather,before upper={\text{Pythagoras:}}} produces an invalid result. For this case, you are invited to use
\tcbset{ams gather,before upper app={\text{Pythagoras:}}},
see /tcb/before upper app.

  • /tcb/theorem style=⟨name⟩(no default, initially standard)

  • Applies a predefined style ⟨name⟩ to the theorem environment. Some of the feasible ⟨name⟩ values resemble style names from the packages theorem and ntheorem to give convenient access to known patterns.

    The styles alter /tcb/separator sign, /tcb/description delimiters, /tcb/terminator sign, and more. Therefore, one should apply such keys after a theorem style.

    For the following examples, we use:

    Definition in the preamble:
    \NewTcbTheorem[use counter from=mytheo]{theorem}{Theorem}{%
    fonttitle=\bfseries\upshape,fontupper=\itshape,
    colframe=green!50!black,colback=green!10!white,
    colbacktitle=green!20!white,coltitle=blue!75!black}{theo}

    The predefined styles are:

    • standard: This is the initial value.

      Compiled output

      \begin{theorem}[theorem style=standard]{standard}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • change standard

      Compiled output

      \begin{theorem}[theorem style=change standard]{change standard}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • plain

      Compiled output

      \begin{theorem}[theorem style=plain]{plain}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • break

      Compiled output

      \begin{theorem}[theorem style=break]{break}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • plain apart

      Compiled output

      \begin{theorem}[theorem style=plain apart]{plain apart}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • change

      Compiled output

      \begin{theorem}[theorem style=change]{change}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • change break

      Compiled output

      \begin{theorem}[theorem style=change break]{change break}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • change apart

      Compiled output

      \begin{theorem}[theorem style=change apart]{change apart}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • margin

      Compiled output

      \begin{theorem}[theorem style=margin,left=10mm]{margin}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
      \begin{theorem}[theorem style=margin,left=10mm,oversize]{margin}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • margin break

      Compiled output

      \begin{theorem}[theorem style=margin break,left=10mm]{margin break}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
      \begin{theorem}[theorem style=margin break,left=10mm,oversize]{margin break}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
    • margin apart

      Compiled output

      \begin{theorem}[theorem style=margin apart,left=10mm]{margin apart}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
      \begin{theorem}[theorem style=margin apart,left=10mm,oversize]{margin apart}{}
      This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*}
      \end{theorem}
18.3 Examples for Definitions and Theorems

In the following, the application of \newtcbtheorem to highlight mathematical definitions, theorems, or the like is demonstrated.

At first, additional tcb keys are created for the appearance of the colored boxes. It is assumed that theorems and corollaries should be identically colored. All following environments are numbered with a common counter, but this can be changed easily. Here, the counter output is supplemented by the subsection number. Further, the zref-clever package [Barros 2024] is used for clever references.

Definition in the preamble:
% \usepackage{zref-clever}
\tcbset{
defstyle/.style={fonttitle=\bfseries\upshape, fontupper=\slshape,
arc=0mm, colback=blue!5!white,colframe=blue!75!black},
theostyle/.style={fonttitle=\bfseries\upshape, fontupper=\slshape,
colback=red!10!white,colframe=red!75!black},
}
\NewTcbTheorem[counter within=subsection]{Definition}{Definition}%
{defstyle,label type=definition}{def}
\NewTcbTheorem[use counter from=Definition]{Theorem}{Theorem}%
{theostyle,label type=theorem}{theo}
\NewTcbTheorem[use counter from=Definition]{Corollary}{Corollary}%
{theostyle,label type=corollary}{cor}

By \newtcbtheorem, commonly numbered theorem environments are created now. defstyle and theostyle are used for the appearance.

If you do not need zref-clever support, drop /tcb/label type from the definitions above.

Now, everything is prepared for the following examples.

Compiled output

The following theorem is numbered as \zcref[S]{theo:diffbarstetig}
and referenced with the marker \texttt{theo:diffbarstetig}.
Alternatively, use the basic form Theorem~\ref{theo:diffbarstetig}.

\begin{Theorem}{Differenzierbarkeit bedingt Stetigkeit, wobei diese Benennung
zu Testzwecken ungew\"{o}hnlich lang ist}{diffbarstetig}%
Eine Funktion $f:I\to\mathbb{R}$ ist in $x_0\in I$ stetig, wenn $f$ in
$x_0$ differenzierbar ist.
\end{Theorem}

Compiled output

The following definition is numbered as \zcref[cap]{def:diffbarkeit} and
referenced with the marker \texttt{def:diffbarkeit}.\bigskip

\begin{Definition}{Differenzierbarkeit}{diffbarkeit}
Eine Funktion $f:~I\to\mathbb{R}$ auf einem Intervall $I$ hei\ss{}t in
$x_0\in I$ differenzierbar oder linear approximierbar,
wenn der Grenzwert
\begin{equation*}
\lim\limits_{x\to x_0}\frac{f(x)-f(x_0)}{x-x_0}=
\lim\limits_{h\to 0}\frac{f(x_0+h)-f(x_0)}{h}
\end{equation*}
existiert. Bei Existenz hei\ss{}t dieser Grenzwert Ableitung
oder Differentialquotient von $f$ in $x_0$ und man
schreibt f\"{u}r ihn
\begin{equation*}
f'(x_0)\quad\text{oder}\quad\frac{df}{dx}(x_0).
\end{equation*}
\end{Definition}

Compiled output

The following corollary is numbered as \zcref{cor:nullstellen} and
referenced with the marker \texttt{cor:nullstellen}.\bigskip

\begin{Corollary}{Nullstellenexistenz}{nullstellen}
Ist $f:[a,b]\to\mathbb{R}$ stetig und haben $f(a)$ und $f(b)$ entgegengesetzte
Vorzeichen, also $f(a)f(b)<0$, so besitzt $f$ eine Nullstelle $x_0\in]a,b[$,
also $f(x_0)=0$.
\end{Corollary}

Compiled output

\begin{Theorem}[boxrule=2mm,toptitle=-1.5mm,bottomtitle=-1.5mm]{%
Hinreichende Bedingung f\"{u}r Wendepunkte}{wendehinreichend}%
$f$ sei eine auf einem Intervall $]a,b[$ dreimal stetig differenzierbare Funktion.
Ist $f''(x_0)=0$ in $x_0\in]a,b[$ und $f'''(x_0)\ne 0$, so ist
$(x_0,f(x_0))$ ein Wendepunkt von $f$.
\end{Theorem}

Compiled output

% \usepackage{zref-clever}
% \usepackage{zref-vario}
% \tcbuselibrary{skins}
\newtcbtheorem[use counter from=Definition]{YetAnotherTheorem}{Theorem}%
{theorem style=plain apart,label type=theorem,enhanced,frame hidden,
boxrule=2mm,titlerule=0mm,toptitle=1mm,bottomtitle=1mm,
fonttitle=\bfseries\large,fontupper=\normalsize,
coltitle=green!35!black,colbacktitle=green!15!white,
colback=green!50!yellow!15!white,borderline={1pt}{0pt}{green!25!blue},
}{theo}

\begin{YetAnotherTheorem}{Mittelwertsatz f\"{u}r $n$ Variable}{meanvaluetheorem}%
Es sei $n\in\mathbb{N}$, $D\subseteq\mathbb{R}^n$ eine offene Menge und
$f\in C^{1}(D,\mathbb{R})$. Dann gibt es auf jeder Strecke
$[x_0,x]\subset D$ einen Punkt $\xi\in[x_0,x]$, so dass gilt
\begin{equation*}
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0)
\end{equation*}
\end{YetAnotherTheorem}

\medskip
Here, |zref-clever| support is used to reference \zcref{theo:meanvaluetheorem}
on \zcpageref{theo:meanvaluetheorem}. This \zcref*[noref]{theo:meanvaluetheorem}
can also be referenced by |\zvref| resulting in \zvref{theo:meanvaluetheorem}.

Note that /tcb/label type was used in the example above to feed zref-clever [Barros 2024] with the needed name information.

Compiled output

Here, using |\zvref| resulting in \zvref{theo:meanvaluetheorem}
is more interesting\ldots

Compiled output

% \tcbuselibrary{skins}
\newtcbtheorem[use counter from=Definition]{YetAnotherTheorem}{Theorem}%
{theorem style=change apart,enhanced,arc=0mm,outer arc=0mm,
boxrule=0mm,toprule=1mm,bottomrule=1mm,left=1mm,right=1mm,
titlerule=0mm,toptitle=0mm,bottomtitle=1mm,top=0mm,
colframe=red!50!black,colback=red!5!white,coltitle=red!50!black,
title style={top color=yellow!50!white,bottom color=red!5!white,
middle color=yellow!50!white},
fonttitle=\bfseries\sffamily\normalsize,fontupper=\normalsize\itshape,
}{theo}

\begin{YetAnotherTheorem}{Mittelwertsatz f\"{u}r $n$ Variable}{mittelwertsatz_n2}%
Es sei $n\in\mathbb{N}$, $D\subseteq\mathbb{R}^n$ eine offene Menge und
$f\in C^{1}(D,\mathbb{R})$. Dann gibt es auf jeder Strecke
$[x_0,x]\subset D$ einen Punkt $\xi\in[x_0,x]$, so dass gilt
\begin{equation*}
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0)
\end{equation*}
\end{YetAnotherTheorem}

Compiled output

% \usepackage{varwidth} \tcbuselibrary{skins}
\newtcbtheorem[use counter from=Definition]{YetAnotherTheorem}{Theorem}%
{enhanced,frame empty,interior empty,colframe=ForestGreen!50!white,
coltitle=ForestGreen!50!black,fonttitle=\bfseries,colbacktitle=ForestGreen!15!white,
borderline={0.5mm}{0mm}{ForestGreen!15!white},
borderline={0.5mm}{0mm}{ForestGreen!50!white,dashed},
attach boxed title to top center={yshift=-2mm},
boxed title style={boxrule=0.4pt},varwidth boxed title}{theo}

\begin{YetAnotherTheorem}{Mittelwertsatz f\"{u}r $n$ Variable}{mittelwertsatz_n3}%
Es sei $n\in\mathbb{N}$, $D\subseteq\mathbb{R}^n$ eine offene Menge und
$f\in C^{1}(D,\mathbb{R})$. Dann gibt es auf jeder Strecke
$[x_0,x]\subset D$ einen Punkt $\xi\in[x_0,x]$, so dass gilt
\begin{equation*}
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0)
\end{equation*}
\end{YetAnotherTheorem}

You need more attention for your theorems? Here, you are …

Compiled output

% tcbuselibrary{skins} % preamble
\begin{Theorem}[enhanced,
fuzzy halo=3mm with yellow,
fuzzy halo=2mm with red,
fuzzy halo=1mm with yellow,
watermark color=red!35!white,
watermark text={Overacting\\Fundamental Theorem}]%
{Fundamental Theorem of Theorems}{fundamental}%
\lipsum[1-2]
\end{Theorem}

Let’s try a more conservative approach:

Compiled output

% \tcbuselibrary{skins}
\newtcbtheorem[use counter from=Definition]{YetAnotherTheorem}{Theorem}%
{theorem style=plain,enhanced,colframe=blue!50!black,colback=yellow!20!white,
coltitle=red!50!black,fonttitle=\upshape\bfseries,fontupper=\itshape,
drop fuzzy shadow=blue!50!black!50!white,boxrule=0.4pt}{theo}

\begin{YetAnotherTheorem}{Mittelwertsatz f\"{u}r $n$ Variable}{mittelwertsatz_n4}%
Es sei $n\in\mathbb{N}$, $D\subseteq\mathbb{R}^n$ eine offene Menge und
$f\in C^{1}(D,\mathbb{R})$. Dann gibt es auf jeder Strecke
$[x_0,x]\subset D$ einen Punkt $\xi\in[x_0,x]$, so dass gilt
\begin{equation*}
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0)
\end{equation*}
\end{YetAnotherTheorem}
18.4 Using other theorem environments with tcolorbox

Instead of creating theorem environments with the methods described before, environments from other packages can be boxed with a tcolorbox.

Environments may be created e. g. by methods from the theorem package or the amsthm package. \tcolorboxenvironment can be used to put a box around these environments.

Definition in the preamble:
\usepackage{amsthm}

\theoremstyle{plain}% from `amsthm'
\newtheorem{lem}{Lemma}% from `amsthm'

\tcolorboxenvironment{lem}{
enhanced jigsaw,colframe=cyan,interior hidden,
breakable,before skip=10pt,after skip=10pt }

\tcolorboxenvironment{proof}{% `proof' from `amsthm'
blanker,breakable,left=5mm,
before skip=10pt,after skip=10pt,
borderline west={1mm}{0pt}{red}}

Compiled output

\begin{lem}
\lipsum[2]
\end{lem}

\lipsum[3]

\begin{proof}
\lipsum*[4]
\end{proof}