user342552
user342552

Reputation:

How to modify OUTPUT font type?

Is it possible to change the OUTPUT font type instead of the default one? How?

This is my default stylesheet: http://filefactory.com/file/cfc2cb0/n/blueOutput.nb

Thanks!

Upvotes: 3

Views: 2195

Answers (5)

Alexey Popkov
Alexey Popkov

Reputation: 9425

You can do this by redefining the StandardForm style which is used for Output style by default (see the DefaultFormatType option in the Output style):

SetOptions[EvaluationNotebook[], 
 StyleDefinitions -> 
  Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
    Cell[StyleData["StandardForm"], 
     FontFamily -> "Palatino Linotype"]}, 
   StyleDefinitions -> "PrivateStylesheetFormatting.nb"]]

But Input style in this case is also affected because it is based on the StandardForm style too...

Upvotes: 2

Mr.Wizard
Mr.Wizard

Reputation: 24336

In light of Simon's answer, you could force output printing in a certain style using $PrePrint.

$PrePrint = Style[#, FontFamily -> "Symbol"] &;

{1 + 1, "abc", Sin[x]}

enter image description here

Upvotes: 3

Simon
Simon

Reputation: 14731

The problem lies in StandardForm not respecting the FontFamily option, although it does seem to respect most other font options. Sjoerd's answer used TraditionalForm output and thus worked. You can see this problem if you run

SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{
    Cell[StyleData[StyleDefinitions -> "Default.nb"]],
    Cell[StyleData["Output"],
     FontColor -> RGBColor[0, 0, .5], FontSize -> 14, 
     FontFamily -> "Symbol", FontWeight -> "Bold"]}]]

Then compare

{1 + 1, "abc", Sin[x]} (* This is by default in StandardForm *)
{1 + 1, "abc", Sin[x]} // StandardForm
{1 + 1, "abc", Sin[x]} // OutputForm
{1 + 1, "abc", Sin[x]} // TraditionalForm

output from above

You can also look at

Dynamic[CurrentValue/@{FontFamily, FontWeight, FontSize}]
Dynamic[CurrentValue/@{FontFamily, FontWeight, FontSize}] // TraditionalForm

output from above

which shows that the CurrentValue of FontFamily "seen" in the output depends on the output format.

Unfortunately, I don't see how to get around this issue...

Upvotes: 5

canadian_scholar
canadian_scholar

Reputation: 1325

You could try wrapping your inputs using the Style[] command. For example:

test="This is a test string.";
Style[test,{Red,"Title"}]

This generates the string in my style sheet's 'title' settings in the colour red. The solution of changing your Stylesheets is obviously preferable to this, but this might be a quick and dirty temporary workaround.

Upvotes: -1

Sjoerd C. de Vries
Sjoerd C. de Vries

Reputation: 16232

Just go to the Format > Edit Stylesheet... menu. Then in the private style definitions sheet that pops-up choose 'Output' from the pull-down menu and change the looks of the resulting Output cell. This stylesheet will be stored with your open notebook.

enter image description here

enter image description here

Upvotes: 4

Related Questions