TLDR:latex-mode
またはLaTeX-mode
(同じ意味です) を使用します。変更する必要はありません。AucTeX にフックするためにauto-mode-alist
使用します。LaTeX-mode-hook
AucTeX のセットアップは、アドバイスを使用して Emacs の TeX およびその仲間に対する組み込みサポートをオーバーライドするため、非常に混乱する可能性があります。
したがって、ELPA から AucTeX をインストールすると、次のように表示されC-h f latex-mode
ます。
This function has :override advice: ‘TeX-latex-mode’.
AucTeX がオーバーライドするモードのリストはTeX-modes
変数の値に依存しますが、他のすべての tex モードについても同じです。
この関数LaTeX-mode
は AucTeX では定義されていません (もう?): Emacs のコアで定義されており、互換性に関する不可解なコメントがあります:
;; The following three autoloaded aliases appear to conflict with
;; AUCTeX. However, even though AUCTeX uses the mixed case variants
;; for all mode relevant variables and hooks, the invocation function
;; and setting of `major-mode' themselves need to be lowercase for
;; AUCTeX to provide a fully functional user-level replacement. So
;; these aliases should remain as they are, in particular since AUCTeX
;; users are likely to use them.
;; Note from Stef: I don't understand the above explanation, the only
;; justification I can find to keep those confusing aliases is for those
;; users who may have files annotated with -*- LaTeX -*- (e.g. because they
;; received them from someone using AUCTeX).
;;;###autoload
(defalias 'TeX-mode #'tex-mode)
;;;###autoload
(defalias 'plain-TeX-mode #'plain-tex-mode)
;;;###autoload
(defalias 'LaTeX-mode #'latex-mode)
これが意味することは、少なくとも 2021 年には、AucTeX を使用するために変更する必要がないということです。auto-mode-alist
インストールするだけで、Emacs の組み込み機能を上書きするのに十分です。
残念ながら、混乱の最後の原因が 1 つあります。LaTeX-mode
は現在ほとんど役に立たない のエイリアスですが、オーバーライドする AucTeX のコードは呼び出さないことlatex-mode
がわかりますlatex-mode
(それは を呼び出しますが、これは異なります。つまり、AucTeX のものである変数 (組み込みの小文字のものとは対照的に) Emacs を使用) は引き続き有用です。latex-mode-hook
LaTeX-mode-hook
LaTeX-