What determines how a specific cell-style influences grouping of cells?

For example "Text" following "Subtitle" is grouped but not following "Text"

nbtitle = CreateDocument[];
NotebookWrite[nbtitle, Cell["subtitle", "Subtitle"]]
NotebookWrite[nbtitle, Cell["this text gets grouped", "Text"]]

nbtext = CreateDocument[];
NotebookWrite[nbtext, Cell["some text", "Text"]];
NotebookWrite[nbtext, Cell["this text is not grouped", "Text"]];



All I can find in the documentation is:

Within a given notebook, there is always a collection of styles that can be used to determine the appearance and behavior of cells. Typically the styles are named so as to reflect what role cells which have them will play in the notebook.

  • 1
    $\begingroup$ Each style has parameter CellGroupingRules or inherit it. If it is what you are looking for then I post it as answer (with some examples). $\endgroup$
    – ybeltukov
    Nov 12, 2013 at 22:23
  • $\begingroup$ @ybeltukov Too slow :) Thanks, it was $\endgroup$
    – ssch
    Nov 12, 2013 at 22:34
  • $\begingroup$ Not I but my Internet. I didn't see the update :) $\endgroup$
    – ybeltukov
    Nov 12, 2013 at 22:43
  • $\begingroup$ Please check this question out when you have time. $\endgroup$
    – C. E.
    Apr 10, 2015 at 15:10

1 Answer 1


The option that governs this behaviour is CellGroupingRules

enter image description here

By changing the grouping I can make sections group under text e.g.

enter image description here

due to

enter image description here

Notice that a number accompanies the grouping assignment. This allows you to allocate an order to the grouping -- lower numbers have higher rank.

  • $\begingroup$ Thanks! I guess I can cancel the ritual sacrifice for the cell gods now $\endgroup$
    – ssch
    Nov 12, 2013 at 22:33

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.