I want to use math fonts with the unicode-math
package. The code I wrote is
\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
\begin{document}
\begin{equation}
\vec{F} = m \vec{a}
\end{equation}
\end{document}
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
(./document.tex
LaTeX2e <2018-12-01>
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def)))
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/share/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texmf-dist/tex/latex/base/tuenc.def))
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/share/texmf-dist/tex/latex/unicode-math/unicode-math.sty
(/usr/share/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty
(/usr/share/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/share/texmf-dist/tex/latex/filehook/filehook.sty)
(/usr/share/texmf-dist/tex/latex/base/fix-cm.sty
(/usr/share/texmf-dist/tex/latex/base/ts1enc.def))
(/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>.
...
l.8
? 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.
Best Answer
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, andfc-match
ought to be able to find it there. Re-runtlmgr install tex-gyre-math
andtlmgr update --self --all
as whatever user owns the TeX Live installation. Runningsudo 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 intex-gyre-fonts
,texlive-fontsextra
,otf-latin-modern
andotf-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.
find /usr -name "texgyrepagella-math.otf" -print
/etc/fonts/conf.avail/09-texlive-fonts.conf
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
ortlmgr
in user mode. If you don’t have any important files in the hidden TeX Live directories in your home folder, consider deleting them.