0

I want to use wrapfigure to contain an (align) environment. How do I remove the excessive vertical spacing above and below the \rule commands without using \vspace? I don't understand where this space comes from in the first place.

\begin{wrapfigure}{r}{0.5\textwidth}
    \rule{0.5\textwidth}{1pt}
    \captionof{model}{MODEL \hfill[LP]}
    \rule{0.5\textwidth}{1pt}
    \begin{align}
        1 = 1
    \end{align}
    \rule{0.5\textwidth}{1pt}
\end{wrapfigure}

This is my current output:

enter image description here

I already set

\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}

in the beginning of the document. This successfully removes space around the align environment.

I want the hrules to wrap the caption tightly and symetrically. Furthermore, I want the top and bottom padding equal to the \columnsep setting, i.e left and right padding.

Thanks a lot in advance.

EDIT:

Got there. I got this result with:

\captionsetup[model]{skip=0.2em, labelsep=period}
\usepackage{parskip}
\setlength{\parskip}{0pt}

and

\vspace{-1.3em}
\captionof{model}{MODEL \hfill[LP]}

Still, for some reason \vspace always feels like a dirty hack to me. I would feel better if the linebreak after the caption would not be produced in the first place. Is the use of \vspace to be recommended, in general?

enter image description here

3
  • Wrapfig adds \intextsep above and below (same as figure [h]). Also, \rule takes up \baselineskip by itself, while \hrule does not. – John Kormylo May 2 at 0:03
  • @JohnKormylo Thanks a lot! Based on your comment, I went back and replaced rule with hrule. Also, I removed vspace and skip in caption. I got a super clean result. I think the major issue was the \parskip preset in my document. Is there a way to surpress parskips locally rather than setting ot to 0 for the entire document? Best, Anton – Anton Hinneck May 2 at 10:39
  • Changes inside groups such as {...} or \bgroup ...\egroup are (normally) local to the groups. – John Kormylo May 2 at 16:01
0

See "Edit". I would still apperciate some thoughts on using \vspace. Is there a way to achieve the same without this command?

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.