Dollar symbol ($) in superscript

I would like to type m with a superscript $ in an inline formula. First, I use $ to create an inline math formula, then I successively typed m, ^ (for superscript), and $. After that, the cursor exits the math mode and jumps to the beginning of the next character. It seems that $ is used to exit the math mode here. Is there anyway to get around this?

1 Like

It seems like a bug, as hitting $ tab should do what you want but it does not, it gets you instead a dollar sign outside the math. But you can copy-paste a dollar sign (which you obtain with $ tab) in the superscript.

1 Like

This wasn’t easy to find, but generic-kbd.scm specifies that ("symbol $" "$"). For me symbol is Shift-F5, so a dollar sign can be inserted using Shift-F5 $.

1 Like

Thank you! This works. However, how did you find symbol is Shift-F5? Although it is the same for me, but I cannot find it in generic-kbd.scm.

Happy to help. That would be in prefix-kbd.scm.

Got it! Thanks a lot!

It seems like a bug, as hitting $ tab should do what you want but it does not, it gets you instead a dollar sign outside the math.

I think it is a feature. It seems hitting $ inside a structure like frac/subscript/superscript/… helps out leave the math mode.

I was expecting hitting tab after $ would undo the effect of $ and substitute in the effect of $ tab

Of course there is the key combination ("symbol $" "$") (id est Shift-F5 $ in his OS) that @jeroen pointed out.