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
\mathit
and\mathup
different from\mathbfup
?\mathbfup
works 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
\mathbfup
does? 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\mathup
work correctly “out of the box”, anyway?
Version info: TeX Live 2017, LuaTeX v1.0.4, unicode-math 2017/01/27 v0.8d.
unicode-math
a font which is not a unicode maths font. It just isn't designed for that.range
option was to allow using non-math fonts? E.g. section 4.1.1 in the documentation.bfup/{latin}
. Why would that not work/what would be the purpose of being able to specifylatin
if 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\mathbfup
is in FreeSans Bold as well). It’s just that some of the\math…
commands don’t do what I’d expect.