Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AlMa1r opened this issue Jun 21, 2024 · 1 comment

Comments

@AlMa1r
Copy link

AlMa1r commented Jun 21, 2024

(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

\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:
grafik
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.)

@AlMa1r AlMa1r changed the title If the main math font is TeX Gyre Termes Math and the compiler is lualatex, simplify and document getting new characters from STIX Math or STIX Two Math without causing unrelated issues. 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. Jun 21, 2024
@wspr
Copy link
Collaborator

wspr commented Jul 18, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants