Feeding xelatex or lualatex with
\documentclass{article}
\pagestyle{empty}
\usepackage{unicode-math}
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}
\setsansfont{TeX Gyre Heros}[Scale=0.88]%%% Somewhat ok.
\setmonofont{TeX Gyre Cursor}%%% No explicit turning on ligatures for the monospaced font.
\setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}
\tracinglostchars=2
\begin{document}
\(\mathit{\vec{i}}\)
\end{document}
results in
i
without any arrow. Of course, the problem can be circumvented by dropping \usepackage{unicode-math} … \setmathfont[Ligatures=TeX]{TeX Gyre Termes Math} or exchanging the order of calling \vec and \mathit or simply dropping \mathit for single-letter arguments (as no kerning between adjacent letters of the argument would be needed). However, since the calls to the two macros may be hidden inside other macros (and for my larger, non-minimal LaTeX sources, they are indeed hidden inside other macros), it would be better to solve the problem already on the level of the preamble or in the unicode-math package or by patching it or, ideally, extending the TeX Gyre Termes Math font in such a way that the user's main document needn't be changed. Any idea how to do this?
PS. For latex/pdflatex and NewTX, cf. \mathit{\vec{…}} silently swallows up the vector when using latex/pdflatex and newtxmath .
\tracinglostchars=2, thanks!!! – May 11 '22 at 01:12\vvisn't defined byunicode-math. The two questions also differ in the engines used. I've just made this clear in the title. – May 11 '22 at 01:17\overrightarrow{var}or even just\overset{\rightarrow}{var}suit you? – frabjous May 11 '22 at 01:45\(\mathit{\overrightarrow{I}}\)tolualatexdoesn't print any arrow at all. Feeding\(\mathit{\overset{\rightarrow}{i}}\)tolualatexproduces an arrow too large; the smaller arrow from\vec{i}is visually way more pleasant. I apologize for having saidvarin my original post; I should have taken short letters rather than multi-letter words. – May 11 '22 at 02:01\tracinglostchars=2to the minimal example. Thx! – May 11 '22 at 02:10\oversetwith\mathsmallerfrom the relsize package?\usepackage{relsize}\renewcommand{\vec}[1]{\overset{\mathsmaller\rightarrow}{#1}}– frabjous May 11 '22 at 02:40\(X_{Y_{\vec{i}}}\). As for my larger, non-minimal document, I'd have to check for this. – May 11 '22 at 02:45\usepackage[mathit=sym]{unicode-math}, then \mathit will no longer switch to a text font. But basically your input is errounous.\mathitis not a command to make a mathematical expression italic, but should normally be used with letters only. – Ulrike Fischer May 11 '22 at 07:27unicode-mathdeviates from Lamport's definition, saying “The legacy\math..commands switch to text fonts that are set up to behave correctly in mathematics, and should be used for multi-letter identifiers.” However, this definition is already too restrictive because it already excludes Lamport's example$\mathit{italic + 2^{ft} \Psi \log[\psi]}$and does not allow for typesetting pretty normal identifiers containing dashes, underscores and primes, such as number_of_thingums, centimeters-in-an-inch, or var'. – May 14 '22 at 01:36