0

I am trying to get someone else's thesis template to run, but the EBGaramond font is not working. I also have never used .cls files in latex, so I'm not sure if I'm missing something. In the .cls file, the line causing problems is:

\newfontfamily{\smallcaps}[RawFeature={+c2sc,+scmp}]{EB Garamond}

and the error is: Package fontspec Error: the font ''EB Garamond'' cannot be found

I have tried replacing "EB Garamond" with "ebgaramond" and "EBGaramond". I followed these directions to make sure the font was installed. To check that it was working, I tried using the command \usepackage{ebgaramond} in another document, which worked fine, so there seems to be something wrong about the specific line above. Also, I'm not sure if this is relevant, but the previous user of this template was exclusively using Overleaf.

Beth
  • 3
  • 2
  • are you using xelatex or luatex – David Carlisle Dec 09 '21 at 15:18
  • I've tried both, and I get the same error either way – Beth Dec 09 '21 at 15:27
  • you have provided no test file so hard to debug but are you sure you have the font installed? I'd expect it to be at a location such as /usr/local/texlive/2021/texmf-dist/fonts/opentype/public/ebgaramond/EBGaramond-Regular.otf – David Carlisle Dec 09 '21 at 15:36
  • Yes, it was in the location you specified (though with 2020 instead of 2021). I'm not exactly sure how to put together a text file in this case, but if it's necessary I can try to figure that out. – Beth Dec 09 '21 at 18:46
  • xelatex will not find it by name unless you have configured fontcongig to find it so you could try replacing EB Garamond by EBGaramond-Regular.otf so the file can be fond by lpathsearch rather than fontconfig (luatex shoud work the same way with either form) – David Carlisle Dec 09 '21 at 18:56
  • Wow that seems to have worked! Can you give instructions on how to configure fontcongig to find it so that I can avoid having to change "EB Garamond" to "EBGaramond-Regular.otf"? – Beth Dec 09 '21 at 19:27

1 Answers1

1

xelatex will not find fonts in the tex-live tree by name unless you have configured fontconfig to find them, so you could try replacing the internal font name EB Garamond by the file name EBGaramond-Regular.otf so the file can be found by kpathsearch rather than fontconfig (luatex should work the same way with either form).

To configure fontconfig you need a file such as

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/local/texlive/2021/texmf-dist/fonts/opentype</dir>
  <dir>/usr/local/texlive/2021/texmf-dist/fonts/truetype</dir>
</fontconfig>

"somewhere" (Mine is called local.conf in /etc/fonts but the details on a Mac will be different). Then run fc-cache to rebuild its font cache.

See texdoc texlive

Section 3.4.4 System font configuration for XeTeX and LuaTeX

David Carlisle
  • 757,742