Mathematica outliner's capabilities



As my notebooks get larger, I often try to organize them with titles/subtitles etc, structuring them as an outliner

This also helps me as I try to structure a notebook trying to produce an article, see this.

Unfortunately, I find that Mathematica's outliner capabilities are not so developed... a major source of irritation is that the markers indicating closed groups are very hard to see, and so small I often click on the wrong bracket level trying to open/close them. For me the ideal way would be a double-click on the block header to open/close it.

Also, it is not easy at all to take a block and shift it upper or lower in a hierarchy of levels.

Do you know if there is a way to enhance M's capabilities in this field? Maybe through some specialized stylesheet?


I see by the help you are kindly offering that there is indeed some way to enhance the outliner capabilities - so to rise the bar a bit, knowing that this is a typical outliner feature:

do you know a way to ask your notebook to "show everything down to level x" - that is e.g. keep anything under the level Subsection (or Subsubsection, or ...) closed?


Posted 2014-06-12T07:35:18.223

Reputation: 1 055

Are you aware of Preferences->Show open/close icon for cell groups? This will display group icons on the left side of the notebook. – Yves Klett – 2014-06-12T07:36:50.840

And then then there is System\WholeCellGroupOpener`:

– Yves Klett – 2014-06-12T08:04:25.947

WholeCellGroupOpener is used on the docs. You click the label e.g., examples and it opens and closes – Mike Honeychurch – 2014-06-12T08:07:56.380

@Yves about the pref: thank you, that was new for me! – alessandro – 2014-06-12T09:22:06.970



I think what you need is to set WholeCellGroupOpener->True for the parts of your notebook that you want to open and close by clicking. This is the option that controls that behaviour in the docs.

enter image description here

For what you are wanting you probably should make this an option in a custom stylesheet for sections and subsections etc.

You can also make buttons and use them as Section/Subsection headings etc.

CellPrint@ExpressionCell[Button[Style["Subsection Name", "Subsection"],
   SelectionMove[SelectedNotebook[], All, ButtonCell]; 
   SelectionMove[SelectedNotebook[], All, CellGroup],
   Appearance -> None
   ], "Subsection"]

If you evaluate and take the output and stick it in a notebook it will open and close the group when you click on the name. Do likewise for Sections and any other type of cell that you want to have this functionality.

Mike Honeychurch

Posted 2014-06-12T07:35:18.223

Reputation: 36 211

Answer would be even better with a small screencast of the effect. – Yves Klett – 2014-06-12T08:12:41.760

@YvesKlett don't know how to make animated gifs and need to finish for the day soon. – Mike Honeychurch – 2014-06-12T08:45:58.227

The WholeCellGroupOpener has been a wonderful discovery, thanks! The only prob I have with it is that I'm unable to move my insertion point around: as soon as I click anywhere, it open/closes the group (probably it would have been better if it reacted to dblclicks) – alessandro – 2014-06-12T09:18:49.170

also, any groups having this property are virtually unselectable (to select them you have to click on them), so I cannot find a way e.g. to move them around – alessandro – 2014-06-12T09:28:05.883


You can enable the "Show open/close icon for cell groups" in the Preferences menu, which displays controls on the left side of section headings. This is quite handy compared to the fiddly brackets (mind you, larger/customizable control icons would be a good thing, too).

Mathematica graphics

Mathematica graphics

Yves Klett

Posted 2014-06-12T07:35:18.223

Reputation: 14 743

Kett I would say that the design of the group opener should be accessible to the author. Recently I discussed here this question, but it appears that nobody knows the way to do that. – Alexei Boulbitch – 2014-06-12T11:06:54.507

@AlexeiBoulbitch do you have a link (or was it in chat?). That would be really quite useful a feature! – Yves Klett – 2014-06-12T11:11:59.023

@AlexeiBoulbitch AFAIK the group opener is part of the operating system rather than belonging to Mathematica. – Mike Honeychurch – 2014-06-12T20:11:21.223

@Yves Klett It was a question here: I think that the comment of Mike Honeychurch above looks like the answer. However, there is an option in the OptionInspector defining the appearance of the GroupOpener. It is gray by default, though it is blue in Win7.

– Alexei Boulbitch – 2014-06-13T11:59:56.790