# Weird behaviour from graphicx - inserting PDF files

So I created some graphs in Excel, saved them as PDFs and used the following code to import them to LaTeX:

\newpage
\begin{figure}[htbp]
\centering
\includegraphics[width=0.95\textwidth]{white1.pdf}
\caption{This figure shows the commulative oxygen production rate of white light in iteration number 1. The SEM bars show reading error from the pipette. }

\end{figure}

\newpage
\begin{figure}[htbp]
\centering
\includegraphics[width=0.95\textwidth]{green2.pdf}
\caption{This figure shows the commulative oxygen production rate of green light in iteration number 2. The SEM bars show reading error from the pipette. }

\end{figure}
\newpage
\begin{figure}[htbp]
\centering
\includegraphics[width=0.95\textwidth]{white3.pdf}
\caption{This figure shows the commulative oxygen production rate of green light in iteration number 3. The SEM bars show reading error from the pipette. }

\end{figure}

\newpage
\begin{figure}[htbp]
\centering
\includegraphics[width=0.95\textwidth]{green4.pdf}
\caption{This figure shows the commulative oxygen production rate of green light in iteration number 4. The SEM bars show reading error from the pipette. In this figure there is overlapping of SEM bars that show no significance difference }

\end{figure}

\newpage
\section{Discussion}


However the problem is that the new page at the very end (discussion) is not in order. It gets injected after the first figure.

So if the pages were numbered like this:

fig1, fig2, fig3, fig4, dis1


everytime I try to create the dis1 page by \newpage I get the following output:

fig1, dis1, fig2, fig3, fig4


Anyone know what's happening?

-

Use \clearpage instead of \newpage. It will process all floats before creating a new page.

-

This typically happens with floats that have a contents larger than the text block dimensions. Presumably, in your case, green2.pdf (the first "offender") is flushed to a page of floats and subsequently pushed until there is nothing left to typeset before it is finally printed. Use @Herbert's suggestion to flush (or process) any pending floats, or modify the size of the imported graphic so it will fit within the text block.

Note that a width of 0.9\textwidth will fit the image within the text block width, but it - together with the caption - could still be larger than the text block height (\textheight).

-
okay. i am still learning (pretty new here) so I didn't really get anything you said but I guess with experience I'll know what you are talking about. thanks – masfenix Nov 24 '11 at 8:21
Ask the questions - that's what this site is for! :) Floats are meant to float around in your document. You use the float specifiers htbp to say put the float here if possible, otherwise top of the page, otherwise bottom of the page, otherwise on a page of floats. When all these fail (typically with an oversized graphic), further processing of floats is suspended until later in the document. Using \clearpage flushes this build-up. On a related note - is green2.pdf larger than the other images? Did LaTeX complain and give any wanrings? – Werner Nov 24 '11 at 8:26
I am not sure. I hit compile and i see a bunch of stuff at the bottom of the screen. never bothered reading if there was a warning. I'll find out and let you know. – masfenix Nov 24 '11 at 9:06
That "stuff" is information about the compile processes, which makes its way into a .log file. If you're interested in finding out what this .log file is all about and how to interpret it, read Understanding the Log file. – Werner Nov 24 '11 at 15:11