summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/outline.sty
blob: 77c82f0779717f259034f09a4f546efe0a61097b (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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                  outline.sty -- Outline Style
%                           Hal R. Varian
%                          September, 1987
%
%  Reads structured files generated by PC-OUTLINE and formats them
%  in TeX.  Before using you must use a global search and replace command
%  to change all strings of ".HEAD" to "\HEAD".  Then load outline.sty
%  and TeX the outline file.
%
%  Notes
%  1. To generate the outline, choose "Send to structured file" from the
%     device menu in the print routine of PC-OUTLINE.
%  2. The title must be indicated manually using \title.  It is usually
%     indicated by a .HEAD 1
%  3. Sometimes the structured file ends with a spurious .HEAD 1 which should
%     be removed.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
%for title
\def\title#1{\centerline{\bf #1}\medskip}
     
%use \count11 thru \count18 for counters for levels 1 thru 8
     
\count11=0
\count12=0
\count13=0
\count14=0
\count15=0
\count16=0
\count17=0
\count18=0
     
%create registers for levels, etc.
     
\newcount\CurrentLevel\CurrentLevel=0
\newcount\LastLevel\LastLevel=0
\newcount\CurrentCounter\CurrentCounter=1
\newcount\CharCode\CharCode=96
     
%\Indentation measures the amount of indentation
\newdimen\Indentation\Indentation=3ex
     
%skip between level 1 headings
\def\AdjustSpace{\vskip -.5pc}
     
\parindent=0pt
\parskip=0pt
     
\def\HEAD #1 {%
\par
\CurrentLevel=#1
\CurrentCounter=#1
\advance\CurrentCounter by 10         %level 1 is assigned to register 11, etc.
\ifnum\CurrentLevel>\LastLevel                %if sublevel,
   \count\CurrentCounter=1                    %reset \CurrentCounter,
   \else\advance\count\CurrentCounter by 1\fi %otherwise, increment
\LastLevel=\CurrentLevel
\filbreak     %helps prevent entries from being split between pages
\hskip\CurrentLevel\Indentation
\CharCode=\number\count\CurrentCounter  %for lettered levels
\let\NumCode=\CharCode                  %for numbered levels
\ifcase#1%
\relax\or                               %there is no level zero
   \AdjustSpace\advance\CharCode by 64
\Item\char\CharCode.\space\or           %level 1: A.
\Item\llap{\number\NumCode.\space}\or   %level 2: 1.
   \advance\CharCode by 96
\Item\llap{\char\CharCode)\space}\or    %level 3: a)
\Item\llap{\number\NumCode)\space}\or   %level 4: 1)
   \advance\CharCode by 96
\Item\llap{\char\CharCode$>$\space}\or  %level 5: a>
\Item\llap{\number\NumCode$>$\space}\or %level 6: 1>
   \advance\CharCode by 96
\Item\llap{\char\CharCode:\space}\or    %level 7: a:
\Item\llap{\number\NumCode:\space}\fi}  %level 8: 1:
     
\def\Item{\hangindent\CurrentLevel\Indentation}
%%%-Incise----------------------------------------------------------