Summary
This lesson teaches how to turn a table or an image into a numbered element that the engine places by itself. It explains why a figure or a table floats, namely because it cannot be split across pages, and deduces from this that the text must refer to it by its number; it presents the figure and table environments, the meaning of each placement specifier, the reason why [h] becomes [ht], the price of [H] and the means of containing floats, \clearpage and \FloatBarrier; it studies the caption, with its short title, its position and its format through the caption package; it shows that babel in English prints “Figure” where many journals want “Fig.”, how to tell babel so, and what must then be corrected in cleveref; it recalls where the label goes and discovers that caption betrays a misplaced label; it typesets subfigures and independent figures side by side; it mentions rotated floats, two-column floats and text wrapped around a figure; it solves the problem of footnotes inside tables; and it gathers the typical errors with their log messages.
Learning objectives
- Explain why a figure or a table floats and predict where the engine places it according to its specifiers, including the conversion of
[h]into[ht]. - Contain floats with
\clearpage,\FloatBarrieror[H], weighing the price of each means. - Typeset captions with a number, a short title and a consistent format, above tables and below figures, with the correct spacing.
- Name figures and tables as an institution or a journal requires (“Figure” or “Fig.”), so that the caption, the list and the cleveref references agree.
- Typeset subfigures and independent figures side by side, and notes inside a table, diagnosing the typical float errors from the log.
Why they float
A line of text can end on one page and the next one begin on another; a paragraph splits harmlessly between two pages. A figure or a table, on the other hand, is an indivisible block: half of an image is not put at the bottom of one page and the other half on the next. If this is so, when a figure does not fit in what remains of the page, there are only two ways out: leave the rest of the page blank and put the figure on the next one, or go on typesetting the text and carry the figure to a place where it fits. Printing has always chosen the second, because pages with gaps look like a defect, and LaTeX adopts it: a figure or a table written in a figure or table environment is a float, which the engine removes from the flow of the text and places where it fits, at the top of this page or of a later one, at the bottom, or on a page of its own.
From this follows a rule of writing that is not optional. The author does not know where the figure will end up, and its place changes with every paragraph added before it; “the figure below” or “the following table” may be false in the final version, and often will be. The text refers to a float by its number, which keeps its meaning even if the float moves: “Figure 3 shows…”, written with the label and the reference of the lesson on cross-references. For the same reason a float always has a caption: it is the caption that gives it its number.
Loading the content…
Completed
Sign in to save your progress