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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [doc/] [include/] [texinfo.tex] - Blame information for rev 801

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

Line No. Rev Author Line
1 711 jeremybenn
% 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{2008-03-17.10}
7
%
8
% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10
% 2007, 2008 Free Software Foundation, Inc.
11
%
12
% This texinfo.tex file is free software: you can redistribute it and/or
13
% modify it under the terms of the GNU General Public License as
14
% published by the Free Software Foundation, either version 3 of the
15
% License, or (at your option) any later version.
16
%
17
% This texinfo.tex file is distributed in the hope that it will be
18
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19
% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20
% General Public License for more details.
21
%
22
% You should have received a copy of the GNU General Public License
23
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
%
25
% As a special exception, when this file is read by TeX when processing
26
% a Texinfo source document, you may use the result without
27
% restriction.  (This has been our intent since Texinfo was invented.)
28
%
29
% Please try the latest version of texinfo.tex before submitting bug
30
% reports; you can get the latest version from:
31
%   http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
32
%   ftp://tug.org/tex/texinfo.tex
33
%     (and all CTAN mirrors, see http://www.ctan.org).
34
% The texinfo.tex in any given distribution could well be out
35
% of date, so if that's what you're using, please check.
36
%
37
% Send bug reports to bug-texinfo@gnu.org.  Please include including a
38
% complete document in each bug report with which we can reproduce the
39
% problem.  Patches are, of course, greatly appreciated.
40
%
41
% To process a Texinfo manual with TeX, it's most reliable to use the
42
% texi2dvi shell script that comes with the distribution.  For a simple
43
% manual foo.texi, however, you can get away with this:
44
%   tex foo.texi
45
%   texindex foo.??
46
%   tex foo.texi
47
%   tex foo.texi
48
%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
49
% The extra TeX runs get the cross-reference information correct.
50
% Sometimes one run after texindex suffices, and sometimes you need more
51
% than two; texi2dvi does it as many times as necessary.
52
%
53
% It is possible to adapt texinfo.tex for other languages, to some
54
% extent.  You can get the existing language-specific files from the
55
% full Texinfo distribution.
56
%
57
% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
58
 
59
 
60
\message{Loading texinfo [version \texinfoversion]:}
61
 
62
% If in a .fmt file, print the version number
63
% and turn on active characters that we couldn't do earlier because
64
% they might have appeared in the input file name.
65
\everyjob{\message{[Texinfo version \texinfoversion]}%
66
  \catcode`+=\active \catcode`\_=\active}
67
 
68
 
69
\chardef\other=12
70
 
71
% We never want plain's \outer definition of \+ in Texinfo.
72
% For @tex, we can use \tabalign.
73
\let\+ = \relax
74
 
75
% Save some plain tex macros whose names we will redefine.
76
\let\ptexb=\b
77
\let\ptexbullet=\bullet
78
\let\ptexc=\c
79
\let\ptexcomma=\,
80
\let\ptexdot=\.
81
\let\ptexdots=\dots
82
\let\ptexend=\end
83
\let\ptexequiv=\equiv
84
\let\ptexexclam=\!
85
\let\ptexfootnote=\footnote
86
\let\ptexgtr=>
87
\let\ptexhat=^
88
\let\ptexi=\i
89
\let\ptexindent=\indent
90
\let\ptexinsert=\insert
91
\let\ptexlbrace=\{
92
\let\ptexless=<
93
\let\ptexnewwrite\newwrite
94
\let\ptexnoindent=\noindent
95
\let\ptexplus=+
96
\let\ptexrbrace=\}
97
\let\ptexslash=\/
98
\let\ptexstar=\*
99
\let\ptext=\t
100
\let\ptextop=\top
101
 
102
% If this character appears in an error message or help string, it
103
% starts a new line in the output.
104
\newlinechar = `^^J
105
 
106
% Use TeX 3.0's \inputlineno to get the line number, for better error
107
% messages, but if we're using an old version of TeX, don't do anything.
108
%
109
\ifx\inputlineno\thisisundefined
110
  \let\linenumber = \empty % Pre-3.0.
111
\else
112
  \def\linenumber{l.\the\inputlineno:\space}
113
\fi
114
 
115
% Set up fixed words for English if not already set.
116
\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
117
\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
118
\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
119
\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
120
\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
121
\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
122
\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
123
\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
124
\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
125
\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
126
\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
127
\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
128
\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
129
\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
130
\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
131
\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
132
\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
133
\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
134
\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
135
%
136
\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
137
\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
138
\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
139
\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
140
\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
141
\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
142
\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
143
\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
144
\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
145
\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
146
\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
147
\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
148
%
149
\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
150
\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
151
\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
152
\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
153
\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
154
 
155
% Since the category of space is not known, we have to be careful.
156
\chardef\spacecat = 10
157
\def\spaceisspace{\catcode`\ =\spacecat}
158
 
159
% sometimes characters are active, so we need control sequences.
160
\chardef\colonChar = `\:
161
\chardef\commaChar = `\,
162
\chardef\dashChar  = `\-
163
\chardef\dotChar   = `\.
164
\chardef\exclamChar= `\!
165
\chardef\lquoteChar= `\`
166
\chardef\questChar = `\?
167
\chardef\rquoteChar= `\'
168
\chardef\semiChar  = `\;
169
\chardef\underChar = `\_
170
 
171
% Ignore a token.
172
%
173
\def\gobble#1{}
174
 
175
% The following is used inside several \edef's.
176
\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
177
 
178
% Hyphenation fixes.
179
\hyphenation{
180
  Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
181
  ap-pen-dix bit-map bit-maps
182
  data-base data-bases eshell fall-ing half-way long-est man-u-script
183
  man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
184
  par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
185
  spell-ing spell-ings
186
  stand-alone strong-est time-stamp time-stamps which-ever white-space
187
  wide-spread wrap-around
188
}
189
 
190
% Margin to add to right of even pages, to left of odd pages.
191
\newdimen\bindingoffset
192
\newdimen\normaloffset
193
\newdimen\pagewidth \newdimen\pageheight
194
 
195
% For a final copy, take out the rectangles
196
% that mark overfull boxes (in case you have decided
197
% that the text looks ok even though it passes the margin).
198
%
199
\def\finalout{\overfullrule=0pt}
200
 
201
% @| inserts a changebar to the left of the current line.  It should
202
% surround any changed text.  This approach does *not* work if the
203
% change spans more than two lines of output.  To handle that, we would
204
% have adopt a much more difficult approach (putting marks into the main
205
% vertical list for the beginning and end of each change).
206
%
207
\def\|{%
208
  % \vadjust can only be used in horizontal mode.
209
  \leavevmode
210
  %
211
  % Append this vertical mode material after the current line in the output.
212
  \vadjust{%
213
    % We want to insert a rule with the height and depth of the current
214
    % leading; that is exactly what \strutbox is supposed to record.
215
    \vskip-\baselineskip
216
    %
217
    % \vadjust-items are inserted at the left edge of the type.  So
218
    % the \llap here moves out into the left-hand margin.
219
    \llap{%
220
      %
221
      % For a thicker or thinner bar, change the `1pt'.
222
      \vrule height\baselineskip width1pt
223
      %
224
      % This is the space between the bar and the text.
225
      \hskip 12pt
226
    }%
227
  }%
228
}
229
 
230
% Sometimes it is convenient to have everything in the transcript file
231
% and nothing on the terminal.  We don't just call \tracingall here,
232
% since that produces some useless output on the terminal.  We also make
233
% some effort to order the tracing commands to reduce output in the log
234
% file; cf. trace.sty in LaTeX.
235
%
236
\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
237
\def\loggingall{%
238
  \tracingstats2
239
  \tracingpages1
240
  \tracinglostchars2  % 2 gives us more in etex
241
  \tracingparagraphs1
242
  \tracingoutput1
243
  \tracingmacros2
244
  \tracingrestores1
245
  \showboxbreadth\maxdimen \showboxdepth\maxdimen
246
  \ifx\eTeXversion\undefined\else % etex gives us more logging
247
    \tracingscantokens1
248
    \tracingifs1
249
    \tracinggroups1
250
    \tracingnesting2
251
    \tracingassigns1
252
  \fi
253
  \tracingcommands3  % 3 gives us more in etex
254
  \errorcontextlines16
255
}%
256
 
257
% add check for \lastpenalty to plain's definitions.  If the last thing
258
% we did was a \nobreak, we don't want to insert more space.
259
%
260
\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
261
  \removelastskip\penalty-50\smallskip\fi\fi}
262
\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
263
  \removelastskip\penalty-100\medskip\fi\fi}
264
\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
265
  \removelastskip\penalty-200\bigskip\fi\fi}
266
 
267
% For @cropmarks command.
268
% Do @cropmarks to get crop marks.
269
%
270
\newif\ifcropmarks
271
\let\cropmarks = \cropmarkstrue
272
%
273
% Dimensions to add cropmarks at corners.
274
% Added by P. A. MacKay, 12 Nov. 1986
275
%
276
\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
277
\newdimen\cornerlong  \cornerlong=1pc
278
\newdimen\cornerthick \cornerthick=.3pt
279
\newdimen\topandbottommargin \topandbottommargin=.75in
280
 
281
% Output a mark which sets \thischapter, \thissection and \thiscolor.
282
% We dump everything together because we only have one kind of mark.
283
% This works because we only use \botmark / \topmark, not \firstmark.
284
%
285
% A mark contains a subexpression of the \ifcase ... \fi construct.
286
% \get*marks macros below extract the needed part using \ifcase.
287
%
288
% Another complication is to let the user choose whether \thischapter
289
% (\thissection) refers to the chapter (section) in effect at the top
290
% of a page, or that at the bottom of a page.  The solution is
291
% described on page 260 of The TeXbook.  It involves outputting two
292
% marks for the sectioning macros, one before the section break, and
293
% one after.  I won't pretend I can describe this better than DEK...
294
\def\domark{%
295
  \toks0=\expandafter{\lastchapterdefs}%
296
  \toks2=\expandafter{\lastsectiondefs}%
297
  \toks4=\expandafter{\prevchapterdefs}%
298
  \toks6=\expandafter{\prevsectiondefs}%
299
  \toks8=\expandafter{\lastcolordefs}%
300
  \mark{%
301
                   \the\toks0 \the\toks2
302
      \noexpand\or \the\toks4 \the\toks6
303
    \noexpand\else \the\toks8
304
  }%
305
}
306
% \topmark doesn't work for the very first chapter (after the title
307
% page or the contents), so we use \firstmark there -- this gets us
308
% the mark with the chapter defs, unless the user sneaks in, e.g.,
309
% @setcolor (or @url, or @link, etc.) between @contents and the very
310
% first @chapter.
311
\def\gettopheadingmarks{%
312
  \ifcase0\topmark\fi
313
  \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
314
}
315
\def\getbottomheadingmarks{\ifcase1\botmark\fi}
316
\def\getcolormarks{\ifcase2\topmark\fi}
317
 
318
% Avoid "undefined control sequence" errors.
319
\def\lastchapterdefs{}
320
\def\lastsectiondefs{}
321
\def\prevchapterdefs{}
322
\def\prevsectiondefs{}
323
\def\lastcolordefs{}
324
 
325
% Main output routine.
326
\chardef\PAGE = 255
327
\output = {\onepageout{\pagecontents\PAGE}}
328
 
329
\newbox\headlinebox
330
\newbox\footlinebox
331
 
332
% \onepageout takes a vbox as an argument.  Note that \pagecontents
333
% does insertions, but you have to call it yourself.
334
\def\onepageout#1{%
335
  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
336
  %
337
  \ifodd\pageno  \advance\hoffset by \bindingoffset
338
  \else \advance\hoffset by -\bindingoffset\fi
339
  %
340
  % Do this outside of the \shipout so @code etc. will be expanded in
341
  % the headline as they should be, not taken literally (outputting ''code).
342
  \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
343
  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
344
  \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
345
  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
346
  %
347
  {%
348
    % Have to do this stuff outside the \shipout because we want it to
349
    % take effect in \write's, yet the group defined by the \vbox ends
350
    % before the \shipout runs.
351
    %
352
    \indexdummies         % don't expand commands in the output.
353
    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
354
               % the page break happens to be in the middle of an example.
355
               % We don't want .vr (or whatever) entries like this:
356
               % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
357
               % "\acronym" won't work when it's read back in;
358
               % it needs to be
359
               % {\code {{\tt \backslashcurfont }acronym}
360
    \shipout\vbox{%
361
      % Do this early so pdf references go to the beginning of the page.
362
      \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
363
      %
364
      \ifcropmarks \vbox to \outervsize\bgroup
365
        \hsize = \outerhsize
366
        \vskip-\topandbottommargin
367
        \vtop to0pt{%
368
          \line{\ewtop\hfil\ewtop}%
369
          \nointerlineskip
370
          \line{%
371
            \vbox{\moveleft\cornerthick\nstop}%
372
            \hfill
373
            \vbox{\moveright\cornerthick\nstop}%
374
          }%
375
          \vss}%
376
        \vskip\topandbottommargin
377
        \line\bgroup
378
          \hfil % center the page within the outer (page) hsize.
379
          \ifodd\pageno\hskip\bindingoffset\fi
380
          \vbox\bgroup
381
      \fi
382
      %
383
      \unvbox\headlinebox
384
      \pagebody{#1}%
385
      \ifdim\ht\footlinebox > 0pt
386
        % Only leave this space if the footline is nonempty.
387
        % (We lessened \vsize for it in \oddfootingyyy.)
388
        % The \baselineskip=24pt in plain's \makefootline has no effect.
389
        \vskip 24pt
390
        \unvbox\footlinebox
391
      \fi
392
      %
393
      \ifcropmarks
394
          \egroup % end of \vbox\bgroup
395
        \hfil\egroup % end of (centering) \line\bgroup
396
        \vskip\topandbottommargin plus1fill minus1fill
397
        \boxmaxdepth = \cornerthick
398
        \vbox to0pt{\vss
399
          \line{%
400
            \vbox{\moveleft\cornerthick\nsbot}%
401
            \hfill
402
            \vbox{\moveright\cornerthick\nsbot}%
403
          }%
404
          \nointerlineskip
405
          \line{\ewbot\hfil\ewbot}%
406
        }%
407
      \egroup % \vbox from first cropmarks clause
408
      \fi
409
    }% end of \shipout\vbox
410
  }% end of group with \indexdummies
411
  \advancepageno
412
  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
413
}
414
 
415
\newinsert\margin \dimen\margin=\maxdimen
416
 
417
\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
418
{\catcode`\@ =11
419
\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
420
% marginal hacks, juha@viisa.uucp (Juha Takala)
421
\ifvoid\margin\else % marginal info is present
422
  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
423
\dimen@=\dp#1\relax \unvbox#1\relax
424
\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
425
\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
426
}
427
 
428
% Here are the rules for the cropmarks.  Note that they are
429
% offset so that the space between them is truly \outerhsize or \outervsize
430
% (P. A. MacKay, 12 November, 1986)
431
%
432
\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
433
\def\nstop{\vbox
434
  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
435
\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
436
\def\nsbot{\vbox
437
  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
438
 
439
% Parse an argument, then pass it to #1.  The argument is the rest of
440
% the input line (except we remove a trailing comment).  #1 should be a
441
% macro which expects an ordinary undelimited TeX argument.
442
%
443
\def\parsearg{\parseargusing{}}
444
\def\parseargusing#1#2{%
445
  \def\argtorun{#2}%
446
  \begingroup
447
    \obeylines
448
    \spaceisspace
449
    #1%
450
    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
451
}
452
 
453
{\obeylines %
454
  \gdef\parseargline#1^^M{%
455
    \endgroup % End of the group started in \parsearg.
456
    \argremovecomment #1\comment\ArgTerm%
457
  }%
458
}
459
 
460
% First remove any @comment, then any @c comment.
461
\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
462
\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
463
 
464
% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
465
%
466
% \argremovec might leave us with trailing space, e.g.,
467
%    @end itemize  @c foo
468
% This space token undergoes the same procedure and is eventually removed
469
% by \finishparsearg.
470
%
471
\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
472
\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
473
\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
474
  \def\temp{#3}%
475
  \ifx\temp\empty
476
    % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
477
    \let\temp\finishparsearg
478
  \else
479
    \let\temp\argcheckspaces
480
  \fi
481
  % Put the space token in:
482
  \temp#1 #3\ArgTerm
483
}
484
 
485
% If a _delimited_ argument is enclosed in braces, they get stripped; so
486
% to get _exactly_ the rest of the line, we had to prevent such situation.
487
% We prepended an \empty token at the very beginning and we expand it now,
488
% just before passing the control to \argtorun.
489
% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
490
% either the null string, or it ends with \^^M---thus there is no danger
491
% that a pair of braces would be stripped.
492
%
493
% But first, we have to remove the trailing space token.
494
%
495
\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
496
 
497
% \parseargdef\foo{...}
498
%       is roughly equivalent to
499
% \def\foo{\parsearg\Xfoo}
500
% \def\Xfoo#1{...}
501
%
502
% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
503
% favourite TeX trick.  --kasal, 16nov03
504
 
505
\def\parseargdef#1{%
506
  \expandafter \doparseargdef \csname\string#1\endcsname #1%
507
}
508
\def\doparseargdef#1#2{%
509
  \def#2{\parsearg#1}%
510
  \def#1##1%
511
}
512
 
513
% Several utility definitions with active space:
514
{
515
  \obeyspaces
516
  \gdef\obeyedspace{ }
517
 
518
  % Make each space character in the input produce a normal interword
519
  % space in the output.  Don't allow a line break at this space, as this
520
  % is used only in environments like @example, where each line of input
521
  % should produce a line of output anyway.
522
  %
523
  \gdef\sepspaces{\obeyspaces\let =\tie}
524
 
525
  % If an index command is used in an @example environment, any spaces
526
  % therein should become regular spaces in the raw index file, not the
527
  % expansion of \tie (\leavevmode \penalty \@M \ ).
528
  \gdef\unsepspaces{\let =\space}
529
}
530
 
531
 
532
\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
533
 
534
% Define the framework for environments in texinfo.tex.  It's used like this:
535
%
536
%   \envdef\foo{...}
537
%   \def\Efoo{...}
538
%
539
% It's the responsibility of \envdef to insert \begingroup before the
540
% actual body; @end closes the group after calling \Efoo.  \envdef also
541
% defines \thisenv, so the current environment is known; @end checks
542
% whether the environment name matches.  The \checkenv macro can also be
543
% used to check whether the current environment is the one expected.
544
%
545
% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
546
% are not treated as enviroments; they don't open a group.  (The
547
% implementation of @end takes care not to call \endgroup in this
548
% special case.)
549
 
550
 
551
% At runtime, environments start with this:
552
\def\startenvironment#1{\begingroup\def\thisenv{#1}}
553
% initialize
554
\let\thisenv\empty
555
 
556
% ... but they get defined via ``\envdef\foo{...}'':
557
\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
558
\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
559
 
560
% Check whether we're in the right environment:
561
\def\checkenv#1{%
562
  \def\temp{#1}%
563
  \ifx\thisenv\temp
564
  \else
565
    \badenverr
566
  \fi
567
}
568
 
569
% Evironment mismatch, #1 expected:
570
\def\badenverr{%
571
  \errhelp = \EMsimple
572
  \errmessage{This command can appear only \inenvironment\temp,
573
    not \inenvironment\thisenv}%
574
}
575
\def\inenvironment#1{%
576
  \ifx#1\empty
577
    out of any environment%
578
  \else
579
    in environment \expandafter\string#1%
580
  \fi
581
}
582
 
583
% @end foo executes the definition of \Efoo.
584
% But first, it executes a specialized version of \checkenv
585
%
586
\parseargdef\end{%
587
  \if 1\csname iscond.#1\endcsname
588
  \else
589
    % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
590
    \expandafter\checkenv\csname#1\endcsname
591
    \csname E#1\endcsname
592
    \endgroup
593
  \fi
594
}
595
 
596
\newhelp\EMsimple{Press RETURN to continue.}
597
 
598
 
599
%% Simple single-character @ commands
600
 
601
% @@ prints an @
602
% Kludge this until the fonts are right (grr).
603
\def\@{{\tt\char64}}
604
 
605
% This is turned off because it was never documented
606
% and you can use @w{...} around a quote to suppress ligatures.
607
%% Define @` and @' to be the same as ` and '
608
%% but suppressing ligatures.
609
%\def\`{{`}}
610
%\def\'{{'}}
611
 
612
% Used to generate quoted braces.
613
\def\mylbrace {{\tt\char123}}
614
\def\myrbrace {{\tt\char125}}
615
\let\{=\mylbrace
616
\let\}=\myrbrace
617
\begingroup
618
  % Definitions to produce \{ and \} commands for indices,
619
  % and @{ and @} for the aux/toc files.
620
  \catcode`\{ = \other \catcode`\} = \other
621
  \catcode`\[ = 1 \catcode`\] = 2
622
  \catcode`\! = 0 \catcode`\\ = \other
623
  !gdef!lbracecmd[\{]%
624
  !gdef!rbracecmd[\}]%
625
  !gdef!lbraceatcmd[@{]%
626
  !gdef!rbraceatcmd[@}]%
627
!endgroup
628
 
629
% @comma{} to avoid , parsing problems.
630
\let\comma = ,
631
 
632
% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
633
% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
634
\let\, = \c
635
\let\dotaccent = \.
636
\def\ringaccent#1{{\accent23 #1}}
637
\let\tieaccent = \t
638
\let\ubaraccent = \b
639
\let\udotaccent = \d
640
 
641
% Other special characters: @questiondown @exclamdown @ordf @ordm
642
% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
643
\def\questiondown{?`}
644
\def\exclamdown{!`}
645
\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
646
\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
647
 
648
% Dotless i and dotless j, used for accents.
649
\def\imacro{i}
650
\def\jmacro{j}
651
\def\dotless#1{%
652
  \def\temp{#1}%
653
  \ifx\temp\imacro \ptexi
654
  \else\ifx\temp\jmacro \j
655
  \else \errmessage{@dotless can be used only with i or j}%
656
  \fi\fi
657
}
658
 
659
% The \TeX{} logo, as in plain, but resetting the spacing so that a
660
% period following counts as ending a sentence.  (Idea found in latex.)
661
%
662
\edef\TeX{\TeX \spacefactor=1000 }
663
 
664
% @LaTeX{} logo.  Not quite the same results as the definition in
665
% latex.ltx, since we use a different font for the raised A; it's most
666
% convenient for us to use an explicitly smaller font, rather than using
667
% the \scriptstyle font (since we don't reset \scriptstyle and
668
% \scriptscriptstyle).
669
%
670
\def\LaTeX{%
671
  L\kern-.36em
672
  {\setbox0=\hbox{T}%
673
   \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
674
  \kern-.15em
675
  \TeX
676
}
677
 
678
% Be sure we're in horizontal mode when doing a tie, since we make space
679
% equivalent to this in @example-like environments. Otherwise, a space
680
% at the beginning of a line will start with \penalty -- and
681
% since \penalty is valid in vertical mode, we'd end up putting the
682
% penalty on the vertical list instead of in the new paragraph.
683
{\catcode`@ = 11
684
 % Avoid using \@M directly, because that causes trouble
685
 % if the definition is written into an index file.
686
 \global\let\tiepenalty = \@M
687
 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
688
}
689
 
690
% @: forces normal size whitespace following.
691
\def\:{\spacefactor=1000 }
692
 
693
% @* forces a line break.
694
\def\*{\hfil\break\hbox{}\ignorespaces}
695
 
696
% @/ allows a line break.
697
\let\/=\allowbreak
698
 
699
% @. is an end-of-sentence period.
700
\def\.{.\spacefactor=\endofsentencespacefactor\space}
701
 
702
% @! is an end-of-sentence bang.
703
\def\!{!\spacefactor=\endofsentencespacefactor\space}
704
 
705
% @? is an end-of-sentence query.
706
\def\?{?\spacefactor=\endofsentencespacefactor\space}
707
 
708
% @frenchspacing on|off  says whether to put extra space after punctuation.
709
%
710
\def\onword{on}
711
\def\offword{off}
712
%
713
\parseargdef\frenchspacing{%
714
  \def\temp{#1}%
715
  \ifx\temp\onword \plainfrenchspacing
716
  \else\ifx\temp\offword \plainnonfrenchspacing
717
  \else
718
    \errhelp = \EMsimple
719
    \errmessage{Unknown @frenchspacing option `\temp', must be on/off}%
720
  \fi\fi
721
}
722
 
723
% @w prevents a word break.  Without the \leavevmode, @w at the
724
% beginning of a paragraph, when TeX is still in vertical mode, would
725
% produce a whole line of output instead of starting the paragraph.
726
\def\w#1{\leavevmode\hbox{#1}}
727
 
728
% @group ... @end group forces ... to be all on one page, by enclosing
729
% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
730
% to keep its height that of a normal line.  According to the rules for
731
% \topskip (p.114 of the TeXbook), the glue inserted is
732
% max (\topskip - \ht (first item), 0).  If that height is large,
733
% therefore, no glue is inserted, and the space between the headline and
734
% the text is small, which looks bad.
735
%
736
% Another complication is that the group might be very large.  This can
737
% cause the glue on the previous page to be unduly stretched, because it
738
% does not have much material.  In this case, it's better to add an
739
% explicit \vfill so that the extra space is at the bottom.  The
740
% threshold for doing this is if the group is more than \vfilllimit
741
% percent of a page (\vfilllimit can be changed inside of @tex).
742
%
743
\newbox\groupbox
744
\def\vfilllimit{0.7}
745
%
746
\envdef\group{%
747
  \ifnum\catcode`\^^M=\active \else
748
    \errhelp = \groupinvalidhelp
749
    \errmessage{@group invalid in context where filling is enabled}%
750
  \fi
751
  \startsavinginserts
752
  %
753
  \setbox\groupbox = \vtop\bgroup
754
    % Do @comment since we are called inside an environment such as
755
    % @example, where each end-of-line in the input causes an
756
    % end-of-line in the output.  We don't want the end-of-line after
757
    % the `@group' to put extra space in the output.  Since @group
758
    % should appear on a line by itself (according to the Texinfo
759
    % manual), we don't worry about eating any user text.
760
    \comment
761
}
762
%
763
% The \vtop produces a box with normal height and large depth; thus, TeX puts
764
% \baselineskip glue before it, and (when the next line of text is done)
765
% \lineskip glue after it.  Thus, space below is not quite equal to space
766
% above.  But it's pretty close.
767
\def\Egroup{%
768
    % To get correct interline space between the last line of the group
769
    % and the first line afterwards, we have to propagate \prevdepth.
770
    \endgraf % Not \par, as it may have been set to \lisppar.
771
    \global\dimen1 = \prevdepth
772
  \egroup           % End the \vtop.
773
  % \dimen0 is the vertical size of the group's box.
774
  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
775
  % \dimen2 is how much space is left on the page (more or less).
776
  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
777
  % if the group doesn't fit on the current page, and it's a big big
778
  % group, force a page break.
779
  \ifdim \dimen0 > \dimen2
780
    \ifdim \pagetotal < \vfilllimit\pageheight
781
      \page
782
    \fi
783
  \fi
784
  \box\groupbox
785
  \prevdepth = \dimen1
786
  \checkinserts
787
}
788
%
789
% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
790
% message, so this ends up printing `@group can only ...'.
791
%
792
\newhelp\groupinvalidhelp{%
793
group can only be used in environments such as @example,^^J%
794
where each line of input produces a line of output.}
795
 
796
% @need space-in-mils
797
% forces a page break if there is not space-in-mils remaining.
798
 
799
\newdimen\mil  \mil=0.001in
800
 
801
% Old definition--didn't work.
802
%\parseargdef\need{\par %
803
%% This method tries to make TeX break the page naturally
804
%% if the depth of the box does not fit.
805
%{\baselineskip=0pt%
806
%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
807
%\prevdepth=-1000pt
808
%}}
809
 
810
\parseargdef\need{%
811
  % Ensure vertical mode, so we don't make a big box in the middle of a
812
  % paragraph.
813
  \par
814
  %
815
  % If the @need value is less than one line space, it's useless.
816
  \dimen0 = #1\mil
817
  \dimen2 = \ht\strutbox
818
  \advance\dimen2 by \dp\strutbox
819
  \ifdim\dimen0 > \dimen2
820
    %
821
    % Do a \strut just to make the height of this box be normal, so the
822
    % normal leading is inserted relative to the preceding line.
823
    % And a page break here is fine.
824
    \vtop to #1\mil{\strut\vfil}%
825
    %
826
    % TeX does not even consider page breaks if a penalty added to the
827
    % main vertical list is 10000 or more.  But in order to see if the
828
    % empty box we just added fits on the page, we must make it consider
829
    % page breaks.  On the other hand, we don't want to actually break the
830
    % page after the empty box.  So we use a penalty of 9999.
831
    %
832
    % There is an extremely small chance that TeX will actually break the
833
    % page at this \penalty, if there are no other feasible breakpoints in
834
    % sight.  (If the user is using lots of big @group commands, which
835
    % almost-but-not-quite fill up a page, TeX will have a hard time doing
836
    % good page breaking, for example.)  However, I could not construct an
837
    % example where a page broke at this \penalty; if it happens in a real
838
    % document, then we can reconsider our strategy.
839
    \penalty9999
840
    %
841
    % Back up by the size of the box, whether we did a page break or not.
842
    \kern -#1\mil
843
    %
844
    % Do not allow a page break right after this kern.
845
    \nobreak
846
  \fi
847
}
848
 
849
% @br   forces paragraph break (and is undocumented).
850
 
851
\let\br = \par
852
 
853
% @page forces the start of a new page.
854
%
855
\def\page{\par\vfill\supereject}
856
 
857
% @exdent text....
858
% outputs text on separate line in roman font, starting at standard page margin
859
 
860
% This records the amount of indent in the innermost environment.
861
% That's how much \exdent should take out.
862
\newskip\exdentamount
863
 
864
% This defn is used inside fill environments such as @defun.
865
\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
866
 
867
% This defn is used inside nofill environments such as @example.
868
\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
869
  \leftline{\hskip\leftskip{\rm#1}}}}
870
 
871
% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
872
% paragraph.  For more general purposes, use the \margin insertion
873
% class.  WHICH is `l' or `r'.
874
%
875
\newskip\inmarginspacing \inmarginspacing=1cm
876
\def\strutdepth{\dp\strutbox}
877
%
878
\def\doinmargin#1#2{\strut\vadjust{%
879
  \nobreak
880
  \kern-\strutdepth
881
  \vtop to \strutdepth{%
882
    \baselineskip=\strutdepth
883
    \vss
884
    % if you have multiple lines of stuff to put here, you'll need to
885
    % make the vbox yourself of the appropriate size.
886
    \ifx#1l%
887
      \llap{\ignorespaces #2\hskip\inmarginspacing}%
888
    \else
889
      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
890
    \fi
891
    \null
892
  }%
893
}}
894
\def\inleftmargin{\doinmargin l}
895
\def\inrightmargin{\doinmargin r}
896
%
897
% @inmargin{TEXT [, RIGHT-TEXT]}
898
% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
899
% else use TEXT for both).
900
%
901
\def\inmargin#1{\parseinmargin #1,,\finish}
902
\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
903
  \setbox0 = \hbox{\ignorespaces #2}%
904
  \ifdim\wd0 > 0pt
905
    \def\lefttext{#1}%  have both texts
906
    \def\righttext{#2}%
907
  \else
908
    \def\lefttext{#1}%  have only one text
909
    \def\righttext{#1}%
910
  \fi
911
  %
912
  \ifodd\pageno
913
    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
914
  \else
915
    \def\temp{\inleftmargin\lefttext}%
916
  \fi
917
  \temp
918
}
919
 
920
% @include FILE -- \input text of FILE.
921
%
922
\def\include{\parseargusing\filenamecatcodes\includezzz}
923
\def\includezzz#1{%
924
  \pushthisfilestack
925
  \def\thisfile{#1}%
926
  {%
927
    \makevalueexpandable  % we want to expand any @value in FILE.
928
    \turnoffactive        % and allow special characters in the expansion
929
    \edef\temp{\noexpand\input #1 }%
930
    %
931
    % This trickery is to read FILE outside of a group, in case it makes
932
    % definitions, etc.
933
    \expandafter
934
  }\temp
935
  \popthisfilestack
936
}
937
\def\filenamecatcodes{%
938
  \catcode`\\=\other
939
  \catcode`~=\other
940
  \catcode`^=\other
941
  \catcode`_=\other
942
  \catcode`|=\other
943
  \catcode`<=\other
944
  \catcode`>=\other
945
  \catcode`+=\other
946
  \catcode`-=\other
947
}
948
 
949
\def\pushthisfilestack{%
950
  \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
951
}
952
\def\pushthisfilestackX{%
953
  \expandafter\pushthisfilestackY\thisfile\StackTerm
954
}
955
\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
956
  \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
957
}
958
 
959
\def\popthisfilestack{\errthisfilestackempty}
960
\def\errthisfilestackempty{\errmessage{Internal error:
961
  the stack of filenames is empty.}}
962
 
963
\def\thisfile{}
964
 
965
% @center line
966
% outputs that line, centered.
967
%
968
\parseargdef\center{%
969
  \ifhmode
970
    \let\next\centerH
971
  \else
972
    \let\next\centerV
973
  \fi
974
  \next{\hfil \ignorespaces#1\unskip \hfil}%
975
}
976
\def\centerH#1{%
977
  {%
978
    \hfil\break
979
    \advance\hsize by -\leftskip
980
    \advance\hsize by -\rightskip
981
    \line{#1}%
982
    \break
983
  }%
984
}
985
\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
986
 
987
% @sp n   outputs n lines of vertical space
988
 
989
\parseargdef\sp{\vskip #1\baselineskip}
990
 
991
% @comment ...line which is ignored...
992
% @c is the same as @comment
993
% @ignore ... @end ignore  is another way to write a comment
994
 
995
\def\comment{\begingroup \catcode`\^^M=\other%
996
\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
997
\commentxxx}
998
{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
999
 
1000
\let\c=\comment
1001
 
1002
% @paragraphindent NCHARS
1003
% We'll use ems for NCHARS, close enough.
1004
% NCHARS can also be the word `asis' or `none'.
1005
% We cannot feasibly implement @paragraphindent asis, though.
1006
%
1007
\def\asisword{asis} % no translation, these are keywords
1008
\def\noneword{none}
1009
%
1010
\parseargdef\paragraphindent{%
1011
  \def\temp{#1}%
1012
  \ifx\temp\asisword
1013
  \else
1014
    \ifx\temp\noneword
1015
      \defaultparindent = 0pt
1016
    \else
1017
      \defaultparindent = #1em
1018
    \fi
1019
  \fi
1020
  \parindent = \defaultparindent
1021
}
1022
 
1023
% @exampleindent NCHARS
1024
% We'll use ems for NCHARS like @paragraphindent.
1025
% It seems @exampleindent asis isn't necessary, but
1026
% I preserve it to make it similar to @paragraphindent.
1027
\parseargdef\exampleindent{%
1028
  \def\temp{#1}%
1029
  \ifx\temp\asisword
1030
  \else
1031
    \ifx\temp\noneword
1032
      \lispnarrowing = 0pt
1033
    \else
1034
      \lispnarrowing = #1em
1035
    \fi
1036
  \fi
1037
}
1038
 
1039
% @firstparagraphindent WORD
1040
% If WORD is `none', then suppress indentation of the first paragraph
1041
% after a section heading.  If WORD is `insert', then do indent at such
1042
% paragraphs.
1043
%
1044
% The paragraph indentation is suppressed or not by calling
1045
% \suppressfirstparagraphindent, which the sectioning commands do.
1046
% We switch the definition of this back and forth according to WORD.
1047
% By default, we suppress indentation.
1048
%
1049
\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
1050
\def\insertword{insert}
1051
%
1052
\parseargdef\firstparagraphindent{%
1053
  \def\temp{#1}%
1054
  \ifx\temp\noneword
1055
    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
1056
  \else\ifx\temp\insertword
1057
    \let\suppressfirstparagraphindent = \relax
1058
  \else
1059
    \errhelp = \EMsimple
1060
    \errmessage{Unknown @firstparagraphindent option `\temp'}%
1061
  \fi\fi
1062
}
1063
 
1064
% Here is how we actually suppress indentation.  Redefine \everypar to
1065
% \kern backwards by \parindent, and then reset itself to empty.
1066
%
1067
% We also make \indent itself not actually do anything until the next
1068
% paragraph.
1069
%
1070
\gdef\dosuppressfirstparagraphindent{%
1071
  \gdef\indent{%
1072
    \restorefirstparagraphindent
1073
    \indent
1074
  }%
1075
  \gdef\noindent{%
1076
    \restorefirstparagraphindent
1077
    \noindent
1078
  }%
1079
  \global\everypar = {%
1080
    \kern -\parindent
1081
    \restorefirstparagraphindent
1082
  }%
1083
}
1084
 
1085
\gdef\restorefirstparagraphindent{%
1086
  \global \let \indent = \ptexindent
1087
  \global \let \noindent = \ptexnoindent
1088
  \global \everypar = {}%
1089
}
1090
 
1091
 
1092
% @asis just yields its argument.  Used with @table, for example.
1093
%
1094
\def\asis#1{#1}
1095
 
1096
% @math outputs its argument in math mode.
1097
%
1098
% One complication: _ usually means subscripts, but it could also mean
1099
% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
1100
% _ active, and distinguish by seeing if the current family is \slfam,
1101
% which is what @var uses.
1102
{
1103
  \catcode`\_ = \active
1104
  \gdef\mathunderscore{%
1105
    \catcode`\_=\active
1106
    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
1107
  }
1108
}
1109
% Another complication: we want \\ (and @\) to output a \ character.
1110
% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
1111
% this is not advertised and we don't care.  Texinfo does not
1112
% otherwise define @\.
1113
%
1114
% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
1115
\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
1116
%
1117
\def\math{%
1118
  \tex
1119
  \mathunderscore
1120
  \let\\ = \mathbackslash
1121
  \mathactive
1122
  $\finishmath
1123
}
1124
\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
1125
 
1126
% Some active characters (such as <) are spaced differently in math.
1127
% We have to reset their definitions in case the @math was an argument
1128
% to a command which sets the catcodes (such as @item or @section).
1129
%
1130
{
1131
  \catcode`^ = \active
1132
  \catcode`< = \active
1133
  \catcode`> = \active
1134
  \catcode`+ = \active
1135
  \gdef\mathactive{%
1136
    \let^ = \ptexhat
1137
    \let< = \ptexless
1138
    \let> = \ptexgtr
1139
    \let+ = \ptexplus
1140
  }
1141
}
1142
 
1143
% @bullet and @minus need the same treatment as @math, just above.
1144
\def\bullet{$\ptexbullet$}
1145
\def\minus{$-$}
1146
 
1147
% @dots{} outputs an ellipsis using the current font.
1148
% We do .5em per period so that it has the same spacing in the cm
1149
% typewriter fonts as three actual period characters; on the other hand,
1150
% in other typewriter fonts three periods are wider than 1.5em.  So do
1151
% whichever is larger.
1152
%
1153
\def\dots{%
1154
  \leavevmode
1155
  \setbox0=\hbox{...}% get width of three periods
1156
  \ifdim\wd0 > 1.5em
1157
    \dimen0 = \wd0
1158
  \else
1159
    \dimen0 = 1.5em
1160
  \fi
1161
  \hbox to \dimen0{%
1162
    \hskip 0pt plus.25fil
1163
    .\hskip 0pt plus1fil
1164
    .\hskip 0pt plus1fil
1165
    .\hskip 0pt plus.5fil
1166
  }%
1167
}
1168
 
1169
% @enddots{} is an end-of-sentence ellipsis.
1170
%
1171
\def\enddots{%
1172
  \dots
1173
  \spacefactor=\endofsentencespacefactor
1174
}
1175
 
1176
% @comma{} is so commas can be inserted into text without messing up
1177
% Texinfo's parsing.
1178
%
1179
\let\comma = ,
1180
 
1181
% @refill is a no-op.
1182
\let\refill=\relax
1183
 
1184
% If working on a large document in chapters, it is convenient to
1185
% be able to disable indexing, cross-referencing, and contents, for test runs.
1186
% This is done with @novalidate (before @setfilename).
1187
%
1188
\newif\iflinks \linkstrue % by default we want the aux files.
1189
\let\novalidate = \linksfalse
1190
 
1191
% @setfilename is done at the beginning of every texinfo file.
1192
% So open here the files we need to have open while reading the input.
1193
% This makes it possible to make a .fmt file for texinfo.
1194
\def\setfilename{%
1195
   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
1196
   \iflinks
1197
     \tryauxfile
1198
     % Open the new aux file.  TeX will close it automatically at exit.
1199
     \immediate\openout\auxfile=\jobname.aux
1200
   \fi % \openindices needs to do some work in any case.
1201
   \openindices
1202
   \let\setfilename=\comment % Ignore extra @setfilename cmds.
1203
   %
1204
   % If texinfo.cnf is present on the system, read it.
1205
   % Useful for site-wide @afourpaper, etc.
1206
   \openin 1 texinfo.cnf
1207
   \ifeof 1 \else \input texinfo.cnf \fi
1208
   \closein 1
1209
   %
1210
   \comment % Ignore the actual filename.
1211
}
1212
 
1213
% Called from \setfilename.
1214
%
1215
\def\openindices{%
1216
  \newindex{cp}%
1217
  \newcodeindex{fn}%
1218
  \newcodeindex{vr}%
1219
  \newcodeindex{tp}%
1220
  \newcodeindex{ky}%
1221
  \newcodeindex{pg}%
1222
}
1223
 
1224
% @bye.
1225
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1226
 
1227
 
1228
\message{pdf,}
1229
% adobe `portable' document format
1230
\newcount\tempnum
1231
\newcount\lnkcount
1232
\newtoks\filename
1233
\newcount\filenamelength
1234
\newcount\pgn
1235
\newtoks\toksA
1236
\newtoks\toksB
1237
\newtoks\toksC
1238
\newtoks\toksD
1239
\newbox\boxA
1240
\newcount\countA
1241
\newif\ifpdf
1242
\newif\ifpdfmakepagedest
1243
 
1244
% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1245
% can be set).  So we test for \relax and 0 as well as \undefined,
1246
% borrowed from ifpdf.sty.
1247
\ifx\pdfoutput\undefined
1248
\else
1249
  \ifx\pdfoutput\relax
1250
  \else
1251
    \ifcase\pdfoutput
1252
    \else
1253
      \pdftrue
1254
    \fi
1255
  \fi
1256
\fi
1257
 
1258
% PDF uses PostScript string constants for the names of xref targets,
1259
% for display in the outlines, and in other places.  Thus, we have to
1260
% double any backslashes.  Otherwise, a name like "\node" will be
1261
% interpreted as a newline (\n), followed by o, d, e.  Not good.
1262
% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
1263
% (and related messages, the final outcome is that it is up to the TeX
1264
% user to double the backslashes and otherwise make the string valid, so
1265
% that's what we do).
1266
 
1267
% double active backslashes.
1268
%
1269
{\catcode`\@=0 \catcode`\\=\active
1270
 @gdef@activebackslashdouble{%
1271
   @catcode`@\=@active
1272
   @let\=@doublebackslash}
1273
}
1274
 
1275
% To handle parens, we must adopt a different approach, since parens are
1276
% not active characters.  hyperref.dtx (which has the same problem as
1277
% us) handles it with this amazing macro to replace tokens, with minor
1278
% changes for Texinfo.  It is included here under the GPL by permission
1279
% from the author, Heiko Oberdiek.
1280
%
1281
% #1 is the tokens to replace.
1282
% #2 is the replacement.
1283
% #3 is the control sequence with the string.
1284
%
1285
\def\HyPsdSubst#1#2#3{%
1286
  \def\HyPsdReplace##1#1##2\END{%
1287
    ##1%
1288
    \ifx\\##2\\%
1289
    \else
1290
      #2%
1291
      \HyReturnAfterFi{%
1292
        \HyPsdReplace##2\END
1293
      }%
1294
    \fi
1295
  }%
1296
  \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
1297
}
1298
\long\def\HyReturnAfterFi#1\fi{\fi#1}
1299
 
1300
% #1 is a control sequence in which to do the replacements.
1301
\def\backslashparens#1{%
1302
  \xdef#1{#1}% redefine it as its expansion; the definition is simply
1303
             % \lastnode when called from \setref -> \pdfmkdest.
1304
  \HyPsdSubst{(}{\realbackslash(}{#1}%
1305
  \HyPsdSubst{)}{\realbackslash)}{#1}%
1306
}
1307
 
1308
\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1309
with PDF output, and none of those formats could be found.  (.eps cannot
1310
be supported due to the design of the PDF format; use regular TeX (DVI
1311
output) for that.)}
1312
 
1313
\ifpdf
1314
  %
1315
  % Color manipulation macros based on pdfcolor.tex.
1316
  \def\cmykDarkRed{0.28 1 1 0.35}
1317
  \def\cmykBlack{0 0 0 1}
1318
  %
1319
  \def\pdfsetcolor#1{\pdfliteral{#1 k}}
1320
  % Set color, and create a mark which defines \thiscolor accordingly,
1321
  % so that \makeheadline knows which color to restore.
1322
  \def\setcolor#1{%
1323
    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1324
    \domark
1325
    \pdfsetcolor{#1}%
1326
  }
1327
  %
1328
  \def\maincolor{\cmykBlack}
1329
  \pdfsetcolor{\maincolor}
1330
  \edef\thiscolor{\maincolor}
1331
  \def\lastcolordefs{}
1332
  %
1333
  \def\makefootline{%
1334
    \baselineskip24pt
1335
    \line{\pdfsetcolor{\maincolor}\the\footline}%
1336
  }
1337
  %
1338
  \def\makeheadline{%
1339
    \vbox to 0pt{%
1340
      \vskip-22.5pt
1341
      \line{%
1342
        \vbox to8.5pt{}%
1343
        % Extract \thiscolor definition from the marks.
1344
        \getcolormarks
1345
        % Typeset the headline with \maincolor, then restore the color.
1346
        \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1347
      }%
1348
      \vss
1349
    }%
1350
    \nointerlineskip
1351
  }
1352
  %
1353
  %
1354
  \pdfcatalog{/PageMode /UseOutlines}
1355
  %
1356
  % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1357
  \def\dopdfimage#1#2#3{%
1358
    \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1359
    \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1360
    %
1361
    % pdftex (and the PDF format) support .png, .jpg, .pdf (among
1362
    % others).  Let's try in that order.
1363
    \let\pdfimgext=\empty
1364
    \begingroup
1365
      \openin 1 #1.png \ifeof 1
1366
        \openin 1 #1.jpg \ifeof 1
1367
          \openin 1 #1.jpeg \ifeof 1
1368
            \openin 1 #1.JPG \ifeof 1
1369
              \openin 1 #1.pdf \ifeof 1
1370
                \errhelp = \nopdfimagehelp
1371
                \errmessage{Could not find image file #1 for pdf}%
1372
              \else \gdef\pdfimgext{pdf}%
1373
              \fi
1374
            \else \gdef\pdfimgext{JPG}%
1375
            \fi
1376
          \else \gdef\pdfimgext{jpeg}%
1377
          \fi
1378
        \else \gdef\pdfimgext{jpg}%
1379
        \fi
1380
      \else \gdef\pdfimgext{png}%
1381
      \fi
1382
      \closein 1
1383
    \endgroup
1384
    %
1385
    % without \immediate, pdftex seg faults when the same image is
1386
    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
1387
    \ifnum\pdftexversion < 14
1388
      \immediate\pdfimage
1389
    \else
1390
      \immediate\pdfximage
1391
    \fi
1392
      \ifdim \wd0 >0pt width \imagewidth \fi
1393
      \ifdim \wd2 >0pt height \imageheight \fi
1394
      \ifnum\pdftexversion<13
1395
         #1.\pdfimgext
1396
       \else
1397
         {#1.\pdfimgext}%
1398
       \fi
1399
    \ifnum\pdftexversion < 14 \else
1400
      \pdfrefximage \pdflastximage
1401
    \fi}
1402
  %
1403
  \def\pdfmkdest#1{{%
1404
    % We have to set dummies so commands such as @code, and characters
1405
    % such as \, aren't expanded when present in a section title.
1406
    \indexnofonts
1407
    \turnoffactive
1408
    \activebackslashdouble
1409
    \makevalueexpandable
1410
    \def\pdfdestname{#1}%
1411
    \backslashparens\pdfdestname
1412
    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1413
  }}
1414
  %
1415
  % used to mark target names; must be expandable.
1416
  \def\pdfmkpgn#1{#1}
1417
  %
1418
  % by default, use a color that is dark enough to print on paper as
1419
  % nearly black, but still distinguishable for online viewing.
1420
  \def\urlcolor{\cmykDarkRed}
1421
  \def\linkcolor{\cmykDarkRed}
1422
  \def\endlink{\setcolor{\maincolor}\pdfendlink}
1423
  %
1424
  % Adding outlines to PDF; macros for calculating structure of outlines
1425
  % come from Petr Olsak
1426
  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1427
    \else \csname#1\endcsname \fi}
1428
  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1429
    \advance\tempnum by 1
1430
    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1431
  %
1432
  % #1 is the section text, which is what will be displayed in the
1433
  % outline by the pdf viewer.  #2 is the pdf expression for the number
1434
  % of subentries (or empty, for subsubsections).  #3 is the node text,
1435
  % which might be empty if this toc entry had no corresponding node.
1436
  % #4 is the page number
1437
  %
1438
  \def\dopdfoutline#1#2#3#4{%
1439
    % Generate a link to the node text if that exists; else, use the
1440
    % page number.  We could generate a destination for the section
1441
    % text in the case where a section has no node, but it doesn't
1442
    % seem worth the trouble, since most documents are normally structured.
1443
    \def\pdfoutlinedest{#3}%
1444
    \ifx\pdfoutlinedest\empty
1445
      \def\pdfoutlinedest{#4}%
1446
    \else
1447
      % Doubled backslashes in the name.
1448
      {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
1449
       \backslashparens\pdfoutlinedest}%
1450
    \fi
1451
    %
1452
    % Also double the backslashes in the display string.
1453
    {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
1454
     \backslashparens\pdfoutlinetext}%
1455
    %
1456
    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1457
  }
1458
  %
1459
  \def\pdfmakeoutlines{%
1460
    \begingroup
1461
      % Thanh's hack / proper braces in bookmarks
1462
      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
1463
      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
1464
      %
1465
      % Read toc silently, to get counts of subentries for \pdfoutline.
1466
      \def\numchapentry##1##2##3##4{%
1467
        \def\thischapnum{##2}%
1468
        \def\thissecnum{0}%
1469
        \def\thissubsecnum{0}%
1470
      }%
1471
      \def\numsecentry##1##2##3##4{%
1472
        \advancenumber{chap\thischapnum}%
1473
        \def\thissecnum{##2}%
1474
        \def\thissubsecnum{0}%
1475
      }%
1476
      \def\numsubsecentry##1##2##3##4{%
1477
        \advancenumber{sec\thissecnum}%
1478
        \def\thissubsecnum{##2}%
1479
      }%
1480
      \def\numsubsubsecentry##1##2##3##4{%
1481
        \advancenumber{subsec\thissubsecnum}%
1482
      }%
1483
      \def\thischapnum{0}%
1484
      \def\thissecnum{0}%
1485
      \def\thissubsecnum{0}%
1486
      %
1487
      % use \def rather than \let here because we redefine \chapentry et
1488
      % al. a second time, below.
1489
      \def\appentry{\numchapentry}%
1490
      \def\appsecentry{\numsecentry}%
1491
      \def\appsubsecentry{\numsubsecentry}%
1492
      \def\appsubsubsecentry{\numsubsubsecentry}%
1493
      \def\unnchapentry{\numchapentry}%
1494
      \def\unnsecentry{\numsecentry}%
1495
      \def\unnsubsecentry{\numsubsecentry}%
1496
      \def\unnsubsubsecentry{\numsubsubsecentry}%
1497
      \readdatafile{toc}%
1498
      %
1499
      % Read toc second time, this time actually producing the outlines.
1500
      % The `-' means take the \expnumber as the absolute number of
1501
      % subentries, which we calculated on our first read of the .toc above.
1502
      %
1503
      % We use the node names as the destinations.
1504
      \def\numchapentry##1##2##3##4{%
1505
        \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1506
      \def\numsecentry##1##2##3##4{%
1507
        \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1508
      \def\numsubsecentry##1##2##3##4{%
1509
        \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1510
      \def\numsubsubsecentry##1##2##3##4{% count is always zero
1511
        \dopdfoutline{##1}{}{##3}{##4}}%
1512
      %
1513
      % PDF outlines are displayed using system fonts, instead of
1514
      % document fonts.  Therefore we cannot use special characters,
1515
      % since the encoding is unknown.  For example, the eogonek from
1516
      % Latin 2 (0xea) gets translated to a | character.  Info from
1517
      % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1518
      %
1519
      % xx to do this right, we have to translate 8-bit characters to
1520
      % their "best" equivalent, based on the @documentencoding.  Right
1521
      % now, I guess we'll just let the pdf reader have its way.
1522
      \indexnofonts
1523
      \setupdatafile
1524
      \catcode`\\=\active \otherbackslash
1525
      \input \tocreadfilename
1526
    \endgroup
1527
  }
1528
  %
1529
  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1530
    \ifx\PP\D\let\nextsp\relax
1531
    \else\let\nextsp\skipspaces
1532
      \ifx\p\space\else\addtokens{\filename}{\PP}%
1533
        \advance\filenamelength by 1
1534
      \fi
1535
    \fi
1536
    \nextsp}
1537
  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1538
  \ifnum\pdftexversion < 14
1539
    \let \startlink \pdfannotlink
1540
  \else
1541
    \let \startlink \pdfstartlink
1542
  \fi
1543
  % make a live url in pdf output.
1544
  \def\pdfurl#1{%
1545
    \begingroup
1546
      % it seems we really need yet another set of dummies; have not
1547
      % tried to figure out what each command should do in the context
1548
      % of @url.  for now, just make @/ a no-op, that's the only one
1549
      % people have actually reported a problem with.
1550
      %
1551
      \normalturnoffactive
1552
      \def\@{@}%
1553
      \let\/=\empty
1554
      \makevalueexpandable
1555
      \leavevmode\setcolor{\urlcolor}%
1556
      \startlink attr{/Border [0 0 0]}%
1557
        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1558
    \endgroup}
1559
  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1560
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1561
  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1562
  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1563
  \def\maketoks{%
1564
    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1565
    \ifx\first0\adn0
1566
    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1567
    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1568
    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1569
    \else
1570
      \ifnum0=\countA\else\makelink\fi
1571
      \ifx\first.\let\next=\done\else
1572
        \let\next=\maketoks
1573
        \addtokens{\toksB}{\the\toksD}
1574
        \ifx\first,\addtokens{\toksB}{\space}\fi
1575
      \fi
1576
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1577
    \next}
1578
  \def\makelink{\addtokens{\toksB}%
1579
    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1580
  \def\pdflink#1{%
1581
    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1582
    \setcolor{\linkcolor}#1\endlink}
1583
  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1584
\else
1585
  \let\pdfmkdest = \gobble
1586
  \let\pdfurl = \gobble
1587
  \let\endlink = \relax
1588
  \let\setcolor = \gobble
1589
  \let\pdfsetcolor = \gobble
1590
  \let\pdfmakeoutlines = \relax
1591
\fi  % \ifx\pdfoutput
1592
 
1593
 
1594
\message{fonts,}
1595
 
1596
% Change the current font style to #1, remembering it in \curfontstyle.
1597
% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1598
% italics, not bold italics.
1599
%
1600
\def\setfontstyle#1{%
1601
  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1602
  \csname ten#1\endcsname  % change the current font
1603
}
1604
 
1605
% Select #1 fonts with the current style.
1606
%
1607
\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1608
 
1609
\def\rm{\fam=0 \setfontstyle{rm}}
1610
\def\it{\fam=\itfam \setfontstyle{it}}
1611
\def\sl{\fam=\slfam \setfontstyle{sl}}
1612
\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1613
\def\tt{\fam=\ttfam \setfontstyle{tt}}
1614
 
1615
% Texinfo sort of supports the sans serif font style, which plain TeX does not.
1616
% So we set up a \sf.
1617
\newfam\sffam
1618
\def\sf{\fam=\sffam \setfontstyle{sf}}
1619
\let\li = \sf % Sometimes we call it \li, not \sf.
1620
 
1621
% We don't need math for this font style.
1622
\def\ttsl{\setfontstyle{ttsl}}
1623
 
1624
 
1625
% Default leading.
1626
\newdimen\textleading  \textleading = 13.2pt
1627
 
1628
% Set the baselineskip to #1, and the lineskip and strut size
1629
% correspondingly.  There is no deep meaning behind these magic numbers
1630
% used as factors; they just match (closely enough) what Knuth defined.
1631
%
1632
\def\lineskipfactor{.08333}
1633
\def\strutheightpercent{.70833}
1634
\def\strutdepthpercent {.29167}
1635
%
1636
% can get a sort of poor man's double spacing by redefining this.
1637
\def\baselinefactor{1}
1638
%
1639
\def\setleading#1{%
1640
  \dimen0 = #1\relax
1641
  \normalbaselineskip = \baselinefactor\dimen0
1642
  \normallineskip = \lineskipfactor\normalbaselineskip
1643
  \normalbaselines
1644
  \setbox\strutbox =\hbox{%
1645
    \vrule width0pt height\strutheightpercent\baselineskip
1646
                    depth \strutdepthpercent \baselineskip
1647
  }%
1648
}
1649
 
1650
% PDF CMaps.  See also LaTeX's t1.cmap.
1651
%
1652
% do nothing with this by default.
1653
\expandafter\let\csname cmapOT1\endcsname\gobble
1654
\expandafter\let\csname cmapOT1IT\endcsname\gobble
1655
\expandafter\let\csname cmapOT1TT\endcsname\gobble
1656
 
1657
% if we are producing pdf, and we have \pdffontattr, then define cmaps.
1658
% (\pdffontattr was introduced many years ago, but people still run
1659
% older pdftex's; it's easy to conditionalize, so we do.)
1660
\ifpdf \ifx\pdffontattr\undefined \else
1661
  \begingroup
1662
    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1663
    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1664
%%DocumentNeededResources: ProcSet (CIDInit)
1665
%%IncludeResource: ProcSet (CIDInit)
1666
%%BeginResource: CMap (TeX-OT1-0)
1667
%%Title: (TeX-OT1-0 TeX OT1 0)
1668
%%Version: 1.000
1669
%%EndComments
1670
/CIDInit /ProcSet findresource begin
1671
12 dict begin
1672
begincmap
1673
/CIDSystemInfo
1674
<< /Registry (TeX)
1675
/Ordering (OT1)
1676
/Supplement 0
1677
>> def
1678
/CMapName /TeX-OT1-0 def
1679
/CMapType 2 def
1680
1 begincodespacerange
1681
<00> <7F>
1682
endcodespacerange
1683
8 beginbfrange
1684
<00> <01> <0393>
1685
<09> <0A> <03A8>
1686
<23> <26> <0023>
1687
<28> <3B> <0028>
1688
<3F> <5B> <003F>
1689
<5D> <5E> <005D>
1690
<61> <7A> <0061>
1691
<7B> <7C> <2013>
1692
endbfrange
1693
40 beginbfchar
1694
<02> <0398>
1695
<03> <039B>
1696
<04> <039E>
1697
<05> <03A0>
1698
<06> <03A3>
1699
<07> <03D2>
1700
<08> <03A6>
1701
<0B> <00660066>
1702
<0C> <00660069>
1703
<0D> <0066006C>
1704
<0E> <006600660069>
1705
<0F> <00660066006C>
1706
<10> <0131>
1707
<11> <0237>
1708
<12> <0060>
1709
<13> <00B4>
1710
<14> <02C7>
1711
<15> <02D8>
1712
<16> <00AF>
1713
<17> <02DA>
1714
<18> <00B8>
1715
<19> <00DF>
1716
<1A> <00E6>
1717
<1B> <0153>
1718
<1C> <00F8>
1719
<1D> <00C6>
1720
<1E> <0152>
1721
<1F> <00D8>
1722
<21> <0021>
1723
<22> <201D>
1724
<27> <2019>
1725
<3C> <00A1>
1726
<3D> <003D>
1727
<3E> <00BF>
1728
<5C> <201C>
1729
<5F> <02D9>
1730
<60> <2018>
1731
<7D> <02DD>
1732
<7E> <007E>
1733
<7F> <00A8>
1734
endbfchar
1735
endcmap
1736
CMapName currentdict /CMap defineresource pop
1737
end
1738
end
1739
%%EndResource
1740
%%EOF
1741
    }\endgroup
1742
  \expandafter\edef\csname cmapOT1\endcsname#1{%
1743
    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1744
  }%
1745
%
1746
% \cmapOT1IT
1747
  \begingroup
1748
    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1749
    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1750
%%DocumentNeededResources: ProcSet (CIDInit)
1751
%%IncludeResource: ProcSet (CIDInit)
1752
%%BeginResource: CMap (TeX-OT1IT-0)
1753
%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1754
%%Version: 1.000
1755
%%EndComments
1756
/CIDInit /ProcSet findresource begin
1757
12 dict begin
1758
begincmap
1759
/CIDSystemInfo
1760
<< /Registry (TeX)
1761
/Ordering (OT1IT)
1762
/Supplement 0
1763
>> def
1764
/CMapName /TeX-OT1IT-0 def
1765
/CMapType 2 def
1766
1 begincodespacerange
1767
<00> <7F>
1768
endcodespacerange
1769
8 beginbfrange
1770
<00> <01> <0393>
1771
<09> <0A> <03A8>
1772
<25> <26> <0025>
1773
<28> <3B> <0028>
1774
<3F> <5B> <003F>
1775
<5D> <5E> <005D>
1776
<61> <7A> <0061>
1777
<7B> <7C> <2013>
1778
endbfrange
1779
42 beginbfchar
1780
<02> <0398>
1781
<03> <039B>
1782
<04> <039E>
1783
<05> <03A0>
1784
<06> <03A3>
1785
<07> <03D2>
1786
<08> <03A6>
1787
<0B> <00660066>
1788
<0C> <00660069>
1789
<0D> <0066006C>
1790
<0E> <006600660069>
1791
<0F> <00660066006C>
1792
<10> <0131>
1793
<11> <0237>
1794
<12> <0060>
1795
<13> <00B4>
1796
<14> <02C7>
1797
<15> <02D8>
1798
<16> <00AF>
1799
<17> <02DA>
1800
<18> <00B8>
1801
<19> <00DF>
1802
<1A> <00E6>
1803
<1B> <0153>
1804
<1C> <00F8>
1805
<1D> <00C6>
1806
<1E> <0152>
1807
<1F> <00D8>
1808
<21> <0021>
1809
<22> <201D>
1810
<23> <0023>
1811
<24> <00A3>
1812
<27> <2019>
1813
<3C> <00A1>
1814
<3D> <003D>
1815
<3E> <00BF>
1816
<5C> <201C>
1817
<5F> <02D9>
1818
<60> <2018>
1819
<7D> <02DD>
1820
<7E> <007E>
1821
<7F> <00A8>
1822
endbfchar
1823
endcmap
1824
CMapName currentdict /CMap defineresource pop
1825
end
1826
end
1827
%%EndResource
1828
%%EOF
1829
    }\endgroup
1830
  \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1831
    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1832
  }%
1833
%
1834
% \cmapOT1TT
1835
  \begingroup
1836
    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1837
    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1838
%%DocumentNeededResources: ProcSet (CIDInit)
1839
%%IncludeResource: ProcSet (CIDInit)
1840
%%BeginResource: CMap (TeX-OT1TT-0)
1841
%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1842
%%Version: 1.000
1843
%%EndComments
1844
/CIDInit /ProcSet findresource begin
1845
12 dict begin
1846
begincmap
1847
/CIDSystemInfo
1848
<< /Registry (TeX)
1849
/Ordering (OT1TT)
1850
/Supplement 0
1851
>> def
1852
/CMapName /TeX-OT1TT-0 def
1853
/CMapType 2 def
1854
1 begincodespacerange
1855
<00> <7F>
1856
endcodespacerange
1857
5 beginbfrange
1858
<00> <01> <0393>
1859
<09> <0A> <03A8>
1860
<21> <26> <0021>
1861
<28> <5F> <0028>
1862
<61> <7E> <0061>
1863
endbfrange
1864
32 beginbfchar
1865
<02> <0398>
1866
<03> <039B>
1867
<04> <039E>
1868
<05> <03A0>
1869
<06> <03A3>
1870
<07> <03D2>
1871
<08> <03A6>
1872
<0B> <2191>
1873
<0C> <2193>
1874
<0D> <0027>
1875
<0E> <00A1>
1876
<0F> <00BF>
1877
<10> <0131>
1878
<11> <0237>
1879
<12> <0060>
1880
<13> <00B4>
1881
<14> <02C7>
1882
<15> <02D8>
1883
<16> <00AF>
1884
<17> <02DA>
1885
<18> <00B8>
1886
<19> <00DF>
1887
<1A> <00E6>
1888
<1B> <0153>
1889
<1C> <00F8>
1890
<1D> <00C6>
1891
<1E> <0152>
1892
<1F> <00D8>
1893
<20> <2423>
1894
<27> <2019>
1895
<60> <2018>
1896
<7F> <00A8>
1897
endbfchar
1898
endcmap
1899
CMapName currentdict /CMap defineresource pop
1900
end
1901
end
1902
%%EndResource
1903
%%EOF
1904
    }\endgroup
1905
  \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1906
    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1907
  }%
1908
\fi\fi
1909
 
1910
 
1911
% Set the font macro #1 to the font named #2, adding on the
1912
% specified font prefix (normally `cm').
1913
% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1914
% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
1915
% empty to omit).
1916
\def\setfont#1#2#3#4#5{%
1917
  \font#1=\fontprefix#2#3 scaled #4
1918
  \csname cmap#5\endcsname#1%
1919
}
1920
% This is what gets called when #5 of \setfont is empty.
1921
\let\cmap\gobble
1922
% emacs-page end of cmaps
1923
 
1924
% Use cm as the default font prefix.
1925
% To specify the font prefix, you must define \fontprefix
1926
% before you read in texinfo.tex.
1927
\ifx\fontprefix\undefined
1928
\def\fontprefix{cm}
1929
\fi
1930
% Support font families that don't use the same naming scheme as CM.
1931
\def\rmshape{r}
1932
\def\rmbshape{bx}               %where the normal face is bold
1933
\def\bfshape{b}
1934
\def\bxshape{bx}
1935
\def\ttshape{tt}
1936
\def\ttbshape{tt}
1937
\def\ttslshape{sltt}
1938
\def\itshape{ti}
1939
\def\itbshape{bxti}
1940
\def\slshape{sl}
1941
\def\slbshape{bxsl}
1942
\def\sfshape{ss}
1943
\def\sfbshape{ss}
1944
\def\scshape{csc}
1945
\def\scbshape{csc}
1946
 
1947
% Definitions for a main text size of 11pt.  This is the default in
1948
% Texinfo.
1949
%
1950
\def\definetextfontsizexi{%
1951
% Text fonts (11.2pt, magstep1).
1952
\def\textnominalsize{11pt}
1953
\edef\mainmagstep{\magstephalf}
1954
\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1955
\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1956
\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1957
\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1958
\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1959
\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1960
\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1961
\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1962
\font\texti=cmmi10 scaled \mainmagstep
1963
\font\textsy=cmsy10 scaled \mainmagstep
1964
\def\textecsize{1095}
1965
 
1966
% A few fonts for @defun names and args.
1967
\setfont\defbf\bfshape{10}{\magstep1}{OT1}
1968
\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1969
\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1970
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1971
 
1972
% Fonts for indices, footnotes, small examples (9pt).
1973
\def\smallnominalsize{9pt}
1974
\setfont\smallrm\rmshape{9}{1000}{OT1}
1975
\setfont\smalltt\ttshape{9}{1000}{OT1TT}
1976
\setfont\smallbf\bfshape{10}{900}{OT1}
1977
\setfont\smallit\itshape{9}{1000}{OT1IT}
1978
\setfont\smallsl\slshape{9}{1000}{OT1}
1979
\setfont\smallsf\sfshape{9}{1000}{OT1}
1980
\setfont\smallsc\scshape{10}{900}{OT1}
1981
\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1982
\font\smalli=cmmi9
1983
\font\smallsy=cmsy9
1984
\def\smallecsize{0900}
1985
 
1986
% Fonts for small examples (8pt).
1987
\def\smallernominalsize{8pt}
1988
\setfont\smallerrm\rmshape{8}{1000}{OT1}
1989
\setfont\smallertt\ttshape{8}{1000}{OT1TT}
1990
\setfont\smallerbf\bfshape{10}{800}{OT1}
1991
\setfont\smallerit\itshape{8}{1000}{OT1IT}
1992
\setfont\smallersl\slshape{8}{1000}{OT1}
1993
\setfont\smallersf\sfshape{8}{1000}{OT1}
1994
\setfont\smallersc\scshape{10}{800}{OT1}
1995
\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1996
\font\smalleri=cmmi8
1997
\font\smallersy=cmsy8
1998
\def\smallerecsize{0800}
1999
 
2000
% Fonts for title page (20.4pt):
2001
\def\titlenominalsize{20pt}
2002
\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2003
\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2004
\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2005
\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2006
\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2007
\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2008
\let\titlebf=\titlerm
2009
\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2010
\font\titlei=cmmi12 scaled \magstep3
2011
\font\titlesy=cmsy10 scaled \magstep4
2012
\def\authorrm{\secrm}
2013
\def\authortt{\sectt}
2014
\def\titleecsize{2074}
2015
 
2016
% Chapter (and unnumbered) fonts (17.28pt).
2017
\def\chapnominalsize{17pt}
2018
\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2019
\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2020
\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2021
\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2022
\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2023
\setfont\chapsf\sfbshape{17}{1000}{OT1}
2024
\let\chapbf=\chaprm
2025
\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2026
\font\chapi=cmmi12 scaled \magstep2
2027
\font\chapsy=cmsy10 scaled \magstep3
2028
\def\chapecsize{1728}
2029
 
2030
% Section fonts (14.4pt).
2031
\def\secnominalsize{14pt}
2032
\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2033
\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2034
\setfont\secsl\slbshape{10}{\magstep2}{OT1}
2035
\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2036
\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2037
\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2038
\let\secbf\secrm
2039
\setfont\secsc\scbshape{10}{\magstep2}{OT1}
2040
\font\seci=cmmi12 scaled \magstep1
2041
\font\secsy=cmsy10 scaled \magstep2
2042
\def\sececsize{1440}
2043
 
2044
% Subsection fonts (13.15pt).
2045
\def\ssecnominalsize{13pt}
2046
\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2047
\setfont\ssecit\itbshape{10}{1315}{OT1IT}
2048
\setfont\ssecsl\slbshape{10}{1315}{OT1}
2049
\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2050
\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2051
\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2052
\let\ssecbf\ssecrm
2053
\setfont\ssecsc\scbshape{10}{1315}{OT1}
2054
\font\sseci=cmmi12 scaled \magstephalf
2055
\font\ssecsy=cmsy10 scaled 1315
2056
\def\ssececsize{1200}
2057
 
2058
% Reduced fonts for @acro in text (10pt).
2059
\def\reducednominalsize{10pt}
2060
\setfont\reducedrm\rmshape{10}{1000}{OT1}
2061
\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2062
\setfont\reducedbf\bfshape{10}{1000}{OT1}
2063
\setfont\reducedit\itshape{10}{1000}{OT1IT}
2064
\setfont\reducedsl\slshape{10}{1000}{OT1}
2065
\setfont\reducedsf\sfshape{10}{1000}{OT1}
2066
\setfont\reducedsc\scshape{10}{1000}{OT1}
2067
\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2068
\font\reducedi=cmmi10
2069
\font\reducedsy=cmsy10
2070
\def\reducedecsize{1000}
2071
 
2072
% reset the current fonts
2073
\textfonts
2074
\rm
2075
} % end of 11pt text font size definitions
2076
 
2077
 
2078
% Definitions to make the main text be 10pt Computer Modern, with
2079
% section, chapter, etc., sizes following suit.  This is for the GNU
2080
% Press printing of the Emacs 22 manual.  Maybe other manuals in the
2081
% future.  Used with @smallbook, which sets the leading to 12pt.
2082
%
2083
\def\definetextfontsizex{%
2084
% Text fonts (10pt).
2085
\def\textnominalsize{10pt}
2086
\edef\mainmagstep{1000}
2087
\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2088
\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2089
\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2090
\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2091
\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2092
\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2093
\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2094
\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2095
\font\texti=cmmi10 scaled \mainmagstep
2096
\font\textsy=cmsy10 scaled \mainmagstep
2097
\def\textecsize{1000}
2098
 
2099
% A few fonts for @defun names and args.
2100
\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2101
\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2102
\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2103
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
2104
 
2105
% Fonts for indices, footnotes, small examples (9pt).
2106
\def\smallnominalsize{9pt}
2107
\setfont\smallrm\rmshape{9}{1000}{OT1}
2108
\setfont\smalltt\ttshape{9}{1000}{OT1TT}
2109
\setfont\smallbf\bfshape{10}{900}{OT1}
2110
\setfont\smallit\itshape{9}{1000}{OT1IT}
2111
\setfont\smallsl\slshape{9}{1000}{OT1}
2112
\setfont\smallsf\sfshape{9}{1000}{OT1}
2113
\setfont\smallsc\scshape{10}{900}{OT1}
2114
\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2115
\font\smalli=cmmi9
2116
\font\smallsy=cmsy9
2117
\def\smallecsize{0900}
2118
 
2119
% Fonts for small examples (8pt).
2120
\def\smallernominalsize{8pt}
2121
\setfont\smallerrm\rmshape{8}{1000}{OT1}
2122
\setfont\smallertt\ttshape{8}{1000}{OT1TT}
2123
\setfont\smallerbf\bfshape{10}{800}{OT1}
2124
\setfont\smallerit\itshape{8}{1000}{OT1IT}
2125
\setfont\smallersl\slshape{8}{1000}{OT1}
2126
\setfont\smallersf\sfshape{8}{1000}{OT1}
2127
\setfont\smallersc\scshape{10}{800}{OT1}
2128
\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2129
\font\smalleri=cmmi8
2130
\font\smallersy=cmsy8
2131
\def\smallerecsize{0800}
2132
 
2133
% Fonts for title page (20.4pt):
2134
\def\titlenominalsize{20pt}
2135
\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2136
\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2137
\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2138
\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2139
\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2140
\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2141
\let\titlebf=\titlerm
2142
\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2143
\font\titlei=cmmi12 scaled \magstep3
2144
\font\titlesy=cmsy10 scaled \magstep4
2145
\def\authorrm{\secrm}
2146
\def\authortt{\sectt}
2147
\def\titleecsize{2074}
2148
 
2149
% Chapter fonts (14.4pt).
2150
\def\chapnominalsize{14pt}
2151
\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2152
\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2153
\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2154
\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2155
\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2156
\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2157
\let\chapbf\chaprm
2158
\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2159
\font\chapi=cmmi12 scaled \magstep1
2160
\font\chapsy=cmsy10 scaled \magstep2
2161
\def\chapecsize{1440}
2162
 
2163
% Section fonts (12pt).
2164
\def\secnominalsize{12pt}
2165
\setfont\secrm\rmbshape{12}{1000}{OT1}
2166
\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2167
\setfont\secsl\slbshape{10}{\magstep1}{OT1}
2168
\setfont\sectt\ttbshape{12}{1000}{OT1TT}
2169
\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2170
\setfont\secsf\sfbshape{12}{1000}{OT1}
2171
\let\secbf\secrm
2172
\setfont\secsc\scbshape{10}{\magstep1}{OT1}
2173
\font\seci=cmmi12
2174
\font\secsy=cmsy10 scaled \magstep1
2175
\def\sececsize{1200}
2176
 
2177
% Subsection fonts (10pt).
2178
\def\ssecnominalsize{10pt}
2179
\setfont\ssecrm\rmbshape{10}{1000}{OT1}
2180
\setfont\ssecit\itbshape{10}{1000}{OT1IT}
2181
\setfont\ssecsl\slbshape{10}{1000}{OT1}
2182
\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2183
\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2184
\setfont\ssecsf\sfbshape{10}{1000}{OT1}
2185
\let\ssecbf\ssecrm
2186
\setfont\ssecsc\scbshape{10}{1000}{OT1}
2187
\font\sseci=cmmi10
2188
\font\ssecsy=cmsy10
2189
\def\ssececsize{1000}
2190
 
2191
% Reduced fonts for @acro in text (9pt).
2192
\def\reducednominalsize{9pt}
2193
\setfont\reducedrm\rmshape{9}{1000}{OT1}
2194
\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2195
\setfont\reducedbf\bfshape{10}{900}{OT1}
2196
\setfont\reducedit\itshape{9}{1000}{OT1IT}
2197
\setfont\reducedsl\slshape{9}{1000}{OT1}
2198
\setfont\reducedsf\sfshape{9}{1000}{OT1}
2199
\setfont\reducedsc\scshape{10}{900}{OT1}
2200
\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2201
\font\reducedi=cmmi9
2202
\font\reducedsy=cmsy9
2203
\def\reducedecsize{0900}
2204
 
2205
% reduce space between paragraphs
2206
\divide\parskip by 2
2207
 
2208
% reset the current fonts
2209
\textfonts
2210
\rm
2211
} % end of 10pt text font size definitions
2212
 
2213
 
2214
% We provide the user-level command
2215
%   @fonttextsize 10
2216
% (or 11) to redefine the text font size.  pt is assumed.
2217
%
2218
\def\xword{10}
2219
\def\xiword{11}
2220
%
2221
\parseargdef\fonttextsize{%
2222
  \def\textsizearg{#1}%
2223
  \wlog{doing @fonttextsize \textsizearg}%
2224
  %
2225
  % Set \globaldefs so that documents can use this inside @tex, since
2226
  % makeinfo 4.8 does not support it, but we need it nonetheless.
2227
  %
2228
 \begingroup \globaldefs=1
2229
  \ifx\textsizearg\xword \definetextfontsizex
2230
  \else \ifx\textsizearg\xiword \definetextfontsizexi
2231
  \else
2232
    \errhelp=\EMsimple
2233
    \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2234
  \fi\fi
2235
 \endgroup
2236
}
2237
 
2238
 
2239
% In order for the font changes to affect most math symbols and letters,
2240
% we have to define the \textfont of the standard families.  Since
2241
% texinfo doesn't allow for producing subscripts and superscripts except
2242
% in the main text, we don't bother to reset \scriptfont and
2243
% \scriptscriptfont (which would also require loading a lot more fonts).
2244
%
2245
\def\resetmathfonts{%
2246
  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2247
  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2248
  \textfont\ttfam=\tentt \textfont\sffam=\tensf
2249
}
2250
 
2251
% The font-changing commands redefine the meanings of \tenSTYLE, instead
2252
% of just \STYLE.  We do this because \STYLE needs to also set the
2253
% current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
2254
% \tenSTYLE to set the current font.
2255
%
2256
% Each font-changing command also sets the names \lsize (one size lower)
2257
% and \lllsize (three sizes lower).  These relative commands are used in
2258
% the LaTeX logo and acronyms.
2259
%
2260
% This all needs generalizing, badly.
2261
%
2262
\def\textfonts{%
2263
  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2264
  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2265
  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2266
  \let\tenttsl=\textttsl
2267
  \def\curfontsize{text}%
2268
  \def\lsize{reduced}\def\lllsize{smaller}%
2269
  \resetmathfonts \setleading{\textleading}}
2270
\def\titlefonts{%
2271
  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2272
  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2273
  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2274
  \let\tenttsl=\titlettsl
2275
  \def\curfontsize{title}%
2276
  \def\lsize{chap}\def\lllsize{subsec}%
2277
  \resetmathfonts \setleading{25pt}}
2278
\def\titlefont#1{{\titlefonts\rm #1}}
2279
\def\chapfonts{%
2280
  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2281
  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2282
  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2283
  \let\tenttsl=\chapttsl
2284
  \def\curfontsize{chap}%
2285
  \def\lsize{sec}\def\lllsize{text}%
2286
  \resetmathfonts \setleading{19pt}}
2287
\def\secfonts{%
2288
  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2289
  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2290
  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2291
  \let\tenttsl=\secttsl
2292
  \def\curfontsize{sec}%
2293
  \def\lsize{subsec}\def\lllsize{reduced}%
2294
  \resetmathfonts \setleading{16pt}}
2295
\def\subsecfonts{%
2296
  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2297
  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2298
  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2299
  \let\tenttsl=\ssecttsl
2300
  \def\curfontsize{ssec}%
2301
  \def\lsize{text}\def\lllsize{small}%
2302
  \resetmathfonts \setleading{15pt}}
2303
\let\subsubsecfonts = \subsecfonts
2304
\def\reducedfonts{%
2305
  \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2306
  \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2307
  \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2308
  \let\tenttsl=\reducedttsl
2309
  \def\curfontsize{reduced}%
2310
  \def\lsize{small}\def\lllsize{smaller}%
2311
  \resetmathfonts \setleading{10.5pt}}
2312
\def\smallfonts{%
2313
  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2314
  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2315
  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2316
  \let\tenttsl=\smallttsl
2317
  \def\curfontsize{small}%
2318
  \def\lsize{smaller}\def\lllsize{smaller}%
2319
  \resetmathfonts \setleading{10.5pt}}
2320
\def\smallerfonts{%
2321
  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2322
  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2323
  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2324
  \let\tenttsl=\smallerttsl
2325
  \def\curfontsize{smaller}%
2326
  \def\lsize{smaller}\def\lllsize{smaller}%
2327
  \resetmathfonts \setleading{9.5pt}}
2328
 
2329
% Set the fonts to use with the @small... environments.
2330
\let\smallexamplefonts = \smallfonts
2331
 
2332
% About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
2333
% can fit this many characters:
2334
%   8.5x11=86   smallbook=72  a4=90  a5=69
2335
% If we use \scriptfonts (8pt), then we can fit this many characters:
2336
%   8.5x11=90+  smallbook=80  a4=90+  a5=77
2337
% For me, subjectively, the few extra characters that fit aren't worth
2338
% the additional smallness of 8pt.  So I'm making the default 9pt.
2339
%
2340
% By the way, for comparison, here's what fits with @example (10pt):
2341
%   8.5x11=71  smallbook=60  a4=75  a5=58
2342
%
2343
% I wish the USA used A4 paper.
2344
% --karl, 24jan03.
2345
 
2346
 
2347
% Set up the default fonts, so we can use them for creating boxes.
2348
%
2349
\definetextfontsizexi
2350
 
2351
% Define these so they can be easily changed for other fonts.
2352
\def\angleleft{$\langle$}
2353
\def\angleright{$\rangle$}
2354
 
2355
% Count depth in font-changes, for error checks
2356
\newcount\fontdepth \fontdepth=0
2357
 
2358
% Fonts for short table of contents.
2359
\setfont\shortcontrm\rmshape{12}{1000}{OT1}
2360
\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
2361
\setfont\shortcontsl\slshape{12}{1000}{OT1}
2362
\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2363
 
2364
%% Add scribe-like font environments, plus @l for inline lisp (usually sans
2365
%% serif) and @ii for TeX italic
2366
 
2367
% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
2368
% unless the following character is such as not to need one.
2369
\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
2370
                    \ptexslash\fi\fi\fi}
2371
\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
2372
\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
2373
 
2374
% like \smartslanted except unconditionally uses \ttsl.
2375
% @var is set to this for defun arguments.
2376
\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx}
2377
 
2378
% like \smartslanted except unconditionally use \sl.  We never want
2379
% ttsl for book titles, do we?
2380
\def\cite#1{{\sl #1}\futurelet\next\smartitalicx}
2381
 
2382
\let\i=\smartitalic
2383
\let\slanted=\smartslanted
2384
\let\var=\smartslanted
2385
\let\dfn=\smartslanted
2386
\let\emph=\smartitalic
2387
 
2388
% @b, explicit bold.
2389
\def\b#1{{\bf #1}}
2390
\let\strong=\b
2391
 
2392
% @sansserif, explicit sans.
2393
\def\sansserif#1{{\sf #1}}
2394
 
2395
% We can't just use \exhyphenpenalty, because that only has effect at
2396
% the end of a paragraph.  Restore normal hyphenation at the end of the
2397
% group within which \nohyphenation is presumably called.
2398
%
2399
\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
2400
\def\restorehyphenation{\hyphenchar\font = `- }
2401
 
2402
% Set sfcode to normal for the chars that usually have another value.
2403
% Can't use plain's \frenchspacing because it uses the `\x notation, and
2404
% sometimes \x has an active definition that messes things up.
2405
%
2406
\catcode`@=11
2407
  \def\plainfrenchspacing{%
2408
    \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
2409
    \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
2410
    \def\endofsentencespacefactor{1000}% for @. and friends
2411
  }
2412
  \def\plainnonfrenchspacing{%
2413
    \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2414
    \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2415
    \def\endofsentencespacefactor{3000}% for @. and friends
2416
  }
2417
\catcode`@=\other
2418
\def\endofsentencespacefactor{3000}% default
2419
 
2420
\def\t#1{%
2421
  {\tt \rawbackslash \plainfrenchspacing #1}%
2422
  \null
2423
}
2424
\def\samp#1{`\tclose{#1}'\null}
2425
\setfont\keyrm\rmshape{8}{1000}{OT1}
2426
\font\keysy=cmsy9
2427
\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2428
  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2429
    \vbox{\hrule\kern-0.4pt
2430
     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2431
    \kern-0.4pt\hrule}%
2432
  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2433
\def\key #1{{\nohyphenation \uppercase{#1}}\null}
2434
% The old definition, with no lozenge:
2435
%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
2436
\def\ctrl #1{{\tt \rawbackslash \hat}#1}
2437
 
2438
% @file, @option are the same as @samp.
2439
\let\file=\samp
2440
\let\option=\samp
2441
 
2442
% @code is a modification of @t,
2443
% which makes spaces the same size as normal in the surrounding text.
2444
\def\tclose#1{%
2445
  {%
2446
    % Change normal interword space to be same as for the current font.
2447
    \spaceskip = \fontdimen2\font
2448
    %
2449
    % Switch to typewriter.
2450
    \tt
2451
    %
2452
    % But `\ ' produces the large typewriter interword space.
2453
    \def\ {{\spaceskip = 0pt{} }}%
2454
    %
2455
    % Turn off hyphenation.
2456
    \nohyphenation
2457
    %
2458
    \rawbackslash
2459
    \plainfrenchspacing
2460
    #1%
2461
  }%
2462
  \null
2463
}
2464
 
2465
% We *must* turn on hyphenation at `-' and `_' in @code.
2466
% Otherwise, it is too hard to avoid overfull hboxes
2467
% in the Emacs manual, the Library manual, etc.
2468
 
2469
% Unfortunately, TeX uses one parameter (\hyphenchar) to control
2470
% both hyphenation at - and hyphenation within words.
2471
% We must therefore turn them both off (\tclose does that)
2472
% and arrange explicitly to hyphenate at a dash.
2473
%  -- rms.
2474
{
2475
  \catcode`\-=\active \catcode`\_=\active
2476
  \catcode`\'=\active \catcode`\`=\active
2477
  %
2478
  \global\def\code{\begingroup
2479
    \catcode\rquoteChar=\active \catcode\lquoteChar=\active
2480
    \let'\codequoteright \let`\codequoteleft
2481
    %
2482
    \catcode\dashChar=\active  \catcode\underChar=\active
2483
    \ifallowcodebreaks
2484
     \let-\codedash
2485
     \let_\codeunder
2486
    \else
2487
     \let-\realdash
2488
     \let_\realunder
2489
    \fi
2490
    \codex
2491
  }
2492
}
2493
 
2494
\def\realdash{-}
2495
\def\codedash{-\discretionary{}{}{}}
2496
\def\codeunder{%
2497
  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
2498
  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2499
  % will therefore expand the active definition of _, which is us
2500
  % (inside @code that is), therefore an endless loop.
2501
  \ifusingtt{\ifmmode
2502
               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2503
             \else\normalunderscore \fi
2504
             \discretionary{}{}{}}%
2505
            {\_}%
2506
}
2507
\def\codex #1{\tclose{#1}\endgroup}
2508
 
2509
% An additional complication: the above will allow breaks after, e.g.,
2510
% each of the four underscores in __typeof__.  This is undesirable in
2511
% some manuals, especially if they don't have long identifiers in
2512
% general.  @allowcodebreaks provides a way to control this.
2513
%
2514
\newif\ifallowcodebreaks  \allowcodebreakstrue
2515
 
2516
\def\keywordtrue{true}
2517
\def\keywordfalse{false}
2518
 
2519
\parseargdef\allowcodebreaks{%
2520
  \def\txiarg{#1}%
2521
  \ifx\txiarg\keywordtrue
2522
    \allowcodebreakstrue
2523
  \else\ifx\txiarg\keywordfalse
2524
    \allowcodebreaksfalse
2525
  \else
2526
    \errhelp = \EMsimple
2527
    \errmessage{Unknown @allowcodebreaks option `\txiarg'}%
2528
  \fi\fi
2529
}
2530
 
2531
% @kbd is like @code, except that if the argument is just one @key command,
2532
% then @kbd has no effect.
2533
 
2534
% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2535
%   `example' (@kbd uses ttsl only inside of @example and friends),
2536
%   or `code' (@kbd uses normal tty font always).
2537
\parseargdef\kbdinputstyle{%
2538
  \def\txiarg{#1}%
2539
  \ifx\txiarg\worddistinct
2540
    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2541
  \else\ifx\txiarg\wordexample
2542
    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2543
  \else\ifx\txiarg\wordcode
2544
    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2545
  \else
2546
    \errhelp = \EMsimple
2547
    \errmessage{Unknown @kbdinputstyle option `\txiarg'}%
2548
  \fi\fi\fi
2549
}
2550
\def\worddistinct{distinct}
2551
\def\wordexample{example}
2552
\def\wordcode{code}
2553
 
2554
% Default is `distinct.'
2555
\kbdinputstyle distinct
2556
 
2557
\def\xkey{\key}
2558
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2559
\ifx\one\xkey\ifx\threex\three \key{#2}%
2560
\else{\tclose{\kbdfont\look}}\fi
2561
\else{\tclose{\kbdfont\look}}\fi}
2562
 
2563
% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2564
\let\indicateurl=\code
2565
\let\env=\code
2566
\let\command=\code
2567
 
2568
% @clicksequence{File @click{} Open ...}
2569
\def\clicksequence#1{\begingroup #1\endgroup}
2570
 
2571
% @clickstyle @arrow   (by default)
2572
\parseargdef\clickstyle{\def\click{#1}}
2573
\def\click{\arrow}
2574
 
2575
% @uref (abbreviation for `urlref') takes an optional (comma-separated)
2576
% second argument specifying the text to display and an optional third
2577
% arg as text to display instead of (rather than in addition to) the url
2578
% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
2579
% a hypertex \special here.
2580
%
2581
\def\uref#1{\douref #1,,,\finish}
2582
\def\douref#1,#2,#3,#4\finish{\begingroup
2583
  \unsepspaces
2584
  \pdfurl{#1}%
2585
  \setbox0 = \hbox{\ignorespaces #3}%
2586
  \ifdim\wd0 > 0pt
2587
    \unhbox0 % third arg given, show only that
2588
  \else
2589
    \setbox0 = \hbox{\ignorespaces #2}%
2590
    \ifdim\wd0 > 0pt
2591
      \ifpdf
2592
        \unhbox0             % PDF: 2nd arg given, show only it
2593
      \else
2594
        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
2595
      \fi
2596
    \else
2597
      \code{#1}% only url given, so show it
2598
    \fi
2599
  \fi
2600
  \endlink
2601
\endgroup}
2602
 
2603
% @url synonym for @uref, since that's how everyone uses it.
2604
%
2605
\let\url=\uref
2606
 
2607
% rms does not like angle brackets --karl, 17may97.
2608
% So now @email is just like @uref, unless we are pdf.
2609
%
2610
%\def\email#1{\angleleft{\tt #1}\angleright}
2611
\ifpdf
2612
  \def\email#1{\doemail#1,,\finish}
2613
  \def\doemail#1,#2,#3\finish{\begingroup
2614
    \unsepspaces
2615
    \pdfurl{mailto:#1}%
2616
    \setbox0 = \hbox{\ignorespaces #2}%
2617
    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2618
    \endlink
2619
  \endgroup}
2620
\else
2621
  \let\email=\uref
2622
\fi
2623
 
2624
% Check if we are currently using a typewriter font.  Since all the
2625
% Computer Modern typewriter fonts have zero interword stretch (and
2626
% shrink), and it is reasonable to expect all typewriter fonts to have
2627
% this property, we can check that font parameter.
2628
%
2629
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2630
 
2631
% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
2632
% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2633
%
2634
\def\dmn#1{\thinspace #1}
2635
 
2636
\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
2637
 
2638
% @l was never documented to mean ``switch to the Lisp font'',
2639
% and it is not used as such in any manual I can find.  We need it for
2640
% Polish suppressed-l.  --karl, 22sep96.
2641
%\def\l#1{{\li #1}\null}
2642
 
2643
% Explicit font changes: @r, @sc, undocumented @ii.
2644
\def\r#1{{\rm #1}}              % roman font
2645
\def\sc#1{{\smallcaps#1}}       % smallcaps font
2646
\def\ii#1{{\it #1}}             % italic font
2647
 
2648
% @acronym for "FBI", "NATO", and the like.
2649
% We print this one point size smaller, since it's intended for
2650
% all-uppercase.
2651
%
2652
\def\acronym#1{\doacronym #1,,\finish}
2653
\def\doacronym#1,#2,#3\finish{%
2654
  {\selectfonts\lsize #1}%
2655
  \def\temp{#2}%
2656
  \ifx\temp\empty \else
2657
    \space ({\unsepspaces \ignorespaces \temp \unskip})%
2658
  \fi
2659
}
2660
 
2661
% @abbr for "Comput. J." and the like.
2662
% No font change, but don't do end-of-sentence spacing.
2663
%
2664
\def\abbr#1{\doabbr #1,,\finish}
2665
\def\doabbr#1,#2,#3\finish{%
2666
  {\plainfrenchspacing #1}%
2667
  \def\temp{#2}%
2668
  \ifx\temp\empty \else
2669
    \space ({\unsepspaces \ignorespaces \temp \unskip})%
2670
  \fi
2671
}
2672
 
2673
% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
2674
%
2675
\def\pounds{{\it\$}}
2676
 
2677
% @euro{} comes from a separate font, depending on the current style.
2678
% We use the free feym* fonts from the eurosym package by Henrik
2679
% Theiling, which support regular, slanted, bold and bold slanted (and
2680
% "outlined" (blackboard board, sort of) versions, which we don't need).
2681
% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
2682
%
2683
% Although only regular is the truly official Euro symbol, we ignore
2684
% that.  The Euro is designed to be slightly taller than the regular
2685
% font height.
2686
%
2687
% feymr - regular
2688
% feymo - slanted
2689
% feybr - bold
2690
% feybo - bold slanted
2691
%
2692
% There is no good (free) typewriter version, to my knowledge.
2693
% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
2694
% Hmm.
2695
%
2696
% Also doesn't work in math.  Do we need to do math with euro symbols?
2697
% Hope not.
2698
%
2699
%
2700
\def\euro{{\eurofont e}}
2701
\def\eurofont{%
2702
  % We set the font at each command, rather than predefining it in
2703
  % \textfonts and the other font-switching commands, so that
2704
  % installations which never need the symbol don't have to have the
2705
  % font installed.
2706
  %
2707
  % There is only one designed size (nominal 10pt), so we always scale
2708
  % that to the current nominal size.
2709
  %
2710
  % By the way, simply using "at 1em" works for cmr10 and the like, but
2711
  % does not work for cmbx10 and other extended/shrunken fonts.
2712
  %
2713
  \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
2714
  %
2715
  \ifx\curfontstyle\bfstylename
2716
    % bold:
2717
    \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
2718
  \else
2719
    % regular:
2720
    \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
2721
  \fi
2722
  \thiseurofont
2723
}
2724
 
2725
% Hacks for glyphs from the EC fonts similar to \euro.  We don't
2726
% use \let for the aliases, because sometimes we redefine the original
2727
% macro, and the alias should reflect the redefinition.
2728
\def\guillemetleft{{\ecfont \char"13}}
2729
\def\guillemotleft{\guillemetleft}
2730
\def\guillemetright{{\ecfont \char"14}}
2731
\def\guillemotright{\guillemetright}
2732
\def\guilsinglleft{{\ecfont \char"0E}}
2733
\def\guilsinglright{{\ecfont \char"0F}}
2734
\def\quotedblbase{{\ecfont \char"12}}
2735
\def\quotesinglbase{{\ecfont \char"0D}}
2736
%
2737
\def\ecfont{%
2738
  % We can't distinguish serif/sanserif and italic/slanted, but this
2739
  % is used for crude hacks anyway (like adding French and German
2740
  % quotes to documents typeset with CM, where we lose kerning), so
2741
  % hopefully nobody will notice/care.
2742
  \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
2743
  \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
2744
  \ifx\curfontstyle\bfstylename
2745
    % bold:
2746
    \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
2747
  \else
2748
    % regular:
2749
    \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
2750
  \fi
2751
  \thisecfont
2752
}
2753
 
2754
% @registeredsymbol - R in a circle.  The font for the R should really
2755
% be smaller yet, but lllsize is the best we can do for now.
2756
% Adapted from the plain.tex definition of \copyright.
2757
%
2758
\def\registeredsymbol{%
2759
  $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
2760
               \hfil\crcr\Orb}}%
2761
    }$%
2762
}
2763
 
2764
% @textdegree - the normal degrees sign.
2765
%
2766
\def\textdegree{$^\circ$}
2767
 
2768
% Laurent Siebenmann reports \Orb undefined with:
2769
%  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
2770
% so we'll define it if necessary.
2771
%
2772
\ifx\Orb\undefined
2773
\def\Orb{\mathhexbox20D}
2774
\fi
2775
 
2776
% Quotes.
2777
\chardef\quotedblleft="5C
2778
\chardef\quotedblright=`\"
2779
\chardef\quoteleft=`\`
2780
\chardef\quoteright=`\'
2781
 
2782
 
2783
\message{page headings,}
2784
 
2785
\newskip\titlepagetopglue \titlepagetopglue = 1.5in
2786
\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
2787
 
2788
% First the title page.  Must do @settitle before @titlepage.
2789
\newif\ifseenauthor
2790
\newif\iffinishedtitlepage
2791
 
2792
% Do an implicit @contents or @shortcontents after @end titlepage if the
2793
% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
2794
%
2795
\newif\ifsetcontentsaftertitlepage
2796
 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
2797
\newif\ifsetshortcontentsaftertitlepage
2798
 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
2799
 
2800
\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
2801
        \endgroup\page\hbox{}\page}
2802
 
2803
\envdef\titlepage{%
2804
  % Open one extra group, as we want to close it in the middle of \Etitlepage.
2805
  \begingroup
2806
    \parindent=0pt \textfonts
2807
    % Leave some space at the very top of the page.
2808
    \vglue\titlepagetopglue
2809
    % No rule at page bottom unless we print one at the top with @title.
2810
    \finishedtitlepagetrue
2811
    %
2812
    % Most title ``pages'' are actually two pages long, with space
2813
    % at the top of the second.  We don't want the ragged left on the second.
2814
    \let\oldpage = \page
2815
    \def\page{%
2816
      \iffinishedtitlepage\else
2817
         \finishtitlepage
2818
      \fi
2819
      \let\page = \oldpage
2820
      \page
2821
      \null
2822
    }%
2823
}
2824
 
2825
\def\Etitlepage{%
2826
    \iffinishedtitlepage\else
2827
        \finishtitlepage
2828
    \fi
2829
    % It is important to do the page break before ending the group,
2830
    % because the headline and footline are only empty inside the group.
2831
    % If we use the new definition of \page, we always get a blank page
2832
    % after the title page, which we certainly don't want.
2833
    \oldpage
2834
  \endgroup
2835
  %
2836
  % Need this before the \...aftertitlepage checks so that if they are
2837
  % in effect the toc pages will come out with page numbers.
2838
  \HEADINGSon
2839
  %
2840
  % If they want short, they certainly want long too.
2841
  \ifsetshortcontentsaftertitlepage
2842
    \shortcontents
2843
    \contents
2844
    \global\let\shortcontents = \relax
2845
    \global\let\contents = \relax
2846
  \fi
2847
  %
2848
  \ifsetcontentsaftertitlepage
2849
    \contents
2850
    \global\let\contents = \relax
2851
    \global\let\shortcontents = \relax
2852
  \fi
2853
}
2854
 
2855
\def\finishtitlepage{%
2856
  \vskip4pt \hrule height 2pt width \hsize
2857
  \vskip\titlepagebottomglue
2858
  \finishedtitlepagetrue
2859
}
2860
 
2861
%%% Macros to be used within @titlepage:
2862
 
2863
\let\subtitlerm=\tenrm
2864
\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
2865
 
2866
\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
2867
                \let\tt=\authortt}
2868
 
2869
\parseargdef\title{%
2870
  \checkenv\titlepage
2871
  \leftline{\titlefonts\rm #1}
2872
  % print a rule at the page bottom also.
2873
  \finishedtitlepagefalse
2874
  \vskip4pt \hrule height 4pt width \hsize \vskip4pt
2875
}
2876
 
2877
\parseargdef\subtitle{%
2878
  \checkenv\titlepage
2879
  {\subtitlefont \rightline{#1}}%
2880
}
2881
 
2882
% @author should come last, but may come many times.
2883
% It can also be used inside @quotation.
2884
%
2885
\parseargdef\author{%
2886
  \def\temp{\quotation}%
2887
  \ifx\thisenv\temp
2888
    \def\quotationauthor{#1}% printed in \Equotation.
2889
  \else
2890
    \checkenv\titlepage
2891
    \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
2892
    {\authorfont \leftline{#1}}%
2893
  \fi
2894
}
2895
 
2896
 
2897
%%% Set up page headings and footings.
2898
 
2899
\let\thispage=\folio
2900
 
2901
\newtoks\evenheadline    % headline on even pages
2902
\newtoks\oddheadline     % headline on odd pages
2903
\newtoks\evenfootline    % footline on even pages
2904
\newtoks\oddfootline     % footline on odd pages
2905
 
2906
% Now make TeX use those variables
2907
\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
2908
                            \else \the\evenheadline \fi}}
2909
\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
2910
                            \else \the\evenfootline \fi}\HEADINGShook}
2911
\let\HEADINGShook=\relax
2912
 
2913
% Commands to set those variables.
2914
% For example, this is what  @headings on  does
2915
% @evenheading @thistitle|@thispage|@thischapter
2916
% @oddheading @thischapter|@thispage|@thistitle
2917
% @evenfooting @thisfile||
2918
% @oddfooting ||@thisfile
2919
 
2920
 
2921
\def\evenheading{\parsearg\evenheadingxxx}
2922
\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
2923
\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
2924
\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
2925
 
2926
\def\oddheading{\parsearg\oddheadingxxx}
2927
\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
2928
\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
2929
\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
2930
 
2931
\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
2932
 
2933
\def\evenfooting{\parsearg\evenfootingxxx}
2934
\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
2935
\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
2936
\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
2937
 
2938
\def\oddfooting{\parsearg\oddfootingxxx}
2939
\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
2940
\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
2941
  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
2942
  %
2943
  % Leave some space for the footline.  Hopefully ok to assume
2944
  % @evenfooting will not be used by itself.
2945
  \global\advance\pageheight by -12pt
2946
  \global\advance\vsize by -12pt
2947
}
2948
 
2949
\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
2950
 
2951
% @evenheadingmarks top     \thischapter <- chapter at the top of a page
2952
% @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
2953
%
2954
% The same set of arguments for:
2955
%
2956
% @oddheadingmarks
2957
% @evenfootingmarks
2958
% @oddfootingmarks
2959
% @everyheadingmarks
2960
% @everyfootingmarks
2961
 
2962
\def\evenheadingmarks{\headingmarks{even}{heading}}
2963
\def\oddheadingmarks{\headingmarks{odd}{heading}}
2964
\def\evenfootingmarks{\headingmarks{even}{footing}}
2965
\def\oddfootingmarks{\headingmarks{odd}{footing}}
2966
\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
2967
                          \headingmarks{odd}{heading}{#1} }
2968
\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
2969
                          \headingmarks{odd}{footing}{#1} }
2970
% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
2971
\def\headingmarks#1#2#3 {%
2972
  \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
2973
  \global\expandafter\let\csname get#1#2marks\endcsname \temp
2974
}
2975
 
2976
\everyheadingmarks bottom
2977
\everyfootingmarks bottom
2978
 
2979
% @headings double      turns headings on for double-sided printing.
2980
% @headings single      turns headings on for single-sided printing.
2981
% @headings off         turns them off.
2982
% @headings on          same as @headings double, retained for compatibility.
2983
% @headings after       turns on double-sided headings after this page.
2984
% @headings doubleafter turns on double-sided headings after this page.
2985
% @headings singleafter turns on single-sided headings after this page.
2986
% By default, they are off at the start of a document,
2987
% and turned `on' after @end titlepage.
2988
 
2989
\def\headings #1 {\csname HEADINGS#1\endcsname}
2990
 
2991
\def\HEADINGSoff{%
2992
\global\evenheadline={\hfil} \global\evenfootline={\hfil}
2993
\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
2994
\HEADINGSoff
2995
% When we turn headings on, set the page number to 1.
2996
% For double-sided printing, put current file name in lower left corner,
2997
% chapter name on inside top of right hand pages, document
2998
% title on inside top of left hand pages, and page numbers on outside top
2999
% edge of all pages.
3000
\def\HEADINGSdouble{%
3001
\global\pageno=1
3002
\global\evenfootline={\hfil}
3003
\global\oddfootline={\hfil}
3004
\global\evenheadline={\line{\folio\hfil\thistitle}}
3005
\global\oddheadline={\line{\thischapter\hfil\folio}}
3006
\global\let\contentsalignmacro = \chapoddpage
3007
}
3008
\let\contentsalignmacro = \chappager
3009
 
3010
% For single-sided printing, chapter title goes across top left of page,
3011
% page number on top right.
3012
\def\HEADINGSsingle{%
3013
\global\pageno=1
3014
\global\evenfootline={\hfil}
3015
\global\oddfootline={\hfil}
3016
\global\evenheadline={\line{\thischapter\hfil\folio}}
3017
\global\oddheadline={\line{\thischapter\hfil\folio}}
3018
\global\let\contentsalignmacro = \chappager
3019
}
3020
\def\HEADINGSon{\HEADINGSdouble}
3021
 
3022
\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3023
\let\HEADINGSdoubleafter=\HEADINGSafter
3024
\def\HEADINGSdoublex{%
3025
\global\evenfootline={\hfil}
3026
\global\oddfootline={\hfil}
3027
\global\evenheadline={\line{\folio\hfil\thistitle}}
3028
\global\oddheadline={\line{\thischapter\hfil\folio}}
3029
\global\let\contentsalignmacro = \chapoddpage
3030
}
3031
 
3032
\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3033
\def\HEADINGSsinglex{%
3034
\global\evenfootline={\hfil}
3035
\global\oddfootline={\hfil}
3036
\global\evenheadline={\line{\thischapter\hfil\folio}}
3037
\global\oddheadline={\line{\thischapter\hfil\folio}}
3038
\global\let\contentsalignmacro = \chappager
3039
}
3040
 
3041
% Subroutines used in generating headings
3042
% This produces Day Month Year style of output.
3043
% Only define if not already defined, in case a txi-??.tex file has set
3044
% up a different format (e.g., txi-cs.tex does this).
3045
\ifx\today\undefined
3046
\def\today{%
3047
  \number\day\space
3048
  \ifcase\month
3049
  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3050
  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3051
  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3052
  \fi
3053
  \space\number\year}
3054
\fi
3055
 
3056
% @settitle line...  specifies the title of the document, for headings.
3057
% It generates no output of its own.
3058
\def\thistitle{\putwordNoTitle}
3059
\def\settitle{\parsearg{\gdef\thistitle}}
3060
 
3061
 
3062
\message{tables,}
3063
% Tables -- @table, @ftable, @vtable, @item(x).
3064
 
3065
% default indentation of table text
3066
\newdimen\tableindent \tableindent=.8in
3067
% default indentation of @itemize and @enumerate text
3068
\newdimen\itemindent  \itemindent=.3in
3069
% margin between end of table item and start of table text.
3070
\newdimen\itemmargin  \itemmargin=.1in
3071
 
3072
% used internally for \itemindent minus \itemmargin
3073
\newdimen\itemmax
3074
 
3075
% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3076
% these defs.
3077
% They also define \itemindex
3078
% to index the item name in whatever manner is desired (perhaps none).
3079
 
3080
\newif\ifitemxneedsnegativevskip
3081
 
3082
\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3083
 
3084
\def\internalBitem{\smallbreak \parsearg\itemzzz}
3085
\def\internalBitemx{\itemxpar \parsearg\itemzzz}
3086
 
3087
\def\itemzzz #1{\begingroup %
3088
  \advance\hsize by -\rightskip
3089
  \advance\hsize by -\tableindent
3090
  \setbox0=\hbox{\itemindicate{#1}}%
3091
  \itemindex{#1}%
3092
  \nobreak % This prevents a break before @itemx.
3093
  %
3094
  % If the item text does not fit in the space we have, put it on a line
3095
  % by itself, and do not allow a page break either before or after that
3096
  % line.  We do not start a paragraph here because then if the next
3097
  % command is, e.g., @kindex, the whatsit would get put into the
3098
  % horizontal list on a line by itself, resulting in extra blank space.
3099
  \ifdim \wd0>\itemmax
3100
    %
3101
    % Make this a paragraph so we get the \parskip glue and wrapping,
3102
    % but leave it ragged-right.
3103
    \begingroup
3104
      \advance\leftskip by-\tableindent
3105
      \advance\hsize by\tableindent
3106
      \advance\rightskip by0pt plus1fil
3107
      \leavevmode\unhbox0\par
3108
    \endgroup
3109
    %
3110
    % We're going to be starting a paragraph, but we don't want the
3111
    % \parskip glue -- logically it's part of the @item we just started.
3112
    \nobreak \vskip-\parskip
3113
    %
3114
    % Stop a page break at the \parskip glue coming up.  However, if
3115
    % what follows is an environment such as @example, there will be no
3116
    % \parskip glue; then the negative vskip we just inserted would
3117
    % cause the example and the item to crash together.  So we use this
3118
    % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3119
    % \parskip glue after all.  Section titles are handled this way also.
3120
    %
3121
    \penalty 10001
3122
    \endgroup
3123
    \itemxneedsnegativevskipfalse
3124
  \else
3125
    % The item text fits into the space.  Start a paragraph, so that the
3126
    % following text (if any) will end up on the same line.
3127
    \noindent
3128
    % Do this with kerns and \unhbox so that if there is a footnote in
3129
    % the item text, it can migrate to the main vertical list and
3130
    % eventually be printed.
3131
    \nobreak\kern-\tableindent
3132
    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3133
    \unhbox0
3134
    \nobreak\kern\dimen0
3135
    \endgroup
3136
    \itemxneedsnegativevskiptrue
3137
  \fi
3138
}
3139
 
3140
\def\item{\errmessage{@item while not in a list environment}}
3141
\def\itemx{\errmessage{@itemx while not in a list environment}}
3142
 
3143
% @table, @ftable, @vtable.
3144
\envdef\table{%
3145
  \let\itemindex\gobble
3146
  \tablecheck{table}%
3147
}
3148
\envdef\ftable{%
3149
  \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3150
  \tablecheck{ftable}%
3151
}
3152
\envdef\vtable{%
3153
  \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3154
  \tablecheck{vtable}%
3155
}
3156
\def\tablecheck#1{%
3157
  \ifnum \the\catcode`\^^M=\active
3158
    \endgroup
3159
    \errmessage{This command won't work in this context; perhaps the problem is
3160
      that we are \inenvironment\thisenv}%
3161
    \def\next{\doignore{#1}}%
3162
  \else
3163
    \let\next\tablex
3164
  \fi
3165
  \next
3166
}
3167
\def\tablex#1{%
3168
  \def\itemindicate{#1}%
3169
  \parsearg\tabley
3170
}
3171
\def\tabley#1{%
3172
  {%
3173
    \makevalueexpandable
3174
    \edef\temp{\noexpand\tablez #1\space\space\space}%
3175
    \expandafter
3176
  }\temp \endtablez
3177
}
3178
\def\tablez #1 #2 #3 #4\endtablez{%
3179
  \aboveenvbreak
3180
  \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3181
  \ifnum 0#2>0 \tableindent=#2\mil \fi
3182
  \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3183
  \itemmax=\tableindent
3184
  \advance \itemmax by -\itemmargin
3185
  \advance \leftskip by \tableindent
3186
  \exdentamount=\tableindent
3187
  \parindent = 0pt
3188
  \parskip = \smallskipamount
3189
  \ifdim \parskip=0pt \parskip=2pt \fi
3190
  \let\item = \internalBitem
3191
  \let\itemx = \internalBitemx
3192
}
3193
\def\Etable{\endgraf\afterenvbreak}
3194
\let\Eftable\Etable
3195
\let\Evtable\Etable
3196
\let\Eitemize\Etable
3197
\let\Eenumerate\Etable
3198
 
3199
% This is the counter used by @enumerate, which is really @itemize
3200
 
3201
\newcount \itemno
3202
 
3203
\envdef\itemize{\parsearg\doitemize}
3204
 
3205
\def\doitemize#1{%
3206
  \aboveenvbreak
3207
  \itemmax=\itemindent
3208
  \advance\itemmax by -\itemmargin
3209
  \advance\leftskip by \itemindent
3210
  \exdentamount=\itemindent
3211
  \parindent=0pt
3212
  \parskip=\smallskipamount
3213
  \ifdim\parskip=0pt \parskip=2pt \fi
3214
  \def\itemcontents{#1}%
3215
  % @itemize with no arg is equivalent to @itemize @bullet.
3216
  \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3217
  \let\item=\itemizeitem
3218
}
3219
 
3220
% Definition of @item while inside @itemize and @enumerate.
3221
%
3222
\def\itemizeitem{%
3223
  \advance\itemno by 1  % for enumerations
3224
  {\let\par=\endgraf \smallbreak}% reasonable place to break
3225
  {%
3226
   % If the document has an @itemize directly after a section title, a
3227
   % \nobreak will be last on the list, and \sectionheading will have
3228
   % done a \vskip-\parskip.  In that case, we don't want to zero
3229
   % parskip, or the item text will crash with the heading.  On the
3230
   % other hand, when there is normal text preceding the item (as there
3231
   % usually is), we do want to zero parskip, or there would be too much
3232
   % space.  In that case, we won't have a \nobreak before.  At least
3233
   % that's the theory.
3234
   \ifnum\lastpenalty<10000 \parskip=0in \fi
3235
   \noindent
3236
   \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3237
   \vadjust{\penalty 1200}}% not good to break after first line of item.
3238
  \flushcr
3239
}
3240
 
3241
% \splitoff TOKENS\endmark defines \first to be the first token in
3242
% TOKENS, and \rest to be the remainder.
3243
%
3244
\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3245
 
3246
% Allow an optional argument of an uppercase letter, lowercase letter,
3247
% or number, to specify the first label in the enumerated list.  No
3248
% argument is the same as `1'.
3249
%
3250
\envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
3251
\def\enumeratey #1 #2\endenumeratey{%
3252
  % If we were given no argument, pretend we were given `1'.
3253
  \def\thearg{#1}%
3254
  \ifx\thearg\empty \def\thearg{1}\fi
3255
  %
3256
  % Detect if the argument is a single token.  If so, it might be a
3257
  % letter.  Otherwise, the only valid thing it can be is a number.
3258
  % (We will always have one token, because of the test we just made.
3259
  % This is a good thing, since \splitoff doesn't work given nothing at
3260
  % all -- the first parameter is undelimited.)
3261
  \expandafter\splitoff\thearg\endmark
3262
  \ifx\rest\empty
3263
    % Only one token in the argument.  It could still be anything.
3264
    % A ``lowercase letter'' is one whose \lccode is nonzero.
3265
    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3266
    %   not equal to itself.
3267
    % Otherwise, we assume it's a number.
3268
    %
3269
    % We need the \relax at the end of the \ifnum lines to stop TeX from
3270
    % continuing to look for a <number>.
3271
    %
3272
    \ifnum\lccode\expandafter`\thearg=0\relax
3273
      \numericenumerate % a number (we hope)
3274
    \else
3275
      % It's a letter.
3276
      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3277
        \lowercaseenumerate % lowercase letter
3278
      \else
3279
        \uppercaseenumerate % uppercase letter
3280
      \fi
3281
    \fi
3282
  \else
3283
    % Multiple tokens in the argument.  We hope it's a number.
3284
    \numericenumerate
3285
  \fi
3286
}
3287
 
3288
% An @enumerate whose labels are integers.  The starting integer is
3289
% given in \thearg.
3290
%
3291
\def\numericenumerate{%
3292
  \itemno = \thearg
3293
  \startenumeration{\the\itemno}%
3294
}
3295
 
3296
% The starting (lowercase) letter is in \thearg.
3297
\def\lowercaseenumerate{%
3298
  \itemno = \expandafter`\thearg
3299
  \startenumeration{%
3300
    % Be sure we're not beyond the end of the alphabet.
3301
    \ifnum\itemno=0
3302
      \errmessage{No more lowercase letters in @enumerate; get a bigger
3303
                  alphabet}%
3304
    \fi
3305
    \char\lccode\itemno
3306
  }%
3307
}
3308
 
3309
% The starting (uppercase) letter is in \thearg.
3310
\def\uppercaseenumerate{%
3311
  \itemno = \expandafter`\thearg
3312
  \startenumeration{%
3313
    % Be sure we're not beyond the end of the alphabet.
3314
    \ifnum\itemno=0
3315
      \errmessage{No more uppercase letters in @enumerate; get a bigger
3316
                  alphabet}
3317
    \fi
3318
    \char\uccode\itemno
3319
  }%
3320
}
3321
 
3322
% Call \doitemize, adding a period to the first argument and supplying the
3323
% common last two arguments.  Also subtract one from the initial value in
3324
% \itemno, since @item increments \itemno.
3325
%
3326
\def\startenumeration#1{%
3327
  \advance\itemno by -1
3328
  \doitemize{#1.}\flushcr
3329
}
3330
 
3331
% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3332
% to @enumerate.
3333
%
3334
\def\alphaenumerate{\enumerate{a}}
3335
\def\capsenumerate{\enumerate{A}}
3336
\def\Ealphaenumerate{\Eenumerate}
3337
\def\Ecapsenumerate{\Eenumerate}
3338
 
3339
 
3340
% @multitable macros
3341
% Amy Hendrickson, 8/18/94, 3/6/96
3342
%
3343
% @multitable ... @end multitable will make as many columns as desired.
3344
% Contents of each column will wrap at width given in preamble.  Width
3345
% can be specified either with sample text given in a template line,
3346
% or in percent of \hsize, the current width of text on page.
3347
 
3348
% Table can continue over pages but will only break between lines.
3349
 
3350
% To make preamble:
3351
%
3352
% Either define widths of columns in terms of percent of \hsize:
3353
%   @multitable @columnfractions .25 .3 .45
3354
%   @item ...
3355
%
3356
%   Numbers following @columnfractions are the percent of the total
3357
%   current hsize to be used for each column. You may use as many
3358
%   columns as desired.
3359
 
3360
 
3361
% Or use a template:
3362
%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3363
%   @item ...
3364
%   using the widest term desired in each column.
3365
 
3366
% Each new table line starts with @item, each subsequent new column
3367
% starts with @tab. Empty columns may be produced by supplying @tab's
3368
% with nothing between them for as many times as empty columns are needed,
3369
% ie, @tab@tab@tab will produce two empty columns.
3370
 
3371
% @item, @tab do not need to be on their own lines, but it will not hurt
3372
% if they are.
3373
 
3374
% Sample multitable:
3375
 
3376
%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3377
%   @item first col stuff @tab second col stuff @tab third col
3378
%   @item
3379
%   first col stuff
3380
%   @tab
3381
%   second col stuff
3382
%   @tab
3383
%   third col
3384
%   @item first col stuff @tab second col stuff
3385
%   @tab Many paragraphs of text may be used in any column.
3386
%
3387
%         They will wrap at the width determined by the template.
3388
%   @item@tab@tab This will be in third column.
3389
%   @end multitable
3390
 
3391
% Default dimensions may be reset by user.
3392
% @multitableparskip is vertical space between paragraphs in table.
3393
% @multitableparindent is paragraph indent in table.
3394
% @multitablecolmargin is horizontal space to be left between columns.
3395
% @multitablelinespace is space to leave between table items, baseline
3396
%                                                            to baseline.
3397
%   0pt means it depends on current normal line spacing.
3398
%
3399
\newskip\multitableparskip
3400
\newskip\multitableparindent
3401
\newdimen\multitablecolspace
3402
\newskip\multitablelinespace
3403
\multitableparskip=0pt
3404
\multitableparindent=6pt
3405
\multitablecolspace=12pt
3406
\multitablelinespace=0pt
3407
 
3408
% Macros used to set up halign preamble:
3409
%
3410
\let\endsetuptable\relax
3411
\def\xendsetuptable{\endsetuptable}
3412
\let\columnfractions\relax
3413
\def\xcolumnfractions{\columnfractions}
3414
\newif\ifsetpercent
3415
 
3416
% #1 is the @columnfraction, usually a decimal number like .5, but might
3417
% be just 1.  We just use it, whatever it is.
3418
%
3419
\def\pickupwholefraction#1 {%
3420
  \global\advance\colcount by 1
3421
  \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3422
  \setuptable
3423
}
3424
 
3425
\newcount\colcount
3426
\def\setuptable#1{%
3427
  \def\firstarg{#1}%
3428
  \ifx\firstarg\xendsetuptable
3429
    \let\go = \relax
3430
  \else
3431
    \ifx\firstarg\xcolumnfractions
3432
      \global\setpercenttrue
3433
    \else
3434
      \ifsetpercent
3435
         \let\go\pickupwholefraction
3436
      \else
3437
         \global\advance\colcount by 1
3438
         \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3439
                   % separator; typically that is always in the input, anyway.
3440
         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3441
      \fi
3442
    \fi
3443
    \ifx\go\pickupwholefraction
3444
      % Put the argument back for the \pickupwholefraction call, so
3445
      % we'll always have a period there to be parsed.
3446
      \def\go{\pickupwholefraction#1}%
3447
    \else
3448
      \let\go = \setuptable
3449
    \fi%
3450
  \fi
3451
  \go
3452
}
3453
 
3454
% multitable-only commands.
3455
%
3456
% @headitem starts a heading row, which we typeset in bold.
3457
% Assignments have to be global since we are inside the implicit group
3458
% of an alignment entry.  Note that \everycr resets \everytab.
3459
\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}%
3460
%
3461
% A \tab used to include \hskip1sp.  But then the space in a template
3462
% line is not enough.  That is bad.  So let's go back to just `&' until
3463
% we encounter the problem it was intended to solve again.
3464
%                                       --karl, nathan@acm.org, 20apr99.
3465
\def\tab{\checkenv\multitable &\the\everytab}%
3466
 
3467
% @multitable ... @end multitable definitions:
3468
%
3469
\newtoks\everytab  % insert after every tab.
3470
%
3471
\envdef\multitable{%
3472
  \vskip\parskip
3473
  \startsavinginserts
3474
  %
3475
  % @item within a multitable starts a normal row.
3476
  % We use \def instead of \let so that if one of the multitable entries
3477
  % contains an @itemize, we don't choke on the \item (seen as \crcr aka
3478
  % \endtemplate) expanding \doitemize.
3479
  \def\item{\crcr}%
3480
  %
3481
  \tolerance=9500
3482
  \hbadness=9500
3483
  \setmultitablespacing
3484
  \parskip=\multitableparskip
3485
  \parindent=\multitableparindent
3486
  \overfullrule=0pt
3487
  \global\colcount=0
3488
  %
3489
  \everycr = {%
3490
    \noalign{%
3491
      \global\everytab={}%
3492
      \global\colcount=0 % Reset the column counter.
3493
      % Check for saved footnotes, etc.
3494
      \checkinserts
3495
      % Keeps underfull box messages off when table breaks over pages.
3496
      %\filbreak
3497
        % Maybe so, but it also creates really weird page breaks when the
3498
        % table breaks over pages. Wouldn't \vfil be better?  Wait until the
3499
        % problem manifests itself, so it can be fixed for real --karl.
3500
    }%
3501
  }%
3502
  %
3503
  \parsearg\domultitable
3504
}
3505
\def\domultitable#1{%
3506
  % To parse everything between @multitable and @item:
3507
  \setuptable#1 \endsetuptable
3508
  %
3509
  % This preamble sets up a generic column definition, which will
3510
  % be used as many times as user calls for columns.
3511
  % \vtop will set a single line and will also let text wrap and
3512
  % continue for many paragraphs if desired.
3513
  \halign\bgroup &%
3514
    \global\advance\colcount by 1
3515
    \multistrut
3516
    \vtop{%
3517
      % Use the current \colcount to find the correct column width:
3518
      \hsize=\expandafter\csname col\the\colcount\endcsname
3519
      %
3520
      % In order to keep entries from bumping into each other
3521
      % we will add a \leftskip of \multitablecolspace to all columns after
3522
      % the first one.
3523
      %
3524
      % If a template has been used, we will add \multitablecolspace
3525
      % to the width of each template entry.
3526
      %
3527
      % If the user has set preamble in terms of percent of \hsize we will
3528
      % use that dimension as the width of the column, and the \leftskip
3529
      % will keep entries from bumping into each other.  Table will start at
3530
      % left margin and final column will justify at right margin.
3531
      %
3532
      % Make sure we don't inherit \rightskip from the outer environment.
3533
      \rightskip=0pt
3534
      \ifnum\colcount=1
3535
        % The first column will be indented with the surrounding text.
3536
        \advance\hsize by\leftskip
3537
      \else
3538
        \ifsetpercent \else
3539
          % If user has not set preamble in terms of percent of \hsize
3540
          % we will advance \hsize by \multitablecolspace.
3541
          \advance\hsize by \multitablecolspace
3542
        \fi
3543
       % In either case we will make \leftskip=\multitablecolspace:
3544
      \leftskip=\multitablecolspace
3545
      \fi
3546
      % Ignoring space at the beginning and end avoids an occasional spurious
3547
      % blank line, when TeX decides to break the line at the space before the
3548
      % box from the multistrut, so the strut ends up on a line by itself.
3549
      % For example:
3550
      % @multitable @columnfractions .11 .89
3551
      % @item @code{#}
3552
      % @tab Legal holiday which is valid in major parts of the whole country.
3553
      % Is automatically provided with highlighting sequences respectively
3554
      % marking characters.
3555
      \noindent\ignorespaces##\unskip\multistrut
3556
    }\cr
3557
}
3558
\def\Emultitable{%
3559
  \crcr
3560
  \egroup % end the \halign
3561
  \global\setpercentfalse
3562
}
3563
 
3564
\def\setmultitablespacing{%
3565
  \def\multistrut{\strut}% just use the standard line spacing
3566
  %
3567
  % Compute \multitablelinespace (if not defined by user) for use in
3568
  % \multitableparskip calculation.  We used define \multistrut based on
3569
  % this, but (ironically) that caused the spacing to be off.
3570
  % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
3571
\ifdim\multitablelinespace=0pt
3572
\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
3573
\global\advance\multitablelinespace by-\ht0
3574
\fi
3575
%% Test to see if parskip is larger than space between lines of
3576
%% table. If not, do nothing.
3577
%%        If so, set to same dimension as multitablelinespace.
3578
\ifdim\multitableparskip>\multitablelinespace
3579
\global\multitableparskip=\multitablelinespace
3580
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
3581
                                      %% than skip between lines in the table.
3582
\fi%
3583
\ifdim\multitableparskip=0pt
3584
\global\multitableparskip=\multitablelinespace
3585
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
3586
                                      %% than skip between lines in the table.
3587
\fi}
3588
 
3589
 
3590
\message{conditionals,}
3591
 
3592
% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
3593
% @ifnotxml always succeed.  They currently do nothing; we don't
3594
% attempt to check whether the conditionals are properly nested.  But we
3595
% have to remember that they are conditionals, so that @end doesn't
3596
% attempt to close an environment group.
3597
%
3598
\def\makecond#1{%
3599
  \expandafter\let\csname #1\endcsname = \relax
3600
  \expandafter\let\csname iscond.#1\endcsname = 1
3601
}
3602
\makecond{iftex}
3603
\makecond{ifnotdocbook}
3604
\makecond{ifnothtml}
3605
\makecond{ifnotinfo}
3606
\makecond{ifnotplaintext}
3607
\makecond{ifnotxml}
3608
 
3609
% Ignore @ignore, @ifhtml, @ifinfo, and the like.
3610
%
3611
\def\direntry{\doignore{direntry}}
3612
\def\documentdescription{\doignore{documentdescription}}
3613
\def\docbook{\doignore{docbook}}
3614
\def\html{\doignore{html}}
3615
\def\ifdocbook{\doignore{ifdocbook}}
3616
\def\ifhtml{\doignore{ifhtml}}
3617
\def\ifinfo{\doignore{ifinfo}}
3618
\def\ifnottex{\doignore{ifnottex}}
3619
\def\ifplaintext{\doignore{ifplaintext}}
3620
\def\ifxml{\doignore{ifxml}}
3621
\def\ignore{\doignore{ignore}}
3622
\def\menu{\doignore{menu}}
3623
\def\xml{\doignore{xml}}
3624
 
3625
% Ignore text until a line `@end #1', keeping track of nested conditionals.
3626
%
3627
% A count to remember the depth of nesting.
3628
\newcount\doignorecount
3629
 
3630
\def\doignore#1{\begingroup
3631
  % Scan in ``verbatim'' mode:
3632
  \obeylines
3633
  \catcode`\@ = \other
3634
  \catcode`\{ = \other
3635
  \catcode`\} = \other
3636
  %
3637
  % Make sure that spaces turn into tokens that match what \doignoretext wants.
3638
  \spaceisspace
3639
  %
3640
  % Count number of #1's that we've seen.
3641
  \doignorecount = 0
3642
  %
3643
  % Swallow text until we reach the matching `@end #1'.
3644
  \dodoignore{#1}%
3645
}
3646
 
3647
{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
3648
  \obeylines %
3649
  %
3650
  \gdef\dodoignore#1{%
3651
    % #1 contains the command name as a string, e.g., `ifinfo'.
3652
    %
3653
    % Define a command to find the next `@end #1'.
3654
    \long\def\doignoretext##1^^M@end #1{%
3655
      \doignoretextyyy##1^^M@#1\_STOP_}%
3656
    %
3657
    % And this command to find another #1 command, at the beginning of a
3658
    % line.  (Otherwise, we would consider a line `@c @ifset', for
3659
    % example, to count as an @ifset for nesting.)
3660
    \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
3661
    %
3662
    % And now expand that command.
3663
    \doignoretext ^^M%
3664
  }%
3665
}
3666
 
3667
\def\doignoreyyy#1{%
3668
  \def\temp{#1}%
3669
  \ifx\temp\empty                       % Nothing found.
3670
    \let\next\doignoretextzzz
3671
  \else                                 % Found a nested condition, ...
3672
    \advance\doignorecount by 1
3673
    \let\next\doignoretextyyy           % ..., look for another.
3674
    % If we're here, #1 ends with ^^M\ifinfo (for example).
3675
  \fi
3676
  \next #1% the token \_STOP_ is present just after this macro.
3677
}
3678
 
3679
% We have to swallow the remaining "\_STOP_".
3680
%
3681
\def\doignoretextzzz#1{%
3682
  \ifnum\doignorecount = 0      % We have just found the outermost @end.
3683
    \let\next\enddoignore
3684
  \else                         % Still inside a nested condition.
3685
    \advance\doignorecount by -1
3686
    \let\next\doignoretext      % Look for the next @end.
3687
  \fi
3688
  \next
3689
}
3690
 
3691
% Finish off ignored text.
3692
{ \obeylines%
3693
  % Ignore anything after the last `@end #1'; this matters in verbatim
3694
  % environments, where otherwise the newline after an ignored conditional
3695
  % would result in a blank line in the output.
3696
  \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
3697
}
3698
 
3699
 
3700
% @set VAR sets the variable VAR to an empty value.
3701
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
3702
%
3703
% Since we want to separate VAR from REST-OF-LINE (which might be
3704
% empty), we can't just use \parsearg; we have to insert a space of our
3705
% own to delimit the rest of the line, and then take it out again if we
3706
% didn't need it.
3707
% We rely on the fact that \parsearg sets \catcode`\ =10.
3708
%
3709
\parseargdef\set{\setyyy#1 \endsetyyy}
3710
\def\setyyy#1 #2\endsetyyy{%
3711
  {%
3712
    \makevalueexpandable
3713
    \def\temp{#2}%
3714
    \edef\next{\gdef\makecsname{SET#1}}%
3715
    \ifx\temp\empty
3716
      \next{}%
3717
    \else
3718
      \setzzz#2\endsetzzz
3719
    \fi
3720
  }%
3721
}
3722
% Remove the trailing space \setxxx inserted.
3723
\def\setzzz#1 \endsetzzz{\next{#1}}
3724
 
3725
% @clear VAR clears (i.e., unsets) the variable VAR.
3726
%
3727
\parseargdef\clear{%
3728
  {%
3729
    \makevalueexpandable
3730
    \global\expandafter\let\csname SET#1\endcsname=\relax
3731
  }%
3732
}
3733
 
3734
% @value{foo} gets the text saved in variable foo.
3735
\def\value{\begingroup\makevalueexpandable\valuexxx}
3736
\def\valuexxx#1{\expandablevalue{#1}\endgroup}
3737
{
3738
  \catcode`\- = \active \catcode`\_ = \active
3739
  %
3740
  \gdef\makevalueexpandable{%
3741
    \let\value = \expandablevalue
3742
    % We don't want these characters active, ...
3743
    \catcode`\-=\other \catcode`\_=\other
3744
    % ..., but we might end up with active ones in the argument if
3745
    % we're called from @code, as @code{@value{foo-bar_}}, though.
3746
    % So \let them to their normal equivalents.
3747
    \let-\realdash \let_\normalunderscore
3748
  }
3749
}
3750
 
3751
% We have this subroutine so that we can handle at least some @value's
3752
% properly in indexes (we call \makevalueexpandable in \indexdummies).
3753
% The command has to be fully expandable (if the variable is set), since
3754
% the result winds up in the index file.  This means that if the
3755
% variable's value contains other Texinfo commands, it's almost certain
3756
% it will fail (although perhaps we could fix that with sufficient work
3757
% to do a one-level expansion on the result, instead of complete).
3758
%
3759
\def\expandablevalue#1{%
3760
  \expandafter\ifx\csname SET#1\endcsname\relax
3761
    {[No value for ``#1'']}%
3762
    \message{Variable `#1', used in @value, is not set.}%
3763
  \else
3764
    \csname SET#1\endcsname
3765
  \fi
3766
}
3767
 
3768
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
3769
% with @set.
3770
%
3771
% To get special treatment of `@end ifset,' call \makeond and the redefine.
3772
%
3773
\makecond{ifset}
3774
\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
3775
\def\doifset#1#2{%
3776
  {%
3777
    \makevalueexpandable
3778
    \let\next=\empty
3779
    \expandafter\ifx\csname SET#2\endcsname\relax
3780
      #1% If not set, redefine \next.
3781
    \fi
3782
    \expandafter
3783
  }\next
3784
}
3785
\def\ifsetfail{\doignore{ifset}}
3786
 
3787
% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
3788
% defined with @set, or has been undefined with @clear.
3789
%
3790
% The `\else' inside the `\doifset' parameter is a trick to reuse the
3791
% above code: if the variable is not set, do nothing, if it is set,
3792
% then redefine \next to \ifclearfail.
3793
%
3794
\makecond{ifclear}
3795
\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
3796
\def\ifclearfail{\doignore{ifclear}}
3797
 
3798
% @dircategory CATEGORY  -- specify a category of the dir file
3799
% which this file should belong to.  Ignore this in TeX.
3800
\let\dircategory=\comment
3801
 
3802
% @defininfoenclose.
3803
\let\definfoenclose=\comment
3804
 
3805
 
3806
\message{indexing,}
3807
% Index generation facilities
3808
 
3809
% Define \newwrite to be identical to plain tex's \newwrite
3810
% except not \outer, so it can be used within macros and \if's.
3811
\edef\newwrite{\makecsname{ptexnewwrite}}
3812
 
3813
% \newindex {foo} defines an index named foo.
3814
% It automatically defines \fooindex such that
3815
% \fooindex ...rest of line... puts an entry in the index foo.
3816
% It also defines \fooindfile to be the number of the output channel for
3817
% the file that accumulates this index.  The file's extension is foo.
3818
% The name of an index should be no more than 2 characters long
3819
% for the sake of vms.
3820
%
3821
\def\newindex#1{%
3822
  \iflinks
3823
    \expandafter\newwrite \csname#1indfile\endcsname
3824
    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
3825
  \fi
3826
  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
3827
    \noexpand\doindex{#1}}
3828
}
3829
 
3830
% @defindex foo  ==  \newindex{foo}
3831
%
3832
\def\defindex{\parsearg\newindex}
3833
 
3834
% Define @defcodeindex, like @defindex except put all entries in @code.
3835
%
3836
\def\defcodeindex{\parsearg\newcodeindex}
3837
%
3838
\def\newcodeindex#1{%
3839
  \iflinks
3840
    \expandafter\newwrite \csname#1indfile\endcsname
3841
    \openout \csname#1indfile\endcsname \jobname.#1
3842
  \fi
3843
  \expandafter\xdef\csname#1index\endcsname{%
3844
    \noexpand\docodeindex{#1}}%
3845
}
3846
 
3847
 
3848
% @synindex foo bar    makes index foo feed into index bar.
3849
% Do this instead of @defindex foo if you don't want it as a separate index.
3850
%
3851
% @syncodeindex foo bar   similar, but put all entries made for index foo
3852
% inside @code.
3853
%
3854
\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
3855
\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
3856
 
3857
% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
3858
% #3 the target index (bar).
3859
\def\dosynindex#1#2#3{%
3860
  % Only do \closeout if we haven't already done it, else we'll end up
3861
  % closing the target index.
3862
  \expandafter \ifx\csname donesynindex#2\endcsname \undefined
3863
    % The \closeout helps reduce unnecessary open files; the limit on the
3864
    % Acorn RISC OS is a mere 16 files.
3865
    \expandafter\closeout\csname#2indfile\endcsname
3866
    \expandafter\let\csname\donesynindex#2\endcsname = 1
3867
  \fi
3868
  % redefine \fooindfile:
3869
  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
3870
  \expandafter\let\csname#2indfile\endcsname=\temp
3871
  % redefine \fooindex:
3872
  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
3873
}
3874
 
3875
% Define \doindex, the driver for all \fooindex macros.
3876
% Argument #1 is generated by the calling \fooindex macro,
3877
%  and it is "foo", the name of the index.
3878
 
3879
% \doindex just uses \parsearg; it calls \doind for the actual work.
3880
% This is because \doind is more useful to call from other macros.
3881
 
3882
% There is also \dosubind {index}{topic}{subtopic}
3883
% which makes an entry in a two-level index such as the operation index.
3884
 
3885
\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
3886
\def\singleindexer #1{\doind{\indexname}{#1}}
3887
 
3888
% like the previous two, but they put @code around the argument.
3889
\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
3890
\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
3891
 
3892
% Take care of Texinfo commands that can appear in an index entry.
3893
% Since there are some commands we want to expand, and others we don't,
3894
% we have to laboriously prevent expansion for those that we don't.
3895
%
3896
\def\indexdummies{%
3897
  \escapechar = `\\     % use backslash in output files.
3898
  \def\@{@}% change to @@ when we switch to @ as escape char in index files.
3899
  \def\ {\realbackslash\space }%
3900
  %
3901
  % Need these in case \tex is in effect and \{ is a \delimiter again.
3902
  % But can't use \lbracecmd and \rbracecmd because texindex assumes
3903
  % braces and backslashes are used only as delimiters.
3904
  \let\{ = \mylbrace
3905
  \let\} = \myrbrace
3906
  %
3907
  % I don't entirely understand this, but when an index entry is
3908
  % generated from a macro call, the \endinput which \scanmacro inserts
3909
  % causes processing to be prematurely terminated.  This is,
3910
  % apparently, because \indexsorttmp is fully expanded, and \endinput
3911
  % is an expandable command.  The redefinition below makes \endinput
3912
  % disappear altogether for that purpose -- although logging shows that
3913
  % processing continues to some further point.  On the other hand, it
3914
  % seems \endinput does not hurt in the printed index arg, since that
3915
  % is still getting written without apparent harm.
3916
  %
3917
  % Sample source (mac-idx3.tex, reported by Graham Percival to
3918
  % help-texinfo, 22may06):
3919
  % @macro funindex {WORD}
3920
  % @findex xyz
3921
  % @end macro
3922
  % ...
3923
  % @funindex commtest
3924
  %
3925
  % The above is not enough to reproduce the bug, but it gives the flavor.
3926
  %
3927
  % Sample whatsit resulting:
3928
  % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
3929
  %
3930
  % So:
3931
  \let\endinput = \empty
3932
  %
3933
  % Do the redefinitions.
3934
  \commondummies
3935
}
3936
 
3937
% For the aux and toc files, @ is the escape character.  So we want to
3938
% redefine everything using @ as the escape character (instead of
3939
% \realbackslash, still used for index files).  When everything uses @,
3940
% this will be simpler.
3941
%
3942
\def\atdummies{%
3943
  \def\@{@@}%
3944
  \def\ {@ }%
3945
  \let\{ = \lbraceatcmd
3946
  \let\} = \rbraceatcmd
3947
  %
3948
  % Do the redefinitions.
3949
  \commondummies
3950
  \otherbackslash
3951
}
3952
 
3953
% Called from \indexdummies and \atdummies.
3954
%
3955
\def\commondummies{%
3956
  %
3957
  % \definedummyword defines \#1 as \string\#1\space, thus effectively
3958
  % preventing its expansion.  This is used only for control% words,
3959
  % not control letters, because the \space would be incorrect for
3960
  % control characters, but is needed to separate the control word
3961
  % from whatever follows.
3962
  %
3963
  % For control letters, we have \definedummyletter, which omits the
3964
  % space.
3965
  %
3966
  % These can be used both for control words that take an argument and
3967
  % those that do not.  If it is followed by {arg} in the input, then
3968
  % that will dutifully get written to the index (or wherever).
3969
  %
3970
  \def\definedummyword  ##1{\def##1{\string##1\space}}%
3971
  \def\definedummyletter##1{\def##1{\string##1}}%
3972
  \let\definedummyaccent\definedummyletter
3973
  %
3974
  \commondummiesnofonts
3975
  %
3976
  \definedummyletter\_%
3977
  %
3978
  % Non-English letters.
3979
  \definedummyword\AA
3980
  \definedummyword\AE
3981
  \definedummyword\L
3982
  \definedummyword\OE
3983
  \definedummyword\O
3984
  \definedummyword\aa
3985
  \definedummyword\ae
3986
  \definedummyword\l
3987
  \definedummyword\oe
3988
  \definedummyword\o
3989
  \definedummyword\ss
3990
  \definedummyword\exclamdown
3991
  \definedummyword\questiondown
3992
  \definedummyword\ordf
3993
  \definedummyword\ordm
3994
  %
3995
  % Although these internal commands shouldn't show up, sometimes they do.
3996
  \definedummyword\bf
3997
  \definedummyword\gtr
3998
  \definedummyword\hat
3999
  \definedummyword\less
4000
  \definedummyword\sf
4001
  \definedummyword\sl
4002
  \definedummyword\tclose
4003
  \definedummyword\tt
4004
  %
4005
  \definedummyword\LaTeX
4006
  \definedummyword\TeX
4007
  %
4008
  % Assorted special characters.
4009
  \definedummyword\bullet
4010
  \definedummyword\comma
4011
  \definedummyword\copyright
4012
  \definedummyword\registeredsymbol
4013
  \definedummyword\dots
4014
  \definedummyword\enddots
4015
  \definedummyword\equiv
4016
  \definedummyword\error
4017
  \definedummyword\euro
4018
  \definedummyword\guillemetleft
4019
  \definedummyword\guillemetright
4020
  \definedummyword\guilsinglleft
4021
  \definedummyword\guilsinglright
4022
  \definedummyword\expansion
4023
  \definedummyword\minus
4024
  \definedummyword\pounds
4025
  \definedummyword\point
4026
  \definedummyword\print
4027
  \definedummyword\quotedblbase
4028
  \definedummyword\quotedblleft
4029
  \definedummyword\quotedblright
4030
  \definedummyword\quoteleft
4031
  \definedummyword\quoteright
4032
  \definedummyword\quotesinglbase
4033
  \definedummyword\result
4034
  \definedummyword\textdegree
4035
  %
4036
  % We want to disable all macros so that they are not expanded by \write.
4037
  \macrolist
4038
  %
4039
  \normalturnoffactive
4040
  %
4041
  % Handle some cases of @value -- where it does not contain any
4042
  % (non-fully-expandable) commands.
4043
  \makevalueexpandable
4044
}
4045
 
4046
% \commondummiesnofonts: common to \commondummies and \indexnofonts.
4047
%
4048
\def\commondummiesnofonts{%
4049
  % Control letters and accents.
4050
  \definedummyletter\!%
4051
  \definedummyaccent\"%
4052
  \definedummyaccent\'%
4053
  \definedummyletter\*%
4054
  \definedummyaccent\,%
4055
  \definedummyletter\.%
4056
  \definedummyletter\/%
4057
  \definedummyletter\:%
4058
  \definedummyaccent\=%
4059
  \definedummyletter\?%
4060
  \definedummyaccent\^%
4061
  \definedummyaccent\`%
4062
  \definedummyaccent\~%
4063
  \definedummyword\u
4064
  \definedummyword\v
4065
  \definedummyword\H
4066
  \definedummyword\dotaccent
4067
  \definedummyword\ringaccent
4068
  \definedummyword\tieaccent
4069
  \definedummyword\ubaraccent
4070
  \definedummyword\udotaccent
4071
  \definedummyword\dotless
4072
  %
4073
  % Texinfo font commands.
4074
  \definedummyword\b
4075
  \definedummyword\i
4076
  \definedummyword\r
4077
  \definedummyword\sc
4078
  \definedummyword\t
4079
  %
4080
  % Commands that take arguments.
4081
  \definedummyword\acronym
4082
  \definedummyword\cite
4083
  \definedummyword\code
4084
  \definedummyword\command
4085
  \definedummyword\dfn
4086
  \definedummyword\emph
4087
  \definedummyword\env
4088
  \definedummyword\file
4089
  \definedummyword\kbd
4090
  \definedummyword\key
4091
  \definedummyword\math
4092
  \definedummyword\option
4093
  \definedummyword\pxref
4094
  \definedummyword\ref
4095
  \definedummyword\samp
4096
  \definedummyword\strong
4097
  \definedummyword\tie
4098
  \definedummyword\uref
4099
  \definedummyword\url
4100
  \definedummyword\var
4101
  \definedummyword\verb
4102
  \definedummyword\w
4103
  \definedummyword\xref
4104
}
4105
 
4106
% \indexnofonts is used when outputting the strings to sort the index
4107
% by, and when constructing control sequence names.  It eliminates all
4108
% control sequences and just writes whatever the best ASCII sort string
4109
% would be for a given command (usually its argument).
4110
%
4111
\def\indexnofonts{%
4112
  % Accent commands should become @asis.
4113
  \def\definedummyaccent##1{\let##1\asis}%
4114
  % We can just ignore other control letters.
4115
  \def\definedummyletter##1{\let##1\empty}%
4116
  % Hopefully, all control words can become @asis.
4117
  \let\definedummyword\definedummyaccent
4118
  %
4119
  \commondummiesnofonts
4120
  %
4121
  % Don't no-op \tt, since it isn't a user-level command
4122
  % and is used in the definitions of the active chars like <, >, |, etc.
4123
  % Likewise with the other plain tex font commands.
4124
  %\let\tt=\asis
4125
  %
4126
  \def\ { }%
4127
  \def\@{@}%
4128
  % how to handle braces?
4129
  \def\_{\normalunderscore}%
4130
  %
4131
  % Non-English letters.
4132
  \def\AA{AA}%
4133
  \def\AE{AE}%
4134
  \def\L{L}%
4135
  \def\OE{OE}%
4136
  \def\O{O}%
4137
  \def\aa{aa}%
4138
  \def\ae{ae}%
4139
  \def\l{l}%
4140
  \def\oe{oe}%
4141
  \def\o{o}%
4142
  \def\ss{ss}%
4143
  \def\exclamdown{!}%
4144
  \def\questiondown{?}%
4145
  \def\ordf{a}%
4146
  \def\ordm{o}%
4147
  %
4148
  \def\LaTeX{LaTeX}%
4149
  \def\TeX{TeX}%
4150
  %
4151
  % Assorted special characters.
4152
  % (The following {} will end up in the sort string, but that's ok.)
4153
  \def\bullet{bullet}%
4154
  \def\comma{,}%
4155
  \def\copyright{copyright}%
4156
  \def\registeredsymbol{R}%
4157
  \def\dots{...}%
4158
  \def\enddots{...}%
4159
  \def\equiv{==}%
4160
  \def\error{error}%
4161
  \def\euro{euro}%
4162
  \def\guillemetleft{<<}%
4163
  \def\guillemetright{>>}%
4164
  \def\guilsinglleft{<}%
4165
  \def\guilsinglright{>}%
4166
  \def\expansion{==>}%
4167
  \def\minus{-}%
4168
  \def\pounds{pounds}%
4169
  \def\point{.}%
4170
  \def\print{-|}%
4171
  \def\quotedblbase{"}%
4172
  \def\quotedblleft{"}%
4173
  \def\quotedblright{"}%
4174
  \def\quoteleft{`}%
4175
  \def\quoteright{'}%
4176
  \def\quotesinglbase{,}%
4177
  \def\result{=>}%
4178
  \def\textdegree{degrees}%
4179
  %
4180
  % We need to get rid of all macros, leaving only the arguments (if present).
4181
  % Of course this is not nearly correct, but it is the best we can do for now.
4182
  % makeinfo does not expand macros in the argument to @deffn, which ends up
4183
  % writing an index entry, and texindex isn't prepared for an index sort entry
4184
  % that starts with \.
4185
  %
4186
  % Since macro invocations are followed by braces, we can just redefine them
4187
  % to take a single TeX argument.  The case of a macro invocation that
4188
  % goes to end-of-line is not handled.
4189
  %
4190
  \macrolist
4191
}
4192
 
4193
\let\indexbackslash=0  %overridden during \printindex.
4194
\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4195
 
4196
% Most index entries go through here, but \dosubind is the general case.
4197
% #1 is the index name, #2 is the entry text.
4198
\def\doind#1#2{\dosubind{#1}{#2}{}}
4199
 
4200
% Workhorse for all \fooindexes.
4201
% #1 is name of index, #2 is stuff to put there, #3 is subentry --
4202
% empty if called from \doind, as we usually are (the main exception
4203
% is with most defuns, which call us directly).
4204
%
4205
\def\dosubind#1#2#3{%
4206
  \iflinks
4207
  {%
4208
    % Store the main index entry text (including the third arg).
4209
    \toks0 = {#2}%
4210
    % If third arg is present, precede it with a space.
4211
    \def\thirdarg{#3}%
4212
    \ifx\thirdarg\empty \else
4213
      \toks0 = \expandafter{\the\toks0 \space #3}%
4214
    \fi
4215
    %
4216
    \edef\writeto{\csname#1indfile\endcsname}%
4217
    %
4218
    \safewhatsit\dosubindwrite
4219
  }%
4220
  \fi
4221
}
4222
 
4223
% Write the entry in \toks0 to the index file:
4224
%
4225
\def\dosubindwrite{%
4226
  % Put the index entry in the margin if desired.
4227
  \ifx\SETmarginindex\relax\else
4228
    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
4229
  \fi
4230
  %
4231
  % Remember, we are within a group.
4232
  \indexdummies % Must do this here, since \bf, etc expand at this stage
4233
  \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
4234
      % so it will be output as is; and it will print as backslash.
4235
  %
4236
  % Process the index entry with all font commands turned off, to
4237
  % get the string to sort by.
4238
  {\indexnofonts
4239
   \edef\temp{\the\toks0}% need full expansion
4240
   \xdef\indexsorttmp{\temp}%
4241
  }%
4242
  %
4243
  % Set up the complete index entry, with both the sort key and
4244
  % the original text, including any font commands.  We write
4245
  % three arguments to \entry to the .?? file (four in the
4246
  % subentry case), texindex reduces to two when writing the .??s
4247
  % sorted result.
4248
  \edef\temp{%
4249
    \write\writeto{%
4250
      \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
4251
  }%
4252
  \temp
4253
}
4254
 
4255
% Take care of unwanted page breaks/skips around a whatsit:
4256
%
4257
% If a skip is the last thing on the list now, preserve it
4258
% by backing up by \lastskip, doing the \write, then inserting
4259
% the skip again.  Otherwise, the whatsit generated by the
4260
% \write or \pdfdest will make \lastskip zero.  The result is that
4261
% sequences like this:
4262
% @end defun
4263
% @tindex whatever
4264
% @defun ...
4265
% will have extra space inserted, because the \medbreak in the
4266
% start of the @defun won't see the skip inserted by the @end of
4267
% the previous defun.
4268
%
4269
% But don't do any of this if we're not in vertical mode.  We
4270
% don't want to do a \vskip and prematurely end a paragraph.
4271
%
4272
% Avoid page breaks due to these extra skips, too.
4273
%
4274
% But wait, there is a catch there:
4275
% We'll have to check whether \lastskip is zero skip.  \ifdim is not
4276
% sufficient for this purpose, as it ignores stretch and shrink parts
4277
% of the skip.  The only way seems to be to check the textual
4278
% representation of the skip.
4279
%
4280
% The following is almost like \def\zeroskipmacro{0.0pt} except that
4281
% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
4282
%
4283
\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
4284
%
4285
\newskip\whatsitskip
4286
\newcount\whatsitpenalty
4287
%
4288
% ..., ready, GO:
4289
%
4290
\def\safewhatsit#1{%
4291
\ifhmode
4292
  #1%
4293
\else
4294
  % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
4295
  \whatsitskip = \lastskip
4296
  \edef\lastskipmacro{\the\lastskip}%
4297
  \whatsitpenalty = \lastpenalty
4298
  %
4299
  % If \lastskip is nonzero, that means the last item was a
4300
  % skip.  And since a skip is discardable, that means this
4301
  % -\whatsitskip glue we're inserting is preceded by a
4302
  % non-discardable item, therefore it is not a potential
4303
  % breakpoint, therefore no \nobreak needed.
4304
  \ifx\lastskipmacro\zeroskipmacro
4305
  \else
4306
    \vskip-\whatsitskip
4307
  \fi
4308
  %
4309
  #1%
4310
  %
4311
  \ifx\lastskipmacro\zeroskipmacro
4312
    % If \lastskip was zero, perhaps the last item was a penalty, and
4313
    % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
4314
    % to re-insert the same penalty (values >10000 are used for various
4315
    % signals); since we just inserted a non-discardable item, any
4316
    % following glue (such as a \parskip) would be a breakpoint.  For example:
4317
    %
4318
    %   @deffn deffn-whatever
4319
    %   @vindex index-whatever
4320
    %   Description.
4321
    % would allow a break between the index-whatever whatsit
4322
    % and the "Description." paragraph.
4323
    \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
4324
  \else
4325
    % On the other hand, if we had a nonzero \lastskip,
4326
    % this make-up glue would be preceded by a non-discardable item
4327
    % (the whatsit from the \write), so we must insert a \nobreak.
4328
    \nobreak\vskip\whatsitskip
4329
  \fi
4330
\fi
4331
}
4332
 
4333
% The index entry written in the file actually looks like
4334
%  \entry {sortstring}{page}{topic}
4335
% or
4336
%  \entry {sortstring}{page}{topic}{subtopic}
4337
% The texindex program reads in these files and writes files
4338
% containing these kinds of lines:
4339
%  \initial {c}
4340
%     before the first topic whose initial is c
4341
%  \entry {topic}{pagelist}
4342
%     for a topic that is used without subtopics
4343
%  \primary {topic}
4344
%     for the beginning of a topic that is used with subtopics
4345
%  \secondary {subtopic}{pagelist}
4346
%     for each subtopic.
4347
 
4348
% Define the user-accessible indexing commands
4349
% @findex, @vindex, @kindex, @cindex.
4350
 
4351
\def\findex {\fnindex}
4352
\def\kindex {\kyindex}
4353
\def\cindex {\cpindex}
4354
\def\vindex {\vrindex}
4355
\def\tindex {\tpindex}
4356
\def\pindex {\pgindex}
4357
 
4358
\def\cindexsub {\begingroup\obeylines\cindexsub}
4359
{\obeylines %
4360
\gdef\cindexsub "#1" #2^^M{\endgroup %
4361
\dosubind{cp}{#2}{#1}}}
4362
 
4363
% Define the macros used in formatting output of the sorted index material.
4364
 
4365
% @printindex causes a particular index (the ??s file) to get printed.
4366
% It does not print any chapter heading (usually an @unnumbered).
4367
%
4368
\parseargdef\printindex{\begingroup
4369
  \dobreak \chapheadingskip{10000}%
4370
  %
4371
  \smallfonts \rm
4372
  \tolerance = 9500
4373
  \plainfrenchspacing
4374
  \everypar = {}% don't want the \kern\-parindent from indentation suppression.
4375
  %
4376
  % See if the index file exists and is nonempty.
4377
  % Change catcode of @ here so that if the index file contains
4378
  % \initial {@}
4379
  % as its first line, TeX doesn't complain about mismatched braces
4380
  % (because it thinks @} is a control sequence).
4381
  \catcode`\@ = 11
4382
  \openin 1 \jobname.#1s
4383
  \ifeof 1
4384
    % \enddoublecolumns gets confused if there is no text in the index,
4385
    % and it loses the chapter title and the aux file entries for the
4386
    % index.  The easiest way to prevent this problem is to make sure
4387
    % there is some text.
4388
    \putwordIndexNonexistent
4389
  \else
4390
    %
4391
    % If the index file exists but is empty, then \openin leaves \ifeof
4392
    % false.  We have to make TeX try to read something from the file, so
4393
    % it can discover if there is anything in it.
4394
    \read 1 to \temp
4395
    \ifeof 1
4396
      \putwordIndexIsEmpty
4397
    \else
4398
      % Index files are almost Texinfo source, but we use \ as the escape
4399
      % character.  It would be better to use @, but that's too big a change
4400
      % to make right now.
4401
      \def\indexbackslash{\backslashcurfont}%
4402
      \catcode`\\ = 0
4403
      \escapechar = `\\
4404
      \begindoublecolumns
4405
      \input \jobname.#1s
4406
      \enddoublecolumns
4407
    \fi
4408
  \fi
4409
  \closein 1
4410
\endgroup}
4411
 
4412
% These macros are used by the sorted index file itself.
4413
% Change them to control the appearance of the index.
4414
 
4415
\def\initial#1{{%
4416
  % Some minor font changes for the special characters.
4417
  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
4418
  %
4419
  % Remove any glue we may have, we'll be inserting our own.
4420
  \removelastskip
4421
  %
4422
  % We like breaks before the index initials, so insert a bonus.
4423
  \nobreak
4424
  \vskip 0pt plus 3\baselineskip
4425
  \penalty 0
4426
  \vskip 0pt plus -3\baselineskip
4427
  %
4428
  % Typeset the initial.  Making this add up to a whole number of
4429
  % baselineskips increases the chance of the dots lining up from column
4430
  % to column.  It still won't often be perfect, because of the stretch
4431
  % we need before each entry, but it's better.
4432
  %
4433
  % No shrink because it confuses \balancecolumns.
4434
  \vskip 1.67\baselineskip plus .5\baselineskip
4435
  \leftline{\secbf #1}%
4436
  % Do our best not to break after the initial.
4437
  \nobreak
4438
  \vskip .33\baselineskip plus .1\baselineskip
4439
}}
4440
 
4441
% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
4442
% then page number (#2) flushed to the right margin.  It is used for index
4443
% and table of contents entries.  The paragraph is indented by \leftskip.
4444
%
4445
% A straightforward implementation would start like this:
4446
%       \def\entry#1#2{...
4447
% But this frozes the catcodes in the argument, and can cause problems to
4448
% @code, which sets - active.  This problem was fixed by a kludge---
4449
% ``-'' was active throughout whole index, but this isn't really right.
4450
%
4451
% The right solution is to prevent \entry from swallowing the whole text.
4452
%                                 --kasal, 21nov03
4453
\def\entry{%
4454
  \begingroup
4455
    %
4456
    % Start a new paragraph if necessary, so our assignments below can't
4457
    % affect previous text.
4458
    \par
4459
    %
4460
    % Do not fill out the last line with white space.
4461
    \parfillskip = 0in
4462
    %
4463
    % No extra space above this paragraph.
4464
    \parskip = 0in
4465
    %
4466
    % Do not prefer a separate line ending with a hyphen to fewer lines.
4467
    \finalhyphendemerits = 0
4468
    %
4469
    % \hangindent is only relevant when the entry text and page number
4470
    % don't both fit on one line.  In that case, bob suggests starting the
4471
    % dots pretty far over on the line.  Unfortunately, a large
4472
    % indentation looks wrong when the entry text itself is broken across
4473
    % lines.  So we use a small indentation and put up with long leaders.
4474
    %
4475
    % \hangafter is reset to 1 (which is the value we want) at the start
4476
    % of each paragraph, so we need not do anything with that.
4477
    \hangindent = 2em
4478
    %
4479
    % When the entry text needs to be broken, just fill out the first line
4480
    % with blank space.
4481
    \rightskip = 0pt plus1fil
4482
    %
4483
    % A bit of stretch before each entry for the benefit of balancing
4484
    % columns.
4485
    \vskip 0pt plus1pt
4486
    %
4487
    % Swallow the left brace of the text (first parameter):
4488
    \afterassignment\doentry
4489
    \let\temp =
4490
}
4491
\def\doentry{%
4492
    \bgroup % Instead of the swallowed brace.
4493
      \noindent
4494
      \aftergroup\finishentry
4495
      % And now comes the text of the entry.
4496
}
4497
\def\finishentry#1{%
4498
    % #1 is the page number.
4499
    %
4500
    % The following is kludged to not output a line of dots in the index if
4501
    % there are no page numbers.  The next person who breaks this will be
4502
    % cursed by a Unix daemon.
4503
    \setbox\boxA = \hbox{#1}%
4504
    \ifdim\wd\boxA = 0pt
4505
      \ %
4506
    \else
4507
      %
4508
      % If we must, put the page number on a line of its own, and fill out
4509
      % this line with blank space.  (The \hfil is overwhelmed with the
4510
      % fill leaders glue in \indexdotfill if the page number does fit.)
4511
      \hfil\penalty50
4512
      \null\nobreak\indexdotfill % Have leaders before the page number.
4513
      %
4514
      % The `\ ' here is removed by the implicit \unskip that TeX does as
4515
      % part of (the primitive) \par.  Without it, a spurious underfull
4516
      % \hbox ensues.
4517
      \ifpdf
4518
        \pdfgettoks#1.%
4519
        \ \the\toksA
4520
      \else
4521
        \ #1%
4522
      \fi
4523
    \fi
4524
    \par
4525
  \endgroup
4526
}
4527
 
4528
% Like plain.tex's \dotfill, except uses up at least 1 em.
4529
\def\indexdotfill{\cleaders
4530
  \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
4531
 
4532
\def\primary #1{\line{#1\hfil}}
4533
 
4534
\newskip\secondaryindent \secondaryindent=0.5cm
4535
\def\secondary#1#2{{%
4536
  \parfillskip=0in
4537
  \parskip=0in
4538
  \hangindent=1in
4539
  \hangafter=1
4540
  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
4541
  \ifpdf
4542
    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
4543
  \else
4544
    #2
4545
  \fi
4546
  \par
4547
}}
4548
 
4549
% Define two-column mode, which we use to typeset indexes.
4550
% Adapted from the TeXbook, page 416, which is to say,
4551
% the manmac.tex format used to print the TeXbook itself.
4552
\catcode`\@=11
4553
 
4554
\newbox\partialpage
4555
\newdimen\doublecolumnhsize
4556
 
4557
\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
4558
  % Grab any single-column material above us.
4559
  \output = {%
4560
    %
4561
    % Here is a possibility not foreseen in manmac: if we accumulate a
4562
    % whole lot of material, we might end up calling this \output
4563
    % routine twice in a row (see the doublecol-lose test, which is
4564
    % essentially a couple of indexes with @setchapternewpage off).  In
4565
    % that case we just ship out what is in \partialpage with the normal
4566
    % output routine.  Generally, \partialpage will be empty when this
4567
    % runs and this will be a no-op.  See the indexspread.tex test case.
4568
    \ifvoid\partialpage \else
4569
      \onepageout{\pagecontents\partialpage}%
4570
    \fi
4571
    %
4572
    \global\setbox\partialpage = \vbox{%
4573
      % Unvbox the main output page.
4574
      \unvbox\PAGE
4575
      \kern-\topskip \kern\baselineskip
4576
    }%
4577
  }%
4578
  \eject % run that output routine to set \partialpage
4579
  %
4580
  % Use the double-column output routine for subsequent pages.
4581
  \output = {\doublecolumnout}%
4582
  %
4583
  % Change the page size parameters.  We could do this once outside this
4584
  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
4585
  % format, but then we repeat the same computation.  Repeating a couple
4586
  % of assignments once per index is clearly meaningless for the
4587
  % execution time, so we may as well do it in one place.
4588
  %
4589
  % First we halve the line length, less a little for the gutter between
4590
  % the columns.  We compute the gutter based on the line length, so it
4591
  % changes automatically with the paper format.  The magic constant
4592
  % below is chosen so that the gutter has the same value (well, +-<1pt)
4593
  % as it did when we hard-coded it.
4594
  %
4595
  % We put the result in a separate register, \doublecolumhsize, so we
4596
  % can restore it in \pagesofar, after \hsize itself has (potentially)
4597
  % been clobbered.
4598
  %
4599
  \doublecolumnhsize = \hsize
4600
    \advance\doublecolumnhsize by -.04154\hsize
4601
    \divide\doublecolumnhsize by 2
4602
  \hsize = \doublecolumnhsize
4603
  %
4604
  % Double the \vsize as well.  (We don't need a separate register here,
4605
  % since nobody clobbers \vsize.)
4606
  \vsize = 2\vsize
4607
}
4608
 
4609
% The double-column output routine for all double-column pages except
4610
% the last.
4611
%
4612
\def\doublecolumnout{%
4613
  \splittopskip=\topskip \splitmaxdepth=\maxdepth
4614
  % Get the available space for the double columns -- the normal
4615
  % (undoubled) page height minus any material left over from the
4616
  % previous page.
4617
  \dimen@ = \vsize
4618
  \divide\dimen@ by 2
4619
  \advance\dimen@ by -\ht\partialpage
4620
  %
4621
  % box0 will be the left-hand column, box2 the right.
4622
  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
4623
  \onepageout\pagesofar
4624
  \unvbox255
4625
  \penalty\outputpenalty
4626
}
4627
%
4628
% Re-output the contents of the output page -- any previous material,
4629
% followed by the two boxes we just split, in box0 and box2.
4630
\def\pagesofar{%
4631
  \unvbox\partialpage
4632
  %
4633
  \hsize = \doublecolumnhsize
4634
  \wd0=\hsize \wd2=\hsize
4635
  \hbox to\pagewidth{\box0\hfil\box2}%
4636
}
4637
%
4638
% All done with double columns.
4639
\def\enddoublecolumns{%
4640
  % The following penalty ensures that the page builder is exercised
4641
  % _before_ we change the output routine.  This is necessary in the
4642
  % following situation:
4643
  %
4644
  % The last section of the index consists only of a single entry.
4645
  % Before this section, \pagetotal is less than \pagegoal, so no
4646
  % break occurs before the last section starts.  However, the last
4647
  % section, consisting of \initial and the single \entry, does not
4648
  % fit on the page and has to be broken off.  Without the following
4649
  % penalty the page builder will not be exercised until \eject
4650
  % below, and by that time we'll already have changed the output
4651
  % routine to the \balancecolumns version, so the next-to-last
4652
  % double-column page will be processed with \balancecolumns, which
4653
  % is wrong:  The two columns will go to the main vertical list, with
4654
  % the broken-off section in the recent contributions.  As soon as
4655
  % the output routine finishes, TeX starts reconsidering the page
4656
  % break.  The two columns and the broken-off section both fit on the
4657
  % page, because the two columns now take up only half of the page
4658
  % goal.  When TeX sees \eject from below which follows the final
4659
  % section, it invokes the new output routine that we've set after
4660
  % \balancecolumns below; \onepageout will try to fit the two columns
4661
  % and the final section into the vbox of \pageheight (see
4662
  % \pagebody), causing an overfull box.
4663
  %
4664
  % Note that glue won't work here, because glue does not exercise the
4665
  % page builder, unlike penalties (see The TeXbook, pp. 280-281).
4666
  \penalty0
4667
  %
4668
  \output = {%
4669
    % Split the last of the double-column material.  Leave it on the
4670
    % current page, no automatic page break.
4671
    \balancecolumns
4672
    %
4673
    % If we end up splitting too much material for the current page,
4674
    % though, there will be another page break right after this \output
4675
    % invocation ends.  Having called \balancecolumns once, we do not
4676
    % want to call it again.  Therefore, reset \output to its normal
4677
    % definition right away.  (We hope \balancecolumns will never be
4678
    % called on to balance too much material, but if it is, this makes
4679
    % the output somewhat more palatable.)
4680
    \global\output = {\onepageout{\pagecontents\PAGE}}%
4681
  }%
4682
  \eject
4683
  \endgroup % started in \begindoublecolumns
4684
  %
4685
  % \pagegoal was set to the doubled \vsize above, since we restarted
4686
  % the current page.  We're now back to normal single-column
4687
  % typesetting, so reset \pagegoal to the normal \vsize (after the
4688
  % \endgroup where \vsize got restored).
4689
  \pagegoal = \vsize
4690
}
4691
%
4692
% Called at the end of the double column material.
4693
\def\balancecolumns{%
4694
  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
4695
  \dimen@ = \ht0
4696
  \advance\dimen@ by \topskip
4697
  \advance\dimen@ by-\baselineskip
4698
  \divide\dimen@ by 2 % target to split to
4699
  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
4700
  \splittopskip = \topskip
4701
  % Loop until we get a decent breakpoint.
4702
  {%
4703
    \vbadness = 10000
4704
    \loop
4705
      \global\setbox3 = \copy0
4706
      \global\setbox1 = \vsplit3 to \dimen@
4707
    \ifdim\ht3>\dimen@
4708
      \global\advance\dimen@ by 1pt
4709
    \repeat
4710
  }%
4711
  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
4712
  \setbox0=\vbox to\dimen@{\unvbox1}%
4713
  \setbox2=\vbox to\dimen@{\unvbox3}%
4714
  %
4715
  \pagesofar
4716
}
4717
\catcode`\@ = \other
4718
 
4719
 
4720
\message{sectioning,}
4721
% Chapters, sections, etc.
4722
 
4723
% \unnumberedno is an oxymoron, of course.  But we count the unnumbered
4724
% sections so that we can refer to them unambiguously in the pdf
4725
% outlines by their "section number".  We avoid collisions with chapter
4726
% numbers by starting them at 10000.  (If a document ever has 10000
4727
% chapters, we're in trouble anyway, I'm sure.)
4728
\newcount\unnumberedno \unnumberedno = 10000
4729
\newcount\chapno
4730
\newcount\secno        \secno=0
4731
\newcount\subsecno     \subsecno=0
4732
\newcount\subsubsecno  \subsubsecno=0
4733
 
4734
% This counter is funny since it counts through charcodes of letters A, B, ...
4735
\newcount\appendixno  \appendixno = `\@
4736
%
4737
% \def\appendixletter{\char\the\appendixno}
4738
% We do the following ugly conditional instead of the above simple
4739
% construct for the sake of pdftex, which needs the actual
4740
% letter in the expansion, not just typeset.
4741
%
4742
\def\appendixletter{%
4743
  \ifnum\appendixno=`A A%
4744
  \else\ifnum\appendixno=`B B%
4745
  \else\ifnum\appendixno=`C C%
4746
  \else\ifnum\appendixno=`D D%
4747
  \else\ifnum\appendixno=`E E%
4748
  \else\ifnum\appendixno=`F F%
4749
  \else\ifnum\appendixno=`G G%
4750
  \else\ifnum\appendixno=`H H%
4751
  \else\ifnum\appendixno=`I I%
4752
  \else\ifnum\appendixno=`J J%
4753
  \else\ifnum\appendixno=`K K%
4754
  \else\ifnum\appendixno=`L L%
4755
  \else\ifnum\appendixno=`M M%
4756
  \else\ifnum\appendixno=`N N%
4757
  \else\ifnum\appendixno=`O O%
4758
  \else\ifnum\appendixno=`P P%
4759
  \else\ifnum\appendixno=`Q Q%
4760
  \else\ifnum\appendixno=`R R%
4761
  \else\ifnum\appendixno=`S S%
4762
  \else\ifnum\appendixno=`T T%
4763
  \else\ifnum\appendixno=`U U%
4764
  \else\ifnum\appendixno=`V V%
4765
  \else\ifnum\appendixno=`W W%
4766
  \else\ifnum\appendixno=`X X%
4767
  \else\ifnum\appendixno=`Y Y%
4768
  \else\ifnum\appendixno=`Z Z%
4769
  % The \the is necessary, despite appearances, because \appendixletter is
4770
  % expanded while writing the .toc file.  \char\appendixno is not
4771
  % expandable, thus it is written literally, thus all appendixes come out
4772
  % with the same letter (or @) in the toc without it.
4773
  \else\char\the\appendixno
4774
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
4775
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
4776
 
4777
% Each @chapter defines these (using marks) as the number+name, number
4778
% and name of the chapter.  Page headings and footings can use
4779
% these.  @section does likewise.
4780
\def\thischapter{}
4781
\def\thischapternum{}
4782
\def\thischaptername{}
4783
\def\thissection{}
4784
\def\thissectionnum{}
4785
\def\thissectionname{}
4786
 
4787
\newcount\absseclevel % used to calculate proper heading level
4788
\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
4789
 
4790
% @raisesections: treat @section as chapter, @subsection as section, etc.
4791
\def\raisesections{\global\advance\secbase by -1}
4792
\let\up=\raisesections % original BFox name
4793
 
4794
% @lowersections: treat @chapter as section, @section as subsection, etc.
4795
\def\lowersections{\global\advance\secbase by 1}
4796
\let\down=\lowersections % original BFox name
4797
 
4798
% we only have subsub.
4799
\chardef\maxseclevel = 3
4800
%
4801
% A numbered section within an unnumbered changes to unnumbered too.
4802
% To achive this, remember the "biggest" unnum. sec. we are currently in:
4803
\chardef\unmlevel = \maxseclevel
4804
%
4805
% Trace whether the current chapter is an appendix or not:
4806
% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
4807
\def\chapheadtype{N}
4808
 
4809
% Choose a heading macro
4810
% #1 is heading type
4811
% #2 is heading level
4812
% #3 is text for heading
4813
\def\genhead#1#2#3{%
4814
  % Compute the abs. sec. level:
4815
  \absseclevel=#2
4816
  \advance\absseclevel by \secbase
4817
  % Make sure \absseclevel doesn't fall outside the range:
4818
  \ifnum \absseclevel < 0
4819
    \absseclevel = 0
4820
  \else
4821
    \ifnum \absseclevel > 3
4822
      \absseclevel = 3
4823
    \fi
4824
  \fi
4825
  % The heading type:
4826
  \def\headtype{#1}%
4827
  \if \headtype U%
4828
    \ifnum \absseclevel < \unmlevel
4829
      \chardef\unmlevel = \absseclevel
4830
    \fi
4831
  \else
4832
    % Check for appendix sections:
4833
    \ifnum \absseclevel = 0
4834
      \edef\chapheadtype{\headtype}%
4835
    \else
4836
      \if \headtype A\if \chapheadtype N%
4837
        \errmessage{@appendix... within a non-appendix chapter}%
4838
      \fi\fi
4839
    \fi
4840
    % Check for numbered within unnumbered:
4841
    \ifnum \absseclevel > \unmlevel
4842
      \def\headtype{U}%
4843
    \else
4844
      \chardef\unmlevel = 3
4845
    \fi
4846
  \fi
4847
  % Now print the heading:
4848
  \if \headtype U%
4849
    \ifcase\absseclevel
4850
        \unnumberedzzz{#3}%
4851
    \or \unnumberedseczzz{#3}%
4852
    \or \unnumberedsubseczzz{#3}%
4853
    \or \unnumberedsubsubseczzz{#3}%
4854
    \fi
4855
  \else
4856
    \if \headtype A%
4857
      \ifcase\absseclevel
4858
          \appendixzzz{#3}%
4859
      \or \appendixsectionzzz{#3}%
4860
      \or \appendixsubseczzz{#3}%
4861
      \or \appendixsubsubseczzz{#3}%
4862
      \fi
4863
    \else
4864
      \ifcase\absseclevel
4865
          \chapterzzz{#3}%
4866
      \or \seczzz{#3}%
4867
      \or \numberedsubseczzz{#3}%
4868
      \or \numberedsubsubseczzz{#3}%
4869
      \fi
4870
    \fi
4871
  \fi
4872
  \suppressfirstparagraphindent
4873
}
4874
 
4875
% an interface:
4876
\def\numhead{\genhead N}
4877
\def\apphead{\genhead A}
4878
\def\unnmhead{\genhead U}
4879
 
4880
% @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
4881
% all lower-level sectioning counters to zero.
4882
%
4883
% Also set \chaplevelprefix, which we prepend to @float sequence numbers
4884
% (e.g., figures), q.v.  By default (before any chapter), that is empty.
4885
\let\chaplevelprefix = \empty
4886
%
4887
\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
4888
\def\chapterzzz#1{%
4889
  % section resetting is \global in case the chapter is in a group, such
4890
  % as an @include file.
4891
  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
4892
    \global\advance\chapno by 1
4893
  %
4894
  % Used for \float.
4895
  \gdef\chaplevelprefix{\the\chapno.}%
4896
  \resetallfloatnos
4897
  %
4898
  \message{\putwordChapter\space \the\chapno}%
4899
  %
4900
  % Write the actual heading.
4901
  \chapmacro{#1}{Ynumbered}{\the\chapno}%
4902
  %
4903
  % So @section and the like are numbered underneath this chapter.
4904
  \global\let\section = \numberedsec
4905
  \global\let\subsection = \numberedsubsec
4906
  \global\let\subsubsection = \numberedsubsubsec
4907
}
4908
 
4909
\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz
4910
\def\appendixzzz#1{%
4911
  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
4912
    \global\advance\appendixno by 1
4913
  \gdef\chaplevelprefix{\appendixletter.}%
4914
  \resetallfloatnos
4915
  %
4916
  \def\appendixnum{\putwordAppendix\space \appendixletter}%
4917
  \message{\appendixnum}%
4918
  %
4919
  \chapmacro{#1}{Yappendix}{\appendixletter}%
4920
  %
4921
  \global\let\section = \appendixsec
4922
  \global\let\subsection = \appendixsubsec
4923
  \global\let\subsubsection = \appendixsubsubsec
4924
}
4925
 
4926
\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
4927
\def\unnumberedzzz#1{%
4928
  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
4929
    \global\advance\unnumberedno by 1
4930
  %
4931
  % Since an unnumbered has no number, no prefix for figures.
4932
  \global\let\chaplevelprefix = \empty
4933
  \resetallfloatnos
4934
  %
4935
  % This used to be simply \message{#1}, but TeX fully expands the
4936
  % argument to \message.  Therefore, if #1 contained @-commands, TeX
4937
  % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
4938
  % expanded @cite (which turns out to cause errors because \cite is meant
4939
  % to be executed, not expanded).
4940
  %
4941
  % Anyway, we don't want the fully-expanded definition of @cite to appear
4942
  % as a result of the \message, we just want `@cite' itself.  We use
4943
  % \the<toks register> to achieve this: TeX expands \the<toks> only once,
4944
  % simply yielding the contents of <toks register>.  (We also do this for
4945
  % the toc entries.)
4946
  \toks0 = {#1}%
4947
  \message{(\the\toks0)}%
4948
  %
4949
  \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
4950
  %
4951
  \global\let\section = \unnumberedsec
4952
  \global\let\subsection = \unnumberedsubsec
4953
  \global\let\subsubsection = \unnumberedsubsubsec
4954
}
4955
 
4956
% @centerchap is like @unnumbered, but the heading is centered.
4957
\outer\parseargdef\centerchap{%
4958
  % Well, we could do the following in a group, but that would break
4959
  % an assumption that \chapmacro is called at the outermost level.
4960
  % Thus we are safer this way:         --kasal, 24feb04
4961
  \let\centerparametersmaybe = \centerparameters
4962
  \unnmhead0{#1}%
4963
  \let\centerparametersmaybe = \relax
4964
}
4965
 
4966
% @top is like @unnumbered.
4967
\let\top\unnumbered
4968
 
4969
% Sections.
4970
\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
4971
\def\seczzz#1{%
4972
  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
4973
  \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
4974
}
4975
 
4976
\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz
4977
\def\appendixsectionzzz#1{%
4978
  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
4979
  \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
4980
}
4981
\let\appendixsec\appendixsection
4982
 
4983
\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz
4984
\def\unnumberedseczzz#1{%
4985
  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
4986
  \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
4987
}
4988
 
4989
% Subsections.
4990
\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz
4991
\def\numberedsubseczzz#1{%
4992
  \global\subsubsecno=0  \global\advance\subsecno by 1
4993
  \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
4994
}
4995
 
4996
\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz
4997
\def\appendixsubseczzz#1{%
4998
  \global\subsubsecno=0  \global\advance\subsecno by 1
4999
  \sectionheading{#1}{subsec}{Yappendix}%
5000
                 {\appendixletter.\the\secno.\the\subsecno}%
5001
}
5002
 
5003
\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
5004
\def\unnumberedsubseczzz#1{%
5005
  \global\subsubsecno=0  \global\advance\subsecno by 1
5006
  \sectionheading{#1}{subsec}{Ynothing}%
5007
                 {\the\unnumberedno.\the\secno.\the\subsecno}%
5008
}
5009
 
5010
% Subsubsections.
5011
\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz
5012
\def\numberedsubsubseczzz#1{%
5013
  \global\advance\subsubsecno by 1
5014
  \sectionheading{#1}{subsubsec}{Ynumbered}%
5015
                 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
5016
}
5017
 
5018
\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz
5019
\def\appendixsubsubseczzz#1{%
5020
  \global\advance\subsubsecno by 1
5021
  \sectionheading{#1}{subsubsec}{Yappendix}%
5022
                 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
5023
}
5024
 
5025
\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
5026
\def\unnumberedsubsubseczzz#1{%
5027
  \global\advance\subsubsecno by 1
5028
  \sectionheading{#1}{subsubsec}{Ynothing}%
5029
                 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
5030
}
5031
 
5032
% These macros control what the section commands do, according
5033
% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
5034
% Define them by default for a numbered chapter.
5035
\let\section = \numberedsec
5036
\let\subsection = \numberedsubsec
5037
\let\subsubsection = \numberedsubsubsec
5038
 
5039
% Define @majorheading, @heading and @subheading
5040
 
5041
% NOTE on use of \vbox for chapter headings, section headings, and such:
5042
%       1) We use \vbox rather than the earlier \line to permit
5043
%          overlong headings to fold.
5044
%       2) \hyphenpenalty is set to 10000 because hyphenation in a
5045
%          heading is obnoxious; this forbids it.
5046
%       3) Likewise, headings look best if no \parindent is used, and
5047
%          if justification is not attempted.  Hence \raggedright.
5048
 
5049
 
5050
\def\majorheading{%
5051
  {\advance\chapheadingskip by 10pt \chapbreak }%
5052
  \parsearg\chapheadingzzz
5053
}
5054
 
5055
\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
5056
\def\chapheadingzzz#1{%
5057
  {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5058
                    \parindent=0pt\raggedright
5059
                    \rm #1\hfill}}%
5060
  \bigskip \par\penalty 200\relax
5061
  \suppressfirstparagraphindent
5062
}
5063
 
5064
% @heading, @subheading, @subsubheading.
5065
\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
5066
  \suppressfirstparagraphindent}
5067
\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
5068
  \suppressfirstparagraphindent}
5069
\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
5070
  \suppressfirstparagraphindent}
5071
 
5072
% These macros generate a chapter, section, etc. heading only
5073
% (including whitespace, linebreaking, etc. around it),
5074
% given all the information in convenient, parsed form.
5075
 
5076
%%% Args are the skip and penalty (usually negative)
5077
\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
5078
 
5079
%%% Define plain chapter starts, and page on/off switching for it
5080
% Parameter controlling skip before chapter headings (if needed)
5081
 
5082
\newskip\chapheadingskip
5083
 
5084
\def\chapbreak{\dobreak \chapheadingskip {-4000}}
5085
\def\chappager{\par\vfill\supereject}
5086
% Because \domark is called before \chapoddpage, the filler page will
5087
% get the headings for the next chapter, which is wrong.  But we don't
5088
% care -- we just disable all headings on the filler page.
5089
\def\chapoddpage{%
5090
  \chappager
5091
  \ifodd\pageno \else
5092
    \begingroup
5093
      \evenheadline={\hfil}\evenfootline={\hfil}%
5094
      \oddheadline={\hfil}\oddfootline={\hfil}%
5095
      \hbox to 0pt{}%
5096
      \chappager
5097
    \endgroup
5098
  \fi
5099
}
5100
 
5101
\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
5102
 
5103
\def\CHAPPAGoff{%
5104
\global\let\contentsalignmacro = \chappager
5105
\global\let\pchapsepmacro=\chapbreak
5106
\global\let\pagealignmacro=\chappager}
5107
 
5108
\def\CHAPPAGon{%
5109
\global\let\contentsalignmacro = \chappager
5110
\global\let\pchapsepmacro=\chappager
5111
\global\let\pagealignmacro=\chappager
5112
\global\def\HEADINGSon{\HEADINGSsingle}}
5113
 
5114
\def\CHAPPAGodd{%
5115
\global\let\contentsalignmacro = \chapoddpage
5116
\global\let\pchapsepmacro=\chapoddpage
5117
\global\let\pagealignmacro=\chapoddpage
5118
\global\def\HEADINGSon{\HEADINGSdouble}}
5119
 
5120
\CHAPPAGon
5121
 
5122
% Chapter opening.
5123
%
5124
% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
5125
% Yappendix, Yomitfromtoc), #3 the chapter number.
5126
%
5127
% To test against our argument.
5128
\def\Ynothingkeyword{Ynothing}
5129
\def\Yomitfromtockeyword{Yomitfromtoc}
5130
\def\Yappendixkeyword{Yappendix}
5131
%
5132
\def\chapmacro#1#2#3{%
5133
  % Insert the first mark before the heading break (see notes for \domark).
5134
  \let\prevchapterdefs=\lastchapterdefs
5135
  \let\prevsectiondefs=\lastsectiondefs
5136
  \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
5137
                        \gdef\thissection{}}%
5138
  %
5139
  \def\temptype{#2}%
5140
  \ifx\temptype\Ynothingkeyword
5141
    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5142
                          \gdef\thischapter{\thischaptername}}%
5143
  \else\ifx\temptype\Yomitfromtockeyword
5144
    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5145
                          \gdef\thischapter{}}%
5146
  \else\ifx\temptype\Yappendixkeyword
5147
    \toks0={#1}%
5148
    \xdef\lastchapterdefs{%
5149
      \gdef\noexpand\thischaptername{\the\toks0}%
5150
      \gdef\noexpand\thischapternum{\appendixletter}%
5151
      \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum:
5152
                                 \noexpand\thischaptername}%
5153
    }%
5154
  \else
5155
    \toks0={#1}%
5156
    \xdef\lastchapterdefs{%
5157
      \gdef\noexpand\thischaptername{\the\toks0}%
5158
      \gdef\noexpand\thischapternum{\the\chapno}%
5159
      \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum:
5160
                                 \noexpand\thischaptername}%
5161
    }%
5162
  \fi\fi\fi
5163
  %
5164
  % Output the mark.  Pass it through \safewhatsit, to take care of
5165
  % the preceding space.
5166
  \safewhatsit\domark
5167
  %
5168
  % Insert the chapter heading break.
5169
  \pchapsepmacro
5170
  %
5171
  % Now the second mark, after the heading break.  No break points
5172
  % between here and the heading.
5173
  \let\prevchapterdefs=\lastchapterdefs
5174
  \let\prevsectiondefs=\lastsectiondefs
5175
  \domark
5176
  %
5177
  {%
5178
    \chapfonts \rm
5179
    %
5180
    % Have to define \lastsection before calling \donoderef, because the
5181
    % xref code eventually uses it.  On the other hand, it has to be called
5182
    % after \pchapsepmacro, or the headline will change too soon.
5183
    \gdef\lastsection{#1}%
5184
    %
5185
    % Only insert the separating space if we have a chapter/appendix
5186
    % number, and don't print the unnumbered ``number''.
5187
    \ifx\temptype\Ynothingkeyword
5188
      \setbox0 = \hbox{}%
5189
      \def\toctype{unnchap}%
5190
    \else\ifx\temptype\Yomitfromtockeyword
5191
      \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
5192
      \def\toctype{omit}%
5193
    \else\ifx\temptype\Yappendixkeyword
5194
      \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
5195
      \def\toctype{app}%
5196
    \else
5197
      \setbox0 = \hbox{#3\enspace}%
5198
      \def\toctype{numchap}%
5199
    \fi\fi\fi
5200
    %
5201
    % Write the toc entry for this chapter.  Must come before the
5202
    % \donoderef, because we include the current node name in the toc
5203
    % entry, and \donoderef resets it to empty.
5204
    \writetocentry{\toctype}{#1}{#3}%
5205
    %
5206
    % For pdftex, we have to write out the node definition (aka, make
5207
    % the pdfdest) after any page break, but before the actual text has
5208
    % been typeset.  If the destination for the pdf outline is after the
5209
    % text, then jumping from the outline may wind up with the text not
5210
    % being visible, for instance under high magnification.
5211
    \donoderef{#2}%
5212
    %
5213
    % Typeset the actual heading.
5214
    \nobreak % Avoid page breaks at the interline glue.
5215
    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
5216
          \hangindent=\wd0 \centerparametersmaybe
5217
          \unhbox0 #1\par}%
5218
  }%
5219
  \nobreak\bigskip % no page break after a chapter title
5220
  \nobreak
5221
}
5222
 
5223
% @centerchap -- centered and unnumbered.
5224
\let\centerparametersmaybe = \relax
5225
\def\centerparameters{%
5226
  \advance\rightskip by 3\rightskip
5227
  \leftskip = \rightskip
5228
  \parfillskip = 0pt
5229
}
5230
 
5231
 
5232
% I don't think this chapter style is supported any more, so I'm not
5233
% updating it with the new noderef stuff.  We'll see.  --karl, 11aug03.
5234
%
5235
\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
5236
%
5237
\def\unnchfopen #1{%
5238
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5239
                       \parindent=0pt\raggedright
5240
                       \rm #1\hfill}}\bigskip \par\nobreak
5241
}
5242
\def\chfopen #1#2{\chapoddpage {\chapfonts
5243
\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
5244
\par\penalty 5000 %
5245
}
5246
\def\centerchfopen #1{%
5247
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5248
                       \parindent=0pt
5249
                       \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
5250
}
5251
\def\CHAPFopen{%
5252
  \global\let\chapmacro=\chfopen
5253
  \global\let\centerchapmacro=\centerchfopen}
5254
 
5255
 
5256
% Section titles.  These macros combine the section number parts and
5257
% call the generic \sectionheading to do the printing.
5258
%
5259
\newskip\secheadingskip
5260
\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
5261
 
5262
% Subsection titles.
5263
\newskip\subsecheadingskip
5264
\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
5265
 
5266
% Subsubsection titles.
5267
\def\subsubsecheadingskip{\subsecheadingskip}
5268
\def\subsubsecheadingbreak{\subsecheadingbreak}
5269
 
5270
 
5271
% Print any size, any type, section title.
5272
%
5273
% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
5274
% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
5275
% section number.
5276
%
5277
\def\seckeyword{sec}
5278
%
5279
\def\sectionheading#1#2#3#4{%
5280
  {%
5281
    % Switch to the right set of fonts.
5282
    \csname #2fonts\endcsname \rm
5283
    %
5284
    \def\sectionlevel{#2}%
5285
    \def\temptype{#3}%
5286
    %
5287
    % Insert first mark before the heading break (see notes for \domark).
5288
    \let\prevsectiondefs=\lastsectiondefs
5289
    \ifx\temptype\Ynothingkeyword
5290
      \ifx\sectionlevel\seckeyword
5291
        \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
5292
                              \gdef\thissection{\thissectionname}}%
5293
      \fi
5294
    \else\ifx\temptype\Yomitfromtockeyword
5295
      % Don't redefine \thissection.
5296
    \else\ifx\temptype\Yappendixkeyword
5297
      \ifx\sectionlevel\seckeyword
5298
        \toks0={#1}%
5299
        \xdef\lastsectiondefs{%
5300
          \gdef\noexpand\thissectionname{\the\toks0}%
5301
          \gdef\noexpand\thissectionnum{#4}%
5302
          \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
5303
                                     \noexpand\thissectionname}%
5304
        }%
5305
      \fi
5306
    \else
5307
      \ifx\sectionlevel\seckeyword
5308
        \toks0={#1}%
5309
        \xdef\lastsectiondefs{%
5310
          \gdef\noexpand\thissectionname{\the\toks0}%
5311
          \gdef\noexpand\thissectionnum{#4}%
5312
          \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
5313
                                     \noexpand\thissectionname}%
5314
        }%
5315
      \fi
5316
    \fi\fi\fi
5317
    %
5318
    % Output the mark.  Pass it through \safewhatsit, to take care of
5319
    % the preceding space.
5320
    \safewhatsit\domark
5321
    %
5322
    % Insert space above the heading.
5323
    \csname #2headingbreak\endcsname
5324
    %
5325
    % Now the second mark, after the heading break.  No break points
5326
    % between here and the heading.
5327
    \let\prevsectiondefs=\lastsectiondefs
5328
    \domark
5329
    %
5330
    % Only insert the space after the number if we have a section number.
5331
    \ifx\temptype\Ynothingkeyword
5332
      \setbox0 = \hbox{}%
5333
      \def\toctype{unn}%
5334
      \gdef\lastsection{#1}%
5335
    \else\ifx\temptype\Yomitfromtockeyword
5336
      % for @headings -- no section number, don't include in toc,
5337
      % and don't redefine \lastsection.
5338
      \setbox0 = \hbox{}%
5339
      \def\toctype{omit}%
5340
      \let\sectionlevel=\empty
5341
    \else\ifx\temptype\Yappendixkeyword
5342
      \setbox0 = \hbox{#4\enspace}%
5343
      \def\toctype{app}%
5344
      \gdef\lastsection{#1}%
5345
    \else
5346
      \setbox0 = \hbox{#4\enspace}%
5347
      \def\toctype{num}%
5348
      \gdef\lastsection{#1}%
5349
    \fi\fi\fi
5350
    %
5351
    % Write the toc entry (before \donoderef).  See comments in \chapmacro.
5352
    \writetocentry{\toctype\sectionlevel}{#1}{#4}%
5353
    %
5354
    % Write the node reference (= pdf destination for pdftex).
5355
    % Again, see comments in \chapmacro.
5356
    \donoderef{#3}%
5357
    %
5358
    % Interline glue will be inserted when the vbox is completed.
5359
    % That glue will be a valid breakpoint for the page, since it'll be
5360
    % preceded by a whatsit (usually from the \donoderef, or from the
5361
    % \writetocentry if there was no node).  We don't want to allow that
5362
    % break, since then the whatsits could end up on page n while the
5363
    % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
5364
    \nobreak
5365
    %
5366
    % Output the actual section heading.
5367
    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
5368
          \hangindent=\wd0  % zero if no section number
5369
          \unhbox0 #1}%
5370
  }%
5371
  % Add extra space after the heading -- half of whatever came above it.
5372
  % Don't allow stretch, though.
5373
  \kern .5 \csname #2headingskip\endcsname
5374
  %
5375
  % Do not let the kern be a potential breakpoint, as it would be if it
5376
  % was followed by glue.
5377
  \nobreak
5378
  %
5379
  % We'll almost certainly start a paragraph next, so don't let that
5380
  % glue accumulate.  (Not a breakpoint because it's preceded by a
5381
  % discardable item.)
5382
  \vskip-\parskip
5383
  %
5384
  % This is purely so the last item on the list is a known \penalty >
5385
  % 10000.  This is so \startdefun can avoid allowing breakpoints after
5386
  % section headings.  Otherwise, it would insert a valid breakpoint between:
5387
  %
5388
  %   @section sec-whatever
5389
  %   @deffn def-whatever
5390
  \penalty 10001
5391
}
5392
 
5393
 
5394
\message{toc,}
5395
% Table of contents.
5396
\newwrite\tocfile
5397
 
5398
% Write an entry to the toc file, opening it if necessary.
5399
% Called from @chapter, etc.
5400
%
5401
% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
5402
% We append the current node name (if any) and page number as additional
5403
% arguments for the \{chap,sec,...}entry macros which will eventually
5404
% read this.  The node name is used in the pdf outlines as the
5405
% destination to jump to.
5406
%
5407
% We open the .toc file for writing here instead of at @setfilename (or
5408
% any other fixed time) so that @contents can be anywhere in the document.
5409
% But if #1 is `omit', then we don't do anything.  This is used for the
5410
% table of contents chapter openings themselves.
5411
%
5412
\newif\iftocfileopened
5413
\def\omitkeyword{omit}%
5414
%
5415
\def\writetocentry#1#2#3{%
5416
  \edef\writetoctype{#1}%
5417
  \ifx\writetoctype\omitkeyword \else
5418
    \iftocfileopened\else
5419
      \immediate\openout\tocfile = \jobname.toc
5420
      \global\tocfileopenedtrue
5421
    \fi
5422
    %
5423
    \iflinks
5424
      {\atdummies
5425
       \edef\temp{%
5426
         \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
5427
       \temp
5428
      }%
5429
    \fi
5430
  \fi
5431
  %
5432
  % Tell \shipout to create a pdf destination on each page, if we're
5433
  % writing pdf.  These are used in the table of contents.  We can't
5434
  % just write one on every page because the title pages are numbered
5435
  % 1 and 2 (the page numbers aren't printed), and so are the first
5436
  % two pages of the document.  Thus, we'd have two destinations named
5437
  % `1', and two named `2'.
5438
  \ifpdf \global\pdfmakepagedesttrue \fi
5439
}
5440
 
5441
 
5442
% These characters do not print properly in the Computer Modern roman
5443
% fonts, so we must take special care.  This is more or less redundant
5444
% with the Texinfo input format setup at the end of this file.
5445
%
5446
\def\activecatcodes{%
5447
  \catcode`\"=\active
5448
  \catcode`\$=\active
5449
  \catcode`\<=\active
5450
  \catcode`\>=\active
5451
  \catcode`\\=\active
5452
  \catcode`\^=\active
5453
  \catcode`\_=\active
5454
  \catcode`\|=\active
5455
  \catcode`\~=\active
5456
}
5457
 
5458
 
5459
% Read the toc file, which is essentially Texinfo input.
5460
\def\readtocfile{%
5461
  \setupdatafile
5462
  \activecatcodes
5463
  \input \tocreadfilename
5464
}
5465
 
5466
\newskip\contentsrightmargin \contentsrightmargin=1in
5467
\newcount\savepageno
5468
\newcount\lastnegativepageno \lastnegativepageno = -1
5469
 
5470
% Prepare to read what we've written to \tocfile.
5471
%
5472
\def\startcontents#1{%
5473
  % If @setchapternewpage on, and @headings double, the contents should
5474
  % start on an odd page, unlike chapters.  Thus, we maintain
5475
  % \contentsalignmacro in parallel with \pagealignmacro.
5476
  % From: Torbjorn Granlund <tege@matematik.su.se>
5477
  \contentsalignmacro
5478
  \immediate\closeout\tocfile
5479
  %
5480
  % Don't need to put `Contents' or `Short Contents' in the headline.
5481
  % It is abundantly clear what they are.
5482
  \chapmacro{#1}{Yomitfromtoc}{}%
5483
  %
5484
  \savepageno = \pageno
5485
  \begingroup                  % Set up to handle contents files properly.
5486
    \raggedbottom              % Worry more about breakpoints than the bottom.
5487
    \advance\hsize by -\contentsrightmargin % Don't use the full line length.
5488
    %
5489
    % Roman numerals for page numbers.
5490
    \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
5491
}
5492
 
5493
% redefined for the two-volume lispref.  We always output on
5494
% \jobname.toc even if this is redefined.
5495
%
5496
\def\tocreadfilename{\jobname.toc}
5497
 
5498
% Normal (long) toc.
5499
%
5500
\def\contents{%
5501
  \startcontents{\putwordTOC}%
5502
    \openin 1 \tocreadfilename\space
5503
    \ifeof 1 \else
5504
      \readtocfile
5505
    \fi
5506
    \vfill \eject
5507
    \contentsalignmacro % in case @setchapternewpage odd is in effect
5508
    \ifeof 1 \else
5509
      \pdfmakeoutlines
5510
    \fi
5511
    \closein 1
5512
  \endgroup
5513
  \lastnegativepageno = \pageno
5514
  \global\pageno = \savepageno
5515
}
5516
 
5517
% And just the chapters.
5518
\def\summarycontents{%
5519
  \startcontents{\putwordShortTOC}%
5520
    %
5521
    \let\numchapentry = \shortchapentry
5522
    \let\appentry = \shortchapentry
5523
    \let\unnchapentry = \shortunnchapentry
5524
    % We want a true roman here for the page numbers.
5525
    \secfonts
5526
    \let\rm=\shortcontrm \let\bf=\shortcontbf
5527
    \let\sl=\shortcontsl \let\tt=\shortconttt
5528
    \rm
5529
    \hyphenpenalty = 10000
5530
    \advance\baselineskip by 1pt % Open it up a little.
5531
    \def\numsecentry##1##2##3##4{}
5532
    \let\appsecentry = \numsecentry
5533
    \let\unnsecentry = \numsecentry
5534
    \let\numsubsecentry = \numsecentry
5535
    \let\appsubsecentry = \numsecentry
5536
    \let\unnsubsecentry = \numsecentry
5537
    \let\numsubsubsecentry = \numsecentry
5538
    \let\appsubsubsecentry = \numsecentry
5539
    \let\unnsubsubsecentry = \numsecentry
5540
    \openin 1 \tocreadfilename\space
5541
    \ifeof 1 \else
5542
      \readtocfile
5543
    \fi
5544
    \closein 1
5545
    \vfill \eject
5546
    \contentsalignmacro % in case @setchapternewpage odd is in effect
5547
  \endgroup
5548
  \lastnegativepageno = \pageno
5549
  \global\pageno = \savepageno
5550
}
5551
\let\shortcontents = \summarycontents
5552
 
5553
% Typeset the label for a chapter or appendix for the short contents.
5554
% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
5555
%
5556
\def\shortchaplabel#1{%
5557
  % This space should be enough, since a single number is .5em, and the
5558
  % widest letter (M) is 1em, at least in the Computer Modern fonts.
5559
  % But use \hss just in case.
5560
  % (This space doesn't include the extra space that gets added after
5561
  % the label; that gets put in by \shortchapentry above.)
5562
  %
5563
  % We'd like to right-justify chapter numbers, but that looks strange
5564
  % with appendix letters.  And right-justifying numbers and
5565
  % left-justifying letters looks strange when there is less than 10
5566
  % chapters.  Have to read the whole toc once to know how many chapters
5567
  % there are before deciding ...
5568
  \hbox to 1em{#1\hss}%
5569
}
5570
 
5571
% These macros generate individual entries in the table of contents.
5572
% The first argument is the chapter or section name.
5573
% The last argument is the page number.
5574
% The arguments in between are the chapter number, section number, ...
5575
 
5576
% Chapters, in the main contents.
5577
\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
5578
%
5579
% Chapters, in the short toc.
5580
% See comments in \dochapentry re vbox and related settings.
5581
\def\shortchapentry#1#2#3#4{%
5582
  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
5583
}
5584
 
5585
% Appendices, in the main contents.
5586
% Need the word Appendix, and a fixed-size box.
5587
%
5588
\def\appendixbox#1{%
5589
  % We use M since it's probably the widest letter.
5590
  \setbox0 = \hbox{\putwordAppendix{} M}%
5591
  \hbox to \wd0{\putwordAppendix{} #1\hss}}
5592
%
5593
\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
5594
 
5595
% Unnumbered chapters.
5596
\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
5597
\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
5598
 
5599
% Sections.
5600
\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
5601
\let\appsecentry=\numsecentry
5602
\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
5603
 
5604
% Subsections.
5605
\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
5606
\let\appsubsecentry=\numsubsecentry
5607
\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
5608
 
5609
% And subsubsections.
5610
\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
5611
\let\appsubsubsecentry=\numsubsubsecentry
5612
\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
5613
 
5614
% This parameter controls the indentation of the various levels.
5615
% Same as \defaultparindent.
5616
\newdimen\tocindent \tocindent = 15pt
5617
 
5618
% Now for the actual typesetting. In all these, #1 is the text and #2 is the
5619
% page number.
5620
%
5621
% If the toc has to be broken over pages, we want it to be at chapters
5622
% if at all possible; hence the \penalty.
5623
\def\dochapentry#1#2{%
5624
   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
5625
   \begingroup
5626
     \chapentryfonts
5627
     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
5628
   \endgroup
5629
   \nobreak\vskip .25\baselineskip plus.1\baselineskip
5630
}
5631
 
5632
\def\dosecentry#1#2{\begingroup
5633
  \secentryfonts \leftskip=\tocindent
5634
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
5635
\endgroup}
5636
 
5637
\def\dosubsecentry#1#2{\begingroup
5638
  \subsecentryfonts \leftskip=2\tocindent
5639
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
5640
\endgroup}
5641
 
5642
\def\dosubsubsecentry#1#2{\begingroup
5643
  \subsubsecentryfonts \leftskip=3\tocindent
5644
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
5645
\endgroup}
5646
 
5647
% We use the same \entry macro as for the index entries.
5648
\let\tocentry = \entry
5649
 
5650
% Space between chapter (or whatever) number and the title.
5651
\def\labelspace{\hskip1em \relax}
5652
 
5653
\def\dopageno#1{{\rm #1}}
5654
\def\doshortpageno#1{{\rm #1}}
5655
 
5656
\def\chapentryfonts{\secfonts \rm}
5657
\def\secentryfonts{\textfonts}
5658
\def\subsecentryfonts{\textfonts}
5659
\def\subsubsecentryfonts{\textfonts}
5660
 
5661
 
5662
\message{environments,}
5663
% @foo ... @end foo.
5664
 
5665
% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
5666
%
5667
% Since these characters are used in examples, they should be an even number of
5668
% \tt widths. Each \tt character is 1en, so two makes it 1em.
5669
%
5670
\def\point{$\star$}
5671
\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
5672
\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
5673
\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
5674
\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
5675
\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
5676
 
5677
% The @error{} command.
5678
% Adapted from the TeXbook's \boxit.
5679
%
5680
\newbox\errorbox
5681
%
5682
{\tentt \global\dimen0 = 3em}% Width of the box.
5683
\dimen2 = .55pt % Thickness of rules
5684
% The text. (`r' is open on the right, `e' somewhat less so on the left.)
5685
\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
5686
%
5687
\setbox\errorbox=\hbox to \dimen0{\hfil
5688
   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
5689
   \advance\hsize by -2\dimen2 % Rules.
5690
   \vbox{%
5691
      \hrule height\dimen2
5692
      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
5693
         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
5694
         \kern3pt\vrule width\dimen2}% Space to right.
5695
      \hrule height\dimen2}
5696
    \hfil}
5697
%
5698
\def\error{\leavevmode\lower.7ex\copy\errorbox}
5699
 
5700
% @tex ... @end tex    escapes into raw Tex temporarily.
5701
% One exception: @ is still an escape character, so that @end tex works.
5702
% But \@ or @@ will get a plain tex @ character.
5703
 
5704
\envdef\tex{%
5705
  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
5706
  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
5707
  \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
5708
  \catcode `\%=14
5709
  \catcode `\+=\other
5710
  \catcode `\"=\other
5711
  \catcode `\|=\other
5712
  \catcode `\<=\other
5713
  \catcode `\>=\other
5714
  \escapechar=`\\
5715
  %
5716
  \let\b=\ptexb
5717
  \let\bullet=\ptexbullet
5718
  \let\c=\ptexc
5719
  \let\,=\ptexcomma
5720
  \let\.=\ptexdot
5721
  \let\dots=\ptexdots
5722
  \let\equiv=\ptexequiv
5723
  \let\!=\ptexexclam
5724
  \let\i=\ptexi
5725
  \let\indent=\ptexindent
5726
  \let\noindent=\ptexnoindent
5727
  \let\{=\ptexlbrace
5728
  \let\+=\tabalign
5729
  \let\}=\ptexrbrace
5730
  \let\/=\ptexslash
5731
  \let\*=\ptexstar
5732
  \let\t=\ptext
5733
  \expandafter \let\csname top\endcsname=\ptextop  % outer
5734
  \let\frenchspacing=\plainfrenchspacing
5735
  %
5736
  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
5737
  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
5738
  \def\@{@}%
5739
}
5740
% There is no need to define \Etex.
5741
 
5742
% Define @lisp ... @end lisp.
5743
% @lisp environment forms a group so it can rebind things,
5744
% including the definition of @end lisp (which normally is erroneous).
5745
 
5746
% Amount to narrow the margins by for @lisp.
5747
\newskip\lispnarrowing \lispnarrowing=0.4in
5748
 
5749
% This is the definition that ^^M gets inside @lisp, @example, and other
5750
% such environments.  \null is better than a space, since it doesn't
5751
% have any width.
5752
\def\lisppar{\null\endgraf}
5753
 
5754
% This space is always present above and below environments.
5755
\newskip\envskipamount \envskipamount = 0pt
5756
 
5757
% Make spacing and below environment symmetrical.  We use \parskip here
5758
% to help in doing that, since in @example-like environments \parskip
5759
% is reset to zero; thus the \afterenvbreak inserts no space -- but the
5760
% start of the next paragraph will insert \parskip.
5761
%
5762
\def\aboveenvbreak{{%
5763
  % =10000 instead of <10000 because of a special case in \itemzzz and
5764
  % \sectionheading, q.v.
5765
  \ifnum \lastpenalty=10000 \else
5766
    \advance\envskipamount by \parskip
5767
    \endgraf
5768
    \ifdim\lastskip<\envskipamount
5769
      \removelastskip
5770
      % it's not a good place to break if the last penalty was \nobreak
5771
      % or better ...
5772
      \ifnum\lastpenalty<10000 \penalty-50 \fi
5773
      \vskip\envskipamount
5774
    \fi
5775
  \fi
5776
}}
5777
 
5778
\let\afterenvbreak = \aboveenvbreak
5779
 
5780
% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
5781
% also clear it, so that its embedded environments do the narrowing again.
5782
\let\nonarrowing=\relax
5783
 
5784
% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
5785
% environment contents.
5786
\font\circle=lcircle10
5787
\newdimen\circthick
5788
\newdimen\cartouter\newdimen\cartinner
5789
\newskip\normbskip\newskip\normpskip\newskip\normlskip
5790
\circthick=\fontdimen8\circle
5791
%
5792
\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
5793
\def\ctr{{\hskip 6pt\circle\char'010}}
5794
\def\cbl{{\circle\char'012\hskip -6pt}}
5795
\def\cbr{{\hskip 6pt\circle\char'011}}
5796
\def\carttop{\hbox to \cartouter{\hskip\lskip
5797
        \ctl\leaders\hrule height\circthick\hfil\ctr
5798
        \hskip\rskip}}
5799
\def\cartbot{\hbox to \cartouter{\hskip\lskip
5800
        \cbl\leaders\hrule height\circthick\hfil\cbr
5801
        \hskip\rskip}}
5802
%
5803
\newskip\lskip\newskip\rskip
5804
 
5805
\envdef\cartouche{%
5806
  \ifhmode\par\fi  % can't be in the midst of a paragraph.
5807
  \startsavinginserts
5808
  \lskip=\leftskip \rskip=\rightskip
5809
  \leftskip=0pt\rightskip=0pt % we want these *outside*.
5810
  \cartinner=\hsize \advance\cartinner by-\lskip
5811
  \advance\cartinner by-\rskip
5812
  \cartouter=\hsize
5813
  \advance\cartouter by 18.4pt  % allow for 3pt kerns on either
5814
                                % side, and for 6pt waste from
5815
                                % each corner char, and rule thickness
5816
  \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
5817
  % Flag to tell @lisp, etc., not to narrow margin.
5818
  \let\nonarrowing = t%
5819
  \vbox\bgroup
5820
      \baselineskip=0pt\parskip=0pt\lineskip=0pt
5821
      \carttop
5822
      \hbox\bgroup
5823
          \hskip\lskip
5824
          \vrule\kern3pt
5825
          \vbox\bgroup
5826
              \kern3pt
5827
              \hsize=\cartinner
5828
              \baselineskip=\normbskip
5829
              \lineskip=\normlskip
5830
              \parskip=\normpskip
5831
              \vskip -\parskip
5832
              \comment % For explanation, see the end of \def\group.
5833
}
5834
\def\Ecartouche{%
5835
              \ifhmode\par\fi
5836
              \kern3pt
5837
          \egroup
5838
          \kern3pt\vrule
5839
          \hskip\rskip
5840
      \egroup
5841
      \cartbot
5842
  \egroup
5843
  \checkinserts
5844
}
5845
 
5846
 
5847
% This macro is called at the beginning of all the @example variants,
5848
% inside a group.
5849
\def\nonfillstart{%
5850
  \aboveenvbreak
5851
  \hfuzz = 12pt % Don't be fussy
5852
  \sepspaces % Make spaces be word-separators rather than space tokens.
5853
  \let\par = \lisppar % don't ignore blank lines
5854
  \obeylines % each line of input is a line of output
5855
  \parskip = 0pt
5856
  \parindent = 0pt
5857
  \emergencystretch = 0pt % don't try to avoid overfull boxes
5858
  \ifx\nonarrowing\relax
5859
    \advance \leftskip by \lispnarrowing
5860
    \exdentamount=\lispnarrowing
5861
  \else
5862
    \let\nonarrowing = \relax
5863
  \fi
5864
  \let\exdent=\nofillexdent
5865
}
5866
 
5867
% If you want all examples etc. small: @set dispenvsize small.
5868
% If you want even small examples the full size: @set dispenvsize nosmall.
5869
% This affects the following displayed environments:
5870
%    @example, @display, @format, @lisp
5871
%
5872
\def\smallword{small}
5873
\def\nosmallword{nosmall}
5874
\let\SETdispenvsize\relax
5875
\def\setnormaldispenv{%
5876
  \ifx\SETdispenvsize\smallword
5877
    % end paragraph for sake of leading, in case document has no blank
5878
    % line.  This is redundant with what happens in \aboveenvbreak, but
5879
    % we need to do it before changing the fonts, and it's inconvenient
5880
    % to change the fonts afterward.
5881
    \ifnum \lastpenalty=10000 \else \endgraf \fi
5882
    \smallexamplefonts \rm
5883
  \fi
5884
}
5885
\def\setsmalldispenv{%
5886
  \ifx\SETdispenvsize\nosmallword
5887
  \else
5888
    \ifnum \lastpenalty=10000 \else \endgraf \fi
5889
    \smallexamplefonts \rm
5890
  \fi
5891
}
5892
 
5893
% We often define two environments, @foo and @smallfoo.
5894
% Let's do it by one command:
5895
\def\makedispenv #1#2{
5896
  \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}
5897
  \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}
5898
  \expandafter\let\csname E#1\endcsname \afterenvbreak
5899
  \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
5900
}
5901
 
5902
% Define two synonyms:
5903
\def\maketwodispenvs #1#2#3{
5904
  \makedispenv{#1}{#3}
5905
  \makedispenv{#2}{#3}
5906
}
5907
 
5908
% @lisp: indented, narrowed, typewriter font; @example: same as @lisp.
5909
%
5910
% @smallexample and @smalllisp: use smaller fonts.
5911
% Originally contributed by Pavel@xerox.
5912
%
5913
\maketwodispenvs {lisp}{example}{%
5914
  \nonfillstart
5915
  \tt\quoteexpand
5916
  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
5917
  \gobble       % eat return
5918
}
5919
% @display/@smalldisplay: same as @lisp except keep current font.
5920
%
5921
\makedispenv {display}{%
5922
  \nonfillstart
5923
  \gobble
5924
}
5925
 
5926
% @format/@smallformat: same as @display except don't narrow margins.
5927
%
5928
\makedispenv{format}{%
5929
  \let\nonarrowing = t%
5930
  \nonfillstart
5931
  \gobble
5932
}
5933
 
5934
% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
5935
\envdef\flushleft{%
5936
  \let\nonarrowing = t%
5937
  \nonfillstart
5938
  \gobble
5939
}
5940
\let\Eflushleft = \afterenvbreak
5941
 
5942
% @flushright.
5943
%
5944
\envdef\flushright{%
5945
  \let\nonarrowing = t%
5946
  \nonfillstart
5947
  \advance\leftskip by 0pt plus 1fill
5948
  \gobble
5949
}
5950
\let\Eflushright = \afterenvbreak
5951
 
5952
 
5953
% @quotation does normal linebreaking (hence we can't use \nonfillstart)
5954
% and narrows the margins.  We keep \parskip nonzero in general, since
5955
% we're doing normal filling.  So, when using \aboveenvbreak and
5956
% \afterenvbreak, temporarily make \parskip 0.
5957
%
5958
\envdef\quotation{%
5959
  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
5960
  \parindent=0pt
5961
  %
5962
  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
5963
  \ifx\nonarrowing\relax
5964
    \advance\leftskip by \lispnarrowing
5965
    \advance\rightskip by \lispnarrowing
5966
    \exdentamount = \lispnarrowing
5967
  \else
5968
    \let\nonarrowing = \relax
5969
  \fi
5970
  \parsearg\quotationlabel
5971
}
5972
 
5973
% We have retained a nonzero parskip for the environment, since we're
5974
% doing normal filling.
5975
%
5976
\def\Equotation{%
5977
  \par
5978
  \ifx\quotationauthor\undefined\else
5979
    % indent a bit.
5980
    \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
5981
  \fi
5982
  {\parskip=0pt \afterenvbreak}%
5983
}
5984
 
5985
% If we're given an argument, typeset it in bold with a colon after.
5986
\def\quotationlabel#1{%
5987
  \def\temp{#1}%
5988
  \ifx\temp\empty \else
5989
    {\bf #1: }%
5990
  \fi
5991
}
5992
 
5993
 
5994
% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
5995
% If we want to allow any <char> as delimiter,
5996
% we need the curly braces so that makeinfo sees the @verb command, eg:
5997
% `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
5998
%
5999
% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
6000
%
6001
% [Knuth] p.344; only we need to do the other characters Texinfo sets
6002
% active too.  Otherwise, they get lost as the first character on a
6003
% verbatim line.
6004
\def\dospecials{%
6005
  \do\ \do\\\do\{\do\}\do\$\do\&%
6006
  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
6007
  \do\<\do\>\do\|\do\@\do+\do\"%
6008
}
6009
%
6010
% [Knuth] p. 380
6011
\def\uncatcodespecials{%
6012
  \def\do##1{\catcode`##1=\other}\dospecials}
6013
%
6014
% [Knuth] pp. 380,381,391
6015
% Disable Spanish ligatures ?` and !` of \tt font
6016
\begingroup
6017
  \catcode`\`=\active\gdef`{\relax\lq}
6018
\endgroup
6019
%
6020
% Setup for the @verb command.
6021
%
6022
% Eight spaces for a tab
6023
\begingroup
6024
  \catcode`\^^I=\active
6025
  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
6026
\endgroup
6027
%
6028
\def\setupverb{%
6029
  \tt  % easiest (and conventionally used) font for verbatim
6030
  \def\par{\leavevmode\endgraf}%
6031
  \catcode`\`=\active
6032
  \tabeightspaces
6033
  % Respect line breaks,
6034
  % print special symbols as themselves, and
6035
  % make each space count
6036
  % must do in this order:
6037
  \obeylines \uncatcodespecials \sepspaces
6038
}
6039
 
6040
% Setup for the @verbatim environment
6041
%
6042
% Real tab expansion
6043
\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
6044
%
6045
\def\starttabbox{\setbox0=\hbox\bgroup}
6046
 
6047
% Allow an option to not replace quotes with a regular directed right
6048
% quote/apostrophe (char 0x27), but instead use the undirected quote
6049
% from cmtt (char 0x0d).  The undirected quote is ugly, so don't make it
6050
% the default, but it works for pasting with more pdf viewers (at least
6051
% evince), the lilypond developers report.  xpdf does work with the
6052
% regular 0x27.
6053
%
6054
\def\codequoteright{%
6055
  \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
6056
    \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
6057
      '%
6058
    \else \char'15 \fi
6059
  \else \char'15 \fi
6060
}
6061
%
6062
% and a similar option for the left quote char vs. a grave accent.
6063
% Modern fonts display ASCII 0x60 as a grave accent, so some people like
6064
% the code environments to do likewise.
6065
%
6066
\def\codequoteleft{%
6067
  \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
6068
    \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
6069
      `%
6070
    \else \char'22 \fi
6071
  \else \char'22 \fi
6072
}
6073
%
6074
\begingroup
6075
  \catcode`\^^I=\active
6076
  \gdef\tabexpand{%
6077
    \catcode`\^^I=\active
6078
    \def^^I{\leavevmode\egroup
6079
      \dimen0=\wd0 % the width so far, or since the previous tab
6080
      \divide\dimen0 by\tabw
6081
      \multiply\dimen0 by\tabw % compute previous multiple of \tabw
6082
      \advance\dimen0 by\tabw  % advance to next multiple of \tabw
6083
      \wd0=\dimen0 \box0 \starttabbox
6084
    }%
6085
  }
6086
  \catcode`\'=\active
6087
  \gdef\rquoteexpand{\catcode\rquoteChar=\active \def'{\codequoteright}}%
6088
  %
6089
  \catcode`\`=\active
6090
  \gdef\lquoteexpand{\catcode\lquoteChar=\active \def`{\codequoteleft}}%
6091
  %
6092
  \gdef\quoteexpand{\rquoteexpand \lquoteexpand}%
6093
\endgroup
6094
 
6095
% start the verbatim environment.
6096
\def\setupverbatim{%
6097
  \let\nonarrowing = t%
6098
  \nonfillstart
6099
  % Easiest (and conventionally used) font for verbatim
6100
  \tt
6101
  \def\par{\leavevmode\egroup\box0\endgraf}%
6102
  \catcode`\`=\active
6103
  \tabexpand
6104
  \quoteexpand
6105
  % Respect line breaks,
6106
  % print special symbols as themselves, and
6107
  % make each space count
6108
  % must do in this order:
6109
  \obeylines \uncatcodespecials \sepspaces
6110
  \everypar{\starttabbox}%
6111
}
6112
 
6113
% Do the @verb magic: verbatim text is quoted by unique
6114
% delimiter characters.  Before first delimiter expect a
6115
% right brace, after last delimiter expect closing brace:
6116
%
6117
%    \def\doverb'{'<char>#1<char>'}'{#1}
6118
%
6119
% [Knuth] p. 382; only eat outer {}
6120
\begingroup
6121
  \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
6122
  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
6123
\endgroup
6124
%
6125
\def\verb{\begingroup\setupverb\doverb}
6126
%
6127
%
6128
% Do the @verbatim magic: define the macro \doverbatim so that
6129
% the (first) argument ends when '@end verbatim' is reached, ie:
6130
%
6131
%     \def\doverbatim#1@end verbatim{#1}
6132
%
6133
% For Texinfo it's a lot easier than for LaTeX,
6134
% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
6135
% we need not redefine '\', '{' and '}'.
6136
%
6137
% Inspired by LaTeX's verbatim command set [latex.ltx]
6138
%
6139
\begingroup
6140
  \catcode`\ =\active
6141
  \obeylines %
6142
  % ignore everything up to the first ^^M, that's the newline at the end
6143
  % of the @verbatim input line itself.  Otherwise we get an extra blank
6144
  % line in the output.
6145
  \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
6146
  % We really want {...\end verbatim} in the body of the macro, but
6147
  % without the active space; thus we have to use \xdef and \gobble.
6148
\endgroup
6149
%
6150
\envdef\verbatim{%
6151
    \setupverbatim\doverbatim
6152
}
6153
\let\Everbatim = \afterenvbreak
6154
 
6155
 
6156
% @verbatiminclude FILE - insert text of file in verbatim environment.
6157
%
6158
\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
6159
%
6160
\def\doverbatiminclude#1{%
6161
  {%
6162
    \makevalueexpandable
6163
    \setupverbatim
6164
    \input #1
6165
    \afterenvbreak
6166
  }%
6167
}
6168
 
6169
% @copying ... @end copying.
6170
% Save the text away for @insertcopying later.
6171
%
6172
% We save the uninterpreted tokens, rather than creating a box.
6173
% Saving the text in a box would be much easier, but then all the
6174
% typesetting commands (@smallbook, font changes, etc.) have to be done
6175
% beforehand -- and a) we want @copying to be done first in the source
6176
% file; b) letting users define the frontmatter in as flexible order as
6177
% possible is very desirable.
6178
%
6179
\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
6180
\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
6181
%
6182
\def\insertcopying{%
6183
  \begingroup
6184
    \parindent = 0pt  % paragraph indentation looks wrong on title page
6185
    \scanexp\copyingtext
6186
  \endgroup
6187
}
6188
 
6189
 
6190
\message{defuns,}
6191
% @defun etc.
6192
 
6193
\newskip\defbodyindent \defbodyindent=.4in
6194
\newskip\defargsindent \defargsindent=50pt
6195
\newskip\deflastargmargin \deflastargmargin=18pt
6196
\newcount\defunpenalty
6197
 
6198
% Start the processing of @deffn:
6199
\def\startdefun{%
6200
  \ifnum\lastpenalty<10000
6201
    \medbreak
6202
    \defunpenalty=10003 % Will keep this @deffn together with the
6203
                        % following @def command, see below.
6204
  \else
6205
    % If there are two @def commands in a row, we'll have a \nobreak,
6206
    % which is there to keep the function description together with its
6207
    % header.  But if there's nothing but headers, we need to allow a
6208
    % break somewhere.  Check specifically for penalty 10002, inserted
6209
    % by \printdefunline, instead of 10000, since the sectioning
6210
    % commands also insert a nobreak penalty, and we don't want to allow
6211
    % a break between a section heading and a defun.
6212
    %
6213
    % As a minor refinement, we avoid "club" headers by signalling
6214
    % with penalty of 10003 after the very first @deffn in the
6215
    % sequence (see above), and penalty of 10002 after any following
6216
    % @def command.
6217
    \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
6218
    %
6219
    % Similarly, after a section heading, do not allow a break.
6220
    % But do insert the glue.
6221
    \medskip  % preceded by discardable penalty, so not a breakpoint
6222
  \fi
6223
  %
6224
  \parindent=0in
6225
  \advance\leftskip by \defbodyindent
6226
  \exdentamount=\defbodyindent
6227
}
6228
 
6229
\def\dodefunx#1{%
6230
  % First, check whether we are in the right environment:
6231
  \checkenv#1%
6232
  %
6233
  % As above, allow line break if we have multiple x headers in a row.
6234
  % It's not a great place, though.
6235
  \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
6236
  %
6237
  % And now, it's time to reuse the body of the original defun:
6238
  \expandafter\gobbledefun#1%
6239
}
6240
\def\gobbledefun#1\startdefun{}
6241
 
6242
% \printdefunline \deffnheader{text}
6243
%
6244
\def\printdefunline#1#2{%
6245
  \begingroup
6246
    % call \deffnheader:
6247
    #1#2 \endheader
6248
    % common ending:
6249
    \interlinepenalty = 10000
6250
    \advance\rightskip by 0pt plus 1fil
6251
    \endgraf
6252
    \nobreak\vskip -\parskip
6253
    \penalty\defunpenalty  % signal to \startdefun and \dodefunx
6254
    % Some of the @defun-type tags do not enable magic parentheses,
6255
    % rendering the following check redundant.  But we don't optimize.
6256
    \checkparencounts
6257
  \endgroup
6258
}
6259
 
6260
\def\Edefun{\endgraf\medbreak}
6261
 
6262
% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
6263
% the only thing remainnig is to define \deffnheader.
6264
%
6265
\def\makedefun#1{%
6266
  \expandafter\let\csname E#1\endcsname = \Edefun
6267
  \edef\temp{\noexpand\domakedefun
6268
    \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
6269
  \temp
6270
}
6271
 
6272
% \domakedefun \deffn \deffnx \deffnheader
6273
%
6274
% Define \deffn and \deffnx, without parameters.
6275
% \deffnheader has to be defined explicitly.
6276
%
6277
\def\domakedefun#1#2#3{%
6278
  \envdef#1{%
6279
    \startdefun
6280
    \parseargusing\activeparens{\printdefunline#3}%
6281
  }%
6282
  \def#2{\dodefunx#1}%
6283
  \def#3%
6284
}
6285
 
6286
%%% Untyped functions:
6287
 
6288
% @deffn category name args
6289
\makedefun{deffn}{\deffngeneral{}}
6290
 
6291
% @deffn category class name args
6292
\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
6293
 
6294
% \defopon {category on}class name args
6295
\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
6296
 
6297
% \deffngeneral {subind}category name args
6298
%
6299
\def\deffngeneral#1#2 #3 #4\endheader{%
6300
  % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
6301
  \dosubind{fn}{\code{#3}}{#1}%
6302
  \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
6303
}
6304
 
6305
%%% Typed functions:
6306
 
6307
% @deftypefn category type name args
6308
\makedefun{deftypefn}{\deftypefngeneral{}}
6309
 
6310
% @deftypeop category class type name args
6311
\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
6312
 
6313
% \deftypeopon {category on}class type name args
6314
\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
6315
 
6316
% \deftypefngeneral {subind}category type name args
6317
%
6318
\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
6319
  \dosubind{fn}{\code{#4}}{#1}%
6320
  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6321
}
6322
 
6323
%%% Typed variables:
6324
 
6325
% @deftypevr category type var args
6326
\makedefun{deftypevr}{\deftypecvgeneral{}}
6327
 
6328
% @deftypecv category class type var args
6329
\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
6330
 
6331
% \deftypecvof {category of}class type var args
6332
\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
6333
 
6334
% \deftypecvgeneral {subind}category type var args
6335
%
6336
\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
6337
  \dosubind{vr}{\code{#4}}{#1}%
6338
  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6339
}
6340
 
6341
%%% Untyped variables:
6342
 
6343
% @defvr category var args
6344
\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
6345
 
6346
% @defcv category class var args
6347
\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
6348
 
6349
% \defcvof {category of}class var args
6350
\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
6351
 
6352
%%% Type:
6353
% @deftp category name args
6354
\makedefun{deftp}#1 #2 #3\endheader{%
6355
  \doind{tp}{\code{#2}}%
6356
  \defname{#1}{}{#2}\defunargs{#3\unskip}%
6357
}
6358
 
6359
% Remaining @defun-like shortcuts:
6360
\makedefun{defun}{\deffnheader{\putwordDeffunc} }
6361
\makedefun{defmac}{\deffnheader{\putwordDefmac} }
6362
\makedefun{defspec}{\deffnheader{\putwordDefspec} }
6363
\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
6364
\makedefun{defvar}{\defvrheader{\putwordDefvar} }
6365
\makedefun{defopt}{\defvrheader{\putwordDefopt} }
6366
\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
6367
\makedefun{defmethod}{\defopon\putwordMethodon}
6368
\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
6369
\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
6370
\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
6371
 
6372
% \defname, which formats the name of the @def (not the args).
6373
% #1 is the category, such as "Function".
6374
% #2 is the return type, if any.
6375
% #3 is the function name.
6376
%
6377
% We are followed by (but not passed) the arguments, if any.
6378
%
6379
\def\defname#1#2#3{%
6380
  % Get the values of \leftskip and \rightskip as they were outside the @def...
6381
  \advance\leftskip by -\defbodyindent
6382
  %
6383
  % How we'll format the type name.  Putting it in brackets helps
6384
  % distinguish it from the body text that may end up on the next line
6385
  % just below it.
6386
  \def\temp{#1}%
6387
  \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
6388
  %
6389
  % Figure out line sizes for the paragraph shape.
6390
  % The first line needs space for \box0; but if \rightskip is nonzero,
6391
  % we need only space for the part of \box0 which exceeds it:
6392
  \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
6393
  % The continuations:
6394
  \dimen2=\hsize  \advance\dimen2 by -\defargsindent
6395
  % (plain.tex says that \dimen1 should be used only as global.)
6396
  \parshape 2 0in \dimen0 \defargsindent \dimen2
6397
  %
6398
  % Put the type name to the right margin.
6399
  \noindent
6400
  \hbox to 0pt{%
6401
    \hfil\box0 \kern-\hsize
6402
    % \hsize has to be shortened this way:
6403
    \kern\leftskip
6404
    % Intentionally do not respect \rightskip, since we need the space.
6405
  }%
6406
  %
6407
  % Allow all lines to be underfull without complaint:
6408
  \tolerance=10000 \hbadness=10000
6409
  \exdentamount=\defbodyindent
6410
  {%
6411
    % defun fonts. We use typewriter by default (used to be bold) because:
6412
    % . we're printing identifiers, they should be in tt in principle.
6413
    % . in languages with many accents, such as Czech or French, it's
6414
    %   common to leave accents off identifiers.  The result looks ok in
6415
    %   tt, but exceedingly strange in rm.
6416
    % . we don't want -- and --- to be treated as ligatures.
6417
    % . this still does not fix the ?` and !` ligatures, but so far no
6418
    %   one has made identifiers using them :).
6419
    \df \tt
6420
    \def\temp{#2}% return value type
6421
    \ifx\temp\empty\else \tclose{\temp} \fi
6422
    #3% output function name
6423
  }%
6424
  {\rm\enskip}% hskip 0.5 em of \tenrm
6425
  %
6426
  \boldbrax
6427
  % arguments will be output next, if any.
6428
}
6429
 
6430
% Print arguments in slanted roman (not ttsl), inconsistently with using
6431
% tt for the name.  This is because literal text is sometimes needed in
6432
% the argument list (groff manual), and ttsl and tt are not very
6433
% distinguishable.  Prevent hyphenation at `-' chars.
6434
%
6435
\def\defunargs#1{%
6436
  % use sl by default (not ttsl),
6437
  % tt for the names.
6438
  \df \sl \hyphenchar\font=0
6439
  %
6440
  % On the other hand, if an argument has two dashes (for instance), we
6441
  % want a way to get ttsl.  Let's try @var for that.
6442
  \let\var=\ttslanted
6443
  #1%
6444
  \sl\hyphenchar\font=45
6445
}
6446
 
6447
% We want ()&[] to print specially on the defun line.
6448
%
6449
\def\activeparens{%
6450
  \catcode`\(=\active \catcode`\)=\active
6451
  \catcode`\[=\active \catcode`\]=\active
6452
  \catcode`\&=\active
6453
}
6454
 
6455
% Make control sequences which act like normal parenthesis chars.
6456
\let\lparen = ( \let\rparen = )
6457
 
6458
% Be sure that we always have a definition for `(', etc.  For example,
6459
% if the fn name has parens in it, \boldbrax will not be in effect yet,
6460
% so TeX would otherwise complain about undefined control sequence.
6461
{
6462
  \activeparens
6463
  \global\let(=\lparen \global\let)=\rparen
6464
  \global\let[=\lbrack \global\let]=\rbrack
6465
  \global\let& = \&
6466
 
6467
  \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
6468
  \gdef\magicamp{\let&=\amprm}
6469
}
6470
 
6471
\newcount\parencount
6472
 
6473
% If we encounter &foo, then turn on ()-hacking afterwards
6474
\newif\ifampseen
6475
\def\amprm#1 {\ampseentrue{\bf\&#1 }}
6476
 
6477
\def\parenfont{%
6478
  \ifampseen
6479
    % At the first level, print parens in roman,
6480
    % otherwise use the default font.
6481
    \ifnum \parencount=1 \rm \fi
6482
  \else
6483
    % The \sf parens (in \boldbrax) actually are a little bolder than
6484
    % the contained text.  This is especially needed for [ and ] .
6485
    \sf
6486
  \fi
6487
}
6488
\def\infirstlevel#1{%
6489
  \ifampseen
6490
    \ifnum\parencount=1
6491
      #1%
6492
    \fi
6493
  \fi
6494
}
6495
\def\bfafterword#1 {#1 \bf}
6496
 
6497
\def\opnr{%
6498
  \global\advance\parencount by 1
6499
  {\parenfont(}%
6500
  \infirstlevel \bfafterword
6501
}
6502
\def\clnr{%
6503
  {\parenfont)}%
6504
  \infirstlevel \sl
6505
  \global\advance\parencount by -1
6506
}
6507
 
6508
\newcount\brackcount
6509
\def\lbrb{%
6510
  \global\advance\brackcount by 1
6511
  {\bf[}%
6512
}
6513
\def\rbrb{%
6514
  {\bf]}%
6515
  \global\advance\brackcount by -1
6516
}
6517
 
6518
\def\checkparencounts{%
6519
  \ifnum\parencount=0 \else \badparencount \fi
6520
  \ifnum\brackcount=0 \else \badbrackcount \fi
6521
}
6522
% these should not use \errmessage; the glibc manual, at least, actually
6523
% has such constructs (when documenting function pointers).
6524
\def\badparencount{%
6525
  \message{Warning: unbalanced parentheses in @def...}%
6526
  \global\parencount=0
6527
}
6528
\def\badbrackcount{%
6529
  \message{Warning: unbalanced square brackets in @def...}%
6530
  \global\brackcount=0
6531
}
6532
 
6533
 
6534
\message{macros,}
6535
% @macro.
6536
 
6537
% To do this right we need a feature of e-TeX, \scantokens,
6538
% which we arrange to emulate with a temporary file in ordinary TeX.
6539
\ifx\eTeXversion\undefined
6540
  \newwrite\macscribble
6541
  \def\scantokens#1{%
6542
    \toks0={#1}%
6543
    \immediate\openout\macscribble=\jobname.tmp
6544
    \immediate\write\macscribble{\the\toks0}%
6545
    \immediate\closeout\macscribble
6546
    \input \jobname.tmp
6547
  }
6548
\fi
6549
 
6550
\def\scanmacro#1{%
6551
  \begingroup
6552
    \newlinechar`\^^M
6553
    \let\xeatspaces\eatspaces
6554
    % Undo catcode changes of \startcontents and \doprintindex
6555
    % When called from @insertcopying or (short)caption, we need active
6556
    % backslash to get it printed correctly.  Previously, we had
6557
    % \catcode`\\=\other instead.  We'll see whether a problem appears
6558
    % with macro expansion.                             --kasal, 19aug04
6559
    \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
6560
    % ... and \example
6561
    \spaceisspace
6562
    %
6563
    % Append \endinput to make sure that TeX does not see the ending newline.
6564
    % I've verified that it is necessary both for e-TeX and for ordinary TeX
6565
    %                                                   --kasal, 29nov03
6566
    \scantokens{#1\endinput}%
6567
  \endgroup
6568
}
6569
 
6570
\def\scanexp#1{%
6571
  \edef\temp{\noexpand\scanmacro{#1}}%
6572
  \temp
6573
}
6574
 
6575
\newcount\paramno   % Count of parameters
6576
\newtoks\macname    % Macro name
6577
\newif\ifrecursive  % Is it recursive?
6578
 
6579
% List of all defined macros in the form
6580
%    \definedummyword\macro1\definedummyword\macro2...
6581
% Currently is also contains all @aliases; the list can be split
6582
% if there is a need.
6583
\def\macrolist{}
6584
 
6585
% Add the macro to \macrolist
6586
\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
6587
\def\addtomacrolistxxx#1{%
6588
     \toks0 = \expandafter{\macrolist\definedummyword#1}%
6589
     \xdef\macrolist{\the\toks0}%
6590
}
6591
 
6592
% Utility routines.
6593
% This does \let #1 = #2, with \csnames; that is,
6594
%   \let \csname#1\endcsname = \csname#2\endcsname
6595
% (except of course we have to play expansion games).
6596
%
6597
\def\cslet#1#2{%
6598
  \expandafter\let
6599
  \csname#1\expandafter\endcsname
6600
  \csname#2\endcsname
6601
}
6602
 
6603
% Trim leading and trailing spaces off a string.
6604
% Concepts from aro-bend problem 15 (see CTAN).
6605
{\catcode`\@=11
6606
\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
6607
\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
6608
\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
6609
\def\unbrace#1{#1}
6610
\unbrace{\gdef\trim@@@ #1 } #2@{#1}
6611
}
6612
 
6613
% Trim a single trailing ^^M off a string.
6614
{\catcode`\^^M=\other \catcode`\Q=3%
6615
\gdef\eatcr #1{\eatcra #1Q^^MQ}%
6616
\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
6617
\gdef\eatcrb#1Q#2Q{#1}%
6618
}
6619
 
6620
% Macro bodies are absorbed as an argument in a context where
6621
% all characters are catcode 10, 11 or 12, except \ which is active
6622
% (as in normal texinfo). It is necessary to change the definition of \.
6623
 
6624
% Non-ASCII encodings make 8-bit characters active, so un-activate
6625
% them to avoid their expansion.  Must do this non-globally, to
6626
% confine the change to the current group.
6627
 
6628
% It's necessary to have hard CRs when the macro is executed. This is
6629
% done by  making ^^M (\endlinechar) catcode 12 when reading the macro
6630
% body, and then making it the \newlinechar in \scanmacro.
6631
 
6632
\def\scanctxt{%
6633
  \catcode`\"=\other
6634
  \catcode`\+=\other
6635
  \catcode`\<=\other
6636
  \catcode`\>=\other
6637
  \catcode`\@=\other
6638
  \catcode`\^=\other
6639
  \catcode`\_=\other
6640
  \catcode`\|=\other
6641
  \catcode`\~=\other
6642
  \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
6643
}
6644
 
6645
\def\scanargctxt{%
6646
  \scanctxt
6647
  \catcode`\\=\other
6648
  \catcode`\^^M=\other
6649
}
6650
 
6651
\def\macrobodyctxt{%
6652
  \scanctxt
6653
  \catcode`\{=\other
6654
  \catcode`\}=\other
6655
  \catcode`\^^M=\other
6656
  \usembodybackslash
6657
}
6658
 
6659
\def\macroargctxt{%
6660
  \scanctxt
6661
  \catcode`\\=\other
6662
}
6663
 
6664
% \mbodybackslash is the definition of \ in @macro bodies.
6665
% It maps \foo\ => \csname macarg.foo\endcsname => #N
6666
% where N is the macro parameter number.
6667
% We define \csname macarg.\endcsname to be \realbackslash, so
6668
% \\ in macro replacement text gets you a backslash.
6669
 
6670
{\catcode`@=0 @catcode`@\=@active
6671
 @gdef@usembodybackslash{@let\=@mbodybackslash}
6672
 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
6673
}
6674
\expandafter\def\csname macarg.\endcsname{\realbackslash}
6675
 
6676
\def\macro{\recursivefalse\parsearg\macroxxx}
6677
\def\rmacro{\recursivetrue\parsearg\macroxxx}
6678
 
6679
\def\macroxxx#1{%
6680
  \getargs{#1}%           now \macname is the macname and \argl the arglist
6681
  \ifx\argl\empty       % no arguments
6682
     \paramno=0%
6683
  \else
6684
     \expandafter\parsemargdef \argl;%
6685
  \fi
6686
  \if1\csname ismacro.\the\macname\endcsname
6687
     \message{Warning: redefining \the\macname}%
6688
  \else
6689
     \expandafter\ifx\csname \the\macname\endcsname \relax
6690
     \else \errmessage{Macro name \the\macname\space already defined}\fi
6691
     \global\cslet{macsave.\the\macname}{\the\macname}%
6692
     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
6693
     \addtomacrolist{\the\macname}%
6694
  \fi
6695
  \begingroup \macrobodyctxt
6696
  \ifrecursive \expandafter\parsermacbody
6697
  \else \expandafter\parsemacbody
6698
  \fi}
6699
 
6700
\parseargdef\unmacro{%
6701
  \if1\csname ismacro.#1\endcsname
6702
    \global\cslet{#1}{macsave.#1}%
6703
    \global\expandafter\let \csname ismacro.#1\endcsname=0%
6704
    % Remove the macro name from \macrolist:
6705
    \begingroup
6706
      \expandafter\let\csname#1\endcsname \relax
6707
      \let\definedummyword\unmacrodo
6708
      \xdef\macrolist{\macrolist}%
6709
    \endgroup
6710
  \else
6711
    \errmessage{Macro #1 not defined}%
6712
  \fi
6713
}
6714
 
6715
% Called by \do from \dounmacro on each macro.  The idea is to omit any
6716
% macro definitions that have been changed to \relax.
6717
%
6718
\def\unmacrodo#1{%
6719
  \ifx #1\relax
6720
    % remove this
6721
  \else
6722
    \noexpand\definedummyword \noexpand#1%
6723
  \fi
6724
}
6725
 
6726
% This makes use of the obscure feature that if the last token of a
6727
% <parameter list> is #, then the preceding argument is delimited by
6728
% an opening brace, and that opening brace is not consumed.
6729
\def\getargs#1{\getargsxxx#1{}}
6730
\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
6731
\def\getmacname #1 #2\relax{\macname={#1}}
6732
\def\getmacargs#1{\def\argl{#1}}
6733
 
6734
% Parse the optional {params} list.  Set up \paramno and \paramlist
6735
% so \defmacro knows what to do.  Define \macarg.blah for each blah
6736
% in the params list, to be ##N where N is the position in that list.
6737
% That gets used by \mbodybackslash (above).
6738
 
6739
% We need to get `macro parameter char #' into several definitions.
6740
% The technique used is stolen from LaTeX:  let \hash be something
6741
% unexpandable, insert that wherever you need a #, and then redefine
6742
% it to # just before using the token list produced.
6743
%
6744
% The same technique is used to protect \eatspaces till just before
6745
% the macro is used.
6746
 
6747
\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
6748
        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
6749
\def\parsemargdefxxx#1,{%
6750
  \if#1;\let\next=\relax
6751
  \else \let\next=\parsemargdefxxx
6752
    \advance\paramno by 1%
6753
    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
6754
        {\xeatspaces{\hash\the\paramno}}%
6755
    \edef\paramlist{\paramlist\hash\the\paramno,}%
6756
  \fi\next}
6757
 
6758
% These two commands read recursive and nonrecursive macro bodies.
6759
% (They're different since rec and nonrec macros end differently.)
6760
 
6761
\long\def\parsemacbody#1@end macro%
6762
{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
6763
\long\def\parsermacbody#1@end rmacro%
6764
{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
6765
 
6766
% This defines the macro itself. There are six cases: recursive and
6767
% nonrecursive macros of zero, one, and many arguments.
6768
% Much magic with \expandafter here.
6769
% \xdef is used so that macro definitions will survive the file
6770
% they're defined in; @include reads the file inside a group.
6771
\def\defmacro{%
6772
  \let\hash=##% convert placeholders to macro parameter chars
6773
  \ifrecursive
6774
    \ifcase\paramno
6775
    % 0
6776
      \expandafter\xdef\csname\the\macname\endcsname{%
6777
        \noexpand\scanmacro{\temp}}%
6778
    \or % 1
6779
      \expandafter\xdef\csname\the\macname\endcsname{%
6780
         \bgroup\noexpand\macroargctxt
6781
         \noexpand\braceorline
6782
         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
6783
      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
6784
         \egroup\noexpand\scanmacro{\temp}}%
6785
    \else % many
6786
      \expandafter\xdef\csname\the\macname\endcsname{%
6787
         \bgroup\noexpand\macroargctxt
6788
         \noexpand\csname\the\macname xx\endcsname}%
6789
      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
6790
          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
6791
      \expandafter\expandafter
6792
      \expandafter\xdef
6793
      \expandafter\expandafter
6794
        \csname\the\macname xxx\endcsname
6795
          \paramlist{\egroup\noexpand\scanmacro{\temp}}%
6796
    \fi
6797
  \else
6798
    \ifcase\paramno
6799
    % 0
6800
      \expandafter\xdef\csname\the\macname\endcsname{%
6801
        \noexpand\norecurse{\the\macname}%
6802
        \noexpand\scanmacro{\temp}\egroup}%
6803
    \or % 1
6804
      \expandafter\xdef\csname\the\macname\endcsname{%
6805
         \bgroup\noexpand\macroargctxt
6806
         \noexpand\braceorline
6807
         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
6808
      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
6809
        \egroup
6810
        \noexpand\norecurse{\the\macname}%
6811
        \noexpand\scanmacro{\temp}\egroup}%
6812
    \else % many
6813
      \expandafter\xdef\csname\the\macname\endcsname{%
6814
         \bgroup\noexpand\macroargctxt
6815
         \expandafter\noexpand\csname\the\macname xx\endcsname}%
6816
      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
6817
          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
6818
      \expandafter\expandafter
6819
      \expandafter\xdef
6820
      \expandafter\expandafter
6821
      \csname\the\macname xxx\endcsname
6822
      \paramlist{%
6823
          \egroup
6824
          \noexpand\norecurse{\the\macname}%
6825
          \noexpand\scanmacro{\temp}\egroup}%
6826
    \fi
6827
  \fi}
6828
 
6829
\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
6830
 
6831
% \braceorline decides whether the next nonwhitespace character is a
6832
% {.  If so it reads up to the closing }, if not, it reads the whole
6833
% line.  Whatever was read is then fed to the next control sequence
6834
% as an argument (by \parsebrace or \parsearg)
6835
\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
6836
\def\braceorlinexxx{%
6837
  \ifx\nchar\bgroup\else
6838
    \expandafter\parsearg
6839
  \fi \macnamexxx}
6840
 
6841
 
6842
% @alias.
6843
% We need some trickery to remove the optional spaces around the equal
6844
% sign.  Just make them active and then expand them all to nothing.
6845
\def\alias{\parseargusing\obeyspaces\aliasxxx}
6846
\def\aliasxxx #1{\aliasyyy#1\relax}
6847
\def\aliasyyy #1=#2\relax{%
6848
  {%
6849
    \expandafter\let\obeyedspace=\empty
6850
    \addtomacrolist{#1}%
6851
    \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
6852
  }%
6853
  \next
6854
}
6855
 
6856
 
6857
\message{cross references,}
6858
 
6859
\newwrite\auxfile
6860
\newif\ifhavexrefs    % True if xref values are known.
6861
\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
6862
 
6863
% @inforef is relatively simple.
6864
\def\inforef #1{\inforefzzz #1,,,,**}
6865
\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
6866
  node \samp{\ignorespaces#1{}}}
6867
 
6868
% @node's only job in TeX is to define \lastnode, which is used in
6869
% cross-references.  The @node line might or might not have commas, and
6870
% might or might not have spaces before the first comma, like:
6871
% @node foo , bar , ...
6872
% We don't want such trailing spaces in the node name.
6873
%
6874
\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
6875
%
6876
% also remove a trailing comma, in case of something like this:
6877
% @node Help-Cross,  ,  , Cross-refs
6878
\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
6879
\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
6880
 
6881
\let\nwnode=\node
6882
\let\lastnode=\empty
6883
 
6884
% Write a cross-reference definition for the current node.  #1 is the
6885
% type (Ynumbered, Yappendix, Ynothing).
6886
%
6887
\def\donoderef#1{%
6888
  \ifx\lastnode\empty\else
6889
    \setref{\lastnode}{#1}%
6890
    \global\let\lastnode=\empty
6891
  \fi
6892
}
6893
 
6894
% @anchor{NAME} -- define xref target at arbitrary point.
6895
%
6896
\newcount\savesfregister
6897
%
6898
\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
6899
\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
6900
\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
6901
 
6902
% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
6903
% anchor), which consists of three parts:
6904
% 1) NAME-title - the current sectioning name taken from \lastsection,
6905
%                 or the anchor name.
6906
% 2) NAME-snt   - section number and type, passed as the SNT arg, or
6907
%                 empty for anchors.
6908
% 3) NAME-pg    - the page number.
6909
%
6910
% This is called from \donoderef, \anchor, and \dofloat.  In the case of
6911
% floats, there is an additional part, which is not written here:
6912
% 4) NAME-lof   - the text as it should appear in a @listoffloats.
6913
%
6914
\def\setref#1#2{%
6915
  \pdfmkdest{#1}%
6916
  \iflinks
6917
    {%
6918
      \atdummies  % preserve commands, but don't expand them
6919
      \edef\writexrdef##1##2{%
6920
        \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
6921
          ##1}{##2}}% these are parameters of \writexrdef
6922
      }%
6923
      \toks0 = \expandafter{\lastsection}%
6924
      \immediate \writexrdef{title}{\the\toks0 }%
6925
      \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
6926
      \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout
6927
    }%
6928
  \fi
6929
}
6930
 
6931
% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
6932
% the node name, #2 the name of the Info cross-reference, #3 the printed
6933
% node name, #4 the name of the Info file, #5 the name of the printed
6934
% manual.  All but the node name can be omitted.
6935
%
6936
\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
6937
\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
6938
\def\ref#1{\xrefX[#1,,,,,,,]}
6939
\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
6940
  \unsepspaces
6941
  \def\printedmanual{\ignorespaces #5}%
6942
  \def\printedrefname{\ignorespaces #3}%
6943
  \setbox1=\hbox{\printedmanual\unskip}%
6944
  \setbox0=\hbox{\printedrefname\unskip}%
6945
  \ifdim \wd0 = 0pt
6946
    % No printed node name was explicitly given.
6947
    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
6948
      % Use the node name inside the square brackets.
6949
      \def\printedrefname{\ignorespaces #1}%
6950
    \else
6951
      % Use the actual chapter/section title appear inside
6952
      % the square brackets.  Use the real section title if we have it.
6953
      \ifdim \wd1 > 0pt
6954
        % It is in another manual, so we don't have it.
6955
        \def\printedrefname{\ignorespaces #1}%
6956
      \else
6957
        \ifhavexrefs
6958
          % We know the real title if we have the xref values.
6959
          \def\printedrefname{\refx{#1-title}{}}%
6960
        \else
6961
          % Otherwise just copy the Info node name.
6962
          \def\printedrefname{\ignorespaces #1}%
6963
        \fi%
6964
      \fi
6965
    \fi
6966
  \fi
6967
  %
6968
  % Make link in pdf output.
6969
  \ifpdf
6970
    {\indexnofonts
6971
     \turnoffactive
6972
     % This expands tokens, so do it after making catcode changes, so _
6973
     % etc. don't get their TeX definitions.
6974
     \getfilename{#4}%
6975
     %
6976
     % See comments at \activebackslashdouble.
6977
     {\activebackslashdouble \xdef\pdfxrefdest{#1}%
6978
      \backslashparens\pdfxrefdest}%
6979
     %
6980
     \leavevmode
6981
     \startlink attr{/Border [0 0 0]}%
6982
     \ifnum\filenamelength>0
6983
       goto file{\the\filename.pdf} name{\pdfxrefdest}%
6984
     \else
6985
       goto name{\pdfmkpgn{\pdfxrefdest}}%
6986
     \fi
6987
    }%
6988
    \setcolor{\linkcolor}%
6989
  \fi
6990
  %
6991
  % Float references are printed completely differently: "Figure 1.2"
6992
  % instead of "[somenode], p.3".  We distinguish them by the
6993
  % LABEL-title being set to a magic string.
6994
  {%
6995
    % Have to otherify everything special to allow the \csname to
6996
    % include an _ in the xref name, etc.
6997
    \indexnofonts
6998
    \turnoffactive
6999
    \expandafter\global\expandafter\let\expandafter\Xthisreftitle
7000
      \csname XR#1-title\endcsname
7001
  }%
7002
  \iffloat\Xthisreftitle
7003
    % If the user specified the print name (third arg) to the ref,
7004
    % print it instead of our usual "Figure 1.2".
7005
    \ifdim\wd0 = 0pt
7006
      \refx{#1-snt}{}%
7007
    \else
7008
      \printedrefname
7009
    \fi
7010
    %
7011
    % if the user also gave the printed manual name (fifth arg), append
7012
    % "in MANUALNAME".
7013
    \ifdim \wd1 > 0pt
7014
      \space \putwordin{} \cite{\printedmanual}%
7015
    \fi
7016
  \else
7017
    % node/anchor (non-float) references.
7018
    %
7019
    % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
7020
    % insert empty discretionaries after hyphens, which means that it will
7021
    % not find a line break at a hyphen in a node names.  Since some manuals
7022
    % are best written with fairly long node names, containing hyphens, this
7023
    % is a loss.  Therefore, we give the text of the node name again, so it
7024
    % is as if TeX is seeing it for the first time.
7025
    \ifdim \wd1 > 0pt
7026
      \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
7027
    \else
7028
      % _ (for example) has to be the character _ for the purposes of the
7029
      % control sequence corresponding to the node, but it has to expand
7030
      % into the usual \leavevmode...\vrule stuff for purposes of
7031
      % printing. So we \turnoffactive for the \refx-snt, back on for the
7032
      % printing, back off for the \refx-pg.
7033
      {\turnoffactive
7034
       % Only output a following space if the -snt ref is nonempty; for
7035
       % @unnumbered and @anchor, it won't be.
7036
       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
7037
       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
7038
      }%
7039
      % output the `[mynode]' via a macro so it can be overridden.
7040
      \xrefprintnodename\printedrefname
7041
      %
7042
      % But we always want a comma and a space:
7043
      ,\space
7044
      %
7045
      % output the `page 3'.
7046
      \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
7047
    \fi
7048
  \fi
7049
  \endlink
7050
\endgroup}
7051
 
7052
% This macro is called from \xrefX for the `[nodename]' part of xref
7053
% output.  It's a separate macro only so it can be changed more easily,
7054
% since square brackets don't work well in some documents.  Particularly
7055
% one that Bob is working on :).
7056
%
7057
\def\xrefprintnodename#1{[#1]}
7058
 
7059
% Things referred to by \setref.
7060
%
7061
\def\Ynothing{}
7062
\def\Yomitfromtoc{}
7063
\def\Ynumbered{%
7064
  \ifnum\secno=0
7065
    \putwordChapter@tie \the\chapno
7066
  \else \ifnum\subsecno=0
7067
    \putwordSection@tie \the\chapno.\the\secno
7068
  \else \ifnum\subsubsecno=0
7069
    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
7070
  \else
7071
    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
7072
  \fi\fi\fi
7073
}
7074
\def\Yappendix{%
7075
  \ifnum\secno=0
7076
     \putwordAppendix@tie @char\the\appendixno{}%
7077
  \else \ifnum\subsecno=0
7078
     \putwordSection@tie @char\the\appendixno.\the\secno
7079
  \else \ifnum\subsubsecno=0
7080
    \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
7081
  \else
7082
    \putwordSection@tie
7083
      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
7084
  \fi\fi\fi
7085
}
7086
 
7087
% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
7088
% If its value is nonempty, SUFFIX is output afterward.
7089
%
7090
\def\refx#1#2{%
7091
  {%
7092
    \indexnofonts
7093
    \otherbackslash
7094
    \expandafter\global\expandafter\let\expandafter\thisrefX
7095
      \csname XR#1\endcsname
7096
  }%
7097
  \ifx\thisrefX\relax
7098
    % If not defined, say something at least.
7099
    \angleleft un\-de\-fined\angleright
7100
    \iflinks
7101
      \ifhavexrefs
7102
        \message{\linenumber Undefined cross reference `#1'.}%
7103
      \else
7104
        \ifwarnedxrefs\else
7105
          \global\warnedxrefstrue
7106
          \message{Cross reference values unknown; you must run TeX again.}%
7107
        \fi
7108
      \fi
7109
    \fi
7110
  \else
7111
    % It's defined, so just use it.
7112
    \thisrefX
7113
  \fi
7114
  #2% Output the suffix in any case.
7115
}
7116
 
7117
% This is the macro invoked by entries in the aux file.  Usually it's
7118
% just a \def (we prepend XR to the control sequence name to avoid
7119
% collisions).  But if this is a float type, we have more work to do.
7120
%
7121
\def\xrdef#1#2{%
7122
  {% The node name might contain 8-bit characters, which in our current
7123
   % implementation are changed to commands like @'e.  Don't let these
7124
   % mess up the control sequence name.
7125
    \indexnofonts
7126
    \turnoffactive
7127
    \xdef\safexrefname{#1}%
7128
  }%
7129
  %
7130
  \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
7131
  %
7132
  % Was that xref control sequence that we just defined for a float?
7133
  \expandafter\iffloat\csname XR\safexrefname\endcsname
7134
    % it was a float, and we have the (safe) float type in \iffloattype.
7135
    \expandafter\let\expandafter\floatlist
7136
      \csname floatlist\iffloattype\endcsname
7137
    %
7138
    % Is this the first time we've seen this float type?
7139
    \expandafter\ifx\floatlist\relax
7140
      \toks0 = {\do}% yes, so just \do
7141
    \else
7142
      % had it before, so preserve previous elements in list.
7143
      \toks0 = \expandafter{\floatlist\do}%
7144
    \fi
7145
    %
7146
    % Remember this xref in the control sequence \floatlistFLOATTYPE,
7147
    % for later use in \listoffloats.
7148
    \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
7149
      {\safexrefname}}%
7150
  \fi
7151
}
7152
 
7153
% Read the last existing aux file, if any.  No error if none exists.
7154
%
7155
\def\tryauxfile{%
7156
  \openin 1 \jobname.aux
7157
  \ifeof 1 \else
7158
    \readdatafile{aux}%
7159
    \global\havexrefstrue
7160
  \fi
7161
  \closein 1
7162
}
7163
 
7164
\def\setupdatafile{%
7165
  \catcode`\^^@=\other
7166
  \catcode`\^^A=\other
7167
  \catcode`\^^B=\other
7168
  \catcode`\^^C=\other
7169
  \catcode`\^^D=\other
7170
  \catcode`\^^E=\other
7171
  \catcode`\^^F=\other
7172
  \catcode`\^^G=\other
7173
  \catcode`\^^H=\other
7174
  \catcode`\^^K=\other
7175
  \catcode`\^^L=\other
7176
  \catcode`\^^N=\other
7177
  \catcode`\^^P=\other
7178
  \catcode`\^^Q=\other
7179
  \catcode`\^^R=\other
7180
  \catcode`\^^S=\other
7181
  \catcode`\^^T=\other
7182
  \catcode`\^^U=\other
7183
  \catcode`\^^V=\other
7184
  \catcode`\^^W=\other
7185
  \catcode`\^^X=\other
7186
  \catcode`\^^Z=\other
7187
  \catcode`\^^[=\other
7188
  \catcode`\^^\=\other
7189
  \catcode`\^^]=\other
7190
  \catcode`\^^^=\other
7191
  \catcode`\^^_=\other
7192
  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
7193
  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
7194
  % supported in the main text, it doesn't seem desirable.  Furthermore,
7195
  % that is not enough: for node names that actually contain a ^
7196
  % character, we would end up writing a line like this: 'xrdef {'hat
7197
  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
7198
  % argument, and \hat is not an expandable control sequence.  It could
7199
  % all be worked out, but why?  Either we support ^^ or we don't.
7200
  %
7201
  % The other change necessary for this was to define \auxhat:
7202
  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
7203
  % and then to call \auxhat in \setq.
7204
  %
7205
  \catcode`\^=\other
7206
  %
7207
  % Special characters.  Should be turned off anyway, but...
7208
  \catcode`\~=\other
7209
  \catcode`\[=\other
7210
  \catcode`\]=\other
7211
  \catcode`\"=\other
7212
  \catcode`\_=\other
7213
  \catcode`\|=\other
7214
  \catcode`\<=\other
7215
  \catcode`\>=\other
7216
  \catcode`\$=\other
7217
  \catcode`\#=\other
7218
  \catcode`\&=\other
7219
  \catcode`\%=\other
7220
  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
7221
  %
7222
  % This is to support \ in node names and titles, since the \
7223
  % characters end up in a \csname.  It's easier than
7224
  % leaving it active and making its active definition an actual \
7225
  % character.  What I don't understand is why it works in the *value*
7226
  % of the xrdef.  Seems like it should be a catcode12 \, and that
7227
  % should not typeset properly.  But it works, so I'm moving on for
7228
  % now.  --karl, 15jan04.
7229
  \catcode`\\=\other
7230
  %
7231
  % Make the characters 128-255 be printing characters.
7232
  {%
7233
    \count1=128
7234
    \def\loop{%
7235
      \catcode\count1=\other
7236
      \advance\count1 by 1
7237
      \ifnum \count1<256 \loop \fi
7238
    }%
7239
  }%
7240
  %
7241
  % @ is our escape character in .aux files, and we need braces.
7242
  \catcode`\{=1
7243
  \catcode`\}=2
7244
  \catcode`\@=0
7245
}
7246
 
7247
\def\readdatafile#1{%
7248
\begingroup
7249
  \setupdatafile
7250
  \input\jobname.#1
7251
\endgroup}
7252
 
7253
 
7254
\message{insertions,}
7255
% including footnotes.
7256
 
7257
\newcount \footnoteno
7258
 
7259
% The trailing space in the following definition for supereject is
7260
% vital for proper filling; pages come out unaligned when you do a
7261
% pagealignmacro call if that space before the closing brace is
7262
% removed. (Generally, numeric constants should always be followed by a
7263
% space to prevent strange expansion errors.)
7264
\def\supereject{\par\penalty -20000\footnoteno =0 }
7265
 
7266
% @footnotestyle is meaningful for info output only.
7267
\let\footnotestyle=\comment
7268
 
7269
{\catcode `\@=11
7270
%
7271
% Auto-number footnotes.  Otherwise like plain.
7272
\gdef\footnote{%
7273
  \let\indent=\ptexindent
7274
  \let\noindent=\ptexnoindent
7275
  \global\advance\footnoteno by \@ne
7276
  \edef\thisfootno{$^{\the\footnoteno}$}%
7277
  %
7278
  % In case the footnote comes at the end of a sentence, preserve the
7279
  % extra spacing after we do the footnote number.
7280
  \let\@sf\empty
7281
  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
7282
  %
7283
  % Remove inadvertent blank space before typesetting the footnote number.
7284
  \unskip
7285
  \thisfootno\@sf
7286
  \dofootnote
7287
}%
7288
 
7289
% Don't bother with the trickery in plain.tex to not require the
7290
% footnote text as a parameter.  Our footnotes don't need to be so general.
7291
%
7292
% Oh yes, they do; otherwise, @ifset (and anything else that uses
7293
% \parseargline) fails inside footnotes because the tokens are fixed when
7294
% the footnote is read.  --karl, 16nov96.
7295
%
7296
\gdef\dofootnote{%
7297
  \insert\footins\bgroup
7298
  % We want to typeset this text as a normal paragraph, even if the
7299
  % footnote reference occurs in (for example) a display environment.
7300
  % So reset some parameters.
7301
  \hsize=\pagewidth
7302
  \interlinepenalty\interfootnotelinepenalty
7303
  \splittopskip\ht\strutbox % top baseline for broken footnotes
7304
  \splitmaxdepth\dp\strutbox
7305
  \floatingpenalty\@MM
7306
  \leftskip\z@skip
7307
  \rightskip\z@skip
7308
  \spaceskip\z@skip
7309
  \xspaceskip\z@skip
7310
  \parindent\defaultparindent
7311
  %
7312
  \smallfonts \rm
7313
  %
7314
  % Because we use hanging indentation in footnotes, a @noindent appears
7315
  % to exdent this text, so make it be a no-op.  makeinfo does not use
7316
  % hanging indentation so @noindent can still be needed within footnote
7317
  % text after an @example or the like (not that this is good style).
7318
  \let\noindent = \relax
7319
  %
7320
  % Hang the footnote text off the number.  Use \everypar in case the
7321
  % footnote extends for more than one paragraph.
7322
  \everypar = {\hang}%
7323
  \textindent{\thisfootno}%
7324
  %
7325
  % Don't crash into the line above the footnote text.  Since this
7326
  % expands into a box, it must come within the paragraph, lest it
7327
  % provide a place where TeX can split the footnote.
7328
  \footstrut
7329
  \futurelet\next\fo@t
7330
}
7331
}%end \catcode `\@=11
7332
 
7333
% In case a @footnote appears in a vbox, save the footnote text and create
7334
% the real \insert just after the vbox finished.  Otherwise, the insertion
7335
% would be lost.
7336
% Similarily, if a @footnote appears inside an alignment, save the footnote
7337
% text to a box and make the \insert when a row of the table is finished.
7338
% And the same can be done for other insert classes.  --kasal, 16nov03.
7339
 
7340
% Replace the \insert primitive by a cheating macro.
7341
% Deeper inside, just make sure that the saved insertions are not spilled
7342
% out prematurely.
7343
%
7344
\def\startsavinginserts{%
7345
  \ifx \insert\ptexinsert
7346
    \let\insert\saveinsert
7347
  \else
7348
    \let\checkinserts\relax
7349
  \fi
7350
}
7351
 
7352
% This \insert replacement works for both \insert\footins{foo} and
7353
% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
7354
%
7355
\def\saveinsert#1{%
7356
  \edef\next{\noexpand\savetobox \makeSAVEname#1}%
7357
  \afterassignment\next
7358
  % swallow the left brace
7359
  \let\temp =
7360
}
7361
\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
7362
\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
7363
 
7364
\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
7365
 
7366
\def\placesaveins#1{%
7367
  \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
7368
    {\box#1}%
7369
}
7370
 
7371
% eat @SAVE -- beware, all of them have catcode \other:
7372
{
7373
  \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
7374
  \gdef\gobblesave @SAVE{}
7375
}
7376
 
7377
% initialization:
7378
\def\newsaveins #1{%
7379
  \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
7380
  \next
7381
}
7382
\def\newsaveinsX #1{%
7383
  \csname newbox\endcsname #1%
7384
  \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
7385
    \checksaveins #1}%
7386
}
7387
 
7388
% initialize:
7389
\let\checkinserts\empty
7390
\newsaveins\footins
7391
\newsaveins\margin
7392
 
7393
 
7394
% @image.  We use the macros from epsf.tex to support this.
7395
% If epsf.tex is not installed and @image is used, we complain.
7396
%
7397
% Check for and read epsf.tex up front.  If we read it only at @image
7398
% time, we might be inside a group, and then its definitions would get
7399
% undone and the next image would fail.
7400
\openin 1 = epsf.tex
7401
\ifeof 1 \else
7402
  % Do not bother showing banner with epsf.tex v2.7k (available in
7403
  % doc/epsf.tex and on ctan).
7404
  \def\epsfannounce{\toks0 = }%
7405
  \input epsf.tex
7406
\fi
7407
\closein 1
7408
%
7409
% We will only complain once about lack of epsf.tex.
7410
\newif\ifwarnednoepsf
7411
\newhelp\noepsfhelp{epsf.tex must be installed for images to
7412
  work.  It is also included in the Texinfo distribution, or you can get
7413
  it from ftp://tug.org/tex/epsf.tex.}
7414
%
7415
\def\image#1{%
7416
  \ifx\epsfbox\undefined
7417
    \ifwarnednoepsf \else
7418
      \errhelp = \noepsfhelp
7419
      \errmessage{epsf.tex not found, images will be ignored}%
7420
      \global\warnednoepsftrue
7421
    \fi
7422
  \else
7423
    \imagexxx #1,,,,,\finish
7424
  \fi
7425
}
7426
%
7427
% Arguments to @image:
7428
% #1 is (mandatory) image filename; we tack on .eps extension.
7429
% #2 is (optional) width, #3 is (optional) height.
7430
% #4 is (ignored optional) html alt text.
7431
% #5 is (ignored optional) extension.
7432
% #6 is just the usual extra ignored arg for parsing this stuff.
7433
\newif\ifimagevmode
7434
\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
7435
  \catcode`\^^M = 5     % in case we're inside an example
7436
  \normalturnoffactive  % allow _ et al. in names
7437
  % If the image is by itself, center it.
7438
  \ifvmode
7439
    \imagevmodetrue
7440
    \nobreak\bigskip
7441
    % Usually we'll have text after the image which will insert
7442
    % \parskip glue, so insert it here too to equalize the space
7443
    % above and below.
7444
    \nobreak\vskip\parskip
7445
    \nobreak
7446
    \line\bgroup
7447
  \fi
7448
  %
7449
  % Output the image.
7450
  \ifpdf
7451
    \dopdfimage{#1}{#2}{#3}%
7452
  \else
7453
    % \epsfbox itself resets \epsf?size at each figure.
7454
    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
7455
    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
7456
    \epsfbox{#1.eps}%
7457
  \fi
7458
  %
7459
  \ifimagevmode \egroup \bigbreak \fi  % space after the image
7460
\endgroup}
7461
 
7462
 
7463
% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
7464
% etc.  We don't actually implement floating yet, we always include the
7465
% float "here".  But it seemed the best name for the future.
7466
%
7467
\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
7468
 
7469
% There may be a space before second and/or third parameter; delete it.
7470
\def\eatcommaspace#1, {#1,}
7471
 
7472
% #1 is the optional FLOATTYPE, the text label for this float, typically
7473
% "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
7474
% this float will not be numbered and cannot be referred to.
7475
%
7476
% #2 is the optional xref label.  Also must be present for the float to
7477
% be referable.
7478
%
7479
% #3 is the optional positioning argument; for now, it is ignored.  It
7480
% will somehow specify the positions allowed to float to (here, top, bottom).
7481
%
7482
% We keep a separate counter for each FLOATTYPE, which we reset at each
7483
% chapter-level command.
7484
\let\resetallfloatnos=\empty
7485
%
7486
\def\dofloat#1,#2,#3,#4\finish{%
7487
  \let\thiscaption=\empty
7488
  \let\thisshortcaption=\empty
7489
  %
7490
  % don't lose footnotes inside @float.
7491
  %
7492
  % BEWARE: when the floats start float, we have to issue warning whenever an
7493
  % insert appears inside a float which could possibly float. --kasal, 26may04
7494
  %
7495
  \startsavinginserts
7496
  %
7497
  % We can't be used inside a paragraph.
7498
  \par
7499
  %
7500
  \vtop\bgroup
7501
    \def\floattype{#1}%
7502
    \def\floatlabel{#2}%
7503
    \def\floatloc{#3}% we do nothing with this yet.
7504
    %
7505
    \ifx\floattype\empty
7506
      \let\safefloattype=\empty
7507
    \else
7508
      {%
7509
        % the floattype might have accents or other special characters,
7510
        % but we need to use it in a control sequence name.
7511
        \indexnofonts
7512
        \turnoffactive
7513
        \xdef\safefloattype{\floattype}%
7514
      }%
7515
    \fi
7516
    %
7517
    % If label is given but no type, we handle that as the empty type.
7518
    \ifx\floatlabel\empty \else
7519
      % We want each FLOATTYPE to be numbered separately (Figure 1,
7520
      % Table 1, Figure 2, ...).  (And if no label, no number.)
7521
      %
7522
      \expandafter\getfloatno\csname\safefloattype floatno\endcsname
7523
      \global\advance\floatno by 1
7524
      %
7525
      {%
7526
        % This magic value for \lastsection is output by \setref as the
7527
        % XREFLABEL-title value.  \xrefX uses it to distinguish float
7528
        % labels (which have a completely different output format) from
7529
        % node and anchor labels.  And \xrdef uses it to construct the
7530
        % lists of floats.
7531
        %
7532
        \edef\lastsection{\floatmagic=\safefloattype}%
7533
        \setref{\floatlabel}{Yfloat}%
7534
      }%
7535
    \fi
7536
    %
7537
    % start with \parskip glue, I guess.
7538
    \vskip\parskip
7539
    %
7540
    % Don't suppress indentation if a float happens to start a section.
7541
    \restorefirstparagraphindent
7542
}
7543
 
7544
% we have these possibilities:
7545
% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
7546
% @float Foo,lbl & no caption:    Foo 1.1
7547
% @float Foo & @caption{Cap}:     Foo: Cap
7548
% @float Foo & no caption:        Foo
7549
% @float ,lbl & Caption{Cap}:     1.1: Cap
7550
% @float ,lbl & no caption:       1.1
7551
% @float & @caption{Cap}:         Cap
7552
% @float & no caption:
7553
%
7554
\def\Efloat{%
7555
    \let\floatident = \empty
7556
    %
7557
    % In all cases, if we have a float type, it comes first.
7558
    \ifx\floattype\empty \else \def\floatident{\floattype}\fi
7559
    %
7560
    % If we have an xref label, the number comes next.
7561
    \ifx\floatlabel\empty \else
7562
      \ifx\floattype\empty \else % if also had float type, need tie first.
7563
        \appendtomacro\floatident{\tie}%
7564
      \fi
7565
      % the number.
7566
      \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
7567
    \fi
7568
    %
7569
    % Start the printed caption with what we've constructed in
7570
    % \floatident, but keep it separate; we need \floatident again.
7571
    \let\captionline = \floatident
7572
    %
7573
    \ifx\thiscaption\empty \else
7574
      \ifx\floatident\empty \else
7575
        \appendtomacro\captionline{: }% had ident, so need a colon between
7576
      \fi
7577
      %
7578
      % caption text.
7579
      \appendtomacro\captionline{\scanexp\thiscaption}%
7580
    \fi
7581
    %
7582
    % If we have anything to print, print it, with space before.
7583
    % Eventually this needs to become an \insert.
7584
    \ifx\captionline\empty \else
7585
      \vskip.5\parskip
7586
      \captionline
7587
      %
7588
      % Space below caption.
7589
      \vskip\parskip
7590
    \fi
7591
    %
7592
    % If have an xref label, write the list of floats info.  Do this
7593
    % after the caption, to avoid chance of it being a breakpoint.
7594
    \ifx\floatlabel\empty \else
7595
      % Write the text that goes in the lof to the aux file as
7596
      % \floatlabel-lof.  Besides \floatident, we include the short
7597
      % caption if specified, else the full caption if specified, else nothing.
7598
      {%
7599
        \atdummies
7600
        %
7601
        % since we read the caption text in the macro world, where ^^M
7602
        % is turned into a normal character, we have to scan it back, so
7603
        % we don't write the literal three characters "^^M" into the aux file.
7604
        \scanexp{%
7605
          \xdef\noexpand\gtemp{%
7606
            \ifx\thisshortcaption\empty
7607
              \thiscaption
7608
            \else
7609
              \thisshortcaption
7610
            \fi
7611
          }%
7612
        }%
7613
        \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
7614
          \ifx\gtemp\empty \else : \gtemp \fi}}%
7615
      }%
7616
    \fi
7617
  \egroup  % end of \vtop
7618
  %
7619
  % place the captured inserts
7620
  %
7621
  % BEWARE: when the floats start floating, we have to issue warning
7622
  % whenever an insert appears inside a float which could possibly
7623
  % float. --kasal, 26may04
7624
  %
7625
  \checkinserts
7626
}
7627
 
7628
% Append the tokens #2 to the definition of macro #1, not expanding either.
7629
%
7630
\def\appendtomacro#1#2{%
7631
  \expandafter\def\expandafter#1\expandafter{#1#2}%
7632
}
7633
 
7634
% @caption, @shortcaption
7635
%
7636
\def\caption{\docaption\thiscaption}
7637
\def\shortcaption{\docaption\thisshortcaption}
7638
\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
7639
\def\defcaption#1#2{\egroup \def#1{#2}}
7640
 
7641
% The parameter is the control sequence identifying the counter we are
7642
% going to use.  Create it if it doesn't exist and assign it to \floatno.
7643
\def\getfloatno#1{%
7644
  \ifx#1\relax
7645
      % Haven't seen this figure type before.
7646
      \csname newcount\endcsname #1%
7647
      %
7648
      % Remember to reset this floatno at the next chap.
7649
      \expandafter\gdef\expandafter\resetallfloatnos
7650
        \expandafter{\resetallfloatnos #1=0 }%
7651
  \fi
7652
  \let\floatno#1%
7653
}
7654
 
7655
% \setref calls this to get the XREFLABEL-snt value.  We want an @xref
7656
% to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
7657
% first read the @float command.
7658
%
7659
\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
7660
 
7661
% Magic string used for the XREFLABEL-title value, so \xrefX can
7662
% distinguish floats from other xref types.
7663
\def\floatmagic{!!float!!}
7664
 
7665
% #1 is the control sequence we are passed; we expand into a conditional
7666
% which is true if #1 represents a float ref.  That is, the magic
7667
% \lastsection value which we \setref above.
7668
%
7669
\def\iffloat#1{\expandafter\doiffloat#1==\finish}
7670
%
7671
% #1 is (maybe) the \floatmagic string.  If so, #2 will be the
7672
% (safe) float type for this float.  We set \iffloattype to #2.
7673
%
7674
\def\doiffloat#1=#2=#3\finish{%
7675
  \def\temp{#1}%
7676
  \def\iffloattype{#2}%
7677
  \ifx\temp\floatmagic
7678
}
7679
 
7680
% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
7681
%
7682
\parseargdef\listoffloats{%
7683
  \def\floattype{#1}% floattype
7684
  {%
7685
    % the floattype might have accents or other special characters,
7686
    % but we need to use it in a control sequence name.
7687
    \indexnofonts
7688
    \turnoffactive
7689
    \xdef\safefloattype{\floattype}%
7690
  }%
7691
  %
7692
  % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
7693
  \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
7694
    \ifhavexrefs
7695
      % if the user said @listoffloats foo but never @float foo.
7696
      \message{\linenumber No `\safefloattype' floats to list.}%
7697
    \fi
7698
  \else
7699
    \begingroup
7700
      \leftskip=\tocindent  % indent these entries like a toc
7701
      \let\do=\listoffloatsdo
7702
      \csname floatlist\safefloattype\endcsname
7703
    \endgroup
7704
  \fi
7705
}
7706
 
7707
% This is called on each entry in a list of floats.  We're passed the
7708
% xref label, in the form LABEL-title, which is how we save it in the
7709
% aux file.  We strip off the -title and look up \XRLABEL-lof, which
7710
% has the text we're supposed to typeset here.
7711
%
7712
% Figures without xref labels will not be included in the list (since
7713
% they won't appear in the aux file).
7714
%
7715
\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
7716
\def\listoffloatsdoentry#1-title\finish{{%
7717
  % Can't fully expand XR#1-lof because it can contain anything.  Just
7718
  % pass the control sequence.  On the other hand, XR#1-pg is just the
7719
  % page number, and we want to fully expand that so we can get a link
7720
  % in pdf output.
7721
  \toksA = \expandafter{\csname XR#1-lof\endcsname}%
7722
  %
7723
  % use the same \entry macro we use to generate the TOC and index.
7724
  \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
7725
  \writeentry
7726
}}
7727
 
7728
 
7729
\message{localization,}
7730
 
7731
% @documentlanguage is usually given very early, just after
7732
% @setfilename.  If done too late, it may not override everything
7733
% properly.  Single argument is the language (de) or locale (de_DE)
7734
% abbreviation.  It would be nice if we could set up a hyphenation file.
7735
%
7736
{
7737
  \catcode`\_ = \active
7738
  \globaldefs=1
7739
\parseargdef\documentlanguage{\begingroup
7740
  \let_=\normalunderscore  % normal _ character for filenames
7741
  \tex % read txi-??.tex file in plain TeX.
7742
    % Read the file by the name they passed if it exists.
7743
    \openin 1 txi-#1.tex
7744
    \ifeof 1
7745
      \documentlanguagetrywithoutunderscore{#1_\finish}%
7746
    \else
7747
      \input txi-#1.tex
7748
    \fi
7749
    \closein 1
7750
  \endgroup
7751
\endgroup}
7752
}
7753
%
7754
% If they passed de_DE, and txi-de_DE.tex doesn't exist,
7755
% try txi-de.tex.
7756
%
7757
\def\documentlanguagetrywithoutunderscore#1_#2\finish{%
7758
  \openin 1 txi-#1.tex
7759
  \ifeof 1
7760
    \errhelp = \nolanghelp
7761
    \errmessage{Cannot read language file txi-#1.tex}%
7762
  \else
7763
    \input txi-#1.tex
7764
  \fi
7765
  \closein 1
7766
}
7767
%
7768
\newhelp\nolanghelp{The given language definition file cannot be found or
7769
is empty.  Maybe you need to install it?  In the current directory
7770
should work if nowhere else does.}
7771
 
7772
% Set the catcode of characters 128 through 255 to the specified number.
7773
%
7774
\def\setnonasciicharscatcode#1{%
7775
   \count255=128
7776
   \loop\ifnum\count255<256
7777
      \global\catcode\count255=#1\relax
7778
      \advance\count255 by 1
7779
   \repeat
7780
}
7781
 
7782
\def\setnonasciicharscatcodenonglobal#1{%
7783
   \count255=128
7784
   \loop\ifnum\count255<256
7785
      \catcode\count255=#1\relax
7786
      \advance\count255 by 1
7787
   \repeat
7788
}
7789
 
7790
% @documentencoding sets the definition of non-ASCII characters
7791
% according to the specified encoding.
7792
%
7793
\parseargdef\documentencoding{%
7794
  % Encoding being declared for the document.
7795
  \def\declaredencoding{\csname #1.enc\endcsname}%
7796
  %
7797
  % Supported encodings: names converted to tokens in order to be able
7798
  % to compare them with \ifx.
7799
  \def\ascii{\csname US-ASCII.enc\endcsname}%
7800
  \def\latnine{\csname ISO-8859-15.enc\endcsname}%
7801
  \def\latone{\csname ISO-8859-1.enc\endcsname}%
7802
  \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
7803
  \def\utfeight{\csname UTF-8.enc\endcsname}%
7804
  %
7805
  \ifx \declaredencoding \ascii
7806
     \asciichardefs
7807
  %
7808
  \else \ifx \declaredencoding \lattwo
7809
     \setnonasciicharscatcode\active
7810
     \lattwochardefs
7811
  %
7812
  \else \ifx \declaredencoding \latone
7813
     \setnonasciicharscatcode\active
7814
     \latonechardefs
7815
  %
7816
  \else \ifx \declaredencoding \latnine
7817
     \setnonasciicharscatcode\active
7818
     \latninechardefs
7819
  %
7820
  \else \ifx \declaredencoding \utfeight
7821
     \setnonasciicharscatcode\active
7822
     \utfeightchardefs
7823
  %
7824
  \else
7825
    \message{Unknown document encoding #1, ignoring.}%
7826
  %
7827
  \fi % utfeight
7828
  \fi % latnine
7829
  \fi % latone
7830
  \fi % lattwo
7831
  \fi % ascii
7832
}
7833
 
7834
% A message to be logged when using a character that isn't available
7835
% the default font encoding (OT1).
7836
%
7837
\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
7838
 
7839
% Take account of \c (plain) vs. \, (Texinfo) difference.
7840
\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
7841
 
7842
% First, make active non-ASCII characters in order for them to be
7843
% correctly categorized when TeX reads the replacement text of
7844
% macros containing the character definitions.
7845
\setnonasciicharscatcode\active
7846
%
7847
% Latin1 (ISO-8859-1) character definitions.
7848
\def\latonechardefs{%
7849
  \gdef^^a0{~}
7850
  \gdef^^a1{\exclamdown}
7851
  \gdef^^a2{\missingcharmsg{CENT SIGN}}
7852
  \gdef^^a3{{\pounds}}
7853
  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
7854
  \gdef^^a5{\missingcharmsg{YEN SIGN}}
7855
  \gdef^^a6{\missingcharmsg{BROKEN BAR}}
7856
  \gdef^^a7{\S}
7857
  \gdef^^a8{\"{}}
7858
  \gdef^^a9{\copyright}
7859
  \gdef^^aa{\ordf}
7860
  \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}}
7861
  \gdef^^ac{$\lnot$}
7862
  \gdef^^ad{\-}
7863
  \gdef^^ae{\registeredsymbol}
7864
  \gdef^^af{\={}}
7865
  %
7866
  \gdef^^b0{\textdegree}
7867
  \gdef^^b1{$\pm$}
7868
  \gdef^^b2{$^2$}
7869
  \gdef^^b3{$^3$}
7870
  \gdef^^b4{\'{}}
7871
  \gdef^^b5{$\mu$}
7872
  \gdef^^b6{\P}
7873
  %
7874
  \gdef^^b7{$^.$}
7875
  \gdef^^b8{\cedilla\ }
7876
  \gdef^^b9{$^1$}
7877
  \gdef^^ba{\ordm}
7878
  %
7879
  \gdef^^bb{\missingcharmsg{RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK}}
7880
  \gdef^^bc{$1\over4$}
7881
  \gdef^^bd{$1\over2$}
7882
  \gdef^^be{$3\over4$}
7883
  \gdef^^bf{\questiondown}
7884
  %
7885
  \gdef^^c0{\`A}
7886
  \gdef^^c1{\'A}
7887
  \gdef^^c2{\^A}
7888
  \gdef^^c3{\~A}
7889
  \gdef^^c4{\"A}
7890
  \gdef^^c5{\ringaccent A}
7891
  \gdef^^c6{\AE}
7892
  \gdef^^c7{\cedilla C}
7893
  \gdef^^c8{\`E}
7894
  \gdef^^c9{\'E}
7895
  \gdef^^ca{\^E}
7896
  \gdef^^cb{\"E}
7897
  \gdef^^cc{\`I}
7898
  \gdef^^cd{\'I}
7899
  \gdef^^ce{\^I}
7900
  \gdef^^cf{\"I}
7901
  %
7902
  \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER ETH}}
7903
  \gdef^^d1{\~N}
7904
  \gdef^^d2{\`O}
7905
  \gdef^^d3{\'O}
7906
  \gdef^^d4{\^O}
7907
  \gdef^^d5{\~O}
7908
  \gdef^^d6{\"O}
7909
  \gdef^^d7{$\times$}
7910
  \gdef^^d8{\O}
7911
  \gdef^^d9{\`U}
7912
  \gdef^^da{\'U}
7913
  \gdef^^db{\^U}
7914
  \gdef^^dc{\"U}
7915
  \gdef^^dd{\'Y}
7916
  \gdef^^de{\missingcharmsg{LATIN CAPITAL LETTER THORN}}
7917
  \gdef^^df{\ss}
7918
  %
7919
  \gdef^^e0{\`a}
7920
  \gdef^^e1{\'a}
7921
  \gdef^^e2{\^a}
7922
  \gdef^^e3{\~a}
7923
  \gdef^^e4{\"a}
7924
  \gdef^^e5{\ringaccent a}
7925
  \gdef^^e6{\ae}
7926
  \gdef^^e7{\cedilla c}
7927
  \gdef^^e8{\`e}
7928
  \gdef^^e9{\'e}
7929
  \gdef^^ea{\^e}
7930
  \gdef^^eb{\"e}
7931
  \gdef^^ec{\`{\dotless i}}
7932
  \gdef^^ed{\'{\dotless i}}
7933
  \gdef^^ee{\^{\dotless i}}
7934
  \gdef^^ef{\"{\dotless i}}
7935
  %
7936
  \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER ETH}}
7937
  \gdef^^f1{\~n}
7938
  \gdef^^f2{\`o}
7939
  \gdef^^f3{\'o}
7940
  \gdef^^f4{\^o}
7941
  \gdef^^f5{\~o}
7942
  \gdef^^f6{\"o}
7943
  \gdef^^f7{$\div$}
7944
  \gdef^^f8{\o}
7945
  \gdef^^f9{\`u}
7946
  \gdef^^fa{\'u}
7947
  \gdef^^fb{\^u}
7948
  \gdef^^fc{\"u}
7949
  \gdef^^fd{\'y}
7950
  \gdef^^fe{\missingcharmsg{LATIN SMALL LETTER THORN}}
7951
  \gdef^^ff{\"y}
7952
}
7953
 
7954
% Latin9 (ISO-8859-15) encoding character definitions.
7955
\def\latninechardefs{%
7956
  % Encoding is almost identical to Latin1.
7957
  \latonechardefs
7958
  %
7959
  \gdef^^a4{\euro}
7960
  \gdef^^a6{\v S}
7961
  \gdef^^a8{\v s}
7962
  \gdef^^b4{\v Z}
7963
  \gdef^^b8{\v z}
7964
  \gdef^^bc{\OE}
7965
  \gdef^^bd{\oe}
7966
  \gdef^^be{\"Y}
7967
}
7968
 
7969
% Latin2 (ISO-8859-2) character definitions.
7970
\def\lattwochardefs{%
7971
  \gdef^^a0{~}
7972
  \gdef^^a1{\missingcharmsg{LATIN CAPITAL LETTER A WITH OGONEK}}
7973
  \gdef^^a2{\u{}}
7974
  \gdef^^a3{\L}
7975
  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
7976
  \gdef^^a5{\v L}
7977
  \gdef^^a6{\'S}
7978
  \gdef^^a7{\S}
7979
  \gdef^^a8{\"{}}
7980
  \gdef^^a9{\v S}
7981
  \gdef^^aa{\cedilla S}
7982
  \gdef^^ab{\v T}
7983
  \gdef^^ac{\'Z}
7984
  \gdef^^ad{\-}
7985
  \gdef^^ae{\v Z}
7986
  \gdef^^af{\dotaccent Z}
7987
  %
7988
  \gdef^^b0{\textdegree}
7989
  \gdef^^b1{\missingcharmsg{LATIN SMALL LETTER A WITH OGONEK}}
7990
  \gdef^^b2{\missingcharmsg{OGONEK}}
7991
  \gdef^^b3{\l}
7992
  \gdef^^b4{\'{}}
7993
  \gdef^^b5{\v l}
7994
  \gdef^^b6{\'s}
7995
  \gdef^^b7{\v{}}
7996
  \gdef^^b8{\cedilla\ }
7997
  \gdef^^b9{\v s}
7998
  \gdef^^ba{\cedilla s}
7999
  \gdef^^bb{\v t}
8000
  \gdef^^bc{\'z}
8001
  \gdef^^bd{\H{}}
8002
  \gdef^^be{\v z}
8003
  \gdef^^bf{\dotaccent z}
8004
  %
8005
  \gdef^^c0{\'R}
8006
  \gdef^^c1{\'A}
8007
  \gdef^^c2{\^A}
8008
  \gdef^^c3{\u A}
8009
  \gdef^^c4{\"A}
8010
  \gdef^^c5{\'L}
8011
  \gdef^^c6{\'C}
8012
  \gdef^^c7{\cedilla C}
8013
  \gdef^^c8{\v C}
8014
  \gdef^^c9{\'E}
8015
  \gdef^^ca{\missingcharmsg{LATIN CAPITAL LETTER E WITH OGONEK}}
8016
  \gdef^^cb{\"E}
8017
  \gdef^^cc{\v E}
8018
  \gdef^^cd{\'I}
8019
  \gdef^^ce{\^I}
8020
  \gdef^^cf{\v D}
8021
  %
8022
  \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER D WITH STROKE}}
8023
  \gdef^^d1{\'N}
8024
  \gdef^^d2{\v N}
8025
  \gdef^^d3{\'O}
8026
  \gdef^^d4{\^O}
8027
  \gdef^^d5{\H O}
8028
  \gdef^^d6{\"O}
8029
  \gdef^^d7{$\times$}
8030
  \gdef^^d8{\v R}
8031
  \gdef^^d9{\ringaccent U}
8032
  \gdef^^da{\'U}
8033
  \gdef^^db{\H U}
8034
  \gdef^^dc{\"U}
8035
  \gdef^^dd{\'Y}
8036
  \gdef^^de{\cedilla T}
8037
  \gdef^^df{\ss}
8038
  %
8039
  \gdef^^e0{\'r}
8040
  \gdef^^e1{\'a}
8041
  \gdef^^e2{\^a}
8042
  \gdef^^e3{\u a}
8043
  \gdef^^e4{\"a}
8044
  \gdef^^e5{\'l}
8045
  \gdef^^e6{\'c}
8046
  \gdef^^e7{\cedilla c}
8047
  \gdef^^e8{\v c}
8048
  \gdef^^e9{\'e}
8049
  \gdef^^ea{\missingcharmsg{LATIN SMALL LETTER E WITH OGONEK}}
8050
  \gdef^^eb{\"e}
8051
  \gdef^^ec{\v e}
8052
  \gdef^^ed{\'\i}
8053
  \gdef^^ee{\^\i}
8054
  \gdef^^ef{\v d}
8055
  %
8056
  \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER D WITH STROKE}}
8057
  \gdef^^f1{\'n}
8058
  \gdef^^f2{\v n}
8059
  \gdef^^f3{\'o}
8060
  \gdef^^f4{\^o}
8061
  \gdef^^f5{\H o}
8062
  \gdef^^f6{\"o}
8063
  \gdef^^f7{$\div$}
8064
  \gdef^^f8{\v r}
8065
  \gdef^^f9{\ringaccent u}
8066
  \gdef^^fa{\'u}
8067
  \gdef^^fb{\H u}
8068
  \gdef^^fc{\"u}
8069
  \gdef^^fd{\'y}
8070
  \gdef^^fe{\cedilla t}
8071
  \gdef^^ff{\dotaccent{}}
8072
}
8073
 
8074
% UTF-8 character definitions.
8075
%
8076
% This code to support UTF-8 is based on LaTeX's utf8.def, with some
8077
% changes for Texinfo conventions.  It is included here under the GPL by
8078
% permission from Frank Mittelbach and the LaTeX team.
8079
%
8080
\newcount\countUTFx
8081
\newcount\countUTFy
8082
\newcount\countUTFz
8083
 
8084
\gdef\UTFviiiTwoOctets#1#2{\expandafter
8085
   \UTFviiiDefined\csname u8:#1\string #2\endcsname}
8086
%
8087
\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
8088
   \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
8089
%
8090
\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
8091
   \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
8092
 
8093
\gdef\UTFviiiDefined#1{%
8094
  \ifx #1\relax
8095
    \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
8096
  \else
8097
    \expandafter #1%
8098
  \fi
8099
}
8100
 
8101
\begingroup
8102
  \catcode`\~13
8103
  \catcode`\"12
8104
 
8105
  \def\UTFviiiLoop{%
8106
    \global\catcode\countUTFx\active
8107
    \uccode`\~\countUTFx
8108
    \uppercase\expandafter{\UTFviiiTmp}%
8109
    \advance\countUTFx by 1
8110
    \ifnum\countUTFx < \countUTFy
8111
      \expandafter\UTFviiiLoop
8112
    \fi}
8113
 
8114
  \countUTFx = "C2
8115
  \countUTFy = "E0
8116
  \def\UTFviiiTmp{%
8117
    \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
8118
  \UTFviiiLoop
8119
 
8120
  \countUTFx = "E0
8121
  \countUTFy = "F0
8122
  \def\UTFviiiTmp{%
8123
    \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
8124
  \UTFviiiLoop
8125
 
8126
  \countUTFx = "F0
8127
  \countUTFy = "F4
8128
  \def\UTFviiiTmp{%
8129
    \xdef~{\noexpand\UTFviiiFourOctets\string~}}
8130
  \UTFviiiLoop
8131
\endgroup
8132
 
8133
\begingroup
8134
  \catcode`\"=12
8135
  \catcode`\<=12
8136
  \catcode`\.=12
8137
  \catcode`\,=12
8138
  \catcode`\;=12
8139
  \catcode`\!=12
8140
  \catcode`\~=13
8141
 
8142
  \gdef\DeclareUnicodeCharacter#1#2{%
8143
    \countUTFz = "#1\relax
8144
    \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
8145
    \begingroup
8146
      \parseXMLCharref
8147
      \def\UTFviiiTwoOctets##1##2{%
8148
        \csname u8:##1\string ##2\endcsname}%
8149
      \def\UTFviiiThreeOctets##1##2##3{%
8150
        \csname u8:##1\string ##2\string ##3\endcsname}%
8151
      \def\UTFviiiFourOctets##1##2##3##4{%
8152
        \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
8153
      \expandafter\expandafter\expandafter\expandafter
8154
       \expandafter\expandafter\expandafter
8155
       \gdef\UTFviiiTmp{#2}%
8156
    \endgroup}
8157
 
8158
  \gdef\parseXMLCharref{%
8159
    \ifnum\countUTFz < "A0\relax
8160
      \errhelp = \EMsimple
8161
      \errmessage{Cannot define Unicode char value < 00A0}%
8162
    \else\ifnum\countUTFz < "800\relax
8163
      \parseUTFviiiA,%
8164
      \parseUTFviiiB C\UTFviiiTwoOctets.,%
8165
    \else\ifnum\countUTFz < "10000\relax
8166
      \parseUTFviiiA;%
8167
      \parseUTFviiiA,%
8168
      \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
8169
    \else
8170
      \parseUTFviiiA;%
8171
      \parseUTFviiiA,%
8172
      \parseUTFviiiA!%
8173
      \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
8174
    \fi\fi\fi
8175
  }
8176
 
8177
  \gdef\parseUTFviiiA#1{%
8178
    \countUTFx = \countUTFz
8179
    \divide\countUTFz by 64
8180
    \countUTFy = \countUTFz
8181
    \multiply\countUTFz by 64
8182
    \advance\countUTFx by -\countUTFz
8183
    \advance\countUTFx by 128
8184
    \uccode `#1\countUTFx
8185
    \countUTFz = \countUTFy}
8186
 
8187
  \gdef\parseUTFviiiB#1#2#3#4{%
8188
    \advance\countUTFz by "#10\relax
8189
    \uccode `#3\countUTFz
8190
    \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
8191
\endgroup
8192
 
8193
\def\utfeightchardefs{%
8194
  \DeclareUnicodeCharacter{00A0}{\tie}
8195
  \DeclareUnicodeCharacter{00A1}{\exclamdown}
8196
  \DeclareUnicodeCharacter{00A3}{\pounds}
8197
  \DeclareUnicodeCharacter{00A8}{\"{ }}
8198
  \DeclareUnicodeCharacter{00A9}{\copyright}
8199
  \DeclareUnicodeCharacter{00AA}{\ordf}
8200
  \DeclareUnicodeCharacter{00AB}{\guillemetleft}
8201
  \DeclareUnicodeCharacter{00AD}{\-}
8202
  \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
8203
  \DeclareUnicodeCharacter{00AF}{\={ }}
8204
 
8205
  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
8206
  \DeclareUnicodeCharacter{00B4}{\'{ }}
8207
  \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
8208
  \DeclareUnicodeCharacter{00BA}{\ordm}
8209
  \DeclareUnicodeCharacter{00BB}{\guillemetright}
8210
  \DeclareUnicodeCharacter{00BF}{\questiondown}
8211
 
8212
  \DeclareUnicodeCharacter{00C0}{\`A}
8213
  \DeclareUnicodeCharacter{00C1}{\'A}
8214
  \DeclareUnicodeCharacter{00C2}{\^A}
8215
  \DeclareUnicodeCharacter{00C3}{\~A}
8216
  \DeclareUnicodeCharacter{00C4}{\"A}
8217
  \DeclareUnicodeCharacter{00C5}{\AA}
8218
  \DeclareUnicodeCharacter{00C6}{\AE}
8219
  \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
8220
  \DeclareUnicodeCharacter{00C8}{\`E}
8221
  \DeclareUnicodeCharacter{00C9}{\'E}
8222
  \DeclareUnicodeCharacter{00CA}{\^E}
8223
  \DeclareUnicodeCharacter{00CB}{\"E}
8224
  \DeclareUnicodeCharacter{00CC}{\`I}
8225
  \DeclareUnicodeCharacter{00CD}{\'I}
8226
  \DeclareUnicodeCharacter{00CE}{\^I}
8227
  \DeclareUnicodeCharacter{00CF}{\"I}
8228
 
8229
  \DeclareUnicodeCharacter{00D1}{\~N}
8230
  \DeclareUnicodeCharacter{00D2}{\`O}
8231
  \DeclareUnicodeCharacter{00D3}{\'O}
8232
  \DeclareUnicodeCharacter{00D4}{\^O}
8233
  \DeclareUnicodeCharacter{00D5}{\~O}
8234
  \DeclareUnicodeCharacter{00D6}{\"O}
8235
  \DeclareUnicodeCharacter{00D8}{\O}
8236
  \DeclareUnicodeCharacter{00D9}{\`U}
8237
  \DeclareUnicodeCharacter{00DA}{\'U}
8238
  \DeclareUnicodeCharacter{00DB}{\^U}
8239
  \DeclareUnicodeCharacter{00DC}{\"U}
8240
  \DeclareUnicodeCharacter{00DD}{\'Y}
8241
  \DeclareUnicodeCharacter{00DF}{\ss}
8242
 
8243
  \DeclareUnicodeCharacter{00E0}{\`a}
8244
  \DeclareUnicodeCharacter{00E1}{\'a}
8245
  \DeclareUnicodeCharacter{00E2}{\^a}
8246
  \DeclareUnicodeCharacter{00E3}{\~a}
8247
  \DeclareUnicodeCharacter{00E4}{\"a}
8248
  \DeclareUnicodeCharacter{00E5}{\aa}
8249
  \DeclareUnicodeCharacter{00E6}{\ae}
8250
  \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
8251
  \DeclareUnicodeCharacter{00E8}{\`e}
8252
  \DeclareUnicodeCharacter{00E9}{\'e}
8253
  \DeclareUnicodeCharacter{00EA}{\^e}
8254
  \DeclareUnicodeCharacter{00EB}{\"e}
8255
  \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
8256
  \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
8257
  \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
8258
  \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
8259
 
8260
  \DeclareUnicodeCharacter{00F1}{\~n}
8261
  \DeclareUnicodeCharacter{00F2}{\`o}
8262
  \DeclareUnicodeCharacter{00F3}{\'o}
8263
  \DeclareUnicodeCharacter{00F4}{\^o}
8264
  \DeclareUnicodeCharacter{00F5}{\~o}
8265
  \DeclareUnicodeCharacter{00F6}{\"o}
8266
  \DeclareUnicodeCharacter{00F8}{\o}
8267
  \DeclareUnicodeCharacter{00F9}{\`u}
8268
  \DeclareUnicodeCharacter{00FA}{\'u}
8269
  \DeclareUnicodeCharacter{00FB}{\^u}
8270
  \DeclareUnicodeCharacter{00FC}{\"u}
8271
  \DeclareUnicodeCharacter{00FD}{\'y}
8272
  \DeclareUnicodeCharacter{00FF}{\"y}
8273
 
8274
  \DeclareUnicodeCharacter{0100}{\=A}
8275
  \DeclareUnicodeCharacter{0101}{\=a}
8276
  \DeclareUnicodeCharacter{0102}{\u{A}}
8277
  \DeclareUnicodeCharacter{0103}{\u{a}}
8278
  \DeclareUnicodeCharacter{0106}{\'C}
8279
  \DeclareUnicodeCharacter{0107}{\'c}
8280
  \DeclareUnicodeCharacter{0108}{\^C}
8281
  \DeclareUnicodeCharacter{0109}{\^c}
8282
  \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
8283
  \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
8284
  \DeclareUnicodeCharacter{010C}{\v{C}}
8285
  \DeclareUnicodeCharacter{010D}{\v{c}}
8286
  \DeclareUnicodeCharacter{010E}{\v{D}}
8287
 
8288
  \DeclareUnicodeCharacter{0112}{\=E}
8289
  \DeclareUnicodeCharacter{0113}{\=e}
8290
  \DeclareUnicodeCharacter{0114}{\u{E}}
8291
  \DeclareUnicodeCharacter{0115}{\u{e}}
8292
  \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
8293
  \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
8294
  \DeclareUnicodeCharacter{011A}{\v{E}}
8295
  \DeclareUnicodeCharacter{011B}{\v{e}}
8296
  \DeclareUnicodeCharacter{011C}{\^G}
8297
  \DeclareUnicodeCharacter{011D}{\^g}
8298
  \DeclareUnicodeCharacter{011E}{\u{G}}
8299
  \DeclareUnicodeCharacter{011F}{\u{g}}
8300
 
8301
  \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
8302
  \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
8303
  \DeclareUnicodeCharacter{0124}{\^H}
8304
  \DeclareUnicodeCharacter{0125}{\^h}
8305
  \DeclareUnicodeCharacter{0128}{\~I}
8306
  \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
8307
  \DeclareUnicodeCharacter{012A}{\=I}
8308
  \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
8309
  \DeclareUnicodeCharacter{012C}{\u{I}}
8310
  \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
8311
 
8312
  \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
8313
  \DeclareUnicodeCharacter{0131}{\dotless{i}}
8314
  \DeclareUnicodeCharacter{0132}{IJ}
8315
  \DeclareUnicodeCharacter{0133}{ij}
8316
  \DeclareUnicodeCharacter{0134}{\^J}
8317
  \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
8318
  \DeclareUnicodeCharacter{0139}{\'L}
8319
  \DeclareUnicodeCharacter{013A}{\'l}
8320
 
8321
  \DeclareUnicodeCharacter{0141}{\L}
8322
  \DeclareUnicodeCharacter{0142}{\l}
8323
  \DeclareUnicodeCharacter{0143}{\'N}
8324
  \DeclareUnicodeCharacter{0144}{\'n}
8325
  \DeclareUnicodeCharacter{0147}{\v{N}}
8326
  \DeclareUnicodeCharacter{0148}{\v{n}}
8327
  \DeclareUnicodeCharacter{014C}{\=O}
8328
  \DeclareUnicodeCharacter{014D}{\=o}
8329
  \DeclareUnicodeCharacter{014E}{\u{O}}
8330
  \DeclareUnicodeCharacter{014F}{\u{o}}
8331
 
8332
  \DeclareUnicodeCharacter{0150}{\H{O}}
8333
  \DeclareUnicodeCharacter{0151}{\H{o}}
8334
  \DeclareUnicodeCharacter{0152}{\OE}
8335
  \DeclareUnicodeCharacter{0153}{\oe}
8336
  \DeclareUnicodeCharacter{0154}{\'R}
8337
  \DeclareUnicodeCharacter{0155}{\'r}
8338
  \DeclareUnicodeCharacter{0158}{\v{R}}
8339
  \DeclareUnicodeCharacter{0159}{\v{r}}
8340
  \DeclareUnicodeCharacter{015A}{\'S}
8341
  \DeclareUnicodeCharacter{015B}{\'s}
8342
  \DeclareUnicodeCharacter{015C}{\^S}
8343
  \DeclareUnicodeCharacter{015D}{\^s}
8344
  \DeclareUnicodeCharacter{015E}{\cedilla{S}}
8345
  \DeclareUnicodeCharacter{015F}{\cedilla{s}}
8346
 
8347
  \DeclareUnicodeCharacter{0160}{\v{S}}
8348
  \DeclareUnicodeCharacter{0161}{\v{s}}
8349
  \DeclareUnicodeCharacter{0162}{\cedilla{t}}
8350
  \DeclareUnicodeCharacter{0163}{\cedilla{T}}
8351
  \DeclareUnicodeCharacter{0164}{\v{T}}
8352
 
8353
  \DeclareUnicodeCharacter{0168}{\~U}
8354
  \DeclareUnicodeCharacter{0169}{\~u}
8355
  \DeclareUnicodeCharacter{016A}{\=U}
8356
  \DeclareUnicodeCharacter{016B}{\=u}
8357
  \DeclareUnicodeCharacter{016C}{\u{U}}
8358
  \DeclareUnicodeCharacter{016D}{\u{u}}
8359
  \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
8360
  \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
8361
 
8362
  \DeclareUnicodeCharacter{0170}{\H{U}}
8363
  \DeclareUnicodeCharacter{0171}{\H{u}}
8364
  \DeclareUnicodeCharacter{0174}{\^W}
8365
  \DeclareUnicodeCharacter{0175}{\^w}
8366
  \DeclareUnicodeCharacter{0176}{\^Y}
8367
  \DeclareUnicodeCharacter{0177}{\^y}
8368
  \DeclareUnicodeCharacter{0178}{\"Y}
8369
  \DeclareUnicodeCharacter{0179}{\'Z}
8370
  \DeclareUnicodeCharacter{017A}{\'z}
8371
  \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
8372
  \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
8373
  \DeclareUnicodeCharacter{017D}{\v{Z}}
8374
  \DeclareUnicodeCharacter{017E}{\v{z}}
8375
 
8376
  \DeclareUnicodeCharacter{01C4}{D\v{Z}}
8377
  \DeclareUnicodeCharacter{01C5}{D\v{z}}
8378
  \DeclareUnicodeCharacter{01C6}{d\v{z}}
8379
  \DeclareUnicodeCharacter{01C7}{LJ}
8380
  \DeclareUnicodeCharacter{01C8}{Lj}
8381
  \DeclareUnicodeCharacter{01C9}{lj}
8382
  \DeclareUnicodeCharacter{01CA}{NJ}
8383
  \DeclareUnicodeCharacter{01CB}{Nj}
8384
  \DeclareUnicodeCharacter{01CC}{nj}
8385
  \DeclareUnicodeCharacter{01CD}{\v{A}}
8386
  \DeclareUnicodeCharacter{01CE}{\v{a}}
8387
  \DeclareUnicodeCharacter{01CF}{\v{I}}
8388
 
8389
  \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
8390
  \DeclareUnicodeCharacter{01D1}{\v{O}}
8391
  \DeclareUnicodeCharacter{01D2}{\v{o}}
8392
  \DeclareUnicodeCharacter{01D3}{\v{U}}
8393
  \DeclareUnicodeCharacter{01D4}{\v{u}}
8394
 
8395
  \DeclareUnicodeCharacter{01E2}{\={\AE}}
8396
  \DeclareUnicodeCharacter{01E3}{\={\ae}}
8397
  \DeclareUnicodeCharacter{01E6}{\v{G}}
8398
  \DeclareUnicodeCharacter{01E7}{\v{g}}
8399
  \DeclareUnicodeCharacter{01E8}{\v{K}}
8400
  \DeclareUnicodeCharacter{01E9}{\v{k}}
8401
 
8402
  \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
8403
  \DeclareUnicodeCharacter{01F1}{DZ}
8404
  \DeclareUnicodeCharacter{01F2}{Dz}
8405
  \DeclareUnicodeCharacter{01F3}{dz}
8406
  \DeclareUnicodeCharacter{01F4}{\'G}
8407
  \DeclareUnicodeCharacter{01F5}{\'g}
8408
  \DeclareUnicodeCharacter{01F8}{\`N}
8409
  \DeclareUnicodeCharacter{01F9}{\`n}
8410
  \DeclareUnicodeCharacter{01FC}{\'{\AE}}
8411
  \DeclareUnicodeCharacter{01FD}{\'{\ae}}
8412
  \DeclareUnicodeCharacter{01FE}{\'{\O}}
8413
  \DeclareUnicodeCharacter{01FF}{\'{\o}}
8414
 
8415
  \DeclareUnicodeCharacter{021E}{\v{H}}
8416
  \DeclareUnicodeCharacter{021F}{\v{h}}
8417
 
8418
  \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
8419
  \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
8420
  \DeclareUnicodeCharacter{0228}{\cedilla{E}}
8421
  \DeclareUnicodeCharacter{0229}{\cedilla{e}}
8422
  \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
8423
  \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
8424
 
8425
  \DeclareUnicodeCharacter{0232}{\=Y}
8426
  \DeclareUnicodeCharacter{0233}{\=y}
8427
  \DeclareUnicodeCharacter{0237}{\dotless{j}}
8428
 
8429
  \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
8430
  \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
8431
  \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
8432
  \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
8433
  \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
8434
  \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
8435
  \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
8436
  \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
8437
  \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
8438
  \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
8439
  \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
8440
  \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
8441
 
8442
  \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
8443
  \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
8444
 
8445
  \DeclareUnicodeCharacter{1E20}{\=G}
8446
  \DeclareUnicodeCharacter{1E21}{\=g}
8447
  \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
8448
  \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
8449
  \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
8450
  \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
8451
  \DeclareUnicodeCharacter{1E26}{\"H}
8452
  \DeclareUnicodeCharacter{1E27}{\"h}
8453
 
8454
  \DeclareUnicodeCharacter{1E30}{\'K}
8455
  \DeclareUnicodeCharacter{1E31}{\'k}
8456
  \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
8457
  \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
8458
  \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
8459
  \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
8460
  \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
8461
  \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
8462
  \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
8463
  \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
8464
  \DeclareUnicodeCharacter{1E3E}{\'M}
8465
  \DeclareUnicodeCharacter{1E3F}{\'m}
8466
 
8467
  \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
8468
  \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
8469
  \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
8470
  \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
8471
  \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
8472
  \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
8473
  \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
8474
  \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
8475
  \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
8476
  \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
8477
 
8478
  \DeclareUnicodeCharacter{1E54}{\'P}
8479
  \DeclareUnicodeCharacter{1E55}{\'p}
8480
  \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
8481
  \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
8482
  \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
8483
  \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
8484
  \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
8485
  \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
8486
  \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
8487
  \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
8488
 
8489
  \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
8490
  \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
8491
  \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
8492
  \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
8493
  \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
8494
  \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
8495
  \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
8496
  \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
8497
  \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
8498
  \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
8499
 
8500
  \DeclareUnicodeCharacter{1E7C}{\~V}
8501
  \DeclareUnicodeCharacter{1E7D}{\~v}
8502
  \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
8503
  \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
8504
 
8505
  \DeclareUnicodeCharacter{1E80}{\`W}
8506
  \DeclareUnicodeCharacter{1E81}{\`w}
8507
  \DeclareUnicodeCharacter{1E82}{\'W}
8508
  \DeclareUnicodeCharacter{1E83}{\'w}
8509
  \DeclareUnicodeCharacter{1E84}{\"W}
8510
  \DeclareUnicodeCharacter{1E85}{\"w}
8511
  \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
8512
  \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
8513
  \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
8514
  \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
8515
  \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
8516
  \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
8517
  \DeclareUnicodeCharacter{1E8C}{\"X}
8518
  \DeclareUnicodeCharacter{1E8D}{\"x}
8519
  \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
8520
  \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
8521
 
8522
  \DeclareUnicodeCharacter{1E90}{\^Z}
8523
  \DeclareUnicodeCharacter{1E91}{\^z}
8524
  \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
8525
  \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
8526
  \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
8527
  \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
8528
  \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
8529
  \DeclareUnicodeCharacter{1E97}{\"t}
8530
  \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
8531
  \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
8532
 
8533
  \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
8534
  \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
8535
 
8536
  \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
8537
  \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
8538
  \DeclareUnicodeCharacter{1EBC}{\~E}
8539
  \DeclareUnicodeCharacter{1EBD}{\~e}
8540
 
8541
  \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
8542
  \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
8543
  \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
8544
  \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
8545
 
8546
  \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
8547
  \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
8548
 
8549
  \DeclareUnicodeCharacter{1EF2}{\`Y}
8550
  \DeclareUnicodeCharacter{1EF3}{\`y}
8551
  \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
8552
 
8553
  \DeclareUnicodeCharacter{1EF8}{\~Y}
8554
  \DeclareUnicodeCharacter{1EF9}{\~y}
8555
 
8556
  \DeclareUnicodeCharacter{2013}{--}
8557
  \DeclareUnicodeCharacter{2014}{---}
8558
  \DeclareUnicodeCharacter{2018}{\quoteleft}
8559
  \DeclareUnicodeCharacter{2019}{\quoteright}
8560
  \DeclareUnicodeCharacter{201A}{\quotesinglbase}
8561
  \DeclareUnicodeCharacter{201C}{\quotedblleft}
8562
  \DeclareUnicodeCharacter{201D}{\quotedblright}
8563
  \DeclareUnicodeCharacter{201E}{\quotedblbase}
8564
  \DeclareUnicodeCharacter{2022}{\bullet}
8565
  \DeclareUnicodeCharacter{2026}{\dots}
8566
  \DeclareUnicodeCharacter{2039}{\guilsinglleft}
8567
  \DeclareUnicodeCharacter{203A}{\guilsinglright}
8568
  \DeclareUnicodeCharacter{20AC}{\euro}
8569
 
8570
  \DeclareUnicodeCharacter{2192}{\expansion}
8571
  \DeclareUnicodeCharacter{21D2}{\result}
8572
 
8573
  \DeclareUnicodeCharacter{2212}{\minus}
8574
  \DeclareUnicodeCharacter{2217}{\point}
8575
  \DeclareUnicodeCharacter{2261}{\equiv}
8576
}% end of \utfeightchardefs
8577
 
8578
 
8579
% US-ASCII character definitions.
8580
\def\asciichardefs{% nothing need be done
8581
   \relax
8582
}
8583
 
8584
% Make non-ASCII characters printable again for compatibility with
8585
% existing Texinfo documents that may use them, even without declaring a
8586
% document encoding.
8587
%
8588
\setnonasciicharscatcode \other
8589
 
8590
 
8591
\message{formatting,}
8592
 
8593
\newdimen\defaultparindent \defaultparindent = 15pt
8594
 
8595
\chapheadingskip = 15pt plus 4pt minus 2pt
8596
\secheadingskip = 12pt plus 3pt minus 2pt
8597
\subsecheadingskip = 9pt plus 2pt minus 2pt
8598
 
8599
% Prevent underfull vbox error messages.
8600
\vbadness = 10000
8601
 
8602
% Don't be so finicky about underfull hboxes, either.
8603
\hbadness = 2000
8604
 
8605
% Following George Bush, get rid of widows and orphans.
8606
\widowpenalty=10000
8607
\clubpenalty=10000
8608
 
8609
% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
8610
% using an old version of TeX, don't do anything.  We want the amount of
8611
% stretch added to depend on the line length, hence the dependence on
8612
% \hsize.  We call this whenever the paper size is set.
8613
%
8614
\def\setemergencystretch{%
8615
  \ifx\emergencystretch\thisisundefined
8616
    % Allow us to assign to \emergencystretch anyway.
8617
    \def\emergencystretch{\dimen0}%
8618
  \else
8619
    \emergencystretch = .15\hsize
8620
  \fi
8621
}
8622
 
8623
% Parameters in order: 1) textheight; 2) textwidth;
8624
% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
8625
% 7) physical page height; 8) physical page width.
8626
%
8627
% We also call \setleading{\textleading}, so the caller should define
8628
% \textleading.  The caller should also set \parskip.
8629
%
8630
\def\internalpagesizes#1#2#3#4#5#6#7#8{%
8631
  \voffset = #3\relax
8632
  \topskip = #6\relax
8633
  \splittopskip = \topskip
8634
  %
8635
  \vsize = #1\relax
8636
  \advance\vsize by \topskip
8637
  \outervsize = \vsize
8638
  \advance\outervsize by 2\topandbottommargin
8639
  \pageheight = \vsize
8640
  %
8641
  \hsize = #2\relax
8642
  \outerhsize = \hsize
8643
  \advance\outerhsize by 0.5in
8644
  \pagewidth = \hsize
8645
  %
8646
  \normaloffset = #4\relax
8647
  \bindingoffset = #5\relax
8648
  %
8649
  \ifpdf
8650
    \pdfpageheight #7\relax
8651
    \pdfpagewidth #8\relax
8652
    % if we don't reset these, they will remain at "1 true in" of
8653
    % whatever layout pdftex was dumped with.
8654
    \pdfhorigin = 1 true in
8655
    \pdfvorigin = 1 true in
8656
  \fi
8657
  %
8658
  \setleading{\textleading}
8659
  %
8660
  \parindent = \defaultparindent
8661
  \setemergencystretch
8662
}
8663
 
8664
% @letterpaper (the default).
8665
\def\letterpaper{{\globaldefs = 1
8666
  \parskip = 3pt plus 2pt minus 1pt
8667
  \textleading = 13.2pt
8668
  %
8669
  % If page is nothing but text, make it come out even.
8670
  \internalpagesizes{607.2pt}{6in}% that's 46 lines
8671
                    {\voffset}{.25in}%
8672
                    {\bindingoffset}{36pt}%
8673
                    {11in}{8.5in}%
8674
}}
8675
 
8676
% Use @smallbook to reset parameters for 7x9.25 trim size.
8677
\def\smallbook{{\globaldefs = 1
8678
  \parskip = 2pt plus 1pt
8679
  \textleading = 12pt
8680
  %
8681
  \internalpagesizes{7.5in}{5in}%
8682
                    {-.2in}{0in}%
8683
                    {\bindingoffset}{16pt}%
8684
                    {9.25in}{7in}%
8685
  %
8686
  \lispnarrowing = 0.3in
8687
  \tolerance = 700
8688
  \hfuzz = 1pt
8689
  \contentsrightmargin = 0pt
8690
  \defbodyindent = .5cm
8691
}}
8692
 
8693
% Use @smallerbook to reset parameters for 6x9 trim size.
8694
% (Just testing, parameters still in flux.)
8695
\def\smallerbook{{\globaldefs = 1
8696
  \parskip = 1.5pt plus 1pt
8697
  \textleading = 12pt
8698
  %
8699
  \internalpagesizes{7.4in}{4.8in}%
8700
                    {-.2in}{-.4in}%
8701
                    {0pt}{14pt}%
8702
                    {9in}{6in}%
8703
  %
8704
  \lispnarrowing = 0.25in
8705
  \tolerance = 700
8706
  \hfuzz = 1pt
8707
  \contentsrightmargin = 0pt
8708
  \defbodyindent = .4cm
8709
}}
8710
 
8711
% Use @afourpaper to print on European A4 paper.
8712
\def\afourpaper{{\globaldefs = 1
8713
  \parskip = 3pt plus 2pt minus 1pt
8714
  \textleading = 13.2pt
8715
  %
8716
  % Double-side printing via postscript on Laserjet 4050
8717
  % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
8718
  % To change the settings for a different printer or situation, adjust
8719
  % \normaloffset until the front-side and back-side texts align.  Then
8720
  % do the same for \bindingoffset.  You can set these for testing in
8721
  % your texinfo source file like this:
8722
  % @tex
8723
  % \global\normaloffset = -6mm
8724
  % \global\bindingoffset = 10mm
8725
  % @end tex
8726
  \internalpagesizes{673.2pt}{160mm}% that's 51 lines
8727
                    {\voffset}{\hoffset}%
8728
                    {\bindingoffset}{44pt}%
8729
                    {297mm}{210mm}%
8730
  %
8731
  \tolerance = 700
8732
  \hfuzz = 1pt
8733
  \contentsrightmargin = 0pt
8734
  \defbodyindent = 5mm
8735
}}
8736
 
8737
% Use @afivepaper to print on European A5 paper.
8738
% From romildo@urano.iceb.ufop.br, 2 July 2000.
8739
% He also recommends making @example and @lisp be small.
8740
\def\afivepaper{{\globaldefs = 1
8741
  \parskip = 2pt plus 1pt minus 0.1pt
8742
  \textleading = 12.5pt
8743
  %
8744
  \internalpagesizes{160mm}{120mm}%
8745
                    {\voffset}{\hoffset}%
8746
                    {\bindingoffset}{8pt}%
8747
                    {210mm}{148mm}%
8748
  %
8749
  \lispnarrowing = 0.2in
8750
  \tolerance = 800
8751
  \hfuzz = 1.2pt
8752
  \contentsrightmargin = 0pt
8753
  \defbodyindent = 2mm
8754
  \tableindent = 12mm
8755
}}
8756
 
8757
% A specific text layout, 24x15cm overall, intended for A4 paper.
8758
\def\afourlatex{{\globaldefs = 1
8759
  \afourpaper
8760
  \internalpagesizes{237mm}{150mm}%
8761
                    {\voffset}{4.6mm}%
8762
                    {\bindingoffset}{7mm}%
8763
                    {297mm}{210mm}%
8764
  %
8765
  % Must explicitly reset to 0 because we call \afourpaper.
8766
  \globaldefs = 0
8767
}}
8768
 
8769
% Use @afourwide to print on A4 paper in landscape format.
8770
\def\afourwide{{\globaldefs = 1
8771
  \afourpaper
8772
  \internalpagesizes{241mm}{165mm}%
8773
                    {\voffset}{-2.95mm}%
8774
                    {\bindingoffset}{7mm}%
8775
                    {297mm}{210mm}%
8776
  \globaldefs = 0
8777
}}
8778
 
8779
% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
8780
% Perhaps we should allow setting the margins, \topskip, \parskip,
8781
% and/or leading, also. Or perhaps we should compute them somehow.
8782
%
8783
\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
8784
\def\pagesizesyyy#1,#2,#3\finish{{%
8785
  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
8786
  \globaldefs = 1
8787
  %
8788
  \parskip = 3pt plus 2pt minus 1pt
8789
  \setleading{\textleading}%
8790
  %
8791
  \dimen0 = #1\relax
8792
  \advance\dimen0 by \voffset
8793
  %
8794
  \dimen2 = \hsize
8795
  \advance\dimen2 by \normaloffset
8796
  %
8797
  \internalpagesizes{#1}{\hsize}%
8798
                    {\voffset}{\normaloffset}%
8799
                    {\bindingoffset}{44pt}%
8800
                    {\dimen0}{\dimen2}%
8801
}}
8802
 
8803
% Set default to letter.
8804
%
8805
\letterpaper
8806
 
8807
 
8808
\message{and turning on texinfo input format.}
8809
 
8810
% Define macros to output various characters with catcode for normal text.
8811
\catcode`\"=\other
8812
\catcode`\~=\other
8813
\catcode`\^=\other
8814
\catcode`\_=\other
8815
\catcode`\|=\other
8816
\catcode`\<=\other
8817
\catcode`\>=\other
8818
\catcode`\+=\other
8819
\catcode`\$=\other
8820
\def\normaldoublequote{"}
8821
\def\normaltilde{~}
8822
\def\normalcaret{^}
8823
\def\normalunderscore{_}
8824
\def\normalverticalbar{|}
8825
\def\normalless{<}
8826
\def\normalgreater{>}
8827
\def\normalplus{+}
8828
\def\normaldollar{$}%$ font-lock fix
8829
 
8830
% This macro is used to make a character print one way in \tt
8831
% (where it can probably be output as-is), and another way in other fonts,
8832
% where something hairier probably needs to be done.
8833
%
8834
% #1 is what to print if we are indeed using \tt; #2 is what to print
8835
% otherwise.  Since all the Computer Modern typewriter fonts have zero
8836
% interword stretch (and shrink), and it is reasonable to expect all
8837
% typewriter fonts to have this, we can check that font parameter.
8838
%
8839
\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
8840
 
8841
% Same as above, but check for italic font.  Actually this also catches
8842
% non-italic slanted fonts since it is impossible to distinguish them from
8843
% italic fonts.  But since this is only used by $ and it uses \sl anyway
8844
% this is not a problem.
8845
\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
8846
 
8847
% Turn off all special characters except @
8848
% (and those which the user can use as if they were ordinary).
8849
% Most of these we simply print from the \tt font, but for some, we can
8850
% use math or other variants that look better in normal text.
8851
 
8852
\catcode`\"=\active
8853
\def\activedoublequote{{\tt\char34}}
8854
\let"=\activedoublequote
8855
\catcode`\~=\active
8856
\def~{{\tt\char126}}
8857
\chardef\hat=`\^
8858
\catcode`\^=\active
8859
\def^{{\tt \hat}}
8860
 
8861
\catcode`\_=\active
8862
\def_{\ifusingtt\normalunderscore\_}
8863
\let\realunder=_
8864
% Subroutine for the previous macro.
8865
\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
8866
 
8867
\catcode`\|=\active
8868
\def|{{\tt\char124}}
8869
\chardef \less=`\<
8870
\catcode`\<=\active
8871
\def<{{\tt \less}}
8872
\chardef \gtr=`\>
8873
\catcode`\>=\active
8874
\def>{{\tt \gtr}}
8875
\catcode`\+=\active
8876
\def+{{\tt \char 43}}
8877
\catcode`\$=\active
8878
\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
8879
 
8880
% If a .fmt file is being used, characters that might appear in a file
8881
% name cannot be active until we have parsed the command line.
8882
% So turn them off again, and have \everyjob (or @setfilename) turn them on.
8883
% \otherifyactive is called near the end of this file.
8884
\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
8885
 
8886
% Used sometimes to turn off (effectively) the active characters even after
8887
% parsing them.
8888
\def\turnoffactive{%
8889
  \normalturnoffactive
8890
  \otherbackslash
8891
}
8892
 
8893
\catcode`\@=0
8894
 
8895
% \backslashcurfont outputs one backslash character in current font,
8896
% as in \char`\\.
8897
\global\chardef\backslashcurfont=`\\
8898
\global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
8899
 
8900
% \realbackslash is an actual character `\' with catcode other, and
8901
% \doublebackslash is two of them (for the pdf outlines).
8902
{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
8903
 
8904
% In texinfo, backslash is an active character; it prints the backslash
8905
% in fixed width font.
8906
\catcode`\\=\active
8907
@def@normalbackslash{{@tt@backslashcurfont}}
8908
% On startup, @fixbackslash assigns:
8909
%  @let \ = @normalbackslash
8910
 
8911
% \rawbackslash defines an active \ to do \backslashcurfont.
8912
% \otherbackslash defines an active \ to be a literal `\' character with
8913
% catcode other.
8914
@gdef@rawbackslash{@let\=@backslashcurfont}
8915
@gdef@otherbackslash{@let\=@realbackslash}
8916
 
8917
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
8918
% the literal character `\'.
8919
%
8920
@def@normalturnoffactive{%
8921
  @let\=@normalbackslash
8922
  @let"=@normaldoublequote
8923
  @let~=@normaltilde
8924
  @let^=@normalcaret
8925
  @let_=@normalunderscore
8926
  @let|=@normalverticalbar
8927
  @let<=@normalless
8928
  @let>=@normalgreater
8929
  @let+=@normalplus
8930
  @let$=@normaldollar %$ font-lock fix
8931
  @unsepspaces
8932
}
8933
 
8934
% Make _ and + \other characters, temporarily.
8935
% This is canceled by @fixbackslash.
8936
@otherifyactive
8937
 
8938
% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
8939
% That is what \eatinput is for; after that, the `\' should revert to printing
8940
% a backslash.
8941
%
8942
@gdef@eatinput input texinfo{@fixbackslash}
8943
@global@let\ = @eatinput
8944
 
8945
% On the other hand, perhaps the file did not have a `\input texinfo'. Then
8946
% the first `\' in the file would cause an error. This macro tries to fix
8947
% that, assuming it is called before the first `\' could plausibly occur.
8948
% Also turn back on active characters that might appear in the input
8949
% file name, in case not using a pre-dumped format.
8950
%
8951
@gdef@fixbackslash{%
8952
  @ifx\@eatinput @let\ = @normalbackslash @fi
8953
  @catcode`+=@active
8954
  @catcode`@_=@active
8955
}
8956
 
8957
% Say @foo, not \foo, in error messages.
8958
@escapechar = `@@
8959
 
8960
% These look ok in all fonts, so just make them not special.
8961
@catcode`@& = @other
8962
@catcode`@# = @other
8963
@catcode`@% = @other
8964
 
8965
 
8966
@c Local variables:
8967
@c eval: (add-hook 'write-file-hooks 'time-stamp)
8968
@c page-delimiter: "^\\\\message"
8969
@c time-stamp-start: "def\\\\texinfoversion{"
8970
@c time-stamp-format: "%:y-%02m-%02d.%02H"
8971
@c time-stamp-end: "}"
8972
@c End:
8973
 
8974
@c vim:sw=2:
8975
 
8976
@ignore
8977
   arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
8978
@end ignore

powered by: WebSVN 2.1.0

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