I am trying to use \only{...}
within a table to selectively add blocks of lines. This works as long as I don't have a \midrule
or \bottomrule
included or following the part contained in \only{...}
.
Why does this happen and is there a way to achieve this nevertheless?
An example follows:
\documentclass{beamer}
\usepackage{booktabs}
\begin{document}
\begin{frame}{Example}
\begin{tabular}{ll}
\toprule
bla & bla \\
\midrule
A & A \\
B & B \\
\only<1>{%
\midrule
C & C \\
D & D \\ }
\bottomrule
\end{tabular}
\only<2>{Something else}
\end{frame}
\end{document}
Best Answer
I managed to get it working with some carefully placed comments, see below for example. It seems that LaTeX doesn't like it when you place
\\
and\*rule
on different lines.