我目前在我的数学笔记中使用 tcolorbox,并且我为定理定义了以下环境。
\newtcbtheorem{defn}{}{
enhanced,
breakable,
colback = BrightGreen!50!white,
colframe = white,
coltitle = ForestGreen,
sharp corners,
theorem style = break,
fonttitle = \bfseries\large,
separator sign = {.~}
}{defn}
\newtcbtheorem[use counter from=defn]{thm}{}{
enhanced,
breakable,
colback = cyan!30!white,
colframe = white,
coltitle = RoyalBlue,
sharp corners,
theorem style = break,
fonttitle = \bfseries\large,
separator sign = {.~}
}{thm}
结果就是这样的。
我实际上想删除(:
分隔符,它(可能?)被定义为预定义定理样式的一部分break
。结果应该是这样的:
我该怎么做?谢谢!
答案1
标题周围的括号取决于您选择的样式。请不要使用theorem style = break
并稍微修改您的\newtcbtheorem
定义。
我添加了theorem number
定理数的正确定位。需要更新版本tcolorbox
才能使用此选项。我使用的是 5.0.2。
由于您没有提供完整的 MWE,我将其用作book
文档类并发明了BrightGreen
颜色。
\documentclass{book}
\usepackage[dvipsnames]{xcolor}
\definecolor{BrightGreen}{rgb}{0.4, 1.0, 0.0}
\usepackage[most]{tcolorbox}
\tcbuselibrary{theorems}
\tcbset{commonstyle/.style={
enhanced,
breakable,
sharp corners,
toptitle=4pt,
bottomtitle=0pt,
titlerule=0pt,
top=4pt,
fonttitle = \bfseries\large,
separator sign = {.},
theorem number
}}
\newtcbtheorem{defn}{}{
commonstyle,
colback = BrightGreen!50!white,
colbacktitle = BrightGreen!50!white,
colframe = BrightGreen!50!white,
coltitle = ForestGreen,
}{defn}
\newtcbtheorem[use counter from=defn]{thm}{}{
commonstyle,
colback = cyan!30!white,
colbacktitle = cyan!30!white,
colframe = cyan!30!white,
coltitle = RoyalBlue,
}{thm}
\begin{document}
\chapter{My Chapter}
\section{My Section}
\begin{defn}{The title of my definition}{}
The text of my definition.
\end{defn}
\begin{thm}{The title of my theorem}{}
The text of my theorem.
\end{thm}
\end{document}