![如何在该表中创建相等的列宽?](https://linux22.com/image/415206/%E5%A6%82%E4%BD%95%E5%9C%A8%E8%AF%A5%E8%A1%A8%E4%B8%AD%E5%88%9B%E5%BB%BA%E7%9B%B8%E7%AD%89%E7%9A%84%E5%88%97%E5%AE%BD%EF%BC%9F.png)
我正在用 latex 制作回归输出表。但是,由于重要性,使用\multicolumn
latex 的下标将所有额外的宽度放在最后一列。我希望列宽相同,我该怎么做?
这是我的代码:
\begin{table}[htbp]\centering
\caption{AEX, daily, from 01-01-2020}
\begin{tabular}{>{\centering\arraybackslash} c c c c}
\toprule
\textbf{Variable} & \textbf{Model 1} & \textbf{Model 2} & \textbf{Model 3}\\
\midrule
$b_1$ & -0.012 & -0.052 & -0.156** \\
& (0.04) & (0.06) & (0.06) \\
$b_2$ & & 0.034 & 0.097* \\
& & (0.05) & (0.04) \\
$\beta$ & & & 0.439***\\
& & & (0.06) \\
$\omega$ & 0.529***& 0.530***& 0.518***\\
& (0.03) & (0.03) & (0.02) \\
$\delta$ & 0.529***& 0.530***& 0.518***\\
& (0.03) & (0.03) & (0.02) \\
\midrule
AIC & 196 & 196 & 196 \\
BIC & 0.001 & 0.003 & 0.235 \\
\midrule[\heavyrulewidth]
\addlinespace[1ex]
\multicolumn{4}{p{\dimexpr\textwidth-2\tabcolsep\relax}}{\textsuperscript{***},
\textsuperscript{**},
\textsuperscript{*} denote significance at the 1\%, 5\% and 10\% level, respectively. Standard errors are denoted in brackets.}
\end{tabular}
\end{table}
答案1
以下是表格的两个版本:
\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{threeparttable} % for second example
\begin{document}
\begin{table}[htbp]
\caption{AEX, daily, from 01-01-2020}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} c c c c}
\toprule
\textbf{Variable} & \textbf{Model 1} & \textbf{Model 2} & \textbf{Model 3}\\
\midrule
$b_1$ & -0.012 & -0.052 & -0.156** \\
& (0.04) & (0.06) & (0.06) \\
$b_2$ & & 0.034 & 0.097* \\
& & (0.05) & (0.04) \\
$\beta$ & & & 0.439***\\
& & & (0.06) \\
$\omega$ & 0.529***& 0.530***& 0.518***\\
& (0.03) & (0.03) & (0.02) \\
$\delta$ & 0.529***& 0.530***& 0.518***\\
& (0.03) & (0.03) & (0.02) \\
\midrule
AIC & 196 & 196 & 196 \\
BIC & 0.001 & 0.003 & 0.235 \\
\midrule[\heavyrulewidth]
\end{tabular*}
\textsuperscript{***},
\textsuperscript{**},
\textsuperscript{*} denote significance at the 1\%, 5\% and 10\% level, respectively. Standard errors are denoted in brackets.
\end{table}
\begin{table}[htbp]
\centering
\begin{threeparttable}
\caption{AEX, daily, from 01-01-2020}
\begin{tabular}{ c c c c}
\toprule
\textbf{Variable} & \textbf{Model 1} & \textbf{Model 2} & \textbf{Model 3}\\
\midrule
$b_1$ & -0.012 & -0.052 & -0.156** \\
& (0.04) & (0.06) & (0.06) \\
$b_2$ & & 0.034 & 0.097* \\
& & (0.05) & (0.04) \\
$\beta$ & & & 0.439***\\
& & & (0.06) \\
$\omega$ & 0.529***& 0.530***& 0.518***\\
& (0.03) & (0.03) & (0.02) \\
$\delta$ & 0.529***& 0.530***& 0.518***\\
& (0.03) & (0.03) & (0.02) \\
\midrule
AIC & 196 & 196 & 196 \\
BIC & 0.001 & 0.003 & 0.235 \\
\midrule[\heavyrulewidth]
\end{tabular}
\begin{tablenotes}[flushleft]
\item[] \textsuperscript{***}, \textsuperscript{**}, \textsuperscript{*} denote significance at the 1\%, 5\% and 10\% level, respectively. Standard errors are denoted in brackets.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
答案2
除了将表格脚注材料的宽度固定为环境宽度tabular
(这一目标可以通过使用包的机制轻松实现)之外threeparttable
,您还应该将三个数据列中的数字与各自的小数点对齐。我建议您使用包dcolumn
的机制来实现您的第二个目标。
\documentclass{article}
\usepackage{array,booktabs,dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\sym[1]{^{#1}}
\usepackage[flushleft]{threeparttable}
\begin{document}
\begin{table}[htbp]
\centering
\begin{threeparttable}
\caption{AEX, daily, from 01-01-2020}
\begin{tabular}{@{} l *{3}{d{2.5}} @{}}
\toprule
Variable &
\mc{Model 1} &
\mc{Model 2} &
\mc{Model 3} \\
\midrule
$b_1$ &-0.012 & -0.052 &-0.156\sym{**} \\
&(0.04) & (0.06) &(0.06) \\
$b_2$ & & 0.034 & 0.097\sym{*} \\
& & (0.05) &(0.04) \\
$\beta$ & & & 0.439\sym{***}\\
& & &(0.06) \\
$\omega$& 0.529\sym{***}& 0.530\sym{***}& 0.518\sym{***}\\
&(0.03) &(0.03) &(0.02) \\
$\delta$& 0.529\sym{***}& 0.530\sym{***}& 0.518\sym{***}\\
&(0.03) &(0.03) &(0.02) \\
\midrule
AIC & \mc{196} & \mc{196} & \mc{196} \\
BIC & 0.001 & 0.003 & 0.235 \\
\bottomrule
\end{tabular}
\smallskip
\footnotesize\raggedright
\begin{tablenotes}
\item[]Standard errors are shown in parentheses. $\sym{***}$, $\sym{**}$, and $\sym{*}$ denote significance at the 1\%, 5\%, and 10\% levels, respectively.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
答案3
附带threeparttable
包装siunitx
:
\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs, threeparttable}
\begin{document}
\begin{table}[ht]
\centering
\sisetup{table-space-text-pre={(},
table-align-text-pre=false,
table-space-text-post={$^{***}$},
table-align-text-post=false,
input-open-uncertainty = ,
input-close-uncertainty = ,
table-format=-1.3
}
\begin{threeparttable}
\caption{AEX, daily, from 01-01-2020}
\label{tab:3parttable}
\begin{tabular}{ >{$}c<{$} SSS}
\toprule
\textbf{Variable} & \textbf{Model 1} & \textbf{Model 2} & \textbf{Model 3}\\
\midrule
b_1 & -0.012 & -0.052 & -0.156\tnote{**} \\
& (0.04) & (0.06) & (0.06) \\
b_2 & & 0.034 & 0.097\tnote{*} \\
& & (0.05) & (0.04) \\
\beta & & & 0.439\tnote{***} \\
& & & (0.06) \\
\omega & 0.529\tnote{***} & 0.530\tnote{***} & 0.518\tnote{***} \\
& (0.03) & (0.03) & (0.02) \\
\delta & 0.529\tnote{***} & 0.530\tnote{***} & 0.518\tnote{***} \\
& (0.03) & (0.03) & (0.02) \\
\midrule
AIC & {196} & {196} & {196} \\
BIC & 0.001 & 0.003 & 0.235 \\
\midrule[\heavyrulewidth]
\end{tabular}
\begin{tablenotes}[para]\footnotesize
\item[*], \item[**]\ and \item[***]\ denote significance at the \SI{1}{\%}, \SI{5}{\%} and \SI{10}{\%}, respectively. Standard errors are denoted in brackets.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}