Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

enter image description 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.

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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

enter image description here

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>
  {\bfseries}%                <theorem head font>
  {.}%                        <punctuation after theorem head>
  {.5em}%                     <space after theorem head>
  {}%                         <theorem head spec>

MWE:

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

\newtheoremstyle{definition}% <name>
  {-\topsep}%                 <space above>
  {}%                         <space below>
  {\normalfont}%              <body font>
  {}%                         <indent amount>
  {\bfseries}%                <theorem head font>
  {.}%                        <punctuation after theorem head>
  {.5em}%                     <space after theorem head>
  {}%                         <theorem head spec>
\theoremstyle{definition}
\newmdtheoremenv{definition}{Definition}

\begin{document}

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

\end{document} 

Output:

enter image description here

share|improve this answer
    
This is fantastic. Now I'm left wondering what changed when I updated the amsthm package... –  Christopher A. Wong Mar 31 at 9:44
1  
@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 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 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 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 at 21:53

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

mdframed.sty 2013/03/09 1.8:  Good
mdframed.sty 2013/07/01 1.9b: Bad
mdframed.sty 2013/08/18 1.9d: Good

Note that you can get the latest version of mdframed from https://github.com/marcodaniel/mdframed

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.