我创建了自定义定理/定义/示例格式,以便它们以图像中的颜色显示。但是,编号并不像我希望的那样(见第一张图片)。
与图像中所示不同,我希望有定理 1.5...定义 1.6...示例 1.7...
声明的当前状态如下。我也尝试过在定义和示例中写入“numberwithin=section”,但同样不起作用。如果有人能帮助我,我将不胜感激。谢谢!
% Theorem
\declaretheoremstyle[
spaceabove=6pt,
spacebelow=6pt, headfont=\color{red}\normalfont\bfseries, notefont=\color{black}\mdseries\normalfont,
notebraces={(}{)},
bodyfont=\normalfont,
%postheadspace=1em,
headpunct={ }]{mystyle}
\declaretheorem[name={Theorem}, style=mystyle,
numberwithin=section
]{thm}
% Definition
\declaretheoremstyle[
spaceabove=6pt,
spacebelow=6pt, headfont=\color{blue}\normalfont\bfseries, notefont=\color{black}\mdseries\normalfont,
notebraces={(}{)},
bodyfont=\normalfont,
%postheadspace=1em,
headpunct={ }]{mystyledef}
\declaretheorem[name={Definition}, style=mystyledef,
numberwithin=thm
]{defn}
% Example
\declaretheoremstyle[
spaceabove=6pt,
spacebelow=6pt, headfont=\color{olive}\normalfont\bfseries, notefont=\color{black}\mdseries\normalfont,
notebraces={(}{)},
bodyfont=\normalfont,
%postheadspace=1em,
headpunct={ }]{mystyleexa}
\declaretheorem[name={Example}, style=mystyleexa,
numberwithin = thm
]{exa}