Make Index


The Make Index palette enables you to generate an index for your notebook or project. The Wolfram System calculates page numbers for all the index entries that you specify and lists them in alphabetical order. Each entry in the index is hyperlinked to the related material in the source notebook(s).


To create an index for a document, you must assign an index entry to each cell in the notebook that will be referenced in the index. This is done using the Edit Notebook Index dialog box of the Make Index palette.

Once all the index entries have been defined, you can click a button on the palette to generate the index. For any document, you can generate several different types of indexes.

Simple Index

A simple index is used to check that all the index entries you specified were entered correctly. It lists all the entries including duplicate entries and sub-entries on a separate line. The text of the hyperlink for each entry consists of the cell tag of the target material and the name of the notebook in which it occurs.

The simple index is saved in the same directory as the source notebook(s). By default the file is called SimpleIndex.nb, but you can specify a different name using the Set Index FileName button at the bottom of the palette.

Book Index

A book index contains all the index entries formatted with the following features.

Two-Column Index

A two-column index has the same features as a book index, except that the entries are arranged in two columns.

If the two-column index builds without error, it is saved in the same directory as the source notebook(s). By default the file is called TwoColumnIndex.nb, but you can specify a different name using the Set Index FileName button at the bottom of the palette.

Setting Up an Index

Setting Up Index Entries

To create an index, you must associate index entries with specific cells in your source notebooks. This is done using the Edit Notebook Index dialog box, which allows you to add, edit, and remove index entries.


This dialog box contains three text boxes:

Index Main Entry specifies a term in the index

Index Sub-Entry distinguishes two cells that fall under the same main entry

Short Form defines a short word or phrase to represent the entry in the now obsolete Master Index format

To associate an index entry with a cell (or group of cells):

1.  Select the cell(s).

2.  Specify the entry by typing it into the text fields of the dialog box. The main entry and sub-entry can be either a string or a two-dimensional expression, but the short form must be a string.

3.  Click Tag Current Cell to assign the entry to the selected cell(s).

Any index entries associated with a cell are displayed in the box at the bottom of the dialog box if you select that cell. After you add a new entry, you can click Refresh to check that the entry you specified has been assigned.

Note: Alternatively, you can select all or part of a cell's contents and click the Index Cell on Selection button. This makes the index entry for the cell the same as the selected text.

To edit or remove an index entry:

1.  Select the cell. A list of the currently assigned entries associated with that cell is displayed at the bottom of the dialog box. Each entry also has hyperlinks marked Edit and Remove next to it.

2.  Click Edit to edit the entry or Remove to remove it.

3.  Edit the entries displayed in the text fields of the dialog box.

4.  Click Tag Current Cell. This replaces the entry that you edited with the new entry.

To generate an index:

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 Index palette.

3.  Click Edit Notebook Index. This brings up a dialog box.

4.  Use this dialog box to associate index entries with all cells in the notebook that are to be referenced in the index.

5.  Click Paginate to assign page numbers to the source notebook(s). You can skip this step if you have paginated the notebooks previously or if you are creating a simple index, which does not contain any page numbers.

6.  Click the button corresponding to the type of index you want to create. For example, to build a simple index, click Make Simple Index. The other formats available are book index, two-column index, and browser index. See the "Introduction" section to learn about the differences among these four types of indexes.

Note: The Wolfram System automatically creates an index based on all the index entries that you defined. The index is saved as a separate notebook in the same directory as the source notebook.

Creating an Index 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.

There are two steps involved in setting up an index.

1.  Associate index entries with specific cells in your source notebook. The simplest way to insert index entries is using the Edit Notebook Index dialog box, accessed from the Make Index palette. Alternatively, you can type and evaluate the AddIndexEntry function. The following command associates the specified main entry and sub-entry with the currently selected cell(s) in the notebook.

AddIndexEntry [ nb ,{ main , sub }]

2.  Generate the index using the MakeIndex function. This generates an index for the notebook.

MakeIndex [ nb , "Simple"]

The second argument of MakeIndex specifies the format of the index. You can choose from four different formats: "Simple", "Book", "TwoColumn", or "BrowserIndex". (See the "Introduction" section for more information on these formats.)

Note: The MakeIndex 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.