# How can I stop content overlapping my footer?

I am trying to use LaTeX to generate PDF versions of cheat sheets people build on my website. They are all three column documents, effectively each containing multiple tables.

For the most part, LaTeX handles the dividing of content into columns really well. However, sometimes some blocks overlap the footer. I have a test document (built with lualatex, based on this tex file), and you can see on page 2 in the first column the "Directives" block overlaps the footer.

I've tried a few different things to resolve this. The closest solution was adding an mbox after each table, as in this PDF (from this tex file). As you can see, there is no longer an overlapping issue. However, on page 3 there is now a gap at the top of column 2.

Does anybody have an idea how I can stop columns overlapping the footer without introducing odd gaps at the top of some columns?

-

You don't give LaTeX much of a chance here:-) Each of the sections is an unbreakable table (`tabularx` or `tabulary` mostly) as LaTeX never re-orders content it is inevitable that you get overfull boxes or big gaps. LaTeX does complain a lot

``````Overfull \vbox (52.91997pt too high) has occurred while \output is active
Overfull \vbox (51.91997pt too high) has occurred while \output is active
Overfull \vbox (50.91997pt too high) has occurred while \output is active
Overfull \vbox (49.91997pt too high) has occurred while \output is active
Overfull \vbox (48.91997pt too high) has occurred while \output is active
Overfull \vbox (47.91997pt too high) has occurred while \output is active
Overfull \vbox (46.91997pt too high) has occurred while \output is active
Overfull \vbox (45.91997pt too high) has occurred while \output is active
Overfull \vbox (44.91997pt too high) has occurred while \output is active
Overfull \vbox (43.91997pt too high) has occurred while \output is active
Overfull \vbox (42.91997pt too high) has occurred while \output is active
Overfull \vbox (41.91997pt too high) has occurred while \output is active
Overfull \vbox (40.91997pt too high) has occurred while \output is active
Overfull \vbox (39.91997pt too high) has occurred while \output is active
Overfull \vbox (38.91997pt too high) has occurred while \output is active
Overfull \vbox (37.91997pt too high) has occurred while \output is active
Overfull \vbox (36.91997pt too high) has occurred while \output is active
``````

The `NgModelController` table on page two simply doesn't fit in that column, you could put a `\columnbreak` before it leaving that column very short, and also causing problems in the next column unless you force a break there as well.

I suspect that in this case the various tables are more or less independent and that a better algorithm for this kind of layout would be to measure each one, and then add whichever table best fits in the current column. It's not impossible to do that but LaTeX doesn't really offer much support for that kind of layout out of the box and if it is just one document rather than an automated printing of thousands of pages of data dumped from some database, it is probably better to re-arrange the tables by hand.

Or of course you could use breakable tables and allow them to wrap to the next column. It's fairly easy to use `longtable` in `multicol` (there is some code on this site for example) although it's a bit harder to use the repeating header feature that longtable would normally have.

-
Thanks David. I'm splitting the tables manually after roughly 30 lines of content so that they should be able to fit into one column, with the trade-off being, as you spotted, that some columns would end up being short. The documents are built by site users, and there's lots of flexibility to their arrangements, so manual layouts aren't really an option, unfortunately. I looked into longtable, but didn't get very far - with this set up, table columns are all ragged right, non-justified, with wrapping text and flexible widths, which I couldn't get to work with longtable in the same way. – Dave Child May 19 '13 at 10:56
@DaveChild oh sorry I misread I thought this was a one-off cheat-sheet document. Automatic layout is trickier then:-) although it should work to get rid of all forced columnbreaks and have flexible glue between each table. longtable shouldn't really be a problem as you are not really using any tabularx functionality as each table is a single column so you know its width in advance so the tabularx calculation of the width of the X column isn't needed. (in fact you don't really need a table at all) – David Carlisle May 19 '13 at 11:04
You're going to hate me in a minute. Or find this prolem intriguing. I hope the latter! Unfortunately, it's more complicated - tables can have up to four columns. Here's the PDF and Tex for another one, with no overlapping issues but gives an idea of the sorts of layouts that are common: dl.dropboxusercontent.com/u/16366/latex/… dl.dropboxusercontent.com/u/16366/latex/… – Dave Child May 19 '13 at 11:07