summaryrefslogtreecommitdiff
path: root/info/examples/tip/enumlist.tip
blob: f3baeb5b5d44d290932a268148d7f8916a286e3d (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
73
74
75
76
77
78
79
80
81
82
83
% This macro source file is from the four volume series
% "TeX in Practice" by Stephan von Bechtolsheim, published
% 1993 by Springer-Verlag, New York.
% Copyright 1993 Stephan von Bechtolsheim.
% No warranty or liability is assumed.
% This macro may be copied freely if no fees other than
% media cost or shipping charges are charged and as long
% as this copyright and the following source code itself
% is not changed. Please see the series for further information.
%
% Version: 1.0
% Date: May 1, 1993
%
%
% This source code is documented in 11.3.1, p. II-72.
% Original source in file "par2.TEX", starting line 1216.
\wlog{L: "enumlist.tip" ["par2.TEX," l. 1216, p. II-72]}%
% This file DOES belong to format "texip."
\InputD{parv-1.tip}
\InputD{counters.tip}
\catcode`\@ = 11
\newcount\@EnumerateListDepth
\@EnumerateListDepth = 0
\NewCounter{Enumerate1}{\arabic}% 
    {\TheCounter{Enumerate1}.}{\TheCounter{Enumerate1}}
\NewCounter{Enumerate2}{\alph}% 
    {(\TheCounter{Enumerate2})}% 
    {\TheCounter{Enumerate1}.\TheCounter{Enumerate2}}
\NewCounter{Enumerate3}{\roman}% 
    {\TheCounter{Enumerate3}.}% 
    {\RefCounter{Enumerate2}.\TheCounter{Enumerate3}}
\NewCounter{Enumerate4}{\Alph}% 
    {\TheCounter{Enumerate4}.}% 
    {\RefCounter{Enumerate3}.\TheCounter{Enumerate4}}
\def\BeginEnumerate{% 
    \begingroup
    \global\advance\@EnumerateListDepth by 1
    \ifcase\@EnumerateListDepth
        \errmessage{\string\BeginEnumerate: no level
            zero.}%
    \or
        \SetCounter{Enumerate1}{0}%
        \@BeginEnumerateLevelOne
        \def\Label ##1{\@Label{##1}{\RefCounter{Enumerate1}}{1}}%
        \def\Item{% 
            \StepCounter{Enumerate1}%
            \ItemLR{\PrintCounter{Enumerate1}}%
        }%
    \or
        \SetCounter{Enumerate2}{0}%
        \@BeginEnumerateLevelTwo
        \def\Label ##1{\@Label{##1}{\RefCounter{Enumerate2}}{1}}%
        \def\Item{% 
            \StepCounter{Enumerate2}%
            \ItemLR{\PrintCounter{Enumerate2}}%
        }%
    \or
        \SetCounter{Enumerate3}{0}%
        \@BeginEnumerateLevelThree
        \def\Label ##1{\@Label{##1}{\RefCounter{Enumerate3}}{1}}%
        \def\Item{% 
            \StepCounter{Enumerate3}%
            \ItemLR{\PrintCounter{Enumerate3}}%
        }%
    \or
        \SetCounter{Enumerate4}{0}%
        \@BeginEnumerateLevelFour
        \def\Label ##1{\@Label{##1}{\RefCounter{Enumerate4}}{1}}%
        \def\Item{% 
            \StepCounter{Enumerate4}%
            \ItemLR{\PrintCounter{Enumerate4}}%
        }%
    \else
        \errmessage{\string\BeginEnumerate: maximum
            nesting level of 4 exceeded.}%
    \fi
}
\def\EndEnumerate{% 
    \EndAList
    \endgroup
    \global\advance\@EnumerateListDepth by -1
}
\catcode`\@ = 12