我想将标题“Normal”、“Student-t”和“GED”置于两列的中心,使它们直接位于栏的正上方。
\documentclass{article}
\usepackage{booktabs,siunitx}
\sisetup{table-format=1.3} % default numerical column spec
\begin{document}
\begin{table}
\sisetup{table-format=1.3}
\centering
\begin{tabular}{
l
S[table-format=2]
S[table-format=1.3]
SS
l
S[table-format=1.3]
S[table-format=1.3]
S
l
l
S[table-format=2]
S[table-format=1.3]
SS
}
\bottomrule
\addlinespace
& & {Normal} & & & {Student-t} & & & {GED} \\
\cmidrule(lr){3-4} \cmidrule(lr){6-7} \cmidrule(lr){9-10} % center non-numerical info (A, B, ...) by placing them in braces
& {s} & {KLIC} & {CSL} & & {KLIC} & {CSL} & & {KLIC} & {CSL} \\
\midrule % leave gap between the two rules
GARCH
& 1 & 0.999 & 0.999 & & 0.999 & 0.001 & & 0.999 & 0.999 \\
& 5 & 0.999 & 0.826 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 10 & 0.999 & 0.826 & & 0.999 & 0.999 & & 0.999 & 0.999\\
\addlinespace
GJR
& 1 & 0.999 & 0.010 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 5 & 0.999 & 0.010 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 10 & 0.999 & 0.008 & & 0.999 & 0.999 & & 0.999 & 0.999\\
\addlinespace
MS
& 1 & 0.999 & 0.998 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 5 & 0.999 & 0.812 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 10 & 0.999 & 0.811 & & 0.999 & 0.999 & & 0.999 & 0.999\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
您可以使用\multicolumn
将两列居中:
\documentclass{article}
\usepackage{booktabs,siunitx}
\sisetup{table-format=1.3} % default numerical column spec
\begin{document}
\begin{table}
\sisetup{table-format=1.3}
\centering
\begin{tabular}{
l
S[table-format=2]
S[table-format=1.3]
SS
l
S[table-format=1.3]
S[table-format=1.3]
S
l
l
S[table-format=2]
S[table-format=1.3]
SS
}
\bottomrule
\addlinespace
&& \multicolumn{2}{c}{Normal} && \multicolumn{2}{c}{Student-t} && \multicolumn{2}{c}{GED} \\
\cmidrule(lr){3-4} \cmidrule(lr){6-7} \cmidrule(lr){9-10} % center non-numerical info (A, B, ...) by placing them in braces
& {s} & {KLIC} & {CSL} & & {KLIC} & {CSL} & & {KLIC} & {CSL} \\
\midrule % leave gap between the two rules
GARCH
& 1 & 0.999 & 0.999 & & 0.999 & 0.001 & & 0.999 & 0.999 \\
& 5 & 0.999 & 0.826 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 10 & 0.999 & 0.826 & & 0.999 & 0.999 & & 0.999 & 0.999\\
\addlinespace
GJR
& 1 & 0.999 & 0.010 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 5 & 0.999 & 0.010 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 10 & 0.999 & 0.008 & & 0.999 & 0.999 & & 0.999 & 0.999\\
\addlinespace
MS
& 1 & 0.999 & 0.998 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 5 & 0.999 & 0.812 & & 0.999 & 0.999 & & 0.999 & 0.999\\
& 10 & 0.999 & 0.811 & & 0.999 & 0.999 & & 0.999 & 0.999\\
\bottomrule
\end{tabular}
\end{table}