# Tables below footnotes, is this a good output routine algorithm or a bug?

Consider the minimal code below, which produces two different layouts depending on the table position marks.

The first layout uses

\begin{table}


which results in the table ending below the footnotes and the second,

\begin{table}[htbp]


results in the table ending above the footnotes. Is this normal behaviour in LaTeX? I think a better algorithm would have been to try and position images or tables above the footnotes; is it some form of a bug? Here is the MWE.

\documentclass{book}
\usepackage[paperwidth=4.75in,paperheight=7.25in,
textwidth=4.5in,textheight=6.5in,
marginratio=1:1]{geometry}
\usepackage[latin,english]{babel}
\usepackage[demo]{graphicx}
\usepackage{booktabs,lipsum}
\begin{document}

\selectlanguage{latin}
\chapter{Errora}

Una imagine tabula, figura et \ae nigma.\footnote{translatio via google}.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.3\textwidth]{./graphics/amato}
\caption{Uno pictorum}
\end{figure}
\begin{table}%[htbp] %uncomment to see difference
\centering
\begin{tabular}{cccc}
\toprule
Error &Errors &error &errors\\
\bottomrule
\end{tabular}
\caption{Test}
\end{table}
%\lipsum[1-3]
\end{document}


Edit:

I had a look at the documentation of the footmisc recommended by Thorsten Donig as a workaround where Robin Fairbairns describes this behaviour as an "infelicity". There is a further infelicity, if you let both floats to float freely, the table floats to the next page and the image goes in the footer area, while there is ample space to have stayed exactly in its position in the text.

-
Perhaps it would be a good idea to provide the complete code used to generate those pages? –  Roelof Spijker Oct 28 '11 at 7:53
@wh1t3 Sorry, forgot to copy it:) –  Yiannis Lazarides Oct 28 '11 at 7:54
It's not a bug, but a feature. A table doesn't belong to the page in the same way as footnotes do and footnotes below the bottom float can be hard to see, or mistaken as footnotes to the float. However, I would not use bottom floats when there are also footnotes. –  egreg Oct 28 '11 at 16:22
@egreg Robin Fairbairns in the footmisc package describes this behaviour as an "infelicity". If you comment the figure positioning marks the figure floats below the footnotes and the table floats onto the next page, whereas there is ample space to have positioned in the here position. That is why I am querying the algorithm. Can you please have a second look? –  Yiannis Lazarides Oct 28 '11 at 18:10
The default positioning argument of the standard classes is [tbp]; so LaTeX will never try h if it's not specified in the optional argument. In this case, the figure cannot go t (it's a chapter starting page) but it can go b and, of course, the table cannot go there any more, because the space for floats at the bottom is 3/10 of the page height. To avoid bottom floats altogether and allowing default h placement, do \renewcommand*\fps@figure{htp} and similarly for \fps@table. –  egreg Oct 28 '11 at 21:46
show 1 more comment

The normal output routine performed by LaTeX typesets footnotes above bottom floats: the rationale is that bottom floats don't belong to the type block on the same degree that footnotes do. Somebody finds this infelicitous and so the package footmisc provides the bottom option.

My opinion is that bottom floats should be avoided on pages that also have footnotes: the reader will be confused by two competing objects at the bottom, whatever is their order.

This poses a problem, though: the default positioning argument for floats is, in the standard classes (and also for memoir and the AMS classes) is [tbp]. In other words, when a user types \begin{figure} without providing placement options, h placement will never be tried, but b will.

In your example, without the options to the floating environments you'll have this result:

• the placement t for the figure and the table will not be tried, because we're in a chapter's starting page;

• the b placement for the figure will be accepted, if the figure doesn't exceed the \bottomfraction: bottom floats can't occupy more than \bottomfraction of a page (default 3/10);

• even if the figure is put at the bottom, the table won't, because only \bottomnumber floats are accepted at the bottom (default 1), pushing the table on the next page.

There is a way out: redefine \fps@figure and \fps@table to a value more suitable to your needs, for example

\makeatletter
\renewcommand{\fps@figure}{htp}
\renewcommand{\fps@table}{htp}
\makeatother


and try with explicit placement options only at the final stage of production, when deciding about the fine details of pagination.

-
Thanks for all your comments and this fine explanation. –  Yiannis Lazarides Oct 29 '11 at 11:22

You can fix this by the footmisc package.

\usepackage[bottom]{footmisc}

-
Thanks for providing a workaround. However, I am asking the correctness or not of the default behaviour. –  Yiannis Lazarides Oct 28 '11 at 18:24
1. To answer the question: It is a "feature" (see answer of egreg).
2. If I read your question right, you are not completely happy with this. Following the "overkill rule", I therefore give an answer about changing that "feature":

Generally, when floats go to places where one does not want them to go, instead of e.g. [htbp] as float specifier, one can also use [h], [h!], [H] from the float package:

giving floating environments a [H] option which means 'PUT IT HERE' (as opposed to the standard [h] option which means 'You may put it here if you like')

, or command \FloatBarrier from the picins package.

In case of tables or figures being placed below footnotes, also the stfloats (formerly stkernel) package from the sttools bundle can remedy this "feature" with command \fnbelowfloat:

\usepackage{stfloats}
\fnbelowfloat % puts footnotes below the bottom floats


as well as the footmisc package with option bottom (see answer of Thorsten Donig):

\usepackage[bottom]{footmisc}

-
The question at hand is about the default placement of "bottom" (b) floats below footnotes, not the positioning of footnotes in general. –  lockstep Oct 28 '11 at 18:16
@Stephen Please read the question again and my edit, especially asking if it is a bug or a bad algo. egreg thinks is a feature. –  Yiannis Lazarides Oct 28 '11 at 18:23
IMO, your answer was indeed "too much away from the problem". –  lockstep Oct 28 '11 at 18:31
@Stephen I don't have a problem with it and I agree with a bit of overkill if the question is answered as well. Once the poster realizes he did not answer the specific question, he has the opportunity to edit his post a bit. –  Yiannis Lazarides Oct 28 '11 at 18:36