Paginate
Introduction
The Paginate palette enables you to assign page numbers to one or more notebooks. You must paginate your source notebook(s) at least once before you generate a table of contents or index. Otherwise, the table of contents or index will not contain any page numbers.
Paginating Notebooks
To paginate one or more notebooks:
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.)
Options for Pagination
The three buttons at the bottom of the palette enable you to specify options that control how the page numbers are assigned. 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.
- StartingPages determines the starting page number for all notebooks in a project. The option is specified as a list {p1,p2,…,pk}, where pk specifies the starting page number of the k th notebook in the project. Each element of the list can be set to an integer, "Next", "Odd", "Even", or Inherited. The default setting is StartingPages->{1,"Next"}. If pk is "Next", "Odd", or "Even", the starting page for the k th notebook is the next page, next odd page, or next even page following the last page of the previous notebook. If pk is Inherited, the starting page number for the k th notebook is inherited from the setting of the option StartingPageNumber for that notebook.
- OpenAllCellGroups determines whether to open all cell groups before calculating page breaks. The default setting is OpenAllCellGroups->True.
- PaginationFunction specifies a function (func) to apply to each notebook after page numbers are calculated but before the notebook is closed. If this option is set to something other than Null, the return values from Paginate will have func[nb] appended to each sublist.
Pagination 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 paginates the specified notebook. If the argument is a project file, the command paginates all notebooks in the project.
This paginates all notebooks in a project. The setting StartingPages->"Next" means that the starting page for each notebook is the next page following the last page of the previous notebook.
Other possible settings for StartingPages are "Even", "Odd", Inherited, or a list of integers. The following command paginates all notebooks in a project and sets the starting page for the first four notebooks to be 1, 25, 57, and 83.
The following paginates all notebooks in a project. The starting page number for each notebook in the project is inherited from the setting of the option StartingPageNumber for that notebook.