OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [texinfo/] [texinfo.tex] - Blame information for rev 1779

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1005 ivang
% texinfo.tex -- TeX macros to handle Texinfo files.
2
%
3
% Load plain if necessary, i.e., if running under initex.
4
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5
%
6
\def\texinfoversion{2000-05-28.15}
7
%
8
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
9
% Free Software Foundation, Inc.
10
%
11
% This texinfo.tex file is free software; you can redistribute it and/or
12
% modify it under the terms of the GNU General Public License as
13
% published by the Free Software Foundation; either version 2, or (at
14
% your option) any later version.
15
%
16
% This texinfo.tex file is distributed in the hope that it will be
17
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
18
% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19
% General Public License for more details.
20
%
21
% You should have received a copy of the GNU General Public License
22
% along with this texinfo.tex file; see the file COPYING.  If not, write
23
% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24
% Boston, MA 02111-1307, USA.
25
%
26
% In other words, you are welcome to use, share and improve this program.
27
% You are forbidden to forbid anyone else to use, share and improve
28
% what you give them.   Help stamp out software-hoarding!
29
%
30
% Please try the latest version of texinfo.tex before submitting bug
31
% reports; you can get the latest version from:
32
%   ftp://ftp.gnu.org/gnu/texinfo.tex
33
%   (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
34
%   ftp://texinfo.org/tex/texinfo.tex
35
%   ftp://us.ctan.org/macros/texinfo/texinfo.tex
36
%   (and all CTAN mirrors, finger ctan@us.ctan.org for a list).
37
%   /home/gd/gnu/doc/texinfo.tex on the GNU machines.
38
% The texinfo.tex in any given Texinfo distribution could well be out
39
% of date, so if that's what you're using, please check.
40
% Texinfo has a small home page at http://texinfo.org/.
41
%
42
% Send bug reports to bug-texinfo@gnu.org.  Please include including a
43
% complete document in each bug report with which we can reproduce the
44
% problem.  Patches are, of course, greatly appreciated.
45
%
46
% To process a Texinfo manual with TeX, it's most reliable to use the
47
% texi2dvi shell script that comes with the distribution.  For a simple
48
% manual foo.texi, however, you can get away with this:
49
%   tex foo.texi
50
%   texindex foo.??
51
%   tex foo.texi
52
%   tex foo.texi
53
%   dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps.
54
% The extra runs of TeX get the cross-reference information correct.
55
% Sometimes one run after texindex suffices, and sometimes you need more
56
% than two; texi2dvi does it as many times as necessary.
57
%
58
% It is possible to adapt texinfo.tex for other languages.  You can get
59
% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/.
60
 
61
\message{Loading texinfo [version \texinfoversion]:}
62
 
63
% If in a .fmt file, print the version number
64
% and turn on active characters that we couldn't do earlier because
65
% they might have appeared in the input file name.
66
\everyjob{\message{[Texinfo version \texinfoversion]}%
67
  \catcode`+=\active \catcode`\_=\active}
68
 
69
% Save some parts of plain tex whose names we will redefine.
70
\let\ptexb=\b
71
\let\ptexbullet=\bullet
72
\let\ptexc=\c
73
\let\ptexcomma=\,
74
\let\ptexdot=\.
75
\let\ptexdots=\dots
76
\let\ptexend=\end
77
\let\ptexequiv=\equiv
78
\let\ptexexclam=\!
79
\let\ptexi=\i
80
\let\ptexlbrace=\{
81
\let\ptexrbrace=\}
82
\let\ptexstar=\*
83
\let\ptext=\t
84
 
85
% We never want plain's outer \+ definition in Texinfo.
86
% For @tex, we can use \tabalign.
87
\let\+ = \relax
88
 
89
\message{Basics,}
90
\chardef\other=12
91
 
92
% If this character appears in an error message or help string, it
93
% starts a new line in the output.
94
\newlinechar = `^^J
95
 
96
% Set up fixed words for English if not already set.
97
\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
98
\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
99
\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
100
\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
101
\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
102
\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
103
\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
104
\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
105
\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
106
\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
107
\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
108
\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
109
\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
110
\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
111
\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
112
\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
113
\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
114
\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
115
\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
116
%
117
\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
118
\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
119
\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
120
\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
121
\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
122
\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
123
\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
124
\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
125
\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
126
\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
127
\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
128
\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
129
%
130
\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
131
\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
132
\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
133
\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
134
\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
135
\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
136
\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
137
 
138
% Ignore a token.
139
%
140
\def\gobble#1{}
141
 
142
\hyphenation{ap-pen-dix}
143
\hyphenation{mini-buf-fer mini-buf-fers}
144
\hyphenation{eshell}
145
\hyphenation{white-space}
146
 
147
% Margin to add to right of even pages, to left of odd pages.
148
\newdimen \bindingoffset
149
\newdimen \normaloffset
150
\newdimen\pagewidth \newdimen\pageheight
151
 
152
% Sometimes it is convenient to have everything in the transcript file
153
% and nothing on the terminal.  We don't just call \tracingall here,
154
% since that produces some useless output on the terminal.
155
%
156
\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
157
\ifx\eTeXversion\undefined
158
\def\loggingall{\tracingcommands2 \tracingstats2
159
   \tracingpages1 \tracingoutput1 \tracinglostchars1
160
   \tracingmacros2 \tracingparagraphs1 \tracingrestores1
161
   \showboxbreadth\maxdimen\showboxdepth\maxdimen
162
}%
163
\else
164
\def\loggingall{\tracingcommands3 \tracingstats2
165
   \tracingpages1 \tracingoutput1 \tracinglostchars1
166
   \tracingmacros2 \tracingparagraphs1 \tracingrestores1
167
   \tracingscantokens1 \tracingassigns1 \tracingifs1
168
   \tracinggroups1 \tracingnesting2
169
   \showboxbreadth\maxdimen\showboxdepth\maxdimen
170
}%
171
\fi
172
 
173
% For @cropmarks command.
174
% Do @cropmarks to get crop marks.
175
%
176
\newif\ifcropmarks
177
\let\cropmarks = \cropmarkstrue
178
%
179
% Dimensions to add cropmarks at corners.
180
% Added by P. A. MacKay, 12 Nov. 1986
181
%
182
\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
183
\newdimen\cornerlong  \cornerlong=1pc
184
\newdimen\cornerthick \cornerthick=.3pt
185
\newdimen\topandbottommargin \topandbottommargin=.75in
186
 
187
% Main output routine.
188
\chardef\PAGE = 255
189
\output = {\onepageout{\pagecontents\PAGE}}
190
 
191
\newbox\headlinebox
192
\newbox\footlinebox
193
 
194
% \onepageout takes a vbox as an argument.  Note that \pagecontents
195
% does insertions, but you have to call it yourself.
196
\def\onepageout#1{%
197
  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
198
  %
199
  \ifodd\pageno  \advance\hoffset by \bindingoffset
200
  \else \advance\hoffset by -\bindingoffset\fi
201
  %
202
  % Do this outside of the \shipout so @code etc. will be expanded in
203
  % the headline as they should be, not taken literally (outputting ''code).
204
  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
205
  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
206
  %
207
  {%
208
    % Have to do this stuff outside the \shipout because we want it to
209
    % take effect in \write's, yet the group defined by the \vbox ends
210
    % before the \shipout runs.
211
    %
212
    \escapechar = `\\     % use backslash in output files.
213
    \indexdummies         % don't expand commands in the output.
214
    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
215
                   % the page break happens to be in the middle of an example.
216
    \shipout\vbox{%
217
      % Do this early so pdf references go to the beginning of the page.
218
      \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
219
      %
220
      \ifcropmarks \vbox to \outervsize\bgroup
221
        \hsize = \outerhsize
222
        \vskip-\topandbottommargin
223
        \vtop to0pt{%
224
          \line{\ewtop\hfil\ewtop}%
225
          \nointerlineskip
226
          \line{%
227
            \vbox{\moveleft\cornerthick\nstop}%
228
            \hfill
229
            \vbox{\moveright\cornerthick\nstop}%
230
          }%
231
          \vss}%
232
        \vskip\topandbottommargin
233
        \line\bgroup
234
          \hfil % center the page within the outer (page) hsize.
235
          \ifodd\pageno\hskip\bindingoffset\fi
236
          \vbox\bgroup
237
      \fi
238
      %
239
      \unvbox\headlinebox
240
      \pagebody{#1}%
241
      \ifdim\ht\footlinebox > 0pt
242
        % Only leave this space if the footline is nonempty.
243
        % (We lessened \vsize for it in \oddfootingxxx.)
244
        % The \baselineskip=24pt in plain's \makefootline has no effect.
245
        \vskip 2\baselineskip
246
        \unvbox\footlinebox
247
      \fi
248
      %
249
      \ifcropmarks
250
          \egroup % end of \vbox\bgroup
251
        \hfil\egroup % end of (centering) \line\bgroup
252
        \vskip\topandbottommargin plus1fill minus1fill
253
        \boxmaxdepth = \cornerthick
254
        \vbox to0pt{\vss
255
          \line{%
256
            \vbox{\moveleft\cornerthick\nsbot}%
257
            \hfill
258
            \vbox{\moveright\cornerthick\nsbot}%
259
          }%
260
          \nointerlineskip
261
          \line{\ewbot\hfil\ewbot}%
262
        }%
263
      \egroup % \vbox from first cropmarks clause
264
      \fi
265
    }% end of \shipout\vbox
266
  }% end of group with \turnoffactive
267
  \advancepageno
268
  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
269
}
270
 
271
\newinsert\margin \dimen\margin=\maxdimen
272
 
273
\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
274
{\catcode`\@ =11
275
\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
276
% marginal hacks, juha@viisa.uucp (Juha Takala)
277
\ifvoid\margin\else % marginal info is present
278
  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
279
\dimen@=\dp#1 \unvbox#1
280
\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
281
\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
282
}
283
 
284
% Here are the rules for the cropmarks.  Note that they are
285
% offset so that the space between them is truly \outerhsize or \outervsize
286
% (P. A. MacKay, 12 November, 1986)
287
%
288
\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
289
\def\nstop{\vbox
290
  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
291
\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
292
\def\nsbot{\vbox
293
  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
294
 
295
% Parse an argument, then pass it to #1.  The argument is the rest of
296
% the input line (except we remove a trailing comment).  #1 should be a
297
% macro which expects an ordinary undelimited TeX argument.
298
%
299
\def\parsearg#1{%
300
  \let\next = #1%
301
  \begingroup
302
    \obeylines
303
    \futurelet\temp\parseargx
304
}
305
 
306
% If the next token is an obeyed space (from an @example environment or
307
% the like), remove it and recurse.  Otherwise, we're done.
308
\def\parseargx{%
309
  % \obeyedspace is defined far below, after the definition of \sepspaces.
310
  \ifx\obeyedspace\temp
311
    \expandafter\parseargdiscardspace
312
  \else
313
    \expandafter\parseargline
314
  \fi
315
}
316
 
317
% Remove a single space (as the delimiter token to the macro call).
318
{\obeyspaces %
319
 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
320
 
321
{\obeylines %
322
  \gdef\parseargline#1^^M{%
323
    \endgroup % End of the group started in \parsearg.
324
    %
325
    % First remove any @c comment, then any @comment.
326
    % Result of each macro is put in \toks0.
327
    \argremovec #1\c\relax %
328
    \expandafter\argremovecomment \the\toks0 \comment\relax %
329
    %
330
    % Call the caller's macro, saved as \next in \parsearg.
331
    \expandafter\next\expandafter{\the\toks0}%
332
  }%
333
}
334
 
335
% Since all \c{,omment} does is throw away the argument, we can let TeX
336
% do that for us.  The \relax here is matched by the \relax in the call
337
% in \parseargline; it could be more or less anything, its purpose is
338
% just to delimit the argument to the \c.
339
\def\argremovec#1\c#2\relax{\toks0 = {#1}}
340
\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
341
 
342
% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
343
%    @end itemize  @c foo
344
% will have two active spaces as part of the argument with the
345
% `itemize'.  Here we remove all active spaces from #1, and assign the
346
% result to \toks0.
347
%
348
% This loses if there are any *other* active characters besides spaces
349
% in the argument -- _ ^ +, for example -- since they get expanded.
350
% Fortunately, Texinfo does not define any such commands.  (If it ever
351
% does, the catcode of the characters in questionwill have to be changed
352
% here.)  But this means we cannot call \removeactivespaces as part of
353
% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
354
% that \parsearg gets might well have any character at all in it.
355
%
356
\def\removeactivespaces#1{%
357
  \begingroup
358
    \ignoreactivespaces
359
    \edef\temp{#1}%
360
    \global\toks0 = \expandafter{\temp}%
361
  \endgroup
362
}
363
 
364
% Change the active space to expand to nothing.
365
%
366
\begingroup
367
  \obeyspaces
368
  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
369
\endgroup
370
 
371
 
372
\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
373
 
374
%% These are used to keep @begin/@end levels from running away
375
%% Call \inENV within environments (after a \begingroup)
376
\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
377
\def\ENVcheck{%
378
\ifENV\errmessage{Still within an environment; press RETURN to continue}
379
\endgroup\fi} % This is not perfect, but it should reduce lossage
380
 
381
% @begin foo  is the same as @foo, for now.
382
\newhelp\EMsimple{Press RETURN to continue.}
383
 
384
\outer\def\begin{\parsearg\beginxxx}
385
 
386
\def\beginxxx #1{%
387
\expandafter\ifx\csname #1\endcsname\relax
388
{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
389
\csname #1\endcsname\fi}
390
 
391
% @end foo executes the definition of \Efoo.
392
%
393
\def\end{\parsearg\endxxx}
394
\def\endxxx #1{%
395
  \removeactivespaces{#1}%
396
  \edef\endthing{\the\toks0}%
397
  %
398
  \expandafter\ifx\csname E\endthing\endcsname\relax
399
    \expandafter\ifx\csname \endthing\endcsname\relax
400
      % There's no \foo, i.e., no ``environment'' foo.
401
      \errhelp = \EMsimple
402
      \errmessage{Undefined command `@end \endthing'}%
403
    \else
404
      \unmatchedenderror\endthing
405
    \fi
406
  \else
407
    % Everything's ok; the right environment has been started.
408
    \csname E\endthing\endcsname
409
  \fi
410
}
411
 
412
% There is an environment #1, but it hasn't been started.  Give an error.
413
%
414
\def\unmatchedenderror#1{%
415
  \errhelp = \EMsimple
416
  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
417
}
418
 
419
% Define the control sequence \E#1 to give an unmatched @end error.
420
%
421
\def\defineunmatchedend#1{%
422
  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
423
}
424
 
425
 
426
% Single-spacing is done by various environments (specifically, in
427
% \nonfillstart and \quotations).
428
\newskip\singlespaceskip \singlespaceskip = 12.5pt
429
\def\singlespace{%
430
  % Why was this kern here?  It messes up equalizing space above and below
431
  % environments.  --karl, 6may93
432
  %{\advance \baselineskip by -\singlespaceskip
433
  %\kern \baselineskip}%
434
  \setleading \singlespaceskip
435
}
436
 
437
%% Simple single-character @ commands
438
 
439
% @@ prints an @
440
% Kludge this until the fonts are right (grr).
441
\def\@{{\tt\char64}}
442
 
443
% This is turned off because it was never documented
444
% and you can use @w{...} around a quote to suppress ligatures.
445
%% Define @` and @' to be the same as ` and '
446
%% but suppressing ligatures.
447
%\def\`{{`}}
448
%\def\'{{'}}
449
 
450
% Used to generate quoted braces.
451
\def\mylbrace {{\tt\char123}}
452
\def\myrbrace {{\tt\char125}}
453
\let\{=\mylbrace
454
\let\}=\myrbrace
455
\begingroup
456
  % Definitions to produce actual \{ & \} command in an index.
457
  \catcode`\{ = 12 \catcode`\} = 12
458
  \catcode`\[ = 1 \catcode`\] = 2
459
  \catcode`\@ = 0 \catcode`\\ = 12
460
  @gdef@lbracecmd[\{]%
461
  @gdef@rbracecmd[\}]%
462
@endgroup
463
 
464
% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
465
% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
466
\let\, = \c
467
\let\dotaccent = \.
468
\def\ringaccent#1{{\accent23 #1}}
469
\let\tieaccent = \t
470
\let\ubaraccent = \b
471
\let\udotaccent = \d
472
 
473
% Other special characters: @questiondown @exclamdown
474
% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
475
\def\questiondown{?`}
476
\def\exclamdown{!`}
477
 
478
% Dotless i and dotless j, used for accents.
479
\def\imacro{i}
480
\def\jmacro{j}
481
\def\dotless#1{%
482
  \def\temp{#1}%
483
  \ifx\temp\imacro \ptexi
484
  \else\ifx\temp\jmacro \j
485
  \else \errmessage{@dotless can be used only with i or j}%
486
  \fi\fi
487
}
488
 
489
% Be sure we're in horizontal mode when doing a tie, since we make space
490
% equivalent to this in @example-like environments. Otherwise, a space
491
% at the beginning of a line will start with \penalty -- and
492
% since \penalty is valid in vertical mode, we'd end up putting the
493
% penalty on the vertical list instead of in the new paragraph.
494
{\catcode`@ = 11
495
 % Avoid using \@M directly, because that causes trouble
496
 % if the definition is written into an index file.
497
 \global\let\tiepenalty = \@M
498
 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
499
}
500
 
501
% @: forces normal size whitespace following.
502
\def\:{\spacefactor=1000 }
503
 
504
% @* forces a line break.
505
\def\*{\hfil\break\hbox{}\ignorespaces}
506
 
507
% @. is an end-of-sentence period.
508
\def\.{.\spacefactor=3000 }
509
 
510
% @! is an end-of-sentence bang.
511
\def\!{!\spacefactor=3000 }
512
 
513
% @? is an end-of-sentence query.
514
\def\?{?\spacefactor=3000 }
515
 
516
% @w prevents a word break.  Without the \leavevmode, @w at the
517
% beginning of a paragraph, when TeX is still in vertical mode, would
518
% produce a whole line of output instead of starting the paragraph.
519
\def\w#1{\leavevmode\hbox{#1}}
520
 
521
% @group ... @end group forces ... to be all on one page, by enclosing
522
% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
523
% to keep its height that of a normal line.  According to the rules for
524
% \topskip (p.114 of the TeXbook), the glue inserted is
525
% max (\topskip - \ht (first item), 0).  If that height is large,
526
% therefore, no glue is inserted, and the space between the headline and
527
% the text is small, which looks bad.
528
%
529
\def\group{\begingroup
530
  \ifnum\catcode13=\active \else
531
    \errhelp = \groupinvalidhelp
532
    \errmessage{@group invalid in context where filling is enabled}%
533
  \fi
534
  %
535
  % The \vtop we start below produces a box with normal height and large
536
  % depth; thus, TeX puts \baselineskip glue before it, and (when the
537
  % next line of text is done) \lineskip glue after it.  (See p.82 of
538
  % the TeXbook.)  Thus, space below is not quite equal to space
539
  % above.  But it's pretty close.
540
  \def\Egroup{%
541
    \egroup           % End the \vtop.
542
    \endgroup         % End the \group.
543
  }%
544
  %
545
  \vtop\bgroup
546
    % We have to put a strut on the last line in case the @group is in
547
    % the midst of an example, rather than completely enclosing it.
548
    % Otherwise, the interline space between the last line of the group
549
    % and the first line afterwards is too small.  But we can't put the
550
    % strut in \Egroup, since there it would be on a line by itself.
551
    % Hence this just inserts a strut at the beginning of each line.
552
    \everypar = {\strut}%
553
    %
554
    % Since we have a strut on every line, we don't need any of TeX's
555
    % normal interline spacing.
556
    \offinterlineskip
557
    %
558
    % OK, but now we have to do something about blank
559
    % lines in the input in @example-like environments, which normally
560
    % just turn into \lisppar, which will insert no space now that we've
561
    % turned off the interline space.  Simplest is to make them be an
562
    % empty paragraph.
563
    \ifx\par\lisppar
564
      \edef\par{\leavevmode \par}%
565
      %
566
      % Reset ^^M's definition to new definition of \par.
567
      \obeylines
568
    \fi
569
    %
570
    % Do @comment since we are called inside an environment such as
571
    % @example, where each end-of-line in the input causes an
572
    % end-of-line in the output.  We don't want the end-of-line after
573
    % the `@group' to put extra space in the output.  Since @group
574
    % should appear on a line by itself (according to the Texinfo
575
    % manual), we don't worry about eating any user text.
576
    \comment
577
}
578
%
579
% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
580
% message, so this ends up printing `@group can only ...'.
581
%
582
\newhelp\groupinvalidhelp{%
583
group can only be used in environments such as @example,^^J%
584
where each line of input produces a line of output.}
585
 
586
% @need space-in-mils
587
% forces a page break if there is not space-in-mils remaining.
588
 
589
\newdimen\mil  \mil=0.001in
590
 
591
\def\need{\parsearg\needx}
592
 
593
% Old definition--didn't work.
594
%\def\needx #1{\par %
595
%% This method tries to make TeX break the page naturally
596
%% if the depth of the box does not fit.
597
%{\baselineskip=0pt%
598
%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
599
%\prevdepth=-1000pt
600
%}}
601
 
602
\def\needx#1{%
603
  % Ensure vertical mode, so we don't make a big box in the middle of a
604
  % paragraph.
605
  \par
606
  %
607
  % If the @need value is less than one line space, it's useless.
608
  \dimen0 = #1\mil
609
  \dimen2 = \ht\strutbox
610
  \advance\dimen2 by \dp\strutbox
611
  \ifdim\dimen0 > \dimen2
612
    %
613
    % Do a \strut just to make the height of this box be normal, so the
614
    % normal leading is inserted relative to the preceding line.
615
    % And a page break here is fine.
616
    \vtop to #1\mil{\strut\vfil}%
617
    %
618
    % TeX does not even consider page breaks if a penalty added to the
619
    % main vertical list is 10000 or more.  But in order to see if the
620
    % empty box we just added fits on the page, we must make it consider
621
    % page breaks.  On the other hand, we don't want to actually break the
622
    % page after the empty box.  So we use a penalty of 9999.
623
    %
624
    % There is an extremely small chance that TeX will actually break the
625
    % page at this \penalty, if there are no other feasible breakpoints in
626
    % sight.  (If the user is using lots of big @group commands, which
627
    % almost-but-not-quite fill up a page, TeX will have a hard time doing
628
    % good page breaking, for example.)  However, I could not construct an
629
    % example where a page broke at this \penalty; if it happens in a real
630
    % document, then we can reconsider our strategy.
631
    \penalty9999
632
    %
633
    % Back up by the size of the box, whether we did a page break or not.
634
    \kern -#1\mil
635
    %
636
    % Do not allow a page break right after this kern.
637
    \nobreak
638
  \fi
639
}
640
 
641
% @br   forces paragraph break
642
 
643
\let\br = \par
644
 
645
% @dots{} output an ellipsis using the current font.
646
% We do .5em per period so that it has the same spacing in a typewriter
647
% font as three actual period characters.
648
%
649
\def\dots{%
650
  \leavevmode
651
  \hbox to 1.5em{%
652
    \hskip 0pt plus 0.25fil minus 0.25fil
653
    .\hss.\hss.%
654
    \hskip 0pt plus 0.5fil minus 0.5fil
655
  }%
656
}
657
 
658
% @enddots{} is an end-of-sentence ellipsis.
659
%
660
\def\enddots{%
661
  \leavevmode
662
  \hbox to 2em{%
663
    \hskip 0pt plus 0.25fil minus 0.25fil
664
    .\hss.\hss.\hss.%
665
    \hskip 0pt plus 0.5fil minus 0.5fil
666
  }%
667
  \spacefactor=3000
668
}
669
 
670
 
671
% @page    forces the start of a new page
672
%
673
\def\page{\par\vfill\supereject}
674
 
675
% @exdent text....
676
% outputs text on separate line in roman font, starting at standard page margin
677
 
678
% This records the amount of indent in the innermost environment.
679
% That's how much \exdent should take out.
680
\newskip\exdentamount
681
 
682
% This defn is used inside fill environments such as @defun.
683
\def\exdent{\parsearg\exdentyyy}
684
\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
685
 
686
% This defn is used inside nofill environments such as @example.
687
\def\nofillexdent{\parsearg\nofillexdentyyy}
688
\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
689
\leftline{\hskip\leftskip{\rm#1}}}}
690
 
691
% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
692
 
693
\def\inmargin#1{%
694
\strut\vadjust{\nobreak\kern-\strutdepth
695
  \vtop to \strutdepth{\baselineskip\strutdepth\vss
696
  \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
697
\newskip\inmarginspacing \inmarginspacing=1cm
698
\def\strutdepth{\dp\strutbox}
699
 
700
%\hbox{{\rm#1}}\hfil\break}}
701
 
702
% @include file    insert text of that file as input.
703
% Allow normal characters that  we make active in the argument (a file name).
704
\def\include{\begingroup
705
  \catcode`\\=12
706
  \catcode`~=12
707
  \catcode`^=12
708
  \catcode`_=12
709
  \catcode`|=12
710
  \catcode`<=12
711
  \catcode`>=12
712
  \catcode`+=12
713
  \parsearg\includezzz}
714
% Restore active chars for included file.
715
\def\includezzz#1{\endgroup\begingroup
716
  % Read the included file in a group so nested @include's work.
717
  \def\thisfile{#1}%
718
  \input\thisfile
719
\endgroup}
720
 
721
\def\thisfile{}
722
 
723
% @center line   outputs that line, centered
724
 
725
\def\center{\parsearg\centerzzz}
726
\def\centerzzz #1{{\advance\hsize by -\leftskip
727
\advance\hsize by -\rightskip
728
\centerline{#1}}}
729
 
730
% @sp n   outputs n lines of vertical space
731
 
732
\def\sp{\parsearg\spxxx}
733
\def\spxxx #1{\vskip #1\baselineskip}
734
 
735
% @comment ...line which is ignored...
736
% @c is the same as @comment
737
% @ignore ... @end ignore  is another way to write a comment
738
 
739
\def\comment{\begingroup \catcode`\^^M=\other%
740
\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
741
\commentxxx}
742
{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
743
 
744
\let\c=\comment
745
 
746
% @paragraphindent NCHARS
747
% We'll use ems for NCHARS, close enough.
748
% We cannot implement @paragraphindent asis, though.
749
%
750
\def\asisword{asis} % no translation, these are keywords
751
\def\noneword{none}
752
%
753
\def\paragraphindent{\parsearg\doparagraphindent}
754
\def\doparagraphindent#1{%
755
  \def\temp{#1}%
756
  \ifx\temp\asisword
757
  \else
758
    \ifx\temp\noneword
759
      \defaultparindent = 0pt
760
    \else
761
      \defaultparindent = #1em
762
    \fi
763
  \fi
764
  \parindent = \defaultparindent
765
}
766
 
767
% @exampleindent NCHARS
768
% We'll use ems for NCHARS like @paragraphindent.
769
% It seems @exampleindent asis isn't necessary, but
770
% I preserve it to make it similar to @paragraphindent.
771
\def\exampleindent{\parsearg\doexampleindent}
772
\def\doexampleindent#1{%
773
  \def\temp{#1}%
774
  \ifx\temp\asisword
775
  \else
776
    \ifx\temp\noneword
777
      \lispnarrowing = 0pt
778
    \else
779
      \lispnarrowing = #1em
780
    \fi
781
  \fi
782
}
783
 
784
% @asis just yields its argument.  Used with @table, for example.
785
%
786
\def\asis#1{#1}
787
 
788
% @math means output in math mode.
789
% We don't use $'s directly in the definition of \math because control
790
% sequences like \math are expanded when the toc file is written.  Then,
791
% we read the toc file back, the $'s will be normal characters (as they
792
% should be, according to the definition of Texinfo).  So we must use a
793
% control sequence to switch into and out of math mode.
794
%
795
% This isn't quite enough for @math to work properly in indices, but it
796
% seems unlikely it will ever be needed there.
797
%
798
\let\implicitmath = $
799
\def\math#1{\implicitmath #1\implicitmath}
800
 
