18
$\begingroup$

Since version 11 (and 12), the default font for Input/Output cells has changed. As @J.M. has commented below, the font changes are system specific:

Default font changed

  • Source Code Pro on Mac
  • Consolas on Windows, and
  • Bitstream Vera Sans Mono on Linux

As a Mac user, I find myself frustrated by the new "Source Code Pro" font that is used for Input and Output cells. I find it visually most distasteful, especially for Mac users, because it resembles something I associate with PCs from the 1980s, or worse, those old DEC boxes.

But worse, after 100s of years of typography, typewriters, calculators, computers and long-standing mathematical convention, it frankly beggars belief how anyone at Wolfram could have come up with the idea of denoting 0 by a nipple (a 0 with a dot in the middle - that looks like a theta on my computer screen, and causes much confusion).

In short, I don't like it. I don't like it that much that it puts me off using version 11 altogether. So either I have to stick with 10.4, or find a way to get rid of it. I also don't like the way the new fonts impose themselves (without asking) onto pre-existing notebooks, and in our case, onto our Springer book, so that the electronic version no longer matches with the printed version.

Which brings me to my question ...

How can I get rid of the new "Source Code Pro" font in Version 11, in Input and Output cells? I am not asking how to do this at a global level, but rather for a common StyleSheet, say BookStyle.nb, that is used by all chapters in a book.

One would think that opening the common StyleSheet, and explicitly adding the option:

  FontFamily -> "Courier"

... to Input cells and Output Cells would do the trick. But, oddly, it does not.

And yet, if I take any input cell in the front-end, such as:

Integrate[crumpet, {0,1,2}]

... ShowExpression on it, and manually add, FontFamily -> "Courier" to the end ... well, that works fine. But it is not working within the chapters StyleSheet, which leaves me perplexed.

All suggestions most appreciated. But it needs to work not just on my machine, but on the stylesheet for the book, so that the look and feel is maintained.

$\endgroup$
11
  • 1
    $\begingroup$ Have you seen this? $\endgroup$ Commented Aug 13, 2016 at 16:14
  • 3
    $\begingroup$ @Mr.Wizard My impression (not sure how to verify it with certainty) is that StyleHints is new in 11 and represents a change in how formatting code is managed. One finds "CodeFont" embedded throughout the V11 Core.nb (and nonexistent in V10). $\endgroup$
    – Michael E2
    Commented Aug 13, 2016 at 16:56
  • 2
    $\begingroup$ There are numerous fonts out there that use a dotted zero to distinguish it from a capital 'o'. I prefer that approach to drawing a slash through it. (My coding environment currently uses a different font, Hack, that also uses dotted zeros.) $\endgroup$ Commented Aug 13, 2016 at 17:25
  • 1
    $\begingroup$ @Mr.Wizard It makes sense to put the answer with the duplicate; some relevant meta discussions: (m563), (m1376). My comment was responding only to your remark that you don't have V11. $\endgroup$
    – Michael E2
    Commented Aug 13, 2016 at 18:35
  • 2
    $\begingroup$ Personally, I think it looks nice. The problem I have with it is that the Greek glyphs are the same from v10 and before, and therefore looks inconsistent when they are present together with the new font. I also don't like how the new font in the .m editor is wider than before. Less stuff fits on the screen... $\endgroup$
    – QuantumDot
    Commented Aug 13, 2016 at 19:15

2 Answers 2

19
$\begingroup$

No need to modify a stylesheet, it is sufficient to evaluate

SetOptions[$FrontEnd, StyleHints -> {"CodeFont" -> "Courier"}]

or equivalently

CurrentValue[$FrontEnd, {StyleHints, "CodeFont"}] = "Courier";

for permanently setting the default font to "Courier New" system-wide in Mathematica 11. Note that the undocumented StyleHints option is new in version 11, it isn't recognized in the previous versions.

$\endgroup$
2
  • 1
    $\begingroup$ The other solution has merit if the user only wants the font change localized to that particular stylesheet, tho. $\endgroup$ Commented Aug 15, 2016 at 3:59
  • $\begingroup$ OMG,I have to say this is a most powerful mothod to change font then I have seen. $\endgroup$
    – yode
    Commented Dec 7, 2016 at 18:16
11
$\begingroup$

Following the lead from J.M., and then some comments therein from User18 and QuantumDot, the following is working:

In the common StyleSheet, under Notebook options, I added the option:

StyleHints->{"CodeFont" -> "Courier"}

So, for example, the options now read:

Cell[StyleData["Notebook"],
 Saveable->False,
 ShowAutoSpellCheck->False,
 StyleHints->{"CodeFont" -> "Courier"},
StyleMenuListing->None]

This works! Many thanks.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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