9
$\begingroup$

Is there a way to get table of contents I can click on?

I'm looking for something like Table of Contents module in Jupyter notebooks where I can jump between sections easily, here's what my scratch-space usually looks like

enter image description here

$\endgroup$
  • $\begingroup$ You could do something pretty creative with a palette, or the AuthorTools` package has some stuff that might be able to fit your needs. Both of these would require some work though. $\endgroup$ – user6014 Mar 9 '17 at 1:55
  • $\begingroup$ maybe it is usful library.wolfram.com/infocenter/Conferences/5782 $\endgroup$ – tanghe2014 Mar 9 '17 at 4:07
8
$\begingroup$

AFAIK there's nothing built-in.

On the other hand I use this sort-of functionality all the time. Here's a quick way to generate a table of contents palette:

nbTOC[nb_] :=
  Button[
      Mouseover[#, Style[#, "HyperlinkActive"]] &@First@NotebookRead@#,
      SelectionMove[#, All, CellContents],
      Appearance -> None,
      BaseStyle -> "Hyperlink",
      Alignment -> Left,
      ImageSize -> 100
      ] & /@

    Cells[CellStyle -> {"Title", "Chapter", "Section", "Subsection", 
       "Subsubsection"}] // CreatePalette[
     Panel[
      Column[#,
       Dividers -> Center],
      ImageSize -> 100
      ],
     FrontEnd`ClosingSaveDialog -> False,
     WindowTitle -> "Table of Contents",
     Magnification -> 1.5
     ] &;
nbTOC[Optional[Automatic, Automatic]] :=
 nbTOC@EvaluationNotebook[]

It assumes you just want to navigate to the "Title", "Chapter", "Section",etc. cells and that the CellObject available at the time the palette was generated will still exist.

The other way I've done this is, at click time, searched for a cell with the same contents and style as the original cell in the notebook. That way it'll work even after the notebook has been closed and reopened.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.