# Details of automatic cell-grouping w.r.t. cell-style

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.

-
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

The option that governs this behaviour is CellGroupingRules