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 am using the wrapfig package in order to place some text on the right side of my paragraph:

\documentclass{article}
\usepackage{wrapfig}

\begin{document}
    \begin{wrapfigure}{r}{0pt}
        \fbox{Test}
    \end{wrapfigure}

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}

But when I set \hangindent to some positive length, the text/figure moves to the end of the paragraph:

\documentclass{article}
\usepackage{wrapfig}

\begin{document}
    \begin{wrapfigure}{r}{0pt}
        \fbox{Test}
    \end{wrapfigure}
    \setlength{\hangindent}{1cm}
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}

Why does this happen and how can I fix it? Thanks in advance.

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

wrapfig uses \parshape to set the paragraph wrapping the figure. This is incompatible with setting \hangindent and indeed you get a warning

Package wrapfig Warning: Stationary wrapfigure forced to float on input line 9

because wrapfig checks whether the paragraph is set with a non zero \hangindent (or a non zero \parshape). There's no fix with wrapfig nor with cutwin and the only way, I believe, is to write your own \parshape specification.

share|improve this answer
    
Is there any alternative to wrapfig that would play nicely with \hangindent, or any alternative to hangindent that would play nicely with wrapfig? –  jtbandes Oct 8 '12 at 22:26
1  
@jtbandes Not that I know; basically you have to rewrite the wrapfig macros to take care of your \hangindent in the \parshape specification it creates. Not something I personally would try. :) –  egreg Oct 8 '12 at 22:31
add comment

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.