latex3 / unicode-math

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

\sqrt[n]{x} uses incorrect root symbol in combination with range (LuaTeX only) #440

Open Socob opened 6 years ago

Socob commented 6 years ago

Description

In unicode-math v0.8k, when using range=… to take some symbols from another font (where range does not include \sqrt), \sqrt{x} uses the correct root symbol, but \sqrt[n]{x} uses the symbol from a different font, producing inconsistent/broken output. As usual, adding a font declaration with the main font at the end (e. g. \setmathfont{latinmodern-math.otf}[range=\int]) causes both commands to use the same (correct) root symbol. It seems that only LuaTeX is affected.

(I’m not sure whether this is related to #423 or the discussion in https://tex.stackexchange.com/q/364310?)

Check/indicate

Minimal example demonstrating the issue

\documentclass{article}

\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}
\setmathfont{texgyretermes-math.otf}[range={up/{greek,Greek,latin,Latin,num},it/{greek,Greek,latin,Latin,num}}]
% uncomment this to get consistent symbols
%\setmathfont{latinmodern-math.otf}[range=\int]

\begin{document}
    \[
        αβγ
        \sqrt[n]{x} \sqrt{x}
    \]
\end{document}

Further details

Output with \setmathfont{latinmodern-math.otf}[range=\int] at the end: test-with-reset

Output without \setmathfont{latinmodern-math.otf}[range=\int] at the end: test-without-reset

wspr commented 6 years ago

Thanks for the excellent bug reports. I’ll see what I can do to fix this up quickly.