LaTeX: Using a different font for glyphs used in commands like \sum
Hello everyone. I consider myself fairly competent when it comes to my work with LaTeX, but as everyone who uses it knows, it is definetely strange sometimes. And right now I have a problem which just irks me in the wrong ways:
I use XeTeX and a number of custom fonts for my documents, but when writing mathematical formulas I found out that the font I set for Greek letters (Gentium Plus) is used for letter commands like \alpha, \Alpha, ...
but not for commands like \sum, \prod
. As you can see in this example here. You can see XeTeX defaults to Computer Modern.
I've looked all over the net for solutions but I can't find one. I'm using mathspec, amsmath, amsfonts, amssymb
as my font related packages and I set my fonts like this:
\setmainfont{Charis SIL}
\setsansfont{Helvetica Now Display}
\setmonofont[Scale=MatchLowercase]{Fira Code Retina}
\setmathfont(Digits,Latin){Charis SIL}
\setmathfont(Greek){Gentium Plus}
I feel like I'm going insane not solving this problem. Should you require it, my entire LaTeX template is here on Github. Please help, thank you.
Short answer: Gentium Plus is not a full math font.
\sum and \Sigma are different characters. \Sigma is a standard Greek letter, and is included in Gentium Plus, while \sum is a special mathematical character – and is not.
To replace such symbols you will need to use a proper font with full mathematical character set, for example:
Whenever I want to use an OpenType font X with no math range:
It will never look 100% correct, as you end up with a mix of two fonts, but usually it is passable.
(This is not the best example, since FiraGO and Fira Math are closely related, but I hope you see what I meant. The trick here is to get a slashed zero, as Fira Math does not support it yet).
More info can be found in the manuals for fontspec and unicode-math – for example how to define proper ranges like:
\setmathfont[range=\mathup/{num}
Ah, for some reason I assumed that LaTeX pulled the characters from the same source and not that they were actually different characters in the glyph table. I did actually find the
unicode-math
package, but I couldn't quite make sense of therange
option it provided. This might be the way to go for me, or maybe I'll find a proper math font.Many thanks for your help.