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'd like to change the font that Mathematica uses for output by setting the font of the corresponding style in my stylesheet; bit simply overriding the default Output style with

Cell[StyleData["Output"],FontFamily->"Open Sans",FontSize->12]

seems to have no effect.

Is there a way to do this that I'm missing? Is the style used for output something different?


Note that this is not a duplicate of "Set default font for Output", despite the title.

share|improve this question
    
@Mr.Wizard: If I understand that, I've got to change StandardForm, but that changes both Input and Output. Is there no way to change just Output? (And what's the Output style for if it has no effect on output?) –  raxacoricofallapatorius Nov 13 '12 at 22:24
1  
I just read those answers and I too am dissatisfied with them. There are some surprising limitations of the system ("Undo" cough) but this doesn't appear to be one of them as you can select an Output cell and change the font family. I don't know why it is set up this way. –  Mr.Wizard Nov 13 '12 at 22:30
1  
The earlier question did not concern output styles. The reason you can't do this easily is because Core.nb defines DefaultFormatType -> DefaultOutputFormatType for the output style and this is the StandardForm. You can set DefaultFormatType to some other *Form and change that instead, because modifying StandardForm will also change the input sytle. –  rm -rf Nov 13 '12 at 23:18
    
@rm-rf I'm sorry, I now realize that is true. I know I have seen the recommendation/instruction to change StandardForm to effect change in "Output" (and "Input") before; that is what I am dissatisfied with. Sorry for unintentionally disparaging your answer! –  Mr.Wizard Nov 14 '12 at 0:05
add comment

2 Answers

Not sure if there is a straight forward way but here is one way that works.

Edit the private styles of your notebook as per these grabs:

enter image description here

enter image description here

And now your output is Comic Sans :)

enter image description here

You can also:

SetOptions[EvaluationNotebook[], 
 CommonDefaultFormatTypes -> {"Output" -> OutputForm}]

but you still need to make your changes to the OutputForm style.

share|improve this answer
    
+1 for CommonDefaultFormatTypes which I either haven't learned or forgot, but I recommend you use a custom style e.g. "MyOutput" instead of OutputForm or you get the ugly 2D text formatting. –  Mr.Wizard Nov 13 '12 at 23:16
    
-1 for Comic Sans, +2 for a good solution. :) –  rcollyer Nov 13 '12 at 23:23
    
Hm... I see that my recommendation is not valid. That makes this answer significantly less useful IMHO unless there is another work-around to avoid the text-terminal 2D output. –  Mr.Wizard Nov 13 '12 at 23:23
    
@rcollyer I'm not sure it's really a solution (yet?); I don't think people want to have to use OutputForm -- at least I don't. –  Mr.Wizard Nov 13 '12 at 23:24
    
@Mr.Wizard correct me if I'm wrong, isn't OutputForm the default for output cells? –  rcollyer Nov 13 '12 at 23:25
show 7 more comments

After a bit of style sheet spelunking I believe I have a solution. It is far from well tested at this point but I'm encouraged.

One reads in Core.nb under the FormatType Styles section:

The cells below define styles that are mixed in with the styles of most cells. If a cell's FormatType matches the name of one of the styles defined below, then that style is applied between the cell's style and its own options. This is particularly true of Input and Output.

From this it becomes clear why the styles one creates for Input and Output are not respected. That leads me to my proposed method. The template for the private style sheet is as follows:

Mathematica graphics

The code for the top cell, placed above the base style sheet cell, is:

Cell[StyleData["StandardForm"],
  FontFamily -> Inherited
]

This changes the way that the "Input" and "Output" styles work. Now you create font style cells for both, e.g.:

Cell[StyleData["Input"],
 FontFamily -> "Courier"
]

Cell[StyleData["Output"],
 FontFamily -> "Trajan Pro"
]

And prestidigitonium!

Mathematica graphics

share|improve this answer
    
To make this robust it will at least be necessary to consider any other styles that rely on StandardForm and also the different Screen and Printing Environments. –  Mr.Wizard Nov 14 '12 at 0:01
    
+1 brilliant. Had forgotten about the ordering of cells in stylesheets. –  Mike Honeychurch Nov 14 '12 at 0:11
    
Addendum: this doesn't operate with quite the mechanism that I first thought, but I believe it still works. However, the content of the first cell should be the entire definition for "StandardForm" from Core.nb except for the FontFamily line, rather than the stub shown in this answer. I'll revisit this tomorrow and do some more testing, then update the post. –  Mr.Wizard Nov 14 '12 at 1:58
    
I had only done some toy testing and didn't notice any issues with it. What led you to write the addendum? –  Mike Honeychurch Nov 14 '12 at 2:10
    
@Mike on my system I'm losing some of the proper formatting of e.g. Input cells with the simple code shown in the post. (Put another way, not only is the font reset but so is everything else.) I can't rule out that I've just made a mistake but I'm too sleepy to work through it now. –  Mr.Wizard Nov 14 '12 at 2:13
show 3 more comments

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.