Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am a big lover of the EB-Garamond fonts by Georg Duffner. As of now, he has made two sets of font files, EB-Garamond-8 and EB-Garamond-12, respectively for “design size 8pt” and “design size 12pt”. Is there a way to make fontspec (and possibly unicode-math, too) use EB-Garamond-8 fonts for small sizes e.g. sub/superscripts, footnotes… and EB-Garamond-12 fonts for regular sizes when using local font files¹?

If I use only EBGaramond12, the following code works if I put the EBGaramond12-* .otf files in a fonts/ directory sibling to the .tex²


but if I try to adapt it to use the SizeFeatures options

        {Size={-12}, UprightFont=EBGaramond8-Regular, ItalicFont=EBGaramond8-Italic},
        {Size={12-}, UprightFont=EBGaramond12-Regular, ItalicFont=EBGaramond12-Italic, BoldFont=EBGaramond12-Bold}

Then the document won't compile and I get the following error. Using complete names instead of wildcarded ones changes nothing.

The key 'fontspec/UprightFont' is unknown and is being ignored.

¹ It means that using features that automagically select the right system fonts is not an option.

² the file structure is

├── fonts
│   ├── EBGaramond08-Italic.otf
│   ├── EBGaramond08-Regular.otf
│   ├── EBGaramond12-Bold.otf
│   ├── EBGaramond12-Italic.otf
│   └── EBGaramond12-Regular.otf
└── paper.tex
share|improve this question
yes, look into the documentation. –  Herbert May 14 '13 at 13:09
@Herbert Actually using local font files instead of system fonts seems to break the SizeFeatures option. Or vice-versa. –  Evpok May 14 '13 at 14:30
There is no need to put the font files into the TeX directory. However, if you are using XeTeX then there will be a problem if you have fonts installed twice, system dir and local tex dir. –  Herbert May 15 '13 at 6:45
@Herbert I know, but I need to be able to distribute the project to people who might not have EBGaramond installed or not the same version So I need to use a local fonts/ directory –  Evpok May 15 '13 at 6:59
From memory this is a (major) oversight in fontspec which I've been meaning to fix for a long time now… I hope that I can free up some cycles soon to look at it! –  Will Robertson Jul 31 '13 at 7:45

2 Answers 2

If you download the fonts from Georg Duffner’s site, the archive includes a file called README.xelualatex. It tells you to load the font with \setmainfont{EB Garamond} (not your \setmainfont{EBGaramond12}), and explains that the sizes will take care of themselves. It also explains how to turn off optical sizes if you like: \setmainfont[OpticalSize=0]{EB Garamond 12 Regular}.

share|improve this answer
In my case (and in @Evpoks, as evidenced by the comment), I have to include the fonts in the distributed content in case the end-user doesn't have them. This means I have to reference them by filename, so this is not an option. –  You Jul 27 '13 at 10:08
I was just going to suggest using \directlua{fonts.names.scan(".")}, but that’s a neat trick which seems not to work any longer since TeX Live 2013. We need a lua expert to tell us how it goes now. –  Thérèse Jul 27 '13 at 19:18
The question is clearer now with the footnotes, and I see that my answer doesn’t address your situation. However, I’ll leave the answer here anyway, because anyone who downloads EB Garamond from CTAN and not straight from Georg Duffner’s site is likely to be unaware of his explanations (the CTAN package being directed toward users of pdftex). –  Thérèse Jul 31 '13 at 4:39

I still use the NFSS instead of fontspec. And NFSS has something for font sizes. I never used this feature, therefore can't suggest the exact syntax.

Below is my private NFSS-setup for Univers as an example. It uses the private encoding EUT1, you should change it to probably EU1.

\DeclareFontShape{EUT1}{univers}{m}{n}{ <-> "[UniversCom-55Roman.ttf]"}{}
\DeclareFontShape{EUT1}{univers}{m}{it}{ <-> "[UniversCom-55Oblique.ttf]"}{}
\DeclareFontShape{EUT1}{univers}{bx}{n}{ <-> "[UniversCom-65Bold.ttf]"}{}
\DeclareFontShape{EUT1}{univers}{bx}{it}{ <-> "[UniversCom-65Bold.ttf]:slant=0.2"}{}
\DeclareFontShape{EUT1}{univers}{bl}{n}{ <-> "[UniversCom-75Black.ttf]"}{}
share|improve this answer
I don't think this answers the question at all. –  You Jul 26 '13 at 21:02

Your Answer


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.