对于这个所需表格有任何建议吗
这是我的代码
\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[margin=20mm]{geometry}
\begin{document}
\begin{table}
\begin{tabular}{lSSSSSSSS}
\toprule
\multirow{2}{*}{ Markets Models} &
\multicolumn{2}{c}{HK – MEM(1,1)} &
\multicolumn{2}{c}{IN- MEM(1,1)} &
\multicolumn{2}{c}{KO- MEM(1,1)} &
\multicolumn{2}{c}{MA- MEM(2,1)} \\
& {Base} & {Selected} & {Base} & {Selected} & {Base} & {Selected}& {Base} & {Selected}
\\
\midrule
Loglik & -3267.975 &-3265.314& -3447.357& -3434.800& -3696.633& -3694.599& -3032.638& -3029.500 \\
LB(12) & 20.920& 13.805& 51.230& 20.545& 23.850& 13.335& 21.729& 15.733 \\
& 0.052& 0.313& 0.000& 0.057& 0.021& 0.345& 0.041& 0.204 \\
LBSQ(12) & 20.212& 13.087& 18.497& 12.647& 15.899& 10.677& 14.488& 10.958\\
& 0.063& 0.363& 0.101& 0.395& 0.196& 0.557& 0.271& 0.533\\
$\hat{\Phi}$ & & 5.61 & & 3.71 & & 6.51 & &4.41 \\
No spillovers & & 2.326 & & 5.978 & & 2.372& & 3.785\\
p-value & & (0.023) & & (0.000) & & (0.002)& & (0.000)\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
我的输出:
答案1
- 您的文档示例不完整。错误包括:
- 正在加载包
siunitx
S
列规范定义
- 正在加载包
- 而不是
tabular
最好使用tabular*
表格并留给 LaTeX 来计算tabcolsep
:
\documentclass{article}
\usepackage[margin=20mm, showframe]{geometry}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{siunitx}
\sisetup{
input-open-uncertainty =,
input-close-uncertainty=,
table-align-text-pre=false,
group-minimum-digits=4,
group-separator = {,}
}
\begin{document}
\begin{table}
\small
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l
*{8}{S[table-format=-4.4]} @{}}
\toprule
\multirow{2}{*}{Markets Models}
& \multicolumn{2}{c}{HK – MEM(1,1)}
& \multicolumn{2}{c}{IN- MEM(1,1)}
& \multicolumn{2}{c}{KO- MEM(1,1)}
& \multicolumn{2}{c}{MA- MEM(2,1)} \\
\cmidrule(lr){2-3}\cmidrule(lr){4-5}
\cmidrule(lr){6-7}\cmidrule(lr){8-9}
& {Base} & {Selected} & {Base} & {Selected}
& {Base} & {Selected} & {Base} & {Selected} \\
\midrule
Loglik
& -3267.975 &-3265.314 & -3447.357 & -3434.800
& -3696.633 & -3694.599 & -3032.638 & -3029.500 \\
LB(12)
& 20.920 & 13.805 & 51.230 & 20.545
& 23.850 & 13.335 & 21.729 & 15.733 \\
& 0.052 & 0.313 & 0.000 & 0.057
& 0.021 & 0.345 & 0.041 & 0.204 \\
LBSQ(12)
& 20.212 & 13.087 & 18.497 & 12.647
& 15.899 & 10.677 & 14.488 & 10.958 \\
& 0.063 & 0.363 & 0.101 & 0.395
& 0.196 & 0.557 & 0.271 & 0.533 \\
$\hat{\Phi}$
& & 5.61 & & 3.71
& & 6.51 & & 4.41 \\
No spillovers
& & 2.326 & & 5.978
& & 2.372 & & 3.785 \\
p-value
& & (0.023) & & (0.000)
& & (0.002) & & (0.000) \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
附录:
在这种情况下,您将需要一个长表,并且没有名称的行中的数字应该放在括号中(我怀疑这一点),并且比您可以考虑以下解决方案(使用包tabularray
)更好的形式:
\documentclass{article}
\usepackage[margin=20mm]{geometry}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\sisetup{
input-open-uncertainty =,
input-close-uncertainty=,
table-align-text-pre=false,
group-minimum-digits=4,
group-separator = {,}
}
\SetTblrStyle{caption-tag}{font=\small\scshape}
\SetTblrStyle{caption-text}{font=\small\scshape}
\begin{document}
\lipsum[1-7]
\begin{longtblr}[
caption = {Model Diagnostic},
label = {tab:MD}
]{rowhead = 2,
colsep = {3pt},
colspec = {@{}l *{8}{X[c, si={table-format=-4.3{)}}]} @{}},
row{3-X}= {rowsep = 0pt},
rows = {font=\small}
}
\toprule
\SetCell[r=2]{c} Markets Models
& \SetCell[c=2]{c} {{{HK – MEM(1,1)}}}
& & \SetCell[c=2]{c} {{{IN -- MEM(1,1)}}}
& & \SetCell[c=2]{c} {{{KO -- MEM(1,1)}}}
& & \SetCell[c=2]{c} {{{MA -- MEM(2,1)}}} \\
\cmidrule[lr]{2-3}\cmidrule[lr]{4-5}
\cmidrule[lr]{6-7}\cmidrule[lr]{8-9}
& {{{Base}}} & {{{Selected}}} & {{{Base}}} & {{{Selected}}}
& {{{Base}}} & {{{Selected}}} & {{{Base}}} & {{{Selected}}} \\
\midrule
Loglik
& -3267.975 &-3265.314 & -3447.357 & -3434.800
& -3696.633 & -3694.599 & -3032.638 & -3029.500 \\
\addlinespace
LB(12)
& 20.920 & 13.805 & 51.230 & 20.545
& 23.850 & 13.335 & 21.729 & 15.733 \\
& (0.052) & (0.313) & (0.000) & (0.057)
& (0.021) & (0.345) & (0.041) & (0.204) \\
\addlinespace
LBSQ(12)
& 20.212 & 13.087 & 18.497 & 12.647
& 15.899 & 10.677 & 14.488 & 10.958 \\
& (0.063) & (0.363) & (0.101) & (0.395)
& (0.196) & (0.557) & (0.271) & (0.533) \\
\addlinespace
$\hat{\Phi}$
& & 5.61 & & 3.71
& & 6.51 & & 4.41 \\
\midrule[0.15pt, fg=gray]
No spillovers
& & 2.326 & & 5.978
& & 2.372 & & 3.785 \\
p-value
& & (0.023) & & (0.000)
& & (0.002) & & (0.000) \\
\midrule[2pt, fg=gray]
\SetCell[c=9]{c} some text (as title for next table part)
& & & & & & & & \\
\midrule
Loglik
& -3267.975 &-3265.314 & -3447.357 & -3434.800
& -3696.633 & -3694.599 & -3032.638 & -3029.500 \\
\addlinespace
LB(12)
& 20.920 & 13.805 & 51.230 & 20.545
& 23.850 & 13.335 & 21.729 & 15.733 \\
& (0.052) & (0.313) & (0.000) & (0.057)
& (0.021) & (0.345) & (0.041) & (0.204) \\
\addlinespace
LBSQ(12)
& 20.212 & 13.087 & 18.497 & 12.647
& 15.899 & 10.677 & 14.488 & 10.958 \\
& (0.063) & (0.363) & (0.101) & (0.395)
& (0.196) & (0.557) & (0.271) & (0.533) \\
\addlinespace
$\hat{\Phi}$
& & 5.61 & & 3.71
& & 6.51 & & 4.41 \\
\midrule[0.15pt, fg=gray]
No spillovers
& & 2.326 & & 5.978
& & 2.372 & & 3.785 \\
p-value
& & (0.023) & & (0.000)
& & (0.002) & & (0.000) \\
\bottomrule
\end{longtblr}
\end{document}