我有下表:
\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
建立在Zarko 的回答,这里还有一个变体,它还将第一列的内容与对齐。但是,由于表格中有相当多的水平空白,\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}