[Tex/LaTex] siunitx table alignment

horizontal alignmentsiunitxtables

I want to align both the numbers and the text to the left using siunitx' S column type. I tried:

\documentclass[ngerman]{scrreprt}

\usepackage{babel}    
\usepackage[locale=DE]{siunitx}    
\sisetup{separate-uncertainty}
\sisetup{multi-part-units=single}

\usepackage{booktabs}

\begin{document}

\selectlanguage{ngerman}    

\begin{tabular}{l*{2}{S[table-figures-decimal=1,
                        table-text-alignment=left,
                        table-number-alignment=left,
                        table-figures-uncertainty=1]}}
   \toprule
   A & {Column1 symbol $\Delta$} & {Column2 symbol $\delta$} \\
     & {Column1} & {Column2} \\
   \midrule
   B &  -5.0 \pm 1.0 & -10.0 \pm 2.0 \\
   C &   0.0 \pm 1.0 &   5.0 \pm 2.0 \\
   D & -20.0 \pm 1.0 & -100.0 \pm 2.0 \\
\bottomrule
\end{tabular}

\end{document}

Unfortunately the text and the minus' from the numbers are not in line. Aligning both to the right works fine.

Best Answer

Without pre-parsing all of the column content, it's not possible to know in advance how much space to allow for the content of a column. That's the reason that siunitx needs the information 'up front': parsing tables would require a massive change to underlying structures. As such, this is not implemented in siunitx and there are no plans to do so. (A 'pure' LaTeX3 table module might be different, but even then for a typesetting application you should either know in advance what the width is or have the data in some form that can be pre-processed, such as a .csv file.)

Related Question