1

I have the following table:

enter image description here

\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:

enter image description here

\begin{table}[h]
  \centering
  \caption{Transfer Entropy Results}
  \label{tab1:entropy}
  \begin{threeparttable}
\begin{tabular*}{\textwidth}{c@{\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?

  • 1
    Could you please post a complete, compilable code, not just a fragment? – Bernard Aug 13 at 19:55
4
  • 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 environment, in my opinion, the result is not nice
  • as solution to your problem I put the column headers into p columns with width equal to half the text width
  • in my MWE, I remove all unnecessary code, repair definition for S column type and use the threeparttablex package:
\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)   \\
    \addlinespace
\multirow{2}{*}{IPImicro $\rightarrow$ Bitcoin} & 0.091**   \\
                                                & (-4.710)  \\
    \addlinespace
\multirow{2}{*}{Bitcoin $\rightarrow$ IPImacro} & 0.007     \\
                                                & (-4.710)  \\
    \addlinespace
\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}

enter image description here

  • Thanks a lot! "i would not use tabular* table environment, it not gives nice result (to my opinion)" -> what gives better results in your opinion? – MANGo 92 Aug 14 at 15:35
  • @MANGo92, as I said in mine answer ;-). and than not use p{...} columns,... – Zarko Aug 14 at 15:40
  • @MANGo92, simple tabular, consequently the table is than narrower. As is show in other answer. – Zarko Aug 14 at 16:56
1

Building upon Zarko's answer, here is a variant that also aligns the contents of the first column with respect to the \rightarrow. However, I have replaced tabular* with tabular since there is a quite large amount of horizontal white space in the table. I have added some \addlinespace commands to provide more structure to the table.

\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs, multirow}
\usepackage[referable]{threeparttablex}
\usepackage{calc}

\begin{document}
\begin{table}[h]
  \centering
  \caption{Transfer Entropy Results}
  \label{tab1:entropy}
  \begin{threeparttable}
\begin{tabular}{r@{}l 
                             S[input-open-uncertainty,
                               input-close-uncertainty,
                               table-space-text-post={**},
                               table-space-text-pre={(},
                               table-format=-1.3]
                             }
    \toprule
\multicolumn{2}{c}{Causal test}     &  {Regime 1}  \\
    \midrule
\multirow{2}{*}{Bitcoin} & \multirow{2}{*}{~\(\rightarrow\)~ IPImicro}  & 0.015     \\
                                               & & (-4.71)   \\     \addlinespace
\multirow{2}{*}{IPImicro} & \multirow{2}{*}{~\(\rightarrow\)~ Bitcoin} & 0.091**   \\
                                               & & (-4.710)  \\     \addlinespace
\multirow{2}{*}{Bitcoin} & \multirow{2}{*}{~\(\rightarrow\)~ IPImacro} & 0.007     \\
                                               & & (-4.710)  \\     \addlinespace
\multirow{2}{*}{IPImacro} & \multirow{2}{*}{~\(\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}

enter image description here

  • 1
    I think you forgot to post the code.. – schtandard Aug 13 at 22:03
  • @schtandard: Added. Thanks for reminding me. – leandriis Aug 14 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.