In particular, does anyone know a font with good support for combining characters on greek letters? The default fonts in Ubuntu perform poorly in this regard…
Here’s how DejaVu Sans Mono (default monospace font) renders \alpha\hat=0:
Ubuntu Mono is better, but some greek letters are hard to distinguish from latin letters:
And it fails on tall letters:
There is a Thai font called Tlwg Mono that renders this correctly, but the weight of non-greek characters is too light:
Any recommendation? (appart from “stay away from these characters, even if you get them working, it won’t work on other people’s computer” )
Both Fira Code and JetBrains Mono render those fine for me. With those you get also code ligatures, for example displaying -> as a continuous arrow (which some people really like, while others really despise it).
I love writing in Unicode variable names (perhaps a bit more than I should), especially for my physics-based applications. I haven’t really had any trouble with the default font in Jupyter (not exactly sure what that is, should be the default monospace font), though the modifiers aren’t something I use often. I can get visually the right behavior by using \hat \alpha=0, but that line can’t be evaluated, I think because Julia doesn’t like the hat operator at the start of variable names? It does also overlap for beta.
I think Jupyter uses the default monospace font from the browser. On my system it looks like it’s the same font as in the terminal (I agree it works pretty well usually!).
Note that you need to write \alpha\hat: the hat is a combining character that goes over the preceding character. And this way you obtain a valid Julia identifier
I did some tests on Ubuntu 20.04, in the Gnome terminal and in the browser (e.g. Jupyter in Chrome or Firefox) and Juno. It appears that
some fonts work well in the terminal but not in the browser
some work well in the browser but cannot be selected in the Gnome terminal
Here’s a summary, testing for support of combining hat character on greek letters, such as "θ̂ " (obtained with \theta\hat).
Font
Version (head/name)
Gnome Terminal
Browser/Juno
Open license
Bitstream Vera Sans Mono
2.000/1.10
Cascadia Code
2005.150
Consolas
1.000
Cousine
1.220
DejaVu Sans Mono
2.370
Fira Code
4.000
Go Mono
2.008
Hack
3.003
Inconsolata
3.001
Iosevka
1.000/3.0.1
JetBrains Mono
1.000/1.0.3
Latin Modern Mono
2.004
N/A
Liberation Mono
2.100/2.1.0
Linux Libertine Mono O
5.100/5.1.7
N/A
Menlo
6.100/6.1d5e14
Monaco
2.000/5.1d1e1
Nimbus Mono PS
1.000
Noto Mono
1.000
Noto Sans Mono
2.002
N/A
SF Mono
0.000/15.0d5e1
TeX Gyre Cursor
2.004
N/A
Ubuntu Mono
0.800
So on my system at least, the winners are Fira Code and SF Mono (edit: and Iosevka). They’re the only fonts that work both in the terminal and in Jupyter and Juno. I find SF Mono a bit nicer but the license seems to be very restrictive (though I couldn’t find any licensing information in the dmg file downloaded from Apple’s website).
Now I can write
Edit: It looks like some font files have conflicting metadata between the “head” and “name” tables (fontRevision and Version fields respectively). I’ve put both versions when they don’t agree.
This Iosevka font looks very interesting, and highly customizable. And the combining characters work perfectly. Thanks for mentioning it, I’ve added it to the table.
I have now tried all fonts coming with the Atom fonts plugin GitHub - braver/fonts: Free and open fonts for the Atom editor , and only few of them passed the following test:
∂ₜu - Δu*(γ₁-α)*α̂=0 # это по-русски
(in case your browser doesn’t display everything properly: the second character is subscript-t).
Those were Iosevka family, Corby Mono S, DejaVu fonts, and GNU Unifont. Of these I choose DejaVu Sans Mono - Bront, with Iosevka Extended Medium being the close second. Tested on Mac and Windows.
The comparison above in this thread is flawed (or at least very system-dependent) because it looked at text rendered with fallback fonts for glyphs missing from the tested font. For the web page, the text was rendered without fallback font so any missing glyph is shown as missing.
(I didn’t want to revive this thread but my post above is a bit misleading and too old to edit, and it keeps getting attention…)
It’s the problem with reviving old threads: JuliaMono didn’t exist at the time! To me it’s clearly the best recommendation now (as the web page makes clear), so I’ll mark it as solution