How to change the style definitions for Default.nb?
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]
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
?
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.