Emacs / Auctex: automatically turn on / off LaTeX-Math-mode

I use Emacs in conjunction with AucTeX (Ubuntu 10.04 works, if that matters).

Does anyone know if there is a way to automatically include the LaTeX source-mathematical mode (secondary AucTeX mode), if the point is in any medium of mathematics (ie $...$, a $$...$$, begin{equation}...\end{equation},, etc.)?

I assume that there is a relatively simple answer, since syntax highlighting uses the same criteria for coloring mathematical material, but I could not find anything.

+5
source share
2 answers

andre-r , , ` . LaTeX-math-mode .

(defun LaTeX-maybe-math ()
  "If in math mode, act as a prefix key for `LaTeX-math-keymap'.
Otherwise act as `self-insert-command'."
  (interactive)
  (if (texmathp)
      (let* ((events (let ((overriding-local-map LaTeX-math-keymap))
                       (read-key-sequence "math: ")))
             (binding (lookup-key LaTeX-math-keymap events)))
        (call-interactively binding))
    (call-interactively 'self-insert-command)))
(define-key LaTeX-mode-map "`" 'LaTeX-maybe-math)

:

  • .

  • ( ).

  • , .

  • , C-h f1.

+4

LaTeX-math-mode - " ". ( , , , , `A get\forall.) , , .

, :

(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)

IMHO , : `` get `, , `, LaTeX-math-abbrev-prefix.

+3

All Articles