TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a strange problem in LuaLaTeX with both babel, option frenchb, and unicode-math. My TeX Distribution is TeX Live 2013 (installed with MacTeX on a OS X.8.5 system). If I run the following program:

    \setmathfont{XITS Math} % or any other math font

I obtain this error message:

! Extended mathchar used as mathchar (6300214).
<to be read again> 
l.244   \initiate@active@char{:}
? h
A mathchar number must be between 0 and "8000.
I changed this one to zero.

However, it works flawlessly either if I use XeLaTeX, or if I don't use the \setmathfont command, or if I load babel option frenchb before unicode-math:

    \setmathfont{XITS Math} % or any other math font

Any idea of what is going wrong?

share|improve this question
It compiles with XeLaTeX, but not with LuaLaTeX – egreg Feb 2 '14 at 22:07
Indeed, as I noticed… But why this difference? I don't understand. – Franck Pastor Feb 2 '14 at 22:16
up vote 10 down vote accepted

Load babel before unicode-math:


\setmathfont{XITS Math}


a: ba : b



enter image description here

The difference lies in the fact that XeLaTeX and LuaLaTeX use different methods for typesetting the colon French style, that is with equal spaces on either side.

If you add \the\catcode`: after \begin{document}, you'll get 13 if compiling with LuaLaTeX, but 12 if compiling with XeLaTeX. With the latter engine the shorthand features of babel aren't needed, while they are with LuaLaTeX.

So the only solution is to always load babel before unicode-math, so the activation of the shorthand characters can be acknowledged by unicode-math.

More precisely, LuaLaTeX uses an active colon, just like the traditional way. In XeLaTeX, the colon, semicolon, question mark and exclamation mark are placed in special \XeTeXcharclass arrays and rules when passing from a character in class 0 (all normal characters) or 255 (the space, although this would require many explanations) and these special classes are established. For instance, when a normal character is followed by a character in the class named \FB@punctthick (the colon), the code

\ifhmode\penalty 10000 \space\fi

is executed, while after a space the code inserted is

\ifhmode\unskip\penalty 10000 \space\fi

So, a possible space preceding the colon is removed (users can type a space before the colon), a penalty inhibiting a line break is inserted and a normal interword space is added.

share|improve this answer
You're right but I had already noticed that (see the last part of my question). I wanted to understand why it doesn't work if I load frenchb after unicode-math. Thanks to Herbert I see that it is (once again) a problem with the characters activated by frenchb. But how comes it works with XeLaTeX then?? – Franck Pastor Feb 2 '14 at 22:14
@fpast Yes, I didn't notice the last part. Now you know the reason for the difference. – egreg Feb 2 '14 at 22:33
Great, now I understand after your answer's editing. :-) – Franck Pastor Feb 2 '14 at 22:33
Would using polyglossia instead of babel help? – Martin Schröder Feb 3 '14 at 8:51
@MartinSchröder Polyglossia doesn't work with LuaLaTeX – egreg Feb 3 '14 at 8:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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