2

A strange problem occurs with https://ctan.org/pkg/unicode-math. I have tested various fonts and math symbols and the problem seems to be the combination of https://ctan.org/pkg/unicode-math and LuaLaTeX as the problem does not occur on XeLaTeX. When I replace a subset of the symbols then some symbols might be replaced seemingly randomly. This is not only undesired but also gives inconsistent surds.

The color in the MWE is just for ease of detection. I am running on TeXLive 2019 with newest update.

\documentclass{article}
\usepackage{unicode-math,xcolor}
\setmathfont{Asana-Math.otf}
\setmathfont{texgyrebonum-math.otf}[range={\int},Color=red]

\begin{document}
\begin{align*}
    \sqrt{b\int}
    &\sqrt[3]{b\int}
    \sqrt[4]{b\int}
    \sqrt[n]{b\int}\\
    &\cuberoot{b\int}
    \fourthroot{b\int}
\end{align*}
\end{document}

The surds are obviously not consistent, both by shape and by color. Also, the joined lines in the second line look weird but that could be an issue of my pdf viewer.

enter image description here

3
  • 2
    Difficult to test without an example with available fonts
    – egreg
    Feb 12, 2020 at 10:45
  • 2
    @egreg any math font can be used, you actually can even use Asana-Math.otf. Basically I would say it is the standard problem with the range option. You have to reset various font dimens and datas to the main font afterwards. Feb 12, 2020 at 11:21
  • 1
    @egreg You are right, my code thus was not an MWE. Ulrike is also right. Feb 12, 2020 at 17:30

1 Answer 1

2

Here is a quick fix. But I cannot assure that all affected symbols are corrected by this. I have checked the whole document for red symbols and found none except for the desired ones.

The colors in the MWE are just for ease of detection.

\documentclass{article}
\usepackage{unicode-math,xcolor}
\setmathfont{Asana-Math.otf}
\setmathfont{texgyrebonum-math.otf}[range={\int},Color=red]
\setmathfont{Asana-Math.otf}[range={\sqrt},Color=blue]%new

\begin{document}
\begin{align*}
    \sqrt{b\int}
    &\sqrt[3]{b\int}
    \sqrt[4]{b\int}
    \sqrt[n]{b\int}\\
    &\cuberoot{b\int}
    \fourthroot{b\int}
\end{align*}
\end{document}

enter image description here

Observe the comment by Ulrike Fischer:

Your fix is the right thing to do. You should always call the main math font again after having used the range option so that font dimens and other stuff are correct. It doesn't matter much, for which range. \setmathfont{Asana-Math.otf}[range=\sum] e.g. will work too.

2
  • 4
    Your fix is the right thing to do. You should always call the main math font again after having used the range option so that font dimens and other stuff are correct. It doesn't matter much, for which range. \setmathfont{Asana-Math.otf}[range=\sum] e.g. will work too. Feb 12, 2020 at 11:23
  • @UlrikeFischer Thank you for your comment. Will this trick fix all undesired symbols or is a manual check required? Feb 14, 2020 at 23:36

You must log in to answer this question.

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