Center columns with siunitx

by MANGo 92   Last Updated August 13, 2019 20:23 PM

I have the following table:

\begin{table}[h]
\centering
\caption{Transfer Entropy Results}
\label{tab1:entropy}
\begin{threeparttable}
\begin{tabularx}{\textwidth}{CC}
\toprule
Causal test & Results  \\
\midrule
\multicolumn{1}{c}{\multirow{2}[1]{*}{Bitcoin $\rightarrow$ IPImicro}} & 0.015 \\
& (-0.023) \\
\multicolumn{1}{c}{\multirow{2}[0]{*}{IPImicro $\rightarrow$ Bitcoin }} & 0.091** \\
& (-0.027) \\
\multicolumn{1}{c}{\multirow{2}[0]{*}{Bitcoin $\rightarrow$ IPImacro}} & 0.007 \\
& (-0.028) \\
\multicolumn{1}{c}{\multirow{2}[1]{*}{IPImacro $\rightarrow$ Bitcoin }} & 0.073** \\
& (-0.025) \\

\bottomrule
\end{tabularx}
\begin{tablenotes}[para,flushleft]
\footnotesize
\item\hspace{-2.5pt}\noindent\textit{Note:} This table presents the Transfer Entropy estimation results. Standard deviation in parentheses; *** p < 0.01; ** p < 0.05; * p < 0.10.
\end{tablenotes}
\end{threeparttable}
\end{table}


What I want is to allign the numbers at the decimal marker using siunitx.

However, what I get is this:

\begin{table}[h]
\centering
\caption{Transfer Entropy Results}
\label{tab1:entropy}
\begin{threeparttable}
\begin{tabular*}{\textwidth}{[email protected]{\extracolsep{\fill}}*{2}{S}}
\toprule
\multicolumn{1}{c}{Causal test} &  \multicolumn{1}{c}{Regime 1} \\
\midrule
\multicolumn{1}{c}{\multirow{2}[1]{*}{Bitcoin $\rightarrow$ IPImicro}} & 0.015 \\
& {(}-4.710{)} \\
\multicolumn{1}{c}{\multirow{2}[0]{*}{IPImicro $\rightarrow$ Bitcoin }} & 0.091** \\
& {(}-4.710{)} \\
\multicolumn{1}{c}{\multirow{2}[0]{*}{Bitcoin $\rightarrow$ IPImacro}} & 0.007 \\
& {(}-4.710{)} \\
\multicolumn{1}{c}{\multirow{2}[1]{*}{IPImacro $\rightarrow$ Bitcoin }} & 0.073** \\
& {(}-4.710{)} \\

\bottomrule
\end{tabular*}
\begin{tablenotes}[para,flushleft]
\footnotesize
\item\hspace{-2.5pt}\noindent\textit{Note:} This table presents the Transfer Entropy estimation results.  Standard deviation in parentheses; *** p < 0.01; ** p < 0.05; * p < 0.10.
\end{tablenotes}
\end{threeparttable}
\end{table}


The first column is alligned to the left. Any idea what I am doing wrong? I would like to get the exact same result as in example 1, just alligned at the decimal marker. In second step: Is it even possible to have the arrows below each other?

Tags :

• cause of your problem seems to be use of @{\extracolsep{\fill}}
• you define three columns, but use only two ...
• i would not use tabular* table is not nice ...
• as solution (to your problem) can be put column headers into p columns with width equal to half of text width
• in my MWE I remove all unnecessary code and repair definition for S column type:
\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs, multirow}
\usepackage[referable]{threeparttablex}

\begin{document}
\begin{table}[h]
\centering
\caption{Transfer Entropy Results}
\label{tab1:entropy}
\begin{threeparttable}
\begin{tabular*}{\textwidth}{c
S[input-open-uncertainty,
input-close-uncertainty,
table-space-text-pre=(,
table-space-text-post={**},
table-align-text-post=false,
table-format=-1.3]
}
\toprule
\multicolumn{1}{>{\centering}p{0.5\linewidth}}{Causal test}
&  \multicolumn{1}{>{\centering\arraybackslash}p{0.5\linewidth}}{Regime 1}  \\
\midrule
\multirow{2}{*}{Bitcoin $\rightarrow$ IPImicro} & 0.015     \\
& (-4.71)   \\
\multirow{2}{*}{IPImicro $\rightarrow$ Bitcoin} & 0.091**   \\
& (-4.710)  \\
\multirow{2}{*}{Bitcoin $\rightarrow$ IPImacro} & 0.007     \\
& (-4.710)  \\
\multirow{2}{*}{IPImacro $\rightarrow$ Bitcoin} & 0.073**   \\
& (-4.710)  \\
\bottomrule
\end{tabular*}
\begin{tablenotes}[para,flushleft]\footnotesize
\note: This table presents the Transfer Entropy estimation results.
Standard deviation in parentheses.
\item[***] $p < 0.01$;
\item[**]  $p < 0.05$;
\item[*]   $p < 0.10$.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}


Zarko
August 13, 2019 20:11 PM