latex3 / unicode-math

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

A second \setmathfont with range changes \sym* for all(?) characters #387

Closed juliangilbey closed 6 years ago

juliangilbey commented 7 years ago

I'm using unicode-math version 0.8d. The following minimal code example shows the issue.

\documentclass{article}

\usepackage{unicode-math}
\setmathfont[Scale=MatchLowercase]{XITS Math}
\setmathfont[Scale=MatchLowercase,range=\int]{latinmodern-math}

\begin{document}
$\mathrm{sin}$ $\symup{sin}$ $\sin x$
\end{document}

We prefer the integral sign in latinmodern-math because of spacing issues. Unfortunately, though, using the second \setmathfont command makes \symup give everything in latinmodern-math font rather than in XITS Math. \sin uses the operatorfont, which is mathrm, so that looks OK, but the breakage of \symup is unfortunate indeed.

eg9 commented 7 years ago

range seems broken (known problem). A workaround is redeclaring the font for the required ranges.

\documentclass{article}

\usepackage{unicode-math}

\setmathfont{XITS Math}
\setmathfont{Latin Modern Math}[range=\int]
\setmathfont{XITS Math}[
  range={up,it,bfup,bfit}
]

\begin{document}

$\mathrm{sin}$ $\symup{sin}$ $\sin x$ $\symbf{sin}$
$\symit{sin}$ $\symbfit{sin}$

$\displaystyle\int_a^b f(x)\,dx$

\end{document}
screen shot 2017-04-05 at 00 14 08
wspr commented 7 years ago

Thanks Enrico — believe me, fixing this problem is top of the priority list but getting the time to tackle it is proving challenging right now...