我正在尝试定义一种新的定理样式,除了颜色之外,它与类remark
提供的标准完全相同。据我所知,使用包是个好主意。但是,我不知道应该在命令中包含哪些选项才能从中生成通常的样式。amsart
thmtools
\declaretheoremstyle
remark
amsart
以下是我的尝试。如您所见,结果并不令人满意,因为注释前后的垂直间距略有变化。有人知道如何解决这个问题吗?
\documentclass{amsart}
\usepackage{xcolor}
\usepackage{thmtools}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\declaretheoremstyle[headfont = \color{red}\normalfont\itshape, bodyfont = \color{red}\normalfont\itshape]{colored}
\declaretheorem[sibling = theorem, style = colored, name = Remark]{coloredremark}
\begin{document}
\begin{theorem}
Body of first theorem.
\end{theorem}
\begin{coloredremark}
Body of colored remark.
\end{coloredremark}
\begin{theorem}
Body of second theorem.
\end{theorem}
\begin{remark}
Body of normal remark.
\end{remark}
\begin{theorem}
Body of last theorem.
\end{theorem}
\end{document}
答案1
您实际上不需要thmtools
为此使用。由于您想要一种类似于 提供的默认样式的样式amsart
,因此使用 更为简单\newtheoremstyle
,它由 AMS 类和 定义amsthm
。
要了解如何使用\newtheoremstyle
,请参阅文档,第 9 页。这是一个应该可以工作的示例。
\documentclass{amsart}
\usepackage{xcolor}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\newtheoremstyle{coloredremark}%
{}%
{}%
{}%
{}%
{\itshape\color{red}}%
{.}%
{.5em}%
{}%
\theoremstyle{coloredremark}
\newtheorem{coloredremark}[theorem]{Remark}
\begin{document}
\begin{theorem}
Body of first theorem.
\end{theorem}
\begin{coloredremark}
Body of colored remark.
\end{coloredremark}
\begin{theorem}
Body of second theorem.
\end{theorem}
\begin{remark}
Body of normal remark.
\end{remark}
\begin{theorem}
Body of last theorem.
\end{theorem}
\end{document}