1

In my document, I've modified \parskip to give a nice break between paragraphs. But this means that \wrapfigure calculates the number of lines wrong, and gives itself a significantly larger margin than it needs.

How can I fix this? I'd like the text to flow in right underneath the \wrapfigure, the way it does if I remove the \parskip adjustment.

MWE:

this is wrong

\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum}

\setlength{\parskip}{1em}

\begin{document}

\lipsum[1]

\begin{wrapfigure}{r}{0.5\textwidth}
\lipsum[2]
\end{wrapfigure}

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

\lipsum[3]
\end{document}
1

enter image description here

You can specify the multiple of lines that should be short:

\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum}

\setlength{\parskip}{1em}

\begin{document}

\lipsum[1]

\begin{wrapfigure}[9]{r}{0.5\textwidth}
\lipsum[2]
\end{wrapfigure}

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

Short paragraph

\lipsum[3]
\end{document}
  • This seems like it solves the problem nicely, but I'm confused as to how to find that 9 you used. If I don't know in advance how the paragraphs are going to flow or how many breaks there'll be, is there a way I can have TeX calculate this? – Draconis Nov 27 '18 at 2:17
  • It is worth a note that the the optional added here [9] is controlling the narrow lines below the figure. You can read more about it if you run texdoc wrapfig in your terminal/command line (or read it online here) – Ole Anders Nov 27 '18 at 2:19
  • I get your output with the new lipsum package even without your addition, only in texlive 2017 it changes something. – Ulrike Fischer Nov 27 '18 at 11:49

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.