Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
You are not really giving the package enough info about your input. Does for example table-format = -2.1(1) help? –  Joseph Wright Apr 2 at 8:03
    
table-format = -2.1(1) works for column 2 where the numbers have two integer digits. Hence, I have to specify the format individually for each column if the number of integer digits divers. Would be nice to finally set the alignment using one general option. –  A. Groh Apr 2 at 10:21
2  
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 and is far too risking in LaTeX2e. –  Joseph Wright Apr 2 at 10:46

1 Answer 1

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.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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