I’m trying to use unicode-math’s capabilities (\setmathfont[range=…]) to use a non-math font in math mode. For example:
\documentclass{scrartcl}
\usepackage{unicode-math}
\setmainfont{FreeSans}
\setsansfont{FreeSans}
\setmathfont{Latin Modern Math}
\setmathfont{FreeSans}[range=up/{greek,Greek,latin,Latin,num}]
\setmathfont{FreeSans Oblique}[range=it/{greek,Greek,latin,Latin,num}]
\setmathfont{FreeSans Bold}[range=bfup/{greek,Greek,latin,Latin,num}]
\begin{document}
abc123
\textit{abc123}
\textbf{abc123}
\bigskip
\begin{tabular}{ll}
math & $abc123$ \\
mathit & $\mathit{abc123}$ \\
mathrm & $\mathrm{abc123}$ \\
mathup & $\mathup{abc123}$ \\
mathbf & $\mathbf{abc123}$ \\
mathbfup & $\mathbfup{abc123}$
\end{tabular}
\end{document}
With this document, I would expect all text to be in FreeSans and the lines with mathrm and mathup as well as mathbf and mathbfup to be the same. However, my result is this:
So, I have two questions about what is happening:
- Why are
\mathitand\mathupdifferent from\mathbfup?\mathbfupworks as it should, producing text in FreeSans Bold. The other two, on the other hand, produce the default of Latin Modern Math. - How do I get all of these commands to use FreeSans, just like
\mathbfupdoes? I know aboutunicode-math’s command\setmathfontface⟨command⟩{⟨font name⟩}[⟨font features⟩], but that doesn’t let me specify a range likerange=up/{greek,Greek,latin,Latin,num}, as far as I can tell. And shouldn’tunicode-math’s own commands like\mathupwork correctly “out of the box”, anyway?
Version info: TeX Live 2017, LuaTeX v1.0.4, unicode-math 2017/01/27 v0.8d.


unicode-matha font which is not a unicode maths font. It just isn't designed for that. – cfr Jun 16 '17 at 03:07rangeoption was to allow using non-math fonts? E.g. section 4.1.1 in the documentation. – Socob Jun 17 '17 at 17:00bfup/{latin}. Why would that not work/what would be the purpose of being able to specifylatinif it didn’t work this way? What’s more, it does work (as you can see in my example, Latin letters and numbers are in FreeSans in math mode, the first row in the table; what’s more, the text in\mathbfupis in FreeSans Bold as well). It’s just that some of the\math…commands don’t do what I’d expect. – Socob Jun 18 '17 at 01:22latin. It is because it falls through to ASCII. That's what the documentation says it does. But that won't work for anything outside those parts of the font.ituses a different part of a maths font. But the Oblique doesn't have anything there. You want it to use the equivalent of upright for italic, but to take it from the Oblique font. But that isn't going to work. – cfr Jun 18 '17 at 02:02\setmathfont{FreeSans Oblique}[range=it/{latin}->up], but that doesn’t change anything, and the documentation says that this fallback to ASCII happens automatically anyway if the glyphs are missing in the math plane. – Socob Jun 18 '17 at 13:14\setmathfont{FreeSans}[range=up/{latin}]should work, but\setmathfont{FreeSans Oblique}[range=it/{latin}]shouldn’t? Then the question remains, why does\mathupproduce Latin Modern Math and not FreeSans? (Again, it worked for\mathbfup). And again, “pure” math mode (without any\math...command) clearly shows FreeSans Oblique for letters, so\setmathfont{FreeSans Oblique}[range=it/{latin}]does seem to have worked in that case. – Socob Jun 19 '17 at 14:10bfalone, I guess, so ... I'm not really sure. I wouldn't expect it to work, but I wouldn't expect it to fail in quite the way it fails, either. :( – cfr Jun 19 '17 at 22:50unicode-mathversion 0.8j, released 2018-01-07. – egreg Jan 10 '18 at 12:04