5
$\begingroup$

I was wondering how many pre-defined group formatting style there is in Mathematica. From Format -> Style, one see that we can go from Title (for Alt+1) to Subsubsection (Alt+6). However, this does not seem to be exhaustive. This is because, if I press Tab on a line created from any of those formattings (from Alt+1 to Alt+6), then I can automatically "move down one level" each time. However, from Subsubsection, it seems that I can still go 2 more levels down, after which Tab does its "normal" job. Are these 2 additional formattings somewhere to be found in some documentation? Are they in any way "special" and can I assign keyboard shortcuts for them as for the other ones?

$\endgroup$
5
$\begingroup$

The option StyleKeyMapping controls "Tab" and "Backspace" does to the style (AFAIK, it is not documented).

Row[Table[Most@NestWhileList["Tab" /. CurrentValue[{StyleDefinitions, #, StyleKeyMapping}]&,
     i, Not[StringMatchQ[#, "Tab"]] &] // Column[Style[#, #] & /@ #] &,
 {i, {"Chapter", "Title", "Section", "Item", "ItemParagraph", "ItemNumbered"}}], Spacer[10]]

enter image description here

The styles "Subsubsubsection" and "Subsubsubsubsection" are not listed in the Format >> Style menu.

The StyleKeyMapping option value for some "*section" styles are:

CurrentValue[{StyleDefinitions, "Subsection", StyleKeyMapping}]

{"Tab" -> "Subsubsection", "Backspace" -> "Section", KeyEvent["Tab", Modifiers -> {Shift}] -> "Section"}

CurrentValue[{StyleDefinitions, "Subsubsection", StyleKeyMapping}]

{"Tab" -> "Subsubsubsection", "Backspace" -> "Subsection", KeyEvent["Tab", Modifiers -> {Shift}] -> "Subsection"}

CurrentValue[{StyleDefinitions, "Subsubsubsection", StyleKeyMapping}]

{"Tab" -> "Subsubsubsubsection", "Backspace" -> "Subsubsection", KeyEvent["Tab", Modifiers -> {Shift}] -> "Subsubsection"}

To see the full style definitions, you can use

CurrentValue[{StyleDefinitions, "Subsubsubsection"}]

{CellMargins -> {{66, Inherited}, {2, 10}},
StyleKeyMapping -> {"Tab" -> "Subsubsubsubsection", "Backspace" -> "Subsubsection", KeyEvent["Tab", Modifiers -> {Shift}] -> "Subsubsection"},
CellGroupingRules -> {"SectionGrouping", 60},
PageBreakBelow -> False, LanguageCategory -> "NaturalLanguage", CounterIncrements -> "Subsubsubsection",
CounterAssignments -> {{"Subsubsubsubsection", 0}, {"Item", 0}, {"Subitem", 0}, {"Subsubitem", 0}, {"ItemNumbered", 0}, {"SubitemNumbered", 0}, {"SubsubitemNumbered", 0}}, MenuSortingValue -> None, FontFamily -> "Source Sans Pro",
FontSize -> 15, FontWeight -> "Bold",
FontColor -> RGBColor[0.778286411841001, 0.4230563820859083, 0.16115053025101092`]}

Similarly for 'Subsubsubsubsection".

$\endgroup$
  • 2
    $\begingroup$ Huh I'd never seen KeyEvent in a StyleKeyMapping. That's super useful. I can get away with fewer magic keys. $\endgroup$ – b3m2a1 Mar 12 at 20:05
  • $\begingroup$ Very nice. Would there be a way to assign keyboard shortcuts for them though? $\endgroup$ – Patrick.B Mar 13 at 16:40
  • 1
    $\begingroup$ @Patrick.B, you can try MenuCommandKey $\endgroup$ – kglr Mar 13 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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