11
$\begingroup$

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?


Edit

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?

$\endgroup$
4
  • $\begingroup$ Are you aware of Preferences->Show open/close icon for cell groups? This will display group icons on the left side of the notebook. $\endgroup$
    – Yves Klett
    Commented Jun 12, 2014 at 7:36
  • $\begingroup$ And then then there is System`WholeCellGroupOpener: mathematica.stackexchange.com/a/812/131 $\endgroup$
    – Yves Klett
    Commented Jun 12, 2014 at 8:04
  • $\begingroup$ WholeCellGroupOpener is used on the docs. You click the label e.g., examples and it opens and closes $\endgroup$ Commented Jun 12, 2014 at 8:07
  • $\begingroup$ @Yves about the pref: thank you, that was new for me! $\endgroup$
    – alessandro
    Commented Jun 12, 2014 at 9:22

2 Answers 2

8
$\begingroup$

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]; 
   FrontEndExecute[{FrontEndToken["OpenCloseGroup"]}]; 
   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.

$\endgroup$
4
  • $\begingroup$ Answer would be even better with a small screencast of the effect. $\endgroup$
    – Yves Klett
    Commented Jun 12, 2014 at 8:12
  • $\begingroup$ @YvesKlett don't know how to make animated gifs and need to finish for the day soon. $\endgroup$ Commented Jun 12, 2014 at 8:45
  • $\begingroup$ 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) $\endgroup$
    – alessandro
    Commented Jun 12, 2014 at 9:18
  • $\begingroup$ 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 $\endgroup$
    – alessandro
    Commented Jun 12, 2014 at 9:28
5
$\begingroup$

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

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$ Commented Jun 12, 2014 at 11:06
  • $\begingroup$ @AlexeiBoulbitch do you have a link (or was it in chat?). That would be really quite useful a feature! $\endgroup$
    – Yves Klett
    Commented Jun 12, 2014 at 11:11
  • $\begingroup$ @AlexeiBoulbitch AFAIK the group opener is part of the operating system rather than belonging to Mathematica. $\endgroup$ Commented Jun 12, 2014 at 20:11
  • $\begingroup$ @Yves Klett It was a question here: mathematica.stackexchange.com/questions/46082/…. 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. $\endgroup$ Commented Jun 13, 2014 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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