# [XeTeX] unicode-math package and \UnicodeMathSymbol command

Ross Moore ross at ics.mq.edu.au
Mon Jun 22 07:50:07 CEST 2009

Hi Ed,

On 22/06/2009, at 2:43 PM, Ed Morehouse wrote:

> my original question is just whether someone knows of a way to (re)
> declare
> unicode math symbols in the context of the unicode-math package
> without editing
> the unicode-math package itself.
>
> ross, i don't understand what you mean by:
>
>
>> No. This cannot work.
>> To declare any new symbols you have to bind \UnicodeMathSymbol first,
>> as follows:
>>
>> \makeatletter
>>    \let\UnicodeMathSymbol\um <at> mathsymbol <at> noparse
>>    \UnicodeMathSymbol{"0003A}{\colon}{\mathrel}{colon}% default:
>> \mathpunct
>>    \UnicodeMathSymbol{"0007C}{\vert}{\mathrel}{vertical bar}%
>> default: \mathord
>> \makeatother
>
> isn't \UnicodeMathSymbol already bound (bound = defined ?) in
> unicode-math.sty?

No it isn't, except to gobble its arguments
--- at least that what it does *after*  unicode-math.sty has loaded.

Within the processing of  unicode-math.sty  it can be used in either
of 2 different ways, according to whether it has been called for
a single code-point, or whether for a range of successive code-points.

In each case, it has a different binding.
That's why to do what you want, it needs to be bound to the
appropriate protected macro first.
To effect this binding, you need the usual LaTeX
\makeatletter ... \makeatother  unlocking mechanism.

>  i'm just trying to use the command defined there, not define it
> myself.  once i
> \usepackage{unicode-math}, \UnicodeMathSymbol seems to be in scope
> since i am
> able to call it without error, but also without the desired effect.
>   am i missing something here?

That is because you are not supposed to mess with it, unless you
know what you are doing.  :-)
Will defines it to do nothing, because you may be tempted to play.
He wants to make that kind of playing around totally ineffective,
and he seems to have achieved this aim admirably.

>  when i try as you suggest, xetex complains about
> missing \begin{document} and several undefined control sequences.

That'll happen when you forget the  \makeatletter   stuff.

>
>> However, this doesn't work with symbols that have already been
>> declared.
>
> this is something i would like to understand.  why is it that when
> i \input a
> file containing redeclarations into unicode-math.sty (immediately
> after where
> unicode-math-add.tex is \input), it works as i would like, but when
> i try to
> make the redeclarations in the preamble of a document it has no
> effect?

I'm not sure, but I think it is that you cannot change the \mathcode
(rather, the \XeTeXmathcode ) once it has been set.
Thus you have to find the first place where it is done, and change
it there.

This means that if it has been frozen into the format, then you
cannot change it at all!
Ultimately this is how it should be --- but only when everyone
concerned has decided that we finally have it correct and immutable.
I'd say that we are a couple of years away from being there;
perhaps even longer.
This is something to discuss at MKM 2009, and/or TUG 2009.
(Use Google to find these meetings, if you are truly interested.)

>
> ...
>
> i understand that there are unicode and tex standards regarding the
> usage of
> certain symbols, but that's not what i'm asking about.  if one
> accepts the
> premises that not all math symbols have ordinary, operator,
> relation, etc.
> variants, and that someone might want to use a math symbol in a
> role other than
> the one specified by a standard, then my original question is still
> meaningful.

You *can* do this.
Just wrap it in  \mathrel , \mathbin, \mathpunct, \mathord  etc.

e.g.  \mathrel{:}  should give the "ratio" spacing;
\mathpunct{:}  should give the punctuation spacing.

This works for any argument, not just single characters.
In the case of single characters it overrides how they have been
declared.

Given that this possibility is available, no one is throwing knives
at Will to fix things that may not be correct currently.
(It would be counter-productive to put such pressure on anyone,
when it really is a complex problem.)

>
> -ed morehouse

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