[Tex/LaTex] Arrow with an asterisk superscript and text above

arrowsmath-modesuperscripts

I'm trying to create an arrow (or \mapsto) that has text above it and also an asterisk superscript — where the asterisk is only a superscript for the arrow, if that makes sense.

I've been trying \xmapsto{add}^*; the asterisk seems to be above for the whole thing together, which I think makes sense… but I'm wondering if there's a way I could get the asterisk to just be a superscript to the arrow as if the text wasn't there?

Best Answer

If your problem is that the argument to the extendible arrow (e.g. add) is raising the asterisk too high, you can always \smash your argument so that it takes no vertical space (e.g. using code such as $\xrightarrow{\smash{add}}^*$).

Edit. As implied by egreg in the comments, a better solution would be to use \xrightarrow{\text{add}}\mathrel{\vphantom{\to}^*}, so that the text above the arrow contributes to the height of the line without contributing to the height of the superscript. (See this duplicate question for reference.)