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'm trying to insert an image in LaTeX with some text around:

Here is our image:
Here is some text!

I'd like to insert image and 'Here is some image' on the same page, but when i'm trying to compile pdf I get: Warning! !h changed to !ht and places an image on the next page, and here is some text goes right after Here is some image

What's wrong?

share|improve this question

migrated from stackoverflow.com Apr 4 '11 at 12:46

This question came from our site for professional and enthusiast programmers.

Hi. There is specialized place for TeX questions - tex.stackexchange.com – Paul Lysak Mar 24 '11 at 16:16
possible duplicate of Insert image in latex – Jake Apr 4 '11 at 13:52
possible duplicate of Force figure placement in text – Caramdir Apr 4 '11 at 16:02
The answer by Matthias Vallentin nicely explains how to solve the problem using the figure environment. But you could also include an image by using \includegraphics in a center environment if you don't need or want the power of the figure environment. That would give you absolute control about the placement but you would have to give up the \caption as well. – Christian Lindig Apr 4 '11 at 17:59

LaTeX creates a float if you put includegraphics inside a figure environment. Floats are containers for objects that cannot be broken across page boundaries. By using figure, you're essentially telling the LaTeX compiler "please put the picture where you think it fits best."

To force a picture appearing at the exact location where it is in the source code, you can do either of the following:

  1. Use the H specifier for the figure environment. This requires \usepackage{float}.

  2. Don't wrap \includegraphics into a figure environment if you just want the plain image, without caption and other extras.

Example for the first option:


You find more about floats here: http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions.

This exact problem is already covered in more depth at: http://tex.stackexchange.com/questions/8625/force-figure-placement-in-text.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.