[XeTeX] incompatibility with amsmath
Morten Høgholm
morten.hoegholm at gmail.com
Mon Aug 4 16:21:31 CEST 2008
On Sun, 03 Aug 2008 16:03:21 +0200, David M. Jones wrote:
Hi all,
Just to chip in as one who has had a real problem with these two commands
in different circumstances.
> 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.
For flexisym, I had to intervene with these commands in two places:
1) Remove them from the \AtBeginDocument hook
2) \DeclareMathOperator also relies on mathcode of - being less than
32768.
Below is what I wrote in the flexisym documentation and how it is dealt
with there. Don't know if it is of any help but I'd prefer if we could
come up with one proper solution we can all use. If the easiest is to
change amsmath, then that's what we'll do (right, David?).
% Before declaring any math characters active, we have to take care of
% a small problem with \pkg{amsmath} v2.x, if it is loaded before
% \pkg{flexisym}. \cs{std at minus} and \cs{std at equal} are defined as
% \begin{verbatim}
% \mathchardef\std at minus\mathcode`\-\relax
% \mathchardef\std at equal\mathcode`\=\relax
% \end{verbatim}
% in \fn{amsmath.sty} and again \cs{AtBeginDocument}. The
% latter is because
% \begin{quote}
% In case some alternative math fonts are loaded
% later. [\fn{amsmath.dtx}]
% \end{quote}
% The problem arises because \pkg{flexisym} sets the mathcode of all
% symbols to $32768$ which is illegal for a \cs{mathchardef}.
%
% We have to remove the assignments from the \cs{AtBeginDocument} hook
% as they will cause an error there.
% \begin{macrocode}
\@ifpackageloaded{amsmath}{%
\begingroup
% \end{macrocode}
% Split the contents of \cs{@begindocumenthook} by reading what we
% search for as a delimited argument and ensure these two assignments
% do not take place. It is questionable if anything reasonable can be
% done to them. In the case of a package such as \pkg{mathpazo} which
defines
% \begin{verbatim}
%\DeclareMathSymbol{=}{\mathrel}{upright}{"3D}
% \end{verbatim}
% the \cs{Relbar} will look wrong if we don't use the correct
% symbol. The way to solve this is define additional \fn{.sym} files
% which contain the definition of \cs{relbar} and \cs{Relbar}
% needed. We need those additional files anyway for things like
% \cs{joinord}.
% \begin{macrocode}
\long\def\next#1\mathchardef\std at minus\mathcode`\-\relax
\mathchardef\std at equal\mathcode`\=\relax#2\flexi at stop{%
\toks@{#1#2}%
\xdef\@begindocumenthook{\the\toks@}%
}%
\expandafter\next\@begindocumenthook\flexi at stop
\endgroup
}{}
% \end{macrocode}
%
% There is problem when using \cs{DeclareMathOperator} as the
% operators defined call a command \cs{newmcodes@} which relies on the
% mathcode of \texttt{-} being less than 32768. We delay the
% definition \cs{AtBeginDocument} in case \pkg{amssymb} hasn't been
% loaded yet.
% \begin{macrocode}
\AtBeginDocument{%
\def\newmcodes@{%
\mathcode `\'39\mathcode `\*42\mathcode `\."613A
\ifnum\mathcode`\-=45
\else
% \end{macrocode}
% The extra check. Don't do anything if \texttt{-} is math active.
% \begin{macrocode}
\ifnum\mathcode`\-=32768
\else
\mathchardef \std at minus \mathcode `\-\relax
\fi
\fi
\mathcode `\-45 \mathcode `\/47\mathcode `\:"603A\relax
}%
}
% \end{macrocode}
%
--
Morten
More information about the XeTeX
mailing list