# How to sequentially reveal transitions with two columns in beamer

I have a slide in beamer. I would like the top part above a horizontal line to stay the same. First I would like the left hand column below the line to be filled, then the right hand column, then the left hand column to be replaced with some other text. Here is a MWE:

\documentclass[xcolor={svgnames,table},english]{beamer}
\usepackage{babel}
\usepackage[pangram]{blindtext}
\begin{document}
\begin{frame}
\frametitle{Boson Sampling - mathematically}
\blindtext[5]

%$\frac{| A|^2}{\prod_{j=1}^m s_j!}, \text{s_j is number of copies of the jth row of M}$

\uncover<2->{
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}
}
\begin{columns}

\begin{column}{0.5\textwidth}  %%<--- here
\begin{center}
\uncover<2-3>{
\begin{equation*}
M = \left(\begin{array}{ccc}
M_{0,0} & M_{0,1} & M_{0,2} \\
M_{1,0} & M_{1,1} & M_{1,2} \\
M_{2,0} & M_{2,1} & M_{2,2} \\
M_{3,0} & M_{3,1} & M_{3,2} \\
M_{4,0} & M_{4,1} & M_{4,2} \\
M_{5,0} & M_{5,1} & M_{5,2} \\
M_{6,0} & M_{6,1} & M_{6,2} \\
M_{7,0} & M_{7,1} & M_{7,2} \\
M_{8,0} & M_{8,1} & M_{8,2} \\
\end{array}\right)
\end{equation*}
}
\uncover<4>{
${n + m -1 \choose n} \approx \mathrm{e}^n (m/n)^n n^{-1/2})$ different possibles matrices $A$.

\vfill

${8^2 + 8 -1\choose 8} \approx 2^{33},$

${12^2 + 12 -1 \choose 12} \approx 2^{58}$ Permanents are expensive.
}

\end{center}
\end{column}

\begin{column}{0.5\textwidth}  %%<--- here
\uncover<3->{
\begin{center}
\begin{equation*}
A = \left(\begin{array}{ccc}
M_{1,0} & M_{1,1} & M_{1,2} \\
M_{1,0} & M_{1,1} & M_{1,2} \\
M_{6,0} & M_{6,1} & M_{6,2} \\
\end{array}\right)
\end{equation*}
\end{center}
}
\end{column}
\end{columns}
\end{frame}
\end{document}


Unfortunately transitions 3 and 4 appear below transition 2 off the bottom of the slide. I can see this is because of \uncover<2-3> but I can't see how to fix it. I have two questions:

• How can I get transitions 3 and 4 to appear on the slide and not off the bottom? I tried replacing \uncover<2-3> by \only<2-3> but that didn't work.
• The gap below the horizontal line and the top of matrix M is too large . How can I reduce that so that it roughly matches the gap above the horizontal line and the text above it?

Something like this?

\documentclass[xcolor={svgnames,table},english]{beamer}

\usepackage{babel}
\usepackage[pangram]{blindtext}

\begin{document}

\begin{frame}[t]
\frametitle{Boson Sampling - mathematically}
\vspace{0.3cm}
\blindtext[5]
\uncover<2->{%
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}
}

\vspace{-0.75cm}
\begin{columns}[T,onlytextwidth]
\begin{column}{0.5\textwidth}  %%<--- here
\centering
\only<2-3>{%
\begin{equation*}
M = \left(
\begin{array}{ccc}
M_{0,0} & M_{0,1} & M_{0,2} \\
M_{1,0} & M_{1,1} & M_{1,2} \\
M_{2,0} & M_{2,1} & M_{2,2} \\
M_{3,0} & M_{3,1} & M_{3,2} \\
M_{4,0} & M_{4,1} & M_{4,2} \\
M_{5,0} & M_{5,1} & M_{5,2} \\
M_{6,0} & M_{6,1} & M_{6,2} \\
M_{7,0} & M_{7,1} & M_{7,2} \\
M_{8,0} & M_{8,1} & M_{8,2} \\
\end{array}
\right)
\end{equation*}
}
\only<4>{%
${n + m -1 \choose n} \approx \mathrm{e}^n (m/n)^n n^{-1/2})$
different possibles matrices $A$.
${8^2 + 8 -1\choose 8} \approx 2^{33},$
${12^2 + 12 -1 \choose 12} \approx 2^{58}$
Permanents are expensive.
}
\end{column}
\begin{column}{0.44\textwidth}  %%<--- here
\uncover<3->{%
\centering
\vspace{1.4cm}
\begin{equation*}
A = \left(
\begin{array}{ccc}
M_{1,0} & M_{1,1} & M_{1,2} \\
M_{1,0} & M_{1,1} & M_{1,2} \\
M_{6,0} & M_{6,1} & M_{6,2} \\
\end{array}
\right)
\end{equation*}
}
\end{column}
\end{columns}
\end{frame}
\end{document}


• @Raphael I usually put \begin{overlayarea}{\textwidth}{\textheight} after \frametitle{..} and \end{overlayarea} before \end{frame} to prevent these jumps. (And I am relieved and shocked to learn that there is no well-known fix to the \vspace problem.) – user121799 Jan 3 '18 at 20:24
• @marmot Maybe something like \begin{overlayarea}{\textwidth}{.89\textheight} would be better, as \textheight includes the frametitle. Your code basically causes an overfull vbox on ever page. – user36296 Jan 3 '18 at 20:52
• @marmot The exact number may have to be tweaked, depending how your frametitle looks like etc. Alternatively it could be automated by calculating the remaining space on the slide. We have got a few answer on this site, I just don't find them right now. – user36296 Jan 3 '18 at 21:09
• @samcarter Actually, it would be great if there was an option in the beamer package that does that automatically, like \preventjumps or so. ;-) Or is there such an option? – user121799 Jan 3 '18 at 21:11
• @marmot the option is called \begin{frame}[t], however if the content overflows the available space (like overlay 4 in the above example) one has to use dirty hacks (or rearrange the content). – user36296 Jan 3 '18 at 21:14