4

This is what I'm seeing:enter image description here Note the discrepancy in the height of the square root symbol in \sqrt{11}. This seems to happen only when I compile with lualatex.

Here's my MWE:

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont[]{TeX Gyre Pagella Math}
\setmathfont[range={cal}]{Latin Modern Math}

\begin{document}
  Note well:
  \begin{equation*}
    x = \sqrt{11}\sqrt{19}
    \qquad
    y = \frac{\sqrt{11}\sqrt{19}}{26}
  \end{equation*}
\end{document}

I assume this is a bug, but I'm not sure whether that's the case, or how to report it if it is.

2
  • It looks like the problem goes away if I use xelatex, so that might also be a solution.
    – Derek
    Commented Apr 11, 2017 at 23:17
  • 1
    This problem has been corrected for the next version of unicode-math. Commented Jan 3, 2018 at 8:35

2 Answers 2

3

It's a known “feature” of the range option. You cure it by reestablishing as last math font the main one, choosing it for the range of some symbol.

The author of unicode-math is aware of it.

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont[]{TeX Gyre Pagella Math}
\setmathfont[range={cal}]{Latin Modern Math}
\setmathfont[range=\int]{TeX Gyre Pagella Math}

\begin{document}
  Note well:
  \begin{equation*}
    x = \sqrt{11}\sqrt{19}
    \qquad
    y = \frac{\sqrt{11}\sqrt{19}}{26}
  \end{equation*}
\end{document}

enter image description here

4
  • This is a useful workaround for my case. Thanks.
    – Derek
    Commented Apr 11, 2017 at 23:17
  • How does tex actually produce these various versions of the sqrt symbol? It stretches it out vertically, or are there actually several unicode characters for the sqrt symbol?
    – mnr
    Commented Aug 14, 2021 at 14:40
  • @mnr There are several glyphs associated to the Unicode point
    – egreg
    Commented Aug 14, 2021 at 16:36
  • Concerning “The author of unicode-math is aware of it.”: I have not found any open report on this, so I've just made the author even more aware of a related issue in github.com/latex3/unicode-math/issues/637 .
    – AlMa1r
    Commented Jun 21 at 22:34
3

There is not only a problem with the height of the roots, if you look carefully you can see that the horizontal rules of the roots are wrong and also the fraction rule is to thin. As egreg wrote it is a problem with the range option. The last math font sets important math constants. In this case the problem is with \Umathradicalrule and \Umathfractionrule as you can see in this example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont[]{TeX Gyre Pagella Math}
\makeatletter\check@mathfonts \makeatother
\edef\textstylerulewidth{\the\Umathradicalrule\textstyle}
\edef\displaystylerulewidth{\the\Umathradicalrule\displaystyle}
\edef\displaystylefraction{\the\Umathfractionrule\displaystyle}

\setmathfont[range={cal}]{Latin Modern Math}


\begin{document}
\makeatletter\check@mathfonts \makeatother
\Umathradicalrule\textstyle=\textstylerulewidth 
\Umathradicalrule\displaystyle=\textstylerulewidth 
\Umathfractionrule\displaystyle=\displaystylefraction
  Note well:
  \begin{equation*}
    x = \sqrt{11}\sqrt{19}
    \qquad
    y = \frac{\sqrt{11}\sqrt{19}}{26}
  \end{equation*}
\end{document}

(Setting the values like this one-by-one is naturally not the way to go, the solution of egreg is better, but it is imho interesting to see how this value affect the output.)

1
  • Thanks for this, Ulrike — I've used this approach in the next version of the code to save and restore the values. (I haven't decided how this should be unified with XeTeX and also made configurable, but it's a start...) Commented Jan 3, 2018 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .