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.
Add a comment |
2 Answers
Need to add additional {} which emulate a binary operator as TeX thinks there is something on either side of the +:
$A\phantom{{}+{}}B$ - What is the difference between your answer and Stefan's? Is one better?Quinn Culver– Quinn Culver2011-09-23 15:34:05 +00:00Commented Sep 23, 2011 at 15:34
- @Quinn: AFAIK both add identical spacing around the symbol for a binary operator, but the
\mathbinbetter captures the intent of what you are doing.Peter Grill– Peter Grill2011-09-23 15:47:47 +00:00Commented Sep 23, 2011 at 15:47 - When I use
&\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– Quinn Culver2011-09-23 18:16:10 +00:00Commented Sep 23, 2011 at 18:16 - Not exactly sure I fully understand, perhaps it is best to post an additional question with a full MWE, but using
F&\phantom{{}={}}Hshould produce the proper spacing.Peter Grill– Peter Grill2011-09-23 18:26:03 +00:00Commented Sep 23, 2011 at 18:26
Use \mathbin for making the invisible symbol a binary operator:
$A\mathbin{\phantom{+}}B$ - What is the difference between your answer and Peter's? Is one better?Quinn Culver– Quinn Culver2011-09-23 15:34:14 +00:00Commented Sep 23, 2011 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.2011-09-25 14:33:38 +00:00Commented Sep 25, 2011 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– Peter Grill2011-09-25 22:00:02 +00:00Commented Sep 25, 2011 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– peter2012-11-23 10:44:38 +00:00Commented Nov 23, 2012 at 10:44