unicode-math
unicode-math copied to clipboard
Range processing bug.
Description
A sentence or two describing the issue.
Add info or delete as appropriate:
https://tex.stackexchange.com/questions/597185/range-option-not-working-properly-in-setmathfont https://tex.stackexchange.com/questions/348481/when-specifying-a-character-in-unicode-maths-range-option-why-are-alternativ
Minimal example demonstrating the issue
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont{XITS Math}[range={`0-`9}]
%\setmathfont[range={}]{Latin Modern Math}
\begin{document}
1234567890
$ x^{2}+y^{2}=z^{2}, \xi\alpha\beta, 1234567890 $
\end{document}
The font for numbers is not set.
If add something to the range
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont{XITS Math}[range={`0-`9,"0391}]
\begin{document}
1234567890
$ x^{2}+y^{2}=z^{2}, \xi\alpha\beta, 1234567890 $
\end{document}
The font is changed is there's at least one code point in the final range which is located in
"0391-"03A1,"03A3-"03AF,"03B1-"03BF,"03F4,"2202,"2207,"1D434-"1D454,"1D456-"1D467,"1D6E2-"1D6FA,"1D6FC-"1D714
Further details
Range | Meaning |
---|---|
U+0391- U+03A9 | Greek Capital Ketters (U+03A2 is Undefined Character) |
U+03AA, U+03AB | ΪΫ Greek Capital Letter with Dialytika |
U+03AC - U+03AF | Greek Small Letters with Tonos |
U+03B0 (not working) | ΰ Greek Small Letter Upsilon with Dialytika and Tonos |
U+03B1 - U+03BF | Greek Small Letters from alpha to omicron |
U+03C0 - U+03C9 (not working) | Greek Small Letters from pi to omega |
U+03CA - U+03E1 (not working) | Some Viariants of Greak Letters |
U+03F4 | ϴ Another Capital Theta |
U+2202,U+2207 | partial and nabla |
U+1D434 - U+1D467 | Math letters of A-Z and a-z U+1D455 is not defined, mathmatical h is at U+210E (not working) |
U+1D6E2 - U+1D6FA | Math Greek Capital Letters |
U+1D6E2 - U+1D6FA | Math Greek Small Letters |
I have a related but opposite issue when unicode-math 0.8q (2020/01/31) is used with XeTeX 3.141592653-2.6-0.999995 or LuaHBTeX 1.17.0 shipped with TeX Live 2023. If I specify range={up, X}
, where X
is from the following table, up
is ignored:
codepoints | characters |
---|---|
U+00391–U+003A1, U+003A3–U+003A9 | Α–Ω |
U+003B1–U+003C9 | α–ω (incl. ο, ς) |
U+003F4 | ϴ |
U+02202 | ∂ |
U+02207 | ∇ |
U+1D434–U+1D44D | 𝐴–𝑍 |
U+1D44E–U+1D454, U+1D456–U+1D467 | 𝑎–𝑔, 𝑖–𝑧 |
U+1D6E2–U+1D6FA | 𝛢–𝛺 (incl. 𝛩, 𝛳) |
U+1D6FC–U+1D714 | 𝛼–𝜔 (incl. 𝜍, 𝜎) |
Here is the script that prints out each offending codepoint. Be warned that it may take days to loop through all the codepoints:
import os
import subprocess
latex = 'xelatex' # or 'lualatex'
doc1 = r'''
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\setmathfont{TeX Gyre Termes Math}[range={up, "
'''.strip('\n')
doc2 = r'''
}]
\begin{document}
$\symup{ABC}$
\end{document}
'''.strip('\n')
for code in range(0x20000):
char = chr(code)
hex = f'{code:05X}'
uni = f'U+{hex}'
try:
subprocess.run(
[latex, f'--jobname={uni}'],
check=True, input=doc1+hex+doc2, stdout=subprocess.DEVNULL,
encoding='utf8')
result = subprocess.run(
['pdffonts', f'{uni}.pdf'],
check=True, capture_output=True, encoding='utf8')
if 'TeXGyreTermesMath' not in result.stdout:
print(uni, char, flush=True)
except:
print(uni, char, 'error', flush=True)
finally:
os.remove(f'{uni}.log')
os.remove(f'{uni}.aux')
os.remove(f'{uni}.pdf')