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.

Are there other fonts that can be used for mathematical symbols?

I have noticed, that choosing another font (via Stylesheet) does not change the math font (e.g. for greek symbols). Symbols will just stay the same most of the time. I suspect that MMA is just substituting missing symbols in the new font with the ones from "Times" (or an internal one, surely it is "Mathematica1").

Choosing "Courier" will result in different greek symbols, this is the only one I found.

Which fonts include the neccessary symbols?

share|improve this question
add comment

2 Answers

Internally there are only two sets of Greek symbols: proportional and monospaced. These reside in the Mathematica1 and Mathematica1Mono font files.

These characters are mapped to these specific fonts in the configuration file \SystemFiles\FrontEnd\TextResources\UnicodeFontMapping.tr. Presumably any font with the appropriate glyphs could be used with the correct mapping but the result may not be pleasing as the spacing and alignment are likely to differ considerably. Should you choose to edit the file it has some descriptive comments in the header, but there are a few things that may not be obvious. The file starts like this:

@@resource UnicodeFontMapping
Mathematica: Times Automatic
Mathematica: (Times Courier) Automatic
Mathematica: (Mathematica1 Mathematica1Mono) Automatic
Mathematica: (Mathematica2 Mathematica2Mono) Automatic
Mathematica: (Mathematica3 Mathematica3Mono) Automatic

Fonts are given identifiers based on the line on which they appear. Mathematica1 is on the third line after the @@resource header, and counting from zero it is therefore given the identifier 2. The file goes through 15 by default but I believe you an add additional fonts in this manner.

The letter alpha is mapped by this line:

0x03B1      N       -2      0x61        # \[Alpha]

I believe the fields are:

  1. The Unicode code point used in the Notebook
  2. A letter designating the type of character, e.g. (N)ormal, (V)ertical spanning, (H)orizontal spanning, and (D), used for Overscript and Underscript but the naming of which I cannot guess.
  3. The identifier described above. I have yet to determine the significance of the -.
  4. The code point of the actual glyph within the font file.
  5. A comment delimited by #, reminding of the default FullForm mapping.
share|improve this answer
3  
The - sign indicates that we shouldn't be using the Mathematica fonts when we're in Greece. The Mathematica fonts are just a nightmare if you actually want to communicate in Greek, but Unicode makes no distinction between mathematical and lingual uses of Greek (except for epsilon, which evolved into two separate characters...and don't think that didn't cause a stir back in the day when the Unicode committee screwed it up, then majorly broke backward compatibility to fix it). I discovered recently that the "in-Greece" feature didn't seem to be working as expected on Mac v9, so YMMV. –  John Fultz Feb 15 '13 at 22:33
4  
This resource file is going to undergo a major overhaul in a future release, incidentally. Unicode support in Mathematica mostly predates Unicode support in operating systems, and some things are going to be changing. So don't expect this file format to be future-proofed. –  John Fultz Feb 15 '13 at 22:35
    
@JohnFultz Thanks as always for the inside scoop. Regarding the forthcoming changes will there still be a user configuration file like this, just in a different format? –  Mr.Wizard Feb 16 '13 at 6:01
    
@JohnFultz Is support for characters not in the basic multilingual plane (i.e. > FFFF) coming? That would be very useful for working with text in non-Roman scripts. I have a little Chinese character lookup tool that searches based on components and this was a problem (as the database I used has lots of > FFFF characters) –  Szabolcs Feb 17 '13 at 0:30
    
@Mr.Wizard Yes, it'll be a resource with similar sorts of information. When the time comes, I'll be happy to discuss the particulars. –  John Fultz Feb 17 '13 at 18:17
show 4 more comments

Following from Mr. Wizard's post, I was able to get Mathematica to substitute Greek letters with whatever font I want by editing \SystemFiles\FrontEnd\TextResources\UnicodeFontMapping.tr. I first tried changing

Mathematica: (Mathematica1 Mathematica1Mono) Automatic

into

Mathematica: (DejaVuSans DejaVuSansMono) Automatic

which worked for changing the font, however it forced all of the symbols in Mathematica1 to be rendered with DejaVu - including things DejaVu obviously doesn't have like the line for a fraction and the \[Wolf] symbol.

So I undid that, and then just changed the Greek letters to reference font set 0 instead of 2, -2, or 4, which works so long as you use a font that supports a wide range of Greek letters.

0x0391      N       2       0x41        # \[CapitalAlpha]
0x0391      N       0       0x41        # \[CapitalAlpha]

I did this through the Sampi symbol, and now the Greek looks much better with any font. Here's my file if you want to copy it.

Here's what it will look like if you do these changes:

Mathematica Unicode changes

The first two are what I want Mathematica to do - display all Greek in whatever font I say just like any other text. The Text cell is in DejaVuSans, and the Input cell is in DejaVuSans Mono Plain.

The next two are what happens if you change your Unicode Mapping but don't change the default font - for Text it's Times and Input it's Courier Bolded. Notice that they're both missing some of the fancier symbols.

Finally, I have the Mathematica1 and Mathematica1Mono fonts. If you do not change your Unicode Mapping, this is what you get, Mathematica1 for Plain text, and Mathematica1 for mono spaced text. Ignore that some of the symbols are wrong here, that's my own fault.

share|improve this answer
add comment

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.