summaryrefslogtreecommitdiff
path: root/macros/latex209/contrib/misc/subtabfg.sty
blob: 8b0560af92f0445f67cd1e7e6c49481fe1506798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%% 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}