[Tex/LaTex] undefined control sequence and a problem for compiling a table

multirowtables

I need a help to show this figure correctly. Numbers are not on the center.

\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}

EDIT

[Copied from 'answer' below.]

\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}

enter image description here

Best Answer

Well, I put together an (almost) MWE; it's not quite minimal, but it gives a good idea of what the whole table will look like. And it compiles; neither of the code you posted would compile for me, and because it's not clear what packages you're loading (since there's no MWE) I couldn't make sense of your table specification.

I started by greatly simplifying the \begin{tabular} line; also, your \cmidrule was throwing an error, so I changed (c) to (lr). This gives:

\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}

Which yields:

Simplified table

You'll notice that this already goes a long way to making the table look better. If you want the decimal points to be aligned (as it seems you do), you only need slight adjustments, plus the inclusion of 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}

(All the multicolumn{1} makes sure that those columns will be centered, which otherwise they won't be since their column specification asks that they be aligned on a decimal point.) This gives:

Centered on decimal point table

Is this closer to what you're looking for?

Related Question