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}
6
  • Related: Space between two instances of a self-defined environment
    – Werner
    Sep 12, 2015 at 19:10
  • 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, 2015 at 19:15
  • It's related, not necessary a duplicate/solution. You can also set skipbelow to a negative value...
    – Werner
    Sep 12, 2015 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, 2015 at 11:14
  • 2
    Try adding \unskip at the end of the environment. See tex.stackexchange.com/questions/174587/… Sep 16, 2015 at 15:19

1 Answer 1

10
+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}
2
  • 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, 2015 at 14:32
  • Any idea why setting it globally works but setting it just for a specific environment doesn't?
    – nog642
    Oct 20, 2021 at 21:36

You must log in to answer this question.

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