[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Here is a simple example of a style file.
;;; book.el - Special code for book style. (TeX-add-style-hook "book" (lambda () (LaTeX-largest-level-set "part")) TeX-dialect) |
The example is from the AUCTeX sources and is loaded for any LaTeX
document using the book document class (or style before LaTeX2e).
(Note that the above code is much simplified for explanatory purpose.)
The file specifies that the largest kind of section in such a document
is ‘part’. The interesting thing to notice is that the style file
defines an (anonymous) function, and adds it to the list of loaded style
hooks by calling TeX-add-style-hook
.
The first time the user indirectly tries to access some style-specific information, such as the largest sectioning command available, the style hooks for all files directly or indirectly read by the current document are executed. The actual files will only be evaluated once, but the hooks will be called for each buffer using the style file.
Note that the basename of the style file and the name of the style hook should usually be identical.
Add hook to the list of functions to run when we use the TeX file style and the current dialect is one in the set derived from dialect-expr. When dialect-expr is omitted, then hook is allowed to be run whatever the current dialect is.
dialect-expr may be one of:
:latex
For all files in LaTeX mode, or any mode derived thereof.
:bibtex
For all files in BibTeX mode, or any mode derived thereof.
:texinfo
For all files in Texinfo mode.
:plain-tex
For all files in plain-TeX mode, or any mode derived thereof.
:context
For all files in ConTeXt mode.
:classopt
For class options of LaTeX document. This is provided as pseudo-dialect for style hooks associated with class options.
(or dialect-expression1 … dialect-expression_n)
For union of the sets of dialects corresponding to dialect-expression1 through dialect-expression_n
(and dialect-expression1 … dialect-expression_n)
For intersection of the sets of dialects corresponding to dialect-expression1 through dialect-expression_n
(nor dialect-expression1 … dialect-expression_n)
For complement of the union sets of dialects corresponding to dialect-expression1 through dialect-expression_n relatively to the set of all supported dialects
(not dialect-expr)
For complement set of dialect corresponding to dialect-expr relatively to the set of all supported dialects
In case of adding a style hook for LaTeX, when calling function
TeX-add-style-hook
it is thought more futureproof for argument
dialect-expr to pass constant TeX-dialect
currently
defined to :latex
, rather than passing :latex
directly.
Default dialect for use with function TeX-add-style-hook
for
argument dialect-expr when the hook is to be run only on LaTeX
file, or any mode derived thereof.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January 17, 2024 using texi2html 1.82.