801
% @bullet and @minus need the same treatment as @math, just above.
802
\def\bullet{\implicitmath\ptexbullet\implicitmath}
803
\def\minus{\implicitmath-\implicitmath}
804
 
805
% @refill is a no-op.
806
\let\refill=\relax
807
 
808
% If working on a large document in chapters, it is convenient to
809
% be able to disable indexing, cross-referencing, and contents, for test runs.
810
% This is done with @novalidate (before @setfilename).
811
%
812
\newif\iflinks \linkstrue % by default we want the aux files.
813
\let\novalidate = \linksfalse
814
 
815
% @setfilename is done at the beginning of every texinfo file.
816
% So open here the files we need to have open while reading the input.
817
% This makes it possible to make a .fmt file for texinfo.
818
\def\setfilename{%
819
   \iflinks
820
     \readauxfile
821
   \fi % \openindices needs to do some work in any case.
822
   \openindices
823
   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
824
   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
825
   %
826
   % If texinfo.cnf is present on the system, read it.
827
   % Useful for site-wide @afourpaper, etc.
828
   % Just to be on the safe side, close the input stream before the \input.
829
   \openin 1 texinfo.cnf
830
   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
831
   \closein1
832
   \temp
833
   %
834
   \comment % Ignore the actual filename.
835
}
836
 
837
% Called from \setfilename.
838
%
839
\def\openindices{%
840
  \newindex{cp}%
841
  \newcodeindex{fn}%
842
  \newcodeindex{vr}%
843
  \newcodeindex{tp}%
844
  \newcodeindex{ky}%
845
  \newcodeindex{pg}%
846
}
847
 
848
% @bye.
849
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
850
 
851
 
852
\message{pdf,}
853
% adobe `portable' document format
854
\newcount\tempnum
855
\newcount\lnkcount
856
\newtoks\filename
857
\newcount\filenamelength
858
\newcount\pgn
859
\newtoks\toksA
860
\newtoks\toksB
861
\newtoks\toksC
862
\newtoks\toksD
863
\newbox\boxA
864
\newcount\countA
865
\newif\ifpdf
866
\newif\ifpdfmakepagedest
867
 
868
\ifx\pdfoutput\undefined
869
  \pdffalse
870
  \let\pdfmkdest = \gobble
871
  \let\pdfurl = \gobble
872
  \let\endlink = \relax
873
  \let\linkcolor = \relax
874
  \let\pdfmakeoutlines = \relax
875
\else
876
  \pdftrue
877
  \pdfoutput = 1
878
  \input pdfcolor
879
  \def\dopdfimage#1#2#3{%
880
    \def\imagewidth{#2}%
881
    \def\imageheight{#3}%
882
    \ifnum\pdftexversion < 14
883
      \pdfimage
884
    \else
885
      \pdfximage
886
    \fi
887
      \ifx\empty\imagewidth\else width \imagewidth \fi
888
      \ifx\empty\imageheight\else height \imageheight \fi
889
      {#1.pdf}%
890
    \ifnum\pdftexversion < 14 \else
891
      \pdfrefximage \pdflastximage
892
    \fi}
893
  \def\pdfmkdest#1{\pdfdest name{#1@} xyz}
894
  \def\pdfmkpgn#1{#1@}
895
  \let\linkcolor = \Blue  % was Cyan, but that seems light?
896
  \def\endlink{\Black\pdfendlink}
897
  % Adding outlines to PDF; macros for calculating structure of outlines
898
  % come from Petr Olsak
899
  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
900
    \else \csname#1\endcsname \fi}
901
  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
902
    \advance\tempnum by1
903
    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
904
  \def\pdfmakeoutlines{{%
905
    \openin 1 \jobname.toc
906
    \ifeof 1\else\bgroup
907
      \closein 1
908
      \indexnofonts
909
      \def\tt{}
910
      \let\_ = \normalunderscore
911
      % Thanh's hack / proper braces in bookmarks
912
      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
913
      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
914
      %
915
      \def\chapentry ##1##2##3{}
916
      \def\unnumbchapentry ##1##2{}
917
      \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
918
      \def\unnumbsecentry ##1##2{}
919
      \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
920
      \def\unnumbsubsecentry ##1##2{}
921
      \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
922
      \def\unnumbsubsubsecentry ##1##2{}
923
      \input \jobname.toc
924
      \def\chapentry ##1##2##3{%
925
        \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
926
      \def\unnumbchapentry ##1##2{%
927
        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
928
      \def\secentry ##1##2##3##4{%
929
        \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
930
      \def\unnumbsecentry ##1##2{%
931
        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
932
      \def\subsecentry ##1##2##3##4##5{%
933
        \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
934
      \def\unnumbsubsecentry ##1##2{%
935
        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
936
      \def\subsubsecentry ##1##2##3##4##5##6{%
937
        \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
938
      \def\unnumbsubsubsecentry ##1##2{%
939
        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
940
      \input \jobname.toc
941
    \egroup\fi
942
  }}
943
  \def\makelinks #1,{%
944
    \def\params{#1}\def\E{END}%
945
    \ifx\params\E
946
      \let\nextmakelinks=\relax
947
    \else
948
      \let\nextmakelinks=\makelinks
949
      \ifnum\lnkcount>0,\fi
950
      \picknum{#1}%
951
      \startlink attr{/Border [0 0 0]}
952
        goto name{\pdfmkpgn{\the\pgn}}%
953
      \linkcolor #1%
954
      \advance\lnkcount by 1%
955
      \endlink
956
    \fi
957
    \nextmakelinks
958
  }
959
  \def\picknum#1{\expandafter\pn#1}
960
  \def\pn#1{%
961
    \def\p{#1}%
962
    \ifx\p\lbrace
963
      \let\nextpn=\ppn
964
    \else
965
      \let\nextpn=\ppnn
966
      \def\first{#1}
967
    \fi
968
    \nextpn
969
  }
970
  \def\ppn#1{\pgn=#1\gobble}
971
  \def\ppnn{\pgn=\first}
972
  \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
973
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
974
  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
975
    \ifx\PP\D\let\nextsp\relax
976
    \else\let\nextsp\skipspaces
977
      \ifx\p\space\else\addtokens{\filename}{\PP}%
978
        \advance\filenamelength by 1
979
      \fi
980
    \fi
981
    \nextsp}
982
  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
983
  \ifnum\pdftexversion < 14
984
    \let \startlink \pdfannotlink
985
  \else
986
    \let \startlink \pdfstartlink
987
  \fi
988
  \def\pdfurl#1{%
989
    \begingroup
990
      \normalturnoffactive\def\@{@}%
991
      \leavevmode\Red
992
      \startlink attr{/Border [0 0 0]}%
993
        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
994
        % #1
995
    \endgroup}
996
  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
997
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
998
  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
999
  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1000
  \def\maketoks{%
1001
    \expandafter\poptoks\the\toksA|ENDTOKS|
1002
    \ifx\first0\adn0
1003
    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1004
    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1005
    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1006
    \else
1007
      \ifnum0=\countA\else\makelink\fi
1008
      \ifx\first.\let\next=\done\else
1009
        \let\next=\maketoks
1010
        \addtokens{\toksB}{\the\toksD}
1011
        \ifx\first,\addtokens{\toksB}{\space}\fi
1012
      \fi
1013
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1014
    \next}
1015
  \def\makelink{\addtokens{\toksB}%
1016
    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1017
  \def\pdflink#1{%
1018
    \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}}
1019
    \linkcolor #1\endlink}
1020
  \def\mkpgn#1{#1@}
1021
  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1022
\fi % \ifx\pdfoutput
1023
 
1024
 
1025
\message{fonts,}
1026
% Font-change commands.
1027
 
1028
% Texinfo sort of supports the sans serif font style, which plain TeX does not.
1029
% So we set up a \sf analogous to plain's \rm, etc.
1030
\newfam\sffam
1031
\def\sf{\fam=\sffam \tensf}
1032
\let\li = \sf % Sometimes we call it \li, not \sf.
1033
 
1034
% We don't need math for this one.
1035
\def\ttsl{\tenttsl}
1036
 
1037
% Use Computer Modern fonts at \magstephalf (11pt).
1038
\newcount\mainmagstep
1039
\mainmagstep=\magstephalf
1040
 
1041
% Set the font macro #1 to the font named #2, adding on the
1042
% specified font prefix (normally `cm').
1043
% #3 is the font's design size, #4 is a scale factor
1044
\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1045
 
1046
% Use cm as the default font prefix.
1047
% To specify the font prefix, you must define \fontprefix
1048
% before you read in texinfo.tex.
1049
\ifx\fontprefix\undefined
1050
\def\fontprefix{cm}
1051
\fi
1052
% Support font families that don't use the same naming scheme as CM.
1053
\def\rmshape{r}
1054
\def\rmbshape{bx}               %where the normal face is bold
1055
\def\bfshape{b}
1056
\def\bxshape{bx}
1057
\def\ttshape{tt}
1058
\def\ttbshape{tt}
1059
\def\ttslshape{sltt}
1060
\def\itshape{ti}
1061
\def\itbshape{bxti}
1062
\def\slshape{sl}
1063
\def\slbshape{bxsl}
1064
\def\sfshape{ss}
1065
\def\sfbshape{ss}
1066
\def\scshape{csc}
1067
\def\scbshape{csc}
1068
 
1069
\ifx\bigger\relax
1070
\let\mainmagstep=\magstep1
1071
\setfont\textrm\rmshape{12}{1000}
1072
\setfont\texttt\ttshape{12}{1000}
1073
\else
1074
\setfont\textrm\rmshape{10}{\mainmagstep}
1075
\setfont\texttt\ttshape{10}{\mainmagstep}
1076
\fi
1077
% Instead of cmb10, you many want to use cmbx10.
1078
% cmbx10 is a prettier font on its own, but cmb10
1079
% looks better when embedded in a line with cmr10.
1080
\setfont\textbf\bfshape{10}{\mainmagstep}
1081
\setfont\textit\itshape{10}{\mainmagstep}
1082
\setfont\textsl\slshape{10}{\mainmagstep}
1083
\setfont\textsf\sfshape{10}{\mainmagstep}
1084
\setfont\textsc\scshape{10}{\mainmagstep}
1085
\setfont\textttsl\ttslshape{10}{\mainmagstep}
1086
\font\texti=cmmi10 scaled \mainmagstep
1087
\font\textsy=cmsy10 scaled \mainmagstep
1088
 
1089
% A few fonts for @defun, etc.
1090
\setfont\defbf\bxshape{10}{\magstep1} %was 1314
1091
\setfont\deftt\ttshape{10}{\magstep1}
1092
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1093
 
1094
% Fonts for indices, footnotes, small examples (9pt).
1095
\setfont\smallrm\rmshape{9}{1000}
1096
\setfont\smalltt\ttshape{9}{1000}
1097
\setfont\smallbf\bfshape{10}{900}
1098
\setfont\smallit\itshape{9}{1000}
1099
\setfont\smallsl\slshape{9}{1000}
1100
\setfont\smallsf\sfshape{9}{1000}
1101
\setfont\smallsc\scshape{10}{900}
1102
\setfont\smallttsl\ttslshape{10}{900}
1103
\font\smalli=cmmi9
1104
\font\smallsy=cmsy9
1105
 
1106
% Fonts for title page:
1107
\setfont\titlerm\rmbshape{12}{\magstep3}
1108
\setfont\titleit\itbshape{10}{\magstep4}
1109
\setfont\titlesl\slbshape{10}{\magstep4}
1110
\setfont\titlett\ttbshape{12}{\magstep3}
1111
\setfont\titlettsl\ttslshape{10}{\magstep4}
1112
\setfont\titlesf\sfbshape{17}{\magstep1}
1113
\let\titlebf=\titlerm
1114
\setfont\titlesc\scbshape{10}{\magstep4}
1115
\font\titlei=cmmi12 scaled \magstep3
1116
\font\titlesy=cmsy10 scaled \magstep4
1117
\def\authorrm{\secrm}
1118
 
1119
% Chapter (and unnumbered) fonts (17.28pt).
1120
\setfont\chaprm\rmbshape{12}{\magstep2}
1121
\setfont\chapit\itbshape{10}{\magstep3}
1122
\setfont\chapsl\slbshape{10}{\magstep3}
1123
\setfont\chaptt\ttbshape{12}{\magstep2}
1124
\setfont\chapttsl\ttslshape{10}{\magstep3}
1125
\setfont\chapsf\sfbshape{17}{1000}
1126
\let\chapbf=\chaprm
1127
\setfont\chapsc\scbshape{10}{\magstep3}
1128
\font\chapi=cmmi12 scaled \magstep2
1129
\font\chapsy=cmsy10 scaled \magstep3
1130
 
1131
% Section fonts (14.4pt).
1132
\setfont\secrm\rmbshape{12}{\magstep1}
1133
\setfont\secit\itbshape{10}{\magstep2}
1134
\setfont\secsl\slbshape{10}{\magstep2}
1135
\setfont\sectt\ttbshape{12}{\magstep1}
1136
\setfont\secttsl\ttslshape{10}{\magstep2}
1137
\setfont\secsf\sfbshape{12}{\magstep1}
1138
\let\secbf\secrm
1139
\setfont\secsc\scbshape{10}{\magstep2}
1140
\font\seci=cmmi12 scaled \magstep1
1141
\font\secsy=cmsy10 scaled \magstep2
1142
 
1143
% \setfont\ssecrm\bxshape{10}{\magstep1}    % This size an font looked bad.
1144
% \setfont\ssecit\itshape{10}{\magstep1}    % The letters were too crowded.
1145
% \setfont\ssecsl\slshape{10}{\magstep1}
1146
% \setfont\ssectt\ttshape{10}{\magstep1}
1147
% \setfont\ssecsf\sfshape{10}{\magstep1}
1148
 
1149
%\setfont\ssecrm\bfshape{10}{1315}      % Note the use of cmb rather than cmbx.
1150
%\setfont\ssecit\itshape{10}{1315}      % Also, the size is a little larger than
1151
%\setfont\ssecsl\slshape{10}{1315}      % being scaled magstep1.
1152
%\setfont\ssectt\ttshape{10}{1315}
1153
%\setfont\ssecsf\sfshape{10}{1315}
1154
 
1155
%\let\ssecbf=\ssecrm
1156
 
1157
% Subsection fonts (13.15pt).
1158
\setfont\ssecrm\rmbshape{12}{\magstephalf}
1159
\setfont\ssecit\itbshape{10}{1315}
1160
\setfont\ssecsl\slbshape{10}{1315}
1161
\setfont\ssectt\ttbshape{12}{\magstephalf}
1162
\setfont\ssecttsl\ttslshape{10}{1315}
1163
\setfont\ssecsf\sfbshape{12}{\magstephalf}
1164
\let\ssecbf\ssecrm
1165
\setfont\ssecsc\scbshape{10}{\magstep1}
1166
\font\sseci=cmmi12 scaled \magstephalf
1167
\font\ssecsy=cmsy10 scaled 1315
1168
% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1169
% but that is not a standard magnification.
1170
 
1171
% In order for the font changes to affect most math symbols and letters,
1172
% we have to define the \textfont of the standard families.  Since
1173
% texinfo doesn't allow for producing subscripts and superscripts, we
1174
% don't bother to reset \scriptfont and \scriptscriptfont (which would
1175
% also require loading a lot more fonts).
1176
%
1177
\def\resetmathfonts{%
1178
  \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1179
  \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1180
  \textfont\ttfam = \tentt \textfont\sffam = \tensf
1181
}
1182
 
1183
 
1184
% The font-changing commands redefine the meanings of \tenSTYLE, instead
1185
% of just \STYLE.  We do this so that font changes will continue to work
1186
% in math mode, where it is the current \fam that is relevant in most
1187
% cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
1188
% \tenbf}, for example.  By redefining \tenbf, we obviate the need to
1189
% redefine \bf itself.
1190
\def\textfonts{%
1191
  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1192
  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1193
  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1194
  \resetmathfonts}
1195
\def\titlefonts{%
1196
  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1197
  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1198
  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1199
  \let\tenttsl=\titlettsl
1200
  \resetmathfonts \setleading{25pt}}
1201
\def\titlefont#1{{\titlefonts\rm #1}}
1202
\def\chapfonts{%
1203
  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1204
  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1205
  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1206
  \resetmathfonts \setleading{19pt}}
1207
\def\secfonts{%
1208
  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1209
  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1210
  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1211
  \resetmathfonts \setleading{16pt}}
1212
\def\subsecfonts{%
1213
  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1214
  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1215
  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1216
  \resetmathfonts \setleading{15pt}}
1217
\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1218
\def\smallfonts{%
1219
  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
1220
  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
1221
  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
1222
  \let\tenttsl=\smallttsl
1223
  \resetmathfonts \setleading{11pt}}
1224
 
1225
% Set up the default fonts, so we can use them for creating boxes.
1226
%
1227
\textfonts
1228
 
1229
% Define these so they can be easily changed for other fonts.
1230
\def\angleleft{$\langle$}
1231
\def\angleright{$\rangle$}
1232
 
1233
% Count depth in font-changes, for error checks
1234
\newcount\fontdepth \fontdepth=0
1235
 
1236
% Fonts for short table of contents.
1237
\setfont\shortcontrm\rmshape{12}{1000}
1238
\setfont\shortcontbf\bxshape{12}{1000}
1239
\setfont\shortcontsl\slshape{12}{1000}
1240
 
1241
%% Add scribe-like font environments, plus @l for inline lisp (usually sans
1242
%% serif) and @ii for TeX italic
1243
 
1244
% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1245
% unless the following character is such as not to need one.
1246
\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1247
\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
1248
\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
1249
 
1250
\let\i=\smartitalic
1251
\let\var=\smartslanted
1252
\let\dfn=\smartslanted
1253
\let\emph=\smartitalic
1254
\let\cite=\smartslanted
1255
 
1256
\def\b#1{{\bf #1}}
1257
\let\strong=\b
1258
 
