Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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!


Update:

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

share|improve this question

2 Answers 2

up vote 11 down vote accepted

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]
share|improve this answer
    
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. –  Identity Aug 28 '12 at 5:25
    
@T.Webster Right, you'll have to create that folder (with that directory tree structure) –  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.)

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

This reverses the change:

SetOptions[SelectedNotebook[],
 DefaultNewCellStyle -> Inherited]

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

SetOptions[SelectedNotebook[],
 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?

share|improve this answer
    
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. –  Lara Jordan Jul 26 '13 at 9:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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