blob: 79d1c2d8bb66077f78b61a21a089aa80244df66d (
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
% -- -- Hyperfweb.tex -- --
%
% This one does the same thing for fweb as Tanmoy Bhattacharyya's
% hyperweb.tex does for Pascal web but without the input hacking hacks
%
% It rather assumes an fweave where every occurrence of a module number
% is screened by a macro call, so that the macros downbelow
% only have to swich meaning of one macro, according to context
%
% Please note that this is a supplement not a replacement
% for fwebmac.sty
%
%
\input hyperbasics
\def\HySRnull#1{#1}
\let\HySR=\HySRnull
\def\HySRef#1{\hyperref{}{section}{#1}{#1}}
%
%
%
%
%
\def\note#1#2.{\WY\noindent{\let\HySR=\HySRef
\hangindent2em\baselineskip10pt\eightrm#1~#2.\par}}
\def\startsection{\WQ\noindent{\let\*=\empty\bf\hyperdef\hypernoname
{section}{\modstar}{\let\*=\lapstar\modstar.}%
\ifx\includefile\empty\else\ [{\tt\includefile}]\fi\quad}}
\def\WX#1:#2\X#3\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi
\XX$\langle\,$#2{\let\HySR=\HySRef
\eightrm\kern.5em#1}$\,\rangle^{\rm #3}$\XX}
\def\lheader{\mainfont\hyperdef\hypernoname{page}{\the\pageno}%
{\the\pageno}\eightrm\qquad\Whead\hfill\Wtitle\qquad
\ifnum\pageno=\contentspageno\else
\tensy x\mainfont\Wmodno
\fi}
\def\rheader{\ifnum\pageno=\contentspageno\else
\tensy x\mainfont\Wmodno
\fi
\eightrm\qquad\Wtitle\hfill\Whead
\qquad\mainfont\hyperdef\hypernoname{page}{\the\pageno}%
{\the\pageno}}
\newbox\hyperbox
\newif\iffooter\footertrue
\def\normaloutput#1#2#3{
\ifodd\pageno\hoffset=\pageshift\fi
\shipout\vbox
{
\vbox to\fullpageheight
{
\iftitle\global\titlefalse
\else \hbox to\pagewidth
{\vbox to10pt{}%
\ifidenticalpageheads#2\else
\ifodd\pageno
#3% Pg nos alternate left \& right.
\else#2\fi
\fi
}%
\fi
\vfill#1% Parameter |#1| is the page itself.
\iffooter\vfill\copy\hyperbox\fi
}
}
\global\advance\pageno by1}
{\boxmaxdepth=0pt\relax\global
\setbox\hyperbox\hbox to \pagewidth{GO TO:\hfil\hyperref{}{page}{1}{first
page}\hfil\hyperref{}{section}{INDEX}{Index}\hfil\hyperref{}{section}%
{SECTIONS}{Section Names}\hfil\hyperref{}{section}{CONTENTS}{Contents}}}
\iffooter\advance\pageheight by -\ht\hyperbox\setpage\relax\fi
\def\Winx{\par\vskip6pt plus 1fil
\let\HySR=\HySRef
\write\cont{}% Ensure that the contents file isn't empty
\closeout\cont % The contents information has been fully gathered
\output{\ifpagesaved\normaloutput{\box\Sbox}\lheader\rheader\fi
\global\setbox\Sbox=\page \global\pagesavedtrue}
\pagesavedfalse \eject % Eject the page-so-far and predecessors
\setbox\Sbox\vbox{\unvbox\Sbox}% Take it out of its box
\vsize=\pageheight \advance\vsize by -\ht\Sbox % The remaining height
\hsize=.5\pagewidth \advance\hsize by -10pt
% Column width for the index (20pt between cols)
\parfillskip 0pt plus .6\hsize % Try to avoid almost empty lines
\def\lr{L}% This tells whether the left or right column is next
\output{\if L\lr\global\setbox\Lbox=\page \gdef\lr{R}
\else\normaloutput{\vbox to\pageheight{\box\Sbox\vss
\hbox to\pagewidth{\box\Lbox\hfil\page}}}\lheader\rheader
\global\vsize\pageheight\gdef\lr{L}\global\pagesavedfalse\fi}
%% \message{Index:}
\parskip 0pt plus .5pt
\outer\def\:##1, {\par\hangindent2em\noindent##1:\kern1em}% Index entry
\def\[##1]{$\underline{##1}$}% Underlined index item
\def\(##1){$^{\rm ##1}$}% Language marker
\hyperdef\hypernoname{section}{INDEX}{}%
\let\Windexspace\medskip % Spacing between letter groups in index.
\rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
\hyphenpenalty 10000 \parindent0pt}
\def\Wfin{\par\vfill\eject
\ifpagesaved\null\vfill\eject\fi % Output a null index column
\if L\lr\else\null\vfill\eject\fi % Finish the current page
\parfillskip 0pt plus 1fil
\def\rhead{NAMES OF THE SECTIONS}
\output{\normaloutput\page\lheader\rheader}
\setpage
\hyperdef\hypernoname{section}{SECTIONS}{}%
\def\note##1##2.{\quad{\eightrm##1 ##2.}}
\def\WU{\note{Used in }}% Cross-reference for uses of sections
\def\:{\par\hangindent 2em}\let\*=*}
\def\Wcon{\par\vfill\eject
\rightskip 0pt \hyphenpenalty 50 \tolerance 200
\setpage
\output{\normaloutput\page\lheader\rheader}
\titletrue % Prepare to output the table of contents
\hyperdef\hypernoname{section}{CONTENTS}{}
\pageno=\contentspageno \def\rhead{TABLE OF CONTENTS}
\topofcontents
\catcode`\@=11
\hbox to\hsize{\hfil Section\hbox to3em{\hss Page}}
\def\WZ##1##2##3##4{\hbox to\hsize{\kern##1em\ignorespaces##2
\leaders\hbox to .5em{.\hfil}\hfil\ %
\let\preserve=\*\let\*=\empty
\hyperref{}{section}{##3}{\let\*=\preserve##3}%
\hbox to3em{\hss\hyperref{}{page}{##4}{##4}}}}
\let\WIM\WIN % Restore the proper definition.
\readcontents\relax % Read the contents info.
\botofcontents
\FWEBend}
|