[XeTeX] Conflicts between AMS document classes and polyglossia

Ross Moore ross at ics.mq.edu.au
Fri Dec 26 06:26:37 CET 2008


Hi Rémy,

On 26/12/2008, at 1:40 AM, Rémy Oudompheng wrote:

> Hi,
>
> I am experiencing problems compiling documents using AMS document
> classes (such as amsart), using a standard setup of TeXLive (TeXLive
> 2008 packages from ArchLinux).
>
> For example, the following file :
>
> \documentclass{amsart}
> \usepackage[english]{polyglossia}
> \begin{document}
> \title{Title}
> \author{Author}
> \maketitle
> Several words.
> \newpage
> More words.
> \end{document}
>
> fails with the following error :
>
> ! Use of \protect doesn't match its definition.
> <argument> ...orespaces }\protect \MakeUppercase
>                                                   {Author}
> l.11 \end{document}
>
> ?
>
> Removing the option for the polyglossia package seems to remove the
> error. How can I work around this problem ?

Interesting problem.
It occurs because  polyglossia  scans the contents of the
left & right header marks, inserting \protect commands
to allow safer expansion within macros.

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


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


Now your example works fine both with and without using
  polyglossia.sty , and it should not adversely affect
other documents with the  amsart  document class.

Note that  amsproc.cls   also would profit from this kind of edit.

>
> Regards,
>   Rémy Oudompheng.


Hope this helps,

	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