I'm editing a very long text in a Mathematica notebook and I'm using the "Article" stylesheet. In this text, code is highlighted using

Style[codeToHighlight, FontFamily -> "Arial", FontSlant -> Italic]

or Format -> Font -> ... after selecting it.

I want to define a "Ctrl + 0" keyboard shortcut to make selected a portion of text cell appear in Arial + Italic Style.

I'm re-reading this post and trying to make sense of what should I put into MenuSetup.tr, but I'm not sure if it's the right approach.

  • 1
    $\begingroup$ I think this could help. Please refer to the following bit of documentation reference.wolfram.com/language/ref/EventHandler.html $\endgroup$ Nov 17 '15 at 17:18
  • 1
    $\begingroup$ To be able to easy change the procedure I'm recommending using joker functionality from Shortcuts` package: 34159 $\endgroup$
    – Kuba
    Nov 17 '15 at 21:37


 {font = "Courier"},
  Style["Text", FontFamily -> Dynamic[font]],
    "x"} :> (font = 
     font /. {"Times" -> "Courier", "Courier" -> "Times"})]

On press of button x text "Text"toggles between font "Times" and "Courier"

  • $\begingroup$ Thanks, but this doesn't do what I want. $\endgroup$ Nov 17 '15 at 17:44

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