I am a beginner.

I would like to add a keyboard shortcut to the Format > Text Color > Red menu item.

I know I can type alt-r-x-up arrow-up arrow-return (Windows7). But I want to include this command with others for the (excellent) external shortcut maker that I use (Clavier+). If I don't, Clavier+ is too slow and it ends up in a mess.

I tried to search in the already answered questions, but could not go very far. My ultimate goald would be to have a shortcut for


"-" (type "negative")

clear formatting

So there are 2 questions :

  1. how and where can I add something like MenuKey["r", Modifiers->{"Control+Alt"}] to type directly in red

  2. is it possible to make macros in Mathematica to concatenate several commands ?

I hope I was clear.

  • $\begingroup$ Do those answer work for you: 47474? $\endgroup$
    – Kuba
    Commented Oct 30, 2017 at 9:14

1 Answer 1


The easiest way to do this is to first copy your MenuSetup.tr file:

     newSetup =
        StringTrim[#, $InstallationDirectory | $UserBaseDirectory | \
       StringTrim[#, $InstallationDirectory | $UserBaseDirectory | \
         StringTrim[#, $InstallationDirectory | $UserBaseDirectory | \
     ] &@FrontEndExecute@

Search in that newSetup for "Text Color"

Replace the MenuItem for "Red" with this:

MenuItem["Red", FontColor -> RGBColor[1, 0, 0], 
 MenuKey["-", Modifiers -> {"Command", "Shift"}]]

Then reset the menu with this:

  FrontEnd`ResetMenusPacket[{Automatic, Automatic}]

Alternately, I have a chunk of code that I detailed here with a better implementation here that lets you do things like this:

 {"Mathematica", "Format", "Text Color"},
 "Tangerine" :> FontColor -> RGBColor[1, .5, 0],
 MenuKey["-", Modifiers -> {"Command", "Shift"}]

But I can't fully remember how to remove the MenuKey afterwards, so only use that if you are really feeling it.

  • $\begingroup$ Thank you very much. $\endgroup$
    – dennis
    Commented Oct 30, 2017 at 7:45
  • $\begingroup$ Thank you very much. Helps to understand how it may work. As I said, I am a beginner. So please excuse... The first block I copied in Mathem. Got the output "failed" after I hit return. So did a copy of MenuSetup and opened it with Notepad++. Could not find Text Color, but "Te&xt Color". Changed the "red" line with your line. Did manually the subtitution with the original file. Re-started Mathematica. Did not work. So I tried several combinations of modifiers, alt (never worked), control (appears in the menu, but does not work, same with shift. Seems can't overwrite a native mathem. shortcuts $\endgroup$
    – dennis
    Commented Oct 30, 2017 at 8:21
  • $\begingroup$ @dennis You 100% can overwrite the shortcuts. "Te&xt Color" is undoubtedly just what Windows calls it. What happens, then, when you select a chunk of text and press Control+Shift+-? $\endgroup$
    – b3m2a1
    Commented Oct 30, 2017 at 8:52
  • $\begingroup$ Ok, thanks, I see 1 of my mistakes : used the negative in the calc keyboard. I'll keep you informed. $\endgroup$
    – dennis
    Commented Oct 30, 2017 at 9:05
  • $\begingroup$ It works. Thanks a lot. I read the other example you wrote. Very interesting. I suppose it answers to my other question : it IS possible to concatenate several actions. Just needs to program it... $\endgroup$
    – dennis
    Commented Oct 30, 2017 at 9:19

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.