I created TOC programatically using instructions from


But it created second notebook TOC.nb. Is it possible to create TOC for example at the front of my notebook?

  • $\begingroup$ I meant, at the beginning, before the content, because now it's in seperate notebook $\endgroup$
    – adolzi
    May 15, 2015 at 19:01
  • $\begingroup$ Please take a tour. You can always upvote the answer you find useful too. $\endgroup$
    – Kuba
    May 20, 2015 at 9:27

3 Answers 3


I don't know much about this package but you can either NotebookGet created notebook and NotebookWrite boxes in your notebook, or do something like

<< AuthorTools`

SelectionMove[EvaluationNotebook[], Before, Notebook];

  • $\begingroup$ I have tried this answer. The problem is that you do not get the format of contents right. See below my answer... $\endgroup$ Aug 26, 2015 at 13:04

It is important to notice that the notebook must be saved first to use the functions Paginate and MakeContents

<< AuthorTools`

nbkObj = SelectedNotebook[];
contObj = MakeContents[nbkObj, "Book"];

I can get the contents in the same notebook with...

NotebookWrite[nbkObj, NotebookGet[contObj]]

but I am loosing the previous "Book" format.

It seems the problem is how to copy the cells from the TOCNotebook and paste them in the main Notebook. I have tried also

 SelectionMove[contObj, All, Notebook]
 NotebookWrite[nbkObj, NotebookRead[contObj]]

and even

 NotebookWrite[nbkObj, NotebookImport[contObj]]

but the content style is lost. Any alternatives to preserve also the style of contents while pasting in the same notebook? I was looking also in SE questions related to how one can copy and past cells from one notebook to another preserving the format. But I cannot find the right answer to my question.


"...but the content style is lost." The stylesheet used in the TOC.nb file is the HelpBrowser.nb file. I have copied TOCSection, TOCSubsection and TOCSubsubsection styles from the HelpBrowser.nb file to the style file I use for my writing notebooks. You will note that there is a TabSpacings setting in those styles which controls where the page number is printed.


This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .