# Text on the left, picture on the right and other text follows

I use the following code to produce a picture on the right of the text

\documentclass[12pt,landscape]{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\usepackage{wrapfig}
\begin{document}

\begin{wrapfigure}[8]{r}{2.5in}
\centering
\includegraphics[width=2.4in]{governator.jpg}
\end{wrapfigure}
BOO

\begin{wrapfigure}[8]{r}{2.5in}
\centering
\includegraphics[width=2.4in]{governator.jpg}
\end{wrapfigure}
\lipsum[1]

\end{document}


The idea is to have text on the left, the picture on the right, and the new text in the bottom.

The second paragraph is good, but the text in the first paragraph is shorter and this breaks the layout.

Is there a way to correct this situation?

\documentclass[12pt,landscape]{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\usepackage{wrapfig}
\makeatletter
\newcommand\wrapfill{\par
\ifx\parshape\WF@fudgeparshape
\nobreak
\vskip-\baselineskip
\vskip\c@WF@wrappedlines\baselineskip
\allowbreak
\WFclear
\fi
}
\makeatother
\begin{document}

\begin{wrapfigure}[8]{r}{2.5in}
\centering
\includegraphics[width=2.4in]{governator.jpg}
\end{wrapfigure}
BOO\wrapfill

\begin{wrapfigure}[8]{r}{2.5in}
\centering
\includegraphics[width=2.4in]{governator.jpg}
\end{wrapfigure}
\lipsum[1]

\end{document}

• Please explain your answer a bit. – Reinstate Monica - M. Schröder Jan 31 '12 at 10:38
• I just copied the code... But this is how I understand: If the paragraph is shorter than necessary (\ifx\parshape...) than the code adds a negativ \vskip after your paragraph (to enter the last line of the too-short-paragraph). From here again adds a positiv \vskip wich is the number of lines which have to be shortened to wrap around the figure (\c@wrappedlines) times \baselineskip. Sorry my English is a little bit poor. Hope I explained well enough. – schmendrich Jan 31 '12 at 11:16
• Nice Schmendrich, that's what I've been lookig for :) 10x – B.T. Jan 31 '12 at 14:46