7.1 An overview of LaTeX’s float concepts

Floats are often problematic in the present version of LaTEX, because the system was developed at a time when documents contained considerably less graphical material than they do today. Placing floats (tables and figures) works relatively well as long as the space they occupy is not too large compared with the space taken up by the text. If a lot of floating material is present, however, then it is often the case that all material from a certain point onward floats to the end of the chapter or document unless you make some adjustments on the level of individual floats.

You can also try to fine-tune the float style parameters for a given document but often a combination of both configuration and local adjustments is necessary to achieve the desired typesetting results.

The present section explains the background and behavior of LaTEX’s float algorithm and explains where and how you can manipulate it to serve your needs. We start with defining the terminology and then discuss the algorithm and its configuration possibilities. The section finishes with a look at the consequences resulting from the design choices made in the algorithm and how they affect the processing of your documents.

7.1.1 LaTeX float terminology

In this section we define the terminology used throughout the present chapter.

7.1.2 Basic behavioral rules of LaTeX’s float mechanism

With this knowledge, we are now ready to delve into the algorithm’s behavior. First we have to understand that all of LaTEX’s typesetting algorithms are designed to avoid any sort of backtracking. This means that LaTEX reads through the document source, formats what it finds, and (more or less) immediately typesets it. The reasons for this design choice were to limit complexity (which is still quite high) and also to maintain reasonable speed (remember that this is from the early eighties).

For floats, this means that the algorithm is greedy; i.e., the moment it encounters a float, it immediately tries to place it and, if it succeeds, it never changes its decision. This means that it may choose a solution that could be deemed inferior in light of data received later.

For example, if a figure is allowed to go to the top or bottom area, LaTEX may decide to place this figure in the top area. If this figure is followed by two tables that are allowed to go only to the top, these tables may not fit anymore. A solution that could have worked in this case (but was not tried) would have been to place the figure in the bottom area and the two tables in the top area.

7.1.3 Consequences of the algorithm

In this section we take a look at the not so obvious consequences resulting from the design choices made in LaTEX’s float algorithm when it is used out of the box. Each time we discuss possibilities to explore if the default outcome is not serving your needs.

7.1.4 fltrace - Tracing the float algorithm

The algorithm used by LaTEX has a lot of (fairly low-level) tracing code built in, and this can be activated by loading the package fltrace. This can be of some help if the float placement you get is totally surprising.

With you get the current values of all relevant (internal) parameters used by the algorithm (so you have to do some mental translation). It also lists the floats that are already allocated to different areas of the current page and those that are deferred. The floats are denoted by their storage register name; e.g., you see names like @A, @B, and so forth.1 For example, you might see