Skip to content
Topos Uranos

Summary

This lesson teaches how to typeset tables that read effortlessly. It pins down what a table is, a text read by rows and by columns, and when it is preferable to a list or a figure; it presents the tabular environment, with the column letters l, c, r and p{width}, the sign & between cells and \\ at the end of each row; it shows the grid of vertical lines and \hline and explains why it hinders reading; it presents the rules of booktabs, \toprule, \midrule, \bottomrule, \cmidrule with its trims and \addlinespace, together with the conventions of professional tables; it aligns figures on the right or on the decimal marker with the S column of siunitx and removes the side padding with @{}; it places the units in the headings, breaks long headings with \makecell and sets text in paragraph columns with \raggedright and \arraybackslash; it compares \arraystretch and \tabcolsep with the spacing of booktabs; and it reads the real logs of the most frequent errors, including those that produce no warning at all.

Learning objectives

  1. Decide whether a set of data is presented as a table, a list or a figure, and justify the decision by the way the reader will consult it.
  2. Typeset a table with tabular, choosing for each column the letter that suits its content, and predict what a given source produces.
  3. Rebuild a grid table with the rules of booktabs, without vertical or double lines and with the units in the headings.
  4. Align columns of figures on the decimal marker with siunitx, setting a table-format suited to the data, and foresee what happens when a value does not fit in it.
  5. Diagnose, from the log or from the output, the typical errors of a table, and recognize those that compile without a warning.

What a table is

A table is a text that is read in two directions. Each row gathers what is known about one object (a chemical element, a country, a year); each column gathers one property of all of them (the mass, the population, the price). The reader seldom reads it whole: they look for a row, run down a column, compare two neighbouring figures. From this follows the criterion by which a table is judged: it is good if it lets the reader find a value and compare it with its neighbours without the eye stumbling over anything that is not information.

If this is so, the table is not the natural form of every set of data. When the data have a single dimension (a series of steps, a list of requirements), the suitable form is a list, which is read from top to bottom and needs no columns. When what matters is not each value but the shape of the whole (a trend, a maximum, the relation between two quantities), the suitable form is a figure, because the eye grasps a slope at a glance and would deduce it laboriously from a column of numbers. The table is preferable when the reader needs the values themselves, with their digits, and when the data cross in two entries.

In this lesson tables stand loose in the text, as one more block, or centred with the center environment. In the lesson devoted to figures and floating tables they will receive a caption, a number and a place in the list of tables; what is learned here is the composition of their interior, which does not change.