2

The following MWE has started failing for me after TL 2017 update today:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Pagella Math}
\setmathfont[range={`A-`Z,`a-`z,`0-`9}]{Charis SIL}
\begin{document}
Test.
\end{document}

The error is

! Missing number, treated as zero.
<to be read again> 
\__bool_A_0: 
l.4 ...thfont[range={`A-`Z,`a-`z,`0-`9}]{Charis SIL}
1

1 Answer 1

2

The issue is due to \bool_if:NTF having become “greedy”, so it always evaluate all parts. Here's a fix proposed by Joseph Wright, see https://github.com/wspr/unicode-math/pull/393

\documentclass{article}
\usepackage{unicode-math}

\ExplSyntaxOn
\keys_define:nn {unicode-math}
 {
  range .code:n =
   {
    \bool_set_false:N \l__um_init_bool
    \int_incr:N \g__um_fam_int
    \tl_set:Nx \__um_symfont_tl {__um_fam\int_use:N\g__um_fam_int}
    \cs_set_eq:NN \__um_sym:nnn \__um_process_symbol_parse:nnn
    \cs_set_eq:NN \__um_set_mathalphabet_char:Nnn \__um_mathmap_parse:Nnn
    \cs_set_eq:NN \__um_remap_symbol:nnn \__um_remap_symbol_parse:nnn
    \cs_set_eq:NN \__um_maybe_init_alphabet:n \use_none:n
    \cs_set_eq:NN \__um_map_char_single:nn \__um_map_char_parse:nn
    \cs_set_eq:NN \__um_assign_delcode:nn \__um_assign_delcode_parse:nn
    \cs_set_eq:NN \__um_make_mathactive:nNN \__um_make_mathactive_parse:nNN
    \seq_clear:N \l__um_char_range_seq
    \seq_clear:N \l__um_mclass_range_seq
    \seq_clear:N \l__um_cmd_range_seq
    \seq_clear:N \l__um_mathalph_seq

    \clist_map_inline:nn {#1}
     {
      \__um_if_mathalph_decl:nTF {##1}
       {
        \seq_put_right:Nx \l__um_mathalph_seq
         {
          { \exp_not:V \l__um_tmpa_tl }
          { \exp_not:V \l__um_tmpb_tl }
          { \exp_not:V \l__um_tmpc_tl }
         }
       }
       {
        \seq_if_in:NnTF \g__um_mathclasses_seq {##1}
          { \seq_put_right:Nn \l__um_mclass_range_seq {##1} }
          {
            \bool_lazy_and:nnTF { \tl_if_single_p:n {##1} } { \token_if_cs_p:N ##1 } % <---- this one is the only changed line
              { \seq_put_right:Nn \l__um_cmd_range_seq {##1} }
              { \seq_put_right:Nn \l__um_char_range_seq {##1} }
          }
       }
     }
   }
 }
\ExplSyntaxOff

\setmathfont{TeX Gyre Pagella Math}
\setmathfont[range={`A-`Z,`a-`z,`0-`9}]{Charis SIL}

\begin{document}

Test.

\end{document}
3
  • Where would I place that code in unicode-math.sty to create a temporary fix until it gets updated? Commented Jul 23, 2017 at 20:56
  • @HerbSchulz It's in unicode-math-xetex.sty and unicode-math-luatex.sty; there's just one line to be changed, I'll mark it in the code above.
    – egreg
    Commented Jul 23, 2017 at 21:25
  • Thanks, works like a charm. I can imagine the patch is already making its way through CTAN. Commented Jul 23, 2017 at 23:01

You must log in to answer this question.

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