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've been trying and searching for quite some time, but I don't see what I'm doing wrong:

I want to create several table columns with decimal numbers (some in the format "1,25" and some like "3,156" or "12,247").

I tried:
(The vertical lines are only for seeing clearly where the columns begin and end.)

\documentclass[11pt, a4paper]{scrreprt}

\usepackage{booktabs}

\usepackage[round-mode=places, round-integer-to-decimal, round-precision=2, 
table-number-alignment=center,
round-integer-to-decimal
]{siunitx}

\begin{document}

\footnotesize

\begin{tabular}{|S| S[round-precision=4]| c }
\multicolumn{1}{c}{$A_{max}$} & \multicolumn{1}{c}{$A_{max}$} & test \\
1,2345 & 1,2345 & 1,2345\\
1,23 & 1,23 & 1,23\\
1 & 1 & 1\\
1,23456 & 1,243456 & 1,23456\\
%11,23456 & 11,23456\\

\end{tabular}

\end{document} 

I'd like the whole "number block" to be centered in the width of the column, however, in the result the decimal point seems to be the centered in the S-columns: Example Screenshot

From my understanding of the siunitx-manual, the option table-number-alignment=center should do exactly that, shouldn't it?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

When you are using table-number-alignment = center, you also need to set up the space to reserve using the table-format option. In your case, table-format = 1.4 would be appropriate.

share|improve this answer
    
thanks, Joseph! My error was: I thought that table-format = 1.2 would round the numbers to 2 digits after the decimal point, but it seems to only to define the alignment of the number in the column and the number of decimal digits has to be defined with e. g. round-precision=2 –  Martin Jul 1 '11 at 21:30
1  
@Martin: Someone recently asked more-or-less about this 'Why does table-format = ... not round?', to which the answer is that I'd prefer people to have to choose explicitly to turn on rounding. –  Joseph Wright Jul 1 '11 at 21:32
    
that's perfectly ok, I just did not expect it (maybe because I'm being used to using Microsoft Excel which does both at the same time) –  Martin Jul 1 '11 at 21:37
add comment

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.