# [texhax] LaTeX puts floats inside a listing...

Soeren D. Schulze soeren.d.schulze at gmx.de
Fri Jun 3 19:40:30 CEST 2011

In a LaTeX article, I have something like this:

\begin{figure}[ht]
\end{figure}
\section{...}
\lstinputlisting{...}

The listing is relatively long (more than one page), so it should not be
in a float.
Now LaTeX decides to put the figure on top of the following page (i.e.
"t"), inside the listing -- but that's ugly.

What I'm looking for: a LaTeX command that forces all figures (and other
floats) to be printed before starting the new section.  I know that
"\clearpage" does this, but I do not necessarily want to start a new page.

Is there any such command?

Sören