TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used the code from here to get text to wrap around images, but whenever I have a long image near the end of the page, it runs off the page and gets cut off. How do I fix this?

share|improve this question
up vote 7 down vote accepted

When positioning the wrapped float, you can specify uppercase L or R for the position, instead of lowercase l, r. This allows the wrapfigure environment to float and LaTeX can move it to avoid page overflow.

share|improve this answer

You could add the following to your document preamble:

  \par \penalty-100\begingroup%
  \dimen@ii\pagegoal \advance\dimen@ii-\pagetotal
  \ifdim \dimen@>\dimen@ii

and then use


to check whether the image will fit on the page or not. If it does/will fit, nothing will happen. If it does/will not fit, a break (page or column) is issued, so the next paragraph will start on a new page.

The above code was taken from the minimal needspace package.

share|improve this answer
I don't want to be tough, but it does mean that one has to include the graphics twice, first to check its siye and then to include it? – yo' Jan 27 '12 at 19:13
@tohecz: That's correct. I'm not sure whether this requirement is an isolated instance, and therefore a separate commands seems viable. If not, and this check has to be included with each, it would be possible to include such a check as part of the wrapfigure environment. – Werner Jan 27 '12 at 19:15

Your Answer


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.