Imported Upstream version 4.0.43
[platform/upstream/mtools.git] / 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{2023-03-21.06}
7 %
8 % Copyright 1985, 1986, 1988, 1990-2023 Free Software Foundation, Inc.
9 %
10 % This texinfo.tex file is free software: you can redistribute it and/or
11 % modify it under the terms of the GNU General Public License as
12 % published by the Free Software Foundation, either version 3 of the
13 % License, or (at your option) any later version.
14 %
15 % This texinfo.tex file is distributed in the hope that it will be
16 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 % General Public License for more details.
19 %
20 % You should have received a copy of the GNU General Public License
21 % along with this program.  If not, see <https://www.gnu.org/licenses/>.
22 %
23 % As a special exception, when this file is read by TeX when processing
24 % a Texinfo source document, you may use the result without
25 % restriction. This Exception is an additional permission under section 7
26 % of the GNU General Public License, version 3 ("GPLv3").
27 %
28 % Please try the latest version of texinfo.tex before submitting bug
29 % reports; you can get the latest version from:
30 %   https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
31 %   https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
32 %   https://www.gnu.org/software/texinfo/ (the Texinfo home page)
33 % The texinfo.tex in any given distribution could well be out
34 % of date, so if that's what you're using, please check.
35 %
36 % Send bug reports to bug-texinfo@gnu.org.  Please include a
37 % complete document in each bug report with which we can reproduce the
38 % problem.  Patches are, of course, greatly appreciated.
39 %
40 % To process a Texinfo manual with TeX, it's most reliable to use the
41 % texi2dvi shell script that comes with the distribution.  For a simple
42 % manual foo.texi, however, you can get away with this:
43 %   tex foo.texi
44 %   texindex foo.??
45 %   tex foo.texi
46 %   tex foo.texi
47 %   dvips foo.dvi -o  # or whatever; this makes foo.ps.
48 % The extra TeX runs get the cross-reference information correct.
49 % Sometimes one run after texindex suffices, and sometimes you need more
50 % than two; texi2dvi does it as many times as necessary.
51 %
52 % It is possible to adapt texinfo.tex for other languages, to some
53 % extent.  You can get the existing language-specific files from the
54 % full Texinfo distribution.
55 %
56 % The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
57
58
59 \message{Loading texinfo [version \texinfoversion]:}
60
61 % LaTeX's \typeout.  This ensures that the messages it is used for
62 % are identical in format to the corresponding ones from latex/pdflatex.
63 \def\typeout{\immediate\write17}%
64
65 \chardef\other=12
66
67 % We never want plain's \outer definition of \+ in Texinfo.
68 % For @tex, we can use \tabalign.
69 \let\+ = \relax
70
71 % Save some plain tex macros whose names we will redefine.
72 \let\ptexb=\b
73 \let\ptexbullet=\bullet
74 \let\ptexc=\c
75 \let\ptexcomma=\,
76 \let\ptexdot=\.
77 \let\ptexdots=\dots
78 \let\ptexend=\end
79 \let\ptexequiv=\equiv
80 \let\ptexexclam=\!
81 \let\ptexfootnote=\footnote
82 \let\ptexgtr=>
83 \let\ptexhat=^
84 \let\ptexi=\i
85 \let\ptexindent=\indent
86 \let\ptexinsert=\insert
87 \let\ptexlbrace=\{
88 \let\ptexless=<
89 \let\ptexnewwrite\newwrite
90 \let\ptexnoindent=\noindent
91 \let\ptexplus=+
92 \let\ptexraggedright=\raggedright
93 \let\ptexrbrace=\}
94 \let\ptexslash=\/
95 \let\ptexsp=\sp
96 \let\ptexstar=\*
97 \let\ptexsup=\sup
98 \let\ptext=\t
99 \let\ptextop=\top
100 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
101
102 % If this character appears in an error message or help string, it
103 % starts a new line in the output.
104 \newlinechar = `^^J
105
106 % Use TeX 3.0's \inputlineno to get the line number, for better error
107 % messages, but if we're using an old version of TeX, don't do anything.
108 %
109 \ifx\inputlineno\thisisundefined
110   \let\linenumber = \empty % Pre-3.0.
111 \else
112   \def\linenumber{l.\the\inputlineno:\space}
113 \fi
114
115 % Set up fixed words for English if not already set.
116 \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
117 \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
118 \ifx\putworderror\undefined     \gdef\putworderror{error}\fi
119 \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
120 \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
121 \ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
122 \ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
123 \ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
124 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
125 \ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
126 \ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
127 \ifx\putwordof\undefined        \gdef\putwordof{of}\fi
128 \ifx\putwordon\undefined        \gdef\putwordon{on}\fi
129 \ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
130 \ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
131 \ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
132 \ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
133 \ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
134 \ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
135 \ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
136 %
137 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
138 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
139 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
140 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
141 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
142 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
143 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
144 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
145 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
146 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
147 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
148 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
149 %
150 \ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
151 \ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
152 \ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
153 \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
154 \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
155
156 % Give the space character the catcode for a space.
157 \def\spaceisspace{\catcode`\ =10\relax}
158
159 % Likewise for ^^M, the end of line character.
160 \def\endlineisspace{\catcode13=10\relax}
161
162 \chardef\dashChar  = `\-
163 \chardef\slashChar = `\/
164 \chardef\underChar = `\_
165
166 % Ignore a token.
167 %
168 \def\gobble#1{}
169
170 % The following is used inside several \edef's.
171 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
172
173 % Hyphenation fixes.
174 \hyphenation{
175   Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
176   ap-pen-dix bit-map bit-maps
177   data-base data-bases eshell fall-ing half-way long-est man-u-script
178   man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
179   par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
180   spell-ing spell-ings
181   stand-alone strong-est time-stamp time-stamps which-ever white-space
182   wide-spread wrap-around
183 }
184
185 % Sometimes it is convenient to have everything in the transcript file
186 % and nothing on the terminal.  We don't just call \tracingall here,
187 % since that produces some useless output on the terminal.  We also make
188 % some effort to order the tracing commands to reduce output in the log
189 % file; cf. trace.sty in LaTeX.
190 %
191 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
192 \def\loggingall{%
193   \tracingstats2
194   \tracingpages1
195   \tracinglostchars2  % 2 gives us more in etex
196   \tracingparagraphs1
197   \tracingoutput1
198   \tracingmacros2
199   \tracingrestores1
200   \showboxbreadth\maxdimen \showboxdepth\maxdimen
201   \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
202     \tracingscantokens1
203     \tracingifs1
204     \tracinggroups1
205     \tracingnesting2
206     \tracingassigns1
207   \fi
208   \tracingcommands3  % 3 gives us more in etex
209   \errorcontextlines16
210 }%
211
212 % @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
213 % aren't perfect, it's not the end of the world, being an error message,
214 % after all.
215
216 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
217 \def\doerrormsg#1{\errmessage{#1}}
218
219 % add check for \lastpenalty to plain's definitions.  If the last thing
220 % we did was a \nobreak, we don't want to insert more space.
221 %
222 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
223   \removelastskip\penalty-50\smallskip\fi\fi}
224 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
225   \removelastskip\penalty-100\medskip\fi\fi}
226 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
227   \removelastskip\penalty-200\bigskip\fi\fi}
228
229 %\f Output routine
230 %
231
232 % For a final copy, take out the rectangles
233 % that mark overfull boxes (in case you have decided
234 % that the text looks ok even though it passes the margin).
235 %
236 \def\finalout{\overfullrule=0pt }
237
238 % Output a mark which sets \thischapter, \thissection and \thiscolor.
239 % We dump everything together because we only have one kind of mark.
240 % This works because we only use \botmark / \topmark, not \firstmark.
241 %
242 % A mark contains a subexpression of the \ifcase ... \fi construct.
243 % \get*marks macros below extract the needed part using \ifcase.
244 %
245 % Another complication is to let the user choose whether \thischapter
246 % (\thissection) refers to the chapter (section) in effect at the top
247 % of a page, or that at the bottom of a page.
248
249 % \domark is called twice inside \chapmacro, to add one
250 % mark before the section break, and one after.
251 %   In the second call \prevchapterdefs is the same as \currentchapterdefs,
252 % and \prevsectiondefs is the same as \currentsectiondefs.
253 %   Then if the page is not broken at the mark, some of the previous
254 % section appears on the page, and we can get the name of this section
255 % from \firstmark for @everyheadingmarks top.
256 %   @everyheadingmarks bottom uses \botmark.
257 %
258 % See page 260 of The TeXbook.
259 \def\domark{%
260   \toks0=\expandafter{\currentchapterdefs}%
261   \toks2=\expandafter{\currentsectiondefs}%
262   \toks4=\expandafter{\prevchapterdefs}%
263   \toks6=\expandafter{\prevsectiondefs}%
264   \toks8=\expandafter{\currentcolordefs}%
265   \mark{%
266                    \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
267       \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
268     \noexpand\else \the\toks8             % 2: color marks
269   }%
270 }
271
272 % \gettopheadingmarks, \getbottomheadingmarks,
273 % \getcolormarks - extract needed part of mark.
274 %
275 % \topmark doesn't work for the very first chapter (after the title
276 % page or the contents), so we use \firstmark there -- this gets us
277 % the mark with the chapter defs, unless the user sneaks in, e.g.,
278 % @setcolor (or @url, or @link, etc.) between @contents and the very
279 % first @chapter.
280 \def\gettopheadingmarks{%
281   \ifcase0\the\savedtopmark\fi
282   \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
283 }
284 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
285 \def\getcolormarks{\ifcase2\the\savedtopmark\fi}
286
287 % Avoid "undefined control sequence" errors.
288 \def\currentchapterdefs{}
289 \def\currentsectiondefs{}
290 \def\currentsection{}
291 \def\prevchapterdefs{}
292 \def\prevsectiondefs{}
293 \def\currentcolordefs{}
294
295 % Margin to add to right of even pages, to left of odd pages.
296 \newdimen\bindingoffset
297 \newdimen\normaloffset
298 \newdimen\txipagewidth \newdimen\txipageheight
299
300 % Main output routine.
301 %
302 \chardef\PAGE = 255
303 \newtoks\defaultoutput
304 \defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
305 \output=\expandafter{\the\defaultoutput}
306
307 \newbox\headlinebox
308 \newbox\footlinebox
309
310 % When outputting the double column layout for indices, an output routine
311 % is run several times, hiding the original value of \topmark.  Hence, save
312 % \topmark at the beginning.
313 %
314 \newtoks\savedtopmark
315 \newif\iftopmarksaved
316 \topmarksavedtrue
317 \def\savetopmark{%
318   \iftopmarksaved\else
319     \global\savedtopmark=\expandafter{\topmark}%
320     \global\topmarksavedtrue
321   \fi
322 }
323
324 % \onepageout takes a vbox as an argument.
325 % \shipout a vbox for a single page, adding an optional header, footer
326 % and footnote.  This also causes index entries for this page to be written
327 % to the auxiliary files.
328 %
329 \def\onepageout#1{%
330   \hoffset=\normaloffset
331   %
332   \ifodd\pageno  \advance\hoffset by \bindingoffset
333   \else \advance\hoffset by -\bindingoffset\fi
334   %
335   \checkchapterpage
336   %
337   % Make the heading and footing.  \makeheadline and \makefootline
338   % use the contents of \headline and \footline.
339   \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
340   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
341   \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
342   \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
343   \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
344   %
345   {%
346     % Set context for writing to auxiliary files like index files.
347     % Have to do this stuff outside the \shipout because we want it to
348     % take effect in \write's, yet the group defined by the \vbox ends
349     % before the \shipout runs.
350     %
351     \atdummies         % don't expand commands in the output.
352     \turnoffactive
353     \shipout\vbox{%
354       % Do this early so pdf references go to the beginning of the page.
355       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
356       %
357       \unvbox\headlinebox
358       \pagebody{#1}%
359       \ifdim\ht\footlinebox > 0pt
360         % Only leave this space if the footline is nonempty.
361         % (We lessened \vsize for it in \oddfootingyyy.)
362         % The \baselineskip=24pt in plain's \makefootline has no effect.
363         \vskip 24pt
364         \unvbox\footlinebox
365       \fi
366       %
367     }%
368   }%
369   \global\topmarksavedfalse
370   \advancepageno
371   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
372 }
373
374 \newinsert\margin \dimen\margin=\maxdimen
375
376 % Main part of page, including any footnotes
377 \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
378 {\catcode`\@ =11
379 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
380 % marginal hacks, juha@viisa.uucp (Juha Takala)
381 \ifvoid\margin\else % marginal info is present
382   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
383 \dimen@=\dp#1\relax \unvbox#1\relax
384 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
385 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
386 }
387
388 % Check if we are on the first page of a chapter.  Used for printing headings.
389 \newif\ifchapterpage
390 \def\checkchapterpage{%
391   % Get the chapter that was current at the end of the last page
392   \ifcase1\the\savedtopmark\fi
393   \let\prevchaptername\thischaptername
394   %
395   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
396   \let\curchaptername\thischaptername
397   %
398   \ifx\curchaptername\prevchaptername
399     \chapterpagefalse
400   \else
401     \chapterpagetrue
402   \fi
403 }
404
405 % Argument parsing
406
407 % Parse an argument, then pass it to #1.  The argument is the rest of
408 % the input line (except we remove a trailing comment).  #1 should be a
409 % macro which expects an ordinary undelimited TeX argument.
410 % For example, \def\foo{\parsearg\fooxxx}.
411 %
412 \def\parsearg{\parseargusing{}}
413 \def\parseargusing#1#2{%
414   \def\argtorun{#2}%
415   \begingroup
416     \obeylines
417     \spaceisspace
418     #1%
419     \parseargline\empty% Insert the \empty token, see \finishparsearg below.
420 }
421
422 {\obeylines %
423   \gdef\parseargline#1^^M{%
424     \endgroup % End of the group started in \parsearg.
425     \argremovecomment #1\comment\ArgTerm%
426   }%
427 }
428
429 % First remove any @comment, then any @c comment.  Pass the result on to 
430 % \argcheckspaces.
431 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
432 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
433
434 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
435 %
436 % \argremovec might leave us with trailing space, e.g.,
437 %    @end itemize  @c foo
438 % This space token undergoes the same procedure and is eventually removed
439 % by \finishparsearg.
440 %
441 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
442 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
443 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
444   \def\temp{#3}%
445   \ifx\temp\empty
446     % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
447     \let\temp\finishparsearg
448   \else
449     \let\temp\argcheckspaces
450   \fi
451   % Put the space token in:
452   \temp#1 #3\ArgTerm
453 }
454
455 % If a _delimited_ argument is enclosed in braces, they get stripped; so
456 % to get _exactly_ the rest of the line, we had to prevent such situation.
457 % We prepended an \empty token at the very beginning and we expand it now,
458 % just before passing the control to \argtorun.
459 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
460 % either the null string, or it ends with \^^M---thus there is no danger
461 % that a pair of braces would be stripped.
462 %
463 % But first, we have to remove the trailing space token.
464 %
465 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
466
467
468 % \parseargdef - define a command taking an argument on the line
469 %
470 % \parseargdef\foo{...}
471 %       is roughly equivalent to
472 % \def\foo{\parsearg\Xfoo}
473 % \def\Xfoo#1{...}
474 \def\parseargdef#1{%
475   \expandafter \doparseargdef \csname\string#1\endcsname #1%
476 }
477 \def\doparseargdef#1#2{%
478   \def#2{\parsearg#1}%
479   \def#1##1%
480 }
481
482 % Several utility definitions with active space:
483 {
484   \obeyspaces
485   \gdef\obeyedspace{ }
486
487   % Make each space character in the input produce a normal interword
488   % space in the output.  Don't allow a line break at this space, as this
489   % is used only in environments like @example, where each line of input
490   % should produce a line of output anyway.
491   %
492   \gdef\sepspaces{\obeyspaces\let =\tie}
493
494   % If an index command is used in an @example environment, any spaces
495   % therein should become regular spaces in the raw index file, not the
496   % expansion of \tie (\leavevmode \penalty \@M \ ).
497   \gdef\unsepspaces{\let =\space}
498 }
499
500
501 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
502
503 % Define the framework for environments in texinfo.tex.  It's used like this:
504 %
505 %   \envdef\foo{...}
506 %   \def\Efoo{...}
507 %
508 % It's the responsibility of \envdef to insert \begingroup before the
509 % actual body; @end closes the group after calling \Efoo.  \envdef also
510 % defines \thisenv, so the current environment is known; @end checks
511 % whether the environment name matches.  The \checkenv macro can also be
512 % used to check whether the current environment is the one expected.
513 %
514 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
515 % are not treated as environments; they don't open a group.  (The
516 % implementation of @end takes care not to call \endgroup in this
517 % special case.)
518
519
520 % At run-time, environments start with this:
521 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
522 % initialize
523 \let\thisenv\empty
524
525 % ... but they get defined via ``\envdef\foo{...}'':
526 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
527 \long\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
528
529 % Check whether we're in the right environment:
530 \def\checkenv#1{%
531   \def\temp{#1}%
532   \ifx\thisenv\temp
533   \else
534     \badenverr
535   \fi
536 }
537
538 % Environment mismatch, #1 expected:
539 \def\badenverr{%
540   \errhelp = \EMsimple
541   \errmessage{This command can appear only \inenvironment\temp,
542     not \inenvironment\thisenv}%
543 }
544 \def\inenvironment#1{%
545   \ifx#1\empty
546     outside of any environment%
547   \else
548     in environment \expandafter\string#1%
549   \fi
550 }
551
552
553 % @end foo calls \checkenv and executes the definition of \Efoo.
554 \parseargdef\end{%
555   \if 1\csname iscond.#1\endcsname
556   \else
557     % The general wording of \badenverr may not be ideal.
558     \expandafter\checkenv\csname#1\endcsname
559     \csname E#1\endcsname
560     \endgroup
561   \fi
562 }
563
564 \newhelp\EMsimple{Press RETURN to continue.}
565
566
567 % Be sure we're in horizontal mode when doing a tie, since we make space
568 % equivalent to this in @example-like environments. Otherwise, a space
569 % at the beginning of a line will start with \penalty -- and
570 % since \penalty is valid in vertical mode, we'd end up putting the
571 % penalty on the vertical list instead of in the new paragraph.
572 {\catcode`@ = 11
573  % Avoid using \@M directly, because that causes trouble
574  % if the definition is written into an index file.
575  \global\let\tiepenalty = \@M
576  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
577 }
578
579 % @: forces normal size whitespace following.
580 \def\:{\spacefactor=1000 }
581
582 % @* forces a line break.
583 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
584
585 % @/ allows a line break.
586 \let\/=\allowbreak
587
588 % @- allows explicit insertion of hyphenation points
589 \def\-{\discretionary{\normaldash}{}{}}%
590
591 % @. is an end-of-sentence period.
592 \def\.{.\spacefactor=\endofsentencespacefactor\space}
593
594 % @! is an end-of-sentence bang.
595 \def\!{!\spacefactor=\endofsentencespacefactor\space}
596
597 % @? is an end-of-sentence query.
598 \def\?{?\spacefactor=\endofsentencespacefactor\space}
599
600 % @w prevents a word break.  Without the \leavevmode, @w at the
601 % beginning of a paragraph, when TeX is still in vertical mode, would
602 % produce a whole line of output instead of starting the paragraph.
603 \def\w#1{\leavevmode\hbox{#1}}
604
605 % @group ... @end group forces ... to be all on one page, by enclosing
606 % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
607 % to keep its height that of a normal line.  According to the rules for
608 % \topskip (p.114 of the TeXbook), the glue inserted is
609 % max (\topskip - \ht (first item), 0).  If that height is large,
610 % therefore, no glue is inserted, and the space between the headline and
611 % the text is small, which looks bad.
612 %
613 % Another complication is that the group might be very large.  This can
614 % cause the glue on the previous page to be unduly stretched, because it
615 % does not have much material.  In this case, it's better to add an
616 % explicit \vfill so that the extra space is at the bottom.  The
617 % threshold for doing this is if the group is more than \vfilllimit
618 % percent of a page (\vfilllimit can be changed inside of @tex).
619 %
620 \newbox\groupbox
621 \def\vfilllimit{0.7}
622 %
623 \envdef\group{%
624   \ifnum\catcode`\^^M=\active \else
625     \errhelp = \groupinvalidhelp
626     \errmessage{@group invalid in context where filling is enabled}%
627   \fi
628   \startsavinginserts
629   %
630   \setbox\groupbox = \vtop\bgroup
631     % Do @comment since we are called inside an environment such as
632     % @example, where each end-of-line in the input causes an
633     % end-of-line in the output.  We don't want the end-of-line after
634     % the `@group' to put extra space in the output.  Since @group
635     % should appear on a line by itself (according to the Texinfo
636     % manual), we don't worry about eating any user text.
637     \comment
638 }
639 %
640 % The \vtop produces a box with normal height and large depth; thus, TeX puts
641 % \baselineskip glue before it, and (when the next line of text is done)
642 % \lineskip glue after it.  Thus, space below is not quite equal to space
643 % above.  But it's pretty close.
644 \def\Egroup{%
645     % To get correct interline space between the last line of the group
646     % and the first line afterwards, we have to propagate \prevdepth.
647     \endgraf % Not \par, as it may have been set to \lisppar.
648     \global\dimen1 = \prevdepth
649   \egroup           % End the \vtop.
650   \addgroupbox
651   \prevdepth = \dimen1
652   \checkinserts
653 }
654
655 \def\addgroupbox{
656   % \dimen0 is the vertical size of the group's box.
657   \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
658   % \dimen2 is how much space is left on the page (more or less).
659   \dimen2 = \txipageheight   \advance\dimen2 by -\pagetotal
660   % if the group doesn't fit on the current page, and it's a big big
661   % group, force a page break.
662   \ifdim \dimen0 > \dimen2
663     \ifdim \pagetotal < \vfilllimit\txipageheight
664       \page
665     \fi
666   \fi
667   \box\groupbox
668 }
669
670 %
671 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
672 % message, so this ends up printing `@group can only ...'.
673 %
674 \newhelp\groupinvalidhelp{%
675 group can only be used in environments such as @example,^^J%
676 where each line of input produces a line of output.}
677
678 % @need space-in-mils
679 % forces a page break if there is not space-in-mils remaining.
680
681 \newdimen\mil  \mil=0.001in
682
683 \parseargdef\need{%
684   % Ensure vertical mode, so we don't make a big box in the middle of a
685   % paragraph.
686   \par
687   %
688   % If the @need value is less than one line space, it's useless.
689   \dimen0 = #1\mil
690   \dimen2 = \ht\strutbox
691   \advance\dimen2 by \dp\strutbox
692   \ifdim\dimen0 > \dimen2
693     % This is similar to the 'needspace' module in LaTeX.
694     % The first penalty allows a break if the end of the page is
695     % not too far away.  Following penalties and skips are discarded.
696     % Otherwise, require at least \dimen0 of vertical space.
697     %
698     % (We used to use a \vtop to reserve space, but this had spacing issues
699     % when followed by a section heading, as it was not a "discardable item".
700     % This also has the benefit of providing glue before the page break if
701     % there isn't enough space.)
702     \vskip0pt plus \dimen0
703     \penalty-100
704     \vskip0pt plus -\dimen0
705     \vskip \dimen0
706     \penalty9999
707     \vskip -\dimen0
708     \penalty0\relax % this hides the above glue from \safewhatsit and \dobreak
709   \fi
710 }
711
712 % @br   forces paragraph break (and is undocumented).
713
714 \let\br = \par
715
716 % @page forces the start of a new page.
717 %
718 \def\page{\par\vfill\supereject}
719
720 % @exdent text....
721 % outputs text on separate line in roman font, starting at standard page margin
722
723 % This records the amount of indent in the innermost environment.
724 % That's how much \exdent should take out.
725 \newskip\exdentamount
726
727 % This defn is used inside fill environments such as @defun.
728 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
729
730 % This defn is used inside nofill environments such as @example.
731 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
732   \leftline{\hskip\leftskip{\rm#1}}}}
733
734 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
735 % paragraph.  For more general purposes, use the \margin insertion
736 % class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
737 %
738 \newskip\inmarginspacing \inmarginspacing=1cm
739 \def\strutdepth{\dp\strutbox}
740 %
741 \def\doinmargin#1#2{\strut\vadjust{%
742   \nobreak
743   \kern-\strutdepth
744   \vtop to \strutdepth{%
745     \baselineskip=\strutdepth
746     \vss
747     % if you have multiple lines of stuff to put here, you'll need to
748     % make the vbox yourself of the appropriate size.
749     \ifx#1l%
750       \llap{\ignorespaces #2\hskip\inmarginspacing}%
751     \else
752       \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
753     \fi
754     \null
755   }%
756 }}
757 \def\inleftmargin{\doinmargin l}
758 \def\inrightmargin{\doinmargin r}
759 %
760 % @inmargin{TEXT [, RIGHT-TEXT]}
761 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
762 % else use TEXT for both).
763 %
764 \def\inmargin#1{\parseinmargin #1,,\finish}
765 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
766   \setbox0 = \hbox{\ignorespaces #2}%
767   \ifdim\wd0 > 0pt
768     \def\lefttext{#1}%  have both texts
769     \def\righttext{#2}%
770   \else
771     \def\lefttext{#1}%  have only one text
772     \def\righttext{#1}%
773   \fi
774   %
775   \ifodd\pageno
776     \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
777   \else
778     \def\temp{\inleftmargin\lefttext}%
779   \fi
780   \temp
781 }
782
783 % @include FILE -- \input text of FILE.
784 %
785 \def\include{\parseargusing\filenamecatcodes\includezzz}
786 \def\includezzz#1{%
787   \pushthisfilestack
788   \def\thisfile{#1}%
789   {%
790     \makevalueexpandable  % we want to expand any @value in FILE.
791     \turnoffactive        % and allow special characters in the expansion
792     \indexnofonts         % Allow `@@' and other weird things in file names.
793     \wlog{texinfo.tex: doing @include of #1^^J}%
794     \edef\temp{\noexpand\input #1 }%
795     %
796     % This trickery is to read FILE outside of a group, in case it makes
797     % definitions, etc.
798     \expandafter
799   }\temp
800   \popthisfilestack
801 }
802 \def\filenamecatcodes{%
803   \catcode`\\=\other
804   \catcode`~=\other
805   \catcode`^=\other
806   \catcode`_=\other
807   \catcode`|=\other
808   \catcode`<=\other
809   \catcode`>=\other
810   \catcode`+=\other
811   \catcode`-=\other
812   \catcode`\`=\other
813   \catcode`\'=\other
814 }
815
816 \def\pushthisfilestack{%
817   \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
818 }
819 \def\pushthisfilestackX{%
820   \expandafter\pushthisfilestackY\thisfile\StackTerm
821 }
822 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
823   \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
824 }
825
826 \def\popthisfilestack{\errthisfilestackempty}
827 \def\errthisfilestackempty{\errmessage{Internal error:
828   the stack of filenames is empty.}}
829 %
830 \def\thisfile{}
831
832 % @center line
833 % outputs that line, centered.
834 %
835 \parseargdef\center{%
836   \ifhmode
837     \let\centersub\centerH
838   \else
839     \let\centersub\centerV
840   \fi
841   \centersub{\hfil \ignorespaces#1\unskip \hfil}%
842   \let\centersub\relax % don't let the definition persist, just in case
843 }
844 \def\centerH#1{{%
845   \hfil\break
846   \advance\hsize by -\leftskip
847   \advance\hsize by -\rightskip
848   \line{#1}%
849   \break
850 }}
851 %
852 \newcount\centerpenalty
853 \def\centerV#1{%
854   % The idea here is the same as in \startdefun, \cartouche, etc.: if
855   % @center is the first thing after a section heading, we need to wipe
856   % out the negative parskip inserted by \sectionheading, but still
857   % prevent a page break here.
858   \centerpenalty = \lastpenalty
859   \ifnum\centerpenalty>10000 \vskip\parskip \fi
860   \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
861   \line{\kern\leftskip #1\kern\rightskip}%
862 }
863
864 % @sp n   outputs n lines of vertical space
865 %
866 \parseargdef\sp{\vskip #1\baselineskip}
867
868 % @comment ...line which is ignored...
869 % @c is the same as @comment
870 % @ignore ... @end ignore  is another way to write a comment
871
872
873 \def\c{\begingroup \catcode`\^^M=\active%
874 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
875 \cxxx}
876 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
877 %
878 \let\comment\c
879
880 % @paragraphindent NCHARS
881 % We'll use ems for NCHARS, close enough.
882 % NCHARS can also be the word `asis' or `none'.
883 % We cannot feasibly implement @paragraphindent asis, though.
884 %
885 \def\asisword{asis} % no translation, these are keywords
886 \def\noneword{none}
887 %
888 \parseargdef\paragraphindent{%
889   \def\temp{#1}%
890   \ifx\temp\asisword
891   \else
892     \ifx\temp\noneword
893       \defaultparindent = 0pt
894     \else
895       \defaultparindent = #1em
896     \fi
897   \fi
898   \parindent = \defaultparindent
899 }
900
901 % @exampleindent NCHARS
902 % We'll use ems for NCHARS like @paragraphindent.
903 % It seems @exampleindent asis isn't necessary, but
904 % I preserve it to make it similar to @paragraphindent.
905 \parseargdef\exampleindent{%
906   \def\temp{#1}%
907   \ifx\temp\asisword
908   \else
909     \ifx\temp\noneword
910       \lispnarrowing = 0pt
911     \else
912       \lispnarrowing = #1em
913     \fi
914   \fi
915 }
916
917 % @firstparagraphindent WORD
918 % If WORD is `none', then suppress indentation of the first paragraph
919 % after a section heading.  If WORD is `insert', then do indent at such
920 % paragraphs.
921 %
922 % The paragraph indentation is suppressed or not by calling
923 % \suppressfirstparagraphindent, which the sectioning commands do.
924 % We switch the definition of this back and forth according to WORD.
925 % By default, we suppress indentation.
926 %
927 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
928 \def\insertword{insert}
929 %
930 \parseargdef\firstparagraphindent{%
931   \def\temp{#1}%
932   \ifx\temp\noneword
933     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
934   \else\ifx\temp\insertword
935     \let\suppressfirstparagraphindent = \relax
936   \else
937     \errhelp = \EMsimple
938     \errmessage{Unknown @firstparagraphindent option `\temp'}%
939   \fi\fi
940 }
941
942 % Here is how we actually suppress indentation.  Redefine \everypar to
943 % \kern backwards by \parindent, and then reset itself to empty.
944 %
945 % We also make \indent itself not actually do anything until the next
946 % paragraph.
947 %
948 \gdef\dosuppressfirstparagraphindent{%
949   \gdef\indent  {\restorefirstparagraphindent \indent}%
950   \gdef\noindent{\restorefirstparagraphindent \noindent}%
951   \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
952 }
953 %
954 \gdef\restorefirstparagraphindent{%
955   \global\let\indent = \ptexindent
956   \global\let\noindent = \ptexnoindent
957   \global\everypar = {}%
958 }
959
960 % leave vertical mode without cancelling any first paragraph indent
961 \gdef\imageindent{%
962   \toks0=\everypar
963   \everypar={}%
964   \ptexnoindent
965   \global\everypar=\toks0
966 }
967
968
969 % @refill is a no-op.
970 \let\refill=\relax
971
972 % @setfilename INFO-FILENAME - ignored
973 \let\setfilename=\comment
974
975 % @bye.
976 \outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
977
978
979 \message{pdf,}
980 % adobe `portable' document format
981 \newcount\tempnum
982 \newcount\lnkcount
983 \newtoks\filename
984 \newcount\filenamelength
985 \newcount\pgn
986 \newtoks\toksA
987 \newtoks\toksB
988 \newtoks\toksC
989 \newtoks\toksD
990 \newbox\boxA
991 \newbox\boxB
992 \newcount\countA
993 \newif\ifpdf
994 \newif\ifpdfmakepagedest
995
996 %
997 % For LuaTeX
998 %
999
1000 \newif\iftxiuseunicodedestname
1001 \txiuseunicodedestnamefalse % For pdfTeX etc.
1002
1003 \ifx\luatexversion\thisisundefined
1004 \else
1005   % Use Unicode destination names
1006   \txiuseunicodedestnametrue
1007   % Escape PDF strings with converting UTF-16 from UTF-8
1008   \begingroup
1009     \catcode`\%=12
1010     \directlua{
1011       function UTF16oct(str)
1012         tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1013         for c in string.utfvalues(str) do
1014           if c < 0x10000 then
1015             tex.sprint(
1016               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1017                             string.char(0x5c) .. string.char(0x25) .. '03o',
1018                             math.floor(c / 256), math.floor(c % 256)))
1019           else
1020             c = c - 0x10000
1021             local c_hi = c / 1024 + 0xd800
1022             local c_lo = c % 1024 + 0xdc00
1023             tex.sprint(
1024               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1025                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
1026                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
1027                             string.char(0x5c) .. string.char(0x25) .. '03o',
1028                             math.floor(c_hi / 256), math.floor(c_hi % 256),
1029                             math.floor(c_lo / 256), math.floor(c_lo % 256)))
1030           end
1031         end
1032       end
1033     }
1034   \endgroup
1035   \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1036   % Escape PDF strings without converting
1037   \begingroup
1038     \directlua{
1039       function PDFescstr(str)
1040         for c in string.bytes(str) do
1041           if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1042             tex.sprint(-2,
1043               string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1044                             c))
1045           else
1046             tex.sprint(-2, string.char(c))
1047           end
1048         end
1049       end
1050     }
1051     % The -2 in the arguments here gives all the input to TeX catcode 12 
1052     % (other) or 10 (space), preventing undefined control sequence errors. See 
1053     % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
1054     %
1055   \endgroup
1056   \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1057   \ifnum\luatexversion>84
1058     % For LuaTeX >= 0.85
1059     \def\pdfdest{\pdfextension dest}
1060     \let\pdfoutput\outputmode
1061     \def\pdfliteral{\pdfextension literal}
1062     \def\pdfcatalog{\pdfextension catalog}
1063     \def\pdftexversion{\numexpr\pdffeedback version\relax}
1064     \let\pdfximage\saveimageresource
1065     \let\pdfrefximage\useimageresource
1066     \let\pdflastximage\lastsavedimageresourceindex
1067     \def\pdfendlink{\pdfextension endlink\relax}
1068     \def\pdfoutline{\pdfextension outline}
1069     \def\pdfstartlink{\pdfextension startlink}
1070     \def\pdffontattr{\pdfextension fontattr}
1071     \def\pdfobj{\pdfextension obj}
1072     \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1073     \let\pdfpagewidth\pagewidth
1074     \let\pdfpageheight\pageheight
1075     \edef\pdfhorigin{\pdfvariable horigin}
1076     \edef\pdfvorigin{\pdfvariable vorigin}
1077   \fi
1078 \fi
1079
1080 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1081 % can be set).  So we test for \relax and 0 as well as being undefined.
1082 \ifx\pdfoutput\thisisundefined
1083 \else
1084   \ifx\pdfoutput\relax
1085   \else
1086     \ifcase\pdfoutput
1087     \else
1088       \pdftrue
1089     \fi
1090   \fi
1091 \fi
1092
1093 \newif\ifpdforxetex
1094 \pdforxetexfalse
1095 \ifpdf
1096   \pdforxetextrue
1097 \fi
1098 \ifx\XeTeXrevision\thisisundefined\else
1099   \pdforxetextrue
1100 \fi
1101
1102
1103 % Output page labels information.
1104 % See PDF reference v.1.7 p.594, section 8.3.1.
1105 \ifpdf
1106 \def\pagelabels{%
1107   \def\title{0 << /P (T-) /S /D >>}%
1108   \edef\roman{\the\romancount << /S /r >>}%
1109   \edef\arabic{\the\arabiccount << /S /D >>}%
1110   %
1111   % Page label ranges must be increasing.  Remove any duplicates.
1112   % (There is a slight chance of this being wrong if e.g. there is
1113   % a @contents but no @titlepage, etc.)
1114   %
1115   \ifnum\romancount=0 \def\roman{}\fi
1116   \ifnum\arabiccount=0 \def\title{}%
1117   \else
1118     \ifnum\romancount=\arabiccount \def\roman{}\fi
1119   \fi
1120   %
1121   \ifnum\romancount<\arabiccount
1122     \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax
1123   \else
1124     \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax
1125   \fi
1126 }
1127 \else
1128   \let\pagelabels\relax
1129 \fi
1130
1131 \newcount\pagecount \pagecount=0
1132 \newcount\romancount \romancount=0
1133 \newcount\arabiccount \arabiccount=0
1134 \ifpdf
1135   \let\ptxadvancepageno\advancepageno
1136   \def\advancepageno{%
1137     \ptxadvancepageno\global\advance\pagecount by 1
1138   }
1139 \fi
1140
1141
1142 % PDF uses PostScript string constants for the names of xref targets,
1143 % for display in the outlines, and in other places.  Thus, we have to
1144 % double any backslashes.  Otherwise, a name like "\node" will be
1145 % interpreted as a newline (\n), followed by o, d, e.  Not good.
1146
1147 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1148 % related messages.  The final outcome is that it is up to the TeX user
1149 % to double the backslashes and otherwise make the string valid, so
1150 % that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
1151 % do this reliably, so we use it.
1152
1153 % #1 is a control sequence in which to do the replacements,
1154 % which we \xdef.
1155 \def\txiescapepdf#1{%
1156   \ifx\pdfescapestring\thisisundefined
1157     % No primitive available; should we give a warning or log?
1158     % Many times it won't matter.
1159     \xdef#1{#1}%
1160   \else
1161     % The expandable \pdfescapestring primitive escapes parentheses,
1162     % backslashes, and other special chars.
1163     \xdef#1{\pdfescapestring{#1}}%
1164   \fi
1165 }
1166 \def\txiescapepdfutfsixteen#1{%
1167   \ifx\pdfescapestrutfsixteen\thisisundefined
1168     % No UTF-16 converting macro available.
1169     \txiescapepdf{#1}%
1170   \else
1171     \xdef#1{\pdfescapestrutfsixteen{#1}}%
1172   \fi
1173 }
1174
1175 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1176 with PDF output, and none of those formats could be found.  (.eps cannot
1177 be supported due to the design of the PDF format; use regular TeX (DVI
1178 output) for that.)}
1179
1180 \ifpdf
1181   %
1182   % Color manipulation macros using ideas from pdfcolor.tex,
1183   % except using rgb instead of cmyk; the latter is said to render as a
1184   % very dark gray on-screen and a very dark halftone in print, instead
1185   % of actual black. The dark red here is dark enough to print on paper as
1186   % nearly black, but still distinguishable for online viewing.  We use
1187   % black by default, though.
1188   \def\rgbDarkRed{0.50 0.09 0.12}
1189   \def\rgbBlack{0 0 0}
1190   %
1191   % rg sets the color for filling (usual text, etc.);
1192   % RG sets the color for stroking (thin rules, e.g., normal _'s).
1193   \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
1194   %
1195   % Set color, and create a mark which defines \thiscolor accordingly,
1196   % so that \makeheadline knows which color to restore.
1197   \def\curcolor{0 0 0}%
1198   \def\setcolor#1{%
1199     \ifx#1\curcolor\else
1200       \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1201       \domark
1202       \pdfsetcolor{#1}%
1203       \xdef\curcolor{#1}%
1204     \fi
1205   }
1206   %
1207   \let\maincolor\rgbBlack
1208   \pdfsetcolor{\maincolor}
1209   \edef\thiscolor{\maincolor}
1210   \def\currentcolordefs{}
1211   %
1212   \def\makefootline{%
1213     \baselineskip24pt
1214     \line{\pdfsetcolor{\maincolor}\the\footline}%
1215   }
1216   %
1217   \def\makeheadline{%
1218     \vbox to 0pt{%
1219       \vskip-22.5pt
1220       \line{%
1221         \vbox to8.5pt{}%
1222         % Extract \thiscolor definition from the marks.
1223         \getcolormarks
1224         % Typeset the headline with \maincolor, then restore the color.
1225         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1226       }%
1227       \vss
1228     }%
1229     \nointerlineskip
1230   }
1231   %
1232   %
1233   \pdfcatalog{/PageMode /UseOutlines}
1234   %
1235   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1236   \def\dopdfimage#1#2#3{%
1237     \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1238     \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1239     %
1240     % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1241     % others).  Let's try in that order, PDF first since if
1242     % someone has a scalable image, presumably better to use that than a
1243     % bitmap.
1244     \let\pdfimgext=\empty
1245     \begingroup
1246       \openin 1 #1.pdf \ifeof 1
1247         \openin 1 #1.PDF \ifeof 1
1248           \openin 1 #1.png \ifeof 1
1249             \openin 1 #1.jpg \ifeof 1
1250               \openin 1 #1.jpeg \ifeof 1
1251                 \openin 1 #1.JPG \ifeof 1
1252                   \errhelp = \nopdfimagehelp
1253                   \errmessage{Could not find image file #1 for pdf}%
1254                 \else \gdef\pdfimgext{JPG}%
1255                 \fi
1256               \else \gdef\pdfimgext{jpeg}%
1257               \fi
1258             \else \gdef\pdfimgext{jpg}%
1259             \fi
1260           \else \gdef\pdfimgext{png}%
1261           \fi
1262         \else \gdef\pdfimgext{PDF}%
1263         \fi
1264       \else \gdef\pdfimgext{pdf}%
1265       \fi
1266       \closein 1
1267     \endgroup
1268     %
1269     % without \immediate, ancient pdftex seg faults when the same image is
1270     % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
1271     \ifnum\pdftexversion < 14
1272       \immediate\pdfimage
1273     \else
1274       \immediate\pdfximage
1275     \fi
1276       \ifdim \wd0 >0pt width \pdfimagewidth \fi
1277       \ifdim \wd2 >0pt height \pdfimageheight \fi
1278       \ifnum\pdftexversion<13
1279          #1.\pdfimgext
1280        \else
1281          {#1.\pdfimgext}%
1282        \fi
1283     \ifnum\pdftexversion < 14 \else
1284       \pdfrefximage \pdflastximage
1285     \fi}
1286   %
1287   \def\setpdfdestname#1{{%
1288     % We have to set dummies so commands such as @code, and characters
1289     % such as \, aren't expanded when present in a section title.
1290     \indexnofonts
1291     \makevalueexpandable
1292     \turnoffactive
1293     \iftxiuseunicodedestname
1294       \ifx \declaredencoding \latone
1295         % Pass through Latin-1 characters.
1296         % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1297       \else
1298         \ifx \declaredencoding \utfeight
1299           % Pass through Unicode characters.
1300         \else
1301           % Use ASCII approximations in destination names.
1302           \passthroughcharsfalse
1303         \fi
1304       \fi
1305     \else
1306       % Use ASCII approximations in destination names.
1307       \passthroughcharsfalse
1308     \fi
1309     \def\pdfdestname{#1}%
1310     \txiescapepdf\pdfdestname
1311   }}
1312   %
1313   \def\setpdfoutlinetext#1{{%
1314     \indexnofonts
1315     \makevalueexpandable
1316     \turnoffactive
1317     \ifx \declaredencoding \latone
1318       % The PDF format can use an extended form of Latin-1 in bookmark
1319       % strings.  See Appendix D of the PDF Reference, Sixth Edition, for
1320       % the "PDFDocEncoding".
1321       \passthroughcharstrue
1322       % Pass through Latin-1 characters.
1323       %   LuaTeX: Convert to Unicode
1324       %   pdfTeX: Use Latin-1 as PDFDocEncoding
1325       \def\pdfoutlinetext{#1}%
1326     \else
1327       \ifx \declaredencoding \utfeight
1328         \ifx\luatexversion\thisisundefined
1329           % For pdfTeX  with UTF-8.
1330           % TODO: the PDF format can use UTF-16 in bookmark strings,
1331           % but the code for this isn't done yet.
1332           % Use ASCII approximations.
1333           \passthroughcharsfalse
1334           \def\pdfoutlinetext{#1}%
1335         \else
1336           % For LuaTeX with UTF-8.
1337           % Pass through Unicode characters for title texts.
1338           \passthroughcharstrue
1339           \def\pdfoutlinetext{#1}%
1340         \fi
1341       \else
1342         % For non-Latin-1 or non-UTF-8 encodings.
1343         % Use ASCII approximations.
1344         \passthroughcharsfalse
1345         \def\pdfoutlinetext{#1}%
1346       \fi
1347     \fi
1348     % LuaTeX: Convert to UTF-16
1349     % pdfTeX: Use Latin-1 as PDFDocEncoding
1350     \txiescapepdfutfsixteen\pdfoutlinetext
1351   }}
1352   %
1353   \def\pdfmkdest#1{%
1354     \setpdfdestname{#1}%
1355     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1356   }
1357   %
1358   % used to mark target names; must be expandable.
1359   \def\pdfmkpgn#1{#1}
1360   %
1361   % by default, use black for everything.
1362   \def\urlcolor{\rgbBlack}
1363   \let\linkcolor\rgbBlack
1364   \def\endlink{\setcolor{\maincolor}\pdfendlink}
1365   %
1366   % Adding outlines to PDF; macros for calculating structure of outlines
1367   % come from Petr Olsak
1368   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1369     \else \csname#1\endcsname \fi}
1370   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1371     \advance\tempnum by 1
1372     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1373   %
1374   % #1 is the section text, which is what will be displayed in the
1375   % outline by the pdf viewer.  #2 is the pdf expression for the number
1376   % of subentries (or empty, for subsubsections).  #3 is the node text,
1377   % which might be empty if this toc entry had no corresponding node.
1378   % #4 is the page number
1379   %
1380   \def\dopdfoutline#1#2#3#4{%
1381     % Generate a link to the node text if that exists; else, use the
1382     % page number.  We could generate a destination for the section
1383     % text in the case where a section has no node, but it doesn't
1384     % seem worth the trouble, since most documents are normally structured.
1385     \setpdfoutlinetext{#1}
1386     \setpdfdestname{#3}
1387     \ifx\pdfdestname\empty
1388       \def\pdfdestname{#4}%
1389     \fi
1390     %
1391     \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
1392   }
1393   %
1394   \def\pdfmakeoutlines{%
1395     \begingroup
1396       % Read toc silently, to get counts of subentries for \pdfoutline.
1397       \def\partentry##1##2##3##4{}% ignore parts in the outlines
1398       \def\numchapentry##1##2##3##4{%
1399         \def\thischapnum{##2}%
1400         \def\thissecnum{0}%
1401         \def\thissubsecnum{0}%
1402       }%
1403       \def\numsecentry##1##2##3##4{%
1404         \advancenumber{chap\thischapnum}%
1405         \def\thissecnum{##2}%
1406         \def\thissubsecnum{0}%
1407       }%
1408       \def\numsubsecentry##1##2##3##4{%
1409         \advancenumber{sec\thissecnum}%
1410         \def\thissubsecnum{##2}%
1411       }%
1412       \def\numsubsubsecentry##1##2##3##4{%
1413         \advancenumber{subsec\thissubsecnum}%
1414       }%
1415       \def\thischapnum{0}%
1416       \def\thissecnum{0}%
1417       \def\thissubsecnum{0}%
1418       %
1419       % use \def rather than \let here because we redefine \chapentry et
1420       % al. a second time, below.
1421       \def\appentry{\numchapentry}%
1422       \def\appsecentry{\numsecentry}%
1423       \def\appsubsecentry{\numsubsecentry}%
1424       \def\appsubsubsecentry{\numsubsubsecentry}%
1425       \def\unnchapentry{\numchapentry}%
1426       \def\unnsecentry{\numsecentry}%
1427       \def\unnsubsecentry{\numsubsecentry}%
1428       \def\unnsubsubsecentry{\numsubsubsecentry}%
1429       \readdatafile{toc}%
1430       %
1431       % Read toc second time, this time actually producing the outlines.
1432       % The `-' means take the \expnumber as the absolute number of
1433       % subentries, which we calculated on our first read of the .toc above.
1434       %
1435       % We use the node names as the destinations.
1436       %
1437       % Currently we prefix the section name with the section number
1438       % for chapter and appendix headings only in order to avoid too much 
1439       % horizontal space being required in the PDF viewer.
1440       \def\numchapentry##1##2##3##4{%
1441         \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1442       \def\unnchapentry##1##2##3##4{%
1443         \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1444       \def\numsecentry##1##2##3##4{%
1445         \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1446       \def\numsubsecentry##1##2##3##4{%
1447         \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1448       \def\numsubsubsecentry##1##2##3##4{% count is always zero
1449         \dopdfoutline{##1}{}{##3}{##4}}%
1450       %
1451       % PDF outlines are displayed using system fonts, instead of
1452       % document fonts.  Therefore we cannot use special characters,
1453       % since the encoding is unknown.  For example, the eogonek from
1454       % Latin 2 (0xea) gets translated to a | character.  Info from
1455       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1456       %
1457       % TODO this right, we have to translate 8-bit characters to
1458       % their "best" equivalent, based on the @documentencoding.  Too
1459       % much work for too little return.  Just use the ASCII equivalents
1460       % we use for the index sort strings.
1461       % 
1462       \indexnofonts
1463       \setupdatafile
1464       % We can have normal brace characters in the PDF outlines, unlike
1465       % Texinfo index files.  So set that up.
1466       \def\{{\lbracecharliteral}%
1467       \def\}{\rbracecharliteral}%
1468       \catcode`\\=\active \otherbackslash
1469       \input \tocreadfilename
1470     \endgroup
1471   }
1472   {\catcode`[=1 \catcode`]=2
1473    \catcode`{=\other \catcode`}=\other
1474    \gdef\lbracecharliteral[{]%
1475    \gdef\rbracecharliteral[}]%
1476   ]
1477   %
1478   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1479     \ifx\PP\D\let\nextsp\relax
1480     \else\let\nextsp\skipspaces
1481       \addtokens{\filename}{\PP}%
1482       \advance\filenamelength by 1
1483     \fi
1484     \nextsp}
1485   \def\getfilename#1{%
1486     \filenamelength=0
1487     % If we don't expand the argument now, \skipspaces will get
1488     % snagged on things like "@value{foo}".
1489     \edef\temp{#1}%
1490     \expandafter\skipspaces\temp|\relax
1491   }
1492   \ifnum\pdftexversion < 14
1493     \let \startlink \pdfannotlink
1494   \else
1495     \let \startlink \pdfstartlink
1496   \fi
1497   % make a live url in pdf output.
1498   \def\pdfurl#1{%
1499     \begingroup
1500       % it seems we really need yet another set of dummies; have not
1501       % tried to figure out what each command should do in the context
1502       % of @url.  for now, just make @/ a no-op, that's the only one
1503       % people have actually reported a problem with.
1504       %
1505       \normalturnoffactive
1506       \def\@{@}%
1507       \let\/=\empty
1508       \makevalueexpandable
1509       % do we want to go so far as to use \indexnofonts instead of just
1510       % special-casing \var here?
1511       \def\var##1{##1}%
1512       %
1513       \leavevmode\setcolor{\urlcolor}%
1514       \startlink attr{/Border [0 0 0]}%
1515         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1516     \endgroup}
1517   % \pdfgettoks - Surround page numbers in #1 with @pdflink.  #1 may
1518   % be a simple number, or a list of numbers in the case of an index
1519   % entry.
1520   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1521   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1522   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1523   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1524   \def\maketoks{%
1525     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1526     \ifx\first0\adn0
1527     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1528     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1529     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1530     \else
1531       \ifnum0=\countA\else\makelink\fi
1532       \ifx\first.\let\next=\done\else
1533         \let\next=\maketoks
1534         \addtokens{\toksB}{\the\toksD}
1535         \ifx\first,\addtokens{\toksB}{\space}\fi
1536       \fi
1537     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1538     \next}
1539   \def\makelink{\addtokens{\toksB}%
1540     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1541   \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1542   \def\pdflinkpage#1#2{%
1543     \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1544     \setcolor{\linkcolor}#2\endlink}
1545   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1546 \else
1547   % non-pdf mode
1548   \let\pdfmkdest = \gobble
1549   \let\pdfurl = \gobble
1550   \let\endlink = \relax
1551   \let\setcolor = \gobble
1552   \let\pdfsetcolor = \gobble
1553   \let\pdfmakeoutlines = \relax
1554 \fi  % \ifx\pdfoutput
1555
1556 %
1557 % For XeTeX
1558 %
1559 \ifx\XeTeXrevision\thisisundefined
1560 \else
1561   %
1562   % XeTeX version check
1563   %
1564   \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1565     % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1566     % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1567     % For avoiding PDF destination name replacement, we use this special
1568     % instead of xdvipdfmx's command line option `-C 0x0010'.
1569     \special{dvipdfmx:config C 0x0010}
1570     % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1571     % It can handle Unicode destination names for PDF.
1572     \txiuseunicodedestnametrue
1573   \else
1574     % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1575     % `dvipdfmx:config' special.
1576     % So for avoiding PDF destination name replacement,
1577     % xdvipdfmx's command line option `-C 0x0010' is necessary.
1578     %
1579     % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1580     % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1581     % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1582     \txiuseunicodedestnamefalse
1583   \fi
1584   %
1585   % Color support
1586   %
1587   \def\rgbDarkRed{0.50 0.09 0.12}
1588   \def\rgbBlack{0 0 0}
1589   %
1590   \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1591   %
1592   % Set color, and create a mark which defines \thiscolor accordingly,
1593   % so that \makeheadline knows which color to restore.
1594   \def\setcolor#1{%
1595     \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1596     \domark
1597     \pdfsetcolor{#1}%
1598   }
1599   %
1600   \def\maincolor{\rgbBlack}
1601   \pdfsetcolor{\maincolor}
1602   \edef\thiscolor{\maincolor}
1603   \def\currentcolordefs{}
1604   %
1605   \def\makefootline{%
1606     \baselineskip24pt
1607     \line{\pdfsetcolor{\maincolor}\the\footline}%
1608   }
1609   %
1610   \def\makeheadline{%
1611     \vbox to 0pt{%
1612       \vskip-22.5pt
1613       \line{%
1614         \vbox to8.5pt{}%
1615         % Extract \thiscolor definition from the marks.
1616         \getcolormarks
1617         % Typeset the headline with \maincolor, then restore the color.
1618         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1619       }%
1620       \vss
1621     }%
1622     \nointerlineskip
1623   }
1624   %
1625   % PDF outline support
1626   %
1627   % Emulate pdfTeX primitive
1628   \def\pdfdest name#1 xyz{%
1629     \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1630   }
1631   %
1632   \def\setpdfdestname#1{{%
1633     % We have to set dummies so commands such as @code, and characters
1634     % such as \, aren't expanded when present in a section title.
1635     \indexnofonts
1636     \makevalueexpandable
1637     \turnoffactive
1638     \iftxiuseunicodedestname
1639       % Pass through Unicode characters.
1640     \else
1641       % Use ASCII approximations in destination names.
1642       \passthroughcharsfalse
1643     \fi
1644     \def\pdfdestname{#1}%
1645     \txiescapepdf\pdfdestname
1646   }}
1647   %
1648   \def\setpdfoutlinetext#1{{%
1649     \turnoffactive
1650     % Always use Unicode characters in title texts.
1651     \def\pdfoutlinetext{#1}%
1652     % For XeTeX, xdvipdfmx converts to UTF-16.
1653     % So we do not convert.
1654     \txiescapepdf\pdfoutlinetext
1655   }}
1656   %
1657   \def\pdfmkdest#1{%
1658     \setpdfdestname{#1}%
1659     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1660   }
1661   %
1662   % by default, use black for everything.
1663   \def\urlcolor{\rgbBlack}
1664   \def\linkcolor{\rgbBlack}
1665   \def\endlink{\setcolor{\maincolor}\pdfendlink}
1666   %
1667   \def\dopdfoutline#1#2#3#4{%
1668     \setpdfoutlinetext{#1}
1669     \setpdfdestname{#3}
1670     \ifx\pdfdestname\empty
1671       \def\pdfdestname{#4}%
1672     \fi
1673     %
1674     \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1675       << /S /GoTo /D (\pdfdestname) >> >> }%
1676   }
1677   %
1678   \def\pdfmakeoutlines{%
1679     \begingroup
1680       %
1681       % For XeTeX, counts of subentries are not necessary.
1682       % Therefore, we read toc only once.
1683       %
1684       % We use node names as destinations.
1685       %
1686       % Currently we prefix the section name with the section number
1687       % for chapter and appendix headings only in order to avoid too much 
1688       % horizontal space being required in the PDF viewer.
1689       \def\partentry##1##2##3##4{}% ignore parts in the outlines
1690       \def\numchapentry##1##2##3##4{%
1691         \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
1692       \def\numsecentry##1##2##3##4{%
1693         \dopdfoutline{##1}{2}{##3}{##4}}%
1694       \def\numsubsecentry##1##2##3##4{%
1695         \dopdfoutline{##1}{3}{##3}{##4}}%
1696       \def\numsubsubsecentry##1##2##3##4{%
1697         \dopdfoutline{##1}{4}{##3}{##4}}%
1698       %
1699       \let\appentry\numchapentry%
1700       \let\appsecentry\numsecentry%
1701       \let\appsubsecentry\numsubsecentry%
1702       \let\appsubsubsecentry\numsubsubsecentry%
1703       \def\unnchapentry##1##2##3##4{%
1704         \dopdfoutline{##1}{1}{##3}{##4}}%
1705       \let\unnsecentry\numsecentry%
1706       \let\unnsubsecentry\numsubsecentry%
1707       \let\unnsubsubsecentry\numsubsubsecentry%
1708       %
1709       % For XeTeX, xdvipdfmx converts strings to UTF-16.
1710       % Therefore, the encoding and the language may not be considered.
1711       %
1712       \indexnofonts
1713       \setupdatafile
1714       % We can have normal brace characters in the PDF outlines, unlike
1715       % Texinfo index files.  So set that up.
1716       \def\{{\lbracecharliteral}%
1717       \def\}{\rbracecharliteral}%
1718       \catcode`\\=\active \otherbackslash
1719       \input \tocreadfilename
1720     \endgroup
1721   }
1722   {\catcode`[=1 \catcode`]=2
1723    \catcode`{=\other \catcode`}=\other
1724    \gdef\lbracecharliteral[{]%
1725    \gdef\rbracecharliteral[}]%
1726   ]
1727
1728   \special{pdf:docview << /PageMode /UseOutlines >> }
1729   % ``\special{pdf:tounicode ...}'' is not necessary
1730   % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1731   % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1732   % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1733   % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1734 %
1735   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1736     \ifx\PP\D\let\nextsp\relax
1737     \else\let\nextsp\skipspaces
1738       \addtokens{\filename}{\PP}%
1739       \advance\filenamelength by 1
1740     \fi
1741     \nextsp}
1742   \def\getfilename#1{%
1743     \filenamelength=0
1744     % If we don't expand the argument now, \skipspaces will get
1745     % snagged on things like "@value{foo}".
1746     \edef\temp{#1}%
1747     \expandafter\skipspaces\temp|\relax
1748   }
1749   % make a live url in pdf output.
1750   \def\pdfurl#1{%
1751     \begingroup
1752       % it seems we really need yet another set of dummies; have not
1753       % tried to figure out what each command should do in the context
1754       % of @url.  for now, just make @/ a no-op, that's the only one
1755       % people have actually reported a problem with.
1756       %
1757       \normalturnoffactive
1758       \def\@{@}%
1759       \let\/=\empty
1760       \makevalueexpandable
1761       % do we want to go so far as to use \indexnofonts instead of just
1762       % special-casing \var here?
1763       \def\var##1{##1}%
1764       %
1765       \leavevmode\setcolor{\urlcolor}%
1766       \special{pdf:bann << /Border [0 0 0]
1767         /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1768     \endgroup}
1769   \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1770   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1771   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1772   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1773   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1774   \def\maketoks{%
1775     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1776     \ifx\first0\adn0
1777     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1778     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1779     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1780     \else
1781       \ifnum0=\countA\else\makelink\fi
1782       \ifx\first.\let\next=\done\else
1783         \let\next=\maketoks
1784         \addtokens{\toksB}{\the\toksD}
1785         \ifx\first,\addtokens{\toksB}{\space}\fi
1786       \fi
1787     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1788     \next}
1789   \def\makelink{\addtokens{\toksB}%
1790     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1791   \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1792   \def\pdflinkpage#1#2{%
1793     \special{pdf:bann << /Border [0 0 0]
1794       /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1795     \setcolor{\linkcolor}#2\endlink}
1796   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1797 %
1798   %
1799   % @image support
1800   %
1801   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1802   \def\doxeteximage#1#2#3{%
1803     \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1804     \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1805     %
1806     % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1807     % others).  Let's try in that order, PDF first since if
1808     % someone has a scalable image, presumably better to use that than a
1809     % bitmap.
1810     \let\xeteximgext=\empty
1811     \begingroup
1812       \openin 1 #1.pdf \ifeof 1
1813         \openin 1 #1.PDF \ifeof 1
1814           \openin 1 #1.png \ifeof 1
1815             \openin 1 #1.jpg \ifeof 1
1816               \openin 1 #1.jpeg \ifeof 1
1817                 \openin 1 #1.JPG \ifeof 1
1818                   \errmessage{Could not find image file #1 for XeTeX}%
1819                 \else \gdef\xeteximgext{JPG}%
1820                 \fi
1821               \else \gdef\xeteximgext{jpeg}%
1822               \fi
1823             \else \gdef\xeteximgext{jpg}%
1824             \fi
1825           \else \gdef\xeteximgext{png}%
1826           \fi
1827         \else \gdef\xeteximgext{PDF}%
1828         \fi
1829       \else \gdef\xeteximgext{pdf}%
1830       \fi
1831       \closein 1
1832     \endgroup
1833     %
1834     % Putting an \hbox around the image can prevent an over-long line
1835     % after the image.
1836     \hbox\bgroup
1837       \def\xetexpdfext{pdf}%
1838       \ifx\xeteximgext\xetexpdfext
1839         \XeTeXpdffile "#1".\xeteximgext ""
1840       \else
1841         \def\xetexpdfext{PDF}%
1842         \ifx\xeteximgext\xetexpdfext
1843           \XeTeXpdffile "#1".\xeteximgext ""
1844         \else
1845           \XeTeXpicfile "#1".\xeteximgext ""
1846         \fi
1847       \fi
1848       \ifdim \wd0 >0pt width \xeteximagewidth \fi
1849       \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1850     \egroup
1851   }
1852 \fi
1853
1854
1855 %
1856 \message{fonts,}
1857
1858 % Set the baselineskip to #1, and the lineskip and strut size
1859 % correspondingly.  There is no deep meaning behind these magic numbers
1860 % used as factors; they just match (closely enough) what Knuth defined.
1861 %
1862 \def\lineskipfactor{.08333}
1863 \def\strutheightpercent{.70833}
1864 \def\strutdepthpercent {.29167}
1865 %
1866 % can get a sort of poor man's double spacing by redefining this.
1867 \def\baselinefactor{1}
1868 %
1869 \newdimen\textleading
1870 \def\setleading#1{%
1871   \dimen0 = #1\relax
1872   \normalbaselineskip = \baselinefactor\dimen0
1873   \normallineskip = \lineskipfactor\normalbaselineskip
1874   \normalbaselines
1875   \setbox\strutbox =\hbox{%
1876     \vrule width0pt height\strutheightpercent\baselineskip
1877                     depth \strutdepthpercent \baselineskip
1878   }%
1879 }
1880
1881 % PDF CMaps.  See also LaTeX's t1.cmap.
1882 %
1883 % do nothing with this by default.
1884 \expandafter\let\csname cmapOT1\endcsname\gobble
1885 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1886 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1887
1888 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1889 % (\pdffontattr was introduced many years ago, but people still run
1890 % older pdftex's; it's easy to conditionalize, so we do.)
1891 \ifpdf \ifx\pdffontattr\thisisundefined \else
1892   \begingroup
1893     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1894     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1895 %%DocumentNeededResources: ProcSet (CIDInit)
1896 %%IncludeResource: ProcSet (CIDInit)
1897 %%BeginResource: CMap (TeX-OT1-0)
1898 %%Title: (TeX-OT1-0 TeX OT1 0)
1899 %%Version: 1.000
1900 %%EndComments
1901 /CIDInit /ProcSet findresource begin
1902 12 dict begin
1903 begincmap
1904 /CIDSystemInfo
1905 << /Registry (TeX)
1906 /Ordering (OT1)
1907 /Supplement 0
1908 >> def
1909 /CMapName /TeX-OT1-0 def
1910 /CMapType 2 def
1911 1 begincodespacerange
1912 <00> <7F>
1913 endcodespacerange
1914 8 beginbfrange
1915 <00> <01> <0393>
1916 <09> <0A> <03A8>
1917 <23> <26> <0023>
1918 <28> <3B> <0028>
1919 <3F> <5B> <003F>
1920 <5D> <5E> <005D>
1921 <61> <7A> <0061>
1922 <7B> <7C> <2013>
1923 endbfrange
1924 40 beginbfchar
1925 <02> <0398>
1926 <03> <039B>
1927 <04> <039E>
1928 <05> <03A0>
1929 <06> <03A3>
1930 <07> <03D2>
1931 <08> <03A6>
1932 <0B> <00660066>
1933 <0C> <00660069>
1934 <0D> <0066006C>
1935 <0E> <006600660069>
1936 <0F> <00660066006C>
1937 <10> <0131>
1938 <11> <0237>
1939 <12> <0060>
1940 <13> <00B4>
1941 <14> <02C7>
1942 <15> <02D8>
1943 <16> <00AF>
1944 <17> <02DA>
1945 <18> <00B8>
1946 <19> <00DF>
1947 <1A> <00E6>
1948 <1B> <0153>
1949 <1C> <00F8>
1950 <1D> <00C6>
1951 <1E> <0152>
1952 <1F> <00D8>
1953 <21> <0021>
1954 <22> <201D>
1955 <27> <2019>
1956 <3C> <00A1>
1957 <3D> <003D>
1958 <3E> <00BF>
1959 <5C> <201C>
1960 <5F> <02D9>
1961 <60> <2018>
1962 <7D> <02DD>
1963 <7E> <007E>
1964 <7F> <00A8>
1965 endbfchar
1966 endcmap
1967 CMapName currentdict /CMap defineresource pop
1968 end
1969 end
1970 %%EndResource
1971 %%EOF
1972     }\endgroup
1973   \expandafter\edef\csname cmapOT1\endcsname#1{%
1974     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1975   }%
1976 %
1977 % \cmapOT1IT
1978   \begingroup
1979     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1980     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1981 %%DocumentNeededResources: ProcSet (CIDInit)
1982 %%IncludeResource: ProcSet (CIDInit)
1983 %%BeginResource: CMap (TeX-OT1IT-0)
1984 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1985 %%Version: 1.000
1986 %%EndComments
1987 /CIDInit /ProcSet findresource begin
1988 12 dict begin
1989 begincmap
1990 /CIDSystemInfo
1991 << /Registry (TeX)
1992 /Ordering (OT1IT)
1993 /Supplement 0
1994 >> def
1995 /CMapName /TeX-OT1IT-0 def
1996 /CMapType 2 def
1997 1 begincodespacerange
1998 <00> <7F>
1999 endcodespacerange
2000 8 beginbfrange
2001 <00> <01> <0393>
2002 <09> <0A> <03A8>
2003 <25> <26> <0025>
2004 <28> <3B> <0028>
2005 <3F> <5B> <003F>
2006 <5D> <5E> <005D>
2007 <61> <7A> <0061>
2008 <7B> <7C> <2013>
2009 endbfrange
2010 42 beginbfchar
2011 <02> <0398>
2012 <03> <039B>
2013 <04> <039E>
2014 <05> <03A0>
2015 <06> <03A3>
2016 <07> <03D2>
2017 <08> <03A6>
2018 <0B> <00660066>
2019 <0C> <00660069>
2020 <0D> <0066006C>
2021 <0E> <006600660069>
2022 <0F> <00660066006C>
2023 <10> <0131>
2024 <11> <0237>
2025 <12> <0060>
2026 <13> <00B4>
2027 <14> <02C7>
2028 <15> <02D8>
2029 <16> <00AF>
2030 <17> <02DA>
2031 <18> <00B8>
2032 <19> <00DF>
2033 <1A> <00E6>
2034 <1B> <0153>
2035 <1C> <00F8>
2036 <1D> <00C6>
2037 <1E> <0152>
2038 <1F> <00D8>
2039 <21> <0021>
2040 <22> <201D>
2041 <23> <0023>
2042 <24> <00A3>
2043 <27> <2019>
2044 <3C> <00A1>
2045 <3D> <003D>
2046 <3E> <00BF>
2047 <5C> <201C>
2048 <5F> <02D9>
2049 <60> <2018>
2050 <7D> <02DD>
2051 <7E> <007E>
2052 <7F> <00A8>
2053 endbfchar
2054 endcmap
2055 CMapName currentdict /CMap defineresource pop
2056 end
2057 end
2058 %%EndResource
2059 %%EOF
2060     }\endgroup
2061   \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2062     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2063   }%
2064 %
2065 % \cmapOT1TT
2066   \begingroup
2067     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2068     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2069 %%DocumentNeededResources: ProcSet (CIDInit)
2070 %%IncludeResource: ProcSet (CIDInit)
2071 %%BeginResource: CMap (TeX-OT1TT-0)
2072 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2073 %%Version: 1.000
2074 %%EndComments
2075 /CIDInit /ProcSet findresource begin
2076 12 dict begin
2077 begincmap
2078 /CIDSystemInfo
2079 << /Registry (TeX)
2080 /Ordering (OT1TT)
2081 /Supplement 0
2082 >> def
2083 /CMapName /TeX-OT1TT-0 def
2084 /CMapType 2 def
2085 1 begincodespacerange
2086 <00> <7F>
2087 endcodespacerange
2088 5 beginbfrange
2089 <00> <01> <0393>
2090 <09> <0A> <03A8>
2091 <21> <26> <0021>
2092 <28> <5F> <0028>
2093 <61> <7E> <0061>
2094 endbfrange
2095 32 beginbfchar
2096 <02> <0398>
2097 <03> <039B>
2098 <04> <039E>
2099 <05> <03A0>
2100 <06> <03A3>
2101 <07> <03D2>
2102 <08> <03A6>
2103 <0B> <2191>
2104 <0C> <2193>
2105 <0D> <0027>
2106 <0E> <00A1>
2107 <0F> <00BF>
2108 <10> <0131>
2109 <11> <0237>
2110 <12> <0060>
2111 <13> <00B4>
2112 <14> <02C7>
2113 <15> <02D8>
2114 <16> <00AF>
2115 <17> <02DA>
2116 <18> <00B8>
2117 <19> <00DF>
2118 <1A> <00E6>
2119 <1B> <0153>
2120 <1C> <00F8>
2121 <1D> <00C6>
2122 <1E> <0152>
2123 <1F> <00D8>
2124 <20> <2423>
2125 <27> <2019>
2126 <60> <2018>
2127 <7F> <00A8>
2128 endbfchar
2129 endcmap
2130 CMapName currentdict /CMap defineresource pop
2131 end
2132 end
2133 %%EndResource
2134 %%EOF
2135     }\endgroup
2136   \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2137     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2138   }%
2139 \fi\fi
2140 %
2141 % This is what gets called when #5 of \setfont is empty.
2142 \let\cmap\gobble
2143 %
2144 % (end of cmaps)
2145
2146
2147 % Set the font macro #1 to the font named \fontprefix#2.
2148 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2149 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2150 % Example:
2151 % #1 = \textrm
2152 % #2 = \rmshape
2153 % #3 = 10
2154 % #4 = \mainmagstep
2155 % #5 = OT1
2156 %
2157 \def\setfont#1#2#3#4#5{%
2158   \font#1=\fontprefix#2#3 scaled #4
2159   \csname cmap#5\endcsname#1%
2160   \ifx#2\ttshape\hyphenchar#1=-1 \fi
2161   \ifx#2\ttbshape\hyphenchar#1=-1 \fi
2162   \ifx#2\ttslshape\hyphenchar#1=-1 \fi
2163 }
2164
2165 % Use cm as the default font prefix.
2166 % To specify the font prefix, you must define \fontprefix
2167 % before you read in texinfo.tex.
2168 \ifx\fontprefix\thisisundefined
2169 \def\fontprefix{cm}
2170 \fi
2171 % Support font families that don't use the same naming scheme as CM.
2172 \def\rmshape{r}
2173 \def\rmbshape{bx}               % where the normal face is bold
2174 \def\bfshape{b}
2175 \def\bxshape{bx}
2176 \def\ttshape{tt}
2177 \def\ttbshape{tt}
2178 \def\ttslshape{sltt}
2179 \def\itshape{ti}
2180 \def\itbshape{bxti}
2181 \def\slshape{sl}
2182 \def\slbshape{bxsl}
2183 \def\sfshape{ss}
2184 \def\sfbshape{ss}
2185 \def\scshape{csc}
2186 \def\scbshape{csc}
2187
2188 % Definitions for a main text size of 11pt.  (The default in Texinfo.)
2189 %
2190 \def\definetextfontsizexi{%
2191 % Text fonts (11.2pt, magstep1).
2192 \def\textnominalsize{11pt}
2193 \edef\mainmagstep{\magstephalf}
2194 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2195 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2196 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2197 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2198 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2199 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2200 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2201 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2202 \font\texti=cmmi10 scaled \mainmagstep
2203 \font\textsy=cmsy10 scaled \mainmagstep
2204 \def\textecsize{1095}
2205
2206 % A few fonts for @defun names and args.
2207 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2208 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2209 \setfont\defsl\slshape{10}{\magstep1}{OT1}
2210 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2211 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2212 \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2213
2214 % Fonts for indices, footnotes, small examples (9pt).
2215 \def\smallnominalsize{9pt}
2216 \setfont\smallrm\rmshape{9}{1000}{OT1}
2217 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2218 \setfont\smallbf\bfshape{10}{900}{OT1}
2219 \setfont\smallit\itshape{9}{1000}{OT1IT}
2220 \setfont\smallsl\slshape{9}{1000}{OT1}
2221 \setfont\smallsf\sfshape{9}{1000}{OT1}
2222 \setfont\smallsc\scshape{10}{900}{OT1}
2223 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2224 \font\smalli=cmmi9
2225 \font\smallsy=cmsy9
2226 \def\smallecsize{0900}
2227
2228 % Fonts for small examples (8pt).
2229 \def\smallernominalsize{8pt}
2230 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2231 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2232 \setfont\smallerbf\bfshape{10}{800}{OT1}
2233 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2234 \setfont\smallersl\slshape{8}{1000}{OT1}
2235 \setfont\smallersf\sfshape{8}{1000}{OT1}
2236 \setfont\smallersc\scshape{10}{800}{OT1}
2237 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2238 \font\smalleri=cmmi8
2239 \font\smallersy=cmsy8
2240 \def\smallerecsize{0800}
2241
2242 % Fonts for math mode superscripts (7pt).
2243 \def\sevennominalsize{7pt}
2244 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2245 \setfont\seventt\ttshape{10}{700}{OT1TT}
2246 \setfont\sevenbf\bfshape{10}{700}{OT1}
2247 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2248 \setfont\sevensl\slshape{10}{700}{OT1}
2249 \setfont\sevensf\sfshape{10}{700}{OT1}
2250 \setfont\sevensc\scshape{10}{700}{OT1}
2251 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2252 \font\seveni=cmmi7
2253 \font\sevensy=cmsy7
2254 \def\sevenecsize{0700}
2255
2256 % Fonts for title page (20.4pt):
2257 \def\titlenominalsize{20pt}
2258 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2259 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2260 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2261 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2262 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2263 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2264 \let\titlebf=\titlerm
2265 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2266 \font\titlei=cmmi12 scaled \magstep3
2267 \font\titlesy=cmsy10 scaled \magstep4
2268 \def\titleecsize{2074}
2269
2270 % Chapter (and unnumbered) fonts (17.28pt).
2271 \def\chapnominalsize{17pt}
2272 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2273 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2274 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2275 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2276 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2277 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2278 \let\chapbf=\chaprm
2279 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2280 \font\chapi=cmmi12 scaled \magstep2
2281 \font\chapsy=cmsy10 scaled \magstep3
2282 \def\chapecsize{1728}
2283
2284 % Section fonts (14.4pt).
2285 \def\secnominalsize{14pt}
2286 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2287 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2288 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2289 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2290 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2291 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2292 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2293 \let\secbf\secrm
2294 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2295 \font\seci=cmmi12 scaled \magstep1
2296 \font\secsy=cmsy10 scaled \magstep2
2297 \def\sececsize{1440}
2298
2299 % Subsection fonts (13.15pt).
2300 \def\ssecnominalsize{13pt}
2301 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2302 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2303 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2304 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2305 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2306 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2307 \let\ssecbf\ssecrm
2308 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2309 \font\sseci=cmmi12 scaled \magstephalf
2310 \font\ssecsy=cmsy10 scaled 1315
2311 \def\ssececsize{1200}
2312
2313 % Reduced fonts for @acronym in text (10pt).
2314 \def\reducednominalsize{10pt}
2315 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2316 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2317 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2318 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2319 \setfont\reducedsl\slshape{10}{1000}{OT1}
2320 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2321 \setfont\reducedsc\scshape{10}{1000}{OT1}
2322 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2323 \font\reducedi=cmmi10
2324 \font\reducedsy=cmsy10
2325 \def\reducedecsize{1000}
2326
2327 \textleading = 13.2pt % line spacing for 11pt CM
2328 \textfonts            % reset the current fonts
2329 \rm
2330 } % end of 11pt text font size definitions, \definetextfontsizexi
2331
2332
2333 % Definitions to make the main text be 10pt Computer Modern, with
2334 % section, chapter, etc., sizes following suit.  This is for the GNU
2335 % Press printing of the Emacs 22 manual.  Maybe other manuals in the
2336 % future.  Used with @smallbook, which sets the leading to 12pt.
2337 %
2338 \def\definetextfontsizex{%
2339 % Text fonts (10pt).
2340 \def\textnominalsize{10pt}
2341 \edef\mainmagstep{1000}
2342 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2343 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2344 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2345 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2346 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2347 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2348 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2349 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2350 \font\texti=cmmi10 scaled \mainmagstep
2351 \font\textsy=cmsy10 scaled \mainmagstep
2352 \def\textecsize{1000}
2353
2354 % A few fonts for @defun names and args.
2355 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2356 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2357 \setfont\defsl\slshape{10}{\magstephalf}{OT1}
2358 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2359 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2360 \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2361
2362 % Fonts for indices, footnotes, small examples (9pt).
2363 \def\smallnominalsize{9pt}
2364 \setfont\smallrm\rmshape{9}{1000}{OT1}
2365 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2366 \setfont\smallbf\bfshape{10}{900}{OT1}
2367 \setfont\smallit\itshape{9}{1000}{OT1IT}
2368 \setfont\smallsl\slshape{9}{1000}{OT1}
2369 \setfont\smallsf\sfshape{9}{1000}{OT1}
2370 \setfont\smallsc\scshape{10}{900}{OT1}
2371 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2372 \font\smalli=cmmi9
2373 \font\smallsy=cmsy9
2374 \def\smallecsize{0900}
2375
2376 % Fonts for small examples (8pt).
2377 \def\smallernominalsize{8pt}
2378 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2379 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2380 \setfont\smallerbf\bfshape{10}{800}{OT1}
2381 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2382 \setfont\smallersl\slshape{8}{1000}{OT1}
2383 \setfont\smallersf\sfshape{8}{1000}{OT1}
2384 \setfont\smallersc\scshape{10}{800}{OT1}
2385 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2386 \font\smalleri=cmmi8
2387 \font\smallersy=cmsy8
2388 \def\smallerecsize{0800}
2389
2390 % Fonts for math mode superscripts (7pt).
2391 \def\sevennominalsize{7pt}
2392 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2393 \setfont\seventt\ttshape{10}{700}{OT1TT}
2394 \setfont\sevenbf\bfshape{10}{700}{OT1}
2395 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2396 \setfont\sevensl\slshape{10}{700}{OT1}
2397 \setfont\sevensf\sfshape{10}{700}{OT1}
2398 \setfont\sevensc\scshape{10}{700}{OT1}
2399 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2400 \font\seveni=cmmi7
2401 \font\sevensy=cmsy7
2402 \def\sevenecsize{0700}
2403
2404 % Fonts for title page (20.4pt):
2405 \def\titlenominalsize{20pt}
2406 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2407 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2408 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2409 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2410 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2411 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2412 \let\titlebf=\titlerm
2413 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2414 \font\titlei=cmmi12 scaled \magstep3
2415 \font\titlesy=cmsy10 scaled \magstep4
2416 \def\titleecsize{2074}
2417
2418 % Chapter fonts (14.4pt).
2419 \def\chapnominalsize{14pt}
2420 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2421 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2422 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2423 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2424 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2425 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2426 \let\chapbf\chaprm
2427 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2428 \font\chapi=cmmi12 scaled \magstep1
2429 \font\chapsy=cmsy10 scaled \magstep2
2430 \def\chapecsize{1440}
2431
2432 % Section fonts (12pt).
2433 \def\secnominalsize{12pt}
2434 \setfont\secrm\rmbshape{12}{1000}{OT1}
2435 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2436 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2437 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2438 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2439 \setfont\secsf\sfbshape{12}{1000}{OT1}
2440 \let\secbf\secrm
2441 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2442 \font\seci=cmmi12
2443 \font\secsy=cmsy10 scaled \magstep1
2444 \def\sececsize{1200}
2445
2446 % Subsection fonts (10pt).
2447 \def\ssecnominalsize{10pt}
2448 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2449 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2450 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2451 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2452 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2453 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2454 \let\ssecbf\ssecrm
2455 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2456 \font\sseci=cmmi10
2457 \font\ssecsy=cmsy10
2458 \def\ssececsize{1000}
2459
2460 % Reduced fonts for @acronym in text (9pt).
2461 \def\reducednominalsize{9pt}
2462 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2463 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2464 \setfont\reducedbf\bfshape{10}{900}{OT1}
2465 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2466 \setfont\reducedsl\slshape{9}{1000}{OT1}
2467 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2468 \setfont\reducedsc\scshape{10}{900}{OT1}
2469 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2470 \font\reducedi=cmmi9
2471 \font\reducedsy=cmsy9
2472 \def\reducedecsize{0900}
2473
2474 \divide\parskip by 2  % reduce space between paragraphs
2475 \textleading = 12pt   % line spacing for 10pt CM
2476 \textfonts            % reset the current fonts
2477 \rm
2478 } % end of 10pt text font size definitions, \definetextfontsizex
2479
2480 % Fonts for short table of contents.
2481 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2482 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
2483 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2484 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2485
2486
2487 % We provide the user-level command
2488 %   @fonttextsize 10
2489 % (or 11) to redefine the text font size.  pt is assumed.
2490 %
2491 \def\xiword{11}
2492 \def\xword{10}
2493 \def\xwordpt{10pt}
2494 %
2495 \parseargdef\fonttextsize{%
2496   \def\textsizearg{#1}%
2497   %\wlog{doing @fonttextsize \textsizearg}%
2498   %
2499   % Set \globaldefs so that documents can use this inside @tex, since
2500   % makeinfo 4.8 does not support it, but we need it nonetheless.
2501   %
2502  \begingroup \globaldefs=1
2503   \ifx\textsizearg\xword \definetextfontsizex
2504   \else \ifx\textsizearg\xiword \definetextfontsizexi
2505   \else
2506     \errhelp=\EMsimple
2507     \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2508   \fi\fi
2509  \endgroup
2510 }
2511
2512 %
2513 % Change the current font style to #1, remembering it in \curfontstyle.
2514 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2515 % italics, not bold italics.
2516 %
2517 \def\setfontstyle#1{%
2518   \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2519   \csname #1font\endcsname  % change the current font
2520 }
2521
2522 \def\rm{\fam=0 \setfontstyle{rm}}
2523 \def\it{\fam=\itfam \setfontstyle{it}}
2524 \def\sl{\fam=\slfam \setfontstyle{sl}}
2525 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2526 \def\tt{\fam=\ttfam \setfontstyle{tt}}
2527
2528 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
2529 % So we set up a \sf.
2530 \newfam\sffam
2531 \def\sf{\fam=\sffam \setfontstyle{sf}}
2532
2533 % We don't need math for this font style.
2534 \def\ttsl{\setfontstyle{ttsl}}
2535
2536
2537 % In order for the font changes to affect most math symbols and letters,
2538 % we have to define the \textfont of the standard families.
2539 % We don't bother to reset \scriptscriptfont; awaiting user need.
2540 %
2541 \def\resetmathfonts{%
2542   \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2543   \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2544   \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2545   %
2546   % Fonts for superscript.  Note that the 7pt fonts are used regardless
2547   % of the current font size.
2548   \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
2549   \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
2550   \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
2551   \scriptfont\sffam=\sevensf
2552 }
2553
2554
2555
2556 % \defineassignfonts{SIZE} -
2557 %   Define sequence \assignfontsSIZE, which switches between font sizes
2558 % by redefining the meanings of \STYLEfont.  (Just \STYLE additionally sets
2559 % the current \fam for math mode.)
2560 %
2561 \def\defineassignfonts#1{%
2562   \expandafter\edef\csname assignfonts#1\endcsname{%
2563     \let\noexpand\rmfont\csname #1rm\endcsname
2564     \let\noexpand\itfont\csname #1it\endcsname
2565     \let\noexpand\slfont\csname #1sl\endcsname
2566     \let\noexpand\bffont\csname #1bf\endcsname
2567     \let\noexpand\ttfont\csname #1tt\endcsname
2568     \let\noexpand\smallcaps\csname #1sc\endcsname
2569     \let\noexpand\sffont  \csname #1sf\endcsname
2570     \let\noexpand\ifont   \csname #1i\endcsname
2571     \let\noexpand\syfont  \csname #1sy\endcsname
2572     \let\noexpand\ttslfont\csname #1ttsl\endcsname
2573   }
2574 }
2575
2576 \def\assignfonts#1{%
2577   \csname assignfonts#1\endcsname
2578 }
2579
2580 \newif\ifrmisbold
2581
2582 % Select smaller font size with the current style.  Used to change font size
2583 % in, e.g., the LaTeX logo and acronyms.  If we are using bold fonts for
2584 % normal roman text, also use bold fonts for roman text in the smaller size.
2585 \def\switchtolllsize{%
2586    \expandafter\assignfonts\expandafter{\lllsize}%
2587    \ifrmisbold
2588      \let\rmfont\bffont
2589    \fi
2590    \csname\curfontstyle\endcsname
2591 }%
2592
2593 \def\switchtolsize{%
2594    \expandafter\assignfonts\expandafter{\lsize}%
2595    \ifrmisbold
2596      \let\rmfont\bffont
2597    \fi
2598    \csname\curfontstyle\endcsname
2599 }%
2600
2601 % Define the font-changing commands (all called \...fonts).
2602 % Each font-changing command also sets the names \lsize (one size lower)
2603 % and \lllsize (three sizes lower).  These relative commands are used
2604 % in, e.g., the LaTeX logo and acronyms.
2605 %
2606 % Note: The fonts used for \ifont are for "math italics"  (\itfont is for
2607 % italics in regular text).  \syfont is also used in math mode only.
2608 %
2609 \def\definefontsetatsize#1#2#3#4#5{%
2610   \defineassignfonts{#1}%
2611 \expandafter\def\csname #1fonts\endcsname{%
2612   \def\curfontsize{#1}%
2613   \def\lsize{#2}\def\lllsize{#3}%
2614   \csname rmisbold#5\endcsname
2615   \csname assignfonts#1\endcsname
2616   \resetmathfonts
2617   \setleading{#4}%
2618 }}
2619
2620 \definefontsetatsize{text}   {reduced}{smaller}{\textleading}{false}
2621 \definefontsetatsize{title}  {chap}   {subsec} {27pt}  {true}
2622 \definefontsetatsize{chap}   {sec}    {text}   {19pt}  {true}
2623 \definefontsetatsize{sec}    {subsec} {reduced}{17pt}  {true}
2624 \definefontsetatsize{ssec}   {text}   {small}  {15pt}  {true}
2625 \definefontsetatsize{reduced}{small}  {smaller}{10.5pt}{false}
2626 \definefontsetatsize{small}  {smaller}{smaller}{10.5pt}{false}
2627 \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2628
2629 \def\titlefont#1{{\titlefonts\rm #1}}
2630 \let\subsecfonts = \ssecfonts
2631 \let\subsubsecfonts = \ssecfonts
2632
2633 % Define these just so they can be easily changed for other fonts.
2634 \def\angleleft{$\langle$}
2635 \def\angleright{$\rangle$}
2636
2637 % Set the fonts to use with the @small... environments.
2638 \let\smallexamplefonts = \smallfonts
2639
2640 % About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
2641 % can fit this many characters:
2642 %   8.5x11=86   smallbook=72  a4=90  a5=69
2643 % If we use \scriptfonts (8pt), then we can fit this many characters:
2644 %   8.5x11=90+  smallbook=80  a4=90+  a5=77
2645 % For me, subjectively, the few extra characters that fit aren't worth
2646 % the additional smallness of 8pt.  So I'm making the default 9pt.
2647 %
2648 % By the way, for comparison, here's what fits with @example (10pt):
2649 %   8.5x11=71  smallbook=60  a4=75  a5=58
2650 % --karl, 24jan03.
2651
2652 % Set up the default fonts, so we can use them for creating boxes.
2653 %
2654 \definetextfontsizexi
2655
2656
2657 % Check if we are currently using a typewriter font.  Since all the
2658 % Computer Modern typewriter fonts have zero interword stretch (and
2659 % shrink), and it is reasonable to expect all typewriter fonts to have
2660 % this property, we can check that font parameter. #1 is what to
2661 % print if we are indeed using \tt; #2 is what to print otherwise.
2662 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
2663
2664 % Same as above, but check for italic font.  Actually this also catches
2665 % non-italic slanted fonts since it is impossible to distinguish them from
2666 % italic fonts.  But since this is only used by $ and it uses \sl anyway
2667 % this is not a problem.
2668 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
2669
2670
2671 % Check if internal flag is clear, i.e. has not been @set.
2672 \def\ifflagclear#1#2#3{%
2673   \expandafter\ifx\csname SET#1\endcsname\relax
2674   #2\else#3\fi
2675 }
2676
2677 {
2678 \catcode`\'=\active
2679 \catcode`\`=\active
2680
2681 \gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
2682 \gdef\setregularquotes{\let`\lq \let'\rq}
2683 }
2684 \setregularquotes
2685
2686 % output for ' in @code
2687 % in tt font hex 0D (undirected) or 27 (curly right quote)
2688 %
2689 \def\codequoteright{%
2690   \ifusingtt
2691       {\ifflagclear{txicodequoteundirected}%
2692           {\ifflagclear{codequoteundirected}%
2693               {'}%
2694               {\char"0D }}%
2695           {\char"0D }}%
2696       {'}%
2697 }
2698
2699 % output for ` in @code
2700 % in tt font hex 12 (grave accent) or 60 (curly left quote)
2701 % \relax disables Spanish ligatures ?` and !` of \tt font.
2702 %
2703 \def\codequoteleft{%
2704   \ifusingtt
2705       {\ifflagclear{txicodequotebacktick}%
2706           {\ifflagclear{codequotebacktick}%
2707               {\relax`}%
2708               {\char"12 }}%
2709           {\char"12 }}%
2710       {\relax`}%
2711 }
2712
2713 % Commands to set the quote options.
2714
2715 \parseargdef\codequoteundirected{%
2716   \def\temp{#1}%
2717   \ifx\temp\onword
2718     \expandafter\let\csname SETtxicodequoteundirected\endcsname
2719       = t%
2720   \else\ifx\temp\offword
2721     \expandafter\let\csname SETtxicodequoteundirected\endcsname
2722       = \relax
2723   \else
2724     \errhelp = \EMsimple
2725     \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2726   \fi\fi
2727 }
2728
2729 \parseargdef\codequotebacktick{%
2730   \def\temp{#1}%
2731   \ifx\temp\onword
2732     \expandafter\let\csname SETtxicodequotebacktick\endcsname
2733       = t%
2734   \else\ifx\temp\offword
2735     \expandafter\let\csname SETtxicodequotebacktick\endcsname
2736       = \relax
2737   \else
2738     \errhelp = \EMsimple
2739     \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2740   \fi\fi
2741 }
2742
2743 % Turn them on by default
2744 \let\SETtxicodequoteundirected = t
2745 \let\SETtxicodequotebacktick = t
2746
2747
2748 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2749 \def\noligaturesquoteleft{\relax\lq}
2750
2751 % Count depth in font-changes, for error checks
2752 \newcount\fontdepth \fontdepth=0
2753
2754 % Font commands.
2755
2756 % #1 is the font command (\sl or \it), #2 is the text to slant.
2757 % If we are in a monospaced environment, however, 1) always use \ttsl,
2758 % and 2) do not add an italic correction.
2759 \def\dosmartslant#1#2{%
2760   \ifusingtt 
2761     {{\ttsl #2}\let\next=\relax}%
2762     {\def\next{{#1#2}\smartitaliccorrection}}%
2763   \next
2764 }
2765 \def\smartslanted{\dosmartslant\sl}
2766 \def\smartitalic{\dosmartslant\it}
2767
2768 % Output an italic correction unless the following character is such as
2769 % not to need one.
2770 \def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx}
2771 \def\smartitaliccorrectionx{%
2772   \ifx\next,%
2773   \else\ifx\next-%
2774   \else\ifx\next.%
2775   \else\ifx\next\.%
2776   \else\ifx\next\comma%
2777   \else\ptexslash
2778   \fi\fi\fi\fi\fi
2779   \aftersmartic
2780 }
2781
2782 % @cite unconditionally uses \sl with \smartitaliccorrection.
2783 \def\cite#1{{\sl #1}\smartitaliccorrection}
2784
2785 % @var unconditionally uses \sl.  This gives consistency for
2786 % parameter names whether they are in @def, @table @code or a
2787 % regular paragraph.
2788 %  To get ttsl font for @var when used in code context, @set txicodevaristt.
2789 % The \null is to reset \spacefactor.
2790 \def\aftersmartic{}
2791 \def\var#1{%
2792   \let\saveaftersmartic = \aftersmartic
2793   \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2794   %
2795   \ifflagclear{txicodevaristt}%
2796     {\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
2797     {\def\varnext{\smartslanted{#1}}}%
2798   \varnext
2799 }
2800
2801 % To be removed after next release
2802 \def\SETtxicodevaristt{}% @set txicodevaristt
2803
2804 \let\i=\smartitalic
2805 \let\slanted=\smartslanted
2806 \let\dfn=\smartslanted
2807 \let\emph=\smartitalic
2808
2809 % @r for roman font, used for code comment
2810 \def\r#1{{%
2811   \usenormaldash % get --, --- ligatures even if in @code
2812   \defcharsdefault  % in case on def line
2813   \rm #1}}
2814 {\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}}
2815
2816 % @sc, undocumented @ii.
2817 \def\sc#1{{\smallcaps#1}}       % smallcaps font
2818 \def\ii#1{{\it #1}}             % italic font
2819
2820 % @b, explicit bold.  Also @strong.
2821 \def\b#1{{\bf #1}}
2822 \let\strong=\b
2823
2824 % @sansserif, explicit sans.
2825 \def\sansserif#1{{\sf #1}}
2826
2827 \newif\iffrenchspacing
2828 \frenchspacingfalse
2829
2830 % Set sfcode to normal for the chars that usually have another value.
2831 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2832 % sometimes \x has an active definition that messes things up.
2833 %
2834 \catcode`@=11
2835   \def\plainfrenchspacing{%
2836     \iffrenchspacing\else
2837       \frenchspacingtrue
2838       \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2839       \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2840       \def\endofsentencespacefactor{1000}% for @. and friends
2841     \fi
2842   }
2843   \def\plainnonfrenchspacing{%
2844     \iffrenchspacing
2845       \frenchspacingfalse
2846        \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2847        \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2848        \def\endofsentencespacefactor{3000}% for @. and friends
2849     \fi
2850   }
2851 \catcode`@=\other
2852 \def\endofsentencespacefactor{3000}% default
2853
2854 % @frenchspacing on|off  says whether to put extra space after punctuation.
2855 %
2856 \def\onword{on}
2857 \def\offword{off}
2858 %
2859 \let\frenchspacingsetting\plainnonfrenchspacing % used in output routine
2860 \parseargdef\frenchspacing{%
2861   \def\temp{#1}%
2862   \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing
2863   \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing
2864   \else
2865     \errhelp = \EMsimple
2866     \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
2867   \fi\fi
2868   \frenchspacingsetting
2869 }
2870
2871
2872 % @t, explicit typewriter.
2873 \def\t#1{%
2874   {\tt \defcharsdefault \plainfrenchspacing #1}%
2875   \null
2876 }
2877
2878 % @samp.
2879 \def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
2880
2881 % @indicateurl is \samp, that is, with quotes.
2882 \let\indicateurl=\samp
2883
2884 % @code (and similar) prints in typewriter, but with spaces the same
2885 % size as normal in the surrounding text, without hyphenation, etc.
2886 % This is a subroutine for that.
2887 \def\tclose#1{%
2888   {%
2889     % Change normal interword space to be same as for the current font.
2890     \spaceskip = \fontdimen2\font
2891     %
2892     % Switch to typewriter.
2893     \tt
2894     %
2895     % `\ ' produces the large typewriter interword space.
2896     \def\ {{\spaceskip = 0pt{} }}%
2897     %
2898     \plainfrenchspacing
2899     #1%
2900   }%
2901   \null % reset spacefactor to 1000
2902 }
2903
2904 % This is for LuaTeX: It is not sufficient to disable hyphenation at
2905 % explicit dashes by setting `\hyphenchar` to -1.
2906 \def\dashnobreak{%
2907   \normaldash
2908   \penalty 10000 }
2909
2910 % We must turn on hyphenation at `-' and `_' in @code.
2911 % Otherwise, it is too hard to avoid overfull hboxes
2912 % in the Emacs manual, the Library manual, etc.
2913 % We explicitly allow hyphenation at these characters
2914 % using \discretionary.
2915 %
2916 % Hyphenation at - and hyphenation within words was turned off
2917 % by default for the tt fonts using the \hyphenchar parameter of TeX.
2918 {
2919   \catcode`\-=\active \catcode`\_=\active
2920   \catcode`\'=\active \catcode`\`=\active
2921   \global\let'=\rq \global\let`=\lq  % default definitions
2922   %
2923   \global\def\code{\begingroup
2924     \setcodequotes
2925     \catcode\dashChar=\active  \catcode\underChar=\active
2926     \ifallowcodebreaks
2927      \let-\codedash
2928      \let_\codeunder
2929     \else
2930      \let-\dashnobreak
2931      \let_\realunder
2932     \fi
2933     \codex
2934   }
2935   %
2936   \gdef\codedash{\futurelet\next\codedashfinish}
2937   \gdef\codedashfinish{%
2938     \normaldash % always output the dash character itself.
2939     % 
2940     % Now, output a discretionary to allow a line break, unless
2941     % (a) the next character is a -, or
2942     % (b) the preceding character is a -, or
2943     % (c) we are at the start of the string.
2944     % In both cases (b) and (c), \codedashnobreak should be set to \codedash.
2945     %
2946     % E.g., given --posix, we do not want to allow a break after either -.
2947     % Given --foo-bar, we do want to allow a break between the - and the b.
2948     \ifx\next\codedash \else
2949       \ifx\codedashnobreak\codedash
2950       \else \discretionary{}{}{}\fi
2951     \fi
2952     % we need the space after the = for the case when \next itself is a
2953     % space token; it would get swallowed otherwise.  As in @code{- a}.
2954     \global\let\codedashnobreak= \next
2955   }
2956 }
2957 \def\normaldash{-}
2958 %
2959 \def\codex #1{\tclose{%
2960   % Given -foo (with a single dash), we do not want to allow a break
2961   % after the -.  \codedashnobreak is set to the first character in
2962   % @code.
2963   \futurelet\codedashnobreak\relax
2964   #1%
2965 }\endgroup}
2966
2967 \def\codeunder{%
2968   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
2969   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2970   % will therefore expand the active definition of _, which is us
2971   % (inside @code that is), therefore an endless loop.
2972   \ifusingtt{\ifmmode
2973                \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2974              \else\normalunderscore \fi
2975              \discretionary{}{}{}}%
2976             {\_}%
2977 }
2978
2979 % An additional complication: the above will allow breaks after, e.g.,
2980 % each of the four underscores in __typeof__.  This is bad.
2981 % @allowcodebreaks provides a document-level way to turn breaking at -
2982 % and _ on and off.
2983 %
2984 \newif\ifallowcodebreaks  \allowcodebreakstrue
2985
2986 \def\keywordtrue{true}
2987 \def\keywordfalse{false}
2988
2989 \parseargdef\allowcodebreaks{%
2990   \def\txiarg{#1}%
2991   \ifx\txiarg\keywordtrue
2992     \allowcodebreakstrue
2993   \else\ifx\txiarg\keywordfalse
2994     \allowcodebreaksfalse
2995   \else
2996     \errhelp = \EMsimple
2997     \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2998   \fi\fi
2999 }
3000
3001 % For @command, @env, @file, @option quotes seem unnecessary,
3002 % so use \code rather than \samp.
3003 \let\command=\code
3004 \let\env=\code
3005 \let\file=\code
3006 \let\option=\code
3007
3008 % @uref (abbreviation for `urlref') aka @url takes an optional
3009 % (comma-separated) second argument specifying the text to display and
3010 % an optional third arg as text to display instead of (rather than in
3011 % addition to) the url itself.  First (mandatory) arg is the url.
3012
3013 % TeX-only option to allow changing PDF output to show only the second
3014 % arg (if given), and not the url (which is then just the link target).
3015 \newif\ifurefurlonlylink
3016
3017 % The default \pretolerance setting stops the penalty inserted in
3018 % \urefallowbreak being a discouragement to line breaking.  Set it to
3019 % a negative value for this paragraph only.  Hopefully this does not
3020 % conflict with redefinitions of \par done elsewhere.
3021 \def\nopretolerance{%
3022 \pretolerance=-1
3023 \def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
3024 }
3025
3026 % The main macro is \urefbreak, which allows breaking at expected
3027 % places within the url.
3028 \def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
3029 \let\uref=\urefbreak
3030 %
3031 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
3032 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
3033   \unsepspaces
3034   \pdfurl{#1}%
3035   \setbox0 = \hbox{\ignorespaces #3}%
3036   \ifdim\wd0 > 0pt
3037     \unhbox0 % third arg given, show only that
3038   \else
3039     \setbox0 = \hbox{\ignorespaces #2}% look for second arg
3040     \ifdim\wd0 > 0pt
3041       \ifpdf
3042         % For pdfTeX and LuaTeX
3043         \ifurefurlonlylink
3044           % PDF plus option to not display url, show just arg
3045           \unhbox0             
3046         \else
3047           % PDF, normally display both arg and url for consistency,
3048           % visibility, if the pdf is eventually used to print, etc.
3049           \unhbox0\ (\urefcode{#1})%
3050         \fi
3051       \else
3052         \ifx\XeTeXrevision\thisisundefined
3053           \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3054         \else
3055           % For XeTeX
3056           \ifurefurlonlylink
3057             % PDF plus option to not display url, show just arg
3058             \unhbox0             
3059           \else
3060             % PDF, normally display both arg and url for consistency,
3061             % visibility, if the pdf is eventually used to print, etc.
3062             \unhbox0\ (\urefcode{#1})%
3063           \fi
3064         \fi
3065       \fi
3066     \else
3067       \urefcode{#1}% only url given, so show it
3068     \fi
3069   \fi
3070   \endlink
3071 \endgroup}
3072
3073 % Allow line breaks around only a few characters (only).
3074 \def\urefcatcodes{%
3075   \catcode`\&=\active \catcode`\.=\active
3076   \catcode`\#=\active \catcode`\?=\active
3077   \catcode`\/=\active
3078 }
3079 {
3080   \urefcatcodes
3081   %
3082   \global\def\urefcode{\begingroup
3083     \setcodequotes
3084     \urefcatcodes
3085     \let&\urefcodeamp
3086     \let.\urefcodedot
3087     \let#\urefcodehash
3088     \let?\urefcodequest
3089     \let/\urefcodeslash
3090     \codex
3091   }
3092   %
3093   % By default, they are just regular characters.
3094   \global\def&{\normalamp}
3095   \global\def.{\normaldot}
3096   \global\def#{\normalhash}
3097   \global\def?{\normalquest}
3098   \global\def/{\normalslash}
3099 }
3100
3101 \def\urefcodeamp{\urefprebreak \&\urefpostbreak}
3102 \def\urefcodedot{\urefprebreak .\urefpostbreak}
3103 \def\urefcodehash{\urefprebreak \#\urefpostbreak}
3104 \def\urefcodequest{\urefprebreak ?\urefpostbreak}
3105 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3106 {
3107   \catcode`\/=\active
3108   \global\def\urefcodeslashfinish{%
3109     \urefprebreak \slashChar
3110     % Allow line break only after the final / in a sequence of
3111     % slashes, to avoid line break between the slashes in http://.
3112     \ifx\next/\else \urefpostbreak \fi
3113   }
3114 }
3115
3116 % By default we'll break after the special characters, but some people like to 
3117 % break before the special chars, so allow that.  Also allow no breaking at 
3118 % all, for manual control.
3119
3120 \parseargdef\urefbreakstyle{%
3121   \def\txiarg{#1}%
3122   \ifx\txiarg\wordnone
3123     \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3124   \else\ifx\txiarg\wordbefore
3125     \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
3126   \else\ifx\txiarg\wordafter
3127     \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
3128   \else
3129     \errhelp = \EMsimple
3130     \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3131   \fi\fi\fi
3132 }
3133 \def\wordafter{after}
3134 \def\wordbefore{before}
3135 \def\wordnone{none}
3136
3137 % Allow a ragged right output to aid breaking long URL's.  There can
3138 % be a break at the \allowbreak with no extra glue (if the existing stretch in 
3139 % the line is sufficient), a break at the \penalty with extra glue added
3140 % at the end of the line, or no break at all here.
3141 %   Changing the value of the penalty and/or the amount of stretch affects how 
3142 % preferable one choice is over the other.
3143 \def\urefallowbreak{%
3144   \penalty0\relax
3145   \hskip 0pt plus 2 em\relax
3146   \penalty1000\relax
3147   \hskip 0pt plus -2 em\relax
3148 }
3149
3150 \urefbreakstyle after
3151
3152 % @url synonym for @uref, since that's how everyone uses it.
3153 %
3154 \let\url=\uref
3155
3156 % rms does not like angle brackets --karl, 17may97.
3157 % So now @email is just like @uref, unless we are pdf.
3158 %
3159 %\def\email#1{\angleleft{\tt #1}\angleright}
3160 \ifpdforxetex
3161   \def\email#1{\doemail#1,,\finish}
3162   \def\doemail#1,#2,#3\finish{\begingroup
3163     \unsepspaces
3164     \pdfurl{mailto:#1}%
3165     \setbox0 = \hbox{\ignorespaces #2}%
3166     \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3167     \endlink
3168   \endgroup}
3169 \else
3170   \let\email=\uref
3171 \fi
3172
3173 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3174 %   `example' (@kbd uses ttsl only inside of @example and friends),
3175 %   or `code' (@kbd uses normal tty font always).
3176 \parseargdef\kbdinputstyle{%
3177   \def\txiarg{#1}%
3178   \ifx\txiarg\worddistinct
3179     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3180   \else\ifx\txiarg\wordexample
3181     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3182   \else\ifx\txiarg\wordcode
3183     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3184   \else
3185     \errhelp = \EMsimple
3186     \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3187   \fi\fi\fi
3188 }
3189 \def\worddistinct{distinct}
3190 \def\wordexample{example}
3191 \def\wordcode{code}
3192
3193 % Default is `distinct'.
3194 \kbdinputstyle distinct
3195
3196 \def\kbd#1{%
3197   \tclose{\kbdfont\setcodequotes#1}%
3198 }
3199
3200 % definition of @key that produces a lozenge.  Doesn't adjust to text size.
3201 %\setfont\keyrm\rmshape{8}{1000}{OT1}
3202 %\font\keysy=cmsy9
3203 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3204 %  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3205 %    \vbox{\hrule\kern-0.4pt
3206 %     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3207 %    \kern-0.4pt\hrule}%
3208 %  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3209
3210 % definition of @key with no lozenge.
3211 %
3212 \def\key#1{{\setregularquotes \tt #1}\null}
3213
3214 % @clicksequence{File @click{} Open ...}
3215 \def\clicksequence#1{\begingroup #1\endgroup}
3216
3217 % @clickstyle @arrow   (by default)
3218 \parseargdef\clickstyle{\def\click{#1}}
3219 \def\click{\arrow}
3220
3221 % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
3222 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3223 %
3224 \def\dmn#1{\thinspace #1}
3225
3226 % @acronym for "FBI", "NATO", and the like.
3227 % We print this one point size smaller, since it's intended for
3228 % all-uppercase.
3229 %
3230 \def\acronym#1{\doacronym #1,,\finish}
3231 \def\doacronym#1,#2,#3\finish{%
3232   {\switchtolsize #1}%
3233   \def\temp{#2}%
3234   \ifx\temp\empty \else
3235     \space ({\unsepspaces \ignorespaces \temp \unskip})%
3236   \fi
3237   \null % reset \spacefactor=1000
3238 }
3239
3240 % @abbr for "Comput. J." and the like.
3241 % No font change, but don't do end-of-sentence spacing.
3242 %
3243 \def\abbr#1{\doabbr #1,,\finish}
3244 \def\doabbr#1,#2,#3\finish{%
3245   {\plainfrenchspacing #1}%
3246   \def\temp{#2}%
3247   \ifx\temp\empty \else
3248     \space ({\unsepspaces \ignorespaces \temp \unskip})%
3249   \fi
3250   \null % reset \spacefactor=1000
3251 }
3252
3253 % @asis just yields its argument.  Used with @table, for example.
3254 %
3255 \def\asis#1{#1}
3256
3257 % @math outputs its argument in math mode.
3258 %
3259 % One complication: _ usually means subscripts, but it could also mean
3260 % an actual _ character, as in @math{@var{some_variable} + 1}.  So make
3261 % _ active, and distinguish by seeing if the current family is \slfam,
3262 % which is what @var uses.
3263 {
3264   \catcode`\_ = \active
3265   \gdef\mathunderscore{%
3266     \catcode`\_=\active
3267     \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3268   }
3269 }
3270 % Another complication: we want \\ (and @\) to output a math (or tt) \.
3271 % FYI, plain.tex uses \\ as a temporary control sequence (for no
3272 % particular reason), but this is not advertised and we don't care.
3273 %
3274 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3275 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3276 %
3277 \def\math{%
3278   \ifmmode\else % only go into math if not in math mode already
3279     \tex
3280     \mathunderscore
3281     \let\\ = \mathbackslash
3282     \mathactive
3283     % make the texinfo accent commands work in math mode
3284     \let\"=\ddot
3285     \let\'=\acute
3286     \let\==\bar
3287     \let\^=\hat
3288     \let\`=\grave
3289     \let\u=\breve
3290     \let\v=\check
3291     \let\~=\tilde
3292     \let\dotaccent=\dot
3293     % have to provide another name for sup operator
3294     \let\mathopsup=\sup
3295   $\expandafter\finishmath\fi
3296 }
3297 \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
3298
3299 % Some active characters (such as <) are spaced differently in math.
3300 % We have to reset their definitions in case the @math was an argument
3301 % to a command which sets the catcodes (such as @item or @section).
3302 %
3303 {
3304   \catcode`^ = \active
3305   \catcode`< = \active
3306   \catcode`> = \active
3307   \catcode`+ = \active
3308   \catcode`' = \active
3309   \gdef\mathactive{%
3310     \let^ = \ptexhat
3311     \let< = \ptexless
3312     \let> = \ptexgtr
3313     \let+ = \ptexplus
3314     \let' = \ptexquoteright
3315   }
3316 }
3317
3318 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3319 % If in text, use math to place as sub/superscript, but switch
3320 % into text mode, with smaller fonts.  This is a different font than the
3321 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3322 % fix it (significant additions to font machinery) until someone notices.
3323 %
3324 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3325 \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
3326 %
3327 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3328 \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
3329
3330 % provide this command from LaTeX as it is very common
3331 \def\frac#1#2{{{#1}\over{#2}}}
3332
3333 % @displaymath.
3334 % \globaldefs is needed to recognize the end lines in \tex and
3335 % \end tex.  Set \thisenv as @end displaymath is seen before @end tex.
3336 {\obeylines
3337 \globaldefs=1
3338 \envdef\displaymath{%
3339 \tex%
3340 \def\thisenv{\displaymath}%
3341 \begingroup\let\end\displaymathend%
3342 $$%
3343 }
3344
3345 \def\displaymathend{$$\endgroup\end}%
3346
3347 \def\Edisplaymath{%
3348 \def\thisenv{\tex}%
3349 \end tex
3350 }}
3351
3352
3353 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3354 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3355 % except specified as a normal braced arg, so no newlines to worry about.
3356
3357 \def\outfmtnametex{tex}
3358 %
3359 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3360 \long\def\doinlinefmt#1,#2,\finish{%
3361   \def\inlinefmtname{#1}%
3362   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3363 }
3364
3365 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3366 % FMTNAME is tex, else ELSE-TEXT.
3367 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3368 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3369   \def\inlinefmtname{#1}%
3370   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3371 }
3372 %
3373 % For raw, must switch into @tex before parsing the argument, to avoid
3374 % setting catcodes prematurely.  Doing it this way means that, for
3375 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3376 % ignored.  But this isn't important because if people want a literal
3377 % *right* brace they would have to use a command anyway, so they may as
3378 % well use a command to get a left brace too.  We could re-use the
3379 % delimiter character idea from \verb, but it seems like overkill.
3380
3381 \long\def\inlineraw{\tex \doinlineraw}
3382 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3383 \def\doinlinerawtwo#1,#2,\finish{%
3384   \def\inlinerawname{#1}%
3385   \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3386   \endgroup % close group opened by \tex.
3387 }
3388
3389 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3390 %
3391 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3392 \long\def\doinlineifset#1,#2,\finish{%
3393   \def\inlinevarname{#1}%
3394   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3395   \else\ignorespaces#2\fi
3396 }
3397
3398 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3399 %
3400 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3401 \long\def\doinlineifclear#1,#2,\finish{%
3402   \def\inlinevarname{#1}%
3403   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3404 }
3405
3406
3407 \message{glyphs,}
3408 % and logos.
3409
3410 % @@ prints an @, as does @atchar{}.
3411 \def\@{\char64 }
3412 \let\atchar=\@
3413
3414 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3415 \def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}}
3416 \def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}}
3417 \let\{=\lbracechar
3418 \let\}=\rbracechar
3419
3420 % @comma{} to avoid , parsing problems.
3421 \let\comma = ,
3422
3423 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3424 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3425 \let\, = \ptexc
3426 \let\dotaccent = \ptexdot
3427 \def\ringaccent#1{{\accent23 #1}}
3428 \let\tieaccent = \ptext
3429 \let\ubaraccent = \ptexb
3430 \let\udotaccent = \d
3431
3432 % Other special characters: @questiondown @exclamdown @ordf @ordm
3433 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3434 \def\questiondown{?`}
3435 \def\exclamdown{!`}
3436 \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
3437 \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
3438
3439 % Dotless i and dotless j, used for accents.
3440 \def\imacro{i}
3441 \def\jmacro{j}
3442 \def\dotless#1{%
3443   \def\temp{#1}%
3444   \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3445   \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3446   \else \errmessage{@dotless can be used only with i or j}%
3447   \fi\fi
3448 }
3449
3450 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3451 % period following counts as ending a sentence.  (Idea found in latex.)
3452 %
3453 \edef\TeX{\TeX \spacefactor=1000 }
3454
3455 % @LaTeX{} logo.  Not quite the same results as the definition in
3456 % latex.ltx, since we use a different font for the raised A; it's most
3457 % convenient for us to use an explicitly smaller font, rather than using
3458 % the \scriptstyle font (since we don't reset \scriptstyle and
3459 % \scriptscriptstyle).
3460 %
3461 \def\LaTeX{%
3462   L\kern-.36em
3463   {\setbox0=\hbox{T}%
3464    \vbox to \ht0{\hbox{%
3465      \ifx\textnominalsize\xwordpt
3466        % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
3467        % Revert to plain's \scriptsize, which is 7pt.
3468        \count255=\the\fam $\fam\count255 \scriptstyle A$%
3469      \else
3470        \ifx\curfontsize\smallword
3471          % For footnotes and indices
3472          \count255=\the\fam $\fam\count255 \scriptstyle A$%
3473        \else
3474          % For 11pt, we can use our lllsize.
3475          \switchtolllsize A%
3476        \fi
3477      \fi
3478      }%
3479      \vss
3480   }}%
3481   \kern-.15em
3482   \TeX
3483 }
3484 \def\smallword{small}
3485
3486 % Some math mode symbols.  Define \ensuremath to switch into math mode
3487 % unless we are already there.  Expansion tricks may not be needed here,
3488 % but safer, and can't hurt.
3489 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3490 \def\ensuredmath#1{$\relax#1$}
3491 %
3492 \def\bullet{\ensuremath\ptexbullet}
3493 \def\geq{\ensuremath\ge}
3494 \def\leq{\ensuremath\le}
3495 \def\minus{\ensuremath-}
3496
3497 % @dots{} outputs an ellipsis using the current font.
3498 % We do .5em per period so that it has the same spacing in the cm
3499 % typewriter fonts as three actual period characters; on the other hand,
3500 % in other typewriter fonts three periods are wider than 1.5em.  So do
3501 % whichever is larger.
3502 %
3503 \def\dots{%
3504   \leavevmode
3505   \setbox0=\hbox{...}% get width of three periods
3506   \ifdim\wd0 > 1.5em
3507     \dimen0 = \wd0
3508   \else
3509     \dimen0 = 1.5em
3510   \fi
3511   \hbox to \dimen0{%
3512     \hskip 0pt plus.25fil
3513     .\hskip 0pt plus1fil
3514     .\hskip 0pt plus1fil
3515     .\hskip 0pt plus.5fil
3516   }%
3517 }
3518
3519 % @enddots{} is an end-of-sentence ellipsis.
3520 %
3521 \def\enddots{%
3522   \dots
3523   \spacefactor=\endofsentencespacefactor
3524 }
3525
3526 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3527 %
3528 % Since these characters are used in examples, they should be an even number of
3529 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3530 %
3531 \def\point{$\star$}
3532 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3533 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3534 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3535 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3536 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3537
3538 % The @error{} command.
3539 % Adapted from the TeXbook's \boxit.
3540 %
3541 \newbox\errorbox
3542 %
3543 {\ttfont \global\dimen0 = 3em}% Width of the box.
3544 \dimen2 = .55pt % Thickness of rules
3545 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3546 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3547 %
3548 \setbox\errorbox=\hbox to \dimen0{\hfil
3549    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3550    \advance\hsize by -2\dimen2 % Rules.
3551    \vbox{%
3552       \hrule height\dimen2
3553       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
3554          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3555          \kern3pt\vrule width\dimen2}% Space to right.
3556       \hrule height\dimen2}
3557     \hfil}
3558 %
3559 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3560
3561 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3562 %
3563 \def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}}
3564
3565 % @euro{} comes from a separate font, depending on the current style.
3566 % We use the free feym* fonts from the eurosym package by Henrik
3567 % Theiling, which support regular, slanted, bold and bold slanted (and
3568 % "outlined" (blackboard board, sort of) versions, which we don't need).
3569 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3570 %
3571 % Although only regular is the truly official Euro symbol, we ignore
3572 % that.  The Euro is designed to be slightly taller than the regular
3573 % font height.
3574 %
3575 % feymr - regular
3576 % feymo - slanted
3577 % feybr - bold
3578 % feybo - bold slanted
3579 %
3580 % There is no good (free) typewriter version, to my knowledge.
3581 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3582 % Hmm.
3583 %
3584 % Also doesn't work in math.  Do we need to do math with euro symbols?
3585 % Hope not.
3586 %
3587 %
3588 \def\euro{{\eurofont e}}
3589 \def\eurofont{%
3590   % We set the font at each command, rather than predefining it in
3591   % \textfonts and the other font-switching commands, so that
3592   % installations which never need the symbol don't have to have the
3593   % font installed.
3594   %
3595   % There is only one designed size (nominal 10pt), so we always scale
3596   % that to the current nominal size.
3597   %
3598   % By the way, simply using "at 1em" works for cmr10 and the like, but
3599   % does not work for cmbx10 and other extended/shrunken fonts.
3600   %
3601   \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3602   %
3603   \ifx\curfontstyle\bfstylename
3604     % bold:
3605     \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3606   \else
3607     % regular:
3608     \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3609   \fi
3610   \thiseurofont
3611 }
3612
3613 % Glyphs from the EC fonts.  We don't use \let for the aliases, because
3614 % sometimes we redefine the original macro, and the alias should reflect
3615 % the redefinition.
3616 %
3617 % Use LaTeX names for the Icelandic letters.
3618 \def\DH{{\ecfont \char"D0}} % Eth
3619 \def\dh{{\ecfont \char"F0}} % eth
3620 \def\TH{{\ecfont \char"DE}} % Thorn
3621 \def\th{{\ecfont \char"FE}} % thorn
3622 %
3623 \def\guillemetleft{{\ecfont \char"13}}
3624 \def\guillemotleft{\guillemetleft}
3625 \def\guillemetright{{\ecfont \char"14}}
3626 \def\guillemotright{\guillemetright}
3627 \def\guilsinglleft{{\ecfont \char"0E}}
3628 \def\guilsinglright{{\ecfont \char"0F}}
3629 \def\quotedblbase{{\ecfont \char"12}}
3630 \def\quotesinglbase{{\ecfont \char"0D}}
3631 %
3632 \def\L{{\ecfont \char"8A}} % L with stroke
3633 \def\l{{\ecfont \char"AA}} % l with stroke
3634 %
3635 % This positioning is not perfect (see the ogonek LaTeX package), but
3636 % we have the precomposed glyphs for the most common cases.  We put the
3637 % tests to use those glyphs in the single \ogonek macro so we have fewer
3638 % dummy definitions to worry about for index entries, etc.
3639 %
3640 % ogonek is also used with other letters in Lithuanian (IOU), but using
3641 % the precomposed glyphs for those is not so easy since they aren't in
3642 % the same EC font.
3643 \def\ogonek#1{{%
3644   \def\temp{#1}%
3645   \ifx\temp\macrocharA\Aogonek
3646   \else\ifx\temp\macrochara\aogonek
3647   \else\ifx\temp\macrocharE\Eogonek
3648   \else\ifx\temp\macrochare\eogonek
3649   \else
3650     \ecfont \setbox0=\hbox{#1}%
3651     \ifdim\ht0=1ex\accent"0C #1%
3652     \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3653     \fi
3654   \fi\fi\fi\fi
3655   }%
3656 }
3657 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3658 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3659 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3660 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3661 %
3662 % Use the European Computer Modern fonts (cm-super in outline format)
3663 % for non-CM glyphs.  That is ec* for regular text and tc* for the text
3664 % companion symbols (LaTeX TS1 encoding).  Both are part of the ec
3665 % package and follow the same conventions.
3666
3667 \def\ecfont{\etcfont{e}}
3668 \def\tcfont{\etcfont{t}}
3669 %
3670 \def\etcfont#1{%
3671   % We can't distinguish serif/sans and italic/slanted, but this
3672   % is used for crude hacks anyway (like adding French and German
3673   % quotes to documents typeset with CM, where we lose kerning), so
3674   % hopefully nobody will notice/care.
3675   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3676   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3677   \ifusingtt
3678       % typewriter:
3679      {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}%
3680   % else
3681      {\ifx\curfontstyle\bfstylename
3682         % bold:
3683         \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3684       \else
3685         % regular:
3686         \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3687       \fi}%
3688   \thisecfont
3689 }
3690
3691 % @registeredsymbol - R in a circle.  The font for the R should really
3692 % be smaller yet, but lllsize is the best we can do for now.
3693 % Adapted from the plain.tex definition of \copyright.
3694 %
3695 \def\registeredsymbol{%
3696   $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
3697                \hfil\crcr\Orb}}%
3698     }$%
3699 }
3700
3701 % @textdegree - the normal degrees sign.
3702 %
3703 \def\textdegree{%
3704    \ifmmode ^\circ
3705    \else {\tcfont \char 176}%
3706    \fi}
3707
3708 % Laurent Siebenmann reports \Orb undefined with:
3709 %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
3710 % so we'll define it if necessary.
3711 %
3712 \ifx\Orb\thisisundefined
3713 \def\Orb{\mathhexbox20D}
3714 \fi
3715
3716 % Quotes.
3717 \chardef\quoteleft=`\`
3718 \chardef\quoteright=`\'
3719
3720 % only change font for tt for correct kerning and to avoid using
3721 % \ecfont unless necessary.
3722 \def\quotedblleft{%
3723   \ifusingtt{{\ecfont\char"10}}{{\char"5C}}%
3724 }
3725
3726 \def\quotedblright{%
3727   \ifusingtt{{\ecfont\char"11}}{{\char`\"}}%
3728 }
3729
3730
3731 \message{page headings,}
3732
3733 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3734 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3735
3736 % First the title page.  Must do @settitle before @titlepage.
3737 \newif\ifseenauthor
3738 \newif\iffinishedtitlepage
3739
3740 % @setcontentsaftertitlepage used to do an implicit @contents or
3741 % @shortcontents after @end titlepage, but it is now obsolete.
3742 \def\setcontentsaftertitlepage{%
3743   \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3744               command; move your @contents command if you want the contents
3745               after the title page.}}%
3746 \def\setshortcontentsaftertitlepage{%
3747   \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3748               command; move your @shortcontents and @contents commands if you 
3749               want the contents after the title page.}}%
3750
3751 \parseargdef\shorttitlepage{%
3752   {\headingsoff \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3753   \endgroup\page\hbox{}\page}\pageone}
3754
3755 \envdef\titlepage{%
3756   % Open one extra group, as we want to close it in the middle of \Etitlepage.
3757   \begingroup
3758     \parindent=0pt \textfonts
3759     \headingsoff
3760     % Leave some space at the very top of the page.
3761     \vglue\titlepagetopglue
3762     % No rule at page bottom unless we print one at the top with @title.
3763     \finishedtitlepagetrue
3764     %
3765     % Most title ``pages'' are actually two pages long, with space
3766     % at the top of the second.  We don't want the ragged left on the second.
3767     \let\oldpage = \page
3768     \def\page{%
3769       \iffinishedtitlepage\else
3770          \finishtitlepage
3771       \fi
3772       \let\page = \oldpage
3773       \page
3774       \null
3775     }%
3776 }
3777
3778 \def\Etitlepage{%
3779     \iffinishedtitlepage\else
3780         \finishtitlepage
3781     \fi
3782     % It is important to do the page break before ending the group,
3783     % because the headline and footline are only empty inside the group.
3784     % If we use the new definition of \page, we always get a blank page
3785     % after the title page, which we certainly don't want.
3786     \oldpage
3787     \pageone
3788   \endgroup
3789   %
3790 }
3791
3792 \def\finishtitlepage{%
3793   \vskip4pt \hrule height 2pt width \hsize
3794   \vskip\titlepagebottomglue
3795   \finishedtitlepagetrue
3796 }
3797
3798 % Settings used for typesetting titles: no hyphenation, no indentation,
3799 % don't worry much about spacing, ragged right.  This should be used
3800 % inside a \vbox, and fonts need to be set appropriately first. \par should
3801 % be specified before the end of the \vbox, since a vbox is a group.
3802
3803 \def\raggedtitlesettings{%
3804   \rm
3805   \hyphenpenalty=10000
3806   \parindent=0pt
3807   \tolerance=5000
3808   \ptexraggedright
3809 }
3810
3811 % Macros to be used within @titlepage:
3812
3813 \let\subtitlerm=\rmfont
3814 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3815
3816 \parseargdef\title{%
3817   \checkenv\titlepage
3818   \vbox{\titlefonts \raggedtitlesettings #1\par}%
3819   % print a rule at the page bottom also.
3820   \finishedtitlepagefalse
3821   \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3822 }
3823
3824 \parseargdef\subtitle{%
3825   \checkenv\titlepage
3826   {\subtitlefont \rightline{#1}}%
3827 }
3828
3829 % @author should come last, but may come many times.
3830 % It can also be used inside @quotation.
3831 %
3832 \parseargdef\author{%
3833   \def\temp{\quotation}%
3834   \ifx\thisenv\temp
3835     \def\quotationauthor{#1}% printed in \Equotation.
3836   \else
3837     \checkenv\titlepage
3838     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3839     {\secfonts\rm \leftline{#1}}%
3840   \fi
3841 }
3842
3843
3844 % Set up page headings and footings.
3845
3846 \let\thispage=\folio
3847
3848 \newtoks\evenheadline    % headline on even pages
3849 \newtoks\oddheadline     % headline on odd pages
3850 \newtoks\evenchapheadline% headline on even pages with a new chapter
3851 \newtoks\oddchapheadline % headline on odd pages with a new chapter
3852 \newtoks\evenfootline    % footline on even pages
3853 \newtoks\oddfootline     % footline on odd pages
3854
3855 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3856 \headline={{\textfonts\rm\frenchspacingsetting
3857             \ifchapterpage
3858               \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
3859             \else
3860               \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
3861             \fi}}
3862
3863 \footline={{\textfonts\rm\frenchspacingsetting
3864             \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}%
3865            \HEADINGShook}
3866 \let\HEADINGShook=\relax
3867
3868 % Commands to set those variables.
3869 % For example, this is what  @headings on  does
3870 % @evenheading @thistitle|@thispage|@thischapter
3871 % @oddheading @thischapter|@thispage|@thistitle
3872 % @evenfooting @thisfile||
3873 % @oddfooting ||@thisfile
3874
3875
3876 \def\evenheading{\parsearg\evenheadingxxx}
3877 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3878 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3879   \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
3880   \global\evenchapheadline=\evenheadline}
3881
3882 \def\oddheading{\parsearg\oddheadingxxx}
3883 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3884 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3885   \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3886   \global\oddchapheadline=\oddheadline}
3887
3888 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3889
3890 \def\evenfooting{\parsearg\evenfootingxxx}
3891 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3892 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3893 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3894
3895 \def\oddfooting{\parsearg\oddfootingxxx}
3896 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3897 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3898   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3899   %
3900   % Leave some space for the footline.  Hopefully ok to assume
3901   % @evenfooting will not be used by itself.
3902   \global\advance\txipageheight by -12pt
3903   \global\advance\vsize by -12pt
3904 }
3905
3906 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3907
3908 % @evenheadingmarks top     \thischapter <- chapter at the top of a page
3909 % @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
3910 %
3911 % The same set of arguments for:
3912 %
3913 % @oddheadingmarks
3914 % @evenfootingmarks
3915 % @oddfootingmarks
3916 % @everyheadingmarks
3917 % @everyfootingmarks
3918
3919 % These define \getoddheadingmarks, \getevenheadingmarks,
3920 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3921 % \gettopheadingmarks, \getbottomheadingmarks.
3922 %
3923 \def\evenheadingmarks{\headingmarks{even}{heading}}
3924 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3925 \def\evenfootingmarks{\headingmarks{even}{footing}}
3926 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3927 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3928                           \headingmarks{odd}{heading}{#1} }
3929 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3930                           \headingmarks{odd}{footing}{#1} }
3931 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3932 \def\headingmarks#1#2#3 {%
3933   \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3934   \global\expandafter\let\csname get#1#2marks\endcsname \temp
3935 }
3936
3937 \everyheadingmarks bottom
3938 \everyfootingmarks bottom
3939
3940 % @headings double      turns headings on for double-sided printing.
3941 % @headings single      turns headings on for single-sided printing.
3942 % @headings off         turns them off.
3943 % @headings on          same as @headings double, retained for compatibility.
3944 % @headings after       turns on double-sided headings after this page.
3945 % @headings doubleafter turns on double-sided headings after this page.
3946 % @headings singleafter turns on single-sided headings after this page.
3947 % By default, they are off at the start of a document,
3948 % and turned `on' after @end titlepage.
3949
3950 \parseargdef\headings{\csname HEADINGS#1\endcsname}
3951
3952 \def\headingsoff{% non-global headings elimination
3953   \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}%
3954    \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}%
3955 }
3956
3957 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3958
3959 % Set the page number to 1.
3960 \def\pageone{
3961   \global\pageno=1
3962   \global\arabiccount = \pagecount
3963 }
3964
3965 \let\contentsalignmacro = \chappager
3966
3967 % \def\HEADINGSon{\HEADINGSdouble} % defined by \CHAPPAGon
3968
3969 % For double-sided printing, put current file name in lower left corner,
3970 % chapter name on inside top of right hand pages, document
3971 % title on inside top of left hand pages, and page numbers on outside top
3972 % edge of all pages.
3973 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdouble}
3974 \let\HEADINGSdoubleafter=\HEADINGSafter
3975 \def\HEADINGSdouble{%
3976 \global\evenfootline={\hfil}
3977 \global\oddfootline={\hfil}
3978 \global\evenheadline={\line{\folio\hfil\thistitle}}
3979 \global\oddheadline={\line{\thischapter\hfil\folio}}
3980 \global\evenchapheadline={\line{\folio\hfil\thistitle}}
3981 \global\oddchapheadline={\line{\hfil\folio}}
3982 \global\let\contentsalignmacro = \chapoddpage
3983 }
3984
3985 % For single-sided printing, chapter title goes across top left of page,
3986 % page number on top right.
3987 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsingle}
3988 \def\HEADINGSsingle{%
3989 \global\evenfootline={\hfil}
3990 \global\oddfootline={\hfil}
3991 \global\evenheadline={\line{\thischapter\hfil\folio}}
3992 \global\oddheadline={\line{\thischapter\hfil\folio}}
3993 \global\evenchapheadline={\line{\hfil\folio}}
3994 \global\oddchapheadline={\line{\hfil\folio}}
3995 \global\let\contentsalignmacro = \chappager
3996 }
3997
3998 % for @setchapternewpage off
3999 \def\HEADINGSsinglechapoff{%
4000 \global\evenfootline={\hfil}
4001 \global\oddfootline={\hfil}
4002 \global\evenheadline={\line{\thischapter\hfil\folio}}
4003 \global\oddheadline={\line{\thischapter\hfil\folio}}
4004 \global\evenchapheadline=\evenheadline
4005 \global\oddchapheadline=\oddheadline
4006 \global\let\contentsalignmacro = \chappager
4007 }
4008
4009 % Subroutines used in generating headings
4010 % This produces Day Month Year style of output.
4011 % Only define if not already defined, in case a txi-??.tex file has set
4012 % up a different format (e.g., txi-cs.tex does this).
4013 \ifx\today\thisisundefined
4014 \def\today{%
4015   \number\day\space
4016   \ifcase\month
4017   \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
4018   \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
4019   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
4020   \fi
4021   \space\number\year}
4022 \fi
4023
4024 % @settitle line...  specifies the title of the document, for headings.
4025 % It generates no output of its own.
4026 \def\thistitle{\putwordNoTitle}
4027 \def\settitle{\parsearg{\gdef\thistitle}}
4028
4029
4030 \message{tables,}
4031 % Tables -- @table, @ftable, @vtable, @item(x).
4032
4033 % default indentation of table text
4034 \newdimen\tableindent \tableindent=.8in
4035 % default indentation of @itemize and @enumerate text
4036 \newdimen\itemindent  \itemindent=.3in
4037 % margin between end of table item and start of table text.
4038 \newdimen\itemmargin  \itemmargin=.1in
4039
4040 % used internally for \itemindent minus \itemmargin
4041 \newdimen\itemmax
4042
4043 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
4044 % these defs.
4045 % They also define \itemindex
4046 % to index the item name in whatever manner is desired (perhaps none).
4047
4048 \newif\ifitemxneedsnegativevskip
4049
4050 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4051
4052 \def\internalBitem{\smallbreak \parsearg\itemzzz}
4053 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
4054
4055 \def\itemzzz #1{\begingroup %
4056   \advance\hsize by -\rightskip
4057   \advance\hsize by -\tableindent
4058   \setbox0=\hbox{\itemindicate{#1}}%
4059   \itemindex{#1}%
4060   \nobreak % This prevents a break before @itemx.
4061   %
4062   % If the item text does not fit in the space we have, put it on a line
4063   % by itself, and do not allow a page break either before or after that
4064   % line.  We do not start a paragraph here because then if the next
4065   % command is, e.g., @kindex, the whatsit would get put into the
4066   % horizontal list on a line by itself, resulting in extra blank space.
4067   \ifdim \wd0>\itemmax
4068     %
4069     % Make this a paragraph so we get the \parskip glue and wrapping,
4070     % but leave it ragged-right.
4071     \begingroup
4072       \advance\leftskip by-\tableindent
4073       \advance\hsize by\tableindent
4074       \advance\rightskip by0pt plus1fil\relax
4075       \leavevmode\unhbox0\par
4076     \endgroup
4077     %
4078     % We're going to be starting a paragraph, but we don't want the
4079     % \parskip glue -- logically it's part of the @item we just started.
4080     \nobreak \vskip-\parskip
4081     %
4082     % Stop a page break at the \parskip glue coming up.  However, if
4083     % what follows is an environment such as @example, there will be no
4084     % \parskip glue; then the negative vskip we just inserted would
4085     % cause the example and the item to crash together.  So we use this
4086     % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4087     % \parskip glue after all.  Section titles are handled this way also.
4088     %
4089     \penalty 10001
4090     \endgroup
4091     \itemxneedsnegativevskipfalse
4092   \else
4093     % The item text fits into the space.  Start a paragraph, so that the
4094     % following text (if any) will end up on the same line.
4095     \noindent
4096     % Do this with kerns and \unhbox so that if there is a footnote in
4097     % the item text, it can migrate to the main vertical list and
4098     % eventually be printed.
4099     \nobreak\kern-\tableindent
4100     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4101     \unhbox0
4102     \nobreak\kern\dimen0
4103     \endgroup
4104     \itemxneedsnegativevskiptrue
4105   \fi
4106 }
4107
4108 \def\item{\errmessage{@item while not in a list environment}}
4109 \def\itemx{\errmessage{@itemx while not in a list environment}}
4110
4111 % @table, @ftable, @vtable.
4112 \envdef\table{%
4113   \let\itemindex\gobble
4114   \tablecheck{table}%
4115 }
4116 \envdef\ftable{%
4117   \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4118   \tablecheck{ftable}%
4119 }
4120 \envdef\vtable{%
4121   \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4122   \tablecheck{vtable}%
4123 }
4124 \def\tablecheck#1{%
4125   \ifnum \the\catcode`\^^M=\active
4126     \endgroup
4127     \errmessage{This command won't work in this context; perhaps the problem is
4128       that we are \inenvironment\thisenv}%
4129     \def\next{\doignore{#1}}%
4130   \else
4131     \let\next\tablex
4132   \fi
4133   \next
4134 }
4135 \def\tablex#1{%
4136   \def\itemindicate{#1}%
4137   \parsearg\tabley
4138 }
4139 \def\tabley#1{%
4140   {%
4141     \makevalueexpandable
4142     \edef\temp{\noexpand\tablez #1\space\space\space}%
4143     \expandafter
4144   }\temp \endtablez
4145 }
4146 \def\tablez #1 #2 #3 #4\endtablez{%
4147   \aboveenvbreak
4148   \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4149   \ifnum 0#2>0 \tableindent=#2\mil \fi
4150   \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4151   \itemmax=\tableindent
4152   \advance \itemmax by -\itemmargin
4153   \advance \leftskip by \tableindent
4154   \exdentamount=\tableindent
4155   \parindent = 0pt
4156   \parskip = \smallskipamount
4157   \ifdim \parskip=0pt \parskip=2pt \fi
4158   \let\item = \internalBitem
4159   \let\itemx = \internalBitemx
4160 }
4161 \def\Etable{\endgraf\afterenvbreak}
4162 \let\Eftable\Etable
4163 \let\Evtable\Etable
4164 \let\Eitemize\Etable
4165 \let\Eenumerate\Etable
4166
4167 % This is the counter used by @enumerate, which is really @itemize
4168
4169 \newcount \itemno
4170
4171 \envdef\itemize{\parsearg\doitemize}
4172
4173 \def\doitemize#1{%
4174   \aboveenvbreak
4175   \itemmax=\itemindent
4176   \advance\itemmax by -\itemmargin
4177   \advance\leftskip by \itemindent
4178   \exdentamount=\itemindent
4179   \parindent=0pt
4180   \parskip=\smallskipamount
4181   \ifdim\parskip=0pt \parskip=2pt \fi
4182   %
4183   % Try typesetting the item mark so that if the document erroneously says
4184   % something like @itemize @samp (intending @table), there's an error
4185   % right away at the @itemize.  It's not the best error message in the
4186   % world, but it's better than leaving it to the @item.  This means if
4187   % the user wants an empty mark, they have to say @w{} not just @w.
4188   \def\itemcontents{#1}%
4189   \setbox0 = \hbox{\itemcontents}%
4190   %
4191   % @itemize with no arg is equivalent to @itemize @bullet.
4192   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4193   %
4194   \let\item=\itemizeitem
4195 }
4196
4197 % Definition of @item while inside @itemize and @enumerate.
4198 %
4199 \def\itemizeitem{%
4200   \advance\itemno by 1  % for enumerations
4201   {\let\par=\endgraf \smallbreak}% reasonable place to break
4202   {%
4203    % If the document has an @itemize directly after a section title, a
4204    % \nobreak will be last on the list, and \sectionheading will have
4205    % done a \vskip-\parskip.  In that case, we don't want to zero
4206    % parskip, or the item text will crash with the heading.  On the
4207    % other hand, when there is normal text preceding the item (as there
4208    % usually is), we do want to zero parskip, or there would be too much
4209    % space.  In that case, we won't have a \nobreak before.  At least
4210    % that's the theory.
4211    \ifnum\lastpenalty<10000 \parskip=0in \fi
4212    \noindent
4213    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4214    %
4215    \ifinner\else
4216      \vadjust{\penalty 1200}% not good to break after first line of item.
4217    \fi
4218    % We can be in inner vertical mode in a footnote, although an
4219    % @itemize looks awful there.
4220   }%
4221   \flushcr
4222 }
4223
4224 % \splitoff TOKENS\endmark defines \first to be the first token in
4225 % TOKENS, and \rest to be the remainder.
4226 %
4227 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4228
4229 % Allow an optional argument of an uppercase letter, lowercase letter,
4230 % or number, to specify the first label in the enumerated list.  No
4231 % argument is the same as `1'.
4232 %
4233 \envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
4234 \def\enumeratey #1 #2\endenumeratey{%
4235   % If we were given no argument, pretend we were given `1'.
4236   \def\thearg{#1}%
4237   \ifx\thearg\empty \def\thearg{1}\fi
4238   %
4239   % Detect if the argument is a single token.  If so, it might be a
4240   % letter.  Otherwise, the only valid thing it can be is a number.
4241   % (We will always have one token, because of the test we just made.
4242   % This is a good thing, since \splitoff doesn't work given nothing at
4243   % all -- the first parameter is undelimited.)
4244   \expandafter\splitoff\thearg\endmark
4245   \ifx\rest\empty
4246     % Only one token in the argument.  It could still be anything.
4247     % A ``lowercase letter'' is one whose \lccode is nonzero.
4248     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4249     %   not equal to itself.
4250     % Otherwise, we assume it's a number.
4251     %
4252     % We need the \relax at the end of the \ifnum lines to stop TeX from
4253     % continuing to look for a <number>.
4254     %
4255     \ifnum\lccode\expandafter`\thearg=0\relax
4256       \numericenumerate % a number (we hope)
4257     \else
4258       % It's a letter.
4259       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4260         \lowercaseenumerate % lowercase letter
4261       \else
4262         \uppercaseenumerate % uppercase letter
4263       \fi
4264     \fi
4265   \else
4266     % Multiple tokens in the argument.  We hope it's a number.
4267     \numericenumerate
4268   \fi
4269 }
4270
4271 % An @enumerate whose labels are integers.  The starting integer is
4272 % given in \thearg.
4273 %
4274 \def\numericenumerate{%
4275   \itemno = \thearg
4276   \startenumeration{\the\itemno}%
4277 }
4278
4279 % The starting (lowercase) letter is in \thearg.
4280 \def\lowercaseenumerate{%
4281   \itemno = \expandafter`\thearg
4282   \startenumeration{%
4283     % Be sure we're not beyond the end of the alphabet.
4284     \ifnum\itemno=0
4285       \errmessage{No more lowercase letters in @enumerate; get a bigger
4286                   alphabet}%
4287     \fi
4288     \char\lccode\itemno
4289   }%
4290 }
4291
4292 % The starting (uppercase) letter is in \thearg.
4293 \def\uppercaseenumerate{%
4294   \itemno = \expandafter`\thearg
4295   \startenumeration{%
4296     % Be sure we're not beyond the end of the alphabet.
4297     \ifnum\itemno=0
4298       \errmessage{No more uppercase letters in @enumerate; get a bigger
4299                   alphabet}
4300     \fi
4301     \char\uccode\itemno
4302   }%
4303 }
4304
4305 % Call \doitemize, adding a period to the first argument and supplying the
4306 % common last two arguments.  Also subtract one from the initial value in
4307 % \itemno, since @item increments \itemno.
4308 %
4309 \def\startenumeration#1{%
4310   \advance\itemno by -1
4311   \doitemize{#1.}\flushcr
4312 }
4313
4314
4315 % @multitable macros
4316
4317 % Macros used to set up halign preamble:
4318 %
4319 \let\endsetuptable\relax
4320 \def\xendsetuptable{\endsetuptable}
4321 \let\columnfractions\relax
4322 \def\xcolumnfractions{\columnfractions}
4323 \newif\ifsetpercent
4324
4325 % #1 is the @columnfraction, usually a decimal number like .5, but might
4326 % be just 1.  We just use it, whatever it is.
4327 %
4328 \def\pickupwholefraction#1 {%
4329   \global\advance\colcount by 1
4330   \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4331   \setuptable
4332 }
4333
4334 \newcount\colcount
4335 \def\setuptable#1{%
4336   \def\firstarg{#1}%
4337   \ifx\firstarg\xendsetuptable
4338     \let\go = \relax
4339   \else
4340     \ifx\firstarg\xcolumnfractions
4341       \global\setpercenttrue
4342     \else
4343       \ifsetpercent
4344          \let\go\pickupwholefraction
4345       \else
4346          \global\advance\colcount by 1
4347          \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4348                    % separator; typically that is always in the input, anyway.
4349          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4350       \fi
4351     \fi
4352     \ifx\go\pickupwholefraction
4353       % Put the argument back for the \pickupwholefraction call, so
4354       % we'll always have a period there to be parsed.
4355       \def\go{\pickupwholefraction#1}%
4356     \else
4357       \let\go = \setuptable
4358     \fi%
4359   \fi
4360   \go
4361 }
4362
4363 % @headitem starts a heading row, which we typeset in bold.  Assignments
4364 % have to be global since we are inside the implicit group of an
4365 % alignment entry.  \everycr below resets \everytab so we don't have to
4366 % undo it ourselves.
4367 \def\headitemfont{\b}% for people to use in the template row; not changeable
4368 \def\headitem{%
4369   \crcr % must appear first
4370   \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4371   \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4372   \the\everytab % for the first item
4373 }%
4374 %
4375 % default for tables with no headings.
4376 \let\headitemcrhook=\relax
4377 %
4378 \def\tab{\checkenv\multitable &\the\everytab}%
4379
4380 \newtoks\everytab  % insert after every tab.
4381 %
4382 \envdef\multitable{%
4383   \vskip\parskip
4384   \startsavinginserts
4385   %
4386   % @item within a multitable starts a normal row.
4387   % We use \def instead of \let so that if one of the multitable entries
4388   % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4389   % \endtemplate) expanding \doitemize.
4390   \def\item{\crcr}%
4391   %
4392   \tolerance=9500
4393   \hbadness=9500
4394   \parskip=0pt
4395   \parindent=6pt
4396   \overfullrule=0pt
4397   \global\colcount=0
4398   %
4399   \everycr = {%
4400     \noalign{%
4401       \global\everytab={}% Reset from possible headitem.
4402       \global\colcount=0 % Reset the column counter.
4403       %
4404       % Check for saved footnotes, etc.:
4405       \checkinserts
4406       %
4407       % Perhaps a \nobreak, then reset:
4408       \headitemcrhook
4409       \global\let\headitemcrhook=\relax
4410     }%
4411   }%
4412   %
4413   \parsearg\domultitable
4414 }
4415 \def\domultitable#1{%
4416   % To parse everything between @multitable and @item:
4417   \setuptable#1 \endsetuptable
4418   %
4419   % This preamble sets up a generic column definition, which will
4420   % be used as many times as user calls for columns.
4421   % \vtop will set a single line and will also let text wrap and
4422   % continue for many paragraphs if desired.
4423   \halign\bgroup &%
4424     \global\advance\colcount by 1
4425     \strut
4426     \vtop{%
4427       \advance\hsize by -1\leftskip
4428       % Find the correct column width
4429       \hsize=\expandafter\csname col\the\colcount\endcsname
4430       %
4431       \advance\rightskip by -1\rightskip % Zero leaving only any stretch
4432       \ifnum\colcount=1
4433         \advance\hsize by\leftskip % Add indent of surrounding text
4434       \else
4435         % In order to keep entries from bumping into each other.
4436         \leftskip=12pt
4437         \ifsetpercent \else
4438           % If a template has been used
4439           \advance\hsize by \leftskip
4440         \fi
4441       \fi
4442       \noindent\ignorespaces##\unskip\strut
4443     }\cr
4444 }
4445 \def\Emultitable{%
4446   \crcr
4447   \egroup % end the \halign
4448   \global\setpercentfalse
4449 }
4450
4451
4452 \message{conditionals,}
4453
4454 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotlatex, @ifnotplaintext,
4455 % @ifnotxml always succeed.  They currently do nothing; we don't
4456 % attempt to check whether the conditionals are properly nested.  But we
4457 % have to remember that they are conditionals, so that @end doesn't
4458 % attempt to close an environment group.
4459 %
4460 \def\makecond#1{%
4461   \expandafter\let\csname #1\endcsname = \relax
4462   \expandafter\let\csname iscond.#1\endcsname = 1
4463 }
4464 \makecond{iftex}
4465 \makecond{ifnotdocbook}
4466 \makecond{ifnothtml}
4467 \makecond{ifnotinfo}
4468 \makecond{ifnotlatex}
4469 \makecond{ifnotplaintext}
4470 \makecond{ifnotxml}
4471
4472 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4473 %
4474 \def\direntry{\doignore{direntry}}
4475 \def\documentdescription{\doignore{documentdescription}}
4476 \def\docbook{\doignore{docbook}}
4477 \def\html{\doignore{html}}
4478 \def\ifdocbook{\doignore{ifdocbook}}
4479 \def\ifhtml{\doignore{ifhtml}}
4480 \def\ifinfo{\doignore{ifinfo}}
4481 \def\iflatex{\doignore{iflatex}}
4482 \def\ifnottex{\doignore{ifnottex}}
4483 \def\ifplaintext{\doignore{ifplaintext}}
4484 \def\ifxml{\doignore{ifxml}}
4485 \def\ignore{\doignore{ignore}}
4486 \def\latex{\doignore{latex}}
4487 \def\menu{\doignore{menu}}
4488 \def\xml{\doignore{xml}}
4489
4490 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4491 %
4492 % A count to remember the depth of nesting.
4493 \newcount\doignorecount
4494
4495 \def\doignore#1{\begingroup
4496   % Scan in ``verbatim'' mode:
4497   \obeylines
4498   \catcode`\@ = \other
4499   \catcode`\{ = \other
4500   \catcode`\} = \other
4501   %
4502   % Make sure that spaces turn into tokens that match what \doignoretext wants.
4503   \spaceisspace
4504   %
4505   % Count number of #1's that we've seen.
4506   \doignorecount = 0
4507   %
4508   % Swallow text until we reach the matching `@end #1'.
4509   \dodoignore{#1}%
4510 }
4511
4512 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4513   \obeylines %
4514   %
4515   \gdef\dodoignore#1{%
4516     % #1 contains the command name as a string, e.g., `ifinfo'.
4517     %
4518     % Define a command to find the next `@end #1'.
4519     \long\def\doignoretext##1^^M@end #1{%
4520       \doignoretextyyy##1^^M@#1\_STOP_}%
4521     %
4522     % And this command to find another #1 command, at the beginning of a
4523     % line.  (Otherwise, we would consider a line `@c @ifset', for
4524     % example, to count as an @ifset for nesting.)
4525     \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4526     %
4527     % And now expand that command.
4528     \doignoretext ^^M%
4529   }%
4530 }
4531
4532 \def\doignoreyyy#1{%
4533   \def\temp{#1}%
4534   \ifx\temp\empty                       % Nothing found.
4535     \let\next\doignoretextzzz
4536   \else                                 % Found a nested condition, ...
4537     \advance\doignorecount by 1
4538     \let\next\doignoretextyyy           % ..., look for another.
4539     % If we're here, #1 ends with ^^M\ifinfo (for example).
4540   \fi
4541   \next #1% the token \_STOP_ is present just after this macro.
4542 }
4543
4544 % We have to swallow the remaining "\_STOP_".
4545 %
4546 \def\doignoretextzzz#1{%
4547   \ifnum\doignorecount = 0      % We have just found the outermost @end.
4548     \let\next\enddoignore
4549   \else                         % Still inside a nested condition.
4550     \advance\doignorecount by -1
4551     \let\next\doignoretext      % Look for the next @end.
4552   \fi
4553   \next
4554 }
4555
4556 % Finish off ignored text.
4557 { \obeylines%
4558   % Ignore anything after the last `@end #1'; this matters in verbatim
4559   % environments, where otherwise the newline after an ignored conditional
4560   % would result in a blank line in the output.
4561   \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4562 }
4563
4564
4565 % @set VAR sets the variable VAR to an empty value.
4566 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4567 %
4568 % Since we want to separate VAR from REST-OF-LINE (which might be
4569 % empty), we can't just use \parsearg; we have to insert a space of our
4570 % own to delimit the rest of the line, and then take it out again if we
4571 % didn't need it.
4572 % We rely on the fact that \parsearg sets \catcode`\ =10.
4573 %
4574 \parseargdef\set{\setyyy#1 \endsetyyy}
4575 \def\setyyy#1 #2\endsetyyy{%
4576   {%
4577     \makevalueexpandable
4578     \def\temp{#2}%
4579     \edef\next{\gdef\makecsname{SET#1}}%
4580     \ifx\temp\empty
4581       \next{}%
4582     \else
4583       \setzzz#2\endsetzzz
4584     \fi
4585   }%
4586 }
4587 % Remove the trailing space \setxxx inserted.
4588 \def\setzzz#1 \endsetzzz{\next{#1}}
4589
4590 % @clear VAR clears (i.e., unsets) the variable VAR.
4591 %
4592 \parseargdef\clear{%
4593   {%
4594     \makevalueexpandable
4595     \global\expandafter\let\csname SET#1\endcsname=\relax
4596   }%
4597 }
4598
4599 % @value{foo} gets the text saved in variable foo.
4600 \def\value{\begingroup\makevalueexpandable\valuexxx}
4601 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4602 {
4603   \catcode`\-=\active \catcode`\_=\active
4604   %
4605   \gdef\makevalueexpandable{%
4606     \let\value = \expandablevalue
4607     % We don't want these characters active, ...
4608     \catcode`\-=\other \catcode`\_=\other
4609     % ..., but we might end up with active ones in the argument if
4610     % we're called from @code, as @code{@value{foo-bar_}}, though.
4611     % So \let them to their normal equivalents.
4612     \let-\normaldash \let_\normalunderscore
4613   }
4614 }
4615
4616 \def\expandablevalue#1{%
4617   \expandafter\ifx\csname SET#1\endcsname\relax
4618     {[No value for ``#1'']}%
4619     \message{Variable `#1', used in @value, is not set.}%
4620   \else
4621     \csname SET#1\endcsname
4622   \fi
4623 }
4624
4625 % Like \expandablevalue, but completely expandable (the \message in the
4626 % definition above operates at the execution level of TeX).  Used when
4627 % writing to auxiliary files, due to the expansion that \write does.
4628 % If flag is undefined, pass through an unexpanded @value command: maybe it 
4629 % will be set by the time it is read back in.
4630 %
4631 % NB flag names containing - or _ may not work here.
4632 \def\dummyvalue#1{%
4633   \expandafter\ifx\csname SET#1\endcsname\relax
4634     \string\value{#1}%
4635   \else
4636     \csname SET#1\endcsname
4637   \fi
4638 }
4639
4640 % Used for @value's in index entries to form the sort key: expand the @value
4641 % if possible, otherwise sort late.
4642 \def\indexnofontsvalue#1{%
4643   \expandafter\ifx\csname SET#1\endcsname\relax
4644     ZZZZZZZ%
4645   \else
4646     \csname SET#1\endcsname
4647   \fi
4648 }
4649
4650 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4651 % with @set.
4652
4653 % To get the special treatment we need for `@end ifset,' we call
4654 % \makecond and then redefine.
4655 %
4656 \makecond{ifset}
4657 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4658 \def\doifset#1#2{%
4659   {%
4660     \makevalueexpandable
4661     \let\next=\empty
4662     \expandafter\ifx\csname SET#2\endcsname\relax
4663       #1% If not set, redefine \next.
4664     \fi
4665     \expandafter
4666   }\next
4667 }
4668 \def\ifsetfail{\doignore{ifset}}
4669
4670 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4671 % defined with @set, or has been undefined with @clear.
4672 %
4673 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4674 % above code: if the variable is not set, do nothing, if it is set,
4675 % then redefine \next to \ifclearfail.
4676 %
4677 \makecond{ifclear}
4678 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4679 \def\ifclearfail{\doignore{ifclear}}
4680
4681 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4682 % without the @) is in fact defined.  We can only feasibly check at the
4683 % TeX level, so something like `mathcode' is going to considered
4684 % defined even though it is not a Texinfo command.
4685
4686 \makecond{ifcommanddefined}
4687 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4688 %
4689 \def\doifcmddefined#1#2{{%
4690     \makevalueexpandable
4691     \let\next=\empty
4692     \expandafter\ifx\csname #2\endcsname\relax
4693       #1% If not defined, \let\next as above.
4694     \fi
4695     \expandafter
4696   }\next
4697 }
4698 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4699
4700 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4701 \makecond{ifcommandnotdefined}
4702 \def\ifcommandnotdefined{%
4703   \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4704 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4705
4706 % Set the `txicommandconditionals' variable, so documents have a way to
4707 % test if the @ifcommand...defined conditionals are available.
4708 \set txicommandconditionals
4709
4710 % @dircategory CATEGORY  -- specify a category of the dir file
4711 % which this file should belong to.  Ignore this in TeX.
4712 \let\dircategory=\comment
4713
4714 % @defininfoenclose.
4715 \let\definfoenclose=\comment
4716
4717
4718 \message{indexing,}
4719 % Index generation facilities
4720
4721 % Define \newwrite to be identical to plain tex's \newwrite
4722 % except not \outer, so it can be used within macros and \if's.
4723 \edef\newwrite{\makecsname{ptexnewwrite}}
4724
4725 % \newindex {IX} defines an index named IX.
4726 % It automatically defines \IXindex such that
4727 % \IXindex ...rest of line... puts an entry in the index IX.
4728 % It also defines \IXindfile to be the number of the output channel for
4729 % the file that accumulates this index.  The file's extension is IX.
4730 %
4731 \def\newindex#1{%
4732   \expandafter\chardef\csname#1indfile\endcsname=0
4733   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
4734     \noexpand\doindex{#1}}
4735 }
4736
4737 % @defindex foo  ==  \newindex{foo}
4738 %
4739 \def\defindex{\parsearg\newindex}
4740
4741 % Define @defcodeindex, like @defindex except put all entries in @code.
4742 %
4743 \def\defcodeindex{\parsearg\newcodeindex}
4744 %
4745 \def\newcodeindex#1{%
4746   \expandafter\chardef\csname#1indfile\endcsname=0
4747   \expandafter\xdef\csname#1index\endcsname{%
4748     \noexpand\docodeindex{#1}}%
4749 }
4750
4751 % The default indices:
4752 \newindex{cp}%      concepts,
4753 \newcodeindex{fn}%  functions,
4754 \newcodeindex{vr}%  variables,
4755 \newcodeindex{tp}%  types,
4756 \newcodeindex{ky}%  keys
4757 \newcodeindex{pg}%  and programs.
4758
4759
4760 % @synindex foo bar    makes index foo feed into index bar.
4761 % Do this instead of @defindex foo if you don't want it as a separate index.
4762 %
4763 % @syncodeindex foo bar   similar, but put all entries made for index foo
4764 % inside @code.
4765 %
4766 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4767 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4768
4769 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4770 % #3 the target index (bar).
4771 \def\dosynindex#1#2#3{%
4772   \requireopenindexfile{#3}%
4773   % redefine \fooindfile:
4774   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4775   \expandafter\let\csname#2indfile\endcsname=\temp
4776   % redefine \fooindex:
4777   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4778 }
4779
4780 % Define \doindex, the driver for all index macros.
4781 % Argument #1 is generated by the calling \fooindex macro,
4782 % and it is the two-letter name of the index.
4783
4784 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4785 \def\doindexxxx #1{\doind{\indexname}{#1}}
4786
4787 % like the previous two, but they put @code around the argument.
4788 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4789 \def\docodeindexxxx #1{\docind{\indexname}{#1}}
4790
4791 \f
4792 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4793 % preventing its expansion.  This is used only for control words,
4794 % not control letters, because the \space would be incorrect for
4795 % control characters, but is needed to separate the control word
4796 % from whatever follows.
4797 %
4798 % These can be used both for control words that take an argument and
4799 % those that do not.  If it is followed by {arg} in the input, then
4800 % that will dutifully get written to the index (or wherever).
4801 %
4802 % For control letters, we have \definedummyletter, which omits the
4803 % space.
4804 %
4805 \def\definedummyword  #1{\def#1{\string#1\space}}%
4806 \def\definedummyletter#1{\def#1{\string#1}}%
4807
4808 % Used for the aux, toc and index files to prevent expansion of Texinfo 
4809 % commands.  Most of the commands are controlled through the
4810 % \ifdummies conditional.
4811 %
4812 \def\atdummies{%
4813   \dummiestrue
4814   %
4815   \definedummyletter\@%
4816   \definedummyletter\ %
4817   \definedummyletter\{%
4818   \definedummyletter\}%
4819   \definedummyletter\&%
4820   %
4821   \definedummyletter\_%
4822   \definedummyletter\-%
4823   %
4824   \definedummyword\subentry
4825   %
4826   % We want to disable all macros so that they are not expanded by \write.
4827   \let\commondummyword\definedummyword
4828   \macrolist
4829   \let\value\dummyvalue
4830   %
4831   \turnoffactive
4832 }
4833
4834 \newif\ifdummies
4835 \newif\ifindexnofonts
4836
4837 \def\commondummyletter#1{%
4838   \expandafter\let\csname\string#1:impl\endcsname#1%
4839   \edef#1{%
4840     \noexpand\ifindexnofonts
4841       % empty expansion
4842     \noexpand\else
4843       \noexpand\ifdummies\string#1%
4844       \noexpand\else
4845         \noexpand\jumptwofi % dispose of the \fi
4846         \expandafter\noexpand\csname\string#1:impl\endcsname
4847       \noexpand\fi
4848     \noexpand\fi}%
4849 }
4850
4851 \def\commondummyaccent#1{%
4852   \expandafter\let\csname\string#1:impl\endcsname#1%
4853   \edef#1{%
4854     \noexpand\ifindexnofonts
4855       \noexpand\expandafter % dispose of \else ... \fi
4856       \noexpand\asis
4857     \noexpand\else
4858       \noexpand\ifdummies\string#1%
4859       \noexpand\else
4860         \noexpand\jumptwofi % dispose of the \fi
4861         \expandafter\noexpand\csname\string#1:impl\endcsname
4862       \noexpand\fi
4863     \noexpand\fi}%
4864 }
4865
4866 % Like \commondummyaccent but add a \space at the end of the dummy expansion
4867 % #2 is the expansion used for \indexnofonts.  #2 is always followed by
4868 % \asis to remove a pair of following braces.
4869 \def\commondummyword#1#2{%
4870   \expandafter\let\csname\string#1:impl\endcsname#1%
4871   \expandafter\def\csname\string#1:ixnf\endcsname{#2\asis}%
4872   \edef#1{%
4873     \noexpand\ifindexnofonts
4874       \noexpand\expandafter % dispose of \else ... \fi
4875       \expandafter\noexpand\csname\string#1:ixnf\endcsname
4876     \noexpand\else
4877       \noexpand\ifdummies\string#1\space
4878       \noexpand\else
4879         \noexpand\jumptwofi % dispose of the \fi \fi
4880         \expandafter\noexpand\csname\string#1:impl\endcsname
4881       \noexpand\fi
4882     \noexpand\fi}%
4883 }
4884 \def\jumptwofi#1\fi\fi{\fi\fi#1}
4885
4886 % For \atdummies and \indexnofonts.  \atdummies sets
4887 % \dummiestrue and \indexnofonts sets \indexnofontstrue.
4888 \def\definedummies{
4889   % @-sign is always an escape character when reading auxiliary files
4890   \escapechar = `\@
4891   %
4892   \commondummyletter\!%
4893   \commondummyaccent\"%
4894   \commondummyaccent\'%
4895   \commondummyletter\*%
4896   \commondummyaccent\,%
4897   \commondummyletter\.%
4898   \commondummyletter\/%
4899   \commondummyletter\:%
4900   \commondummyaccent\=%
4901   \commondummyletter\?%
4902   \commondummyaccent\^%
4903   \commondummyaccent\`%
4904   \commondummyaccent\~%
4905   %
4906   % Control letters and accents.
4907   \commondummyword\u          {}%
4908   \commondummyword\v          {}%
4909   \commondummyword\H          {}%
4910   \commondummyword\dotaccent  {}%
4911   \commondummyword\ogonek     {}%
4912   \commondummyword\ringaccent {}%
4913   \commondummyword\tieaccent  {}%
4914   \commondummyword\ubaraccent {}%
4915   \commondummyword\udotaccent {}%
4916   \commondummyword\dotless    {}%
4917   %
4918   % Texinfo font commands.
4919   \commondummyword\b          {}%
4920   \commondummyword\i          {}%
4921   \commondummyword\r          {}%
4922   \commondummyword\sansserif  {}%
4923   \commondummyword\sc         {}%
4924   \commondummyword\slanted    {}%
4925   \commondummyword\t          {}%
4926   %
4927   % Commands that take arguments.
4928   \commondummyword\abbr       {}%
4929   \commondummyword\acronym    {}%
4930   \commondummyword\anchor     {}%
4931   \commondummyword\cite       {}%
4932   \commondummyword\code       {}%
4933   \commondummyword\command    {}%
4934   \commondummyword\dfn        {}%
4935   \commondummyword\dmn        {}%
4936   \commondummyword\email      {}%
4937   \commondummyword\emph       {}%
4938   \commondummyword\env        {}%
4939   \commondummyword\file       {}%
4940   \commondummyword\image      {}%
4941   \commondummyword\indicateurl{}%
4942   \commondummyword\inforef    {}%
4943   \commondummyword\kbd        {}%
4944   \commondummyword\key        {}%
4945   \commondummyword\math       {}%
4946   \commondummyword\option     {}%
4947   \commondummyword\pxref      {}%
4948   \commondummyword\ref        {}%
4949   \commondummyword\samp       {}%
4950   \commondummyword\strong     {}%
4951   \commondummyword\tie        {}%
4952   \commondummyword\U          {}%
4953   \commondummyword\uref       {}%
4954   \commondummyword\url        {}%
4955   \commondummyword\var        {}%
4956   \commondummyword\verb       {}%
4957   \commondummyword\w          {}%
4958   \commondummyword\xref       {}%
4959   %
4960   \commondummyword\AA               {AA}%
4961   \commondummyword\AE               {AE}%
4962   \commondummyword\DH               {DZZ}%
4963   \commondummyword\L                {L}%
4964   \commondummyword\O                {O}%
4965   \commondummyword\OE               {OE}%
4966   \commondummyword\TH               {TH}%
4967   \commondummyword\aa               {aa}%
4968   \commondummyword\ae               {ae}%
4969   \commondummyword\dh               {dzz}%
4970   \commondummyword\exclamdown       {!}%
4971   \commondummyword\l                {l}%
4972   \commondummyword\o                {o}%
4973   \commondummyword\oe               {oe}%
4974   \commondummyword\ordf             {a}%
4975   \commondummyword\ordm             {o}%
4976   \commondummyword\questiondown     {?}%
4977   \commondummyword\ss               {ss}%
4978   \commondummyword\th               {th}%
4979   %
4980   \commondummyword\LaTeX            {LaTeX}%
4981   \commondummyword\TeX              {TeX}%
4982   %
4983   % Assorted special characters.
4984   \commondummyword\ampchar          {\normalamp}%
4985   \commondummyword\atchar           {\@}%
4986   \commondummyword\arrow            {->}%
4987   \commondummyword\backslashchar    {\realbackslash}%
4988   \commondummyword\bullet           {bullet}%
4989   \commondummyword\comma            {,}%
4990   \commondummyword\copyright        {copyright}%
4991   \commondummyword\dots             {...}%
4992   \commondummyword\enddots          {...}%
4993   \commondummyword\entrybreak       {}%
4994   \commondummyword\equiv            {===}%
4995   \commondummyword\error            {error}%
4996   \commondummyword\euro             {euro}%
4997   \commondummyword\expansion        {==>}%
4998   \commondummyword\geq              {>=}%
4999   \commondummyword\guillemetleft    {<<}%
5000   \commondummyword\guillemetright   {>>}%
5001   \commondummyword\guilsinglleft    {<}%
5002   \commondummyword\guilsinglright   {>}%
5003   \commondummyword\lbracechar       {\{}%
5004   \commondummyword\leq              {<=}%
5005   \commondummyword\mathopsup        {sup}%
5006   \commondummyword\minus            {-}%
5007   \commondummyword\pounds           {pounds}%
5008   \commondummyword\point            {.}%
5009   \commondummyword\print            {-|}%
5010   \commondummyword\quotedblbase     {"}%
5011   \commondummyword\quotedblleft     {"}%
5012   \commondummyword\quotedblright    {"}%
5013   \commondummyword\quoteleft        {`}%
5014   \commondummyword\quoteright       {'}%
5015   \commondummyword\quotesinglbase   {,}%
5016   \commondummyword\rbracechar       {\}}%
5017   \commondummyword\registeredsymbol {R}%
5018   \commondummyword\result           {=>}%
5019   \commondummyword\sub              {}%
5020   \commondummyword\sup              {}%
5021   \commondummyword\textdegree       {o}%
5022 }
5023
5024 \let\indexlbrace\relax
5025 \let\indexrbrace\relax
5026 \let\indexatchar\relax
5027 \let\indexbackslash\relax
5028
5029 {\catcode`\@=0
5030 \catcode`\\=13
5031   @gdef@backslashdisappear{@def\{}}
5032 }
5033
5034 {
5035 \catcode`\<=13
5036 \catcode`\-=13
5037 \catcode`\`=13
5038   \gdef\indexnonalnumdisappear{%
5039     \ifflagclear{txiindexlquoteignore}{}{%
5040       % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5041       % (Introduced for FSFS 2nd ed.)
5042       \let`=\empty
5043     }%
5044     %
5045     \ifflagclear{txiindexbackslashignore}{}{%
5046       \backslashdisappear
5047     }%
5048     \ifflagclear{txiindexhyphenignore}{}{%
5049       \def-{}%
5050     }%
5051     \ifflagclear{txiindexlessthanignore}{}{%
5052       \def<{}%
5053     }%
5054     \ifflagclear{txiindexatsignignore}{}{%
5055       \def\@{}%
5056     }%
5057   }
5058
5059   \gdef\indexnonalnumreappear{%
5060     \let-\normaldash
5061     \let<\normalless
5062   }
5063 }
5064
5065
5066 % \indexnofonts is used when outputting the strings to sort the index
5067 % by, and when constructing control sequence names.  It eliminates all
5068 % control sequences and just writes whatever the best ASCII sort string
5069 % would be for a given command (usually its argument).
5070 %
5071 \def\indexnofonts{%
5072   \indexnofontstrue
5073   %
5074   \def\ { }%
5075   \def\@{@}%
5076   \def\_{\normalunderscore}%
5077   \def\-{}% @- shouldn't affect sorting
5078   %
5079   \uccode`\1=`\{ \uppercase{\def\{{1}}%
5080   \uccode`\1=`\} \uppercase{\def\}{1}}%
5081   \let\lbracechar\{%
5082   \let\rbracechar\}%
5083   %
5084   %
5085   % We need to get rid of all macros, leaving only the arguments (if present).
5086   % Of course this is not nearly correct, but it is the best we can do for now.
5087   %
5088   % Since macro invocations are followed by braces, we can just redefine them
5089   % to take a single TeX argument.  The case of a macro invocation that
5090   % goes to end-of-line is not handled.
5091   %
5092   \def\commondummyword##1{\let##1\asis}%
5093   \macrolist
5094   \let\value\indexnofontsvalue
5095 }
5096
5097 \f
5098
5099
5100 % #1 is the index name, #2 is the entry text.
5101 \def\doind#1#2{%
5102   \iflinks
5103   {%
5104     %
5105     \requireopenindexfile{#1}%
5106     \edef\writeto{\csname#1indfile\endcsname}%
5107     %
5108     \def\indextext{#2}%
5109     \safewhatsit\doindwrite
5110   }%
5111   \fi
5112 }
5113
5114 % Same as \doind, but for code indices
5115 \def\docind#1#2{%
5116   \iflinks
5117   {%
5118     %
5119     \requireopenindexfile{#1}%
5120     \edef\writeto{\csname#1indfile\endcsname}%
5121     %
5122     \def\indextext{#2}%
5123     \safewhatsit\docindwrite
5124   }%
5125   \fi
5126 }
5127
5128 % Check if an index file has been opened, and if not, open it.
5129 \def\requireopenindexfile#1{%
5130 \ifnum\csname #1indfile\endcsname=0
5131   \expandafter\newwrite \csname#1indfile\endcsname
5132   \edef\suffix{#1}%
5133   % A .fls suffix would conflict with the file extension for the output
5134   % of -recorder, so use .f1s instead.
5135   \ifx\suffix\indexisfl\def\suffix{f1}\fi
5136   % Open the file
5137   \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5138   % Using \immediate above here prevents an object entering into the current 
5139   % box, which could confound checks such as those in \safewhatsit for
5140   % preceding skips.
5141   \typeout{Writing index file \jobname.\suffix}%
5142 \fi}
5143 \def\indexisfl{fl}
5144
5145 % Definition for writing index entry sort key.
5146 {
5147 \catcode`\-=13
5148 \gdef\indexwritesortas{%
5149   \begingroup
5150   \indexnonalnumreappear
5151   \indexwritesortasxxx}
5152 \gdef\indexwritesortasxxx#1{%
5153   \xdef\indexsortkey{#1}\endgroup}
5154 }
5155
5156 \def\indexwriteseealso#1{
5157   \gdef\pagenumbertext{\string\seealso{#1}}%
5158 }
5159 \def\indexwriteseeentry#1{
5160   \gdef\pagenumbertext{\string\seeentry{#1}}%
5161 }
5162
5163 % The default definitions
5164 \def\sortas#1{}%
5165 \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
5166 \def\putwordSeeAlso{See also}
5167 \def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
5168
5169
5170 % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
5171 %   * Set \bracedtext to "{aaa}{bbb}"
5172 %   * Set \fullindexsortkey to "aaa @subentry ZZZ"
5173 %   * If @seealso occurs, set \pagenumbertext
5174 %
5175 \def\splitindexentry#1{%
5176   \gdef\fullindexsortkey{}%
5177   \xdef\bracedtext{}%
5178   \def\sep{}%
5179   \def\seealso##1{}%
5180   \def\seeentry##1{}%
5181   \expandafter\doindexsegment#1\subentry\finish\subentry
5182 }
5183
5184 % append the results from the next segment
5185 \def\doindexsegment#1\subentry{%
5186   \def\segment{#1}%
5187   \ifx\segment\isfinish
5188   \else
5189     %
5190     % Fully expand the segment, throwing away any @sortas directives, and 
5191     % trim spaces.
5192     \edef\trimmed{\segment}%
5193     \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5194     \ifincodeindex
5195       \edef\trimmed{\noexpand\code{\trimmed}}%
5196     \fi
5197     %
5198     \xdef\bracedtext{\bracedtext{\trimmed}}%
5199     %
5200     % Get the string to sort by.  Process the segment with all
5201     % font commands turned off.
5202     \bgroup
5203       \let\sortas\indexwritesortas
5204       \let\seealso\indexwriteseealso
5205       \let\seeentry\indexwriteseeentry
5206       \indexnofonts
5207       % The braces around the commands are recognized by texindex.
5208       \def\lbracechar{{\string\indexlbrace}}%
5209       \def\rbracechar{{\string\indexrbrace}}%
5210       \let\{=\lbracechar
5211       \let\}=\rbracechar
5212       \def\@{{\string\indexatchar}}%
5213       \def\atchar##1{\@}%
5214       \def\backslashchar{{\string\indexbackslash}}%
5215       \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
5216       %
5217       \let\indexsortkey\empty
5218       \global\let\pagenumbertext\empty
5219       % Execute the segment and throw away the typeset output.  This executes
5220       % any @sortas or @seealso commands in this segment.
5221       \setbox\dummybox = \hbox{\segment}%
5222       \ifx\indexsortkey\empty{%
5223         \indexnonalnumdisappear
5224         \xdef\trimmed{\segment}%
5225         \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5226         \xdef\indexsortkey{\trimmed}%
5227         \ifx\indexsortkey\empty
5228           \message{Empty index sort key near line \the\inputlineno}%
5229           \xdef\indexsortkey{ }%
5230         \fi
5231       }\fi
5232       %
5233       % Append to \fullindexsortkey.
5234       \edef\tmp{\gdef\noexpand\fullindexsortkey{%
5235                   \fullindexsortkey\sep\indexsortkey}}%
5236       \tmp
5237     \egroup
5238     \def\sep{\subentry}%
5239     %
5240     \expandafter\doindexsegment
5241   \fi
5242 }
5243 \def\isfinish{\finish}%
5244 \newbox\dummybox % used above
5245
5246 \let\subentry\relax
5247
5248 % Use \ instead of @ in index files.  To support old texi2dvi and texindex.
5249 % This works without changing the escape character used in the toc or aux
5250 % files because the index entries are fully expanded here, and \string uses
5251 % the current value of \escapechar.
5252 \def\escapeisbackslash{\escapechar=`\\}
5253
5254 % Use \ in index files by default.  texi2dvi didn't support @ as the escape 
5255 % character (as it checked for "\entry" in the files, and not "@entry").  When 
5256 % the new version of texi2dvi has had a chance to become more prevalent, then 
5257 % the escape character can change back to @ again.  This should be an easy 
5258 % change to make now because both @ and \ are only used as escape characters in 
5259 % index files, never standing for themselves. 
5260 %
5261 \set txiindexescapeisbackslash
5262
5263 % Write the entry in \indextext to the index file.
5264 %
5265
5266 \newif\ifincodeindex
5267 \def\doindwrite{\incodeindexfalse\doindwritex}
5268 \def\docindwrite{\incodeindextrue\doindwritex}
5269
5270 \def\doindwritex{%
5271   \maybemarginindex
5272   %
5273   \atdummies
5274   %
5275   \ifflagclear{txiindexescapeisbackslash}{}{\escapeisbackslash}%
5276   %
5277   % For texindex which always views { and } as separators.
5278   \def\{{\lbracechar{}}%
5279   \def\}{\rbracechar{}}%
5280   \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
5281   %
5282   % Split the entry into primary entry and any subentries, and get the index 
5283   % sort key.
5284   \splitindexentry\indextext
5285   %
5286   % Set up the complete index entry, with both the sort key and
5287   % the original text, including any font commands.  We write
5288   % three arguments to \entry to the .?? file (four in the
5289   % subentry case), texindex reduces to two when writing the .??s
5290   % sorted result.
5291   %
5292   \edef\temp{%
5293     \write\writeto{%
5294       \string\entry{\fullindexsortkey}%
5295         {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
5296         \bracedtext}%
5297   }%
5298   \temp
5299 }
5300
5301 % Put the index entry in the margin if desired (undocumented).
5302 \def\maybemarginindex{%
5303   \ifx\SETmarginindex\relax\else
5304     \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
5305   \fi
5306 }
5307 \let\SETmarginindex=\relax
5308
5309
5310 % Take care of unwanted page breaks/skips around a whatsit:
5311 %
5312 % If a skip is the last thing on the list now, preserve it
5313 % by backing up by \lastskip, doing the \write, then inserting
5314 % the skip again.  Otherwise, the whatsit generated by the
5315 % \write or \pdfdest will make \lastskip zero.  The result is that
5316 % sequences like this:
5317 % @end defun
5318 % @tindex whatever
5319 % @defun ...
5320 % will have extra space inserted, because the \medbreak in the
5321 % start of the @defun won't see the skip inserted by the @end of
5322 % the previous defun.
5323 %
5324 % But don't do any of this if we're not in vertical mode.  We
5325 % don't want to do a \vskip and prematurely end a paragraph.
5326 %
5327 % Avoid page breaks due to these extra skips, too.
5328 %
5329 % But wait, there is a catch there:
5330 % We'll have to check whether \lastskip is zero skip.  \ifdim is not
5331 % sufficient for this purpose, as it ignores stretch and shrink parts
5332 % of the skip.  The only way seems to be to check the textual
5333 % representation of the skip.
5334 %
5335 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5336 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5337 %
5338 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5339 %
5340 \newskip\whatsitskip
5341 \newcount\whatsitpenalty
5342 %
5343 % ..., ready, GO:
5344 %
5345 \def\safewhatsit#1{\ifhmode
5346   #1%
5347  \else
5348   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5349   \whatsitskip = \lastskip
5350   \edef\lastskipmacro{\the\lastskip}%
5351   \whatsitpenalty = \lastpenalty
5352   %
5353   % If \lastskip is nonzero, that means the last item was a
5354   % skip.  And since a skip is discardable, that means this
5355   % -\whatsitskip glue we're inserting is preceded by a
5356   % non-discardable item, therefore it is not a potential
5357   % breakpoint, therefore no \nobreak needed.
5358   \ifx\lastskipmacro\zeroskipmacro
5359   \else
5360     \vskip-\whatsitskip
5361   \fi
5362   %
5363   #1%
5364   %
5365   \ifx\lastskipmacro\zeroskipmacro
5366     % If \lastskip was zero, perhaps the last item was a penalty, and
5367     % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
5368     % to re-insert the same penalty (values >10000 are used for various
5369     % signals); since we just inserted a non-discardable item, any
5370     % following glue (such as a \parskip) would be a breakpoint.  For example:
5371     %   @deffn deffn-whatever
5372     %   @vindex index-whatever
5373     %   Description.
5374     % would allow a break between the index-whatever whatsit
5375     % and the "Description." paragraph.
5376     \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5377   \else
5378     % On the other hand, if we had a nonzero \lastskip,
5379     % this make-up glue would be preceded by a non-discardable item
5380     % (the whatsit from the \write), so we must insert a \nobreak.
5381     \nobreak\vskip\whatsitskip
5382   \fi
5383 \fi}
5384
5385 % The index entry written in the file actually looks like
5386 %  \entry {sortstring}{page}{topic}
5387 % or
5388 %  \entry {sortstring}{page}{topic}{subtopic}
5389 % The texindex program reads in these files and writes files
5390 % containing these kinds of lines:
5391 %  \initial {c}
5392 %     before the first topic whose initial is c
5393 %  \entry {topic}{pagelist}
5394 %     for a topic that is used without subtopics
5395 %  \primary {topic}
5396 %  \entry {topic}{}
5397 %     for the beginning of a topic that is used with subtopics
5398 %  \secondary {subtopic}{pagelist}
5399 %     for each subtopic.
5400 %  \secondary {subtopic}{}
5401 %     for a subtopic with sub-subtopics
5402 %  \tertiary {subtopic}{subsubtopic}{pagelist}
5403 %     for each sub-subtopic.
5404
5405 % Define the user-accessible indexing commands
5406 % @findex, @vindex, @kindex, @cindex.
5407
5408 \def\findex {\fnindex}
5409 \def\kindex {\kyindex}
5410 \def\cindex {\cpindex}
5411 \def\vindex {\vrindex}
5412 \def\tindex {\tpindex}
5413 \def\pindex {\pgindex}
5414
5415 % Define the macros used in formatting output of the sorted index material.
5416
5417 % @printindex causes a particular index (the ??s file) to get printed.
5418 % It does not print any chapter heading (usually an @unnumbered).
5419 %
5420 \parseargdef\printindex{\begingroup
5421   \dobreak \chapheadingskip{10000}%
5422   %
5423   \smallfonts \rm
5424   \tolerance = 9500
5425   \plainfrenchspacing
5426   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5427   %
5428   % See comment in \requireopenindexfile.
5429   \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5430   %
5431   % See if the index file exists and is nonempty.
5432   \openin 1 \jobname.\indexname s
5433   \ifeof 1
5434     % \enddoublecolumns gets confused if there is no text in the index,
5435     % and it loses the chapter title and the aux file entries for the
5436     % index.  The easiest way to prevent this problem is to make sure
5437     % there is some text.
5438     \putwordIndexNonexistent
5439     \typeout{No file \jobname.\indexname s.}%
5440   \else
5441     % If the index file exists but is empty, then \openin leaves \ifeof
5442     % false.  We have to make TeX try to read something from the file, so
5443     % it can discover if there is anything in it.
5444     \read 1 to \thisline
5445     \ifeof 1
5446       \putwordIndexIsEmpty
5447     \else
5448       \expandafter\printindexzz\thisline\relax\relax\finish%
5449     \fi
5450   \fi
5451   \closein 1
5452 \endgroup}
5453
5454 % If the index file starts with a backslash, forgo reading the index
5455 % file altogether.  If somebody upgrades texinfo.tex they may still have
5456 % old index files using \ as the escape character.  Reading this would
5457 % at best lead to typesetting garbage, at worst a TeX syntax error.
5458 \def\printindexzz#1#2\finish{%
5459   \ifflagclear{txiindexescapeisbackslash}{%
5460     \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
5461       \ifflagclear{txiskipindexfileswithbackslash}{%
5462 \errmessage{%
5463 ERROR: A sorted index file in an obsolete format was skipped.  
5464 To fix this problem, please upgrade your version of 'texi2dvi'
5465 or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
5466 If you are using an old version of 'texindex' (part of the Texinfo 
5467 distribution), you may also need to upgrade to a newer version (at least 6.0).
5468 You may be able to typeset the index if you run
5469 'texindex \jobname.\indexname' yourself.
5470 You could also try setting the 'txiindexescapeisbackslash' flag by 
5471 running a command like
5472 'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'.  If you do 
5473 this, Texinfo will try to use index files in the old format.
5474 If you continue to have problems, deleting the index files and starting again 
5475 might help (with 'rm \jobname.?? \jobname.??s')%
5476 }%
5477       }{%
5478         (Skipped sorted index file in obsolete format)
5479       }%
5480     \else
5481       \begindoublecolumns
5482       \input \jobname.\indexname s
5483       \enddoublecolumns
5484     \fi
5485   }{%
5486     \begindoublecolumns
5487     \catcode`\\=0\relax
5488     %
5489     % Make @ an escape character to give macros a chance to work.  This
5490     % should work because we (hopefully) don't otherwise use @ in index files.
5491     %\catcode`\@=12\relax
5492     \catcode`\@=0\relax
5493     \input \jobname.\indexname s
5494     \enddoublecolumns
5495   }%
5496 }
5497
5498 % These macros are used by the sorted index file itself.
5499 % Change them to control the appearance of the index.
5500
5501 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5502 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5503 \catcode`\$=3
5504 \gdef\initialglyphs{%
5505   % special control sequences used in the index sort key
5506   \let\indexlbrace\{%
5507   \let\indexrbrace\}%
5508   \let\indexatchar\@%
5509   \def\indexbackslash{\math{\backslash}}%
5510   %
5511   % Some changes for non-alphabetic characters.  Using the glyphs from the
5512   % math fonts looks more consistent than the typewriter font used elsewhere
5513   % for these characters.
5514   \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
5515   %
5516   % In case @\ is used for backslash
5517   \uppercase{\let\\=~}
5518   % Can't get bold backslash so don't use bold forward slash
5519   \catcode`\/=13
5520   \def/{{\secrmnotbold \normalslash}}%
5521   \def-{{\normaldash\normaldash}}% en dash `--'
5522   \def^{{\chapbf \normalcaret}}%
5523   \def~{{\chapbf \normaltilde}}%
5524   \def\_{%
5525      \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5526   \def|{$\vert$}%
5527   \def<{$\less$}%
5528   \def>{$\gtr$}%
5529   \def+{$\normalplus$}%
5530 }}
5531
5532 \def\initial{%
5533   \bgroup
5534   \initialglyphs
5535   \initialx
5536 }
5537
5538 \def\initialx#1{%
5539   % Remove any glue we may have, we'll be inserting our own.
5540   \removelastskip
5541   %
5542   % We like breaks before the index initials, so insert a bonus.
5543   % The glue before the bonus allows a little bit of space at the
5544   % bottom of a column to reduce an increase in inter-line spacing.
5545   \nobreak
5546   \vskip 0pt plus 5\baselineskip
5547   \penalty -300 
5548   \vskip 0pt plus -5\baselineskip
5549   %
5550   % Typeset the initial.  Making this add up to a whole number of
5551   % baselineskips increases the chance of the dots lining up from column
5552   % to column.  It still won't often be perfect, because of the stretch
5553   % we need before each entry, but it's better.
5554   %
5555   % No shrink because it confuses \balancecolumns.
5556   \vskip 1.67\baselineskip plus 1\baselineskip
5557   \leftline{\secfonts \kern-0.05em \secbf #1}%
5558   % \secfonts is inside the argument of \leftline so that the change of
5559   % \baselineskip will not affect any glue inserted before the vbox that
5560   % \leftline creates.
5561   % Do our best not to break after the initial.
5562   \nobreak
5563   \vskip .33\baselineskip plus .1\baselineskip
5564   \egroup % \initialglyphs
5565 }
5566
5567 \newdimen\entryrightmargin
5568 \entryrightmargin=0pt
5569
5570 % for PDF output, whether to make the text of the entry a link to the page
5571 % number.  set for @contents and @shortcontents where there is only one
5572 % page number.
5573 \newif\iflinkentrytext
5574
5575 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5576 % then page number (#2) flushed to the right margin.  It is used for index
5577 % and table of contents entries.  The paragraph is indented by \leftskip.
5578 %
5579 \def\entry{%
5580   \begingroup
5581     %
5582     % Start a new paragraph if necessary, so our assignments below can't
5583     % affect previous text.
5584     \par
5585     %
5586     % No extra space above this paragraph.
5587     \parskip = 0in
5588     %
5589     % When reading the text of entry, convert explicit line breaks
5590     % from @* into spaces.  The user might give these in long section
5591     % titles, for instance.
5592     \def\*{\unskip\space\ignorespaces}%
5593     \def\entrybreak{\hfil\break}% An undocumented command
5594     %
5595     % Swallow the left brace of the text (first parameter):
5596     \afterassignment\doentry
5597     \let\temp =
5598 }
5599 \def\entrybreak{\unskip\space\ignorespaces}%
5600 \def\doentry{%
5601     % Save the text of the entry in \boxA
5602     \global\setbox\boxA=\hbox\bgroup
5603     \bgroup % Instead of the swallowed brace.
5604       \noindent
5605       \aftergroup\finishentry
5606       % And now comes the text of the entry.
5607       % Not absorbing as a macro argument reduces the chance of problems
5608       % with catcodes occurring.
5609 }
5610 {\catcode`\@=11
5611 % #1 is the page number
5612 \gdef\finishentry#1{%
5613     \egroup % end \boxA
5614     \dimen@ = \wd\boxA % Length of text of entry
5615     % add any leaders and page number to \boxA.
5616     \global\setbox\boxA=\hbox\bgroup
5617       \ifpdforxetex
5618         \iflinkentrytext
5619           \pdflinkpage{#1}{\unhbox\boxA}%
5620         \else
5621           \unhbox\boxA
5622         \fi
5623       \else
5624         \unhbox\boxA
5625       \fi
5626       %
5627       % Get the width of the page numbers, and only use
5628       % leaders if they are present.
5629       \global\setbox\boxB = \hbox{#1}%
5630       \ifdim\wd\boxB = 0pt
5631         \null\nobreak\hfill\ %
5632       \else
5633         %
5634         \null\nobreak\indexdotfill % Have leaders before the page number.
5635         %
5636         \ifpdforxetex
5637           \pdfgettoks#1.%
5638           \hskip\skip\thinshrinkable\the\toksA
5639         \else
5640           \hskip\skip\thinshrinkable #1%
5641         \fi
5642       \fi
5643     \egroup % end \boxA
5644     %
5645     % now output
5646     \ifdim\wd\boxB = 0pt
5647       \noindent\unhbox\boxA\par
5648       \nobreak
5649     \else\bgroup
5650       % We want the text of the entries to be aligned to the left, and the
5651       % page numbers to be aligned to the right.
5652       %
5653       \parindent = 0pt
5654       \advance\leftskip by 0pt plus 1fil
5655       \advance\leftskip by 0pt plus -1fill
5656       \rightskip = 0pt plus -1fil
5657       \advance\rightskip by 0pt plus 1fill
5658       % Cause last line, which could consist of page numbers on their own
5659       % if the list of page numbers is long, to be aligned to the right.
5660       \parfillskip=0pt plus -1fill
5661       %
5662       \advance\rightskip by \entryrightmargin
5663       % Determine how far we can stretch into the margin.
5664       % This allows, e.g., "Appendix H  GNU Free Documentation License" to
5665       % fit on one line in @letterpaper format.
5666       \ifdim\entryrightmargin>2.1em
5667         \dimen@i=2.1em
5668       \else
5669         \dimen@i=0em
5670       \fi
5671       \advance \parfillskip by 0pt minus 1\dimen@i
5672       %
5673       \dimen@ii = \hsize
5674       \advance\dimen@ii by -1\leftskip
5675       \advance\dimen@ii by -1\entryrightmargin
5676       \advance\dimen@ii by 1\dimen@i
5677       \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5678       \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
5679         % Try to split the text roughly evenly.  \dimen@ will be the length of 
5680         % the first line.
5681         \dimen@ = 0.7\dimen@
5682         \dimen@ii = \hsize
5683         \ifnum\dimen@>\dimen@ii
5684           % If the entry is too long (for example, if it needs more than
5685           % two lines), use all the space in the first line.
5686           \dimen@ = \dimen@ii
5687         \fi
5688         \advance\leftskip by 0pt plus 1fill % ragged right
5689         \advance \dimen@ by 1\rightskip
5690         \parshape = 2 0pt \dimen@ 0em \dimen@ii
5691         % Ideally we'd add a finite glue at the end of the first line only,
5692         % instead of using \parshape with explicit line lengths, but TeX
5693         % doesn't seem to provide a way to do such a thing.
5694         %
5695         % Indent all lines but the first one.
5696         \advance\leftskip by 1em
5697         \advance\parindent by -1em
5698       \fi\fi
5699       \indent % start paragraph
5700       \unhbox\boxA
5701       %
5702       % Do not prefer a separate line ending with a hyphen to fewer lines.
5703       \finalhyphendemerits = 0
5704       %
5705       % Word spacing - no stretch
5706       \spaceskip=\fontdimen2\font minus \fontdimen4\font
5707       %
5708       \linepenalty=1000  % Discourage line breaks.
5709       \hyphenpenalty=5000  % Discourage hyphenation.
5710       %
5711       \par % format the paragraph
5712     \egroup % The \vbox
5713     \fi
5714   \endgroup
5715 }}
5716
5717 \newskip\thinshrinkable
5718 \skip\thinshrinkable=.15em minus .15em
5719
5720 % Like plain.tex's \dotfill, except uses up at least 1 em.
5721 % The filll stretch here overpowers both the fil and fill stretch to push
5722 % the page number to the right.
5723 \def\indexdotfill{\cleaders
5724   \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5725
5726
5727 \def\primary #1{\line{#1\hfil}}
5728
5729 \def\secondary{\indententry{0.5cm}}
5730 \def\tertiary{\indententry{1cm}}
5731
5732 \def\indententry#1#2#3{%
5733   \bgroup
5734   \leftskip=#1
5735   \entry{#2}{#3}%
5736   \egroup
5737 }
5738
5739 % Define two-column mode, which we use to typeset indexes.
5740 % Adapted from the TeXbook, page 416, which is to say,
5741 % the manmac.tex format used to print the TeXbook itself.
5742 \catcode`\@=11  % private names
5743
5744 \newbox\partialpage
5745 \newdimen\doublecolumnhsize
5746
5747 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5748   % If not much space left on page, start a new page.
5749   \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5750   %
5751   % Grab any single-column material above us.
5752   \output = {%
5753     \savetopmark
5754     %
5755     \global\setbox\partialpage = \vbox{%
5756       % Unvbox the main output page.
5757       \unvbox\PAGE
5758       \kern-\topskip \kern\baselineskip
5759     }%
5760   }%
5761   \eject % run that output routine to set \partialpage
5762   %
5763   % Use the double-column output routine for subsequent pages.
5764   \output = {\doublecolumnout}%
5765   %
5766   % Change the page size parameters.  We could do this once outside this
5767   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5768   % format, but then we repeat the same computation.  Repeating a couple
5769   % of assignments once per index is clearly meaningless for the
5770   % execution time, so we may as well do it in one place.
5771   %
5772   % First we halve the line length, less a little for the gutter between
5773   % the columns.  We compute the gutter based on the line length, so it
5774   % changes automatically with the paper format.  The magic constant
5775   % below is chosen so that the gutter has the same value (well, +-<1pt)
5776   % as it did when we hard-coded it.
5777   %
5778   % We put the result in a separate register, \doublecolumhsize, so we
5779   % can restore it in \pagesofar, after \hsize itself has (potentially)
5780   % been clobbered.
5781   %
5782   \doublecolumnhsize = \hsize
5783     \advance\doublecolumnhsize by -.04154\hsize
5784     \divide\doublecolumnhsize by 2
5785   \hsize = \doublecolumnhsize
5786   %
5787   % Get the available space for the double columns -- the normal
5788   % (undoubled) page height minus any material left over from the
5789   % previous page.
5790   \advance\vsize by -\ht\partialpage
5791   \vsize = 2\vsize
5792   %
5793   % For the benefit of balancing columns
5794   \advance\baselineskip by 0pt plus 0.5pt
5795 }
5796
5797 % The double-column output routine for all double-column pages except
5798 % the last, which is done by \balancecolumns.
5799 %
5800 \def\doublecolumnout{%
5801   %
5802   \savetopmark
5803   \splittopskip=\topskip \splitmaxdepth=\maxdepth
5804   \dimen@ = \vsize
5805   \divide\dimen@ by 2
5806   %
5807   % box0 will be the left-hand column, box2 the right.
5808   \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
5809   \global\advance\vsize by 2\ht\partialpage
5810   \onepageout\pagesofar % empty except for the first time we are called
5811   \unvbox\PAGE
5812   \penalty\outputpenalty
5813 }
5814 %
5815 % Re-output the contents of the output page -- any previous material,
5816 % followed by the two boxes we just split, in box0 and box2.
5817 \def\pagesofar{%
5818   \unvbox\partialpage
5819   %
5820   \hsize = \doublecolumnhsize
5821   \wd0=\hsize \wd2=\hsize
5822   \hbox to\txipagewidth{\box0\hfil\box2}%
5823 }
5824
5825
5826 % Finished with double columns.
5827 \def\enddoublecolumns{%
5828   % The following penalty ensures that the page builder is exercised
5829   % _before_ we change the output routine.  This is necessary in the
5830   % following situation:
5831   %
5832   % The last section of the index consists only of a single entry.
5833   % Before this section, \pagetotal is less than \pagegoal, so no
5834   % break occurs before the last section starts.  However, the last
5835   % section, consisting of \initial and the single \entry, does not
5836   % fit on the page and has to be broken off.  Without the following
5837   % penalty the page builder will not be exercised until \eject
5838   % below, and by that time we'll already have changed the output
5839   % routine to the \balancecolumns version, so the next-to-last
5840   % double-column page will be processed with \balancecolumns, which
5841   % is wrong:  The two columns will go to the main vertical list, with
5842   % the broken-off section in the recent contributions.  As soon as
5843   % the output routine finishes, TeX starts reconsidering the page
5844   % break.  The two columns and the broken-off section both fit on the
5845   % page, because the two columns now take up only half of the page
5846   % goal.  When TeX sees \eject from below which follows the final
5847   % section, it invokes the new output routine that we've set after
5848   % \balancecolumns below; \onepageout will try to fit the two columns
5849   % and the final section into the vbox of \txipageheight (see
5850   % \pagebody), causing an overfull box.
5851   %
5852   % Note that glue won't work here, because glue does not exercise the
5853   % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5854   \penalty0
5855   %
5856   \output = {%
5857     % Split the last of the double-column material.
5858     \savetopmark
5859     \balancecolumns
5860   }%
5861   \eject % call the \output just set
5862   \ifdim\pagetotal=0pt
5863     % Having called \balancecolumns once, we do not
5864     % want to call it again.  Therefore, reset \output to its normal
5865     % definition right away.
5866     \global\output=\expandafter{\the\defaultoutput}
5867     %
5868     \endgroup % started in \begindoublecolumns
5869     % Leave the double-column material on the current page, no automatic
5870     % page break.
5871     \box\balancedcolumns
5872     %
5873     % \pagegoal was set to the doubled \vsize above, since we restarted
5874     % the current page.  We're now back to normal single-column
5875     % typesetting, so reset \pagegoal to the normal \vsize.
5876     \global\vsize = \txipageheight %
5877     \pagegoal = \txipageheight %
5878   \else
5879     % We had some left-over material.  This might happen when \doublecolumnout
5880     % is called in \balancecolumns.  Try again.
5881     \expandafter\enddoublecolumns
5882   \fi
5883 }
5884 \newbox\balancedcolumns
5885 \setbox\balancedcolumns=\vbox{shouldnt see this}%
5886 %
5887 % Only called for the last of the double column material.  \doublecolumnout 
5888 % does the others.
5889 \def\balancecolumns{%
5890   \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
5891   \dimen@ = \ht0
5892   \ifdim\dimen@<7\baselineskip
5893     % Don't split a short final column in two.
5894     \setbox2=\vbox{}%
5895     \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5896   \else
5897     % double the leading vertical space
5898     \advance\dimen@ by \topskip
5899     \advance\dimen@ by-\baselineskip
5900     \divide\dimen@ by 2 % target to split to
5901     \dimen@ii = \dimen@
5902     \splittopskip = \topskip
5903     % Loop until left column is at least as high as the right column.
5904     {%
5905       \vbadness = 10000
5906       \loop
5907         \global\setbox3 = \copy0
5908         \global\setbox1 = \vsplit3 to \dimen@
5909       \ifdim\ht1<\ht3
5910         \global\advance\dimen@ by 1pt
5911       \repeat
5912     }%
5913     % Now the left column is in box 1, and the right column in box 3.
5914     %
5915     % Check whether the left column has come out higher than the page itself.  
5916     % (Note that we have doubled \vsize for the double columns, so
5917     % the actual height of the page is 0.5\vsize).
5918     \ifdim2\ht1>\vsize
5919       % It appears that we have been called upon to balance too much material.
5920       % Output some of it with \doublecolumnout, leaving the rest on the page.
5921       \setbox\PAGE=\box0
5922       \doublecolumnout
5923     \else
5924       % Compare the heights of the two columns.
5925       \ifdim4\ht1>5\ht3
5926         % Column heights are too different, so don't make their bottoms
5927         % flush with each other.
5928         \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
5929         \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
5930       \else
5931         % Make column bottoms flush with each other.
5932         \setbox2=\vbox to\ht1{\unvbox3\unskip}%
5933         \setbox0=\vbox to\ht1{\unvbox1\unskip}%
5934       \fi
5935       \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5936     \fi
5937   \fi
5938   %
5939 }
5940 \catcode`\@ = \other
5941
5942
5943 \message{sectioning,}
5944 % Chapters, sections, etc.
5945
5946 % Let's start with @part.
5947 \parseargdef\part{\partzzz{#1}}
5948 \def\partzzz#1{%
5949   \chapoddpage
5950   \null
5951   \vskip.3\vsize  % move it down on the page a bit
5952   \begingroup
5953     \noindent \titlefonts\rm #1\par % the text
5954     \let\lastnode=\empty      % no node to associate with
5955     \writetocentry{part}{#1}{}% but put it in the toc
5956     \headingsoff              % no headline or footline on the part page
5957     % This outputs a mark at the end of the page that clears \thischapter
5958     % and \thissection, as is done in \startcontents.
5959     \let\pchapsepmacro\relax
5960     \chapmacro{}{Yomitfromtoc}{}%
5961     \chapoddpage
5962   \endgroup
5963 }
5964
5965 % \unnumberedno is an oxymoron.  But we count the unnumbered
5966 % sections so that we can refer to them unambiguously in the pdf
5967 % outlines by their "section number".  We avoid collisions with chapter
5968 % numbers by starting them at 10000.  (If a document ever has 10000
5969 % chapters, we're in trouble anyway, I'm sure.)
5970 \newcount\unnumberedno \unnumberedno = 10000
5971 \newcount\chapno
5972 \newcount\secno        \secno=0
5973 \newcount\subsecno     \subsecno=0
5974 \newcount\subsubsecno  \subsubsecno=0
5975
5976 % This counter is funny since it counts through charcodes of letters A, B, ...
5977 \newcount\appendixno  \appendixno = `\@
5978 %
5979 % \def\appendixletter{\char\the\appendixno}
5980 % We do the following ugly conditional instead of the above simple
5981 % construct for the sake of pdftex, which needs the actual
5982 % letter in the expansion, not just typeset.
5983 %
5984 \def\appendixletter{%
5985   \ifnum\appendixno=`A A%
5986   \else\ifnum\appendixno=`B B%
5987   \else\ifnum\appendixno=`C C%
5988   \else\ifnum\appendixno=`D D%
5989   \else\ifnum\appendixno=`E E%
5990   \else\ifnum\appendixno=`F F%
5991   \else\ifnum\appendixno=`G G%
5992   \else\ifnum\appendixno=`H H%
5993   \else\ifnum\appendixno=`I I%
5994   \else\ifnum\appendixno=`J J%
5995   \else\ifnum\appendixno=`K K%
5996   \else\ifnum\appendixno=`L L%
5997   \else\ifnum\appendixno=`M M%
5998   \else\ifnum\appendixno=`N N%
5999   \else\ifnum\appendixno=`O O%
6000   \else\ifnum\appendixno=`P P%
6001   \else\ifnum\appendixno=`Q Q%
6002   \else\ifnum\appendixno=`R R%
6003   \else\ifnum\appendixno=`S S%
6004   \else\ifnum\appendixno=`T T%
6005   \else\ifnum\appendixno=`U U%
6006   \else\ifnum\appendixno=`V V%
6007   \else\ifnum\appendixno=`W W%
6008   \else\ifnum\appendixno=`X X%
6009   \else\ifnum\appendixno=`Y Y%
6010   \else\ifnum\appendixno=`Z Z%
6011   % The \the is necessary, despite appearances, because \appendixletter is
6012   % expanded while writing the .toc file.  \char\appendixno is not
6013   % expandable, thus it is written literally, thus all appendixes come out
6014   % with the same letter (or @) in the toc without it.
6015   \else\char\the\appendixno
6016   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6017   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6018
6019 % Each @chapter defines these (using marks) as the number+name, number
6020 % and name of the chapter.  Page headings and footings can use
6021 % these.  @section does likewise.
6022 \def\thischapter{}
6023 \def\thischapternum{}
6024 \def\thischaptername{}
6025 \def\thissection{}
6026 \def\thissectionnum{}
6027 \def\thissectionname{}
6028
6029 \newcount\absseclevel % used to calculate proper heading level
6030 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6031
6032 % @raisesections: treat @section as chapter, @subsection as section, etc.
6033 \def\raisesections{\global\advance\secbase by -1}
6034
6035 % @lowersections: treat @chapter as section, @section as subsection, etc.
6036 \def\lowersections{\global\advance\secbase by 1}
6037
6038 % we only have subsub.
6039 \chardef\maxseclevel = 3
6040 %
6041 % A numbered section within an unnumbered changes to unnumbered too.
6042 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
6043 \chardef\unnlevel = \maxseclevel
6044 %
6045 % Trace whether the current chapter is an appendix or not:
6046 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6047 \def\chapheadtype{N}
6048
6049 % Choose a heading macro
6050 % #1 is heading type
6051 % #2 is heading level
6052 % #3 is text for heading
6053 \def\genhead#1#2#3{%
6054   % Compute the abs. sec. level:
6055   \absseclevel=#2
6056   \advance\absseclevel by \secbase
6057   % Make sure \absseclevel doesn't fall outside the range:
6058   \ifnum \absseclevel < 0
6059     \absseclevel = 0
6060   \else
6061     \ifnum \absseclevel > 3
6062       \absseclevel = 3
6063     \fi
6064   \fi
6065   % The heading type:
6066   \def\headtype{#1}%
6067   \if \headtype U%
6068     \ifnum \absseclevel < \unnlevel
6069       \chardef\unnlevel = \absseclevel
6070     \fi
6071   \else
6072     % Check for appendix sections:
6073     \ifnum \absseclevel = 0
6074       \edef\chapheadtype{\headtype}%
6075     \else
6076       \if \headtype A\if \chapheadtype N%
6077         \errmessage{@appendix... within a non-appendix chapter}%
6078       \fi\fi
6079     \fi
6080     % Check for numbered within unnumbered:
6081     \ifnum \absseclevel > \unnlevel
6082       \def\headtype{U}%
6083     \else
6084       \chardef\unnlevel = 3
6085     \fi
6086   \fi
6087   % Now print the heading:
6088   \if \headtype U%
6089     \ifcase\absseclevel
6090         \unnumberedzzz{#3}%
6091     \or \unnumberedseczzz{#3}%
6092     \or \unnumberedsubseczzz{#3}%
6093     \or \unnumberedsubsubseczzz{#3}%
6094     \fi
6095   \else
6096     \if \headtype A%
6097       \ifcase\absseclevel
6098           \appendixzzz{#3}%
6099       \or \appendixsectionzzz{#3}%
6100       \or \appendixsubseczzz{#3}%
6101       \or \appendixsubsubseczzz{#3}%
6102       \fi
6103     \else
6104       \ifcase\absseclevel
6105           \chapterzzz{#3}%
6106       \or \seczzz{#3}%
6107       \or \numberedsubseczzz{#3}%
6108       \or \numberedsubsubseczzz{#3}%
6109       \fi
6110     \fi
6111   \fi
6112   \suppressfirstparagraphindent
6113 }
6114
6115 % an interface:
6116 \def\numhead{\genhead N}
6117 \def\apphead{\genhead A}
6118 \def\unnmhead{\genhead U}
6119
6120 % @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
6121 % all lower-level sectioning counters to zero.
6122 %
6123 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
6124 % (e.g., figures), q.v.  By default (before any chapter), that is empty.
6125 \let\chaplevelprefix = \empty
6126 %
6127 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6128 \def\chapterzzz#1{%
6129   % section resetting is \global in case the chapter is in a group, such
6130   % as an @include file.
6131   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6132     \global\advance\chapno by 1
6133   %
6134   % Used for \float.
6135   \gdef\chaplevelprefix{\the\chapno.}%
6136   \resetallfloatnos
6137   %
6138   % \putwordChapter can contain complex things in translations.
6139   \toks0=\expandafter{\putwordChapter}%
6140   \message{\the\toks0 \space \the\chapno}%
6141   %
6142   % Write the actual heading.
6143   \chapmacro{#1}{Ynumbered}{\the\chapno}%
6144   %
6145   % So @section and the like are numbered underneath this chapter.
6146   \global\let\section = \numberedsec
6147   \global\let\subsection = \numberedsubsec
6148   \global\let\subsubsection = \numberedsubsubsec
6149 }
6150
6151 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6152 %
6153 \def\appendixzzz#1{%
6154   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6155     \global\advance\appendixno by 1
6156   \gdef\chaplevelprefix{\appendixletter.}%
6157   \resetallfloatnos
6158   %
6159   % \putwordAppendix can contain complex things in translations.
6160   \toks0=\expandafter{\putwordAppendix}%
6161   \message{\the\toks0 \space \appendixletter}%
6162   %
6163   \chapmacro{#1}{Yappendix}{\appendixletter}%
6164   %
6165   \global\let\section = \appendixsec
6166   \global\let\subsection = \appendixsubsec
6167   \global\let\subsubsection = \appendixsubsubsec
6168 }
6169
6170 % normally unnmhead0 calls unnumberedzzz:
6171 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
6172 \def\unnumberedzzz#1{%
6173   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6174     \global\advance\unnumberedno by 1
6175   %
6176   % Since an unnumbered has no number, no prefix for figures.
6177   \global\let\chaplevelprefix = \empty
6178   \resetallfloatnos
6179   %
6180   % This used to be simply \message{#1}, but TeX fully expands the
6181   % argument to \message.  Therefore, if #1 contained @-commands, TeX
6182   % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
6183   % expanded @cite (which turns out to cause errors because \cite is meant
6184   % to be executed, not expanded).
6185   %
6186   % Anyway, we don't want the fully-expanded definition of @cite to appear
6187   % as a result of the \message, we just want `@cite' itself.  We use
6188   % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6189   % simply yielding the contents of <toks register>.  (We also do this for
6190   % the toc entries.)
6191   \toks0 = {#1}%
6192   \message{(\the\toks0)}%
6193   %
6194   \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6195   %
6196   \global\let\section = \unnumberedsec
6197   \global\let\subsection = \unnumberedsubsec
6198   \global\let\subsubsection = \unnumberedsubsubsec
6199 }
6200
6201 % @centerchap is like @unnumbered, but the heading is centered.
6202 \outer\parseargdef\centerchap{%
6203   \let\centerparametersmaybe = \centerparameters
6204   \unnmhead0{#1}%
6205   \let\centerparametersmaybe = \relax
6206 }
6207
6208 % @top is like @unnumbered.
6209 \let\top\unnumbered
6210
6211 % Sections.
6212
6213 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6214 \def\seczzz#1{%
6215   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
6216   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6217 }
6218
6219 % normally calls appendixsectionzzz:
6220 \outer\parseargdef\appendixsection{\apphead1{#1}}
6221 \def\appendixsectionzzz#1{%
6222   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
6223   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6224 }
6225 \let\appendixsec\appendixsection
6226
6227 % normally calls unnumberedseczzz:
6228 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6229 \def\unnumberedseczzz#1{%
6230   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
6231   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6232 }
6233
6234 % Subsections.
6235
6236 % normally calls numberedsubseczzz:
6237 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6238 \def\numberedsubseczzz#1{%
6239   \global\subsubsecno=0  \global\advance\subsecno by 1
6240   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6241 }
6242
6243 % normally calls appendixsubseczzz:
6244 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6245 \def\appendixsubseczzz#1{%
6246   \global\subsubsecno=0  \global\advance\subsecno by 1
6247   \sectionheading{#1}{subsec}{Yappendix}%
6248                  {\appendixletter.\the\secno.\the\subsecno}%
6249 }
6250
6251 % normally calls unnumberedsubseczzz:
6252 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6253 \def\unnumberedsubseczzz#1{%
6254   \global\subsubsecno=0  \global\advance\subsecno by 1
6255   \sectionheading{#1}{subsec}{Ynothing}%
6256                  {\the\unnumberedno.\the\secno.\the\subsecno}%
6257 }
6258
6259 % Subsubsections.
6260
6261 % normally numberedsubsubseczzz:
6262 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6263 \def\numberedsubsubseczzz#1{%
6264   \global\advance\subsubsecno by 1
6265   \sectionheading{#1}{subsubsec}{Ynumbered}%
6266                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6267 }
6268
6269 % normally appendixsubsubseczzz:
6270 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6271 \def\appendixsubsubseczzz#1{%
6272   \global\advance\subsubsecno by 1
6273   \sectionheading{#1}{subsubsec}{Yappendix}%
6274                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6275 }
6276
6277 % normally unnumberedsubsubseczzz:
6278 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6279 \def\unnumberedsubsubseczzz#1{%
6280   \global\advance\subsubsecno by 1
6281   \sectionheading{#1}{subsubsec}{Ynothing}%
6282                  {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6283 }
6284
6285 % These macros control what the section commands do, according
6286 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6287 % Define them by default for a numbered chapter.
6288 \let\section = \numberedsec
6289 \let\subsection = \numberedsubsec
6290 \let\subsubsection = \numberedsubsubsec
6291
6292 % Define @majorheading, @heading and @subheading
6293
6294 \def\majorheading{%
6295   {\advance\chapheadingskip by 10pt \chapbreak }%
6296   \parsearg\chapheadingzzz
6297 }
6298
6299 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6300 \def\chapheadingzzz#1{%
6301   \vbox{\chapfonts \raggedtitlesettings #1\par}%
6302   \nobreak\bigskip \nobreak
6303   \suppressfirstparagraphindent
6304 }
6305
6306 % @heading, @subheading, @subsubheading.
6307 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6308   \suppressfirstparagraphindent}
6309 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6310   \suppressfirstparagraphindent}
6311 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6312   \suppressfirstparagraphindent}
6313
6314 % These macros generate a chapter, section, etc. heading only
6315 % (including whitespace, linebreaking, etc. around it),
6316 % given all the information in convenient, parsed form.
6317
6318 % Args are the skip and penalty (usually negative)
6319 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6320
6321 % Parameter controlling skip before chapter headings (if needed)
6322 \newskip\chapheadingskip
6323
6324 % Define plain chapter starts, and page on/off switching for it.
6325 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6326
6327 % Start a new page
6328 \def\chappager{\par\vfill\supereject}
6329
6330 % \chapoddpage - start on an odd page for a new chapter
6331 % Because \domark is called before \chapoddpage, the filler page will
6332 % get the headings for the next chapter, which is wrong.  But we don't
6333 % care -- we just disable all headings on the filler page.
6334 \def\chapoddpage{%
6335   \chappager
6336   \ifodd\pageno \else
6337     \begingroup
6338       \headingsoff
6339       \null
6340       \chappager
6341     \endgroup
6342   \fi
6343 }
6344
6345 \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname\HEADINGSon}
6346
6347 \def\CHAPPAGoff{%
6348 \global\let\contentsalignmacro = \chappager
6349 \global\let\pchapsepmacro=\chapbreak
6350 \global\def\HEADINGSon{\HEADINGSsinglechapoff}}
6351
6352 \def\CHAPPAGon{%
6353 \global\let\contentsalignmacro = \chappager
6354 \global\let\pchapsepmacro=\chappager
6355 \global\def\HEADINGSon{\HEADINGSsingle}}
6356
6357 \def\CHAPPAGodd{%
6358 \global\let\contentsalignmacro = \chapoddpage
6359 \global\let\pchapsepmacro=\chapoddpage
6360 \global\def\HEADINGSon{\HEADINGSdouble}}
6361
6362 \setchapternewpage on
6363
6364 % \chapmacro - Chapter opening.
6365 %
6366 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6367 % Yappendix, Yomitfromtoc), #3 the chapter number.
6368 % Not used for @heading series.
6369 %
6370 % To test against our argument.
6371 \def\Ynothingkeyword{Ynothing}
6372 \def\Yappendixkeyword{Yappendix}
6373 \def\Yomitfromtockeyword{Yomitfromtoc}
6374 %
6375 %
6376 % Definitions for @thischapter. These can be overridden in translation
6377 % files.
6378 \def\thischapterAppendix{%
6379   \putwordAppendix{} \thischapternum: \thischaptername}
6380
6381 \def\thischapterChapter{%
6382   \putwordChapter{} \thischapternum: \thischaptername}
6383 %
6384 %
6385 \def\chapmacro#1#2#3{%
6386   \expandafter\ifx\thisenv\titlepage\else
6387     \checkenv{}% chapters, etc., should not start inside an environment.
6388   \fi
6389   % Insert the first mark before the heading break (see notes for \domark).
6390   \let\prevchapterdefs=\currentchapterdefs
6391   \let\prevsectiondefs=\currentsectiondefs
6392   \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6393                         \gdef\thissection{}}%
6394   %
6395   \def\temptype{#2}%
6396   \ifx\temptype\Ynothingkeyword
6397     \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6398                           \gdef\thischapter{\thischaptername}}%
6399   \else\ifx\temptype\Yomitfromtockeyword
6400     \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6401                           \gdef\thischapter{}}%
6402   \else\ifx\temptype\Yappendixkeyword
6403     \toks0={#1}%
6404     \xdef\currentchapterdefs{%
6405       \gdef\noexpand\thischaptername{\the\toks0}%
6406       \gdef\noexpand\thischapternum{\appendixletter}%
6407       \let\noexpand\thischapter\noexpand\thischapterAppendix
6408     }%
6409   \else
6410     \toks0={#1}%
6411     \xdef\currentchapterdefs{%
6412       \gdef\noexpand\thischaptername{\the\toks0}%
6413       \gdef\noexpand\thischapternum{\the\chapno}%
6414       \let\noexpand\thischapter\noexpand\thischapterChapter
6415     }%
6416   \fi\fi\fi
6417   %
6418   % Output the mark.  Pass it through \safewhatsit, to take care of
6419   % the preceding space.
6420   \safewhatsit\domark
6421   %
6422   % Insert the chapter heading break.
6423   \pchapsepmacro
6424   %
6425   % Now the second mark, after the heading break.  No break points
6426   % between here and the heading.
6427   \let\prevchapterdefs=\currentchapterdefs
6428   \let\prevsectiondefs=\currentsectiondefs
6429   \domark
6430   %
6431   {%
6432     \chapfonts \rm
6433     \let\footnote=\errfootnoteheading % give better error message
6434     %
6435     % Have to define \currentsection before calling \donoderef, because the
6436     % xref code eventually uses it.  On the other hand, it has to be called
6437     % after \pchapsepmacro, or the headline will change too soon.
6438     \gdef\currentsection{#1}%
6439     %
6440     % Only insert the separating space if we have a chapter/appendix
6441     % number, and don't print the unnumbered ``number''.
6442     \ifx\temptype\Ynothingkeyword
6443       \setbox0 = \hbox{}%
6444       \def\toctype{unnchap}%
6445     \else\ifx\temptype\Yomitfromtockeyword
6446       \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6447       \def\toctype{omit}%
6448     \else\ifx\temptype\Yappendixkeyword
6449       \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6450       \def\toctype{app}%
6451     \else
6452       \setbox0 = \hbox{#3\enspace}%
6453       \def\toctype{numchap}%
6454     \fi\fi\fi
6455     %
6456     % Write the toc entry for this chapter.  Must come before the
6457     % \donoderef, because we include the current node name in the toc
6458     % entry, and \donoderef resets it to empty.
6459     \writetocentry{\toctype}{#1}{#3}%
6460     %
6461     % For pdftex, we have to write out the node definition (aka, make
6462     % the pdfdest) after any page break, but before the actual text has
6463     % been typeset.  If the destination for the pdf outline is after the
6464     % text, then jumping from the outline may wind up with the text not
6465     % being visible, for instance under high magnification.
6466     \donoderef{#2}%
6467     %
6468     % Typeset the actual heading.
6469     \nobreak % Avoid page breaks at the interline glue.
6470     \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6471           \unhbox0 #1\par}%
6472   }%
6473   \nobreak\bigskip % no page break after a chapter title
6474   \nobreak
6475 }
6476
6477 % @centerchap -- centered and unnumbered.
6478 \let\centerparametersmaybe = \relax
6479 \def\centerparameters{%
6480   \advance\rightskip by 3\rightskip
6481   \leftskip = \rightskip
6482   \parfillskip = 0pt
6483 }
6484
6485
6486 % Section titles.  These macros combine the section number parts and
6487 % call the generic \sectionheading to do the printing.
6488 %
6489 \newskip\secheadingskip
6490 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6491
6492 % Subsection titles.
6493 \newskip\subsecheadingskip
6494 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6495
6496 % Subsubsection titles.
6497 \def\subsubsecheadingskip{\subsecheadingskip}
6498 \def\subsubsecheadingbreak{\subsecheadingbreak}
6499
6500 % Definition for @thissection. This can be overridden in translation
6501 % files.
6502 \def\thissectionDef{%
6503   \putwordSection{} \thissectionnum: \thissectionname}
6504 %
6505
6506
6507 % Print any size, any type, section title.
6508 %
6509 % #1 is the text of the title,
6510 % #2 is the section level (sec/subsec/subsubsec),
6511 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6512 % #4 is the section number.
6513 %
6514 \def\seckeyword{sec}
6515 %
6516 \def\sectionheading#1#2#3#4{%
6517   {%
6518     \def\sectionlevel{#2}%
6519     \def\temptype{#3}%
6520     %
6521     % It is ok for the @heading series commands to appear inside an
6522     % environment (it's been historically allowed, though the logic is
6523     % dubious), but not the others.
6524     \ifx\temptype\Yomitfromtockeyword\else
6525       \checkenv{}% non-@*heading should not be in an environment.
6526     \fi
6527     \let\footnote=\errfootnoteheading
6528     %
6529     % Switch to the right set of fonts.
6530     \csname #2fonts\endcsname \rm
6531     %
6532     % Insert first mark before the heading break (see notes for \domark).
6533     \let\prevsectiondefs=\currentsectiondefs
6534     \ifx\temptype\Ynothingkeyword
6535       \ifx\sectionlevel\seckeyword
6536         \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6537                               \gdef\thissection{\thissectionname}}%
6538       \fi
6539     \else\ifx\temptype\Yomitfromtockeyword
6540       % Don't redefine \thissection.
6541     \else\ifx\temptype\Yappendixkeyword
6542       \ifx\sectionlevel\seckeyword
6543         \toks0={#1}%
6544         \xdef\currentsectiondefs{%
6545           \gdef\noexpand\thissectionname{\the\toks0}%
6546           \gdef\noexpand\thissectionnum{#4}%
6547           \let\noexpand\thissection\noexpand\thissectionDef
6548         }%
6549       \fi
6550     \else
6551       \ifx\sectionlevel\seckeyword
6552         \toks0={#1}%
6553         \xdef\currentsectiondefs{%
6554           \gdef\noexpand\thissectionname{\the\toks0}%
6555           \gdef\noexpand\thissectionnum{#4}%
6556           \let\noexpand\thissection\noexpand\thissectionDef
6557         }%
6558       \fi
6559     \fi\fi\fi
6560     %
6561     % Go into vertical mode.  Usually we'll already be there, but we
6562     % don't want the following whatsit to end up in a preceding paragraph
6563     % if the document didn't happen to have a blank line.
6564     \par
6565     %
6566     % Output the mark.  Pass it through \safewhatsit, to take care of
6567     % the preceding space.
6568     \safewhatsit\domark
6569     %
6570     % Insert space above the heading.
6571     \csname #2headingbreak\endcsname
6572     %
6573     % Now the second mark, after the heading break.  No break points
6574     % between here and the heading.
6575     \global\let\prevsectiondefs=\currentsectiondefs
6576     \domark
6577     %
6578     % Only insert the space after the number if we have a section number.
6579     \ifx\temptype\Ynothingkeyword
6580       \setbox0 = \hbox{}%
6581       \def\toctype{unn}%
6582       \gdef\currentsection{#1}%
6583     \else\ifx\temptype\Yomitfromtockeyword
6584       % for @headings -- no section number, don't include in toc,
6585       % and don't redefine \currentsection.
6586       \setbox0 = \hbox{}%
6587       \def\toctype{omit}%
6588       \let\sectionlevel=\empty
6589     \else\ifx\temptype\Yappendixkeyword
6590       \setbox0 = \hbox{#4\enspace}%
6591       \def\toctype{app}%
6592       \gdef\currentsection{#1}%
6593     \else
6594       \setbox0 = \hbox{#4\enspace}%
6595       \def\toctype{num}%
6596       \gdef\currentsection{#1}%
6597     \fi\fi\fi
6598     %
6599     % Write the toc entry (before \donoderef).  See comments in \chapmacro.
6600     \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6601     %
6602     % Write the node reference (= pdf destination for pdftex).
6603     % Again, see comments in \chapmacro.
6604     \donoderef{#3}%
6605     %
6606     % Interline glue will be inserted when the vbox is completed.
6607     % That glue will be a valid breakpoint for the page, since it'll be
6608     % preceded by a whatsit (usually from the \donoderef, or from the
6609     % \writetocentry if there was no node).  We don't want to allow that
6610     % break, since then the whatsits could end up on page n while the
6611     % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
6612     \nobreak
6613     %
6614     % Output the actual section heading.
6615     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6616           \hangindent=\wd0  % zero if no section number
6617           \unhbox0 #1}%
6618   }%
6619   % Add extra space after the heading -- half of whatever came above it.
6620   % Don't allow stretch, though.
6621   \kern .5 \csname #2headingskip\endcsname
6622   %
6623   % Do not let the kern be a potential breakpoint, as it would be if it
6624   % was followed by glue.
6625   \nobreak
6626   %
6627   % We'll almost certainly start a paragraph next, so don't let that
6628   % glue accumulate.  (Not a breakpoint because it's preceded by a
6629   % discardable item.)  However, when a paragraph is not started next
6630   % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6631   % or the negative glue will cause weirdly wrong output, typically
6632   % obscuring the section heading with something else.
6633   \vskip-\parskip
6634   %
6635   % This is so the last item on the main vertical list is a known
6636   % \penalty > 10000, so \startdefun, etc., can recognize the situation
6637   % and do the needful.
6638   \penalty 10001
6639 }
6640
6641
6642 \message{toc,}
6643 % Table of contents.
6644 \newwrite\tocfile
6645
6646 % Write an entry to the toc file, opening it if necessary.
6647 % Called from @chapter, etc.
6648 %
6649 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6650 % We append the current node name (if any) and page number as additional
6651 % arguments for the \{chap,sec,...}entry macros which will eventually
6652 % read this.  The node name is used in the pdf outlines as the
6653 % destination to jump to.
6654 %
6655 % We open the .toc file for writing here instead of at @setfilename (or
6656 % any other fixed time) so that @contents can be anywhere in the document.
6657 % But if #1 is `omit', then we don't do anything.  This is used for the
6658 % table of contents chapter openings themselves.
6659 %
6660 \newif\iftocfileopened
6661 \def\omitkeyword{omit}%
6662 %
6663 \def\writetocentry#1#2#3{%
6664   \edef\writetoctype{#1}%
6665   \ifx\writetoctype\omitkeyword \else
6666     \iftocfileopened\else
6667       \immediate\openout\tocfile = \jobname.toc
6668       \global\tocfileopenedtrue
6669     \fi
6670     %
6671     \iflinks
6672       {\atdummies
6673        \edef\temp{%
6674          \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6675        \temp
6676       }%
6677     \fi
6678   \fi
6679   %
6680   % Tell \shipout to create a pdf destination on each page, if we're
6681   % writing pdf.  These are used in the table of contents.  We can't
6682   % just write one on every page because the title pages are numbered
6683   % 1 and 2 (the page numbers aren't printed), and so are the first
6684   % two pages of the document.  Thus, we'd have two destinations named
6685   % `1', and two named `2'.
6686   \ifpdforxetex
6687     \global\pdfmakepagedesttrue
6688   \fi
6689 }
6690
6691
6692 % These characters do not print properly in the Computer Modern roman
6693 % fonts, so we must take special care.  This is more or less redundant
6694 % with the Texinfo input format setup at the end of this file.
6695 %
6696 \def\activecatcodes{%
6697   \catcode`\"=\active
6698   \catcode`\$=\active
6699   \catcode`\<=\active
6700   \catcode`\>=\active
6701   \catcode`\\=\active
6702   \catcode`\^=\active
6703   \catcode`\_=\active
6704   \catcode`\|=\active
6705   \catcode`\~=\active
6706 }
6707
6708
6709 % Read the toc file, which is essentially Texinfo input.
6710 \def\readtocfile{%
6711   \setupdatafile
6712   \activecatcodes
6713   \input \tocreadfilename
6714 }
6715
6716 \newskip\contentsrightmargin \contentsrightmargin=1in
6717 \newcount\savepageno
6718 \newcount\lastnegativepageno \lastnegativepageno = -1
6719
6720 % Prepare to read what we've written to \tocfile.
6721 %
6722 \def\startcontents#1{%
6723   % If @setchapternewpage on, and @headings double, the contents should
6724   % start on an odd page, unlike chapters.
6725   \contentsalignmacro
6726   \immediate\closeout\tocfile
6727   %
6728   % Don't need to put `Contents' or `Short Contents' in the headline.
6729   % It is abundantly clear what they are.
6730   \chapmacro{#1}{Yomitfromtoc}{}%
6731   %
6732   \savepageno = \pageno
6733   \begingroup                  % Set up to handle contents files properly.
6734     \raggedbottom              % Worry more about breakpoints than the bottom.
6735     \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6736     %
6737     % Roman numerals for page numbers.
6738     \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6739     \def\thistitle{}% no title in double-sided headings
6740     % Record where the Roman numerals started.
6741     \ifnum\romancount=0 \global\romancount=\pagecount \fi
6742     \linkentrytexttrue
6743 }
6744
6745 % \raggedbottom in plain.tex hardcodes \topskip so override it
6746 \catcode`\@=11
6747 \def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue}
6748 \catcode`\@=\other
6749
6750 % redefined for the two-volume lispref.  We always output on
6751 % \jobname.toc even if this is redefined.
6752 %
6753 \def\tocreadfilename{\jobname.toc}
6754
6755 % Normal (long) toc.
6756 %
6757 \def\contents{%
6758   \startcontents{\putwordTOC}%
6759     \openin 1 \tocreadfilename\space
6760     \ifeof 1 \else
6761       \readtocfile
6762     \fi
6763     \vfill \eject
6764     \contentsalignmacro % in case @setchapternewpage odd is in effect
6765     \ifeof 1 \else
6766       \pdfmakeoutlines
6767     \fi
6768     \closein 1
6769   \endgroup
6770   \contentsendroman
6771 }
6772
6773 % And just the chapters.
6774 \def\summarycontents{%
6775   \startcontents{\putwordShortTOC}%
6776     %
6777     \let\partentry = \shortpartentry
6778     \let\numchapentry = \shortchapentry
6779     \let\appentry = \shortchapentry
6780     \let\unnchapentry = \shortunnchapentry
6781     % We want a true roman here for the page numbers.
6782     \secfonts
6783     \let\rm=\shortcontrm \let\bf=\shortcontbf
6784     \let\sl=\shortcontsl \let\tt=\shortconttt
6785     \rm
6786     \hyphenpenalty = 10000
6787     \advance\baselineskip by 1pt % Open it up a little.
6788     \def\numsecentry##1##2##3##4{}
6789     \let\appsecentry = \numsecentry
6790     \let\unnsecentry = \numsecentry
6791     \let\numsubsecentry = \numsecentry
6792     \let\appsubsecentry = \numsecentry
6793     \let\unnsubsecentry = \numsecentry
6794     \let\numsubsubsecentry = \numsecentry
6795     \let\appsubsubsecentry = \numsecentry
6796     \let\unnsubsubsecentry = \numsecentry
6797     \openin 1 \tocreadfilename\space
6798     \ifeof 1 \else
6799       \readtocfile
6800     \fi
6801     \closein 1
6802     \vfill \eject
6803     \contentsalignmacro % in case @setchapternewpage odd is in effect
6804   \endgroup
6805   \contentsendroman
6806 }
6807 \let\shortcontents = \summarycontents
6808
6809 % Get ready to use Arabic numerals again
6810 \def\contentsendroman{%
6811   \lastnegativepageno = \pageno
6812   \global\pageno = \savepageno
6813   %
6814   % If \romancount > \arabiccount, the contents are at the end of the
6815   % document.  Otherwise, advance where the Arabic numerals start for
6816   % the page numbers.
6817   \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi
6818 }
6819
6820 % Typeset the label for a chapter or appendix for the short contents.
6821 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6822 %
6823 \def\shortchaplabel#1{%
6824   % This space should be enough, since a single number is .5em, and the
6825   % widest letter (M) is 1em, at least in the Computer Modern fonts.
6826   % But use \hss just in case.
6827   % (This space doesn't include the extra space that gets added after
6828   % the label; that gets put in by \shortchapentry above.)
6829   %
6830   % We'd like to right-justify chapter numbers, but that looks strange
6831   % with appendix letters.  And right-justifying numbers and
6832   % left-justifying letters looks strange when there is less than 10
6833   % chapters.  Have to read the whole toc once to know how many chapters
6834   % there are before deciding ...
6835   \hbox to 1em{#1\hss}%
6836 }
6837
6838 % These macros generate individual entries in the table of contents.
6839 % The first argument is the chapter or section name.
6840 % The last argument is the page number.
6841 % The arguments in between are the chapter number, section number, ...
6842
6843 % Parts, in the main contents.  Replace the part number, which doesn't
6844 % exist, with an empty box.  Let's hope all the numbers have the same width.
6845 % Also ignore the page number, which is conventionally not printed.
6846 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6847 \def\partentry#1#2#3#4{%
6848   % Add stretch and a bonus for breaking the page before the part heading.
6849   % This reduces the chance of the page being broken immediately after the
6850   % part heading, before a following chapter heading.
6851   \vskip 0pt plus 5\baselineskip
6852   \penalty-300
6853   \vskip 0pt plus -5\baselineskip
6854   \dochapentry{\numeralbox\labelspace#1}{}%
6855 }
6856 %
6857 % Parts, in the short toc.
6858 \def\shortpartentry#1#2#3#4{%
6859   \penalty-300
6860   \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6861   \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6862 }
6863
6864 % Chapters, in the main contents.
6865 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6866
6867 % Chapters, in the short toc.
6868 % See comments in \dochapentry re vbox and related settings.
6869 \def\shortchapentry#1#2#3#4{%
6870   \tocentry{\shortchaplabel{#2}\labelspace #1}{#4}%
6871 }
6872
6873 % Appendices, in the main contents.
6874 % Need the word Appendix, and a fixed-size box.
6875 %
6876 \def\appendixbox#1{%
6877   % We use M since it's probably the widest letter.
6878   \setbox0 = \hbox{\putwordAppendix{} M}%
6879   \hbox to \wd0{\putwordAppendix{} #1\hss}}
6880 %
6881 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6882
6883 % Unnumbered chapters.
6884 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6885 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{#4}}
6886
6887 % Sections.
6888 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6889 \let\appsecentry=\numsecentry
6890 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6891
6892 % Subsections.
6893 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6894 \let\appsubsecentry=\numsubsecentry
6895 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6896
6897 % And subsubsections.
6898 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6899 \let\appsubsubsecentry=\numsubsubsecentry
6900 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6901
6902 % This parameter controls the indentation of the various levels.
6903 % Same as \defaultparindent.
6904 \newdimen\tocindent \tocindent = 15pt
6905
6906 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6907 % page number.
6908 %
6909 % If the toc has to be broken over pages, we want it to be at chapters
6910 % if at all possible; hence the \penalty.
6911 \def\dochapentry#1#2{%
6912    \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6913    \begingroup
6914      % Move the page numbers slightly to the right
6915      \advance\entryrightmargin by -0.05em
6916      \chapentryfonts
6917      \tocentry{#1}{#2}%
6918    \endgroup
6919    \nobreak\vskip .25\baselineskip plus.1\baselineskip
6920 }
6921
6922 \def\dosecentry#1#2{\begingroup
6923   \secentryfonts \leftskip=\tocindent
6924   \tocentry{#1}{#2}%
6925 \endgroup}
6926
6927 \def\dosubsecentry#1#2{\begingroup
6928   \subsecentryfonts \leftskip=2\tocindent
6929   \tocentry{#1}{#2}%
6930 \endgroup}
6931
6932 \def\dosubsubsecentry#1#2{\begingroup
6933   \subsubsecentryfonts \leftskip=3\tocindent
6934   \tocentry{#1}{#2}%
6935 \endgroup}
6936
6937 % We use the same \entry macro as for the index entries.
6938 \let\tocentry = \entry
6939
6940 % Space between chapter (or whatever) number and the title.
6941 \def\labelspace{\hskip1em \relax}
6942
6943 \def\chapentryfonts{\secfonts \rm}
6944 \def\secentryfonts{\textfonts}
6945 \def\subsecentryfonts{\textfonts}
6946 \def\subsubsecentryfonts{\textfonts}
6947
6948
6949 \message{environments,}
6950 % @foo ... @end foo.
6951
6952 % @tex ... @end tex    escapes into raw TeX temporarily.
6953 % One exception: @ is still an escape character, so that @end tex works.
6954 % But \@ or @@ will get a plain @ character.
6955
6956 \envdef\tex{%
6957   \setregularquotes
6958   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6959   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6960   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6961   \catcode `\%=14
6962   \catcode `\+=\other
6963   \catcode `\"=\other
6964   \catcode `\|=\other
6965   \catcode `\<=\other
6966   \catcode `\>=\other
6967   \catcode `\`=\other
6968   \catcode `\'=\other
6969   %
6970   % ' is active in math mode (mathcode"8000).  So reset it, and all our
6971   % other math active characters (just in case), to plain's definitions.
6972   \mathactive
6973   %
6974   % Inverse of the list at the beginning of the file.
6975   \let\b=\ptexb
6976   \let\bullet=\ptexbullet
6977   \let\c=\ptexc
6978   \let\,=\ptexcomma
6979   \let\.=\ptexdot
6980   \let\dots=\ptexdots
6981   \let\equiv=\ptexequiv
6982   \let\!=\ptexexclam
6983   \let\i=\ptexi
6984   \let\indent=\ptexindent
6985   \let\noindent=\ptexnoindent
6986   \let\{=\ptexlbrace
6987   \let\+=\tabalign
6988   \let\}=\ptexrbrace
6989   \let\/=\ptexslash
6990   \let\sp=\ptexsp
6991   \let\*=\ptexstar
6992   %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
6993   \let\t=\ptext
6994   \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
6995   \let\frenchspacing=\plainfrenchspacing
6996   %
6997   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
6998   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
6999   \def\@{@}%
7000 }
7001 % There is no need to define \Etex.
7002
7003 % Define @lisp ... @end lisp.
7004 % @lisp environment forms a group so it can rebind things,
7005 % including the definition of @end lisp (which normally is erroneous).
7006
7007 % Amount to narrow the margins by for @lisp.
7008 \newskip\lispnarrowing \lispnarrowing=0.4in
7009
7010 % This is the definition that ^^M gets inside @lisp, @example, and other
7011 % such environments.  \null is better than a space, since it doesn't
7012 % have any width.
7013 \def\lisppar{\null\endgraf}
7014
7015 % This space is always present above and below environments.
7016 \newskip\envskipamount \envskipamount = 0pt
7017
7018 % Make spacing and below environment symmetrical.  We use \parskip here
7019 % to help in doing that, since in @example-like environments \parskip
7020 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7021 % start of the next paragraph will insert \parskip.
7022 %
7023 \def\aboveenvbreak{{%
7024   % =10000 instead of <10000 because of a special case in \itemzzz and
7025   % \sectionheading, q.v.
7026   \ifnum \lastpenalty=10000 \else
7027     \advance\envskipamount by \parskip
7028     \endgraf
7029     \ifdim\lastskip<\envskipamount
7030       \removelastskip
7031       \ifnum\lastpenalty<10000
7032         % Penalize breaking before the environment, because preceding text
7033         % often leads into it.
7034         \penalty100
7035       \fi
7036       \vskip\envskipamount
7037     \fi
7038   \fi
7039 }}
7040
7041 \def\afterenvbreak{{%
7042   % =10000 instead of <10000 because of a special case in \itemzzz and
7043   % \sectionheading, q.v.
7044   \ifnum \lastpenalty=10000 \else
7045     \advance\envskipamount by \parskip
7046     \endgraf
7047     \ifdim\lastskip<\envskipamount
7048       \removelastskip
7049       % it's not a good place to break if the last penalty was \nobreak
7050       % or better ...
7051       \ifnum\lastpenalty<10000 \penalty-50 \fi
7052       \vskip\envskipamount
7053     \fi
7054   \fi
7055 }}
7056
7057 % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
7058 % also clear it, so that its embedded environments do the narrowing again.
7059 \let\nonarrowing=\relax
7060
7061 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7062 % environment contents.
7063
7064 %
7065 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7066 \def\ctr{{\hskip 6pt\circle\char'010}}
7067 \def\cbl{{\circle\char'012\hskip -6pt}}
7068 \def\cbr{{\hskip 6pt\circle\char'011}}
7069 \def\carttop{\hbox to \cartouter{\hskip\lskip
7070         \ctl\leaders\hrule height\circthick\hfil\ctr
7071         \hskip\rskip}}
7072 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7073         \cbl\leaders\hrule height\circthick\hfil\cbr
7074         \hskip\rskip}}
7075 %
7076 \newskip\lskip\newskip\rskip
7077
7078 % only require the font if @cartouche is actually used
7079 \def\cartouchefontdefs{%
7080   \font\circle=lcircle10\relax
7081   \circthick=\fontdimen8\circle
7082 }
7083 \newdimen\circthick
7084 \newdimen\cartouter\newdimen\cartinner
7085 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7086
7087 \envparseargdef\cartouche{%
7088   \cartouchefontdefs
7089   \ifhmode\par\fi  % can't be in the midst of a paragraph.
7090   \startsavinginserts
7091   \lskip=\leftskip \rskip=\rightskip
7092   \leftskip=0pt\rightskip=0pt % we want these *outside*.
7093   %
7094   % Set paragraph width for text inside cartouche.  There are
7095   % left and right margins of 3pt each plus two vrules 0.4pt each.
7096   \cartinner=\hsize \advance\cartinner by-\lskip
7097   \advance\cartinner by-\rskip
7098   \advance\cartinner by -6.8pt
7099   %
7100   % For drawing top and bottom of cartouche.  Each corner char
7101   % adds 6pt and we take off the width of a rule to line up with the
7102   % right boundary perfectly.
7103   \cartouter=\hsize
7104   \advance\cartouter by 11.6pt
7105   %
7106   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7107   %
7108   % If this cartouche directly follows a sectioning command, we need the
7109   % \parskip glue (backspaced over by default) or the cartouche can
7110   % collide with the section heading.
7111   \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7112   %
7113   \setbox\groupbox=\vtop\bgroup
7114       \baselineskip=0pt\parskip=0pt\lineskip=0pt
7115       \carttop
7116       \hbox\bgroup
7117           \hskip\lskip
7118           \vrule\kern3pt
7119           \vbox\bgroup
7120               \hsize=\cartinner
7121               \baselineskip=\normbskip
7122               \lineskip=\normlskip
7123               \parskip=\normpskip
7124               \def\arg{#1}%
7125               \ifx\arg\empty\else
7126                 \centerV{\hfil \bf #1 \hfil}%
7127               \fi
7128               \kern3pt
7129               \vskip -\parskip
7130 }
7131 \def\Ecartouche{%
7132               \ifhmode\par\fi
7133               \kern3pt
7134           \egroup
7135           \kern3pt\vrule
7136           \hskip\rskip
7137       \egroup
7138       \cartbot
7139   \egroup
7140   \addgroupbox
7141   \checkinserts
7142 }
7143
7144
7145 % This macro is called at the beginning of all the @example variants,
7146 % inside a group.
7147 \newdimen\nonfillparindent
7148 \def\nonfillstart{%
7149   \aboveenvbreak
7150   \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7151   \sepspaces % Make spaces be word-separators rather than space tokens.
7152   \let\par = \lisppar % don't ignore blank lines
7153   \obeylines % each line of input is a line of output
7154   \parskip = 0pt
7155   % Turn off paragraph indentation but redefine \indent to emulate
7156   % the normal \indent.
7157   \nonfillparindent=\parindent
7158   \parindent = 0pt
7159   \let\indent\nonfillindent
7160   %
7161   \emergencystretch = 0pt % don't try to avoid overfull boxes
7162   \ifx\nonarrowing\relax
7163     \advance \leftskip by \lispnarrowing
7164     \exdentamount=\lispnarrowing
7165   \else
7166     \let\nonarrowing = \relax
7167   \fi
7168   \let\exdent=\nofillexdent
7169 }
7170
7171 \begingroup
7172 \obeyspaces
7173 % We want to swallow spaces (but not other tokens) after the fake
7174 % @indent in our nonfill-environments, where spaces are normally
7175 % active and set to @tie, resulting in them not being ignored after
7176 % @indent.
7177 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7178 \gdef\nonfillindentcheck{%
7179 \ifx\temp %
7180 \expandafter\nonfillindentgobble%
7181 \else%
7182 \leavevmode\nonfillindentbox%
7183 \fi%
7184 }%
7185 \endgroup
7186 \def\nonfillindentgobble#1{\nonfillindent}
7187 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7188
7189 % If you want all examples etc. small: @set dispenvsize small.
7190 % If you want even small examples the full size: @set dispenvsize nosmall.
7191 % This affects the following displayed environments:
7192 %    @example, @display, @format, @lisp, @verbatim
7193 %
7194 \def\smallword{small}
7195 \def\nosmallword{nosmall}
7196 \let\SETdispenvsize\relax
7197 \def\setnormaldispenv{%
7198   \ifx\SETdispenvsize\smallword
7199     % end paragraph for sake of leading, in case document has no blank
7200     % line.  This is redundant with what happens in \aboveenvbreak, but
7201     % we need to do it before changing the fonts, and it's inconvenient
7202     % to change the fonts afterward.
7203     \ifnum \lastpenalty=10000 \else \endgraf \fi
7204     \smallexamplefonts \rm
7205   \fi
7206 }
7207 \def\setsmalldispenv{%
7208   \ifx\SETdispenvsize\nosmallword
7209   \else
7210     \ifnum \lastpenalty=10000 \else \endgraf \fi
7211     \smallexamplefonts \rm
7212   \fi
7213 }
7214
7215 % We often define two environments, @foo and @smallfoo.
7216 % Let's do it in one command.  #1 is the env name, #2 the definition.
7217 \def\makedispenvdef#1#2{%
7218   \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7219   \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7220   \expandafter\let\csname E#1\endcsname \afterenvbreak
7221   \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7222 }
7223
7224 % Define two environment synonyms (#1 and #2) for an environment.
7225 \def\maketwodispenvdef#1#2#3{%
7226   \makedispenvdef{#1}{#3}%
7227   \makedispenvdef{#2}{#3}%
7228 }
7229 %
7230 % @lisp: indented, narrowed, typewriter font;
7231 % @example: same as @lisp.
7232 %
7233 % @smallexample and @smalllisp: use smaller fonts.
7234 % Originally contributed by Pavel@xerox.
7235 %
7236 \maketwodispenvdef{lisp}{example}{%
7237   \nonfillstart
7238   \tt\setcodequotes
7239   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7240   \parsearg\gobble
7241 }
7242 % @display/@smalldisplay: same as @lisp except keep current font.
7243 %
7244 \makedispenvdef{display}{%
7245   \nonfillstart
7246   \gobble
7247 }
7248
7249 % @format/@smallformat: same as @display except don't narrow margins.
7250 %
7251 \makedispenvdef{format}{%
7252   \let\nonarrowing = t%
7253   \nonfillstart
7254   \gobble
7255 }
7256
7257 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7258 \envdef\flushleft{%
7259   \let\nonarrowing = t%
7260   \nonfillstart
7261   \gobble
7262 }
7263 \let\Eflushleft = \afterenvbreak
7264
7265 % @flushright.
7266 %
7267 \envdef\flushright{%
7268   \let\nonarrowing = t%
7269   \nonfillstart
7270   \advance\leftskip by 0pt plus 1fill\relax
7271   \gobble
7272 }
7273 \let\Eflushright = \afterenvbreak
7274
7275
7276 % @raggedright does more-or-less normal line breaking but no right
7277 % justification.  From plain.tex.
7278 \envdef\raggedright{%
7279   \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7280 }
7281 \let\Eraggedright\par
7282
7283
7284 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7285 % and narrows the margins.  We keep \parskip nonzero in general, since
7286 % we're doing normal filling.  So, when using \aboveenvbreak and
7287 % \afterenvbreak, temporarily make \parskip 0.
7288 %
7289 \makedispenvdef{quotation}{\quotationstart}
7290 %
7291 \def\quotationstart{%
7292   \indentedblockstart % same as \indentedblock, but increase right margin too.
7293   \ifx\nonarrowing\relax
7294     \advance\rightskip by \lispnarrowing
7295   \fi
7296   \parsearg\quotationlabel
7297 }
7298
7299 % We have retained a nonzero parskip for the environment, since we're
7300 % doing normal filling.
7301 %
7302 \def\Equotation{%
7303   \par
7304   \ifx\quotationauthor\thisisundefined\else
7305     % indent a bit.
7306     \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7307   \fi
7308   {\parskip=0pt \afterenvbreak}%
7309 }
7310 \def\Esmallquotation{\Equotation}
7311
7312 % If we're given an argument, typeset it in bold with a colon after.
7313 \def\quotationlabel#1{%
7314   \def\temp{#1}%
7315   \ifx\temp\empty \else
7316     {\bf #1: }%
7317   \fi
7318 }
7319
7320 % @indentedblock is like @quotation, but indents only on the left and
7321 % has no optional argument.
7322
7323 \makedispenvdef{indentedblock}{\indentedblockstart}
7324 %
7325 \def\indentedblockstart{%
7326   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7327   \parindent=0pt
7328   %
7329   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7330   \ifx\nonarrowing\relax
7331     \advance\leftskip by \lispnarrowing
7332     \exdentamount = \lispnarrowing
7333   \else
7334     \let\nonarrowing = \relax
7335   \fi
7336 }
7337
7338 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7339 %
7340 \def\Eindentedblock{%
7341   \par
7342   {\parskip=0pt \afterenvbreak}%
7343 }
7344 \def\Esmallindentedblock{\Eindentedblock}
7345
7346
7347 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7348 % If we want to allow any <char> as delimiter,
7349 % we need the curly braces so that makeinfo sees the @verb command, eg:
7350 % `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
7351 %
7352 % [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
7353 %
7354 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7355 % active too.  Otherwise, they get lost as the first character on a
7356 % verbatim line.
7357 \def\dospecials{%
7358   \do\ \do\\\do\{\do\}\do\$\do\&%
7359   \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7360   \do\<\do\>\do\|\do\@\do+\do\"%
7361   % Don't do the quotes -- if we do, @set txicodequoteundirected and
7362   % @set txicodequotebacktick will not have effect on @verb and
7363   % @verbatim, and ?` and !` ligatures won't get disabled.
7364   %\do\`\do\'%
7365 }
7366 %
7367 % [Knuth] p. 380
7368 \def\uncatcodespecials{%
7369   \def\do##1{\catcode`##1=\other}\dospecials}
7370 %
7371 % Setup for the @verb command.
7372 %
7373 % Eight spaces for a tab
7374 \begingroup
7375   \catcode`\^^I=\active
7376   \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7377 \endgroup
7378 %
7379 \def\setupverb{%
7380   \tt
7381   \def\par{\leavevmode\endgraf}%
7382   \parindent = 0pt
7383   \setcodequotes
7384   \tabeightspaces
7385   % Respect line breaks,
7386   % print special symbols as themselves, and
7387   % make each space count
7388   % must do in this order:
7389   \obeylines \uncatcodespecials \sepspaces
7390 }
7391
7392 % Setup for the @verbatim environment
7393 %
7394 % Real tab expansion.
7395 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7396 %
7397 % We typeset each line of the verbatim in an \hbox, so we can handle
7398 % tabs.
7399 \newbox\verbbox
7400 \def\starttabbox{\setbox\verbbox=\hbox\bgroup}
7401 %
7402 \begingroup
7403   \catcode`\^^I=\active
7404   \gdef\tabexpand{%
7405     \catcode`\^^I=\active
7406     \def^^I{\leavevmode\egroup
7407       \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7408       \divide\dimen\verbbox by\tabw
7409       \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7410       \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
7411       \wd\verbbox=\dimen\verbbox
7412       \leavevmode\box\verbbox \starttabbox
7413     }%
7414   }
7415 \endgroup
7416
7417 % start the verbatim environment.
7418 \def\setupverbatim{%
7419   \let\nonarrowing = t%
7420   \nonfillstart
7421   \tt % easiest (and conventionally used) font for verbatim
7422   \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
7423   \tabexpand
7424   \setcodequotes
7425   % Respect line breaks,
7426   % print special symbols as themselves, and
7427   % make each space count.
7428   % Must do in this order:
7429   \obeylines \uncatcodespecials \sepspaces
7430 }
7431
7432 % Do the @verb magic: verbatim text is quoted by unique
7433 % delimiter characters.  Before first delimiter expect a
7434 % right brace, after last delimiter expect closing brace:
7435 %
7436 %    \def\doverb'{'<char>#1<char>'}'{#1}
7437 %
7438 % [Knuth] p. 382; only eat outer {}
7439 \begingroup
7440   \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7441   \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7442 \endgroup
7443 %
7444 \def\verb{\begingroup\setupverb\doverb}
7445 %
7446 %
7447 % Do the @verbatim magic: define the macro \doverbatim so that
7448 % the (first) argument ends when '@end verbatim' is reached, ie:
7449 %
7450 %     \def\doverbatim#1@end verbatim{#1}
7451 %
7452 % For Texinfo it's a lot easier than for LaTeX,
7453 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7454 % we need not redefine '\', '{' and '}'.
7455 %
7456 % Inspired by LaTeX's verbatim command set [latex.ltx]
7457 %
7458 \begingroup
7459   \catcode`\ =\active
7460   \obeylines %
7461   % ignore everything up to the first ^^M, that's the newline at the end
7462   % of the @verbatim input line itself.  Otherwise we get an extra blank
7463   % line in the output.
7464   \xdef\doverbatim#1^^M#2@end verbatim{%
7465     \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
7466   % We really want {...\end verbatim} in the body of the macro, but
7467   % without the active space; thus we have to use \xdef and \gobble.
7468   % The \egroup ends the \verbbox started at the end of the last line in
7469   % the block.
7470 \endgroup
7471 %
7472 \envdef\verbatim{%
7473     \setnormaldispenv\setupverbatim\doverbatim
7474 }
7475 \let\Everbatim = \afterenvbreak
7476
7477
7478 % @verbatiminclude FILE - insert text of file in verbatim environment.
7479 %
7480 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7481 %
7482 \def\doverbatiminclude#1{%
7483   {%
7484     \makevalueexpandable
7485     \setupverbatim
7486     {%
7487       \indexnofonts       % Allow `@@' and other weird things in file names.
7488       \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7489       \edef\tmp{\noexpand\input #1 }
7490       \expandafter
7491     }\expandafter\starttabbox\tmp\egroup
7492     \afterenvbreak
7493   }%
7494 }
7495
7496 % @copying ... @end copying.
7497 % Save the text away for @insertcopying later.
7498 %
7499 % We save the uninterpreted tokens, rather than creating a box.
7500 % Saving the text in a box would be much easier, but then all the
7501 % typesetting commands (@smallbook, font changes, etc.) have to be done
7502 % beforehand -- and a) we want @copying to be done first in the source
7503 % file; b) letting users define the frontmatter in as flexible order as
7504 % possible is desirable.
7505 %
7506 \def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying}
7507 {\catcode`\ =\other
7508 \gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7509 }
7510
7511 \def\insertcopying{%
7512   \begingroup
7513     \parindent = 0pt  % paragraph indentation looks wrong on title page
7514     \scanexp\copyingtext
7515   \endgroup
7516 }
7517
7518
7519 \message{defuns,}
7520 % @defun etc.
7521
7522 \newskip\defbodyindent \defbodyindent=.4in
7523 \newskip\defargsindent \defargsindent=50pt
7524 \newskip\deflastargmargin \deflastargmargin=18pt
7525 \newcount\defunpenalty
7526
7527 % Start the processing of @deffn:
7528 \def\startdefun{%
7529   \ifnum\lastpenalty<10000
7530     \medbreak
7531     \defunpenalty=10003 % Will keep this @deffn together with the
7532                         % following @def command, see below.
7533   \else
7534     % If there are two @def commands in a row, we'll have a \nobreak,
7535     % which is there to keep the function description together with its
7536     % header.  But if there's nothing but headers, we need to allow a
7537     % break somewhere.  Check specifically for penalty 10002, inserted
7538     % by \printdefunline, instead of 10000, since the sectioning
7539     % commands also insert a nobreak penalty, and we don't want to allow
7540     % a break between a section heading and a defun.
7541     %
7542     % As a further refinement, we avoid "club" headers by signalling
7543     % with penalty of 10003 after the very first @deffn in the
7544     % sequence (see above), and penalty of 10002 after any following
7545     % @def command.
7546     \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7547     %
7548     % Similarly, after a section heading, do not allow a break.
7549     % But do insert the glue.
7550     \medskip  % preceded by discardable penalty, so not a breakpoint
7551   \fi
7552   %
7553   \parindent=0in
7554   \advance\leftskip by \defbodyindent
7555   \exdentamount=\defbodyindent
7556 }
7557
7558 % Called as \printdefunline \deffooheader{text}
7559 %
7560 \def\printdefunline#1#2{%
7561   \begingroup
7562     \plainfrenchspacing
7563     % call \deffooheader:
7564     #1#2 \endheader
7565     % common ending:
7566     \interlinepenalty = 10000
7567     \advance\rightskip by 0pt plus 1fil\relax
7568     \endgraf
7569     \nobreak\vskip -\parskip
7570     \penalty\defunpenalty  % signal to \startdefun and \deffoox
7571     % Some of the @defun-type tags do not enable magic parentheses,
7572     % rendering the following check redundant.  But we don't optimize.
7573     \checkparencounts
7574   \endgroup
7575 }
7576
7577 \def\Edefun{\endgraf\medbreak}
7578
7579 % @defblock, @defline do not automatically create index entries
7580 \envdef\defblock{%
7581   \startdefun
7582 }
7583 \let\Edefblock\Edefun
7584
7585 \def\defline{%
7586   \doingtypefnfalse
7587   \parseargusing\activeparens{\printdefunline\deflineheader}%
7588 }
7589 \def\deflineheader#1 #2 #3\endheader{%
7590   \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
7591 }
7592 \def\deftypeline{%
7593   \doingtypefntrue
7594   \parseargusing\activeparens{\printdefunline\deflineheader}%
7595 }
7596
7597 % \makedefun{deffoo} (\deffooheader parameters) { (\deffooheader expansion) }
7598 %
7599 % Define \deffoo, \deffoox  \Edeffoo and \deffooheader.
7600 \def\makedefun#1{%
7601   \expandafter\let\csname E#1\endcsname = \Edefun
7602   \edef\temp{\noexpand\domakedefun
7603     \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7604   \temp
7605 }
7606 \def\domakedefun#1#2#3{%
7607   \envdef#1{%
7608     \startdefun
7609     \doingtypefnfalse    % distinguish typed functions from all else
7610     \parseargusing\activeparens{\printdefunline#3}%
7611   }%
7612   \def#2{%
7613     % First, check whether we are in the right environment:
7614     \checkenv#1%
7615     %
7616     % As in \startdefun, allow line break if we have multiple x headers
7617     % in a row.  It's not a great place, though.
7618     \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7619     %
7620     \doingtypefnfalse    % distinguish typed functions from all else
7621     \parseargusing\activeparens{\printdefunline#3}%
7622   }%
7623   \def#3% definition of \deffooheader follows
7624 }
7625
7626 \newif\ifdoingtypefn       % doing typed function?
7627 \newif\ifrettypeownline    % typeset return type on its own line?
7628
7629 % @deftypefnnewline on|off says whether the return type of typed functions
7630 % are printed on their own line.  This affects @deftypefn, @deftypefun,
7631 % @deftypeop, and @deftypemethod.
7632
7633 \parseargdef\deftypefnnewline{%
7634   \def\temp{#1}%
7635   \ifx\temp\onword
7636     \expandafter\let\csname SETtxideftypefnnl\endcsname
7637       = \empty
7638   \else\ifx\temp\offword
7639     \expandafter\let\csname SETtxideftypefnnl\endcsname
7640       = \relax
7641   \else
7642     \errhelp = \EMsimple
7643     \errmessage{Unknown @txideftypefnnl value `\temp',
7644                 must be on|off}%
7645   \fi\fi
7646 }
7647
7648 % Untyped functions:
7649
7650 % @deffn category name args
7651 \makedefun{deffn}#1 #2 #3\endheader{%
7652   \doind{fn}{\code{#2}}%
7653   \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
7654 }
7655
7656 % @defop category class name args
7657 \makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
7658 \def\defopheaderx#1#2 #3 #4\endheader{%
7659   \doind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
7660   \printdefname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
7661 }
7662
7663 % Typed functions:
7664
7665 % @deftypefn category type name args
7666 \makedefun{deftypefn}#1 #2 #3 #4\endheader{%
7667   \doind{fn}{\code{#3}}%
7668   \doingtypefntrue
7669   \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
7670 }
7671
7672 % @deftypeop category class type name args
7673 \makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
7674 \def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
7675   \doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
7676   \doingtypefntrue
7677   \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
7678 }
7679
7680 % Typed variables:
7681
7682 % @deftypevr category type var args
7683 \makedefun{deftypevr}#1 #2 #3 #4\endheader{%
7684   \doind{vr}{\code{#3}}%
7685   \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
7686 }
7687
7688 % @deftypecv category class type var args
7689 \makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
7690 \def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
7691   \doind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
7692   \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
7693 }
7694
7695 % Untyped variables:
7696
7697 % @defvr category var args
7698 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7699
7700 % @defcv category class var args
7701 \makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}}
7702 \def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} }
7703
7704 % Types:
7705
7706 % @deftp category name args
7707 \makedefun{deftp}#1 #2 #3\endheader{%
7708   \doind{tp}{\code{#2}}%
7709   \printdefname{#1}{}{#2}\defunargs{#3\unskip}%
7710 }
7711
7712 % Remaining @defun-like shortcuts:
7713 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7714 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7715 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7716 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7717 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7718 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7719 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7720 \makedefun{defmethod}{\defopheaderx\putwordMethodon}
7721 \makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon}
7722 \makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof}
7723 \makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof}
7724
7725 % \printdefname, which formats the name of the @def (not the args).
7726 % #1 is the category, such as "Function".
7727 % #2 is the return type, if any.
7728 % #3 is the function name.
7729 %
7730 % We are followed by (but not passed) the arguments, if any.
7731 %
7732 \def\printdefname#1#2#3{%
7733   \par
7734   % Get the values of \leftskip and \rightskip as they were outside the @def...
7735   \advance\leftskip by -\defbodyindent
7736   %
7737   % Determine if we are typesetting the return type of a typed function
7738   % on a line by itself.
7739   \rettypeownlinefalse
7740   \ifdoingtypefn  % doing a typed function specifically?
7741     % then check user option for putting return type on its own line:
7742     \ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}%
7743   \fi
7744   %
7745   % How we'll format the category name.  Putting it in brackets helps
7746   % distinguish it from the body text that may end up on the next line
7747   % just below it.
7748   \def\temp{#1}%
7749   \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7750   %
7751   % Figure out line sizes for the paragraph shape.  We'll always have at
7752   % least two.
7753   \tempnum = 2
7754   %
7755   % The first line needs space for \box0; but if \rightskip is nonzero,
7756   % we need only space for the part of \box0 which exceeds it:
7757   \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
7758   %
7759   % If doing a return type on its own line, we'll have another line.
7760   \ifrettypeownline
7761     \advance\tempnum by 1
7762     \def\maybeshapeline{0in \hsize}%
7763   \else
7764     \def\maybeshapeline{}%
7765   \fi
7766   %
7767   % The continuations:
7768   \dimen2=\hsize  \advance\dimen2 by -\defargsindent
7769   %
7770   % The final paragraph shape:
7771   \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
7772   %
7773   % Put the category name at the right margin.
7774   \noindent
7775   \hbox to 0pt{%
7776     \hfil\box0 \kern-\hsize
7777     % \hsize has to be shortened this way:
7778     \kern\leftskip
7779     % Intentionally do not respect \rightskip, since we need the space.
7780   }%
7781   %
7782   % Allow all lines to be underfull without complaint:
7783   \tolerance=10000 \hbadness=10000
7784   \exdentamount=\defbodyindent
7785   {%
7786     % defun fonts. We use typewriter by default (used to be bold) because:
7787     % . we're printing identifiers, they should be in tt in principle.
7788     % . in languages with many accents, such as Czech or French, it's
7789     %   common to leave accents off identifiers.  The result looks ok in
7790     %   tt, but exceedingly strange in rm.
7791     % . we don't want -- and --- to be treated as ligatures.
7792     % . this still does not fix the ?` and !` ligatures, but so far no
7793     %   one has made identifiers using them :).
7794     \df \tt
7795     \def\temp{#2}% text of the return type
7796     \ifx\temp\empty\else
7797       \tclose{\temp}% typeset the return type
7798       \ifrettypeownline
7799         % put return type on its own line; prohibit line break following:
7800         \hfil\vadjust{\nobreak}\break  
7801       \else
7802         \space  % type on same line, so just followed by a space
7803       \fi
7804     \fi           % no return type
7805     #3% output function name
7806   }%
7807   \ifflagclear{txidefnamenospace}{%
7808     {\rm\enskip}% hskip 0.5 em of \rmfont
7809   }{}%
7810   %
7811   \boldbrax
7812   % arguments will be output next, if any.
7813 }
7814
7815 % Print arguments.  Use slanted for @def*, typewriter for @deftype*.
7816 \def\defunargs#1{%
7817   \bgroup
7818     \df \ifdoingtypefn \tt \else \sl \fi
7819     \ifflagclear{txicodevaristt}{}%
7820        {\def\var##1{{\setregularquotes \ttsl ##1}}}%
7821     #1%
7822   \egroup
7823 }
7824
7825 % We want ()&[] to print specially on the defun line.
7826 %
7827 \def\activeparens{%
7828   \catcode`\(=\active \catcode`\)=\active
7829   \catcode`\[=\active \catcode`\]=\active
7830   \catcode`\&=\active
7831 }
7832
7833 % Make control sequences which act like normal parenthesis chars.
7834 \let\lparen = ( \let\rparen = )
7835
7836 % Be sure that we always have a definition for `(', etc.  For example,
7837 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7838 % so TeX would otherwise complain about undefined control sequence.
7839 {
7840   \activeparens
7841   \gdef\defcharsdefault{%
7842     \let(=\lparen \let)=\rparen
7843     \let[=\lbrack \let]=\rbrack
7844     \let& = \&%
7845   }
7846   \globaldefs=1 \defcharsdefault
7847
7848   \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7849   \gdef\magicamp{\let&=\amprm}
7850 }
7851 \let\ampchar\&
7852
7853 \newcount\parencount
7854
7855 % If we encounter &foo, then turn on ()-hacking afterwards
7856 \newif\ifampseen
7857 \def\amprm#1 {\ampseentrue{\rm\&#1 }}
7858
7859 \def\parenfont{%
7860   \ifampseen
7861     % At the first level, print parens in roman,
7862     % otherwise use the default font.
7863     \ifnum \parencount=1 \rm \fi
7864   \else
7865     % The \sf parens (in \boldbrax) actually are a little bolder than
7866     % the contained text.  This is especially needed for [ and ] .
7867     \sf
7868   \fi
7869 }
7870 \def\infirstlevel#1{%
7871   \ifampseen
7872     \ifnum\parencount=1
7873       #1%
7874     \fi
7875   \fi
7876 }
7877 \def\bfafterword#1 {#1 \bf}
7878
7879 \def\opnr{%
7880   \global\advance\parencount by 1
7881   {\parenfont(}%
7882   \infirstlevel \bfafterword
7883 }
7884 \def\clnr{%
7885   {\parenfont)}%
7886   \infirstlevel \sl
7887   \global\advance\parencount by -1
7888 }
7889
7890 \newcount\brackcount
7891 \def\lbrb{%
7892   \global\advance\brackcount by 1
7893   {\bf[}%
7894 }
7895 \def\rbrb{%
7896   {\bf]}%
7897   \global\advance\brackcount by -1
7898 }
7899
7900 \def\checkparencounts{%
7901   \ifnum\parencount=0 \else \badparencount \fi
7902   \ifnum\brackcount=0 \else \badbrackcount \fi
7903 }
7904 % these should not use \errmessage; the glibc manual, at least, actually
7905 % has such constructs (when documenting function pointers).
7906 \def\badparencount{%
7907   \message{Warning: unbalanced parentheses in @def...}%
7908   \global\parencount=0
7909 }
7910 \def\badbrackcount{%
7911   \message{Warning: unbalanced square brackets in @def...}%
7912   \global\brackcount=0
7913 }
7914
7915
7916 \message{macros,}
7917 % @macro.
7918
7919 % To do this right we need a feature of e-TeX, \scantokens,
7920 % which we arrange to emulate with a temporary file in ordinary TeX.
7921 \ifx\eTeXversion\thisisundefined
7922   \newwrite\macscribble
7923   \def\scantokens#1{%
7924     \toks0={#1}%
7925     \immediate\openout\macscribble=\jobname.tmp
7926     \immediate\write\macscribble{\the\toks0}%
7927     \immediate\closeout\macscribble
7928     \input \jobname.tmp
7929   }
7930 \fi
7931
7932 \let\E=\expandafter
7933
7934 % Used at the time of macro expansion.
7935 % Argument is macro body with arguments substituted
7936 \def\scanmacro#1{%
7937   \newlinechar`\^^M
7938   % expand the expansion of \eatleadingcr twice to maybe remove a leading
7939   % newline (and \else and \fi tokens), then call \eatspaces on the result.
7940   \def\xeatspaces##1{%
7941     \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
7942   }}%
7943   \def\xempty##1{}%
7944   %
7945   % Process the macro body under the current catcode regime.
7946   \scantokens{#1@comment}%
7947   %
7948   % The \comment is to remove the \newlinechar added by \scantokens, and
7949   % can be noticed by \parsearg.  Note \c isn't used because this means cedilla 
7950   % in math mode.
7951 }
7952
7953 % Used for copying and captions
7954 \def\scanexp#1{%
7955   \expandafter\scanmacro\expandafter{#1}%
7956 }
7957
7958 \newcount\paramno   % Count of parameters
7959 \newtoks\macname    % Macro name
7960 \newif\ifrecursive  % Is it recursive?
7961
7962 % List of all defined macros in the form
7963 %    \commondummyword\macro1\commondummyword\macro2...
7964 % Currently is also contains all @aliases; the list can be split
7965 % if there is a need.
7966 \def\macrolist{}
7967
7968 % Add the macro to \macrolist
7969 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7970 \def\addtomacrolistxxx#1{%
7971      \toks0 = \expandafter{\macrolist\commondummyword#1}%
7972      \xdef\macrolist{\the\toks0}%
7973 }
7974
7975 % Utility routines.
7976 % This does \let #1 = #2, with \csnames; that is,
7977 %   \let \csname#1\endcsname = \csname#2\endcsname
7978 % (except of course we have to play expansion games).
7979 %
7980 \def\cslet#1#2{%
7981   \expandafter\let
7982   \csname#1\expandafter\endcsname
7983   \csname#2\endcsname
7984 }
7985
7986 % Trim leading and trailing spaces off a string.
7987 % Concepts from aro-bend problem 15 (see CTAN).
7988 {\catcode`\@=11
7989 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7990 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7991 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7992 \def\unbrace#1{#1}
7993 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
7994 }
7995
7996 {\catcode`\^^M=\other%
7997 \gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
7998 % Warning: this won't work for a delimited argument
7999 % or for an empty argument
8000
8001 % Trim a single trailing ^^M off a string.
8002 {\catcode`\^^M=\other \catcode`\Q=3%
8003 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8004 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8005 \gdef\eatcrb#1Q#2Q{#1}%
8006 }
8007
8008 % Macro bodies are absorbed as an argument in a context where
8009 % all characters are catcode 10, 11 or 12, except \ which is active
8010 % (as in normal texinfo). It is necessary to change the definition of \
8011 % to recognize macro arguments; this is the job of \mbodybackslash.
8012 %
8013 % Non-ASCII encodings make 8-bit characters active, so un-activate
8014 % them to avoid their expansion.  Must do this non-globally, to
8015 % confine the change to the current group.
8016 %
8017 % It's necessary to have hard CRs when the macro is executed. This is
8018 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8019 % body, and then making it the \newlinechar in \scanmacro.
8020 %
8021 \def\scanctxt{% used as subroutine
8022   \catcode`\"=\other
8023   \catcode`\+=\other
8024   \catcode`\<=\other
8025   \catcode`\>=\other
8026   \catcode`\^=\other
8027   \catcode`\_=\other
8028   \catcode`\|=\other
8029   \catcode`\~=\other
8030   \catcode`\@=\other
8031   \catcode`\^^M=\other
8032   \catcode`\\=\active
8033   \passthroughcharstrue
8034 }
8035
8036 \def\macrobodyctxt{% used for @macro definitions and @copying
8037   \scanctxt
8038   \catcode`\ =\other
8039   \catcode`\{=\other
8040   \catcode`\}=\other
8041 }
8042
8043 % Used when scanning braced macro arguments.  Note, however, that catcode
8044 % changes here are ineffectual if the macro invocation was nested inside
8045 % an argument to another Texinfo command.
8046 \def\macroargctxt{%
8047   \scanctxt
8048   \catcode`\ =\active
8049 }
8050
8051 \def\macrolineargctxt{% used for whole-line arguments without braces
8052   \scanctxt
8053   \catcode`\{=\other
8054   \catcode`\}=\other
8055 }
8056
8057 % \mbodybackslash is the definition of \ in @macro bodies.
8058 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8059 % where N is the macro parameter number.
8060 % We define \csname macarg.\endcsname to be \realbackslash, so
8061 % \\ in macro replacement text gets you a backslash.
8062 %
8063 {\catcode`@=0 @catcode`@\=@active
8064  @gdef@usembodybackslash{@let\=@mbodybackslash}
8065  @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8066 }
8067 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8068
8069 \def\margbackslash#1{\char`\#1 }
8070
8071 \def\macro{\recursivefalse\parsearg\macroxxx}
8072 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8073
8074 \def\macroxxx#1{%
8075   \getargs{#1}% now \macname is the macname and \argl the arglist
8076   \ifx\argl\empty       % no arguments
8077      \paramno=0\relax
8078   \else
8079      \expandafter\parsemargdef \argl;%
8080      \if\paramno>256\relax
8081        \ifx\eTeXversion\thisisundefined
8082          \errhelp = \EMsimple
8083          \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8084        \fi
8085      \fi
8086   \fi
8087   \if1\csname ismacro.\the\macname\endcsname
8088      \message{Warning: redefining \the\macname}%
8089   \else
8090      \expandafter\ifx\csname \the\macname\endcsname \relax
8091      \else \errmessage{Macro name \the\macname\space already defined}\fi
8092      \global\cslet{macsave.\the\macname}{\the\macname}%
8093      \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8094      \addtomacrolist{\the\macname}%
8095   \fi
8096   \begingroup \macrobodyctxt \usembodybackslash
8097   \ifrecursive \expandafter\parsermacbody
8098   \else \expandafter\parsemacbody
8099   \fi}
8100
8101 \parseargdef\unmacro{%
8102   \if1\csname ismacro.#1\endcsname
8103     \global\cslet{#1}{macsave.#1}%
8104     \global\expandafter\let \csname ismacro.#1\endcsname=0%
8105     % Remove the macro name from \macrolist:
8106     \begingroup
8107       \expandafter\let\csname#1\endcsname \relax
8108       \let\commondummyword\unmacrodo
8109       \xdef\macrolist{\macrolist}%
8110     \endgroup
8111   \else
8112     \errmessage{Macro #1 not defined}%
8113   \fi
8114 }
8115
8116 % Called by \do from \dounmacro on each macro.  The idea is to omit any
8117 % macro definitions that have been changed to \relax.
8118 %
8119 \def\unmacrodo#1{%
8120   \ifx #1\relax
8121     % remove this
8122   \else
8123     \noexpand\commondummyword \noexpand#1%
8124   \fi
8125 }
8126
8127 % \getargs -- Parse the arguments to a @macro line.  Set \macname to
8128 % the name of the macro, and \argl to the braced argument list.
8129 \def\getargs#1{\getargsxxx#1{}}
8130 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8131 \def\getmacname#1 #2\relax{\macname={#1}}
8132 \def\getmacargs#1{\def\argl{#1}}
8133 % This made use of the feature that if the last token of a
8134 % <parameter list> is #, then the preceding argument is delimited by
8135 % an opening brace, and that opening brace is not consumed.
8136
8137 % Parse the optional {params} list to @macro or @rmacro.
8138 % Set \paramno to the number of arguments,
8139 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8140 % three-param macro.)  Define \macarg.BLAH for each BLAH in the params
8141 % list to some hook where the argument is to be expanded.  If there are
8142 % less than 10 arguments that hook is to be replaced by ##N where N
8143 % is the position in that list, that is to say the macro arguments are to be
8144 % defined `a la TeX in the macro body.  
8145 %
8146 % That gets used by \mbodybackslash (above).
8147 %
8148 % If there are 10 or more arguments, a different technique is used: see
8149 % \parsemmanyargdef.
8150 %
8151 \def\parsemargdef#1;{%
8152   \paramno=0\def\paramlist{}%
8153   \let\hash\relax
8154   % \hash is redefined to `#' later to get it into definitions
8155   \let\xeatspaces\relax
8156   \let\xempty\relax
8157   \parsemargdefxxx#1,;,%
8158   \ifnum\paramno<10\relax\else
8159     \paramno0\relax
8160     \parsemmanyargdef@@#1,;,% 10 or more arguments
8161   \fi
8162 }
8163 \def\parsemargdefxxx#1,{%
8164   \if#1;\let\next=\relax
8165   \else \let\next=\parsemargdefxxx
8166     \advance\paramno by 1
8167     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8168         {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
8169     \edef\paramlist{\paramlist\hash\the\paramno,}%
8170   \fi\next}
8171 % the \xempty{} is to give \eatleadingcr an argument in the case of an
8172 % empty macro argument.
8173
8174 % \parsemacbody, \parsermacbody
8175 %
8176 % Read recursive and nonrecursive macro bodies. (They're different since
8177 % rec and nonrec macros end differently.)
8178
8179 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 
8180 % body to be transformed.
8181 % Set \macrobody to the body of the macro, and call \macrodef.
8182 %
8183 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8184 \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
8185 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8186 \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
8187
8188 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8189 \edef\texiatcatcode{\the\catcode`\@}
8190 \catcode `@=11\relax
8191
8192 %%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
8193
8194 % If there are 10 or more arguments, a different technique is used, where the
8195 % hook remains in the body, and when macro is to be expanded the body is
8196 % processed again to replace the arguments.
8197 %
8198 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8199 % argument N value and then \edef the body (nothing else will expand because of
8200 % the catcode regime under which the body was input).
8201 %
8202 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8203 % arguments, no macro can have more than 256 arguments (else error).
8204 %
8205 % In case that there are 10 or more arguments we parse again the arguments
8206 % list to set new definitions for the \macarg.BLAH macros corresponding to
8207 % each BLAH argument. It was anyhow needed to parse already once this list
8208 % in order to count the arguments, and as macros with at most 9 arguments
8209 % are by far more frequent than macro with 10 or more arguments, defining
8210 % twice the \macarg.BLAH macros does not cost too much processing power.
8211 \def\parsemmanyargdef@@#1,{%
8212   \if#1;\let\next=\relax
8213   \else 
8214     \let\next=\parsemmanyargdef@@
8215     \edef\tempb{\eatspaces{#1}}%
8216     \expandafter\def\expandafter\tempa
8217        \expandafter{\csname macarg.\tempb\endcsname}%
8218     % Note that we need some extra \noexpand\noexpand, this is because we
8219     % don't want \the  to be expanded in the \parsermacbody  as it uses an
8220     % \xdef .
8221     \expandafter\edef\tempa
8222       {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8223     \advance\paramno by 1\relax
8224   \fi\next}
8225
8226
8227 \let\endargs@\relax
8228 \let\nil@\relax
8229 \def\nilm@{\nil@}%
8230 \long\def\nillm@{\nil@}%
8231
8232 % This macro is expanded during the Texinfo macro expansion, not during its
8233 % definition.  It gets all the arguments' values and assigns them to macros
8234 % macarg.ARGNAME
8235 %
8236 % #1 is the macro name
8237 % #2 is the list of argument names
8238 % #3 is the list of argument values
8239 \def\getargvals@#1#2#3{%
8240   \def\macargdeflist@{}%
8241   \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8242   \def\paramlist{#2,\nil@}%
8243   \def\macroname{#1}%
8244   \begingroup
8245   \macroargctxt
8246   \def\argvaluelist{#3,\nil@}%
8247   \def\@tempa{#3}%
8248   \ifx\@tempa\empty
8249     \setemptyargvalues@
8250   \else
8251     \getargvals@@
8252   \fi
8253 }
8254 \def\getargvals@@{%
8255   \ifx\paramlist\nilm@
8256       % Some sanity check needed here that \argvaluelist is also empty.
8257       \ifx\argvaluelist\nillm@
8258       \else
8259         \errhelp = \EMsimple
8260         \errmessage{Too many arguments in macro `\macroname'!}%
8261       \fi
8262       \let\next\macargexpandinbody@
8263   \else
8264     \ifx\argvaluelist\nillm@
8265        % No more arguments values passed to macro.  Set remaining named-arg
8266        % macros to empty.
8267        \let\next\setemptyargvalues@
8268     \else
8269       % pop current arg name into \@tempb
8270       \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8271       \expandafter\@tempa\expandafter{\paramlist}%
8272        % pop current argument value into \@tempc
8273       \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8274       \expandafter\@tempa\expandafter{\argvaluelist}%
8275        % Here \@tempb is the current arg name and \@tempc is the current arg value.
8276        % First place the new argument macro definition into \@tempd
8277        \expandafter\macname\expandafter{\@tempc}%
8278        \expandafter\let\csname macarg.\@tempb\endcsname\relax
8279        \expandafter\def\expandafter\@tempe\expandafter{%
8280          \csname macarg.\@tempb\endcsname}%
8281        \edef\@tempd{\long\def\@tempe{\the\macname}}%
8282        \push@\@tempd\macargdeflist@
8283        \let\next\getargvals@@
8284     \fi
8285   \fi
8286   \next
8287 }
8288
8289 \def\push@#1#2{%
8290   \expandafter\expandafter\expandafter\def
8291   \expandafter\expandafter\expandafter#2%
8292   \expandafter\expandafter\expandafter{%
8293   \expandafter#1#2}%
8294 }
8295
8296 % Replace arguments by their values in the macro body, and place the result
8297 % in macro \@tempa.
8298
8299 \def\macvalstoargs@{%
8300   %  To do this we use the property that token registers that are \the'ed
8301   % within an \edef  expand only once. So we are going to place all argument
8302   % values into respective token registers.
8303   %
8304   % First we save the token context, and initialize argument numbering.
8305   \begingroup
8306     \paramno0\relax
8307     % Then, for each argument number #N, we place the corresponding argument
8308     % value into a new token list register \toks#N
8309     \expandafter\putargsintokens@\saveparamlist@,;,%
8310     % Then, we expand the body so that argument are replaced by their
8311     % values. The trick for values not to be expanded themselves is that they
8312     % are within tokens and that tokens expand only once in an \edef .
8313     \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8314     % Now we restore the token stack pointer to free the token list registers
8315     % which we have used, but we make sure that expanded body is saved after
8316     % group.
8317     \expandafter
8318   \endgroup
8319   \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8320   }
8321
8322 % Define the named-macro outside of this group and then close this group. 
8323
8324 \def\macargexpandinbody@{% 
8325   \expandafter
8326   \endgroup
8327   \macargdeflist@
8328   % First the replace in body the macro arguments by their values, the result
8329   % is in \@tempa .
8330   \macvalstoargs@
8331   % Then we point at the \norecurse or \gobble (for recursive) macro value
8332   % with \@tempb .
8333   \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8334   % Depending on whether it is recursive or not, we need some tailing
8335   % \egroup .
8336   \ifx\@tempb\gobble
8337      \let\@tempc\relax
8338   \else
8339      \let\@tempc\egroup
8340   \fi
8341   % And now we do the real job:
8342   \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8343   \@tempd
8344 }
8345
8346 \def\putargsintokens@#1,{%
8347   \if#1;\let\next\relax
8348   \else
8349     \let\next\putargsintokens@
8350     % First we allocate the new token list register, and give it a temporary
8351     % alias \@tempb .
8352     \toksdef\@tempb\the\paramno
8353     % Then we place the argument value into that token list register.
8354     \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8355     \expandafter\@tempb\expandafter{\@tempa}%
8356     \advance\paramno by 1\relax
8357   \fi
8358   \next
8359 }
8360
8361 % Trailing missing arguments are set to empty.
8362
8363 \def\setemptyargvalues@{%
8364   \ifx\paramlist\nilm@
8365     \let\next\macargexpandinbody@
8366   \else
8367     \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8368     \let\next\setemptyargvalues@
8369   \fi
8370   \next
8371 }
8372
8373 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8374   \expandafter\def\expandafter\@tempa\expandafter{%
8375     \expandafter\def\csname macarg.#1\endcsname{}}%
8376   \push@\@tempa\macargdeflist@
8377   \def\paramlist{#2}%
8378 }
8379
8380 % #1 is the element target macro
8381 % #2 is the list macro
8382 % #3,#4\endargs@ is the list value
8383 \def\pop@#1#2#3,#4\endargs@{%
8384    \def#1{#3}%
8385    \def#2{#4}%
8386 }
8387 \long\def\longpop@#1#2#3,#4\endargs@{%
8388    \long\def#1{#3}%
8389    \long\def#2{#4}%
8390 }
8391
8392
8393 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8394
8395
8396 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8397 %    \macrobody has the body of the macro in it, with placeholders for
8398 % its parameters, looking like "\xeatspaces{\hash 1}".
8399 %    \paramno is the number of parameters
8400 %    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8401 % There are four cases: macros of zero, one, up to nine, and many arguments.
8402 % \xdef is used so that macro definitions will survive the file
8403 % they're defined in: @include reads the file inside a group.
8404 %
8405 \def\macrodef{%
8406   \let\hash=##% convert placeholders to macro parameter chars
8407   \ifnum\paramno=1
8408     \long\def\xeatspaces##1{##1}%
8409     % We don't use \xeatspaces for single-argument macros, because we
8410     % want to keep ends of lines.  This definition removes \xeatspaces
8411     % when \macrobody is expanded below.
8412   \else
8413     \def\xeatspaces{\string\xeatspaces}%
8414     % This expands \xeatspaces as a sequence of character tokens, which
8415     % stops \scantokens inserting an extra space after the control sequence.
8416   \fi
8417   \ifcase\paramno
8418   % 0
8419     \expandafter\xdef\csname\the\macname\endcsname{%
8420       \begingroup
8421         \noexpand\spaceisspace
8422         \noexpand\endlineisspace
8423         \noexpand\expandafter % skip any whitespace after the macro name.
8424         \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8425     \expandafter\xdef\csname\the\macname @@@\endcsname{%
8426       \endgroup
8427       \noexpand\scanmacro{\macrobody}}%
8428   \or % 1
8429     \expandafter\xdef\csname\the\macname\endcsname{%
8430        \begingroup
8431        \noexpand\braceorline
8432        \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8433     \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8434       \endgroup
8435       \noexpand\scanmacro{\macrobody}%
8436       }%
8437   \else % at most 9
8438     \ifnum\paramno<10\relax
8439       % @MACNAME sets the context for reading the macro argument
8440       % @MACNAME@@ gets the argument, processes backslashes and appends a 
8441       % comma.
8442       % @MACNAME@@@ removes braces surrounding the argument list.
8443       % @MACNAME@@@@ scans the macro body with arguments substituted.
8444       \expandafter\xdef\csname\the\macname\endcsname{%
8445         \begingroup
8446         \noexpand\expandafter  % This \expandafter skip any spaces after the
8447         \noexpand\macroargctxt % macro before we change the catcode of space.
8448         \noexpand\expandafter
8449         \expandafter\noexpand\csname\the\macname @@\endcsname}%
8450       \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8451           \noexpand\passargtomacro
8452           \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8453       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8454           \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8455       \expandafter\expandafter
8456       \expandafter\xdef
8457       \expandafter\expandafter
8458         \csname\the\macname @@@@\endcsname\paramlist{%
8459           \endgroup\noexpand\scanmacro{\macrobody}}%
8460     \else % 10 or more:
8461       \expandafter\xdef\csname\the\macname\endcsname{%
8462         \noexpand\getargvals@{\the\macname}{\argl}%
8463       }%
8464       \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8465       \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8466     \fi
8467   \fi}
8468
8469 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8470
8471 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8472
8473
8474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8475 %
8476 {\catcode`\@=0 \catcode`\\=13  % We need to manipulate \ so use @ as escape
8477 @catcode`@_=11  % private names
8478 @catcode`@!=11  % used as argument separator
8479
8480 % \passargtomacro#1#2 -
8481 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8482 % compressed to one.
8483 %
8484 % This implementation works by expansion, and not execution (so we cannot use 
8485 % \def or similar).  This reduces the risk of this failing in contexts where 
8486 % complete expansion is done with no execution (for example, in writing out to 
8487 % an auxiliary file for an index entry).
8488
8489 % State is kept in the input stream: the argument passed to
8490 % @look_ahead, @gobble_and_check_finish and @add_segment is
8491 %
8492 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN  (... rest of input)
8493 %
8494 % where:
8495 % THE_MACRO - name of the macro we want to call
8496 % ARG_RESULT - argument list we build to pass to that macro
8497 % PENDING_BS - either a backslash or nothing
8498 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8499
8500 @gdef@passargtomacro#1#2{%
8501   @add_segment #1!{}@relax#2\@_finish\%
8502 }
8503 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8504
8505 % #1 - THE_MACRO ARG_RESULT
8506 % #2 - PENDING_BS
8507 % #3 - NEXT_TOKEN
8508 % #4 used to look ahead
8509 %
8510 % If the next token is not a backslash, process the rest of the argument; 
8511 % otherwise, remove the next token.
8512 @gdef@look_ahead#1!#2#3#4{%
8513   @ifx#4\%
8514    @expandafter@gobble_and_check_finish 
8515   @else
8516    @expandafter@add_segment
8517   @fi#1!{#2}#4#4%
8518 }
8519
8520 % #1 - THE_MACRO ARG_RESULT
8521 % #2 - PENDING_BS
8522 % #3 - NEXT_TOKEN
8523 % #4 should be a backslash, which is gobbled.
8524 % #5 looks ahead
8525 %
8526 % Double backslash found.  Add a single backslash, and look ahead.
8527 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8528   @add_segment#1\!{}#5#5%
8529 }
8530
8531 @gdef@is_fi{@fi}
8532
8533 % #1 - THE_MACRO ARG_RESULT
8534 % #2 - PENDING_BS
8535 % #3 - NEXT_TOKEN
8536 % #4 is input stream until next backslash
8537 %
8538 % Input stream is either at the start of the argument, or just after a 
8539 % backslash sequence, either a lone backslash, or a doubled backslash.  
8540 % NEXT_TOKEN contains the first token in the input stream: if it is \finish, 
8541 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8542 % the next backslash.  PENDING_BACKSLASH contains a backslash to represent
8543 % a backslash just before the start of the input stream that has not been
8544 % added to ARG_RESULT.
8545 @gdef@add_segment#1!#2#3#4\{%
8546 @ifx#3@_finish
8547   @call_the_macro#1!%
8548 @else
8549   % append the pending backslash to the result, followed by the next segment
8550   @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8551   % this @fi is discarded by @look_ahead.
8552   % we can't get rid of it with \expandafter because we don't know how 
8553   % long #4 is.
8554 }
8555
8556 % #1 - THE_MACRO
8557 % #2 - ARG_RESULT
8558 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the 
8559 % conditional.
8560 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8561
8562 }
8563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8564
8565 % \braceorline MAC is used for a one-argument macro MAC.  It checks
8566 % whether the next non-whitespace character is a {.  It sets the context
8567 % for reading the argument (slightly different in the two cases).  Then,
8568 % to read the argument, in the whole-line case, it then calls the regular
8569 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8570
8571 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8572 \def\braceorlinexxx{%
8573   \ifx\nchar\bgroup
8574     \macroargctxt
8575     \expandafter\passargtomacro
8576   \else
8577     \macrolineargctxt\expandafter\parsearg
8578   \fi \macnamexxx}
8579
8580
8581 % @linemacro
8582
8583 \parseargdef\linemacro{%
8584   \getargs{#1}% now \macname is the macname and \argl the arglist
8585   \ifx\argl\empty
8586     \paramno=0
8587     \let\hash\relax
8588     \def\paramlist{\hash 1\endlinemacro}%
8589   \else
8590     \expandafter\linegetparamlist\argl;%
8591   \fi
8592   \begingroup \macrobodyctxt \usembodybackslash
8593   \parselinemacrobody
8594 }
8595
8596 % Build up \paramlist which will be used as the parameter text for the macro.
8597 % At the end it will be like "#1 #2 #3\endlinemacro".
8598 \def\linegetparamlist#1;{%
8599   \paramno=0\def\paramlist{}%
8600   \let\hash\relax
8601   \linegetparamlistxxx#1,;,%
8602 }
8603 \def\linegetparamlistxxx#1,{%
8604   \if#1;\let\next=\linegetparamlistxxxx
8605   \else \let\next=\linegetparamlistxxx
8606     \advance\paramno by 1
8607     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8608         {\hash\the\paramno}%
8609     \edef\paramlist{\paramlist\hash\the\paramno\space}%
8610   \fi\next}
8611 \def\linegetparamlistxxxx{%
8612   \expandafter\fixparamlist\paramlist\fixparamlist
8613 }
8614 % Replace final space token
8615 \def\fixparamlist#1 \fixparamlist{%
8616   \def\paramlist{#1\endlinemacro}%
8617 }
8618
8619 % Read the body of the macro, replacing backslash-surrounded variables
8620 %
8621 {\catcode`\ =\other\long\gdef\parselinemacrobody#1@end linemacro{%
8622 \xdef\macrobody{#1}%
8623 \endgroup
8624 \linemacrodef
8625 }}
8626
8627 % Make the definition
8628 \def\linemacrodef{%
8629   \let\hash=##%
8630   \expandafter\xdef\csname\the\macname\endcsname{%
8631     \bgroup
8632     \noexpand\parsearg
8633     \expandafter\noexpand\csname\the\macname @@\endcsname
8634   }
8635   \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8636     \egroup
8637     \expandafter\noexpand
8638     \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
8639   }
8640   \expandafter\expandafter
8641   \expandafter\xdef
8642   \expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
8643     \newlinechar=13 % split \macrobody into lines
8644     \noexpand\scantokens{\macrobody}%
8645   }
8646 }
8647
8648
8649
8650 % @alias.
8651 % We need some trickery to remove the optional spaces around the equal
8652 % sign.  Make them active and then expand them all to nothing.
8653 %
8654 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8655 \def\aliasxxx #1{\aliasyyy#1\relax}
8656 \def\aliasyyy #1=#2\relax{%
8657   {%
8658     \expandafter\let\obeyedspace=\empty
8659     \addtomacrolist{#1}%
8660     \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8661   }%
8662   \next
8663 }
8664
8665
8666 \message{cross references,}
8667
8668 \newwrite\auxfile
8669 \newif\ifhavexrefs    % True if xref values are known.
8670 \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
8671
8672 % @inforef is relatively simple.
8673 \def\inforef #1{\inforefzzz #1,,,,**}
8674 \def\inforefzzz #1,#2,#3,#4**{%
8675   \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8676   node \samp{\ignorespaces#1{}}}
8677
8678 % @node's only job in TeX is to define \lastnode, which is used in
8679 % cross-references.  The @node line might or might not have commas, and
8680 % might or might not have spaces before the first comma, like:
8681 % @node foo , bar , ...
8682 % We don't want such trailing spaces in the node name.
8683 %
8684 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8685 %
8686 % also remove a trailing comma, in case of something like this:
8687 % @node Help-Cross,  ,  , Cross-refs
8688 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8689 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
8690
8691 % Used so that the @top node doesn't have to be wrapped in an @ifnottex
8692 % conditional.
8693 % \doignore goes to more effort to skip nested conditionals but we don't need 
8694 % that here.
8695 \def\omittopnode{%
8696    \ifx\lastnode\wordTop
8697    \expandafter\ignorenode\fi
8698 }
8699 \def\wordTop{Top}
8700
8701 % Until the next @node, @part or @bye command, divert output to a box that
8702 % is not output.
8703 \def\ignorenode{\setbox\dummybox\vbox\bgroup
8704 \def\part{\egroup\part}%
8705 \def\node{\egroup\node}%
8706 \ignorenodebye
8707 }
8708
8709 {\let\bye\relax
8710 \gdef\ignorenodebye{\let\bye\ignorenodebyedef}
8711 \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
8712 % The redefinition of \bye here is because it is declared \outer
8713
8714 \let\lastnode=\empty
8715
8716 % Write a cross-reference definition for the current node.  #1 is the
8717 % type (Ynumbered, Yappendix, Ynothing).
8718 %
8719 \def\donoderef#1{%
8720   \ifx\lastnode\empty\else
8721     \setref{\lastnode}{#1}%
8722     \global\let\lastnode=\empty
8723   \fi
8724 }
8725
8726 % @anchor{NAME} -- define xref target at arbitrary point.
8727 %
8728 \newcount\savesfregister
8729 %
8730 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8731 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8732 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8733
8734 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8735 % anchor), which consists of three parts:
8736 % 1) NAME-title - the current sectioning name taken from \currentsection,
8737 %                 or the anchor name.
8738 % 2) NAME-snt   - section number and type, passed as the SNT arg, or
8739 %                 empty for anchors.
8740 % 3) NAME-pg    - the page number.
8741 %
8742 % This is called from \donoderef, \anchor, and \dofloat.  In the case of
8743 % floats, there is an additional part, which is not written here:
8744 % 4) NAME-lof   - the text as it should appear in a @listoffloats.
8745 %
8746 \def\setref#1#2{%
8747   \pdfmkdest{#1}%
8748   \iflinks
8749     {%
8750       \requireauxfile
8751       \atdummies  % preserve commands, but don't expand them
8752       % match definition in \xrdef, \refx, \xrefX.
8753       \def\value##1{##1}%
8754       \edef\writexrdef##1##2{%
8755         \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8756           ##1}{##2}}% these are parameters of \writexrdef
8757       }%
8758       \toks0 = \expandafter{\currentsection}%
8759       \immediate \writexrdef{title}{\the\toks0 }%
8760       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8761       \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8762     }%
8763   \fi
8764 }
8765
8766 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8767 % automatically in xrefs, if the third arg is not explicitly specified.
8768 % This was provided as a "secret" @set xref-automatic-section-title
8769 % variable, now it's official.
8770
8771 \parseargdef\xrefautomaticsectiontitle{%
8772   \def\temp{#1}%
8773   \ifx\temp\onword
8774     \expandafter\let\csname SETxref-automatic-section-title\endcsname
8775       = \empty
8776   \else\ifx\temp\offword
8777     \expandafter\let\csname SETxref-automatic-section-title\endcsname
8778       = \relax
8779   \else
8780     \errhelp = \EMsimple
8781     \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8782                 must be on|off}%
8783   \fi\fi
8784 }
8785
8786\f
8787 % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
8788 % the node name, #2 the name of the Info cross-reference, #3 the printed
8789 % node name, #4 the name of the Info file, #5 the name of the printed
8790 % manual.  All but the node name can be omitted.
8791 %
8792 \def\pxref{\putwordsee{} \xrefXX}
8793 \def\xref{\putwordSee{} \xrefXX}
8794 \def\ref{\xrefXX}
8795
8796 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8797 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8798 %
8799 \newbox\toprefbox
8800 \newbox\printedrefnamebox
8801 \newbox\infofilenamebox
8802 \newbox\printedmanualbox
8803 %
8804 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8805   \unsepspaces
8806   %
8807   % Get args without leading/trailing spaces.
8808   \def\printedrefname{\ignorespaces #3}%
8809   \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8810   %
8811   \def\infofilename{\ignorespaces #4}%
8812   \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8813   %
8814   \def\printedmanual{\ignorespaces #5}%
8815   \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
8816   %
8817   % If the printed reference name (arg #3) was not explicitly given in
8818   % the @xref, figure out what we want to use.
8819   \ifdim \wd\printedrefnamebox = 0pt
8820     % No printed node name was explicitly given.
8821     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8822       % Not auto section-title: use node name inside the square brackets.
8823       \def\printedrefname{\ignorespaces #1}%
8824     \else
8825       % Auto section-title: use chapter/section title inside
8826       % the square brackets if we have it.
8827       \ifdim \wd\printedmanualbox > 0pt
8828         % It is in another manual, so we don't have it; use node name.
8829         \def\printedrefname{\ignorespaces #1}%
8830       \else
8831         \ifhavexrefs
8832           % We (should) know the real title if we have the xref values.
8833           \def\printedrefname{\refx{#1-title}}%
8834         \else
8835           % Otherwise just copy the Info node name.
8836           \def\printedrefname{\ignorespaces #1}%
8837         \fi%
8838       \fi
8839     \fi
8840   \fi
8841   %
8842   % Make link in pdf output.
8843   \ifpdf
8844     % For pdfTeX and LuaTeX
8845     {\indexnofonts
8846      \makevalueexpandable
8847      \turnoffactive
8848      % This expands tokens, so do it after making catcode changes, so _
8849      % etc. don't get their TeX definitions.  This ignores all spaces in
8850      % #4, including (wrongly) those in the middle of the filename.
8851      \getfilename{#4}%
8852      %
8853      % This (wrongly) does not take account of leading or trailing
8854      % spaces in #1, which should be ignored.
8855      \setpdfdestname{#1}%
8856      %
8857      \ifx\pdfdestname\empty
8858        \def\pdfdestname{Top}% no empty targets
8859      \fi
8860      %
8861      \leavevmode
8862      \startlink attr{/Border [0 0 0]}%
8863      \ifnum\filenamelength>0
8864        goto file{\the\filename.pdf} name{\pdfdestname}%
8865      \else
8866        goto name{\pdfmkpgn{\pdfdestname}}%
8867      \fi
8868     }%
8869     \setcolor{\linkcolor}%
8870   \else
8871     \ifx\XeTeXrevision\thisisundefined
8872     \else
8873       % For XeTeX
8874       {\indexnofonts
8875        \makevalueexpandable
8876        \turnoffactive
8877        % This expands tokens, so do it after making catcode changes, so _
8878        % etc. don't get their TeX definitions.  This ignores all spaces in
8879        % #4, including (wrongly) those in the middle of the filename.
8880        \getfilename{#4}%
8881        %
8882        % This (wrongly) does not take account of leading or trailing
8883        % spaces in #1, which should be ignored.
8884        \setpdfdestname{#1}%
8885        %
8886        \ifx\pdfdestname\empty
8887          \def\pdfdestname{Top}% no empty targets
8888        \fi
8889        %
8890        \leavevmode
8891        \ifnum\filenamelength>0
8892          % With default settings,
8893          % XeTeX (xdvipdfmx) replaces link destination names with integers.
8894          % In this case, the replaced destination names of
8895          % remote PDFs are no longer known.  In order to avoid a replacement,
8896          % you can use xdvipdfmx's command line option `-C 0x0010'.
8897          % If you use XeTeX 0.99996+ (TeX Live 2016+),
8898          % this command line option is no longer necessary
8899          % because we can use the `dvipdfmx:config' special.
8900          \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8901            << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
8902        \else
8903          \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8904            << /S /GoTo /D (\pdfdestname) >> >>}%
8905        \fi
8906       }%
8907       \setcolor{\linkcolor}%
8908     \fi
8909   \fi
8910   {%
8911     % Have to otherify everything special to allow the \csname to
8912     % include an _ in the xref name, etc.
8913     \indexnofonts
8914     \turnoffactive
8915     \def\value##1{##1}%
8916     \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8917       \csname XR#1-title\endcsname
8918   }%
8919   %
8920   % Float references are printed completely differently: "Figure 1.2"
8921   % instead of "[somenode], p.3".  \iffloat distinguishes them by
8922   % \Xthisreftitle being set to a magic string.
8923   \iffloat\Xthisreftitle
8924     % If the user specified the print name (third arg) to the ref,
8925     % print it instead of our usual "Figure 1.2".
8926     \ifdim\wd\printedrefnamebox = 0pt
8927       \refx{#1-snt}%
8928     \else
8929       \printedrefname
8930     \fi
8931     %
8932     % If the user also gave the printed manual name (fifth arg), append
8933     % "in MANUALNAME".
8934     \ifdim \wd\printedmanualbox > 0pt
8935       \space \putwordin{} \cite{\printedmanual}%
8936     \fi
8937   \else
8938     % node/anchor (non-float) references.
8939     % 
8940     % If we use \unhbox to print the node names, TeX does not insert
8941     % empty discretionaries after hyphens, which means that it will not
8942     % find a line break at a hyphen in a node names.  Since some manuals
8943     % are best written with fairly long node names, containing hyphens,
8944     % this is a loss.  Therefore, we give the text of the node name
8945     % again, so it is as if TeX is seeing it for the first time.
8946     % 
8947     \ifdim \wd\printedmanualbox > 0pt
8948       % Cross-manual reference with a printed manual name.
8949       % 
8950       \crossmanualxref{\cite{\printedmanual\unskip}}%
8951     %
8952     \else\ifdim \wd\infofilenamebox > 0pt
8953       % Cross-manual reference with only an info filename (arg 4), no
8954       % printed manual name (arg 5).  This is essentially the same as
8955       % the case above; we output the filename, since we have nothing else.
8956       % 
8957       \crossmanualxref{\code{\infofilename\unskip}}%
8958     %
8959     \else
8960       % Reference within this manual.
8961       %
8962       % Only output a following space if the -snt ref is nonempty, as the ref
8963       % will be empty for @unnumbered and @anchor.
8964       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
8965       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8966       %
8967       % output the `[mynode]' via the macro below so it can be overridden.
8968       \xrefprintnodename\printedrefname
8969       %
8970       \ifflagclear{txiomitxrefpg}{%
8971         % We always want a comma
8972         ,%
8973         % output the `page 3'.
8974         \turnoffactive \putpageref{#1}%
8975         % Add a , if xref followed by a space
8976         \if\space\noexpand\tokenafterxref ,%
8977         \else\ifx\      \tokenafterxref ,% @TAB
8978         \else\ifx\*\tokenafterxref ,%   @*
8979         \else\ifx\ \tokenafterxref ,%   @SPACE
8980         \else\ifx\
8981                   \tokenafterxref ,%    @NL
8982         \else\ifx\tie\tokenafterxref ,% @tie
8983         \fi\fi\fi\fi\fi\fi
8984       }{}%
8985     \fi\fi
8986   \fi
8987   \endlink
8988 \endgroup}
8989
8990 % can be overridden in translation files
8991 \def\putpageref#1{%
8992   \space\putwordpage\tie\refx{#1-pg}}
8993
8994 % Output a cross-manual xref to #1.  Used just above (twice).
8995
8996 % Only include the text "Section ``foo'' in" if the foo is neither
8997 % missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
8998 % "see The Foo Manual", the idea being to refer to the whole manual.
8999
9000 % But, this being TeX, we can't easily compare our node name against the
9001 % string "Top" while ignoring the possible spaces before and after in
9002 % the input.  By adding the arbitrary 7sp below, we make it much less
9003 % likely that a real node name would have the same width as "Top" (e.g.,
9004 % in a monospaced font).  Hopefully it will never happen in practice.
9005
9006 % For the same basic reason, we retypeset the "Top" at every
9007 % reference, since the current font is indeterminate.
9008
9009 \def\crossmanualxref#1{%
9010   \setbox\toprefbox = \hbox{Top\kern7sp}%
9011   \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
9012   \ifdim \wd2 > 7sp  % nonempty?
9013     \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
9014       \putwordSection{} ``\printedrefname'' \putwordin{}\space
9015     \fi
9016   \fi
9017   #1%
9018 }
9019
9020 % This macro is called from \xrefX for the `[nodename]' part of xref
9021 % output.  It's a separate macro only so it can be changed more easily,
9022 % since square brackets don't work well in some documents.  Particularly
9023 % one that Bob is working on :).
9024 %
9025 \def\xrefprintnodename#1{[#1]}
9026
9027 % Things referred to by \setref.
9028 %
9029 \def\Ynothing{}
9030 \def\Yomitfromtoc{}
9031 \def\Ynumbered{%
9032   \ifnum\secno=0
9033     \putwordChapter@tie \the\chapno
9034   \else \ifnum\subsecno=0
9035     \putwordSection@tie \the\chapno.\the\secno
9036   \else \ifnum\subsubsecno=0
9037     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9038   \else
9039     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9040   \fi\fi\fi
9041 }
9042 \def\Yappendix{%
9043   \ifnum\secno=0
9044      \putwordAppendix@tie @char\the\appendixno{}%
9045   \else \ifnum\subsecno=0
9046      \putwordSection@tie @char\the\appendixno.\the\secno
9047   \else \ifnum\subsubsecno=0
9048     \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9049   \else
9050     \putwordSection@tie
9051       @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9052   \fi\fi\fi
9053 }
9054
9055 % \refx{NAME} - reference a cross-reference string named NAME.
9056 \def\refx#1{%
9057   \requireauxfile
9058   {%
9059     \indexnofonts
9060     \turnoffactive
9061     \def\value##1{##1}%
9062     \expandafter\global\expandafter\let\expandafter\thisrefX
9063       \csname XR#1\endcsname
9064   }%
9065   \ifx\thisrefX\relax
9066     % If not defined, say something at least.
9067     \angleleft un\-de\-fined\angleright
9068     \iflinks
9069       \ifhavexrefs
9070         {\toks0 = {#1}% avoid expansion of possibly-complex value
9071          \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9072       \else
9073         \ifwarnedxrefs\else
9074           \global\warnedxrefstrue
9075           \message{Cross reference values unknown; you must run TeX again.}%
9076         \fi
9077       \fi
9078     \fi
9079   \else
9080     % It's defined, so just use it.
9081     \thisrefX
9082   \fi
9083 }
9084
9085 % This is the macro invoked by entries in the aux file.  Define a control 
9086 % sequence for a cross-reference target (we prepend XR to the control sequence 
9087 % name to avoid collisions).  The value is the page number.  If this is a float 
9088 % type, we have more work to do.
9089 %
9090 \def\xrdef#1#2{%
9091   {% Expand the node or anchor name to remove control sequences.
9092    % \turnoffactive stops 8-bit characters being changed to commands
9093    % like @'e.  \refx does the same to retrieve the value in the definition.
9094     \indexnofonts
9095     \turnoffactive
9096     \def\value##1{##1}%
9097     \xdef\safexrefname{#1}%
9098   }%
9099   %
9100   \bgroup
9101     \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
9102   \egroup
9103   % We put the \gdef inside a group to avoid the definitions building up on 
9104   % TeX's save stack, which can cause it to run out of space for aux files with 
9105   % thousands of lines.  \gdef doesn't use the save stack, but \csname does
9106   % when it defines an unknown control sequence as \relax. 
9107   %
9108   % Was that xref control sequence that we just defined for a float?
9109   \expandafter\iffloat\csname XR\safexrefname\endcsname
9110     % it was a float, and we have the (safe) float type in \iffloattype.
9111     \expandafter\let\expandafter\floatlist
9112       \csname floatlist\iffloattype\endcsname
9113     %
9114     % Is this the first time we've seen this float type?
9115     \expandafter\ifx\floatlist\relax
9116       \toks0 = {\do}% yes, so just \do
9117     \else
9118       % had it before, so preserve previous elements in list.
9119       \toks0 = \expandafter{\floatlist\do}%
9120     \fi
9121     %
9122     % Remember this xref in the control sequence \floatlistFLOATTYPE,
9123     % for later use in \listoffloats.
9124     \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9125       {\safexrefname}}%
9126   \fi
9127 }
9128
9129 % If working on a large document in chapters, it is convenient to
9130 % be able to disable indexing, cross-referencing, and contents, for test runs.
9131 % This is done with @novalidate at the beginning of the file.
9132 %
9133 \newif\iflinks \linkstrue % by default we want the aux files.
9134 \let\novalidate = \linksfalse
9135
9136 % Used when writing to the aux file, or when using data from it.
9137 \def\requireauxfile{%
9138   \iflinks
9139     \tryauxfile
9140     % Open the new aux file.  TeX will close it automatically at exit.
9141     \immediate\openout\auxfile=\jobname.aux
9142   \fi
9143   \global\let\requireauxfile=\relax   % Only do this once.
9144 }
9145
9146 % Read the last existing aux file, if any.  No error if none exists.
9147 %
9148 \def\tryauxfile{%
9149   \openin 1 \jobname.aux
9150   \ifeof 1 \else
9151     \readdatafile{aux}%
9152     \global\havexrefstrue
9153   \fi
9154   \closein 1
9155 }
9156
9157 \def\setupdatafile{%
9158   \catcode`\^^@=\other
9159   \catcode`\^^A=\other
9160   \catcode`\^^B=\other
9161   \catcode`\^^C=\other
9162   \catcode`\^^D=\other
9163   \catcode`\^^E=\other
9164   \catcode`\^^F=\other
9165   \catcode`\^^G=\other
9166   \catcode`\^^H=\other
9167   \catcode`\^^K=\other
9168   \catcode`\^^L=\other
9169   \catcode`\^^N=\other
9170   \catcode`\^^P=\other
9171   \catcode`\^^Q=\other
9172   \catcode`\^^R=\other
9173   \catcode`\^^S=\other
9174   \catcode`\^^T=\other
9175   \catcode`\^^U=\other
9176   \catcode`\^^V=\other
9177   \catcode`\^^W=\other
9178   \catcode`\^^X=\other
9179   \catcode`\^^Z=\other
9180   \catcode`\^^[=\other
9181   \catcode`\^^\=\other
9182   \catcode`\^^]=\other
9183   \catcode`\^^^=\other
9184   \catcode`\^^_=\other
9185   \catcode`\^=\other
9186   %
9187   % Special characters.  Should be turned off anyway, but...
9188   \catcode`\~=\other
9189   \catcode`\[=\other
9190   \catcode`\]=\other
9191   \catcode`\"=\other
9192   \catcode`\_=\active
9193   \catcode`\|=\active
9194   \catcode`\<=\active
9195   \catcode`\>=\active
9196   \catcode`\$=\other
9197   \catcode`\#=\other
9198   \catcode`\&=\other
9199   \catcode`\%=\other
9200   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9201   %
9202   \catcode`\\=\active
9203   %
9204   % @ is our escape character in .aux files, and we need braces.
9205   \catcode`\{=1
9206   \catcode`\}=2
9207   \catcode`\@=0
9208 }
9209
9210 \def\readdatafile#1{%
9211 \begingroup
9212   \setupdatafile
9213   \input\jobname.#1
9214 \endgroup}
9215
9216
9217 \message{insertions,}
9218 % including footnotes.
9219
9220 \newcount \footnoteno
9221
9222 % The trailing space in the following definition for supereject is
9223 % vital for proper filling; pages come out unaligned when you do a
9224 % pagealignmacro call if that space before the closing brace is
9225 % removed. (Generally, numeric constants should always be followed by a
9226 % space to prevent strange expansion errors.)
9227 \def\supereject{\par\penalty -20000\footnoteno =0 }
9228
9229 % @footnotestyle is meaningful for Info output only.
9230 \let\footnotestyle=\comment
9231
9232 {\catcode `\@=11
9233 %
9234 % Auto-number footnotes.  Otherwise like plain.
9235 \gdef\footnote{%
9236   \global\advance\footnoteno by \@ne
9237   \edef\thisfootno{$^{\the\footnoteno}$}%
9238   %
9239   % In case the footnote comes at the end of a sentence, preserve the
9240   % extra spacing after we do the footnote number.
9241   \let\@sf\empty
9242   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9243   %
9244   % Remove inadvertent blank space before typesetting the footnote number.
9245   \unskip
9246   \thisfootno\@sf
9247   \dofootnote
9248 }%
9249
9250 % Don't bother with the trickery in plain.tex to not require the
9251 % footnote text as a parameter.  Our footnotes don't need to be so general.
9252 %
9253 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9254 % \parseargline) fails inside footnotes because the tokens are fixed when
9255 % the footnote is read.  --karl, 16nov96.
9256 %
9257 \gdef\dofootnote{%
9258   \insert\footins\bgroup
9259   %
9260   % Nested footnotes are not supported in TeX, that would take a lot
9261   % more work.  (\startsavinginserts does not suffice.)
9262   \let\footnote=\errfootnotenest
9263   %
9264   % We want to typeset this text as a normal paragraph, even if the
9265   % footnote reference occurs in (for example) a display environment.
9266   % So reset some parameters.
9267   \hsize=\txipagewidth
9268   \interlinepenalty\interfootnotelinepenalty
9269   \splittopskip\ht\strutbox % top baseline for broken footnotes
9270   \splitmaxdepth\dp\strutbox
9271   \floatingpenalty\@MM
9272   \leftskip\z@skip
9273   \rightskip\z@skip
9274   \spaceskip\z@skip
9275   \xspaceskip\z@skip
9276   \parindent\defaultparindent
9277   %
9278   \smallfonts \rm
9279   %
9280   % Because we use hanging indentation in footnotes, a @noindent appears
9281   % to exdent this text, so make it be a no-op.  makeinfo does not use
9282   % hanging indentation so @noindent can still be needed within footnote
9283   % text after an @example or the like (not that this is good style).
9284   \let\noindent = \relax
9285   %
9286   % Hang the footnote text off the number.  Use \everypar in case the
9287   % footnote extends for more than one paragraph.
9288   \everypar = {\hang}%
9289   \textindent{\thisfootno}%
9290   %
9291   % Don't crash into the line above the footnote text.  Since this
9292   % expands into a box, it must come within the paragraph, lest it
9293   % provide a place where TeX can split the footnote.
9294   \footstrut
9295   %
9296   % Invoke rest of plain TeX footnote routine.
9297   \futurelet\next\fo@t
9298 }
9299 }%end \catcode `\@=11
9300
9301 \def\errfootnotenest{%
9302   \errhelp=\EMsimple
9303   \errmessage{Nested footnotes not supported in texinfo.tex,
9304     even though they work in makeinfo; sorry}
9305 }
9306
9307 \def\errfootnoteheading{%
9308   \errhelp=\EMsimple
9309   \errmessage{Footnotes in chapters, sections, etc., are not supported}
9310 }
9311
9312 % In case a @footnote appears in a vbox, save the footnote text and create
9313 % the real \insert just after the vbox finished.  Otherwise, the insertion
9314 % would be lost.
9315 % Similarly, if a @footnote appears inside an alignment, save the footnote
9316 % text to a box and make the \insert when a row of the table is finished.
9317 % And the same can be done for other insert classes.  --kasal, 16nov03.
9318 %
9319 % Replace the \insert primitive by a cheating macro.
9320 % Deeper inside, just make sure that the saved insertions are not spilled
9321 % out prematurely.
9322 %
9323 \def\startsavinginserts{%
9324   \ifx \insert\ptexinsert
9325     \let\insert\saveinsert
9326   \else
9327     \let\checkinserts\relax
9328   \fi
9329 }
9330
9331 % This \insert replacement works for both \insert\footins{foo} and
9332 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9333 %
9334 \def\saveinsert#1{%
9335   \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9336   \afterassignment\next
9337   % swallow the left brace
9338   \let\temp =
9339 }
9340 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9341 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9342
9343 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9344
9345 \def\placesaveins#1{%
9346   \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9347     {\box#1}%
9348 }
9349
9350 % eat @SAVE -- beware, all of them have catcode \other:
9351 {
9352   \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
9353   \gdef\gobblesave @SAVE{}
9354 }
9355
9356 % initialization:
9357 \def\newsaveins #1{%
9358   \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9359   \next
9360 }
9361 \def\newsaveinsX #1{%
9362   \csname newbox\endcsname #1%
9363   \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9364     \checksaveins #1}%
9365 }
9366
9367 % initialize:
9368 \let\checkinserts\empty
9369 \newsaveins\footins
9370 \newsaveins\margin
9371
9372
9373 % @image.  We use the macros from epsf.tex to support this.
9374 % If epsf.tex is not installed and @image is used, we complain.
9375 %
9376 % Check for and read epsf.tex up front.  If we read it only at @image
9377 % time, we might be inside a group, and then its definitions would get
9378 % undone and the next image would fail.
9379 \openin 1 = epsf.tex
9380 \ifeof 1 \else
9381   % Do not bother showing banner with epsf.tex v2.7k (available in
9382   % doc/epsf.tex and on ctan).
9383   \def\epsfannounce{\toks0 = }%
9384   \input epsf.tex
9385 \fi
9386 \closein 1
9387 %
9388 % We will only complain once about lack of epsf.tex.
9389 \newif\ifwarnednoepsf
9390 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9391   work.  It is also included in the Texinfo distribution, or you can get
9392   it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
9393 %
9394 \def\image#1{%
9395   \ifx\epsfbox\thisisundefined
9396     \ifwarnednoepsf \else
9397       \errhelp = \noepsfhelp
9398       \errmessage{epsf.tex not found, images will be ignored}%
9399       \global\warnednoepsftrue
9400     \fi
9401   \else
9402     \imagexxx #1,,,,,\finish
9403   \fi
9404 }
9405
9406 % Approximate height of a line in the standard text font.
9407 \newdimen\capheight
9408 \setbox0=\vbox{\tenrm H}
9409 \capheight=\ht0
9410
9411 %
9412 % Arguments to @image:
9413 % #1 is (mandatory) image filename; we tack on .eps extension.
9414 % #2 is (optional) width, #3 is (optional) height.
9415 % #4 is (ignored optional) html alt text.
9416 % #5 is (ignored optional) extension.
9417 % #6 is just the usual extra ignored arg for parsing stuff.
9418 \newif\ifimagevmode
9419 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9420   \catcode`\^^M = 5     % in case we're inside an example
9421   \normalturnoffactive  % allow _ et al. in names
9422   \makevalueexpandable
9423   \ifvmode
9424     \imagevmodetrue
9425     \medskip
9426     % Usually we'll have text after the image which will insert
9427     % \parskip glue, so insert it here too to equalize the space
9428     % above and below.
9429     \vskip\parskip
9430     %
9431     % Place image in a \vtop for a top page margin that is (close to) correct,
9432     % as \topskip glue is relative to the first baseline.
9433     \vtop\bgroup \kern -\capheight \vskip-\parskip
9434   \fi
9435   %
9436   \ifx\centersub\centerV
9437     % For @center @image, enter vertical mode and add vertical space
9438     % Enter an extra \parskip because @center doesn't add space itself.
9439     \vbox\bgroup\vskip\parskip\medskip\vskip\parskip
9440   \else
9441     % Enter horizontal mode so that indentation from an enclosing
9442     %  environment such as @quotation is respected.
9443     % However, if we're at the top level, we don't want the
9444     %  normal paragraph indentation.
9445     \imageindent
9446   \fi
9447   %
9448   % Output the image.
9449   \ifpdf
9450     % For pdfTeX and LuaTeX <= 0.80
9451     \dopdfimage{#1}{#2}{#3}%
9452   \else
9453     \ifx\XeTeXrevision\thisisundefined
9454       % For epsf.tex
9455       % \epsfbox itself resets \epsf?size at each figure.
9456       \setbox0 = \hbox{\ignorespaces #2}%
9457         \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9458       \setbox0 = \hbox{\ignorespaces #3}%
9459         \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9460       \epsfbox{#1.eps}%
9461     \else
9462       % For XeTeX
9463       \doxeteximage{#1}{#2}{#3}%
9464     \fi
9465   \fi
9466   %
9467   \ifimagevmode
9468     \egroup
9469     \medskip  % space after a standalone image
9470   \fi
9471   \ifx\centersub\centerV % @center @image
9472     \medskip
9473     \egroup % close \vbox
9474   \fi
9475 \endgroup}
9476
9477
9478 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9479 % etc.  We don't actually implement floating yet, we always include the
9480 % float "here".  But it seemed the best name for the future.
9481 %
9482 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9483
9484 % There may be a space before second and/or third parameter; delete it.
9485 \def\eatcommaspace#1, {#1,}
9486
9487 % #1 is the optional FLOATTYPE, the text label for this float, typically
9488 % "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
9489 % this float will not be numbered and cannot be referred to.
9490 %
9491 % #2 is the optional xref label.  Also must be present for the float to
9492 % be referable.
9493 %
9494 % #3 is the optional positioning argument; for now, it is ignored.  It
9495 % will somehow specify the positions allowed to float to (here, top, bottom).
9496 %
9497 % We keep a separate counter for each FLOATTYPE, which we reset at each
9498 % chapter-level command.
9499 \let\resetallfloatnos=\empty
9500 %
9501 \def\dofloat#1,#2,#3,#4\finish{%
9502   \let\thiscaption=\empty
9503   \let\thisshortcaption=\empty
9504   %
9505   % don't lose footnotes inside @float.
9506   %
9507   % BEWARE: when the floats start float, we have to issue warning whenever an
9508   % insert appears inside a float which could possibly float. --kasal, 26may04
9509   %
9510   \startsavinginserts
9511   %
9512   % We can't be used inside a paragraph.
9513   \par
9514   %
9515   \vtop\bgroup
9516     \def\floattype{#1}%
9517     \def\floatlabel{#2}%
9518     \def\floatloc{#3}% we do nothing with this yet.
9519     %
9520     \ifx\floattype\empty
9521       \let\safefloattype=\empty
9522     \else
9523       {%
9524         % the floattype might have accents or other special characters,
9525         % but we need to use it in a control sequence name.
9526         \indexnofonts
9527         \turnoffactive
9528         \xdef\safefloattype{\floattype}%
9529       }%
9530     \fi
9531     %
9532     % If label is given but no type, we handle that as the empty type.
9533     \ifx\floatlabel\empty \else
9534       % We want each FLOATTYPE to be numbered separately (Figure 1,
9535       % Table 1, Figure 2, ...).  (And if no label, no number.)
9536       %
9537       \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9538       \global\advance\floatno by 1
9539       %
9540       {%
9541         % This magic value for \currentsection is output by \setref as the
9542         % XREFLABEL-title value.  \xrefX uses it to distinguish float
9543         % labels (which have a completely different output format) from
9544         % node and anchor labels.  And \xrdef uses it to construct the
9545         % lists of floats.
9546         %
9547         \edef\currentsection{\floatmagic=\safefloattype}%
9548         \setref{\floatlabel}{Yfloat}%
9549       }%
9550     \fi
9551     %
9552     % start with \parskip glue, I guess.
9553     \vskip\parskip
9554     %
9555     % Don't suppress indentation if a float happens to start a section.
9556     \restorefirstparagraphindent
9557 }
9558
9559 % we have these possibilities:
9560 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9561 % @float Foo,lbl & no caption:    Foo 1.1
9562 % @float Foo & @caption{Cap}:     Foo: Cap
9563 % @float Foo & no caption:        Foo
9564 % @float ,lbl & Caption{Cap}:     1.1: Cap
9565 % @float ,lbl & no caption:       1.1
9566 % @float & @caption{Cap}:         Cap
9567 % @float & no caption:
9568 %
9569 \def\Efloat{%
9570     \let\floatident = \empty
9571     %
9572     % In all cases, if we have a float type, it comes first.
9573     \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9574     %
9575     % If we have an xref label, the number comes next.
9576     \ifx\floatlabel\empty \else
9577       \ifx\floattype\empty \else % if also had float type, need tie first.
9578         \appendtomacro\floatident{\tie}%
9579       \fi
9580       % the number.
9581       \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9582     \fi
9583     %
9584     % Start the printed caption with what we've constructed in
9585     % \floatident, but keep it separate; we need \floatident again.
9586     \let\captionline = \floatident
9587     %
9588     \ifx\thiscaption\empty \else
9589       \ifx\floatident\empty \else
9590         \appendtomacro\captionline{: }% had ident, so need a colon between
9591       \fi
9592       %
9593       % caption text.
9594       \appendtomacro\captionline{\scanexp\thiscaption}%
9595     \fi
9596     %
9597     % If we have anything to print, print it, with space before.
9598     % Eventually this needs to become an \insert.
9599     \ifx\captionline\empty \else
9600       \vskip.5\parskip
9601       \captionline
9602       %
9603       % Space below caption.
9604       \vskip\parskip
9605     \fi
9606     %
9607     % If have an xref label, write the list of floats info.  Do this
9608     % after the caption, to avoid chance of it being a breakpoint.
9609     \ifx\floatlabel\empty \else
9610       % Write the text that goes in the lof to the aux file as
9611       % \floatlabel-lof.  Besides \floatident, we include the short
9612       % caption if specified, else the full caption if specified, else nothing.
9613       {%
9614         \requireauxfile
9615         \atdummies
9616         %
9617         \ifx\thisshortcaption\empty
9618           \def\gtemp{\thiscaption}%
9619         \else
9620           \def\gtemp{\thisshortcaption}%
9621         \fi
9622         \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9623           \ifx\gtemp\empty \else : \gtemp \fi}}%
9624       }%
9625     \fi
9626   \egroup  % end of \vtop
9627   %
9628   \checkinserts
9629 }
9630
9631 % Append the tokens #2 to the definition of macro #1, not expanding either.
9632 %
9633 \def\appendtomacro#1#2{%
9634   \expandafter\def\expandafter#1\expandafter{#1#2}%
9635 }
9636
9637 % @caption, @shortcaption
9638 %
9639 \def\caption{\docaption\thiscaption}
9640 \def\shortcaption{\docaption\thisshortcaption}
9641 \def\docaption{\checkenv\float \bgroup\scanctxt\docaptionz}
9642 \def\docaptionz#1#2{\egroup \def#1{#2}}
9643
9644 % The parameter is the control sequence identifying the counter we are
9645 % going to use.  Create it if it doesn't exist and assign it to \floatno.
9646 \def\getfloatno#1{%
9647   \ifx#1\relax
9648       % Haven't seen this figure type before.
9649       \csname newcount\endcsname #1%
9650       %
9651       % Remember to reset this floatno at the next chap.
9652       \expandafter\gdef\expandafter\resetallfloatnos
9653         \expandafter{\resetallfloatnos #1=0 }%
9654   \fi
9655   \let\floatno#1%
9656 }
9657
9658 % \setref calls this to get the XREFLABEL-snt value.  We want an @xref
9659 % to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
9660 % first read the @float command.
9661 %
9662 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9663
9664 % Magic string used for the XREFLABEL-title value, so \xrefX can
9665 % distinguish floats from other xref types.
9666 \def\floatmagic{!!float!!}
9667
9668 % #1 is the control sequence we are passed; we expand into a conditional
9669 % which is true if #1 represents a float ref.  That is, the magic
9670 % \currentsection value which we \setref above.
9671 %
9672 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9673 %
9674 % #1 is (maybe) the \floatmagic string.  If so, #2 will be the
9675 % (safe) float type for this float.  We set \iffloattype to #2.
9676 %
9677 \def\doiffloat#1=#2=#3\finish{%
9678   \def\temp{#1}%
9679   \def\iffloattype{#2}%
9680   \ifx\temp\floatmagic
9681 }
9682
9683 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9684 %
9685 \parseargdef\listoffloats{%
9686   \def\floattype{#1}% floattype
9687   {%
9688     % the floattype might have accents or other special characters,
9689     % but we need to use it in a control sequence name.
9690     \indexnofonts
9691     \turnoffactive
9692     \xdef\safefloattype{\floattype}%
9693   }%
9694   %
9695   % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9696   \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9697     \ifhavexrefs
9698       % if the user said @listoffloats foo but never @float foo.
9699       \message{\linenumber No `\safefloattype' floats to list.}%
9700     \fi
9701   \else
9702     \begingroup
9703       \leftskip=\tocindent  % indent these entries like a toc
9704       \let\do=\listoffloatsdo
9705       \csname floatlist\safefloattype\endcsname
9706     \endgroup
9707   \fi
9708 }
9709
9710 % This is called on each entry in a list of floats.  We're passed the
9711 % xref label, in the form LABEL-title, which is how we save it in the
9712 % aux file.  We strip off the -title and look up \XRLABEL-lof, which
9713 % has the text we're supposed to typeset here.
9714 %
9715 % Figures without xref labels will not be included in the list (since
9716 % they won't appear in the aux file).
9717 %
9718 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9719 \def\listoffloatsdoentry#1-title\finish{{%
9720   % Can't fully expand XR#1-lof because it can contain anything.  Just
9721   % pass the control sequence.  On the other hand, XR#1-pg is just the
9722   % page number, and we want to fully expand that so we can get a link
9723   % in pdf output.
9724   \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9725   %
9726   % use the same \entry macro we use to generate the TOC and index.
9727   \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9728   \writeentry
9729 }}
9730
9731
9732 \message{localization,}
9733
9734 % For single-language documents, @documentlanguage is usually given very
9735 % early, just after @documentencoding.  Single argument is the language
9736 % (de) or locale (de_DE) abbreviation.
9737 %
9738 {
9739   \catcode`\_ = \active
9740   \globaldefs=1
9741 \parseargdef\documentlanguage{%
9742   \tex % read txi-??.tex file in plain TeX.
9743     % Read the file by the name they passed if it exists.
9744     \let_ = \normalunderscore  % normal _ character for filename test
9745     \openin 1 txi-#1.tex
9746     \ifeof 1
9747       \documentlanguagetrywithoutunderscore #1_\finish
9748     \else
9749       \globaldefs = 1  % everything in the txi-LL files needs to persist
9750       \input txi-#1.tex
9751     \fi
9752     \closein 1
9753   \endgroup % end raw TeX
9754 }
9755 %
9756 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9757 % try txi-de.tex.
9758 %
9759 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9760   \openin 1 txi-#1.tex
9761   \ifeof 1
9762     \errhelp = \nolanghelp
9763     \errmessage{Cannot read language file txi-#1.tex}%
9764   \else
9765     \globaldefs = 1  % everything in the txi-LL files needs to persist
9766     \input txi-#1.tex
9767   \fi
9768   \closein 1
9769 }
9770 }% end of special _ catcode
9771 %
9772 \newhelp\nolanghelp{The given language definition file cannot be found or
9773 is empty.  Maybe you need to install it?  Putting it in the current
9774 directory should work if nowhere else does.}
9775
9776 % This macro is called from txi-??.tex files; the first argument is the
9777 % \language name to set (without the "\lang@" prefix), the second and
9778 % third args are \{left,right}hyphenmin.
9779 %
9780 % The language names to pass are determined when the format is built.
9781 % See the etex.log file created at that time, e.g.,
9782 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9783 %
9784 % With TeX Live 2008, etex now includes hyphenation patterns for all
9785 % available languages.  This means we can support hyphenation in
9786 % Texinfo, at least to some extent.  (This still doesn't solve the
9787 % accented characters problem.)
9788 %
9789 \catcode`@=11
9790 \def\txisetlanguage#1#2#3{%
9791   % do not set the language if the name is undefined in the current TeX.
9792   \expandafter\ifx\csname lang@#1\endcsname \relax
9793     \message{no patterns for #1}%
9794   \else
9795     \global\language = \csname lang@#1\endcsname
9796   \fi
9797   % but there is no harm in adjusting the hyphenmin values regardless.
9798   \global\lefthyphenmin = #2\relax
9799   \global\righthyphenmin = #3\relax
9800 }
9801
9802 % XeTeX and LuaTeX can handle Unicode natively.
9803 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9804 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9805 %
9806 \newif\iftxinativeunicodecapable
9807 \newif\iftxiusebytewiseio
9808
9809 \ifx\XeTeXrevision\thisisundefined
9810   \ifx\luatexversion\thisisundefined
9811     \txinativeunicodecapablefalse
9812     \txiusebytewiseiotrue
9813   \else
9814     \txinativeunicodecapabletrue
9815     \txiusebytewiseiofalse
9816   \fi
9817 \else
9818   \txinativeunicodecapabletrue
9819   \txiusebytewiseiofalse
9820 \fi
9821
9822 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9823 % for non-UTF-8 (byte-wise) encodings.
9824 %
9825 \def\setbytewiseio{%
9826   \ifx\XeTeXrevision\thisisundefined
9827   \else
9828     \XeTeXdefaultencoding "bytes"  % For subsequent files to be read
9829     \XeTeXinputencoding "bytes"  % For document root file
9830     % Unfortunately, there seems to be no corresponding XeTeX command for
9831     % output encoding.  This is a problem for auxiliary index and TOC files.
9832     % The only solution would be perhaps to write out @U{...} sequences in
9833     % place of non-ASCII characters.
9834   \fi
9835
9836   \ifx\luatexversion\thisisundefined
9837   \else
9838     \directlua{
9839     local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9840     local function convert_char (char)
9841       return utf8_char(byte(char))
9842     end
9843
9844     local function convert_line (line)
9845       return gsub(line, ".", convert_char)
9846     end
9847
9848     callback.register("process_input_buffer", convert_line)
9849
9850     local function convert_line_out (line)
9851       local line_out = ""
9852       for c in string.utfvalues(line) do
9853          line_out = line_out .. string.char(c)
9854       end
9855       return line_out
9856     end
9857
9858     callback.register("process_output_buffer", convert_line_out)
9859     }
9860   \fi
9861
9862   \txiusebytewiseiotrue
9863 }
9864
9865
9866 % Helpers for encodings.
9867 % Set the catcode of characters 128 through 255 to the specified number.
9868 %
9869 \def\setnonasciicharscatcode#1{%
9870    \count255=128
9871    \loop\ifnum\count255<256
9872       \global\catcode\count255=#1\relax
9873       \advance\count255 by 1
9874    \repeat
9875 }
9876
9877 \def\setnonasciicharscatcodenonglobal#1{%
9878    \count255=128
9879    \loop\ifnum\count255<256
9880       \catcode\count255=#1\relax
9881       \advance\count255 by 1
9882    \repeat
9883 }
9884
9885 % @documentencoding sets the definition of non-ASCII characters
9886 % according to the specified encoding.
9887 %
9888 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9889 \def\documentencodingzzz#1{%
9890   %
9891   % Encoding being declared for the document.
9892   \def\declaredencoding{\csname #1.enc\endcsname}%
9893   %
9894   % Supported encodings: names converted to tokens in order to be able
9895   % to compare them with \ifx.
9896   \def\ascii{\csname US-ASCII.enc\endcsname}%
9897   \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9898   \def\latone{\csname ISO-8859-1.enc\endcsname}%
9899   \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9900   \def\utfeight{\csname UTF-8.enc\endcsname}%
9901   %
9902   \ifx \declaredencoding \ascii
9903      \asciichardefs
9904   %
9905   \else \ifx \declaredencoding \lattwo
9906      \iftxinativeunicodecapable
9907        \setbytewiseio
9908      \fi
9909      \setnonasciicharscatcode\active
9910      \lattwochardefs
9911   %
9912   \else \ifx \declaredencoding \latone
9913      \iftxinativeunicodecapable
9914        \setbytewiseio
9915      \fi
9916      \setnonasciicharscatcode\active
9917      \latonechardefs
9918   %
9919   \else \ifx \declaredencoding \latnine
9920      \iftxinativeunicodecapable
9921        \setbytewiseio
9922      \fi
9923      \setnonasciicharscatcode\active
9924      \latninechardefs
9925   %
9926   \else \ifx \declaredencoding \utfeight
9927      \iftxinativeunicodecapable
9928        % For native Unicode handling (XeTeX and LuaTeX)
9929        \nativeunicodechardefs
9930      \else
9931        % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX).
9932        % Since we already invoke \utfeightchardefs at the top level,
9933        % making non-ascii chars active is sufficient.
9934        \setnonasciicharscatcode\active
9935      \fi
9936   %
9937   \else
9938     \message{Ignoring unknown document encoding: #1.}%
9939   %
9940   \fi % utfeight
9941   \fi % latnine
9942   \fi % latone
9943   \fi % lattwo
9944   \fi % ascii
9945   %
9946   \ifx\XeTeXrevision\thisisundefined
9947   \else
9948     \ifx \declaredencoding \utfeight
9949     \else
9950       \ifx \declaredencoding \ascii
9951       \else
9952         \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
9953         non-ASCII characters in auxiliary files.}%
9954       \fi
9955     \fi
9956   \fi
9957 }
9958
9959 % A message to be logged when using a character that isn't available
9960 % the default font encoding (OT1).
9961 %
9962 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9963
9964 % Take account of \c (plain) vs. \, (Texinfo) difference.
9965 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9966
9967 \def\gdefchar#1#2{%
9968 \gdef#1{%
9969    \ifpassthroughchars
9970      \string#1%
9971    \else
9972      #2%
9973    \fi
9974 }}
9975
9976 \begingroup
9977
9978 % Make non-ASCII characters active for defining the character definition
9979 % macros.
9980 \setnonasciicharscatcode\active
9981
9982 % Latin1 (ISO-8859-1) character definitions.
9983 \gdef\latonechardefs{%
9984   \gdefchar^^a0{\tie}
9985   \gdefchar^^a1{\exclamdown}
9986   \gdefchar^^a2{{\tcfont \char162}} % cent
9987   \gdefchar^^a3{\pounds{}}
9988   \gdefchar^^a4{{\tcfont \char164}} % currency
9989   \gdefchar^^a5{{\tcfont \char165}} % yen
9990   \gdefchar^^a6{{\tcfont \char166}} % broken bar
9991   \gdefchar^^a7{\S}
9992   \gdefchar^^a8{\"{}}
9993   \gdefchar^^a9{\copyright{}}
9994   \gdefchar^^aa{\ordf}
9995   \gdefchar^^ab{\guillemetleft{}}
9996   \gdefchar^^ac{\ensuremath\lnot}
9997   \gdefchar^^ad{\-}
9998   \gdefchar^^ae{\registeredsymbol{}}
9999   \gdefchar^^af{\={}}
10000   %
10001   \gdefchar^^b0{\textdegree}
10002   \gdefchar^^b1{$\pm$}
10003   \gdefchar^^b2{$^2$}
10004   \gdefchar^^b3{$^3$}
10005   \gdefchar^^b4{\'{}}
10006   \gdefchar^^b5{$\mu$}
10007   \gdefchar^^b6{\P}
10008   \gdefchar^^b7{\ensuremath\cdot}
10009   \gdefchar^^b8{\cedilla\ }
10010   \gdefchar^^b9{$^1$}
10011   \gdefchar^^ba{\ordm}
10012   \gdefchar^^bb{\guillemetright{}}
10013   \gdefchar^^bc{$1\over4$}
10014   \gdefchar^^bd{$1\over2$}
10015   \gdefchar^^be{$3\over4$}
10016   \gdefchar^^bf{\questiondown}
10017   %
10018   \gdefchar^^c0{\`A}
10019   \gdefchar^^c1{\'A}
10020   \gdefchar^^c2{\^A}
10021   \gdefchar^^c3{\~A}
10022   \gdefchar^^c4{\"A}
10023   \gdefchar^^c5{\ringaccent A}
10024   \gdefchar^^c6{\AE}
10025   \gdefchar^^c7{\cedilla C}
10026   \gdefchar^^c8{\`E}
10027   \gdefchar^^c9{\'E}
10028   \gdefchar^^ca{\^E}
10029   \gdefchar^^cb{\"E}
10030   \gdefchar^^cc{\`I}
10031   \gdefchar^^cd{\'I}
10032   \gdefchar^^ce{\^I}
10033   \gdefchar^^cf{\"I}
10034   %
10035   \gdefchar^^d0{\DH}
10036   \gdefchar^^d1{\~N}
10037   \gdefchar^^d2{\`O}
10038   \gdefchar^^d3{\'O}
10039   \gdefchar^^d4{\^O}
10040   \gdefchar^^d5{\~O}
10041   \gdefchar^^d6{\"O}
10042   \gdefchar^^d7{$\times$}
10043   \gdefchar^^d8{\O}
10044   \gdefchar^^d9{\`U}
10045   \gdefchar^^da{\'U}
10046   \gdefchar^^db{\^U}
10047   \gdefchar^^dc{\"U}
10048   \gdefchar^^dd{\'Y}
10049   \gdefchar^^de{\TH}
10050   \gdefchar^^df{\ss}
10051   %
10052   \gdefchar^^e0{\`a}
10053   \gdefchar^^e1{\'a}
10054   \gdefchar^^e2{\^a}
10055   \gdefchar^^e3{\~a}
10056   \gdefchar^^e4{\"a}
10057   \gdefchar^^e5{\ringaccent a}
10058   \gdefchar^^e6{\ae}
10059   \gdefchar^^e7{\cedilla c}
10060   \gdefchar^^e8{\`e}
10061   \gdefchar^^e9{\'e}
10062   \gdefchar^^ea{\^e}
10063   \gdefchar^^eb{\"e}
10064   \gdefchar^^ec{\`{\dotless i}}
10065   \gdefchar^^ed{\'{\dotless i}}
10066   \gdefchar^^ee{\^{\dotless i}}
10067   \gdefchar^^ef{\"{\dotless i}}
10068   %
10069   \gdefchar^^f0{\dh}
10070   \gdefchar^^f1{\~n}
10071   \gdefchar^^f2{\`o}
10072   \gdefchar^^f3{\'o}
10073   \gdefchar^^f4{\^o}
10074   \gdefchar^^f5{\~o}
10075   \gdefchar^^f6{\"o}
10076   \gdefchar^^f7{$\div$}
10077   \gdefchar^^f8{\o}
10078   \gdefchar^^f9{\`u}
10079   \gdefchar^^fa{\'u}
10080   \gdefchar^^fb{\^u}
10081   \gdefchar^^fc{\"u}
10082   \gdefchar^^fd{\'y}
10083   \gdefchar^^fe{\th}
10084   \gdefchar^^ff{\"y}
10085 }
10086
10087 % Latin9 (ISO-8859-15) encoding character definitions.
10088 \gdef\latninechardefs{%
10089   % Encoding is almost identical to Latin1.
10090   \latonechardefs
10091   %
10092   \gdefchar^^a4{\euro{}}
10093   \gdefchar^^a6{\v S}
10094   \gdefchar^^a8{\v s}
10095   \gdefchar^^b4{\v Z}
10096   \gdefchar^^b8{\v z}
10097   \gdefchar^^bc{\OE}
10098   \gdefchar^^bd{\oe}
10099   \gdefchar^^be{\"Y}
10100 }
10101
10102 % Latin2 (ISO-8859-2) character definitions.
10103 \gdef\lattwochardefs{%
10104   \gdefchar^^a0{\tie}
10105   \gdefchar^^a1{\ogonek{A}}
10106   \gdefchar^^a2{\u{}}
10107   \gdefchar^^a3{\L}
10108   \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10109   \gdefchar^^a5{\v L}
10110   \gdefchar^^a6{\'S}
10111   \gdefchar^^a7{\S}
10112   \gdefchar^^a8{\"{}}
10113   \gdefchar^^a9{\v S}
10114   \gdefchar^^aa{\cedilla S}
10115   \gdefchar^^ab{\v T}
10116   \gdefchar^^ac{\'Z}
10117   \gdefchar^^ad{\-}
10118   \gdefchar^^ae{\v Z}
10119   \gdefchar^^af{\dotaccent Z}
10120   %
10121   \gdefchar^^b0{\textdegree}
10122   \gdefchar^^b1{\ogonek{a}}
10123   \gdefchar^^b2{\ogonek{ }}
10124   \gdefchar^^b3{\l}
10125   \gdefchar^^b4{\'{}}
10126   \gdefchar^^b5{\v l}
10127   \gdefchar^^b6{\'s}
10128   \gdefchar^^b7{\v{}}
10129   \gdefchar^^b8{\cedilla\ }
10130   \gdefchar^^b9{\v s}
10131   \gdefchar^^ba{\cedilla s}
10132   \gdefchar^^bb{\v t}
10133   \gdefchar^^bc{\'z}
10134   \gdefchar^^bd{\H{}}
10135   \gdefchar^^be{\v z}
10136   \gdefchar^^bf{\dotaccent z}
10137   %
10138   \gdefchar^^c0{\'R}
10139   \gdefchar^^c1{\'A}
10140   \gdefchar^^c2{\^A}
10141   \gdefchar^^c3{\u A}
10142   \gdefchar^^c4{\"A}
10143   \gdefchar^^c5{\'L}
10144   \gdefchar^^c6{\'C}
10145   \gdefchar^^c7{\cedilla C}
10146   \gdefchar^^c8{\v C}
10147   \gdefchar^^c9{\'E}
10148   \gdefchar^^ca{\ogonek{E}}
10149   \gdefchar^^cb{\"E}
10150   \gdefchar^^cc{\v E}
10151   \gdefchar^^cd{\'I}
10152   \gdefchar^^ce{\^I}
10153   \gdefchar^^cf{\v D}
10154   %
10155   \gdefchar^^d0{\DH}
10156   \gdefchar^^d1{\'N}
10157   \gdefchar^^d2{\v N}
10158   \gdefchar^^d3{\'O}
10159   \gdefchar^^d4{\^O}
10160   \gdefchar^^d5{\H O}
10161   \gdefchar^^d6{\"O}
10162   \gdefchar^^d7{$\times$}
10163   \gdefchar^^d8{\v R}
10164   \gdefchar^^d9{\ringaccent U}
10165   \gdefchar^^da{\'U}
10166   \gdefchar^^db{\H U}
10167   \gdefchar^^dc{\"U}
10168   \gdefchar^^dd{\'Y}
10169   \gdefchar^^de{\cedilla T}
10170   \gdefchar^^df{\ss}
10171   %
10172   \gdefchar^^e0{\'r}
10173   \gdefchar^^e1{\'a}
10174   \gdefchar^^e2{\^a}
10175   \gdefchar^^e3{\u a}
10176   \gdefchar^^e4{\"a}
10177   \gdefchar^^e5{\'l}
10178   \gdefchar^^e6{\'c}
10179   \gdefchar^^e7{\cedilla c}
10180   \gdefchar^^e8{\v c}
10181   \gdefchar^^e9{\'e}
10182   \gdefchar^^ea{\ogonek{e}}
10183   \gdefchar^^eb{\"e}
10184   \gdefchar^^ec{\v e}
10185   \gdefchar^^ed{\'{\dotless{i}}}
10186   \gdefchar^^ee{\^{\dotless{i}}}
10187   \gdefchar^^ef{\v d}
10188   %
10189   \gdefchar^^f0{\dh}
10190   \gdefchar^^f1{\'n}
10191   \gdefchar^^f2{\v n}
10192   \gdefchar^^f3{\'o}
10193   \gdefchar^^f4{\^o}
10194   \gdefchar^^f5{\H o}
10195   \gdefchar^^f6{\"o}
10196   \gdefchar^^f7{$\div$}
10197   \gdefchar^^f8{\v r}
10198   \gdefchar^^f9{\ringaccent u}
10199   \gdefchar^^fa{\'u}
10200   \gdefchar^^fb{\H u}
10201   \gdefchar^^fc{\"u}
10202   \gdefchar^^fd{\'y}
10203   \gdefchar^^fe{\cedilla t}
10204   \gdefchar^^ff{\dotaccent{}}
10205 }
10206
10207 \endgroup % active chars
10208
10209 % UTF-8 character definitions.
10210 %
10211 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10212 % changes for Texinfo conventions.  It is included here under the GPL by
10213 % permission from Frank Mittelbach and the LaTeX team.
10214 %
10215 \newcount\countUTFx
10216 \newcount\countUTFy
10217 \newcount\countUTFz
10218
10219 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10220    \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10221 %
10222 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10223    \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10224 %
10225 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10226    \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10227
10228 \gdef\UTFviiiDefined#1{%
10229   \ifx #1\relax
10230     \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10231   \else
10232     \expandafter #1%
10233   \fi
10234 }
10235
10236 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10237 \begingroup
10238   \catcode`\~13
10239   \catcode`\$12
10240   \catcode`\"12
10241
10242   % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10243   % substituting ~ and $ with a character token of that value.
10244   \def\UTFviiiLoop{%
10245     \global\catcode\countUTFx\active
10246     \uccode`\~\countUTFx
10247     \uccode`\$\countUTFx
10248     \uppercase\expandafter{\UTFviiiTmp}%
10249     \advance\countUTFx by 1
10250     \ifnum\countUTFx < \countUTFy
10251       \expandafter\UTFviiiLoop
10252     \fi}
10253
10254   % For bytes other than the first in a UTF-8 sequence.  Not expected to
10255   % be expanded except when writing to auxiliary files.
10256   \countUTFx = "80
10257   \countUTFy = "C2
10258   \def\UTFviiiTmp{%
10259     \gdef~{%
10260         \ifpassthroughchars $\fi}}%
10261   \UTFviiiLoop
10262
10263   \countUTFx = "C2
10264   \countUTFy = "E0
10265   \def\UTFviiiTmp{%
10266     \gdef~{%
10267         \ifpassthroughchars $%
10268         \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10269   \UTFviiiLoop
10270
10271   \countUTFx = "E0
10272   \countUTFy = "F0
10273   \def\UTFviiiTmp{%
10274     \gdef~{%
10275         \ifpassthroughchars $%
10276         \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10277   \UTFviiiLoop
10278
10279   \countUTFx = "F0
10280   \countUTFy = "F4
10281   \def\UTFviiiTmp{%
10282     \gdef~{%
10283         \ifpassthroughchars $%
10284         \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10285         }}%
10286   \UTFviiiLoop
10287 \endgroup
10288
10289 \def\globallet{\global\let} % save some \expandafter's below
10290
10291 % @U{xxxx} to produce U+xxxx, if we support it.
10292 \def\U#1{%
10293   \expandafter\ifx\csname uni:#1\endcsname \relax
10294     \iftxinativeunicodecapable
10295       % All Unicode characters can be used if native Unicode handling is
10296       % active.  However, if the font does not have the glyph,
10297       % letters are missing.
10298       \begingroup
10299         \uccode`\.="#1\relax
10300         \uppercase{.}
10301       \endgroup
10302     \else
10303       \errhelp = \EMsimple      
10304       \errmessage{Unicode character U+#1 not supported, sorry}%
10305     \fi
10306   \else
10307     \csname uni:#1\endcsname
10308   \fi
10309 }
10310
10311 % These macros are used here to construct the name of a control
10312 % sequence to be defined.
10313 \def\UTFviiiTwoOctetsName#1#2{%
10314   \csname u8:#1\string #2\endcsname}%
10315 \def\UTFviiiThreeOctetsName#1#2#3{%
10316   \csname u8:#1\string #2\string #3\endcsname}%
10317 \def\UTFviiiFourOctetsName#1#2#3#4{%
10318   \csname u8:#1\string #2\string #3\string #4\endcsname}%
10319
10320 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10321 % provide a definition macro to replace a Unicode character;
10322 % this gets used by the @U command
10323 %
10324 \begingroup
10325   \catcode`\"=12
10326   \catcode`\<=12
10327   \catcode`\.=12
10328   \catcode`\,=12
10329   \catcode`\;=12
10330   \catcode`\!=12
10331   \catcode`\~=13
10332   \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10333     \countUTFz = "#1\relax
10334     \begingroup
10335       \parseXMLCharref
10336     
10337       % Give \u8:... its definition.  The sequence of seven \expandafter's
10338       % expands after the \gdef three times, e.g.
10339       %
10340       % 1.  \UTFviiTwoOctetsName B1 B2
10341       % 2.  \csname u8:B1 \string B2 \endcsname
10342       % 3.  \u8: B1 B2  (a single control sequence token)
10343       %
10344       \expandafter\expandafter
10345       \expandafter\expandafter
10346       \expandafter\expandafter
10347       \expandafter\gdef       \UTFviiiTmp{#2}%
10348       % 
10349       \expandafter\ifx\csname uni:#1\endcsname \relax \else
10350        \message{Internal error, already defined: #1}%
10351       \fi
10352       %
10353       % define an additional control sequence for this code point.
10354       \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10355     \endgroup}
10356   %
10357   % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10358   % to the corresponding UTF-8 sequence.
10359   \gdef\parseXMLCharref{%
10360     \ifnum\countUTFz < "20\relax
10361       \errhelp = \EMsimple
10362       \errmessage{Cannot define Unicode char value < 0020}%
10363     \else\ifnum\countUTFz < "800\relax
10364       \parseUTFviiiA,%
10365       \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10366     \else\ifnum\countUTFz < "10000\relax
10367       \parseUTFviiiA;%
10368       \parseUTFviiiA,%
10369       \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10370     \else
10371       \parseUTFviiiA;%
10372       \parseUTFviiiA,%
10373       \parseUTFviiiA!%
10374       \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10375     \fi\fi\fi
10376   }
10377
10378   % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10379   % It must be a non-initial byte in the sequence.
10380   % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10381   % of the bytes.
10382   \gdef\parseUTFviiiA#1{%
10383     \countUTFx = \countUTFz
10384     \divide\countUTFz by 64
10385     \countUTFy = \countUTFz  % Save to be the future value of \countUTFz.
10386     \multiply\countUTFz by 64
10387     
10388     % \countUTFz is now \countUTFx with the last 5 bits cleared.  Subtract
10389     % in order to get the last five bits.
10390     \advance\countUTFx by -\countUTFz
10391
10392     % Convert this to the byte in the UTF-8 sequence.
10393     \advance\countUTFx by 128
10394     \uccode `#1\countUTFx
10395     \countUTFz = \countUTFy}
10396
10397   % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10398   % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10399   %    sequence.
10400   % #2 is one of the \UTFviii*OctetsName macros.
10401   % #3 is always a full stop (.)
10402   % #4 is a template for the other bytes in the sequence.  The values for these
10403   %    bytes is substituted in here with \uppercase using the \uccode's.
10404   \gdef\parseUTFviiiB#1#2#3#4{%
10405     \advance\countUTFz by "#10\relax
10406     \uccode `#3\countUTFz
10407     \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10408 \endgroup
10409
10410 % For native Unicode handling (XeTeX and LuaTeX),
10411 % provide a definition macro that sets a catcode to `other' non-globally
10412 %
10413 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10414   \catcode"#1=\other
10415 }
10416
10417 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10418 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10419 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10420 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10421 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10422
10423 % Many of our renditions are less than wonderful, and all the missing
10424 % characters are available somewhere.  Loading the necessary fonts
10425 % awaits user request.  We can't truly support Unicode without
10426 % reimplementing everything that's been done in LaTeX for many years,
10427 % plus probably using luatex or xetex, and who knows what else.
10428 % We won't be doing that here in this simple file.  But we can try to at
10429 % least make most of the characters not bomb out.
10430 %
10431 \def\unicodechardefs{%
10432   \DeclareUnicodeCharacter{0020}{ } % space
10433   \DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number
10434   \DeclareUnicodeCharacter{0022}{\char"22 }%
10435   \DeclareUnicodeCharacter{0023}{\char"23 }%
10436   \DeclareUnicodeCharacter{0024}{\char"24 }%
10437   \DeclareUnicodeCharacter{0025}{\char"25 }%
10438   \DeclareUnicodeCharacter{0026}{\char"26 }%
10439   \DeclareUnicodeCharacter{0027}{\char"27 }%
10440   \DeclareUnicodeCharacter{0028}{\char"28 }%
10441   \DeclareUnicodeCharacter{0029}{\char"29 }%
10442   \DeclareUnicodeCharacter{002A}{\char"2A }%
10443   \DeclareUnicodeCharacter{002B}{\char"2B }%
10444   \DeclareUnicodeCharacter{002C}{\char"2C }%
10445   \DeclareUnicodeCharacter{002D}{\char"2D }%
10446   \DeclareUnicodeCharacter{002E}{\char"2E }%
10447   \DeclareUnicodeCharacter{002F}{\char"2F }%
10448   \DeclareUnicodeCharacter{0030}{0}%
10449   \DeclareUnicodeCharacter{0031}{1}%
10450   \DeclareUnicodeCharacter{0032}{2}%
10451   \DeclareUnicodeCharacter{0033}{3}%
10452   \DeclareUnicodeCharacter{0034}{4}%
10453   \DeclareUnicodeCharacter{0035}{5}%
10454   \DeclareUnicodeCharacter{0036}{6}%
10455   \DeclareUnicodeCharacter{0037}{7}%
10456   \DeclareUnicodeCharacter{0038}{8}%
10457   \DeclareUnicodeCharacter{0039}{9}%
10458   \DeclareUnicodeCharacter{003A}{\char"3A }%
10459   \DeclareUnicodeCharacter{003B}{\char"3B }%
10460   \DeclareUnicodeCharacter{003C}{\char"3C }%
10461   \DeclareUnicodeCharacter{003D}{\char"3D }%
10462   \DeclareUnicodeCharacter{003E}{\char"3E }%
10463   \DeclareUnicodeCharacter{003F}{\char"3F }%
10464   \DeclareUnicodeCharacter{0040}{\char"40 }%
10465   \DeclareUnicodeCharacter{0041}{A}%
10466   \DeclareUnicodeCharacter{0042}{B}%
10467   \DeclareUnicodeCharacter{0043}{C}%
10468   \DeclareUnicodeCharacter{0044}{D}%
10469   \DeclareUnicodeCharacter{0045}{E}%
10470   \DeclareUnicodeCharacter{0046}{F}%
10471   \DeclareUnicodeCharacter{0047}{G}%
10472   \DeclareUnicodeCharacter{0048}{H}%
10473   \DeclareUnicodeCharacter{0049}{I}%
10474   \DeclareUnicodeCharacter{004A}{J}%
10475   \DeclareUnicodeCharacter{004B}{K}%
10476   \DeclareUnicodeCharacter{004C}{L}%
10477   \DeclareUnicodeCharacter{004D}{M}%
10478   \DeclareUnicodeCharacter{004E}{N}%
10479   \DeclareUnicodeCharacter{004F}{O}%
10480   \DeclareUnicodeCharacter{0050}{P}%
10481   \DeclareUnicodeCharacter{0051}{Q}%
10482   \DeclareUnicodeCharacter{0052}{R}%
10483   \DeclareUnicodeCharacter{0053}{S}%
10484   \DeclareUnicodeCharacter{0054}{T}%
10485   \DeclareUnicodeCharacter{0055}{U}%
10486   \DeclareUnicodeCharacter{0056}{V}%
10487   \DeclareUnicodeCharacter{0057}{W}%
10488   \DeclareUnicodeCharacter{0058}{X}%
10489   \DeclareUnicodeCharacter{0059}{Y}%
10490   \DeclareUnicodeCharacter{005A}{Z}%
10491   \DeclareUnicodeCharacter{005B}{\char"5B }%
10492   \DeclareUnicodeCharacter{005C}{\char"5C }%
10493   \DeclareUnicodeCharacter{005D}{\char"5D }%
10494   \DeclareUnicodeCharacter{005E}{\char"5E }%
10495   \DeclareUnicodeCharacter{005F}{\char"5F }%
10496   \DeclareUnicodeCharacter{0060}{\char"60 }%
10497   \DeclareUnicodeCharacter{0061}{a}%
10498   \DeclareUnicodeCharacter{0062}{b}%
10499   \DeclareUnicodeCharacter{0063}{c}%
10500   \DeclareUnicodeCharacter{0064}{d}%
10501   \DeclareUnicodeCharacter{0065}{e}%
10502   \DeclareUnicodeCharacter{0066}{f}%
10503   \DeclareUnicodeCharacter{0067}{g}%
10504   \DeclareUnicodeCharacter{0068}{h}%
10505   \DeclareUnicodeCharacter{0069}{i}%
10506   \DeclareUnicodeCharacter{006A}{j}%
10507   \DeclareUnicodeCharacter{006B}{k}%
10508   \DeclareUnicodeCharacter{006C}{l}%
10509   \DeclareUnicodeCharacter{006D}{m}%
10510   \DeclareUnicodeCharacter{006E}{n}%
10511   \DeclareUnicodeCharacter{006F}{o}%
10512   \DeclareUnicodeCharacter{0070}{p}%
10513   \DeclareUnicodeCharacter{0071}{q}%
10514   \DeclareUnicodeCharacter{0072}{r}%
10515   \DeclareUnicodeCharacter{0073}{s}%
10516   \DeclareUnicodeCharacter{0074}{t}%
10517   \DeclareUnicodeCharacter{0075}{u}%
10518   \DeclareUnicodeCharacter{0076}{v}%
10519   \DeclareUnicodeCharacter{0077}{w}%
10520   \DeclareUnicodeCharacter{0078}{x}%
10521   \DeclareUnicodeCharacter{0079}{y}%
10522   \DeclareUnicodeCharacter{007A}{z}%
10523   \DeclareUnicodeCharacter{007B}{\char"7B }%
10524   \DeclareUnicodeCharacter{007C}{\char"7C }%
10525   \DeclareUnicodeCharacter{007D}{\char"7D }%
10526   \DeclareUnicodeCharacter{007E}{\char"7E }%
10527   % \DeclareUnicodeCharacter{007F}{} % DEL
10528   %
10529   \DeclareUnicodeCharacter{00A0}{\tie}%
10530   \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10531   \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10532   \DeclareUnicodeCharacter{00A3}{\pounds{}}%
10533   \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10534   \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10535   \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10536   \DeclareUnicodeCharacter{00A7}{\S}%
10537   \DeclareUnicodeCharacter{00A8}{\"{ }}%
10538   \DeclareUnicodeCharacter{00A9}{\copyright{}}%
10539   \DeclareUnicodeCharacter{00AA}{\ordf}%
10540   \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
10541   \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10542   \DeclareUnicodeCharacter{00AD}{\-}%
10543   \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
10544   \DeclareUnicodeCharacter{00AF}{\={ }}%
10545   %
10546   \DeclareUnicodeCharacter{00B0}{\textdegree}%
10547   \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10548   \DeclareUnicodeCharacter{00B2}{$^2$}%
10549   \DeclareUnicodeCharacter{00B3}{$^3$}%
10550   \DeclareUnicodeCharacter{00B4}{\'{ }}%
10551   \DeclareUnicodeCharacter{00B5}{$\mu$}%
10552   \DeclareUnicodeCharacter{00B6}{\P}%
10553   \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10554   \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10555   \DeclareUnicodeCharacter{00B9}{$^1$}%
10556   \DeclareUnicodeCharacter{00BA}{\ordm}%
10557   \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
10558   \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10559   \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10560   \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10561   \DeclareUnicodeCharacter{00BF}{\questiondown}%
10562   %
10563   \DeclareUnicodeCharacter{00C0}{\`A}%
10564   \DeclareUnicodeCharacter{00C1}{\'A}%
10565   \DeclareUnicodeCharacter{00C2}{\^A}%
10566   \DeclareUnicodeCharacter{00C3}{\~A}%
10567   \DeclareUnicodeCharacter{00C4}{\"A}%
10568   \DeclareUnicodeCharacter{00C5}{\AA}%
10569   \DeclareUnicodeCharacter{00C6}{\AE}%
10570   \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10571   \DeclareUnicodeCharacter{00C8}{\`E}%
10572   \DeclareUnicodeCharacter{00C9}{\'E}%
10573   \DeclareUnicodeCharacter{00CA}{\^E}%
10574   \DeclareUnicodeCharacter{00CB}{\"E}%
10575   \DeclareUnicodeCharacter{00CC}{\`I}%
10576   \DeclareUnicodeCharacter{00CD}{\'I}%
10577   \DeclareUnicodeCharacter{00CE}{\^I}%
10578   \DeclareUnicodeCharacter{00CF}{\"I}%
10579   %
10580   \DeclareUnicodeCharacter{00D0}{\DH}%
10581   \DeclareUnicodeCharacter{00D1}{\~N}%
10582   \DeclareUnicodeCharacter{00D2}{\`O}%
10583   \DeclareUnicodeCharacter{00D3}{\'O}%
10584   \DeclareUnicodeCharacter{00D4}{\^O}%
10585   \DeclareUnicodeCharacter{00D5}{\~O}%
10586   \DeclareUnicodeCharacter{00D6}{\"O}%
10587   \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10588   \DeclareUnicodeCharacter{00D8}{\O}%
10589   \DeclareUnicodeCharacter{00D9}{\`U}%
10590   \DeclareUnicodeCharacter{00DA}{\'U}%
10591   \DeclareUnicodeCharacter{00DB}{\^U}%
10592   \DeclareUnicodeCharacter{00DC}{\"U}%
10593   \DeclareUnicodeCharacter{00DD}{\'Y}%
10594   \DeclareUnicodeCharacter{00DE}{\TH}%
10595   \DeclareUnicodeCharacter{00DF}{\ss}%
10596   %
10597   \DeclareUnicodeCharacter{00E0}{\`a}%
10598   \DeclareUnicodeCharacter{00E1}{\'a}%
10599   \DeclareUnicodeCharacter{00E2}{\^a}%
10600   \DeclareUnicodeCharacter{00E3}{\~a}%
10601   \DeclareUnicodeCharacter{00E4}{\"a}%
10602   \DeclareUnicodeCharacter{00E5}{\aa}%
10603   \DeclareUnicodeCharacter{00E6}{\ae}%
10604   \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10605   \DeclareUnicodeCharacter{00E8}{\`e}%
10606   \DeclareUnicodeCharacter{00E9}{\'e}%
10607   \DeclareUnicodeCharacter{00EA}{\^e}%
10608   \DeclareUnicodeCharacter{00EB}{\"e}%
10609   \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10610   \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10611   \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10612   \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10613   %
10614   \DeclareUnicodeCharacter{00F0}{\dh}%
10615   \DeclareUnicodeCharacter{00F1}{\~n}%
10616   \DeclareUnicodeCharacter{00F2}{\`o}%
10617   \DeclareUnicodeCharacter{00F3}{\'o}%
10618   \DeclareUnicodeCharacter{00F4}{\^o}%
10619   \DeclareUnicodeCharacter{00F5}{\~o}%
10620   \DeclareUnicodeCharacter{00F6}{\"o}%
10621   \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10622   \DeclareUnicodeCharacter{00F8}{\o}%
10623   \DeclareUnicodeCharacter{00F9}{\`u}%
10624   \DeclareUnicodeCharacter{00FA}{\'u}%
10625   \DeclareUnicodeCharacter{00FB}{\^u}%
10626   \DeclareUnicodeCharacter{00FC}{\"u}%
10627   \DeclareUnicodeCharacter{00FD}{\'y}%
10628   \DeclareUnicodeCharacter{00FE}{\th}%
10629   \DeclareUnicodeCharacter{00FF}{\"y}%
10630   %
10631   \DeclareUnicodeCharacter{0100}{\=A}%
10632   \DeclareUnicodeCharacter{0101}{\=a}%
10633   \DeclareUnicodeCharacter{0102}{\u{A}}%
10634   \DeclareUnicodeCharacter{0103}{\u{a}}%
10635   \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10636   \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10637   \DeclareUnicodeCharacter{0106}{\'C}%
10638   \DeclareUnicodeCharacter{0107}{\'c}%
10639   \DeclareUnicodeCharacter{0108}{\^C}%
10640   \DeclareUnicodeCharacter{0109}{\^c}%
10641   \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10642   \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10643   \DeclareUnicodeCharacter{010C}{\v{C}}%
10644   \DeclareUnicodeCharacter{010D}{\v{c}}%
10645   \DeclareUnicodeCharacter{010E}{\v{D}}%
10646   \DeclareUnicodeCharacter{010F}{d'}%
10647   %
10648   \DeclareUnicodeCharacter{0110}{\DH}%
10649   \DeclareUnicodeCharacter{0111}{\dh}%
10650   \DeclareUnicodeCharacter{0112}{\=E}%
10651   \DeclareUnicodeCharacter{0113}{\=e}%
10652   \DeclareUnicodeCharacter{0114}{\u{E}}%
10653   \DeclareUnicodeCharacter{0115}{\u{e}}%
10654   \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10655   \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10656   \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10657   \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10658   \DeclareUnicodeCharacter{011A}{\v{E}}%
10659   \DeclareUnicodeCharacter{011B}{\v{e}}%
10660   \DeclareUnicodeCharacter{011C}{\^G}%
10661   \DeclareUnicodeCharacter{011D}{\^g}%
10662   \DeclareUnicodeCharacter{011E}{\u{G}}%
10663   \DeclareUnicodeCharacter{011F}{\u{g}}%
10664   %
10665   \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10666   \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10667   \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10668   \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10669   \DeclareUnicodeCharacter{0124}{\^H}%
10670   \DeclareUnicodeCharacter{0125}{\^h}%
10671   \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10672   \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10673   \DeclareUnicodeCharacter{0128}{\~I}%
10674   \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10675   \DeclareUnicodeCharacter{012A}{\=I}%
10676   \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10677   \DeclareUnicodeCharacter{012C}{\u{I}}%
10678   \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10679   \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10680   \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10681   %
10682   \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10683   \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10684   \DeclareUnicodeCharacter{0132}{IJ}%
10685   \DeclareUnicodeCharacter{0133}{ij}%
10686   \DeclareUnicodeCharacter{0134}{\^J}%
10687   \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10688   \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10689   \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10690   \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10691   \DeclareUnicodeCharacter{0139}{\'L}%
10692   \DeclareUnicodeCharacter{013A}{\'l}%
10693   \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10694   \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10695   \DeclareUnicodeCharacter{013D}{L'}% should kern
10696   \DeclareUnicodeCharacter{013E}{l'}% should kern
10697   \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10698   %
10699   \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10700   \DeclareUnicodeCharacter{0141}{\L}%
10701   \DeclareUnicodeCharacter{0142}{\l}%
10702   \DeclareUnicodeCharacter{0143}{\'N}%
10703   \DeclareUnicodeCharacter{0144}{\'n}%
10704   \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10705   \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10706   \DeclareUnicodeCharacter{0147}{\v{N}}%
10707   \DeclareUnicodeCharacter{0148}{\v{n}}%
10708   \DeclareUnicodeCharacter{0149}{'n}%
10709   \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10710   \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10711   \DeclareUnicodeCharacter{014C}{\=O}%
10712   \DeclareUnicodeCharacter{014D}{\=o}%
10713   \DeclareUnicodeCharacter{014E}{\u{O}}%
10714   \DeclareUnicodeCharacter{014F}{\u{o}}%
10715   %
10716   \DeclareUnicodeCharacter{0150}{\H{O}}%
10717   \DeclareUnicodeCharacter{0151}{\H{o}}%
10718   \DeclareUnicodeCharacter{0152}{\OE}%
10719   \DeclareUnicodeCharacter{0153}{\oe}%
10720   \DeclareUnicodeCharacter{0154}{\'R}%
10721   \DeclareUnicodeCharacter{0155}{\'r}%
10722   \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10723   \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10724   \DeclareUnicodeCharacter{0158}{\v{R}}%
10725   \DeclareUnicodeCharacter{0159}{\v{r}}%
10726   \DeclareUnicodeCharacter{015A}{\'S}%
10727   \DeclareUnicodeCharacter{015B}{\'s}%
10728   \DeclareUnicodeCharacter{015C}{\^S}%
10729   \DeclareUnicodeCharacter{015D}{\^s}%
10730   \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10731   \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10732   %
10733   \DeclareUnicodeCharacter{0160}{\v{S}}%
10734   \DeclareUnicodeCharacter{0161}{\v{s}}%
10735   \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10736   \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10737   \DeclareUnicodeCharacter{0164}{\v{T}}%
10738   \DeclareUnicodeCharacter{0165}{\v{t}}%
10739   \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10740   \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10741   \DeclareUnicodeCharacter{0168}{\~U}%
10742   \DeclareUnicodeCharacter{0169}{\~u}%
10743   \DeclareUnicodeCharacter{016A}{\=U}%
10744   \DeclareUnicodeCharacter{016B}{\=u}%
10745   \DeclareUnicodeCharacter{016C}{\u{U}}%
10746   \DeclareUnicodeCharacter{016D}{\u{u}}%
10747   \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10748   \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10749   %
10750   \DeclareUnicodeCharacter{0170}{\H{U}}%
10751   \DeclareUnicodeCharacter{0171}{\H{u}}%
10752   \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10753   \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10754   \DeclareUnicodeCharacter{0174}{\^W}%
10755   \DeclareUnicodeCharacter{0175}{\^w}%
10756   \DeclareUnicodeCharacter{0176}{\^Y}%
10757   \DeclareUnicodeCharacter{0177}{\^y}%
10758   \DeclareUnicodeCharacter{0178}{\"Y}%
10759   \DeclareUnicodeCharacter{0179}{\'Z}%
10760   \DeclareUnicodeCharacter{017A}{\'z}%
10761   \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10762   \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10763   \DeclareUnicodeCharacter{017D}{\v{Z}}%
10764   \DeclareUnicodeCharacter{017E}{\v{z}}%
10765   \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10766   %
10767   \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10768   \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10769   \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10770   \DeclareUnicodeCharacter{01C7}{LJ}%
10771   \DeclareUnicodeCharacter{01C8}{Lj}%
10772   \DeclareUnicodeCharacter{01C9}{lj}%
10773   \DeclareUnicodeCharacter{01CA}{NJ}%
10774   \DeclareUnicodeCharacter{01CB}{Nj}%
10775   \DeclareUnicodeCharacter{01CC}{nj}%
10776   \DeclareUnicodeCharacter{01CD}{\v{A}}%
10777   \DeclareUnicodeCharacter{01CE}{\v{a}}%
10778   \DeclareUnicodeCharacter{01CF}{\v{I}}%
10779   %
10780   \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10781   \DeclareUnicodeCharacter{01D1}{\v{O}}%
10782   \DeclareUnicodeCharacter{01D2}{\v{o}}%
10783   \DeclareUnicodeCharacter{01D3}{\v{U}}%
10784   \DeclareUnicodeCharacter{01D4}{\v{u}}%
10785   %
10786   \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10787   \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10788   \DeclareUnicodeCharacter{01E6}{\v{G}}%
10789   \DeclareUnicodeCharacter{01E7}{\v{g}}%
10790   \DeclareUnicodeCharacter{01E8}{\v{K}}%
10791   \DeclareUnicodeCharacter{01E9}{\v{k}}%
10792   %
10793   \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10794   \DeclareUnicodeCharacter{01F1}{DZ}%
10795   \DeclareUnicodeCharacter{01F2}{Dz}%
10796   \DeclareUnicodeCharacter{01F3}{dz}%
10797   \DeclareUnicodeCharacter{01F4}{\'G}%
10798   \DeclareUnicodeCharacter{01F5}{\'g}%
10799   \DeclareUnicodeCharacter{01F8}{\`N}%
10800   \DeclareUnicodeCharacter{01F9}{\`n}%
10801   \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10802   \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10803   \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10804   \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10805   %
10806   \DeclareUnicodeCharacter{021E}{\v{H}}%
10807   \DeclareUnicodeCharacter{021F}{\v{h}}%
10808   %
10809   \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10810   \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10811   \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10812   \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10813   \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10814   \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10815   %
10816   \DeclareUnicodeCharacter{0232}{\=Y}%
10817   \DeclareUnicodeCharacter{0233}{\=y}%
10818   \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10819   %
10820   \DeclareUnicodeCharacter{02BC}{'}%
10821   %
10822   \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10823   %
10824   % Greek letters upper case
10825   \DeclareUnicodeCharacter{0391}{{\it A}}%
10826   \DeclareUnicodeCharacter{0392}{{\it B}}%
10827   \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10828   \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10829   \DeclareUnicodeCharacter{0395}{{\it E}}%
10830   \DeclareUnicodeCharacter{0396}{{\it Z}}%
10831   \DeclareUnicodeCharacter{0397}{{\it H}}%
10832   \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10833   \DeclareUnicodeCharacter{0399}{{\it I}}%
10834   \DeclareUnicodeCharacter{039A}{{\it K}}%
10835   \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10836   \DeclareUnicodeCharacter{039C}{{\it M}}%
10837   \DeclareUnicodeCharacter{039D}{{\it N}}%
10838   \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10839   \DeclareUnicodeCharacter{039F}{{\it O}}%
10840   \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10841   \DeclareUnicodeCharacter{03A1}{{\it P}}%
10842   %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10843   \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10844   \DeclareUnicodeCharacter{03A4}{{\it T}}%
10845   \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10846   \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10847   \DeclareUnicodeCharacter{03A7}{{\it X}}%
10848   \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10849   \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10850   %
10851   % Vowels with accents
10852   \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10853   \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10854   \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10855   \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10856   \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10857   \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10858   %
10859   % Standalone accent
10860   \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10861   %
10862   % Greek letters lower case
10863   \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10864   \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10865   \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10866   \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10867   \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10868   \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10869   \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10870   \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10871   \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10872   \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10873   \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10874   \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10875   \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10876   \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10877   \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10878   \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10879   \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10880   \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10881   \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10882   \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10883   \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10884   \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10885   \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10886   \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10887   \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10888   %
10889   % More Greek vowels with accents
10890   \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10891   \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10892   \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10893   \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10894   \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10895   %
10896   % Variant Greek letters
10897   \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10898   \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10899   \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10900   %
10901   \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10902   \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10903   \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10904   \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10905   \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10906   \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10907   \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10908   \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10909   \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10910   \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10911   \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10912   \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10913   %
10914   \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10915   \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10916   %
10917   \DeclareUnicodeCharacter{1E20}{\=G}%
10918   \DeclareUnicodeCharacter{1E21}{\=g}%
10919   \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10920   \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10921   \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10922   \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10923   \DeclareUnicodeCharacter{1E26}{\"H}%
10924   \DeclareUnicodeCharacter{1E27}{\"h}%
10925   %
10926   \DeclareUnicodeCharacter{1E30}{\'K}%
10927   \DeclareUnicodeCharacter{1E31}{\'k}%
10928   \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10929   \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10930   \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10931   \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10932   \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10933   \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10934   \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10935   \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10936   \DeclareUnicodeCharacter{1E3E}{\'M}%
10937   \DeclareUnicodeCharacter{1E3F}{\'m}%
10938   %
10939   \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10940   \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10941   \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10942   \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10943   \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10944   \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10945   \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10946   \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10947   \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10948   \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10949   %
10950   \DeclareUnicodeCharacter{1E54}{\'P}%
10951   \DeclareUnicodeCharacter{1E55}{\'p}%
10952   \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10953   \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10954   \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10955   \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10956   \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10957   \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10958   \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10959   \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10960   %
10961   \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10962   \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10963   \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10964   \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10965   \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10966   \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10967   \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10968   \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10969   \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10970   \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10971   %
10972   \DeclareUnicodeCharacter{1E7C}{\~V}%
10973   \DeclareUnicodeCharacter{1E7D}{\~v}%
10974   \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10975   \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10976   %
10977   \DeclareUnicodeCharacter{1E80}{\`W}%
10978   \DeclareUnicodeCharacter{1E81}{\`w}%
10979   \DeclareUnicodeCharacter{1E82}{\'W}%
10980   \DeclareUnicodeCharacter{1E83}{\'w}%
10981   \DeclareUnicodeCharacter{1E84}{\"W}%
10982   \DeclareUnicodeCharacter{1E85}{\"w}%
10983   \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10984   \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10985   \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10986   \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10987   \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10988   \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10989   \DeclareUnicodeCharacter{1E8C}{\"X}%
10990   \DeclareUnicodeCharacter{1E8D}{\"x}%
10991   \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10992   \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10993   %
10994   \DeclareUnicodeCharacter{1E90}{\^Z}%
10995   \DeclareUnicodeCharacter{1E91}{\^z}%
10996   \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10997   \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10998   \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10999   \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
11000   \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
11001   \DeclareUnicodeCharacter{1E97}{\"t}%
11002   \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
11003   \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
11004   %
11005   \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
11006   \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
11007   %
11008   \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
11009   \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
11010   \DeclareUnicodeCharacter{1EBC}{\~E}%
11011   \DeclareUnicodeCharacter{1EBD}{\~e}%
11012   %
11013   \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
11014   \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
11015   \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
11016   \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
11017   %
11018   \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
11019   \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
11020   %
11021   \DeclareUnicodeCharacter{1EF2}{\`Y}%
11022   \DeclareUnicodeCharacter{1EF3}{\`y}%
11023   \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
11024   %
11025   \DeclareUnicodeCharacter{1EF8}{\~Y}%
11026   \DeclareUnicodeCharacter{1EF9}{\~y}%
11027   %
11028   % Exotic spaces
11029   \DeclareUnicodeCharacter{2007}{\hphantom{0}}%
11030   %
11031   % Punctuation
11032   \DeclareUnicodeCharacter{2013}{--}%
11033   \DeclareUnicodeCharacter{2014}{---}%
11034   \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
11035   \DeclareUnicodeCharacter{2019}{\quoteright{}}%
11036   \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
11037   \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
11038   \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
11039   \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
11040   \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
11041   \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
11042   \DeclareUnicodeCharacter{2022}{\bullet{}}%
11043   \DeclareUnicodeCharacter{202F}{\thinspace}%
11044   \DeclareUnicodeCharacter{2026}{\dots{}}%
11045   \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
11046   \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
11047   %
11048   \DeclareUnicodeCharacter{20AC}{\euro{}}%
11049   %
11050   \DeclareUnicodeCharacter{2192}{\arrow}%
11051   \DeclareUnicodeCharacter{21D2}{\result{}}%
11052   %
11053   % Mathematical symbols
11054   \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
11055   \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
11056   \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
11057   \DeclareUnicodeCharacter{2212}{\minus{}}%
11058   \DeclareUnicodeCharacter{2217}{\ast}%
11059   \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
11060   \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
11061   \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
11062   \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
11063   \DeclareUnicodeCharacter{2261}{\equiv{}}%
11064   \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
11065   \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
11066   \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
11067   \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
11068   %
11069   \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
11070   \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
11071   \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
11072   \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
11073   \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
11074   \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
11075   \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
11076   \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11077   \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11078   \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11079   \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11080   \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11081   \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11082   \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11083   \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11084   \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11085   \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11086   \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11087   \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11088   \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11089   \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11090   \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11091   \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11092   \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11093   \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11094   \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11095   \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11096   \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11097   \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11098   \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11099   \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11100   \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11101   \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11102   \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11103   \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11104   \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11105   \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11106   \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11107   \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11108   \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11109   \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11110   \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11111   \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11112   \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11113   \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11114   \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11115   \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11116   \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11117   \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11118   \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11119   \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11120   \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11121   \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11122   \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11123   \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11124   \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11125   \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11126   \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11127   \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11128   \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11129   \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11130   \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11131   \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11132   \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11133   \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11134   \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11135   \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11136   \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11137   \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11138   \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11139   \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11140   \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11141   \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11142   \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11143   \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11144   \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11145   \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11146   \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11147   \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11148   \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11149   \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11150   \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11151   \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11152   \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11153   \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11154   \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11155   \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11156   \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11157   \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11158   \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11159   \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11160   %
11161   \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11162   \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11163   \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11164   \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11165   \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
11166   \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11167   \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11168   \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11169   \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11170   \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11171   \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11172   \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11173   \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11174   \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11175   \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11176   \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11177   \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11178   \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11179   \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11180   \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11181   \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11182   \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11183   \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11184   \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11185   \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11186   \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11187   \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11188   \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11189   \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11190   %
11191   \global\mathchardef\checkmark="1370% actually the square root sign
11192   \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11193 }% end of \unicodechardefs
11194
11195 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11196 % It makes the setting that replace UTF-8 byte sequence.
11197 \def\utfeightchardefs{%
11198   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11199   \unicodechardefs
11200 }
11201
11202 % Whether the active definitions of non-ASCII characters expand to
11203 % non-active tokens with the same character code.  This is used to
11204 % write characters literally, instead of using active definitions for
11205 % printing the correct glyphs.
11206 \newif\ifpassthroughchars
11207 \passthroughcharsfalse
11208
11209 % For native Unicode handling (XeTeX and LuaTeX),
11210 % provide a definition macro to replace/pass-through a Unicode character
11211 %
11212 \def\DeclareUnicodeCharacterNative#1#2{%
11213   \ifnum"#1>"7F % only make non-ASCII chars active
11214     \catcode"#1=\active
11215     \def\dodeclareunicodecharacternative##1##2##3{%
11216       \begingroup
11217         \uccode`\~="##2\relax
11218         \uppercase{\gdef~}{%
11219           \ifpassthroughchars
11220             ##1%
11221           \else
11222             ##3%
11223           \fi
11224         }
11225       \endgroup
11226     }
11227     \begingroup
11228       \uccode`\.="#1\relax
11229       \uppercase{\def\UTFNativeTmp{.}}%
11230       \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11231     \endgroup
11232   \fi
11233 }
11234
11235 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11236 % It activates the setting that replaces Unicode characters.
11237 \def\nativeunicodechardefs{%
11238   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11239   \unicodechardefs
11240 }
11241
11242 % For native Unicode handling (XeTeX and LuaTeX),
11243 % make the character token expand
11244 % to the sequences given in \unicodechardefs for printing.
11245 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11246   \def\UTFAtUTmp{#2}
11247   \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11248 }
11249
11250 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11251 \def\nativeunicodechardefsatu{%
11252   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11253   \unicodechardefs
11254 }
11255
11256 % US-ASCII character definitions.
11257 \def\asciichardefs{% nothing need be done
11258    \relax
11259 }
11260
11261 % Define all Unicode characters we know about
11262 \iftxinativeunicodecapable
11263   \nativeunicodechardefsatu
11264 \else
11265   \utfeightchardefs
11266 \fi
11267
11268
11269 \message{formatting,}
11270
11271 \newdimen\defaultparindent \defaultparindent = 15pt
11272
11273 \chapheadingskip = 15pt plus 4pt minus 2pt
11274 \secheadingskip = 12pt plus 3pt minus 2pt
11275 \subsecheadingskip = 9pt plus 2pt minus 2pt
11276
11277 % Prevent underfull vbox error messages.
11278 \vbadness = 10000
11279
11280 % Don't be very finicky about underfull hboxes, either.
11281 \hbadness = 6666
11282
11283 % Following George Bush, get rid of widows and orphans.
11284 \widowpenalty=10000
11285 \clubpenalty=10000
11286
11287 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11288 % using an old version of TeX, don't do anything.  We want the amount of
11289 % stretch added to depend on the line length, hence the dependence on
11290 % \hsize.  We call this whenever the paper size is set.
11291 %
11292 \def\setemergencystretch{%
11293   \ifx\emergencystretch\thisisundefined
11294     % Allow us to assign to \emergencystretch anyway.
11295     \def\emergencystretch{\dimen0}%
11296   \else
11297     \emergencystretch = .15\hsize
11298   \fi
11299 }
11300
11301 % Parameters in order: 1) textheight; 2) textwidth;
11302 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11303 % 7) physical page height; 8) physical page width.
11304 %
11305 % We also call \setleading{\textleading}, so the caller should define
11306 % \textleading.  The caller should also set \parskip.
11307 %
11308 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11309   \voffset = #3\relax
11310   \topskip = #6\relax
11311   \splittopskip = \topskip
11312   %
11313   \vsize = #1\relax
11314   \advance\vsize by \topskip
11315   \txipageheight = \vsize
11316   %
11317   \hsize = #2\relax
11318   \txipagewidth = \hsize
11319   %
11320   \normaloffset = #4\relax
11321   \bindingoffset = #5\relax
11322   %
11323   \ifpdf
11324     \pdfpageheight #7\relax
11325     \pdfpagewidth #8\relax
11326     % if we don't reset these, they will remain at "1 true in" of
11327     % whatever layout pdftex was dumped with.
11328     \pdfhorigin = 1 true in
11329     \pdfvorigin = 1 true in
11330   \else
11331     \ifx\XeTeXrevision\thisisundefined
11332       \special{papersize=#8,#7}%
11333     \else
11334       \pdfpageheight #7\relax
11335       \pdfpagewidth #8\relax
11336       % XeTeX does not have \pdfhorigin and \pdfvorigin.
11337     \fi
11338   \fi
11339   %
11340   \setleading{\textleading}
11341   %
11342   \parindent = \defaultparindent
11343   \setemergencystretch
11344 }
11345
11346 % @letterpaper (the default).
11347 \def\letterpaper{{\globaldefs = 1
11348   \parskip = 3pt plus 2pt minus 1pt
11349   \textleading = 13.2pt
11350   %
11351   % If page is nothing but text, make it come out even.
11352   \internalpagesizes{607.2pt}{6in}% that's 46 lines
11353                     {\voffset}{.25in}%
11354                     {\bindingoffset}{36pt}%
11355                     {11in}{8.5in}%
11356 }}
11357
11358 % Use @smallbook to reset parameters for 7x9.25 trim size.
11359 \def\smallbook{{\globaldefs = 1
11360   \parskip = 2pt plus 1pt
11361   \textleading = 12pt
11362   %
11363   \internalpagesizes{7.5in}{5in}%
11364                     {-.2in}{0in}%
11365                     {\bindingoffset}{16pt}%
11366                     {9.25in}{7in}%
11367   %
11368   \lispnarrowing = 0.3in
11369   \tolerance = 700
11370   \contentsrightmargin = 0pt
11371   \defbodyindent = .5cm
11372 }}
11373
11374 % Use @afourpaper to print on European A4 paper.
11375 \def\afourpaper{{\globaldefs = 1
11376   \parskip = 3pt plus 2pt minus 1pt
11377   \textleading = 13.2pt
11378   %
11379   % Double-side printing via postscript on Laserjet 4050
11380   % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11381   % To change the settings for a different printer or situation, adjust
11382   % \normaloffset until the front-side and back-side texts align.  Then
11383   % do the same for \bindingoffset.  You can set these for testing in
11384   % your texinfo source file like this:
11385   % @tex
11386   % \global\normaloffset = -6mm
11387   % \global\bindingoffset = 10mm
11388   % @end tex
11389   \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11390                     {\voffset}{\hoffset}%
11391                     {\bindingoffset}{44pt}%
11392                     {297mm}{210mm}%
11393   %
11394   \tolerance = 700
11395   \contentsrightmargin = 0pt
11396   \defbodyindent = 5mm
11397 }}
11398
11399 % Use @afivepaper to print on European A5 paper.
11400 % From romildo@urano.iceb.ufop.br, 2 July 2000.
11401 % He also recommends making @example and @lisp be small.
11402 \def\afivepaper{{\globaldefs = 1
11403   \parskip = 2pt plus 1pt minus 0.1pt
11404   \textleading = 12.5pt
11405   %
11406   \internalpagesizes{160mm}{120mm}%
11407                     {\voffset}{-11.4mm}%
11408                     {\bindingoffset}{8pt}%
11409                     {210mm}{148mm}%
11410   %
11411   \lispnarrowing = 0.2in
11412   \tolerance = 800
11413   \contentsrightmargin = 0pt
11414   \defbodyindent = 2mm
11415   \tableindent = 12mm
11416 }}
11417
11418 % A specific text layout, 24x15cm overall, intended for A4 paper.
11419 \def\afourlatex{{\globaldefs = 1
11420   \afourpaper
11421   \internalpagesizes{237mm}{150mm}%
11422                     {\voffset}{4.6mm}%
11423                     {\bindingoffset}{7mm}%
11424                     {297mm}{210mm}%
11425   %
11426   % Must explicitly reset to 0 because we call \afourpaper.
11427   \globaldefs = 0
11428 }}
11429
11430 % Use @afourwide to print on A4 paper in landscape format.
11431 \def\afourwide{{\globaldefs = 1
11432   \afourpaper
11433   \internalpagesizes{241mm}{165mm}%
11434                     {\voffset}{-2.95mm}%
11435                     {\bindingoffset}{7mm}%
11436                     {297mm}{210mm}%
11437   \globaldefs = 0
11438 }}
11439
11440 \def\bsixpaper{{\globaldefs = 1
11441   \afourpaper
11442   \internalpagesizes{140mm}{100mm}%
11443                     {-6.35mm}{-12.7mm}%
11444                     {\bindingoffset}{14pt}%
11445                     {176mm}{125mm}%
11446   \let\SETdispenvsize=\smallword
11447   \lispnarrowing = 0.2in
11448   \globaldefs = 0
11449 }}
11450
11451
11452 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11453 % Perhaps we should allow setting the margins, \topskip, \parskip,
11454 % and/or leading, also. Or perhaps we should compute them somehow.
11455 %
11456 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11457 \def\pagesizesyyy#1,#2,#3\finish{{%
11458   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11459   \globaldefs = 1
11460   %
11461   \parskip = 3pt plus 2pt minus 1pt
11462   \setleading{\textleading}%
11463   %
11464   \dimen0 = #1\relax
11465   \advance\dimen0 by 2.5in % default 1in margin above heading line
11466                            % and 1.5in to include heading, footing and
11467                            % bottom margin
11468   %
11469   \dimen2 = \hsize
11470   \advance\dimen2 by 2in % default to 1 inch margin on each side
11471   %
11472   \internalpagesizes{#1}{\hsize}%
11473                     {\voffset}{\normaloffset}%
11474                     {\bindingoffset}{44pt}%
11475                     {\dimen0}{\dimen2}%
11476 }}
11477
11478 % Set default to letter.
11479 %
11480 \letterpaper
11481
11482 % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
11483 \hfuzz = 1pt
11484
11485
11486 \message{microtype,}
11487
11488 % protrusion, from Thanh's protcode.tex.
11489 \def\mtsetprotcode#1{%
11490   \rpcode#1`\!=200  \rpcode#1`\,=700  \rpcode#1`\-=700  \rpcode#1`\.=700
11491   \rpcode#1`\;=500  \rpcode#1`\:=500  \rpcode#1`\?=200
11492   \rpcode#1`\'=700
11493   \rpcode#1 34=500  % ''
11494   \rpcode#1 123=300 % --
11495   \rpcode#1 124=200 % ---
11496   \rpcode#1`\)=50   \rpcode#1`\A=50   \rpcode#1`\F=50   \rpcode#1`\K=50
11497   \rpcode#1`\L=50   \rpcode#1`\T=50   \rpcode#1`\V=50   \rpcode#1`\W=50
11498   \rpcode#1`\X=50   \rpcode#1`\Y=50   \rpcode#1`\k=50   \rpcode#1`\r=50
11499   \rpcode#1`\t=50   \rpcode#1`\v=50   \rpcode#1`\w=50   \rpcode#1`\x=50
11500   \rpcode#1`\y=50
11501   %
11502   \lpcode#1`\`=700
11503   \lpcode#1 92=500  % ``
11504   \lpcode#1`\(=50   \lpcode#1`\A=50   \lpcode#1`\J=50   \lpcode#1`\T=50
11505   \lpcode#1`\V=50   \lpcode#1`\W=50   \lpcode#1`\X=50   \lpcode#1`\Y=50
11506   \lpcode#1`\v=50   \lpcode#1`\w=50   \lpcode#1`\x=50   \lpcode#1`\y=0
11507   %
11508   \mtadjustprotcode#1\relax
11509 }
11510
11511 \newcount\countC
11512 \def\mtadjustprotcode#1{%
11513   \countC=0
11514   \loop
11515     \ifcase\lpcode#1\countC\else
11516       \mtadjustcp\lpcode#1\countC
11517     \fi
11518     \ifcase\rpcode#1\countC\else
11519       \mtadjustcp\rpcode#1\countC
11520     \fi
11521     \advance\countC 1
11522   \ifnum\countC < 256 \repeat
11523 }
11524
11525 \newcount\countB
11526 \def\mtadjustcp#1#2#3{%
11527   \setbox\boxA=\hbox{%
11528     \ifx#2\font\else#2\fi
11529     \char#3}%
11530   \countB=\wd\boxA
11531   \multiply\countB #1#2#3\relax
11532   \divide\countB \fontdimen6 #2\relax
11533   #1#2#3=\countB\relax
11534 }
11535
11536 \ifx\XeTeXrevision\thisisundefined
11537   \ifx\luatexversion\thisisundefined
11538     \ifpdf % pdfTeX
11539       \mtsetprotcode\textrm
11540       \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
11541     \else % TeX
11542       \def\mtfontexpand#1{}
11543     \fi
11544   \else % LuaTeX
11545     \mtsetprotcode\textrm
11546     \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
11547   \fi
11548 \else % XeTeX
11549   \mtsetprotcode\textrm
11550   \def\mtfontexpand#1{}
11551 \fi
11552
11553
11554 \newif\ifmicrotype
11555
11556 \def\microtypeON{%
11557   \microtypetrue
11558   %
11559   \ifx\XeTeXrevision\thisisundefined
11560     \ifx\luatexversion\thisisundefined
11561       \ifpdf % pdfTeX
11562         \pdfadjustspacing=2
11563         \pdfprotrudechars=2
11564       \fi
11565     \else % LuaTeX
11566       \adjustspacing=2
11567       \protrudechars=2
11568     \fi
11569   \else % XeTeX
11570     \XeTeXprotrudechars=2
11571   \fi
11572   %
11573   \mtfontexpand\textrm
11574   \mtfontexpand\textsl
11575   \mtfontexpand\textbf
11576 }
11577
11578 \def\microtypeOFF{%
11579   \microtypefalse
11580   %
11581   \ifx\XeTeXrevision\thisisundefined
11582     \ifx\luatexversion\thisisundefined
11583       \ifpdf % pdfTeX
11584         \pdfadjustspacing=0
11585         \pdfprotrudechars=0
11586       \fi
11587     \else % LuaTeX
11588       \adjustspacing=0
11589       \protrudechars=0
11590     \fi
11591   \else % XeTeX
11592     \XeTeXprotrudechars=0
11593   \fi
11594 }
11595
11596 \microtypeOFF
11597
11598 \parseargdef\microtype{%
11599   \def\txiarg{#1}%
11600   \ifx\txiarg\onword
11601     \microtypeON
11602   \else\ifx\txiarg\offword
11603     \microtypeOFF
11604   \else
11605     \errhelp = \EMsimple
11606     \errmessage{Unknown @microtype option `\txiarg', must be on|off}%
11607   \fi\fi
11608 }
11609
11610
11611 \message{and turning on texinfo input format.}
11612
11613 % Make UTF-8 the default encoding.
11614 \documentencodingzzz{UTF-8}
11615
11616 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11617 \catcode`\^^K = 10 % treat vertical tab as whitespace
11618
11619 % DEL is a comment character, in case @c does not suffice.
11620 \catcode`\^^? = 14
11621
11622 % Define macros to output various characters with catcode for normal text.
11623 \catcode`\"=\other \def\normaldoublequote{"}
11624 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11625 \catcode`\+=\other \def\normalplus{+}
11626 \catcode`\<=\other \def\normalless{<}
11627 \catcode`\>=\other \def\normalgreater{>}
11628 \catcode`\^=\other \def\normalcaret{^}
11629 \catcode`\_=\other \def\normalunderscore{_}
11630 \catcode`\|=\other \def\normalverticalbar{|}
11631 \catcode`\~=\other \def\normaltilde{~}
11632
11633 % Set catcodes for Texinfo file
11634
11635 % Active characters for printing the wanted glyph.
11636 % Most of these we simply print from the \tt font, but for some, we can
11637 % use math or other variants that look better in normal text.
11638 %
11639 \catcode`\"=\active
11640 \def\activedoublequote{{\tt\char34}}
11641 \let"=\activedoublequote
11642 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11643 \chardef\hatchar=`\^
11644 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11645
11646 \catcode`\_=\active
11647 \def_{\ifusingtt\normalunderscore\_}
11648 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11649 \let\realunder=_
11650
11651 \catcode`\|=\active \def|{{\tt\char124}}
11652
11653 \chardef \less=`\<
11654 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11655 \chardef \gtr=`\>
11656 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11657 \catcode`\+=\active \def+{{\tt \char 43}}
11658 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11659 \catcode`\-=\active \let-=\normaldash
11660
11661
11662 % used for headline/footline in the output routine, in case the page
11663 % breaks in the middle of an @tex block.
11664 \def\texinfochars{%
11665   \let< = \activeless
11666   \let> = \activegtr
11667   \let~ = \activetilde 
11668   \let^ = \activehat
11669   \setregularquotes
11670   \let\b = \strong
11671   \let\i = \smartitalic
11672   % in principle, all other definitions in \tex have to be undone too.
11673 }
11674
11675 % Used sometimes to turn off (effectively) the active characters even after
11676 % parsing them.
11677 \def\turnoffactive{%
11678   \passthroughcharstrue
11679   \let-=\normaldash
11680   \let"=\normaldoublequote
11681   \let$=\normaldollar %$ font-lock fix
11682   \let+=\normalplus
11683   \let<=\normalless
11684   \let>=\normalgreater
11685   \let^=\normalcaret
11686   \let_=\normalunderscore
11687   \let|=\normalverticalbar
11688   \let~=\normaltilde
11689   \otherbackslash
11690   \setregularquotes
11691   \unsepspaces
11692 }
11693
11694 % If a .fmt file is being used, characters that might appear in a file
11695 % name cannot be active until we have parsed the command line.
11696 % So turn them off again, and have \loadconf turn them back on.
11697 \catcode`+=\other \catcode`\_=\other
11698
11699
11700 % \backslashcurfont outputs one backslash character in current font,
11701 % as in \char`\\.
11702 \global\chardef\backslashcurfont=`\\
11703
11704 % Print a typewriter backslash.  For math mode, we can't simply use
11705 % \backslashcurfont: the story here is that in math mode, the \char
11706 % of \backslashcurfont ends up printing the roman \ from the math symbol
11707 % font (because \char in math mode uses the \mathcode, and plain.tex
11708 % sets \mathcode`\\="026E).  Hence we use an explicit \mathchar,
11709 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11710 % ignored family value; char position "5C).  We can't use " for the
11711 % usual hex value because it has already been made active.
11712
11713 \def\ttbackslash{{\tt \ifmmode \mathchar29020 \else \backslashcurfont \fi}}
11714 \let\backslashchar = \ttbackslash % \backslashchar{} is for user documents.
11715
11716 % These are made active for url-breaking, so need
11717 % active definitions as the normal characters.
11718 \def\normaldot{.}
11719 \def\normalquest{?}
11720 \def\normalslash{/}
11721
11722 % \newlinesloadsconf - call \loadconf as soon as possible in the
11723 % file, e.g. at the first newline.
11724 %
11725 {\catcode`\^=7
11726 \catcode`\^^M=13
11727 \gdef\newlineloadsconf{%
11728   \catcode`\^^M=13 %
11729   \newlineloadsconfzz%
11730 }
11731 \gdef\newlineloadsconfzz#1^^M{%
11732   \def\c{\loadconf\c}%
11733   % Definition for the first newline read in the file
11734   \def ^^M{\loadconf}%
11735   % In case the first line has a whole-line command on it
11736   \let\originalparsearg\parsearg%
11737   \def\parsearg{\loadconf\originalparsearg}%
11738 }}
11739
11740
11741 % Emergency active definition of newline, in case an active newline token
11742 % appears by mistake.
11743 {\catcode`\^=7 \catcode13=13%
11744 \gdef\enableemergencynewline{%
11745   \gdef^^M{%
11746     \par%
11747     %<warning: active newline>\par%
11748 }}}
11749
11750
11751 % \loadconf gets called at the beginning of every Texinfo file.
11752 % If texinfo.cnf is present on the system, read it.  Useful for site-wide
11753 % @afourpaper, etc.  Not opening texinfo.cnf directly in texinfo.tex
11754 % makes it possible to make a format file for Texinfo.
11755 %
11756 \gdef\loadconf{%
11757   \relax  % Terminate the filename if running as "tex '&texinfo' FILE.texi".
11758   %
11759   % Turn off the definitions that trigger \loadconf
11760   \everyjobreset
11761   \catcode13=5 % regular end of line
11762   \enableemergencynewline
11763   \let\c=\comment
11764   \let\parsearg\originalparsearg
11765   %
11766   % Also turn back on active characters that might appear in the input
11767   % file name, in case not using a pre-dumped format.
11768   \catcode`+=\active
11769   \catcode`\_=\active
11770   %
11771   \openin 1 texinfo.cnf
11772   \ifeof 1 \else \input texinfo.cnf \fi
11773   \closein 1
11774 }
11775
11776 % Redefine some control sequences to be controlled by the \ifdummies
11777 % and \ifindexnofonts switches.  Do this at the end so that the control
11778 % sequences are all defined.
11779 \definedummies
11780
11781
11782
11783
11784 \catcode`\@=0
11785
11786 % \realbackslash is an actual character `\' with catcode other.
11787 {\catcode`\\=\other @gdef@realbackslash{\}}
11788
11789 % In Texinfo, backslash is an active character; it prints the backslash
11790 % in fixed width font.
11791 \catcode`\\=\active  % @ for escape char from now on.
11792
11793 @let\ = @ttbackslash
11794
11795 % If in a .fmt file, print the version number.
11796 % \eatinput stops the `\input texinfo' from showing up.
11797 % After that, `\' should revert to printing a backslash.
11798 % Turn on active characters that we couldn't do earlier because
11799 % they might have appeared in the input file name.
11800 %
11801 @everyjob{@message{[Texinfo version @texinfoversion]}%
11802   @global@let\ = @eatinput
11803   @catcode`+=@active @catcode`@_=@active}
11804
11805 {@catcode`@^=7 @catcode`@^^M=13%
11806 @gdef@eatinput input texinfo#1^^M{@loadconf}}
11807
11808 @def@everyjobreset{@ifx\@eatinput @let\ = @ttbackslash @fi}
11809
11810 % \otherbackslash defines an active \ to be a literal `\' character with
11811 % catcode other.
11812 @gdef@otherbackslash{@let\=@realbackslash}
11813
11814 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11815 % the literal character `\'.
11816 %
11817 {@catcode`- = @active
11818  @gdef@normalturnoffactive{%
11819    @turnoffactive
11820    @let\=@ttbackslash
11821  }
11822 }
11823
11824 % Say @foo, not \foo, in error messages.
11825 @escapechar = `@@
11826
11827 % These look ok in all fonts, so just make them not special.
11828 % @hashchar{} gets its own user-level command, because of #line.
11829 @catcode`@& = @other @def@normalamp{&}
11830 @catcode`@# = @other @def@normalhash{#}
11831 @catcode`@% = @other @def@normalpercent{%}
11832
11833 @let @hashchar = @normalhash
11834
11835 @c Finally, make ` and ' active, so that txicodequoteundirected and
11836 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
11837 @c don't make ` and ' active, @code will not get them as active chars.
11838 @c Do this last of all since we use ` in the previous @catcode assignments.
11839 @catcode`@'=@active
11840 @catcode`@`=@active
11841
11842 @c Local variables:
11843 @c eval: (add-hook 'before-save-hook 'time-stamp nil t)
11844 @c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
11845 @c page-delimiter: "^\\\\message"
11846 @c End:
11847
11848 @newlineloadsconf