Floats are page elements that float with respect to the rest of the document. Standard floats are tables and figures, but with the float package you can easily make new ones, like algorithms. Most of the time floats work satisfactory, but sometimes LaTeX seems too stubborn to do what you want. This section describes how you can influence LaTeX so that it will do most of the time what you want. There might, however be some pathological cases where it is impossible to convince LaTeX to do things your way. In the following we will use figures as an example but everything applies to other floats as well.
The most encountered problems with floats are:
In the first two cases you must first check if you have given the correct
``placement'' parameter to you float, e.g. \begin\{figure\}[htp]
specifies that your figure may be placed either: Here (i.e. in the text
position where the command is given), on the Top of a page (which may be
the page where you put the command), or on a separate Page of floats. You
could also have specified ``b'' for Bottom of the page. The order of the
letters is insignificant, you cannot force LaTeX to try Bottom first
and then Top by specifying [bt].
If LaTeX doesn't put the float at the place where you expected it, it is usually caused by the following:

There are also some others for double column floats in two-column documents.
The values in the righthand column are the defaults for the standard
LaTeX classes. Other classes could use different defaults. As you see
with the default values a float will not be put in the bottom of a page if
its height is more than 30% of the page height. So if you specify [hb] for
a float which is taller it has to move to a float page. But if it is less
than 50% of the page height it will have to wait until some more floats
are given before a float page can be filled to satisfy the
\floatpagefraction parameter. If you have this kind of behaviour you
can easily adapt the parameters, e.g. with:
\renewcommand{\textfraction}{0.05}
\renewcommand{\topfraction}{0.95}
\renewcommand{\bottomfraction}{0.95}
\renewcommand{\floatpagefraction}{0.35}
\setcounter{totalnumber}{5}
You may want to be careful not to make \floatpagefraction too small,
otherwise you may get too many small floatpages.
You can force LaTeX to ignore most of the parameters for one specific float occurrence by including an exclamation mark (!) in the placement parameters, e.g.
\begin{figure}[!htb]
Floats which contain a ``t'' in the position parameter could be placed before the place where they are referenced (but on the same page). This is normal behaviour for LaTeX but some people just don't like it. There are a number of ways to prevent this:
\suppressfloats[t]
If in spite of all your attempts LaTeX still moves your floats to the end
of the document or the end of a chapter, you can insert a \clearpage
command. This will start a new page and insert all pending floats before
continueing. If it is undesirable to have a pagebreak you can use the
afterpage package and the following command:
\afterpage{\clearpage}
This will wait until the current page is finished and then flush all outstanding floats. In some pathological circumstances afterpage may give strange results, however.
Finally, if you want a float only at the place where you define it, without LaTeX moving it whatsoever, you can use the float package and give the command:
\restylefloat{figure}
in the preamble. Now you will be able to
specify [H] as the position parameter, which will mean ``HERE and only
HERE''. This may cause an unwanted page break however\afterpage{\clearpage \begin{figure}[H] ... \end{figure}}
Complaints from LaTeX about ``Too many floats'' are usually caused by one
of the above problems: floats not being able to be placed and LaTeX
collecting too many of them. The solutions given above, especially those
with \clearpage in them will usually help. In some cases there
really are too many floats, as LaTeX has a limited number of ``boxes'' to
store the floats. The package morefloats can be used to increase
this number. If you need still more then you must edit a private copy of
this file, but even then there will be some limit that you cannot pass.
Then your only resort will be to change your document.