帶有 siunitx 的中心柱

帶有 siunitx 的中心柱

我有下表:

在此輸入影像描述

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

我想要的是使用 siunitx 對齊小數點標記處的數字。

然而,我得到的是這樣的:

在此輸入影像描述

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

第一列靠左對齊。知道我做錯了什麼嗎?我希望得到與範例 1 完全相同的結果,只是在小數點對齊。第二步:是否可以將箭頭放在一起?

答案1

  • 你的問題的原因似乎是使用@{\extracolsep{\fill}}
  • 您定義了三列,但只使用了兩列...
  • 我不會使用tabular*表格環境,在我看來,結果並不好
  • 作為問題的解決方案,我將列標題放入p寬度等於文字寬度一半的列中
  • 在我的 MWE 中,我刪除了所有不必要的程式碼,修復S列類型的定義並使用三部分錶包裹:
\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}

在此輸入影像描述

答案2

建立在札科的回答,這是一個變體,它也將第一列的內容相對於 對齊\rightarrow。但是,我已替換tabular*為,tabular因為表格中存在大量水平空白。我添加了一些\addlinespace命令來為表提供更多結構。

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

在此輸入影像描述

相關內容