[XeTeX] incompatibility with amsmath

David M. Jones dmj at ams.org
Sat Aug 2 20:53:03 CEST 2008

> From: Stephen Moye <stephenmoye at mac.com>
> Date: Sat, 02 Aug 2008 10:04:33 -0400

> Using Will's code with amsmath:
> %---%
> \documentclass[12pt]{article}
> \usepackage{amsmath}
> \usepackage[no-math]{fontspec}
> \setmainfont{Times New Roman}
> \makeatletter
> \DeclareSymbolFont{MRM}{EU1}{\zf at family}{m}{n}
> \makeatother
> \begin{document}
> \XeTeXmathcode`\-="2 \symMRM "2212 % minus sign
> $A-\sqrt{BgT}$
> \end{document}
> %---%
> Notice that "\XeTeXmathcode`\-="2 \symMRM "2212" comes *after*  
> \begin{document}; if it comes *before*, then you get the error. With  
> Times New Roman, you also get a box instead of a minus sign. With  
> Charis SIL and Garamond Premier Pro, you get a minus sign.
> I'm a little curious about the difference between putting the  
> \XeTeXmathcode`\-="2 \symMRM "2212" statement before as opposed to  
> after \begin{document}

Here's the relevant excerpt from amsmath.dtx:

    % \section{Extensible arrows}
    %    The minus sign used in constructing these arrow fills is smashed so
    %    that superscripts above the arrows won't be too high. This
    %    primarily affects the \cn{xleftarrow} and \cn{xrightarrow} arrows.
    %    \begin{macrocode}
    \mathchardef\std at minus\mathcode`\-\relax
    \mathchardef\std at equal\mathcode`\=\relax
    %    \end{macrocode}
    %    In case some alternative math fonts are loaded later:
    %    \begin{macrocode}
      \mathchardef\std at minus\mathcode`\-\relax
      \mathchardef\std at equal\mathcode`\=\relax
    %    \end{macrocode}
    %    \begin{macrocode}
    \def\relbar{\mathrel{\mathpalette\mathsm at sh\std at minus}}

So, amsmath is trying to read the \mathcode of `\- in the
begin-document hook, but after

    \XeTeXmathcode`\-="2 \symMRM "2212"

it finds a 23-bit (?) extended mathchar instead of a 15-bit mathcar,
which causes XeTeX to issue the

    Extended mathchar used as mathchar (71311890).

error.  At some point, amsmath will need to be carefully reviewed for
these sorts of incompatibilities (he says, in his most non-committal
passive voice).

David M. Jones
Publications Technical Specialist
American Mathematical Society

More information about the XeTeX mailing list