I'd like to automatically close \left( with \right) in LaTeX via AUCTeX in Emacs 27. The following should work:

(add-hook 'LaTeX-mode-hook
            (lambda () (set (make-local-variable 'TeX-electric-math)
                            (cons "\\left(" "\\right)"))))

But it doesn't. Any clues as to why it doesn't and how I could make it work?

PS: the solution here adds an extra parenthesis, so in the end you have \left(\right)).

  • 1
    Have you seen the description for LaTeX-electric-left-right-brace in the manual? Dec 10 '20 at 10:02
  • Blimey! Sorry for the bother! I had forgotten about LaTeX-electric-left-right-brace! The funny thing is, I have it in my init, but I had commented it out, can't remember why. Thank you!
    – Daniel
    Dec 11 '20 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.