emacsauctex

What is the difference of tex-mode and latex-mode and LaTeX-mode in emacs


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.


Solution

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

    Instead,

    (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.