2

Something is off with \pause in my beamer file below. It does not work properly. Any idea why?

% !TEX encoding = UTF-8 Unicode
\documentclass{beamer}

\begin{document}

\begin{frame}[shrink=10]

\begin{align}
P(Y_i=1) = & \begin{pmatrix} 
n_i \\
y_i \\
\end{pmatrix}\pi_i^{y_i}(1-\pi_i)^{n_i-y_i}  \\ \pause
\mathcal{L} (\boldsymbol{\beta|y}) = & \prod_{i=1}^N 
\begin{pmatrix} 
n_i \\
y_i \\
\end{pmatrix}\pi_i^{y_i}(1-\pi_i)^{n_i-y_i} \\ \pause
= & \prod_{i=1}^N
\begin{pmatrix} 
n_i \\
y_i \\
\end{pmatrix}\Big (\frac{\pi_i}{1-\pi_i} \Big)^{y_i}(1-\pi_i)^{n_i} \\  \pause
\log{\mathcal{L} (\boldsymbol{\beta|y}) } = & \sum_{i=1}^N \Bigg[y_i \log{\Big     (\frac{\pi_i}{1-\pi_i}\Big )} + n_i \log{(1-\pi_i)} + \log \begin{pmatrix} 
n_i \\
y_i \\
\end{pmatrix} \Bigg ] 
\end{align}

\end{frame}

\end{document}
  • Section 23.4 of the manual; align doesn't cooperate well with \pause. – egreg Nov 29 '14 at 18:26
  • The code above perfectly works on Mac, but not on windows. Any idea how to fix this? – Günal Nov 29 '14 at 18:28
  • Sorry, but Windows and I don't get along well. – egreg Nov 29 '14 at 18:33
  • Neither do I :) – Günal Nov 29 '14 at 18:36
4

Uncovering a displayed multiline numbered formula in beamer is a little tricky, as explained in Section 23.4 Uncovering Tagged Formulas Piecewise of the beamer manual; there, you can also find the recommended approach: to use \uncover and an empty last line afterwards compensated using a negative vertical space:

% !TEX encoding = UTF-8 Unicode
\documentclass{beamer}

\begin{document}

\begin{frame}[shrink=10]

\begin{align}
\uncover<+->{
   P(Y_i=1) &=  \binom{n_i}{y_i}\pi_i^{y_i}(1-\pi_i)^{n_i-y_i}  \\
} 
\uncover<+->{
  \mathcal{L} (\boldsymbol{\beta\mid y}) &=  \prod_{i=1}^N 
  \binom{n_i}{y_i} \\
}
\uncover<+->{
  \pi_i^{y_i}(1-\pi_i)^{n_i-y_i} 
  &= \prod_{i=1}^N
  \binom{n_i}{y_i}\Bigl(\frac{\pi_i}{1-\pi_i} \Bigr)^{y_i}(1-\pi_i)^{n_i} \\
}
\uncover<+->{
  \log{\mathcal{L} (\boldsymbol{\beta|y}) } &= \sum_{i=1}^N 
    \Biggl[y_i \log{\Bigl(\frac{\pi_i}{1-\pi_i}\Bigr)} 
    + n_i \log{(1-\pi_i)} + \log \binom{n_i}{y_i}\Biggr] \\
}     
\notag
\end{align}
\vskip-1.5em

\end{frame}

\end{document}

An animation of the result:

enter image description here

Not related to the question, but I made some other modifications to your code: to use \binom instead of bmatrix and to use the "lateral" versions \Biggl, \Biggr instead of just \Bigg to guarantee proper space handling.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.