Aligning numerical data
Standard alignment options in table columns are left, right, and centered. However, we may need more precise alignment options when dealing with numerical values. The most effective way to compare number magnitudes is by aligning digits at specific positions, such as 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. Adding zeroes also could lead to a wrong impression of accuracy.
In the case of fractions, it’s good to align at the decimal points directly. In this recipe, we will implement this.
How to do it...
The siunitx package is primarily intended for typesetting values with units consistently. It provides a tabular column type for aligning at decimal points as an additional benefit. We will use this now as follows:
- Load the siunitx package in your preamble:
\usepackage{siunitx}
- Use S as the column...