我无法修复,也无法弄清楚为什么我的表格有一条分隔线 - {l| - 延伸到表格上方的标题中。我也不知道为什么 \bottomrule 只延伸到第一列。我认为这些问题是相关的,但无法弄清楚原因。
这是我的代码:
\begin{table}[ht!]
\hrule
\centering
\caption{Daily Trade Statistics for Spot and Futures Market. Average measures displayed in 'All' and quintiles by Market Capitalisation in rows Q5-Q1 (Smallest to Largest).}
\begin{tabularx}{\linewidth}{l|ccc|ccc} \\ \hline
\hline
& \multicolumn{3}{c}{Number of Trades} & \multicolumn{3}{c}{Volume of Trades} \\
\cmidrule{1-4} \cmidrule{5-7}
& Mean & Median & Std. Dev. & Mean & Median & Std. Dev. \\ \hline
Panel A: Spot & & & & & \\ \hline
All & 35,027 & 23,224 & 37,907 & 5,463,166 & 1,629,666 & 16,345,297\\
Q5 (Smallest) &22,429 &14,803 &27,814 & 6,000,618 &1,867,395 &14,977,300\\
Q4 &27,611 &19,662 &28,999 & 9,477,202 &1,707,493 &29,538,178\\
Q3 &25,550 &16,852 &29,595 & 3,098,663 &975,992 &5,614,307\\
Q2 &40,105 &29,168 &43,990 & 4,832,524 &1,424,984&12,591,574\\
Q1 (Largest) &60,337 &51,511 &42,789 & 3,926,218 &2,327,745 &4,948,369\\ \hline
Panel B: Futures & & & & & &\\ \hline
All & 3,221 & 2,038 &4,001 & 11,351,964 & 4,284,000 & 22,528,779\\
Q5 (Smallest) &1,854 &1,418 &1,955 & 10,772,701 &5,375,500 &19,492,113\\
Q4 &2,599 &1,778 &2,765 & 15,654,102 &4,758,000 &35,638,730\\
Q3 &2,726 &1,656 &2,889 & 9,274,756 &2,973,000 &15,273,786\\
Q2 &3,363 &2,146 &4,639 & 11,620,665 &3,285,600 &22,456,704\\
Q1 (Largest) &6,115 &4,120 &5,411 & 8,414,534 &5,176,000 &10,327,336\\
\hline
\bottomrule
\end{tabularx}
\label{trade_stats1}
\end{table}
谢谢,艾德
答案1
为了删除垂直线,请删除\\
第一个\hline
命令前的右侧内容:
除此之外,我还建议进行一些更改:
tabular*
与 结合使用@{\extracolsep{\fill}}
,以tabularx
确保表格与文本宽度一样宽,同时均匀分布列。- 使用包
S
中的类型列siunitx
来改善表中数字的对齐 - 删除了所有垂直线,并
\hline
用包中的相应水平线替换了命令booktabs
。在命令中添加了(r)
和,以便在第 4 列和第 5 列之间的行中创建间隙。(l)
\cmidrule
- 添加了
caption
用于改善标题周围间距的包。 - 相对于“面板...”标题,第一列的内容略微缩进。
\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{input-ignore={,},
input-decimal-markers = {.},
group-separator={,}, }
\usepackage{caption}
\begin{document}
\begin{table}[ht!]
\centering
\caption{Daily Trade Statistics for Spot and Futures Market. Average measures displayed in 'All' and quintiles by Market Capitalisation in rows Q5-Q1 (Smallest to Largest).}
\label{trade_stats1}
\begin{tabular*}{\linewidth}{@{\quad\extracolsep{\fill}}l
*{3}{S[table-format=5]}
S[table-format=8]
S[table-format=7]
S[table-format=8]}
\toprule
& \multicolumn{3}{c}{Number of Trades} & \multicolumn{3}{c}{Volume of Trades} \\
\cmidrule(r){2-4} \cmidrule(l){5-7}
& {Mean} & {Median} & {Std. Dev.} & {Mean} & {Median} & {Std. Dev.} \\
\midrule
\multicolumn{7}{l}{Panel A: Spot} \\
\midrule
All & 35,027 & 23,224 & 37,907 & 5,463,166 & 1,629,666 & 16,345,297\\
Q5 (Smallest) &22,429 &14,803 &27,814 & 6,000,618 &1,867,395 &14,977,300\\
Q4 &27,611 &19,662 &28,999 & 9,477,202 &1,707,493 &29,538,178\\
Q3 &25,550 &16,852 &29,595 & 3,098,663 &975,992 &5,614,307\\
Q2 &40,105 &29,168 &43,990 & 4,832,524 &1,424,984&12,591,574\\
Q1 (Largest) &60,337 &51,511 &42,789 & 3,926,218 &2,327,745 &4,948,369\\
\midrule
\multicolumn{7}{l}{Panel B: Futures} \\
\midrule
All & 3,221 & 2,038 &4,001 & 11,351,964 & 4,284,000 & 22,528,779\\
Q5 (Smallest) &1,854 &1,418 &1,955 & 10,772,701 &5,375,500 &19,492,113\\
Q4 &2,599 &1,778 &2,765 & 15,654,102 &4,758,000 &35,638,730\\
Q3 &2,726 &1,656 &2,889 & 9,274,756 &2,973,000 &15,273,786\\
Q2 &3,363 &2,146 &4,639 & 11,620,665 &3,285,600 &22,456,704\\
Q1 (Largest) &6,115 &4,120 &5,411 & 8,414,534 &5,176,000 &10,327,336\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}