# Extra vertical space inside mdframed theorem environment

I have seen several similar questions on TeX.SE of a similar nature, but none of them seem to address my precise issue. I have been working with mdframed environments for a while. I read that there were some issues with older versions, so I updated to the latest version, 1.9b, but it seems to have introduced a spacing issue that I did not have before.

\documentclass{article}
\usepackage{amsthm}
\usepackage{mdframed}

\theoremstyle{definition}
\newmdtheoremenv{definition}{Definition}

\begin{document}

\begin{definition}
This is a definition.
\end{definition}

\end{document}


The output, zoomed in, is seen here:

There is more vertical space above the contents than below. This only began after I fully updated my TeX distribution, so I assume that this possibly changed how mdframed works. Any ideas? Obviously I can manually change the spacing to fix this, but I'm looking to diagnose the problem, if there is one. Thanks in advance.

The culprit is not mdframed but amsthm.

In fact, the following example without amsthm

\documentclass{article}
\usepackage{mdframed}

\newmdtheoremenv{definition}{Definition}

\begin{document}

\begin{definition}
This is a definition.
\end{definition}

\end{document}


yields

To obtain the style you want, you can redefine the definition style in this way:

\newtheoremstyle{definition}% <name>
{-\topsep}%                 <space above>
{}%                         <space below>
{\normalfont}%              <body font>
{}%                         <indent amount>


MWE:

\documentclass{article}
\usepackage{amsthm}
\usepackage{mdframed}

\newtheoremstyle{definition}% <name>
{-\topsep}%                 <space above>
{}%                         <space below>
{\normalfont}%              <body font>
{}%                         <indent amount>
\theoremstyle{definition}
\newmdtheoremenv{definition}{Definition}

\begin{document}

\begin{definition}
This is a definition.
\end{definition}

\end{document}


Output:

• This is fantastic. Now I'm left wondering what changed when I updated the amsthm package... – Christopher A. Wong Mar 31 '14 at 9:44
• @ChristopherA.Wong -- since the last released update to amsthm was july 2009, and the last functional update was august 2004 (which, i believe, was before mdframed even existed), i seriously doubt that your updating amsthm was the cause of the recent change in your output. however, since this is a recognized deficit in the behavior of amsthm + mdframed, it has been added to the list of requests for action when amsthm and the ams document classes are next overhauled. – barbara beeton Mar 31 '14 at 14:07
• @barbarabeeton, thanks for the info. This makes my problem even more confusing, I suppose, because the spacing issue clearly did not exist before I updated. I was using a MikTeX distribution from 2011. – Christopher A. Wong Mar 31 '14 at 19:55
• i don't suppose you still have a log file from the version that was working. if you did, you could make a list of the packages used with their reported dates, then compare those with the versions reported for the newer run with the problem. (using \listfiles makes collecting this information easier, but if you don't have the ability to rerun an old attempt, that's not a particularly useful suggestion.) but if you could get that information, i'd be interested. – barbara beeton Mar 31 '14 at 20:02
• @barbarabeeton, sadly, I do not have the log files anymore. The only proof I have that I'm not going crazy is the final PDF output from the old version. Oh well. It was probably some perfect combination of bugs from random packages unrelated to amsthm... – Christopher A. Wong Mar 31 '14 at 21:53

Update: This appears to be a bug in certain versions of mdframed!

mdframed.sty 2013/03/09 1.8:  Good