% \iffalse
%%% ====================================================================
%%%  @LaTeX-file{
%%%     author          = "American Mathematical Society",
%%%     version         = "1.2beta",
%%%     date            = "1994/10/12",
%%%     time            = "13:14:10 EDT",
%%%     filename        = "amsldoc.dtx",
%%%     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        = "61780 300 703 10754",
%%%     email           = "tech-support@math.ams.org (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "latex, amslatex, ams-latex, user documentation",
%%%     supported       = "yes",
%%%     abstract        = "This is part of the AMS-\LaTeX{} distribution.
%%%                        It is a document class used to produce user
%%%                        documentation.",
%%%     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.",
%%%  }
%%% ====================================================================
% \fi
\ProvidesClass{amsldoc}[1994/10/12 v1.2beta]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions
\LoadClass{book}

\def\AmS{{\protect\usefont{OMS}{cmsy}{m}{n}%
  A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\chardef\bslash=`\\ % p. 424, TeXbook
\newcommand{\addbslash}{\expandafter\@addbslash\string}
\def\@addbslash#1{\bslash\@nobslash#1}
\newcommand{\nobslash}{\expandafter\@nobslash\string}
\def\@nobslash#1{\ifnum`#1=\bslash\else#1\fi}

%    We define some macros to do automatic indexing of control
%    sequences, environments, options, and file names.

\newcommand{\autoindex}{\index}

\newcommand{\ntt}{\normalfont\ttfamily}

% Control sequence. The function \addbslash makes this command also
% usable for some special control sequences like \% \} \{: instead of
% writing \cs{%} you can write \cs{\%}.
\DeclareRobustCommand{\cs}[1]{{\ntt\addbslash#1\@empty}%
  \autoindex{\nobslash#1@{\string\cs{\string#1\@empty}}}}

%    Allow distinguishing non-private `command names' from private
%    `control sequences'.
\let\cn=\cs

% LaTeX documentclass name
\DeclareRobustCommand{\cls}[1]{{\ntt#1}%
  \autoindex{#1@{\string\ntt{}#1} class}}

% LaTeX package name
\DeclareRobustCommand{\pkg}[1]{{\ntt#1}%
  \autoindex{#1@{\string\ntt{}#1} package}}

% LaTeX option name
\DeclareRobustCommand{\opt}[1]{{\ntt#1}%
  \autoindex{#1@{\string\ntt{}#1} option}}

% environment name
\DeclareRobustCommand{\env}[1]{{\ntt#1}%
  \autoindex{#1@{\string\ntt{}#1} environment}}

% file name
\DeclareRobustCommand{\fn}[1]{{\ntt#1}\autoindex{#1@{\string\ntt{}#1}}}

% BibTeX style
\DeclareRobustCommand{\bst}[1]{{\ntt#1}\autoindex{#1@{\string\ntt{}#1
  bibliography style}}}

\newcommand{\secref}[1]{\S\ref{#1}}

% to index a control sequence without printing it
\newcommand{\indexcs}[1]{\autoindex{#1@{\string\ntt\addbslash#1}}}

% We allow some slop at the right margin because we have some
% long control sequence names and verbatim text to deal with.
\hfuzz2pc

\def\latex/{{\protect\LaTeX}}
\def\amslatex/{{\protect\AmS-\protect\LaTeX}}
\def\tex/{{\protect\TeX}}
\def\amstex/{{\protect\AmS-\protect\TeX}}
\def\bibtex/{{Bib\protect\TeX}}
%    \makeindex command is already used for other purposes
\def\makeindx/{MakeIndex}
%    Don't allow a break after the hyphen:
\def\xypic/{XY\mbox{-}pic}

\newcommand{\Textures}{\textit{Textures}}

% `Meta' macro.
\def\<#1>{\textit{$\langle$#1\/$\rangle$}}

%    Check the definition of \@starttoc before changing it.
\def\@tempa#1{\begingroup
  \makeatletter
  \@input{\jobname.#1}\if@filesw
  \expandafter\newwrite\csname tf@#1\endcsname
             \immediate\openout
                 \csname tf@#1\endcsname \jobname.#1\relax
  \fi \global\@nobreakfalse \endgroup}

\@check@eq\@starttoc\@tempa

%    Turn off \autoindex during \tableofcontents or similar.
\def\@starttoc#1{\begingroup
  \let\autoindex\@gobble
  \makeatletter
  \@input{\jobname.#1}\if@filesw
  \expandafter\newwrite\csname tf@#1\endcsname
             \immediate\openout
                 \csname tf@#1\endcsname \jobname.#1\relax
  \fi \global\@nobreakfalse \endgroup}

%    Make glossary commands a no-op for the moment. [mjd,1994/10/03]
\newcommand{\gloss}[1]{}

\newcommand{\atchar}{}%
\edef\atchar{\noexpand\texttt{\char\number`\@}}
\newcommand{\ampchar}{}
\edef\ampchar{\noexpand\texttt{\char\number`\&}}
\newcommand{\openbox}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}
\newcommand{\qedsymbol}{\openbox}
\def\mail{\texttt}
\def\*#1{\def\@tempa{#1}\def\@tempb{*}%
  \ifx\@tempa\@tempb \expandafter\index
  \else #1\index{#1}\fi}
%    Indexing difficulties with !, @. Use different .ist?
%    Non-indexed \cn (maybe call this \cn*?)
\def\ncn#1{{\let\index\@gobble\cn{#1}}}
\def\cnbang{\protect\cnBang}
\def\cnBang{\ncn{\!}\index{"!@{\cn{\\}"!}}}
%    Shorthand for a discouraged, but not forbidden, line break:
\def\5{\penalty500 }

%    Modifications of sectioning commands from book.cls, mostly
%    reducing font sizes and vertical spacing.
\renewcommand\frontmatter{\clearpage
            \@mainmatterfalse\pagenumbering{roman}}
\renewcommand\mainmatter{\clearpage
       \@mainmattertrue\pagenumbering{arabic}}
\renewcommand\backmatter{\clearpage \@mainmatterfalse}
\renewcommand\part{\clearpage
                 \thispagestyle{plain}%
                 \if@twocolumn
                     \onecolumn
                     \@tempswatrue
                   \else
                     \@tempswafalse
                 \fi
                 \hbox{}\vfil
                 \secdef\@part\@spart}

\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >-2\relax
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
    \markboth{}{}
    {\centering
     \interlinepenalty \@M
     \reset@font
     \ifnum \c@secnumdepth >-2\relax
       \Large\bfseries \partname~\thepart
       \par
       \vskip 20\p@
     \fi
     \Large \bfseries #2\par}%
    \@endpart}
\def\@spart#1{%
    {\centering
     \interlinepenalty \@M
     \reset@font
     \Large \bfseries #1\par}%
    \@endpart}
\def\@endpart{\vfil\newpage
              \if@twoside
                \hbox{}%
                \thispagestyle{empty}%
                \newpage
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\renewcommand\chapter{\par \@afterindentfalse
                    \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#1}%
                       \else
                         \addcontentsline{toc}{chapter}{#1}\fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\def\@makechapterhead#1{%
  \vspace{1.5\baselineskip}%
  {\parindent \z@ \raggedright \reset@font
    \ifnum \c@secnumdepth >\m@ne
      \large\bfseries \@chapapp{} \thechapter
      \par\nobreak
      \vskip.5\baselineskip\relax
    \fi
    #1\par\nobreak
    \vskip\baselineskip
  }}
\def\@schapter#1{\if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]%
                 \else
                   \@makeschapterhead{#1}%
                   \@afterheading
                 \fi}
\def\@makeschapterhead#1{%
  \vspace*{1.5\baselineskip}%
  {\parindent \z@ \raggedright
    \reset@font
    \large \bfseries  #1\par\nobreak
    \vskip\baselineskip
  }}
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-.6\baselineskip \@plus -3\p@}%
                                   {.4\baselineskip}
                                   {\reset@font\normalsize\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-.3\baselineskip\@plus -2\p@}%
                                     {.2\baselineskip}%
                                     {\reset@font\normalsize\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-.2\baselineskip\@plus -2\p@}%
                                     {.2\baselineskip}%
                                     {\reset@font\normalsize\bfseries}}
%
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{{\bfseries#1.} #2}%
  \ifdim \wd\@tempboxa >\hsize
    {\bfseries#1.} #2\par
  \else
    \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
%
\pagestyle{headings}

%    Make |...; shorthand for verbatim fragments.
\AtBeginDocument{\catcode`\|=\active }
\def\activevert{%
  \ifmmode\let\@tempa\vert\else\def\@tempa{\verb;}\fi\@tempa}
\expandafter\gdef\expandafter\dospecials\expandafter
  {\dospecials \do\|}%
\expandafter\gdef\expandafter\@sanitize\expandafter
  {\@sanitize \@makeother\|}
\begingroup\catcode`\|=\active \gdef|{\protect\activevert}\endgroup

\endinput
