Is there a way to set up key bindings for the DisplayFormula
and DisplayFormulaNumbered
styles? I am using Mathematica 9 on mac OS X 10.7.5. This would be very useful as it is time consuming having to click through with the mouse each time.
2 Answers
Yes, you can do that. You can for all notebooks using a given style by editing the style notebook for that style or you can do it for just one notebook. In either case you do the following:
- To make key bindings for styles in a stylesheet, open the relevant stylesheet notebook in Mathematica ; to make bindings restricted to an individual notebook, make that notebook the active one, and choose Format > Edit Stylesheet...
- Select a cell in the stylesheet of the style you want to edit. If you don't see it, choose the style from the drop-down menu at top left of stylesheet window.
- Open the Options Inspector.
- Choose
Selection
at the top left of Options Inspector. - Search for "menucommandkey" in the search box at top right.
You can bind the selected style to Cmnd+1 through Cmnd+9 and Cmnd+Shift+2 through Cmnd+Shift+0. To assign a Cmnd+Shift shortcut, enter the appropriate shifted character; e.g., enter "@" into the Options Inspector to get Cmnd+Shift+2 (or the appropriate key depending on your keyboard language). If all the bindings are in use, you will have to give up one (override it) to make a new binding.
The following image shows how editing cmnd key assignments in a stylesheet notebook looks.
Update
There were mistakes and omissions in my answer when first posted. I hope I have fixed them now.
-
$\begingroup$ Thanks, I followed your instructions, but when I go back to the notebook and press the key combination it has no affect. $\endgroup$– VirgoJul 9, 2013 at 2:13
-
$\begingroup$ @physicsphile. I have made corrections and added some more detail.. $\endgroup$ Jul 9, 2013 at 4:01
-
1$\begingroup$ Note: you are not limited to 1 - 9, as <kbd>Shift</kbd> is an accepted modifier, too. So, I have stylesheets where I am using close to 20 shortcuts. Also, the cell definition can be modified directly by selecting the cell and pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>e</kbd>. Then add the option,
"MenuCommandKey" -> "any valid key"
, to the definition. That is often faster than going through the option inspector. $\endgroup$– rcollyerJul 9, 2013 at 13:02 -
$\begingroup$ @rcollyer. I could not get shifted keys to work on my OS X system. $\endgroup$ Jul 9, 2013 at 15:15
-
This already exists in the Articles StyleSheets, both in the JournalArticle and Preprint as well as in the Book StyleSheets both in the TextBook and Monograph. In all these the
DisplayFormula is Alt+5
and the
DisplayFormulaNumbered is Alt+6.
I like these StyleSheets more then the Default one. There is a peculiarity in them, however, which might seem uncomfortable: in all of them the newly-created cell is by default the TextCell, rather than InputCell, which is the case in the Default StyleSheet. This is, however, logic. In everything else these StyleSheets are much richer in features.
DisplayFormulaNumbered
as the default choice associated with the menu itemFormat > Style > Other...
(for which there already is a keyboard shortcut). $\endgroup$