4

I have EB Garamond 08 Regular and EB Garamond 12 Regular installed but I have no idea how to use them.

enter image description here

I've tried

\setmainfont{EBGaramond12-Regular}
\setmainfont{EBGaramond08-Regular}
\setmainfont{EB Garamond}

They basically compile the same doc.

How do I use EB Garamond 08 Regular in LaTeX?

CreZce
  • 113

1 Answers1

3

Evidently you are using LuaLaTeX or XeTeX, loading fonts via fontspec. That's where the \setmainfont originates.

As @Sverre noted in comments above, the 08 and 12 variants are optical sizes. The fontspec package is very smart, and knows what to do about that (in most cases). But the syntax is special. See the fontspec package documentation regarding Optical Sizes, particularly page 26.

Also be sure that you actually have all the EBGaramond fonts installed! The TeX package may not contain all the sizes. I find it better to download the font from an external location (such as fontsquirrel) and place them in (texmf-local)/fonts/truetype/eb-garamond then update the file name database (perhaps command mktexlsr). You may also need to delete any existing luatex-cache, usually found in (texmf-var) folder.

Try this:

% !TeX TS-program = LuaLaTeX
% !TeX encoding = UTF-8
\documentclass[12pt,lettersize]{memoir} % this class defines the size commands, used below
\usepackage{fontspec} % look at its docs page 26
\setmainfont{EBGaramond12-Regular}[% get fonts from outside source, not the TeX package
UprightFeatures = { SizeFeatures = {%
{Size=-10,  Font=EBGaramond08-Regular},%
{Size=10-, Font=EBGaramond12-Regular},%
}}%
]
\begin{document}
Hello, World!\par
{\small Hello, World!}\par
{\footnotesize Hello, World!}\par
{\scriptsize Hello, World!}\par
{\tiny Hello, World!}\par
\end{document}

I tested the above, and it works on my system. When you inspect the PDF (using a better reader than the one built into TeX) you will see that as the text gets small, suddenly it thickens a bit, indicating the switch to 08 optical size. And if you look at the PDF document properties, you will see that both 12 and 08 sizes are used.

EDIT: As Thérèse notes in comment below, if you get the fonts directly from Georg Duffner's site, then what you need is pre-configured. I am in the bad habit of using mix-and-match fonts for different sizes and shapes, so I use the full fontspec syntax suggested above.

  • 4
    Rather than FontSquirrel, go straight to the source: http://www.georgduffner.at/ebgaramond/download.html. fontspec gets the optical sizes of EB Garamond right with no need for the user to specify the size features; if you want to specify them anyway, you’ll need to do it for the italic as well. – Thérèse Oct 26 '17 at 18:28
  • @Thérèse Good point. In either case, the TeX package doesn't (currently) do the job, you have to get the fonts from somewhere else. The hand-coded method, in my reply, has the questionable advantage of allowing an entirely different font to be used at different size (or shapes). –  Oct 26 '17 at 18:30
  • @user139954 mentions using mix-and-match fonts. How would I specify that along with EB Garamond, for sizes above 18pt, I wanted to use Cormorant (a different garamond-like font that looks better at larger sizes)? Is that even possible? – Bryan H-M Oct 12 '18 at 22:05