EB-Garamond
EB-Garamond copied to clipboard
Please, consider adding support for Mathematics
Hi, Georg.
First of all, it is a real pleasure to see EB-Garamond becoming this beautiful and with strong development. In fact, it is getting so beautiful that I'm tempted to switch over completely to it. :)
But to write documents in XeTeX, I would need to have some kind of support for mathematics. Not exactly in a hurry, but I see that @khaledhosny has accumulated a good amount of knowledge with his XITS font. (Actually, it would be superb if he could document the experience that he gained and, perhaps, transform those in some scripts---as much as possible).
Anyway, I can help with the mathematics part, as I am a Computer Scientist. What I can't really help with is with the artistic side of things (as you probably noticed with the disaster that my URW Garamond No.8 turned out to be).
Thanks for all the beautiful work.
Hi Rogério,
Thank you very much!
Indeed I am considering math support, but if I see it correctly, it needs italic and bold to be usable, so those cuts have to be done first.
For use with pdfLaTeX, by the way, one could consider adopting the mathdesign package for FS Garamond, which fits metrically quite will with EB Garamond. That, however, would need the creation of TeX-fonts from EB-Garamond.
There is a way to use EB Garamond for maths in LaTeX right now with unicode-math
:
\usepackage[math-style=french]{unicode-math}
\setmathfont{XITS Math} % base font
\setmathfont[range=\mathup/{latin,Latin,greek,Greek}]{EBGaramond12-Regular}
\setmathfont[range=\mathit/{latin,Latin}]{EBGaramond12-Italic}
Works with the latest TeXLive version of LuaLaTeX at least. I didn't test it elsewhere. Not perfect though, the kerning is sometimes wrong and the greek italic letters may look weird if you are used to XITS Math.
Interesting idea, thanks, @Evpok !
I second the request for math support and I too think the font is becoming very beautiful.
Besides the Evpok approach there's another option, both have their own issues, and unfortunately the two approaches can't be combined.
In Evpok's case the numerals, at least for me, when I compile with XeLaTeX, remain in the XITSMath font and so do the bold math fonts and subscripts.
When instead of using the unicode-math
package, one uses the mathspec
package and the following commands:
\setallmainfonts[Ligatures=TeX, Numbers=OldStyle, AutoFakeBold=1.5, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EB Garamond}
for OldStyle numbers in both main body and math, and
\setmainfont[Ligatures=TeX, Numbers=OldStyle, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EB Garamond}
\setmathsfont(Digits)[Ligatures=TeX, Numbers={Lining}, AutoFakeBold=1.5, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EB Garamond}
\setmathsfont(Greek)[Ligatures=TeX, Numbers={Lining}, AutoFakeBold=1.5, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EB Garamond}
\setmathsfont(Latin)[Ligatures=TeX, Numbers={Lining}, AutoFakeBold=1.5, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EB Garamond}
\setmathrm[Ligatures=TeX, Numbers={Lining}, AutoFakeBold=1.5, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EB Garamond}
for OldStyle numbers in main body and Lining numbers in math.
With these commands all math is typeset in EB Garamond, but one looses the \mathbb
and \mathcal
fonts, for which one needs to find separate typefaces. But the biggest issue is the loss of quality in symbols like fences, ... which are now bitmapped. Preceding the commands by
\usepackage[unicode-math]
\setmathfont{Asana-Math.otf}
solves the symbols, \mathbb
and \mathcal
issue, but creates a new ones; at least the bold math font and the greek alphabet are no longer EB Garamond. I haven't figured out how to solved these issues, yet.
It seems that in the end the @Evpok way is the way to go :)
The solution to my previous post is:
\usepackage[math-style=french,bold-style=TeX]{unicode-math}
\setmathfont{Asana Math} % base font
\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}, Ligatures=TeX, Numbers={Lining}, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EB Garamond}
\setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}, Ligatures=TeX, Numbers={Lining}, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EBGaramond12-Italic}
\setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}, Ligatures=TeX, Numbers={Lining}, FakeBold=1.5, SizeFeatures={{Size=-8, OpticalSize=8},{Size= 8-, OpticalSize=12}}]{EB Garamond}
with this one sets math (lining numbers, lowercase, uppercase, greek, uppercase greek) in EB Garamond, in upright, italic and a fake bold variant (only upright). The remaining math symbols are typeset using the Asana Math typeface.
That's almost what I was about to answer to your first comment :) except that I stick to XITS and that I do use EBGaramond-Bold (yes, I like challenges :)
The method @Evpok and @itzsimpl describe works quite well for me, too, but accents above italic characters are slightly displaced. Is there a workaround for this as well?
A specific mathfont to go with EB Garamond would perhaps be the most beautiful solution. But I find I very much like the combination of EB Garamond and (Neo) Euler, in particular setting \setmathfont[Scale=MatchLowercase,math-style=upright,vargreek-shape=unicode]{Neo Euler}
Recently @yuanshengzhao has created a math font with OpenType support: see https://github.com/YuanshengZhao/Garamond-Math
That one can be a good starting point for the parts (XTIS) with a correct license (OFL)! The TeX Gyre parts are GFL/LPPL which isn't quite compatible though. Perhaps replace Thermes with STIX/XTIS? Both are Times-like anyway…
(Yeah, Math fonts are messy – in addition to the symbols, you need to make a bunch of new letter styles and all that…)