% subfig.sty 
% ----------------------------------------------------------------------
%                     This LaTeX environment  is for
% printing   subfigures.   To   use   this   environment,  include  in  the
% \documentstyle header  a command to  load in the  .sty file containing this
% macro. For example:
%     \documentstyle[subfig]{article}
% if you  have the  macro in  a file subfig.sty. The environment seems pretty
% well documented in the comments.
%
% Modified : June 8, 1989.  You can now reference either individual
%            figures in the subfigures environment, or all of
%            them.  If you use a \label command immediately after the
%            \begin{subfigures} command, then a reference to that
%            label will generate a reference to the figure number
%            without the alphabetic extension.
%
% Modified : 16 - january - 1989 by Johannes Braams ( BRAAMS@HLSDNL5)
%            Added \global\@ignoretrue in the definition of
%            \endsubfigures in order to prevent a spurious space
%            at the beginning of the next text-line. Also added %'s
%            at the end of each command-line for the same reasons.
%
% Modified: 961011 - by Pete Newbury.  Took subeqn.sty and did a global
%            search-and-replace ``subeqn'' --> ``subfig'' and
%            ``equation'' --> ``figure''.   
%
%%%----------------------------------------------------------------
%%% File: subfig.sty
%%% The subfigures environment %%%
%
% Within the subfigures environment, the only change is that
% figures are labeled differently.  The number stays the same,
% and lower case letters are appended.  For example, if after doing
% three figures, numbered 1, 2, and 3, you start a subfigures
% environmment and do three more figures, they will be numbered
% 4a, 4b, and 4c.  After you end the subfigures environment, the
% next figure will be numbered 5.
%
% Both text and figures can be put inside the subfigures environment.
%
% If you make any improvements, I'd like to hear about them.
%
%
\newtoks\@stfigure

\def\subfigures{\refstepcounter{figure}%
\edef\@savedfigure{\the\c@figure}%
\@stfigure=\expandafter{\thefigure}%   %only want \thefigure
\edef\@savedthefigure{\the\@stfigure}% %expanded once
\edef\oldthefigure{\thefigure}%
\setcounter{figure}{0}%
\def\thefigure{\oldthefigure\alph{figure}}}%

\def\endsubfigures{%
\setcounter{figure}{\@savedfigure}%
\@stfigure=\expandafter{\@savedthefigure}%
\edef\thefigure{\the\@stfigure}\global\@ignoretrue}
%%%----------------------------

