Insertion of sectioning macros, that is `\chapter', `\section', `\subsection', etc. and accompanying `\label''s may be eased by using C-c C-s. This command is highly customizable, the following describes the default behavior.
When invoking you will be asked for a section macro to insert. An appropriate default is automatically selected by AUC TeX, that is either: at the top of the document; the top level sectioning for that document style, and any other place: The same as the last occurring sectioning command.
Next, you will be asked for the the actual name of that section, and
last you will be asked for a label to be associated with that section.
The label will be prefixed by the value specified in
Command: LaTeX-section arg
(C-c C-s) Insert a sectioning command.
Determine the type of section to be inserted, by the argument arg.
The following variables can be set to customize the function.
The precise behavior of
LaTeX-section is defined by the contents
User Option: LaTeX-section-hooks
List of hooks to run when a new section is inserted.
The following variables are set before the hooks are run
A number of hooks are already defined. Most likely, you will be able to get the desired functionality be choosing from these hooks.
To get a full featured
LaTeX-section command, insert
(setq LaTeX-section-hooks '(LaTeX-section-level-hook LaTeX-section-title-hook LaTeX-section-toc-hook LaTeX-section-section-hook LaTeX-section-label-hook))
in your `.emacs' file.
The behavior of
LaTeX-section-label-hook is determined by the
User Option: LaTeX-section-label
Default prefix when asking for a label.
If it is a string, it it used unchanged for all kinds of sections. If it is nil, no label is inserted. If it is a list, the list is searched for a member whose car is equal to the name of the sectioning command being inserted. The cdr is then used as the prefix. If the name is not found, or if the cdr is nil, no label is inserted.
By default, chapters have a prefix of `cha:' while sections and subsections have a prefix of `sec:'. Labels are not automatically inserted for other types of sections.