4

With help from the question How to add custom math-environments I taught AUCTeX that IEEEeqnarray and its starred counterpart are math environments. I added the following to my .emacs

;; teach auctex IEEEeqnarray
(add-hook 'LaTeX-mode-hook 'add-my-latex-environments) 
(defun add-my-latex-environments () 
  (LaTeX-add-environments 
     '("IEEEeqnarray" LaTeX-env-label)
     '("IEEEeqnarray*" LaTeX-env-label)))

In the custom-set-variables section I added

(custom-set-variables
'(font-latex-math-environments (quote ("display" "displaymath" "equation" "eqnarray" "gather" "multline" "align" "alignat" "xalignat" "IEEEeqnarray" "IEEEeqnarray*")))

And finally made reftex aware of it

;; Additionally, reftex code to recognize this environment as an equation 
(setq reftex-label-alist 
  '(("IEEEeqnarray" ?e nil nil t)
    ("IEEEeqnarray*" ?e nil nil t)))

There's some more emacs customisation stuff found at How to Typeset Equations in LaTeX

Now my question is:

How can I teach AUCTeX that it should also auto-expand the sub- and superscripts in these custom environments?

At the beginning of my .emacs I set

(setq TeX-electric-sub-and-superscript t) ; auto-expand sub- and superscript

But even though I integrated the IEEEeqnarray environments into AUCTeX with the above customisations, it doesn't auto-expand the _ and ^ symbols in these environments, as it does in, e.g. eqnarray. I love this functionality, and need it in my custom math environments as well.

1 Answer 1

4

Electric super and subscripts uses texmathp to determine when they should be run. This function is controlled by the texmathp-tex-commands variable which you can customize. You will need to call texmathp-compile if you set it outside of the customize interface.

Adding the following to your custom-set-variables and restarting Emacs should do the trick.

'(texmathp-tex-commands (quote (("IEEEeqnarray" env-on) ("IEEEeqnarray*" env-on))))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .