Aligning numeric data
Standard alignment options in table columns are left, right, and centered. In cases of numeric values, this might not be sufficient. The only way to keep number magnitudes comparable is aligning digits at certain positions, such as at the ones, thousands, or millions places, or at decimal points. Integers can simply be right aligned. Numbers with decimal fractions could be filled up with zeroes to get decimal points aligned, but that would add vacuous noise.
In the case of fractions, it's good to directly align at the decimal points. In this recipe, we will implement this.
How to do it...
The siunitx
package is, first of all, intended for typesetting values with units consistently. Incidentally, supporting its primary purpose, it provides a tabular
column type for aligning at decimal points. We will use this now:
Load the
siunitx
package in your preamble:\usepackage{siunitx}
Use
S
as the column specifier for a column with alignment at decimal points, such as:\begin{tabular...