%% FILE:   subtabfg in SYS2.TEX.PUB.ISULATEX.STYLES
%% AUTHOR: Erica M. S. Harris
%% DATE:   August 1990
%% DESCR:  Style option for subnumbering tables and figures.
%%         Use \subfigures to start subnumbering figures; \newsubfigure
%%         to start a new set of subfigures; and \nosubfigures to turn
%%         subfigure numbering off. These commands should be used outside the
%%         figure environment.  The subfigures can be labelled and referred to
%%         as usual. If you want to label an entire set of subfigures use the
%%         \figurelabel command after the \caption for one of the subfigures in
%%         the set.
%%         Similarly, Use \subtables to start subnumbering tables;
%%         \newsubtable to start a new set of subtables; and \nosubtables
%%         to turn subtable numbering off. These commands should be used
%%         outside the table environment.  The subtables can be labelled and
%%         referred to as usual. If you want to label an entire set of
%%         subtables use the \tablelabel command after the \caption for one
%%         of the subtables in the set.
%%
%% MODS:
%%
\newcounter{mainfigure}

\def\subfigures{\setcounter{mainfigure}{\c@figure}
    \stepcounter{mainfigure}
    \setcounter{figure}{0}
    \global\let\oldthefigure\thefigure%
    \@ifundefined{chapter}%
       {\gdef\thefigure{\themainfigure\alph{figure}}
        \global\let\thewholefigure\themainfigure}
       {\gdef\thefigure{\thechapter.\themainfigure\alph{figure}}
        \gdef\thewholefigure{\thechapter.\themainfigure}}
     \global\let\@currentfigurelabel\thewholefigure}

\def\newsubfigure{\stepcounter{mainfigure}\setcounter{figure}{0}}

\def\nosubfigures{\setcounter{figure}{\c@mainfigure}
       \@ifundefined{chapter}{\gdef\thefigure{\arabic{figure}}}%
               {\gdef\thefigure{\thechapter.\arabic{figure}}}}

\def\@currentfigurelabel{}

\def\figurelabel#1{\@bsphack\if@filesw {\let\thepage\relax
     \xdef\@gtempa{\write\@auxout{\string
         \newlabel{#1}{{\@currentfigurelabel}{\thepage}}}}}
     \@gtempa \if@nobreak \ifvmode\nobreak\fi\fi\fi\@esphack}

\newcounter{maintable}

\def\subtables{\setcounter{maintable}{\c@table}
    \stepcounter{maintable}
    \setcounter{table}{0}
    \global\let\oldthetable\thetable%
    \@ifundefined{chapter}%
       {\gdef\thetable{\themaintable\alph{table}}
        \global\let\thewholetable\themaintable}
       {\gdef\thetable{\thechapter.\themaintable\alph{table}}
        \gdef\thewholetable{\thechapter.\themaintable}}
     \global\let\@currenttablelabel\thewholetable}

\def\newsubtable{\stepcounter{maintable}\setcounter{table}{0}}

\def\nosubtables{\setcounter{table}{\c@maintable}
       \@ifundefined{chapter}{\gdef\thetable{\arabic{table}}}%
               {\gdef\thetable{\thechapter.\arabic{table}}}}

\def\@currenttablelabel{}

\def\tablelabel#1{\@bsphack\if@filesw {\let\thepage\relax
     \xdef\@gtempa{\write\@auxout{\string
         \newlabel{#1}{{\@currenttablelabel}{\thepage}}}}}
     \@gtempa \if@nobreak \ifvmode\nobreak\fi\fi\fi\@esphack}
