2 min read

Fixing a font problem for XeLaTeX

If the topic sounds boring, well, it is really boring. I write it down here in case it’s useful to someone.

I was working on a talk about git & GitHub, and chose a different font (Helvetica Neue, sort of the default Apple font). I think the default font for LaTeX/Beamer is a bit too tall and thin for slides. Here’s the default:

Slide with default font

And here’s what I wanted:

Slide with Helvetica Neue

But it didn’t work on unix

It worked fine with XeLaTeX on my Mac, but it wasn’t working in Unix, and I’d like the source to be portable to others.

XeLaTex was giving two errors:

Invalid fontname `Helvetica Neue', contains ' '

Font \zf@basefont="Helvetica Neue" at 10.0pt not loadable: Metric (TFM) file
or installed font not found.

It obviously wasn’t finding the font.

I futzed about for an hour, trying to figure out where fonts are located on my Mac, and where fonts are located on Unix, and doing various web searches. But no luck.

How I solved the problem

Finally, I read this post on fonts in xelatex, and following that set of ideas, I figured out what to do.

  • Switch to the TeX Gyre Heros font. It looks just like Helvetica to me.

  • Download qhv2.004otf.zip.

  • On unix, unzip the file (which contains eight .otf files) into ~/.fonts

  • On Mac, unzip the file, double-click the .otf files and select “Install font.” This uses the Font Book application.

  • In the .tex file, use \setsansfont{TeX Gyre Heros}

Not thoroughly tested, but it works on two systems.