I have looked over other questions related to style definitions, and looked through the Mathematica 8 documentation, but I do not know why I am having so much difficulty setting the default font in my free .CDF files.

I have tried changing the cell appearance to the desired font style many times for Default.nb, but the changes never take effect, and whenever I go back to "Edit Stylesheet" for Default.nb, all my changes are gone!


Never before have I had so much difficulty setting the default font settings in an an IDE, but for Mathematica, it's worth the trouble. Here is a screenshot of the private style definitions which finally worked. Standard Form is left uncollapsed, but they all have the same font settings.

enter image description here


You cannot save to Default.nb by default, because it has Savable set to False and it is a good idea to not forcibly modify this file. Instead, create a private stylesheet as you have done here and put it in $UserBaseDirectory/SystemFiles/FrontEnd/StyleSheets/. You can now use this with any notebook.

See this answer of mine for an idea of which tokens to set/modify in the stylesheet to change different items. Specifically, to change the font for input cells, you'll need to set a custom style for StandardForm. A very basic one that does what you want will be:

Cell[StyleData["StandardForm"], FontFamily -> "Consolas", FontSize -> 11]
  • $\begingroup$ Although I didn't see a StyleSheets folder @ $UserBaseDirectory/SystemFiles/FrontEnd/StyleSheets/, after adding the "StandardForm" to the private style definitions, and also setting the "Input", "Output styles, saving and reopening, I was able to finally get the style changes to save. $\endgroup$ – T. Webster Aug 28 '12 at 5:25
  • $\begingroup$ @T.Webster Right, you'll have to create that folder (with that directory tree structure) $\endgroup$ – rm -rf Aug 28 '12 at 6:00

With a little help from this post, I came up with this command to change the style of new input cells. (The modifications persist in the saved notebook only.)

 DefaultNewCellStyle -> {"Input",
   FontFamily -> "Consolas", FontSize -> 11}]

This reverses the change:

 DefaultNewCellStyle -> Inherited]

But I was unable to come up with a similar command to modify the output. For instance I tried this ...

 GeneratedCellStyles -> {
   "Graphics" -> "Graphics", "Message" -> {"Message", "MSG"}, 
   "Output" -> {"Output", "FontFamily" -> "Consolas", "FontSize" -> 11},
   "Print" -> "Print", "PrintTemporary" -> "PrintTemporary"}]

which didn't work. Also, AbsoluteOptions[SelectedNotebook[], GeneratedCellStyles] showed the option values had not been changed.

Any suggestions how to modify output with SetOptions?

  • $\begingroup$ Is there a way to see the default styles used for graphs etc ? I want to see and then set the default font for the graph labels and headings as well as Grid items so that all y work uses the same font. At the moment the graphs use one type of font and the grids use another by default. $\endgroup$ – lara Jul 26 '13 at 9:21

Look there:

(1) Open a notebook, in the menu choose "Format" -> "Edit Stylesheet".

(2) Choose a style to change. For example, "Text", in the menu at the top left.

(3) Modify fonts, etc.

(4) Save this stylesheet to a .nb file. Optionally one can also click Install StyleSheet so that the stylesheet can be found at "Format" -> "Stylesheet..." menu.

(5) Open menu "Format" -> "Option Inspector", make sure "Global Preference" is selected (where the default is "Selection") in the popup menu.

(6) Search for DefaultStyleDefinitions, change it to the saved stylesheet file. Click apply.

Close Mathematica and launch it again. The default font is changed.


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.