# [texhax] Bad page break with longtable and floats

Volker Haas volker.haas at brainbot.com
Fri Sep 25 10:44:44 CEST 2009

Hi list,

I encountered a problem when using a longtable and floats on the same
page: some text is printed over the page margins. I searched the web and
found a solution which unfortunately fixes only part of the problem.

Using the original longtable package (v4.11 from texlive 2008) the
following minimal example breaks (the paragraph \lipsum[5] is printed
over the margin:

\documentclass[]{article}

\usepackage{longtable}
%\usepackage{longtablepatched}
\usepackage{lipsum}

\begin{document}

\begin{figure}
\lipsum[1]
\caption{figure 1}
\end{figure}

\lipsum[1-2]

\begin{longtable}{|l|l|}
\hline
1 & 2 \\ \hline
3 & 4 \\ \hline
5 & 6 \\ \hline
7 & 8 \\ \hline
9 & 0 \\ \hline
\end{longtable}

%% \begin{figure}
%% \lipsum[1]
%% \caption{figure 2}
%% \end{figure}

\lipsum[5]

\end{document}

Using a patched version of longtable (found at
http://www.digitas.harvard.edu/cgi-bin/wiki/ken/LongTable) fixes the
problem. But the example breaks again if the second figure is uncommented.

--> Any help on how to make a longtable work with multiple floats on the
same page would greatly be appreciated.

Regards,
Volker

p.s. The TeX code is automatically generated, therefore making it pretty
much impossible to avoid the above mentioned situation...

--
volker haas                 brainbot technologies ag
fon +49 6131 2116394        boppstraße 64
fax +49 6131 2116392        55118 mainz
volker.haas at brainbot.com    http://www.brainbot.com/