# Font substitution with TeX Gyre DejaVu Math when used with unicode-math

With this choice of font, I'm getting a this warning:

Font shape U/esvect/m/n' in size <6.5> not available (Font) size <6> substituted on input line 11.

I understand what it means and what causes it (that the chosen font isn't available in the stated size, so an available different size is substituted). It doesn't happen with every font I try. I can live with it, but would like to be able to eliminate it. My question is whether or not there is anything I can do within my font setup, short of using another font, to eliminate it. I have searched this site, the unicode-math docs, the fontspec docs, and the web in general and haven't found anything obviously relevant.

% !TEX TS-program = lualatexmk
% !TEX encoding = UTF-8 Unicode

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{TeX Gyre DejaVu Math}
\usepackage{esvect}

\begin{document}

$$\vv{a}$$

\end{document}

• unicode-math adapts the mathsizes depending on the math font, that's why you get the message, but you would get similar messages also without it. E.g. if you use \documentclass[11pt]{article} To avoid it you will have to change the font definitions of esvect. – Ulrike Fischer Oct 13 '20 at 16:17
• I think I'm about to learn how to do that then. – LaTeXereXeTaL Oct 13 '20 at 21:26

The font definition file coming with esvect only defines font for fixed sizes, namely 5, 6, 7, 8, 9, 10, 10.95, 12, 14.4, 17.28, 20.74, 24.88, in the usual square root progression after 10.

You can fix this by exploiting the fact that the fonts are available in Type1 format, so they can be scaled at will.

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{TeX Gyre DejaVu Math}
\usepackage{esvect}

\DeclareFontFamily{U}{esvect}{}
\DeclareFontShape{U}{esvect}{m}{n}{%
<-5.5> vect5
<5.5-6.5> vect6
<6.5-7.5> vect7
<7.5-8.5> vect8
<8.5-9.5> vect9
<9.5-> vect10
}{}

\begin{document}

$$\vv{a}$$

\end{document}


This way, LaTeX is able to choose the font at any size, still using optical fonts for smaller sizes.

• Thank you. I've see this sort of thing, but I still don't understand where the numbers in angle brackets come from. How would I know to use those particular numbers? They appear to bracket the 5, 6, 7, 8, 9, and 10 you cite. – LaTeXereXeTaL Oct 13 '20 at 21:25
• @LaTeXereXeTaL <8.5-9.5>vect9 means that any time LaTeX is requested to use the font at a size s such that 8.5 < s ≤ 9.5 (in points), it will use vect9 scaling it at the desired size; <-5,5> is the same as <0-5.5>, whereas <9.5->` is for any size larger than 9.5. – egreg Oct 13 '20 at 21:36