Note: This is probably a duplicate, but I can't figure out the right search terms. If you can post the link to the original question and close this one, it would be greatly appreciated.
I followed the advice here, and now AucTeX has the correct font highlighting and has math mode enabled in my custom math environment. But AucTex doesn't auto-complete \left[ \right]
or \left( \right)
in my custom math environment, which is really inconvenient.
Question: How can I change my
.emacs
file to have AucTeX auto-complete\left[ \right]
,\left( \right)
in my custom math environment?
For reference, here is my .emacs
:
(require 'package)
(package-initialize)
(require 'yasnippet)
(yas-global-mode 1)
(require 'auto-complete)
(add-to-list 'ac-modes 'latex-mode)
(require 'ac-math)
(defun my-ac-latex-mode ()
(setq ac-sources
(append '(; again, I don't want unicode: ac-source-math-unicode
ac-source-math-latex
ac-source-latex-commands)
ac-sources)))
(add-hook 'LaTeX-mode-hook 'my-ac-latex-mode)
(ac-flyspell-workaround)
(add-to-list 'ac-modes 'org-mode)
(require 'auto-complete-config)
(ac-config-default)
(setq ac-auto-start t)
(setq ac-auto-show-menu t)
(global-auto-complete-mode t)
(show-paren-mode 1)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(auto-fill-mode -1)
(remove-hook 'text-mode-hook #'turn-on-auto-fill)
(remove-hook 'text-mode-hook 'auto-detect-wrap)
'(text-mode-hook
'((lambda nil (auto-fill-mode nil))
smart-spacing-mode))
(auto-fill-mode nil)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
(setq mouse-wheel-progressive-speed nil)
(setq mouse-wheel-follow-mouse 't)
(setq scroll-step 1)
(setq mac-mouse-wheel-mode t)
(setq mac-mouse-wheel-smooth-scroll t)
(setq TeX-save-query nil)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(setq TeX-PDF-mode t)
(require 'smartparens-config)
(add-hook 'LaTeX-mode-hook #'smartparens-mode)
(add-hook 'LaTeX-mode-hook 'add-my-latex-environments)
(defun add-my-latex-environments ()
(LaTeX-add-environments
'("formulae" LaTeX-env-label)))
(custom-set-variables
'(font-latex-math-environments (quote
("formulae")))
'(TeX-insert-braces nil))
(setq reftex-label-alist
'(("formulae" ?e nil nil t)))
left
and your brace