[XeTeX] Fontspec 1.8 problem?

Will Robertson will at guerilla.net.au
Mon Jul 18 13:29:56 CEST 2005


Ross Moore wrote:
> Will Robertson wrote:
>> Ross Moore wrote:

[rearranged for a more logical reply]

>> Am I barking up the wrong tree?
>
> Won't the AMS definition still work fine, unchanged ?
> Surely the ':' will come from the correct font in XeTeX ,
> or am I misunderstanding what you are doing with  fontspec ?

Sorry, I should have explained this long ago.
Actually, maybe _I_ don't know what I'm doing with fontspec here.
Let's see...

When CM maths is used, it grabs a multitude of symbols from the  
\mathrm font, which is fine by default. However, if someone wants to  
use, say, Lucida maths with Hoefler Text -- including Hoefler Text as  
the \mathrm font because otherwise it'd look much too spindly when  
writing \sin, \cos -- it is (IMO) inappropriate to also take the  
brackets and various symbols from Hoefler Text because, well, I doubt  
it was designed with that in mind (and the same argument for maths  
accents, only more so -- especially when XeTeX started crashing on us  
for some reason).

So, for the first shot at implementing something, I just redirected  
*all* references to the "operators" maths font to a "legacymaths"  
font which is defined in fontspec as the old cmr font in OT1  
encoding. This was certainly necessary for maths accents, but I'm  
less sure about brackets and some of the symbols. And this is where  
\colon comes in.

>> Since the point of overwriting [\colon] in fontspec is  
>> \AtBeginDocument, I didn't really want to override the effort that  
>> went into this macro [in amsmath]...
>
> Yes, I would normally agree.
> But \colon is predefined with  \mathchardef\colon="603A .

Oh, whoops! Forgot to check the LaTeX sources properly. Thanks for  
pointing that out.

> which is the kind of thing that  fontspec  wants to replace, yes ?
>
> Perhaps a good way to handle this is by first testing what \colon
> currently represents:
>
> \mathchardef\testcolon="603A
> \ifx\colon \testcolon
>   \DeclareMathSymbol{:}{\mathpunct}{legacymaths}{"3A}
> \fi

This is a good way to proceed, and more robust than just checking to  
see if amsmath has been loaded or not.

As a side note, there's some confusion here, which I only realised  
when trying to reply to your email -- : is \mathpunct and \colon is  
\mathrel. So I compiled a summary of every relevant definition of ":"  
and \colon:

% fontmath.ltx:
\DeclareMathSymbol{\colon}{\mathpunct}{operators}{"3A}
\DeclareMathSymbol{:}{\mathrel}{operators}{"3A}

% amsmath.sty:
\renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
   \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}

% euler.sty:
\DeclareMathSymbol{:}\mathrel  {EulerFraktur}{"3A}

% lucbmath.sty:
\DeclareMathSymbol{\@tempb}{\mathpunct}{operators}{58}
\ifx\colon\@tempb
   \DeclareMathSymbol{\colon}{\mathpunct}{operators}{58}
\fi
\DeclareMathSymbol{:}{\mathrel}{operators}{58}

(That lucbmath snippet doesn't make sense to me at all; if \colon =  
\colon, then define \colon to be \colon?!?)

I would hope that every maths setup would provide its own brackets  
and symbols, but failing this at least the CM symbols were actually  
designed for maths.


> In this case, you only want to change the expansion of \colon
> when it has its default established using  \mathchardef .
>
> Maybe this is true for other symbols too, so my testing code
> above could have greater applicability ?

Certainly would!
But I haven't checked how many maths symbols are over-written by  
custom macros...I would assume relatively few.

Thanks for your help with all of this.

Will



More information about the XeTeX mailing list