5

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?

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

1 Answer 1

3

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}

enter image description here

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

1
  • Thank you. I think there is a bug in mdframed so I will look into this package.
    – mstouby
    Sep 30, 2014 at 8:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .