Table with numbers in parentheses in siunitx

an alternative, exploited are all siunitx features:

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}[htb]   % standard record of uncertainty
\centering
\begin{tabular}{S[table-format=3.0]
                c
           *{2}{S[table-format=1.4(4)]}
                }
\toprule
{$n$} & A & {$\alpha_0$} & {$\beta_0$} \\
\midrule
100 & ML & 3.1525(3580) & 0.4773(1209) \\
200 & YW & 3.1866(3272) & 0.4593(1075) \\
300 & ML & 3.1540(2660) & 0.4834(0858) \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htb]   % separate record of uncertainty
\sisetup{separate-uncertainty} % <---
\centering
\begin{tabular}{S[table-format=3.0]
                c
           *{2}{S[table-format=1.4(4)]}
                }
\toprule
{$n$} & A & {$\alpha_0$} & {$\beta_0$} \\
\midrule
100 & ML & 3.1525(3580) & 0.4773(1209) \\
200 & YW & 3.1866(3272) & 0.4593(1075) \\
300 & ML & 3.1540(2660) & 0.4834(0858) \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here


In my case they already are. So can you please post another example when your code fails?

Just to be a little helpful I modified your code in order to have number with uncertainty in the 3rd and 4th column. I don't know what you have in the 2nd column, if they are si unit you can also explicit that.

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}
\centering
\begin{tabular}{S[table-format=3.0]cS[table-format=1.4(5)]S[table-format=1.4(5)]} \\
\toprule
{$n$} & A & {$\alpha_0$} & {$\beta_0$} \\
\midrule
100 & ML & 3.1525 \pm 0.3580 & 0.4773 \pm 0.1209 \\
200 & YW & 3.1866 \pm 0.3272 & 0.4593 \pm 0.1075 \\
300 & ML & 3.1540 \pm 0.2660 & 0.4834 \pm 0.0858 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

example_default

You could modify the way the uncertainty is displayed if you want. Personally I don't like the default style but I don't know your tastes.

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{separate-uncertainty = true}

\begin{document}
\begin{table}
\centering
\begin{tabular}{S[table-format=3.0]cS[table-format=1.4(5)]S[table-format=1.4(5)]} \\
\toprule
{$n$} & A & {$\alpha_0$} & {$\beta_0$} \\
\midrule
100 & ML & 3.1525 \pm 0.3580 & 0.4773 \pm 0.1209 \\
200 & YW & 3.1866 \pm 0.3272 & 0.4593 \pm 0.1075 \\
300 & ML & 3.1540 \pm 0.2660 & 0.4834 \pm 0.0858 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

example_separate_unc

Tags:

Tables

Siunitx