mdframed 的奇怪间距

mdframed 的奇怪间距

我正在使用 mdframed 来创建框架定理环境,但我对定理下方的间距有些困惑。这是我的 MWE:

\documentclass{article}

\usepackage{amsmath}

\usepackage[amsmath,thmmarks]{ntheorem}

\usepackage[ntheorem]{mdframed}
\mdfdefinestyle{thm}{ % saving some space
skipabove=3cm,
skipbelow=3cm,
splittopskip=\topskip,
splitbottomskip=\topskip
}
\newmdtheoremenv[style=thm]{thm}{Theorem}

\begin{document}
Text above.
\begin{thm}
A theorem.
\end{thm}
Text below.
\end{document}

我希望定理上方和下方的间距相同,但事实并非如此,而且改变skipbelow似乎没有任何效果。

谁能向我解释为什么我所做的是错的?

答案1

这是使用 的替代解决方案tcolorbox

\documentclass{article}

\usepackage{amsmath}

\usepackage[amsmath,thmmarks]{ntheorem}

\usepackage[theorems,breakable]{tcolorbox}%

%%% Defining through styles
\tcbset{
defstyle/.style={fonttitle=\bfseries\upshape, fontupper=\slshape,
arc=0mm, colback=blue!5!white,colframe=blue!75!black},
thmstyle/.style={fonttitle=\bfseries\upshape, fontupper=\slshape,
colback=red!10!white,colframe=red!75!black,before=\par\vspace{3cm}\noindent,after=\vspace{3cm}},
}
\newtcbtheorem[number within=subsection]{Definition}{Definition}{defstyle}{def}
\newtcbtheorem[use counter from=Definition]{thm}{Theorem}{thmstyle}{thm}

%% defining directly
\newtcbtheorem{lem}{Lemma}{%
        theorem name,%
        colback=green!5,%
        colframe=green!35!black,%
        fonttitle=\bfseries,title after break={Theorem  -- \raggedleft Continued}%
    }{lem}


\begin{document}
Text above.
\begin{thm}{A theorem.}{thm:mine}%
Some theorem here
\end{thm}
Text below.
\begin{lem}{A lemma.}{lem:mine}%
Some lemma here
\end{lem}
\end{document}

在此处输入图片描述

我更喜欢它,tcolorbox因为它更先进、功能更丰富。

相关内容