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 have 3 paragraphs with text (but without use \paragaph, just ext) and I have 3 images to these paragraphs. When I create pdf I have these paragraphs on one page (with text before) then on next page 2 images and some text which should be after all images and then on third page last image. So how can I do that every image should be on page where is text that belongs to this image. Or at least text would be between images.

My code now looks like this:

lorem ipsum .....
\begin{figure}[!h]
  \begin{center}
    {\includegraphics[width=12cm,keepaspectratio]{img/rest}}
    \caption{...}
    \label{rest}
  \end{center}
\end{figure} 

lorem ipsum ....
\begin{figure}[!h]
   \begin{center}
     {\includegraphics[width=12cm,keepaspectratio]{img/rest2}}
     \caption{...}
     \label{rest2}
   \end{center}
 \end{figure} 
...
share|improve this question
2  
Does the answer at tex.stackexchange.com/questions/8625/… help? –  Ethan Bolker Dec 6 '12 at 17:18

1 Answer 1

up vote 4 down vote accepted

When you use floats (\begin{figure} ... \end{figure}) LaTeX places the figure at the first optimal place after where you type it in. You use !h to force the figure to be placed "exactly here" but this means "if possible" to LaTeX and is not as forcing as one might think. If you absolutely need a figure to occur somewhere, one simple solution is to insert it without the begin-end, in other words not as a float. There are also other solutions such as using the package placeins by using a comand \Floatbarrier. Another package to try is the float package which provides an H option which is similar to !h. In short, getting the pictures exactly where you want with floats is not trivial.

share|improve this answer
    
Thanks for this answer, it helps. –  Bibo Dec 6 '12 at 17:25

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.