答案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}