6

I've set skipbelow=0pt. I still have vertical spacing below every box. I think this has to do with the paragraph spacing. Is there a way to disable this for mdframed? I'd like to avoid using \vspace{-5pt} after every box, since this makes behave my multicols layout weird (page breaks in the middle of the page).

How can I get rid of the spacing after every box? (Disable new line? Disable paragraph spacing just for mdframed boxes? ...)

Here's a MWE

\documentclass[a4paper,8pt]{article}

\usepackage{mdframed}
\mdfdefinestyle{myframe}{%
    outerlinewidth=1pt,
    skipabove=0pt,
    skipbelow=0pt
}

\begin{document}

\begin{mdframed}[style=myframe]
Hello
\end{mdframed}
% Annoying space in between, despite skipabove=skipbelow=0pt
\begin{mdframed}[style=myframe]
Hello
\end{mdframed}

\end{document}
  • Unfortunately the answer there only suggests to set skipablove=skipbelow=0pt which I already did. Furthermore, mdframed is not a self-defined environment – ndrizza Sep 12 '15 at 19:15
  • It's related, not necessary a duplicate/solution. You can also set skipbelow to a negative value... – Werner Sep 12 '15 at 19:16
  • 1
    Is the code above producing the error? If I compile it I get two boxes without any space in between. Is your system up to date? – manthano Sep 16 '15 at 11:14
  • 2
    Try adding \unskip at the end of the environment. See tex.stackexchange.com/questions/174587/… – Steven B. Segletes Sep 16 '15 at 15:19
7
+50

Setting skipabove and skipbelow to 0pt globaly with the \mdfsetup command does the trick (mdframed version 1.9b).

\documentclass[a4paper,8pt]{article}

\usepackage{mdframed}
\mdfsetup{skipabove=0pt,skipbelow=0pt}

\mdfdefinestyle{myframe}{%
    outerlinewidth=1pt
}

\begin{document}

\begin{mdframed}[style=myframe]
Hello
\end{mdframed}
\begin{mdframed}[style=myframe]
Hello
\end{mdframed}


\end{document}
  • Thanks! That worked! The approach of Steven B. Segelets with \unskip also works. However, with Seven's approach, if one still wants to have some exact amount of space greater than 0, then one needs to add \vskip ...pt after \unskip. – ndrizza Sep 17 '15 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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