I am doing a presentation with Beamer and I need help with the use of \only<.> and \boxed{}.

I would like to get the following effect:

  1. a=b+c

  2. a=b+c


  3. a=b+d


  4. a=b+\boxed{d}


I used the following code but I don't like the effect because when it put the box around d it moves also "c=d". Could someone help me to find a different code?


So I would like to get the "d boxed" after that "a=b+d" appears without moving "c=d".

Could someone help me?

2 Answers 2


First: you don't use align properly. You have to write "c=d" inside the environementalign, and "glue" the two equations with an &.

Second: you have to precisely align "d" correspondig to the differences between the width of d and \boxed{d}.

There are two solutions (assuming that the frame is center-aligned); both of the should work, but shomehow the second is better.


% For both solutions

% Just for the second solution



% First solution

% Second solution



enter image description here


The problem here is that \boxed{d} has a different width than d. Tom Solid's solution, unfortunately, looks awkward with the extra spacing inserted.

I'm not sure where you're getting \boxed from (I guess it gets loaded indirectly by beamer) but I've found it defined in multiple packages as:


(or its equivalent). Digging into the definitions of \fbox there is extra space of \fboxsep surrounding the box contents inside the box plus the width of the lines which is \fboxrule. We can use this to make a new command, \bxed (or whatever you prefer to call it) which will remove the space that has been added so that the box spills into the existing white space around d when its printed.


This should give the desired result.

Also, the & in the align environment should come before the = and not after it. You'll notice in Tom's example that the spacing between a and = is larger than the spacing between = and b. Moving the ampersand fixes that issue.

You must log in to answer this question.

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