TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to enrich $\to^*$ with a $w$ above it, and the cleanest look I could get was with the {\smash {\overset w \rightarrow}}^* command. However, I believe this to be a pretty ugly solution, and \smash also smashes the space between two variables and the arrow itself (in for example $g {\smash {\overset w \rightarrow}}^* g'$. Is there a better solution that does not result in the w to be high above the arrow, or the * high above the arrow?

PS: How do you use mathmode or how can you display TeX commands? On other SE sites you can use $ $.

share|improve this question
Regarding your P.S.: You can't, as it's usually the code itself that is interesting. See for example Why doesn't maths render as maths? on meta. You have to upload an image manually. – Torbjørn T. Apr 15 '12 at 17:00
How about $g \mathrel{{\stackrel{\hskip-0.7ex w}{\to}}}{\hskip-1ex}^* g'$? Also, I really think that it is not LaTeX but it's the notation that makes it uncomfortable. – percusse Apr 15 '12 at 17:24
possible duplicate of Arrow with an asterisk superscript and text above? – Caramdir Apr 15 '12 at 23:44
I wonder if we should dupe the older question to this one: the solution here looks cleaner to me. – Joseph Wright Apr 16 '12 at 6:10
@JosephWright: It certainly is. As egreg points out, the solution in the other question also gives wrong line height. On the other hand, the other question has a better formulated question text. – Caramdir Apr 16 '12 at 23:29
up vote 7 down vote accepted

You have to put a "phantom" arrow; here \tostar is defined to have an optional argument, the letter that goes over the arrow (default w):


$a \tostar b$

We use the fact that TeX doesn't insert spaces between two relation symbols.

enter image description here

share|improve this answer
Perfect! This isn't the first time I've seen "phantom". Does it have some meaning? – codd Apr 15 '12 at 18:59
The \vphantom{\to} only occupies the vertical space of \to so we can append the asterisk to the right height. – egreg Apr 15 '12 at 19:23
Unrelated, but I was wondering why the arrow seems to have some extra stuff in the middle of its shaft. I've seen that strange phenomenon for \overrightarrow too. Do you know why? – user21820 Jan 29 '15 at 4:00
@user21820 It's an artifact due to the fact that the arrow is built with a minus sign and an arrow; the PDF viewer must snap both to its grid of pixels and, in some cases, this rounding shows off. – egreg Jan 29 '15 at 9:32
@egreg: I see, but why is the minus sign needed in the first place? \to does not seem to have any minus sign overlaid. – user21820 Jan 29 '15 at 11:02

Your Answer


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.