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 have a document with the book documentclass, and I'm trying to include two wrapfigures on the same page, one on each side (ideally in adjacent paragraphs, but at this point I'm just trying to get them on the page without screwing up any of the other formatting.)

One problem I have seems similar to this question, in that on every page after the one where I use wrapfigure, all of my text gets pushed to the right as if in a column. I tried the solution given there but couldn't get it to work for me.

The other is that I can't seem to get both of the figures to wrap properly; it seems as if they're interfering with each other somehow, but no matter what settings I change, I just can't get them right.

enter image description here

text text text

\begin{wrapfigure}[9]{r}{0.4\textwidth}
\vspace{-20pt}
  \begin{center}
    \includegraphics[width=0.38\textwidth]{images/hausdorffShapes}
  \end{center}
\vspace{-20pt}
  \caption{An example showing $\vec{d}_H(B, A)$ and $\vec{d}_H(B, A)$}
  \label{hausdorffShapes}
\vspace{10pt}
\end{wrapfigure}

text text text

\begin{wrapfigure}[7]{l}{0.4\textwidth}
\vspace{-20pt}
  \begin{center}
    \includegraphics[width=0.38\textwidth]{images/hausdorffBadExample}
  \end{center}
\vspace{-20pt}
  \caption{An example where the Hausdorff distance fails}
  \label{hausdorffBadExample}
\vspace{-10pt}
\end{wrapfigure}

text text text

I get all sorts of other positioning problems if I try different lineheights, or vspace, or widths, etc. Or if I try moving the position of the wrapfigure commands around. No combination I've found has worked.

And, in addition, in the next page on, all of the text is squished to the right, like it's in a column.

Any help would be appreciated, please let me know if I should upload a copy of the ps or pdf or post more of the latex code.

EDIT: It turns out that the rest of the text is only forced into a column for the rest of the section, not the rest of the paper.

Here's a link to an example tex file and the corresponding pdf output.

share|improve this question
    
Please make a complete (small) document that shows the problem, you can use \usepackage[demo]{graphicx} so it doesn't need the images, but it would be much easier to debug with a complete document. –  David Carlisle Apr 20 '13 at 20:58
    
@DavidCarlisle Added links to a sample tex and pdf. Edit: I'm having problems with the dropbox links, so here's a pastebin. For the example, I was just running it through pdflatex. –  Evan Cordell Apr 20 '13 at 21:11
    
You have a section title next to the wrap figure which doesn't appear in the sample code here. Put the second wrapfigure environment between paragraphs not involving the section title ("Computability"). Don't use the center environment, but the simple \centering declaration. –  egreg Apr 20 '13 at 21:33
    
@EvanCordell see updated answer –  David Carlisle Apr 20 '13 at 21:34

1 Answer 1

up vote 4 down vote accepted

It should just work, if it does not please edit your question to show the problem with a complete document such as the one below. I used the wrapfig examples from your question (but removed some negative spacing).

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}

\def\a{One two three four five six. }
\def\b{\a\a Red green blue yellow white black. }
\def\c{\b\b\a\b\b\b\a\b\b}

\begin{document}

\begin{wrapfigure}{r}{0.4\textwidth}
\centering
    \includegraphics[width=0.38\textwidth]{images/hausdorffShapes}
  \caption{An example showing $\vec{d}_H(B, A)$ and $\vec{d}_H(B, A)$}
  \label{hausdorffShapes}
\end{wrapfigure}
\c

\begin{wrapfigure}{l}{0.4\textwidth}
\centering
    \includegraphics[width=0.38\textwidth]{images/hausdorffBadExample}
  \caption{An example where the Hausdorff distance fails}
  \label{hausdorffBadExample}
\end{wrapfigure}
\b\b\c

\end{document}

From your linked document

enter image description here

the additional problem there is that you do not have enough text in the paragraph wrapping the first image, normally wrapfig would take text from the following paragraph, but you have another figure there. Restricting the lines taken by the first image then adding some space fixes things as in the image above.

which is in fact a metric, given that $M$ is also compact. 

\begin{wrapfigure}[5]{r}{0.4\textwidth}
\centering
    \includegraphics[width=0.38\textwidth]{images/hausdorffShapes}
  \caption{An example showing $\vec{d}_H(B, A)$ and $\vec{d}_H(B, A)$}
  \label{hausdorffShapes}
\vspace{10pt}
\end{wrapfigure}
We now have a basic way to talk about the distance between sets of points. Figure \ref{hausdorffShapes} shows the two directed distances between $A$ and $B$, considered as sets of points. The undirected distance is, then, the larger of the two. 

\vspace{2\baselineskip}

\begin{wrapfigure}{l}{0.4\textwidth}
\centering
    \includegraphics[width=0.38\textwidth]{images/hausdorffBadExample}
  \caption{An example where the Hausdorff distance fails}
  \label{hausdorffBadExample}
\end{wrapfigure}
Before we get too excited, however, let us consider a case where the Hausdorff distance gives undesirable results. Figure \ref{hausdorffBadExample} shows two polygonal curves. Note that they have a very small Hausdorff distance, because for every point in $A$ there is a point in $B$ that is very close. If we think about them as curves, however, they seem about as dissimilar as could be! The Hausdorff distance is clearly inadequate for use in comparing the similarity of curves. 
share|improve this answer
    
Your edit really helped, I figured the issue was with how close together they were vertically. Thanks! –  Evan Cordell Apr 20 '13 at 21:41
1  
You may also like to change the 'r' and 'l' position variables to 'o' and 'i' respectively if you want the pictures to be outer and inner on the page regardless of whether it is an odd or even page. –  Nicholas Hamilton Apr 21 '13 at 3:43

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.