I need to create a table which aligns the numbers in a specific format, if x is none or a digit it would look like that: (xxx, xxx) (the first xxx could also be a negative number). What I want to do is align the entries in a column by the comma and maintain the space after the comma and I don't have a clue how to do that.
I also had a look at the siunitx handbook but I couldn't figure out how to do that.
If anyone could help me, I'd be really lucky.
And here's a minimum example:
\documentclass[12pt,a4paper,titlepage]{article}
\usepackage{siunitx, booktabs}
\usepackage{rotating}
\begin{document}
\begin{sidewaystable}
\sisetup{
input-symbols = {()},
table-number-alignment = center,
table-figures-integer = 2,
parse-numbers=false,
locale = DE
}
\begin{tabular}{@{}cS[separate-uncertainty, table-figures-uncertainty = 1]ll@{}}
\multicolumn{1}{l}{} & Mean & & \\
\multicolumn{1}{l}{Lead Time} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{3} \\ \midrule
0 & (-10, 11) & (-25, 116) & (21, 240) \\
1 & (11, 252) & (22, 139) & (24, 244) \\
2 & (63, 390) & (48, 21) & (47, 27) \\
3 & (66, 790) & (68, 24) & (150, 31) \\ \bottomrule
\end{tabular}
\end{sidewaystable}
\end{document}
Best Answer
Here's a solution that (a) uses an
array
environment instead of atabular
environment -- this will generate typographically correct-
minus symbols -- and (b) spares you the tedium of having to type all those opening and closing parentheses.