I want to use math fonts with the unicode-math package. The code I wrote is



\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}

        \vec{F} = m \vec{a} 

But this does not compile with xelatex. I get the output

This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/Arch Linux) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2018-12-01>
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex)))kpathsea:make_tex: Invalid filename `TeX Gyre Pagella Math/OT', contains ' '

! Package fontspec Error: The font "TeX Gyre Pagella Math" cannot be found.

For immediate help type H <return>.


? x
No pages of output.
Transcript written on document.log.

The fonts have been succesfully installed because tllocalmgr install tex-gyre tex-gyre-math gives

Initializing ...
tex-gyre is already installed with texlive-core
and it is uptodate
tex-gyre-math is already installed with texlive-core
and it is uptodate

I can also see the fonts have been installed successfully using a font manager. Then why aren't the fonts being found? The code compiles succesfully on Overleaf.

  • Can fc-list or fc-match "TeX Gyre Pagella Math" find them? Might need to clear some font caches, although in theory it ought to do that whenever it doesn’t find a font, automatically. – Davislor Oct 8 '19 at 17:53
  • 1
    Related? tex.stackexchange.com/questions/257231/… – Davislor Oct 8 '19 at 18:02
  • Does sudo fc-cache -fsv solve the problem? – Davislor Oct 8 '19 at 18:03

Install the Right Packages

If you are running a manual installation of TeX Live 2019, then the TeX Live package tex-gyre-math ought to contain the file, and fc-match ought to be able to find it there. Re-run tlmgr install tex-gyre-math and tlmgr update --self --all as whatever user owns the TeX Live installation. Running sudo fc-cache -fsv to rebuild XeTeX’s font cache might also help.

You might also have installed TeX Live from your distro. In that case, make sure you installed the right packages. Your log says you’re running on Arch Linux. I don’t run that distro myself, but according to the file list, the texlive-core package installs /usr/share/texmf-dist/fonts/opentype/public/tex-gyre-math/texgyrepagella-math.otf, and the rest of the TeX Gyre fonts are in tex-gyre-fonts, texlive-fontsextra, otf-latin-modern and otf-latinmodern-math. Since your log says that you’re running the Arch Linux version of XeLaTeX, but you refer to CTAN packages instead of Arch Linux packages, I suspect that you have a misconfiguration somewhere.

If That Doesn’t Work

You have an unusual installation, but maybe you don’t want to get rid of it.

  • Run find /usr -name "texgyrepagella-math.otf" -print
  • Find what directory the file is installed in (and make sure it’s not installed twice)
  • Add that directory to /etc/fonts/conf.avail/09-texlive-fonts.conf
  • Run sudo fc-cache -fsv.

Also check that you haven’t created any files in your user directory that are overriding updates to your global installation, as can happen if you run updmap or tlmgr in user mode. If you don’t have any important files in the hidden TeX Live directories in your home folder, consider deleting them.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.