0
$\begingroup$

It seems that Manual Cell Grouping is broken in 12.0.0.0 (at least in Linux). If one pastes a cell, then any cell bracketing gets "chopped" at the paste position. This bug affects a large project of mine, so I'm looking for a work-around using Automatic Cell Grouping.

I could probably find such work-around if I knew how to use the cell option CellGroupingRules. This option is not yet fully integrated into Wolfram Language, and as such it has minimal documentation. Can anyone provide some insight as to how to use this option? Or perhaps give a usage example?

Solving the following problem might suffice: Suppose I have defined a cell style called MySection (my own special section header cell). How can I get Automatic Grouping to treat a MySection cell in exactly the same way as a Section cell in terms of grouping precedence (assuming that cells with style MySection and Section are both being used in the same notebook).

BTW, I have sent a bug report to Wolfram support about broken manual grouping (the bug was introduced in 12.0.0.0, no such bug in 11.3).

$\endgroup$
9
  • $\begingroup$ When they say "This option is not yet fully integrated into Wolfram Language" for most FE constructs that's actually not true... This has been around for many versions unchanging and is used everywhere. If they changed it they'd have a huge headache on their hands. On the other hand, for these FE constructs there definitely is as dearth of documentation. $\endgroup$
    – b3m2a1
    May 27, 2019 at 18:03
  • $\begingroup$ @b3m2a1 it normally means that the design and/or behavior was never officially approved. While potentially useful, they do not come with a guarantee of compatibility with future FrontEnds. $\endgroup$
    – ihojnicki
    May 28, 2019 at 2:18
  • $\begingroup$ @ihojnicki I mean yes, but for something CellGroupingRules that's been around so long and used so often it would seem a little capricious to remove. AttachedCell I have no expectation will remain, BackgroundAppearance for Cell I have no expectation will remain, but CellGroupingRules seems as if it's probably safe given how often it's been used here and within WRI's own stylesheets. $\endgroup$
    – b3m2a1
    May 28, 2019 at 2:21
  • 1
    $\begingroup$ @b3m2a1 IIRC, we actually made changes to CellGroupingRules in the last year or so. We generally try to not smash things to bits without a good reason, but we are just not willing to commit to a smash-less future for some. $\endgroup$
    – ihojnicki
    May 28, 2019 at 2:55
  • 1
    $\begingroup$ @b3m2a1 AttachedCell will be promoted to a System symbol (I cannot commit to an exact version number). BackgroundAppearance will be phased out at some point, hopefully merging into Background. It's fate hasn't been decided yet. $\endgroup$
    – ihojnicki
    May 28, 2019 at 2:57

2 Answers 2

1
$\begingroup$

I think the simplest way to achieve your goal is to use the following for your new style:

Cell[StyleData["MySection", StyleDefinitions->StyleData["Section"]],
    newOptions..
]
$\endgroup$
0
$\begingroup$

The required information can be found in the Default.nb stylesheet. For example, under "Styles for Title and Section Cells" -> "Section", select the Section heading, then use the menu Cell -> Show Expression (or Ctrl+Shift+E). One thereby finds the following option values for various cell styles:

Title                     CellGroupingRules -> {"TitleGrouping", 0}
Subtitle                  CellGroupingRules -> {"TitleGrouping", 10}
Subsubtitle               CellGroupingRules -> {"TitleGrouping", 20}

Chapter                   CellGroupingRules -> {"SectionGrouping", 10}
Subchapter                CellGroupingRules -> {"SectionGrouping", 20}
Section                   CellGroupingRules -> {"SectionGrouping", 30}
Subsection                CellGroupingRules -> {"SectionGrouping", 40}
Subsubsection             CellGroupingRules -> {"SectionGrouping", 50}
Subsubsubsection          CellGroupingRules -> {"SectionGrouping", 60}
Subsubsubsubsection       CellGroupingRules -> {"SectionGrouping", 70}

There are also other option values, e.g., "GroupTogetherNestedGrouping" for various list styles.

$\endgroup$

Your Answer

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

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