# Weird spacing with mdframed

I'm using mdframed to make a framed theorem environment but I'm having some trouble with the spacing below the theorem. This is my 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}


I want the spacing above and below the theorem to be the same but it isn't and changing skipbelow doesn't seem to have any effect.

Can anybody explain to me why what I am doing is wrong?

• It seems a bug of the mdframed package and its mdframed environment, but i am not sure. Sep 27 '14 at 22:38

Here is an alternative solution using 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}


I prefer tcolorbox since it is more advanced and feature rich.

• Thank you. I think there is a bug in mdframed so I will look into this package. Sep 30 '14 at 8:02