[Tex/LaTex] siunitx table with separate-uncertainty is too wide

siunitxspacingtables

I'm using a tabular environment with the siunitx type S and the package option separate-uncertainty, like in the example below. In the resulting document, the columns are too wide, and the 3rd column is half off the page. Indeed, pdflatex complains of a Overfull \hbox (185.16673pt too wide) in paragraph at lines 4--10. Apparently, LaTeX is miscalculating the width needed for each column. How can I make the columns tighter?

Minimum working example:

\documentclass{article}
\usepackage[separate-uncertainty]{siunitx}
\begin{document}
\begin{tabular}{SSS}
1.1e19        & -2.6e21       & 7.4e20 \\
9.6e20        & 2.6e21        & 6.0e20 \\
-0.497(17)    & -0.456(25)    & -0.224(41) \\
4.67(16)e22   & 7.23(41)e22   & 2.17(39)e22 \\
\end{tabular}
\end{document}

Screenshot from resulting document, which shows the 3rd column cut off:

Wrong spacing

Best Answer

You need to tell siunitx the format of the numbers you are feeding him. This is what I would do to solve your problem :

\documentclass{article}
\usepackage{booktabs}
\usepackage[separate-uncertainty]{siunitx}

\begin{document}
\begin{tabular}{
S[table-format=-1.3(3)e2, table-align-exponent = false, table-align-uncertainty = false]
S[table-format=-1.3(3)e2, table-align-exponent = false, table-align-uncertainty = false]
S[table-format=-1.3(3)e2, table-align-exponent = false, table-align-uncertainty = false]
}
    \toprule
    \multicolumn{1}{l}{First Column} & 
    \multicolumn{1}{l}{Second Column} &
    \multicolumn{1}{l}{Third Column} \\
    \midrule
    1.1e19       & -2.6e21       & 7.4e20 \\
    9.6e20       & 2.6e21        & 6.0e20 \\
    -0.497(17)   & -0.456(25)    & -0.224(41) \\
    4.67(16)e22  & 7.23(41)e22   & 2.17(39)e22 \\
    \bottomrule
\end{tabular}
\end{document}

Which results in:

enter image description here

Note that there is currently a limitation with siunitx which remove the brackets around the mantissa when a formatting is applied to a S column as stated in siunitx tabular numbers with separated uncertainty and Put brackets around value and uncertainty with exponent in tables with siunitx.