Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Welcome to TeX.SE. Note that it is customary here to thank those who helped you by up-voting the answer (assuming it was helpful), and possibly accepting that answer (via the check mark) that helped you the most. See how do you accept an answer –  Peter Grill Jan 31 '12 at 17:55

1 Answer 1

This is from a google.group:

\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}
share|improve this answer
    
Please explain your answer a bit. –  Martin 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.