For lualatex, if the main math font is TeX Gyre Termes Math, simplify and document getting new characters from STIX Math or STIX Two Math without causing unrelated issues. #637
Let's set our main math font as TeX Gyre Termes Math. We also wish to get some symbol(s) not existing in TeX Gyre Termes Math from another math font. To this end, we write
\setmathfont{TeX Gyre Termes Math}
\setmathfont[Extension=.otf,range={…}]{STIXTwoMath-Regular}% Specify the Unicode position(s) in the value of range.
However, if lualatex is used, the above code leads to superfluous vertical gaps in \substack{…\\…}, \stackrel{…}{…}, \frac{…}{…}, and \underbrace{…}_{…}. To remove these gaps, we append
\setmathfont[range={}]{TeX Gyre Termes Math}% Leave the value of the range parameter empty or put \int there.
Combined:
\documentclass{article}
\pagestyle{empty}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Termes Math}
\setmathfont[Extension=.otf,range={"2040}]{STIXTwoMath-Regular}% Adding some char not present in the default math font.
\setmathfont[range={}]{TeX Gyre Termes Math}% Without this line, you get unwanted vertical space in the output below when compiling with lualatex.
\begin{document}
\(\stackrel{\text{def}}{\Longleftrightarrow} \frac{m}{n}\ \substack{1\\2} \underbrace{\langle\rangle\dotsm \langle\rangle}_{k\ \text{terms}}\)
\end{document}
Running lualatex on this yields:
This seems to work but is (1) undocumented (at least not visibly documented in unicode-math.pdf), (2) a bit bloated, and (3) misleading (the last \setmathfont[range=… doesn't really request a range of new characters; also, from a high-level viewpoint, a user doesn't really wish to mention TeX Gyre Termes Math twice just because of the way things currently work internally).
In this issue report, we ask to simplify and/or document the user's interface to adding new characters when using lualatex without causing unrelated issues (here: vertical gaps).
(Two asides are to be made. First, for xelatex, the issue doesn't exist; you may drop the last \setmathfont… line. Second, I have not tested other pairs of fonts; if you have, please feel free to change this report, including its title.)
Reloading with no range was common practice to work around unicode-math bugs, and I thought (but wouldn't guarantee!) I had fixed those issues. I'll look into this at some point; thanks for the report.
(History: http://tex.stackexchange.com/a/721080 .)
Let's set our main math font as TeX Gyre Termes Math. We also wish to get some symbol(s) not existing in TeX Gyre Termes Math from another math font. To this end, we write
However, if
lualatex
is used, the above code leads to superfluous vertical gaps in\substack{…\\…}
,\stackrel{…}{…}
,\frac{…}{…}
, and\underbrace{…}_{…}
. To remove these gaps, we appendCombined:
Running
lualatex
on this yields: This seems to work but is (1) undocumented (at least not visibly documented inunicode-math.pdf
), (2) a bit bloated, and (3) misleading (the last\setmathfont[range=…
doesn't really request a range of new characters; also, from a high-level viewpoint, a user doesn't really wish to mentionTeX Gyre Termes Math
twice just because of the way things currently work internally).In this issue report, we ask to simplify and/or document the user's interface to adding new characters when using
lualatex
without causing unrelated issues (here: vertical gaps).(Two asides are to be made. First, for
xelatex
, the issue doesn't exist; you may drop the last\setmathfont…
line. Second, I have not tested other pairs of fonts; if you have, please feel free to change this report, including its title.)