% \iffalse      THIS IS A META-COMMENT
%<*dtx>
\ProvidesFile
%========================================================================
                       {FIGCAPS.DTX}
%========================================================================
%</dtx>
%% Copyright 1993-1999 Patrick W Daly
%% Max-Planck-Institut f\"ur Aeronomie
%% Max-Planck-Str. 2
%% D-37191 Katlenburg-Lindau
%% Germany
%% E-mail: daly@linmpi.mpg.de
% 
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% This is a contributed file to the LaTeX2e system.
% -------------------------------------------------
% This is a LaTeX package to put tables and figure captions at the end of an
%    article even though the environments appear in the text.
% Installation:
%    LaTeX this file: creates docstrip installation file figcaps.ins
%                         AND the (LaTeX2e) documentation
%    (La)TeX figcaps.ins: creates package files figcaps.sty, and optionally
%                         documentation driver figcaps.drv
%    (figcaps.ins may be edited as needed)
% Docstrip options available:
%        package - to produce a (LaTeX2e) package .sty file
%        plates  - to include plate environments, just like figures
%        longtab - to include longtable environment, for longtable package (2e)
%        sublab  - to include coding for use with sublabel.sty
%        toc     - to enable tables of contents to be used; writes to auxiliary
%                    files .pot and pof instead of .lof and .lot
%        driver  - to produce a driver file to print the documentation
%        209     - (with package) for package that runs under LaTeX 2.09
%        subpack - (with package) for coding included in other packages
%        agu     - (with package,subpack) for inclusion in aguplus package
%        egs     - (with package,subpack) for inclusion in egs package
%--------------------------------------------------------------------------
%<*!subpack>
%<package&209>\def\ProvidesPackage#1#2]
%<package&209>  {\typeout{Style option `#1'#2]}}
%
%  *** Identify the package file:-
%<package&!209>\NeedsTeXFormat{LaTeX2e}[1994/06/01]
%<package>\ProvidesPackage{figcaps}
%</!subpack>
%
%  *** Provide command to dislay module version
%<package&subpack>\def\ModuleVersion#1[#2]{}
%<package&subpack>    \ModuleVersion{figcaps}
%
%  *** Identify the driver file:-
%<driver>\NeedsTeXFormat{LaTeX2e}
%<driver>\ProvidesFile{figcaps.drv}
%
%  *** The DATE, VERSION, and other INFO
%\fi
%\ProvidesFile{figcaps}
        [1999/02/23 4.7 (PWD)]
% \changes{4.0}{1993 Oct 12}{First integrated documented version}
% \changes{4.1}{1993 Oct 29}{Add coding for JGR, GRL, NLINPROC}
% \changes{4.1}{1993 Oct 29}{Add \cs{iffigmark} for marginal notes}
% \changes{4.1}{1993 Oct 29}{Add \cs{@tempa} construct to get \cs{@float}
%                               out of \cs{if} \cs{fi} brackets}
% \changes{4.1}{1993 Nov 15}{For JGR and GRL, tables after captions}
% \changes{4.1}{1993 Nov 20}{Add coding for AGU supplement}
% \changes{4.2}{1993 Nov 20}{Add \cs{figbox} for AGU supplement}
% \changes{4.2}{1993 Nov 20}{AGU supplement: captions in two widths again}
% \changes{4.2}{1993 Dec 16}{Suppress floats for AGU planotable}
% \changes{4.2}{1993 Dec 21}{Add \cs{if@filesw} for extra appendix entries}
% \changes{4.3}{1994 May 19}{Convert to \LaTeXe, add language and other
%     options, add \cs{figmarkon/off} and \cs{figcapson/off}}
% \changes{4.3a}{1994 Jun 06}{For AGU, change \cs{@makefcaption}}
% \changes{4.3b}{1994 Jun 22}{Update to first official release of \LaTeXe}
% \changes{4.3c}{1994 Nov 30}{Bad bug in \cs{figmarkoff} fixed, caused
%      crashes}
% \changes{4.3d}{1995 Jan 3}{Update documentation to PWD standard}
% \changes{4.4}{1995 Jan 8}{Fix bug caused by LTX 94/12/1 \cs{@writefile}}
% \changes{4.5}{1996 Jan 10}{Allow first float to be in appendix}
% \changes{4.5a}{1996 Jun 27}{Change \texttt{nlinproc} option to \texttt{egs}}
% \changes{4.5b}{1996 Jul 22}{Allow \cs{figbox} to scale automatically}
% \changes{4.5c}{1996 Jul 29}{Add \cs{figbox*} to suppress frame}
% \changes{4.5d}{1996 Aug 20}{Fix table notes for AGU}
% \changes{4.5e}{1996 Oct 10}{Zero \cs{parindent} for EGS}
% \changes{4.5f}{1997 Mar 16}{Fix copyright for subpack}
% \changes{4.5g}{1997 Apr 29}{Conform to new \texttt{docstrip}}
% \changes{4.5h}{1997 Nov 18}{Fix appendix problem for AGU}
% \changes{4.6}{1998 Sep 14}{Add \texttt{longtable} environment}
% \changes{4.7}{1999 Feb 23}{Update copyright notice}
%
% \CheckSum{1417}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \iffalse
%<*install>
%^^A =============================================
%^^A    Here is the docstrip installation file
%^^A    It is written on first LaTeX run if it 
%^^A    does not already exist
%^^A =============================================
\begin{filecontents*}{figcaps.ins}
% File: figcaps.ins
% Copyright 1999 Patrick W. Daly
%
% This file can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
% 
% It is an installation file for extracting package and driver
% files from the original source file. Simply process it under
% TeX or LaTeX. 

\input docstrip

\preamble
=============================================
IMPORTANT NOTICE:

This program can be redistributed and/or modified under the terms
of the LaTeX Project Public License Distributed from CTAN
archives in directory macros/latex/base/lppl.txt; either
version 1 of the License, or any later version.

This is a generated file.
It may not be distributed without the original source file \inFileName.

Full documentation can be obtained by LaTeXing that original file.
Only a few abbreviated comments remain here to describe the usage.
=============================================
\endpreamble
\postamble

<<<<< End of generated file <<<<<<
\endpostamble

\declarepreamble\driver
============================================
This is the driver file to produce the LaTeX documentation 
from the original source file \inFileName.

Make changes to it as needed. (Never change the file \inFileName!)
============================================
\endpreamble

\declarepostamble\driverq

End of documentation driver file.
\endpostamble

\keepsilent
\askforoverwritefalse

\generate{\file{figcaps.sty}{\from{figcaps.dtx}{package}}
          \file{figcaps.drv}{\usepreamble\driver\usepostamble\driverq
                           \from{figcaps.dtx}{driver}}
         }

\obeyspaces
\Msg{******************************************}%
\Msg{* For documentation, process figcaps.dtx *}%
\Msg{*    or the driver file      figcaps.drv *}%
\Msg{******************************************}

\endbatchfile
\end{filecontents*}
%</install>
%<*driver>
\documentclass{ltxdoc}
%<driver>%\documentclass[twoside]{ltxdoc}
%<driver>%\documentclass[a4paper]{ltxdoc}
%<driver>%\documentclass[twoside,a4paper]{ltxdoc}
\raggedbottom

 %** To include the detailed explanation of the coding, comment out
 %**   the next line
\OnlyDescription

 %** To produce a command index: add the following line for one run,
 %**   then run  makeindex -s gind.ist natbib
 %**   and reprocess, with or without this line (much faster without)
%<driver>% \EnableCrossrefs\CodelineIndex

 %** To produce a change history: add the following line for one run,
 %**   then run  makeindex -s gglo.ist -o natbib.gls natbib.glo
 %**   and reprocess, with or without this line (faster without)
%<driver>% \RecordChanges

\DisableCrossrefs %May stay; zapped by \EnableCrossrefs
\CodelineNumbered %May stay

\begin{document}
   \DocInput{figcaps.dtx}
\end{document}
%</driver>
%\fi
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
% \DoNotIndex{\ClassWarning,\PackageWarning,\ClassWarningNoLine}
% \DoNotIndex{\PackageWarningNoLine,\ClassInfo,\PackageInfo,\MessageBreak}
% \DoNotIndex{\space,\protect,\DeclareRobustCommand,\CheckCommand}
% \DoNotIndex{\newcommand,\renewcommand,\providecommand,\newenvironment}
% \DoNotIndex{\renewenvironment,\newif,\newlength,\newcounter,\setlength}
% \DoNotIndex{\setcounter,\if,\ifx,\ifcase,\ifnum,\ifdim,\else,\fi}
% \DoNotIndex{\texttt,\textbf,\textrm,\textsl,\textsc}
% \DoNotIndex{\textup,\textit,\textmd,\textsf,\emph}
% \DoNotIndex{\ttfamily,\rmfamily,\sffamily,\mdseries,\bfseries,\upshape}
% \DoNotIndex{\slshape,\scshape,\itshape,\em,\LaTeX,\LaTeXe}
% \DoNotIndex{\filename,\fileversion,\filedate,\let}
% \DoNotIndex{\@ifundefined,\@input,\@latexerr,\@makecaption,\@makeother}
% \DoNotIndex{\@mkboth,\@namedef,\@tempa,\@tempb,\@writefile,\\,\{,\},\^}
% \DoNotIndex{\active,\addcontentsline,\addtocontents,\begingroup,\bgroup}
% \DoNotIndex{\bigskip,\catcode,\clearpage,\closeout,\def,\do,\dospecials}
% \DoNotIndex{\egroup,\else,\end@dblfloat,\end@float,\endgroup,\expandafter}
% \DoNotIndex{\fi,\filedate,\filename,\fileversion,\gdef,\ifx,\immediate}
% \DoNotIndex{\jobname,\label,\let,\long,\newcounter,\newif,\newpage}
% \DoNotIndex{\newwrite,\openout,\par,\refstepcounter,\relax,\space}
% \DoNotIndex{\stepcounter,\string,\typeout,\uppercase,\vbox,\vskip}
% \DoNotIndex{\vspace,\marginpar,\if@filesw,\parindent}
% \DoNotIndex{\advance,\divide,\fboxrule,\fboxsep,\fnum@figure,\fnum@plate}
% \DoNotIndex{\fnum@table,\framebox,\hbox,\hfil,\hsize,\newdimen}
% \DoNotIndex{\providecommand,\section,\setcounter,\small,\textwidth}
% \DoNotIndex{\vrule,\vss,\z@}
% \DoNotIndex{\@caption,\@captype,\@dblfloat,\@depth,\@float,\@height}
% \DoNotIndex{\@ifnextchar,\@tempdima,\@term,\@width,\cl@section}
% \DoNotIndex{\cr@relax,\fbox}
%
% \setcounter{IndexColumns}{2}
% \setlength{\IndexMin}{10cm}
% \setcounter{StandardModuleDepth}{1}
%
% \GetFileInfo{figcaps}
%
% \title{\bfseries A Package to Put Figures and Tables at the End of
%             an Article}
%
% \author{Patrick W. Daly}
%
% \date{This paper describes package \texttt{\filename}\\
%       version \fileversion{} from \filedate\\[1ex]
%     \textsl{It is part of the \texttt{preprint} collection of packages}
%  }
%
% \maketitle
%
% \pagestyle{myheadings}
% \markboth{P. W. Daly}{PUTTING FIGURES AND TABLES AT THE END}
%
%^^A In order to keep all marginal notes on the one (left) side:
%^^A (otherwise they switch sides disasterously with twoside option)
% \makeatletter \@mparswitchfalse \makeatother
%
% \newcommand{\thestyle}{\texttt{\filename}}
%
%\begin{small}\begin{center}\textbf{Summary}\end{center}
% The stripped version of this file contains the following brief description:
%\iffalse
%<*package&!subpack>
%\fi
% \begin{verbatim}
 %  This option allows the figure captions to be collected throughout
 %    the paper and printed on a separate page at the end. The figures
 %    themselves will not appear in the text. This is for purposes of
 %    a manuscript for submission.
 %  Similarly, tables are not printed in the text, but are outputted at
 %    the end, after the figure captions.
%<*plates>
 %  A plate environment also exists, handled just like figures.
%</plates>
%<*longtab>
 % A longtable environment exists, for use with the longtable tools package.
%</longtab>
 %  The figures themselves may appear, with captions, at
 %    the end, after the tables. This is done with command \printfigures
 %    in the preamble. This only makes sense if the figures have been
 %    generated by LaTeX or if they are being imported.
 %  Marginal notes added where environments placed if \figmarkon given.
 %  NOTE: Only works for article-like styles at present, where \section is
 %        the highest sectioning level.
%<*!toc>
 %  NOTE: Tables of contents (incl figures and tables) cannot be used
%</!toc>
 %  NOTE: This file must be read in AFTER \appendix has been defined;
%<*sublab>
 %        if sublabel.sty is also used, it must be read in first.
%</sublab>
%<agu> % The captions are formatted as for AGU journals.
%<egs> % The captions are formatted as for EGS journals.
%<*!209>
 %
 % Options with LaTeX2e:
 %   printfigures  - prints the figures at the end of the article, (is
 %                   like issuing the \printfigures command)
 %   figmark       - turns on the markers for figures and tables in the text,
 %                   (is like issuing \figmarkon)
 %   figon/off     - activates or deactivates the whole procedure (is like
 %                   (issuing \figcapson or \figcapsoff). Default=on.
 %   mylang        - (default) leaves explicit text (e.g. `Figure Captions'
 %                   as is, or if undefined, makes them English
 %   english,american,german,austrian,french,esperanto - changes explicit
 %                   texts accordingly
 %   blank         - makes explicit texts empty.
%</!209>
% \end{verbatim}
%\iffalse
 %-----------------------------------------------------------
%</package&!subpack>
%\fi
%\end{small}
%
% \section{Introduction}
% Often when producing manuscripts for submission to a journal, it is
% required that the figure captions be listed at the end on a separate
% page, and also that tables be put at the end too. Then when the
% manuscript is ready and camera-ready copy, or a preprint, is to be
% generated, one has to move them all back to the proper positions in the
% paper.
%
% This style alleviates this problem. The \texttt{figure} and \texttt{table}
% environments are placed in the text as they should be for the preprint or
% camera-ready copy, but the tables actually are printed at the end. The
% figures are not printed at all, but their captions are listed on a
% separate page at the end. Optionally, the figures themselves may be
% printed at the very end. This last only makes sense if there is something
% in the figures, i.e., they have been produced with \texttt{picture} or are
% imported graphics.
%
% \section{Invoking the Package}
% The macros in this package are included in the main document
% with the |\usepackage| command of \LaTeXe,
% \begin{quote}
% |\documentclass[..]{...}|\\
% |\usepackage[|\emph{options}|]{|\texttt{\filename}|}|
% \end{quote}
% where the possible \emph{options} are described below.
%
% Alternatively, the name of the package is added as an option to the
% |\documentstyle| command in \LaTeX~2.09 compatibility mode, as
% \begin{quote}
% |\documentstyle[..|\texttt{\filename}|..]{...}|
% \end{quote}
%
% It may only be used for \texttt{article}, or an article-like main class.
% That is, for one that does not contain the |\chapter| level of
% sectioning.
%
% The order in which other packages are loaded is important for certain
% features. If my package
% \texttt{sublabel} is included, then it must come before \thestyle.
% Furthermore, \thestyle{} adds to the existing definition of
% |\appendix|, so that if the author has any packages that alter this
% definition, they must come before \thestyle. Clearly, |\appendix| may
% not be redefined afterwards.
%
% \section{Using the Package}
% \DescribeMacro{\figcapson}\DescribeMacro{\figcapsoff}
% The macro package in \thestyle{} operates pretty much automatically.
% The whole thing may be turned on and off with the commands |\figcapson|
% and |\figcapsoff|. The default is \meta{on}. One might want to
% control the placement of figures and tables with this flag rather than by
% adding and removing the option from the |\documentclass| command.
%
% Alternatively, the \LaTeXe{} options \texttt{figon} and \texttt{figoff}
% have the same effect, with \texttt{figon} being the default.
%
% \DescribeMacro{\printfigures}
% The only other means of interacting with the macros is with the command
% |\printfigures|, which, when given anywhere in the text, enables the
% figures themselves to be output at the very end of the paper. Without
% this, only the captions are listed. With it, both captions and figures
% are output.
%
% The \LaTeXe{} option \texttt{printfigures} in |\usepackage| is
% equivalent to issuing the command |\printfigures| in the text.
%
% \DescribeMacro{\figmarkon}
% \DescribeMacro{\figmarkoff}
% Another option is to put marginal notes into the text at the place
% where the float environment is entered. This is useful for camera-ready
% copy that will be cut-and-pasted together to indicate where the figures
% and tables should appear. The commands |\figmarkon| and |\figmarkoff|
% control this feature, with the default being \meta{off}.
%
% The \LaTeXe{} option \texttt{figmark} in |\usepackage| sets this
% default to \meta{on}; in other words, it is equivalent to issuing
% |\figmarkon| in the text.
%
% \DescribeMacro{\figurecapname}
% \DescribeMacro{\tablepagename}
% \DescribeMacro{\figurepagename}
% The text that is written as header at the top of the special pages is
% defined in three commands |\figurecapname|, |\tablepagename|, and
% |\figurepagename|. They default to English text, but may be redefined to
% other languages, or suppressed altogether, with |\renewcommand| or with
% \LaTeXe{} options (see page~\pageref{names}).
%
% \section{How it Works}
% The contents of all the \texttt{figure} and \texttt{table} environments are
% written to auxiliary files {\tt.lof} and {\tt.lot} respectively, and then
% these are read in again at the end of the paper. Since these auxiliary
% files are normally used to write information for the lists of figures and
% tables, this capability is lost. However, it is not likely that one wants
% such lists, or even a table of contents, in a manuscript. In fact, the
% commands |\tableofcontents|, |\listoffigures|, |\listoftables| are turned
% off (they issue a warning message).
%
% If you really do need tables of contents, then see the extra features
% below.
%
% \subsection{With the \texttt{longtable} Package}
% This package may optionally be used with the \texttt{longtable} environment defined 
% in the package of the same name. Since such tables are normally long, i.e.\ 
% over a page, the list of tables at the back will always start a new page for 
% each of these. 
% 
% For preprints, when the tables are not moved to the back (|\figcapsoff|), it 
% makes sense to put the \texttt{longtable} environment inside the |\afterpage| 
% command (from the \texttt{afterpage} package). However, with |\figcapson|, 
% and the table is move, this is useless. In this case, the |\afterpage| 
% command is deactivated. One should realize this in case it is used for other 
% purposes.
% 
% \subsection{As Module to Journal-Specific Styles}
% Although \thestyle{} is meant to be an all-purpose bibliographic style
% \emph{package}, it may also be incorporated as a module to other
% packages for specific journals. In this case, many of the general features may
% be left off. This is allowed for with \texttt{docstrip} options that not
% only leave off certain codelines, but also include extra ones. So far,
% options exist for
% \begin{description}
% \item[\ttfamily egs] for \textsl{European Geophysical Society} journals.
% \item[\ttfamily agu] for \textsl{American Geophysical Union} journals.
% \end{description}
%
% Previous options \texttt{jgr} and \texttt{grl} have become obsolete due
% to revisions in these journals; they have been replaced by the more
% general \texttt{agu} option.
%
% \section{\LaTeXe{} Options}
% Under \LaTeXe, \emph{options} may be added to the |\usepackage| command
% that loads the package. Available options for \thestyle{} set certain
% control flags, thus replacing the equivalent commands, or select the
% language for the texts that are printed by |\figurecapname|,
% |\tablepagename|, and |\figurepagename|.
% \begin{description}
% \item[\ttfamily figon] (default) activates the whole procedure of moving
%     figures and tables to the back of the article, (same as
%     |\figcapson|);
%
% \item[\ttfamily figoff] deactivates the whole procedure, (same as
%     |\figcapsoff|);
%
% \item[\ttfamily printfigures] allows the figures themselves and not just
%     their captions to be output at the very end, in addition to the
%     caption page, (same as |\printfigures|); by default this is not done;
%
% \item[\ttfamily figmark] enables marking of figure and table environments
%     in the text with marginal notes; (same as |\figmarkon|);
%
% \item[\ttfamily mylang] (default) leaves the three \texttt{name} commands
%     as they are; however if they are not defined at all, then they are
%     given English values; since these name commands are not standard, one
%     cannot expect them to be set by other language adaption packages;
%
% \item[\ttfamily english, american, german, austrian, french, esperanto]
%     \label{names}
%     set the \texttt{name} commands to the translation in the
%     corresponding language, overwriting any previous definitions;
%
% \item[\ttfamily blank] sets the text of |\figurecapname|,
%     |\tablepagename|, and |\figurepagename| to nothing.
% \end{description}
%
% \StopEventually{\PrintIndex\PrintChanges}
%
% \section{Options with \texttt{docstrip}}
% The source \texttt{.dtx} file is meant to be processed with
% \texttt{docstrip}, for which a number of options are available:
% \begin{description}
% \item[\ttfamily plates] permits \texttt{plate} and \texttt{plate*}
%    environments to be treated just like \texttt{figure} and
%    \texttt{figure*}; the contents are written to the same auxiliary file
%    and the captions are mixed with those of the figures. The environments
%    must already exist though, for with this option the coding is included
%    to treat plates like figures, but it does not define such plate
%    environments.
%
% \item[\ttfamily longtab] permits \texttt{longtable} environment from the
%    \texttt{longtable} tools package to be treated too (\LaTeXe\ only).
%
% \item[\ttfamily sublab] adds coding to enable the \thestyle{} macros to
%    function with my other option \texttt{sublabel}, which permits objects
%    to be numbered 4{\it a}, 4{\it b}, etc. This coding may always be
%    included, even if \texttt{sublabel} is not invoked; the converse is
%    not true: if \texttt{sublabel} is present, then this coding must also
%    be there, and \texttt{sublabel} must precede \thestyle{} in the list
%    of options.
%
% \item[\ttfamily toc] allows auxiliary files with the extensions {\tt.pof}
%    and {\tt.pot} so that there is no conflict with the tables of contents
%    files. Thus |\tableofcontents|, |\listoffigures|, |\listoftables|, and
%    possibly |\listofplates| may be used as normal.
%
% \item[\ttfamily package] to produce a \texttt{.sty} package file with most
%    comments removed;
%
% \item[\ttfamily 209] for a style option file that will run under the older
%     \LaTeX~2.09;
%
% \item[\ttfamily subpack] (together with \texttt{package}) for coding that
%    is to be included inside a larger package; even more comments are
%    removed, as well as \LaTeXe{} option handling and identification;
%
% \item[\ttfamily agu] (with \texttt{package,subpack}) for special coding
%    for the \textsl{AGU$^{++}$} package;
%
% \item[\ttfamily egs] (with \texttt{package,subpack}) for special
%    coding for the \textsl{EGS} package;
%
% \item[\ttfamily driver] to produce a driver \texttt{.drv} file that will
%     print out the documentation under \LaTeXe. The documentation cannot
%     be printed under \LaTeX~2.09.
%
% \end{description}
% The source file \texttt{\filename.dtx} is itself a driver file and can
% be processed directly by \LaTeXe.
%
% \section{The Coding}
% This section presents and explains the actual coding of the macros.
% It is nested between |%<*package>| and |%</package>|, which
% are indicators to \texttt{docstrip} that this coding belongs to the package
% file.
%
% The \texttt{docstrip} option |<subpack>| should only be called if the
% coding is to be included as part of another package, in which case the
% announcement text and \LaTeXe{} options are suppressed.
%
% An inferior version of this coding is provided for running as a
% style file under \LaTeX~2.09. Code lines belonging to this are
% indicated with guard |<209>|; those for LaTeXe{} only with |<!209>|.
%
% Now test that the main style is article-like, i.e., it has no chapters.
% This is because the figure caption list as well as the tables page are output
% under a |\section*|, and because of the relabelling of figures, tables,
% equations within appendices. (Maybe someday this will be changed.)
%    \begin{macrocode}
%<*package>
\@ifundefined{chapter}{}{%
%<209>    \@latexerr
%<!209>    \PackageError{figcaps}
     {`figcaps' may only be used with article-like classes}
     {There is no help. You just cannot use `figcaps'}}
%    \end{macrocode}
%
% \begin{macro}{\iffigcaps}
% \begin{macro}{\iffigmark}
% \changes{4.1}{1993 Oct 18}{Add flag to switch marginal notes on/off}
% \begin{macro}{\if@figpage}
% Define a few flags that control the operations, such as whether the whole
% procedure is turned on, whether figures and tables are marked in the text
% where they should appear, and whether a page of figures (not just
% captions) is output. These are set by commands defined below and/or by
% \LaTeXe options.
%    \begin{macrocode}
\newif\iffigcaps \figcapstrue
\newif\iffigmark \figmarkfalse
\newif\if@figpage \@figpagefalse
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \subsection{Setting Defaults and \LaTeXe{} Options}
% \begin{macro}{\figurecapname}
% \begin{macro}{\tablepagename}
% \begin{macro}{\figurepagename}
% Define explicit text with name commands that may be changed by language
% adaptations. Since these are non-standard, it is unlikely that they
% already exist, but nevertheless, it does not hurt to assume that they do.
%    \begin{macrocode}
%<*subpack|209>
\@ifundefined{figurecapname}{\def\figurecapname{Figure Captions}}{}
\@ifundefined{tablepagename}{\def\tablepagename{Tables}}{}
\@ifundefined{figurepagename}{\def\figurepagename{Figures}}{}
%</subpack|209>
%    \end{macrocode}
%
% \begin{macro}{\DeclareOption}
% \changes{4.3}{1994 May 19}{Add language options for \LaTeXe}
% In \LaTeXe, the initial values of these commands can be set with options
% to the |\usepackage| command. They are processed in the order given, not
% in the order defined (starred version of |\ProcessOptions|).
%    \begin{macrocode}
%<*!subpack&!209>
\DeclareOption{english}{\def\figurecapname{Figure Captions}%
                        \def\tablepagename{Tables}%
                        \def\figurepagename{Figures}}
\DeclareOption{american}{\ExecuteOptions{english}}
\DeclareOption{german}{\def\figurecapname{Untertiteln der Abbildungen}%
                        \def\tablepagename{Tabellen}%
                        \def\figurepagename{Abbildungen}}
\DeclareOption{austrian}{\ExecuteOptions{german}}
\DeclareOption{french}{\def\figurecapname{Titres des Figures}%
                        \def\tablepagename{Tableaux}%
                        \def\figurepagename{Figures}}
\DeclareOption{esperanto}{\def\figurecapname{Titroj de la Figuroj}%
                        \def\tablepagename{Tabeloj}%
                        \def\figurepagename{Figuroj}}
\DeclareOption{blank}{\def\figurecapname{}%
                        \def\tablepagename{}%
                        \def\figurepagename{}}
\DeclareOption{blank}{\def\appendixname{}}
\DeclareOption{mylang}{\providecommand{\figurecapname}{Figure Captions}%
                       \providecommand{\tablepagename}{Tables}%
                       \providecommand{\figurepagename}{Figures}}
\DeclareOption{figmark}{\figmarktrue}
\DeclareOption{printfigures}{\@figpagetrue}
\DeclareOption{figon}{\figcapstrue}
\DeclareOption{figoff}{\figcapsfalse}
\ExecuteOptions{mylang,figon}
\ProcessOptions*
%</!subpack&!209>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \subsection{Low Level Routines --- the Tricky Bits}
% The way in which this routine is to work is as follows: the float
% commands |\figure|, |\table|, and optionally |\plate| are redefined so
% that they write everything up to the corresponding |\end| command to an
% auxiliary file. These files have extensions {\tt.lof} (for figures and
% plates) and {\tt.lot} (for tables). The entire contents must be written
% literally, that is as verbatim, without any expansion. The terminal
% |\end| text must also be literal.
%
% The actual internal commands that will do this are called |\@vfig|,
% |\@vsfig|, etc., where the second variant is for the starred version of
% the float command. These must be defined in such a way that |\|, |{|,
% and |}| are temporarily characters (catcode=12); their functionality is
% taken over by \verb!|!, |[|, and |]|. Furthermore, the carriage return
% |^^M| must also be made active so that it may be used as a character
% within the template of the definitions. Its function is to separate the
% individual lines of text. It must be active, not `other', because
% |\set@literal| (see below) will give it a definition of |\relax|. (It
% probably cannot be made `other' anyway because it is unprintable.)
%
% Switch the category codes, within a group, of course, to keep them local.
%    \begin{macrocode}
\begingroup
  \catcode `|=0 \catcode `[= 1
  \catcode`]=2 \catcode `\{=12 \catcode `\}=12
  \catcode`\^^M=13 \catcode`\\=12 %
%    \end{macrocode}
% \begin{macro}{\@vfig}
% Now define the true working commands. Take |\@vfig| as prototype for all
% the others. Its arguement is everything up to the literal text
% |\end{figure}|. This argument is expanded and used as argument to
% |\writelof| with an extra line termination (|^^M|) and the text
% |\end{figure}| added. The function |\writelof| dissects its argument into
% individual lines (as indicated by the active |^^M|) and writes them to
% the {\tt.lof} file, until it finds a line of text equal to |\@term|.
% Hence, this termination command is first defined as |\end{figure}|.
% Finally, |\@vfig| issues the \emph{command} (not the literal text)
% |\end{figure}| in order to close the \texttt{figure} environment. This last
% command appears in the definition as \verb!|end[figure]! because of the
% altered category codes.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
|long|gdef|@vfig#1\end{figure}[|def|@term[\end{figure}]%
          |expandafter|writelof#1^^M\end{figure}^^M|end[figure]]%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@vsfig}
% The equivalent function for \texttt{figure*} is now defined.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
|long|gdef|@vsfig#1\end{figure*}[|def|@term[\end{figure*}]%
          |expandafter|writelof#1^^M\end{figure*}^^M|end[figure*]]%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@vtab}
% \begin{macro}{\@vstab}
% Next, the same functions for tables. Here |\writelot| is used instead
% of |\writelof| because the text goes to a different auxiliary file.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
|long|gdef|@vtab#1\end{table}[|def|@term[\end{table}]%
          |expandafter|writelot#1^^M\end{table}^^M|end[table]]%
|long|gdef|@vstab#1\end{table*}[|def|@term[\end{table*}]%
          |expandafter|writelot#1^^M\end{table*}^^M|end[table*]]%
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\@vltab}
% \changes{4.6}{1998 Sep 14}{Add macro for \texttt{longtable} package}
% For use with the \texttt{longtable} package and its environment of the same 
% name, need special coding. This environment is never put into a 
% \texttt{figure} environment, but rather is used on its own.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
%<*longtab&!209>
 |long|gdef|@vltab#1\end{longtable}[|def|@term[\end{longtable}]%
           |expandafter|writelot#1^^M\end{longtable}^^M|end[longtable]]%
%</longtab&!209>
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\@vpla}
% \begin{macro}{\@vspla}
% For the event that a \texttt{plate} environment is also present (as in
% \textsl{AGU}, for example) we must include two more such functions. These
% operate exactly like \texttt{figure}, even using |\writelof| instead of
% |\writelot|.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
%<*plates>
|long|gdef|@vpla#1\end{plate}[|def|@term[\end{plate}]%
          |expandafter|writelof#1^^M\end{plate}^^M|end[plate]]%
|long|gdef|@vspla#1\end{plate*}[|def|@term[\end{plate*}]%
          |expandafter|writelof#1^^M\end{plate*}^^M|end[plate*]]%
%</plates>
%    \end{macrocode}
% \end{macro}\end{macro}
% \begin{macro}{\@vptab}
% \changes{4.5f}{1997 Mar 16}{For AGU only}
% In the AGU supplement, there is an additional \texttt{table} environment
% called \texttt{planotable}. This must then be provided for here. It has
% no starred version.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
%<agu> |long|gdef|@vptab#1\end{planotable}[|def|@term[\end{planotable}]%
%<agu>           |expandafter|writelot#1^^M\end{planotable}^^M|end[planotable]]%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@fcaponly}
% \changes{4.1}{1993 Nov 20}{Remove caption-only commands for AGU}
% \begin{macro}{\@feject}
% \begin{macro}{\@pcaponly}
% \begin{macro}{\@peject}
% Some more special commands are needed with literal commands in their
% templates. These are used to print only the captions when the figures
% auxiliary file is reread in. First |\@fcaponly| reads everything up to
% the |\caption| and throws it away. Then |\@feject| removes all text from
% its current position (which will be right after |\caption|) to the end of
% the \texttt{figure} environment. Similar functions exist for \texttt{plate},
% but not for \texttt{table}, since tables are always reproduced in full.
%
% The AGU supplement does not make use of these commands, since it works
% in a different way.
% \SpecialEscapechar{\|}
%    \begin{macrocode}
%<*!agu>
|long|gdef|@fcaponly#1\caption[|endgroup|@fcaption]%
|long|gdef|@feject#1\end{figure}[|end[figure]]%
%<*plates>
|long|gdef|@pcaponly#1\caption[|endgroup|@pcaption]%
|long|gdef|@peject#1\end{plate}[|end[plate]]%
%</plates>
%</!agu>
  |endgroup
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% Here the category codes are restored to their normal values with the
% ending of the group. Note that each of the above lines must have |%| at
% the end to avoid \meta{end-of-line}, which is active.
%
% \begin{macro}{\FC@writefile}
% \changes{4.4}{1995 Jan 8}{Add macro, equal to old definition of standard
%      \cmd{\@writefile}}
% The release of \LaTeX\ on 1995/12/01 changed the internal definition
% of |\@writefile| such as to make it robuster: the text is written literally
% to the file. This means that my |\string\begin{figure}| is written as
% |\string \begin {figure}| instead of |\begin{figure}|. To get around this,
% keeping capatibility with older versions, and not interfering with
% other uses of |\@writefile|, I add may own version, equal to the
% older definition.
%    \begin{macrocode}
\long\def\FC@writefile#1#2{\@ifundefined{tf@#1}{}{%
  \immediate\write\csname tf@#1\endcsname{#2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\writelof}
% \begin{macro}{\writelot}
% \changes{4.0}{1993 Oct 12}{Add \texttt{toc} option to determine extension
%       of auxiliary files. Tables of contents were previously allowed, now
%       only optionally allowed.}
% Now, the command that write the text to the auxiliary file |\writelof|
% takes the text one line at a time, checks if it
% equals |\@term|; if not, it is output to {\tt.lof} and |\writelof| is
% called again; if yes, the routine comes to an end. The
% \meta{end-of-line} |^^M| must be made active again at this stage so that
% it has the correct category code in the definition. For tables, the
% corresponding |\writelot| is analogous.
%
% Before we do this, however, it should be pointed out that these auxiliary
% files are normally used for lists of figures and tables information. Thus
% they may not be used for this purpose. Normally, one does not have such
% tables of contents in an article, but if that should be required, then
% we provide a \texttt{docstrip} option \texttt{toc} to change the extensions
% to {\tt.pof} and {\tt.pot}.
%    \begin{macrocode}
%<*!toc>
\def\lof{lof} \def\lot{lot}
%</!toc>
%<toc>\def\lof{pof} \def\lot{pot}

{\catcode`\^^M=13%
  \long\gdef\writelof#1^^M{\def\@tempb{#1}%
      \ifx\@tempb\@term\let\@tempa\relax\else
      \if@filesw\FC@writefile{pof}{#1}\fi\let\@tempa\writelof\fi \@tempa}
  \long\gdef\writelot#1^^M{\def\@tempb{#1}%
      \ifx\@tempb\@term\let\@tempa\relax\else
      \if@filesw\FC@writefile{pot}{#1}\fi\let\@tempa\writelot\fi \@tempa}
}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \subsection{Caption Commands}
% \begin{macro}{\@fcaption}
% \changes{4.1}{1993 Nov 20}{Remove caption-only commands for AGU}
% \begin{macro}{\@@fcapopt}
% \begin{macro}{\@@fcap}
% Here are the modified |\caption| commands for printing only the captions.
% In |\@figurecaps|, the command |\@fcaponly| is called at the start of
% a \texttt{figure} environment, which ejects all text up to the |\caption|
% command, and then calls |\@fcaption|. This then selects |\@@fcap| or
% |\@@fcapopt| depending on the presence of the optional argument. Both do
% essentially the same thing: they call the true caption command
% |\@caption| to process the argument, and then call |\@feject| to remove
% the remaining text in the \texttt{figure} environment. Note: this is only
% done when the auxiliary {\tt.lof} file is being read in to produce a list
% of captions.
%    \begin{macrocode}
%<*!agu>
\def\@fcaption{\refstepcounter\@captype \@ifnextchar[{\@@fcapopt}{\@@fcap}}
\def\@@fcapopt[#1]#2{\@caption\@captype[]{#2}\begingroup\set@literal\@feject}
\def\@@fcap#1{\@caption\@captype[]{#1}\begingroup\set@literal\@feject}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\@pcaption}
% \begin{macro}{\@@pcapopt}
% \begin{macro}{\@@pcap}
% The same thing for plates.
%    \begin{macrocode}
%<*plates>
\def\@pcaption{\refstepcounter\@captype \@ifnextchar[{\@@pcapopt}{\@@pcap}}
\def\@@pcapopt[#1]#2{\@caption\@captype[]{#2}\begingroup\set@literal\@peject}
\def\@@pcap#1{\@caption\@captype[]{#1}\begingroup\set@literal\@peject}
%</plates>
%</!agu>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \subsection{The High Level Commands for Float Environments}
% \begin{macro}{\figcapson}
% \changes{4.3}{1994 May 19}{Add on/off commands to set whole thing
%            on/off}
% \begin{macro}{\figcapsoff}
% \changes{4.3}{1994 May 19}{Add on/off commands to set whole thing
%            on/off}
% Here are the new definitions of the figure and table, which are to
% be executed in the main text where the environments are entered. These
% new definitions are only in effect if the flag \texttt{figcaps} is
% \meta{true}, otherwise the original definitions hold. This flag allows
% the style to be input in the |\documentstyle| line, or with
% |\usepackage|, even if it is not yet, or no longer, wanted.
%    \begin{macrocode}
\def\figcapson{\figcapstrue}
\def\figcapsoff{\figcapsfalse}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\figmarkon}
% \changes{4.3}{1994 May 19}{Add on/off commands to set flag
%          \cmd{\iffigmark}, consistent with older manuals!}
% \begin{macro}{\figmarkoff}
% \changes{4.3}{1994 May 19}{Add on/off commands to set flag
%          \cmd{\iffigmark}, consistent with older manuals!}
% \changes{4.3c}{1994 Nov 30}{Correct very bad bug!}
% Another flag allows the figures and tables in the text to be marked with
% a marginal note to indicate where they are first referred to. Since this is
% only necessary for cut-and-paste procedures, the default is to have the
% flag set \meta{false} unless the \LaTeXe{} option \texttt{figmark} has
% been given. These commands set the state of the flag.
%    \begin{macrocode}
\def\figmarkon{\figmarktrue}
\def\figmarkoff{\figmarkfalse}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\figure}
% \changes{4.1}{1993 Oct 18}{Add marginal note with \cmd{\iffigmark}}
% \changes{4.1}{1993 Oct 29}{Add \cmd{\@zfigure} to bring
%                   float out of the if clause}
% \changes{4.5}{1996 Jan 10}{Test for \cs{ifFC@appendix}}
% In the new definitions, the
% necessary auxiliary file is opened, the counter is stepped, the caption
% type determined (these are normal functions of the float routine), and
% then |\begin{figure}| is written literally to the auxiliary file.
% Finally, |\@vfig|, or equivalent, is called to process the rest of the
% environment's contents.
%
% If |figcaps| is \meta{false}, then the normal |\@float| command is used.
%    \begin{macrocode}
\def\figure{\iffigcaps \let\@tempb=\@zfigure \else \let\@tempb=\@float\fi
  \@tempb{figure}}
\def\@zfigure#1{\begingroup\set@literal\@ifnextchar[{\@figure}{\@figure[]}}
\def\@figure[#1]{\@ifundefined{tf@pof}{\newwrite\tf@pof
     \if@filesw\immediate\openout\tf@pof\jobname.\lof\relax
     \ifFC@appendix\FC@writefile{pof}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{figure}\iffigmark\marginpar{\fbox{\fnum@figure}}\fi
  \def\@captype{figure}\if@filesw\FC@writefile{pof}{\string\begin{figure}}\fi
  \@vfig}

\def\endfigure{\iffigcaps
    \endgroup\if@filesw\FC@writefile{pof}{\string\end{figure}}\fi\else
    \end@float\fi}

\@namedef{figure*}{\iffigcaps \let\@tempb=\@zsfigure \else
  \let\@tempb=\@dblfloat\fi \@tempb{figure}}
\def\@zsfigure#1{\begingroup\set@literal\@ifnextchar[{\@sfigure}{\@sfigure[]}}
\def\@sfigure[#1]{\@ifundefined{tf@pof}{\newwrite\tf@pof
     \if@filesw\immediate\openout\tf@pof\jobname.\lof\relax
     \ifFC@appendix\FC@writefile{pof}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{figure}\iffigmark\marginpar{\fbox{\fnum@figure}}\fi
  \def\@captype{figure}\if@filesw\FC@writefile{pof}{\string\begin{figure}}\fi
  \@vsfig}

\@namedef{endfigure*}{\iffigcaps\endfigure\else\end@dblfloat\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\plate}
% \changes{3.2}{1993 Feb 9}{Add possibility of plate environments}
% \changes{4.1}{1993 Oct 18}{Add marginal note with \cmd{\iffigmark}}
% \changes{4.1}{1993 Oct 29}{Add \cmd{\@zfigure} to bring
%                   float out of the if clause}
% \changes{4.5}{1996 Jan 10}{Test for \cs{ifFC@appendix}}
%  Plates are defined in the same way, and write to the same auxiliary
% file as figures. We must first test if there really is a plate counter,
% otherwise we will have trouble later.
%    \begin{macrocode}
%<*plates>
\@ifundefined{c@plate}{\newcounter{plate}}{}

\def\plate{\iffigcaps \let\@tempb=\@zplate \else \let\@tempb=\@float\fi
  \@tempb{plate}}
\def\@zplate#1{\begingroup\set@literal\@ifnextchar[{\@plate}{\@plate[]}}
\def\@plate[#1]{\@ifundefined{tf@pof}{\newwrite\tf@pof
     \if@filesw\immediate\openout\tf@pof\jobname.\lof\relax
     \ifFC@appendix\FC@writefile{pof}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{plate}\iffigmark\marginpar{\fbox{\fnum@plate}}\fi
  \def\@captype{plate}\if@filesw\FC@writefile{pof}{\string\begin{plate}}\fi
  \@vpla}

\def\endplate{\iffigcaps
    \endgroup\if@filesw\FC@writefile{pof}{\string\end{plate}}\fi\else
    \end@float\fi}

\@namedef{plate*}{\iffigcaps \let\@tempb=\@zsplate \else
  \let\@tempb=\@dblfloat\fi \@tempb{plate}}
\def\@zsplate#1{\begingroup\set@literal\@ifnextchar[{\@splate}{\@splate[]}}
\def\@splate[#1]{\@ifundefined{tf@pof}{\newwrite\tf@pof
     \if@filesw\immediate\openout\tf@pof\jobname.\lof\relax
     \ifFC@appendix\FC@writefile{pof}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{plate}\iffigmark\marginpar{\fbox{\fnum@plate}}\fi
  \def\@captype{plate}\if@filesw\FC@writefile{pof}{\string\begin{plate}}\fi
  \@vspla}

\@namedef{endplate*}{\iffigcaps\endplate\else\end@dblfloat\fi}
%</plates>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\table}
% \changes{4.1}{1993 Oct 18}{Add marginal note with \cmd{\iffigmark}}
% \changes{4.1}{1993 Oct 29}{Add \cmd{\@zfigure} to bring
%                   float out of the if clause}
% \changes{4.5}{1996 Jan 10}{Test for \cs{ifFC@appendix}}
% \changes{4.5d}{1996 Aug 20}{Add \cs{spew@tblnotes} for AGU}
% The table environments are made up the same way, but write to {\tt.lot}
% instead of {\tt.lof}.
%    \begin{macrocode}
\def\table{\iffigcaps \let\@tempb=\@ztable \else \let\@tempb=\@float\fi
  \@tempb{table}}
\def\@ztable#1{\begingroup\set@literal\@ifnextchar[{\@table}{\@table[]}}
\def\@table[#1]{\@ifundefined{tf@pot}{\newwrite\tf@pot
     \if@filesw\immediate\openout\tf@pot\jobname.\lot\relax
     \ifFC@appendix\FC@writefile{pot}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{table}\iffigmark\marginpar{\fbox{\fnum@table}}\fi
  \def\@captype{table}\if@filesw\FC@writefile{pot}{\string\begin{table}}\fi
  \@vtab}

\def\endtable{\iffigcaps
   \endgroup\if@filesw\FC@writefile{pot}{\string\end{table}}\fi\else
%<agu>   \spew@tblnotes
   \end@float\fi}

\@namedef{table*}{\iffigcaps \let\@tempb=\@zstable \else
  \let\@tempb=\@dblfloat\fi \@tempb{table}}
\def\@zstable#1{\begingroup\set@literal\@ifnextchar[{\@stable}{\@stable[]}}
\def\@stable[#1]{\@ifundefined{tf@pot}{\newwrite\tf@pot
     \if@filesw\immediate\openout\tf@pot\jobname.\lot\relax
     \ifFC@appendix\FC@writefile{pot}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{table}\iffigmark\marginpar{\fbox{\fnum@table}}\fi
  \def\@captype{table}\if@filesw\FC@writefile{pot}
    {\string\begin{table}}%
    \fi\@vstab}

\@namedef{endtable*}{\iffigcaps\endtable\else
%<agu>   \spew@tblnotes
   \end@dblfloat\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\longtable}
% \changes{4.6}{1998 Sep 14}{Add macro for \texttt{longtable} package}
% For the \texttt{longtable} package, add environment of same name.
% This coding to be added after the preamble so that the order of loading
% \thestyle{} and \texttt{longtable} is unimportant. The \cs{LT@makecaptions}
% is fixed to use the \cs{\@makecaptions} format that is current.
% Since it makes sense to use the \texttt{longtable} environment with the 
% \texttt{afterpage} command, but not when the table is moved to the back,
% switch off that command when moving is active.
%    \begin{macrocode}
%<*longtab&!209>
\AtBeginDocument{\let\FC@ltab=\longtable                                       
  \let\FC@endltab=\endlongtable
\def\longtable{\iffigcaps \let\@tempb=\@ltable \else 
  \let\@tempb=\FC@ltab\fi \@tempb}
\def\@ltable{\begingroup\set@literal
     \@ifundefined{tf@pot}{\newwrite\tf@pot
     \if@filesw\immediate\openout\tf@pot\jobname.\lot\relax
     \ifFC@appendix\FC@writefile{pot}{\string\doappendix}\fi\fi}{}%
  \refstepcounter{table}\iffigmark\marginpar{\fbox{\fnum@table}}\fi
  \def\@captype{table}\if@filesw\FC@writefile{pot}
     {\string\begin{longtable}}\fi \@vltab}
\def\endlongtable{\iffigcaps
   \endgroup\if@filesw\FC@writefile{pot}{\string\end{longtable}}\fi\else
   \FC@endltab\fi}
\@ifpackageloaded{longtable}{%
\def\LT@makecaption#1#2#3{%
  \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
   \@makecaption{#1{#2}}{#3}%
    \endgraf\vskip\baselineskip}%
  \hss}}}}{}
\@ifpackageloaded{afterpage}{%
 \let\FC@afterpage=\afterpage
 \def\afterpage{\iffigcaps \let\@tempb\relax \else \let\@tempb\FC@afterpage\fi
   \@tempb}}{}
  }
%</longtab&!209>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\planotable}
% \changes{4.1}{1993 Nov 20}{Add for AGU supplement}
% \changes{4.5}{1996 Jan 10}{Test for \cs{ifFC@appendix}}
% For the AGU supplement, we need to add the environment \texttt{planotable}.
%    \begin{macrocode}
%<agu>\let\aguplano=\planotable
%<agu>\let\endaguplano=\endplanotable
%<agu>
%<agu>\def\planotable{\iffigcaps \let\@tempb=\@ptable \else
%<agu>  \let\@tempb=\aguplano\fi \@tempb}
%<agu>\def\@ptable{\begingroup\set@literal
%<agu>     \@ifundefined{tf@pot}{\newwrite\tf@pot
%<agu>     \if@filesw\immediate\openout\tf@pot\jobname.\lot\relax
%<agu>     \ifFC@appendix\FC@writefile{pot}{\string\doappendix}\fi\fi}{}%
%<agu>  \refstepcounter{table}\iffigmark\marginpar{\fbox{\fnum@table}}\fi
%<agu>  \def\@captype{table}\if@filesw\FC@writefile{pot}
%<agu>     {\string\begin{planotable}}\fi \@vptab}
%<agu>
%<agu>\def\endplanotable{\iffigcaps
%<agu>   \endgroup\if@filesw\FC@writefile{pot}{\string\end{planotable}}\fi\else
%<agu>   \endaguplano\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tableofcontents}
% \changes{4.4}{1995 Jan 8}{Use \LaTeXe{} warning command}
% \begin{macro}{\listoffigures}
% \changes{4.4}{1995 Jan 8}{Use \LaTeXe{} warning command}
% \begin{macro}{\listoftables}
% \changes{4.4}{1995 Jan 8}{Use \LaTeXe{} warning command}
% \begin{macro}{\listofplates}
% \changes{4.4}{1995 Jan 8}{Use \LaTeXe{} warning command}
% Unless the \texttt{docstrip} option \texttt{toc} has been selected, turn off
% the tables of contents commands, because they will interfere with the
% writing of the auxiliary files.
%    \begin{macrocode}
%<*!toc>
\def\tableofcontents{%
%<209>  \@@warning
%<!209>  \PackageWarningNoLine{figcaps}
   {Ignored: \protect\tableofcontents\space command}}
\def\listoffigures{%
%<209>  \@@warning
%<!209>  \PackageWarningNoLine{figcaps}
   {Ignored: \protect\listoffigures\space command}}
\def\listoftables{%
%<209>  \@@warning
%<!209>  \PackageWarningNoLine{figcaps}
   {Ignored: \protect\listoftables\space command}}
%<*plates>
\def\listofplates{%
%<209>  \@@warning
%<!209>  \PackageWarningNoLine{figcaps}
   {Ignored: \protect\listofplates\space command}}
%</plates>
\def\addtocontents#1#2{\relax}
\def\addcontentsline#1#2#3{\relax}
%</!toc>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\set@literal}
% \changes{3.1}{1992 Oct 14}{Use {\tt\symbol{94}\symbol{94}M!=\protect\bslash
%    relax} in place of {\tt\protect\bslash obeylines} which caused problems
%    with floats inside paragraphs because then
%    {\tt\symbol{94}\symbol{94}M!=\protect\bslash par}}
% Here is the command that makes all characters literal. It especially
% makes |^^M| to be active, defined to be |\relax|. In earlier versions,
% |\obeylines| was used instead, but that sets |^^M| to |\par| and there
% were problems when the floats appeared in the middle of a paragraph.
%    \begin{macrocode}
{\catcode`\^^M=\active \gdef\cr@relax{\catcode`\^^M=\active \let^^M=\relax}}
\def\set@literal{\cr@relax \let\do\@makeother\dospecials}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Commands to Put Saved Text at the End}
% \begin{macro}{\@figurecaps}
% \changes{4.1}{1993 Nov 20}{Revisions for AGU supplement}
% \changes{4.3a}{1994 Jun 6}{Zero \cmd{\parindent} for AGU}
% \changes{4.5e}{1996 Oct 17}{Zero \cmd{\parindent} generally}
% Now define the routine to read in the {\tt.lof} auxiliary file with the
% purpose of listing only the captions. Since the list is to be made under
% a |\section*|, there may be trouble if |\appendix| has been called
% already. The redefined |\section*| command may print out |\appendixname|.
% Thus this name is set to blank if it exists.
%
% The |\reset@figtab| command is called to reset the figure, plate, table
% counters to zero. This is because they are to go through their automatic
% sequence once more as they are read in. Actually, this is not necessary,
% since the |\caption|s were never really called in the text part. However,
% it is better to be certain that the counters are where we expect them.
%
% An entry is made to the running heads and to the table of contents.
% The \texttt{figure} environment is redefined yet again to make use of
% |\@fcaponly|, and |\addcontentsline| is set to swallow its arguments.
% This latter is called by the |\@caption| command and we do not want the
% entries to be made at this point. The |\@makecaption| command must be
% altered to a special format for the captions list.
% Finally, the auxiliary file {\tt.lof} is input.
%
% For the AGU supplement, the procedure is different. Instead of ignoring
% everything except the |\caption|, all printable text is contained in
% a |\figbox|, which here is defined to swallow its argument. (Actually the
% internal |\@figbox| is redefined.)
%
% For AGU, need to call |\noappendix| and to set |\parindent| to zero.
% This is because the manuscript part of AGU\TeX{} redefines |\@caption|
% so that this is no longer done there.
%
% Also need to zero |\parindent| for EGS. So why not do it generally?
%
% Note: no distinction is made between \texttt{figure} and \texttt{figure*},
% since both environments write the unstarred variant to the auxiliary
% file. For a list of captions, there is no need for a distinction.
%
%    \begin{macrocode}
\def\@figurecaps{\@ifundefined{tf@pof}{}{\if@filesw
  \immediate\closeout\tf@pof\fi
  \@ifundefined{appendixname}{}{\def\appendixname{}}
%<agu>  \noappendix
  \parindent\z@
  \reset@figtab\clearpage\section*{\figurecapname}\vspace{1cm}%
    \@mkboth{\uppercase{\figurecapname}}{\uppercase{\figurecapname}}%
    \addcontentsline{toc}{section}{\figurecapname}%
  \def\figure{\def\addcontentsline####1####2####3{}%
    \def\@captype{figure}%
%<*!agu>
    \begingroup\set@literal\@fcaponly
   }\def\endfigure{\endgroup\bigskip}%
%</!agu>
%<agu>    \vbox\bgroup
%<agu>   }\def\endfigure{\egroup\bigskip}%
%<*plates>
  \def\plate{\def\addcontentsline####1####2####3{}%
    \def\@captype{plate}%
%<*!agu>
    \begingroup\set@literal\@pcaponly
%</!agu>
%<agu>    \vbox\bgroup
   }\let\endplate=\endfigure
%</plates>
  {\let\@makecaption=\@makefcaption
%<agu>  \def\@figbox##1##2##3{\relax}
  \@input{\jobname.\lof}}%
  \clearpage}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tablepage}
