I am very new to Beamer (and a latex novis) so I guess I am just missing some basics. I couldn't find an answer to my question, so I hope this isn't a repost.

I am trying to show my equation changing in the same frame and keep alignment of all things that do not change. As you can see I managed to set a new width of the 0 on slide 2-3 to take up as much space as the F that was there before but I can't figure out how to get it to stay still when i move the last term to the left side.

I have tried moving the & around and now I have sprinkled with some \phantom's but it still moves.

Sorry about all the packages. I have forgotten which does what so I included them all.

Is there an easy fix to get it to be still?

\setbeamertemplate{footline}[frame number]
\DeclareFontShape{OT1}{cmss}{b}{n}{<->ssub * cmss/bx/n}{} 




    \frametitle{$\int \frac{dp}{\rho} + \frac{\partial \phi}{\partial t} + \frac{1}{2} \norm{\nabla \phi}^2 = constant$}
        &\only<1-2>{\phantom{-\frac{1}{\rho }\nabla p +}\frac{\partial \mathbf{v}}{\partial t} + (\mathbf{v} \cdot \nabla)\mathbf{v}} \only<3->{\frac{1}{\rho }\nabla p + \frac{\partial \mathbf{v}}{\partial t} + (\mathbf{v} \cdot \nabla)\mathbf{v}} = 
        \only<1>{\mathbf{F}-\frac{1}{\rho }\nabla p}
        \only<2>{\Sz-\frac{1}{\rho }\nabla p}
        \only<3>{\Sz \phantom{-\frac{1}{\rho }\nabla p}}


1 Answer 1


I've simplified your implementation using \alt<os>{<default>}{<other>} which sets <default> on the given overlay specification and <other> otherwise.

enter image description here





  \frametitle{An equation}
    \alt<3>{\frac{1}{\rho }\nabla p +}{\phantom{\frac{1}{\rho }\nabla p + {}}}
      \frac{\partial \mathbf{v}}{\partial t} + (\mathbf{v} \cdot \nabla)\mathbf{v} = 
    \alt<1-2>{-\frac{1}{\rho }\nabla p}{\phantom{{} -\frac{1}{\rho }\nabla p}}


The important thing to note here is additional {} within \phantom as it provides the appropriate spacing around binary operators.

  • Wow, that was fast! And also a much simpler way of writing it =) I implemented your code, but I'll go over mine tomorrow with your tip regarding '\phantom' to see where I got it wrong. Thank you, sir!
    – Mathphyte
    Feb 24, 2021 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .