5
$\begingroup$

Is there a way to set up key bindings for the DisplayFormula and DisplayFormulaNumberedstyles? 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.

$\endgroup$
3
  • $\begingroup$ This related question may help. $\endgroup$
    – m_goldberg
    Jul 8, 2013 at 22:16
  • $\begingroup$ I agree that the default way is too time consuming. My own way to deal with it is described in this answer where I just keep DisplayFormulaNumbered as the default choice associated with the menu item Format > Style > Other... (for which there already is a keyboard shortcut). $\endgroup$
    – Jens
    Jul 9, 2013 at 4:44
  • $\begingroup$ @Jens thanks, nice one. $\endgroup$
    – Virgo
    Jul 10, 2013 at 1:06

2 Answers 2

8
$\begingroup$

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:

  1. 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...
  2. 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.
  3. Open the Options Inspector.
  4. Choose Selection at the top left of Options Inspector.
  5. 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.

StyleCmndKey.png

Update

There were mistakes and omissions in my answer when first posted. I hope I have fixed them now.

$\endgroup$
8
  • $\begingroup$ Thanks, I followed your instructions, but when I go back to the notebook and press the key combination it has no affect. $\endgroup$
    – Virgo
    Jul 9, 2013 at 2:13
  • $\begingroup$ @physicsphile. I have made corrections and added some more detail.. $\endgroup$
    – m_goldberg
    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$
    – rcollyer
    Jul 9, 2013 at 13:02
  • $\begingroup$ @rcollyer. I could not get shifted keys to work on my OS X system. $\endgroup$
    – m_goldberg
    Jul 9, 2013 at 15:15
  • $\begingroup$ I've never had an issue on OSX. $\endgroup$
    – rcollyer
    Jul 9, 2013 at 15:32
2
$\begingroup$

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.

$\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.