1259
% We can't just use \exhyphenpenalty, because that only has effect at
1260
% the end of a paragraph.  Restore normal hyphenation at the end of the
1261
% group within which \nohyphenation is presumably called.
1262
%
1263
\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
1264
\def\restorehyphenation{\hyphenchar\font = `- }
1265
 
1266
\def\t#1{%
1267
  {\tt \rawbackslash \frenchspacing #1}%
1268
  \null
1269
}
1270
\let\ttfont=\t
1271
\def\samp#1{`\tclose{#1}'\null}
1272
\setfont\keyrm\rmshape{8}{1000}
1273
\font\keysy=cmsy9
1274
\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
1275
  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1276
    \vbox{\hrule\kern-0.4pt
1277
     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1278
    \kern-0.4pt\hrule}%
1279
  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1280
% The old definition, with no lozenge:
1281
%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1282
\def\ctrl #1{{\tt \rawbackslash \hat}#1}
1283
 
1284
% @file, @option are the same as @samp.
1285
\let\file=\samp
1286
\let\option=\samp
1287
 
1288
% @code is a modification of @t,
1289
% which makes spaces the same size as normal in the surrounding text.
1290
\def\tclose#1{%
1291
  {%
1292
    % Change normal interword space to be same as for the current font.
1293
    \spaceskip = \fontdimen2\font
1294
    %
1295
    % Switch to typewriter.
1296
    \tt
1297
    %
1298
    % But `\ ' produces the large typewriter interword space.
1299
    \def\ {{\spaceskip = 0pt{} }}%
1300
    %
1301
    % Turn off hyphenation.
1302
    \nohyphenation
1303
    %
1304
    \rawbackslash
1305
    \frenchspacing
1306
    #1%
1307
  }%
1308
  \null
1309
}
1310
 
1311
% We *must* turn on hyphenation at `-' and `_' in \code.
1312
% Otherwise, it is too hard to avoid overfull hboxes
1313
% in the Emacs manual, the Library manual, etc.
1314
 
1315
% Unfortunately, TeX uses one parameter (\hyphenchar) to control
1316
% both hyphenation at - and hyphenation within words.
1317
% We must therefore turn them both off (\tclose does that)
1318
% and arrange explicitly to hyphenate at a dash.
1319
%  -- rms.
1320
{
1321
  \catcode`\-=\active
1322
  \catcode`\_=\active
1323
  %
1324
  \global\def\code{\begingroup
1325
    \catcode`\-=\active \let-\codedash
1326
    \catcode`\_=\active \let_\codeunder
1327
    \codex
1328
  }
1329
  %
1330
  % If we end up with any active - characters when handling the index,
1331
  % just treat them as a normal -.
1332
  \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
1333
}
1334
 
1335
\def\realdash{-}
1336
\def\codedash{-\discretionary{}{}{}}
1337
\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1338
\def\codex #1{\tclose{#1}\endgroup}
1339
 
1340
%\let\exp=\tclose  %Was temporary
1341
 
1342
% @kbd is like @code, except that if the argument is just one @key command,
1343
% then @kbd has no effect.
1344
 
1345
% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1346
%   `example' (@kbd uses ttsl only inside of @example and friends),
1347
%   or `code' (@kbd uses normal tty font always).
1348
\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1349
\def\kbdinputstylexxx#1{%
1350
  \def\arg{#1}%
1351
  \ifx\arg\worddistinct
1352
    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1353
  \else\ifx\arg\wordexample
1354
    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1355
  \else\ifx\arg\wordcode
1356
    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1357
  \fi\fi\fi
1358
}
1359
\def\worddistinct{distinct}
1360
\def\wordexample{example}
1361
\def\wordcode{code}
1362
 
1363
% Default is kbdinputdistinct.  (Too much of a hassle to call the macro,
1364
% the catcodes are wrong for parsearg to work.)
1365
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1366
 
1367
\def\xkey{\key}
1368
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1369
\ifx\one\xkey\ifx\threex\three \key{#2}%
1370
\else{\tclose{\kbdfont\look}}\fi
1371
\else{\tclose{\kbdfont\look}}\fi}
1372
 
1373
% For @url, @env, @command quotes seem unnecessary, so use \code.
1374
\let\url=\code
1375
\let\env=\code
1376
\let\command=\code
1377
 
1378
% @uref (abbreviation for `urlref') takes an optional (comma-separated)
1379
% second argument specifying the text to display and an optional third
1380
% arg as text to display instead of (rather than in addition to) the url
1381
% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
1382
% a hypertex \special here.
1383
%
1384
\def\uref#1{\douref #1,,,\finish}
1385
\def\douref#1,#2,#3,#4\finish{\begingroup
1386
  \unsepspaces
1387
  \pdfurl{#1}%
1388
  \setbox0 = \hbox{\ignorespaces #3}%
1389
  \ifdim\wd0 > 0pt
1390
    \unhbox0 % third arg given, show only that
1391
  \else
1392
    \setbox0 = \hbox{\ignorespaces #2}%
1393
    \ifdim\wd0 > 0pt
1394
      \ifpdf
1395
        \unhbox0             % PDF: 2nd arg given, show only it
1396
      \else
1397
        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
1398
      \fi
1399
    \else
1400
      \code{#1}% only url given, so show it
1401
    \fi
1402
  \fi
1403
  \endlink
1404
\endgroup}
1405
 
1406
% rms does not like angle brackets --karl, 17may97.
1407
% So now @email is just like @uref, unless we are pdf.
1408
%
1409
%\def\email#1{\angleleft{\tt #1}\angleright}
1410
\ifpdf
1411
  \def\email#1{\doemail#1,,\finish}
1412
  \def\doemail#1,#2,#3\finish{\begingroup
1413
    \unsepspaces
1414
    \pdfurl{mailto:#1}%
1415
    \setbox0 = \hbox{\ignorespaces #2}%
1416
    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
1417
    \endlink
1418
  \endgroup}
1419
\else
1420
  \let\email=\uref
1421
\fi
1422
 
1423
% Check if we are currently using a typewriter font.  Since all the
1424
% Computer Modern typewriter fonts have zero interword stretch (and
1425
% shrink), and it is reasonable to expect all typewriter fonts to have
1426
% this property, we can check that font parameter.
1427
%
1428
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1429
 
1430
% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
1431
% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1432
%
1433
\def\dmn#1{\thinspace #1}
1434
 
1435
\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1436
 
1437
% @l was never documented to mean ``switch to the Lisp font'',
1438
% and it is not used as such in any manual I can find.  We need it for
1439
% Polish suppressed-l.  --karl, 22sep96.
1440
%\def\l#1{{\li #1}\null}
1441
 
1442
% Explicit font changes: @r, @sc, undocumented @ii.
1443
\def\r#1{{\rm #1}}              % roman font
1444
\def\sc#1{{\smallcaps#1}}       % smallcaps font
1445
\def\ii#1{{\it #1}}             % italic font
1446
 
1447
% @acronym downcases the argument and prints in smallcaps.
1448
\def\acronym#1{{\smallcaps \lowercase{#1}}}
1449
 
1450
% @pounds{} is a sterling sign.
1451
\def\pounds{{\it\$}}
1452
 
1453
 
1454
\message{page headings,}
1455
 
1456
\newskip\titlepagetopglue \titlepagetopglue = 1.5in
1457
\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1458
 
1459
% First the title page.  Must do @settitle before @titlepage.
1460
\newif\ifseenauthor
1461
\newif\iffinishedtitlepage
1462
 
1463
% Do an implicit @contents or @shortcontents after @end titlepage if the
1464
% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
1465
%
1466
\newif\ifsetcontentsaftertitlepage
1467
 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1468
\newif\ifsetshortcontentsaftertitlepage
1469
 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1470
 
1471
\def\shorttitlepage{\parsearg\shorttitlepagezzz}
1472
\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1473
        \endgroup\page\hbox{}\page}
1474
 
1475
\def\titlepage{\begingroup \parindent=0pt \textfonts
1476
   \let\subtitlerm=\tenrm
1477
   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1478
   %
1479
   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1480
   %
1481
   % Leave some space at the very top of the page.
1482
   \vglue\titlepagetopglue
1483
   %
1484
   % Now you can print the title using @title.
1485
   \def\title{\parsearg\titlezzz}%
1486
   \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1487
                    % print a rule at the page bottom also.
1488
                    \finishedtitlepagefalse
1489
                    \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1490
   % No rule at page bottom unless we print one at the top with @title.
1491
   \finishedtitlepagetrue
1492
   %
1493
   % Now you can put text using @subtitle.
1494
   \def\subtitle{\parsearg\subtitlezzz}%
1495
   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1496
   %
1497
   % @author should come last, but may come many times.
1498
   \def\author{\parsearg\authorzzz}%
1499
   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1500
      {\authorfont \leftline{##1}}}%
1501
   %
1502
   % Most title ``pages'' are actually two pages long, with space
1503
   % at the top of the second.  We don't want the ragged left on the second.
1504
   \let\oldpage = \page
1505
   \def\page{%
1506
      \iffinishedtitlepage\else
1507
         \finishtitlepage
1508
      \fi
1509
      \oldpage
1510
      \let\page = \oldpage
1511
      \hbox{}}%
1512
%   \def\page{\oldpage \hbox{}}
1513
}
1514
 
1515
\def\Etitlepage{%
1516
   \iffinishedtitlepage\else
1517
      \finishtitlepage
1518
   \fi
1519
   % It is important to do the page break before ending the group,
1520
   % because the headline and footline are only empty inside the group.
1521
   % If we use the new definition of \page, we always get a blank page
1522
   % after the title page, which we certainly don't want.
1523
   \oldpage
1524
   \endgroup
1525
   %
1526
   % If they want short, they certainly want long too.
1527
   \ifsetshortcontentsaftertitlepage
1528
     \shortcontents
1529
     \contents
1530
     \global\let\shortcontents = \relax
1531
     \global\let\contents = \relax
1532
   \fi
1533
   %
1534
   \ifsetcontentsaftertitlepage
1535
     \contents
1536
     \global\let\contents = \relax
1537
     \global\let\shortcontents = \relax
1538
   \fi
1539
   %
1540
   \ifpdf \pdfmakepagedesttrue \fi
1541
   %
1542
   \HEADINGSon
1543
}
1544
 
1545
\def\finishtitlepage{%
1546
   \vskip4pt \hrule height 2pt width \hsize
1547
   \vskip\titlepagebottomglue
1548
   \finishedtitlepagetrue
1549
}
1550
 
1551
%%% Set up page headings and footings.
1552
 
1553
\let\thispage=\folio
1554
 
1555
\newtoks\evenheadline    % headline on even pages
1556
\newtoks\oddheadline     % headline on odd pages
1557
\newtoks\evenfootline    % footline on even pages
1558
\newtoks\oddfootline     % footline on odd pages
1559
 
1560
% Now make Tex use those variables
1561
\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1562
                            \else \the\evenheadline \fi}}
1563
\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1564
                            \else \the\evenfootline \fi}\HEADINGShook}
1565
\let\HEADINGShook=\relax
1566
 
1567
% Commands to set those variables.
1568
% For example, this is what  @headings on  does
1569
% @evenheading @thistitle|@thispage|@thischapter
1570
% @oddheading @thischapter|@thispage|@thistitle
1571
% @evenfooting @thisfile||
1572
% @oddfooting ||@thisfile
1573
 
1574
\def\evenheading{\parsearg\evenheadingxxx}
1575
\def\oddheading{\parsearg\oddheadingxxx}
1576
\def\everyheading{\parsearg\everyheadingxxx}
1577
 
1578
\def\evenfooting{\parsearg\evenfootingxxx}
1579
\def\oddfooting{\parsearg\oddfootingxxx}
1580
\def\everyfooting{\parsearg\everyfootingxxx}
1581
 
1582
{\catcode`\@=0 %
1583
 
1584
\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1585
\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1586
\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1587
 
1588
\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1589
\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1590
\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1591
 
1592
\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1593
 
1594
\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1595
\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1596
\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1597
 
1598
\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1599
\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1600
  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1601
  %
1602
  % Leave some space for the footline.  Hopefully ok to assume
1603
  % @evenfooting will not be used by itself.
1604
  \global\advance\pageheight by -\baselineskip
1605
  \global\advance\vsize by -\baselineskip
1606
}
1607
 
1608
\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1609
%
1610
}% unbind the catcode of @.
1611
 
1612
% @headings double      turns headings on for double-sided printing.
1613
% @headings single      turns headings on for single-sided printing.
1614
% @headings off         turns them off.
1615
% @headings on          same as @headings double, retained for compatibility.
1616
% @headings after       turns on double-sided headings after this page.
1617
% @headings doubleafter turns on double-sided headings after this page.
1618
% @headings singleafter turns on single-sided headings after this page.
1619
% By default, they are off at the start of a document,
1620
% and turned `on' after @end titlepage.
1621
 
1622
\def\headings #1 {\csname HEADINGS#1\endcsname}
1623
 
1624
\def\HEADINGSoff{
1625
\global\evenheadline={\hfil} \global\evenfootline={\hfil}
1626
\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1627
\HEADINGSoff
1628
% When we turn headings on, set the page number to 1.
1629
% For double-sided printing, put current file name in lower left corner,
1630
% chapter name on inside top of right hand pages, document
1631
% title on inside top of left hand pages, and page numbers on outside top
1632
% edge of all pages.
1633
\def\HEADINGSdouble{
1634
\global\pageno=1
1635
\global\evenfootline={\hfil}
1636
\global\oddfootline={\hfil}
1637
\global\evenheadline={\line{\folio\hfil\thistitle}}
1638
\global\oddheadline={\line{\thischapter\hfil\folio}}
1639
\global\let\contentsalignmacro = \chapoddpage
1640
}
1641
\let\contentsalignmacro = \chappager
1642
 
1643
% For single-sided printing, chapter title goes across top left of page,
1644
% page number on top right.
1645
\def\HEADINGSsingle{
1646
\global\pageno=1
1647
\global\evenfootline={\hfil}
1648
\global\oddfootline={\hfil}
1649
\global\evenheadline={\line{\thischapter\hfil\folio}}
1650
\global\oddheadline={\line{\thischapter\hfil\folio}}
1651
\global\let\contentsalignmacro = \chappager
1652
}
1653
\def\HEADINGSon{\HEADINGSdouble}
1654
 
1655
\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1656
\let\HEADINGSdoubleafter=\HEADINGSafter
1657
\def\HEADINGSdoublex{%
1658
\global\evenfootline={\hfil}
1659
\global\oddfootline={\hfil}
1660
\global\evenheadline={\line{\folio\hfil\thistitle}}
1661
\global\oddheadline={\line{\thischapter\hfil\folio}}
1662
\global\let\contentsalignmacro = \chapoddpage
1663
}
1664
 
1665
\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1666
\def\HEADINGSsinglex{%
1667
\global\evenfootline={\hfil}
1668
\global\oddfootline={\hfil}
1669
\global\evenheadline={\line{\thischapter\hfil\folio}}
1670
\global\oddheadline={\line{\thischapter\hfil\folio}}
1671
\global\let\contentsalignmacro = \chappager
1672
}
1673
 
1674
% Subroutines used in generating headings
1675
% This produces Day Month Year style of output.
1676
% Only define if not already defined, in case a txi-??.tex file has set
1677
% up a different format (e.g., txi-cs.tex does this).
1678
\ifx\today\undefined
1679
\def\today{%
1680
  \number\day\space
1681
  \ifcase\month
1682
  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
1683
  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
1684
  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
1685
  \fi
1686
  \space\number\year}
1687
\fi
1688
 
1689
% @settitle line...  specifies the title of the document, for headings.
1690
% It generates no output of its own.
1691
\def\thistitle{\putwordNoTitle}
1692
\def\settitle{\parsearg\settitlezzz}
1693
\def\settitlezzz #1{\gdef\thistitle{#1}}
1694
 
1695
 
1696
\message{tables,}
1697
% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1698
 
1699
% default indentation of table text
1700
\newdimen\tableindent \tableindent=.8in
1701
% default indentation of @itemize and @enumerate text
1702
\newdimen\itemindent  \itemindent=.3in
1703
% margin between end of table item and start of table text.
1704
\newdimen\itemmargin  \itemmargin=.1in
1705
 
1706
% used internally for \itemindent minus \itemmargin
1707
\newdimen\itemmax
1708
 
1709
% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1710
% these defs.
1711
% They also define \itemindex
1712
% to index the item name in whatever manner is desired (perhaps none).
1713
 
1714
\newif\ifitemxneedsnegativevskip
1715
 
1716
\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1717
 
1718
\def\internalBitem{\smallbreak \parsearg\itemzzz}
1719
\def\internalBitemx{\itemxpar \parsearg\itemzzz}
1720
 
1721
\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1722
\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1723
 
1724
\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1725
\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1726
 
1727
\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1728
                 \itemzzz {#1}}
1729
 
1730
\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1731
                 \itemzzz {#1}}
1732
 
1733
\def\itemzzz #1{\begingroup %
1734
  \advance\hsize by -\rightskip
1735
  \advance\hsize by -\tableindent
1736
  \setbox0=\hbox{\itemfont{#1}}%
1737
  \itemindex{#1}%
1738
  \nobreak % This prevents a break before @itemx.
1739
  %
1740
  % If the item text does not fit in the space we have, put it on a line
1741
  % by itself, and do not allow a page break either before or after that
1742
  % line.  We do not start a paragraph here because then if the next
1743
  % command is, e.g., @kindex, the whatsit would get put into the
1744
  % horizontal list on a line by itself, resulting in extra blank space.
1745
  \ifdim \wd0>\itemmax
1746
    %
1747
    % Make this a paragraph so we get the \parskip glue and wrapping,
1748
    % but leave it ragged-right.
1749
    \begingroup
1750
      \advance\leftskip by-\tableindent
1751
      \advance\hsize by\tableindent
1752
      \advance\rightskip by0pt plus1fil
1753
      \leavevmode\unhbox0\par
1754
    \endgroup
1755
    %
1756
    % We're going to be starting a paragraph, but we don't want the
1757
    % \parskip glue -- logically it's part of the @item we just started.
1758
    \nobreak \vskip-\parskip
1759
    %
1760
    % Stop a page break at the \parskip glue coming up.  Unfortunately
1761
    % we can't prevent a possible page break at the following
1762
    % \baselineskip glue.
1763
    \nobreak
1764
    \endgroup
1765
    \itemxneedsnegativevskipfalse
1766
  \else
1767
    % The item text fits into the space.  Start a paragraph, so that the
1768
    % following text (if any) will end up on the same line.
1769
    \noindent
1770
    % Do this with kerns and \unhbox so that if there is a footnote in
1771
    % the item text, it can migrate to the main vertical list and
1772
    % eventually be printed.
1773
    \nobreak\kern-\tableindent
1774
    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
1775
    \unhbox0
1776
    \nobreak\kern\dimen0
1777
    \endgroup
1778
    \itemxneedsnegativevskiptrue
1779
  \fi
1780
}
1781
 
1782
\def\item{\errmessage{@item while not in a table}}
1783
\def\itemx{\errmessage{@itemx while not in a table}}
1784
\def\kitem{\errmessage{@kitem while not in a table}}
1785
\def\kitemx{\errmessage{@kitemx while not in a table}}
1786
\def\xitem{\errmessage{@xitem while not in a table}}
1787
\def\xitemx{\errmessage{@xitemx while not in a table}}
1788
 
1789
% Contains a kludge to get @end[description] to work.
1790
\def\description{\tablez{\dontindex}{1}{}{}{}{}}
1791
 
1792
% @table, @ftable, @vtable.
1793
\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1794
{\obeylines\obeyspaces%
1795
\gdef\tablex #1^^M{%
1796
\tabley\dontindex#1        \endtabley}}
1797
 
1798
\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1799
{\obeylines\obeyspaces%
1800
\gdef\ftablex #1^^M{%
1801
\tabley\fnitemindex#1        \endtabley
1802
\def\Eftable{\endgraf\afterenvbreak\endgroup}%
1803
\let\Etable=\relax}}
1804
 
1805
\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1806
{\obeylines\obeyspaces%
1807
\gdef\vtablex #1^^M{%
1808
\tabley\vritemindex#1        \endtabley
1809
\def\Evtable{\endgraf\afterenvbreak\endgroup}%
1810
\let\Etable=\relax}}
1811
 
1812
\def\dontindex #1{}
1813
\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1814
\def\vritemindex #1{\doind {vr}{\code{#1}}}%
1815
 
1816
{\obeyspaces %
1817
\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1818
\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1819
 
1820
\def\tablez #1#2#3#4#5#6{%
1821
\aboveenvbreak %
1822
\begingroup %
1823
\def\Edescription{\Etable}% Necessary kludge.
1824
\let\itemindex=#1%
1825
\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1826
\ifnum 0#4>0 \tableindent=#4\mil \fi %
1827
\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1828
\def\itemfont{#2}%
1829
\itemmax=\tableindent %
1830
\advance \itemmax by -\itemmargin %
1831
\advance \leftskip by \tableindent %
1832
\exdentamount=\tableindent
1833
\parindent = 0pt
1834
\parskip = \smallskipamount
1835
\ifdim \parskip=0pt \parskip=2pt \fi%
1836
\def\Etable{\endgraf\afterenvbreak\endgroup}%
1837
\let\item = \internalBitem %
1838
\let\itemx = \internalBitemx %
1839
\let\kitem = \internalBkitem %
1840
\let\kitemx = \internalBkitemx %
1841
\let\xitem = \internalBxitem %
1842
\let\xitemx = \internalBxitemx %
1843
}
1844
 
1845
% This is the counter used by @enumerate, which is really @itemize
1846
 
1847
\newcount \itemno
1848
 
1849
\def\itemize{\parsearg\itemizezzz}
1850
 
1851
\def\itemizezzz #1{%
1852
  \begingroup % ended by the @end itemize
1853
  \itemizey {#1}{\Eitemize}
1854
}
1855
 
1856
\def\itemizey #1#2{%
1857
\aboveenvbreak %
1858
\itemmax=\itemindent %
1859
\advance \itemmax by -\itemmargin %
1860
\advance \leftskip by \itemindent %
1861
\exdentamount=\itemindent
1862
\parindent = 0pt %
1863
\parskip = \smallskipamount %
1864
\ifdim \parskip=0pt \parskip=2pt \fi%
1865
\def#2{\endgraf\afterenvbreak\endgroup}%
1866
\def\itemcontents{#1}%
1867
\let\item=\itemizeitem}
1868
 
1869
% Set sfcode to normal for the chars that usually have another value.
1870
% These are `.?!:;,'
1871
\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1872
  \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1873
 
1874
% \splitoff TOKENS\endmark defines \first to be the first token in
1875
% TOKENS, and \rest to be the remainder.
1876
%
1877
\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1878
 
1879
% Allow an optional argument of an uppercase letter, lowercase letter,
1880
% or number, to specify the first label in the enumerated list.  No
1881
% argument is the same as `1'.
1882
%
1883
\def\enumerate{\parsearg\enumeratezzz}
1884
\def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
1885
\def\enumeratey #1 #2\endenumeratey{%
1886
  \begingroup % ended by the @end enumerate
1887
  %
1888
  % If we were given no argument, pretend we were given `1'.
1889
  \def\thearg{#1}%
1890
  \ifx\thearg\empty \def\thearg{1}\fi
1891
  %
1892
  % Detect if the argument is a single token.  If so, it might be a
1893
  % letter.  Otherwise, the only valid thing it can be is a number.
1894
  % (We will always have one token, because of the test we just made.
1895
  % This is a good thing, since \splitoff doesn't work given nothing at
1896
  % all -- the first parameter is undelimited.)
1897
  \expandafter\splitoff\thearg\endmark
1898
  \ifx\rest\empty
1899
    % Only one token in the argument.  It could still be anything.
1900
    % A ``lowercase letter'' is one whose \lccode is nonzero.
1901
    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1902
    %   not equal to itself.
1903
    % Otherwise, we assume it's a number.
1904
    %
1905
    % We need the \relax at the end of the \ifnum lines to stop TeX from
1906
    % continuing to look for a <number>.
1907
    %
1908
    \ifnum\lccode\expandafter`\thearg=0\relax
1909
      \numericenumerate % a number (we hope)
1910
    \else
1911
      % It's a letter.
1912
      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1913
        \lowercaseenumerate % lowercase letter
1914
      \else
1915
        \uppercaseenumerate % uppercase letter
1916
      \fi
1917
    \fi
1918
  \else
1919
    % Multiple tokens in the argument.  We hope it's a number.
1920
    \numericenumerate
1921
  \fi
1922
}
1923
 
1924
% An @enumerate whose labels are integers.  The starting integer is
1925
% given in \thearg.
1926
%
1927
\def\numericenumerate{%
1928
  \itemno = \thearg
1929
  \startenumeration{\the\itemno}%
1930
}
1931
 
1932
% The starting (lowercase) letter is in \thearg.
1933
\def\lowercaseenumerate{%
1934
  \itemno = \expandafter`\thearg
1935
  \startenumeration{%
1936
    % Be sure we're not beyond the end of the alphabet.
1937
    \ifnum\itemno=0
1938
      \errmessage{No more lowercase letters in @enumerate; get a bigger
1939
                  alphabet}%
1940
    \fi
1941
    \char\lccode\itemno
1942
  }%
1943
}
1944
 
1945
% The starting (uppercase) letter is in \thearg.
1946
\def\uppercaseenumerate{%
1947
  \itemno = \expandafter`\thearg
1948
  \startenumeration{%
1949
    % Be sure we're not beyond the end of the alphabet.
1950
    \ifnum\itemno=0
1951
      \errmessage{No more uppercase letters in @enumerate; get a bigger
1952
                  alphabet}
1953
    \fi
1954
    \char\uccode\itemno
1955
  }%
1956
}
1957
 
1958
% Call itemizey, adding a period to the first argument and supplying the
1959
% common last two arguments.  Also subtract one from the initial value in
1960
% \itemno, since @item increments \itemno.
1961
%
1962
\def\startenumeration#1{%
1963
  \advance\itemno by -1
1964
  \itemizey{#1.}\Eenumerate\flushcr
1965
}
1966
 
1967
% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1968
% to @enumerate.
1969
%
1970
\def\alphaenumerate{\enumerate{a}}
1971
\def\capsenumerate{\enumerate{A}}
1972
\def\Ealphaenumerate{\Eenumerate}
1973
\def\Ecapsenumerate{\Eenumerate}
1974
 
1975
% Definition of @item while inside @itemize.
1976
 
1977
\def\itemizeitem{%
1978
\advance\itemno by 1
1979
{\let\par=\endgraf \smallbreak}%
1980
\ifhmode \errmessage{In hmode at itemizeitem}\fi
1981
{\parskip=0in \hskip 0pt
1982
\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1983
\vadjust{\penalty 1200}}%
1984
\flushcr}
1985
 
1986
% @multitable macros
1987
% Amy Hendrickson, 8/18/94, 3/6/96
1988
%
1989
% @multitable ... @end multitable will make as many columns as desired.
1990
% Contents of each column will wrap at width given in preamble.  Width
1991
% can be specified either with sample text given in a template line,
1992
% or in percent of \hsize, the current width of text on page.
1993
 
1994
% Table can continue over pages but will only break between lines.
1995
 
1996
% To make preamble:
1997
%
1998
% Either define widths of columns in terms of percent of \hsize:
1999
%   @multitable @columnfractions .25 .3 .45
2000
%   @item ...
2001
%
2002
%   Numbers following @columnfractions are the percent of the total
2003
%   current hsize to be used for each column. You may use as many
2004
%   columns as desired.
2005
 
2006
 
2007
% Or use a template:
2008
%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2009
%   @item ...
2010
%   using the widest term desired in each column.
2011
%
2012
% For those who want to use more than one line's worth of words in
2013
% the preamble, break the line within one argument and it
2014
% will parse correctly, i.e.,
2015
%
2016
%     @multitable {Column 1 template} {Column 2 template} {Column 3
2017
%      template}
2018
% Not:
2019
%     @multitable {Column 1 template} {Column 2 template}
2020
%      {Column 3 template}
2021
 
2022
% Each new table line starts with @item, each subsequent new column
2023
% starts with @tab. Empty columns may be produced by supplying @tab's
2024
% with nothing between them for as many times as empty columns are needed,
2025
% ie, @tab@tab@tab will produce two empty columns.
2026
 
2027
% @item, @tab, @multitable or @end multitable do not need to be on their
2028
% own lines, but it will not hurt if they are.
2029
 
2030
% Sample multitable:
2031
 
2032
%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2033
%   @item first col stuff @tab second col stuff @tab third col
2034
%   @item
2035
%   first col stuff
2036
%   @tab
2037
%   second col stuff
2038
%   @tab
2039
%   third col
2040
%   @item first col stuff @tab second col stuff
2041
%   @tab Many paragraphs of text may be used in any column.
2042
%
2043
%         They will wrap at the width determined by the template.
2044
%   @item@tab@tab This will be in third column.
2045
%   @end multitable
2046
 
2047
% Default dimensions may be reset by user.
2048
% @multitableparskip is vertical space between paragraphs in table.
2049
% @multitableparindent is paragraph indent in table.
2050
% @multitablecolmargin is horizontal space to be left between columns.
2051
% @multitablelinespace is space to leave between table items, baseline
2052
%                                                            to baseline.
2053
%   0pt means it depends on current normal line spacing.
2054
%
2055
\newskip\multitableparskip
2056
\newskip\multitableparindent
2057
\newdimen\multitablecolspace
2058
\newskip\multitablelinespace
2059
\multitableparskip=0pt
2060
\multitableparindent=6pt
2061
\multitablecolspace=12pt
2062
\multitablelinespace=0pt
2063
 
2064
% Macros used to set up halign preamble:
2065
%
2066
\let\endsetuptable\relax
2067
\def\xendsetuptable{\endsetuptable}
2068
\let\columnfractions\relax
2069
\def\xcolumnfractions{\columnfractions}
2070
\newif\ifsetpercent
2071
 
2072
% #1 is the part of the @columnfraction before the decimal point, which
2073
% is presumably either 0 or the empty string (but we don't check, we
2074
% just throw it away).  #2 is the decimal part, which we use as the
2075
% percent of \hsize for this column.
2076
\def\pickupwholefraction#1.#2 {%
2077
  \global\advance\colcount by 1
2078
  \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
2079
  \setuptable
2080
}
2081
 
2082
\newcount\colcount
2083
\def\setuptable#1{%
2084
  \def\firstarg{#1}%
2085
  \ifx\firstarg\xendsetuptable
2086
    \let\go = \relax
2087
  \else
2088
    \ifx\firstarg\xcolumnfractions
2089
      \global\setpercenttrue
2090
    \else
2091
      \ifsetpercent
2092
         \let\go\pickupwholefraction
2093
      \else
2094
         \global\advance\colcount by 1
2095
         \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
2096
                            % typically that is always in the input, anyway.
2097
         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2098
      \fi
2099
    \fi
2100
    \ifx\go\pickupwholefraction
2101
      % Put the argument back for the \pickupwholefraction call, so
2102
      % we'll always have a period there to be parsed.
2103
      \def\go{\pickupwholefraction#1}%
2104
    \else
2105
      \let\go = \setuptable
2106
    \fi%
2107
  \fi
2108
  \go
2109
}
2110
 
2111
% This used to have \hskip1sp.  But then the space in a template line is
2112
% not enough.  That is bad.  So let's go back to just & until we
2113
% encounter the problem it was intended to solve again.
2114
% --karl, nathan@acm.org, 20apr99.
2115
\def\tab{&}
2116
 
2117
% @multitable ... @end multitable definitions:
2118
%
2119
\def\multitable{\parsearg\dotable}
2120
\def\dotable#1{\bgroup
2121
  \vskip\parskip
2122
  \let\item\crcr
2123
  \tolerance=9500
2124
  \hbadness=9500
2125
  \setmultitablespacing
2126
  \parskip=\multitableparskip
2127
  \parindent=\multitableparindent
2128
  \overfullrule=0pt
2129
  \global\colcount=0
2130
  \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2131
  %
2132
  % To parse everything between @multitable and @item:
2133
  \setuptable#1 \endsetuptable
2134
  %
2135
  % \everycr will reset column counter, \colcount, at the end of
2136
  % each line. Every column entry will cause \colcount to advance by one.
2137
  % The table preamble
2138
  % looks at the current \colcount to find the correct column width.
2139
  \everycr{\noalign{%
2140
  %
2141
  % \filbreak%% keeps underfull box messages off when table breaks over pages.
2142
  % Maybe so, but it also creates really weird page breaks when the table
2143
  % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
2144
  % manifests itself, so it can be fixed for real --karl.
2145
    \global\colcount=0\relax}}%
2146
  %
2147
  % This preamble sets up a generic column definition, which will
2148
  % be used as many times as user calls for columns.
2149
  % \vtop will set a single line and will also let text wrap and
2150
  % continue for many paragraphs if desired.
2151
  \halign\bgroup&\global\advance\colcount by 1\relax
2152
    \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2153
  %
2154
  % In order to keep entries from bumping into each other
2155
  % we will add a \leftskip of \multitablecolspace to all columns after
2156
  % the first one.
2157
  %
2158
  % If a template has been used, we will add \multitablecolspace
2159
  % to the width of each template entry.
2160
  %
2161
  % If the user has set preamble in terms of percent of \hsize we will
2162
  % use that dimension as the width of the column, and the \leftskip
2163
  % will keep entries from bumping into each other.  Table will start at
2164
  % left margin and final column will justify at right margin.
2165
  %
2166
  % Make sure we don't inherit \rightskip from the outer environment.
2167
  \rightskip=0pt
2168
  \ifnum\colcount=1
2169
    % The first column will be indented with the surrounding text.
2170
    \advance\hsize by\leftskip
2171
  \else
2172
    \ifsetpercent \else
2173
      % If user has not set preamble in terms of percent of \hsize
2174
      % we will advance \hsize by \multitablecolspace.
2175
      \advance\hsize by \multitablecolspace
2176
    \fi
2177
   % In either case we will make \leftskip=\multitablecolspace:
2178
  \leftskip=\multitablecolspace
2179
  \fi
2180
  % Ignoring space at the beginning and end avoids an occasional spurious
2181
  % blank line, when TeX decides to break the line at the space before the
2182
  % box from the multistrut, so the strut ends up on a line by itself.
2183
  % For example:
2184
  % @multitable @columnfractions .11 .89
2185
  % @item @code{#}
2186
  % @tab Legal holiday which is valid in major parts of the whole country.
2187
  % Is automatically provided with highlighting sequences respectively marking
2188
  % characters.
2189
  \noindent\ignorespaces##\unskip\multistrut}\cr
2190
}
2191
 
2192
\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2193
% If so, do nothing. If not, give it an appropriate dimension based on
2194
% current baselineskip.
2195
\ifdim\multitablelinespace=0pt
2196
\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
2197
\global\advance\multitablelinespace by-\ht0
2198
%% strut to put in table in case some entry doesn't have descenders,
2199
%% to keep lines equally spaced
2200
\let\multistrut = \strut
2201
\else
2202
%% FIXME: what is \box0 supposed to be?
2203
\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2204
width0pt\relax} \fi
2205
%% Test to see if parskip is larger than space between lines of
2206
%% table. If not, do nothing.
2207
%%        If so, set to same dimension as multitablelinespace.
2208
\ifdim\multitableparskip>\multitablelinespace
2209
\global\multitableparskip=\multitablelinespace
2210
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2211
                                      %% than skip between lines in the table.
2212
\fi%
2213
\ifdim\multitableparskip=0pt
2214
\global\multitableparskip=\multitablelinespace
2215
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2216
                                      %% than skip between lines in the table.
2217
\fi}
2218
 
2219
 
2220
\message{conditionals,}
2221
% Prevent errors for section commands.
2222
% Used in @ignore and in failing conditionals.
2223
\def\ignoresections{%
2224
  \let\chapter=\relax
2225
  \let\unnumbered=\relax
2226
  \let\top=\relax
2227
  \let\unnumberedsec=\relax
2228
  \let\unnumberedsection=\relax
2229
  \let\unnumberedsubsec=\relax
2230
  \let\unnumberedsubsection=\relax
2231
  \let\unnumberedsubsubsec=\relax
2232
  \let\unnumberedsubsubsection=\relax
2233
  \let\section=\relax
2234
  \let\subsec=\relax
2235
  \let\subsubsec=\relax
2236
  \let\subsection=\relax
2237
  \let\subsubsection=\relax
2238
  \let\appendix=\relax
2239
  \let\appendixsec=\relax
2240
  \let\appendixsection=\relax
2241
  \let\appendixsubsec=\relax
2242
  \let\appendixsubsection=\relax
2243
  \let\appendixsubsubsec=\relax
2244
  \let\appendixsubsubsection=\relax
2245
  \let\contents=\relax
2246
  \let\smallbook=\relax
2247
  \let\titlepage=\relax
2248
}
2249
 
2250
% Used in nested conditionals, where we have to parse the Texinfo source
2251
% and so want to turn off most commands, in case they are used
2252
% incorrectly.
2253
%
2254
\def\ignoremorecommands{%
2255
  \let\defcodeindex = \relax
2256
  \let\defcv = \relax
2257
  \let\deffn = \relax
2258
  \let\deffnx = \relax
2259
  \let\defindex = \relax
2260
  \let\defivar = \relax
2261
  \let\defmac = \relax
2262
  \let\defmethod = \relax
2263
  \let\defop = \relax
2264
  \let\defopt = \relax
2265
  \let\defspec = \relax
2266
  \let\deftp = \relax
2267
  \let\deftypefn = \relax
2268
  \let\deftypefun = \relax
2269
  \let\deftypeivar = \relax
2270
  \let\deftypeop = \relax
2271
  \let\deftypevar = \relax
2272
  \let\deftypevr = \relax
2273
  \let\defun = \relax
2274
  \let\defvar = \relax
2275
  \let\defvr = \relax
2276
  \let\ref = \relax
2277
  \let\xref = \relax
2278
  \let\printindex = \relax
2279
  \let\pxref = \relax
2280
  \let\settitle = \relax
2281
  \let\setchapternewpage = \relax
2282
  \let\setchapterstyle = \relax
2283
  \let\everyheading = \relax
2284
  \let\evenheading = \relax
2285
  \let\oddheading = \relax
2286
  \let\everyfooting = \relax
2287
  \let\evenfooting = \relax
2288
  \let\oddfooting = \relax
2289
  \let\headings = \relax
2290
  \let\include = \relax
2291
  \let\lowersections = \relax
2292
  \let\down = \relax
2293
  \let\raisesections = \relax
2294
  \let\up = \relax
2295
  \let\set = \relax
2296
  \let\clear = \relax
2297
  \let\item = \relax
2298
}
2299
 
2300
% Ignore @ignore ... @end ignore.
2301
%
2302
\def\ignore{\doignore{ignore}}
2303
 
2304
% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
2305
%
2306
\def\ifinfo{\doignore{ifinfo}}
2307
\def\ifhtml{\doignore{ifhtml}}
2308
\def\ifnottex{\doignore{ifnottex}}
2309
\def\html{\doignore{html}}
2310
\def\menu{\doignore{menu}}
2311
\def\direntry{\doignore{direntry}}
2312
 
2313
% @dircategory CATEGORY  -- specify a category of the dir file
2314
% which this file should belong to.  Ignore this in TeX.
2315
\let\dircategory = \comment
2316
 
2317
% Ignore text until a line `@end #1'.
2318
%
2319
\def\doignore#1{\begingroup
2320
  % Don't complain about control sequences we have declared \outer.
2321
  \ignoresections
2322
  %
2323
  % Define a command to swallow text until we reach `@end #1'.
2324
  % This @ is a catcode 12 token (that is the normal catcode of @ in
2325
  % this texinfo.tex file).  We change the catcode of @ below to match.
2326
  \long\def\doignoretext##1@end #1{\enddoignore}%
2327
  %
2328
  % Make sure that spaces turn into tokens that match what \doignoretext wants.
2329
  \catcode32 = 10
2330
  %
2331
  % Ignore braces, too, so mismatched braces don't cause trouble.
2332
  \catcode`\{ = 9
2333
  \catcode`\} = 9
2334
  %
2335
  % We must not have @c interpreted as a control sequence.
2336
  \catcode`\@ = 12
2337
  %
2338
  % Make the letter c a comment character so that the rest of the line
2339
  % will be ignored. This way, the document can have (for example)
2340
  %   @c @end ifinfo
2341
  % and the @end ifinfo will be properly ignored.
2342
  % (We've just changed @ to catcode 12.)
2343
  \catcode`\c = 14
2344
  %
2345
  % And now expand that command.
2346
  \doignoretext
2347
}
2348
 
2349
% What we do to finish off ignored text.
2350
%
2351
\def\enddoignore{\endgroup\ignorespaces}%
2352
 
2353
\newif\ifwarnedobs\warnedobsfalse
2354
\def\obstexwarn{%
2355
  \ifwarnedobs\relax\else
2356
  % We need to warn folks that they may have trouble with TeX 3.0.
2357
  % This uses \immediate\write16 rather than \message to get newlines.
2358
    \immediate\write16{}
2359
    \immediate\write16{WARNING: for users of Unix TeX 3.0!}
2360
    \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
2361
    \immediate\write16{If you are running another version of TeX, relax.}
2362
    \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
2363
    \immediate\write16{  Then upgrade your TeX installation if you can.}
2364
    \immediate\write16{  (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
2365
    \immediate\write16{If you are stuck with version 3.0, run the}
2366
    \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
2367
    \immediate\write16{  to use a workaround.}
2368
    \immediate\write16{}
2369
    \global\warnedobstrue
2370
    \fi
2371
}
2372
 
2373
% **In TeX 3.0, setting text in \nullfont hangs tex.  For a
2374
% workaround (which requires the file ``dummy.tfm'' to be installed),
2375
% uncomment the following line:
2376
%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
2377
 
2378
% Ignore text, except that we keep track of conditional commands for
2379
% purposes of nesting, up to an `@end #1' command.
2380
%
2381
\def\nestedignore#1{%
2382
  \obstexwarn
2383
  % We must actually expand the ignored text to look for the @end
2384
  % command, so that nested ignore constructs work.  Thus, we put the
2385
  % text into a \vbox and then do nothing with the result.  To minimize
2386
  % the change of memory overflow, we follow the approach outlined on
2387
  % page 401 of the TeXbook: make the current font be a dummy font.
2388
  %
2389
  \setbox0 = \vbox\bgroup
2390
    % Don't complain about control sequences we have declared \outer.
2391
    \ignoresections
2392
    %
2393
    % Define `@end #1' to end the box, which will in turn undefine the
2394
    % @end command again.
2395
    \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
2396
    %
2397
    % We are going to be parsing Texinfo commands.  Most cause no
2398
    % trouble when they are used incorrectly, but some commands do
2399
    % complicated argument parsing or otherwise get confused, so we
2400
    % undefine them.
2401
    %
2402
    % We can't do anything about stray @-signs, unfortunately;
2403
    % they'll produce `undefined control sequence' errors.
2404
    \ignoremorecommands
2405
    %
2406
    % Set the current font to be \nullfont, a TeX primitive, and define
2407
    % all the font commands to also use \nullfont.  We don't use
2408
    % dummy.tfm, as suggested in the TeXbook, because not all sites
2409
    % might have that installed.  Therefore, math mode will still
2410
    % produce output, but that should be an extremely small amount of
2411
    % stuff compared to the main input.
2412
    %
2413
    \nullfont
2414
    \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
2415
    \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
2416
    \let\tensf=\nullfont
2417
    % Similarly for index fonts (mostly for their use in smallexample).
2418
    \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
2419
    \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
2420
    \let\smallsf=\nullfont
2421
    %
2422
    % Don't complain when characters are missing from the fonts.
2423
    \tracinglostchars = 0
2424
    %
2425
    % Don't bother to do space factor calculations.
2426
    \frenchspacing
2427
    %
2428
    % Don't report underfull hboxes.
2429
    \hbadness = 10000
2430
    %
2431
    % Do minimal line-breaking.
2432
    \pretolerance = 10000
2433
    %
2434
    % Do not execute instructions in @tex
2435
    \def\tex{\doignore{tex}}%
2436
    % Do not execute macro definitions.
2437
    % `c' is a comment character, so the word `macro' will get cut off.
2438
    \def\macro{\doignore{ma}}%
2439
}
2440
 
2441
% @set VAR sets the variable VAR to an empty value.
2442
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
2443
%
2444
% Since we want to separate VAR from REST-OF-LINE (which might be
2445
% empty), we can't just use \parsearg; we have to insert a space of our
2446
% own to delimit the rest of the line, and then take it out again if we
2447
% didn't need it.  Make sure the catcode of space is correct to avoid
2448
% losing inside @example, for instance.
2449
%
2450
\def\set{\begingroup\catcode` =10
2451
  \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
2452
  \parsearg\setxxx}
2453
\def\setxxx#1{\setyyy#1 \endsetyyy}
2454
\def\setyyy#1 #2\endsetyyy{%
2455
  \def\temp{#2}%
2456
  \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
2457
  \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
2458
  \fi
2459
  \endgroup
2460
}
2461
% Can't use \xdef to pre-expand #2 and save some time, since \temp or
2462
% \next or other control sequences that we've defined might get us into
2463
% an infinite loop. Consider `@set foo @cite{bar}'.
2464
\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
2465
 
2466
% @clear VAR clears (i.e., unsets) the variable VAR.
2467
%
2468
\def\clear{\parsearg\clearxxx}
2469
\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
2470
 
2471
% @value{foo} gets the text saved in variable foo.
2472
{
2473
  \catcode`\_ = \active
2474
  %
2475
  % We might end up with active _ or - characters in the argument if
2476
  % we're called from @code, as @code{@value{foo-bar_}}.  So \let any
2477
  % such active characters to their normal equivalents.
2478
  \gdef\value{\begingroup
2479
    \catcode`\-=12 \catcode`\_=12
2480
    \indexbreaks \let_\normalunderscore
2481
    \valuexxx}
2482
}
2483
\def\valuexxx#1{\expandablevalue{#1}\endgroup}
2484
 
2485
% We have this subroutine so that we can handle at least some @value's
2486
% properly in indexes (we \let\value to this in \indexdummies).  Ones
2487
% whose names contain - or _ still won't work, but we can't do anything
2488
% about that.  The command has to be fully expandable, since the result
2489
% winds up in the index file.  This means that if the variable's value
2490
% contains other Texinfo commands, it's almost certain it will fail
2491
% (although perhaps we could fix that with sufficient work to do a
2492
% one-level expansion on the result, instead of complete).
2493
%
2494
\def\expandablevalue#1{%
2495
  \expandafter\ifx\csname SET#1\endcsname\relax
2496
    {[No value for ``#1'']}%
2497
  \else
2498
    \csname SET#1\endcsname
2499
  \fi
2500
}
2501
 
2502
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
2503
% with @set.
2504
%
2505
\def\ifset{\parsearg\ifsetxxx}
2506
\def\ifsetxxx #1{%
2507
  \expandafter\ifx\csname SET#1\endcsname\relax
2508
    \expandafter\ifsetfail
2509
  \else
2510
    \expandafter\ifsetsucceed
2511
  \fi
2512
}
2513
\def\ifsetsucceed{\conditionalsucceed{ifset}}
2514
\def\ifsetfail{\nestedignore{ifset}}
2515
\defineunmatchedend{ifset}
2516
 
2517
% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
2518
% defined with @set, or has been undefined with @clear.
2519
%
2520
\def\ifclear{\parsearg\ifclearxxx}
2521
\def\ifclearxxx #1{%
2522
  \expandafter\ifx\csname SET#1\endcsname\relax
2523
    \expandafter\ifclearsucceed
2524
  \else
2525
    \expandafter\ifclearfail
2526
  \fi
2527
}
2528
\def\ifclearsucceed{\conditionalsucceed{ifclear}}
2529
\def\ifclearfail{\nestedignore{ifclear}}
2530
\defineunmatchedend{ifclear}
2531
 
2532
% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
2533
% following, through the first @end iftex (etc.).  Make `@end iftex'
2534
% (etc.) valid only after an @iftex.
2535
%
2536
\def\iftex{\conditionalsucceed{iftex}}
2537
\def\ifnothtml{\conditionalsucceed{ifnothtml}}
2538
\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
2539
\defineunmatchedend{iftex}
2540
\defineunmatchedend{ifnothtml}
2541
\defineunmatchedend{ifnotinfo}
2542
 
2543
% We can't just want to start a group at @iftex (for example) and end it
2544
% at @end iftex, since then @set commands inside the conditional have no
2545
% effect (they'd get reverted at the end of the group).  So we must
2546
% define \Eiftex to redefine itself to be its previous value.  (We can't
2547
% just define it to fail again with an ``unmatched end'' error, since
2548
% the @ifset might be nested.)
2549
%
2550
\def\conditionalsucceed#1{%
2551
  \edef\temp{%
2552
    % Remember the current value of \E#1.
2553
    \let\nece{prevE#1} = \nece{E#1}%
2554
    %
2555
    % At the `@end #1', redefine \E#1 to be its previous value.
2556
    \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
2557
  }%
2558
  \temp
2559
}
2560
 
2561
% We need to expand lots of \csname's, but we don't want to expand the
2562
% control sequences after we've constructed them.
2563
%
2564
\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
2565
 
2566
% @defininfoenclose.
2567
\let\definfoenclose=\comment
2568
 
2569
 
2570
\message{indexing,}
2571
% Index generation facilities
2572
 
2573
% Define \newwrite to be identical to plain tex's \newwrite
2574
% except not \outer, so it can be used within \newindex.
2575
{\catcode`\@=11
2576
\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2577
 
2578
% \newindex {foo} defines an index named foo.
2579
% It automatically defines \fooindex such that
2580
% \fooindex ...rest of line... puts an entry in the index foo.
2581
% It also defines \fooindfile to be the number of the output channel for
2582
% the file that accumulates this index.  The file's extension is foo.
2583
% The name of an index should be no more than 2 characters long
2584
% for the sake of vms.
2585
%
2586
\def\newindex#1{%
2587
  \iflinks
2588
    \expandafter\newwrite \csname#1indfile\endcsname
2589
    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2590
  \fi
2591
  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
2592
    \noexpand\doindex{#1}}
2593
}
2594
 
2595
% @defindex foo  ==  \newindex{foo}
2596
 
2597
\def\defindex{\parsearg\newindex}
2598
 
2599
% Define @defcodeindex, like @defindex except put all entries in @code.
2600
 
2601
\def\newcodeindex#1{%
2602
  \iflinks
2603
    \expandafter\newwrite \csname#1indfile\endcsname
2604
    \openout \csname#1indfile\endcsname \jobname.#1
2605
  \fi
2606
  \expandafter\xdef\csname#1index\endcsname{%
2607
    \noexpand\docodeindex{#1}}
2608
}
2609
 
2610
\def\defcodeindex{\parsearg\newcodeindex}
2611
 
2612
% @synindex foo bar    makes index foo feed into index bar.
2613
% Do this instead of @defindex foo if you don't want it as a separate index.
2614
% The \closeout helps reduce unnecessary open files; the limit on the
2615
% Acorn RISC OS is a mere 16 files.
2616
\def\synindex#1 #2 {%
2617
  \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2618
  \expandafter\closeout\csname#1indfile\endcsname
2619
  \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2620
  \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2621
    \noexpand\doindex{#2}}%
2622
}
2623
 
2624
% @syncodeindex foo bar   similar, but put all entries made for index foo
2625
% inside @code.
2626
\def\syncodeindex#1 #2 {%
2627
  \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2628
  \expandafter\closeout\csname#1indfile\endcsname
2629
  \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2630
  \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2631
    \noexpand\docodeindex{#2}}%
2632
}
2633
 
2634
% Define \doindex, the driver for all \fooindex macros.
2635
% Argument #1 is generated by the calling \fooindex macro,
2636
%  and it is "foo", the name of the index.
2637
 
2638
% \doindex just uses \parsearg; it calls \doind for the actual work.
2639
% This is because \doind is more useful to call from other macros.
2640
 
2641
% There is also \dosubind {index}{topic}{subtopic}
2642
% which makes an entry in a two-level index such as the operation index.
2643
 
2644
\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2645
\def\singleindexer #1{\doind{\indexname}{#1}}
2646
 
2647
% like the previous two, but they put @code around the argument.
2648
\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2649
\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2650
 
2651
\def\indexdummies{%
2652
\def\ { }%
2653
% Take care of the plain tex accent commands.
2654
\def\"{\realbackslash "}%
2655
\def\`{\realbackslash `}%
2656
\def\'{\realbackslash '}%
2657
\def\^{\realbackslash ^}%
2658
\def\~{\realbackslash ~}%
2659
\def\={\realbackslash =}%
2660
\def\b{\realbackslash b}%
2661
\def\c{\realbackslash c}%
2662
\def\d{\realbackslash d}%
2663
\def\u{\realbackslash u}%
2664
\def\v{\realbackslash v}%
2665
\def\H{\realbackslash H}%
2666
% Take care of the plain tex special European modified letters.
2667
\def\oe{\realbackslash oe}%
2668
\def\ae{\realbackslash ae}%
2669
\def\aa{\realbackslash aa}%
2670
\def\OE{\realbackslash OE}%
2671
\def\AE{\realbackslash AE}%
2672
\def\AA{\realbackslash AA}%
2673
\def\o{\realbackslash o}%
2674
\def\O{\realbackslash O}%
2675
\def\l{\realbackslash l}%
2676
\def\L{\realbackslash L}%
2677
\def\ss{\realbackslash ss}%
2678
% Take care of texinfo commands likely to appear in an index entry.
2679
% (Must be a way to avoid doing expansion at all, and thus not have to
2680
% laboriously list every single command here.)
2681
\def\@{@}% will be @@ when we switch to @ as escape char.
2682
% Need these in case \tex is in effect and \{ is a \delimiter again.
2683
% But can't use \lbracecmd and \rbracecmd because texindex assumes
2684
% braces and backslashes are used only as delimiters.
2685
\let\{ = \mylbrace
2686
\let\} = \myrbrace
2687
\def\_{{\realbackslash _}}%
2688
\def\w{\realbackslash w }%
2689
\def\bf{\realbackslash bf }%
2690
%\def\rm{\realbackslash rm }%
2691
\def\sl{\realbackslash sl }%
2692
\def\sf{\realbackslash sf}%
2693
\def\tt{\realbackslash tt}%
2694
\def\gtr{\realbackslash gtr}%
2695
\def\less{\realbackslash less}%
2696
\def\hat{\realbackslash hat}%
2697
\def\TeX{\realbackslash TeX}%
2698
\def\dots{\realbackslash dots }%
2699
\def\result{\realbackslash result}%
2700
\def\equiv{\realbackslash equiv}%
2701
\def\expansion{\realbackslash expansion}%
2702
\def\print{\realbackslash print}%
2703
\def\error{\realbackslash error}%
2704
\def\point{\realbackslash point}%
2705
\def\copyright{\realbackslash copyright}%
2706
\def\tclose##1{\realbackslash tclose {##1}}%
2707
\def\code##1{\realbackslash code {##1}}%
2708
\def\uref##1{\realbackslash uref {##1}}%
2709
\def\url##1{\realbackslash url {##1}}%
2710
\def\env##1{\realbackslash env {##1}}%
2711
\def\command##1{\realbackslash command {##1}}%
2712
\def\option##1{\realbackslash option {##1}}%
2713
\def\dotless##1{\realbackslash dotless {##1}}%
2714
\def\samp##1{\realbackslash samp {##1}}%
2715
\def\,##1{\realbackslash ,{##1}}%
2716
\def\t##1{\realbackslash t {##1}}%
2717
\def\r##1{\realbackslash r {##1}}%
2718
\def\i##1{\realbackslash i {##1}}%
2719
\def\b##1{\realbackslash b {##1}}%
2720
\def\sc##1{\realbackslash sc {##1}}%
2721
\def\cite##1{\realbackslash cite {##1}}%
2722
\def\key##1{\realbackslash key {##1}}%
2723
\def\file##1{\realbackslash file {##1}}%
2724
\def\var##1{\realbackslash var {##1}}%
2725
\def\kbd##1{\realbackslash kbd {##1}}%
2726
\def\dfn##1{\realbackslash dfn {##1}}%
2727
\def\emph##1{\realbackslash emph {##1}}%
2728
\def\acronym##1{\realbackslash acronym {##1}}%
2729
%
2730
% Handle some cases of @value -- where the variable name does not
2731
% contain - or _, and the value does not contain any
2732
% (non-fully-expandable) commands.
2733
\let\value = \expandablevalue
2734
%
2735
\unsepspaces
2736
% Turn off macro expansion
2737
\turnoffmacros
2738
}
2739
 
2740
% If an index command is used in an @example environment, any spaces
2741
% therein should become regular spaces in the raw index file, not the
2742
% expansion of \tie (\\leavevmode \penalty \@M \ ).
2743
{\obeyspaces
2744
 \gdef\unsepspaces{\obeyspaces\let =\space}}
2745
 
2746
% \indexnofonts no-ops all font-change commands.
2747
% This is used when outputting the strings to sort the index by.
2748
\def\indexdummyfont#1{#1}
2749
\def\indexdummytex{TeX}
2750
\def\indexdummydots{...}
2751
 
2752
\def\indexnofonts{%
2753
% Just ignore accents.
2754
\let\,=\indexdummyfont
2755
\let\"=\indexdummyfont
2756
\let\`=\indexdummyfont
2757
\let\'=\indexdummyfont
2758
\let\^=\indexdummyfont
2759
\let\~=\indexdummyfont
2760
\let\==\indexdummyfont
2761
\let\b=\indexdummyfont
2762
\let\c=\indexdummyfont
2763
\let\d=\indexdummyfont
2764
\let\u=\indexdummyfont
2765
\let\v=\indexdummyfont
2766
\let\H=\indexdummyfont
2767
\let\dotless=\indexdummyfont
2768
% Take care of the plain tex special European modified letters.
2769
\def\oe{oe}%
2770
\def\ae{ae}%
2771
\def\aa{aa}%
2772
\def\OE{OE}%
2773
\def\AE{AE}%
2774
\def\AA{AA}%
2775
\def\o{o}%
2776
\def\O{O}%
2777
\def\l{l}%
2778
\def\L{L}%
2779
\def\ss{ss}%
2780
\let\w=\indexdummyfont
2781
\let\t=\indexdummyfont
2782
\let\r=\indexdummyfont
2783
\let\i=\indexdummyfont
2784
\let\b=\indexdummyfont
2785
\let\emph=\indexdummyfont
2786
\let\strong=\indexdummyfont
2787
\let\cite=\indexdummyfont
2788
\let\sc=\indexdummyfont
2789
%Don't no-op \tt, since it isn't a user-level command
2790
% and is used in the definitions of the active chars like <, >, |...
2791
%\let\tt=\indexdummyfont
2792
\let\tclose=\indexdummyfont
2793
\let\code=\indexdummyfont
2794
\let\url=\indexdummyfont
2795
\let\uref=\indexdummyfont
2796
\let\env=\indexdummyfont
2797
\let\acronym=\indexdummyfont
2798
\let\command=\indexdummyfont
2799
\let\option=\indexdummyfont
2800
\let\file=\indexdummyfont
2801
\let\samp=\indexdummyfont
2802
\let\kbd=\indexdummyfont
2803
\let\key=\indexdummyfont
2804
\let\var=\indexdummyfont
2805
\let\TeX=\indexdummytex
2806
\let\dots=\indexdummydots
2807
\def\@{@}%
2808
}
2809
 
2810
% To define \realbackslash, we must make \ not be an escape.
2811
% We must first make another character (@) an escape
2812
% so we do not become unable to do a definition.
2813
 
2814
{\catcode`\@=0 \catcode`\\=\other
2815
 @gdef@realbackslash{\}}
2816
 
2817
\let\indexbackslash=0  %overridden during \printindex.
2818
\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
2819
 
2820
% For \ifx comparisons.
2821
\def\emptymacro{\empty}
2822
 
2823
% Most index entries go through here, but \dosubind is the general case.
2824
%
2825
\def\doind#1#2{\dosubind{#1}{#2}\empty}
2826
 
2827
% Workhorse for all \fooindexes.
2828
% #1 is name of index, #2 is stuff to put there, #3 is subentry --
2829
% \empty if called from \doind, as we usually are.  The main exception
2830
% is with defuns, which call us directly.
2831
%
2832
\def\dosubind#1#2#3{%
2833
  % Put the index entry in the margin if desired.
2834
  \ifx\SETmarginindex\relax\else
2835
    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2836
  \fi
2837
  {%
2838
    \count255=\lastpenalty
2839
    {%
2840
      \indexdummies % Must do this here, since \bf, etc expand at this stage
2841
      \escapechar=`\\
2842
      {%
2843
        \let\folio = 0% We will expand all macros now EXCEPT \folio.
2844
        \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2845
        % so it will be output as is; and it will print as backslash.
2846
        %
2847
        \def\thirdarg{#3}%
2848
        %
2849
        % If third arg is present, precede it with space in sort key.
2850
        \ifx\thirdarg\emptymacro
2851
          \let\subentry = \empty
2852
        \else
2853
          \def\subentry{ #3}%
2854
        \fi
2855
        %
2856
        % First process the index entry with all font commands turned
2857
        % off to get the string to sort by.
2858
        {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
2859
        %
2860
        % Now the real index entry with the fonts.
2861
        \toks0 = {#2}%
2862
        %
2863
        % If third (subentry) arg is present, add it to the index
2864
        % string.  And include a space.
2865
        \ifx\thirdarg\emptymacro \else
2866
          \toks0 = \expandafter{\the\toks0 \space #3}%
2867
        \fi
2868
        %
2869
        % Set up the complete index entry, with both the sort key
2870
        % and the original text, including any font commands.  We write
2871
        % three arguments to \entry to the .?? file, texindex reduces to
2872
        % two when writing the .??s sorted result.
2873
        \edef\temp{%
2874
          \write\csname#1indfile\endcsname{%
2875
            \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2876
        }%
2877
        %
2878
        % If a skip is the last thing on the list now, preserve it
2879
        % by backing up by \lastskip, doing the \write, then inserting
2880
        % the skip again.  Otherwise, the whatsit generated by the
2881
        % \write will make \lastskip zero.  The result is that sequences
2882
        % like this:
2883
        % @end defun
2884
        % @tindex whatever
2885
        % @defun ...
2886
        % will have extra space inserted, because the \medbreak in the
2887
        % start of the @defun won't see the skip inserted by the @end of
2888
        % the previous defun.
2889
        %
2890
        % But don't do any of this if we're not in vertical mode.  We
2891
        % don't want to do a \vskip and prematurely end a paragraph.
2892
        %
2893
        % Avoid page breaks due to these extra skips, too.
2894
        %
2895
        \iflinks
2896
          \ifvmode
2897
            \skip0 = \lastskip
2898
            \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
2899
          \fi
2900
          %
2901
          \temp % do the write
2902
          %
2903
          %
2904
          \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
2905
        \fi
2906
      }%
2907
    }%
2908
    \penalty\count255
2909
  }%
2910
}
2911
 
2912
% The index entry written in the file actually looks like
2913
%  \entry {sortstring}{page}{topic}
2914
% or
2915
%  \entry {sortstring}{page}{topic}{subtopic}
2916
% The texindex program reads in these files and writes files
2917
% containing these kinds of lines:
2918
%  \initial {c}
2919
%     before the first topic whose initial is c
2920
%  \entry {topic}{pagelist}
2921
%     for a topic that is used without subtopics
2922
%  \primary {topic}
2923
%     for the beginning of a topic that is used with subtopics
2924
%  \secondary {subtopic}{pagelist}
2925
%     for each subtopic.
2926
 
2927
% Define the user-accessible indexing commands
2928
% @findex, @vindex, @kindex, @cindex.
2929
 
2930
\def\findex {\fnindex}
2931
\def\kindex {\kyindex}
2932
\def\cindex {\cpindex}
2933
\def\vindex {\vrindex}
2934
\def\tindex {\tpindex}
2935
\def\pindex {\pgindex}
2936
 
2937
\def\cindexsub {\begingroup\obeylines\cindexsub}
2938
{\obeylines %
2939
\gdef\cindexsub "#1" #2^^M{\endgroup %
2940
\dosubind{cp}{#2}{#1}}}
2941
 
2942
% Define the macros used in formatting output of the sorted index material.
2943
 
2944
% @printindex causes a particular index (the ??s file) to get printed.
2945
% It does not print any chapter heading (usually an @unnumbered).
2946
%
2947
\def\printindex{\parsearg\doprintindex}
2948
\def\doprintindex#1{\begingroup
2949
  \dobreak \chapheadingskip{10000}%
2950
  %
2951
  \smallfonts \rm
2952
  \tolerance = 9500
2953
  \indexbreaks
2954
  %
2955
  % See if the index file exists and is nonempty.
2956
  % Change catcode of @ here so that if the index file contains
2957
  % \initial {@}
2958
  % as its first line, TeX doesn't complain about mismatched braces
2959
  % (because it thinks @} is a control sequence).
2960
  \catcode`\@ = 11
2961
  \openin 1 \jobname.#1s
2962
  \ifeof 1
2963
    % \enddoublecolumns gets confused if there is no text in the index,
2964
    % and it loses the chapter title and the aux file entries for the
2965
    % index.  The easiest way to prevent this problem is to make sure
2966
    % there is some text.
2967
    \putwordIndexNonexistent
2968
  \else
2969
    %
2970
    % If the index file exists but is empty, then \openin leaves \ifeof
2971
    % false.  We have to make TeX try to read something from the file, so
2972
    % it can discover if there is anything in it.
2973
    \read 1 to \temp
2974
    \ifeof 1
2975
      \putwordIndexIsEmpty
2976
    \else
2977
      % Index files are almost Texinfo source, but we use \ as the escape
2978
      % character.  It would be better to use @, but that's too big a change
2979
      % to make right now.
2980
      \def\indexbackslash{\rawbackslashxx}%
2981
      \catcode`\\ = 0
2982
      \escapechar = `\\
2983
      \begindoublecolumns
2984
      \input \jobname.#1s
2985
      \enddoublecolumns
2986
    \fi
2987
  \fi
2988
  \closein 1
2989
\endgroup}
2990
 
2991
% These macros are used by the sorted index file itself.
2992
% Change them to control the appearance of the index.
2993
 
2994
\def\initial#1{{%
2995
  % Some minor font changes for the special characters.
2996
  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2997
  %
2998
  % Remove any glue we may have, we'll be inserting our own.
2999
  \removelastskip
3000
  %
3001
  % We like breaks before the index initials, so insert a bonus.
3002
  \penalty -300
3003
  %
3004
  % Typeset the initial.  Making this add up to a whole number of
3005
  % baselineskips increases the chance of the dots lining up from column
3006
  % to column.  It still won't often be perfect, because of the stretch
3007
  % we need before each entry, but it's better.
3008
  %
3009
  % No shrink because it confuses \balancecolumns.
3010
  \vskip 1.67\baselineskip plus .5\baselineskip
3011
  \leftline{\secbf #1}%
3012
  \vskip .33\baselineskip plus .1\baselineskip
3013
  %
3014
  % Do our best not to break after the initial.
3015
  \nobreak
3016
}}
3017
 
3018
% This typesets a paragraph consisting of #1, dot leaders, and then #2
3019
% flush to the right margin.  It is used for index and table of contents
3020
% entries.  The paragraph is indented by \leftskip.
3021
%
3022
\def\entry#1#2{\begingroup
3023
  %
3024
  % Start a new paragraph if necessary, so our assignments below can't
3025
  % affect previous text.
3026
  \par
3027
  %
3028
  % Do not fill out the last line with white space.
3029
  \parfillskip = 0in
3030
  %
3031
  % No extra space above this paragraph.
3032
  \parskip = 0in
3033
  %
3034
  % Do not prefer a separate line ending with a hyphen to fewer lines.
3035
  \finalhyphendemerits = 0
3036
  %
3037
  % \hangindent is only relevant when the entry text and page number
3038
  % don't both fit on one line.  In that case, bob suggests starting the
3039
  % dots pretty far over on the line.  Unfortunately, a large
3040
  % indentation looks wrong when the entry text itself is broken across
3041
  % lines.  So we use a small indentation and put up with long leaders.
3042
  %
3043
  % \hangafter is reset to 1 (which is the value we want) at the start
3044
  % of each paragraph, so we need not do anything with that.
3045
  \hangindent = 2em
3046
  %
3047
  % When the entry text needs to be broken, just fill out the first line
3048
  % with blank space.
3049
  \rightskip = 0pt plus1fil
3050
  %
3051
  % A bit of stretch before each entry for the benefit of balancing columns.
3052
  \vskip 0pt plus1pt
3053
  %
3054
  % Start a ``paragraph'' for the index entry so the line breaking
3055
  % parameters we've set above will have an effect.
3056
  \noindent
3057
  %
3058
  % Insert the text of the index entry.  TeX will do line-breaking on it.
3059
  #1%
3060
  % The following is kludged to not output a line of dots in the index if
3061
  % there are no page numbers.  The next person who breaks this will be
3062
  % cursed by a Unix daemon.
3063
  \def\tempa{{\rm }}%
3064
  \def\tempb{#2}%
3065
  \edef\tempc{\tempa}%
3066
  \edef\tempd{\tempb}%
3067
  \ifx\tempc\tempd\ \else%
3068
    %
3069
    % If we must, put the page number on a line of its own, and fill out
3070
    % this line with blank space.  (The \hfil is overwhelmed with the
3071
    % fill leaders glue in \indexdotfill if the page number does fit.)
3072
    \hfil\penalty50
3073
    \null\nobreak\indexdotfill % Have leaders before the page number.
3074
    %
3075
    % The `\ ' here is removed by the implicit \unskip that TeX does as
3076
    % part of (the primitive) \par.  Without it, a spurious underfull
3077
    % \hbox ensues.
3078
    \ifpdf
3079
      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
3080
    \else
3081
      \ #2% The page number ends the paragraph.
3082
    \fi
3083
  \fi%
3084
  \par
3085
\endgroup}
3086
 
3087
% Like \dotfill except takes at least 1 em.
3088
\def\indexdotfill{\cleaders
3089
  \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
3090
 
3091
\def\primary #1{\line{#1\hfil}}
3092
 
3093
\newskip\secondaryindent \secondaryindent=0.5cm
3094
 
3095
\def\secondary #1#2{
3096
{\parfillskip=0in \parskip=0in
3097
\hangindent =1in \hangafter=1
3098
\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
3099
}}
3100
 
3101
% Define two-column mode, which we use to typeset indexes.
3102
% Adapted from the TeXbook, page 416, which is to say,
3103
% the manmac.tex format used to print the TeXbook itself.
3104
\catcode`\@=11
3105
 
3106
\newbox\partialpage
3107
\newdimen\doublecolumnhsize
3108
 
3109
\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
3110
  % Grab any single-column material above us.
3111
  \output = {%
3112
    %
3113
    % Here is a possibility not foreseen in manmac: if we accumulate a
3114
    % whole lot of material, we might end up calling this \output
3115
    % routine twice in a row (see the doublecol-lose test, which is
3116
    % essentially a couple of indexes with @setchapternewpage off).  In
3117
    % that case we just ship out what is in \partialpage with the normal
3118
    % output routine.  Generally, \partialpage will be empty when this
3119
    % runs and this will be a no-op.  See the indexspread.tex test case.
3120
    \ifvoid\partialpage \else
3121
      \onepageout{\pagecontents\partialpage}%
3122
    \fi
3123
    %
3124
    \global\setbox\partialpage = \vbox{%
3125
      % Unvbox the main output page.
3126
      \unvbox\PAGE
3127
      \kern-\topskip \kern\baselineskip
3128
    }%
3129
  }%
3130
  \eject % run that output routine to set \partialpage
3131
  %
3132
  % Use the double-column output routine for subsequent pages.
3133
  \output = {\doublecolumnout}%
3134
  %
3135
  % Change the page size parameters.  We could do this once outside this
3136
  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
3137
  % format, but then we repeat the same computation.  Repeating a couple
3138
  % of assignments once per index is clearly meaningless for the
3139
  % execution time, so we may as well do it in one place.
3140
  %
3141
  % First we halve the line length, less a little for the gutter between
3142
  % the columns.  We compute the gutter based on the line length, so it
3143
  % changes automatically with the paper format.  The magic constant
3144
  % below is chosen so that the gutter has the same value (well, +-<1pt)
3145
  % as it did when we hard-coded it.
3146
  %
3147
  % We put the result in a separate register, \doublecolumhsize, so we
3148
  % can restore it in \pagesofar, after \hsize itself has (potentially)
3149
  % been clobbered.
3150
  %
3151
  \doublecolumnhsize = \hsize
3152
    \advance\doublecolumnhsize by -.04154\hsize
3153
    \divide\doublecolumnhsize by 2
3154
  \hsize = \doublecolumnhsize
3155
  %
3156
  % Double the \vsize as well.  (We don't need a separate register here,
3157
  % since nobody clobbers \vsize.)
3158
  \advance\vsize by -\ht\partialpage
3159
  \vsize = 2\vsize
3160
}
3161
 
3162
% The double-column output routine for all double-column pages except
3163
% the last.
3164
%
3165
\def\doublecolumnout{%
3166
  \splittopskip=\topskip \splitmaxdepth=\maxdepth
3167
  % Get the available space for the double columns -- the normal
3168
  % (undoubled) page height minus any material left over from the
3169
  % previous page.
3170
  \dimen@ = \vsize
3171
  \divide\dimen@ by 2
3172
  %
3173
  % box0 will be the left-hand column, box2 the right.
3174
  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
3175
  \onepageout\pagesofar
3176
  \unvbox255
3177
  \penalty\outputpenalty
3178
}
3179
\def\pagesofar{%
3180
  % Re-output the contents of the output page -- any previous material,
3181
  % followed by the two boxes we just split, in box0 and box2.
3182
  \unvbox\partialpage
3183
  %
3184
  \hsize = \doublecolumnhsize
3185
  \wd0=\hsize \wd2=\hsize
3186
  \hbox to\pagewidth{\box0\hfil\box2}%
3187
}
3188
\def\enddoublecolumns{%
3189
  \output = {%
3190
    % Split the last of the double-column material.  Leave it on the
3191
    % current page, no automatic page break.
3192
    \balancecolumns
3193
    %
3194
    % If we end up splitting too much material for the current page,
3195
    % though, there will be another page break right after this \output
3196
    % invocation ends.  Having called \balancecolumns once, we do not
3197
    % want to call it again.  Therefore, reset \output to its normal
3198
    % definition right away.  (We hope \balancecolumns will never be
3199
    % called on to balance too much material, but if it is, this makes
3200
    % the output somewhat more palatable.)
3201
    \global\output = {\onepageout{\pagecontents\PAGE}}%
3202
  }%
3203
  \eject
3204
  \endgroup % started in \begindoublecolumns
3205
  %
3206
  % \pagegoal was set to the doubled \vsize above, since we restarted
3207
  % the current page.  We're now back to normal single-column
3208
  % typesetting, so reset \pagegoal to the normal \vsize (after the
3209
  % \endgroup where \vsize got restored).
3210
  \pagegoal = \vsize
3211
}
3212
\def\balancecolumns{%
3213
  % Called at the end of the double column material.
3214
  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
3215
  \dimen@ = \ht0
3216
  \advance\dimen@ by \topskip
3217
  \advance\dimen@ by-\baselineskip
3218
  \divide\dimen@ by 2 % target to split to
3219
  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
3220
  \splittopskip = \topskip
3221
  % Loop until we get a decent breakpoint.
3222
  {%
3223
    \vbadness = 10000
3224
    \loop
3225
      \global\setbox3 = \copy0
3226
      \global\setbox1 = \vsplit3 to \dimen@
3227
    \ifdim\ht3>\dimen@
3228
      \global\advance\dimen@ by 1pt
3229
    \repeat
3230
  }%
3231
  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
3232
  \setbox0=\vbox to\dimen@{\unvbox1}%
3233
  \setbox2=\vbox to\dimen@{\unvbox3}%
3234
  %
3235
  \pagesofar
3236
}
3237
\catcode`\@ = \other
3238
 
3239
 
3240
\message{sectioning,}
3241
% Chapters, sections, etc.
3242
 
3243
\newcount\chapno
3244
\newcount\secno        \secno=0
3245
\newcount\subsecno     \subsecno=0
3246
\newcount\subsubsecno  \subsubsecno=0
3247
 
3248
% This counter is funny since it counts through charcodes of letters A, B, ...
3249
\newcount\appendixno  \appendixno = `\@
3250
% \def\appendixletter{\char\the\appendixno}
3251
% We do the following for the sake of pdftex, which needs the actual
3252
% letter in the expansion, not just typeset.
3253
\def\appendixletter{%
3254
  \ifnum\appendixno=`A A%
3255
  \else\ifnum\appendixno=`B B%
3256
  \else\ifnum\appendixno=`C C%
3257
  \else\ifnum\appendixno=`D D%
3258
  \else\ifnum\appendixno=`E E%
3259
  \else\ifnum\appendixno=`F F%
3260
  \else\ifnum\appendixno=`G G%
3261
  \else\ifnum\appendixno=`H H%
3262
  \else\ifnum\appendixno=`I I%
3263
  \else\ifnum\appendixno=`J J%
3264
  \else\ifnum\appendixno=`K K%
3265
  \else\ifnum\appendixno=`L L%
3266
  \else\ifnum\appendixno=`M M%
3267
  \else\ifnum\appendixno=`N N%
3268
  \else\ifnum\appendixno=`O O%
3269
  \else\ifnum\appendixno=`P P%
3270
  \else\ifnum\appendixno=`Q Q%
3271
  \else\ifnum\appendixno=`R R%
3272
  \else\ifnum\appendixno=`S S%
3273
  \else\ifnum\appendixno=`T T%
3274
  \else\ifnum\appendixno=`U U%
3275
  \else\ifnum\appendixno=`V V%
3276
  \else\ifnum\appendixno=`W W%
3277
  \else\ifnum\appendixno=`X X%
3278
  \else\ifnum\appendixno=`Y Y%
3279
  \else\ifnum\appendixno=`Z Z%
3280
  % The \the is necessary, despite appearances, because \appendixletter is
3281
  % expanded while writing the .toc file.  \char\appendixno is not
3282
  % expandable, thus it is written literally, thus all appendixes come out
3283
  % with the same letter (or @) in the toc without it.
3284
  \else\char\the\appendixno
3285
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
3286
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
3287
 
3288
% Each @chapter defines this as the name of the chapter.
3289
% page headings and footings can use it.  @section does likewise.
3290
\def\thischapter{}
3291
\def\thissection{}
3292
 
3293
\newcount\absseclevel % used to calculate proper heading level
3294
\newcount\secbase\secbase=0 % @raise/lowersections modify this count
3295
 
3296
% @raisesections: treat @section as chapter, @subsection as section, etc.
3297
\def\raisesections{\global\advance\secbase by -1}
3298
\let\up=\raisesections % original BFox name
3299
 
3300
% @lowersections: treat @chapter as section, @section as subsection, etc.
3301
\def\lowersections{\global\advance\secbase by 1}
3302
\let\down=\lowersections % original BFox name
3303
 
3304
% Choose a numbered-heading macro
3305
% #1 is heading level if unmodified by @raisesections or @lowersections
3306
% #2 is text for heading
3307
\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3308
\ifcase\absseclevel
3309
  \chapterzzz{#2}
3310
\or
3311
  \seczzz{#2}
3312
\or
3313
  \numberedsubseczzz{#2}
3314
\or
3315
  \numberedsubsubseczzz{#2}
3316
\else
3317
  \ifnum \absseclevel<0
3318
    \chapterzzz{#2}
3319
  \else
3320
    \numberedsubsubseczzz{#2}
3321
  \fi
3322
\fi
3323
}
3324
 
3325
% like \numhead, but chooses appendix heading levels
3326
\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3327
\ifcase\absseclevel
3328
  \appendixzzz{#2}
3329
\or
3330
  \appendixsectionzzz{#2}
3331
\or
3332
  \appendixsubseczzz{#2}
3333
\or
3334
  \appendixsubsubseczzz{#2}
3335
\else
3336
  \ifnum \absseclevel<0
3337
    \appendixzzz{#2}
3338
  \else
3339
    \appendixsubsubseczzz{#2}
3340
  \fi
3341
\fi
3342
}
3343
 
3344
% like \numhead, but chooses numberless heading levels
3345
\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3346
\ifcase\absseclevel
3347
  \unnumberedzzz{#2}
3348
\or
3349
  \unnumberedseczzz{#2}
3350
\or
3351
  \unnumberedsubseczzz{#2}
3352
\or
3353
  \unnumberedsubsubseczzz{#2}
3354
\else
3355
  \ifnum \absseclevel<0
3356
    \unnumberedzzz{#2}
3357
  \else
3358
    \unnumberedsubsubseczzz{#2}
3359
  \fi
3360
\fi
3361
}
3362
 
3363
% @chapter, @appendix, @unnumbered.
3364
\def\thischaptername{No Chapter Title}
3365
\outer\def\chapter{\parsearg\chapteryyy}
3366
\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
3367
\def\chapterzzz #1{%
3368
\secno=0 \subsecno=0 \subsubsecno=0
3369
\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
3370
\chapmacro {#1}{\the\chapno}%
3371
\gdef\thissection{#1}%
3372
\gdef\thischaptername{#1}%
3373
% We don't substitute the actual chapter name into \thischapter
3374
% because we don't want its macros evaluated now.
3375
\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
3376
\toks0 = {#1}%
3377
\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3378
                                  {\the\chapno}}}%
3379
\temp
3380
\donoderef
3381
\global\let\section = \numberedsec
3382
\global\let\subsection = \numberedsubsec
3383
\global\let\subsubsection = \numberedsubsubsec
3384
}
3385
 
3386
\outer\def\appendix{\parsearg\appendixyyy}
3387
\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
3388
\def\appendixzzz #1{%
3389
\secno=0 \subsecno=0 \subsubsecno=0
3390
\global\advance \appendixno by 1
3391
\message{\putwordAppendix\space \appendixletter}%
3392
\chapmacro {#1}{\putwordAppendix{} \appendixletter}%
3393
\gdef\thissection{#1}%
3394
\gdef\thischaptername{#1}%
3395
\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
3396
\toks0 = {#1}%
3397
\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3398
                       {\putwordAppendix{} \appendixletter}}}%
3399
\temp
3400
\appendixnoderef
3401
\global\let\section = \appendixsec
3402
\global\let\subsection = \appendixsubsec
3403
\global\let\subsubsection = \appendixsubsubsec
3404
}
3405
 
3406
% @centerchap is like @unnumbered, but the heading is centered.
3407
\outer\def\centerchap{\parsearg\centerchapyyy}
3408
\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
3409
 
3410
% @top is like @unnumbered.
3411
\outer\def\top{\parsearg\unnumberedyyy}
3412
 
3413
\outer\def\unnumbered{\parsearg\unnumberedyyy}
3414
\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
3415
\def\unnumberedzzz #1{%
3416
\secno=0 \subsecno=0 \subsubsecno=0
3417
%
3418
% This used to be simply \message{#1}, but TeX fully expands the
3419
% argument to \message.  Therefore, if #1 contained @-commands, TeX
3420
% expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
3421
% expanded @cite (which turns out to cause errors because \cite is meant
3422
% to be executed, not expanded).
3423
%
3424
% Anyway, we don't want the fully-expanded definition of @cite to appear
3425
% as a result of the \message, we just want `@cite' itself.  We use
3426
% \the<toks register> to achieve this: TeX expands \the<toks> only once,
3427
% simply yielding the contents of <toks register>.  (We also do this for
3428
% the toc entries.)
3429
\toks0 = {#1}\message{(\the\toks0)}%
3430
%
3431
\unnumbchapmacro {#1}%
3432
\gdef\thischapter{#1}\gdef\thissection{#1}%
3433
\toks0 = {#1}%
3434
\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
3435
\temp
3436
\unnumbnoderef
3437
\global\let\section = \unnumberedsec
3438
\global\let\subsection = \unnumberedsubsec
3439
\global\let\subsubsection = \unnumberedsubsubsec
3440
}
3441
 
3442
% Sections.
3443
\outer\def\numberedsec{\parsearg\secyyy}
3444
\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3445
\def\seczzz #1{%
3446
\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3447
\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
3448
\toks0 = {#1}%
3449
\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3450
                                  {\the\chapno}{\the\secno}}}%
3451
\temp
3452
\donoderef
3453
\nobreak
3454
}
3455
 
3456
\outer\def\appendixsection{\parsearg\appendixsecyyy}
3457
\outer\def\appendixsec{\parsearg\appendixsecyyy}
3458
\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3459
\def\appendixsectionzzz #1{%
3460
\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3461
\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3462
\toks0 = {#1}%
3463
\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3464
                                  {\appendixletter}{\the\secno}}}%
3465
\temp
3466
\appendixnoderef
3467
\nobreak
3468
}
3469
 
3470
\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3471
\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3472
\def\unnumberedseczzz #1{%
3473
\plainsecheading {#1}\gdef\thissection{#1}%
3474
\toks0 = {#1}%
3475
\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}%
3476
\temp
3477
\unnumbnoderef
3478
\nobreak
3479
}
3480
 
3481
% Subsections.
3482
\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3483
\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3484
\def\numberedsubseczzz #1{%
3485
\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3486
\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3487
\toks0 = {#1}%
3488
\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3489
                                    {\the\chapno}{\the\secno}{\the\subsecno}}}%
3490
\temp
3491
\donoderef
3492
\nobreak
3493
}
3494
 
3495
\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3496
\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3497
\def\appendixsubseczzz #1{%
3498
\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3499
\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3500
\toks0 = {#1}%
3501
\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3502
                                {\appendixletter}{\the\secno}{\the\subsecno}}}%
3503
\temp
3504
\appendixnoderef
3505
\nobreak
3506
}
3507
 
3508
\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3509
\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3510
\def\unnumberedsubseczzz #1{%
3511
\plainsubsecheading {#1}\gdef\thissection{#1}%
3512
\toks0 = {#1}%
3513
\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
3514
                                    {\the\toks0}}}%
3515
\temp
3516
\unnumbnoderef
3517
\nobreak
3518
}
3519
 
3520
% Subsubsections.
3521
\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3522
\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3523
\def\numberedsubsubseczzz #1{%
3524
\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3525
\subsubsecheading {#1}
3526
  {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3527
\toks0 = {#1}%
3528
\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3529
  {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3530
\temp
3531
\donoderef
3532
\nobreak
3533
}
3534
 
3535
\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3536
\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3537
\def\appendixsubsubseczzz #1{%
3538
\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3539
\subsubsecheading {#1}
3540
  {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3541
\toks0 = {#1}%
3542
\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3543
  {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3544
\temp
3545
\appendixnoderef
3546
\nobreak
3547
}
3548
 
3549
\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3550
\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3551
\def\unnumberedsubsubseczzz #1{%
3552
\plainsubsubsecheading {#1}\gdef\thissection{#1}%
3553
\toks0 = {#1}%
3554
\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
3555
                                    {\the\toks0}}}%
3556
\temp
3557
\unnumbnoderef
3558
\nobreak
3559
}
3560
 
3561
% These are variants which are not "outer", so they can appear in @ifinfo.
3562
% Actually, they should now be obsolete; ordinary section commands should work.
3563
\def\infotop{\parsearg\unnumberedzzz}
3564
\def\infounnumbered{\parsearg\unnumberedzzz}
3565
\def\infounnumberedsec{\parsearg\unnumberedseczzz}
3566
\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3567
\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3568
 
3569
\def\infoappendix{\parsearg\appendixzzz}
3570
\def\infoappendixsec{\parsearg\appendixseczzz}
3571
\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3572
\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3573
 
3574
\def\infochapter{\parsearg\chapterzzz}
3575
\def\infosection{\parsearg\sectionzzz}
3576
\def\infosubsection{\parsearg\subsectionzzz}
3577
\def\infosubsubsection{\parsearg\subsubsectionzzz}
3578
 
3579
% These macros control what the section commands do, according
3580
% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3581
% Define them by default for a numbered chapter.
3582
\global\let\section = \numberedsec
3583
\global\let\subsection = \numberedsubsec
3584
\global\let\subsubsection = \numberedsubsubsec
3585
 
3586
% Define @majorheading, @heading and @subheading
3587
 
3588
% NOTE on use of \vbox for chapter headings, section headings, and such:
3589
%       1) We use \vbox rather than the earlier \line to permit
3590
%          overlong headings to fold.
3591
%       2) \hyphenpenalty is set to 10000 because hyphenation in a
3592
%          heading is obnoxious; this forbids it.
3593
%       3) Likewise, headings look best if no \parindent is used, and
3594
%          if justification is not attempted.  Hence \raggedright.
3595
 
3596
 
3597
\def\majorheading{\parsearg\majorheadingzzz}
3598
\def\majorheadingzzz #1{%
3599
{\advance\chapheadingskip by 10pt \chapbreak }%
3600
{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3601
                  \parindent=0pt\raggedright
3602
                  \rm #1\hfill}}\bigskip \par\penalty 200}
3603
 
3604
\def\chapheading{\parsearg\chapheadingzzz}
3605
\def\chapheadingzzz #1{\chapbreak %
3606
{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3607
                  \parindent=0pt\raggedright
3608
                  \rm #1\hfill}}\bigskip \par\penalty 200}
3609
 
3610
% @heading, @subheading, @subsubheading.
3611
\def\heading{\parsearg\plainsecheading}
3612
\def\subheading{\parsearg\plainsubsecheading}
3613
\def\subsubheading{\parsearg\plainsubsubsecheading}
3614
 
3615
% These macros generate a chapter, section, etc. heading only
3616
% (including whitespace, linebreaking, etc. around it),
3617
% given all the information in convenient, parsed form.
3618
 
3619
%%% Args are the skip and penalty (usually negative)
3620
\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3621
 
3622
\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3623
 
3624
%%% Define plain chapter starts, and page on/off switching for it
3625
% Parameter controlling skip before chapter headings (if needed)
3626
 
3627
\newskip\chapheadingskip
3628
 
3629
\def\chapbreak{\dobreak \chapheadingskip {-4000}}
3630
\def\chappager{\par\vfill\supereject}
3631
\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3632
 
3633
\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3634
 
3635
\def\CHAPPAGoff{%
3636
\global\let\contentsalignmacro = \chappager
3637
\global\let\pchapsepmacro=\chapbreak
3638
\global\let\pagealignmacro=\chappager}
3639
 
3640
\def\CHAPPAGon{%
3641
\global\let\contentsalignmacro = \chappager
3642
\global\let\pchapsepmacro=\chappager
3643
\global\let\pagealignmacro=\chappager
3644
\global\def\HEADINGSon{\HEADINGSsingle}}
3645
 
3646
\def\CHAPPAGodd{
3647
\global\let\contentsalignmacro = \chapoddpage
3648
\global\let\pchapsepmacro=\chapoddpage
3649
\global\let\pagealignmacro=\chapoddpage
3650
\global\def\HEADINGSon{\HEADINGSdouble}}
3651
 
3652
\CHAPPAGon
3653
 
3654
\def\CHAPFplain{
3655
\global\let\chapmacro=\chfplain
3656
\global\let\unnumbchapmacro=\unnchfplain
3657
\global\let\centerchapmacro=\centerchfplain}
3658
 
3659
% Plain chapter opening.
3660
% #1 is the text, #2 the chapter number or empty if unnumbered.
3661
\def\chfplain#1#2{%
3662
  \pchapsepmacro
3663
  {%
3664
    \chapfonts \rm
3665
    \def\chapnum{#2}%
3666
    \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3667
    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3668
          \hangindent = \wd0 \centerparametersmaybe
3669
          \unhbox0 #1\par}%
3670
  }%
3671
  \nobreak\bigskip % no page break after a chapter title
3672
  \nobreak
3673
}
3674
 
3675
% Plain opening for unnumbered.
3676
\def\unnchfplain#1{\chfplain{#1}{}}
3677
 
3678
% @centerchap -- centered and unnumbered.
3679
\let\centerparametersmaybe = \relax
3680
\def\centerchfplain#1{{%
3681
  \def\centerparametersmaybe{%
3682
    \advance\rightskip by 3\rightskip
3683
    \leftskip = \rightskip
3684
    \parfillskip = 0pt
3685
  }%
3686
  \chfplain{#1}{}%
3687
}}
3688
 
3689
\CHAPFplain % The default
3690
 
3691
\def\unnchfopen #1{%
3692
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3693
                       \parindent=0pt\raggedright
3694
                       \rm #1\hfill}}\bigskip \par\nobreak
3695
}
3696
 
3697
\def\chfopen #1#2{\chapoddpage {\chapfonts
3698
\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3699
\par\penalty 5000 %
3700
}
3701
 
3702
\def\centerchfopen #1{%
3703
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3704
                       \parindent=0pt
3705
                       \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
3706
}
3707
 
3708
\def\CHAPFopen{
3709
\global\let\chapmacro=\chfopen
3710
\global\let\unnumbchapmacro=\unnchfopen
3711
\global\let\centerchapmacro=\centerchfopen}
3712
 
3713
 
3714
% Section titles.
3715
\newskip\secheadingskip
3716
\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3717
\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3718
\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3719
 
3720
% Subsection titles.
3721
\newskip \subsecheadingskip
3722
\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3723
\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3724
\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3725
 
3726
% Subsubsection titles.
3727
\let\subsubsecheadingskip = \subsecheadingskip
3728
\let\subsubsecheadingbreak = \subsecheadingbreak
3729
\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3730
\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3731
 
3732
 
3733
% Print any size section title.
3734
%
3735
% #1 is the section type (sec/subsec/subsubsec), #2 is the section
3736
% number (maybe empty), #3 the text.
3737
\def\sectionheading#1#2#3{%
3738
  {%
3739
    \expandafter\advance\csname #1headingskip\endcsname by \parskip
3740
    \csname #1headingbreak\endcsname
3741
  }%
3742
  {%
3743
    % Switch to the right set of fonts.
3744
    \csname #1fonts\endcsname \rm
3745
    %
3746
    % Only insert the separating space if we have a section number.
3747
    \def\secnum{#2}%
3748
    \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3749
    %
3750
    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3751
          \hangindent = \wd0 % zero if no section number
3752
          \unhbox0 #3}%
3753
  }%
3754
  \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3755
}
3756
 
3757
 
3758
\message{toc,}
3759
% Table of contents.
3760
\newwrite\tocfile
3761
 
3762
% Write an entry to the toc file, opening it if necessary.
3763
% Called from @chapter, etc.  We supply {\folio} at the end of the
3764
% argument, which will end up as the last argument to the \...entry macro.
3765
%
3766
% We open the .toc file here instead of at @setfilename or any other
3767
% given time so that @contents can be put in the document anywhere.
3768
%
3769
\newif\iftocfileopened
3770
\def\writetocentry#1{%
3771
  \iftocfileopened\else
3772
    \immediate\openout\tocfile = \jobname.toc
3773
    \global\tocfileopenedtrue
3774
  \fi
3775
  \iflinks \write\tocfile{#1{\folio}}\fi
3776
}
3777
 
3778
\newskip\contentsrightmargin \contentsrightmargin=1in
3779
\newcount\savepageno
3780
\newcount\lastnegativepageno \lastnegativepageno = -1
3781
 
3782
% Finish up the main text and prepare to read what we've written
3783
% to \tocfile.
3784
%
3785
\def\startcontents#1{%
3786
   % If @setchapternewpage on, and @headings double, the contents should
3787
   % start on an odd page, unlike chapters.  Thus, we maintain
3788
   % \contentsalignmacro in parallel with \pagealignmacro.
3789
   % From: Torbjorn Granlund <tege@matematik.su.se>
3790
   \contentsalignmacro
3791
   \immediate\closeout\tocfile
3792
   %
3793
   % Don't need to put `Contents' or `Short Contents' in the headline.
3794
   % It is abundantly clear what they are.
3795
   \unnumbchapmacro{#1}\def\thischapter{}%
3796
   \savepageno = \pageno
3797
   \begingroup                  % Set up to handle contents files properly.
3798
      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
3799
      % We can't do this, because then an actual ^ in a section
3800
      % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
3801
      %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3802
      \raggedbottom             % Worry more about breakpoints than the bottom.
3803
      \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3804
      %
3805
      % Roman numerals for page numbers.
3806
      \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
3807
}
3808
 
3809
 
3810
% Normal (long) toc.
3811
\def\contents{%
3812
   \startcontents{\putwordTOC}%
3813
     \openin 1 \jobname.toc
3814
     \ifeof 1 \else
3815
       \closein 1
3816
       \input \jobname.toc
3817
     \fi
3818
     \vfill \eject
3819
     \contentsalignmacro % in case @setchapternewpage odd is in effect
3820
     \pdfmakeoutlines
3821
   \endgroup
3822
   \lastnegativepageno = \pageno
3823
   \pageno = \savepageno
3824
}
3825
 
3826
% And just the chapters.
3827
\def\summarycontents{%
3828
   \startcontents{\putwordShortTOC}%
3829
      %
3830
      \let\chapentry = \shortchapentry
3831
      \let\unnumbchapentry = \shortunnumberedentry
3832
      % We want a true roman here for the page numbers.
3833
      \secfonts
3834
      \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3835
      \rm
3836
      \hyphenpenalty = 10000
3837
      \advance\baselineskip by 1pt % Open it up a little.
3838
      \def\secentry ##1##2##3##4{}
3839
      \def\unnumbsecentry ##1##2{}
3840
      \def\subsecentry ##1##2##3##4##5{}
3841
      \def\unnumbsubsecentry ##1##2{}
3842
      \def\subsubsecentry ##1##2##3##4##5##6{}
3843
      \def\unnumbsubsubsecentry ##1##2{}
3844
      \openin 1 \jobname.toc
3845
      \ifeof 1 \else
3846
        \closein 1
3847
        \input \jobname.toc
3848
      \fi
3849
     \vfill \eject
3850
     \contentsalignmacro % in case @setchapternewpage odd is in effect
3851
   \endgroup
3852
   \lastnegativepageno = \pageno
3853
   \pageno = \savepageno
3854
}
3855
\let\shortcontents = \summarycontents
3856
 
3857
\ifpdf
3858
  \pdfcatalog{/PageMode /UseOutlines}%
3859
\fi
3860
 
3861
% These macros generate individual entries in the table of contents.
3862
% The first argument is the chapter or section name.
3863
% The last argument is the page number.
3864
% The arguments in between are the chapter number, section number, ...
3865
 
3866
% Chapter-level things, for both the long and short contents.
3867
\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3868
 
3869
% See comments in \dochapentry re vbox and related settings
3870
\def\shortchapentry#1#2#3{%
3871
  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
3872
}
3873
 
3874
% Typeset the label for a chapter or appendix for the short contents.
3875
% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3876
% We could simplify the code here by writing out an \appendixentry
3877
% command in the toc file for appendices, instead of using \chapentry
3878
% for both, but it doesn't seem worth it.
3879
%
3880
\newdimen\shortappendixwidth
3881
%
3882
\def\shortchaplabel#1{%
3883
  % Compute width of word "Appendix", may change with language.
3884
  \setbox0 = \hbox{\shortcontrm \putwordAppendix}%
3885
  \shortappendixwidth = \wd0
3886
  %
3887
  % We typeset #1 in a box of constant width, regardless of the text of
3888
  % #1, so the chapter titles will come out aligned.
3889
  \setbox0 = \hbox{#1}%
3890
  \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3891
  %
3892
  % This space should be plenty, since a single number is .5em, and the
3893
  % widest letter (M) is 1em, at least in the Computer Modern fonts.
3894
  % (This space doesn't include the extra space that gets added after
3895
  % the label; that gets put in by \shortchapentry above.)
3896
  \advance\dimen0 by 1.1em
3897
  \hbox to \dimen0{#1\hfil}%
3898
}
3899
 
3900
\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3901
\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}}
3902
 
3903
% Sections.
3904
\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3905
\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3906
 
3907
% Subsections.
3908
\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3909
\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3910
 
3911
% And subsubsections.
3912
\def\subsubsecentry#1#2#3#4#5#6{%
3913
  \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3914
\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3915
 
3916
% This parameter controls the indentation of the various levels.
3917
\newdimen\tocindent \tocindent = 3pc
3918
 
3919
% Now for the actual typesetting. In all these, #1 is the text and #2 is the
3920
% page number.
3921
%
3922
% If the toc has to be broken over pages, we want it to be at chapters
3923
% if at all possible; hence the \penalty.
3924
\def\dochapentry#1#2{%
3925
   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3926
   \begingroup
3927
     \chapentryfonts
3928
     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
3929
   \endgroup
3930
   \nobreak\vskip .25\baselineskip plus.1\baselineskip
3931
}
3932
 
3933
\def\dosecentry#1#2{\begingroup
3934
  \secentryfonts \leftskip=\tocindent
3935
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
3936
\endgroup}
3937
 
3938
\def\dosubsecentry#1#2{\begingroup
3939
  \subsecentryfonts \leftskip=2\tocindent
3940
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
3941
\endgroup}
3942
 
3943
\def\dosubsubsecentry#1#2{\begingroup
3944
  \subsubsecentryfonts \leftskip=3\tocindent
3945
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
3946
\endgroup}
3947
 
3948
% Final typesetting of a toc entry; we use the same \entry macro as for
3949
% the index entries, but we want to suppress hyphenation here.  (We
3950
% can't do that in the \entry macro, since index entries might consist
3951
% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3952
\def\tocentry#1#2{\begingroup
3953
  \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3954
  % Do not use \turnoffactive in these arguments.  Since the toc is
3955
  % typeset in cmr, so characters such as _ would come out wrong; we
3956
  % have to do the usual translation tricks.
3957
  \entry{#1}{#2}%
3958
\endgroup}
3959
 
3960
% Space between chapter (or whatever) number and the title.
3961
\def\labelspace{\hskip1em \relax}
3962
 
3963
\def\dopageno#1{{\rm #1}}
3964
\def\doshortpageno#1{{\rm #1}}
3965
 
3966
\def\chapentryfonts{\secfonts \rm}
3967
\def\secentryfonts{\textfonts}
3968
\let\subsecentryfonts = \textfonts
3969
\let\subsubsecentryfonts = \textfonts
3970
 
3971
 
3972
\message{environments,}
3973
% @foo ... @end foo.
3974
 
3975
% Since these characters are used in examples, it should be an even number of
3976
% \tt widths. Each \tt character is 1en, so two makes it 1em.
3977
% Furthermore, these definitions must come after we define our fonts.
3978
\newbox\dblarrowbox    \newbox\longdblarrowbox
3979
\newbox\pushcharbox    \newbox\bullbox
3980
\newbox\equivbox       \newbox\errorbox
3981
 
3982
%{\tentt
3983
%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3984
%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3985
%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3986
%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3987
% Adapted from the manmac format (p.420 of TeXbook)
3988
%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3989
%                                      depth .1ex\hfil}
3990
%}
3991
 
3992
% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3993
\def\point{$\star$}
3994
\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3995
\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3996
\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3997
\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3998
 
3999
% Adapted from the TeXbook's \boxit.
4000
{\tentt \global\dimen0 = 3em}% Width of the box.
4001
\dimen2 = .55pt % Thickness of rules
4002
% The text. (`r' is open on the right, `e' somewhat less so on the left.)
4003
\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
4004
 
4005
\global\setbox\errorbox=\hbox to \dimen0{\hfil
4006
   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
4007
   \advance\hsize by -2\dimen2 % Rules.
4008
   \vbox{
4009
      \hrule height\dimen2
4010
      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
4011
         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
4012
         \kern3pt\vrule width\dimen2}% Space to right.
4013
      \hrule height\dimen2}
4014
    \hfil}
4015
 
4016
% The @error{} command.
4017
\def\error{\leavevmode\lower.7ex\copy\errorbox}
4018
 
4019
% @tex ... @end tex    escapes into raw Tex temporarily.
4020
% One exception: @ is still an escape character, so that @end tex works.
4021
% But \@ or @@ will get a plain tex @ character.
4022
 
4023
\def\tex{\begingroup
4024
  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
4025
  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
4026
  \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
4027
  \catcode `\%=14
4028
  \catcode 43=12 % plus
4029
  \catcode`\"=12
4030
  \catcode`\==12
4031
  \catcode`\|=12
4032
  \catcode`\<=12
4033
  \catcode`\>=12
4034
  \escapechar=`\\
4035
  %
4036
  \let\b=\ptexb
4037
  \let\bullet=\ptexbullet
4038
  \let\c=\ptexc
4039
  \let\,=\ptexcomma
4040
  \let\.=\ptexdot
4041
  \let\dots=\ptexdots
4042
  \let\equiv=\ptexequiv
4043
  \let\!=\ptexexclam
4044
  \let\i=\ptexi
4045
  \let\{=\ptexlbrace
4046
  \let\+=\tabalign
4047
  \let\}=\ptexrbrace
4048
  \let\*=\ptexstar
4049
  \let\t=\ptext
4050
  %
4051
  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
4052
  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
4053
  \def\@{@}%
4054
\let\Etex=\endgroup}
4055
 
4056
% Define @lisp ... @endlisp.
4057
% @lisp does a \begingroup so it can rebind things,
4058
% including the definition of @endlisp (which normally is erroneous).
4059
 
4060
% Amount to narrow the margins by for @lisp.
4061
\newskip\lispnarrowing \lispnarrowing=0.4in
4062
 
4063
% This is the definition that ^^M gets inside @lisp, @example, and other
4064
% such environments.  \null is better than a space, since it doesn't
4065
% have any width.
4066
\def\lisppar{\null\endgraf}
4067
 
4068
% Make each space character in the input produce a normal interword
4069
% space in the output.  Don't allow a line break at this space, as this
4070
% is used only in environments like @example, where each line of input
4071
% should produce a line of output anyway.
4072
%
4073
{\obeyspaces %
4074
\gdef\sepspaces{\obeyspaces\let =\tie}}
4075
 
4076
% Define \obeyedspace to be our active space, whatever it is.  This is
4077
% for use in \parsearg.
4078
{\sepspaces%
4079
\global\let\obeyedspace= }
4080
 
4081
% This space is always present above and below environments.
4082
\newskip\envskipamount \envskipamount = 0pt
4083
 
4084
% Make spacing and below environment symmetrical.  We use \parskip here
4085
% to help in doing that, since in @example-like environments \parskip
4086
% is reset to zero; thus the \afterenvbreak inserts no space -- but the
4087
% start of the next paragraph will insert \parskip
4088
%
4089
\def\aboveenvbreak{{\advance\envskipamount by \parskip
4090
\endgraf \ifdim\lastskip<\envskipamount
4091
\removelastskip \penalty-50 \vskip\envskipamount \fi}}
4092
 
4093
\let\afterenvbreak = \aboveenvbreak
4094
 
4095
% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
4096
\let\nonarrowing=\relax
4097
 
4098
% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
4099
% environment contents.
4100
\font\circle=lcircle10
4101
\newdimen\circthick
4102
\newdimen\cartouter\newdimen\cartinner
4103
\newskip\normbskip\newskip\normpskip\newskip\normlskip
4104
\circthick=\fontdimen8\circle
4105
%
4106
\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
4107
\def\ctr{{\hskip 6pt\circle\char'010}}
4108
\def\cbl{{\circle\char'012\hskip -6pt}}
4109
\def\cbr{{\hskip 6pt\circle\char'011}}
4110
\def\carttop{\hbox to \cartouter{\hskip\lskip
4111
        \ctl\leaders\hrule height\circthick\hfil\ctr
4112
        \hskip\rskip}}
4113
\def\cartbot{\hbox to \cartouter{\hskip\lskip
4114
        \cbl\leaders\hrule height\circthick\hfil\cbr
4115
        \hskip\rskip}}
4116
%
4117
\newskip\lskip\newskip\rskip
4118
 
4119
\long\def\cartouche{%
4120
\begingroup
4121
        \lskip=\leftskip \rskip=\rightskip
4122
        \leftskip=0pt\rightskip=0pt %we want these *outside*.
4123
        \cartinner=\hsize \advance\cartinner by-\lskip
4124
                          \advance\cartinner by-\rskip
4125
        \cartouter=\hsize
4126
        \advance\cartouter by 18.4pt % allow for 3pt kerns on either
4127
%                                    side, and for 6pt waste from
4128
%                                    each corner char, and rule thickness
4129
        \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
4130
        % Flag to tell @lisp, etc., not to narrow margin.
4131
        \let\nonarrowing=\comment
4132
        \vbox\bgroup
4133
                \baselineskip=0pt\parskip=0pt\lineskip=0pt
4134
                \carttop
4135
                \hbox\bgroup
4136
                        \hskip\lskip
4137
                        \vrule\kern3pt
4138
                        \vbox\bgroup
4139
                                \hsize=\cartinner
4140
                                \kern3pt
4141
                                \begingroup
4142
                                        \baselineskip=\normbskip
4143
                                        \lineskip=\normlskip
4144
                                        \parskip=\normpskip
4145
                                        \vskip -\parskip
4146
\def\Ecartouche{%
4147
                                \endgroup
4148
                                \kern3pt
4149
                        \egroup
4150
                        \kern3pt\vrule
4151
                        \hskip\rskip
4152
                \egroup
4153
                \cartbot
4154
        \egroup
4155
\endgroup
4156
}}
4157
 
4158
 
4159
% This macro is called at the beginning of all the @example variants,
4160
% inside a group.
4161
\def\nonfillstart{%
4162
  \aboveenvbreak
4163
  \inENV % This group ends at the end of the body
4164
  \hfuzz = 12pt % Don't be fussy
4165
  \sepspaces % Make spaces be word-separators rather than space tokens.
4166
  \singlespace
4167
  \let\par = \lisppar % don't ignore blank lines
4168
  \obeylines % each line of input is a line of output
4169
  \parskip = 0pt
4170
  \parindent = 0pt
4171
  \emergencystretch = 0pt % don't try to avoid overfull boxes
4172
  % @cartouche defines \nonarrowing to inhibit narrowing
4173
  % at next level down.
4174
  \ifx\nonarrowing\relax
4175
    \advance \leftskip by \lispnarrowing
4176
    \exdentamount=\lispnarrowing
4177
    \let\exdent=\nofillexdent
4178
    \let\nonarrowing=\relax
4179
  \fi
4180
}
4181
 
4182
% Define the \E... control sequence only if we are inside the particular
4183
% environment, so the error checking in \end will work.
4184
%
4185
% To end an @example-like environment, we first end the paragraph (via
4186
% \afterenvbreak's vertical glue), and then the group.  That way we keep
4187
% the zero \parskip that the environments set -- \parskip glue will be
4188
% inserted at the beginning of the next paragraph in the document, after
4189
% the environment.
4190
%
4191
\def\nonfillfinish{\afterenvbreak\endgroup}
4192
 
4193
% @lisp: indented, narrowed, typewriter font.
4194
\def\lisp{\begingroup
4195
  \nonfillstart
4196
  \let\Elisp = \nonfillfinish
4197
  \tt
4198
  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
4199
  \gobble       % eat return
4200
}
4201
 
4202
% @example: Same as @lisp.
4203
\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
4204
 
4205
% @small... is usually equivalent to the non-small (@smallbook
4206
% redefines).  We must call \example (or whatever) last in the
4207
% definition, since it reads the return following the @example (or
4208
% whatever) command.
4209
%
4210
% This actually allows (for example) @end display inside an
4211
% @smalldisplay.  Too bad, but makeinfo will catch the error anyway.
4212
%
4213
\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
4214
\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
4215
\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
4216
\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
4217
 
4218
% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
4219
% Originally contributed by Pavel@xerox.
4220
\def\smalllispx{\begingroup
4221
  \def\Esmalllisp{\nonfillfinish\endgroup}%
4222
  \def\Esmallexample{\nonfillfinish\endgroup}%
4223
  \smallfonts
4224
  \lisp
4225
}
4226
 
4227
% @display: same as @lisp except keep current font.
4228
%
4229
\def\display{\begingroup
4230
  \nonfillstart
4231
  \let\Edisplay = \nonfillfinish
4232
  \gobble
4233
}
4234
 
4235
% @smalldisplay (when @smallbook): @display plus smaller fonts.
4236
%
4237
\def\smalldisplayx{\begingroup
4238
  \def\Esmalldisplay{\nonfillfinish\endgroup}%
4239
  \smallfonts \rm
4240
  \display
4241
}
4242
 
4243
% @format: same as @display except don't narrow margins.
4244
%
4245
\def\format{\begingroup
4246
  \let\nonarrowing = t
4247
  \nonfillstart
4248
  \let\Eformat = \nonfillfinish
4249
  \gobble
4250
}
4251
 
4252
% @smallformat (when @smallbook): @format plus smaller fonts.
4253
%
4254
\def\smallformatx{\begingroup
4255
  \def\Esmallformat{\nonfillfinish\endgroup}%
4256
  \smallfonts \rm
4257
  \format
4258
}
4259
 
4260
% @flushleft (same as @format).
4261
%
4262
\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
4263
 
4264
% @flushright.
4265
%
4266
\def\flushright{\begingroup
4267
  \let\nonarrowing = t
4268
  \nonfillstart
4269
  \let\Eflushright = \nonfillfinish
4270
  \advance\leftskip by 0pt plus 1fill
4271
  \gobble
4272
}
4273
 
4274
% @quotation does normal linebreaking (hence we can't use \nonfillstart)
4275
% and narrows the margins.
4276
%
4277
\def\quotation{%
4278
  \begingroup\inENV %This group ends at the end of the @quotation body
4279
  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
4280
  \singlespace
4281
  \parindent=0pt
4282
  % We have retained a nonzero parskip for the environment, since we're
4283
  % doing normal filling. So to avoid extra space below the environment...
4284
  \def\Equotation{\parskip = 0pt \nonfillfinish}%
4285
  %
4286
  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
4287
  \ifx\nonarrowing\relax
4288
    \advance\leftskip by \lispnarrowing
4289
    \advance\rightskip by \lispnarrowing
4290
    \exdentamount = \lispnarrowing
4291
    \let\nonarrowing = \relax
4292
  \fi
4293
}
4294
 
4295
 
4296
\message{defuns,}
4297
% @defun etc.
4298
 
4299
% Allow user to change definition object font (\df) internally
4300
\def\setdeffont #1 {\csname DEF#1\endcsname}
4301
 
4302
\newskip\defbodyindent \defbodyindent=.4in
4303
\newskip\defargsindent \defargsindent=50pt
4304
\newskip\deftypemargin \deftypemargin=12pt
4305
\newskip\deflastargmargin \deflastargmargin=18pt
4306
 
4307
\newcount\parencount
4308
% define \functionparens, which makes ( and ) and & do special things.
4309
% \functionparens affects the group it is contained in.
4310
\def\activeparens{%
4311
\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
4312
\catcode`\[=\active \catcode`\]=\active}
4313
 
4314
% Make control sequences which act like normal parenthesis chars.
4315
\let\lparen = ( \let\rparen = )
4316
 
4317
{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
4318
 
4319
% Be sure that we always have a definition for `(', etc.  For example,
4320
% if the fn name has parens in it, \boldbrax will not be in effect yet,
4321
% so TeX would otherwise complain about undefined control sequence.
4322
\global\let(=\lparen \global\let)=\rparen
4323
\global\let[=\lbrack \global\let]=\rbrack
4324
 
4325
\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
4326
\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
4327
% This is used to turn on special parens
4328
% but make & act ordinary (given that it's active).
4329
\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
4330
 
4331
% Definitions of (, ) and & used in args for functions.
4332
% This is the definition of ( outside of all parentheses.
4333
\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
4334
  \global\advance\parencount by 1
4335
}
4336
%
4337
% This is the definition of ( when already inside a level of parens.
4338
\gdef\opnested{\char`\(\global\advance\parencount by 1 }
4339
%
4340
\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
4341
  % also in that case restore the outer-level definition of (.
4342
  \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
4343
  \global\advance \parencount by -1 }
4344
% If we encounter &foo, then turn on ()-hacking afterwards
4345
\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
4346
%
4347
\gdef\normalparens{\boldbrax\let&=\ampnr}
4348
} % End of definition inside \activeparens
4349
%% These parens (in \boldbrax) actually are a little bolder than the
4350
%% contained text.  This is especially needed for [ and ]
4351
\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
4352
\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
4353
\let\ampnr = \&
4354
\def\lbrb{{\bf\char`\[}}
4355
\def\rbrb{{\bf\char`\]}}
4356
 
4357
% Active &'s sneak into the index arguments, so make sure it's defined.
4358
{
4359
  \catcode`& = 13
4360
  \global\let& = \ampnr
4361
}
4362
 
4363
% First, defname, which formats the header line itself.
4364
% #1 should be the function name.
4365
% #2 should be the type of definition, such as "Function".
4366
 
4367
\def\defname #1#2{%
4368
% Get the values of \leftskip and \rightskip as they were
4369
% outside the @def...
4370
\dimen2=\leftskip
4371
\advance\dimen2 by -\defbodyindent
4372
\noindent
4373
\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
4374
\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
4375
\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
4376
\parshape 2 0in \dimen0 \defargsindent \dimen1
4377
% Now output arg 2 ("Function" or some such)
4378
% ending at \deftypemargin from the right margin,
4379
% but stuck inside a box of width 0 so it does not interfere with linebreaking
4380
{% Adjust \hsize to exclude the ambient margins,
4381
% so that \rightline will obey them.
4382
\advance \hsize by -\dimen2
4383
\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
4384
% Make all lines underfull and no complaints:
4385
\tolerance=10000 \hbadness=10000
4386
\advance\leftskip by -\defbodyindent
4387
\exdentamount=\defbodyindent
4388
{\df #1}\enskip        % Generate function name
4389
}
4390
 
4391
% Actually process the body of a definition
4392
% #1 should be the terminating control sequence, such as \Edefun.
4393
% #2 should be the "another name" control sequence, such as \defunx.
4394
% #3 should be the control sequence that actually processes the header,
4395
%    such as \defunheader.
4396
 
4397
\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4398
\medbreak %
4399
% Define the end token that this defining construct specifies
4400
% so that it will exit this group.
4401
\def#1{\endgraf\endgroup\medbreak}%
4402
\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
4403
\parindent=0in
4404
\advance\leftskip by \defbodyindent
4405
\exdentamount=\defbodyindent
4406
\begingroup %
4407
\catcode 61=\active % 61 is `='
4408
\obeylines\activeparens\spacesplit#3}
4409
 
4410
% #1 is the \E... control sequence to end the definition (which we define).
4411
% #2 is the \...x control sequence for consecutive fns (which we define).
4412
% #3 is the control sequence to call to resume processing.
4413
% #4, delimited by the space, is the class name.
4414
%
4415
\def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
4416
\medbreak %
4417
% Define the end token that this defining construct specifies
4418
% so that it will exit this group.
4419
\def#1{\endgraf\endgroup\medbreak}%
4420
\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
4421
\parindent=0in
4422
\advance\leftskip by \defbodyindent
4423
\exdentamount=\defbodyindent
4424
\begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
4425
 
4426
% Used for @deftypemethod and @deftypeivar.
4427
% #1 is the \E... control sequence to end the definition (which we define).
4428
% #2 is the \...x control sequence for consecutive fns (which we define).
4429
% #3 is the control sequence to call to resume processing.
4430
% #4, delimited by a space, is the class name.
4431
% #5 is the method's return type.
4432
%
4433
\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV
4434
  \medbreak
4435
  \def#1{\endgraf\endgroup\medbreak}%
4436
  \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
4437
  \parindent=0in
4438
  \advance\leftskip by \defbodyindent
4439
  \exdentamount=\defbodyindent
4440
  \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
4441
 
4442
% Used for @deftypeop.  The change from \deftypemethparsebody is an
4443
% extra argument at the beginning which is the `category', instead of it
4444
% being the hardwired string `Method' or `Instance Variable'.  We have
4445
% to account for this both in the \...x definition and in parsing the
4446
% input at hand.  Thus also need a control sequence (passed as #5) for
4447
% the \E... definition to assign the category name to.
4448
%
4449
\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV
4450
  \medbreak
4451
  \def#1{\endgraf\endgroup\medbreak}%
4452
  \def#2##1 ##2 ##3 {%
4453
    \def#4{##1}%
4454
    \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}%
4455
  \parindent=0in
4456
  \advance\leftskip by \defbodyindent
4457
  \exdentamount=\defbodyindent
4458
  \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}}
4459
 
4460
\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
4461
\medbreak %
4462
% Define the end token that this defining construct specifies
4463
% so that it will exit this group.
4464
\def#1{\endgraf\endgroup\medbreak}%
4465
\def#2##1 ##2 {\def#4{##1}%
4466
\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4467
\parindent=0in
4468
\advance\leftskip by \defbodyindent
4469
\exdentamount=\defbodyindent
4470
\begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
4471
 
4472
% These parsing functions are similar to the preceding ones
4473
% except that they do not make parens into active characters.
4474
% These are used for "variables" since they have no arguments.
4475
 
4476
\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4477
\medbreak %
4478
% Define the end token that this defining construct specifies
4479
% so that it will exit this group.
4480
\def#1{\endgraf\endgroup\medbreak}%
4481
\def#2{\begingroup\obeylines\spacesplit#3}%
4482
\parindent=0in
4483
\advance\leftskip by \defbodyindent
4484
\exdentamount=\defbodyindent
4485
\begingroup %
4486
\catcode 61=\active %
4487
\obeylines\spacesplit#3}
4488
 
4489
% This is used for \def{tp,vr}parsebody.  It could probably be used for
4490
% some of the others, too, with some judicious conditionals.
4491
%
4492
\def\parsebodycommon#1#2#3{%
4493
  \begingroup\inENV %
4494
  \medbreak %
4495
  % Define the end token that this defining construct specifies
4496
  % so that it will exit this group.
4497
  \def#1{\endgraf\endgroup\medbreak}%
4498
  \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4499
  \parindent=0in
4500
  \advance\leftskip by \defbodyindent
4501
  \exdentamount=\defbodyindent
4502
  \begingroup\obeylines
4503
}
4504
 
4505
\def\defvrparsebody#1#2#3#4 {%
4506
  \parsebodycommon{#1}{#2}{#3}%
4507
  \spacesplit{#3{#4}}%
4508
}
4509
 
4510
% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4511
% type is just `struct', because we lose the braces in `{struct
4512
% termios}' when \spacesplit reads its undelimited argument.  Sigh.
4513
% \let\deftpparsebody=\defvrparsebody
4514
%
4515
% So, to get around this, we put \empty in with the type name.  That
4516
% way, TeX won't find exactly `{...}' as an undelimited argument, and
4517
% won't strip off the braces.
4518
%
4519
\def\deftpparsebody #1#2#3#4 {%
4520
  \parsebodycommon{#1}{#2}{#3}%
4521
  \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4522
}
4523
 
4524
% Fine, but then we have to eventually remove the \empty *and* the
4525
% braces (if any).  That's what this does.
4526
%
4527
\def\removeemptybraces\empty#1\relax{#1}
4528
 
4529
% After \spacesplit has done its work, this is called -- #1 is the final
4530
% thing to call, #2 the type name (which starts with \empty), and #3
4531
% (which might be empty) the arguments.
4532
%
4533
\def\parsetpheaderline#1#2#3{%
4534
  #1{\removeemptybraces#2\relax}{#3}%
4535
}%
4536
 
4537
\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
4538
\medbreak %
4539
% Define the end token that this defining construct specifies
4540
% so that it will exit this group.
4541
\def#1{\endgraf\endgroup\medbreak}%
4542
\def#2##1 ##2 {\def#4{##1}%
4543
\begingroup\obeylines\spacesplit{#3{##2}}}%
4544
\parindent=0in
4545
\advance\leftskip by \defbodyindent
4546
\exdentamount=\defbodyindent
4547
\begingroup\obeylines\spacesplit{#3{#5}}}
4548
 
4549
% Split up #2 at the first space token.
4550
% call #1 with two arguments:
4551
%  the first is all of #2 before the space token,
4552
%  the second is all of #2 after that space token.
4553
% If #2 contains no space token, all of it is passed as the first arg
4554
% and the second is passed as empty.
4555
 
4556
{\obeylines
4557
\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
4558
\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
4559
\ifx\relax #3%
4560
#1{#2}{}\else #1{#2}{#3#4}\fi}}
4561
 
4562
% So much for the things common to all kinds of definitions.
4563
 
4564
% Define @defun.
4565
 
4566
% First, define the processing that is wanted for arguments of \defun
4567
% Use this to expand the args and terminate the paragraph they make up
4568
 
4569
\def\defunargs#1{\functionparens \sl
4570
% Expand, preventing hyphenation at `-' chars.
4571
% Note that groups don't affect changes in \hyphenchar.
4572
% Set the font temporarily and use \font in case \setfont made \tensl a macro.
4573
{\tensl\hyphenchar\font=0}%
4574
#1%
4575
{\tensl\hyphenchar\font=45}%
4576
\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4577
\interlinepenalty=10000
4578
\advance\rightskip by 0pt plus 1fil
4579
\endgraf\nobreak\vskip -\parskip\nobreak
4580
}
4581
 
4582
\def\deftypefunargs #1{%
4583
% Expand, preventing hyphenation at `-' chars.
4584
% Note that groups don't affect changes in \hyphenchar.
4585
% Use \boldbraxnoamp, not \functionparens, so that & is not special.
4586
\boldbraxnoamp
4587
\tclose{#1}% avoid \code because of side effects on active chars
4588
\interlinepenalty=10000
4589
\advance\rightskip by 0pt plus 1fil
4590
\endgraf\nobreak\vskip -\parskip\nobreak
4591
}
4592
 
4593
% Do complete processing of one @defun or @defunx line already parsed.
4594
 
4595
% @deffn Command forward-char nchars
4596
 
4597
\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4598
 
4599
\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4600
\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4601
\catcode 61=\other % Turn off change made in \defparsebody
4602
}
4603
 
4604
% @defun == @deffn Function
4605
 
4606
\def\defun{\defparsebody\Edefun\defunx\defunheader}
4607
 
4608
\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4609
\begingroup\defname {#1}{\putwordDeffunc}%
4610
\defunargs {#2}\endgroup %
4611
\catcode 61=\other % Turn off change made in \defparsebody
4612
}
4613
 
4614
% @deftypefun int foobar (int @var{foo}, float @var{bar})
4615
 
4616
\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4617
 
4618
% #1 is the data type.  #2 is the name and args.
4619
\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4620
% #1 is the data type, #2 the name, #3 the args.
4621
\def\deftypefunheaderx #1#2 #3\relax{%
4622
\doind {fn}{\code{#2}}% Make entry in function index
4623
\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}%
4624
\deftypefunargs {#3}\endgroup %
4625
\catcode 61=\other % Turn off change made in \defparsebody
4626
}
4627
 
4628
% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4629
 
4630
\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4631
 
4632
% \defheaderxcond#1\relax$$$
4633
% puts #1 in @code, followed by a space, but does nothing if #1 is null.
4634
\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4635
 
4636
% #1 is the classification.  #2 is the data type.  #3 is the name and args.
4637
\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4638
% #1 is the classification, #2 the data type, #3 the name, #4 the args.
4639
\def\deftypefnheaderx #1#2#3 #4\relax{%
4640
\doind {fn}{\code{#3}}% Make entry in function index
4641
\begingroup
4642
\normalparens % notably, turn off `&' magic, which prevents
4643
%               at least some C++ text from working
4644
\defname {\defheaderxcond#2\relax$$$#3}{#1}%
4645
\deftypefunargs {#4}\endgroup %
4646
\catcode 61=\other % Turn off change made in \defparsebody
4647
}
4648
 
4649
% @defmac == @deffn Macro
4650
 
4651
\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4652
 
4653
\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4654
\begingroup\defname {#1}{\putwordDefmac}%
4655
\defunargs {#2}\endgroup %
4656
\catcode 61=\other % Turn off change made in \defparsebody
4657
}
4658
 
4659
% @defspec == @deffn Special Form
4660
 
4661
\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4662
 
4663
\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4664
\begingroup\defname {#1}{\putwordDefspec}%
4665
\defunargs {#2}\endgroup %
4666
\catcode 61=\other % Turn off change made in \defparsebody
4667
}
4668
 
4669
% @defop CATEGORY CLASS OPERATION ARG...
4670
%
4671
\def\defop #1 {\def\defoptype{#1}%
4672
\defopparsebody\Edefop\defopx\defopheader\defoptype}
4673
%
4674
\def\defopheader#1#2#3{%
4675
\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
4676
\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}%
4677
\defunargs {#3}\endgroup %
4678
}
4679
 
4680
% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
4681
%
4682
\def\deftypeop #1 {\def\deftypeopcategory{#1}%
4683
  \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
4684
                       \deftypeopcategory}
4685
%
4686
% #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
4687
\def\deftypeopheader#1#2#3#4{%
4688
  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4689
  \begingroup
4690
    \defname{\defheaderxcond#2\relax$$$#3}
4691
            {\deftypeopcategory\ \putwordon\ \code{#1}}%
4692
    \deftypefunargs{#4}%
4693
  \endgroup
4694
}
4695
 
4696
% @deftypemethod CLASS TYPE METHOD ARG...
4697
%
4698
\def\deftypemethod{%
4699
  \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4700
%
4701
% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4702
\def\deftypemethodheader#1#2#3#4{%
4703
  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4704
  \begingroup
4705
    \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
4706
    \deftypefunargs{#4}%
4707
  \endgroup
4708
}
4709
 
4710
% @deftypeivar CLASS TYPE VARNAME
4711
%
4712
\def\deftypeivar{%
4713
  \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
4714
%
4715
% #1 is the class name, #2 the data type, #3 the variable name.
4716
\def\deftypeivarheader#1#2#3{%
4717
  \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
4718
  \begingroup
4719
    \defname{\defheaderxcond#2\relax$$$#3}
4720
            {\putwordInstanceVariableof\ \code{#1}}%
4721
    \defvarargs{#3}%
4722
  \endgroup
4723
}
4724
 
4725
% @defmethod == @defop Method
4726
%
4727
\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4728
%
4729
% #1 is the class name, #2 the method name, #3 the args.
4730
\def\defmethodheader#1#2#3{%
4731
  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
4732
  \begingroup
4733
    \defname{#2}{\putwordMethodon\ \code{#1}}%
4734
    \defunargs{#3}%
4735
  \endgroup
4736
}
4737
 
4738
% @defcv {Class Option} foo-class foo-flag
4739
 
4740
\def\defcv #1 {\def\defcvtype{#1}%
4741
\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4742
 
4743
\def\defcvarheader #1#2#3{%
4744
\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index
4745
\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}%
4746
\defvarargs {#3}\endgroup %
4747
}
4748
 
4749
% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
4750
%
4751
\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4752
%
4753
\def\defivarheader#1#2#3{%
4754
  \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index
4755
  \begingroup
4756
    \defname{#2}{\putwordInstanceVariableof\ #1}%
4757
    \defvarargs{#3}%
4758
  \endgroup
4759
}
4760
 
4761
% @defvar
4762
% First, define the processing that is wanted for arguments of @defvar.
4763
% This is actually simple: just print them in roman.
4764
% This must expand the args and terminate the paragraph they make up
4765
\def\defvarargs #1{\normalparens #1%
4766
\interlinepenalty=10000
4767
\endgraf\nobreak\vskip -\parskip\nobreak}
4768
 
4769
% @defvr Counter foo-count
4770
 
4771
\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4772
 
4773
\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4774
\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4775
 
4776
% @defvar == @defvr Variable
4777
 
4778
\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4779
 
4780
\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4781
\begingroup\defname {#1}{\putwordDefvar}%
4782
\defvarargs {#2}\endgroup %
4783
}
4784
 
4785
% @defopt == @defvr {User Option}
4786
 
4787
\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4788
 
4789
\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4790
\begingroup\defname {#1}{\putwordDefopt}%
4791
\defvarargs {#2}\endgroup %
4792
}
4793
 
4794
% @deftypevar int foobar
4795
 
4796
\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4797
 
4798
% #1 is the data type.  #2 is the name, perhaps followed by text that
4799
% is actually part of the data type, which should not be put into the index.
4800
\def\deftypevarheader #1#2{%
4801
\dovarind#2 \relax% Make entry in variables index
4802
\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}%
4803
\interlinepenalty=10000
4804
\endgraf\nobreak\vskip -\parskip\nobreak
4805
\endgroup}
4806
\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4807
 
4808
% @deftypevr {Global Flag} int enable
4809
 
4810
\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4811
 
4812
\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4813
\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4814
\interlinepenalty=10000
4815
\endgraf\nobreak\vskip -\parskip\nobreak
4816
\endgroup}
4817
 
4818
% Now define @deftp
4819
% Args are printed in bold, a slight difference from @defvar.
4820
 
4821
\def\deftpargs #1{\bf \defvarargs{#1}}
4822
 
4823
% @deftp Class window height width ...
4824
 
4825
\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4826
 
4827
\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4828
\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4829
 
4830
% These definitions are used if you use @defunx (etc.)
4831
% anywhere other than immediately after a @defun or @defunx.
4832
%
4833
\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
4834
\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
4835
\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
4836
\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
4837
\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
4838
\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4839
\def\defopx#1 {\errmessage{@defopx in invalid context}}
4840
\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
4841
\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
4842
\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
4843
\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
4844
\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
4845
\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
4846
\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
4847
\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
4848
\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
4849
\def\defunx#1 {\errmessage{@defunx in invalid context}}
4850
\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
4851
\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
4852
 
4853
 
4854
\message{macros,}
4855
% @macro.
4856
 
4857
% To do this right we need a feature of e-TeX, \scantokens,
4858
% which we arrange to emulate with a temporary file in ordinary TeX.
4859
\ifx\eTeXversion\undefined
4860
 \newwrite\macscribble
4861
 \def\scanmacro#1{%
4862
   \begingroup \newlinechar`\^^M
4863
   % Undo catcode changes of \startcontents and \doprintindex
4864
   \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
4865
   % Append \endinput to make sure that TeX does not see the ending newline.
4866
   \toks0={#1\endinput}%
4867
   \immediate\openout\macscribble=\jobname.tmp
4868
   \immediate\write\macscribble{\the\toks0}%
4869
   \immediate\closeout\macscribble
4870
   \let\xeatspaces\eatspaces
4871
   \input \jobname.tmp
4872
   \endgroup
4873
}
4874
\else
4875
\def\scanmacro#1{%
4876
\begingroup \newlinechar`\^^M
4877
% Undo catcode changes of \startcontents and \doprintindex
4878
\catcode`\@=0 \catcode`\\=12 \escapechar=`\@
4879
\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
4880
\fi
4881
 
4882
\newcount\paramno   % Count of parameters
4883
\newtoks\macname    % Macro name
4884
\newif\ifrecursive  % Is it recursive?
4885
\def\macrolist{}    % List of all defined macros in the form
4886
                    % \do\macro1\do\macro2...
4887
 
4888
% Utility routines.
4889
% Thisdoes \let #1 = #2, except with \csnames.
4890
\def\cslet#1#2{%
4891
\expandafter\expandafter
4892
\expandafter\let
4893
\expandafter\expandafter
4894
\csname#1\endcsname
4895
\csname#2\endcsname}
4896
 
4897
% Trim leading and trailing spaces off a string.
4898
% Concepts from aro-bend problem 15 (see CTAN).
4899
{\catcode`\@=11
4900
\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
4901
\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
4902
\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
4903
\def\unbrace#1{#1}
4904
\unbrace{\gdef\trim@@@ #1 } #2@{#1}
4905
}
4906
 
4907
% Trim a single trailing ^^M off a string.
4908
{\catcode`\^^M=12\catcode`\Q=3%
4909
\gdef\eatcr #1{\eatcra #1Q^^MQ}%
4910
\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
4911
\gdef\eatcrb#1Q#2Q{#1}%
4912
}
4913
 
4914
% Macro bodies are absorbed as an argument in a context where
4915
% all characters are catcode 10, 11 or 12, except \ which is active
4916
% (as in normal texinfo). It is necessary to change the definition of \.
4917
 
4918
% It's necessary to have hard CRs when the macro is executed. This is
4919
% done by  making ^^M (\endlinechar) catcode 12 when reading the macro
4920
% body, and then making it the \newlinechar in \scanmacro.
4921
 
4922
\def\macrobodyctxt{%
4923
  \catcode`\~=12
4924
  \catcode`\^=12
4925
  \catcode`\_=12
4926
  \catcode`\|=12
4927
  \catcode`\<=12
4928
  \catcode`\>=12
4929
  \catcode`\+=12
4930
  \catcode`\{=12
4931
  \catcode`\}=12
4932
  \catcode`\@=12
4933
  \catcode`\^^M=12
4934
  \usembodybackslash}
4935
 
4936
\def\macroargctxt{%
4937
  \catcode`\~=12
4938
  \catcode`\^=12
4939
  \catcode`\_=12
4940
  \catcode`\|=12
4941
  \catcode`\<=12
4942
  \catcode`\>=12
4943
  \catcode`\+=12
4944
  \catcode`\@=12
4945
  \catcode`\\=12}
4946
 
4947
% \mbodybackslash is the definition of \ in @macro bodies.
4948
% It maps \foo\ => \csname macarg.foo\endcsname => #N
4949
% where N is the macro parameter number.
4950
% We define \csname macarg.\endcsname to be \realbackslash, so
4951
% \\ in macro replacement text gets you a backslash.
4952
 
4953
{\catcode`@=0 @catcode`@\=@active
4954
 @gdef@usembodybackslash{@let\=@mbodybackslash}
4955
 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
4956
}
4957
\expandafter\def\csname macarg.\endcsname{\realbackslash}
4958
 
4959
\def\macro{\recursivefalse\parsearg\macroxxx}
4960
\def\rmacro{\recursivetrue\parsearg\macroxxx}
4961
 
4962
\def\macroxxx#1{%
4963
  \getargs{#1}%           now \macname is the macname and \argl the arglist
4964
  \ifx\argl\empty       % no arguments
4965
     \paramno=0%
4966
  \else
4967
     \expandafter\parsemargdef \argl;%
4968
  \fi
4969
  \if1\csname ismacro.\the\macname\endcsname
4970
     \message{Warning: redefining \the\macname}%
4971
  \else
4972
     \expandafter\ifx\csname \the\macname\endcsname \relax
4973
     \else \errmessage{The name \the\macname\space is reserved}\fi
4974
     \global\cslet{macsave.\the\macname}{\the\macname}%
4975
     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
4976
     % Add the macroname to \macrolist
4977
     \toks0 = \expandafter{\macrolist\do}%
4978
     \xdef\macrolist{\the\toks0
4979
       \expandafter\noexpand\csname\the\macname\endcsname}%
4980
  \fi
4981
  \begingroup \macrobodyctxt
4982
  \ifrecursive \expandafter\parsermacbody
4983
  \else \expandafter\parsemacbody
4984
  \fi}
4985
 
4986
\def\unmacro{\parsearg\unmacroxxx}
4987
\def\unmacroxxx#1{%
4988
  \if1\csname ismacro.#1\endcsname
4989
    \global\cslet{#1}{macsave.#1}%
4990
    \global\expandafter\let \csname ismacro.#1\endcsname=0%
4991
    % Remove the macro name from \macrolist
4992
    \begingroup
4993
      \edef\tempa{\expandafter\noexpand\csname#1\endcsname}%
4994
      \def\do##1{%
4995
        \def\tempb{##1}%
4996
        \ifx\tempa\tempb
4997
          % remove this
4998
        \else
4999
          \toks0 = \expandafter{\newmacrolist\do}%
5000
          \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}%
5001
        \fi}%
5002
      \def\newmacrolist{}%
5003
      % Execute macro list to define \newmacrolist
5004
      \macrolist
5005
      \global\let\macrolist\newmacrolist
5006
    \endgroup
5007
  \else
5008
    \errmessage{Macro #1 not defined}%
5009
  \fi
5010
}
5011
 
5012
% This makes use of the obscure feature that if the last token of a
5013
% <parameter list> is #, then the preceding argument is delimited by
5014
% an opening brace, and that opening brace is not consumed.
5015
\def\getargs#1{\getargsxxx#1{}}
5016
\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
5017
\def\getmacname #1 #2\relax{\macname={#1}}
5018
\def\getmacargs#1{\def\argl{#1}}
5019
 
5020
% Parse the optional {params} list.  Set up \paramno and \paramlist
5021
% so \defmacro knows what to do.  Define \macarg.blah for each blah
5022
% in the params list, to be ##N where N is the position in that list.
5023
% That gets used by \mbodybackslash (above).
5024
 
5025
% We need to get `macro parameter char #' into several definitions.
5026
% The technique used is stolen from LaTeX:  let \hash be something
5027
% unexpandable, insert that wherever you need a #, and then redefine
5028
% it to # just before using the token list produced.
5029
%
5030
% The same technique is used to protect \eatspaces till just before
5031
% the macro is used.
5032
 
5033
\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
5034
        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
5035
\def\parsemargdefxxx#1,{%
5036
  \if#1;\let\next=\relax
5037
  \else \let\next=\parsemargdefxxx
5038
    \advance\paramno by 1%
5039
    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
5040
        {\xeatspaces{\hash\the\paramno}}%
5041
    \edef\paramlist{\paramlist\hash\the\paramno,}%
5042
  \fi\next}
5043
 
5044
% These two commands read recursive and nonrecursive macro bodies.
5045
% (They're different since rec and nonrec macros end differently.)
5046
 
5047
\long\def\parsemacbody#1@end macro%
5048
{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
5049
\long\def\parsermacbody#1@end rmacro%
5050
{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
5051
 
5052
% This defines the macro itself. There are six cases: recursive and
5053
% nonrecursive macros of zero, one, and many arguments.
5054
% Much magic with \expandafter here.
5055
% \xdef is used so that macro definitions will survive the file
5056
% they're defined in; @include reads the file inside a group.
5057
\def\defmacro{%
5058
  \let\hash=##% convert placeholders to macro parameter chars
5059
  \ifrecursive
5060
    \ifcase\paramno
5061
    % 0
5062
      \expandafter\xdef\csname\the\macname\endcsname{%
5063
        \noexpand\scanmacro{\temp}}%
5064
    \or % 1
5065
      \expandafter\xdef\csname\the\macname\endcsname{%
5066
         \bgroup\noexpand\macroargctxt
5067
         \noexpand\braceorline
5068
         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
5069
      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
5070
         \egroup\noexpand\scanmacro{\temp}}%
5071
    \else % many
5072
      \expandafter\xdef\csname\the\macname\endcsname{%
5073
         \bgroup\noexpand\macroargctxt
5074
         \noexpand\csname\the\macname xx\endcsname}%
5075
      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5076
          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5077
      \expandafter\expandafter
5078
      \expandafter\xdef
5079
      \expandafter\expandafter
5080
        \csname\the\macname xxx\endcsname
5081
          \paramlist{\egroup\noexpand\scanmacro{\temp}}%
5082
    \fi
5083
  \else
5084
    \ifcase\paramno
5085
    % 0
5086
      \expandafter\xdef\csname\the\macname\endcsname{%
5087
        \noexpand\norecurse{\the\macname}%
5088
        \noexpand\scanmacro{\temp}\egroup}%
5089
    \or % 1
5090
      \expandafter\xdef\csname\the\macname\endcsname{%
5091
         \bgroup\noexpand\macroargctxt
5092
         \noexpand\braceorline
5093
         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
5094
      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
5095
        \egroup
5096
        \noexpand\norecurse{\the\macname}%
5097
        \noexpand\scanmacro{\temp}\egroup}%
5098
    \else % many
5099
      \expandafter\xdef\csname\the\macname\endcsname{%
5100
         \bgroup\noexpand\macroargctxt
5101
         \expandafter\noexpand\csname\the\macname xx\endcsname}%
5102
      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5103
          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5104
      \expandafter\expandafter
5105
      \expandafter\xdef
5106
      \expandafter\expandafter
5107
      \csname\the\macname xxx\endcsname
5108
      \paramlist{%
5109
          \egroup
5110
          \noexpand\norecurse{\the\macname}%
5111
          \noexpand\scanmacro{\temp}\egroup}%
5112
    \fi
5113
  \fi}
5114
 
5115
\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
5116
 
5117
% \braceorline decides whether the next nonwhitespace character is a
5118
% {.  If so it reads up to the closing }, if not, it reads the whole
5119
% line.  Whatever was read is then fed to the next control sequence
5120
% as an argument (by \parsebrace or \parsearg)
5121
\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
5122
\def\braceorlinexxx{%
5123
  \ifx\nchar\bgroup\else
5124
    \expandafter\parsearg
5125
  \fi \next}
5126
 
5127
% We mant to disable all macros during \shipout so that they are not
5128
% expanded by \write.
5129
\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
5130
  \edef\next{\macrolist}\expandafter\endgroup\next}
5131
 
5132
 
5133
% @alias.
5134
% We need some trickery to remove the optional spaces around the equal
5135
% sign.  Just make them active and then expand them all to nothing.
5136
\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
5137
\def\aliasxxx #1{\aliasyyy#1\relax}
5138
\def\aliasyyy #1=#2\relax{\ignoreactivespaces
5139
\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
5140
           \expandafter\noexpand\csname#2\endcsname}%
5141
\expandafter\endgroup\next}
5142
 
5143
 
5144
\message{cross references,}
5145
% @xref etc.
5146
 
5147
\newwrite\auxfile
5148
 
5149
\newif\ifhavexrefs    % True if xref values are known.
5150
\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
5151
 
5152
% @inforef is relatively simple.
5153
\def\inforef #1{\inforefzzz #1,,,,**}
5154
\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
5155
  node \samp{\ignorespaces#1{}}}
5156
 
5157
% @node's job is to define \lastnode.
5158
\def\node{\ENVcheck\parsearg\nodezzz}
5159
\def\nodezzz#1{\nodexxx [#1,]}
5160
\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
5161
\let\nwnode=\node
5162
\let\lastnode=\relax
5163
 
5164
% The sectioning commands (@chapter, etc.) call these.
5165
\def\donoderef{%
5166
  \ifx\lastnode\relax\else
5167
    \expandafter\expandafter\expandafter\setref{\lastnode}%
5168
      {Ysectionnumberandtype}%
5169
    \global\let\lastnode=\relax
5170
  \fi
5171
}
5172
\def\unnumbnoderef{%
5173
  \ifx\lastnode\relax\else
5174
    \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
5175
    \global\let\lastnode=\relax
5176
  \fi
5177
}
5178
\def\appendixnoderef{%
5179
  \ifx\lastnode\relax\else
5180
    \expandafter\expandafter\expandafter\setref{\lastnode}%
5181
      {Yappendixletterandtype}%
5182
    \global\let\lastnode=\relax
5183
  \fi
5184
}
5185
 
5186
 
5187
% @anchor{NAME} -- define xref target at arbitrary point.
5188
%
5189
\newcount\savesfregister
5190
\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
5191
\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
5192
\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
5193
 
5194
% \setref{NAME}{SNT} defines a cross-reference point NAME, namely
5195
% NAME-title, NAME-pg, and NAME-SNT.  Called from \foonoderef.  We have
5196
% to set \indexdummies so commands such as @code in a section title
5197
% aren't expanded.  It would be nicer not to expand the titles in the
5198
% first place, but there's so many layers that that is hard to do.
5199
%
5200
\def\setref#1#2{{%
5201
  \indexdummies
5202
  \pdfmkdest{#1}%
5203
  \dosetq{#1-title}{Ytitle}%
5204
  \dosetq{#1-pg}{Ypagenumber}%
5205
  \dosetq{#1-snt}{#2}%
5206
}}
5207
 
5208
% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
5209
% the node name, #2 the name of the Info cross-reference, #3 the printed
5210
% node name, #4 the name of the Info file, #5 the name of the printed
5211
% manual.  All but the node name can be omitted.
5212
%
5213
\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
5214
\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
5215
\def\ref#1{\xrefX[#1,,,,,,,]}
5216
\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
5217
  \unsepspaces
5218
  \def\printedmanual{\ignorespaces #5}%
5219
  \def\printednodename{\ignorespaces #3}%
5220
  \setbox1=\hbox{\printedmanual}%
5221
  \setbox0=\hbox{\printednodename}%
5222
  \ifdim \wd0 = 0pt
5223
    % No printed node name was explicitly given.
5224
    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
5225
      % Use the node name inside the square brackets.
5226
      \def\printednodename{\ignorespaces #1}%
5227
    \else
5228
      % Use the actual chapter/section title appear inside
5229
      % the square brackets.  Use the real section title if we have it.
5230
      \ifdim \wd1 > 0pt
5231
        % It is in another manual, so we don't have it.
5232
        \def\printednodename{\ignorespaces #1}%
5233
      \else
5234
        \ifhavexrefs
5235
          % We know the real title if we have the xref values.
5236
          \def\printednodename{\refx{#1-title}{}}%
5237
        \else
5238
          % Otherwise just copy the Info node name.
5239
          \def\printednodename{\ignorespaces #1}%
5240
        \fi%
5241
      \fi
5242
    \fi
5243
  \fi
5244
  %
5245
  % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
5246
  % insert empty discretionaries after hyphens, which means that it will
5247
  % not find a line break at a hyphen in a node names.  Since some manuals
5248
  % are best written with fairly long node names, containing hyphens, this
5249
  % is a loss.  Therefore, we give the text of the node name again, so it
5250
  % is as if TeX is seeing it for the first time.
5251
  \ifpdf
5252
    \leavevmode
5253
    \getfilename{#4}%
5254
    \ifnum\filenamelength>0
5255
      \startlink attr{/Border [0 0 0]}%
5256
        goto file{\the\filename.pdf} name{#1@}%
5257
    \else
5258
      \startlink attr{/Border [0 0 0]}%
5259
        goto name{#1@}%
5260
    \fi
5261
    \linkcolor
5262
  \fi
5263
  %
5264
  \ifdim \wd1 > 0pt
5265
    \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
5266
  \else
5267
    % _ (for example) has to be the character _ for the purposes of the
5268
    % control sequence corresponding to the node, but it has to expand
5269
    % into the usual \leavevmode...\vrule stuff for purposes of
5270
    % printing. So we \turnoffactive for the \refx-snt, back on for the
5271
    % printing, back off for the \refx-pg.
5272
    {\normalturnoffactive
5273
     % Only output a following space if the -snt ref is nonempty; for
5274
     % @unnumbered and @anchor, it won't be.
5275
     \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
5276
     \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
5277
    }%
5278
    % [mynode],
5279
    [\printednodename],\space
5280
    % page 3
5281
    \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
5282
  \fi
5283
  \endlink
5284
\endgroup}
5285
 
5286
% \dosetq is the interface for calls from other macros
5287
 
5288
% Use \normalturnoffactive so that punctuation chars such as underscore
5289
% and backslash work in node names.  (\turnoffactive doesn't do \.)
5290
\def\dosetq#1#2{%
5291
  {\let\folio=0%
5292
   \normalturnoffactive
5293
   \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
5294
   \iflinks
5295
     \next
5296
   \fi
5297
  }%
5298
}
5299
 
5300
% \internalsetq {foo}{page} expands into
5301
% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
5302
% When the aux file is read, ' is the escape character
5303
 
5304
\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
5305
 
5306
% Things to be expanded by \internalsetq
5307
 
5308
\def\Ypagenumber{\folio}
5309
 
5310
\def\Ytitle{\thissection}
5311
 
5312
\def\Ynothing{}
5313
 
5314
\def\Ysectionnumberandtype{%
5315
\ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
5316
\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
5317
\else \ifnum \subsubsecno=0 %
5318
\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
5319
\else %
5320
\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
5321
\fi \fi \fi }
5322
 
5323
\def\Yappendixletterandtype{%
5324
\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
5325
\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
5326
\else \ifnum \subsubsecno=0 %
5327
\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
5328
\else %
5329
\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
5330
\fi \fi \fi }
5331
 
5332
\gdef\xreftie{'tie}
5333
 
5334
% Use TeX 3.0's \inputlineno to get the line number, for better error
5335
% messages, but if we're using an old version of TeX, don't do anything.
5336
%
5337
\ifx\inputlineno\thisisundefined
5338
  \let\linenumber = \empty % Non-3.0.
5339
\else
5340
  \def\linenumber{\the\inputlineno:\space}
5341
\fi
5342
 
5343
% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
5344
% If its value is nonempty, SUFFIX is output afterward.
5345
 
5346
\def\refx#1#2{%
5347
  \expandafter\ifx\csname X#1\endcsname\relax
5348
    % If not defined, say something at least.
5349
    \angleleft un\-de\-fined\angleright
5350
    \iflinks
5351
      \ifhavexrefs
5352
        \message{\linenumber Undefined cross reference `#1'.}%
5353
      \else
5354
        \ifwarnedxrefs\else
5355
          \global\warnedxrefstrue
5356
          \message{Cross reference values unknown; you must run TeX again.}%
5357
        \fi
5358
      \fi
5359
    \fi
5360
  \else
5361
    % It's defined, so just use it.
5362
    \csname X#1\endcsname
5363
  \fi
5364
  #2% Output the suffix in any case.
5365
}
5366
 
5367
% This is the macro invoked by entries in the aux file.
5368
%
5369
\def\xrdef#1{\begingroup
5370
  % Reenable \ as an escape while reading the second argument.
5371
  \catcode`\\ = 0
5372
  \afterassignment\endgroup
5373
  \expandafter\gdef\csname X#1\endcsname
5374
}
5375
 
5376
% Read the last existing aux file, if any.  No error if none exists.
5377
\def\readauxfile{\begingroup
5378
  \catcode`\^^@=\other
5379
  \catcode`\^^A=\other
5380
  \catcode`\^^B=\other
5381
  \catcode`\^^C=\other
5382
  \catcode`\^^D=\other
5383
  \catcode`\^^E=\other
5384
  \catcode`\^^F=\other
5385
  \catcode`\^^G=\other
5386
  \catcode`\^^H=\other
5387
  \catcode`\^^K=\other
5388
  \catcode`\^^L=\other
5389
  \catcode`\^^N=\other
5390
  \catcode`\^^P=\other
5391
  \catcode`\^^Q=\other
5392
  \catcode`\^^R=\other
5393
  \catcode`\^^S=\other
5394
  \catcode`\^^T=\other
5395
  \catcode`\^^U=\other
5396
  \catcode`\^^V=\other
5397
  \catcode`\^^W=\other
5398
  \catcode`\^^X=\other
5399
  \catcode`\^^Z=\other
5400
  \catcode`\^^[=\other
5401
  \catcode`\^^\=\other
5402
  \catcode`\^^]=\other
5403
  \catcode`\^^^=\other
5404
  \catcode`\^^_=\other
5405
  \catcode`\@=\other
5406
  \catcode`\^=\other
5407
  % It was suggested to define this as 7, which would allow ^^e4 etc.
5408
  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
5409
  % supported in the main text, it doesn't seem desirable.  Furthermore,
5410
  % that is not enough: for node names that actually contain a ^
5411
  % character, we would end up writing a line like this: 'xrdef {'hat
5412
  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
5413
  % argument, and \hat is not an expandable control sequence.  It could
5414
  % all be worked out, but why?  Either we support ^^ or we don't.
5415
  %
5416
  % The other change necessary for this was to define \auxhat:
5417
  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
5418
  % and then to call \auxhat in \setq.
5419
  %
5420
  \catcode`\~=\other
5421
  \catcode`\[=\other
5422
  \catcode`\]=\other
5423
  \catcode`\"=\other
5424
  \catcode`\_=\other
5425
  \catcode`\|=\other
5426
  \catcode`\<=\other
5427
  \catcode`\>=\other
5428
  \catcode`\$=\other
5429
  \catcode`\#=\other
5430
  \catcode`\&=\other
5431
  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
5432
  % Make the characters 128-255 be printing characters
5433
  {%
5434
    \count 1=128
5435
    \def\loop{%
5436
      \catcode\count 1=\other
5437
      \advance\count 1 by 1
5438
      \ifnum \count 1<256 \loop \fi
5439
    }%
5440
  }%
5441
  % The aux file uses ' as the escape (for now).
5442
  % Turn off \ as an escape so we do not lose on
5443
  % entries which were dumped with control sequences in their names.
5444
  % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
5445
  % Reference to such entries still does not work the way one would wish,
5446
  % but at least they do not bomb out when the aux file is read in.
5447
  \catcode`\{=1
5448
  \catcode`\}=2
5449
  \catcode`\%=\other
5450
  \catcode`\'=0
5451
  \catcode`\\=\other
5452
  %
5453
  \openin 1 \jobname.aux
5454
  \ifeof 1 \else
5455
    \closein 1
5456
    \input \jobname.aux
5457
    \global\havexrefstrue
5458
    \global\warnedobstrue
5459
  \fi
5460
  % Open the new aux file.  TeX will close it automatically at exit.
5461
  \openout\auxfile=\jobname.aux
5462
\endgroup}
5463
 
5464
 
5465
% Footnotes.
5466
 
5467
\newcount \footnoteno
5468
 
5469
% The trailing space in the following definition for supereject is
5470
% vital for proper filling; pages come out unaligned when you do a
5471
% pagealignmacro call if that space before the closing brace is
5472
% removed. (Generally, numeric constants should always be followed by a
5473
% space to prevent strange expansion errors.)
5474
\def\supereject{\par\penalty -20000\footnoteno =0 }
5475
 
5476
% @footnotestyle is meaningful for info output only.
5477
\let\footnotestyle=\comment
5478
 
5479
\let\ptexfootnote=\footnote
5480
 
5481
{\catcode `\@=11
5482
%
5483
% Auto-number footnotes.  Otherwise like plain.
5484
\gdef\footnote{%
5485
  \global\advance\footnoteno by \@ne
5486
  \edef\thisfootno{$^{\the\footnoteno}$}%
5487
  %
5488
  % In case the footnote comes at the end of a sentence, preserve the
5489
  % extra spacing after we do the footnote number.
5490
  \let\@sf\empty
5491
  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
5492
  %
5493
  % Remove inadvertent blank space before typesetting the footnote number.
5494
  \unskip
5495
  \thisfootno\@sf
5496
  \footnotezzz
5497
}%
5498
 
5499
% Don't bother with the trickery in plain.tex to not require the
5500
% footnote text as a parameter.  Our footnotes don't need to be so general.
5501
%
5502
% Oh yes, they do; otherwise, @ifset and anything else that uses
5503
% \parseargline fail inside footnotes because the tokens are fixed when
5504
% the footnote is read.  --karl, 16nov96.
5505
%
5506
\long\gdef\footnotezzz{\insert\footins\bgroup
5507
  % We want to typeset this text as a normal paragraph, even if the
5508
  % footnote reference occurs in (for example) a display environment.
5509
  % So reset some parameters.
5510
  \interlinepenalty\interfootnotelinepenalty
5511
  \splittopskip\ht\strutbox % top baseline for broken footnotes
5512
  \splitmaxdepth\dp\strutbox
5513
  \floatingpenalty\@MM
5514
  \leftskip\z@skip
5515
  \rightskip\z@skip
5516
  \spaceskip\z@skip
5517
  \xspaceskip\z@skip
5518
  \parindent\defaultparindent
5519
  %
5520
  \smallfonts \rm
5521
  %
5522
  % Hang the footnote text off the number.
5523
  \hang
5524
  \textindent{\thisfootno}%
5525
  %
5526
  % Don't crash into the line above the footnote text.  Since this
5527
  % expands into a box, it must come within the paragraph, lest it
5528
  % provide a place where TeX can split the footnote.
5529
  \footstrut
5530
  \futurelet\next\fo@t
5531
}
5532
\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
5533
  \else\let\next\f@t\fi \next}
5534
\def\f@@t{\bgroup\aftergroup\@foot\let\next}
5535
\def\f@t#1{#1\@foot}
5536
\def\@foot{\strut\par\egroup}
5537
 
5538
}%end \catcode `\@=11
5539
 
5540
% Set the baselineskip to #1, and the lineskip and strut size
5541
% correspondingly.  There is no deep meaning behind these magic numbers
5542
% used as factors; they just match (closely enough) what Knuth defined.
5543
%
5544
\def\lineskipfactor{.08333}
5545
\def\strutheightpercent{.70833}
5546
\def\strutdepthpercent {.29167}
5547
%
5548
\def\setleading#1{%
5549
  \normalbaselineskip = #1\relax
5550
  \normallineskip = \lineskipfactor\normalbaselineskip
5551
  \normalbaselines
5552
  \setbox\strutbox =\hbox{%
5553
    \vrule width0pt height\strutheightpercent\baselineskip
5554
                    depth \strutdepthpercent \baselineskip
5555
  }%
5556
}
5557
 
5558
% @| inserts a changebar to the left of the current line.  It should
5559
% surround any changed text.  This approach does *not* work if the
5560
% change spans more than two lines of output.  To handle that, we would
5561
% have adopt a much more difficult approach (putting marks into the main
5562
% vertical list for the beginning and end of each change).
5563
%
5564
\def\|{%
5565
  % \vadjust can only be used in horizontal mode.
5566
  \leavevmode
5567
  %
5568
  % Append this vertical mode material after the current line in the output.
5569
  \vadjust{%
5570
    % We want to insert a rule with the height and depth of the current
5571
    % leading; that is exactly what \strutbox is supposed to record.
5572
    \vskip-\baselineskip
5573
    %
5574
    % \vadjust-items are inserted at the left edge of the type.  So
5575
    % the \llap here moves out into the left-hand margin.
5576
    \llap{%
5577
      %
5578
      % For a thicker or thinner bar, change the `1pt'.
5579
      \vrule height\baselineskip width1pt
5580
      %
5581
      % This is the space between the bar and the text.
5582
      \hskip 12pt
5583
    }%
5584
  }%
5585
}
5586
 
5587
% For a final copy, take out the rectangles
5588
% that mark overfull boxes (in case you have decided
5589
% that the text looks ok even though it passes the margin).
5590
%
5591
\def\finalout{\overfullrule=0pt}
5592
 
5593
% @image.  We use the macros from epsf.tex to support this.
5594
% If epsf.tex is not installed and @image is used, we complain.
5595
%
5596
% Check for and read epsf.tex up front.  If we read it only at @image
5597
% time, we might be inside a group, and then its definitions would get
5598
% undone and the next image would fail.
5599
\openin 1 = epsf.tex
5600
\ifeof 1 \else
5601
  \closein 1
5602
  % Do not bother showing banner with post-v2.7 epsf.tex (available in
5603
  % doc/epsf.tex until it shows up on ctan).
5604
  \def\epsfannounce{\toks0 = }%
5605
  \input epsf.tex
5606
\fi
5607
%
5608
% We will only complain once about lack of epsf.tex.
5609
\newif\ifwarnednoepsf
5610
\newhelp\noepsfhelp{epsf.tex must be installed for images to
5611
  work.  It is also included in the Texinfo distribution, or you can get
5612
  it from ftp://tug.org/tex/epsf.tex.}
5613
%
5614
\def\image#1{%
5615
  \ifx\epsfbox\undefined
5616
    \ifwarnednoepsf \else
5617
      \errhelp = \noepsfhelp
5618
      \errmessage{epsf.tex not found, images will be ignored}%
5619
      \global\warnednoepsftrue
5620
    \fi
5621
  \else
5622
    \imagexxx #1,,,\finish
5623
  \fi
5624
}
5625
%
5626
% Arguments to @image:
5627
% #1 is (mandatory) image filename; we tack on .eps extension.
5628
% #2 is (optional) width, #3 is (optional) height.
5629
% #4 is just the usual extra ignored arg for parsing this stuff.
5630
\def\imagexxx#1,#2,#3,#4\finish{%
5631
  \ifpdf
5632
    \centerline{\dopdfimage{#1}{#2}{#3}}%
5633
  \else
5634
    % \epsfbox itself resets \epsf?size at each figure.
5635
    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5636
    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5637
    \begingroup
5638
      \catcode`\^^M = 5 % in case we're inside an example
5639
      % If the image is by itself, center it.
5640
      \ifvmode
5641
        \nobreak\bigskip
5642
        % Usually we'll have text after the image which will insert
5643
        % \parskip glue, so insert it here too to equalize the space
5644
        % above and below.
5645
        \nobreak\vskip\parskip
5646
        \nobreak
5647
        \centerline{\epsfbox{#1.eps}}%
5648
        \bigbreak
5649
      \else
5650
        % In the middle of a paragraph, no extra space.
5651
        \epsfbox{#1.eps}%
5652
      \fi
5653
    \endgroup
5654
  \fi
5655
}
5656
 
5657
 
5658
\message{localization,}
5659
% and i18n.
5660
 
5661
% @documentlanguage is usually given very early, just after
5662
% @setfilename.  If done too late, it may not override everything
5663
% properly.  Single argument is the language abbreviation.
5664
% It would be nice if we could set up a hyphenation file here.
5665
%
5666
\def\documentlanguage{\parsearg\dodocumentlanguage}
5667
\def\dodocumentlanguage#1{%
5668
  \tex % read txi-??.tex file in plain TeX.
5669
  % Read the file if it exists.
5670
  \openin 1 txi-#1.tex
5671
  \ifeof1
5672
    \errhelp = \nolanghelp
5673
    \errmessage{Cannot read language file txi-#1.tex}%
5674
    \let\temp = \relax
5675
  \else
5676
    \def\temp{\input txi-#1.tex }%
5677
  \fi
5678
  \temp
5679
  \endgroup
5680
}
5681
\newhelp\nolanghelp{The given language definition file cannot be found or
5682
is empty.  Maybe you need to install it?  In the current directory
5683
should work if nowhere else does.}
5684
 
5685
 
5686
% @documentencoding should change something in TeX eventually, most
5687
% likely, but for now just recognize it.
5688
\let\documentencoding = \comment
5689
 
5690
 
5691
% Page size parameters.
5692
%
5693
\newdimen\defaultparindent \defaultparindent = 15pt
5694
 
5695
\chapheadingskip = 15pt plus 4pt minus 2pt
5696
\secheadingskip = 12pt plus 3pt minus 2pt
5697
\subsecheadingskip = 9pt plus 2pt minus 2pt
5698
 
5699
% Prevent underfull vbox error messages.
5700
\vbadness = 10000
5701
 
5702
% Don't be so finicky about underfull hboxes, either.
5703
\hbadness = 2000
5704
 
5705
% Following George Bush, just get rid of widows and orphans.
5706
\widowpenalty=10000
5707
\clubpenalty=10000
5708
 
5709
% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
5710
% using an old version of TeX, don't do anything.  We want the amount of
5711
% stretch added to depend on the line length, hence the dependence on
5712
% \hsize.  We call this whenever the paper size is set.
5713
%
5714
\def\setemergencystretch{%
5715
  \ifx\emergencystretch\thisisundefined
5716
    % Allow us to assign to \emergencystretch anyway.
5717
    \def\emergencystretch{\dimen0}%
5718
  \else
5719
    \emergencystretch = .15\hsize
5720
  \fi
5721
}
5722
 
5723
% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
5724
% 4) hoffset; 5) binding offset; 6) topskip.  Then whoever calls us can
5725
% set \parskip and call \setleading for \baselineskip.
5726
%
5727
\def\internalpagesizes#1#2#3#4#5#6{%
5728
  \voffset = #3\relax
5729
  \topskip = #6\relax
5730
  \splittopskip = \topskip
5731
  %
5732
  \vsize = #1\relax
5733
  \advance\vsize by \topskip
5734
  \outervsize = \vsize
5735
  \advance\outervsize by 2\topandbottommargin
5736
  \pageheight = \vsize
5737
  %
5738
  \hsize = #2\relax
5739
  \outerhsize = \hsize
5740
  \advance\outerhsize by 0.5in
5741
  \pagewidth = \hsize
5742
  %
5743
  \normaloffset = #4\relax
5744
  \bindingoffset = #5\relax
5745
  %
5746
  \parindent = \defaultparindent
5747
  \setemergencystretch
5748
}
5749
 
5750
% @letterpaper (the default).
5751
\def\letterpaper{{\globaldefs = 1
5752
  \parskip = 3pt plus 2pt minus 1pt
5753
  \setleading{13.2pt}%
5754
  %
5755
  % If page is nothing but text, make it come out even.
5756
  \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
5757
}}
5758
 
5759
% Use @smallbook to reset parameters for 7x9.5 (or so) format.
5760
\def\smallbook{{\globaldefs = 1
5761
  \parskip = 2pt plus 1pt
5762
  \setleading{12pt}%
5763
  %
5764
  \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
5765
  %
5766
  \lispnarrowing = 0.3in
5767
  \tolerance = 700
5768
  \hfuzz = 1pt
5769
  \contentsrightmargin = 0pt
5770
  \deftypemargin = 0pt
5771
  \defbodyindent = .5cm
5772
  %
5773
  \let\smalldisplay = \smalldisplayx
5774
  \let\smallexample = \smalllispx
5775
  \let\smallformat = \smallformatx
5776
  \let\smalllisp = \smalllispx
5777
}}
5778
 
5779
% Use @afourpaper to print on European A4 paper.
5780
\def\afourpaper{{\globaldefs = 1
5781
  \setleading{12pt}%
5782
  \parskip = 3pt plus 2pt minus 1pt
5783
  %
5784
  \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
5785
  %
5786
  \tolerance = 700
5787
  \hfuzz = 1pt
5788
}}
5789
 
5790
% A specific text layout, 24x15cm overall, intended for A4 paper.  Top margin
5791
% 29mm, hence bottom margin 28mm, nominal side margin 3cm.
5792
\def\afourlatex{{\globaldefs = 1
5793
  \setleading{13.6pt}%
5794
  %
5795
  \afourpaper
5796
  \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
5797
  %
5798
  \globaldefs = 0
5799
}}
5800
 
5801
% Use @afourwide to print on European A4 paper in wide format.
5802
\def\afourwide{%
5803
  \afourpaper
5804
  \internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
5805
  %
5806
  \globaldefs = 0
5807
}
5808
 
5809
% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
5810
% Perhaps we should allow setting the margins, \topskip, \parskip,
5811
% and/or leading, also. Or perhaps we should compute them somehow.
5812
%
5813
\def\pagesizes{\parsearg\pagesizesxxx}
5814
\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
5815
\def\pagesizesyyy#1,#2,#3\finish{{%
5816
  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
5817
  \globaldefs = 1
5818
  %
5819
  \parskip = 3pt plus 2pt minus 1pt
5820
  \setleading{13.2pt}%
5821
  %
5822
  \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
5823
}}
5824
 
5825
% Set default to letter.
5826
%
5827
\letterpaper
5828
 
5829
 
5830
\message{and turning on texinfo input format.}
5831
 
5832
% Define macros to output various characters with catcode for normal text.
5833
\catcode`\"=\other
5834
\catcode`\~=\other
5835
\catcode`\^=\other
5836
\catcode`\_=\other
5837
\catcode`\|=\other
5838
\catcode`\<=\other
5839
\catcode`\>=\other
5840
\catcode`\+=\other
5841
\catcode`\$=\other
5842
\def\normaldoublequote{"}
5843
\def\normaltilde{~}
5844
\def\normalcaret{^}
5845
\def\normalunderscore{_}
5846
\def\normalverticalbar{|}
5847
\def\normalless{<}
5848
\def\normalgreater{>}
5849
\def\normalplus{+}
5850
\def\normaldollar{$}
5851
 
5852
% This macro is used to make a character print one way in ttfont
5853
% where it can probably just be output, and another way in other fonts,
5854
% where something hairier probably needs to be done.
5855
%
5856
% #1 is what to print if we are indeed using \tt; #2 is what to print
5857
% otherwise.  Since all the Computer Modern typewriter fonts have zero
5858
% interword stretch (and shrink), and it is reasonable to expect all
5859
% typewriter fonts to have this, we can check that font parameter.
5860
%
5861
\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
5862
 
5863
% Same as above, but check for italic font.  Actually this also catches
5864
% non-italic slanted fonts since it is impossible to distinguish them from
5865
% italic fonts.  But since this is only used by $ and it uses \sl anyway
5866
% this is not a problem.
5867
\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
5868
 
5869
% Turn off all special characters except @
5870
% (and those which the user can use as if they were ordinary).
5871
% Most of these we simply print from the \tt font, but for some, we can
5872
% use math or other variants that look better in normal text.
5873
 
5874
\catcode`\"=\active
5875
\def\activedoublequote{{\tt\char34}}
5876
\let"=\activedoublequote
5877
\catcode`\~=\active
5878
\def~{{\tt\char126}}
5879
\chardef\hat=`\^
5880
\catcode`\^=\active
5881
\def^{{\tt \hat}}
5882
 
5883
\catcode`\_=\active
5884
\def_{\ifusingtt\normalunderscore\_}
5885
% Subroutine for the previous macro.
5886
\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
5887
 
5888
\catcode`\|=\active
5889
\def|{{\tt\char124}}
5890
\chardef \less=`\<
5891
\catcode`\<=\active
5892
\def<{{\tt \less}}
5893
\chardef \gtr=`\>
5894
\catcode`\>=\active
5895
\def>{{\tt \gtr}}
5896
\catcode`\+=\active
5897
\def+{{\tt \char 43}}
5898
\catcode`\$=\active
5899
\def${\ifusingit{{\sl\$}}\normaldollar}
5900
%\catcode 27=\active
5901
%\def^^[{$\diamondsuit$}
5902
 
5903
% Set up an active definition for =, but don't enable it most of the time.
5904
{\catcode`\==\active
5905
\global\def={{\tt \char 61}}}
5906
 
5907
\catcode`+=\active
5908
\catcode`\_=\active
5909
 
5910
% If a .fmt file is being used, characters that might appear in a file
5911
% name cannot be active until we have parsed the command line.
5912
% So turn them off again, and have \everyjob (or @setfilename) turn them on.
5913
% \otherifyactive is called near the end of this file.
5914
\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
5915
 
5916
\catcode`\@=0
5917
 
5918
% \rawbackslashxx output one backslash character in current font
5919
\global\chardef\rawbackslashxx=`\\
5920
%{\catcode`\\=\other
5921
%@gdef@rawbackslashxx{\}}
5922
 
5923
% \rawbackslash redefines \ as input to do \rawbackslashxx.
5924
{\catcode`\\=\active
5925
@gdef@rawbackslash{@let\=@rawbackslashxx }}
5926
 
5927
% \normalbackslash outputs one backslash in fixed width font.
5928
\def\normalbackslash{{\tt\rawbackslashxx}}
5929
 
5930
% \catcode 17=0   % Define control-q
5931
\catcode`\\=\active
5932
 
5933
% Used sometimes to turn off (effectively) the active characters
5934
% even after parsing them.
5935
@def@turnoffactive{@let"=@normaldoublequote
5936
@let\=@realbackslash
5937
@let~=@normaltilde
5938
@let^=@normalcaret
5939
@let_=@normalunderscore
5940
@let|=@normalverticalbar
5941
@let<=@normalless
5942
@let>=@normalgreater
5943
@let+=@normalplus
5944
@let$=@normaldollar}
5945
 
5946
@def@normalturnoffactive{@let"=@normaldoublequote
5947
@let\=@normalbackslash
5948
@let~=@normaltilde
5949
@let^=@normalcaret
5950
@let_=@normalunderscore
5951
@let|=@normalverticalbar
5952
@let<=@normalless
5953
@let>=@normalgreater
5954
@let+=@normalplus
5955
@let$=@normaldollar}
5956
 
5957
% Make _ and + \other characters, temporarily.
5958
% This is canceled by @fixbackslash.
5959
@otherifyactive
5960
 
5961
% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
5962
% That is what \eatinput is for; after that, the `\' should revert to printing
5963
% a backslash.
5964
%
5965
@gdef@eatinput input texinfo{@fixbackslash}
5966
@global@let\ = @eatinput
5967
 
5968
% On the other hand, perhaps the file did not have a `\input texinfo'. Then
5969
% the first `\{ in the file would cause an error. This macro tries to fix
5970
% that, assuming it is called before the first `\' could plausibly occur.
5971
% Also back turn on active characters that might appear in the input
5972
% file name, in case not using a pre-dumped format.
5973
%
5974
@gdef@fixbackslash{%
5975
  @ifx\@eatinput @let\ = @normalbackslash @fi
5976
  @catcode`+=@active
5977
  @catcode`@_=@active
5978
}
5979
 
5980
% Say @foo, not \foo, in error messages.
5981
@escapechar = `@@
5982
 
5983
% These look ok in all fonts, so just make them not special.
5984
@catcode`@& = @other
5985
@catcode`@# = @other
5986
@catcode`@% = @other
5987
 
5988
@c Set initial fonts.
5989
@textfonts
5990
@rm
5991
 
5992
 
5993
@c Local variables:
5994
@c eval: (add-hook 'write-file-hooks 'time-stamp)
5995
@c page-delimiter: "^\\\\message"
5996
@c time-stamp-start: "def\\\\texinfoversion{"
5997
@c time-stamp-format: "%:y-%02m-%02d.%02H"
5998
@c time-stamp-end: "}"
5999
@c End:

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.