% \changes{4.1}{1993 Oct 22}{For NLINPROC, add explicit
%            {\tt\protect\bslash small}}
% \changes{4.1}{1993 Nov 20}{Revisions for AGU supplement}
% \changes{4.2}{1993 Dec 16}{For AGU: suppress floats for \texttt{planotable}}
% \changes{4.3a}{1994 Jun 6}{Zero \cmd{\parindent} for AGU}
% \changes{4.5e}{1996 Oct 17}{Zero \cmd{\parindent} generally}
% The page(s) of tables are written similarly, except no effort is made to
% list only the captions. The whole set of tables is read in as is,
% except that the tables are not to `float'.
%    \begin{macrocode}
\def\@tablepage{\@ifundefined{tf@pot}{}{\if@filesw
  \immediate\closeout\tf@pot\fi
  \@ifundefined{appendixname}{}{\def\appendixname{}}
%<agu>  \noappendix
  \parindent\z@
  \reset@figtab\clearpage\section*{\tablepagename}
    \@mkboth{\uppercase{\tablepagename}}{\uppercase{\tablepagename}}%
   \def\table{\def\@captype{table}\vbox\bgroup
%<egs>    \small
%<*!agu>
   }\def\endtable{\egroup\bigskip}%
%</!agu>
%<agu>   }\def\endtable{\spew@tblnotes\egroup\bigskip}%
%<agu>   \let\planotable=\aguplano \let\endplanotable=\endaguplano
%<agu>   \def\@float##1{\def\@captype{table}\vbox\bgroup}
%<agu>   \let\@dblfloat=\@float \let\clearpage=\newpage
%<longtab&!209>   \def\longtable{\newpage\FC@ltab} \let\endlongtable=\FC@endltab
  \@input{\jobname.\lot}
  \clearpage}}
%    \end{macrocode}
%
% Note that \texttt{agu} needs to provide for \texttt{planotable}. Since that
% environment calls |\@float| or |\@dblfloat| explicitly, the only way to
% turn of the floating mechanism is to redefine those commands. The
% |\clearpage| is also turned into |\newpage| otherwise \texttt{planotable}
% tries to eject some pseudo floats when tables are continued, resulting in
% an unwanted blank page.
%
% The \texttt{longtable} environment does not call the floating mechanism, 
% but we do have to restore the original definitions here. But add 
% \cs{newpage} to \cs{longtable} so that each such table starts on a new page.
% \end{macro}
%
% \begin{macro}{\printfigures}
% A similar page of figures (as opposed to their captions only) is added
% only optionally if the command |\printfigures| is given in the preamble.
%    \begin{macrocode}
\def\printfigures{\@figpagetrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@figurepage}
% \changes{4.1}{1993 Nov 20}{Revisions for AGU supplement}
% \changes{4.3a}{1994 Jun 6}{Zero \cmd{\parindent} for AGU}
% \changes{4.3a}{1994 Jun 6}{Add \cmd{\figurewidth} and \cmd{\platewidth} for
%      AGU}
% The page(s) of figures are much like those for the tables, except that
% the |\label| command must be switched off. This is because the labels
% have already been defined during the list of captions. However, any
% entries to a list of figures will be made here, since
% |\addtocontentsline| is in effect.
%
% For AGU, make the |\figurewidth| and |\platewidth| commands set |\hsize|
% (as well as |\pt@width|) in order to avoid overfull hboxes.
%    \begin{macrocode}
\def\@figurepage{\if@figpage\@ifundefined{tf@pof}{}{%
  \@ifundefined{appendixname}{}{\def\appendixname{}}
%<agu>  \noappendix \parindent\z@
  \reset@figtab\clearpage\section*{\figurepagename}%
  \@mkboth{\uppercase{\figurepagename}}{\uppercase{\figurepagename}}%
  \begingroup
%<agu>  \def\figurewidth##1{\pt@width##1\hsize##1}
  \def\figure{\def\@captype{figure}\vbox\bgroup}\def\endfigure{\egroup
    \vspace{20pt}}%
%<*plates>
%<agu>  \let\platewidth=\figurewidth
  \def\plate{\def\@captype{plate}\vbox\bgroup}\let\endplate=\endfigure
%</plates>
  \def\label##1{}%
  \@input{\jobname.\lof}\newpage\endgroup}\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makefcaption}
% The special caption format for the captions list is defined here. The
% difference between this and the regular |\@makecaption| is that it is
% never centered if the text is less than one line. Unfortunately, this may
% alter the style of the caption. Maybe some better solution can be found.
% (The specific journals have special definitions of |\@makefcaption|
% that are given later.)
%    \begin{macrocode}
%<*!agu&!egs>
\long\def\@makefcaption#1#2{%
   \vskip 10pt
    #1. #2\par }
%</!agu&!egs>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\reset@figtab}
% The command to reset the figure and table counters.
%    \begin{macrocode}
\def\reset@figtab{%
  \setcounter{figure}{0}\setcounter{table}{0}
%<*plates>
  \setcounter{plate}{0}
%</plates>
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\enddocument}
% \changes{3.4}{1993 Aug 10}{Change order of pages to tables, figcaps,
%      figures}
% \changes{4.1}{1993 Nov 15}{For AGU, order is figcaps, tables, figures}
% The pages of figures, tables, and captions should be printed
% automatically at the end of the document without any extra commands from
% the author. To do this, put them into the |\end{document}|.
% (This can be done much more easily in \LaTeXe.)
%    \begin{macrocode}
%<*209>
\let\@nddoc=\enddocument
%<!agu>\def\enddocument{\iffigcaps\@tablepage\@figurecaps\@figurepage\fi\@nddoc}
%<agu>\def\enddocument{\iffigcaps\@figurecaps\@tablepage\@figurepage\fi\@nddoc}
%</209>
%<*!209>
%<!agu>\AtEndDocument{\iffigcaps\@tablepage\@figurecaps\@figurepage\fi}
%<agu>\AtEndDocument{\iffigcaps\@figurecaps\@tablepage\@figurepage\fi}
%</!209>
%    \end{macrocode}
% \end{macro}
%
% \subsection{Complications with the Appendix}
% The problem is that the figures etc.\ are stored to auxiliary files
% {\tt.lof} or {\tt.lot} and then read in later at the end of the paper.
% Thus these files must know when the |\appendix| has been given and when
% |\section| commands have been issued (new appendices) in order to keep the
% number labels straight. It is also necessary to reset things to their
% previous status. The |\@addtoreset| command must be undone, something that
% is not normally allowed for.
%
% The modifications here are added to the |\appendix| definition that
% exists \emph{before} this file is read in. The |\appendix| is not
% defined here, nor need it even include such subnumbering.
% The following macros merely allow such subnumbering to function properly
% under this style option.
%
% \begin{macro}{\appendix}
% \changes{3.3}{1993 Jul 23}{Add possibility of subnumbered figures and
%                            tables in appendix}
% \changes{4.2}{1993 Dec 21}{Add auxiliary file switch test for the appendix
%      entries to the \texttt{pof} and \texttt{pot} files}
% \changes{4.5}{1996 Jan 10}{Add flag to indicate appendix is on}
% \changes{4.5h}{1997 Nov 18}{Globally \cs{let} some things be redefined}
% The existing definition of |\appendix| is stored and the new |\appendix|
% command is defined. It writes |\doappendix| to the auxiliary files,
% redefines |\section| so that it puts a |\stepcounter{section}| command
% into the auxiliary files, and executes |\doappendix|.
% The definition of the |\section| command must be stored at a number of
% locations: |\@section| is the original non-appendix version, while
% |\@@section| contains any redinitions made by |\doappendix|, i.e., by the
% original |\appendix| command.
%
% Both |\@section| and |\reset@figtab| are globally set to avoid a problem
% if the appendix occurs inside an environment. This does occur with the
% AGU |\begin{article}|\dots|\end{article}| feature.
%
% The flag |\ifFC@appendix| is used to test if the appendix is active when
% the first float appears, so that when the auxiliary file is opened, the
% |\doappendix| is written immediately to it. Previously, without this, if
% the first figure or table appeared in the appendix, the listed captions
% did not have appendix numbering because this command was missing in the
% captions files.
%
%    \begin{macrocode}
\let\@appendix=\appendix
\newif\ifFC@appendix \FC@appendixfalse
\def\appendix{\FC@appendixtrue
  \@ifundefined{tf@pof}{}{\if@filesw\FC@writefile{pof}{\string\doappendix}\fi}%
  \@ifundefined{tf@pot}{}{\if@filesw\FC@writefile{pot}{\string\doappendix}\fi}%
  \global\let\@section=\section
  \doappendix
  \let\@@section=\section
  \def\section{%
    \@ifundefined{tf@pof}{}{\if@filesw\FC@writefile{pof}{\string
        \stepcounter{section}}\fi}%
    \@ifundefined{tf@pot}{}{\if@filesw\FC@writefile{pot}{\string
        \stepcounter{section}}\fi}%
    \@@section}
  \global\let\reset@figtab=\@unappendix}
%    \end{macrocode}
% The last step alters |\reset@figtab| so that appendix features are
% reset as well as the counters.
% \end{macro}
%
% \begin{macro}{\doappendix}
% \changes{4.5h}{1997 Nov 18}{Globally \cs{let} some things be redefined}
% The |\doappendix| contains those commands that must be executed when
% |\appendix| is given, both in the main text, and when the auxiliary files
% are reread in. It first saves the current definitions of |\thexxx|
% and of |\cl@section| (the list of counters that are reset when the section
% counter is incremented).
%    \begin{macrocode}
\def\doappendix{%
  \global\let\@thefigure=\thefigure
  \global\let\@thetable=\thetable
%<*plates>
  \global\let\@theplate=\theplate
%</plates>
  \global\let\@cl@section=\cl@section
  \@appendix
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@unappendix}
% The |\@unappendix| undoes the changes made by |\doappendix|.
% It becomes |\reset@figcaps| when |\appendix| is called.
% It is thus invoked by |\@figurecaps|, |\@tablepage|, and |\@figurepage|.
%    \begin{macrocode}
\def\@unappendix{\FC@appendixfalse
  \setcounter{figure}{0}\setcounter{table}{0}
  \let\thefigure=\@thefigure
  \let\thetable=\@thetable
%<*plates>
  \setcounter{plate}{0}%
  \let\theplate=\@theplate
%</plates>
  \let\cl@section=\@cl@section
  \let\section=\@section
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Complications with \texttt{sublabel.sty}}
% \begin{macro}{\sublabon}
% \changes{3.3}{1993 Jul 23}{Additions to allow for style option {\tt
%                            sublabel.sty}}
% \begin{macro}{\sublaboff}
% A similar problem exists if the style option \texttt{sublabel} has been
% activated. This could mean that figures and tables are subnumbered even
% outside of an appendix. Subnumbering here means e.g., 4{\it a}, 4{\it b},
% etc. As for the appendix, here too the auxiliary files must know when
% subnumbering is turned on and off. This means that these commands must be
% written to the auxiliary files whenever issued.
%
% These modifications here can only be made \emph{after}
% \texttt{sublabel.sty} has been read in, for obvious reasons.
%    \begin{macrocode}
%<*sublab>
\let\orisubon=\sublabon
\let\orisuboff=\sublaboff
\def\sublabon#1{\orisubon{#1}\if@filesw
    \iffigcaps\def\@tempb{#1}
    \def\@tempa{figure}\ifx\@tempa\@tempb
    \@ifundefined{tf@pof}{\newwrite\tf@pof
        \immediate\openout\tf@pof\jobname.\lof}{}%
    \FC@writefile{pof}{\string\orisubon{#1}}\fi
%<*plates>
    \def\@tempa{plate}\ifx\@tempa\@tempb
    \@ifundefined{tf@pof}{\newwrite\tf@pof
        \immediate\openout\tf@pof\jobname.\lof}{}%
    \FC@writefile{pof}{\string\orisubon{#1}}\fi
%</plates>
    \def\@tempa{table}\ifx\@tempa\@tempb
    \@ifundefined{tf@pot}{\newwrite\tf@pot
        \immediate\openout\tf@pot\jobname.\lot}{}%
    \FC@writefile{pot}{\string\orisubon{#1}}\fi
\fi\fi}
\def\sublaboff#1{\orisuboff{#1}\if@filesw
    \iffigcaps\def\@tempb{#1}
    \def\@tempa{figure}\ifx\@tempa\@tempb
    \@ifundefined{tf@pof}{\newwrite\tf@pof
        \immediate\openout\tf@pof\jobname.\lof}{}%
    \FC@writefile{pof}{\string\orisuboff{#1}}\fi
%<*plates>
    \def\@tempa{plate}\ifx\@tempa\@tempb
    \@ifundefined{tf@pof}{\newwrite\tf@pof
        \immediate\openout\tf@pof\jobname.\lof}{}%
    \FC@writefile{pof}{\string\orisuboff{#1}}\fi
%</plates>
    \def\@tempa{table}\ifx\@tempa\@tempb
    \@ifundefined{tf@pot}{\newwrite\tf@pot
        \immediate\openout\tf@pot\jobname.\lot}{}%
    \FC@writefile{pot}{\string\orisuboff{#1}}\fi
\fi\fi}
%</sublab>
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \subsection{Journal-Specific Coding}
% \changes{4.1}{1993 Oct 22}{Add extra coding for JGR, GRL, and NLINPROC}
% \changes{4.1}{1993 Nov 20}{Add extra coding for AGU supplement}
% \changes{4.3}{1994 May 19}{Remove obsolete JGR, GRL coding}
% When \thestyle{} is used as a module to other main styles for specific
% journals, there are some extra details that must be seen to.
%
% \begin{macro}{\figbox}
% \changes{4.2}{1993 Nov 20}{Add for AGU supplement, to remove figures
%     from list of figure captions}
% \changes{4.5b}{1996 Jul 22}{Let size fit contents automatically}
% \changes{4.5c}{1996 Jul 29}{Add starred version for no frame}
% For the AGU supplement, figures and plates are put into a |\figbox|
% which reserves space for them, or which can contain a real figure.
% During the printing of the captions, this command is set to swallow
% its argument. The normal captions-only system cannot be used for this
% because there may be additional width commands in the |figure| environment
% for setting the caption widths, which must be observed, i.e., read in.
% This box takes three arguments: width, height, and contents, which
% are centered horizontally and vertically in the box. The box is framed
% with |\framebox| so the parameters |\fboxsep| and |\fboxrule| may
% be used to control its appearance.
% The starred version of this command suppresses the frame without changing
% the |\framebox| parameters. It actually uses |\makebox| instead.
% It is better to use |\figbox*| to remove the frame because |\framebox|
% is also used in the marginal notes for the figures, which always should
% have the frame.
%
% If the first argument (width) is left empty, the box is made to fit its
% contents, both vertically and horizontally. If only the second argument
% (width) is left empty, the width will be as given and the height is scaled
% automatically. This is for use with |\epsfig| and relatives.
%    \begin{macrocode}
%<agu>\def\figbox{\@ifstar{\let\agubox\makebox\@figbox}
%<agu>  {\let\agubox\framebox\@figbox}}
%<agu>\def\@figbox#1#2#3{\hbox to \hsize{\hfil
%<agu>  \ifx!#1!\agubox{#3}\else
%<agu>  \agubox[#1][c]{\ifx!#2!#3\else\@tempdima#2\relax
%<agu>  \divide\@tempdima by2\relax
%<agu>  \advance\@tempdima by-\fboxsep \advance\@tempdima by-\fboxrule
%<agu>  \vrule\@height\@tempdima\@depth\@tempdima\@width\z@
%<agu>  \vbox to \z@{\vss\hbox{#3}\vss}\fi}\fi\hfil}}
%    \end{macrocode}
% \end{macro}
%
% The marking of figures and tables with marginal notes should be
% enabled by default.
%    \begin{macrocode}
%<agu>\figmarktrue
%    \end{macrocode}
%
% For the AGU supplement, the necessary flag is |\if@preprint|. Furthermore,
% for AGU preprints and manuscripts, we need to turn off the |\figurewidth|
% and |\platewidth| commands that come with the AGU-supplied macros.
%    \begin{macrocode}
%<agu>\if@preprint \figcapsfalse
%<agu>  \def\figurewidth#1{\pt@width=\hsize}
%<agu>  \def\platewidth#1{\pt@width=\hsize}
%<agu>\fi
%<agu>\if@draft
%<agu>  \def\figurewidth#1{\pt@width=\hsize}
%<agu>  \def\platewidth#1{\pt@width=\hsize}
%<agu>\fi
%    \end{macrocode}
%
% \begin{macro}{\@makefcaption}
% \changes{4.2}{1993 Nov 20}{Redefine for AGU supplement, to print captions
%      in two widths}
% \changes{4.3a}{1994 Jun 6}{For AGU, set \cmd{\hsize} to avoid overfull
%      hbox messages}
% Now define |\@makefcaption|, the special version of |\@makecaption| for
% the page of captions, for AGU. This is either the supplied version of
% the macro, or a special version that prints the caption twice, in two
% widths.
%    \begin{macrocode}
%<agu>\let\ori@makecap=\@makecaption
%<agu>\def\@makefcaption#1#2{{\if@dblcap\if@camera\pt@width=\textwidth
%<agu> \ori@makecap{#1}{#2}
%<agu> \pt@width=\wpt@width
%<agu> \hsize=\pt@width
%<agu> \vskip10pt \def\label##1{}\fi\fi
%<agu> \ori@makecap{#1}{#2}}
%<agu>}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\doublecaption}
% \changes{4.2}{1993 Nov 20}{Add for AGU supplement, to enable doubled captions
%      in two widths}
% To enable this double caption, one must give |\doublecaption|
% with the width of the wider caption as argument in the preamble.
% A normal value for \textsl{AGU} journals is 35~pc.
%    \begin{macrocode}
%<agu>\newdimen\wpt@width
%<agu>\newif\if@dblcap \@dblcapfalse
%<agu>\def\doublecaption#1{\wpt@width=#1\relax\@dblcaptrue}
%    \end{macrocode}
% \end{macro}
% Finally, for \emph{EGS}, the regular |\@makecaptions|
% macro is sufficient. In that journal, all captions are flush-left to
% begin with, so this might as well be kept for the figure captions too.
%    \begin{macrocode}
%<egs>\let\@makefcaption=\@makecaption
%    \end{macrocode}
% The whole figure caption business is activated only for |draft| mode.
%    \begin{macrocode}
%<egs>\if@draft\figcapstrue\else\figcapsfalse\fi
%    \end{macrocode}
%
% This terminates the special coding, and thus the style file.
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \Finale