# Images on same page as text (paragraph)

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}
...

-
Does the answer at tex.stackexchange.com/questions/8625/… help? – Ethan Bolker Dec 6 '12 at 17:18

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.
\FloatBarrier should be uppercase (\Floatbarrier doesn't exist) – smihael Aug 22 '15 at 17:58