[Tex/LaTex] How to create equally spaced columns in a table with centered number blocks, which themselves are aligned on the decimal marker

siunitxtablestabularx

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?

Best Answer

Automatic setting of table-format is not currently possible. To set up to maintain alignment, it is necessary to know how much space to reserve. This depends on all of the entries in a column, not just the current entry. Thus to set table-format automatically would require some significant change to the entire way that tables are constructed. As the S column is intended to be used with a range of LaTeX tabular-like implementations, this is not really desirable. Thus you do have to set the format on a per-column basis.