4
$\begingroup$

I want to customize my Mathematica front end to

  1. specify the default monospace, serif, and sans-serif fonts;
  2. disable scaling and anti-aliasing on bitmapped fonts.

Regarding (1), by far, I'm most interested in customizing the monospace font, since it's the one I use 99% of the time. The default looks like Courier to me (and a very fuzzy one at that). I want to change it to the bitmapped font Terminus.

I know that one can customize individual cell styles, including the choice of font, but I'm looking for a more global way to specify these fonts.

As for (2), I have not been able to find anything yet, unfortunately. I use bitmapped fonts (like Terminus) because they look as crisp as the screen's resolution will allow, as long as they are not scaled or anti-aliased. A scaled or anti-aliased bitmapped font is completely useless, IMO.


For most software in my experience, this sort of customization tends to be available through Edit > Preferences, but not in the case of Mathematica. Fonts are not even mentioned in this dialog.

FWIW, my OS is Debian.


Update: I tried Format > Options Inspector... followed by Formatting Options > Font Options. I set the font to Terminus (it was listed among the options, which is encouraging) and adjusted the font size to be one of Terminus's native sizes (Terminus is bitmapped, so it should not be scaled). Even after hitting Apply, the notebook's appearance remained unaffected by this change. In particular, the input font looks like the usual fuzzy Courier.

$\endgroup$
  • $\begingroup$ Maybe Duplicate thread $\endgroup$ – xyz Apr 24 '16 at 13:40
  • $\begingroup$ @ShutaoTANG: thank you, but none of the answers in the thread you linked look global to me. As mentioned in my post, I know that one can customize individual cell styles, and individual notebooks. I'm looking for a global customization, one that should uniformly affect every notebook and every style. $\endgroup$ – kjo Apr 24 '16 at 13:44
  • $\begingroup$ Have you considered Options[$FrontEnd, DefaultStyleDefinitions]? You can use SetOptions[FrontEnd, DefaultStyleDefinitions ->...myfilepath...]. $\endgroup$ – Michael E2 Apr 24 '16 at 13:50
7
$\begingroup$

Here is a function came from this page

setFont[fontFamily_, fontSize_] :=
 With[
  {
   styleNB = Notebook[{
        Cell[StyleData[StyleDefinitions -> "Default.nb"]],
        Cell[StyleData["StandardForm"], 
        FontFamily -> ToString[fontFamily], 
        FontSize -> ToExpression[fontSize]]}
   ],
   styleSheetName = 
     FileNameJoin[
      {$UserBaseDirectory, "SystemFiles", 
       "FrontEnd", "StyleSheets", "myStyle.nb"}]
 },
 If[FileExistsQ[styleSheetName],
   SetOptions[
     $FrontEnd, DefaultStyleDefinitions -> "Default.nb"]
 ];
 Export[styleSheetName,styleNB];
 SetOptions[
   $FrontEnd,
   DefaultStyleDefinitions ->styleSheetName
 ]
]

Usage:

setFont["Consolas", 12]

then, you need to restrat the Mathematica. Here is a screenshot that using "Consolas" font.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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