Marking a cell's bracket and then using Alt-7 I can make it a Text cell using the formatting set forth in Default.nb or in a modification of it stored with the notebook itself (so called "private Stylesheet for ... .nb").

However, if I look at texts which I write in LibreOffice and the like, I need more than one style to format normal text, e.g.

  1. the pure formatting of a standard Text Cell,
  2. one or more like the standard Text cell, but with a negative indentation and with the first tab at the same distance, e.g. for cells (in text processing one would speak about paragraphs) with some outdented number or keyword, then a tab and then the paragraph with a hanging indentation.
  3. possibly I would like one more paragraph like the standard one, but with the additional feature "NO pagebreak above" and possibly also one (or a whole set) with the option not to split the paragraph by a page break. But one can do without this third set of cell options directly built into the prototype from the style sheet, if one uses the recipe to add new shortcuts for this purpose to MenuSetup.tr (see here)

and I would like to stick to that habit also in Mathematica.

Now I came across

MenuCommandKey is an option for cells that specifies the keyboard shortcut to be associated with a style listed in the Format \[FilledRightTriangle] Style submenu.

and I wonder, if it would be possible to use this mechanism to add shortcuts to the existing ones such that

Alt-7 makes the cell a Text cell (as currently)

Alt-7 Alt-1 (the second one. i.e. Alt-1 associated to the option MenuCommandKey of the standard Text cell) transforms it to the lowest indentation level (e.g. 40 printer points),

Alt-7 Alt-2 (the second one. i.e. Alt-2 associated to the option MenuCommandKey of the standard Text and to the further indentetd cell, one above) transforms it to the next indentation level (e.g. 80 printer points),

Alt-7 Alt-3 (the second one. i.e. Alt-3 associated to the option MenuCommandKey of the standard Text and to the further indentetd cell, one above) transforms it to the next indentation level (e.g. 120 printer points),


Alt-7 Alt9 transforms it back to the standard Text cell format without special indentation.

Is it feasible to make something like this? Or is there already a better way to meet my target, but I am not aware of it?


1 Answer 1


I'm not sure of the exact indentation style you desire, but here is an approach that may work for you. The key idea is to make use of StyleKeyMapping, a feature of styles where certain keys entered at the beginning of a cell changes the cell style. For example, here is a stylesheet that uses Tab and Backspace to modify the cell's style:

    StyleDefinitions -> Notebook[
        Cell[StyleData["Text40", StyleDefinitions->StyleData["Text"]],
        Cell[StyleData["Text80", StyleDefinitions->StyleData["Text"]],

And, here is an animation of the style sheet in action. I create a text cell, and then copy the monologue "To be or not to be" into the text cell. Then, I place the cursor at the beginning of the cell, and hit the Tab key to cycle through the "Text", "Text40", and "Text80" cell styles. Then I hit the Backspace key to cycle through the styles backwards:

enter image description here


Your Answer

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

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