我正在使用 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
因為它更先進且功能豐富。