[Tex/LaTex] How to keep tables closer

floatstables

I am finding it a bit difficult to keep the tables where I wanted them. I can't seen to make a MWE either. But the document is uploaded here.

Basically, say the

text (~\ref{}) is on page 70 and the actual table is on 84;

text (~\ref{}) is on page 71 and the actual table is on 85;

text (~\ref{}) is on page 72 and the actual table is on 86;

where

\begin{table}[!hp]

has been used at the beginning of all tables.

In all cases, the text are in \subsection{}s. The tables seem to have been flushed to the end of the whole section.

What I hope to get is, the tables are close to the text, if not the maybe on the next page. But a simple !hp is not working at all.

Best Answer

There is general advice (mostly in Will's answer) in an earlier question

However you have a specific requirement (for some reason) to avoid text page floats and only allow h and p.

That makes positioning difficult. If a float cannot go "here" (and that is usually the case as that point is too low on the page to fit in a float) then LaTeX will hold it back to make a float page. To avoid very empty pages it waits until it has at least \floatpagefraction of a page (this fraction is not ignored if you use !). By default in article this is 0.5 so at least half the page must be filled.

This means that if you have two figures with the first just less than half a page in height then in around half the cases they will not fit "here" as that point will be in the bottom half of the page. The first float cannot make a float page as the page will be too short, but the two figures will not fit on a float page if the second one is larger, or even if it is smaller but there is no room for two figures and the \floatsep gap between. This means a setting of [hp] makes it very easy to get floats that cannot be placed, and as all figures are kept in order, once one cannot be placed they are all unplaceable. They will then be held back until flushed with a \clearpage at the end of the document or section.

So with an option of [hp] you must set \floatpagefraction low enough that any sequence of floats can be placed.

Simplest is to set it really low, say to 0.01. Then no float should float more than one page; it will always be shipped out immediately. However, because floats are not held back, the float pages will only have one float per page as latex will not wait to see if the next one fits.

Related Question