答案1
number freestyle
我們可以在定義環境時使用該選項tcolorbox
。
這是一個例子:
\documentclass{article}
\usepackage[theorems]{tcolorbox}
\newtcbtheorem[number freestyle=
\noexpand\thesubsection-\noexpand \arabic{\tcbcounter}]
{example}{Example}{colbacktitle=green!50!black}{exp}
\renewcommand{\thesubsection}{\thesection-\arabic{subsection}} % for the dash in
% the subsection number
\begin{document}
\section{First section}
\section{second section}
\subsection{First subsection}
\begin{example}{}{example1}
This is an example
\end{example}
\end{document}