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 want to have a figure floating next to a block quote. So I used the wrapfig package and the quote environment.

If you typeset the following example, you will see that the figure is printed on the next page instead of being next to the block quote. It works perfectly with normal text. Is there any solution to that?

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{wrapfig}
\begin{document}
    \blindtext[3]
    \begin{wrapfigure}{R}{0.5\textwidth}
        \centering
        \rule{5cm}{5cm}
        \caption{Foo bar foobar baz baq}
    \end{wrapfigure}
    \begin{quote}
        \blindtext
    \end{quote}
    \blindtext
\end{document}

enter image description here

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

It seems to work OK using r instead of R (lowercase specifiers don't allow the object to float); I also added some value for the hanging indentation:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{wrapfig}
\begin{document}
    \blindtext[3]
    \begin{wrapfigure}{r}[-10pt]{0.5\textwidth}
        \vspace*{\topsep}
        \centering
        \rule{5cm}{5cm}
        \caption{Foo bar foobar baz baq}
    \end{wrapfigure}
    \begin{quote}
        \blindtext
    \end{quote}
    \blindtext
\end{document}

enter image description here

Notice the additional \vspace*{\topsep} inside wrapfigure; in this case, this is necessary to have the top of the figure aligned with the top of the first line of the quote environment (thanks to barbara beeton for suggesting this improvement).

share|improve this answer
    
Thanks, but it only works with the indentation! Otherwise I get this. –  Ps0ke Nov 4 '12 at 3:07
    
@Ps0ke I don't understand your comment. My code produces the effect illustrated in the image I attached; if you are still experiencing undesired results, please edit your question and add some complete and minimal document illustrating the problem. –  Gonzalo Medina Nov 4 '12 at 3:09
    
I'm sorry, I must've made a mistake. Your code works perfectly--with or with out the indentaion. –  Ps0ke Nov 4 '12 at 3:16
    
@Ps0ke ah, OK then. –  Gonzalo Medina Nov 4 '12 at 3:24
    
@GonzaloMedina -- is there any way to have the top of the figure aligned with the top of the first line of the quote? it would look nicer. –  barbara beeton Nov 4 '12 at 14:10
show 3 more comments

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.