I've got a problem where I am using beamer's \only
command, but within \only
, the equation number incrementation doesn't survive. I.e., I'd like to do
\only<1>{
\begin{align}
equation 1
\end{align}
}
\only<2>{
\begin{align}
equation 2
\end{align}
}
The problem is that both equations show up as having equation number 1, rather than the first being equation 1 and the 2nd being equation 2. One way to deal with this seems to be to add a \refstepcounter{equation}
after the first only, but that is not ideal, and it depends on how many equations are in the first \only
environment (the same problem would occur if defining a macro, say, that called the \refstepcounter{equation}
at the end of the only, i.e,. the user would need to keep track of how many equations are in each \only
).
Is there a better way to do this? thanks very much!
Best Answer
You can use the
\alt
environment to include the equation when you want and increment the counter when you don't: