%%% ====================================================================
%%%  @LaTeX-file{
%%%     filename        = "amscls.dtx",
%%%     version         = "1.2beta",
%%%     date            = "1994/12/13",
%%%     time            = "11:36:18 EST",
%%%     author          = "American Mathematical Society",
%%%     copyright       = "Copyright (C) 1994 American Mathematical Society,
%%%                        all rights reserved.  Copying of this file is
%%%                        authorized only if either:
%%%                        (1) you make absolutely no changes to your copy,
%%%                        including name; OR
%%%                        (2) if you do make changes, you first rename it
%%%                        to some other name.",
%%%     address         = "American Mathematical Society,
%%%                        Technical Support,
%%%                        Electronic Products and Services,
%%%                        P. O. Box 6248,
%%%                        Providence, RI 02940,
%%%                        USA",
%%%     telephone       = "401-455-4080 or (in the USA and Canada)
%%%                        800-321-4AMS (321-4267)",
%%%     FAX             = "401-331-3842",
%%%     checksum        = "56186 2595 9908 96646",
%%%     email           = "tech-support@math.ams.org (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "latex, amslatex, ams-latex",
%%%     supported       = "yes",
%%%     abstract        = "This is part of the AMS-\LaTeX{} distribution.
%%%                        It produces output conforming to the style
%%%                        conventions of American Mathematical Society
%%%                        publications.  The file \fn{amscls.dtx} is
%%%                        converted by the installation procedure
%%%                        into two document classes, \cls{amsart} and
%%%                        \cls{amsbook}, which are intended, respectively,
%%%                        for articles and books containing mathematical
%%%                        research; both class files will also carry this
%%%                        heading, and the particular class should be
%%%                        determined from the external file name.",
%%%     docstring       = "The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================
%
% \iffalse
%<*driver>
\documentclass{amsdtx}
\begin{document}
\title{The \cls{amsart} and \cls{amsbook} document classes}
\author{American Mathematical Society\\Michael Downes}
\date{Version \fileversion, \filedate}
\hDocInput{amscls.dtx}
\end{document}
%</driver>
% \fi
%
% \maketitle
%
% \MakeShortVerb\|
% \section{Introduction}
%    This file (\fn{amscls.dtx}) is the master file for two \latex/
%    document classes, \cls{amsart} and \cls{amsbook}, which are
%    intended for articles and books containing mathematical research.
%    They produce output that follows the style conventions of
%    American Mathematical Society publications.
%
% \StopEventually{}
%
% \section{Implementation}
%    The usual name, date, and version information.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
%<amsart>\ProvidesClass{amsart}[1994/10/27 v1.2beta]
%<amsbook>\ProvidesClass{amsbook}[1994/10/27 v1.2beta]
%    \end{macrocode}
%
% \section{Options}
% \subsection{Notes}
%    Note: Options will be processed in the order they are declared;
%    cf \cs{ProcessOptions}.
%
% \subsection{Paper size}
%    The option \opt{letterpaper} (default) sets the target paper
%    width and height to U.S. letter size, 8.5 in x 11 in. Options
%    \opt{a4paper} and \opt{legalpaper} are also supported, but we
%    don't include some of the more unusual paper options
%    (\opt{a5paper}, \opt{executivepaper}) of the generic
%    \cls{article} class.
%    \begin{macrocode}
\DeclareOption{a4paper}{\paperheight 297mm\paperwidth 210mm }
\DeclareOption{letterpaper}{\paperheight 11in\paperwidth 8.5in }
\DeclareOption{legalpaper}{\paperheight 14in\paperwidth 8.5in }
%    \end{macrocode}
%
%    The options \opt{landscape} and \opt{portrait} swap paper height
%    and width.
%    \begin{macrocode}
\DeclareOption{landscape}{\@tempdima\paperheight
  \paperheight\paperwidth \paperwidth\@tempdima}
\DeclareOption{portrait}{}
%    \end{macrocode}
%
%  \subsection{Two-side or one-side printing}
%
%    For two-sided printing we set the switch \cs{if@twoside} which
%    will cause the margins to be adjusted so that the type blocks of
%    back-to-back pages will line up. The \cs{if@mparswitch} makes margin
%    paragraphs print in the outside margin.
%    \begin{macrocode}
\DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse}
\DeclareOption{twoside}{\@twosidetrue  \@mparswitchtrue}
%    \end{macrocode}
%
%  \subsection{Draft or final version}
%
%    The \opt{draft} option causes overfull lines to be marked with
%    a black slug in the right margin.
%    \begin{macrocode}
\DeclareOption{draft}{\overfullrule5\p@ }
\DeclareOption{final}{\overfullrule\z@ }
%    \end{macrocode}
%
%  \subsection{Title page}
%    The title and related information can optionally be printed on a
%    separate page.
%    \begin{macrocode}
\DeclareOption{titlepage}{\@titlepagetrue}
\DeclareOption{notitlepage}{\@titlepagefalse}
%    \end{macrocode}
%
%  \subsection{Two-column printing}
%
%    Two-column layout is handled through a predefined internal switch.
%    \begin{macrocode}
\DeclareOption{onecolumn}{\@twocolumnfalse}
\DeclareOption{twocolumn}{\@twocolumntrue}
%    \end{macrocode}
%
%  \subsection{The nomath option}
%
%    The `nomath' option causes most of the extra math features to be
%    omitted. In that case we need to make sure a couple of utility
%    functions are defined.
%    \begin{macrocode}
\DeclareOption{nomath}{%
  \def\numberwithin##1##2{\@ifundefined{c@##1}{\@nocounterr{##1}}{%
    \@ifundefined{c@##2}{\@nocounterr{##2}}{%
    \@addtoreset{##1}{##2}%
    \toks@\@xp\@xp\@xp{\csname the##1\endcsname}%
    \@xp\xdef\csname the##1\endcsname
      {\@xp\@nx\csname the##2\endcsname
       .\the\toks@}}}}
}
%    \end{macrocode}
%
% \subsection{Some font options}
%
%    The `noamsfonts' option means to avoid declaring math alphabets or
%    symbol fonts for the extra math fonts in the AMSFonts set. If
%    these fonts are declared, it means that the corresponding .tfm
%    files are required even for documents that do not use any symbols
%    from those fonts. So we allow optionally to not declare them, for
%    convenience of users who don't have those fonts on their system
%    and don't want the hassle of getting them.
%    \begin{macrocode}
\DeclareOption{noamsfonts}{%
  \PassOptionsToPackage{noamsfonts}{amsfonts}}
%    \end{macrocode}
%    The `psamsfonts' option, passed on the amsfonts package, means that
%    alternative \fn{.fd} files should be used that do not refer to
%    \fn{.tfm} files for sizes 6,8,9 (which are not present in the
%    PostScript AMS fonts set from Y\&Y/Blue Sky Research).
%    \begin{macrocode}
\DeclareOption{psamsfonts}{%
  \PassOptionsToPackage{psamsfonts}{amsfonts}}
%    \end{macrocode}
%
% \subsection{Equation numbering on the left or right}
%    The option \opt{leqno}---equation numbers on the left---is the
%    default in AMS styles. Therefore we provide also a \opt{reqno}
%    option.
%    \begin{macrocode}
\newif\iftagsleft@
\DeclareOption{leqno}{%
  \tagsleft@true \PassOptionsToPackage{leqno}{amstex}}
\DeclareOption{reqno}{%
  \tagsleft@false \PassOptionsToPackage{reqno}{amstex}}
%    \end{macrocode}
%
% \subsection{Vertical centering of equation numbers}
%    For multiline equations the equation number is by default centered
%    vertically on the total height of the equation. To make the
%    equation number print on the first line (for left-hand
%    numbers) or the last line (right-hand numbers), there is a tbtags
%    option `top/bottom tags'.
%    \begin{macrocode}
\newif\ifctagsplit@
\DeclareOption{centertags}{%
  \ctagsplit@true \PassOptionsToPackage{centertags}{amstex}}
\DeclareOption{tbtags}{%
  \ctagsplit@false \PassOptionsToPackage{tbtags}{amstex}}
%    \end{macrocode}
%
%  \subsection{Flush left displays}
%
%    The option \opt{fleqn} causes displayed equations to print
%    aligned on the left instead of centered, with an indentation
%    of \cs{mathindent} from the prevailing left margin. If the
%    \pkg{amstex} package is loaded, most of this code will be
%    overridden, but it seems we need it anyway because of the
%    possibility of the `nomath' class option.
%    \begin{macrocode}
\DeclareOption{fleqn}{%
  \def\[{\relax
    \ifmmode\@badmath
    \else
      \begin{trivlist}%
      \@beginparpenalty\predisplaypenalty
      \@endparpenalty\postdisplaypenalty
      \item[]\leavevmode
      \hbox to\linewidth\bgroup$\displaystyle
%    \end{macrocode}
%    Note that the \cs{m@th} should go at the end in \cs{]} just in
%    case an embedded small math formula inside \cs{text} occurs in
%    the display.
%
%    Why the extra bgroup here? I think it's not needed.
%    [mjd,3-Feb-1994]
%    \begin{macrocode}
      \hskip\mathindent\bgroup
    \fi}%
  \def\]{\relax
    \ifmmode
      \egroup \m@th$\hfil \egroup
      \end{trivlist}%
    \else \@badmath
    \fi}%
  \renewenvironment{equation}{%
    \@beginparpenalty\predisplaypenalty
    \@endparpenalty\postdisplaypenalty
    \refstepcounter{equation}%
    \@topsep\abovedisplayskip \trivlist
    \item[]\leavevmode
    \hbox to\linewidth\bgroup\hskip\mathindent$\displaystyle
  }{%
    \m@th$\hfil \displaywidth\linewidth \hbox{\@eqnnum}\egroup
    \endtrivlist
  }%
  \renewenvironment{eqnarray}{%
    \stepcounter{equation}\let\@currentlabel\theequation
    \global\@eqnswtrue \global\@eqcnt\z@ \tabskip\mathindent
    \let\\=\@eqncr \abovedisplayskip\topsep
    \ifvmode \advance\abovedisplayskip\partopsep \fi
    \belowdisplayskip\abovedisplayskip
    \belowdisplayshortskip\abovedisplayskip
    \abovedisplayshortskip\abovedisplayskip
    $$\everycr{}\halign to\linewidth\bgroup
      \hskip\@centering
      $\displaystyle\tabskip\z@skip####\m@th$&%
      \@eqnsel \global\@eqcnt\@ne
      \hfil${}####{}\m@th$\hfil&%
      \global\@eqcnt\tw@
      $\displaystyle ####\m@th$\hfil\tabskip\@centering&%
      \global\@eqcnt\thr@@
      \hbox to \z@\bgroup\hss####\egroup\tabskip\z@skip\cr
    }{%
      \@@eqncr \egroup \global\advance\c@equation\m@ne$$%
      \global\@ignoretrue
    }%
  \newdimen\mathindent \mathindent\leftmargini
}
%    \end{macrocode}
%
% \subsection{Dealing with font sizes}
%
% \begin{macro}{\@mainsize}
% \begin{macro}{\@ptsize}
%    Instead of the miserly \cs{@ptsize} variable from \latex/'s
%    ancient history that only contained the last digit of the main
%    typesize, we set up a proper variable \cs{@mainsize} that
%    contains all the digits of the main typesize. Just in case it is
%    needed for someone using an old package, we will keep
%    \cs{@ptsize} also.
%    \begin{macrocode}
\newcommand{\@mainsize}{10}
\newcommand{\@ptsize}{0}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%  \begin{macro}{\larger}
%  \begin{macro}{\smaller}
%    This function is an easy byproduct of the work done to fold
%    typesize-specific code into the main class file. The range of font
%    sizes is \cn{normalsize}, \cn{small}, \cn{Small}, \cn{SMALL},
%    \cn{tiny}, \cn{Tiny}, \cn{large}, \cn{Large}, \cn{LARGE},
%    \cn{huge}, \cn{Huge}. Spaces are left at either end of the case
%    statement to accommodate adding \cn{TINY} and \cn{HUGE} in the
%    future but it's not clear that they're really needed.
%    \begin{macrocode}
\newcommand{\larger}[1][1]{%
  \count@\@currsizeindex \advance\count@#1\relax
  \ifnum\count@<\z@ \count@\z@ \else\ifnum\count@>12 \count@12 \fi\fi
%    \end{macrocode}
%    The various size-changing commands \cn{normalsize}, etc. will take
%    care of updating \cs{@currsizeindex}.
%    \begin{macrocode}
  \ifcase\count@
    \Tiny\or\Tiny\or\tiny\or\SMALL\or\Small\or\small
    \or\normalsize
    \or\large\or\Large\or\LARGE\or\huge\or\Huge\else\Huge
  \fi
}
\newcommand{\smaller}[1][1]{\larger[-#1]}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%    The \cs{@adjustvertspacing} function adapts some vertical spacing
%    amounts to the current type size. We don't expect large sections of
%    vertical text to occur in the extraordinarily small or large type
%    sizes, so the \cs{@adjustvertspacing} function is only called in
%    the range between `footnote' size and `Large' size. Notice that no
%    shrinkability is used.
%    \begin{macrocode}
\def\@adjustvertspacing{%
%    \end{macrocode}
%    \cs{big/med/smallskipamount} are generic space values that will be
%    used by the commands \cn{bigskip}, \cn{medskip}, \cn{smallskip}. We
%    also link the spacing around displayed equations to these amounts.
%    \begin{macrocode}
  \bigskipamount.7\baselineskip plus.7\baselineskip
  \medskipamount\bigskipamount \divide\medskipamount\tw@
  \smallskipamount\medskipamount \divide\smallskipamount\tw@
  \abovedisplayskip\medskipamount
  \belowdisplayskip \abovedisplayskip
%    \end{macrocode}
%    The above-display short space is zero but with the same
%    stretchability as the above-display normal space. And the
%    below-display short space is similar, but has a base value equal to
%    \cs{smallskipamount}. Use of the multiplier |1| is an arcane \TeX{}
%    trick that coerces the skip value to a dimen value, i.e. gives us
%    the base value of the skip register without the stretch or shrink
%    values.
%    \begin{macrocode}
  \abovedisplayshortskip\abovedisplayskip
  \advance\abovedisplayshortskip-1\abovedisplayskip
  \belowdisplayshortskip\abovedisplayshortskip
  \advance\belowdisplayshortskip 1\smallskipamount
%    \end{macrocode}
%    The traditional value for \cs{jot} is 3pt, which we generalize
%    to \cs{baselineskip}/4. This is used to adjust interline spacing in
%    multiline displayed equations.
%    \begin{macrocode}
  \jot\baselineskip \divide\jot 4 \relax
}
%    \end{macrocode}%
%
%    We fill out the range of typesize changing commands to a full
%    eleven: five large/huge commands and five small/tiny commands. (The
%    capitalization of the command names suggests that there should
%    actually be thirteen---add \cn{TINY} and \cn{HUGE}---but let's be
%    conservative and leave those out until a real need for them is
%    known to exist.) An unavoidable side effect is that \cn{tiny} now
%    selects 6pt instead of 5pt by default.
%
%    In version 1.1 of \cls{amsart} and \cls{amsbook} \cn{small} was
%    the same as \cn{footnotesize}.
%
%    The only size-changing command that is predefined by \LaTeX{} is
%    \cn{normalsize}; that's why it's the only one for which we use
%    \cn{renewcommand} below.
%    \begin{macrocode}
\renewcommand\normalsize{\@xsetfontsize\normalsize 6%
  \@adjustvertspacing \let\@listi\@listI}
%\newcommand\TINY{\@xsetfontsize\TINY 0}
\newcommand\Tiny{\@xsetfontsize\Tiny 1}
\newcommand\tiny{\@xsetfontsize\tiny 2}
\newcommand\SMALL{\@xsetfontsize\SMALL 3}
\newcommand\Small{\@xsetfontsize\Small 4%
  \@adjustvertspacing
  \def\@listi{\topsep\smallskipamount \parsep\z@skip \itemsep\z@skip}}
\newcommand\small{\@xsetfontsize\small 5\@adjustvertspacing}
%    \end{macrocode}
%    For backward compatibility we had better define \cn{footnotesize}
%    and \cn{scriptsize}. Also there is the small discrepancy with
%    \cn{tiny} to worry about.
%    \begin{macrocode}
\def\footnotesize{\Small}
\def\scriptsize{\SMALL}
%    \end{macrocode}
%
%    The sizes above 10pt use magstep values, stored in the functions
%    \cs{@xipt}, \cs{@xiipt}, etc.
%    \begin{macrocode}
\newcommand\large{\@xsetfontsize\large 7\@adjustvertspacing}
\newcommand\Large{\@xsetfontsize\Large 8\@adjustvertspacing}
\newcommand\LARGE{\@xsetfontsize\LARGE 9}
\newcommand\huge{\@xsetfontsize\huge{10}}
\newcommand\Huge{\@xsetfontsize\Huge{11}}
%\newcommand\HUGE{\@xsetfontsize\HUGE{12}}
%    \end{macrocode}
%
%    So now we had better define the \cs{@xsetfontsize} function.
%    The size-changing commands use \cs{@setfontsize} instead of
%    \cs{fontsize} to (a)~give an error message if used in math mode and
%    (b)~set the \cs{@currsize} variable.
%    \begin{macrocode}
\def\@xsetfontsize#1#2{%
  \chardef\@currsizeindex#2\relax
  \edef\@tempa{\@nx\@setfontsize\@nx#1%
    \@xp\ifcase\@xp\@currsizeindex\@typesizes
%    \end{macrocode}
%    Add nonsense values 99/99 at the end just in case some extreme
%    error turns up.
%    \begin{macrocode}
      \else{99}{99}\fi}%
  \@tempa
}
%    \end{macrocode}
%    For the record let's initialize \cs{@currsizeindex}.
%    \begin{macrocode}
\chardef\@currsizeindex=6
%    \end{macrocode}
%
%    Set penalties in book style to prevent widows, orphans, and hyphens
%    at the end of a page.
%    \begin{macrocode}
%<*amsbook>
\widowpenalty=10000
\clubpenalty=10000
\brokenpenalty=10000
%</amsbook>
%    \end{macrocode}
%
%    Set some default linespacing values. The variable \cs{linespacing}
%    is usually the normal interline space in the main text. It is used
%    to specify vertical space for elements such as section heads and
%    theorems in proportion to the normal interline space.
%    \begin{macrocode}
\newdimen\linespacing
\lineskip=1pt \lineskiplimit=1pt
\normallineskip=1pt \normallineskiplimit=1pt
\let\baselinestretch=\@empty
%    \end{macrocode}
%
%      Settings for \cn{textheight} and \cn{textwidth}.
%      We start with the value 50.5pc specified in AMS journal
%      specifications as the total height of the type block
%      and then subtract the running head height and adjust
%      for \cs{topskip} to get the proper value for the
%      text block.
%    \begin{macrocode}
%<amsart>\headheight=8pt \headsep=16pt
%<amsbook>\headheight=6pt \headsep=12pt
\footskip=12pt
\textheight=50.5pc \topskip=10pt
\textwidth=30pc
\columnsep=10pt \columnseprule=0pt
%    \end{macrocode}
%
%    \begin{macrocode}
\marginparwidth=90pt
\marginparsep=11pt
%    \end{macrocode}
%
%    Avoid setting any text until begin-document.
%    \begin{macrocode}
\AtBeginDocument{\settoheight{\footnotesep}{\footnotesize M$^1$}}
%    \end{macrocode}
%
%    \begin{macrocode}
\skip\footins=7pt plus11pt
\skip\@mpfootins=\skip\footins
%    \end{macrocode}
%
%    \begin{macrocode}
\fboxsep=3pt \fboxrule=.4pt
%    \end{macrocode}
%
%    \begin{macrocode}
\arrayrulewidth=.4pt    \doublerulesep=2pt
\labelsep=5pt           \arraycolsep=\labelsep
\tabcolsep=\labelsep    \tabbingsep=\labelsep
%    \end{macrocode}
%
%    \begin{macrocode}
\floatsep=15pt plus 12pt    \dblfloatsep=15pt plus 12pt
\textfloatsep=\floatsep  \dbltextfloatsep=15pt plus 12pt
\intextsep=\floatsep
%    \end{macrocode}
%
%    \begin{macrocode}
\@fptop=0pt plus1fil     \@dblfptop=0pt plus1fil
\@fpbot=0pt plus1fil     \@dblfpbot=0pt plus1fil
\@fpsep=8pt plus2fil     \@dblfpsep=8pt plus2fil\relax
%    \end{macrocode}
%
%    \begin{macrocode}
\marginparpush=5pt
%    \end{macrocode}
%
%    \begin{macrocode}
%<amsart>\parskip=0pt plus1pt\relax
%<amsbook>\parskip=0pt
%    \end{macrocode}
%
%    \cs{@parboxrestore}, used by \cs{@footnotetext}, sets
%    \cs{parindent} to 0pt; since this is not what we want, we
%    make a new dimen \cs{normalparindent} and after calling
%    \cs{@parboxrestore}, \cs{@footnotetext} resets
%    \cs{parindent} back to normal.
%    \begin{macrocode}
\newdimen\normalparindent
%<amsart>\normalparindent=12pt
%<amsbook>\normalparindent=18pt
\parindent=\normalparindent
%    \end{macrocode}
%
%    \begin{macrocode}
\partopsep=0pt \relax
\parsep=0pt \relax
\itemsep=0pt \relax
%    \end{macrocode}
%
%    \begin{macrocode}
\@lowpenalty=51         \@medpenalty=151        \@highpenalty=301
\@beginparpenalty=-\@lowpenalty
\@endparpenalty=-\@lowpenalty
\@itempenalty=-\@lowpenalty
%    \end{macrocode}
%
% \subsection{Typesize-specific code}
%    The class option \opt{12pt} sets the main typesize to 12 pt and
%    makes various adaptations, primarily sliding the size-changing
%    commands up the scale of magsteps. This makes it more likely that
%    someone with bitmapped fonts will have all the fonts and sizes
%    that they need. The \opt{8pt} option is for those who like to
%    conserve paper.
%
%    By parameterizing some aspects it is possible to make a great deal
%    of the typesize-specific code automatically adapt to the selected
%    size. Then there is so little typesize-specific code remaining
%    that it no longer makes sense to put the code in separate \fn{.clo}
%    files. So instead of analogs for the generic \fn{size10,11,12.clo}
%    files we have the code for those options entirely contained in the
%    \fn{.cls} file in the form of declared options.
%
%    Some miscellaneous remarks.
%
%    ---If PostScript fonts are used, it may seem a little strange to
%    use fonts following the magstep'd point sizes 10.95, 14.4, 17.28,
%    20.74, 24.88 instead of simply 11, 14, 17, 21, 25. But it is not
%    easy for us to make that distinction here in the documentclass
%    definitions of the fontsize changing commands. So we don't try.
%
%    \begin{macrocode}
\DeclareOption{10pt}{\def\@mainsize{10}\def\@ptsize{0}%
  \def\@typesizes{%
%    \end{macrocode}
%    There should be 11 typesize/baselineskip pairs: five below
%    \cn{normalsize} and five above.
%    \begin{macrocode}
    \or{5}{6}\or{6}{7}\or{7}{8}\or{8}{10}\or{9}{11}%
    \or{10}{12}% normalsize
    \or{\@xipt}{13}\or{\@xiipt}{14}\or{\@xivpt}{17}%
    \or{\@xviipt}{20}\or{\@xxpt}{24}}%
  \normalsize \linespacing=\baselineskip
}
%
\DeclareOption{11pt}{\def\@mainsize{11}\def\@ptsize{1}%
  \def\@typesizes{%
    \or{6}{7}\or{7}{8}\or{8}{10}\or{9}{11}\or{10}{12}%
    \or{\@xipt}{13}% normalsize
    \or{\@xiipt}{14}\or{\@xivpt}{17}\or{\@xviipt}{20}%
    \or{\@xxpt}{24}\or{\@xxvpt}{30}}%
  \normalsize \linespacing=\baselineskip
}
%
\DeclareOption{12pt}{\def\@mainsize{12}\def\@ptsize{2}%
  \def\@typesizes{%
    \or{7}{8}\or{8}{10}\or{9}{11}\or{10}{12}\or{\@xipt}{13}%
    \or{\@xiipt}{14}% normalsize
    \or{\@xivpt}{17}\or{\@xviipt}{20}\or{\@xxpt}{24}%
    \or{\@xxvpt}{30}\or{\@xxvpt}{30}}%
  \normalsize \linespacing=\baselineskip
}
%
\DeclareOption{8pt}{\def\@mainsize{8}\def\@ptsize{8}%
  \def\@typesizes{%
    \or{5}{6}\or{5}{6}\or{5}{6}\or{6}{7}\or{7}{8}%
    \or{8}{10}% normalsize
    \or{9}{11}\or{10}{12}\or{\@xipt}{13}%
    \or{\@xiipt}{14}\or{\@xivpt}{17}}%
  \normalsize \linespacing=\baselineskip
}
%
\DeclareOption{9pt}{\def\@mainsize{9}\def\@ptsize{9}%
  \def\@typesizes{%
    \or{5}{6}\or{5}{6}\or{6}{7}\or{7}{8}\or{8}{10}%
    \or{9}{11}% normalsize
    \or{10}{12}\or{\@xipt}{13}\or{\@xiipt}{14}%
    \or{\@xivpt}{17}\or{\@xviipt}{20}}%
  \normalsize \linespacing=\baselineskip
}
%    \end{macrocode}
%
% \subsection{Running heads}
%    The normal application of pagestyle functions \cs{ps@xxx} is to
%    determine the contents of running heads and feet. The function
%    \cs{@mkboth} is used internally by commands \cn{chapter},
%    \cn{section}, and the like to set the running heads.
%    \begin{macrocode}
\def\ps@empty{\let\@mkboth\@gobbletwo
  \let\@oddhead\@empty \let\@evenhead\@empty
  \let\@oddfoot\@empty \let\@evenfoot\@empty
%    \end{macrocode}
%    The current implementation in amsart/amsbook of the vertical
%    space at the top of an opening page uses \cn{topskip}, which
%    means that we need to do some resetting here.
%    \begin{macrocode}
  \global\topskip\normaltopskip}
