Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I get the align environment to play nicely with beamer overlays? As a simple example I would like

\begin{align*}  
    a = \frac{bc}{c}  
\end{align*}

on the first overlay and then

\begin{align*}  
    a = b  
\end{align*}

on the second, but I want the equal signs to line up for both. Using beamer's \overprint environment, for example, the equal sign shifts between the two lines I guess because they are of different length.

share|improve this question
    
Welcome to tex.sx! A tip: If you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it) –  Joseph Wright Apr 19 '11 at 13:06

1 Answer 1

up vote 5 down vote accepted

\pause is the only overlay command that really gives me trouble. I am usually able to workaround with the overlay-aware \only, \uncover, \alt, etc. Just make sure you don't put the alignment character & inside one of their arguments.

In this case we use a standard trick for alignment: make the smaller thing overlap and the larger thing invisible.

\documentclass{beamer}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}

\begin{frame}
\begin{align*}
    a &= \mathrlap{\alt<2->{b}{\frac{bc}{c}}}\phantom{\frac{bc}{c}}
\end{align*}
\end{frame}

\end{document}
share|improve this answer
    
looks pretty good--there's still some vertical jitter in your code, is there a way to take care of that too? –  evencoil Apr 19 '11 at 13:33
    
Uh yeah, I'm an idiot...just add \vphantom{\frac{bc}{c}} and its good to go. Great solution, thanks again! –  evencoil Apr 19 '11 at 13:37
    
@evencoil: or do both with \phantom. –  Matthew Leingang Apr 19 '11 at 14:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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