I am using Mathematica 9 on Windows 8, and I regularly want to use cell styles such as Section, SubSection and so on.

If I click the + button before creating a new cell, a context menu with a number of style options is displayed:

Is there a way to configure this menu to contain some of the styles that I regularly use?

-
fyi, there are actually keyboard shortcuts for the styles, predefined (see Format->Style) (I am on Mac, don't know about Windows) (and I wasn't aware that the (+) is a button :) ) – Pinguin Dirk Oct 11 '13 at 8:41
Select Format...Style from the menubar. – DavidC Oct 11 '13 at 9:21
Thanks, @DavidCarraher, the previous commenter also indicated this option. Ideally, I would like to avoid moving the mouse back and forth in the GUI, so keyboard shortcuts are a better option; unless there is a way to customize the context menu... – Anders Gustafsson Oct 11 '13 at 9:46

Here's a possible approach, I cannot say how stable it is:

(I will focus on Section, Subsection, but actually, you could do pretty nice stuff knowing about the menu and how to manipulate it. Also, as noted in my comment above, you might want to memorize the keyboard shortcuts for these things, but I liked the idea of manipulating that menu)

First we try to figure out where the menu comes from:

SetOptions[EvaluationNotebook[], "CellInsertionPointCell" -> None]


This switches off the menu. To get the normal menu back, we use:

SetOptions[EvaluationNotebook[],
"CellInsertionPointCell" ->


For convenience, we define for now:

 orig = FrontEndResource["FEExpressions", "CellInsertionMenu"];


Looking at the FullForm of orig, we get an idea of the menu.

First, we could e.g. try to remove the Delimiters:

SetOptions[EvaluationNotebook[],
"CellInsertionPointCell" -> orig /.
Delimiter -> Unevaluated[Sequence[]]]


or set the menu to any random cell (not very useful):

SetOptions[EvaluationNotebook[], "CellInsertionPointCell" -> Cell["foo", "Text"]]


(a possible) solution for the problem at hand

SetOptions[EvaluationNotebook[],
"CellInsertionPointCell" ->
ReleaseHold@Insert[orig,
Hold@Sequence @@ {Delimiter,
PaneBox[GridBox[{{PaneBox[
DynamicBox[
FEPrivateFrontEndResource["FEBitmaps",
"InsertionText"]],
BaselinePosition -> Scaled[0.4] -> Center,
ImageSize -> 14], "Section"}},
GridBoxAlignment -> {"Columns" -> {{Right}},
"Rows" -> {{Baseline}}}, AutoDelete -> False,
GridBoxItemSize -> {"Columns" -> {{All}}, "Rows" -> {{All}}},
GridBoxSpacings -> {"Columns" -> {0, 0.6, 2, 0},
"Rows" -> {{Automatic}}}],
ImageMargins -> {{0, 0}, {1, 1}}] :>
FrontEndTokenExecute[EvaluationNotebook[], "Style",
"Section"],
PaneBox[
GridBox[{{PaneBox[
DynamicBox[
FEPrivateFrontEndResource["FEBitmaps",
"InsertionText"]],
BaselinePosition -> Scaled[0.4] -> Center,
ImageSize -> 14], "SubSection"}},
GridBoxAlignment -> {"Columns" -> {{Right}},
"Rows" -> {{Baseline}}}, AutoDelete -> False,
GridBoxItemSize -> {"Columns" -> {{All}}, "Rows" -> {{All}}},

GridBoxSpacings -> {"Columns" -> {0, 0.6, 2, 0},
"Rows" -> {{Automatic}}}],
ImageMargins -> {{0, 0}, {1, 1}}] :>
FrontEndTokenExecute[EvaluationNotebook[], "Style",
"Subsection"]}, {1, 1, 1, 1, 2, -1}]]


Note that I used Insert, so that we can pretty well choose where we insert the menu. I didn't put too much work into the styling, I actually just copied the "Plain Text" one and adjusted. Note that you could modify the menu any way you want, Inserting, Deleteing, Appending, Prepending, ... stuff - or just rewrite it all by yourself.

The result:

-
My goodness! Awesome! Many, many thanks for putting all your effort into solving this issue! Will this only be valid for my current session/notebook, i.e. do I need to run this every new session, or will the change be permanent? – Anders Gustafsson Oct 11 '13 at 9:51
Glad you like it- I'd say that goes into Stylesheets, but I am definitely no good when it comes to those, sorry. There are various resources on here and the internet about these things, I am sure you'll find a good way! (and as a note: don't accept too quickly, you don't want to scare away other good answers, do you? :) Thanks anyway though!) – Pinguin Dirk Oct 11 '13 at 10:42
Nice work. ...... – Mike Honeychurch Oct 12 '13 at 0:26
thanks @MikeHoneychurch! – Pinguin Dirk Oct 12 '13 at 9:36