5.1 Modes and Hooks
AUCTeX supports a wide variety of derivatives and extensions of TeX. Besides plain TeX those are LaTeX, AMS-TeX, ConTeXt, Texinfo and docTeX. For each of them there is a separate major mode in AUCTeX and each major mode runs text-mode-hook
, TeX-mode-hook
as well as a hook special to the mode in this order. The following table provides an overview of the respective mode functions and hooks.
Type | Mode function | Hook |
---|---|---|
Plain TeX | plain-TeX-mode | plain-TeX-mode-hook |
LaTeX | LaTeX-mode | LaTeX-mode-hook |
AMS-TeX | ams-tex-mode | AmS-TeX-mode-hook |
ConTeXt | ConTeXt-mode | ConTeXt-mode-hook |
Texinfo | Texinfo-mode | Texinfo-mode-hook |
DocTeX | docTeX-mode | docTeX-mode-hook |
If you need to make a customization via a hook which is only relevant for one of the modes listed above, put it into the respective mode hook, if it is relevant for any AUCTeX mode, add it to TeX-mode-hook
and if it is relevant for all text modes, append it to text-mode-hook
.
Other useful hooks are listed below.
variable
TeX-after-compilation-finished-hook​
Hook which is run after the TeX/LaTeX processor has successfully finished compiling your document. (See Processing, for finding out how to compile your document). Each function in the hook is run with the compiled output document as its argument.
This is useful for automatically refreshing the viewer after re-compilation especially when using Emacs viewers such as DocView or PDF Tools. The function TeX-revert-document-buffer
can be added to the hook for this purpose.