With AucTeX, one can insert many LaTeX commands using shortcuts.
For example in a math environment (e.g., between $ $), the shortcut `g
insert \gamma
. Normally right after \gamma
if I would like to type a letter I should make a space, for example $\gamma a=1$
, but if I would like to type a number, a symbol or another latex command, it is not necessary, for example $\gamma\alpha=1$
or $\gamma*1=\gamma$ or $\gamma1=\gamma$
, or $\gamma^1=\gamma$
.
Is there a way in AucTeX to insert a space right after a latex command (inserted by an AucTeX shortcut, e.g. `g
) if the next keystroke is a letter?
I think this can significantly increase the speed of typing, because the space should be inserted anyway.
I have added the requirement inserted by an AucTeX shortcut to avoid the complicated situations like \leq
and \leqslant
.
post-self-insert-hook
. The function should examinelast-command
, and if it is whatever auctex uses to expand shortcuts, it should examine the character just inserted and optionally insert a space in front of it.