10

Using the siunitx package

\usepackage{siunitx}

Consider the following two tables:

1.

\begin{tabular}{
  S[table-number-alignment=center, table-figures-decimal=3, table-auto-round]
}
  3.23958398 \\
\end{tabular}

% => 3.234

2.

\begin{tabular}{
  S[table-figures-decimal=3, table-auto-round]
}
  3.23958398 \\
\end{tabular}

% => 3.23958398

In the former, the number gets rounded, but in the latter it does not. Ran under both pdflatex and xelatex. Can anyone explain?

11

In the second case, you have not set the table-number-alignment key, which will therefore take the default value center-decimal-marker. The later does not reserve space in the table for numbers of a particular size, and so table-auto-round does not apply.

The entire reason that center-decimal-marker is the default is precisely because it does not require any information about the size of the number in order to carry out alignment without any overfull boxes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.