10
votes

I am configuring AUCTeX in emacs.

Most of the configurations are put in a LaTeX-mode-hook. When I open a main.tex file, I notice that the major mode is latex-mode and my hooked configurations are not activated. I have to M-x Tex-latex-mode to activate them. But the major-mode is still latex-mode.

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

        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ;; auctex

        (setq TeX-auto-save t)
        (setq TeX-parse-self t)
       ))

So I would like to know what is the difference of these modes and how can I turn on AUCTeX automatically when I open a *.tex file.

1

1 Answers

11
votes

The modes provided by AUCTeX are listed at https://www.gnu.org/software/auctex/manual/auctex.html#Modes-and-Hooks and they are

  • plain-TeX-mode
  • LaTeX-mode
  • ams-TeX-mode
  • ConTeXt-mode
  • Texinfo-mode
  • docTeX-mode

Instead,

  • tex-mode
  • plain-tex-mode
  • latex-mode
  • slitex-mode
  • doctex-mode

(note the different capitalization) are the major modes provided by the TeX mode package shipped with Emacs.

If you want to open all *.tex files with AUCTeX LaTeX mode add this to your .emacs:

(add-to-list 'auto-mode-alist '("\\.tex$" . LaTeX-mode))

Actually, this shouldn't be necessary, because AUCTeX defines the tex-mode.el mode names as alias of its own modes.