%%% ====================================================================
%%%  @LaTeX-file{
%%%     filename        = "amsdtx.dtx",
%%%     version         = "1.2beta",
%%%     date            = "1994/10/27",
%%%     time            = "14:38:19 EDT",
%%%     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        = "02960 707 2183 24320",
%%%     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 provides a couple of document classes used
%%%                        to produce user documentation or technical
%%%                        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.",
%%%  }
%%% ====================================================================
%
% \iffalse
%    The following section of code makes this file self-printable.
%    \begin{macrocode}
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\documentclass{amsdtx}
\newcommand{\rp}{\let\PBS\\\raggedright\let\\\PBS}
\begin{document}
\title{The \cls{amsldoc} and \cls{amsdtx} document classes}
\author{American Mathematical Society\\Michael Downes}
\date{Version \fileversion, \filedate}
\hDocInput{amsdtx.dtx}
\end{document}
%</driver>
%    \end{macrocode}
% \fi
%
%^^A If this file is printed by itself the \fileversion and \filedate
%^^A information will come from the file header rather than from the
%^^A \ProvidesClass command. See \hDocInput.
% \maketitle
%
% \MakeShortVerb\|
% \section{Introduction}
%    This file is the source for two documentclasses, \cls{amsldoc}
%    (used for the \amslatex/ user's guide) and \cls{amsdtx} (used for
%    printing AMS \fn{.dtx} files). The generic \cls{book} class is used
%    as a base, but the \cls{amsdtx} class is modified to serve as an
%    article-type class. This affects the form of documentation files
%    mainly in the use of \cn{maketitle} and \cn{chapter}.
%
% \begin{table}
% \caption{Features of the \cls{amsldoc} and \cls{amsdtx} classes}
% \newcommand{\rpth}{\rp{.75}}
% \centering
% \begin{tabular}{lp{.65\columnwidth}}
% Command Name& Purpose\\
% \hline
% \cn{cn}& \rp To print a user command name: \verb"\cn{title}"; leading
%   backslash can be optionally included for control symbols:
%   \verb"\cn{\%}". The \cn{cn} command works properly even in macro
%   arguments (compare to, e.g., \cn{verb}\verb"'\newif'"). But beware
%   of a fragile control symbol (are there any?) in a moving argument.\\
% \cn{cs}& \rp `Control sequence': to print an internal command name,
%   not intended for the end user\\
% \cn{env}& \rp To print an environment name: \verb"\env{table}"\\
% \cn{pkg}& \rp To print a package name: \verb"\pkg{eufrak}"\\
% \cn{cls}& \rp To print a class name: \verb"\cls{book}"\\
% \cn{opt}& \rp To print the name of a class or package option:
%   \verb"\opt{twocolumn}"\\
% \cn{fn}& \rp To print a file name or font name: \verb"\fn{T1enc.def}",
%   \verb"\fn{cmsy10}"\\
% \cn{qc}& \rp To quote a single character: \verb"\qc{\%}";
%   this works properly for special characters, even in macro
%   arguments, unlike e.g., \verb"\verb'%'"\\
% \cn{latex/} etc.& \rp Convenient forms of \cn{LaTeX}, \cn{TeX},
%   \cn{BibTeX}, etc. that are easier to type and have a trailing slash
%   to eliminate the following-space problem (without needing different
%   markup in different contexts)
% \end{tabular}
% \end{table}
%
% \StopEventually{}
%
%    Standard starting pieces.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
%<amsldoc>\ProvidesClass{amsldoc}[1994/10/27 v1.2beta]
%<amsdtx>\ProvidesClass{amsdtx}[1994/10/27 v1.2beta]
%    \end{macrocode}
%
% \section{Implementation}
%    Start with the generic book class as a base.
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions
\LoadClass{book}
%    \end{macrocode}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    Some functions to support \cn{cn} etc. For most of these commands
%    we don't really want them to be \cs{long}! (But rumor has it that
%    the next release of \latex/ will have an optional form for
%    \cn{newcommand} to make non-long commands. [mjd,1994/10/19])
%
%    We use the name \cn{bslchar} instead of \cn{bslash} to avoid
%    potential conflict with the \pkg{doc} package \cn{bslash} command.
%    Unlike \cn{bslash}, \cn{bslchar} survives unlimited
%    writing/expansion because it is a chardef.
%    \begin{macrocode}
\chardef\bslchar=`\\ % p. 424, TeXbook
\newcommand{\addbslash}{\expandafter\@addbslash\string}
\def\@addbslash#1{\bslchar\@nobslash#1}
\newcommand{\nobslash}{\expandafter\@nobslash\string}
\def\@nobslash#1{\ifnum`#1=\bslchar\else#1\fi}
%    \end{macrocode}
%
%    We define some macros to do automatic indexing of control
%    sequences, environments, options, and file names.
%    \begin{macrocode}
\newcommand{\autoindex}{\index}
%    \end{macrocode}
%    To avoid font substitution warnings we make the tt font always
%    print in the normal weight and shape.
%    \begin{macrocode}
\newcommand{\ntt}{\normalfont\ttfamily}
%    \end{macrocode}
%
%    Control sequence. The function \cn{addbslash} makes this command
%    also usable for some special control sequences like \cn{\%} \cn{\}}
%    \cn{\{}: instead of writing |\cs{%}| you can write |\cs{\%}|.
%    \begin{macrocode}
\DeclareRobustCommand{\cs}[1]{{\ntt\addbslash#1\@empty}%
  \autoindex{\nobslash#1@\cs{\string#1\@empty}}}
%    \end{macrocode}
%
%    Allow distinguishing non-private `command names' that will be
%    visible to the user from internal (mostly private) `control
%    sequences'.
%    \begin{macrocode}
\DeclareRobustCommand{\cn}[1]{{\ntt\addbslash#1\@empty}%
%    \end{macrocode}
%    The \cn{nobslash} function here removes the leading backslash (for
%    sorting purposes only) so that command names after sorting will be
%    interspersed with regular words. The final \cs{@empty} is just to
%    avoid bad errors if an empty argument is accidentally given; the
%    printed results will be nonsense.
%    \begin{macrocode}
  \autoindex{\nobslash#1@\cn{\string#1\@empty}}}
%    \end{macrocode}
%
%    \latex/ documentclass name.
%    \begin{macrocode}
\DeclareRobustCommand{\cls}[1]{{\ntt#1}%
  \autoindex{#1@\cls{#1} class}}
%    \end{macrocode}
%
%    \latex/ package name.
%    \begin{macrocode}
\DeclareRobustCommand{\pkg}[1]{{\ntt#1}%
  \autoindex{#1@\pkg{#1} package}}
%    \end{macrocode}
%
%    \latex/ option name.
%    \begin{macrocode}
\DeclareRobustCommand{\opt}[1]{{\ntt#1}%
  \autoindex{#1@\opt{#1} option}}
%    \end{macrocode}
%
%    Environment name.
%    \begin{macrocode}
\DeclareRobustCommand{\env}[1]{{\ntt#1}%
  \autoindex{#1@\env{#1} environment}}
%    \end{macrocode}
%
%    File name.
%    \begin{macrocode}
\DeclareRobustCommand{\fn}[1]{{\ntt#1}\autoindex{#1@\fn{#1}}}
%    \end{macrocode}
%
%    \bibtex/ style.
%    \begin{macrocode}
\DeclareRobustCommand{\bst}[1]{{\ntt#1}\autoindex{#1@{\string\ntt{}#1
  bibliography style}}}
%    \end{macrocode}
%
%    To index a control sequence without printing it. Note non-long.
%    \begin{macrocode}
\newcommand{\indexcs}[1]{\autoindex{#1@\cs{#1}}}
%    \end{macrocode}
%
%    We allow some slop at the right margin because we have some
%    long control sequence names and verbatim text to deal with. Also
%    ignore underfull hboxes and vboxes unless they are really bad.
%    \begin{macrocode}
\hfuzz2pc
\vbadness9999 \hbadness5000
%    \end{macrocode}
%
%    \begin{macrocode}
\def\AmS{{\protect\usefont{OMS}{cmsy}{m}{n}%
  A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
%    \end{macrocode}
%
%    \begin{macrocode}
\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}}
%    \end{macrocode}
%
%    \cn{makeindex} command is already used for other purposes.
%    \begin{macrocode}
\def\makeindx/{MakeIndex}
%    \end{macrocode}
%
%    Don't allow a break after the hyphen:
%    \begin{macrocode}
\def\xypic/{XY\mbox{-}pic}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand{\Textures}{\textit{Textures}}
%    \end{macrocode}
%
%    `Meta' macro.
%    \begin{macrocode}
\def\<#1>{\textit{$\langle$#1\/$\rangle$}}
%    \end{macrocode}
%
%    Check the definition of \cs{@starttoc} before changing it.
%    \begin{macrocode}
\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
%    \end{macrocode}
%
%    Turn off \cs{autoindex} during \cn{tableofcontents} or similar.
%    \begin{macrocode}
\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}
%    \end{macrocode}
%
%    Make glossary commands a no-op for the moment. [mjd,1994/10/03]
%    Provide a \cn{secref} command for section references.
%    \begin{macrocode}
%<*amsldoc>
\newcommand{\gloss}[1]{}
\newcommand{\secref}[1]{\S\ref{#1}}
%</amsldoc>
%    \end{macrocode}
%
%    We can write |\qc\%| to quote a single
%    character in situations where |\verb"%"| would not work, mainly
%    when text is read as a macro argument (e.g., footnotes).
%    \begin{macrocode}
\newcommand{\qc}[1]{}% check for prior definition
\edef\qc#1{\noexpand\protect\expandafter\noexpand\csname qc \endcsname
  \noexpand\protect#1}
%    \end{macrocode}
%    For this function the first argument is \cn{protect} and just needs
%    to be discarded. The method for removing a leading backslash is to
%    turn off \cs{escapechar}; this is more forgiving of variations like
%    |\qc{$}|. If the argument is |\ | we print a cmtt visible-space
%    character.
%    \begin{macrocode}
\@namedef{qc }#1#2{\begingroup\ntt
  \ifx\ #2\char`\ \else\escapechar\m@ne\string#2\fi\endgroup}
%    \end{macrocode}
%    Declare a few character names to avoid e.g., indexing difficulties.
%    \begin{macrocode}
\DeclareRobustCommand{\qcat}{\qc\@}%
\DeclareRobustCommand{\qcamp}{\qc\&}%
\DeclareRobustCommand{\qcbang}{\qc\!}%
%    \end{macrocode}
%
%  \begin{macro}{\arg}
%    Change \cn{arg} to print a macro argument number:
%    \begin{macrocode}
\DeclareRobustCommand{\arg}[1]{{\ntt\##1}}
%    \end{macrocode}
%  \end{macro}
%
%    We need to emulate the \pkg{amsthm} \cn{qedsymbol} for the
%    \amslatex/ user's guide.
%    \begin{macrocode}
%<*amsldoc>
\newcommand{\openbox}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}
\newcommand{\qedsymbol}{\openbox}
%</amsldoc>
%    \end{macrocode}
%
%    Logical markup for e-mail address:
%    \begin{macrocode}
%<amsldoc>\def\mail{\texttt}
%    \end{macrocode}
%
%    Shorthand for indexing:
%    \begin{macrocode}
%<*amsldoc>
\def\*#1{\def\@tempa{#1}\def\@tempb{*}%
  \ifx\@tempa\@tempb \expandafter\index
  \else #1\index{#1}\fi}
%</amsldoc>
%    \end{macrocode}
%
%    Non-indexed \cn{cn} (maybe call this |\cn*|?)
%    \begin{macrocode}
\def\ncn#1{{\let\index\@gobble\cn{#1}}}
%    \end{macrocode}
%    Indexing difficulties with !, @.
%    \begin{macrocode}

\DeclareRobustCommand{\cnbang}{%
  \ncn{\!}\index{"!@{\ntt\bslchar\qcbang}}}
\DeclareRobustCommand{\cnat}{%
  \ncn{\!}\index{"@@{\ntt\bslchar\qcat}}}
%    \end{macrocode}
%
%    Shorthand for a discouraged, but not forbidden, line break:
%    \begin{macrocode}
\def\5{\penalty500 }
%    \end{macrocode}
%
% \section{\cls{amsldoc} style modifications for sectioning commands}
%    The following section deals with book commands (part, chapter,
%    frontmatter, \dots).
%    \begin{macrocode}
%<*amsldoc>
%    \end{macrocode}
%
%    Modifications of sectioning commands from \fn{book.cls}, mostly
%    reducing font sizes and vertical spacing.
%    \begin{macrocode}
\renewcommand\frontmatter{\clearpage
            \@mainmatterfalse\pagenumbering{roman}}
\renewcommand\mainmatter{\clearpage
       \@mainmattertrue\pagenumbering{arabic}}
\renewcommand\backmatter{\clearpage \@mainmatterfalse}
%    \end{macrocode}
%
%    \begin{macrocode}
\renewcommand\part{\clearpage
                 \thispagestyle{plain}%
                 \if@twocolumn
                     \onecolumn
                     \@tempswatrue
                   \else
                     \@tempswafalse
                 \fi
                 \hbox{}\vfil
                 \secdef\@part\@spart}
%    \end{macrocode}
%
%    \begin{macrocode}
\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}
%    \end{macrocode}
%
%    \begin{macrocode}
\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}
%    \end{macrocode}
%
%    \begin{macrocode}
\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}
%    \end{macrocode}
%
%    \begin{macrocode}
\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
  }}
%</amsldoc>
%    \end{macrocode}
%
% \section{\cls{amsdtx} style modifications for sectioning commands}
%    These definitions for \cn{maketitle} are from \fn{article.cls}.
%    \begin{macrocode}
%<*amsdtx>
\renewcommand\maketitle{\par
  \begingroup
    \renewcommand\thefootnote{\fnsymbol{footnote}}%
    \def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}%
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hbox to1.8em{\hss$\m@th^{\@thefnmark}$}##1}%
    \if@twocolumn
      \ifnum \col@number=\@ne
        \@maketitle
      \else
        \twocolumn[\@maketitle]%
      \fi
    \else
      \newpage
      \global\@topnum\z@   % Prevents figures from going at top of page.
      \@maketitle
    \fi
    \thispagestyle{plain}\@thanks
  \endgroup
  \setcounter{footnote}{0}%
  \let\thanks\relax
  \let\maketitle\relax\let\@maketitle\relax
  \gdef\@thanks{}\gdef\@author{}\gdef\@title{}}
%
\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
    {\large \@date}%
  \end{center}%
  \par
%    \end{macrocode}
%    Put the title into both running heads.
%    \begin{macrocode}
  \uppercase\expandafter{\expandafter\toks@\expandafter{\@title}}%
  \edef\@tempa{\noexpand\markboth{\the\toks@}{\the\toks@}}%
  \@tempa
  \vskip 1.5em}
%</amsdtx>
%    \end{macrocode}
%
%    Edit the sectioning commands.
%    \begin{macrocode}
\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}}
%    \end{macrocode}
%    Change index environment to turn off \cn{autoindex}.
%    \begin{macrocode}
\renewenvironment{theindex}{%
  \if@twocolumn \@restonecolfalse \else \@restonecoltrue \fi
  \columnseprule \z@ \columnsep 35\p@
  \let\autoindex\@gobble
%<amsdtx>  \twocolumn[\section*{\indexname}]%
%<amsldoc>  \twocolumn[\@makeschapterhead{\indexname}]%
  \@mkboth{\uppercase{\indexname}}{\uppercase{\indexname}}%
  \thispagestyle{plain}\parindent\z@
  \parskip\z@ \@plus .3\p@\relax
  \let\item\@idxitem
}{%
  \if@restonecol\onecolumn\else\clearpage\fi
}
%    \end{macrocode}
%
%    Take out \cn{thechapter} from \cn{thesection}.
%    \begin{macrocode}
%<amsdtx>\renewcommand{\thesection}{\arabic{section}}
%    \end{macrocode}
%
%    Change the style of captions slightly. Also incorporate some
%    caption improvements from Donald Arseneau (\fn{comp.text.tex}, 11
%    Oct 1994).
%    \begin{macrocode}
\long\def\@makecaption#1#2{%
  \addvspace\abovecaptionskip
  \begingroup
    \countdef\@parcycles=8 % local count register
    \@parcycles\z@
    \@setpar{\advance\@parcycles\@ne \ifnum\@parcycles>999
      \@@par\@parcycles\z@\fi
      \ifhmode \unskip\hskip\parfillskip\penalty-\@M\fi}%
    \@hangfrom{\textbf{#1.} }\vadjust{\penalty\m@ne}#2%
  \endgroup
  \ifhmode\unpenalty\fi\par
  \ifnum\lastpenalty=\m@ne % only one line in the caption
    \unpenalty \setbox\@tempboxa\lastbox
    \nointerlineskip
    \hbox to\hsize{\hfill\unhbox\@tempboxa\unskip\hfill}%
  \fi
  \nobreak\vskip\belowcaptionskip
}
%    \end{macrocode}
%    For table captions, assume top captions and so put space below the
%    caption rather than above:
%    \begin{macrocode}
\renewenvironment{table}{%
  \belowcaptionskip\abovecaptionskip \abovecaptionskip\z@skip
  \@float{table}%
}{%
  \end@float
}
\renewenvironment{table*}{%
  \belowcaptionskip\abovecaptionskip \abovecaptionskip\z@skip
  \@dblfloat{table}%
}{%
  \end@dblfloat
}
%    \end{macrocode}
%
% \section{Float placement parameters}
%    These control the placing of floating objects like tables and
%    figures. The values here, which are much more tolerant than the
%    LaTeX defaults, are more or less copied from \fn{amscls.dtx}.
%    \begin{macrocode}
\setcounter{topnumber}{4}\setcounter{bottomnumber}{4}
\setcounter{totalnumber}{4}\setcounter{dbltopnumber}{4}
\renewcommand{\topfraction}{.97}\renewcommand{\bottomfraction}{.97}
\renewcommand{\textfraction}{.03}\renewcommand{\floatpagefraction}{.9}
\renewcommand{\dbltopfraction}{.97}
\renewcommand{\dblfloatpagefraction}{.9}
\setlength{\floatsep}{8pt plus6pt}
\setlength{\textfloatsep}{10pt plus8pt}
\setlength{\intextsep}{8pt plus6pt}
\setlength{\dblfloatsep}{8pt plus6pt}
\setlength{\dbltextfloatsep}{10pt plus8pt}
\setlength{\@fptop}{0pt}\setlength{\@fpsep}{8pt}%
\setlength{\@fpbot}{0pt plus 1fil}
\setlength{\@dblfptop}{0pt}\setlength{\@dblfpsep}{8pt}%
\setlength{\@dblfpbot}{0pt plus 1fil}
%    \end{macrocode}

%    \begin{macrocode}
\pagestyle{headings}
%    \end{macrocode}
%
%    Make \verb"|...|" shorthand for verbatim fragments. In the case of
%   the \cls{amsldoc} class, we avoid requiring an extra package
%   (\pkg{doc} or \pkg{shortvrb}), to reduce the possibility of package
%   files not being found at run time.
%    \begin{macrocode}
%<*amsldoc>
\AtBeginDocument{\catcode`\|=\active }
\def\activevert{\verb|}
\expandafter\gdef\expandafter\dospecials\expandafter
  {\dospecials \do\|}%
\expandafter\gdef\expandafter\@sanitize\expandafter
  {\@sanitize \@makeother\|}
\begingroup\catcode`\|=\active \gdef|{\protect\activevert{}}\endgroup
%</amsldoc>
%    \end{macrocode}
%    Load \pkg{doc} package, reset \cn{AltMacroFont} to be the same as
%    \cn{MacroFont} (when there are large sections of conditional
%    code I think it looks better not to have it all slanted).
%    \begin{macrocode}
%<*amsdtx>
\RequirePackage{doc}
\def\AltMacroFont{\MacroFont}
%    \end{macrocode}
%
%    Ordinary \cn{DocInput} doesn't handle standardized file headers
%    unless you enclose them in \cs{iffalse} \dots\ \cs{fi} which I
%    don't care to do. So instead here's an alternate version of
%    \cn{DocInput}, called \cn{hDocInput}.
%    \begin{macrocode}
\def\hDocInput#1{\MakePercentIgnore
  \begingroup
%    \end{macrocode}
%    Define active \qc{\@} which should be the first non-percent,
%    non-equal-sign character when a file header is present. (If a file
%    header is not present, \cn{hDocInput} should not be used.)
%    \begin{macrocode}
  \begingroup \lccode`\~=`\@
  \lowercase{\endgroup\long\def ~}##1##{%
    \catcode`\==12 \skipfileheader{##1}}%
  \catcode`\@=\active \catcode`\==14 % comment
  \def\filename{#1}%
  \@@input#1 \MakePercentComment}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\skipfileheader#1#2 {\endgroup
  \hGetFileInfo#2 version = "??" date = "??"\@nil
  \begingroup\catcode`\==9 \catcode`\ =9 \futurelet\0\endgroup
}
%    \end{macrocode}
%
%    \begin{macrocode}
\long\def\hGetFileInfo#1 version = "#2"#3 date = "#4"#5\@nil{%
  \def\fileversion{#2}\def\filedate{#4}}
%</amsdtx>
%    \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{831}
% \Finale
