The subfig package^{∗}

Andrew D. Lewis

1998/03/05

1 How to use the subfig macros

subfigures The package subfig defines an environment subfigures within which the figures will be numbered and are referenced alphabetically. That is, if the last figure number is, say 2, when the subfigures environment is fired up, the figures inside the environment will be numbered 2a, 2b, etc. Referencing also uses the alphabetical numbering scheme. Easy as that!

If you want to temporarily turn off the alphabetical numbering and pretend that you never asked for it, use the option normal.

2 Implementation

1 ⟨∗package⟩

First the options.

2

 3 \newif\if@ADL@normal\@ADL@normalfalse
 4 \DeclareOption{normal}{\@ADL@normaltrue}
 5 \ProcessOptions

Checking to see if we have specified normal, define the subfigures environment. If normal is on, simply make it a dud. If normal is not on, then save the current figure number in \@tempa and restart the figure counter at zero (recalling that since we are inside an environment, this will be local). This is a direct hack of the AMS ‘subequations’ environment.

6

 7 \if@ADL@normal
 8 \PackageWarning{subfig}{Disabling `subfigures' environment}
 9 \newenvironment{subfigures}{\relax}{\relax}
10 \else
11 \newenvironment{subfigures}{%
12  \refstepcounter{figure}%
13  \begingroup % conservative approach
14  \let\protect\@nx

∗This file has version number v1.0a, last revised 1998/03/05.

15  \edef\@tempa{\def\@nx\theparentfigure{\thefigure}}%
16  \@xp\endgroup\@tempa
17  \setcounter{parentfigure}{\value{figure}}%
18  \setcounter{figure}{0}%
19  \def\thefigure{\theparentfigure\alph{figure}}%
20  \ignorespaces}
21  {\setcounter{figure}{\value{parentfigure}}\global\@ignoretrue}
22 \fi

23

24 ⟨/package⟩