Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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). – ybeltukov Nov 12 '13 at 22:23
@ybeltukov Too slow :) Thanks, it was – ssch Nov 12 '13 at 22:34
Not I but my Internet. I didn't see the update :) – ybeltukov Nov 12 '13 at 22:43
Please check this question out when you have time. – C. E. Apr 10 '15 at 15:10
up vote 3 down vote accepted

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.

share|improve this answer
Thanks! I guess I can cancel the ritual sacrifice for the cell gods now – ssch Nov 12 '13 at 22:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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