fontspec
fontspec copied to clipboard
Can't use .fontspec files with math fonts
(Apologies if this should be filed under the unicode-math project.) I'm trying to use a .fontspec file for a math font. For example, I start with this:
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{texgyrepagella-math.otf}
\begin{document}
$\alpha$
\end{document}
I create a file TeXGyrePagellaMath.fontspec containing
\defaultfontfeatures[TeX Gyre Pagella Math]
{
Extension = .otf,
UprightFont = texgyrepagella-math
}
(UprightFont seems like the wrong name, but I'm not sure what to use.) I replace \setmathfont{...} with \setmathfont{TeX Gyre Pagella Math}. When I compile, I get this error:
(.../TeXGyrePagellaMath.fontspec)kpathsea:make_tex: Invalid filename
`[TeX Gyre Pagella Math.otf]/OT', contains '['
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "TeX Gyre Pagella Math" cannot be found.
...
See also https://tex.stackexchange.com/questions/437855/use-separate-fontname-fontspec-file-with-unicode-math