# Vertical spacing problem using mdframed environment

I want to use mdframed to add a frame around a text. But the vertical spacing is not as expected. I found the following help page: Vertical spacing problem related to the mdframed environment

The accepted answer was promising and I tested it myself, but I get a different result than the screenshot there suggests.

\documentclass{article}
\usepackage[framemethod=1]{mdframed}

\begin{document}

\noindent Text
\begin{mdframed}
Framed
\end{mdframed}
Text

\noindent Text
\begin{mdframed}[skipbelow=-0.5em]
Framed
\end{mdframed}
Text

\end{document}


My result is:

I have mdframed version 1.9 installed which seems to be the newest version.

Can anybody can confirm this behaviour? Even better would be a fix for the problem.

EDIT:
After AboAmmar's answer. I noticed an even stranger but perhaps related behavior of mdframed. It allows to define a style and use it for a environment afterwards. The following example will use the skipabove, but the skipbelow seems to be ignored:

\documentclass{article}
\usepackage[framemethod=1]{mdframed}

\mdfdefinestyle{mystyle}{skipabove=2pt,skipbelow=-2pt}

\begin{document}

\noindent Text
\begin{mdframed}[style=mystyle]
Framed
\end{mdframed}
Text
\end{document}


Result:

The result is the same, if the skipbelow is defined directly after \begin{mdframed}. Only \mdfsetup{skipabove=2pt,skipbelow=-2pt} seem to change the space after the box, but I don't want to use the setting globally.

In the current version (see documentation of Version 1.9b), you can set the top and below skip values as:

\mdfsetup{skipabove=<value>,skipbelow=<another value>}


So, the above example can be adjusted as follows:

\documentclass{article}
\usepackage[framemethod=1]{mdframed}

\mdfsetup{skipabove=2pt,skipbelow=-2pt}

\begin{document}
\noindent Text
\begin{mdframed}
Framed
\end{mdframed}
Text

\noindent Text
\begin{mdframed}
Framed
\end{mdframed}
Text\\
Text
\end{document}


You can, of course, choose proper values for skipabove or skipbelow.

Here is the result now:

• Firstly, thanks for your help. I knew this options but they also behave very strange. The documentation says default skipabove and skipbelow is 0pt. I would expect this means than no space is used and I also tried to set them manually to 0pt before, but it doesn't do what it should do. Your example also used a positive and a negative value, but the result is still not in the center. – Bryan Elrod Mar 25 '15 at 21:17