LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Will Robertson <[log in to unmask]>
Tue, 20 May 2014 11:39:35 +0930
text/plain (4 kB) , text/html (6 kB)
Dear all,

I'm writing to continue some recent discussions in other forums on unicode
math and how:
* unicode-math.sty current (incorrectly) deals with it, and
* how we envisage official support for unicode math in LaTeX into the

* * *

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 multi-letter 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 single-letter identifiers and not to be used for strings of
characters such as "Re" in italic or "Set" in bold.

So originally unicode-math 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 unicode-math 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
unicode-math 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

0. Colours are used to ensure what you're seeing is correct and not a
side-effect 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

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 unicode-math 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 cross-platform enough that
will work instead.

5. I'm largely happy to make a breaking change to unicode-math.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 single-letter symbols -- in
such cases it would surely be sensible to use (perhaps a variation on)

Best regards,


\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 = "[latinmodern-math.otf]:color=FF0000" at 10pt\relax



 \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
 \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
 \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}}



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}