tags:

views:

29

answers:

2

I'm trying to text-wrap floating images in LaTeX, using code like the following:

\begin{wrapfigure}{R}{0.5\textwidth}
\begin{center}
\includegraphics{images/image.png}
\caption{This is the caption.}
}
\label{fig:image1}
\end{center}
\end{wrapfigure

This works fine most of the time (creating an image that floats on the right-hand side), but sometimes LaTeX does not properly clear after the image, and it leaves an open column for another page or two. How does one remedy this, or ideally, does LaTeX have a function similar to clear: both in CSS?

There is the \clearpage command, but it's not appropriate when there's no natural place to break to a new page near the image.

A: 

You might try to manually set the height of the figure using the optional argument of wrapfigure

\begin{wrapfigure}[lineheight]{alignment}{width}

where lineheight is the number of text lines which shall wrap around the image.

fschmitt
No such luck. This results in it not being a constant column of whitespace, but still having whitespace corresponding to the lineheight every few lines.
Herman
A: 

I still don't have a good answer to this question, but the solution for now is to not use wrapfigure at all. Using only figure solves the problem of open columns, but it's not the most ideal solution. Any other answers are still welcome, but I'll post my half-way solution here for those who might also need it:

\begin{figure}
\begin{center}
\includegraphics{images/image.png}
\caption{This is the caption.}
\end{center}
\label{fig:image1}
\end{figure}
Herman