about summary refs log tree commit diff
path: root/tmac.toc
blob: 6909c0e53686e490fa675fedd6a41ba3c6db390c (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
.\" generate toc
.de toc.gen
.	nr toc.i \\$1
.	br
.	mk
.	nr toc.ll (\\n[.l]u-\w'\\*[toc.\\n[toc.i].name]')
.	nr toc.ll (\\n[toc.ll]u-\w'\\n[toc.\\n[toc.i].num]'-2)
.	ad l
.	post.url "#toc.\\n[toc.i]" "\\*[toc.\\n[toc.i].name]"
\v'0em'\l'\\n[toc.ll]u.'
.	br
.\"	rt
.	ad r
.\"	br
\v'-1em'\\n[toc.\\n[toc.i].num]
.	nr toc.i +1
.	if !(\\n[toc.i]=\\n[toc.total]) \{\
.   sp -0.1
.		toc.gen \\n[toc.i]
.	\}
..
.\" add to toc
.de toc.mark
.	post.mark "\\$*"
.	post.name "toc.\\n[toc.idx]"
.	tm INDEX.ds toc.\\n[toc.idx].name \\$*
.	tm INDEX.nr toc.\\n[toc.idx].num \\n[.%]
.	nr toc.idx +1
.	tm INDEX.nr toc.total \\n[toc.idx]
.	tm INDEX.nr toc.init 1
..
.\" wraper for toc
.de toc
.	nr toc.oldad \\n(.j
.	if \\n[toc.init] \{\
.		sp
.		ce
.ft B
.ps +2
\\*[toc.tl]
.ft R
.sp 2
.		toc.gen 0
.	\}
.	br
.	ad \\n[toc.oldad]
..
.ds toc.tl TABLE OF CONTENTS