Skip to main content
added 1273 characters in body
Source Link
xuhdev
  • 2k
  • 14
  • 31

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))

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)))
(advice-add 'LaTeX-math-lambda :after #'my-insert-space-if-alnum))
  (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)))
  (dolist (f '(
               LaTeX-math-alpha
               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))
added 181 characters in body
Source Link
xuhdev
  • 2k
  • 14
  • 31

The following is an example for \lambda, but should work for the others as well:

(defadvicedefun LaTeXmy-mathinsert-lambda (after LaTeXspace-mathif-lambdaalnum (orig-afterfunc activate&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 (read-char)c 'general-category) '(Ll Lu Nd))
      (insert "?\ "))
    (insert c)))
(advice-add 'LaTeX-math-lambda :after #'my-insert-space-if-alnum))

The following is an example for \lambda, but should work for the others as well:

(defadvice LaTeX-math-lambda (after LaTeX-math-lambda-after activate)
  (when (memq (get-char-code-property (read-char) 'general-category) '(Ll Lu Nd))
    (insert " ")))

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)))
(advice-add 'LaTeX-math-lambda :after #'my-insert-space-if-alnum))
Source Link
xuhdev
  • 2k
  • 14
  • 31

The following is an example for \lambda, but should work for the others as well:

(defadvice LaTeX-math-lambda (after LaTeX-math-lambda-after activate)
  (when (memq (get-char-code-property (read-char) 'general-category) '(Ll Lu Nd))
    (insert " ")))