In a table in beamer
, I would like to remove \hline
after X number of slides using
\only<1>{\hline}
But this always results in an error message:
Misplaced
\noalign
What can I do to overcome this (other than create a new table on the following slide)?
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{tabular}{*5{c}}
1 & 2 & 3 & 4 & \only<2>{5}\\
\only<1>{\hline}
\end{tabular}
\end{frame}
\end{document}
Edit:
Marco Daniel's answer does fix what I asked for above. However, it does not work when the second row begins with a multicolumn
:
\documentclass{beamer}
\usepackage{multirow}
\begin{document}
\begin{frame}
\begin{tabular}{*5{c}}
\multicolumn{1}{|c|}{1} & 2 & 3 & 4 & \only<1>{5}\only<2>{\multirow{2}{*}{5}}
\onslide<1>{\\\hline}\onslide<2>{\\[-\normalbaselineskip]}
\multicolumn{1}{|c|}{1} & 2 & 3 & 4 & \only<1>{5}\only<2>{}
\end{tabular}
\end{frame}
\end{document}
Misplaced
\omit
Best Answer
You must put the complete statement in
\onslide
: