我有一个表格,它目前对于我的页面来说太大了,所以我想减小列宽。同时,我也想将值对齐到小数点。我一直在尝试使用这个siunitx
包,但不知何故我无法做到正确。我不一定非要使用这个包,但我希望表格保持原样(除了列宽)。我想单独调整每列的宽度,使表格整体与文档中的文本宽度相同。
这是我的桌子:
\documentclass[12pt, a4paper]{article}
\usepackage[format=hang,font={small,it},labelfont={bf,it},labelsep=space]{caption}
\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\begin{table}[!htb]
\caption{Sample caption \label{tab:example}}
\begin{tabular}{rlSllSl}
\toprule
& TEXTEXTEXT & AR & t-stat & Firms & AR & t-stat \\
\midrule
& X TEXTEXTEXT & & & & \\
\midrule
1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\
2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\
3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\
4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\
5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\
6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\
7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\
8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\
9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\
10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\
11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\
12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\
13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\
14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\
\midrule
& Y TEXTEXTEXT & & & & \\
\midrule
1 & TEXTEXTEXT & 0.0001 & (0.01) & ATEXTEXTEXT & 0.0137 & (1.59)* \\
2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\
3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\
4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\
5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\
6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\
7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\
8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\
9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\
10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\
11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\
12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\
13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\
14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\
15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\
16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\
17 & TEXTEXTEXT & 0.0083 & (0.82) & & \\
18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\
19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\
20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\
21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\
22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\
\bottomrule
\end{tabular}
{\raggedright \footnotesize{One-tailed t-statistics in parantheses
Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01} \par}
\end{table}
\end{document}
非常感谢您的帮助!
答案1
为了使用 MWE 将某些内容填充到一页中,也许使用\usepackage{fullpage}
将有助于实现该目标。
\documentclass[12pt, a4paper]{article}
\usepackage[format=hang,font={small,it},labelfont={bf,it},labelsep=space]{caption}
\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{dcolumn}
\newcolumntype{L}{D{.}{.}{2,5}}
\usepackage{fullpage}
\begin{document}
\begin{table}[!htb]
\caption{Sample caption \label{tab:example}}
\begin{tabular}{rlSllSl}
\toprule
& TEXTEXTEXT & AR & t-stat & Firms & AR & t-stat \\
\midrule
& X TEXTEXTEXT & & & & \\
\midrule
1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\
2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\
3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\
4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\
5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\
6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\
7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\
8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\
9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\
10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\
11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\
12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\
13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\
14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\
\midrule
& Y TEXTEXTEXT & & & & \\
\midrule
1 & TEXTEXTEXT & 0.0001 & (0.01) & ATEXTEXTEXT & 0.0137 & (1.59)* \\
2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\
3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\
4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\
5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\
6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\
7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\
8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\
9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\
10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\
11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\
12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\
13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\
14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\
15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\
16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\
17 & TEXTEXTEXT & 0.0083 & (0.82) & & \\
18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\
19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\
20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\
21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\
22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\
\bottomrule
\end{tabular}
{\raggedright \footnotesize{One-tailed t-statistics in parantheses
Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01} \par}
\end{table}
\end{document}
答案2
以下还有三种可能性:
由于您的表格太高,无法放入文本块,并且您指定不想更改边距,因此我建议使用longtable
。如果您的标题长度超过一行,或者您决定在表格中添加更多行,这可能会特别有用。
在第二个例子中,我允许在第 2 列和第 5 列中换行,并为表格使用较大的字体大小。
在第三个例子中,我将字体大小缩小为\footnotesize
。这样,即使标题不止一行或两行,表格也可以放在一页中。
所有表格都使用该siunitx
包来将数字与小数点对齐。
\documentclass[12pt, a4paper]{article}
\usepackage[format=hang,font={small,it},labelfont={bf,it},labelsep=space]{caption}
\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
\usepackage{siunitx}
\usepackage{booktabs}
\sisetup{table-align-text-pre = false,
table-align-text-post = false,
input-open-uncertainty = ,
input-close-uncertainty = ,}
\usepackage{longtable} % Used for table 1
\usepackage{xltabular} % Used for table 2
\begin{document}
{\setlength{\tabcolsep}{3.25pt} \small
\begin{longtable}{@{}rlS[table-format=-1.4]SlS[table-format=-1.4]S@{}}
\caption{Sample caption that might be longer than a single line Sample caption that might be longer than a single line Sample caption that might be longer than a single line Sample caption that might be longer than a single line \label{tab:example}}\\
\toprule
& TEXTEXTEXT & {AR} & {t-stat} & Firms & {AR} & {t-stat} \\
\midrule
\endhead
\multicolumn{7}{l}{\footnotesize One-tailed t-statistics in parantheses}\\
\multicolumn{7}{l}{\footnotesize Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01}
\endlastfoot
& \multicolumn{2}{l}{X TEXTEXTEXT} \\
\midrule
1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\
2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\
3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\
4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\
5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\
6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\
7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\
8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\
9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\
10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\
11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\
12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\
13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\
14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\
\midrule
& \multicolumn{2}{l}{Y TEXTEXTEXT}\\
\midrule
1 & TEXTEXTEXT & 0.0001 & (0.01) & ATEXTEXTEXT & 0.0137 & (1.59)* \\
2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\
3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\
4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\
5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\
6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\
7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\
8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\
9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\
10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\
11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\
12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\
13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\
14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\
15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\
16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\
17 & TEXTEXTEXT & 0.0083 & (0.82) & & \\
18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\
19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\
20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\
21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\
22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\
\bottomrule
\end{longtable}
}
\newpage
{\small
\begin{xltabular}{\textwidth}{@{}r
>{\raggedright\arraybackslash}X
S[table-format=-1.4]
S
>{\raggedright\arraybackslash}XS[table-format=-1.4]
S@{}}
\caption{Sample caption \label{tab:example2}}\\
\toprule
& TEXTEXTEXT & {AR} & {t-stat} & Firms & {AR} & {t-stat} \\
\midrule
\endhead
\multicolumn{7}{l}{\footnotesize One-tailed t-statistics in parantheses}\\
\multicolumn{7}{l}{\footnotesize Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01}
\endlastfoot
& \multicolumn{3}{l}{X TEXTEXTEXT} \\
\midrule
1 & TEXTEX TEXT & 0.0056 & (0.46) & TEXTEX TEXT & 0.0046 & (0.37) \\
2 & TEXTEX TEXT & -0.0067 & (-0.45) & TEXTEX TEXT & 0.0062 & (0.63) \\
3 & TEXTEX TEXT & 0.0006 & (0.07) & TEXTEX TEXT & -0.0036 & (-0.31) \\
4 & TEXTEX TEXT & -0.0005 & (-0.05) & TEXTEX TEXT & 0.0054 & (0.35) \\
5 & TEXTEX TEXT & 0.0029 & (0.34) & TEXTEX TEXT & 0.0046 & (0.39) \\
6 & TEXTEX TEXT & 0.0034 & (0.30) & TEXTEX TEXT & 0.0103 & (1.12) \\
7 & TEXTEX TEXT & 0.0063 & (0.38) & & & \\
8 & TEXTEX TEXT & -0.0006 & (-0.07) & & & \\
9 & TEXTEX TEXT & -0.0037 & (-0.29) & & & \\
10 & TEXTEX TEXT & -0.0017 & (-0.19) & & & \\
11 & TEXTEX TEXT & -0.0005 & (-0.06) & & & \\
12 & TEXTEX TEXT & 0.0048 & (0.57) & & & \\
13 & TEXTEX TEXT & 0.0054 & (0.52) & & & \\
14 & TEXTEX TEXT & 0.0026 & (0.25) & & & \\
\midrule
& \multicolumn{3}{l}{Y TEXTEXTEXT} \\*
\midrule
1 & TEXTEX TEXT & 0.0001 & (0.01) & ATEXTEX TEXT & 0.0137 & (1.59)* \\
2 & TEXTEX TEXT & -0.0014 & (-0.12) & TEXTEX TEXT & 0.0105 & (1.15) \\
3 & TEXTEX TEXT & 0.0107 & (1.48)* & TEXTEX TEXT & 0.0061 & (0.55) \\
4 & TEXTEX TEXT & 0.0040 & (0.32) & TEXTEX TEXT & 0.0109 & (0.88) \\
5 & TEXTEX TEXT & 0.0091 & (1.16) & TEXTEX TEXT & 0.0044 & (0.47) \\
6 & TEXTEX TEXT & 0.0034 & (0.41) & TEXTEX TEXT & -0.0021 & (-0.13) \\
7 & TEXTEX TEXT & -0.0014 & (-0.13) & TEXTEX TEXT & -0.0045 & (-0.35) \\
8 & TEXTEX TEXT & 0.0019 & (0.13) & TEXTEX TEXT & 0.0143 & (1.18) \\
9 & TEXTEX TEXT & 0.0001 & (0.01) & TEXTEX TEXT & -0.0160 & (-1.53)* \\
10 & TEXTEX TEXT & 0.0086 & (1.15) & TEXTEX TEXT & -0.0046 & (-0.15) \\
11 & TEXTEX TEXT & -0.0103 & (-0.98) & TEXTEX TEXT & 0.0004 & (0.04) \\
12 & TEXTEX TEXT & -0.0008 & (-0.08) & TEXTEX TEXT & -0.0015 & (-0.10) \\
13 & TEXTEX TEXT & -0.0078 & (-0.68) & TEXTEX TEXT & -0.0100 & (-0.44) \\
14 & TEXTEX TEXT & -0.0023 & (-0.14) & TEXTEX TEXT & 0.0054 & (0.65) \\
15 & TEXTEX TEXT & -0.0065 & (-0.51) & TEXTEX TEXT & 0.0018 & (0.14) \\
16 & TEXTEX TEXT & 0.0020 & (0.29) & TEXTEX TEXT & -0.0195 & (-0.91) \\
17 & TEXTEX TEXT & 0.0083 & (0.82) & & \\
18 & TEXTEX TEXT & 0.0009 & (0.11) & & & \\
19 & TEXTEX TEXT & -0.0101 & (-0.90) & & & \\
20 & TEXTEX TEXT & 0.0043 & (0.51) & & & \\
21 & TEXTEX TEXT & 0.0072 & (0.75) & & & \\
22 & TEXTEX TEXT & -0.0211 & (-0.94) & & & \\
\bottomrule
\end{xltabular}
}
\newpage
\begin{table}[ht]
\caption{Sample caption \label{tab:example3}}
\centering
\footnotesize
\begin{tabular}{@{}rlS[table-format=-1.4]SlS[table-format=-1.4]S@{}}
\toprule
& TEXTEXTEXT & {AR} & {t-stat} & Firms & {AR} & {t-stat} \\
\midrule
& \multicolumn{2}{l}{X TEXTEXTEXT} \\
\midrule
1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\
2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\
3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\
4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\
5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\
6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\
7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\
8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\
9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\
10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\
11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\
12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\
13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\
14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\
\midrule
& \multicolumn{2}{l}{Y TEXTEXTEXT}\\
\midrule
1 & TEXTEXTEXT & 0.0001 & (0.01) & ATEXTEXTEXT & 0.0137 & (1.59)* \\
2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\
3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\
4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\
5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\
6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\
7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\
8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\
9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\
10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\
11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\
12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\
13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\
14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\
15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\
16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\
17 & TEXTEXTEXT & 0.0083 & (0.82) & & \\
18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\
19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\
20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\
21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\
22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\
\bottomrule
\multicolumn{7}{l}{\footnotesize One-tailed t-statistics in parantheses}\\
\multicolumn{7}{l}{\footnotesize Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01}
\end{tabular}
\end{table}
\end{document}
答案3
与siunitx
和tabularx
(该表格适合文本区域):
\documentclass[12pt, a4paper]{article}
\usepackage[format=hang,
font={small,it},
labelfont={bf,it},
labelsep=space]{caption}
\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
\usepackage{siunitx}
\usepackage{booktabs, tabularx}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{table}[ht]
\small
\caption{Sample caption}
\label{tab:example}
%
\sisetup{parse-numbers=false,
table-format=-2.4} % integer part had to have
% one digit more than normally needed
% otherwise decimal point is overwritten
\begin{tabularx}{\linewidth}{@{} rXSSXSS @{}}
\toprule
& TEXTEXTEXT & {AR} & {t-stat} & Firms & {AR} & {t-stat} \\
\midrule
& \multicolumn{6}{l}{X TEXTEXTEXT} \\
\midrule
1 & TEXTEXTEXT & 0.0056 & (0.46) & TEXTEXTEXT & 0.0046 & (0.37) \\
2 & TEXTEXTEXT & -0.0067 & (-0.45) & TEXTEXTEXT & 0.0062 & (0.63) \\
3 & TEXTEXTEXT & 0.0006 & (0.07) & TEXTEXTEXT & -0.0036 & (-0.31) \\
4 & TEXTEXTEXT & -0.0005 & (-0.05) & TEXTEXTEXT & 0.0054 & (0.35) \\
5 & TEXTEXTEXT & 0.0029 & (0.34) & TEXTEXTEXT & 0.0046 & (0.39) \\
6 & TEXTEXTEXT & 0.0034 & (0.30) & TEXTEXTEXT & 0.0103 & (1.12) \\
7 & TEXTEXTEXT & 0.0063 & (0.38) & & & \\
8 & TEXTEXTEXT & -0.0006 & (-0.07) & & & \\
9 & TEXTEXTEXT & -0.0037 & (-0.29) & & & \\
10 & TEXTEXTEXT & -0.0017 & (-0.19) & & & \\
11 & TEXTEXTEXT & -0.0005 & (-0.06) & & & \\
12 & TEXTEXTEXT & 0.0048 & (0.57) & & & \\
13 & TEXTEXTEXT & 0.0054 & (0.52) & & & \\
14 & TEXTEXTEXT & 0.0026 & (0.25) & & & \\
\midrule
& \multicolumn{6}{l}{Y TEXTEXTEXT} \\
\midrule
1 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & 0.0137 & (1.59)* \\
2 & TEXTEXTEXT & -0.0014 & (-0.12) & TEXTEXTEXT & 0.0105 & (1.15) \\
3 & TEXTEXTEXT & 0.0107 & (1.48)* & TEXTEXTEXT & 0.0061 & (0.55) \\
4 & TEXTEXTEXT & 0.0040 & (0.32) & TEXTEXTEXT & 0.0109 & (0.88) \\
5 & TEXTEXTEXT & 0.0091 & (1.16) & TEXTEXTEXT & 0.0044 & (0.47) \\
6 & TEXTEXTEXT & 0.0034 & (0.41) & TEXTEXTEXT & -0.0021 & (-0.13) \\
7 & TEXTEXTEXT & -0.0014 & (-0.13) & TEXTEXTEXT & -0.0045 & (-0.35) \\
8 & TEXTEXTEXT & 0.0019 & (0.13) & TEXTEXTEXT & 0.0143 & (1.18) \\
9 & TEXTEXTEXT & 0.0001 & (0.01) & TEXTEXTEXT & -0.0160 & (-1.53)* \\
10 & TEXTEXTEXT & 0.0086 & (1.15) & TEXTEXTEXT & -0.0046 & (-0.15) \\
11 & TEXTEXTEXT & -0.0103 & (-0.98) & TEXTEXTEXT & 0.0004 & (0.04) \\
12 & TEXTEXTEXT & -0.0008 & (-0.08) & TEXTEXTEXT & -0.0015 & (-0.10) \\
13 & TEXTEXTEXT & -0.0078 & (-0.68) & TEXTEXTEXT & -0.0100 & (-0.44) \\
14 & TEXTEXTEXT & -0.0023 & (-0.14) & TEXTEXTEXT & 0.0054 & (0.65) \\
15 & TEXTEXTEXT & -0.0065 & (-0.51) & TEXTEXTEXT & 0.0018 & (0.14) \\
16 & TEXTEXTEXT & 0.0020 & (0.29) & TEXTEXTEXT & -0.0195 & (-0.91) \\
17 & TEXTEXTEXT & 0.0083 & (0.82) & & & \\
18 & TEXTEXTEXT & 0.0009 & (0.11) & & & \\
19 & TEXTEXTEXT & -0.0101 & (-0.90) & & & \\
20 & TEXTEXTEXT & 0.0043 & (0.51) & & & \\
21 & TEXTEXTEXT & 0.0072 & (0.75) & & & \\
22 & TEXTEXTEXT & -0.0211 & (-0.94) & & & \\
\bottomrule
\end{tabularx}
\raggedright\footnotesize
One-tailed t-statistics in parantheses
Signs indicate * p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01
\end{table}
\end{document}
(红线表示页面布局)
笔记:您的表格太高,无法放入文本区域。您可以解决这个问题,但要定义得更大\textheight
(借助geometry
} 包或使用较小的字体(例如\footnotesize
}
附录:受到\sisetup
@leandris 回答中的启发:
\begin{table}[ht]
\footnotesize
\caption{Sample caption}
\label{tab:example}
%
\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 = ,
}
\begin{tabularx}{\linewidth}{@{} r*{2}{XS[table-format=-1.4]
S[table-format=-1.2]}
@{}}
% table body
\end{table}
可以更好地控制S
列格式。使用footnotesize
字体大小可以: