# Align table entries with s-columns

I'm looking to create a table in which I align the entries by the dot. For the first column of entry values, this alignment takes place nicely. However, for the second column, the negative value surrounded by square-brackets is shifted so that the dots do not align. Any suggestions how to solve this?

\begin{table}[htbp!]
\centering
\begin{tabular}{*{1}{l}*{3}{S[table-format=1.2]}}
\toprule
\toprule
& {$\alpha$} & {$\beta$} & {$R^{2}$}\\
\midrule
Credit Spread & 0.00  & 0.13  & 0.00\\
&\hbox{[$0.26$]}  & \hbox{[$-5.56$]}  & \\

\bottomrule
\end{tabular}
\end{table}

• Welcome to TeX.SX! Why are you using these hboxes? To disable the effects of the S column? – TeXnician Aug 29 '18 at 11:20
• (1) welcome, (2) it is custom here to post full minimal examples, not sniplets like this. Full minimal examples can then be copied as is and tested. (3) Why are you using those \hbox in the first place? They of course messes things us and the S parser cannot see the dot. Can you explain what exactly you are trying to do? I've never seen that syntax before. – daleif Aug 29 '18 at 11:21

Here is what I'm assuming you are trying to do

\documentclass[a4paper]{memoir}

\usepackage{siunitx}

\begin{document}

\begin{table}[htbp!]
\centering

\sisetup{
parse-numbers=false,
}

\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\begin{tabular}{
l
S[table-format=2.3] % space for []'s
S[table-format=-2.3] %
S[table-format=1.3] %
}
\toprule
& \mc{$\alpha$} & \mc{$\beta$} & \mc{$R^{2}$}
\\
\midrule
Credit Spread & 0.00       & 0.13      & 0.00
\\
& [0.26]     & [-5.56]   &
\\

\bottomrule
\end{tabular}
\end{table}

\end{document}


You need to reserve space for the brackets:

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

\begin{document}

\begin{table}[htp]
\centering

\caption{Whatever}

\sisetup{
table-space-text-pre=[,
table-space-text-post=],
}

\begin{tabular}{
l
S[table-format=1.2]
S[table-format=-1.2]
S[table-format=1.2]
}
\toprule
& {$\alpha$} & {$\beta$} & {$R^{2}$}\\
\midrule
Credit Spread &  0.00  &   0.13  & 0.00 \\
& [0.26] & [-5.56] &      \\
\bottomrule
\end{tabular}

\end{table}

\end{document}