1

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 .

  • 1
    Side note, regarding "how to give error instead of silently ignore" see e.g. errors - Getting xetex to complain when a character is missing - TeX - LaTeX Stack Exchange and others – user202729 May 11 '22 at 01:09
  • By the way it's recommended to use https link instead of http link, so that some functionalities in the site works properly. – user202729 May 11 '22 at 01:10
  • @user202729 As for http vs. https, I don't know which functionality would make the difference. As for \tracinglostchars=2, thanks!!! –  May 11 '22 at 01:12
  • This looks suspiciously like https://tex.stackexchange.com/q/643756 (also from you) which differs only in the font used, and has an answer. – barbara beeton May 11 '22 at 01:14
  • @barbarabeeton The answer http://tex.stackexchange.com/a/643761 doesn't fit because \vv isn't defined by unicode-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
  • I know they don't look quite the same, but would either \overrightarrow{var} or even just \overset{\rightarrow}{var} suit you? – frabjous May 11 '22 at 01:45
  • @frabjous Feeding \(\mathit{\overrightarrow{I}}\) to lualatex doesn't print any arrow at all. Feeding \(\mathit{\overset{\rightarrow}{i}}\) to lualatex produces an arrow too large; the smaller arrow from \vec{i} is visually way more pleasant. I apologize for having said var in my original post; I should have taken short letters rather than multi-letter words. –  May 11 '22 at 02:01
  • @user202729 Added \tracinglostchars=2 to the minimal example. Thx! –  May 11 '22 at 02:10
  • @frabjous I've just changed my original post by replacing var with a single letter to avoid being asked why placing a short arrow over a long argument. –  May 11 '22 at 02:12
  • How about combing \overset with \mathsmaller from the relsize package? \usepackage{relsize}\renewcommand{\vec}[1]{\overset{\mathsmaller\rightarrow}{#1}} – frabjous May 11 '22 at 02:40
  • @frabjous Sure, thanks! The usual limitations are the small arrows in double second-level subscripts or superscripts, such as \(X_{Y_{\vec{i}}}\). As for my larger, non-minimal document, I'd have to check for this. –  May 11 '22 at 02:45
  • 1
    you can use \usepackage[mathit=sym]{unicode-math}, then \mathit will no longer switch to a text font. But basically your input is errounous. \mathit is not a command to make a mathematical expression italic, but should normally be used with letters only. – Ulrike Fischer May 11 '22 at 07:27
  • @UlrikeFischer I've just looked it up. Strictly speaking, your last sentence is wrong. In Lamport's LaTeX: A Document Preparation System: User's Guide and Reference Manual, 1994, 2nd ed., p. 51, § 3.3.8, we see a list of commands including “\mathit”, followed by the sentence “They change the style only of letters, numbers, and uppercase Greek letters. Nothing else is affected.” I view this as a definition, albeit not a strict mathematical one. In particular, “nothing else is affected” implies that arrows, wherever they are, should not be affected either, let alone disappear. –  May 14 '22 at 01:21
  • @UlrikeFischer Of course, the documentation unicode-math deviates 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

0 Answers0