Using beamer. Let's say I want to write A+B but with the plus invisible in one slide and visible in the next one. I think I read somewhere that more space is left normally around the + for being a binary operator. It seems to be that A\phantom{+}B leaves only the space of the sign +. How can I get all the space I need.
Asked
Active
Viewed 7,053 times
29
Quinn Culver
- 986
Anna Taurogenireva
- 4,271
2 Answers
30
Need to add additional {} which emulate a binary operator as TeX thinks there is something on either side of the +:
$A\phantom{{}+{}}B$
Peter Grill
- 223,288
29
Use \mathbin for making the invisible symbol a binary operator:
$A\mathbin{\phantom{+}}B$
Stefan Kottwitz
- 231,401
-
What is the difference between your answer and Peter's? Is one better? – Quinn Culver Sep 23 '11 at 15:34
-
I would think @Stefan's answer is more clear, since you literally define
\phantom{+}to act like a binary math operator (via\mathbin. In my opinion, one would only obtain @Peter's solution through experience with this problem, or perhaps a couple of compiles to see whether the spacing is correct. – Werner Sep 25 '11 at 14:33 -
1@Werner: The spacing will be identical. The
{}on either side of the+lets TeX know that there is an item of zero width on either side of the+. But, I do agree that in this case, that\mathbinmore clearly captures the intent. – Peter Grill Sep 25 '11 at 22:00 -
5they may work the same in \phantom, but they dont at the beginning of a line. if i start a line with a logical and, it will attach to the next variable like a unary operator, \mathbin doesnt fix this, {} does. – peter Nov 23 '12 at 10:44
\mathbinbetter captures the intent of what you are doing. – Peter Grill Sep 23 '11 at 15:47&\phanom{=}H...on one line of an align environment and then&=H...on the next, they are misaligned, and using (either of) your trick(s) works. According to your (and Stefan's) explanation, this is because the first=one is not a binary operator whereas the second=is. Am I correct in deducing that the reason the second=is considered a binary operator is because TeX considers the text at the end of the previous line to be to the left of=? – Quinn Culver Sep 23 '11 at 18:16F&\phantom{{}={}}Hshould produce the proper spacing. – Peter Grill Sep 23 '11 at 18:26