# How can I uncover the fraction line in beamer?

I would like to uncover elements of an equation one at a time. This is easy enough usually, but in this case I'd like to progressively reveal a fraction. The problem with the way I'm doing it is that the fraction line is visible throughout, and for obvious aesthetic reasons I'd only like it to show up on the last uncover. Here's how I'm doing it now :

\documentclass[8pt,xcolor=dvipsnames,compress]{beamer}
\begin{document}
\begin{frame}
$\frac{\uncover<2->{\int} \phi(\lambda) \uncover<2->{T(\lambda) \lambda d \lambda}}{\uncover<3->{\int \phi_{S}(\lambda) T(\lambda) \lambda d \lambda}}$
\end{frame}
\end{document}


This reveals the elements I'd like to reveal when I'd like to reveal them, but as I've said keeps the fraction line throughout. Any ideas on how to only make it appear on step 3 ?

• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – henry May 27 '15 at 13:25
• Sorry about that, I've turned my code into a minimally working example now. Hope that's enough. – ticster May 27 '15 at 13:32
• I meant to put it on the first slide. But as you wrote somewhere else apparently you intend to keep it in one place. So you could color the fraction line but this is apparently a bit complex but somebody has done it of course. :) => tex.stackexchange.com/questions/149731/color-fraction-bar – henry May 27 '15 at 14:24
• @henry Now all I need to do is make the \frac line white in the first 2 slides and black again in the last one... Gonna try to see if that's doable. – ticster May 27 '15 at 14:29
• @henry Success ! And no ugly "color it as the background" needed. Gonna post it as an answer. – ticster May 27 '15 at 14:33

Inspired by some of the tweaking found here, I've come up with the following solution :

\documentclass[8pt,xcolor=dvipsnames,compress]{beamer}
\begin{document}
\begin{frame}
$\uncover<2->{\int} \phi(\lambda) \uncover<2->{T(\lambda) \lambda d \lambda} \uncover<3->{\above 0.4pt} \uncover<3->{\int \phi_{S}(\lambda) T(\lambda) \lambda d \lambda}$
\end{frame}
\end{document}


Basically you just avoid the \frac command entirely by doing what it does yourself using \above, allowing you to use \uncover on the \above command.

Here's a pretty fun non-complete solution. I've taken the \binom command and removed the parentheses. The elements are not completely unmoving though. We can probably tweak the command some more. I will look into it more later.

After @LoopSpace's kind encouragement I made a new attempt and solved it. The good thing about \binom is as @LoopSpace was discussing that it works the same way as \frac but without the fraction bar. I added a phantom of the denominator to get the correct alignment of the fraction.

However, even with the newly defined command, I couldn't get the correct horizontal alignment if the \int was within a \uncover environment, to solve this, I put the \int in the full fraction within an \uncover environment as well.

\documentclass[8pt,xcolor=dvipsnames,compress]{beamer}
\newcommand{\hidefrac}[2]{\genfrac{}{}{0pt}{0}{#1}{#2}} %new command, 0 in the fourth argument means displaystyle (change to 1 for textsize)
%taken from definition of \binom in the amsmath package

\begin{document}
\begin{frame}
$\only<1-2>{\hidefrac{\uncover<2->{\int}\phi(\lambda)\uncover<2->{T(\lambda)\lambda d\lambda}}{\phantom{\int\phi_{S}(\lambda)T(\lambda)\lambda d\lambda}}}$%
$\only<3->{\displaystyle\frac{\uncover<3->{\int}\phi(\lambda)T(\lambda)\lambda d\lambda}{\int\phi_{S}(\lambda)T(\lambda)\lambda d \lambda}}$
\end{frame}
\end{document}


And be careful with spaces. Try removing the % in the end of the first \only line to see what I mean.

• I don't really understand the point of bringing in \binom. What novelty does this bring in relative to Andrew's answer ? – ticster May 27 '15 at 14:26
• Mentionning \binom is perhaps a red herring. The key is using the \genfrac command upon which both \frac and \binom are based. You could even make an overlay-aware version of this to condense the code still further. Good answer. – Loop Space May 27 '15 at 17:44

Just use \pause:

$\frac{\uncover<2->{\int} \phi(\lambda) \uncover<2->{T(\lambda) \lambda d \lambda}\pause[3]}{\int \phi_{S}(\lambda) T(\lambda) \lambda d \lambda}$

• The problem with \pause is that it completely messes up my slide if I want to have other things appear lower in the slide before I'm done completely revealing the equation. – ticster May 27 '15 at 14:53
• Yes, that is a problem. I didn't think about that. – Mark May 27 '15 at 18:49