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