3

I would like to use EB Garamond (distributed with TeX Live) in a document typeset by XeLaTeX on OS X 10.11:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{EB Garamond}
\begin{document}

Hello, World!

\end{document}

However when I run xelatex it produces the following error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "EB Garamond" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.3 \setmainfont[Ligatures=TeX]{EB Garamond}

Even though the font exists on my system:

$ ls /usr/local/texlive/2015/texmf-dist/fonts/opentype/public/ebgaramond/
EBGaramond12-Italic.otf     EBGaramondInitials.otf
EBGaramond12-Regular.otf

How do I get XeLaTeX to use the TeX Live copy of EB Garamond on OS X?

Related: The same question but for Ubuntu GNU/Linux

1 Answers1

6

Solution 1: Add TeX Live fonts to the standard OS X font location

XeLaTeX uses the system font library, which on OS X look for fonts only in /System/Library/Fonts, /Library/Fonts and ~/Library/Fonts (source). The command above creates a symlink from the user's font library to the directory containing the OpenType fonts distributed with TeX Live 2015.

ln -s /usr/local/texlive/2015/texmf-dist/fonts/opentype/ ~/Library/Fonts/texlive-opentype

(NB: If you don't want to use the TeX Live 2015 version, change the date in the command above.)

The example in the question works once this link has been created.

Solution 2: Select the font by filename

A disadvantage of solution 1 is it can slow down graphic design programs such as GIMP or Inkscape because they have to keep track of a large number of fonts. If this is a problem for you, don't symlink the TeX Live fonts into ~/Library/Fonts/, and ask for fonts by filename instead.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{EBGaramond12}[
  Extension   = .otf ,
  UprightFont = *-Regular ,
  ItalicFont  = *-Italic ,
  Ligatures   = TeX]
\begin{document}

Hello, World!

\end{document}