I try to show frame in 4 slides. First 2 are fine, but I fail in showing a table using two slides. Content of first column appears correctly – only on slide 4, but borders around this column are still shown
\documentclass[12pt]{beamer}
%\documentclass[12pt,handout]{beamer}
\usepackage{multirow} %Used for tables with merged cells
\usepackage{collcell} %pdflatex.exe hangs without this one
\begin{document}
\begin{frame}{Communication Models}
\begin{itemize}[<+->]
\item OSI
\item TCP/IP
\end{itemize}
\onslide<3->
\begin{center}
%Works almost fine, but first column should disappear fully (not just text)
\begin{tabular}{|>{\onslide<4->}l<{\onslide<3->}|l|l|l|}
\hline
\textbf{Mnemonic}& \textbf{\#} & \textbf{OSI} & \textbf{TCP/IP} \\ \hline
All & 7 & Application & \multirow{3}{*}{Application} \\ \cline{1-3}
People & 6 & Presentation & \\ \cline{1-3}
Seem & 5 & Session & \\ \hline
To & 4 & Transport & Transport \\ \hline
Need & 3 & Network & Internet \\ \hline
Data & 2 & Data Link & \multirow{2}{*}{Link Access} \\ \cline{1-3}
Processing & 1 & Physical & \\ \hline
\end{tabular}
\end{center}
\end{frame}
\end{document}
Instead of:
\begin{tabular}{|>{\onslide<4->}l<{\onslide<3->}|l|l|l|}
I tried to use:
\begin{tabular}{>{\onslide<4->}|l<{\onslide<3->}|l|l|l|}
\begin{tabular}{ \ifnum\slideno>3 | \fi >{\onslide<4->}l<{\onslide<3->}|l|l|l|}
but first version gives:
! Package array Error: >{..} at wrong position: token ignored.
and second:
! Package array Error: Illegal pream-token (\ifnum): `c' used.
Is it possible to make first column to be hidden on several slides completely (including borders)?
Solution, based on Piet's answer (UPD2)
Updated solution (UPD3) uses page-independent slideinframe
counter, which is counted for each frame separately
This solution uses \newcolumntype{G}
for first column, which does not appear at slide 3, but appears at slide 4 and handouts.
% Add line below to preamble
\def\Gobble#1\EndGobble{}
% UPD3: 3 lines below define slide counter within a frame (found here: http://tex.stackexchange.com/a/120940/119704)
\makeatletter
\def\c@slideinframe{\beamer@slideinframe}
\makeatother
...
% Add lines below to body (before tabular, and edit tabular definition)
% Next line is to show first column on handouts
\newcolumntype{G}{|l}
% Rules below hide first column on first 3 slides of beamer presentation, no influence on handouts
\only{beamer}{
% UPD3: Change "page" to "slideinframe"
%\ifnum\value{page}>3 \newcolumntype{G}{|l}\else
\ifnum\value{slideinframe}>3 \newcolumntype{G}{|l}\else
% I would be grateful if someone could describe the magic below :)
\newcolumntype{G}{@{}>{\Gobble}l<{\EndGobble}@{}}\fi
}
% Apply newcolumntype
\begin{tabular}{G|l|l|l|}
Solution based on samcarter's workaround (UPD1)
Draw a rectangle with color, equal to background color
This solution needs fine tuning (position and size of the rectangle)
% Add line below to preamble:
\usepackage{tikz}
...
% Add lines to the end of frame:
\only<beamer>{
\vspace*{-4.7cm}
\begin{tikzpicture}
\begin{onlyenv}<3>
\draw [color=bg, fill=bg] (0,0) rectangle (3.67,4.3);
\end{onlyenv}
\end{tikzpicture}
}
\end{frame}
\end{document}
Best Answer
Edit: I have changed this to a slightly cleaner solution with
\newcolumntype
.You cannot put macros in a
tabular
spec that have to be expanded at definition time. You you must make the wholebegin{tabular}{...}
line conditional. And then you still have the first column text that must be swallowed up.Alternatively, define a new columntype, conditional on the slide number. Here is an example: