summaryrefslogtreecommitdiff
path: root/web/webfiles/xwebdoc.sty
blob: 9d4bd4566b8ccb2ed32ceb69f913758818489271 (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
%
% LaTeX style option xwebdoc for documentation of webfiles package
%
%
% (customized version of progltx.doc and cwebdoc.sty, combined
% with webdoc.sty)
%

\chardef\uscode=\catcode`\_
\catcode`\_=11  % letter


%%% In addition to the normal \LaTeX{} structuring markups we will
%%% provide a markup for a layout of the document that is like in
%%% \WEB{}.  This can be done easily. All sections are numbered, the
%%% number of the next section is stored in the counter |section|.	We
%%% distinguish between main sections which start a group of sections
%%% and between normal sections within a group.

%%% The main sections are started with the macro |\chap|. It has one
%%% parameter, the title of the section group. This parameter must be
%%% terminated by a dot.  We start a new page, typeset the title in
%%% bold face and separate it from the section text with a |\medskip|.
%%% This text, the documentation part of the section, is formatted
%%% without paragraph indentation.

%%% If the \WEB{}-like macros are used every section number should be
%%% output with a following dot. We want to establish this when we use the
%%% |\chap| or the |\sect| macro the first time. Furthermore the new page
%%% at the begin of a main section should not be started at the first
%%% |\chap| because a title may precede it (and the title should not
%%% be on a seperate page unless explicitely requested). Instead a
%%% skip of (approximately) 2~pica should be set. To achieve
%%% both goals a macro |\chap_intro| is defined that defines |\thesection|
%%% appropriately, skips the 2~pica, and redefines itself to
%%% |\newpage|---we then just have to call |\chap_intro| at the beginning
%%% of |\chap|. The same applies to |\sect_intro|.

\newskip\pre_sect_skip	\pre_sect_skip=2pc plus 1pc minus 6pt

\def\chap_intro{%
   \gdef\thesection{\arabic{section}.}%
   \gdef\chap_intro{\newpage}%
   \addvspace{\pre_sect_skip}%
   }

\def\sect_intro{%
   \gdef\thesection{\arabic{section}}%
   \global\let\sect_intro\relax
   }


%%% \sect Now we will have a look at the {\it wonderful\/} internal
%%% interface of \LaTeX{}\@. With ``wonderful'' I mean that I'm always
%%% full of wonder why it was designed in this way. E.g., if anybody
%%% can explain to me why the coding of the non-indentation of the first
%%% line in the following paragraph was combined with the coding of
%%% the skip which will come in front of the section---I will be thankful
%%% for the rest of my life. Such different things should be kept
%%% different, i.e., the suppression of the indentation should not be
%%% hidden in the sign of a skip! The same comment applies to the combined
%%% coding of the skip below the section heading resp.\ to the right
%%% of a run-in heading.

%%% \begin{quote} \it
%%% I want the following layout: no indentation in the following
%%% paragraph\/ {\rm but no} space in front of the section heading.
%%% How do I code a value of\/ $\sl -0 pt$?
%%% \end{quote}
%%% %
%%% Well, a work-around is to use a value of $\rm -1\,sp$ because the
%%% reader will not see this distance---but in my opinions this is no
%%% good programming style. In this special case I have luck, too:
%%% the skip is not set anyway, either it is discarded by the preceding
%%% |\newpage| or it is not added by |\addvspace| because of the preceding
%%% |\pre_sect_skip|.

\def\chap#1.{%
   \chap_intro
   \@startsection{section}{1}%
      {\z@}%
      {\m@ne sp}%
      {\medskipamount}%
      {\normalsize\bf}%
      {#1.}%
   }


%%% \sect Normal sections are started with |\sect|.  This macro has no
%%% parameter.  Between two paragraphs we skip |\pre_sect_skip|.
%%% Between the section number and the text one quad of space is set.
%%% We have to take care for empty documentation parts where the
%%% program part (i.e.\ |\beginprog|) will follow immediately. Then
%%% the program part should begin on a new line and not behind the
%%% section number. So we provide |\null| as an empty documentation
%%% part in every case.

%%% Now again the design of |\@startsection| comes in hand: \LaTeX{}
%%% always leaves a quad after the section number (by the way,
%%% this is not mentioned in the documentation---you have to look
%%% in the macros to figure this out). Because our section header
%%% consists only of the number we have to code a value of $\rm
%%% -0\,pt$\,\dots

\def\sect{%
   \sect_intro
   \@startsection{subsection}{2}%
      {\z@}%
      {\pre_sect_skip}%
      {\m@ne sp}%
      {\normalsize\bf}%
      {\null}%
   }


%%% \sect We are finished and just have to restore the category code.
\catcode`\_=\uscode





%
% logos
%
\def\cweb{{\tt CWEB\/}}
\def\ctangle{{\tt CTANGLE\/}}
\def\cweave{{\tt CWEAVE\/}}
\def\C++{C\raise .4ex\hbox{$\scriptstyle +\!+$}}


%
% new elements
%
\font\manfnt=manfnt	% with the dangerous bend sign
\chardef\bend="7F	% I like the non-S curve ;-)
\newenvironment{fixme}{%
	\trivlist
	    \hangindent 2em
	    \hangafter -2
	    \item[\hbox to 0pt{\hss \manfnt \bend}]%
	    \ignorespaces
    }{%
	\endtrivlist
    }


\newenvironment{cseqtab}{%
	\quote
	\obeycr
	\tabular{lrl}%
	\@gobblecr	% eat following newline
    }{%
	\endtabular
	\endquote
    }


%
% new tags
%
\def\arg#1{{\sl Arg.~#1\/}:}


%
% change of LaTeX parameters, for layout etc.
%

% figure
\def\textfraction{0.1}	% must be at least 10% text on page
\def\topfraction{0.9}	% rest may be top insertion
\def\floatpagefraction{0.8} % float pages only if the float is larger than 80%


%
% from webdoc.sty:
%
\oddsidemargin=10mm
\evensidemargin=0mm
\textwidth=16cm
\textheight=24cm
\topmargin=-4mm
\headsep=8mm
\if@twoside
    \def\ps@headings{%
      \let\@oddfoot\@empty
      \let\@evenfoot\@empty
      \def\@evenhead{{\textup{\thepage}\hfil\footnotesize\leftmark}}%
      \def\@oddhead{{\footnotesize\rightmark}\hfil\textup{\thepage}}%
      \let\@mkboth\markboth
      \def\sectionmark##1{%
        \markboth%
           {\uppercase{\ifnum \c@secnumdepth >\z@
              \S\thesection\hskip 1em\relax\fi ##1}}%
           {\uppercase{\ifnum \c@secnumdepth >\z@
              \S\thesection\hskip 1em\relax\fi ##1}}
      }
      \def\subsectionmark##1{}%
    }
\else
    \def\ps@headings{%
      \let\@oddfoot\@empty
      \def\@oddhead{{\footnotesize\rightmark}\hfil\textbf{\thepage}}%
      \let\@mkboth\markboth
      \def\sectionmark##1{%
        \markright{\uppercase{\ifnum \c@secnumdepth >\m@ne
            \S\thesection\hskip 1em\relax \fi
            ##1}}}
      \def\subsectionmark##1{}%
    }
\fi


%
% from logos.sty:
%
\font\bigfatrm=cmbx10 scaled\magstep5
\let\bfitself\bf
\newif\ifboldface
\def\bf{\boldfacetrue\bfitself}
\font\ninerm=cmr9
\font\ninebold=cmbx9
\font\mflogofont=logo10

%
% MATLAB:
%
\newcommand{\matlab}{%
   \mbox{M{\ifboldface\ninebold\else\ninerm\fi%   
     \kern-.05emA\kern-.15emT\kern-.05emL\kern-.05emA\kern-.05emB%
     \spacefactor1000}}}
   
%
% Maplab en Maplib:
%
% maplab in ems (evenredig met de fontgrootte) --> werkt in alle
% fontgroottes.
%
\def\Maplab{M\kern-.05emA\kern-.20em\raise.6ex\hbox{P}\kern-.30em
    \lower.6ex\hbox{L}\kern-.2em\raise.2ex\hbox{A}\kern-.1emB}
\def\MAPLAB{{\bigfatrm\Maplab}}
\def\maplab{%
   {\ifboldface\ninebold\else\ninerm\fi\Maplab}%
    \index{Maplab@ {\ninerm\protect\Maplab}}}
%
% idem voor MapLib:
%
\def\Maplib{M\kern-.05emA\kern-.20em\raise.6ex\hbox{P}\kern-.30em
    \lower.6ex\hbox{L}\kern-.2em\raise.2ex\hbox{i}\kern0emB}
\def\MAPLIB{{\bigfatrm\Maplib}}
\def\maplib{%
   {\ifboldface\ninebold\else\ninerm\fi\Maplib}%
    \index{Maplib@ {\ninerm\protect\Maplib}}}


%
% Computertalen:
%
\def\cee{{\ninerm C\spacefactor1000}}
\def\fortran{{\ninerm FORTRAN}}
%%\def\cee{{C}}

%
% WEB's, WEAVEs en TANGLEs:
%
\def\web{{\tt WEB}}
\def\cweb{{\tt CWEB}}
\def\mweb{{\tt MWEB}}
\def\nuweb{{\tt nuweb}}
\def\ceeweb{{\tt ceeweb}}

\def\weave{{\tt weave}}
\def\cweave{{\tt cweave}}
\def\ceeweave{{\tt ceeweave}}
\def\mweave{{\tt mweave}}

\def\tangle{{\tt tangle}}
\def\ctangle{{\tt ctangle}}
\def\ceetangle{{\tt ceetangle}}
\def\mtangle{{\tt mtangle}}

\def\spider{{\rm Spider}}


%
% Tools
%
\def\MakeIndex{{\it MakeIndex\/{}}}

%
% diversen
%
\def\C++{\cee\raise .4ex\hbox{$\scriptstyle +\!+$}}
\def\unix{{\ninerm U\kern-.05emNIX\spacefactor1000}}
\def\uvalogo{\center\parbox{0mm}{\input{UvA}\box\graph\hss\vss}}
\def\metafont{{\mflogofont METAFONT}}
\def\metapost{{\mflogofont METAPOST}}
\def\BibTeX{{\sc Bib}{\rm\TeX}}
\def\MakeIndex{{\it MakeIndex}}