Cmidrule misplaced \noalign

alignmentbeamerbooktabsrulestables

I am using cmidrule as I have used it before, but it's giving me strange errors. Below the MWE reproduces them. What is going on?

\documentclass{beamer}

\usepackage{booktabs}
\usepackage{multicol}
\usepackage{multirow}

\begin{document}

\begin{frame}{MWE}
    \begin{table}[tbh!]
        \centering
        \footnotesize
        \begin{tabular}{lccccccc}
            \toprule
                        & \multicolumn{3}{c}{(1)} && \multicolumn{3}{c}{(2)} \\
                        & \multicolumn{3}{c}{\textbf{OUTCOME}} && \multicolumn{3}{c}{\textbf{OUTCOME}} \\
                        & \cmidrule{2-4} \cmidrule{6-8} \\
                        & I & II & III && I & II & III \\
           \midrule
            \bottomrule
        \end{tabular}
    \end{table}
\end{frame}

\end{document}

Best Answer

The line

& \cmidrule{2-4} \cmidrule{6-8} \\

contains a syntax error (&) and a typographical error (\\).

There also seems to be no need for 8 columns when 6 will do just fine. For visual balance, I'd also omit the bold-facing of some of the header cells. Since we're dealing with a beamer document, there's no point in using a table float to encase the tabular material. To finish things off, here's an excerpt from section 2 of the user guide of the booktabs package (emphasis added by me):

enter image description here

Thus, use either \midrule or \bottomrule, but not both.


Here's how I would be tempted to reconfigure your table -- note the absence of whitespace padding on the left- and right-hand sides.

enter image description here

\documentclass{beamer}
\usepackage{booktabs}
\begin{document}
\begin{frame}{MWE}
    % don't use figure and table floats in beamer docs
    %%\begin{table} 
    \begin{center}
    \begin{tabular}{@{} *{6}{c} @{}}
    \toprule
    \multicolumn{3}{@{}c}{(1)}     & \multicolumn{3}{c@{}}{(2)}     \\
    \multicolumn{3}{@{}c}{OUTCOME} & \multicolumn{3}{c@{}}{OUTCOME} \\
    \cmidrule(r){1-3} \cmidrule(l){4-6} 
    I & II & III & I & II & III \\
    \midrule
    aaa & bbb & ccc & ddd & eee & ggg \\
    \bottomrule
    \end{tabular}
    \end{center}
    %%\end{table}
\end{frame}
\end{document}
Related Question