[XeTeX] Conflicts between AMS document classes and polyglossia

Ross Moore ross at ics.mq.edu.au
Tue Dec 30 00:39:12 CET 2008


Hi David,

On 30/12/2008, at 5:17 AM, David M. Jones wrote:

>> However, there is a piece of coding that  AMS  classes use
>> which is not safe against this strategy.
>>
>> lines 622--626 of  amsart.cls  are as follows:
>>
>>    \toks4{\def\\{ \ignorespaces}}% defend against questionable usage
>>    \edef\@tempa{%
>>      \@nx\markboth{\the\toks4
>>        \@nx\MakeUppercase{\the\toks@}}{\the\@temptokena}}%
>>    \@tempa
>
> Correct.  The argument to \markboth here is a token list that is not
> invariant under repeated applications of protected edefs.
>
>> These are more robustly written as:
>>
>> %  \toks4{\def\\{ \ignorespaces}}% defend against questionable usage
>>    \edef\@tempa{%
>>      \@nx\markboth{\@nx\protect at backslash
>>        \@nx\MakeUppercase{\the\toks@}}{\the\@temptokena}}%
>>    \@tempa
>>
>> using a new internal macro \protect at backslash  defined as:
>>
>> %% RRM --- added 2008/12/26
>> \def\protect at backslash{%
>>   \expandafter\def\noexpand\\{ \ignorespaces}}
>
> But neither is this.  This will survives a single round of expansion
> (which is admittedly good enough for the case at hand), but not a
> second.

Sure.
It's not my job to rewrite other people's packages.
Instead I try to locate places where existing coding is causing
a difficulty, and find a work-around that involves minimal changes,
yet fits with the style of programming that is being used at that
place in the package or class file. (This way even a novice can
make a temporary fix to a local copy of the relevant file.)

Having drawn attention to the location and nature of the problem,
it is then up to the package owner (who is no doubt more aware
of the intention and all the ins-and-outs of the existing coding,
and how it can be safely modified consistently with other packages
and class files) to sort out what is the *best* fix.
This may well involve more extensive changes ...

> A safer implementation is
>
>     \DeclareRobustCommand\redefine at backslash{\def\\{ \ignorespaces}}
>
>     \protected at edef\@tempa{%
>         \@nx\markboth{%
>             \redefine at backslash
>             \MakeUppercase{\the\toks@}}{\the\@temptokena}%
>     }%

  ... such as occur here.

>
> which takes advantage of LaTeX 2e's apparatus for dealing with these
> issues.

So can we expect to see these changes within an imminent update
to the AMS class files:  amsart.cls , amsproc.cls  and any others?

>
> David M. Jones
> Publications Technical Specialist
> American Mathematical Society
> http://www.ams.org/


All the best for the New Year,

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





More information about the XeTeX mailing list