latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
241 stars 28 forks source link

range option not working for minus sign typed as “-” #451

Open Socob opened 6 years ago

Socob commented 6 years ago

Description

When using the range option to take the minus sign from another font, the replacement does not work when entering the minus sign as “-” (U+002D HYPHEN-MINUS) in math mode unless \minus is explicitly specified in control sequence form. Using "002D and/or "2212 alone does not work.

Check/indicate

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{texgyrepagella-math.otf}
\setmathfont{latinmodern-math.otf}
\setmathfont{texgyrepagella-math.otf}[
    range={
        "002D, % -
        "2212, % −
    }
]
% The following version works!
%\setmathfont{texgyrepagella-math.otf}[
%   range={
%       "002D, % -
%       "2212, % −
%       \minus,
%   }
%]
\begin{document}
    -−

    $-−$
\end{document}

Further details

It’s a bit hard to see the difference, but here is the output:

Incorrect (1st version): Incorrect output

Correct (2nd version): Correct output

This is in unicode-math v0.8l, but it was working in unicode-math v0.8f.

wspr commented 6 years ago

Thanks, I suspect this happens for all symbols for which the input ascii is remapped to a different unicode slot (also see *).