[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.6.1 A Simple Style File

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 "chapter")))

The example is from the AUCTeX sources and is loaded for any LaTeX document using the book document class (or style before LaTeX2e). The file specifies that the largest kind of section in such a document is chapter. 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.

Function: TeX-add-style-hook style hook

Add hook to the list of functions to run when we use the TeX file style.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Ralf Angeli on January 13, 2013 using texi2html 1.82.