3
$\begingroup$

I am trying to change the font of the formula number in a cell which has style DisplayFormulaNumbered. I can easily change the font of the formula I enter by selecting it and using the format menu. But the number to the right of the formula wont change. Any help with this would be greatly appreciated. I am using mathematica 9.

$\endgroup$
4
$\begingroup$

You can get the Style definitions for "DisplayFormulaNumbered" using

CurrentValue[{StyleDefinitions, "DisplayFormulaNumbered"}]
{CellMargins -> {{66, Inherited}, {Inherited, Inherited}}, 
 StripStyleOnPaste -> True, 
 CellFrameLabels -> {{None, 
    Cell[TextData[{"(", CounterBox["DisplayFormulaNumbered"], ")"}], 
     "DisplayFormulaEquationNumber"]}, {None, None}}, 
 DefaultFormatType -> DefaultInputFormatType, 
 "HyphenationOptionsHyphenationCharacter" -> "\[Continuation]", 
 LanguageCategory -> "Formula", ScriptLevel -> 0, 
 SingleLetterItalics -> True, 
 CounterIncrements -> "DisplayFormulaNumbered", 
 MenuSortingValue -> 1710, FontFamily -> "Arial", FontSize -> 14, 
 FontColor -> GrayLevel[0.2], 
 UnderoverscriptBoxOptionsLimitsPositioning -> True}

and for "DisplayFormulaEquationNumber" using

CurrentValue[{StyleDefinitions, "DisplayFormulaEquationNumber"}]
{FontFamily -> "Arial", FontSize -> -1 + Inherited}

You can use this information to define your custom style for numbered display formulas:

SetOptions[EvaluationNotebook[], 
  StyleDefinitions -> 
   Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
     Cell[StyleData["myNumberedDisplayFormula"], 
      CellMargins -> {{66, Inherited}, {Inherited, Inherited}}, 
      StripStyleOnPaste -> True, 
      CellFrameLabels -> {{None, 
         Cell[TextData[{"(", CounterBox["myNumberedDisplayFormula"], 
            ")"}], FontColor -> Orange, FontFamily -> Inherited, 
          FontSize -> -1 + Inherited]}, {None, None}}, 
      DefaultFormatType -> DefaultInputFormatType, 
      "HyphenationOptionsHyphenationCharacter" -> "\[Continuation]", 
      LanguageCategory -> "Formula", ScriptLevel -> 0, 
      SingleLetterItalics -> True, 
      CounterIncrements -> "myNumberedDisplayFormula", 
      MenuSortingValue -> 1710, FontFamily -> "Arial", FontSize -> 14,
       FontColor -> GrayLevel[.2], 
      UnderoverscriptBoxOptionsLimitsPositioning -> True]}, 
    Saveable -> True, 
    StyleDefinitions -> "PrivateStylesheetFormatting.nb"]];

enter image description here

$\endgroup$
  • $\begingroup$ You just beat me! (+1) I think my answer is sufficiently different, although there are similarities. $\endgroup$ – Michael E2 Sep 13 '14 at 20:16
  • $\begingroup$ @Michael, just saw (and upvoted :)) your answer. I think editing the stylesheet and changing the style definition for "DisplayFormulaEquationNumber" is a more practical approach. $\endgroup$ – kglr Sep 13 '14 at 20:31
  • $\begingroup$ That worked great, but killed some other styles that I had defined before. I was wondering how I can preserve my current customizations and implement these new ones? $\endgroup$ – Virgo Sep 14 '14 at 0:41
  • $\begingroup$ @physicsphile, perhaps you can add the new style to the stylesheet containing your customizations; e.g. as in this Q/A $\endgroup$ – kglr Sep 14 '14 at 4:05
3
$\begingroup$

The style of the number is "DisplayFormulaEquationNumber". I'm going to assume you want all the displayed numbers to have the same style.

  1. From the menu, choose Format > Edit Stylesheet...

  2. Enter DisplayFormulaEquationNumber in the Enter a style name box (no quotes).

  3. Select the cell and format as you wish. You can use the font menu commands or the Options inspector to modify the style. You can also use the Cell > Show Expression to manually enter options.

Example stylesheet, which "DisplayFormulaEquationNumber" styled to be large and bold:

enter image description here

The equations in the notebook:

enter image description here

$\endgroup$
  • $\begingroup$ Thanks, my current workbook didn't have the option to enter the stylename. I went to the stylesheet that it inherited from and I could do it there. But unfortunately I found changing the fonts did not propagate through to my notebook. $\endgroup$ – Virgo Sep 14 '14 at 0:28
  • $\begingroup$ @physicsphile Did you try reopening your notebook? $\endgroup$ – Michael E2 Sep 14 '14 at 0:29
  • $\begingroup$ Yes, it din't seem to make any difference. $\endgroup$ – Virgo Sep 14 '14 at 0:53
  • $\begingroup$ @physicsphile, I put some screenshots to show what I get. $\endgroup$ – Michael E2 Sep 14 '14 at 2:05
  • $\begingroup$ Thanks, it works when I start a new file but not on my old file. $\endgroup$ – Virgo Sep 14 '14 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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