在上面的表格中,多列下方的三列较小,并向左对齐。但是,我希望它们相对于上方最大的多列垂直居中,如下所示
\documentclass{book}
\usepackage[x11names]{xcolor}
\usepackage[a4paper]{geometry}
\geometry{twoside=true, showframe=false}
% Horizontal
\geometry{inner=5mm, outer=5mm, includemp=true, bindingoffset=5mm, marginparsep=3.5mm, marginparwidth=15mm}
% Vertical
\geometry{top=20mm, vmarginratio=3:5, includehead=true, includefoot=true, headheight=8pt, headsep=14pt, footskip=5mm}
\usepackage{ragged2e}
\usepackage{tabularx}
\newcolumntype{C}{ >{\arraybackslash \Centering}X }
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{mathtools}
\begin{document}
\begin{table*}[htb]
% Center the table
\centering
\begin{tabularx}{\textwidth}{*{3}{l} >{\hsize=0.75\hsize}C !{\vrule width 0.25mm}*{3}{l} >{\hsize=0.75\hsize}C !{\vrule width 0.25mm}>{\hsize=1.5\hsize}C}
\toprule
\multicolumn{3}{c}{Exhaustive Search Method} & & \multicolumn{3}{c}{Proposed Method} & &
\\
\Xhline{0.25mm}
\multicolumn{3}{c}{Combination of POIs} & $\mathit{SDSCR_{min}}$ & \multicolumn{3}{c}{Combination of POIs} & $\mathit{SDSCR_{min}}$ & Reference POIs
\\
\Xhline{0.25mm}
33 & 36 & 35 & 4.90 & 33 & 36 & 35 & 4.90 & 36
\\
34 & 33 & 35 & 5.23 & 34 & 33 & 35 & 5.23 & 34
\\
11 & 5 & 31 & 5.63 & 11 & 5 & 31 & 5.63 & 11
\\
33 & 14 & 35 & 5.73 & 33 & 14 & 35 & 5.73 & 31
\\
14 & 5 & 31 & 5.76 & 14 & 5 & 31 & 5.76 & 14
\\
\Xhline{0.25mm}
\multicolumn{3}{c}{\color{DodgerBlue2} \bfseries Time 8.8 s} & & \multicolumn{3}{c}{\color{DodgerBlue2} \bfseries Time 0.46 s} & &
\\
\bottomrule
\end{tabularx}
\end{table*}
\end{document}
答案1
你对这个表很幸运:将长标题设置为零宽度可以解决问题。
我会完全避免使用垂直规则并用siunitx
它来更好地对齐图形。
\documentclass{book}
\usepackage[a4paper]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{ragged2e}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{mathtools}
\usepackage{siunitx}
\geometry{
% General
twoside=true,
showframe=false,
% Horizontal
inner=5mm,
outer=5mm,
includemp=true,
bindingoffset=5mm,
marginparsep=3.5mm,
marginparwidth=15mm,
% Vertical
top=20mm,
vmarginratio=3:5,
includehead=true,
includefoot=true,
headheight=8pt,
headsep=14pt,
footskip=5mm,
}
\begin{document}
\begin{table}[htb]
% Center the table
\centering
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
S[table-format=2.0]
S[table-format=2.0]
S[table-format=2.0]
S[table-format=1.2]
S[table-format=2.0]
S[table-format=2.0]
S[table-format=2.0]
S[table-format=1.2]
S[table-format=2.0]
@{}
}
\toprule
\multicolumn{4}{@{}c}{Exhaustive Search Method} & \multicolumn{4}{c}{Proposed Method} \\
\cmidrule(r){1-4}\cmidrule(lr){5-8}
\multicolumn{3}{@{}c}{\makebox[0pt]{Combination of POIs}} & $\mathit{SDSCR}_{\min}$ &
\multicolumn{3}{c}{\makebox[0pt]{Combination of POIs}} & $\mathit{SDSCR}_{\min}$ &
{Reference POIs} \\
\midrule
33 & 36 & 35 & 4.90 & 33 & 36 & 35 & 4.90 & 36 \\
34 & 33 & 35 & 5.23 & 34 & 33 & 35 & 5.23 & 34 \\
11 & 5 & 31 & 5.63 & 11 & 5 & 31 & 5.63 & 11 \\
33 & 14 & 35 & 5.73 & 33 & 14 & 35 & 5.73 & 31 \\
14 & 5 & 31 & 5.76 & 14 & 5 & 31 & 5.76 & 14 \\
\midrule
\multicolumn{3}{@{}c}{\color{DodgerBlue2}\bfseries Time \SI{8.8}{s}} &&
\multicolumn{3}{c}{\color{DodgerBlue2}\bfseries Time \SI{0.46}{s}} \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
答案2
像这样吗?
\documentclass{book}
\usepackage[x11names]{xcolor}
\usepackage[a4paper,twoside]{geometry}
\geometry{inner=5mm, outer=5mm, includemp=true,
bindingoffset=5mm, marginparsep=3.5mm,
marginparwidth=15mm,
top=20mm, vmarginratio=3:5, includeheadfoot,
headheight=8pt, headsep=14pt, footskip=5mm}
\usepackage{ragged2e,tabularx}
\newcolumntype{C}{ >{\arraybackslash\Centering}X }
\usepackage{booktabs,makecell,mathtools}
\begin{document}
\begin{table}[htb]
\begin{tabularx}{\textwidth}{@{}
*{2}{*{3}{>{\hsize=0.9\hsize\linewidth=\hsize}C}
>{\hsize=1.3\hsize\linewidth=\hsize}C}
c @{}}
\toprule
\multicolumn{4}{@{}c}{Exhaustive Search Method} &
\multicolumn{4}{c}{Proposed Method} &
Reference POIs\\
\cmidrule(r){1-4} \cmidrule(lr){5-8}
\multicolumn{3}{@{}c}{Combination of POIs} & $\mathit{SDSCR}_{\min}$ &
\multicolumn{3}{c}{Combination of POIs} & $\mathit{SDSCR}_{\min}$ & \\
\cmidrule(r){1-3} \cmidrule(lr){4-4}
\cmidrule(lr){5-7} \cmidrule(lr){8-8}
\cmidrule(l){9-9}
33 & 36 & 35 & 4.90 & 33 & 36 & 35 & 4.90 & 36 \\
34 & 33 & 35 & 5.23 & 34 & 33 & 35 & 5.23 & 34 \\
11 & 5 & 31 & 5.63 & 11 & 5 & 31 & 5.63 & 11 \\
33 & 14 & 35 & 5.73 & 33 & 14 & 35 & 5.73 & 31 \\
14 & 5 & 31 & 5.76 & 14 & 5 & 31 & 5.76 & 14 \\
\cmidrule(r){1-3} \cmidrule(lr){5-7}
\multicolumn{3}{c}{\color{DodgerBlue2}\bfseries Time 8.8\,s} & &
\multicolumn{3}{c}{\color{DodgerBlue2}\bfseries Time 0.46\,s} & & \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案3
由于罪魁祸首是multicolumn
标题的长度,我只需缩写这些标题并在标题文本中提及完整描述。因此,可以使用标准对齐的简单表格r
,c
。
\documentclass{book}
\usepackage[x11names]{xcolor}
\usepackage[a4paper]{geometry}
\geometry{twoside=true, showframe=false}
% Horizontal
\geometry{inner=5mm, outer=5mm, includemp=true, bindingoffset=5mm, marginparsep=3.5mm, marginparwidth=15mm}
% Vertical
\geometry{top=20mm, vmarginratio=3:5, includehead=true, includefoot=true, headheight=8pt, headsep=14pt, footskip=5mm}
\usepackage{ragged2e}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{mathtools}
\begin{document}
\begin{table*}[htb]
% Center the table
\centering
\begin{tabular}{*3{r}c*3{r}cc}
\toprule
\multicolumn{4}{c}{Exhaustive Search Method} & \multicolumn{4}{c}{Proposed Method} & \\
\cmidrule(r){1-4}\cmidrule(lr){5-8}
\multicolumn{3}{c}{Comb.\ POIs} & $\mathit{SDSCR_{\min}}$ & \multicolumn{3}{c}{Comb.\ POIs} & $\mathit{SDSCR_{\min}}$ & Ref.\ POIs \\ \midrule
33 & 36 & 35 & 4.90 & 33 & 36 & 35 & 4.90 & 36 \\
34 & 33 & 35 & 5.23 & 34 & 33 & 35 & 5.23 & 34 \\
11 & 5 & 31 & 5.63 & 11 & 5 & 31 & 5.63 & 11 \\
33 & 14 & 35 & 5.73 & 33 & 14 & 35 & 5.73 & 31 \\
14 & 5 & 31 & 5.76 & 14 & 5 & 31 & 5.76 & 14 \\ \midrule
\multicolumn{3}{c}{\color{DodgerBlue2} \bfseries Time 8.8 s} & & \multicolumn{3}{c}{\color{DodgerBlue2} \bfseries Time 0.46 s} & & \\ \bottomrule
\end{tabular}
\end{table*}
\end{document}