# [NTG-context] LuaTeX and Unicode Math

Wed Oct 3 02:26:33 CEST 2007

Hi,

> While trying to convert some stuff from HTML to PDF (using LuaTeX) I
> have noticed some minor problems: unicode math characters work OK in
> text mode (under assumption that the font has them), but not in math
> mode. In pdfTeX they work OK in both cases. (That behaviour is
> expected, but not necessary desired.)

using pdftex for day to day work.  I have become used to typing most
of my math in unicode, and now none of it works (with luatex). But I
have been too busy to actually try to understand what is happening
behind the scences.

> Is there any cure to it?

AFAIK, luatex has not toched on the math handling of tex yet. There
are some old ideas on how TeX's math support can be improved, and with
luatex that is a real possibility. I am sure that at some stage, once
some aspects of the lua functionality are more stable, this will be
looked into. It makes sense to finalize mkiv support only after that.

> I could/should solve the problem with better handling of xml entities
> or with fallbacks (if φ is not present in font, use \phi etc.), but I
> don't know how to do either of them.
>
> I would normally say something like
>   \chardefφ=\active
>   \defφ{\phi}
> to solve the problem, but that doesn't work when doing XML conversion.

Actually, for a unicode aware engine it should be the other way around

\def\phi{φ}

That is, all definemathcommand be changed to something like

\definemathcharacter[φ][<font:location>]

and so on. But my guess is that this will need a overhaul of the math
character encoding. Again, that is something which I do not understand
at the moment.

`