The following is an example for \lambda
, but should work for the others as well:
(defun my-insert-space-if-alnum (orig-func &rest args)
"Insert an extra space if the char read is alphabetical or a number."
(let ((c (read-char)))
(when (memq (get-char-code-property c 'general-category) '(Ll Lu Nd))
(insert ?\ ))
(insert c)))
(advicedolist (f '(
LaTeX-addmath-alpha
'LaTeX LaTeX-math-beta
LaTeX-math-delta
LaTeX-math-Delta
LaTeX-math-epsilon
LaTeX-math-phi
LaTeX-math-Phi
LaTeX-math-gamma
LaTeX-math-Gamma
LaTeX-math-eta
LaTeX-math-theta
LaTeX-math-Theta
LaTeX-math-kappa
LaTeX-math-lambda
LaTeX-math-Lambda
LaTeX-math-mu
LaTeX-math-nu
LaTeX-math-nabla
LaTeX-math-pi
LaTeX-math-Pi
LaTeX-math-chi
LaTeX-math-rho
LaTeX-math-sigma
LaTeX-math-Sigma
LaTeX-math-tau
LaTeX-math-upsilon
LaTeX-math-Upsilon
LaTeX-math-omega
LaTeX-math-Omega
LaTeX-math-xi
LaTeX-math-Xi
LaTeX-math-psi
LaTeX-math-Psi
LaTeX-math-zeta
))
(advice-add f :after #'my-insert-space-if-alnum))