0

For example, if I have a newtcbtheorem in which I have a first entry#1=name of corollary and a second entry=label of corollary, could I add a third entry=Corollary of Theorem \ref{th:#3}?

See this example

\documentclass{book}
\usepackage[svgnames,x11names]{xcolor}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{stix}
\usepackage[most]{tcolorbox}
\tcbuselibrary{theorems}

\newtcbtheorem[number within=subsection] {goldtheorem}{Theorem}{nobeforeafter,tcbox raise base,enhanced,boxrule=0pt,interior style={top color=Gold1!10!white,bottom color=Gold1!10!white, middle color=Gold1!50!yellow,},colframe=red,fuzzy halo=1pt with Gold1,description color = black, coltitle=black,fonttitle=\bfseries,separator sign={\ ---},#1,}{th}

% New Corollaries

\newtcbtheorem[number within=subsection, use counter from=goldtheorem] {goldcorolth}{Corollary of \ref{th:#3}}{nobeforeafter, tcbox raise base,enhanced,boxrule=0pt,interior style={top color=Gold1!10!white,bottom color=Gold1!10!white, middle color=Gold1!50!yellow,},colframe=red,fuzzy halo=1pt with Gold1,description color = black, coltitle=black,fonttitle=\bfseries, theorem label supplement={hypertarget={Tcolor-#3}}
separator sign={\ ---},#1}{th}

\begin{document}

\section{Added of the Corollaries}

\begin{goldtheorem}{A Theorem}{T1}
\begin{statement}

\end{statement}
\end{goldtheorem}
\begin{proof}
Its Proof.
\end{proof}

\noindent\begin{goldcorolth}{A Corollary} {CorolT}
\end{goldcorolth}
But I'd like to have this:

\noindent\begin{tcolorbox}[title={Corollary of Theorem 1.2.0.1 --- 1.2.0.2 --- A Corollary}, nobeforeafter,tcbox raise base,enhanced,boxrule=0pt,interior style={top color=Gold1!10!white,bottom color=Gold1!10!white, middle color=Gold1!50!yellow,},colframe=red,fuzzy halo=1pt with Gold1,description color = black, coltitle=black,fonttitle=\bfseries,separator sign={\ ---}]

\end{tcolorbox}

\end{document}

Is It possible?

2
  • tcbtheorems doesn't accept optional parameters, so #1 in your definitions has no sense. It's also not possible to add a third parameter to a tcbtheorem. But you can do it with a regular tcolorbox. In fact tcbtheorems are nothing else than special tcolorboxes.
    – Ignasi
    Aug 28, 2021 at 10:50
  • Ok, Thank you. But how?
    – Puck
    Aug 28, 2021 at 12:27

1 Answer 1

2

My comment was wrong. Any tcbtheorem accepts an optional parameter.

enter image description here

With this optional parameter is possible to construct a particular title like OP wants:

\documentclass{book}
\usepackage[svgnames,x11names]{xcolor}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{stix}
\usepackage[most]{tcolorbox}
\tcbuselibrary{theorems}

\tcbset{
    golden/.style={
        nobeforeafter, tcbox raise base, enhanced, boxrule=0pt, 
        interior style={top color=Gold1!10!white, bottom color=Gold1!10!white, middle color=Gold1!50!yellow},
        colframe=red, fuzzy halo=1pt with Gold1, description color = black, coltitle=black, fonttitle=\bfseries, separator sign={\ ---}
    }
}

\newtcbtheorem[number within=subsection]{goldtheorem}{Theorem}{golden}{th}

% New Corollaries

\newtcbtheorem[number within=subsection, use counter from=goldtheorem]{goldcorolth}{Corollary}{golden}{corol}

\begin{document}

\chapter{First}

\section{Added of the Corollaries}

\subsection{Something}

\begin{goldtheorem}{A Theorem}{T1}
\end{goldtheorem}
\begin{proof}
Its Proof.
\end{proof}


\noindent\begin{goldcorolth}[colbacktitle=cyan, title={Corollary of Theorem~\ref{th:T1} --- \thetcbcounter\ --- A Corollary}]{}{C1}
\end{goldcorolth}

\end{document}

enter image description here

You must log in to answer this question.

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