1
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

Example:

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

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

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

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