[XeTeX] incompatibility with amsmath

David M. Jones dmj at ams.org
Sun Aug 3 16:03:21 CEST 2008


> From: Will Robertson <wspr81 at gmail.com>
> Date: Sun, 3 Aug 2008 11:07:31 +0930
> Reply-To: Unicode-based TeX for Mac OS X and other platforms <xetex at tug.org>
> 
> On 03/08/2008, at 10:26 AM, Andrew Moschou wrote:
> 
> > Thanks for the information!
> 
> In terms of how to fix this problem, the easiest is simply to ensure  
> that amsmath is loaded first and your definition is \AtBeginDocument:
> 
> \@ifpackageloaded{amsmath}{%
>    \AtBeginDocument{\XeTeXmathcode`\-="2 \symMRM "2212}%
> }{%
>    \AtBeginDocument{%
>      \@ifpackageloaded{amsmath}{%
>        \PackageError{fontspec}{%
>          Please load amsmath before fontspec%
>        }{Bad things happen when amsmath changes things behind my back.}%

Although I'm sure that would be true, it's not really a propos in this
case: amsmath isn't attempting to change anything except its own
internal definitions of \std at minus and \std at equal.

By the way, as I should have mentioned in my previous message, I don't
know precisely what problem amsmath is trying to solve with \std at minus
and \std at equal and I haven't tested to see what effect setting
\XeTeXmathcode`\- will have on \relbar, \Relbar and all of the arrows
that use them.  I'll try to investigate next week when I'm on the
AMS's time instead of my own.

> However, if you're willing to break out memoir's "\AtEndPackage" code  
> (which IMO should have it's own package), you could write instead  
> (untested)
> 
> \def\define at mathminus{%
>    \AtBeginDocument{\XeTeXmathcode`\-="2 \symMRM "2212}}
> 
> \@ifpackageloaded{amsmath}{\define at mathminus}{%
>    \AtEndPackage{amsmath}{\define at mathminus}}
> 
> This would be a little bit more friendly :)

Presumably you want the redefinition of - whether or not amsmath is
loaded.  If there's other code in the preamble that depends on having
the redefinition of - be in effect during the preamble, you might have
to repeat the definition:

    \def\define at mathminus{\XeTeXmathcode`\-="2 \symMRM "2212}

    \define at mathminus

    \AtBeginDocument{\define at mathminus}

This should be safe whether or not amsmath is loaded (modulo the
earlier caveats about \relbar and \Relbar).

David.


More information about the XeTeX mailing list