2

I'm trying to use unicode-math's \mathsfit to set sans-serif italicised numerals in math mode. I don't want sans-serif math in general; only numerals and latin/Latin (but that works already). I use xelatex.

My MWE so far is:

\documentclass{standalone}
\usepackage{fontspec}
\usepackage{unicode-math}

\setsansfont{Arial}
\setmathfont[range=\mathsfup/{num,latin,Latin}]{Arial}
\setmathfont[range=\mathsfit/{num,latin,Latin}]{Arial Italic}
\begin{document}
$\mathsf{3} \mathsfit{3} \mathsfup{3} 3$


$\mathsf{a} \mathsfit{a} \mathsfup{a} a$
\end{document}

I know Arial is not a math font and does not have all the fancy math glyphs. I neither want nor need them. I would like to set latin characters (upper and lower case) and numerals in math mode in sans-serif using \mathsf, \mathfsup, and \mathsfit. With the MWE posted above this works for \mathsf and \mathfsup as well as with \mathfsit for latin characters:

enter image description here

unicode-math prints the following error message:

*************************************************
* unicode-math warning: "no-alphabet"
*
* I am trying to set up alphabet "sfit/num" but there are no configuration
* settings for it. (See source file "unicode-math-alphabets.dtx" to debug.)
*************************************************

I've tried to apply some pattern matching and added the following lines to unicode-math.sty, to provide the alphabet sfit/num:

\__um_new_alphabet_config:nnn {sfit} {num}
 {
  \__um_set_mathalphabet_numbers:nnn {sf}   {it}{#1}
  \__um_set_mathalphabet_numbers:nnn {sfit} {it}{#1}
 }

but then I get the error:

! Missing number, treated as zero.
<to be read again>
                   \g__um_it_num_usv
l.7 ...=\mathsfit/{num,latin,Latin}]{Arial Italic}

Can any help me adding that alphabet? Why is it missing in the first place? Is it (generally) not needed or is it impossible?

Thank you for your answers and comments.

  • 3
    the absence of italic numerals in unicode (and hence their omission from unicode-math) is the result of their omission from the list of requested symbols compiled by the stix group. in traditional math and technical publishing, numerals are rendered upright in math contexts; none of the participating organizations recognized any explicit "math meaning" to italic vs. upright, hence italic numerals were considered a "font and markup" situation, which is not addressed by unicode. if you can provide published documentation of a use with explicit math meaning, this can be revisited. – barbara beeton Sep 24 '15 at 13:21
  • Thank you for the background information. So I'll define a new font face with \setmathfontface and use that instead of \mathsfit. – bev Sep 24 '15 at 14:04
3

The comment from barbara beeton makes it clear, that there are no sans-serif italic numerals, but this is 'considered a "font and markup" situation'. So, I use font and markup to work around the problem to get the desired result:

\documentclass{standalone}
\usepackage{fontspec}
\usepackage{unicode-math}

\setsansfont{Arial}
\setmathfont[range=\mathsfup/{num,latin,Latin}]{Arial}
\setmathfont[range=\mathsfit/{num,latin,Latin}]{Arial Italic}
\setmathfontface\mathsfitnum{Arial Italic}
\begin{document}
$\mathsf{3} \mathsfit{3} \mathsfup{3} \mathsfitnum{3} 3$


$\mathsf{a} \mathsfit{a} \mathsfup{a} \mathsfitnum{a} a$
\end{document}

With the new \mathsfitnum-macro, both the numeral and the latin letter are in Arial Italic:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.