例如,如果我有一个 newtcbtheorem,其中第一个条目#1=推论的名称,第二个条目=推论的标签,我可以添加第三个条目=定理 \ref{th:#3} 的推论吗?
参见此示例
\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}
是否可以?
答案1
我的评论是错误的。Anytcbtheorem
接受一个可选参数。
使用这个可选参数可以构造一个title
像 OP 想要的特定内容:
\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}