Make Contents


The Make Contents palette enables you to generate a table of contents for any notebook or group of notebooks.


You can format your table of contents in any of three predefined styles:

Creating a Table of Contents

To create a table of contents:

1.  For a single notebook, open the notebook and make it the currently selected notebook. For multiple notebooks, open the Make Project dialog box and load the project file for your project. (If you have not already created a project file, see "Creating a Project File" to learn how.)

2.  Open the Make Project dialog box.

3.  Click Paginate to assign page numbers to the source notebook(s). You can skip this step if you have paginated the notebooks previously or are creating a simple table of contents that does not contain any page numbers.

4.  Click either Make Simple Contents, Make Book Contents, or Make Condensed Contents, depending on which style of table of contents you want to create.

It may take a few moments for the evaluation to be completed, depending on the size of the source notebook(s). The newly generated table of contents appears on the screen and is saved in the same directory as the source notebook.

Note: The Wolfram System automatically adds cell tags to the source notebook(s) and saves all changes. It is therefore advisable to make a backup copy of your notebook(s) before generating a table of contents.

Customizing a Table of Contents

The buttons at the bottom of the palette let you specify options to customize various features of the table of contents. To set the value of an option, click the button bearing the name of that option. This brings up a dialog box displaying the current value of the option. You can edit the text and click Apply for the changes to take effect. Click OK to close the dialog box.

Creating a Table of Contents Programmatically

The Wolfram System kernel refers to any open notebook via an expression of the form NotebookObject[fe,id], where fe specifies the front end in which the notebook is open and id is a unique serial number for the notebook.

The command Notebooks[] returns a list of notebook objects corresponding to all notebooks currently open in the front end.

This assigns the variable nb to represent the first notebook object in the list.

Alternatively, you can identify a notebook by specifying the name and location of the notebook file. You can use the ToFileName function to construct a string specifying the full pathname of the file.

This loads the AuthorTools package.

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 the "Introduction" of this tutorial 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 backup.

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->{"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 ->{"Title","Section","Subsection"}]