4

I styled my amsthm theorems with mdframed. I tried to add some space before and underneath my theorems with skipabove and skipbelow as stated here on page 6.

\documentclass{article}

\usepackage{amsthm, mdframed}

\parindent 0pt
\definecolor{mygray}{gray}{0.95}

\mdfdefinestyle{mythm}{
    backgroundcolor=mygray,
    linewidth=0pt,
    innertopmargin=0pt,
    innerbottommargin=6pt,
    skipabove=20pt,
    skipbelow=20pt
}

\newmdtheoremenv[style=mythm]{thm}{Theorem}

\begin{document}
    This comes before the theorem.
    \begin{thm}
        This is my theorem.
    \end{thm}
    This comes after the theorem.
\end{document}

However, the spacing at the bottom doesn't show up.

My theorem without extra space.

What is going wrong and how can I solve that?

3
  • I think this is a standing bug/feature in mdframed, it is really hard to get it to have an even space above an below. Changing to much larger values, the skipabove does work, but below, does not
    – daleif
    Oct 17, 2014 at 13:16
  • Might be an idea to email the author, he is usually quite helpful. I think he's also usually on this site.
    – daleif
    Oct 17, 2014 at 13:20
  • Had a closer look, it is definitely a bug, in how styles are defined. If you use \mdfsetup instead of defining a style, then it works. This is clearly a but. I'll email the author.
    – daleif
    Oct 17, 2014 at 13:30

1 Answer 1

2

I have sent the author the following MWE:

\documentclass{article}

\usepackage{amsthm, mdframed}

\definecolor{mygray}{gray}{0.95}

%
% notice how skipbelow is ignored
\mdfdefinestyle{mythm}{
    backgroundcolor=mygray,
    linewidth=0pt,
    innertopmargin=0pt,
    innerbottommargin=6pt,
    skipabove=5em,
    skipbelow=5em,
}

\newmdtheoremenv[style=mythm]{thm}{Theorem}

% if we use this instead, it works
% \mdfsetup{
%     backgroundcolor=mygray,
%     linewidth=0pt,
%     innertopmargin=0pt,
%     innerbottommargin=6pt,
%     skipabove=5em,
%     skipbelow=5em,
% }
% \newmdtheoremenv{thm}{Theorem}


\usepackage{kantlipsum}
\begin{document}
\kant*[2]
\begin{thm}
  This is my theorem.
\end{thm}
\kant*[2]
\end{document}

You must log in to answer this question.

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