18

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.

wolfies
  • 8,722
  • 1
  • 25
  • 54
  • 1
  • Thanks - I have updated the question to reflect same – wolfies Aug 13 '16 at 16:25
  • Related, perhaps duplicate?: (9942), (14536), (48843), (69141) – Mr.Wizard Aug 13 '16 at 16:52
  • 3
    @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). – Michael E2 Aug 13 '16 at 16:56
  • @MichaelE2 That makes sense. However going forward that prior question is not restricted to versions 10 and prior, so a v11 method should be posted there and supersede older methods, unless we do restrict that question to pre-v11? How do you think this should work? – Mr.Wizard Aug 13 '16 at 16:59
  • I only linked to the other question in my first comment, as I hesitated on whether this is a dupe or not. At least you got something out of it, whatever happens. – J. M.'s missing motivation Aug 13 '16 at 17:11
  • 2
    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.) – Brett Champion Aug 13 '16 at 17:25
  • 1
    @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. – Michael E2 Aug 13 '16 at 18:35
  • 2
    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... – QuantumDot Aug 13 '16 at 19:15
  • Do you know if there is a way to change the FontWeight? (also @QuantumDot) – sebhofer Aug 22 '16 at 08:34
  • @sebhofer If you navigate to $InstallationDirectory/SystemFiles/Fonts/TrueType, you'll find a list of all the fonts that are available. Then you can pick any one as a setting for "CodeFont" (just insert a space between each camel case and hyphen). For example "Source Code Pro Light" will make the font lightweight and "Source Code Pro Black" will make it disgustingly thick. (i've only tested this on a mac). – QuantumDot Aug 22 '16 at 11:10

2 Answers2

19

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.

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
11

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.

wolfies
  • 8,722
  • 1
  • 25
  • 54