Dear all,
I'm writing to continue some recent discussions in other forums on unicode
math and how:
* unicodemath.sty current (incorrectly) deals with it, and
* how we envisage official support for unicode math in LaTeX into the
future.
* * *
In short, here's the issue as I see it.
LaTeX has a default maths font plus families such as \mathrm, \mathit, and
\mathbf to choose new alphabets. These maths fonts are expressly and
strictly only allowed to be text fonts, contrary to their name. This allows
people to write things like \mathit{Re} for Reynolds number and
\mathbf{Set} in category theory (thanks David C for the example).
The \mathbf command in particular has been abused in physics to denote
vectors and matrices, such as \mathbf{B} for magnetic field. I suspect the
situation is similar for sans math, with tensors using sans on occasion but
no doubt in other contexts used for multiletter identifiers. (Examples
more than welcome; in fact, requested.)
In contrast, Unicode math defines a number of alphabets in a single Unicode
font, including mathematical italic and bold mathematical italic and many
more variations. In OpenType maths fonts to date, these symbols are all
designed as singleletter identifiers and not to be used for strings of
characters such as "Re" in italic or "Set" in bold.
So originally unicodemath simply mapped the unicode alphabets onto the
LaTeX commands (with nice options and so on for choosing your style of bold
and ensuring greek "just works"), and while all the style options and
normalisation were nice and work (IMO) well, the choice of overwriting
\mathbf and so on has led to obvious problems.
* * *
I'd first like to apologise for the inconvenience that unicodemath has
caused up until this point  I do hope to "fix" it soon, whatever "fix"
means now. The rest of this email is largely a summary of approach taken by
unicodemath and how it can be fixed, expressed in plain (Unicode)TeX (see
attached and run it through XeTeX; you'll need Linux Libertine installed
but feel free to replace it with any font with both roman and greek text
glyphs).
0. Colours are used to ensure what you're seeing is correct and not a
sideeffect of the underlying Plain math machinery.
1. \mathbf and friends go back to simply selecting a text font. Note that
they still need to remap \mathcode{}s in this case because normal unicode
math glyphs exist all the way up in Plane 1 where text fonts daren't to
tread.
2. Greek input into \mathbf and friends does "work"  if what you were
after were Greek letters from a text font.
3. To get proper bold symbols, including Greek, we'll need a whole new set
of commands. These will need sensible names of some sort. Below I've chosen
\symbf, etc., which doesn't look too bad to me.
4. If how I've implemented unicodemath looks wrong to you, I'd appreciate
suggestions :) Switching \mathcode{}s like this isn't super fun but
* doesn't seem too slow, and
* I'm not aware of anything else flexible and crossplatform enough that
will work instead.
5. I'm largely happy to make a breaking change to unicodemath.sty itself,
but comments on whether an "overwrite" mode which functions as the package
currently does would be sensible as a long term thing would be appreciated.
IMO, it doesn't make much sense to have a separate text font that is only
used for bold math identifiers that aren't real singleletter symbols  in
such cases it would surely be sensible to use (perhaps a variation on)
\textbf.
Best regards,
Will
\newfam\bfmathfam
\newfam\itmathfam
\font\rm = "Linux Libertine O:color=000000" at 10pt\relax
\font\bf = "Linux Libertine O Bold:color=0000FF" at 10pt\relax
\font\it = "Linux Libertine O Italic:color=00AA00" at 10pt\relax
\font\mm = "[latinmodernmath.otf]:color=FF0000" at 10pt\relax
\textfont\bfmathfam\bf
\textfont\itmathfam\it
\textfont1\mm
\def\alpha{α}
\def\beta{β}
\def\gamma{γ}
\def\codemathhigh{%
\Umathcode`\a = 7 1 "1D44E\relax
\Umathcode`\b = 7 1 "1D44F\relax
\Umathcode`\c = 7 1 "1D450\relax
\Umathcode"03B1 = 7 1 "1D6FC\relax
\Umathcode"03B2 = 7 1 "1D6FD\relax
\Umathcode"03B3 = 7 1 "1D6FE\relax
}
\def\codemathlow{%
\Umathcode`\a = 7 1 `\a\relax
\Umathcode`\b = 7 1 `\b\relax
\Umathcode`\c = 7 1 `\c\relax
\Umathcode"03B1 = 7 1 "03B1\relax
\Umathcode"03B2 = 7 1 "03B2\relax
\Umathcode"03B3 = 7 1 "03B3\relax
}
\def\codemathsymbf{%
\Umathcode`\a = 7 1 "1D41A\relax
\Umathcode`\b = 7 1 "1D41B\relax
\Umathcode`\c = 7 1 "1D41C\relax
\Umathcode"03B1 = 7 1 "1D6C2\relax
\Umathcode"03B2 = 7 1 "1D6C3\relax
\Umathcode"03B3 = 7 1 "1D6C4\relax
}
\def\mathit#1{{\codemathlow\fam\itmathfam #1}}
\def\mathbf#1{{\codemathlow\fam\bfmathfam #1}}
\def\symbf#1{{\codemathsymbf #1}}
\parindent=0pt\relax
\hsize=6cm\relax
\hrule
\bigskip
\rm
\codemathhigh
Regular symbols:
$$
a + b + c \quad \alpha + \beta + \gamma
$$
Bold and italic math families:
$$
\mathit{abc\alpha\beta\gamma} \quad \mathbf{abc\alpha\beta\gamma}
$$
Bold math symbols:
$$
a+b+c \quad \symbf{a+b+c}
$$
$$
\alpha + \beta + \gamma \quad \symbf{\alpha + \beta + \gamma}
$$
\bye
