我得到了这个结果。整列的数字按小数点对齐,但我希望最后三行“观测值”、“对数相似度”、“卡方”中的数字也按小数点对齐,但不与它们上方的行对齐。此外,有没有办法强制将脚注大小的文本设置为纸张大小?非常感谢!
\documentclass[a4paper, 11pt]{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{ltablex}
\usepackage{dcolumn}
\usepackage{siunitx}
\usepackage{multirow}
\usepackage{makecell}
\begin{document}
\begin{table}[htbp]\centering
\small
\sisetup{input-symbols = {()},
table-space-text-post=*** ,
table-align-text-post=false}
\renewcommand{\arraystretch}{0.7}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\setlength\tabcolsep{0pt}
\caption{Demographic Factors for SR1 (Pooled Sample) \label{tab:pooledsr1}}
\begin{tabular*}{\linewidth}{@{\hspace{6pt}\extracolsep{\fill}}
l
S[table-format=-1.5]
*{5}{S[table-format=-2.3]
}
@{}}
\toprule
\makecell{Dependent Variable}&\multicolumn{1}{c}{SR1dummy}&\multicolumn{5}{c}{SR1}\\
\cmidrule(l){1-1} \cmidrule{2-2} \cmidrule(l){3-7}
Model&\multicolumn{1}{c}{Probit}&\multicolumn{3}{c}{Tobit}&\multicolumn{1}{c}{Cragg's}&\multicolumn{1}{c}{Heckman}\\
\cmidrule(lr){3-5}
& &\multicolumn{1}{c}{Latent}&\multicolumn{1}{c}{Censored}&\multicolumn{1}{c}{Truncated} \\
\midrule
LnInc & 0.254\sym{***}& 29.56\sym{***}& 20.57\sym{***}& 14.47\sym{***}& 14.89\sym{***}& 14.35\sym{***}\\
& (0.00521) & (0.628) & (0.406) & (0.287) & (0.514) & (0.661) \\
\addlinespace
Age & 0.00448 & 0.472\sym{*} & 0.328\sym{*} & 0.231\sym{*} & 0.155 & 0.162 \\
& (0.00287) & (0.259) & (0.180) & (0.127) & (0.194) & (0.157) \\
\addlinespace
Kid & 0.0347\sym{***}& 2.180\sym{**} & 1.517\sym{**} & 1.067\sym{**} & -0.685 & -0.150 \\
& (0.0105) & (0.988) & (0.687) & (0.483) & (0.774) & (0.623) \\
\addlinespace
Old & 0.0266\sym{**} & 1.158 & 0.806 & 0.567 & -0.854 & -0.420 \\
& (0.0126) & (1.167) & (0.812) & (0.571) & (0.901) & (0.719) \\
\addlinespace
HHsize & -0.0430\sym{***}& -3.580\sym{***}& -2.491\sym{***}& -1.753\sym{***}& -0.578 & -0.883\sym{**} \\
& (0.00623) & (0.577) & (0.401) & (0.282) & (0.440) & (0.374) \\
\addlinespace
Male & 0.00322 & 1.366 & 0.951 & 0.669 & 1.692\sym{*} & 1.366\sym{*} \\
& (0.0131) & (1.196) & (0.832) & (0.586) & (0.912) & (0.726) \\
\addlinespace
Married & -0.0585\sym{***}& -8.688\sym{***}& -6.045\sym{***}& -4.253\sym{***}& -6.431\sym{***}& -5.727\sym{***}\\
& (0.0222) & (2.006) & (1.396) & (0.982) & (1.505) & (1.206) \\
\addlinespace
Party & -0.0324\sym{*} & -2.104 & -1.464 & -1.030 & 0.0964 & -0.254 \\
& (0.0175) & (1.542) & (1.073) & (0.755) & (1.127) & (0.917) \\
\addlinespace
Job & 0.0803\sym{***}& 10.61\sym{***}& 7.380\sym{***}& 5.192\sym{***}& 6.184\sym{***}& 5.624\sym{***}\\
& (0.0158) & (1.503) & (1.044) & (0.734) & (1.197) & (0.948) \\
\addlinespace
House & -0.0286 & -4.952\sym{***}& -3.445\sym{***}& -2.424\sym{***}& -4.829\sym{***}& -4.087\sym{***}\\
& (0.0209) & (1.917) & (1.334) & (0.938) & (1.464) & (1.174) \\
\addlinespace
Age 30-34 & -0.0998\sym{***}& -7.547\sym{***}& -5.251\sym{***}& -3.694\sym{***}& -0.0971 & -1.095 \\
& (0.0323) & (2.880) & (2.003) & (1.410) & (2.136) & (1.757) \\
\addlinespace
Age 35-39 & -0.0873\sym{**} & -9.292\sym{***}& -6.465\sym{***}& -4.549\sym{***}& -3.322 & -3.478 \\
& (0.0396) & (3.532) & (2.457) & (1.729) & (2.627) & (2.120) \\
\addlinespace
Age 40-44 & -0.117\sym{**} & -13.26\sym{***}& -9.224\sym{***}& -6.490\sym{***}& -5.429\sym{*} & -5.348\sym{**} \\
& (0.0491) & (4.416) & (3.073) & (2.162) & (3.293) & (2.665) \\
\addlinespace
Age 45-49 & -0.111\sym{*} & -10.86\sym{*} & -7.558\sym{*} & -5.318\sym{*} & -2.888 & -3.287 \\
& (0.0623) & (5.610) & (3.904) & (2.746) & (4.185) & (3.387) \\
\addlinespace
Age 50-59 & -0.0563 & -2.961 & -2.060 & -1.449 & 2.488 & 1.620 \\
& (0.0820) & (7.395) & (5.146) & (3.620) & (5.522) & (4.456) \\
\midrule
Observations & 5446 & 5446 & 5446 & 5446 & 3395 & 5446 \\
Log lik. & -2632.3 & -18083.2 & -18083.2 & -18083.2 & -15061.6 & \\
Chi-squared & 1950.0 & 2815.1 & 2815.1 & 2815.1 & 998.9 & 315.4 \\
\bottomrule
\multicolumn{7}{l}{\footnotesize Standard errors in parentheses; The marginal effects in the Tobit model for latent, censored, and truncated dependent variables are listed together; provincial fixed effects controlled}\\
\multicolumn{7}{l}{\footnotesize \sym{*} \(p<0.1\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)}\\
\end{tabular*}
\end{table}
\end{document}
答案1
一些建议和意见:
由于最后三行的数字与前面的内容或彼此之间没有关联,因此将这些数字按小数对齐没有什么意义。事实上,按小数对齐数字可能会造成错误的印象,让人觉得这些数字在某种程度上是相关的。我只会将它们居中。
我会在这里使用包装内的机器
dcolumn
;使用包装内的设施siunitx
感觉有点小题大做。在任何情况下都不应使用指令
\renewcommand{\arraystretch}{0.7}
。如果表格不适合页面,请切换到longtable
环境。
\documentclass[a4paper, 11pt]{article}
\usepackage{tabularx,booktabs,dcolumn,makecell}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{@{}c@{}}{#1}} % handy shortcut macro
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{document}
\begin{table}
\small
\setlength\tabcolsep{3pt}
\caption{Demographic Factors for SR1 (Pooled Sample)}
\label{tab:pooledsr1}
\begin{tabular}{@{}l *{5}{d{2.6}} d{2.5} @{}}
\toprule
\makecell{Dependent\\ Variable} &\mc{\makecell{SR1\\dummy}} & \multicolumn{5}{c}{SR1}\\
\cmidrule{3-7}
Model
&\mc{Probit} &\multicolumn{3}{c}{Tobit} &\mc{Cragg's} &\mc{Heckman}\\
\cmidrule{3-5}
&& \mc{Latent}&\mc{Censored}&\mc{Trunc.} \\
\midrule
LnInc & 0.254\sym{***}& 29.56\sym{***}& 20.57\sym{***}& 14.47\sym{***}& 14.89\sym{***}& 14.35\sym{***}\\
& (0.00521) & (0.628) & (0.406) & (0.287) & (0.514) & (0.661) \\
\addlinespace
Age & 0.00448 & 0.472\sym{*}& 0.328\sym{*} & 0.231\sym{*} & 0.155 & 0.162 \\
& (0.00287) & (0.259) & (0.180) & (0.127) & (0.194) & (0.157) \\
\addlinespace
Kid & 0.0347\sym{***}& 2.180\sym{**} & 1.517\sym{**} & 1.067\sym{**} & -0.685 & -0.150 \\
&(0.0105) & (0.988) & (0.687) & (0.483) & (0.774) & (0.623) \\
\addlinespace
Old & 0.0266\sym{**} & 1.158 & 0.806 & 0.567 & -0.854 & -0.420 \\
&(0.0126) & (1.167) & (0.812) & (0.571) & (0.901) & (0.719) \\
\addlinespace
HHsize & -0.0430\sym{***}&-3.580\sym{***}&-2.491\sym{***}&-1.753\sym{***}& -0.578 & -0.883\sym{**} \\
& (0.00623) & (0.577) & (0.401) & (0.282) & (0.440) & (0.374) \\
\addlinespace
Male & 0.00322 & 1.366 & 0.951 & 0.669 & 1.692\sym{*}& 1.366\sym{*} \\
&(0.0131) & (1.196) & (0.832) & (0.586) & (0.912) & (0.726) \\
\addlinespace
Married & -0.0585\sym{***}&-8.688\sym{***}&-6.045\sym{***}&-4.253\sym{***}&-6.431\sym{***}&-5.727\sym{***}\\
&(0.0222) & (2.006) & (1.396) & (0.982) & (1.505) & (1.206) \\
\addlinespace
Party & -0.0324\sym{*} & -2.104 & -1.464 & -1.030 & 0.0964 & -0.254 \\
&(0.0175) & (1.542) & (1.073) & (0.755) & (1.127) & (0.917) \\
\addlinespace
Job & 0.0803\sym{***}& 10.61\sym{***}& 7.380\sym{***}& 5.192\sym{***}& 6.184\sym{***}& 5.624\sym{***}\\
&(0.0158) & (1.503) & (1.044) & (0.734) & (1.197) & (0.948) \\
\addlinespace
House & -0.0286 &-4.952\sym{***}&-3.445\sym{***}&-2.424\sym{***}&-4.829\sym{***}&-4.087\sym{***}\\
&(0.0209) & (1.917) & (1.334) & (0.938) & (1.464) & (1.174) \\
\addlinespace
Age 30--34&-0.0998\sym{***} &-7.547\sym{***}&-5.251\sym{***}&-3.694\sym{***}&-0.0971 & -1.095 \\
&(0.0323) & (2.880) & (2.003) & (1.410) & (2.136) & (1.757) \\
\addlinespace
Age 35--39 & -0.0873\sym{**}&-9.292\sym{***}&-6.465\sym{***}&-4.549\sym{***}&-3.322 & -3.478 \\
&(0.0396) & (3.532) & (2.457) & (1.729) & (2.627) & (2.120) \\
\addlinespace
Age 40--44 & -0.117\sym{**}&-13.26\sym{***}&-9.224\sym{***}&-6.490\sym{***}&-5.429\sym{*} &-5.348\sym{**} \\
&(0.0491) & (4.416) & (3.073) & (2.162) & (3.293) & (2.665) \\
\addlinespace
Age 45--49 & -0.111\sym{*} &-10.86\sym{*} &-7.558\sym{*} &-5.318\sym{*} & -2.888 & -3.287 \\
&(0.0623) & (5.610) & (3.904) & (2.746) & (4.185) & (3.387) \\
\addlinespace
Age 50--59 & -0.0563 & -2.961 & -2.060 & -1.449 & 2.488 & 1.620 \\
&(0.0820) & (7.395) & (5.146) & (3.620) & (5.522) & (4.456) \\
\midrule
Observations & \mc{5446} & \mc{5446} & \mc{5446} & \mc{5446} & \mc{3395} & \mc{5446} \\
Log lik. & \mc{$-2632.3$} & \mc{$-18083.2$}& \mc{$-18083.2$} & \mc{$-18083.2$}& \mc{$-15061.6$}& \\
Chi-squared & \mc{1950.0} & \mc{2815.1} & \mc{2815.1} & \mc{2815.1} & \mc{998.9} & \mc{315.4} \\
\bottomrule
\addlinespace
\multicolumn{7}{@{}p{\textwidth}@{}}{\footnotesize Standard errors in parentheses; The marginal
effects in the Tobit model for latent, censored, and truncated dependent variables are listed
together; provincial fixed effects controlled.}\\
\multicolumn{7}{l}{\footnotesize \sym{*} \(p<0.1\); \sym{**} \(p<0.05\); \sym{***} \(p<0.01\).}\\
\end{tabular}
\end{table}
\end{document}
答案2
编辑
- 对于表格最后三行的不同列格式,您需要将表格分成两部分,并为每个部分确定列参数
- 为了保持列分布均匀,相应的列必须具有相同的宽度
- 您的请求很不寻常,在提出的此类表格中通常使用的解决方案要简单得多。米科在他的回答中
\documentclass[a4paper, 11pt]{article}
\usepackage{booktabs, ltablex, makecell, multirow, tabularx}
\usepackage{siunitx}
\begin{document}
\begin{table}[htbp]\centering
\small
\sisetup{input-symbols = {()},% changed
group-four-digits,
table-align-text-post=false}
\renewcommand{\arraystretch}{0.7}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\setlength\tabcolsep{0pt}
\caption{Demographic Factors for SR1 (Pooled Sample) \label{tab:pooledsr1}}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
p{14ex}
S[table-format=-1.5,% changed
table-space-text-post={***}]
*{5}{S[table-format=-2.3,% changed
table-space-text-post={***}]}
}
\toprule
\makecell{Dependent\\Variable}% changed
& {\makecell{SR1\\dummy}}% changed
& \multicolumn{5}{c}{SR1} \\
\cmidrule(lr){1-1} \cmidrule(lr){2-2} \cmidrule(lr){3-7}% changed
\multirow{2}{*}{Model}% changed
& {\multirow{2}{*}{Probit}}% changed
& \multicolumn{3}{c}{Tobit}
& {\multirow{2}{*}{Cragg's}}
& {\multirow{2}{*}{Heckman}} \\% changed
\cmidrule(lr){3-5}% changed
& & {\makecell{Latent}}
& {\makecell{Censored}}
& {\makecell{Truncated}}
& & \\% changed
\midrule
LnInc & 0.254\sym{***} & 29.56\sym{***} & 20.57\sym{***}
& 14.47\sym{***} & 14.89\sym{***} & 14.35\sym{***} \\
& (0.00521) & (0.628) & (0.406)
& (0.287) & (0.514) & (0.661) \\
\addlinespace
Age & 0.00448 & 0.472\sym{*} & 0.328\sym{*}
& 0.231\sym{*} & 0.155 & 0.162 \\
& (0.00287) & (0.259) & (0.180)
& (0.127) & (0.194) & (0.157) \\
\addlinespace
Kid & 0.0347\sym{***} & 2.180\sym{**} & 1.517\sym{**}
& 1.067\sym{**} & -0.685 & -0.150 \\
& (0.0105) & (0.988) & (0.687)
& (0.483) & (0.774) & (0.623) \\
\addlinespace
Old & 0.0266\sym{**} & 1.158 & 0.806
& 0.567 & -0.854 & -0.420 \\
& (0.0126) & (1.167) & (0.812)
& (0.571) & (0.901) & (0.719) \\
\addlinespace
HHsize & -0.0430\sym{***}& -3.580\sym{***} & -2.491\sym{***}
& -1.753\sym{***} & -0.578 & -0.883\sym{**} \\
& (0.00623) & (0.577) & (0.401)
& (0.282) & (0.440) & (0.374) \\
\addlinespace
Male & 0.00322 & 1.366 & 0.951
& 0.669 & 1.692\sym{*} & 1.366\sym{*} \\
& (0.0131) & (1.196) & (0.832)
& (0.586) & (0.912) & (0.726) \\
\addlinespace
Married & -0.0585\sym{***}& -8.688\sym{***} & -6.045\sym{***}
& -4.253\sym{***} & -6.431\sym{***} & -5.727\sym{***} \\
& (0.0222) & (2.006) & (1.396)
& (0.982) & (1.505) & (1.206) \\
\addlinespace
Party & -0.0324\sym{*} & -2.104 & -1.464
& -1.030 & 0.0964 & -0.254 \\
& (0.0175) & (1.542) & (1.073)
& (0.755) & (1.127) & (0.917) \\
\addlinespace
Job & 0.0803\sym{***} & 10.61\sym{***} & 7.380\sym{***}
& 5.192\sym{***} & 6.184\sym{***} & 5.624\sym{***} \\
& (0.0158) & (1.503) & (1.044)
& (0.734) & (1.197) & (0.948) \\
\addlinespace
House & -0.0286 & -4.952\sym{***} & -3.445\sym{***}
& -2.424\sym{***} & -4.829\sym{***} & -4.087\sym{***} \\
& (0.0209) & (1.917) & (1.334)
& (0.938) & (1.464) & (1.174) \\
\addlinespace
Age 30-34 & -0.0998\sym{***} & -7.547\sym{***} & -5.251\sym{***}
& -3.694\sym{***} & -0.0971 & -1.095 \\
& (0.0323) & (2.880) & (2.003)
& (1.410) & (2.136) & (1.757) \\
\addlinespace
Age 35-39 & -0.0873\sym{**} & -9.292\sym{***} & -6.465\sym{***}
& -4.549\sym{***} & -3.322 & -3.478 \\
& (0.0396) & (3.532) & (2.457)
& (1.729) & (2.627) & (2.120) \\
\addlinespace
Age 40-44 & -0.117\sym{**} & -13.26\sym{***} & -9.224\sym{***}
& -6.490\sym{***} & -5.429\sym{*} & -5.348\sym{**} \\
& (0.0491) & (4.416) & (3.073)
& (2.162) & (3.293) & (2.665) \\
\addlinespace
Age 45-49 & -0.111\sym{*} & -10.86\sym{*} & -7.558\sym{*}
& -5.318\sym{*} & -2.888 & -3.287 \\
& (0.0623) & (5.610) & (3.904)
& (2.746) & (4.185) & (3.387) \\
\addlinespace
Age 50-59 & -0.0563 & -2.961 & -2.060
& -1.449 & 2.488 & 1.620 \\
& (0.0820) & (7.395) & (5.146)
& (3.620) & (5.522) & (4.456) \\
\midrule
\end{tabular*}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}% added separate table for last three rows
p{14ex}
S[table-format=-4.2]
*{4}{S[table-format=-5.2]}
S[table-format=4.1]
}
Observations & 5446 & 5446 & 5446 & 5446
& 3395 & 5446 \\
Log lik. & -2632.3 & -18083.2 & -18083.2 & -18083.2
& -15061.6 & \\
Chi-squared & 1950.0 & 2815.1 & 815.1 & 2815.1
& 998.9 & 315.4 \\
\midrule[\heavyrulewidth]% changed
\multicolumn{7}{p{\dimexpr\linewidth-2\tabcolsep\relax}}{\footnotesize Standard errors in parentheses; The marginal effects in the Tobit model for latent, censored, and truncated dependent variables are listed together; provincial fixed effects controlled}\\
\multicolumn{7}{l}{\footnotesize \sym{*} \(p<0.1\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)}\\
\end{tabular*}
\end{table}
\end{document}