%    \end{macrocode}
%    Pagestyle `plain' has the page numbers in the running feet.
%    \begin{macrocode}
\def\ps@plain{\ps@empty
  \def\@oddfoot{\normalfont\scriptsize \hfil\thepage\hfil}%
  \let\@evenfoot\@oddfoot}
%    \end{macrocode}
%    Pagestyle `headings' uses text from sectioning commands for
%    running heads. Empty running feet.
%    \begin{macrocode}
\def\ps@headings{\ps@empty
  \def\@evenhead{\normalfont\scriptsize
      \rlap{\thepage}\hfil \leftmark{}{}\hfil}%
  \def\@oddhead{\normalfont\scriptsize \hfil
      \rightmark{}{}\hfil \llap{\thepage}}%
  \let\@mkboth\markboth
%<*amsbook>
  \def\partmark{\@secmark\markboth\partrunhead\partname}%
  \def\chaptermark{%
    \@secmark\markboth\chapterrunhead\chaptername}%
  \def\sectionmark{%
    \@secmark\markright\sectionrunhead\sectionname}%
%</amsbook>
}
%    \end{macrocode}
%
%  \begin{macro}{\sectionname}
%    Init.
%    \begin{macrocode}
\let\sectionname\@empty
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@nilgobble}
%    Something that apparently doesn't exist in the kernel?
%    \begin{macrocode}
\long\def\@nilgobble#1\@nil{}
%    \end{macrocode}
%  \end{macro}
%
%    A general section-marking function. Arg 1 is either \cn{markright}
%    or \cn{markboth} indicating which kind of marking action is desired
%    (this gives us some string pool/hash table savings by allowing the
%    \cs{@secmark} function to serve for both cases). Arg 2 is the
%    function that should be called in the running head to process the
%    remaining three args. Args 3,4 are normally \cn{xxxname} and
%    \cn{thexxx} (xxx being the name of the sectioning command) but they
%    might be sometimes omitted.
%    \begin{macrocode}
%<*amsbook>
\def\@secmark#1#2#3#4#5{%
%    \end{macrocode}
%    We want to apply expansion to xxxname and thexxx but not to the
%    other elements.
%    \begin{macrocode}
  \begingroup \let\protect\@unexpandable@protect
  \edef\@tempa{\endgroup \toks@{\@nx#2{#3}{#4}}}%
  \@tempa
  \toks@\@xp{\the\toks@{#5}}%
%    \end{macrocode}
%    If a \cn{markright} operation is called for, use the current
%    left-mark via \cs{@temptokena}.
%    \begin{macrocode}
  \afterassignment\@nilgobble\@temptokena\@themark{}\@nil
  \edef\@tempa{\@nx\@mkboth{%
    \ifx\markright#1\the\@temptokena\else\the\toks@\fi}{\the\toks@}}%
  \@tempa}
%</amsbook>
%    \end{macrocode}
%
%    Fix \cn{markboth} so that \cs{@secmark} can work without too much
%    thrashing.
%    \begin{macrocode}
\def\markboth#1#2{%
  \begingroup
    \@temptokena{{#1}{#2}}\xdef\@themark{\the\@temptokena}%
    \mark{\the\@temptokena}%
  \endgroup
  \if@nobreak\ifvmode\nobreak\fi\fi}
%    \end{macrocode}
%
%    With the myheadings pagestyle, no automatic running heads will be
%    provided by the documentclass; only running heads specified by
%    the user through explicit \cn{markboth} or \cn{markright}
%    commands will be used.
%    \begin{macrocode}
\def\ps@myheadings{\ps@headings \let\@mkboth\@gobbletwo}
%    \end{macrocode}
%
%    Save normal topskip value in a skip register.
%    \begin{macrocode}
\newskip\normaltopskip
\normaltopskip=10pt \relax
%    \end{macrocode}
%
% \subsection{Unrecognized options}
%
%    The \opt{makeidx} option is redundant; everything that it does in
%    the generic \latex/ classes is already done anyway in this class.
%    \begin{macrocode}
\DeclareOption{makeidx}{}
%    \end{macrocode}
%
%    Any other unrecognized options produce an error, except in
%    compatibility mode when we must try loading an option file.
%    \begin{macrocode}
\DeclareOption*{\if@compatibility\input{\CurrentOption.sty}%
  \else\expandafter\@unknownoptionerror\fi}
%    \end{macrocode}
%
% \subsection{Process options}
%    Install the default options. First, however, we'd better install
%    the \pkg{amsgen} function set.
%    \begin{macrocode}
\input{amsgen.sty}
\ExecuteOptions{leqno,centertags,letterpaper,portrait,%
  10pt,twoside,onecolumn,final}
%    \end{macrocode}
%    Options will be processed in the order of the associated
%    \cs{DeclareOption} commands.
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
%    If the \opt{nomath} option was specified, then \cn{numberwithin}
%    will be defined. If not, we will call the \pkg{amstex} package.
%    \begin{macrocode}
\@ifundefined{numberwithin}{\RequirePackage{amstex}\relax}{}
%    \end{macrocode}
%
%    Now a utility macro to do \cn{uppercase} but sidestep any math, to
%    prevent uppercasing math variables.  In order to be handled properly
%    the |$...$| or |\(...\)| must be on the outer level (not
%    enclosed in braces).  We did not try to handle the possibility
%    |\begin{math}| |...| |\end{math}| in a title at the present time (too
%    complicated).  Also we increase inter-word space in the uppercase
%    text.
%
%    One other little problem: uppercasing of a few special characters
%    like the German {\ss} (\cn{ss}) and the undotted i and j (\cn{i}
%    and \cn{j}), used sometimes with accents. We redefine to be upper
%    case equivalents. (Undotted \cn{i} and \cn{j} in math would be
%    typed as \cn{imath} and \cn{jmath}.)
%
%    Spaceskip is changed in accordance with recommendations for
%    increased interword spacing in all-caps text by e.g. `Words into
%    Type'.
%    \begin{macrocode}
\newcommand{\uppercasenonmath}[1]{\toks@\@emptytoks
%    Insert an extra \@empty to avoid removing braces around arg #1.
  \@xp\@skipmath\@xp\@empty#1$$%
  \edef#1{\@nx\@upprep\the\toks@}%
}
%    \end{macrocode}
%
%  \begin{macro}{\@upprep}
%    Preparations for printing all-cap text.
%    \begin{macrocode}
\newcommand{\@upprep}{%
  \spaceskip1.3\fontdimen2\font plus1.3\fontdimen3\font
  \upchars@}
%    \end{macrocode}
%  \end{macro}
%
%    In all-caps text, eszet should print as SS, dotless i should print
%    as normal cap I, Mc should print with a small-caps (not lowercase)
%    c, and so forth.
%    \begin{macrocode}
\newcommand{\upchars@}{%
  \def\ss{SS}\def\i{I}\def\j{J}\def\ae{\AE}\def\oe{\OE}%
  \def\o{\O}\def\aa{\AA}\def\l{\L}\def\Mc{M{\scshape c}}}
%    \end{macrocode}
%
%  \begin{macro}{\@skipmath}
%  \begin{macro}{\@xskipmath}
%    \cs{@skipmath} searches for |$...$| in order to keep from applying
%    \cn{uppercase} to the contents. Then it calls \cs{@xskipmath} to
%    search for |\(...\)|.
%    \begin{macrocode}
\newcommand{\@skipmath}{}
\long\def\@skipmath#1$#2${%
  \@xskipmath#1\(\)%
  \@ifnotempty{#2}{\toks@\@xp{\the\toks@$#2$}\@skipmath\@empty}}%
%
\newcommand{\@xskipmath}{}
\long\def\@xskipmath#1\(#2\){%
%    Expand away the added \@empty
  \uppercase{\toks@\@xp\@xp\@xp{\@xp\the\@xp\toks@#1}}%
  \@ifnotempty{#2}{\toks@\@xp{\the\toks@\(#2\)}\@xskipmath\@empty}}%
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\today}
%    The command \cn{today} produces today's date in the form most
%    commonly used in the U.S.
%    \begin{macrocode}
\newcommand{\today}{%
  \relax\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}
%    \end{macrocode}
%  \end{macro}
%
% \subsection{Old text font commands}
%    The \cn{em} command is not redefined here (let's say, to give an
%    `obsolete' warning and recommend instead \cn{emph}) because there
%    is no alternative internal command \cn{emshape}.
%    \begin{macrocode}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
%    \end{macrocode}
%
%    The macro \cn{defaultfont} was provided in version 1.1 of amsart;
%    retained for compatibility as a synonym of \cn{normalfont}. Resets
%    everything except for size.
%    \begin{macrocode}
\def\defaultfont{\@subst@obsolete\defaultfont\normalfont}
%    \end{macrocode}
%
% \subsection{Top matter}
%    For the \cn{title} command, we support an optional argument to give
%    a shortened version of the title for running heads.
%    \begin{macrocode}
\renewcommand{\title}[2][]{\gdef\shorttitle{#1}\gdef\@title{#2}}
%    \end{macrocode}
%    The default value for the optional argument is `same as the
%    mandatory arg' but there doesn't seem to be an easy way to get that
%    effect with \ncn{[re]newcommand}. Here is how to use \cs{@dblarg}
%    in conjunction with the preceding \cn{newcommand}:
%    \begin{macrocode}
\edef\title{\@nx\@dblarg
  \@xp\@nx\csname\string\title\endcsname}
%    \end{macrocode}
%    The \cn{author} command accepts an optional argument similar to
%    that of the \cn{title} command.
%    \begin{macrocode}
\renewcommand{\author}[2][]{%
  \ifx\@empty\authors
    \gdef\shortauthors{#1}\gdef\authors{#2}%
  \else
    \g@addto@macro\shortauthors{\and#1}%
    \g@addto@macro\authors{\and#2}%
  \fi
  \g@addto@macro\addresses{\author{}}%
}
\edef\author{\@nx\@dblarg
  \@xp\@nx\csname\string\author\endcsname}
%    \end{macrocode}
%    Initialize some variables.
%    \begin{macrocode}
\let\shortauthors\@empty   \let\authors\@empty
\let\addresses\@empty      \let\thankses\@empty
%    \end{macrocode}
%    The optional arguments of \cn{address}, \cn{curraddr}, \cn{email}
%    are to indicate which author the address applies to, if a document
%    has multiple authors and there is not a normal one-to-one
%    correspondence between authors and addresses.
%    \begin{macrocode}
\newcommand{\address}[2][]{\g@addto@macro\addresses{\address{#1}{#2}}}
\newcommand{\curraddr}[2][]{\g@addto@macro\addresses{\curraddr{#1}{#2}}}
\newcommand{\email}[2][]{\g@addto@macro\addresses{\email{#1}{#2}}}
\renewcommand{\thanks}[1]{\g@addto@macro\thankses{\thanks{#1}}}
%    \end{macrocode}
%
%    The following example of addresses for three authors of a
%    tri-author paper illustrates the kind of complications that need to
%    be handled.
% \begin{verbatim}
%  \author{Roland Campbell}
%  \address{Department of Mathematics\\
%    Pennsylvania State University\\
%    Pittsburgh, Pennsylvania 13593}
%  \email[R.~Campbell]{campr@@galois.psu.edu}
%
%  \author{Mark M. Dane}
%  % Same address as R. Campbell
%  \curraddr[M.~Dane]{Atmospheric Research Station\\
%    Pala Lundi, Fiji}
%  \email[M.~Dane]{DaneMark@@ffr.choice}
%
%  \author{Jeremiah Jones}
%  \address[J.~Jones]{Department of Philosophy\\
%  Freedman College\\
%  Periwinkle, Colorado 84320}
%  \email[J.~Jones]{id739e@@oseoi44 (Bitnet)}
% \end{verbatim}
%
%    In an article, typesetting of the address information is done at
%    the end of the document, by calling |\@setaddresses|.
%    \begin{macrocode}
%<*amsart>
\AtEndDocument{\relax
  \ifx\@empty\@translators \else\@settranslators\fi
  \ifx\@empty\addresses \else\@setaddresses\fi}
%</amsart>
%
\def\@setaddresses{\par
  \nobreak \begingroup \footnotesize
  \def\author##1{\nobreak\addvspace\bigskipamount}%
%    \end{macrocode}
%    Address is supposed to go all on one line, so we redefine |\\|
%    to just insert a comma instead of doing a line break.
%    \begin{macrocode}
  \def\\{\unskip, \ignorespaces}%
%    \end{macrocode}
%    No page breaks in the address section is accomplished by
%    |\interlinepenalty\@M| and by the |\nobreak| before the |\bigskip|.
%    \begin{macrocode}
  \interlinepenalty\@M
  \def\address##1##2{\begingroup
%    If there are two addresses for the same author, add a \bigskip
%    between them.
    \par\nobreak\addvspace\bigskipamount\indent
%    If the name of the author to whom this address applies
%    was given, typeset it
    \@ifnotempty{##1}{(\ignorespaces##1\unskip) }%
%    Now the main part of the address:
    {\scshape\ignorespaces##2}\par\endgroup}%
%    Current address:
  \def\curraddr##1##2{\begingroup
    \@ifnotempty{##2}{\nobreak\indent{\itshape Current address}%
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      ##2\par\endgroup}}%
%    And then email:
  \def\email##1##2{\begingroup
    \@ifnotempty{##2}{\nobreak\indent{\itshape E-mail address}%
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      \ttfamily##2\par\endgroup}}%
  \addresses
  \endgroup
}
%
%    Some other administrative info. For \date we can just use the
%    default definition provided by LaTeX. Except that we initialize the
%    date to empty instead of to \today.
%    \begin{macrocode}
\let\@date\@empty
\def\dedicatory#1{\def\@dedicatory{#1}}
\let\@dedicatory=\@empty
\def\keywords#1{\def\@keywords{#1}}
\let\@keywords=\@empty
\def\subjclass#1{\def\@subjclass{#1}}
\let\@subjclass=\@empty
%    \end{macrocode}
%
%    We handle translator names like author names, just in case there is
%    more than one translator. [mjd,1994/10/19]
%    \begin{macrocode}
\def\translator#1{\g@addto@macro\@translators{\and#1}}
\let\@translators=\@empty
%    \end{macrocode}
%
%    \begin{macrocode}
%<*amsart>
\def\@settranslators{\par\begingroup
  \addvspace{6\p@\@plus9\p@}%
  \hbox to\columnwidth{\hss\normalfont\normalsize
    Translated by %
    \andify\@translators \uppercasenonmath\@translators
    \@translators}
  \endgroup
}
%</amsart>
%    \end{macrocode}
%
%    The general function to convert a list of items in the form
% \begin{verbatim}
% A\and B\and C\and D
% \end{verbatim}
%    to the form `A, B, C, and D' is \cn{xandlist}:
% \begin{verbatim}
% \xandlist{, }{ and }{, and }{A\and B\and C\and D}
% \end{verbatim}
%    This is a completely expandable macro, with the return value being
%    the converted list. There is also a `no-execute' version whose
%    fourth argument should be a macro; the text to be converted will be
%    taken from that macro and after conversion will be put back as the
%    macro's new replacement text.
% \begin{verbatim}
%      \nxandlist{, }{ and }{, and }\result
% \end{verbatim}
%    I don't think I want to explain this except by recommending that
%    you watch it in operation with \cn{tracingmacros} if you're
%    interested. [mjd,1994/10/19]
%    \begin{macrocode}
\newcommand{\xandlist}[4]{\@andlista{{#1}{#2}{#3}}#4\and\and}
\def\@andlista#1#2\and#3\and{\@andlistc{#2}\@ifnotempty{#3}{%
  \@andlistb#1{#3}}}
\def\@andlistb#1#2#3#4#5\and{%
  \@ifempty{#5}{%
    \@andlistc{#2#4}%
  }{%
    \@andlistc{#1#4}\@andlistb{#1}{#3}{#3}{#5}%
  }}
\let\@andlistc\@iden
\newcommand{\nxandlist}[4]{%
  \def\@andlistc##1{\toks@\@xp{\the\toks@##1}}%
  \toks@{\toks@\@emptytoks \@andlista{{#1}{#2}{#3}}}%
  \the\@xp\toks@#4\and\and
  \edef#4{\the\toks@}%
  \let\@andlistc\@iden}
%    \end{macrocode}
%
%    The \cn{andify} function is provided as a convenient abbreviation
%    for the most common case.
%    \begin{macrocode}
\newcommand{\andify}{%
  \nxandlist{\unskip, }{\unskip{} and~}{\unskip, and~}}
%    \end{macrocode}
%    Override the funny default definition of \cn{and} from \latex/.
%    This is not actually used by AMS classes, however.
%    \begin{macrocode}
\def\and{\unskip{ }and \ignorespaces}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\maketitle{\par
  \@topnum\z@ % this prevents figures from falling at the top of page 1
%    \end{macrocode}
%    For the \cls{amsart} class, we do some setup for the running heads
%    here. If there are no author names, we set the left-hand running
%    head to the value of the right-hand running head.
%    \begin{macrocode}
%<*amsart>
  \uppercasenonmath\shorttitle
  \ifx\@empty\shortauthors \let\shortauthors\shorttitle
  \else \andify\shortauthors \uppercasenonmath\shortauthors \fi
%</amsart>
  \begingroup
  \@maketitle
%<*amsart>
  \toks@\@xp{\shortauthors}\@temptokena\@xp{\shorttitle}%
  \edef\@tempa{\@nx\markboth{\the\toks@}{\the\@temptokena}}\@tempa
%</amsart>
  \endgroup
  \c@footnote\z@
  \def\do##1{\let##1\relax}%
  \do\maketitle \do\@maketitle \do\title
  \do\author \do\address \do\email \do\curraddr
  \do\dedicatory \do\@dedicatory \do\thanks \do\thankses
  \do\keywords \do\@keywords \do\subjclass \do\@subjclass
}
%    \end{macrocode}
%
%    Set up the style of an article opening page.
%    \begin{macrocode}
%<*amsart>
\def\@maketitle{%
%    \end{macrocode}
%    Set font to normal, just in case.
%    \begin{macrocode}
  \normalfont\normalsize
%    \end{macrocode}
%
%    Special footnotes are put here to ensure that they come first at
%    the bottom of the page.
%    \begin{macrocode}
  \let\@makefnmark\relax  \let\@thefnmark\relax
  \ifx\@empty\@date\else \@footnotetext{\@setdate}\fi
  \ifx\@empty\@subjclass\else \@footnotetext{\@setsubjclass}\fi
  \ifx\@empty\@keywords\else \@footnotetext{\@setkeywords}\fi
  \ifx\@empty\thankses\else \@footnotetext{%
%    \end{macrocode}
%    In order to make multiple thanks footnotes work inside a single
%    \cs{@footnotetext} argument we need to make the first \cs{par} be
%    ignored. Cf \cs{@setthanks}.
%    \begin{macrocode}
    \def\par{\let\par\@par}\@setthanks}\fi
%    \end{macrocode}
%    If \pagestyle{myheadings} was specified, \@mkboth will be a no-op.
%    \begin{macrocode}
  \@mkboth{\@nx\shortauthors}{\@nx\shorttitle}%
  \global\topskip42\p@ % 5.5 picas to the base of the first title line
  \@settitle
  \ifx\@empty\authors \else \@setauthors \fi
%    \end{macrocode}
%    Likewise with \cs{@dedicatory} and \cs{@date}.
%    \begin{macrocode}
  \ifx\@empty\@dedicatory
  \else
    \baselineskip18\p@
    \vtop{\centering{\footnotesize\itshape\@dedicatory\@@par}%
      \global\dimen@i\prevdepth}\prevdepth\dimen@i
  \fi
%    \end{macrocode}
%    Space before the main text should be 32 + 14 base-to-base; we
%    accomplish this by doing a vskip of that amount with \cs{baselineskip}
%    subtracted.
%    \begin{macrocode}
  \normalsize
  \dimen@32\p@ \advance\dimen@-\baselineskip
  \vskip\dimen@\@plus14\p@ \relax
} % end \@maketitle
%</amsart>
%    \end{macrocode}
%    Some name setup.
%    \begin{macrocode}
\newcommand{\abstractname}{Abstract}
\newcommand{\datename}{Date}
\newcommand{\keywordsname}{Key words and phrases}
\newcommand{\subjclassname}{\textup{1991} Mathematics Subject
     Classification}
%    \end{macrocode}
%
%    \begin{macrocode}
%<*amsart>
\def\@settitle{\begin{center}\baselineskip14\p@\relax\bfseries
    \uppercasenonmath\@title \@title
  \end{center}%
}
%</amsart>
%    \end{macrocode}
%    For multiple authors we need to combine the author names into a
%    list of the form Author One, Author Two, ..., and Author Last.
%    \begin{macrocode}
%<*amsart>
\def\@setauthors{%
  \begingroup
  \trivlist
  \centering\footnotesize \@topsep32\p@\relax
  \advance\@topsep by -\baselineskip
  \item\relax
%    \end{macrocode}
%    Here \cs{uppercasenonmath} instead of just \cn{uppercase} is a bit of
%    overkill but it gives us the uppercase special chars and handles
%    potential exotic cases without further work.
%    \begin{macrocode}
  \andify\authors \uppercasenonmath\authors
  \authors
  \endtrivlist
  \endgroup
}
%</amsart>
%    \end{macrocode}
%    The following definitions suffice for both the \cls{amsart} and
%    \cls{amsbook} classes.
%    \begin{macrocode}
\def\@setdate{{\itshape \datename.}\enspace \@date\@addpunct.}
\def\@setsubjclass{%
  {\itshape\subjclassname.}\enspace\@subjclass\@addpunct.}
\def\@setkeywords{%
  {\itshape \keywordsname.}\enspace \@keywords\@addpunct.}
\def\@setthanks{\def\thanks##1{\par##1\@addpunct.}\thankses}
%    \end{macrocode}
%
%    `Abstract' can be changed to say `R\'esum\'e' (French) by
%    redefining \cn{abstractname}.  This and other control
%    sequence names (\cn{refname}, \cn{contentsname},
%    \cn{appendixname}, and so on) are compatible with babel.sty,
%    (the AMS sometimes publishes articles in languages other than
%    English.)
%    \begin{macrocode}
\def\abstract{\par
  \removelastskip
%     Make sure \addvspace doesn't do anything weird:
  \vskip\z@skip
%    \end{macrocode}
%    If there is an abstract it should follow immediately after
%    |\maketitle| in the user's file.  We need to subtract the difference
%    between the previous vskip and the desired skip of 28pt plus
%    0pt.  If we could use \unskip that would be nice but we can't because
%    we're on the main vertical list.
%    \begin{macrocode}
  \normalfont\footnotesize
  \list{{\scshape\abstractname}.}{%
    \topsep32\p@\@plus 14\p@
    \labelsep.5em\leftmargin3pc \rightmargin\leftmargin
    \itemindent\leftmargin}%
  \item\relax\ignorespaces
}
%
\def\endabstract{\endtrivlist
%    Undefine these commands to save a little memory.
  \global\let\abstract\relax \global\let\endabstract\relax
}
%    \end{macrocode}
%
%    Title page environment does nothing much; information and
%    formatting to be provided by the user.
%    \begin{macrocode}
\def\titlepage{%
%<amsbook>  \cleardoublepage
%<amsart>  \clearpage
  \thispagestyle{empty}\setcounter{page}{0}}
\def\endtitlepage{\newpage}
%    \end{macrocode}
%
% \subsection{Macros for list labels}
%    \begin{macrocode}
%<amsart>\def\labelenumi{(\theenumi)}
%<amsbook>\def\labelenumi{\theenumi.}
\def\theenumi{\@arabic\c@enumi}
\def\labelenumii{(\theenumii)}
\def\theenumii{\@alph\c@enumii}
\def\p@enumii{\theenumi}
\def\labelenumiii{(\theenumiii)}
\def\theenumiii{\@roman\c@enumiii}
\def\p@enumiii{\theenumi(\theenumii)}
\def\labelenumiv{(\theenumiv)}
\def\theenumiv{\@Alph\c@enumiv}
\def\p@enumiv{\p@enumiii\theenumiii}
%
\def\labelitemi{$\m@th\bullet$}
\def\labelitemii{\bfseries --}% \upshape already done by \itemize
\def\labelitemiii{$\m@th\ast$}
\def\labelitemiv{$\m@th\cdot$}
%    \end{macrocode}
%
% \subsection{Verse and quotation environments}
%    \begin{macrocode}
\def\verse{\let\\\@centercr
  \list{}{\itemsep\z@ \itemindent -1.5em\listparindent\itemindent
  \rightmargin\leftmargin \advance\leftmargin 1.5em}\item[]}
\let\endverse=\endlist
%    \end{macrocode}
%    The left/right margins of the quotation environment are supposed to
%    be the same as for the abstract environment.
%    \begin{macrocode}
\def\quotation{\list{}{%
    \leftmargin3pc \listparindent\normalparindent
    \itemindent\z@
    \rightmargin\leftmargin \parsep\z@ \@plus\p@}%
  \item[]}
\let\endquotation=\endlist
\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist
%    \end{macrocode}
%
% \subsection{List environments}
%    Changed definition of \cs{trivlist}, \cs{enumerate}, and
%    \cs{itemize} in order to have \cn{makelabel} apply \cn{upshape}.
%    \begin{macrocode}
\def\trivlist{\parsep\parskip\@nmbrlistfalse
  \@trivlist \labelwidth\z@ \leftmargin\z@
  \itemindent\z@
  \let\@itemlabel\@empty
  \def\makelabel##1{\upshape##1}}

\def\enumerate{\ifnum \@enumdepth >3 \@toodeep\else
      \advance\@enumdepth \@ne
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
      {\csname label\@enumctr\endcsname}{\usecounter
        {\@enumctr}\def\makelabel##1{\hss\llap{\upshape##1}}}\fi}

\def\itemize{%
  \ifnum\@itemdepth>3 \@toodeep
  \else \advance\@itemdepth\@ne
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \list{\csname\@itemitem\endcsname}%
      {\def\makelabel##1{\hss\llap{\upshape##1}}}%
  \fi}
%
\newcommand{\descriptionlabel}[1]{\hspace\labelsep \upshape\bfseries #1:}
\newcommand{\description}{\list{}{%
%    \end{macrocode}
%    Adjust the indent of the first line to the desired value:
%    \begin{macrocode}
  \advance\leftmargini6\p@ \itemindent-12\p@
  \labelwidth\z@ \let\makelabel\descriptionlabel}}
\let\enddescription=\endlist
%    \end{macrocode}
%
%    Since these margin settings are dependent on the fonts used, we
%    postpone them until begin-document. (This means that we cannot use
%    the values directly for calculations before begin-document.)
%    \begin{macrocode}
\AtBeginDocument{\settowidth\leftmargini{\labelenumi\hspace*\labelsep}%
  \advance\leftmargini by \normalparindent
  \settowidth\leftmarginii{\labelenumii\hspace*\labelsep}%
  \advance\leftmarginii by 15pt
  \settowidth\leftmarginiii{\labelenumiii\hspace*\labelsep}%
  \advance\leftmarginiii by 12pt
  \settowidth\leftmarginiv{\labelenumiv\hspace*\labelsep}%
  \advance\leftmarginiv by 10pt
  \leftmarginv=10pt
  \leftmarginvi=10pt
  \leftmargin=\leftmargini
  \labelsep=5pt
  \labelwidth=\leftmargini \advance\labelwidth-\labelsep
  \@listi}
%    \end{macrocode}
%
%    In some contexts the space above/below lists needs to be
%    suppressed. So we put it into a variable \cs{listisep}.
%    \begin{macrocode}
\newskip\listisep
\listisep\smallskipamount
\def\@listI{\leftmargin\leftmargini \parsep\z@skip
  \topsep\listisep \itemsep\z@skip
  \listparindent\normalparindent}
\let\@listi\@listI
%    \end{macrocode}
%
%    Is it necessary to reset \cs{parsep}, \cs{partopsep}, \cs{itemsep}
%    to their default values (0) in each of the subordinate list
%    setup functions? I don't believe so, but I leave the settings in
%    the listii function just in case some unusual nesting of
%    environments might cause trouble. [mjd,1994/09/22]
%    \begin{macrocode}
\def\@listii{\leftmargin\leftmarginii
  \labelwidth\leftmarginii \advance\labelwidth-\labelsep
  \topsep\z@skip \parsep\z@skip \partopsep\z@skip \itemsep\z@skip}
\def\@listiii{\leftmargin\leftmarginiii
  \labelwidth\leftmarginiii \advance\labelwidth-\labelsep}
\def\@listiv{\leftmargin\leftmarginiv
  \labelwidth\leftmarginiv \advance\labelwidth-\labelsep}
\def\@listv{\leftmargin\leftmarginv
  \labelwidth\leftmarginv \advance\labelwidth-\labelsep}
\def\@listvi{\leftmargin\leftmarginvi
  \labelwidth\leftmarginvi \advance\labelwidth-\labelsep}
%    \end{macrocode}
%
% \subsection{Redefined internal sectioning commands}
%
%    In amsart.sty \cs{@startsection}, \cs{@sect},
%    and a couple of other things are redefined to fix a few hard-coded
%    things that would interfere with the desired style.  The most
%    noteworthy difference is that all section headings will go into the
%    table of contents (governed by secnumdepth as usual), EVEN WHEN THE
%    * FORM IS USED.  The only section heading not listed in the table of
%    contents is the heading for the toc itself.
%    \begin{macrocode}
\def\@startsection#1#2#3#4#5#6{%
%    \end{macrocode}
%    Section titles, if they are run-in with the following text, are
%    stored in a box instead of being typeset right away.  They will be
%    typeset by \cs{everypar}, but if one section heading follows
%    right after another, this won't happen.  So by doing
%    \cs{leavevmode} we force this to happen.  (\cs{if@noskipsec}
%    is true if the previous section title has not yet been typeset.)
%    \begin{macrocode}
 \if@noskipsec \leavevmode \fi
 \par \@tempskipa #4\relax
 \@afterindenttrue
 \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi
 \if@nobreak \everypar{}\else
     \addpenalty\@secpenalty\addvspace\@tempskipa\fi
%    Don't call \@ssect in the ifstar case:
 \@ifstar{\@dblarg{\@sect{#1}{\@m}{#3}{#4}{#5}{#6}}}%
         {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
}
%    \end{macrocode}
%
%       For reference, here is the argument list for \cs{@sect}.
%    \begin{verbatim}
% % #1    #2     #3      #4          #5         #6     #7      #8
% {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}[SHORTT]{TITLE}
%    \end{verbatim}
%    \begin{macrocode}
\def\@sect#1#2#3#4#5#6[#7]#8{%
  \ifnum #2>\c@secnumdepth \let\@thisnumber\@empty
  \else \@xp\let\@xp\@thisnumber\csname the#1\endcsname\fi
%    \end{macrocode}
%    \cs{@svsec} will be the section number plus some formatting if
%    the star form was not used and if the depth of numbering extends to
%    the current level. The user can change secnumdepth to control how
%    many levels of sectioning will be numbered.
%    \begin{macrocode}
 \ifnum #2>\c@secnumdepth
   \let\@svsec\@empty
 \else
   \refstepcounter{#1}%
%    \end{macrocode}
%    If the |*|-form was not used (|#2| less than 1000), we add
%    \cn{sectionname} or whatever as a prefix, separated by a space.
%    We need the ifundefined test in order to know whether the space
%    should be added or not.  There must be a better way to do this
%    but I haven't thought of it yet.
%    \begin{macrocode}
   \edef\@svsec{\ifnum#2<\@m
             \@ifundefined{#1name}{}{%
               \ignorespaces\csname #1name\endcsname\space}\fi
%    \end{macrocode}
%    We add \cn{textup} here in order to make section
%    numbers always roman, even within italic.
%    \begin{macrocode}
    \@nx\textup{\csname the#1\endcsname.}\enspace}%
  \fi
  \@tempskipa #5\relax
  \ifdim \@tempskipa>\z@ % then this is not a run-in section heading
    \begingroup #6\relax
    \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty\@M #8\par}%
    \endgroup
%    \end{macrocode}
%
%    Section headings don't set marks for the running heads in the amsart
%    style, only in the amsbook style.
%    \begin{macrocode}
%<*amsbook>
  \csname #1mark\endcsname{\@thisnumber}{#7}%
%</amsbook>
%    \end{macrocode}
%    If |#2| (level) is greater than 1000 then we don't do a table
%    of contents entry. This happens only for the section heading above
%    the table of contents itself.
%    \begin{macrocode}
  \ifnum#2>\@m \else
    \addcontentsline{toc}{#1}{\protect\numberline{%
      \@ifundefined{#1name}{}{\@xp\protect\csname#1name\endcsname\ }%
      \@thisnumber.}#8}%
  \fi
 \else
%    \end{macrocode}
%    Otherwise we're doing a run-in heading; it is stored as \cs{@svsechd},
%    which will be typeset by \cs{everypar} as soon as some text is
%    encountered.
%    \begin{macrocode}
  \def\@svsechd{#6\hskip #3\@svsec
%    \end{macrocode}
%
%    To allow for the possibility that the user wants an empty section
%    title, leaving just the section number, we check whether \arg{8}
%    is nonempty before adding the period.
%    \begin{macrocode}
    \@ifnotempty{#8}{\ignorespaces#8\unskip
%    \end{macrocode}
%    The following test is to prevent a period being added if the
%    section title ended in a question mark or other punctuation.
%    \begin{macrocode}
       \@addpunct.}%
        \ifnum#2>\@m \else
          \addcontentsline{toc}{#1}%
            {\ifnum #2>\c@secnumdepth \else
              \protect\numberline{%
                \ifnum#2<\@m\@ifundefined{#1name}{}{%
                  \csname #1name\endcsname\ }\fi
                \@thisnumber.}\fi
             #8}\fi}%
  \fi
%    \end{macrocode}
%    In a previous version of amsart \@nobreaktrue was added to \@xsect
%    for some reason. Let's keep that just in case it was done to
%    prevent a certain kind of bug. [mjd,17-Aug-1994]
%    \begin{macrocode}
  \global\@nobreaktrue
%    \end{macrocode}
%    \cs{@xsect} does some more stuff based on whether this is a run-in
%    heading or not.
%    \begin{macrocode}
  \@xsect{#5}}
%
%    Undefine |\@ssect| to save memory; it's not needed in amsart.
%    \begin{macrocode}
\let\@ssect\relax
%    \end{macrocode}
%
%    Allocate counters for sectioning commands. Paragraph counter is
%    allocated but normally not used. Subparagraph counter is not
%    allocated.
%    \begin{macrocode}
\newcounter{part}
%<amsbook>\newcounter{chapter}
%<amsart>\newcounter{section}
%<amsbook>\newcounter{section}[chapter]
%<amsbook>\def\thesection{\arabic{section}}
\newcounter{subsection}[section]
\newcounter{subsubsection}[subsection]
\newcounter{paragraph}[subsubsection]
%    \end{macrocode}
%    Set numbering style for sectioning commands. In a couple of cases
%    resetting is unnecessary but we include the full list here for
%    completeness.
%    \begin{macrocode}
\renewcommand\thepart          {\arabic{part}}
%<amsbook>\renewcommand\thechapter       {\arabic{chapter}}
\renewcommand\thesection       {\arabic{section}}
\renewcommand\thesubsection    {\thesection.\arabic{subsection}}
\renewcommand\thesubsubsection {\thesubsection .\arabic{subsubsection}}
\renewcommand\theparagraph     {\thesubsubsection.\arabic{paragraph}}
%    \end{macrocode}
%    Depth of section numbering; if \verb'secnumdepth' were 2 instead of
%    3, \cn{subsubsection} would not be numbered.
%    \begin{macrocode}
\setcounter{secnumdepth}{3}
%    \end{macrocode}
%
%      The arguments of \cs{@startsection} are given for reference:
%    \begin{verbatim}
% % #1    #2     #3      #4          #5         #6
% {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}
%    \end{verbatim}
%
%    \begin{macrocode}
\def\partname{Part}
%<*amsart>
\def\part{\@startsection{part}{0}%
  \z@{\linespacing\@plus\linespacing}{.5\linespacing}%
  {\normalfont\bfseries\raggedright}}
%</amsart>
%    \end{macrocode}
%    In the book class \cn{part} puts the part title on a separate
%    page.
%    \begin{macrocode}
%<*amsbook>
\def\part{\cleardoublepage \thispagestyle{empty}%
  \null\vfil  \markboth{}{}\secdef\@part\@spart}
%
\def\@part[#1]#2{%
  \ifnum \c@secnumdepth >-2\relax \refstepcounter{part}%
    \addcontentsline{toc}{part}{\partname\ \thepart.
        \protect\enspace\protect\noindent#1}%
  \else
    \addcontentsline{toc}{part}{#1}\fi
  \begingroup\centering
  \ifnum \c@secnumdepth >-2\relax
       {\fontsize{\@xviipt}{22}\bfseries
         \partname\ \thepart} \vskip 20\p@ \fi
  \fontsize{\@xxpt}{25}\bfseries
      #1\vfil\vfil\endgroup \newpage\thispagestyle{empty}}

\def\@spart#1{\addcontentsline{toc}{part}{\protect\noindent#1}%
  \begingroup\centering
  \fontsize{\@xxpt}{25}\bfseries
     #1\vfil\vfil\endgroup \newpage\thispagestyle{empty}}
%</amsbook>
%    \end{macrocode}
%
%    The arguments of \cn{partrunhead} are \cn{partname},
%    \cn{thepart}, and the text of the part title. The first two were
%    fully expanded during the marking process. Use of a mere
%    interword space between the first two args makes it possible
%    to apply \cn{ignorespaces} and \cn{unskip} as shown here
%    to produce the desired results if one or the other is empty.
%    \begin{macrocode}
%<*amsbook>
\def\partrunhead#1#2#3{%
  \@ifnotempty{#2}{\uppercase{#1 #2}\@ifnotempty{#3}{. }}%
  \def\@tempa{#3}%
  \ifx\@empty\@tempa\else\uppercasenonmath\@tempa\@tempa\fi}
\let\chapterrunhead\partrunhead
\let\sectionrunhead\partrunhead
%</amsbook>
%    \end{macrocode}
%
%      Section headings in the amsbook style differ from the amsart
%      style in a couple of ways: The ones that aren't centered are
%      indented on the left, instead of flush left; and the first
%      level, \cn{section}, is not small caps but bold.
%    \begin{macrocode}
%      Cf.~the definition of \cn{appendix}.
\def\section{\@startsection{section}{1}%
  \z@{.7\linespacing\@plus\linespacing}{.5\linespacing}%
%<amsart>  {\normalfont\scshape\centering}}
%<amsbook>  {\normalfont\bfseries\centering}}
%    \end{macrocode}
%
%    Negative value for \arg{5} is a signal to make a run-in heading instead
%    of doing a vskip after the heading.
%    \begin{macrocode}
\def\subsection{\@startsection{subsection}{2}%
%<amsart>  \z@{.5\linespacing\@plus.7\linespacing}{-.5em}%
%<amsbook>  \normalparindent{.5\linespacing\@plus.7\linespacing}{-.5em}%
  {\normalfont\bfseries}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\subsubsection{\@startsection{subsubsection}{3}%
%<amsart>  \z@{.5\linespacing\@plus.7\linespacing}{-.5em}%
%<amsbook>  \normalparindent\z@{-.5em}%
  {\normalfont\itshape}}
%    \end{macrocode}
%
%    Fontdimen 2 of the current font is the ideal interword space of the
%    font. Thus the following spec says that the space after the
%    paragraph heading should be a normal interword space (but
%    nonstretching and nonshrinking).
%    \begin{macrocode}
\def\paragraph{\@startsection{paragraph}{4}%
%<amsart>  \z@\z@{-\fontdimen2\font}%
%<amsbook>  \normalparindent\z@{-\fontdimen2\font}%
  \normalfont}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\subparagraph{\@startsection{subparagraph}{5}%
  \z@\z@{-\fontdimen2\font}%
  \normalfont}
%    \end{macrocode}
%
%    \begin{macrocode}
%<*amsart>
\def\appendix{\par\c@section\z@ \c@subsection\z@
   \let\sectionname\appendixname
   \def\thesection{\@Alph\c@section}}
%</amsart>
%    \end{macrocode}
%
%    \begin{macrocode}
\def\appendixname{Appendix}
%    \end{macrocode}
%
%    A slower, but fully expandable definition of \cs{@Roman} to avoid
%    the nonexpandable \cs{uppercase} which is undesirable in certain
%    circumstances.
%    \begin{macrocode}
\def\@Roman#1{\@xp\@slowromancap
  \romannumeral#1@}%
%
\def\@slowromancap#1{\ifx @#1% then terminate
  \else
%    \end{macrocode}
%    Note: \cs{if} is required here, not \cs{ifx}, because
%    \cs{romannumeral} returns category 12 letters!
%    \begin{macrocode}
    \if i#1I\else\if v#1V\else\if x#1X\else\if l#1L\else\if
    c#1C\else\if m#1M\else#1\fi\fi\fi\fi\fi\fi
    \@xp\@slowromancap
  \fi
}
%    \end{macrocode}
%
% \subsection{Book features}
%    Books (monographs) comprise three distinct sections,
%    \cn{frontmatter}, \cn{mainmatter}, and \cn{backmatter}.  The
%    \cn{frontmatter} would consist of the title page, copyright page,
%    table of contents, preface, etc.  The \cn{mainmatter} would
%    be the body of the book.  The \cn{backmatter} would include the
%    appendix, bibliography, glossary, and index.
%    \begin{macrocode}
%<*amsbook>
\def\frontmatter{\cleardoublepage\pagenumbering{roman}}
\def\mainmatter{\cleardoublepage\pagenumbering{arabic}}
\def\backmatter{\cleardoublepage}
%</amsbook>
%    \end{macrocode}
%
%    Book proceedings and monographs allow a signature to print at the
%    end of a preface.
%<*!amsart>
\def\aufm #1\endaufm{\vspace*{12pt}{\flushright #1\endgraf}}
%</!amsart>
%
% \subsection{Book chapters}
%    The \cn{chapter} command is provided only in the amsbook class, not
%    in the amsart class.
%    \begin{macrocode}
%<*amsbook>
\def\chapter{\cleardoublepage \thispagestyle{plain}\global\@topnum\z@
  \@afterindentfalse \secdef\@chapter\@schapter}
%
\def\@chapter[#1]#2{\refstepcounter{chapter}%
  \ifnum \c@secnumdepth <\z@ \let\thechapter\@empty\fi
  \typeout{\chaptername\space\thechapter}%
  \addcontentsline{toc}{chapter}{%
    \protect\numberline{%
      \ifx\thechapter\@empty\else\chaptername\ \thechapter.\fi}#1}%
  \chaptermark\thechapter{#1}%
  \addtocontents{lof}{\protect\addvspace{10\p@}}%
  \addtocontents{lot}{\protect\addvspace{10\p@}}%
  \@makechapterhead{#2}\@afterheading}
%
\def\@schapter#1{\typeout{#1}%
  \addcontentsline{toc}{chapter}{#1}%
  \chaptermark{}{#1}%
  \addtocontents{lof}{\protect\addvspace{10\p@}}%
  \addtocontents{lot}{\protect\addvspace{10\p@}}%
  \@makeschapterhead{#1}\@afterheading}
%
\def\chaptername{Chapter}
\def\thechapter{\@arabic\c@chapter}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@makechapterhead#1{\global\topskip 8.5pc\relax
  \begingroup
  \fontsize{\@xivpt}{18}\bfseries\centering
%    \end{macrocode}
%      In order to keep the chapter number ``CHAPTER III'' from
%      getting in the way of the \cs{topskip} we put it inside
%      the paragraph containing the main title.  Then we have to
%      do some laborious \cs{rlap}ing and \cs{hskip}ing to
%      position it correctly.
%    \begin{macrocode}
    \ifnum\c@secnumdepth>\m@ne
      \leavevmode \hskip-\leftskip
      \rlap{\vbox to\z@{\vss
          \centerline{\normalsize\mdseries
              \uppercase\@xp{\chaptername}\enspace\thechapter}
          \vskip 2pc}}\hskip\leftskip\fi
     #1\par \endgroup
  \skip@34\p@ \advance\skip@-\normalbaselineskip
  \vskip\skip@ }
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@makeschapterhead#1{\global\topskip 8.5pc\relax
  \begingroup
  \fontsize{\@xivpt}{18}\bfseries\centering
  #1\par \endgroup
  \skip@34\p@ \advance\skip@-\normalbaselineskip
  \vskip\skip@ }
%</amsbook>
%    \end{macrocode}
%    The \cn{appendix} command, following the LaTeX book, marks the
%    start of a division after \cn{mainmatter} and before
%    \cn{backmatter} that consists of appendixes.
%    \begin{macrocode}
%<*amsbook>
\def\appendix{\par
  \c@chapter\z@ \c@section\z@
  \def\chaptername{Appendix}%
  \def\thechapter{\@Alph\c@chapter}}
%</amsbook>
%    \end{macrocode}
%
% \subsection{Table of contents macros}
%
%    \cs{@pnumwidth} is the maximum width for page numbers in a table of
%    contents.  1.6em allows enough room for three digits.
%    \begin{macrocode}
\newcommand{\@pnumwidth}{1.6em}
%    \end{macrocode}
%    \cs{@tocrmarg} is \cs{@pnumwidth} plus the desired minimum
%    space (1em) between page numbers and the preceding text.
%    \begin{macrocode}
\newcommand{\@tocrmarg}{2.6em}
%<amsart>\setcounter{tocdepth}{2}
%<amsbook>\setcounter{tocdepth}{1}
%    \end{macrocode}
%
%    \cn{tableofcontents} is like \cn{chapter} or \cn{section} except
%    for no number and no table of contents entry.
%    \begin{verbatim}
%    Arguments: {} = name = empty
%    \@M = no number should be used and no table of contents entry
%    \z@ = indent amount
%    12pt + 12pt = vskip before
%    6pt = vskip after
%    \centering\scshape = format
%    \end{verbatim}
%
%      Since table of contents, list of figures and list of figures
%      are identical in design as far as the chapter heading and other
%      preliminaries go, we redefine \cs{@starttoc} to do the necessary
%      work, rather than defining a new macro (which would use up another
%      control sequence name).
%    \begin{macrocode}
\def\@starttoc#1#2{\begingroup
%    \end{macrocode}
%    Remove the skip after the abstract so that we can substitute another
%    \begin{macrocode}
%<*amsart>
  \removelastskip\vskip\z@skip
%    \end{macrocode}
%    The first two arguments of |\@startsection| here are special values
%    that cause different internal branches to be taken.
%    \begin{macrocode}
  \@startsection{}\@M\z@{\linespacing\@plus\linespacing}{.5\linespacing}%
    {\centering\scshape}\contentsname
%</amsart>
%    \end{macrocode}
%      Inside this group we change \cs{secdef} so that we can call
%      \cn{chapter} and only get the preliminary part of its definition
%      that we need.
%    \begin{macrocode}
%<amsbook>  \let\secdef\@gobbletwo \chapter
%    \end{macrocode}
%      If we have a list of figures or list of tables we want to put
%      them in the main table of contents, but we don't want to put an
%      entry there for the main table of contents itself. So we check
%      to see if argument 2 is \cn{contentsname} and if it is then
%      we refrain from doing \cn{addcontentsline}.
%    \begin{macrocode}
  \ifx#2\contentsname \else
%<amsbook>    \addcontentsline{toc}{chapter}#2\fi
%<amsart>    \addcontentsline{toc}{section}#2\fi
%    \end{macrocode}
%      Now we do the equivalent of \cs{@schapter}.
%    \begin{macrocode}
%<amsbook>  \typeout#2\chaptermark{}#2\@makeschapterhead#2\@afterheading
%    \end{macrocode}
%      And finally we call in the original definition of
%      \cs{@starttoc}.
%    \begin{macrocode}
  \makeatletter
  \@input{\jobname.#1}%
  \if@filesw
    \@xp\newwrite\csname tf@#1\endcsname
    \immediate\@xp\openout\csname tf@#1\endcsname \jobname.#1\relax
  \fi
  \global\@nobreakfalse \endgroup
%    \end{macrocode}
%
%    \begin{macrocode}
%<*amsart>
  \addvspace{32\p@\@plus14\p@}%
  \let\tableofcontents\relax \let\l@part\relax \let\l@section\relax
  \let\l@subsection\relax \let\l@subsubsection\relax
%</amsart>
%<amsbook>  \newpage
}
%    \end{macrocode}
%      Now it is easy to define \cn{tableofcontents} and its relatives.
%    \begin{macrocode}
\def\contentsname{Contents}
\def\listfigurename{List of Figures}
\def\listtablename{List of Tables}
\def\tableofcontents{\@starttoc{toc}\contentsname}
\def\listoffigures{\@starttoc{lof}\listfigurename}
\def\listoftables{\@starttoc{lot}\listtablename}
%    \end{macrocode}
%
%    \begin{macrocode}
%<*amsbook>
\newskip\chaptocamount
\chaptocamount=8pt
\newbox\TestChapwd
\newbox\TestAppwd
\newbox\TestSectwd
\newbox\TestFigwd
\setbox\TestChapwd=\hbox{Chapter 1.\hskip1em}%
\setbox\TestAppwd=\hbox{Appendix M.\hskip1em}%
\setbox\TestSectwd=\hbox{0.0.\hskip1em}%
\setbox\TestFigwd=\hbox{0.0.\hskip1em}%
\def\numberline#1{\hbox to\@tempdima{\hfill#1\hskip1em}}%
\def\chapterline#1{\hbox to\@tempdima{#1\hfill}}%
%</amsbook>
%    \end{macrocode}
%    \cs{@tocline} is a modified form of
%    \cs{@dottedtocline} for higher-level section titles.
%    Arguments: ABOVESKIP, NUMBER WIDTH, STYLE, TEXT, PAGE.
%    \begin{macrocode}
%<*amsart>
\def\@tocline#1#2#3#4#5{\par
  \addpenalty\@secpenalty\addvspace{#1}%
  \begingroup   \@tempdima#2\relax % used by \numberline
  \parindent\z@ \rightskip\@pnumwidth \parfillskip-\@pnumwidth
  {#3\leavevmode #4\hfil \hbox to\@pnumwidth{\hss #5}}\par\nobreak
  \endgroup}
%</amsart>
%<*amsbook>
\def\@tocline#1#2#3#4#5#6{\par
  \addpenalty\@secpenalty\addvspace{#1}%
  \begingroup
\hyphenpenalty=10000
\@tempdima#3\relax
  \parindent\z@ \leftskip#2\relax \advance\leftskip by #3\relax
  \rightskip\@pnumwidth \parfillskip-\@pnumwidth
  {#4\leavevmode\hskip-\@tempdima #5\relax
        \hfil\hbox to\@pnumwidth{\hss {\mdseries #6}}}\par\nobreak
  \endgroup}
%</amsbook>
%    \end{macrocode}
%
%    \begin{macrocode}
%<amsart>\def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
%<*amsbook>
\def\l@figure{\@tocline\bigskipamount
   {0pt}{\wd\TestFigwd}{\upshape}}
%</amsbook>
\let\l@table=\l@figure
%    \end{macrocode}
%
%    \begin{macrocode}
%<amsart>\def\l@part{\@tocline\bigskipamount{2em}{\upshape\bfseries}}
%    \end{macrocode}
%
%    To print a part title in the table of contents, we make it like
%    a centered section heading since it is a major division.
%    Argument \arg{2}, the page number is discarded because
%    \cn{part} will normally be followed immediately by
%    \cn{chapter}, whose page number can be used for reference.
%    \begin{macrocode}
%<*amsbook>
\def\l@chapter{\@tocline\chaptocamount{0pt}{\wd\TestChapwd}{\upshape}}
\def\l@appendix{\@tocline\chaptocamount{0pt}{\wd\TestAppwd}{\upshape}}
\def\l@section{\@tocline{0pt}{1pc}{\wd\TestSectwd}{\upshape}}
\def\l@subsection{\@tocline{0pt}{1pc}{5pc}{\upshape}}
\def\l@subsubsection{\@tocline{0pt}{1pc}{7pc}{\upshape}}
\def\l@part{\@tocline{12pt plus 2pt}{0pt}{0pt}{\upshape\bfseries}}
%</amsbook>
%    \end{macrocode}
%
%    Redefine \cs{@dottedtocline} to remove the dots.  But retain the
%    same name in order not to use up another control sequence name.
%
%    Example lines from .toc file:
%    \begin{verbatim}
%    \contentsline {section}{\numberline {2.}Top matter}{3}
%    \contentsline {subsection}{\numberline {2.1.}AT: Article Title}{3}
%    \end{verbatim}
%    Arguments: LEVEL, NUMBER WIDTH, EXTRA SEP, NUMBER/TEXT, PAGE
%    \begin{macrocode}
\def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
  \vskip \z@\@plus\p@
  {\leftskip #2\relax \rightskip\@tocrmarg \parfillskip-\rightskip
   \parindent #2\relax \@afterindenttrue
   \interlinepenalty\@M \leavevmode
   \@tempdima #3\relax \advance\leftskip\@tempdima
    \null \hskip-\leftskip #4\nobreak
        \hfill\nobreak
%    \end{macrocode}
%    We omit the page numbers from the highest-numbered level (= lowest,
%    least-important level) of sectioning.
%    \begin{macrocode}
  \ifnum#1<\c@tocdepth\hbox to\@pnumwidth{\hfil\upshape#5}\fi
  \null\par}\fi}
%    \end{macrocode}
%    In order to avoid having the number overlap the following text,
%    we change the definition of \cs{numberline} so that
%    if \cs{@tempdima} is not big enough, the natural width of the
%    number is used.
%    \begin{macrocode}
\def\numberline#1{\@ifnotempty{#1}{%
  \sbox\z@{#1\enspace}%
  \ifdim\wd\z@>\@tempdima \box\z@\else \hbox to\@tempdima{#1\hfil}\fi
}}
%    \end{macrocode}
%    These definitions set up the form of table of contents entries for
%    section, subsection, subsubsection and paragraph.
%    \begin{macrocode}
%<*amsart>
\def\l@section{\@tocline\medskipamount{2em}{\upshape\bfseries}}
\def\l@subsection{\@dottedtocline\tw@{1.5em}{2.3em}}
\def\l@subsubsection{\@dottedtocline\thr@@{3.8em}{3.2em}}
\def\l@paragraph{\@dottedtocline4{7em}{4.1em}}
%    \end{macrocode}
%</amsart>
%
%    Bibliography setup.  Following babel.sty, we use
%    \cn{refname} in articles and \cn{bibname} in books.
%    \begin{macrocode}
\def\refname{References}
\def\bibname{Bibliography}
%
\def\bibliographystyle#1{%
   \if@filesw\immediate\write\@auxout
    {\string\bibstyle{#1}}\fi
        \def\@tempa{#1}%
        \def\@tempb{amsplain}%
        \def\@tempc{}%
        \ifx\@tempa\@tempb
                \def\@biblabel##1{##1.}%
                \def\bibsetup{}%
        \else
                \def\bibsetup{\labelsep6\p@}%
        \ifx\@tempa\@tempc
                \def\@biblabel##1{}%
                \def\bibsetup{\labelwidth\z@ \leftmargin24\p@
                \itemindent-24\p@
                          \labelsep\z@ }%
        \fi
\fi}
\newenvironment{thebibliography}[1]{%
%<amsart>  \@xp\section\@xp*\@xp{\refname}%
%<amsbook>  \@xp\chapter\@xp*\@xp{\bibname}%
  \normalfont\footnotesize\labelsep .5em\relax
  \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
  \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
    \leftmargin\labelwidth \advance\leftmargin\labelsep
    \usecounter{enumiv}}%
  \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
  \sfcode`\.=\@m
}{%
%    \end{macrocode}
%    Change error for empty list (no items) to warning, to allow authors
%    to leave their bibliography temporarily empty during writing:
%    \begin{macrocode}
  \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
  \endlist
}
%    \end{macrocode}
%
%    The \cn{bysame} command prints a horizontal dash indicating
%    repetition of the author's name in consecutive bibliography
%    entries.
%    \begin{macrocode}
\def\bysame{\leavevmode\hbox to3em{\hrulefill}\thinspace}
%    \end{macrocode}
%    We define \cn{newblock} even though it's not needed for AMS
%    publication style, just to avoid error messages when a non-AMS
%    \fn{.bst} file is used. This is a convenience for users; use of
%    \cn{newblock} is not recommended for submissions to the AMS.
%    \begin{macrocode}
\def\newblock{}
%    \end{macrocode}
%
%    Chapter or section heading for an index. Index is set up to be two
%    columns.
%    \begin{macrocode}
\newif\if@restonecol
%    \end{macrocode}
%
%    \begin{macrocode}
%<*amsbook>
\def\indexchap{\@startsection{chapter}{1}{\z@}{92pt}{10pc}%
  {\centering\fontsize{\@xivpt}{18}\bfseries}}%
%</amsbook>
%    \end{macrocode}
%
%    \begin{macrocode}
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
  \columnseprule\z@ \columnsep 35\p@
%<*amsbook>
  \twocolumn[\@xp\indexchap\@xp*\@xp{\indexname}]%
  \chaptermark{}\indexname
%</amsbook>
%<amsart>  \twocolumn[\@xp\section\@xp*\@xp{\indexname}]%
  \thispagestyle{plain}%
  \let\item\@idxitem
  \parindent\z@  \parskip\z@\@plus.3\p@\relax
  \footnotesize}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\indexname{Index}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@idxitem{\par\hangindent 2em}
\def\subitem{\par\hangindent 2em\hspace*{1em}}
\def\subsubitem{\par\hangindent 3em\hspace*{2em}}
\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
\def\indexspace{\par\bigskip}
%    \end{macrocode}
%
% \subsection{Footnotes}
%    In books the footnote counter should reset to 0 at the beginning of
%    each chapter:
%    \begin{macrocode}
%<amsbook>\@addtoreset{footnote}{chapter}
%    \end{macrocode}
%
%    Rule above footnotes is 5 picas wide.
%    \begin{macrocode}
\def\footnoterule{\kern-.4\p@
        \hrule\@width 5pc\kern11\p@\kern-\footnotesep}
%
\def\@makefnmark{\hbox{$\m@th^{\@thefnmark}$}}
%
\def\@makefntext{\indent\@makefnmark}
%    \end{macrocode}
%    Add \cn{normalfont} before \cn{footnotesize} so that
%    fonts will come out properly using the new font selection scheme.
%    \begin{macrocode}
\long\def\@footnotetext#1{\insert\footins{%
  \normalfont\footnotesize
  \interlinepenalty\interfootnotelinepenalty
  \splittopskip\footnotesep \splitmaxdepth \dp\strutbox
  \floatingpenalty\@MM \hsize\columnwidth
%    \end{macrocode}
%    Mostly \cs{@parboxrestore} does what we want; but not with
%    respect to \cs{parindent} and \cs{tolerance}.
%    \begin{macrocode}
  \@parboxrestore \parindent\normalparindent \sloppy
  \edef\@currentlabel{\p@footnote\@thefnmark}%
  \@makefntext{\rule\z@\footnotesep\ignorespaces#1\unskip\strut\par}}}
%    \end{macrocode}
%    We change \cn{sloppy} to keep it from overriding our normal value of
%    1pt for \cs{hfuzz} and \cs{vfuzz} with a LESS sloppy value (.5pt).
%    \begin{macrocode}
\hfuzz=1pt \vfuzz=\hfuzz
\def\sloppy{\tolerance9999\relax}
%    \end{macrocode}
%
% \section{Float placement parameters}
%    These control the placing of floating objects like tables and
%    figures. We use much more tolerant values than the LaTeX defaults;
%    the LaTeX defaults are geared to fussier page breaks, at a price of
%    requiring more manual intervention to deal with difficult page
%    breaking problems.
%
%    When using LaTeX's twocolumn option, `page' really means `column',
%    for the parameters that don't have a dbl prefix: that is, topnumber
%    is then the maximum number of top figures allowed in each column,
%    and so forth.
% \begin{description}
% \item[topnumber] maximum number of top figures allowed per page
% \item[bottomnumber] maximum number of bottom figures allowed per page
% \item[totalnumber] maximum number of figures (top and bottom) allowed
%    per page
% \item[dbltopnumber] same as topnumber, but for two-column wide
%    figures, when double-column format is used
% \end{description}
%    \begin{macrocode}
\setcounter{topnumber}{4}
\setcounter{bottomnumber}{4}
\setcounter{totalnumber}{4}
\setcounter{dbltopnumber}{4}
%    \end{macrocode}
%    Float fraction parameters.
% \begin{description}
% \item[\cn{topfraction}] maximum part of the page allowed for top
%    figures, expressed as a decimal fraction. The value of .97 means
%    roughly `accept pages that have only two lines of text, and the
%    rest figures'.
% \item[\cn{bottomfraction}] same as \topfraction, but for bottom
%    figures
% \item[\cn{textfraction}] \emph{minimum} part of the page that must be
%    occupied by text, if the page is to have any text at all. If this
%    value cannot be achieved, \latex/ will turn the current figure or
%    figures into a ``float page'', i.e., a page of figures without any
%    text.
% \item[\cn{floatpagefraction}] minimum amount (that is, total combined
%    height) of figures needed before LaTeX will make a float page. This
%    is expressed as a fraction of the normal page height.
% \item[\cn{dbltopfraction}] like \topfraction, but applies only to
%    figures that are two columns wide, when double-column format is
%    used.
% \item[\cn{dblfloatpagefraction}] minimum amount of double-column
%    figure material needed before LaTeX will make a two-column wide
%    ``float page''
% \end{description}
%    \begin{macrocode}
\renewcommand{\topfraction}{.97}
\renewcommand{\bottomfraction}{.97}
\renewcommand{\textfraction}{.03}
\renewcommand{\floatpagefraction}{.9}
\renewcommand{\dbltopfraction}{.97}
\renewcommand{\dblfloatpagefraction}{.9}
%    \end{macrocode}
%
%    We also modify the default values for spacing around floating
%    figures: (A) so that figures on a float page will not be
%    vertically centered on the total page height but will
%    be flush at the top of the page, and (B) so that there will
%    be slightly more stretchability around figures, to help find better
%    page breaks in difficult situations.
%
% \begin{description}
% \item[\cn{floatsep}] Space between consecutive figures
% \item[\cn{textfloatsep}] Space between text and top or bottom figures
% \item[\cn{intextsep}] Space above and below a figure in the middle of
%    the text (i.e., placed with the [h] option)
% \item[\cn{dblfloatsep}] Space between consecutive figures that are
%    two columns wide (when two-column format is used)
% \item[\cn{dbltextfloatsep}] Space between double-column figures and text
% \item[\cn{@fptop}] Space above the first figure on a float page
% \item[\cn{@fpsep}] Space between figures on a float page
% \item[\cn{@fpbot}] Space below the last figure on a float page
% \item[\cn{@dblfptop}] Space above the first double-column figure on a
%    two-column wide float page
% \item[\cn{@dblfptop}] Space between double-column figures on a  two-column
%    wide float page
% \item[\cn{@dblfptop}] Space below the last double-column figure on a
%    two-column wide float page
% \end{description}
%    \begin{macrocode}
\setlength{\floatsep}{12pt plus 6pt minus 4pt}
\setlength{\textfloatsep}{15pt plus 8pt minus 5pt}
\setlength{\intextsep}{12pt plus 6pt minus 4pt}
\setlength{\dblfloatsep}{12pt plus 6pt minus 4pt}
\setlength{\dbltextfloatsep}{15pt plus 8pt minus 5pt}
\setlength{\@fptop}{0pt}% removed ``plus 1fil''
\setlength{\@fpsep}{8pt}% removed ``plus 2fil''
\setlength{\@fpbot}{0pt plus 1fil}
\setlength{\@dblfptop}{0pt}% removed ``plus 1fil''
\setlength{\@dblfpsep}{8pt}% removed ``plus 2fil''
\setlength{\@dblfpbot}{0pt plus 1fil}
%    \end{macrocode}
%
%    \cn{fps@figure}, \cn{fps@table}: placement specifications for
%    \env{figure} and \env{table} environments. `tbp' means that a
%    figure will be placed at the top or bottom of a page, or on a
%    separate page with no text. This might be changed to `tp', for
%    example, if you never want figures to appear at the bottom of a
%    page.
%    \begin{macrocode}
\newcommand{\fps@figure}{tbp}
\newcommand{\fps@table}{tbp}
%    \end{macrocode}
%
%    Some more setup for figures.
%    \begin{macrocode}
%<amsart>\newcounter{figure}
%<amsbook>\newcounter{figure}[chapter]
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename\ \thefigure}
\def\figurename{Figure}
\def\figure{\@float{figure}}
\let\endfigure=\end@float
%    \end{macrocode}
%    And similar for tables.
%    \begin{macrocode}
%<amsart>\newcounter{table}
%<amsbook>\newcounter{table}[chapter]
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename\ \thetable}
\def\tablename{Table}
\def\table{\@float{table}}
\let\endtable=\end@float
%    \end{macrocode}
%    This is what we want \cs{@makecaption} to do: If the total width is
%    greater than normal columnwidth we want to break the caption into
%    lines using a line width of $W$ = (columnwidth - 6pc), and center the
%    resulting block between the margins. Otherwise we want to set the
%    caption as a single line, centered between the margins.
%
%    To do this we set the caption as a vbox with line width $W$,
%    except that we allow the last line (which may be the only line) to
%    have width up to full columnwidth by adding a kern of -6pc. If the
%    result is a single hbox (i.e., a single line) we need to unpack the
%    hbox, remove rightskip, parfillskip, and the -6pc kern, and center
%    the remaining material. If the caption is more than one line, then
%    box 1 contains the last line, which we need to unpack in the same
%    way, and run through the paragraphing process again (because this
%    last line may be up to 6 picas wider than the desired width).
%
%    Finally, if the caption is for a figure, it will be set below the
%    figure, so the separating space goes above the caption;  otherwise
%    the separating space goes below the caption.
%    \begin{macrocode}
\long\def\@makecaption#1#2{%
%    \end{macrocode}
%    Measure the contents of the caption.  If |#2| is not
%    empty, then we must add a period and an en-space before
%    typesetting it.  The \cs{@caption} macro adds an extra
%    \cs{ignorespaces} at the beginning of |#2|, so in order
%    to find out if the user-typed portion is empty we use
%    \cs{@cdr} to pull off the \cs{ignorespaces}.
%    \begin{macrocode}
%    Use color-safe commands
  \setbox\@tempboxa\vbox{\color@setgroup
    \advance\hsize-6pc\noindent
    \scshape#1\@xp\@ifnotempty\@xp
        {\@cdr#2\@nil}{.\upshape\enspace#2}%
    \unskip\kern-6pc\par
    \global\setbox\@ne\lastbox\color@endgroup}%
  \ifhbox\@ne % the normal case
    \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
  \fi
%    \end{macrocode}
%    If \cs{@tempboxa} is not empty at this point then the caption was
%    more than one line long or there was extra vertical mode material,
%    maybe a \cs{write} (from \cn{index} or something).
%    Interestingly, we can't use \cs{ifvoid} to see if
%    \cs{@tempboxa} is empty, because empty is not the same thing
%    as void (as far as the \cs{ifvoid} test is concerned).  So
%    instead we measure the width of \cs{@tempboxa}
%    to see if it's zero; this should suffice for non-bizarre cases.
%    \begin{macrocode}
  \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
    \setbox\@ne\hbox to\columnwidth{\hss\kern-6pc\box\@ne\hss}%
  \else % tempboxa contained more than one line
    \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip
        \noindent\unhbox\@ne\advance\hsize-6pc\par}%
\fi
  \ifnum\@tempcnta<64 % if the float IS a figure...
    \addvspace\abovecaptionskip
    \moveright 3pc\box\@ne
  \else % if the float IS NOT a figure...
    \moveright 3pc\box\@ne
    \nobreak
    \vskip\belowcaptionskip
  \fi
\relax
}
%    \end{macrocode}
%    Allocate the skip registers for above and below caption space.
%    \begin{macrocode}
\newskip\abovecaptionskip \abovecaptionskip=12pt \relax
\newskip\belowcaptionskip \belowcaptionskip=12pt \relax
%    \end{macrocode}
%
% \subsection{Theorems and related structures}
%
%    The handling of theorem environments is broken out into a separate
%    package so that it can be used independently of the amsart/amsbook
%    document classes.
%    \begin{macrocode}
\RequirePackage{amsthm}
%    \end{macrocode}
%
%    We need to make a couple of small modifications in theorem style:
%    the default style provided by the \pkg{amsthm} package is tailored
%    a little bit to the generic \cls{article} and \cls{book} document
%    classes.
%
%    Use a wider space after the number if it is swapped to the left.
%    \begin{macrocode}
\def\@swapped#1#2{#2%
  \@ifnotempty{#1}{\@addpunct{.}\quad#1\unskip}}
%    \end{macrocode}
%
%      Some theorem style parameters that vary from the defaults of the
%      \pkg{amsthm} package are set here.
%    \begin{macrocode}
\def\th@plain{%
%<amsart>  \let\theoremindent\noindent
%<amsbook>  \let\theoremindent\indent
%<amsart>  \theoremheadfont{\bfseries}% heading font bold
%<amsbook>  \theoremheadfont{\scshape}% heading font small caps
  \theoremnotefont{\mdseries\upshape}
  \theorempreskipamount.5\baselineskip\@plus.2\baselineskip
                                    \@minus.2\baselineskip
  \theorempostskipamount\theorempreskipamount
  \itshape
}
\def\th@remark{%
%<amsart>  \let\theoremindent\noindent
%<amsbook>  \let\theoremindent\indent
%<amsart>  \theoremheadfont{\itshape}% heading font bold
%<amsbook>  \theoremheadfont{\scshape}% heading font small caps
  \theoremnotefont{\mdseries\upshape}%
  \theorempreskipamount.5\baselineskip\@plus.2\baselineskip
                                    \@minus.2\baselineskip
  \theorempostskipamount\theorempreskipamount
  \upshape
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\th@definition{%
%<amsart>  \let\theoremindent\noindent
%<amsbook>  \let\theoremindent\indent
%<amsart>  \theoremheadfont{\bfseries}% heading font bold
%<amsbook>  \theoremheadfont{\scshape}% heading font small caps
  \theoremnotefont{\mdseries\upshape}%
  \theorempreskipamount.5\baselineskip\@plus.2\baselineskip
                                    \@minus.2\baselineskip
  \theorempostskipamount\theorempreskipamount
  \upshape
}
%    \end{macrocode}
%
%    In the amsbook style the \env{proof} environment uses paragraph
%    indent, and small caps instead of italic for the word ``Proof''.
%    \begin{macrocode}
%<*amsbook>
\renewenvironment{proof}[1][\proofname]{\par \normalfont
  \topsep6\p@\@plus6\p@ \trivlist \itemindent\normalparindent
  \item[\hskip\labelsep\scshape
    #1\@addpunct{.}]\ignorespaces
}{%
  \qed\endtrivlist
}
%</amsbook>
%    \end{macrocode}
%
%    For backward compatibility with version 1.1 of \cls{amsart}, we
%    define \env{pf}, \env{pf*} environments.
%    \begin{macrocode}
\newenvironment{pf}{\proof[\proofname]}{\endproof}
\newenvironment{pf*}[1]{\proof[#1]}{\endproof}
%    \end{macrocode}
%
% \subsection{Miscellaneous}
%
%    Redefine {@biblabel} to do nothing if the argument is empty. We
%    don't really care what the previous definition was so we don't
%    check it.
%    \begin{macrocode}
\def\@biblabel#1{\@ifnotempty{#1}{[#1]}}
%    \end{macrocode}
%    Changed \cs{@cite} to always use roman/upright, nonbold font, even
%    in italic or bold text (following AMS style).
%    \begin{macrocode}
\def\@cite#1#2{{%
%    \end{macrocode}
%    Turn off mathsurround just in case there are subscripts in the cite
%    numbers.
%    \begin{macrocode}
%<amsart>  \m@th\upshape\mdseries[{#1\if@tempswa, #2\fi}]}}
%<amsbook> \m@th\upshape\mdseries[{\bfseries #1}{\if@tempswa, #2\fi}]}}
%    \end{macrocode}
%
%  \begin{macro}{\fullwidthdisplay}
%    The function \cn{fullwidthdisplay} makes a displayed equation take
%    up the full column width even if the current context is an indented
%    list.
%    \begin{macrocode}
\def\fullwidthdisplay{\displayindent\z@ \displaywidth\columnwidth}
%    \end{macrocode}
%    And we insert the \cn{fullwidthdisplay} function at the beginning of
%    \cn{everydisplay} just in case any later code in \cn{everydisplay}
%    needs to use the values of \cn{displayindent} or \cn{displaywidth}.
%    \begin{macrocode}
\edef\@tempa{\noexpand\fullwidthdisplay\the\everydisplay}
\everydisplay\expandafter{\@tempa}
%    \end{macrocode}
%  \end{macro}
%
%    A few odds and ends for indexes:
%    \begin{macrocode}
\newcommand\seename{see also}%
\newcommand\see[2]{{\em \seename\/} #1}%
\newcommand\printindex{\@input{\jobname.ind}}%
%    \end{macrocode}
%
% \subsection{Book style variations}
%    Here is the layout for a \cn{maketitle} in the \cls{amsbook} class.
%    \begin{macrocode}
%<*amsbook>
\def\@maketitle{\cleardoublepage \thispagestyle{empty}%
  \begingroup \topskip\z@skip
  \null\vfil
  \begingroup
  \Large\bfseries \centering
  \openup\medskipamount
  \uppercasenonmath\@title
  \@title\vfil
  \def\and{\par\bigskip}\mdseries\authors\vfil
  \endgroup
  \vfil\vfil
  \newpage\thispagestyle{empty}
  \null\vfil
  \begingroup
    \parskip\medskipamount
    \ifx\@empty\@translators\else\@settranslators\fi
    \ifx\@empty\thankses\else\@setthanks\fi
  \endgroup
  \vfil
  \ifx\@empty\@subjclass \else \@setsubjclass \vfil\fi
  \ifx\@empty\@keywords \else \@setkeywords \vfil\fi
  \ifx\@empty\addresses\else\@setaddresses\fi
  \vfil\vfil
  \endgroup}
%</amsbook>
%    \end{macrocode}
%
%    Define the desired form for translator names.
%    \begin{macrocode}
%<*amsbook>
\def\@settranslators{\par
  \begingroup
  Translated by: \andify\@translators \uppercasenonmath\@translators
  \@translators \@@par
  \endgroup}
%</amsbook>
%    \end{macrocode}
%
% \section{Hyphenation exceptions}
%    Some common hyphenation exceptions, based on the listing in
%    TUGboat vol 10, no 3, November 1989, pp.~336--341. Many words from
%    the TUGboat list that seemed less likely to occur in mathematical
%    text have been omitted because hyphenation exceptions use up memory
%    (most versions of TeX currently have a limit of 307 on hyphenation
%    exceptions; each added hyphenation exception uses up something like
%    2 extra words of main memory as well). The list of hyphenations for
%    proper names could be expanded forever if room permitted; we
%    restrict ourselves to a rather short, extremely arbitrary list.
%    Note that the hyphenation rules of British English differ in some
%    particulars from the US rules, so some of the hyphenations
%    given below may need to be overridden for proper UK hyphenation.
%
%    \begin{macrocode}
\hyphenation{acad-e-my acad-e-mies af-ter-thought anom-aly anom-alies
an-ti-deriv-a-tive an-tin-o-my an-tin-o-mies apoth-e-o-ses
apoth-e-o-sis ap-pen-dix ar-che-typ-al as-sign-a-ble as-sist-ant-ship
as-ymp-tot-ic asyn-chro-nous at-trib-uted at-trib-ut-able bank-rupt
bank-rupt-cy bi-dif-fer-en-tial blue-print busier busiest
cat-a-stroph-ic cat-a-stroph-i-cally con-gress cross-hatched data-base
de-fin-i-tive de-riv-a-tive dis-trib-ute dri-ver dri-vers eco-nom-ics
econ-o-mist elit-ist equi-vari-ant ex-quis-ite ex-tra-or-di-nary
flow-chart for-mi-da-ble forth-right friv-o-lous ge-o-des-ic
ge-o-det-ic geo-met-ric griev-ance griev-ous griev-ous-ly
hexa-dec-i-mal ho-lo-no-my ho-mo-thetic ideals idio-syn-crasy
in-fin-ite-ly in-fin-i-tes-i-mal ir-rev-o-ca-ble key-stroke
lam-en-ta-ble light-weight mal-a-prop-ism man-u-script mar-gin-al
meta-bol-ic me-tab-o-lism meta-lan-guage me-trop-o-lis
met-ro-pol-i-tan mi-nut-est mol-e-cule mono-chrome mono-pole
mo-nop-oly mono-spline mo-not-o-nous mul-ti-fac-eted mul-ti-plic-able
non-euclid-ean non-iso-mor-phic non-smooth par-a-digm par-a-bol-ic
pa-rab-o-loid pa-ram-e-trize para-mount pen-ta-gon phe-nom-e-non
post-script pre-am-ble pro-ce-dur-al pro-hib-i-tive pro-hib-i-tive-ly
pseu-do-dif-fer-en-tial pseu-do-fi-nite pseu-do-nym qua-drat-ic
quad-ra-ture qua-si-smooth qua-si-sta-tion-ary qua-si-tri-an-gu-lar
quin-tes-sence quin-tes-sen-tial re-arrange-ment rec-tan-gle
ret-ri-bu-tion retro-fit retro-fit-ted right-eous right-eous-ness
ro-bot ro-bot-ics sched-ul-ing se-mes-ter semi-def-i-nite
semi-ho-mo-thet-ic set-up se-vere-ly side-step sov-er-eign spe-cious
spher-oid spher-oid-al star-tling star-tling-ly sta-tis-tics
sto-chas-tic straight-est strange-ness strat-a-gem strong-hold
sum-ma-ble symp-to-matic syn-chro-nous topo-graph-i-cal tra-vers-a-ble
tra-ver-sal tra-ver-sals treach-ery turn-around un-at-tached
un-err-ing-ly white-space wide-spread wing-spread wretch-ed
wretch-ed-ly Eng-lish Euler-ian Feb-ru-ary Gauss-ian
Hamil-ton-ian Her-mit-ian Jan-u-ary Japan-ese Kor-te-weg
Le-gendre Mar-kov-ian Noe-ther-ian No-vem-ber Rie-mann-ian Sep-tem-ber}
%    \end{macrocode}
%
% \subsection{Initialization}
%    We define a function to do the normal calculations that we want for
%    \cn{textheight} and \cn{textwidth}
%
%  \begin{macro}{\calclayout}
%    Subtract the height of the running heads:
%    \begin{macrocode}
\def\calclayout{\advance\textheight -\headheight
  \advance\textheight -\headsep
%    \end{macrocode}
%    Subtract the difference between normalbaselineskip and topskip:
%    \begin{macrocode}
  \advance\textheight -\normalbaselineskip
  \advance\textheight\normaltopskip
%    \end{macrocode}
%    We set \cn{oddsidemargin} and \cn{evensidemargin} to
%    center the text on the page.
%    \begin{macrocode}
  \oddsidemargin\paperwidth
  \advance\oddsidemargin -\textwidth
  \divide\oddsidemargin\tw@
%    \end{macrocode}
%    Now we subtract the default margin provided by standard DVI
%    drivers.  But first we make sure that the final margin will
%    be at least .5 inch.
%    \begin{macrocode}
  \ifdim\oddsidemargin<.5truein \oddsidemargin.5truein \fi
  \advance\oddsidemargin -1truein
  \evensidemargin\oddsidemargin
%    \end{macrocode}
%     And we set \cn{topmargin} to get vertical centering as well.
%    \begin{macrocode}
  \topmargin\paperheight \advance\topmargin -\textheight
  \advance\topmargin -\headheight \advance\topmargin -\headsep
%    \end{macrocode}
%    Height of running foot ignored: not present.
%    \begin{macrocode}
  \divide\topmargin\tw@
%    \end{macrocode}
%    We provide a minimum of .5in (after compensating for the default
%    margin---see next step).
%    \begin{macrocode}
  \ifdim\topmargin<.5truein \topmargin.5truein \fi
%    \end{macrocode}
%    Now subtract the default margin provided by standard DVI
%    drivers.
%    \begin{macrocode}
  \advance\topmargin -1truein\relax
}
%    \end{macrocode}
%    \end{macro}
%
%    Init the page numbering, etc.
%    \begin{macrocode}
\calclayout % initialize
\pagenumbering{arabic}
\pagestyle{headings}
\thispagestyle{plain}
%    \end{macrocode}
%
%    Some back-compatibility definitions.
%
%    Macro for making non-slanted numbers and punctuation in italic
%    or slanted text.  This is to avoid visual inconsistencies
%    between numbers or parentheses in math and adjacent numbers or
%    parentheses in text.
%    \begin{macrocode}
\def\rom{\@subst@obsolete\rom\textup}
%    \end{macrocode}
%
%    If we are in compatibility mode, add some backward compatibility
%    stuff below. Otherwise quit here.
%    \begin{macrocode}
\if@compatibility \else\endinput\fi
%    \end{macrocode}
%
%    Compensate for changed meaning of \cn{tiny}:
%    \begin{macrocode}
\def\tiny{\Tiny}
%    \end{macrocode}
%
%    The usual \cs{endinput} to ensure that random garbage at the end of
%    the file doesn't get copied by \fn{docstrip}.
%    \begin{macrocode}
\endinput
%    \end{macrocode}
%
% \CheckSum{3327}
% \Finale
