I created TOC programatically using instructions from
http://reference.wolfram.com/language/AuthorTools/tutorial/MakeContents.html
But it created second notebook TOC.nb. Is it possible to create TOC for example at the front of my notebook?
I created TOC programatically using instructions from
http://reference.wolfram.com/language/AuthorTools/tutorial/MakeContents.html
But it created second notebook TOC.nb. Is it possible to create TOC for example at the front of my notebook?
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];
NotebookWrite[
EvaluationNotebook[],
AuthorTools`MakeContents`MakeContentsNotebook[
NotebookFileName@EvaluationNotebook[],
"Simple"]
]
It is important to notice that the notebook must be saved first to use the functions Paginate and MakeContents
<< AuthorTools`
nbkObj = SelectedNotebook[];
Paginate[nbkObj]
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.