2

I have the following table in my document

\begin{table}\centering
\begin{tabular}{llrr}
\toprule
Name & Country & Image tiles & Building geometries \\ 
\midrule 
Kalola & Tanzania & 47 & 340 \\
Mwantende & Malawi & 61  & 237 \\
Dodoma & Tanzania & 71 & 964\\ 
\bottomrule
\end{tabular}
\caption{Validation sets}  \label{tb:validation_sets}
\end{table}

In the resulting document, it takes up the entire page which looks ridiculous:

table

Just a few pages later, I have a table with the exact same structure, only more rows:

\begin{table}\centering
\begin{tabular}{llrr}
\toprule
Name & Country & Image tiles & Building geometries \\ 
\midrule 
Babati & Tanzania & 58 & 192 \\
Chunya & Tanzania & 16  & 212 \\
Idunda & Tanzania & 64 & 389\\ 
Kambikatoto & Tanzania & 39 & 921\\
Lugufu & Tanzania & 126 & 660\\ 
Lunyala & Tanzania & 30 & 390 \\
Mgandu & Tanzania & 37 & 628\\ 
Mufindi & Tanzania & 84 & 495 \\
Tunduru & Tanzania & 17 & 298\\ 
Usinga & Tanzania & 86 & 167\\ 
Chifungwe & Zambia & 57 & 168 \\
Chilubula & Zambia & 112 & 384\\ 
Mpika & Zambia & 50 & 196 \\
Dedza & Malawi & 33 & 307 \\
Kasungu & Malawi & 50 & 279\\
Mangochi & Malawi & 23 & 286 \\
\bottomrule
\end{tabular}
\caption{Test sets}  \label{tb:test_sets}
\end{table}

That one renders just as I would expect:

table2

Question: What is causing the first, smaller table to take up the whole page and what do I need to change so that it behaves like the second table?

I have looked at a similar question but the solution didn't work for me.

Thank you for any advice!

Jan Pisl
  • 155
  • 1
  • 2
  • 8
  • 3
    the vertical centering is the default layout for a float page. Why the algorithm placed that table on a float page rather than top or bottom of a text page is impossible to say with the information you have shown, it depends on the surrounding text and other pending floats. – David Carlisle Jan 26 '21 at 12:47
  • 1
    with the default settings latex only makes a float page if over half the page is taken up, it looks like that is a forced page with \clearpage but hard to guess with no code shown. – David Carlisle Jan 26 '21 at 12:52
  • 1
    You could try to move the table to another part of the document. This will influence the positioning of the table. Of course it makes sense, that the table is not too far away of the referenced part in the document. – Arne Jan 26 '21 at 13:34
  • Thanks! @DavidCarlisle there is no \clearpage anywhere nearby. Here is the entire document https://www.overleaf.com/read/wsnznwyrcvyb – Jan Pisl Jan 26 '21 at 13:44
  • 2
    @JanPisl and on line 1526 it says.... \clearpage which is exactly the point that you force this output. The "clear" in \clearpage means "clear the queue of pending floats", so any table which has not yet been found a good position is dumped into a float page to force it to appear at this point. You get what you ask for. – David Carlisle Jan 26 '21 at 14:18
  • 1
    also note the red circle with 39. after any error the PDF is not intended to be used: just a possible use for debugging so if you have errors in the document it is not a good idea to ask about the PDF output such as float placement. Tex makes no attempt at making sensible PDF output after an error. – David Carlisle Jan 26 '21 at 14:50
  • Maybe you don‘t want the tables to float at all, but then you should not place them in a floating environment. – Jasper Habicht Nov 18 '23 at 07:07

1 Answers1

3

It is not shown in the question but is clear in the link shown in comments, the following page break is a forced page break with \clearpage.

The purpose of \clearpage is to flush out all pending floats at this point before moving on to the next page, so if, as here, there are pending floats that have not yet been allocated to a position in the documents they are forced onto float pages ignoring the usual constraint that a float page should have at least half the height taken up with floats.

So you can either remove the \clearpage so allowing the float to float past this page break and be positioned at the top of the next page, or you can move the table earlier in the source, and perhaps add [!htbp] so that it can be positioned before this forced page break.

David Carlisle
  • 757,742