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

Senthil Kumar M senthil.debian at gmail.com
Fri Jun 3 19:48:32 CEST 2011

On Fri, Jun 3, 2011 at 10:40 AM, Soeren D. Schulze
<soeren.d.schulze at gmx.de> wrote:
> 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


>From the TeX FAQ (http://www.tex.ac.uk/cgi-bin/texfaq2html?label=floats):

"Try the placeins package: it defines a \FloatBarrier command beyond
which floats may not pass. A package option allows you to declare that
floats may not pass a \section command, but you can place
\FloatBarriers wherever you choose".



More information about the texhax mailing list