[XeTeX] unicode-math package and \UnicodeMathSymbol command

Ross Moore ross at ics.mq.edu.au
Mon Jun 22 02:40:16 CEST 2009


On 22/06/2009, at 8:43 AM, Ed Morehouse wrote:

> Nicolas Vaughan <nivaca at ...> writes:
>
>>
>>
>> Can you send a minimal example/Nicolas
>
> here you go:
>
> \documentclass{article}
>
> \usepackage{xltxtra}
> \defaultfontfeatures{Mapping=tex-text, Scale=MatchLowercase}
> \setromanfont{Latin Modern Roman}
>
> \usepackage[math-style=TeX]{unicode-math}
> \setmathfont{Cambria Math}
>
> \UnicodeMathSymbol{"0003A}{\colon}{\mathrel}{colon}% default: 
> \mathpunct
> \UnicodeMathSymbol{"0007C}{\vert}{\mathrel}{vertical bar}% default:  
> \mathord

No. This cannot work.
To declare any new symbols you have to bind \UnicodeMathSymbol first,
as follows:

\makeatletter
   \let\UnicodeMathSymbol\um at mathsymbol@noparse
   \UnicodeMathSymbol{"0003A}{\colon}{\mathrel}{colon}% default: 
\mathpunct
   \UnicodeMathSymbol{"0007C}{\vert}{\mathrel}{vertical bar}%  
default: \mathord
\makeatother

However, this doesn't work with symbols that have already been declared.
Instead, if you want what your example seems to indicate (but see below)
then you would need to do something like:

   \def\colon{\mathrel{\char"003A}}
   \def\vert{\mathrel{\char"007C}}

and adjust your coding to use these macros:

>
> \begin{document}


$$
f \colon X → Y \quad ⟹ \quad f ^{-1} : 2^Y → 2^X = B ⟼ \{x ∈  
X \vert f(x) ∈ B\}
$$

This gives the result that I think you are after, but ...


  ... in doing this, you are going *against* standard (and TeX) usage.
In the TeXBook (p.134) it is clear that  \colon  is meant to be
punctuation, and  :  is meant to have relation spacing in math.


That this doesn't work properly yet is not entirely surprising.

Notice the the website for Unicode-math says:

>>> IT IS NOT YET READY FOR DISTRIBUTION :)
>>> ___________________



That means that some things need not be as convenient as
you would like them to be, nor even strictly correct.

Besides, a single character cannot be declared to have 2 different
math-types, so you should expect to have to use macros sometimes,
even when you think there is a single character that might do the job.


Indeed I think that it is wrong to have this
in  unicode-math-add.tex :

    \UnicodeMathSymbol{"0003A}{\colon}{\mathpunct}{}%

especially so since  unicode-math.tex  already has this:

    \UnicodeMathSymbol{"02236}{\colon}{\mathrel}{ratio}

which follows AMS usage, but which differs from the original \TeX .

It is most unfortunate that, over the years, there has been
a lot of confusion about the use of  \colon  and  : .
It's not at all clear how this should be sorted out now.
Probably it depends upon what font designers have chosen to do.


Similarly, using \vert as above is actually the wrong markup also.
You should be using  \mid  for the purpose of this kind of
qualifier relation; i.e., the separator between the element set
specifier, and the conditions which need to be satisfied.
(see the TeXBook, p.174)

  \mid  correctly gives the Unicode character  U+02223  not the
vertical bar.  (This is also used as the "divides" symbol,
which is clearly another use of the character as a relation.)



Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the XeTeX mailing list