我需要帮助才能正确显示此图。数字不在中心。
\begin{table}
\label{ch:a:3:4:2:5}
\centering %\small
\begin{tabular}{c*{5}{d[table-format=2.2]}}
\toprule
\multirow{2}{*}{\textbf{MVV}} & \multicolumn{5}{c}{\textbf{QP}} \\ \cmidrule(c){2-6}
\textbf{Content} & {$20$} & {$26$} & {$32$} & {$38$} & {$44$} \\ \midrule
\texttt{BookArrival} &1.72\% &4.65\% &9.84\% &19.17\%
&36.15\% \\
\texttt{Newspaper} &$3.00\%$ &$8.39\%$ &$18.31\%$ &$28.09\%$ &$41.61\%$\\
\texttt{ChampagneTower} &$4.13\%$ &$8.64\%$ &$14.51\%$ &$25.83\%$
&$39.26\%$\\
\texttt{Caf\'{e}} &$7.78\%$ &$18.28\%$ &$31.58\%$ &$47.49\%$
&$64.43\%$\\
\texttt{PoznanStreet} &$2.21\%$ &$7.37\%$ &$15.55\%$ &$32.48\%$
&$49.00\%$\\
\texttt{PoznanCarPark} &$2.22\%$ &$7.41\%$ &$16.01\%$ &$30.06\%$
&$50.78\%$\\
\bottomrule
\end{tabular}
\end{table}
编辑
[从下面的‘答案’复制。]
\begin{table}
\centering %\small
\begin{tabular}{S[table-format=3.3]S[table-format=1.2]S[table-format=1.2]S[table-format=1.2]S[table-format=2.2]S[table-format=2.2]}
\toprule
\multirow{2}{*}{\textbf{MVV}} & \multicolumn{5}{c}{\textbf{QP}} \\ \cmidrule(c){2 - 6}
\textbf{Content} & {$20$} & {$26$} & {$32$} & {$38$} & {$44$} \\ \midrule
\texttt{BookArrival} &1.72\% &4.65\% &9.84\% &19.17\%
&36.15\% \\
\texttt{Newspaper} &3.00\% &8.39\% &18.31\% &28.09\% &41.61\%\\
\texttt{ChampagneTower} &4.13\% &8.64\% &14.51\% &25.83\%
&39.26\%\\
\texttt{Caf\'{e}} &7.78\% &18.28\% &31.58\% &47.49\%
&64.43\%\\
\texttt{PoznanStreet} &2.21\% &7.37\% &15.55\% &32.48\%
&49.00\%\\
\texttt{PoznanCarPark} &2.22\% &7.41\% &16.01\% &30.06\%
&50.78\%\\
\bottomrule
\end{tabular}
\end{table}
答案1
好吧,我整理了一个(几乎)MWE;它不是最小的,但它很好地说明了整个表格是什么样子。而且它可以编译;你发布的代码对我来说都无法编译,而且由于不清楚你正在加载什么包(因为没有 MWE),我无法理解你的表格规范。
我首先大大简化了该\begin{tabular}
行;另外,您的代码\cmidrule
抛出了错误,因此我将(c)
其改为(lr)
。这给出:
\documentclass{article}
\usepackage{multirow}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{table}
\begin{tabular}{lccccc}
\toprule
\textbf{MVV} & \multicolumn{5}{c}{\textbf{QP}} \\
\cmidrule(lr){2-6}
\textbf{Content} & {$20$} & {$26$} & {$32$} & {$38$} & {$44$} \\
\midrule
\texttt{BookArrival} &1.72\% &4.65\% &9.84\% &19.17\%
&36.15\% \\
\texttt{Newspaper} &$3.00\%$ &$8.39\%$ &$18.31\%$ &$28.09\%$ &$41.61\%$\\
\texttt{ChampagneTower} &$4.13\%$ &$8.64\%$ &$14.51\%$ &$25.83\%$
&$39.26\%$\\
\texttt{Caf\'{e}} &$7.78\%$ &$18.28\%$ &$31.58\%$ &$47.49\%$
&$64.43\%$\\
\texttt{PoznanStreet} &$2.21\%$ &$7.37\%$ &$15.55\%$ &$32.48\%$
&$49.00\%$\\
\texttt{PoznanCarPark} &$2.22\%$ &$7.41\%$ &$16.01\%$ &$30.06\%$
&$50.78\%$\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
得出的结果是:
您会注意到,这已经在很大程度上使表格看起来更好了。如果您希望小数点对齐(您似乎希望如此),则只需进行轻微调整,再加上dcolumn
:
\documentclass{article}
\usepackage{dcolumn}
\usepackage{booktabs}
\begin{document}
\begin{table}
\begin{tabular}{ l *{5}{D{.}{.}{4}} }
\toprule
\textbf{MVV} & \multicolumn{5}{c}{\textbf{QP}} \\
\cmidrule(lr){2-6}
\textbf{Content} & \multicolumn{1}{c}{$20$} & \multicolumn{1}{c}{$26$} & \multicolumn{1}{c}{$32$} & \multicolumn{1}{c}{$38$} & \multicolumn{1}{c}{$44$} \\
\midrule
\texttt{BookArrival} &1.72\% &4.65\% &9.84\% &19.17\%
&36.15\% \\
\texttt{Newspaper} &3.00\% &8.39\% &18.31\% &28.09\% &41.61\%\\
\texttt{ChampagneTower} &4.13\% &8.64\% &14.51\% &25.83\%
&39.26\%\\
\texttt{Caf\'{e}} &7.78\% &18.28\% &31.58\% &47.49\%
&64.43\%\\
\texttt{PoznanStreet} &2.21\% &7.37\% &15.55\% &32.48\%
&49.00\%\\
\texttt{PoznanCarPark} &2.22\% &7.41\% &16.01\% &30.06\%
&50.78\%\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
(所有这些都multicolumn{1}
确保这些列将居中,否则它们将不会居中,因为它们的列规范要求它们在小数点上对齐。)这给出:
这是否更接近您所寻找的?