[Tex/LaTex] Error : Too many unprocesssed floats, multiple figures single page

floatssubfloats

I am trying to include 3 figures on a single page. I tried the following code:

\begin{figure}[t!]
\begin{center}
\includegraphics[scale=0.5]{images/Figure1.pdf}
\caption{Figure 1.}
\label{fig1}

\includegraphics[scale=0.5]{images/Figure2.pdf}
\caption{Figure 2.}
\label{fig2}

\includegraphics[scale=0.5]{images/Figure3.pdf}
\caption{Figure 3.}
\label{fig3}
\end{center}
\end{figure}

However, this code produces an error on compiling.

! LaTeX Error: Too many unprocessed floats.

When I remove the 3rd figure out of the figure environment and put it in a new figure environment, then it works. But it then goes to multiple pages, only the first 2 figures stay on the same page.

Then I searched other similar questions and saw this one : Arranging multiple figures How to arrage multiple figures? . Here they talk about using subfigure package, so I just gave in the top of my latex document.

\usepackage{subfig}

When I compile this, I get another error.

! LaTeX Error: Command \c@subfigure already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.113 \newcounter{subfigure}
                            [figure]

Any suggestions for getting around this ?

Best Answer

You have shown one float (a figure). If this one is the sole cause of the too many unprocessed floats error, it almost certainly means that LaTeX is unable to place it according to the limitations it has been given. When that happens, all later figures have to wait in line (to avoid getting them out of order). If there are more than allowed to be pending (I think 18), you get this error. The morefloats package allows you to go over 18, but even so, you may find all the figures flushed at the end of the chapter or the end of the document.

You have used \begin{figure}[t!] which means it can only be put at the top of a text page. Probably it cannot fit there within the default constraints. (The default constraints are set by the class file, which you haven't mentioned.) In the article class, a top float is only allowed 70% of a page, a float bigger than that probably should go on a page by itself, so I would suggest using [tp] instead of [t!].

You could also reduce the size of the float. You can trim a little whitespace from the top and bottom by not using the center environment. Just use \centering.

Also, you can adjust the parameters that limit how much space floats can take up. For example:

\renewcommand{\topfraction}{0.8}
\renewcommand{\textfraction}{0.15}

These commands would go in the preamble of your document.

Finally, as a last resort, issuing \clearpage before the problem float will cause all pending floats to be processed on the pages that follow. If this one is the only one, that is equivalent to putting it on a page by itself (the [p] option).