I've searched around this site and also a lot with Google, but did not find exactly a solution to my problem.
I want to create a table width equally (and automatically) spaced columns. These columns contain numerical values, which should be aligned at the decimal marker. In each column, the whole number block shall then be centered with respect to the column.
I've tried using S
columns of the siunitx
package with the table-number-alignment=center option and fideling around with table-format=n.m. However, this only works, if in all columns there occurs at least once a number having +n integers or m decimal places. Here a short example of my efforts, the vertical line are only for visualization:
\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\begin{document}
\begin{table}\small
\centering
\sisetup{
table-number-alignment = center,
table-format=+2.3
}
\begin{tabularx}{\textwidth}{
@{}c|*{7}{S|}@{}
}
\toprule
Text & aa & bb & cc & ff & gg & hh & kk \\
\midrule
Text & 1 & 0.115 & 0.086 & 1.41 & 0.23 & 0.092 & 6.82 \\
Text & -32 & 5.3 & -36 & 0.01 & 50.1 & 0.7 & -18.8 \\
\bottomrule
\end{tabularx}
\caption{Example}
\end{table}
\end{document}
Column cc
looks as it should, because it matches the +2.3 figure-format, while columns bb
or hh
look somewhat strange. I want these numbers to be centered, too. Is it possible to get the desired look using the siunitx
package?
table-format
setting on a per-column basis.