This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Add-ons & Links / AuthorTools / Function Interface /

Creating a Table of Contents

This section assumes that you have already loaded the AuthorTools package and set the variable nb to represent the notebook you wish to process. (See Using Functions for more information.)

This generates a table of contents for the notebook. The table of contents is saved in the same directory as the source notebook.

MakeContents[nb,"Simple"]

The second argument of the function specifies the format of the table of contents. You can choose from three different formats: "Simple", "Book", or "BookCondensed". (See Make Contents for more information on these formats.)

Note: The MakeContents command inserts cell tags into the source notebook and automatically saves the changes. If you do not want your source notebook modified, you should keep a separate copy as a back-up.

If you are going to generate a table of contents in any format other than Simple, you should first use Paginate. This function calculates the page numbers for the specified notebook and stores them as TaggingRules in the notebook.

Paginate[nb]

The following command generates a table of contents in the Book format.

MakeContents[nb,"Book"]

The option SelectedCellStyles determines which cells in the notebook are included in the table of contents. The default setting is SelectedCellStyles Rule {"Title", "Section", "Subsection", "Subsubsection"}. The following command generates a table of contents in the Book format that includes only Title, Section, and Subsection cells.

MakeContents[nb,"Book",SelectedCellStyles Rule {"Title", "Section", "Subsection"}]