B The xlabel command

The xlabel command is used to ensure that all sections and subsections in the document include an \xlabel command labelling them with the section heading in lower case with all non-alphanumeric characters removed and words separated by underscore.

The format of the command is:

# xlabeldocument

This will process the file document and create a new version, newdocument, containing any additional \xlabel commands required. The file type .tex is optional and will be added if it is omitted.

A label is created from the heading of each \section and \subsection in the specified document by removing common font-changing commands (such as \texttt, \texttt, \em and \emph), replacing all spaces by underscore, removing all non-alphanumeric characters (underscore counts as alphanumeric here) and folding to lower case. If the sectioning command does not already contain an \xlabel command specifying the generated label, one is inserted.

The labels generated will be displayed and should be inspected for peculiarities, probably caused by unusual LATEX commands in the heading.

Warnings will be displayed if:

When you are happy with the result, copy newdocument back to document.