2

I am facing an issue with wrapfig, as the figure is close to a page break, so I have to use the R parameter to make it float. I was looking at this answer, but contrary to what it's shown, the float is placed in the center of the next page (instead of the top of the next page as shown). Is there a way to control this? The figure is way too far of its context.

The problem is similar to this code, where the context of the figure is the fourth paragraph of the first page, and the figure shows up in the middle of the second page:

\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum}

\begin{document}

\lipsum[1-7]
\begin{wrapfigure}{R}{5cm}
\centering
\rule{3cm}{4cm}
\end{wrapfigure}
\lipsum[1-6]

\end{document}
11
  • If I modify your example to \end{wrapfigure} !!!\lipsum[1-6] then the !!! make it clear that the image is attached to the immediately following paragraph, starting !!! so this does not appear to be an example of the problem described? Nov 13, 2015 at 14:17
  • No, the example shows what is happening but it doesn't reproduce my real problem but I gave it to have an indication of what's happening.
    – aaragon
    Nov 13, 2015 at 14:20
  • sorry but if you want someone to debug that I think an example of the problem is a minimum requirement, Nov 13, 2015 at 14:28
  • for example is it just a long paragraph over the page break? Nov 13, 2015 at 14:29
  • 1
    Note a floating wrapfig is never (except accidentally) placed at top of a page wrapfig always adds to the start of a paragraph (see texdoc wrapfig page 2) so if the first para after the page break starts half way down the page that's where it will be. Nov 13, 2015 at 14:32

1 Answer 1

5

wrapfig always adds floats to the start of a paragraph and as clarified in comments the behaviour is expected, the float was added to the start of the first paragraph which started sufficiently high up the page to accept the figure.

It is easy to manually adjust the position, once the document is stable, add a spurious paragraph break at the point TeX broke the page then add

\clearpage
\begin{wrapfig}..
\end{wrapfig}
\noindent rest of paragraph....

then the figure will appear in a cutout at the top of the page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .