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 $ $.

$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