[Tex/LaTex] Prevent wrapfigure from wrapping the next section

wrapfigure

Code:

\documentclass{article}
\usepackage[a5paper]{geometry}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}
\begin{wrapfigure}{l}{0.5\textwidth}
  \rule{4cm}{12cm}
\end{wrapfigure}
\lipsum[1]

\section{Hello}

Hello section text
\end{document}

Prints:

enter image description here

  1. How can I make it shift \section{Hello} to the left?
  2. And more generally: never wrap any text in the new section, following wrapfigure?

Best Answer

With the text and image as they are, wrapfig needs a bit of help.

You could tell it to stop wrapping after 29 lines:

\begin{wrapfigure}[29]{l}{0.5\textwidth}

But the result is rather squeezed:

enter image description here

A much better result in this case is to simply add \clearpage before the \section and move it to the next page.

Related Question