Message Boards Message Boards

Use CellGroup[] in current Notebook?


(Posted to StackExchange a week ago, with no response.)

I have used the Option Inspector to set CellGrouping to Manual for the current, selected Notebook. Nonetheless, the following does not group these two cells together:

CellPrint[CellGroup[{TextCell["hello"], TextCell["goodbye"]}]]

Also, adding the second argument to CellGroup[] to specify which cell should be open, does not work.

Please note that both of these work if I create the cells in a new Notebook, created with CellGrouping -> Manual.

I saw the same behavior with Cell[CellGroupData[...]].

What am I missing?

POSTED BY: Aaron Naiman
3 months ago

Unfortunately there are many issues related to cell groups structure: SE / Cell @ CellGroupData in Cells family

And my rules of thumb, unfortunately, are:

  • only use CellGroup+TextCell+ExpressionCell and friends, which are a higher level collegues of CellGroupData and Cell, for small snippets rather than serious work. Why? I don't know, maybe I just can't handle them but writing your code in a low level form works:

    NotebookWrite[EvaluationNotebook[],  Cell@CellGroupData[{Cell["hello"], Cell["goodbye"]}]]
  • don't expect much from Manual CellGrouping with respect to other related options. Same reason.

You want details? You can as WRI Support.

POSTED BY: Kuba Podkalicki
3 months ago

Kuba, thank you. (Here is the SE discussion.)

POSTED BY: Aaron Naiman
3 months ago

Group Abstract Group Abstract