我正在生成一个长表。我想将表格注释放在标题后面。为此,我将表格注释放在标题中。但是,标题和表格注释出现在同一行中。如果我将标题放在\\
标题后面,标题和表格注释都会左对齐。但是,只有表格注释应该左对齐,标题应该保持居中对齐。此外,我还想让 p 值后面的行在表格的最后一行消失。MWE 如下所示:
\documentclass[12pt, a4paper, twoside]{article}
\usepackage[para]{threeparttable}
\usepackage{booktabs,longtable,tabularx}
\usepackage{caption}
\setlength{\LTcapwidth}{7in}
\usepackage{ltablex}
\usepackage{siunitx}
\usepackage[flushleft]{threeparttablex}
\begin{document}
\begin{longtable}{l*{4}{S}} \caption[Ordinary Least Square Estimations] {Ordinary Least Square Estimations\vspace{1ex} \\
Note: This table provides the results of OLS. Four models are estimated here. Models details are provided in the main body of the document.
}
\label{tab:te3}\\
\toprule
{\bfseries{}} &{\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)} \\%
\endfirsthead
\caption{-- continued from previous page}\\
\toprule
& {\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)}\\
\midrule
\endhead
\bottomrule
\addlinespace
\multicolumn{5}{r}{\footnotesize Continued on next page} \\
\endfoot
\bottomrule
\addlinespace
\insertTableNotes\\
\endlastfoot %
\midrule
A & 0.022*** & 0.019*** & 0.021*** & 0.020*** \\
B & -0.002 & -0.008** & -0.010*** & -0.010** \\
C & 0.024 & -0.007 & -0.004 & -0.015 \\
D & -0.217*** & -0.314*** & -0.275*** & -0.262*** \\
E & -0.133 & -0.068 & -0.071 & -0.026 \\
F & 0.023 & 0.003 & 0.022 & 0.019 \\
G & -0.003*** & -0.003*** & -0.002** & -0.002** \\
H & -0.015 & -0.021** & -0.041*** & -0.045*** \\
I & -0.005** & -0.006*** & -0.006*** & -0.007*** \\
J & 0.184 & 0.346*** & 0.129 & 0.051 \\
K & -0.006* & -0.007** & -0.007** & -0.009*** \\
L & -0.014 & -0.022* & -0.021* & -0.023** \\
M & -0.006 & -0.001 & -0.004 & -0.002 \\
N & 0.001 & 0.004 & 0.009 & 0.003 \\
O & 0.01 & 0.017 & -0.003 & 0.003 \\
P & -0.077 & -0.146*** & -0.103** & -0.093** \\
Q & -0.022*** & -0.002 & -0.004 & -0.007 \\
R & 0.028*** & 0.035*** & 0.032*** & 0.027*** \\
S & 0.006 & 0.035*** & 0.026*** & 0.025*** \\
T & 0.0003 & -0.007 & 0.005 & -0.009 \\
U & -0.149** & -0.052 & 0.055 & 0.077 \\
V & -0.017* & -0.020** & -0.016* & -0.014* \\
W & -0.006 & -0.005 & 0.002 & -0.0004 \\
Z & -0.006 & -0.003 & -0.003 & -0.006 \\
AB & 0.004*** & 0.005*** & 0.005*** & 0.004*** \\
AC & -0.056** & -0.058** & -0.045* & -0.028 \\
AD & 1.985** & 0.856 & 0.178 & 0.306 \\
AE & & -0.028*** & -0.012* & -0.012 \\
AF & & 0.043*** & 0.044*** & 0.042*** \\
AG & & -0.043*** & -0.037*** & -0.036*** \\
AH & & -0.007 & -0.004 & -0.008 \\
AI & & -0.003 & -0.004 & -0.003 \\
AJ & & -0.014 & -0.003 & 0.004 \\
BA & & & -0.030*** & -0.031*** \\
BC & & & -0.038*** & -0.039*** \\
BD & & & -0.042*** & -0.044*** \\
BE & & & -0.025*** & -0.028*** \\
BF & & & -0.032*** & -0.036*** \\
BH & & & -0.034*** & -0.058*** \\
BJ & & & 0.006 & -0.013 \\
BI & & & -0.027*** & -0.048*** \\
BL & & & -0.028*** & -0.051*** \\
BM & & & 0.030*** & 0.012 \\
BL * FC & & & & -0.0005 \\
BM * FC & & & & 0.009** \\
BC * FC & & & & 0.013 \\
BO * FC & & & & 0.052*** \\
BP * FC & & & & -0.036** \\
Constant & 0.131* & 0.039 & -0.032 & -0.03 \\
\midrule
Observations & 1,210 & 1,210 & 1,210 & 1,210 \\
$R^2$ & 0.126 & 0.187 & 0.28 & 0.301 \\
Adjusted $R^2$ & 0.106 & 0.164 & 0.254 & 0.272 \\
Residual Std. Error & 0.003 & 0.003 & 0.002 & 0.002 \\
$F$ Statistic & 6.325*** & 8.204*** & 10.552*** & 0.417*** \\
\bottomrule
\multicolumn{5}{c}{*p<0.1; **p<0.05; ***p<0.01} \\
\end{longtable}%
\end{document}
答案1
为了使表格适合边距,请使用ltablex
和X
列。此外,将表格的列格式固定S
为精确的数字,并ThhreePartTablex
为表格注释打包:
\documentclass[12pt, a4paper, twoside]{article}
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.3pt}
\usepackage{booktabs}
\usepackage{caption}%
\usepackage{longtable, tabularx, ltablex}
\usepackage{siunitx} %
\usepackage[flushleft, online]{threeparttablex} %
\begin{document}
\begin{ThreePartTable}
\sisetup{table-format=-2.3, table-space-text-post=***, table-number-alignment=center}
\keepXColumns
\begin{TableNotes}\footnotesize
\item[\hspace{-\fontdimen2\font}]\emph{Note:} This table provides the results of OLS. Four models are estimated
here. Models details are provided in the main body of the document.
\end{TableNotes}
\begin{tabularx}{\textwidth}{X@{}S[table-format =-1.4]*{2}{S}S[table-format =-1.4]}
\caption{Ordinary Least Square Estimations}\label{tab:te3}\\
\insertTableNotes\\
\addlinespace%
%\toprule
% &{\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)} \\%
\endfirsthead
\caption[]{-- continued from previous page}\\
\toprule
& {\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)}\\
\midrule
\endhead
\bottomrule
\addlinespace
\multicolumn{5}{r}{\footnotesize Continued on next page} \\
\endfoot
\bottomrule
\addlinespace
%\insertTableNotes\\
\endlastfoot %
\midrule
A & 0.022*** & 0.019*** & 0.021*** & 0.020*** \\
B & -0.002 & -0.008** & -0.010*** & -0.010** \\
C & 0.024 & -0.007 & -0.004 & -0.015 \\
D & -0.217*** & -0.314*** & -0.275*** & -0.262*** \\
E & -0.133 & -0.068 & -0.071 & -0.026 \\
F & 0.023 & 0.003 & 0.022 & 0.019 \\
G & -0.003*** & -0.003*** & -0.002** & -0.002** \\
H & -0.015 & -0.021** & -0.041*** & -0.045*** \\
I & -0.005** & -0.006*** & -0.006*** & -0.007*** \\
J & 0.184 & 0.346*** & 0.129 & 0.051 \\
K & -0.006* & -0.007** & -0.007** & -0.009*** \\
L & -0.014 & -0.022* & -0.021* & -0.023** \\
M & -0.006 & -0.001 & -0.004 & -0.002 \\
N & 0.001 & 0.004 & 0.009 & 0.003 \\
O & 0.01 & 0.017 & -0.003 & 0.003 \\
P & -0.077 & -0.146*** & -0.103** & -0.093** \\
Q & -0.022*** & -0.002 & -0.004 & -0.007 \\
R & 0.028*** & 0.035*** & 0.032*** & 0.027*** \\
T & 0.0003 & -0.007 & 0.005 & -0.009 \\
U & -0.149** & -0.052 & 0.055 & 0.077 \\
V & -0.017* & -0.020** & -0.016* & -0.014* \\
W & -0.006 & -0.005 & 0.002 & -0.0004 \\
Z & -0.006 & -0.003 & -0.003 & -0.006 \\
AB & 0.004*** & 0.005*** & 0.005*** & 0.004*** \\
AC & -0.056** & -0.058** & -0.045* & -0.028 \\
AD & 1.985** & 0.856 & 0.178 & 0.306 \\
AE & & -0.028*** & -0.012* & -0.012 \\
AF & & 0.043*** & 0.044*** & 0.042*** \\
AG & & -0.043*** & -0.037*** & -0.036*** \\
AH & & -0.007 & -0.004 & -0.008 \\
AI & & -0.003 & -0.004 & -0.003 \\
AJ & & -0.014 & -0.003 & 0.004 \\
BA & & & -0.030*** & -0.031*** \\
BC & & & -0.038*** & -0.039*** \\
BD & & & -0.042*** & -0.044*** \\
BE & & & -0.025*** & -0.028*** \\
BF & & & -0.032*** & -0.036*** \\
BH & & & -0.034*** & -0.058*** \\
BJ & & & 0.006 & -0.013 \\
BI & & & -0.027*** & -0.048*** \\
BL & & & -0.028*** & -0.051*** \\
BM & & & 0.030*** & 0.012 \\
BL * FC & & & & -0.0005 \\
BM * FC & & & & 0.009** \\
BC * FC & & & & 0.013 \\
BO * FC & & & & 0.052*** \\
BP * FC & & & & -0.036** \\
Constant & 0.131* & 0.039 & -0.032 & -0.03 \\
\midrule
Observations & 1,210 & 1,210 & 1,210 & 1,210 \\
$R^2$ & 0.126 & 0.187 & 0.28 & 0.301 \\
Adjusted $R^2$ & 0.106 & 0.164 & 0.254 & 0.272 \\
Residual\cr Std. Error & 0.003 & 0.003 & 0.002 & 0.002 \\
$F$ Statistic & 6.325*** & 8.204*** & 10.552*** & 0.417*** \\
\bottomrule
\addlinespace
\multicolumn{5}{c}{* $ p<0.1 $; ** $ p<0.05 $; *** $ p<0.01 $} \\
\end{tabularx}%
\end{ThreePartTable}
\end{document}
答案2
用于\caption*
注释:
\documentclass[12pt, a4paper, twoside]{article}
\usepackage[para]{threeparttable}
\usepackage{booktabs,longtable,tabularx}
\usepackage{caption}
\setlength{\LTcapwidth}{7in}
\usepackage{ltablex}
\usepackage{siunitx}
\usepackage[flushleft]{threeparttablex}
\begin{document}
\begin{longtable}{l*{4}{S}}
\caption{Ordinary Least Square Estimations}\label{tab:te3}\\
\caption*{%
Note: This table provides the results of OLS. Four models are estimated
here. Models details are provided in the main body of the document.
}\\
\toprule
{\bfseries{}} &{\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)} \\%
\endfirsthead
\caption[]{-- continued from previous page}\\
\toprule
& {\bfseries(1)} & {\bfseries(2)} &{\bfseries(3)} & {\bfseries(4)}\\
\midrule
\endhead
\bottomrule
\addlinespace
\multicolumn{5}{r}{\footnotesize Continued on next page} \\
\endfoot
\bottomrule
\addlinespace
\insertTableNotes\\
\endlastfoot %
\midrule
A & 0.022*** & 0.019*** & 0.021*** & 0.020*** \\
B & -0.002 & -0.008** & -0.010*** & -0.010** \\
C & 0.024 & -0.007 & -0.004 & -0.015 \\
D & -0.217*** & -0.314*** & -0.275*** & -0.262*** \\
E & -0.133 & -0.068 & -0.071 & -0.026 \\
F & 0.023 & 0.003 & 0.022 & 0.019 \\
G & -0.003*** & -0.003*** & -0.002** & -0.002** \\
H & -0.015 & -0.021** & -0.041*** & -0.045*** \\
I & -0.005** & -0.006*** & -0.006*** & -0.007*** \\
J & 0.184 & 0.346*** & 0.129 & 0.051 \\
K & -0.006* & -0.007** & -0.007** & -0.009*** \\
L & -0.014 & -0.022* & -0.021* & -0.023** \\
M & -0.006 & -0.001 & -0.004 & -0.002 \\
N & 0.001 & 0.004 & 0.009 & 0.003 \\
O & 0.01 & 0.017 & -0.003 & 0.003 \\
P & -0.077 & -0.146*** & -0.103** & -0.093** \\
Q & -0.022*** & -0.002 & -0.004 & -0.007 \\
R & 0.028*** & 0.035*** & 0.032*** & 0.027*** \\
S & 0.006 & 0.035*** & 0.026*** & 0.025*** \\
T & 0.0003 & -0.007 & 0.005 & -0.009 \\
U & -0.149** & -0.052 & 0.055 & 0.077 \\
V & -0.017* & -0.020** & -0.016* & -0.014* \\
W & -0.006 & -0.005 & 0.002 & -0.0004 \\
Z & -0.006 & -0.003 & -0.003 & -0.006 \\
AB & 0.004*** & 0.005*** & 0.005*** & 0.004*** \\
AC & -0.056** & -0.058** & -0.045* & -0.028 \\
AD & 1.985** & 0.856 & 0.178 & 0.306 \\
AE & & -0.028*** & -0.012* & -0.012 \\
AF & & 0.043*** & 0.044*** & 0.042*** \\
AG & & -0.043*** & -0.037*** & -0.036*** \\
AH & & -0.007 & -0.004 & -0.008 \\
AI & & -0.003 & -0.004 & -0.003 \\
AJ & & -0.014 & -0.003 & 0.004 \\
BA & & & -0.030*** & -0.031*** \\
BC & & & -0.038*** & -0.039*** \\
BD & & & -0.042*** & -0.044*** \\
BE & & & -0.025*** & -0.028*** \\
BF & & & -0.032*** & -0.036*** \\
BH & & & -0.034*** & -0.058*** \\
BJ & & & 0.006 & -0.013 \\
BI & & & -0.027*** & -0.048*** \\
BL & & & -0.028*** & -0.051*** \\
BM & & & 0.030*** & 0.012 \\
BL * FC & & & & -0.0005 \\
BM * FC & & & & 0.009** \\
BC * FC & & & & 0.013 \\
BO * FC & & & & 0.052*** \\
BP * FC & & & & -0.036** \\
Constant & 0.131* & 0.039 & -0.032 & -0.03 \\
\midrule
Observations & 1,210 & 1,210 & 1,210 & 1,210 \\
$R^2$ & 0.126 & 0.187 & 0.28 & 0.301 \\
Adjusted $R^2$ & 0.106 & 0.164 & 0.254 & 0.272 \\
Residual Std. Error & 0.003 & 0.003 & 0.002 & 0.002 \\
$F$ Statistic & 6.325*** & 8.204*** & 10.552*** & 0.417*** \\
\bottomrule
\multicolumn{5}{c}{*p<0.1; **p<0.05; ***p<0.01} \\
\end{longtable}%
\end{document}