Debian Codegraph @

build-aux/texinfo.tex

raw
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{2025-12-23.13}
7 %
8 % Copyright 1985, 1986, 1988, 1990-2025 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 [email protected]. 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 % Used to ignore an active newline that may appear immediately after
160 % a macro name.
161 {\catcode13=\active \gdef\ignoreactivenewline{\let^^M\empty}}
162
163 \chardef\dashChar = `\-
164 \chardef\slashChar = `\/
165 \chardef\underChar = `\_
166
167 % Ignore a token.
168 %
169 \def\gobble#1{}
170
171 % The following is used inside several \edef's.
172 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
173
174 % Hyphenation fixes.
175 \hyphenation{
176 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
177 ap-pen-dix bit-map bit-maps
178 data-base data-bases eshell fall-ing half-way long-est man-u-script
179 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
180 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
181 spell-ing spell-ings
182 stand-alone strong-est time-stamp time-stamps which-ever white-space
183 wide-spread wrap-around
184 }
185
186 % Sometimes it is convenient to have everything in the transcript file
187 % and nothing on the terminal. We don't just call \tracingall here,
188 % since that produces some useless output on the terminal. We also make
189 % some effort to order the tracing commands to reduce output in the log
190 % file; cf. trace.sty in LaTeX.
191 %
192 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
193 \def\loggingall{%
194 \tracingstats2
195 \tracingpages1
196 \tracinglostchars2 % 2 gives us more in etex
197 \tracingparagraphs1
198 \tracingoutput1
199 \tracingmacros2
200 \tracingrestores1
201 \showboxbreadth\maxdimen \showboxdepth\maxdimen
202 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
203 \tracingscantokens1
204 \tracingifs1
205 \tracinggroups1
206 \tracingnesting2
207 \tracingassigns1
208 \fi
209 \tracingcommands3 % 3 gives us more in etex
210 \errorcontextlines16
211 }%
212
213 % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
214 % aren't perfect, it's not the end of the world, being an error message,
215 % after all.
216 %
217 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
218 \def\doerrormsg#1{\errmessage{#1}}
219
220 % add check for \lastpenalty to plain's definitions. If the last thing
221 % we did was a \nobreak, we don't want to insert more space.
222 %
223 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
224 \removelastskip\penalty-50\smallskip\fi\fi}
225 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
226 \removelastskip\penalty-100\medskip\fi\fi}
227 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
228 \removelastskip\penalty-200\bigskip\fi\fi}
229
230 % Output routine
231 %
232
233 % For a final copy, take out the rectangles
234 % that mark overfull boxes (in case you have decided
235 % that the text looks ok even though it passes the margin).
236 %
237 \def\finalout{\overfullrule=0pt }
238
239 % Output a mark which sets \thischapter, \thissection and \thiscolor.
240 % We dump everything together because we only have one kind of mark.
241 % This works because we only use \botmark / \topmark, not \firstmark.
242 %
243 % A mark contains a subexpression of the \ifcase ... \fi construct.
244 % \get*marks macros below extract the needed part using \ifcase.
245 %
246 % Another complication is to let the user choose whether \thischapter
247 % (\thissection) refers to the chapter (section) in effect at the top
248 % of a page, or that at the bottom of a page.
249
250 % \domark is called twice inside \chapmacro, to add one
251 % mark before the section break, and one after.
252 % In the second call \prevchapterdefs is the same as \currentchapterdefs,
253 % and \prevsectiondefs is the same as \currentsectiondefs.
254 % Then if the page is not broken at the mark, some of the previous
255 % section appears on the page, and we can get the name of this section
256 % from \firstmark for @everyheadingmarks top.
257 % @everyheadingmarks bottom uses \botmark.
258 %
259 % See page 260 of The TeXbook.
260 \def\domark{%
261 \toks0=\expandafter{\currentchapterdefs}%
262 \toks2=\expandafter{\currentsectiondefs}%
263 \toks4=\expandafter{\prevchapterdefs}%
264 \toks6=\expandafter{\prevsectiondefs}%
265 \toks8=\expandafter{\currentcolordefs}%
266 \mark{%
267 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
268 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
269 \noexpand\else \the\toks8 % 2: color marks
270 }%
271 }
272
273 % \gettopheadingmarks, \getbottomheadingmarks,
274 % \getcolormarks - extract needed part of mark.
275 %
276 % \topmark doesn't work for the very first chapter (after the title
277 % page or the contents), so we use \firstmark there -- this gets us
278 % the mark with the chapter defs, unless the user sneaks in, e.g.,
279 % @setcolor (or @url etc.) between @contents and the very 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\prevchapterdefs{}
291 \def\prevsectiondefs{}
292 \def\currentcolordefs{}
293
294 % Margin to add to right of even pages, to left of odd pages.
295 \newdimen\bindingoffset
296 \newdimen\normaloffset
297 \newdimen\txipagewidth \newdimen\txipageheight
298
299 % Main output routine.
300 %
301 \chardef\PAGE = 255
302 \newtoks\defaultoutput
303 \defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
304 \output=\expandafter{\the\defaultoutput}
305
306 \newbox\headlinebox
307 \newbox\footlinebox
308
309 % When outputting the double column layout for indices, an output routine
310 % is run several times, hiding the original value of \topmark. Hence, save
311 % \topmark at the beginning.
312 %
313 \newtoks\savedtopmark
314 \newif\iftopmarksaved
315 \topmarksavedtrue
316 \def\savetopmark{%
317 \iftopmarksaved\else
318 \global\savedtopmark=\expandafter{\topmark}%
319 \global\topmarksavedtrue
320 \fi
321 }
322
323 % \onepageout takes a vbox as an argument.
324 % \shipout a vbox for a single page, adding an optional header, footer
325 % and footnote. This also causes index entries for this page to be written
326 % to the auxiliary files.
327 %
328 \def\onepageout#1{%
329 \hoffset=\normaloffset
330 %
331 \ifodd\pageno \advance\hoffset by \bindingoffset
332 \else \advance\hoffset by -\bindingoffset\fi
333 %
334 \checkchapterpage
335 %
336 % Make the heading and footing. \makeheadline and \makefootline
337 % use the contents of \headline and \footline.
338 \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}%
339 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
340 \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
341 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
342 \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
343 %
344 {%
345 % Set context for writing to auxiliary files like index files.
346 % Have to do this stuff outside the \shipout because we want it to
347 % take effect in \write's, yet the group defined by the \vbox ends
348 % before the \shipout runs.
349 %
350 \atdummies % don't expand commands in the output.
351 \turnoffactive
352 \shipout\vbox{%
353 % Do this early so pdf references go to the beginning of the page.
354 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
355 %
356 \unvbox\headlinebox
357 \pagebody{#1}%
358 \ifdim\ht\footlinebox > 0pt
359 % Only leave this space if the footline is nonempty.
360 % (We lessened \vsize for it in \oddfootingyyy.)
361 % The \baselineskip=24pt in plain's \makefootline has no effect.
362 \vskip 24pt
363 \unvbox\footlinebox
364 \fi
365 %
366 }%
367 }%
368 \global\topmarksavedfalse
369 \advancepageno
370 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
371 }
372
373 \newinsert\margin \dimen\margin=\maxdimen
374
375 % Main part of page, including any footnotes
376 \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
377 {\catcode`\@ =11
378 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
379 % marginal hacks, [email protected] (Juha Takala)
380 \ifvoid\margin\else % marginal info is present
381 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
382 \dimen@=\dp#1\relax \unvbox#1\relax
383 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
384 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
385 }
386
387 % Check if we are on the first page of a chapter. Used for printing headings.
388 \newif\ifchapterpage
389 \def\checkchapterpage{%
390 % Get the chapter that was current at the end of the last page
391 \ifcase1\the\savedtopmark\fi
392 \let\prevchaptername\thischaptername
393 %
394 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
395 \let\curchaptername\thischaptername
396 %
397 \ifx\curchaptername\prevchaptername
398 \chapterpagefalse
399 \else
400 \chapterpagetrue
401 \fi
402 }
403
404 % Argument parsing
405
406 % Parse an argument, then pass it to #1. The argument is the rest of
407 % the input line (except we remove a trailing comment). #1 should be a
408 % macro which expects an ordinary undelimited TeX argument.
409 % For example, \def\foo{\parsearg\fooxxx}.
410 %
411 \def\parsearg{\parseargusing{}}
412 \def\parseargusing#1#2{%
413 \def\argtorun{#2}%
414 \begingroup
415 \obeylines
416 \spaceisspace
417 #1%
418 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
419 }
420
421 {\obeylines %
422 \gdef\parseargline#1^^M{%
423 \endgroup % End of the group started in \parsearg.
424 \argremovecomment #1\comment\ArgTerm%
425 }%
426 }
427
428 % First remove any @comment, then any @c comment. Pass the result on to
429 % \argremovespace.
430 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
431 \def\argremovec#1\c#2\ArgTerm{\argremovespace#1$ $\ArgTerm}
432 % \argremovec might leave us with trailing space, though; e.g.,
433 % @end itemize @c foo
434 % Note that the argument cannot contain the TeX $, as its catcode is
435 % changed to \other when Texinfo source is read.
436 \def\argremovespace#1 $#2\ArgTerm{\finishparsearg#1$\ArgTerm}
437
438 % If a _delimited_ argument is enclosed in braces, they get stripped; so
439 % to get _exactly_ the rest of the line, we had to prevent such situation.
440 % We prepended an \empty token at the very beginning and we expand it
441 % just before passing the control to \next.
442 % (But first, we have to remove the remaining $ or two.)
443 \def\finishparsearg#1$#2\ArgTerm{\expandafter\argtorun\expandafter{#1}}
444
445
446 % \parseargdef - define a command taking an argument on the line
447 %
448 % \parseargdef\foo{...}
449 % is roughly equivalent to
450 % \def\foo{\parsearg\Xfoo}
451 % \def\Xfoo#1{...}
452 \def\parseargdef#1{%
453 \expandafter \doparseargdef \csname\string#1\endcsname #1%
454 }
455 \def\doparseargdef#1#2{%
456 \def#2{\parsearg#1}%
457 \def#1##1%
458 }
459
460 % Several utility definitions with active space:
461 {
462 \obeyspaces
463 \gdef\obeyedspace{ }
464
465 % Make each space character in the input produce a normal interword
466 % space in the output. Don't allow a line break at this space, as this
467 % is used only in environments like @example, where each line of input
468 % should produce a line of output anyway.
469 %
470 \gdef\sepspaces{\obeyspaces\let =\tie}
471
472 % If an index command is used in an @example environment, any spaces
473 % therein should become regular spaces in the raw index file, not the
474 % expansion of \tie (\leavevmode \penalty \@M \ ).
475 \gdef\unsepspaces{\let =\space}
476 }
477
478
479 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
480
481 % Define the framework for environments in texinfo.tex. It's used like this:
482 %
483 % \envdef\foo{...}
484 % \def\Efoo{...}
485 %
486 % \envdef inserts \begingroup before the actual body; @end calls
487 % \Efoo then closes the group with \endgroup. \envdef also
488 % defines \thisenv, so the current environment is known; @end checks
489 % whether the environment name matches. The \checkenv macro can also be
490 % used to check whether the current environment is the one expected.
491 %
492 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
493 % are not treated as environments; they don't open a group. (The
494 % implementation of @end takes care not to call \endgroup in this
495 % special case.)
496
497
498 % At run-time, environments start with this:
499 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
500 % initialize
501 \let\thisenv\empty
502
503 % ... but they get defined via ``\envdef\foo{...}'':
504 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
505 \long\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
506
507 % Check whether we're in the right environment:
508 \def\checkenv#1{%
509 \def\temp{#1}%
510 \ifx\thisenv\temp
511 \else
512 \badenverr
513 \fi
514 }
515
516 % Environment mismatch, #1 expected:
517 \def\badenverr{%
518 \errhelp = \EMsimple
519 \errmessage{This command can appear only \inenvironment\temp,
520 not \inenvironment\thisenv}%
521 }
522 \def\inenvironment#1{%
523 \ifx#1\empty
524 outside of any environment%
525 \else
526 in environment \expandafter\string#1%
527 \fi
528 }
529
530
531 % @end foo calls \checkenv and executes the definition of \Efoo.
532 \parseargdef\end{%
533 \if 1\csname iscond.#1\endcsname
534 \else
535 % The general wording of \badenverr may not be ideal.
536 \expandafter\checkenv\csname#1\endcsname
537 \csname E#1\endcsname
538 \endgroup
539 \fi
540 }
541
542 \newhelp\EMsimple{Press RETURN to continue.}
543
544
545 % Be sure we're in horizontal mode when doing a tie, since we make space
546 % equivalent to this in @example-like environments. Otherwise, a space
547 % at the beginning of a line will start with \penalty -- and
548 % since \penalty is valid in vertical mode, we'd end up putting the
549 % penalty on the vertical list instead of in the new paragraph.
550 {\catcode`@ = 11
551 % Avoid using \@M directly, because that causes trouble
552 % if the definition is written into an index file.
553 \global\let\tiepenalty = \@M
554 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
555 }
556
557 % @: forces normal size whitespace following.
558 \def\:{\spacefactor=1000 }
559
560 % @* forces a line break.
561 % In internal horizontal or vertical mode, convert explicit line breaks
562 % from @* into spaces. For instance, if the user gives these in long
563 % section titles, this may occur in the table of contents, or the page
564 % heading line.
565 \def\*{%
566 \ifinner\unskip\space\ignorespaces
567 \else\unskip\hfil\break\hbox{}\ignorespaces\fi}
568
569 % @/ allows a line break.
570 \let\/=\allowbreak
571
572 % @- allows explicit insertion of hyphenation points
573 \def\-{\discretionary{\normaldash}{}{}}%
574
575 % @. is an end-of-sentence period.
576 \def\.{.\spacefactor=\endofsentencespacefactor\space}
577
578 % @! is an end-of-sentence bang.
579 \def\!{!\spacefactor=\endofsentencespacefactor\space}
580
581 % @? is an end-of-sentence query.
582 \def\?{?\spacefactor=\endofsentencespacefactor\space}
583
584 % @w prevents a word break. Without the \leavevmode, @w at the
585 % beginning of a paragraph, when TeX is still in vertical mode, would
586 % produce a whole line of output instead of starting the paragraph.
587 \def\w#1{\leavevmode\hbox{#1}}
588
589 % @group ... @end group forces ... to be all on one page, by enclosing
590 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
591 % to keep its height that of a normal line. According to the rules for
592 % \topskip (p.114 of the TeXbook), the glue inserted is
593 % max (\topskip - \ht (first item), 0). If that height is large,
594 % therefore, no glue is inserted, and the space between the headline and
595 % the text is small, which looks bad.
596 %
597 % Another complication is that the group might be very large. This can
598 % cause the glue on the previous page to be unduly stretched, because it
599 % does not have much material. In this case, it's better to add an
600 % explicit \vfill so that the extra space is at the bottom. The
601 % threshold for doing this is if the group is more than \vfilllimit
602 % percent of a page (\vfilllimit can be changed inside of @tex).
603 %
604 \newbox\groupbox
605 \def\vfilllimit{0.7}
606 %
607 \envdef\group{%
608 \ifnum\catcode`\^^M=\active \else
609 \errhelp = \groupinvalidhelp
610 \errmessage{@group invalid in context where filling is enabled}%
611 \fi
612 \startsavinginserts
613 %
614 \setbox\groupbox = \vtop\bgroup
615 % Do @comment since we are called inside an environment such as
616 % @example, where each end-of-line in the input causes an
617 % end-of-line in the output. We don't want the end-of-line after
618 % the `@group' to put extra space in the output. Since @group
619 % should appear on a line by itself (according to the Texinfo
620 % manual), we don't worry about eating any user text.
621 \comment
622 }
623 %
624 % The \vtop produces a box with normal height and large depth; thus, TeX puts
625 % \baselineskip glue before it, and (when the next line of text is done)
626 % \lineskip glue after it. Thus, space below is not quite equal to space
627 % above. But it's pretty close.
628 \def\Egroup{%
629 % To get correct interline space between the last line of the group
630 % and the first line afterwards, we have to propagate \prevdepth.
631 \endgraf % Not \par, as it may have been set to \lisppar.
632 \global\dimen1 = \prevdepth
633 \egroup % End the \vtop.
634 \addgroupbox
635 \prevdepth = \dimen1
636 \checkinserts
637 }
638
639 \def\addgroupbox{
640 % \dimen0 is the vertical size of the group's box.
641 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
642 % \dimen2 is how much space is left on the page (more or less).
643 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
644 % if the group doesn't fit on the current page, and it's a big big
645 % group, force a page break.
646 \ifdim \dimen0 > \dimen2
647 \ifdim \pagetotal < \vfilllimit\txipageheight
648 \page
649 \fi
650 \fi
651 \box\groupbox
652 }
653
654 %
655 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
656 % message, so this ends up printing `@group can only ...'.
657 %
658 \newhelp\groupinvalidhelp{%
659 group can only be used in environments such as @example,^^J%
660 where each line of input produces a line of output.}
661
662 % @need space-in-mils
663 % forces a page break if there is not space-in-mils remaining.
664
665 \newdimen\mil \mil=0.001in
666
667 \parseargdef\need{%
668 % Ensure vertical mode, so we don't make a big box in the middle of a
669 % paragraph.
670 \par
671 %
672 % If the @need value is less than one line space, it's useless.
673 \dimen0 = #1\mil
674 \dimen2 = \ht\strutbox
675 \advance\dimen2 by \dp\strutbox
676 \ifdim\dimen0 > \dimen2
677 % This is similar to the 'needspace' module in LaTeX.
678 % The first penalty allows a break if the end of the page is
679 % not too far away. Following penalties and skips are discarded.
680 % Otherwise, require at least \dimen0 of vertical space.
681 %
682 % (We used to use a \vtop to reserve space, but this had spacing issues
683 % when followed by a section heading, as it was not a "discardable item".
684 % This also has the benefit of providing glue before the page break if
685 % there isn't enough space.)
686 \vskip0pt plus \dimen0
687 \penalty-100
688 \vskip0pt plus -\dimen0
689 \vskip \dimen0
690 \penalty9999
691 \vskip -\dimen0
692 \penalty0\relax % this hides the above glue from \safewhatsit and \dobreak
693 \fi
694 }
695
696 % @br forces paragraph break (and is undocumented).
697
698 \let\br = \par
699
700 % @page forces the start of a new page.
701 %
702 \def\page{\par\vfill\supereject}
703
704 % @exdent text....
705 % outputs text on separate line in roman font, starting at standard page margin
706
707 % This records the amount of indent in the innermost environment.
708 % That's how much \exdent should take out.
709 \newskip\exdentamount
710
711 % This defn is used inside fill environments such as @defun.
712 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
713
714 % This defn is used inside nofill environments such as @example.
715 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
716 \leftline{\hskip\leftskip{\rm#1}}}}
717
718 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
719 % paragraph. For more general purposes, use the \margin insertion
720 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
721 %
722 \newskip\inmarginspacing \inmarginspacing=1cm
723 \def\strutdepth{\dp\strutbox}
724 %
725 \def\doinmargin#1#2{\strut\vadjust{%
726 \nobreak
727 \kern-\strutdepth
728 \vtop to \strutdepth{%
729 \baselineskip=\strutdepth
730 \vss
731 % if you have multiple lines of stuff to put here, you'll need to
732 % make the vbox yourself of the appropriate size.
733 \ifx#1l%
734 \llap{\ignorespaces #2\hskip\inmarginspacing}%
735 \else
736 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
737 \fi
738 \null
739 }%
740 }}
741 \def\inleftmargin{\doinmargin l}
742 \def\inrightmargin{\doinmargin r}
743 %
744 % @inmargin{TEXT [, RIGHT-TEXT]}
745 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
746 % else use TEXT for both).
747 %
748 \def\inmargin#1{\parseinmargin #1,,\finish}
749 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
750 \setbox0 = \hbox{\ignorespaces #2}%
751 \ifdim\wd0 > 0pt
752 \def\lefttext{#1}% have both texts
753 \def\righttext{#2}%
754 \else
755 \def\lefttext{#1}% have only one text
756 \def\righttext{#1}%
757 \fi
758 %
759 \ifodd\pageno
760 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
761 \else
762 \def\temp{\inleftmargin\lefttext}%
763 \fi
764 \temp
765 }
766
767 % @include FILE -- \input text of FILE.
768 %
769 \def\include{\parseargusing\filenamecatcodes\includezzz}
770 \def\includezzz#1{%
771 \pushthisfilestack
772 \def\thisfile{#1}%
773 {%
774 \makevalueexpandable % we want to expand any @value in FILE.
775 \turnoffactive % and allow special characters in the expansion
776 \indexnofonts % Allow `@@' and other weird things in file names.
777 \wlog{texinfo.tex: doing @include of #1^^J}%
778 \edef\temp{\noexpand\input #1 }%
779 %
780 % This trickery is to read FILE outside of a group, in case it makes
781 % definitions, etc.
782 \expandafter
783 }\temp
784 \popthisfilestack
785 }
786 \def\filenamecatcodes{%
787 \catcode`\\=\other
788 \catcode`~=\other
789 \catcode`^=\other
790 \catcode`_=\other
791 \catcode`|=\other
792 \catcode`<=\other
793 \catcode`>=\other
794 \catcode`+=\other
795 \catcode`-=\other
796 \catcode`\`=\other
797 \catcode`\'=\other
798 }
799
800 \def\pushthisfilestack{%
801 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
802 }
803 \def\pushthisfilestackX{%
804 \expandafter\pushthisfilestackY\thisfile\StackTerm
805 }
806 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
807 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
808 }
809
810 \def\popthisfilestack{\errthisfilestackempty}
811 \def\errthisfilestackempty{\errmessage{Internal error:
812 the stack of filenames is empty.}}
813 %
814 \def\thisfile{}
815
816 % @center line
817 % outputs that line, centered.
818 %
819 \parseargdef\center{%
820 \ifhmode
821 \let\centersub\centerH
822 \else
823 \let\centersub\centerV
824 \fi
825 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
826 \let\centersub\relax % don't let the definition persist, just in case
827 }
828 \def\centerH#1{{%
829 \hfil\break
830 \advance\hsize by -\leftskip
831 \advance\hsize by -\rightskip
832 \line{#1}%
833 \break
834 }}
835 %
836 \newcount\centerpenalty
837 \def\centerV#1{%
838 % The idea here is the same as in \startdefun, \cartouche, etc.: if
839 % @center is the first thing after a section heading, we need to wipe
840 % out the negative parskip inserted by \sectionheading, but still
841 % prevent a page break here.
842 \centerpenalty = \lastpenalty
843 \ifnum\centerpenalty>10000 \vskip\parskip \fi
844 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
845 \line{\kern\leftskip #1\kern\rightskip}%
846 }
847
848 % @sp n outputs n lines of vertical space
849 %
850 \parseargdef\sp{\vskip #1\baselineskip}
851
852 % @comment ...line which is ignored...
853 % @c is the same as @comment
854 % @ignore ... @end ignore is another way to write a comment
855
856
857 \def\c{\begingroup \catcode`\^^M=\active%
858 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
859 \cxxx}
860 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
861 %
862 \let\comment\c
863
864 % @paragraphindent NCHARS
865 % We'll use ems for NCHARS, close enough.
866 % NCHARS can also be the word `asis' or `none'.
867 % We cannot feasibly implement @paragraphindent asis, though.
868 %
869 \def\asisword{asis} % no translation, these are keywords
870 \def\noneword{none}
871 %
872 \parseargdef\paragraphindent{%
873 \def\temp{#1}%
874 \ifx\temp\asisword
875 \else
876 \ifx\temp\noneword
877 \defaultparindent = 0pt
878 \else
879 \defaultparindent = #1em
880 \fi
881 \fi
882 \parindent = \defaultparindent
883 }
884
885 % @exampleindent NCHARS
886 % We'll use ems for NCHARS like @paragraphindent.
887 % It seems @exampleindent asis isn't necessary, but
888 % I preserve it to make it similar to @paragraphindent.
889 \parseargdef\exampleindent{%
890 \def\temp{#1}%
891 \ifx\temp\asisword
892 \else
893 \ifx\temp\noneword
894 \lispnarrowing = 0pt
895 \else
896 \lispnarrowing = #1em
897 \fi
898 \fi
899 }
900
901 % @firstparagraphindent WORD
902 % If WORD is `none', then suppress indentation of the first paragraph
903 % after a section heading. If WORD is `insert', then do indent at such
904 % paragraphs.
905 %
906 % The paragraph indentation is suppressed or not by calling
907 % \suppressfirstparagraphindent, which the sectioning commands do.
908 % We switch the definition of this back and forth according to WORD.
909 % By default, we suppress indentation.
910 %
911 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
912 \def\insertword{insert}
913 %
914 \parseargdef\firstparagraphindent{%
915 \def\temp{#1}%
916 \ifx\temp\noneword
917 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
918 \else\ifx\temp\insertword
919 \let\suppressfirstparagraphindent = \relax
920 \else
921 \errhelp = \EMsimple
922 \errmessage{Unknown @firstparagraphindent option `\temp'}%
923 \fi\fi
924 }
925
926 % Here is how we actually suppress indentation. Redefine \everypar to
927 % \kern backwards by \parindent, and then reset itself to empty.
928 %
929 % We also make \indent itself not actually do anything until the next
930 % paragraph.
931 %
932 \gdef\dosuppressfirstparagraphindent{%
933 \gdef\indent {\restorefirstparagraphindent \indent}%
934 \gdef\noindent{\restorefirstparagraphindent \noindent}%
935 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
936 }
937 %
938 \gdef\restorefirstparagraphindent{%
939 \global\let\indent = \ptexindent
940 \global\let\noindent = \ptexnoindent
941 \global\everypar = {}%
942 }
943
944 % leave vertical mode without cancelling any first paragraph indent
945 \gdef\imageindent{%
946 \toks0=\everypar
947 \everypar={}%
948 \ptexnoindent
949 \global\everypar=\toks0
950 }
951
952
953 % @refill is a no-op.
954 \let\refill=\relax
955
956 % @setfilename INFO-FILENAME - ignored
957 \let\setfilename=\comment
958
959 % @bye.
960 \outer\def\bye{%
961 \chappager\pagelabels
962 % possibly set in \printindex
963 \ifx\byeerror\relax\else\errmessage{\byeerror}\fi
964 \tracingstats=1\ptexend}
965
966 % set in \donoderef below, but we need to define this here so that
967 % conditionals balance inside the large \ifpdf ... \fi blocks below.
968 \newif\ifnodeseen
969 \nodeseenfalse
970
971 \message{pdf,}
972 % adobe `portable' document format
973 \newcount\tempnum
974 \newcount\lnkcount
975 \newtoks\filename
976 \newcount\filenamelength
977 \newcount\pgn
978 \newtoks\toksA
979 \newtoks\toksB
980 \newtoks\toksC
981 \newtoks\toksD
982 \newbox\boxA
983 \newbox\boxB
984 \newcount\countA
985 \newif\ifpdf
986 \newif\ifpdfmakepagedest
987
988 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
989 % can be set). So we test for \relax and 0 as well as being undefined.
990 \ifx\pdfoutput\thisisundefined
991 \else
992 \ifx\pdfoutput\relax
993 \else
994 \ifcase\pdfoutput
995 \else
996 \pdftrue
997 \fi
998 \fi
999 \fi
1000
1001 \newif\ifxetex
1002 \ifx\XeTeXrevision\thisisundefined\else
1003 \xetextrue
1004 \fi
1005
1006 \newif\ifluatex
1007 \ifx\luatexversion\thisisundefined\else
1008 \luatextrue
1009 \ifnum\luatexversion>84
1010 \pdftrue
1011 \fi
1012 \fi
1013
1014 \newif\ifpdforxetex
1015 \ifpdf
1016 \pdforxetextrue
1017 \fi
1018 \ifxetex
1019 \pdforxetextrue
1020 \fi
1021
1022
1023
1024 % Whether to use non-ASCII bytes in internal link targets. Presently this
1025 % is almost always on.
1026 \newif\iftxiuseunicodedestname
1027 \txiuseunicodedestnametrue
1028
1029 %
1030 % For LuaTeX
1031 %
1032
1033 \ifluatex
1034 % Use Unicode destination names
1035 \txiuseunicodedestnametrue
1036 % Escape PDF strings with converting UTF-16 from UTF-8
1037 \begingroup
1038 \catcode`\%=12
1039 \directlua{
1040 function UTF16oct(str)
1041 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1042 for c in string.utfvalues(str) do
1043 if c < 0x10000 then
1044 tex.sprint(
1045 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1046 string.char(0x5c) .. string.char(0x25) .. '03o',
1047 math.floor(c / 256), math.floor(c % 256)))
1048 else
1049 c = c - 0x10000
1050 local c_hi = c / 1024 + 0xd800
1051 local c_lo = c % 1024 + 0xdc00
1052 tex.sprint(
1053 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1054 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1055 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1056 string.char(0x5c) .. string.char(0x25) .. '03o',
1057 math.floor(c_hi / 256), math.floor(c_hi % 256),
1058 math.floor(c_lo / 256), math.floor(c_lo % 256)))
1059 end
1060 end
1061 end
1062 }
1063 \endgroup
1064 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1065 % Escape PDF strings without converting
1066 \begingroup
1067 \directlua{
1068 function PDFescstr(str)
1069 for c in string.bytes(str) do
1070 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1071 tex.sprint(-2,
1072 string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1073 c))
1074 else
1075 tex.sprint(-2, string.char(c))
1076 end
1077 end
1078 end
1079 }
1080 % The -2 in the arguments here gives all the input to TeX catcode 12
1081 % (other) or 10 (space), preventing undefined control sequence errors. See
1082 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
1083 %
1084 \endgroup
1085 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1086 \ifpdf
1087 % For LuaTeX >= 0.85
1088 \def\pdfdest{\pdfextension dest}
1089 \let\pdfoutput\outputmode
1090 \def\pdfliteral{\pdfextension literal}
1091 \def\pdfcatalog{\pdfextension catalog}
1092 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1093 \let\pdfximage\saveimageresource
1094 \let\pdfrefximage\useimageresource
1095 \let\pdflastximage\lastsavedimageresourceindex
1096 \def\pdfendlink{\pdfextension endlink\relax}
1097 \def\pdfoutline{\pdfextension outline}
1098 \def\pdfstartlink{\pdfextension startlink}
1099 \def\pdffontattr{\pdfextension fontattr}
1100 \def\pdfobj{\pdfextension obj}
1101 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1102 \let\pdfpagewidth\pagewidth
1103 \let\pdfpageheight\pageheight
1104 \edef\pdfhorigin{\pdfvariable horigin}
1105 \edef\pdfvorigin{\pdfvariable vorigin}
1106 \fi
1107 \fi
1108
1109
1110 % Output page labels information.
1111 % See PDF reference v.1.7 p.594, section 8.3.1.
1112 % Page label ranges must be increasing.
1113 \ifpdf
1114 \def\pagelabels{%
1115 \def\title{0 << /P (T-) /S /D >>}%
1116 %
1117 % support @contents at very end of document
1118 \ifnum\contentsendcount=\pagecount
1119 \ifnum\arabiccount<\romancount
1120 \pdfcatalog{/PageLabels << /Nums
1121 [\title
1122 \the\arabiccount << /S /D >>
1123 \the\romancount << /S /r >>
1124 ] >> }\relax
1125 \fi
1126 % no contents in document
1127 \else\ifnum\contentsendcount=0
1128 \pdfcatalog{/PageLabels << /Nums
1129 [\title
1130 \the\arabiccount << /S /D >>
1131 ] >> }\relax
1132 \else
1133 \pdfcatalog{/PageLabels << /Nums
1134 [\title
1135 \the\romancount << /S /r >>
1136 \the\contentsendcount << /S /D >>
1137 ] >> }\relax
1138 \fi\fi
1139 }
1140 \else
1141 \let\pagelabels\relax
1142 \fi
1143
1144 \newcount\pagecount \pagecount=0
1145 \newcount\romancount \romancount=0
1146 \newcount\arabiccount \arabiccount=0
1147 \newcount\contentsendcount \contentsendcount=0
1148
1149 \ifpdf
1150 \let\ptxadvancepageno\advancepageno
1151 \def\advancepageno{%
1152 \ptxadvancepageno\global\advance\pagecount by 1
1153 }
1154 \fi
1155
1156
1157 % PDF uses PostScript string constants for the names of xref targets,
1158 % for display in the outlines, and in other places. Thus, we have to
1159 % double any backslashes. Otherwise, a name like "\node" will be
1160 % interpreted as a newline (\n), followed by o, d, e. Not good.
1161 %
1162 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1163 % related messages. The final outcome is that it is up to the TeX user
1164 % to double the backslashes and otherwise make the string valid, so
1165 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1166 % do this reliably, so we use it.
1167
1168 % #1 is a control sequence in which to do the replacements,
1169 % which we \xdef.
1170 \def\txiescapepdf#1{%
1171 \ifx\pdfescapestring\thisisundefined
1172 % No primitive available; should we give a warning or log?
1173 % Many times it won't matter.
1174 \xdef#1{#1}%
1175 \else
1176 % The expandable \pdfescapestring primitive escapes parentheses,
1177 % backslashes, and other special chars.
1178 \xdef#1{\pdfescapestring{#1}}%
1179 \fi
1180 }
1181 \def\txiescapepdfutfsixteen#1{%
1182 \ifx\pdfescapestrutfsixteen\thisisundefined
1183 % No UTF-16 converting macro available.
1184 \txiescapepdf{#1}%
1185 \else
1186 \xdef#1{\pdfescapestrutfsixteen{#1}}%
1187 \fi
1188 }
1189
1190 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1191 with PDF output, and none of those formats could be found. (.eps cannot
1192 be supported due to the design of the PDF format; use regular TeX (DVI
1193 output) for that.)}
1194
1195 % definitions for pdftex or luatex with pdf output
1196 \ifpdf
1197 % Strings in PDF outlines can either be ASCII, or encoded in UTF-16BE
1198 % with BOM. Unfortunately there is no simple way with pdftex to output
1199 % UTF-16, so we have to do some quite convoluted expansion games if we
1200 % find the string contains a non-ASCII codepoint if we want these to
1201 % display correctly. We generated the UTF-16 sequences in
1202 % \DeclareUnicodeCharacter and we access them here.
1203 %
1204 \def\defpdfoutlinetextunicode#1{%
1205 \def\pdfoutlinetext{#1}%
1206 %
1207 % Make UTF-8 sequences expand to UTF-16 definitions.
1208 \passthroughcharsfalse \utfbytespdftrue
1209 \utfviiidefinedwarningfalse
1210 %
1211 % Completely expand, eliminating any control sequences such as \code,
1212 % leaving only possibly \utfbytes.
1213 \let\utfbytes\relax
1214 \pdfaccentliterals
1215 \xdef\pdfoutlinetextchecked{#1}%
1216 \checkutfbytes
1217 }%
1218 % Check if \utfbytes occurs in expansion.
1219 \def\checkutfbytes{%
1220 \expandafter\checkutfbytesz\pdfoutlinetextchecked\utfbytes\finish
1221 }%
1222 \def\checkutfbytesz#1\utfbytes#2\finish{%
1223 \def\after{#2}%
1224 \ifx\after\empty
1225 % No further action needed. Output ASCII string as-is, as converting
1226 % to UTF-16 is somewhat slow (and uses more space).
1227 \global\let\pdfoutlinetext\pdfoutlinetextchecked
1228 \else
1229 \passthroughcharstrue % pass UTF-8 sequences unaltered
1230 \xdef\pdfoutlinetext{\pdfoutlinetext}%
1231 \expandafter\expandutfsixteen\expandafter{\pdfoutlinetext}\pdfoutlinetext
1232 \fi
1233 }%
1234 %
1235 \catcode2=1 % begin-group character
1236 \catcode3=2 % end-group character
1237 %
1238 % argument should be pure UTF-8 with no control sequences. convert to
1239 % UTF-16BE by inserting null bytes before bytes < 128 and expanding
1240 % UTF-8 multibyte sequences to saved UTF-16BE sequences.
1241 \def\expandutfsixteen#1#2{%
1242 \bgroup \asciitounicode
1243 \passthroughcharsfalse
1244 \let\utfbytes\asis
1245 %
1246 % for Byte Order Mark (BOM)
1247 \catcode"FE=12
1248 \catcode"FF=12
1249 %
1250 % we want to treat { and } in #1 as any other ASCII bytes. however,
1251 % we need grouping characters for \scantokens and definitions/assignments,
1252 % so define alternative grouping characters using control characters
1253 % that are unlikely to occur.
1254 % this does not affect 0x02 or 0x03 bytes arising from expansion as
1255 % these are tokens with different catcodes.
1256 \catcode"02=1 % begin-group character
1257 \catcode"03=2 % end-group character
1258 %
1259 \expandafter\xdef\expandafter#2\scantokens{%
1260 ^^02^^fe^^ff#1^^03}%
1261 % NB we need \scantokens to provide both the open and close group tokens
1262 % for \xdef otherwise there is an e-TeX error "File ended while
1263 % scanning definition of..."
1264 % NB \scantokens is a e-TeX command which is assumed to be provided by
1265 % pdfTeX.
1266 %
1267 \egroup
1268 }%
1269 %
1270 \catcode2=12 \catcode3=12 % defaults
1271 %
1272 % Color support
1273 %
1274 % rg sets the color for filling (usual text, etc.);
1275 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1276 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1277 %
1278 % PDF outline support
1279 %
1280 \pdfcatalog{/PageMode /UseOutlines}
1281 %
1282 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1283 \def\dopdfimage#1#2#3{%
1284 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1285 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1286 %
1287 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1288 % others). Let's try in that order, PDF first since if
1289 % someone has a scalable image, presumably better to use that than a
1290 % bitmap.
1291 \let\pdfimgext=\empty
1292 \begingroup
1293 \openin 1 #1.pdf \ifeof 1
1294 \openin 1 #1.PDF \ifeof 1
1295 \openin 1 #1.png \ifeof 1
1296 \openin 1 #1.jpg \ifeof 1
1297 \openin 1 #1.jpeg \ifeof 1
1298 \openin 1 #1.JPG \ifeof 1
1299 \errhelp = \nopdfimagehelp
1300 \errmessage{Could not find image file #1 for pdf}%
1301 \else \gdef\pdfimgext{JPG}%
1302 \fi
1303 \else \gdef\pdfimgext{jpeg}%
1304 \fi
1305 \else \gdef\pdfimgext{jpg}%
1306 \fi
1307 \else \gdef\pdfimgext{png}%
1308 \fi
1309 \else \gdef\pdfimgext{PDF}%
1310 \fi
1311 \else \gdef\pdfimgext{pdf}%
1312 \fi
1313 \closein 1
1314 \endgroup
1315 %
1316 % without \immediate, ancient pdftex seg faults when the same image is
1317 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1318 \ifnum\pdftexversion < 14
1319 \immediate\pdfimage
1320 \else
1321 \immediate\pdfximage
1322 \fi
1323 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1324 \ifdim \wd2 >0pt height \pdfimageheight \fi
1325 \ifnum\pdftexversion<13
1326 #1.\pdfimgext
1327 \else
1328 {#1.\pdfimgext}%
1329 \fi
1330 \ifnum\pdftexversion < 14 \else
1331 \pdfrefximage \pdflastximage
1332 \fi}
1333 %
1334 \def\setpdfdestname#1{{%
1335 % We have to set dummies so commands such as @code, and characters
1336 % such as \, aren't expanded when present in a section title.
1337 \indexnofonts
1338 \makevalueexpandable
1339 \turnoffactive
1340 \iftxiuseunicodedestname
1341 \ifx \declaredencoding \latone
1342 % Pass through Latin-1 characters.
1343 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1344 \else
1345 \ifx \declaredencoding \utfeight
1346 % Pass through Unicode characters.
1347 \else
1348 % Use ASCII approximations in destination names.
1349 \passthroughcharsfalse
1350 \fi
1351 \fi
1352 \else
1353 % Use ASCII approximations in destination names.
1354 \passthroughcharsfalse
1355 \fi
1356 \def\pdfdestname{#1}%
1357 \txiescapepdf\pdfdestname
1358 }}
1359 %
1360 \def\setpdfoutlinetext#1{{%
1361 \indexnofonts
1362 \makevalueexpandable
1363 \turnoffactive
1364 \ifx \declaredencoding \latone
1365 % The PDF format can use an extended form of Latin-1 in bookmark
1366 % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1367 % the "PDFDocEncoding".
1368 \passthroughcharstrue
1369 % Pass through Latin-1 characters.
1370 % LuaTeX: Convert to Unicode
1371 % pdfTeX: Use Latin-1 as PDFDocEncoding
1372 \def\pdfoutlinetext{#1}%
1373 \else
1374 \ifx \declaredencoding \utfeight
1375 \ifluatex
1376 % For LuaTeX with UTF-8.
1377 % Pass through Unicode characters for title texts.
1378 \passthroughcharstrue
1379 \pdfaccentliterals
1380 \xdef\pdfoutlinetext{#1}%
1381 \else
1382 % For pdfTeX with UTF-8.
1383 \defpdfoutlinetextunicode{#1}%
1384 \fi
1385 \else
1386 % For non-Latin-1 or non-UTF-8 encodings.
1387 % Use ASCII approximations.
1388 \passthroughcharsfalse
1389 \def\pdfoutlinetext{#1}%
1390 \fi
1391 \fi
1392 % LuaTeX: Convert to UTF-16
1393 % pdfTeX: Use Latin-1 as PDFDocEncoding
1394 \txiescapepdfutfsixteen\pdfoutlinetext
1395 }}
1396 %
1397 \def\pdfmkdest#1{%
1398 \setpdfdestname{#1}%
1399 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1400 }
1401 %
1402 % Adding outlines to PDF; macros for calculating structure of outlines
1403 % come from Petr Olsak
1404 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1405 \else \csname#1\endcsname \fi}
1406 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1407 \advance\tempnum by 1
1408 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1409 %
1410 % #1 is the section text, which is what will be displayed in the
1411 % outline by the pdf viewer. #2 is the pdf expression for the number
1412 % of subentries (or empty, for subsubsections). #3 is the node text,
1413 % which might be empty if this toc entry had no corresponding node.
1414 % #4 is the page number
1415 %
1416 \def\dopdfoutline#1#2#3#4{%
1417 % Generate a link to the node text if that exists; else, use the
1418 % page number. We could generate a destination for the section
1419 % text in the case where a section has no node, but it doesn't
1420 % seem worth the trouble, since most documents are normally structured.
1421 \setpdfoutlinetext{#1}
1422 \setpdfdestname{#3}
1423 \ifx\pdfdestname\empty
1424 \def\pdfdestname{#4}%
1425 \fi
1426 %
1427 \pdfoutline goto name{\pdfdestname}#2{\pdfoutlinetext}%
1428 }
1429 %
1430 \def\pdfmakeoutlines{%
1431 \begingroup
1432 % Read toc silently, to get counts of subentries for \pdfoutline.
1433 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1434 \def\numchapentry##1##2##3##4{%
1435 \def\thischapnum{##2}%
1436 \def\thissecnum{0}%
1437 \def\thissubsecnum{0}%
1438 \def\indexlastsec{chap\thischapnum}%
1439 }%
1440 \def\numsecentry##1##2##3##4{%
1441 \advancenumber{chap\thischapnum}%
1442 \def\thissecnum{##2}%
1443 \def\thissubsecnum{0}%
1444 \def\indexlastsec{sec\thissecnum}%
1445 }%
1446 \def\numsubsecentry##1##2##3##4{%
1447 \advancenumber{sec\thissecnum}%
1448 \def\thissubsecnum{##2}%
1449 \def\indexlastsec{subsec\thissecnum}%
1450 }%
1451 \def\numsubsubsecentry##1##2##3##4{%
1452 \advancenumber{subsec\thissubsecnum}%
1453 }%
1454 \def\thischapnum{0}%
1455 \def\thissecnum{0}%
1456 \def\thissubsecnum{0}%
1457 \let\indexlastsec\empty
1458 %
1459 % Index initials are subsidiary to whatever sectioning command just
1460 % occurred, usually @appendix or @chapter but occasionally a lower level.
1461 \def\idxinitialentry##1##2##3##4{%
1462 \expandafter\advancenumber\expandafter{\indexlastsec}%
1463 }%
1464 % use \def rather than \let here because we redefine \chapentry et
1465 % al. a second time, below.
1466 \def\appentry{\numchapentry}%
1467 \def\appsecentry{\numsecentry}%
1468 \def\appsubsecentry{\numsubsecentry}%
1469 \def\appsubsubsecentry{\numsubsubsecentry}%
1470 \def\unnchapentry{\numchapentry}%
1471 \def\unnsecentry{\numsecentry}%
1472 \def\unnsubsecentry{\numsubsecentry}%
1473 \def\unnsubsubsecentry{\numsubsubsecentry}%
1474 %
1475 \readdatafile{toc}%
1476 %
1477 % Read toc second time, this time actually producing the outlines.
1478 % The `-' means take the \expnumber as the absolute number of
1479 % subentries, which we calculated on our first read of the .toc above.
1480 %
1481 % We use the node names as the destinations.
1482 %
1483 % Currently we prefix the section name with the section number
1484 % for chapter and appendix headings only in order to avoid too much
1485 % horizontal space being required in the PDF viewer.
1486 \def\numchapentry##1##2##3##4{%
1487 \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1488 \def\unnchapentry##1##2##3##4{%
1489 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1490 \def\numsecentry##1##2##3##4{%
1491 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1492 \def\numsubsecentry##1##2##3##4{%
1493 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1494 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1495 \dopdfoutline{##1}{}{##3}{##4}}%
1496 \def\idxinitialentry##1##2##3##4{%
1497 \dopdfoutline{##1}{}{idx.##1.##2}{##4}}%
1498 %
1499 \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning
1500 \setupdatafile
1501 % We can have normal brace characters in the PDF outlines, unlike
1502 % Texinfo index files. So set that up.
1503 \def\{{\lbracecharliteral}%
1504 \def\}{\rbracecharliteral}%
1505 \catcode`\\=\active \otherbackslash
1506 \input \tocreadfilename\relax
1507 \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
1508 \endgroup
1509 }
1510 \def\dopdfoutlinecontents{%
1511 \expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}%
1512 }
1513 {\catcode`[=1 \catcode`]=2
1514 \catcode`{=\other \catcode`}=\other
1515 \gdef\lbracecharliteral[{]%
1516 \gdef\rbracecharliteral[}]%
1517 ]
1518 %
1519 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1520 \ifx\PP\D\let\nextsp\relax
1521 \else\let\nextsp\skipspaces
1522 \addtokens{\filename}{\PP}%
1523 \advance\filenamelength by 1
1524 \fi
1525 \nextsp}
1526 \def\getfilename#1{%
1527 \filenamelength=0
1528 % If we don't expand the argument now, \skipspaces will get
1529 % snagged on things like "@value{foo}".
1530 \edef\temp{#1}%
1531 \expandafter\skipspaces\temp|\relax
1532 }
1533 \ifnum\pdftexversion < 14
1534 \let \startlink \pdfannotlink
1535 \else
1536 \let \startlink \pdfstartlink
1537 \fi
1538 \def\pdfmakeurl#1{%
1539 \startlink attr{/Border [0 0 0]}%
1540 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1541 }%
1542 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1543 %
1544 \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1545 \def\pdflinkpage#1#2{%
1546 \startlink attr{/Border [0 0 0]} goto name{#1}
1547 \setcolor{\linkcolor}#2\endlink}
1548 \else
1549 % non-pdf mode
1550 \let\pdfmkdest = \gobble
1551 \let\pdfurl = \gobble
1552 \let\endlink = \relax
1553 \let\setcolor = \gobble
1554 \let\pdfsetcolor = \gobble
1555 \let\pdfmakeoutlines = \relax
1556 \fi
1557
1558 %
1559 % For XeTeX
1560 %
1561 \ifxetex
1562 %
1563 % XeTeX version check
1564 %
1565 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1566 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1567 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1568 % For avoiding PDF destination name replacement, we use this special
1569 % instead of xdvipdfmx's command line option `-C 0x0010'.
1570 \special{dvipdfmx:config C 0x0010}
1571 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1572 % It can handle Unicode destination names for PDF.
1573 \txiuseunicodedestnametrue
1574 \else
1575 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1576 % `dvipdfmx:config' special.
1577 % So for avoiding PDF destination name replacement,
1578 % xdvipdfmx's command line option `-C 0x0010' is necessary.
1579 %
1580 % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1581 % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1582 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1583 \txiuseunicodedestnamefalse
1584 \fi
1585 %
1586 % Color support
1587 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1588 %
1589 % PDF outline support
1590 %
1591 % Emulate pdfTeX primitive
1592 \def\pdfdest name#1 xyz{%
1593 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1594 }
1595 %
1596 \def\setpdfdestname#1{{%
1597 % We have to set dummies so commands such as @code, and characters
1598 % such as \, aren't expanded when present in a section title.
1599 \indexnofonts
1600 \makevalueexpandable
1601 \turnoffactive
1602 \iftxiuseunicodedestname
1603 % Pass through Unicode characters.
1604 \else
1605 % Use ASCII approximations in destination names.
1606 \passthroughcharsfalse
1607 \fi
1608 \def\pdfdestname{#1}%
1609 \txiescapepdf\pdfdestname
1610 }}
1611 %
1612 \def\setpdfoutlinetext#1{{%
1613 \turnoffactive
1614 % Always use Unicode characters in title texts.
1615 \def\pdfoutlinetext{#1}%
1616 % For XeTeX, xdvipdfmx converts to UTF-16.
1617 % So we do not convert.
1618 \txiescapepdf\pdfoutlinetext
1619 }}
1620 %
1621 \def\pdfmkdest#1{%
1622 \setpdfdestname{#1}%
1623 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1624 }
1625 %
1626 \def\dopdfoutline#1#2#3#4{%
1627 \setpdfoutlinetext{#1}
1628 \setpdfdestname{#3}
1629 \ifx\pdfdestname\empty
1630 \def\pdfdestname{#4}%
1631 \fi
1632 %
1633 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1634 << /S /GoTo /D (\pdfdestname) >> >> }%
1635 }
1636 %
1637 \def\pdfmakeoutlines{%
1638 \begingroup
1639 % For XeTeX, counts of subentries are not necessary.
1640 % Therefore, we read toc only once.
1641 %
1642 % We use node names as destinations.
1643 %
1644 % Currently we prefix the section name with the section number
1645 % for chapter and appendix headings only in order to avoid too much
1646 % horizontal space being required in the PDF viewer.
1647 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1648 \def\numchapentry##1##2##3##4{%
1649 \dopdfoutline{##2 ##1}{1}{##3}{##4}%
1650 \def\indexseclevel{2}}%
1651 \def\numsecentry##1##2##3##4{%
1652 \dopdfoutline{##1}{2}{##3}{##4}%
1653 \def\indexseclevel{3}}%
1654 \def\numsubsecentry##1##2##3##4{%
1655 \dopdfoutline{##1}{3}{##3}{##4}%
1656 \def\indexseclevel{4}}%
1657 \def\numsubsubsecentry##1##2##3##4{%
1658 \dopdfoutline{##1}{4}{##3}{##4}%
1659 \def\indexseclevel{5}}%
1660 %
1661 \def\idxinitialentry##1##2##3##4{%
1662 \dopdfoutline{##1}{\indexseclevel}{idx.##1.##2}{##4}}%
1663 %
1664 \let\appentry\numchapentry%
1665 \let\appsecentry\numsecentry%
1666 \let\appsubsecentry\numsubsecentry%
1667 \let\appsubsubsecentry\numsubsubsecentry%
1668 \def\unnchapentry##1##2##3##4{%
1669 \dopdfoutline{##1}{1}{##3}{##4}}%
1670 \let\unnsecentry\numsecentry%
1671 \let\unnsubsecentry\numsubsecentry%
1672 \let\unnsubsubsecentry\numsubsubsecentry%
1673 %
1674 % For XeTeX, xdvipdfmx converts strings to UTF-16.
1675 % Therefore, the encoding and the language may not be considered.
1676 %
1677 \indexnofonts
1678 \pdfaccentliterals
1679 \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning
1680 %
1681 \setupdatafile
1682 % We can have normal brace characters in the PDF outlines, unlike
1683 % Texinfo index files. So set that up.
1684 \def\{{\lbracecharliteral}%
1685 \def\}{\rbracecharliteral}%
1686 \catcode`\\=\active \otherbackslash
1687 \xetexpreauxfile
1688 \input \tocreadfilename\relax
1689 \xetexpostauxfile
1690 \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
1691 \endgroup
1692 }
1693 \def\dopdfoutlinecontents{%
1694 \expandafter\dopdfoutline\expandafter
1695 {\putwordTOC}{1}{txi.CONTENTS}{txi.CONTENTS}%
1696 }
1697 {\catcode`[=1 \catcode`]=2
1698 \catcode`{=\other \catcode`}=\other
1699 \gdef\lbracecharliteral[{]%
1700 \gdef\rbracecharliteral[}]%
1701 ]
1702
1703 \special{pdf:docview << /PageMode /UseOutlines >> }
1704 % ``\special{pdf:tounicode ...}'' is not necessary
1705 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1706 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1707 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1708 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1709 %
1710 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1711 \ifx\PP\D\let\nextsp\relax
1712 \else\let\nextsp\skipspaces
1713 \addtokens{\filename}{\PP}%
1714 \advance\filenamelength by 1
1715 \fi
1716 \nextsp}
1717 \def\getfilename#1{%
1718 \filenamelength=0
1719 % If we don't expand the argument now, \skipspaces will get
1720 % snagged on things like "@value{foo}".
1721 \edef\temp{#1}%
1722 \expandafter\skipspaces\temp|\relax
1723 }
1724 \def\pdfmakeurl#1{%
1725 \special{pdf:bann << /Border [0 0 0]
1726 /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1727 }
1728 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1729 \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1730 \def\pdflinkpage#1#2{%
1731 \special{pdf:bann << /Border [0 0 0]
1732 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1733 \setcolor{\linkcolor}#2\endlink}
1734 %
1735 %
1736 % @image support
1737 %
1738 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1739 \def\doxeteximage#1#2#3{%
1740 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1741 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1742 %
1743 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1744 % others). Let's try in that order, PDF first since if
1745 % someone has a scalable image, presumably better to use that than a
1746 % bitmap.
1747 \let\xeteximgext=\empty
1748 \begingroup
1749 \openin 1 #1.pdf \ifeof 1
1750 \openin 1 #1.PDF \ifeof 1
1751 \openin 1 #1.png \ifeof 1
1752 \openin 1 #1.jpg \ifeof 1
1753 \openin 1 #1.jpeg \ifeof 1
1754 \openin 1 #1.JPG \ifeof 1
1755 \errmessage{Could not find image file #1 for XeTeX}%
1756 \else \gdef\xeteximgext{JPG}%
1757 \fi
1758 \else \gdef\xeteximgext{jpeg}%
1759 \fi
1760 \else \gdef\xeteximgext{jpg}%
1761 \fi
1762 \else \gdef\xeteximgext{png}%
1763 \fi
1764 \else \gdef\xeteximgext{PDF}%
1765 \fi
1766 \else \gdef\xeteximgext{pdf}%
1767 \fi
1768 \closein 1
1769 \endgroup
1770 %
1771 % Putting an \hbox around the image can prevent an over-long line
1772 % after the image.
1773 \hbox\bgroup
1774 \def\xetexpdfext{pdf}%
1775 \ifx\xeteximgext\xetexpdfext
1776 \XeTeXpdffile "#1".\xeteximgext ""
1777 \else
1778 \def\xetexpdfext{PDF}%
1779 \ifx\xeteximgext\xetexpdfext
1780 \XeTeXpdffile "#1".\xeteximgext ""
1781 \else
1782 \XeTeXpicfile "#1".\xeteximgext ""
1783 \fi
1784 \fi
1785 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1786 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1787 \egroup
1788 }
1789 \fi
1790
1791 % common definitions and code for pdftex, luatex and xetex
1792 \ifpdforxetex
1793 % The dark red here is dark enough to print on paper as
1794 % nearly black, but still distinguishable for online viewing. We use
1795 % black by default, though.
1796 \def\rgbDarkRed{0.50 0.09 0.12}
1797 \def\rgbBlack{0 0 0}
1798 %
1799 % Set color, and create a mark which defines \thiscolor accordingly,
1800 % so that \makeheadline knows which color to restore.
1801 \def\curcolor{0 0 0}%
1802 \def\setcolor#1{%
1803 \ifx#1\curcolor\else
1804 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1805 \domark
1806 \pdfsetcolor{#1}%
1807 \xdef\curcolor{#1}%
1808 \fi
1809 }
1810 %
1811 \let\maincolor\rgbBlack
1812 \pdfsetcolor{\maincolor}
1813 \edef\thiscolor{\maincolor}
1814 \def\currentcolordefs{}
1815 %
1816 \def\makefootline{%
1817 \baselineskip24pt
1818 \line{\pdfsetcolor{\maincolor}\the\footline}%
1819 }
1820 %
1821 \def\makeheadline{%
1822 \vbox to 0pt{%
1823 \vskip-22.5pt
1824 \line{%
1825 \vbox to8.5pt{}%
1826 % Extract \thiscolor definition from the marks.
1827 \getcolormarks
1828 % Typeset the headline with \maincolor, then restore the color.
1829 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1830 }%
1831 \vss
1832 }%
1833 \nointerlineskip
1834 }
1835 %
1836 % by default, use black for everything.
1837 \def\urlcolor{\rgbBlack}
1838 \let\linkcolor\rgbBlack
1839 %
1840 % make a live url in pdf output.
1841 \def\pdfurl#1{%
1842 \begingroup
1843 % it seems we really need yet another set of dummies; have not
1844 % tried to figure out what each command should do in the context
1845 % of @url. for now, just make @/ a no-op, that's the only one
1846 % people have actually reported a problem with.
1847 %
1848 \normalturnoffactive
1849 \def\@{@}%
1850 \let\/=\empty
1851 \makevalueexpandable
1852 % do we want to go so far as to use \indexnofonts instead of just
1853 % special-casing \var here?
1854 \def\var##1{##1}%
1855 %
1856 \leavevmode\setcolor{\urlcolor}%
1857 \pdfmakeurl{#1}%
1858 \endgroup}
1859 %
1860 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
1861 % be a simple number, or a list of numbers in the case of an index
1862 % entry.
1863 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1864 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1865 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1866 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1867 \def\maketoks{%
1868 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1869 \ifx\first0\adn0
1870 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1871 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1872 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1873 \else
1874 \ifnum0=\countA\else\makelink\fi
1875 \ifx\first.\let\next=\done\else
1876 \let\next=\maketoks
1877 \addtokens{\toksB}{\the\toksD}
1878 \ifx\first,\addtokens{\toksB}{\space}\fi
1879 \fi
1880 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1881 \next}
1882 \def\makelink{\addtokens{\toksB}%
1883 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1884 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1885 \fi
1886
1887 \ifpdforxetex
1888 % for pdftex.
1889 {\catcode`^^cc=13
1890 \gdef\pdfaccentliteralsutfviii{%
1891 % For PDF outline only. Unicode combining accents follow the
1892 % character they modify. Note we need at least the first byte
1893 % of the UTF-8 sequences to have an active catcode to allow the
1894 % definitions to do their magic.
1895 \def\"##1{##1^^cc^^88}% U+0308
1896 \def\'##1{##1^^cc^^81}% U+0301
1897 \def\,##1{##1^^cc^^a7}% U+0327
1898 \def\=##1{##1^^cc^^85}% U+0305
1899 \def\^##1{##1^^cc^^82}% U+0302
1900 \def\`##1{##1^^cc^^80}% U+0300
1901 \def\~##1{##1^^cc^^83}% U+0303
1902 \def\dotaccent##1{##1^^cc^^87}% U+0307
1903 \def\H##1{##1^^cc^^8b}% U+030B
1904 \def\ogonek##1{##1^^cc^^a8}% U+0328
1905 \def\ringaccent##1{##1^^cc^^8a}% U+030A
1906 \def\u##1{##1^^cc^^8c}% U+0306
1907 \def\ubaraccent##1{##1^^cc^^b1}% U+0331
1908 \def\udotaccent##1{##1^^cc^^a3}% U+0323
1909 \def\v##1{##1^^cc^^8c}% U+030C
1910 % this definition of @tieaccent will only work with exactly two characters
1911 % in argument as we need to insert the combining character between them.
1912 \def\tieaccent##1{\tieaccentz##1}%
1913 \def\tieaccentz##1##2{##1^^cd^^a1##2} % U+0361
1914 }}%
1915 %
1916 % for xetex and luatex, which both support extended ^^^^ escapes and
1917 % process the Unicode codepoint as a single token.
1918 \gdef\pdfaccentliteralsnative{%
1919 \def\"##1{##1^^^^0308}%
1920 \def\'##1{##1^^^^0301}%
1921 \def\,##1{##1^^^^0327}%
1922 \def\=##1{##1^^^^0305}%
1923 \def\^##1{##1^^^^0302}%
1924 \def\`##1{##1^^^^0300}%
1925 \def\~##1{##1^^^^0303}%
1926 \def\dotaccent##1{##1^^^^0307}%
1927 \def\H##1{##1^^^^030b}%
1928 \def\ogonek##1{##1^^^^0328}%
1929 \def\ringaccent##1{##1^^^^030a}%
1930 \def\u##1{##1^^^^0306}%
1931 \def\ubaraccent##1{##1^^^^0331}%
1932 \def\udotaccent##1{##1^^^^0323}%
1933 \def\v##1{##1^^^^030c}%
1934 \def\tieaccent##1{\tieaccentz##1}%
1935 \def\tieaccentz##1##2{##1^^^^0361##2} % U+0361
1936 }%
1937 %
1938 % use the appropriate definition
1939 \ifluatex
1940 \let\pdfaccentliterals\pdfaccentliteralsnative
1941 \else
1942 \ifxetex
1943 \let\pdfaccentliterals\pdfaccentliteralsnative
1944 \else
1945 \let\pdfaccentliterals\pdfaccentliteralsutfviii
1946 \fi
1947 \fi
1948 \fi
1949
1950 %
1951 \message{fonts,}
1952
1953 % Set the baselineskip to #1, and the lineskip and strut size
1954 % correspondingly. There is no deep meaning behind these magic numbers
1955 % used as factors; they just match (closely enough) what Knuth defined.
1956 %
1957 \def\lineskipfactor{.08333}
1958 \def\strutheightpercent{.70833}
1959 \def\strutdepthpercent {.29167}
1960 %
1961 % can get a sort of poor man's double spacing by redefining this.
1962 \def\baselinefactor{1}
1963 %
1964 \newdimen\textleading
1965 \def\setleading#1{%
1966 \dimen0 = #1\relax
1967 \normalbaselineskip = \baselinefactor\dimen0
1968 \normallineskip = \lineskipfactor\normalbaselineskip
1969 \normalbaselines
1970 \setbox\strutbox =\hbox{%
1971 \vrule width0pt height\strutheightpercent\baselineskip
1972 depth \strutdepthpercent \baselineskip
1973 }%
1974 }
1975
1976 % PDF CMaps. See also LaTeX's t1.cmap.
1977 %
1978 % do nothing with this by default.
1979 \expandafter\let\csname cmapOT1\endcsname\gobble
1980 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1981 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1982
1983 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1984 % (\pdffontattr was introduced many years ago, but people still run
1985 % older pdftex's; it's easy to conditionalize, so we do.)
1986 \ifpdf \ifx\pdffontattr\thisisundefined \else
1987 \begingroup
1988 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1989 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1990 %%DocumentNeededResources: ProcSet (CIDInit)
1991 %%IncludeResource: ProcSet (CIDInit)
1992 %%BeginResource: CMap (TeX-OT1-0)
1993 %%Title: (TeX-OT1-0 TeX OT1 0)
1994 %%Version: 1.000
1995 %%EndComments
1996 /CIDInit /ProcSet findresource begin
1997 12 dict begin
1998 begincmap
1999 /CIDSystemInfo
2000 << /Registry (TeX)
2001 /Ordering (OT1)
2002 /Supplement 0
2003 >> def
2004 /CMapName /TeX-OT1-0 def
2005 /CMapType 2 def
2006 1 begincodespacerange
2007 <00> <7F>
2008 endcodespacerange
2009 8 beginbfrange
2010 <00> <01> <0393>
2011 <09> <0A> <03A8>
2012 <23> <26> <0023>
2013 <28> <3B> <0028>
2014 <3F> <5B> <003F>
2015 <5D> <5E> <005D>
2016 <61> <7A> <0061>
2017 <7B> <7C> <2013>
2018 endbfrange
2019 40 beginbfchar
2020 <02> <0398>
2021 <03> <039B>
2022 <04> <039E>
2023 <05> <03A0>
2024 <06> <03A3>
2025 <07> <03D2>
2026 <08> <03A6>
2027 <0B> <00660066>
2028 <0C> <00660069>
2029 <0D> <0066006C>
2030 <0E> <006600660069>
2031 <0F> <00660066006C>
2032 <10> <0131>
2033 <11> <0237>
2034 <12> <0060>
2035 <13> <00B4>
2036 <14> <02C7>
2037 <15> <02D8>
2038 <16> <00AF>
2039 <17> <02DA>
2040 <18> <00B8>
2041 <19> <00DF>
2042 <1A> <00E6>
2043 <1B> <0153>
2044 <1C> <00F8>
2045 <1D> <00C6>
2046 <1E> <0152>
2047 <1F> <00D8>
2048 <21> <0021>
2049 <22> <201D>
2050 <27> <2019>
2051 <3C> <00A1>
2052 <3D> <003D>
2053 <3E> <00BF>
2054 <5C> <201C>
2055 <5F> <02D9>
2056 <60> <2018>
2057 <7D> <02DD>
2058 <7E> <007E>
2059 <7F> <00A8>
2060 endbfchar
2061 endcmap
2062 CMapName currentdict /CMap defineresource pop
2063 end
2064 end
2065 %%EndResource
2066 %%EOF
2067 }\endgroup
2068 \expandafter\edef\csname cmapOT1\endcsname#1{%
2069 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2070 }%
2071 %
2072 % \cmapOT1IT
2073 \begingroup
2074 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2075 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2076 %%DocumentNeededResources: ProcSet (CIDInit)
2077 %%IncludeResource: ProcSet (CIDInit)
2078 %%BeginResource: CMap (TeX-OT1IT-0)
2079 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
2080 %%Version: 1.000
2081 %%EndComments
2082 /CIDInit /ProcSet findresource begin
2083 12 dict begin
2084 begincmap
2085 /CIDSystemInfo
2086 << /Registry (TeX)
2087 /Ordering (OT1IT)
2088 /Supplement 0
2089 >> def
2090 /CMapName /TeX-OT1IT-0 def
2091 /CMapType 2 def
2092 1 begincodespacerange
2093 <00> <7F>
2094 endcodespacerange
2095 8 beginbfrange
2096 <00> <01> <0393>
2097 <09> <0A> <03A8>
2098 <25> <26> <0025>
2099 <28> <3B> <0028>
2100 <3F> <5B> <003F>
2101 <5D> <5E> <005D>
2102 <61> <7A> <0061>
2103 <7B> <7C> <2013>
2104 endbfrange
2105 42 beginbfchar
2106 <02> <0398>
2107 <03> <039B>
2108 <04> <039E>
2109 <05> <03A0>
2110 <06> <03A3>
2111 <07> <03D2>
2112 <08> <03A6>
2113 <0B> <00660066>
2114 <0C> <00660069>
2115 <0D> <0066006C>
2116 <0E> <006600660069>
2117 <0F> <00660066006C>
2118 <10> <0131>
2119 <11> <0237>
2120 <12> <0060>
2121 <13> <00B4>
2122 <14> <02C7>
2123 <15> <02D8>
2124 <16> <00AF>
2125 <17> <02DA>
2126 <18> <00B8>
2127 <19> <00DF>
2128 <1A> <00E6>
2129 <1B> <0153>
2130 <1C> <00F8>
2131 <1D> <00C6>
2132 <1E> <0152>
2133 <1F> <00D8>
2134 <21> <0021>
2135 <22> <201D>
2136 <23> <0023>
2137 <24> <00A3>
2138 <27> <2019>
2139 <3C> <00A1>
2140 <3D> <003D>
2141 <3E> <00BF>
2142 <5C> <201C>
2143 <5F> <02D9>
2144 <60> <2018>
2145 <7D> <02DD>
2146 <7E> <007E>
2147 <7F> <00A8>
2148 endbfchar
2149 endcmap
2150 CMapName currentdict /CMap defineresource pop
2151 end
2152 end
2153 %%EndResource
2154 %%EOF
2155 }\endgroup
2156 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2157 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2158 }%
2159 %
2160 % \cmapOT1TT
2161 \begingroup
2162 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2163 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2164 %%DocumentNeededResources: ProcSet (CIDInit)
2165 %%IncludeResource: ProcSet (CIDInit)
2166 %%BeginResource: CMap (TeX-OT1TT-0)
2167 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2168 %%Version: 1.000
2169 %%EndComments
2170 /CIDInit /ProcSet findresource begin
2171 12 dict begin
2172 begincmap
2173 /CIDSystemInfo
2174 << /Registry (TeX)
2175 /Ordering (OT1TT)
2176 /Supplement 0
2177 >> def
2178 /CMapName /TeX-OT1TT-0 def
2179 /CMapType 2 def
2180 1 begincodespacerange
2181 <00> <7F>
2182 endcodespacerange
2183 5 beginbfrange
2184 <00> <01> <0393>
2185 <09> <0A> <03A8>
2186 <21> <26> <0021>
2187 <28> <5F> <0028>
2188 <61> <7E> <0061>
2189 endbfrange
2190 32 beginbfchar
2191 <02> <0398>
2192 <03> <039B>
2193 <04> <039E>
2194 <05> <03A0>
2195 <06> <03A3>
2196 <07> <03D2>
2197 <08> <03A6>
2198 <0B> <2191>
2199 <0C> <2193>
2200 <0D> <0027>
2201 <0E> <00A1>
2202 <0F> <00BF>
2203 <10> <0131>
2204 <11> <0237>
2205 <12> <0060>
2206 <13> <00B4>
2207 <14> <02C7>
2208 <15> <02D8>
2209 <16> <00AF>
2210 <17> <02DA>
2211 <18> <00B8>
2212 <19> <00DF>
2213 <1A> <00E6>
2214 <1B> <0153>
2215 <1C> <00F8>
2216 <1D> <00C6>
2217 <1E> <0152>
2218 <1F> <00D8>
2219 <20> <2423>
2220 <27> <2019>
2221 <60> <2018>
2222 <7F> <00A8>
2223 endbfchar
2224 endcmap
2225 CMapName currentdict /CMap defineresource pop
2226 end
2227 end
2228 %%EndResource
2229 %%EOF
2230 }\endgroup
2231 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2232 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2233 }%
2234 \fi\fi
2235 %
2236 % This is what gets called when #5 of \setfont is empty.
2237 \let\cmap\gobble
2238 %
2239 % (end of cmaps)
2240
2241
2242 % Set the font macro #1 to the font named \fontprefix#2.
2243 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2244 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2245 % Example:
2246 % #1 = \textrm
2247 % #2 = \rmshape
2248 % #3 = 10
2249 % #4 = \mainmagstep
2250 % #5 = OT1
2251 %
2252 \def\setfont#1#2#3#4#5{%
2253 \font#1=\fontprefix#2#3 scaled #4
2254 \csname cmap#5\endcsname#1%
2255 \ifx#2\ttshape\hyphenchar#1=-1 \fi
2256 \ifx#2\ttbshape\hyphenchar#1=-1 \fi
2257 \ifx#2\ttslshape\hyphenchar#1=-1 \fi
2258 }
2259
2260 % Use cm as the default font prefix.
2261 % To specify the font prefix, you must define \fontprefix
2262 % before you read in texinfo.tex.
2263 \ifx\fontprefix\thisisundefined
2264 \def\fontprefix{cm}
2265 \fi
2266 % Support font families that don't use the same naming scheme as CM.
2267 \def\rmshape{r}
2268 \def\rmbshape{bx} % where the normal face is bold
2269 \def\bfshape{b}
2270 \def\bxshape{bx}
2271 \def\ttshape{tt}
2272 \def\ttbshape{tt}
2273 \def\ttslshape{sltt}
2274 \def\itshape{ti}
2275 \def\itbshape{bxti}
2276 \def\slshape{sl}
2277 \def\slbshape{bxsl}
2278 \def\sfshape{ss}
2279 \def\sfbshape{ss}
2280 \def\scshape{csc}
2281 \def\scbshape{csc}
2282
2283 % Definitions for a main text size of 11pt. (The default in Texinfo.)
2284 %
2285 \def\definetextfontsizexi{%
2286 % Text fonts (11.2pt, magstep1).
2287 \def\textnominalsize{11pt}
2288 \edef\mainmagstep{\magstephalf}
2289 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2290 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2291 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2292 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2293 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2294 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2295 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2296 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2297 \font\texti=cmmi10 scaled \mainmagstep
2298 \font\textsy=cmsy10 scaled \mainmagstep
2299 \def\textecsize{1095}
2300
2301 % A few fonts for @defun names and args.
2302 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2303 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2304 \setfont\defsl\slshape{10}{\magstep1}{OT1}
2305 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2306 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2307 \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2308
2309 % Fonts for indices, footnotes, small examples (9pt).
2310 \def\smallnominalsize{9pt}
2311 \setfont\smallrm\rmshape{9}{1000}{OT1}
2312 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2313 \setfont\smallbf\bfshape{10}{900}{OT1}
2314 \setfont\smallit\itshape{9}{1000}{OT1IT}
2315 \setfont\smallsl\slshape{9}{1000}{OT1}
2316 \setfont\smallsf\sfshape{9}{1000}{OT1}
2317 \setfont\smallsc\scshape{10}{900}{OT1}
2318 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2319 \font\smalli=cmmi9
2320 \font\smallsy=cmsy9
2321 \def\smallecsize{0900}
2322
2323 % Fonts for small examples (8pt).
2324 \def\smallernominalsize{8pt}
2325 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2326 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2327 \setfont\smallerbf\bfshape{10}{800}{OT1}
2328 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2329 \setfont\smallersl\slshape{8}{1000}{OT1}
2330 \setfont\smallersf\sfshape{8}{1000}{OT1}
2331 \setfont\smallersc\scshape{10}{800}{OT1}
2332 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2333 \font\smalleri=cmmi8
2334 \font\smallersy=cmsy8
2335 \def\smallerecsize{0800}
2336
2337 % Fonts for math mode superscripts (7pt).
2338 \def\sevennominalsize{7pt}
2339 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2340 \setfont\seventt\ttshape{10}{700}{OT1TT}
2341 \setfont\sevenbf\bfshape{10}{700}{OT1}
2342 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2343 \setfont\sevensl\slshape{10}{700}{OT1}
2344 \setfont\sevensf\sfshape{10}{700}{OT1}
2345 \setfont\sevensc\scshape{10}{700}{OT1}
2346 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2347 \font\seveni=cmmi7
2348 \font\sevensy=cmsy7
2349 \def\sevenecsize{0700}
2350
2351 % Fonts for title page (20.4pt):
2352 \def\titlenominalsize{20pt}
2353 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2354 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2355 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2356 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2357 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2358 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2359 \let\titlebf=\titlerm
2360 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2361 \font\titlei=cmmi12 scaled \magstep3
2362 \font\titlesy=cmsy10 scaled \magstep4
2363 \def\titleecsize{2074}
2364
2365 % Chapter (and unnumbered) fonts (17.28pt).
2366 \def\chapnominalsize{17pt}
2367 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2368 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2369 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2370 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2371 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2372 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2373 \let\chapbf=\chaprm
2374 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2375 \font\chapi=cmmi12 scaled \magstep2
2376 \font\chapsy=cmsy10 scaled \magstep3
2377 \def\chapecsize{1728}
2378
2379 % Section fonts (14.4pt).
2380 \def\secnominalsize{14pt}
2381 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2382 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2383 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2384 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2385 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2386 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2387 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2388 \let\secbf\secrm
2389 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2390 \font\seci=cmmi12 scaled \magstep1
2391 \font\secsy=cmsy10 scaled \magstep2
2392 \def\sececsize{1440}
2393
2394 % Subsection fonts (13.15pt).
2395 \def\ssecnominalsize{13pt}
2396 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2397 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2398 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2399 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2400 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2401 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2402 \let\ssecbf\ssecrm
2403 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2404 \font\sseci=cmmi12 scaled \magstephalf
2405 \font\ssecsy=cmsy10 scaled 1315
2406 \def\ssececsize{1200}
2407
2408 % Reduced fonts for @acronym in text (10pt).
2409 \def\reducednominalsize{10pt}
2410 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2411 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2412 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2413 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2414 \setfont\reducedsl\slshape{10}{1000}{OT1}
2415 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2416 \setfont\reducedsc\scshape{10}{1000}{OT1}
2417 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2418 \font\reducedi=cmmi10
2419 \font\reducedsy=cmsy10
2420 \def\reducedecsize{1000}
2421
2422 \textleading = 13.2pt % line spacing for 11pt CM
2423 \textfonts % reset the current fonts
2424 \rm
2425 } % end of 11pt text font size definitions, \definetextfontsizexi
2426
2427
2428 % Definitions to make the main text be 10pt Computer Modern, with
2429 % section, chapter, etc., sizes following suit. This is for the GNU
2430 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2431 % future. Used with @smallbook, which sets the leading to 12pt.
2432 %
2433 \def\definetextfontsizex{%
2434 % Text fonts (10pt).
2435 \def\textnominalsize{10pt}
2436 \edef\mainmagstep{1000}
2437 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2438 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2439 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2440 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2441 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2442 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2443 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2444 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2445 \font\texti=cmmi10 scaled \mainmagstep
2446 \font\textsy=cmsy10 scaled \mainmagstep
2447 \def\textecsize{1000}
2448
2449 % A few fonts for @defun names and args.
2450 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2451 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2452 \setfont\defsl\slshape{10}{\magstephalf}{OT1}
2453 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2454 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2455 \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2456
2457 % Fonts for indices, footnotes, small examples (9pt).
2458 \def\smallnominalsize{9pt}
2459 \setfont\smallrm\rmshape{9}{1000}{OT1}
2460 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2461 \setfont\smallbf\bfshape{10}{900}{OT1}
2462 \setfont\smallit\itshape{9}{1000}{OT1IT}
2463 \setfont\smallsl\slshape{9}{1000}{OT1}
2464 \setfont\smallsf\sfshape{9}{1000}{OT1}
2465 \setfont\smallsc\scshape{10}{900}{OT1}
2466 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2467 \font\smalli=cmmi9
2468 \font\smallsy=cmsy9
2469 \def\smallecsize{0900}
2470
2471 % Fonts for small examples (8pt).
2472 \def\smallernominalsize{8pt}
2473 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2474 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2475 \setfont\smallerbf\bfshape{10}{800}{OT1}
2476 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2477 \setfont\smallersl\slshape{8}{1000}{OT1}
2478 \setfont\smallersf\sfshape{8}{1000}{OT1}
2479 \setfont\smallersc\scshape{10}{800}{OT1}
2480 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2481 \font\smalleri=cmmi8
2482 \font\smallersy=cmsy8
2483 \def\smallerecsize{0800}
2484
2485 % Fonts for math mode superscripts (7pt).
2486 \def\sevennominalsize{7pt}
2487 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2488 \setfont\seventt\ttshape{10}{700}{OT1TT}
2489 \setfont\sevenbf\bfshape{10}{700}{OT1}
2490 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2491 \setfont\sevensl\slshape{10}{700}{OT1}
2492 \setfont\sevensf\sfshape{10}{700}{OT1}
2493 \setfont\sevensc\scshape{10}{700}{OT1}
2494 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2495 \font\seveni=cmmi7
2496 \font\sevensy=cmsy7
2497 \def\sevenecsize{0700}
2498
2499 % Fonts for title page (20.4pt):
2500 \def\titlenominalsize{20pt}
2501 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2502 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2503 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2504 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2505 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2506 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2507 \let\titlebf=\titlerm
2508 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2509 \font\titlei=cmmi12 scaled \magstep3
2510 \font\titlesy=cmsy10 scaled \magstep4
2511 \def\titleecsize{2074}
2512
2513 % Chapter fonts (14.4pt).
2514 \def\chapnominalsize{14pt}
2515 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2516 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2517 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2518 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2519 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2520 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2521 \let\chapbf\chaprm
2522 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2523 \font\chapi=cmmi12 scaled \magstep1
2524 \font\chapsy=cmsy10 scaled \magstep2
2525 \def\chapecsize{1440}
2526
2527 % Section fonts (12pt).
2528 \def\secnominalsize{12pt}
2529 \setfont\secrm\rmbshape{12}{1000}{OT1}
2530 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2531 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2532 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2533 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2534 \setfont\secsf\sfbshape{12}{1000}{OT1}
2535 \let\secbf\secrm
2536 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2537 \font\seci=cmmi12
2538 \font\secsy=cmsy10 scaled \magstep1
2539 \def\sececsize{1200}
2540
2541 % Subsection fonts (10pt).
2542 \def\ssecnominalsize{10pt}
2543 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2544 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2545 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2546 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2547 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2548 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2549 \let\ssecbf\ssecrm
2550 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2551 \font\sseci=cmmi10
2552 \font\ssecsy=cmsy10
2553 \def\ssececsize{1000}
2554
2555 % Reduced fonts for @acronym in text (9pt).
2556 \def\reducednominalsize{9pt}
2557 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2558 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2559 \setfont\reducedbf\bfshape{10}{900}{OT1}
2560 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2561 \setfont\reducedsl\slshape{9}{1000}{OT1}
2562 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2563 \setfont\reducedsc\scshape{10}{900}{OT1}
2564 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2565 \font\reducedi=cmmi9
2566 \font\reducedsy=cmsy9
2567 \def\reducedecsize{0900}
2568
2569 \divide\parskip by 2 % reduce space between paragraphs
2570 \textleading = 12pt % line spacing for 10pt CM
2571 \textfonts % reset the current fonts
2572 \rm
2573 } % end of 10pt text font size definitions, \definetextfontsizex
2574
2575 % Fonts for short table of contents.
2576 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2577 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2578 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2579 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2580
2581
2582 % We provide the user-level command
2583 % @fonttextsize 10
2584 % (or 11) to redefine the text font size. pt is assumed.
2585 %
2586 \def\xiword{11}
2587 \def\xword{10}
2588 \def\xwordpt{10pt}
2589 %
2590 \parseargdef\fonttextsize{%
2591 \def\textsizearg{#1}%
2592 %\wlog{doing @fonttextsize \textsizearg}%
2593 %
2594 % Set \globaldefs so that documents can use this inside @tex, since
2595 % makeinfo 4.8 does not support it, but we need it nonetheless.
2596 %
2597 \begingroup \globaldefs=1
2598 \ifx\textsizearg\xword \definetextfontsizex
2599 \else \ifx\textsizearg\xiword \definetextfontsizexi
2600 \else
2601 \errhelp=\EMsimple
2602 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2603 \fi\fi
2604 \endgroup
2605 }
2606
2607 %
2608 % Change the current font style to #1, remembering it in \curfontstyle.
2609 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2610 % italics, not bold italics.
2611 %
2612 \def\setfontstyle#1{%
2613 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2614 \csname #1font\endcsname % change the current font
2615 }
2616
2617 \def\rm{\fam=0 \setfontstyle{rm}}
2618 \def\it{\fam=\itfam \setfontstyle{it}}
2619 \def\sl{\fam=\slfam \setfontstyle{sl}}
2620 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2621 \def\tt{\fam=\ttfam \setfontstyle{tt}}
2622
2623 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
2624 % So we set up a \sf.
2625 \newfam\sffam
2626 \def\sf{\fam=\sffam \setfontstyle{sf}}
2627
2628 % We don't need math for this font style.
2629 \def\ttsl{\setfontstyle{ttsl}}
2630
2631
2632 % In order for the font changes to affect most math symbols and letters,
2633 % we have to define the \textfont of the standard families.
2634 % We don't bother to reset \scriptscriptfont; awaiting user need.
2635 %
2636 \def\resetmathfonts{%
2637 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2638 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2639 \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2640 %
2641 % Fonts for superscript. Note that the 7pt fonts are used regardless
2642 % of the current font size.
2643 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
2644 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
2645 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
2646 \scriptfont\sffam=\sevensf
2647 }
2648
2649
2650
2651 % \defineassignfonts{SIZE} -
2652 % Define sequence \assignfontsSIZE, which switches between font sizes
2653 % by redefining the meanings of \STYLEfont. (Just \STYLE additionally sets
2654 % the current \fam for math mode.)
2655 %
2656 \def\defineassignfonts#1{%
2657 \expandafter\edef\csname assignfonts#1\endcsname{%
2658 \let\noexpand\rmfont\csname #1rm\endcsname
2659 \let\noexpand\itfont\csname #1it\endcsname
2660 \let\noexpand\slfont\csname #1sl\endcsname
2661 \let\noexpand\bffont\csname #1bf\endcsname
2662 \let\noexpand\ttfont\csname #1tt\endcsname
2663 \let\noexpand\smallcaps\csname #1sc\endcsname
2664 \let\noexpand\sffont \csname #1sf\endcsname
2665 \let\noexpand\ifont \csname #1i\endcsname
2666 \let\noexpand\syfont \csname #1sy\endcsname
2667 \let\noexpand\ttslfont\csname #1ttsl\endcsname
2668 }
2669 }
2670
2671 \def\assignfonts#1{%
2672 \csname assignfonts#1\endcsname
2673 }
2674
2675 \newif\ifrmisbold
2676
2677 % Select smaller font size with the current style. Used to change font size
2678 % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
2679 % normal roman text, also use bold fonts for roman text in the smaller size.
2680 \def\switchtolllsize{%
2681 \expandafter\assignfonts\expandafter{\lllsize}%
2682 \ifrmisbold
2683 \let\rmfont\bffont
2684 \fi
2685 \csname\curfontstyle\endcsname
2686 }%
2687
2688 \def\switchtolsize{%
2689 \expandafter\assignfonts\expandafter{\lsize}%
2690 \ifrmisbold
2691 \let\rmfont\bffont
2692 \fi
2693 \csname\curfontstyle\endcsname
2694 }%
2695
2696 % Define the font-changing commands (all called \...fonts).
2697 % Each font-changing command also sets the names \lsize (one size lower)
2698 % and \lllsize (three sizes lower). These relative commands are used
2699 % in, e.g., the LaTeX logo and acronyms.
2700 %
2701 % Note: The fonts used for \ifont are for "math italics" (\itfont is for
2702 % italics in regular text). \syfont is also used in math mode only.
2703 %
2704 \def\definefontsetatsize#1#2#3#4#5{%
2705 \defineassignfonts{#1}%
2706 \expandafter\def\csname #1fonts\endcsname{%
2707 \def\curfontsize{#1}%
2708 \def\lsize{#2}\def\lllsize{#3}%
2709 \csname rmisbold#5\endcsname
2710 \csname assignfonts#1\endcsname
2711 \resetmathfonts
2712 \setleading{#4}%
2713 }}
2714
2715 \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
2716 \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
2717 \definefontsetatsize{chap} {sec} {text} {19pt} {true}
2718 \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
2719 \definefontsetatsize{ssec} {text} {small} {15pt} {true}
2720 \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
2721 \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
2722 \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2723
2724 \def\titlefont#1{{\titlefonts\rm #1}}
2725 \let\subsecfonts = \ssecfonts
2726 \let\subsubsecfonts = \ssecfonts
2727
2728 % Define these just so they can be easily changed for other fonts.
2729 \def\angleleft{$\langle$}
2730 \def\angleright{$\rangle$}
2731
2732 % Set the fonts to use with the @small... environments.
2733 \let\smallexamplefonts = \smallfonts
2734
2735 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2736 % can fit this many characters:
2737 % 8.5x11=86 smallbook=72 a4=90 a5=69
2738 % If we use \scriptfonts (8pt), then we can fit this many characters:
2739 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2740 % For me, subjectively, the few extra characters that fit aren't worth
2741 % the additional smallness of 8pt. So I'm making the default 9pt.
2742 %
2743 % By the way, for comparison, here's what fits with @example (10pt):
2744 % 8.5x11=71 smallbook=60 a4=75 a5=58
2745 % --karl, 24jan03.
2746
2747 % Set up the default fonts, so we can use them for creating boxes.
2748 %
2749 \definetextfontsizexi
2750
2751
2752 % Check if we are currently using a typewriter font. Since all the
2753 % Computer Modern typewriter fonts have zero interword stretch (and
2754 % shrink), and it is reasonable to expect all typewriter fonts to have
2755 % this property, we can check that font parameter. #1 is what to
2756 % print if we are indeed using \tt; #2 is what to print otherwise.
2757 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
2758
2759 % Same as above, but check for italic font. Actually this also catches
2760 % non-italic slanted fonts since it is impossible to distinguish them from
2761 % italic fonts. But since this is only used by $ and it uses \sl anyway
2762 % this is not a problem.
2763 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
2764
2765
2766 % Check if internal flag is clear, i.e. has not been @set.
2767 \def\ifflagclear#1#2#3{%
2768 \expandafter\ifx\csname SET#1\endcsname\relax
2769 #2\else#3\fi
2770 }
2771
2772 {
2773 \catcode`\'=\active
2774 \catcode`\`=\active
2775
2776 \gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
2777 \gdef\setregularquotes{\let`\lq \let'\rq}
2778 }
2779 \setregularquotes
2780
2781 % output for ' in @code
2782 % in tt font hex 0D (undirected) or 27 (curly right quote)
2783 %
2784 \def\codequoteright{%
2785 \ifusingtt
2786 {\ifflagclear{txicodequoteundirected}%
2787 {\ifflagclear{codequoteundirected}%
2788 {'}%
2789 {\char"0D }}%
2790 {\char"0D }}%
2791 {'}%
2792 }
2793
2794 % output for ` in @code
2795 % in tt font hex 12 (grave accent) or 60 (curly left quote)
2796 % \relax disables Spanish ligatures ?` and !` of \tt font.
2797 %
2798 \def\codequoteleft{%
2799 \ifusingtt
2800 {\ifflagclear{txicodequotebacktick}%
2801 {\ifflagclear{codequotebacktick}%
2802 {\relax`}%
2803 {\char"12 }}%
2804 {\char"12 }}%
2805 {\relax`}%
2806 }
2807
2808 % Commands to set the quote options.
2809 %
2810 \parseargdef\codequoteundirected{%
2811 \def\temp{#1}%
2812 \ifx\temp\onword
2813 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2814 = t%
2815 \else\ifx\temp\offword
2816 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2817 = \relax
2818 \else
2819 \errhelp = \EMsimple
2820 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2821 \fi\fi
2822 }
2823
2824 \parseargdef\codequotebacktick{%
2825 \def\temp{#1}%
2826 \ifx\temp\onword
2827 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2828 = t%
2829 \else\ifx\temp\offword
2830 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2831 = \relax
2832 \else
2833 \errhelp = \EMsimple
2834 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2835 \fi\fi
2836 }
2837
2838 % Turn them on by default
2839 \let\SETtxicodequoteundirected = t
2840 \let\SETtxicodequotebacktick = t
2841
2842
2843 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2844 \def\noligaturesquoteleft{\relax\lq}
2845
2846 % Count depth in font-changes, for error checks
2847 \newcount\fontdepth \fontdepth=0
2848
2849 % Font commands.
2850
2851 % #1 is the font command (\sl or \it), #2 is the text to slant.
2852 % If we are in a monospaced environment, however, 1) always use \ttsl,
2853 % and 2) do not add an italic correction.
2854 \def\dosmartslant#1#2{%
2855 \ifusingtt
2856 {{\ttsl #2}\let\next=\relax}%
2857 {\def\next{{#1#2}\smartitaliccorrection}}%
2858 \next
2859 }
2860 \def\smartslanted{\dosmartslant\sl}
2861 \def\smartitalic{\dosmartslant\it}
2862
2863 % Output an italic correction unless the following character is such as
2864 % not to need one.
2865 \def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx}
2866 \def\smartitaliccorrectionx{%
2867 \ifx\next,%
2868 \else\ifx\next-%
2869 \else\ifx\next.%
2870 \else\ifx\next\.%
2871 \else\ifx\next\comma%
2872 \else\ptexslash
2873 \fi\fi\fi\fi\fi
2874 \aftersmartic
2875 }
2876
2877 % @cite unconditionally uses \sl with \smartitaliccorrection.
2878 \def\cite#1{{\sl #1}\smartitaliccorrection}
2879
2880 % By default, use ttsl font for @var when used in code context.
2881 % To unconditionally use \sl for @var, @clear txicodevaristt. This
2882 % gives consistency for parameter names whether they are in @def,
2883 % @table @code or a regular paragraph.
2884 \def\aftersmartic{}
2885 \def\var#1{%
2886 \let\saveaftersmartic = \aftersmartic
2887 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2888 % The \null is to reset \spacefactor.
2889 %
2890 \ifflagclear{txicodevaristt}%
2891 {\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
2892 {\def\varnext{\smartslanted{#1}}}%
2893 \varnext
2894 }
2895
2896 \def\SETtxicodevaristt{}% @set txicodevaristt
2897
2898 \let\i=\smartitalic
2899 \let\slanted=\smartslanted
2900 \let\dfn=\smartslanted
2901 \let\emph=\smartitalic
2902
2903 % @r for roman font, used for code comment
2904 \def\r#1{{%
2905 \usenormaldash % get --, --- ligatures even if in @code
2906 \defcharsdefault % in case on def line
2907 \rm #1}}
2908 {\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}}
2909
2910 % @sc, undocumented @ii.
2911 \def\sc#1{{\smallcaps#1}} % smallcaps font
2912 \def\ii#1{{\it #1}} % italic font
2913
2914 % @b, explicit bold. Also @strong.
2915 \def\b#1{{\bf \defcharsdefault #1}}
2916 \let\strong=\b
2917
2918 % @sansserif, explicit sans.
2919 \def\sansserif#1{{\sf #1}}
2920
2921 \newif\iffrenchspacing
2922 \frenchspacingfalse
2923
2924 % Set sfcode to normal for the chars that usually have another value.
2925 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2926 % sometimes \x has an active definition that messes things up.
2927 %
2928 \catcode`@=11
2929 \def\plainfrenchspacing{%
2930 \iffrenchspacing\else
2931 \frenchspacingtrue
2932 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2933 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2934 \def\endofsentencespacefactor{1000}% for @. and friends
2935 \fi
2936 }
2937 \def\plainnonfrenchspacing{%
2938 \iffrenchspacing
2939 \frenchspacingfalse
2940 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2941 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2942 \def\endofsentencespacefactor{3000}% for @. and friends
2943 \fi
2944 }
2945 \catcode`@=\other
2946 \def\endofsentencespacefactor{3000}% default
2947
2948 % @frenchspacing on|off says whether to put extra space after punctuation.
2949 %
2950 \def\onword{on}
2951 \def\offword{off}
2952 %
2953 \let\frenchspacingsetting\plainnonfrenchspacing % used in output routine
2954 \parseargdef\frenchspacing{%
2955 \def\temp{#1}%
2956 \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing
2957 \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing
2958 \else
2959 \errhelp = \EMsimple
2960 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
2961 \fi\fi
2962 \frenchspacingsetting
2963 }
2964
2965
2966 % @t, explicit typewriter.
2967 \def\t#1{%
2968 {\tt \defcharsdefault \plainfrenchspacing #1}%
2969 \null
2970 }
2971
2972 % @samp.
2973 \def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
2974
2975 % @indicateurl is \samp, that is, with quotes.
2976 \let\indicateurl=\samp
2977
2978 % @code (and similar) prints in typewriter, but with spaces the same
2979 % size as normal in the surrounding text, without hyphenation, etc.
2980 % This is a subroutine for that.
2981 \def\tclose#1{%
2982 {%
2983 % Change normal interword space to be same as for the current font.
2984 \spaceskip = \fontdimen2\font
2985 %
2986 % Switch to typewriter.
2987 \tt
2988 %
2989 % `\ ' produces the large typewriter interword space.
2990 \def\ {{\spaceskip = 0pt{} }}%
2991 %
2992 \plainfrenchspacing
2993 #1%
2994 }%
2995 \null % reset spacefactor to 1000
2996 }
2997
2998 % This is for LuaTeX: It is not sufficient to disable hyphenation at
2999 % explicit dashes by setting `\hyphenchar` to -1.
3000 \def\dashnobreak{%
3001 \normaldash
3002 \penalty 10000 }
3003
3004 % We must turn on hyphenation at `-' and `_' in @code.
3005 % Otherwise, it is too hard to avoid overfull hboxes
3006 % in the Emacs manual, the Library manual, etc.
3007 % We explicitly allow hyphenation at these characters
3008 % using \discretionary.
3009 %
3010 % Hyphenation at - and hyphenation within words was turned off
3011 % by default for the tt fonts using the \hyphenchar parameter of TeX.
3012 {
3013 \catcode`\-=\active \catcode`\_=\active
3014 \catcode`\'=\active \catcode`\`=\active
3015 \global\let'=\rq \global\let`=\lq % default definitions
3016 %
3017 \global\def\code{\begingroup
3018 \setcodequotes
3019 \catcode\dashChar=\active \catcode\underChar=\active
3020 \ifallowcodebreaks
3021 \let-\codedash
3022 \let_\codeunder
3023 \else
3024 \let-\dashnobreak
3025 \let_\realunder
3026 \fi
3027 \codex
3028 }
3029 %
3030 \gdef\codedash{\futurelet\next\codedashfinish}
3031 \gdef\codedashfinish{%
3032 \normaldash % always output the dash character itself.
3033 %
3034 % Now, output a discretionary to allow a line break, unless
3035 % (a) the next character is a -, or
3036 % (b) the preceding character is a -, or
3037 % (c) we are at the start of the string.
3038 % In both cases (b) and (c), \codedashnobreak should be set to \codedash.
3039 %
3040 % E.g., given --posix, we do not want to allow a break after either -.
3041 % Given --foo-bar, we do want to allow a break between the - and the b.
3042 \ifx\next\codedash \else
3043 \ifx\codedashnobreak\codedash
3044 \else \discretionary{}{}{}\fi
3045 \fi
3046 % we need the space after the = for the case when \next itself is a
3047 % space token; it would get swallowed otherwise. As in @code{- a}.
3048 \global\let\codedashnobreak= \next
3049 }
3050 }
3051 \def\normaldash{-}
3052 %
3053 \def\codex #1{\tclose{%
3054 % Given -foo (with a single dash), we do not want to allow a break
3055 % after the -. \codedashnobreak is set to the first character in
3056 % @code.
3057 \futurelet\codedashnobreak\relax
3058 #1%
3059 }\endgroup}
3060
3061 \def\codeunder{%
3062 % this is all so @math{@code{var_name}+1} can work. In math mode, _
3063 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
3064 % will therefore expand the active definition of _, which is us
3065 % (inside @code that is), therefore an endless loop.
3066 \ifusingtt{\ifmmode
3067 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
3068 \else\normalunderscore \fi
3069 \discretionary{}{}{}}%
3070 {\_}%
3071 }
3072
3073 % An additional complication: the above will allow breaks after, e.g.,
3074 % each of the four underscores in __typeof__. This is bad.
3075 % @allowcodebreaks provides a document-level way to turn breaking at -
3076 % and _ on and off.
3077 %
3078 \newif\ifallowcodebreaks \allowcodebreakstrue
3079
3080 \def\keywordtrue{true}
3081 \def\keywordfalse{false}
3082
3083 \parseargdef\allowcodebreaks{%
3084 \def\txiarg{#1}%
3085 \ifx\txiarg\keywordtrue
3086 \allowcodebreakstrue
3087 \else\ifx\txiarg\keywordfalse
3088 \allowcodebreaksfalse
3089 \else
3090 \errhelp = \EMsimple
3091 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
3092 \fi\fi
3093 }
3094
3095 % For @command, @env, @file, @option quotes seem unnecessary,
3096 % so use \code rather than \samp.
3097 \let\command=\code
3098 \let\env=\code
3099 \let\file=\code
3100 \let\option=\code
3101
3102 % @uref (abbreviation for `urlref') aka @url takes an optional
3103 % (comma-separated) second argument specifying the text to display and
3104 % an optional third arg as text to display instead of (rather than in
3105 % addition to) the url itself. First (mandatory) arg is the url.
3106
3107 % TeX-only option to allow changing PDF output to show only the second
3108 % arg (if given), and not the url (which is then just the link target).
3109 \newif\ifurefurlonlylink
3110
3111 % The default \pretolerance setting stops the penalty inserted in
3112 % \urefallowbreak being a discouragement to line breaking. Set it to
3113 % a negative value for this paragraph only. Hopefully this does not
3114 % conflict with redefinitions of \par done elsewhere.
3115 \def\nopretolerance{%
3116 \pretolerance=-1
3117 \def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
3118 }
3119
3120 % The main macro is \urefbreak, which allows breaking at expected
3121 % places within the url.
3122 \def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
3123 \let\uref=\urefbreak
3124 %
3125 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
3126 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
3127 \unsepspaces
3128 \pdfurl{#1}%
3129 \setbox0 = \hbox{\ignorespaces #3}%
3130 \ifdim\wd0 > 0pt
3131 \unhbox0 % third arg given, show only that
3132 \else
3133 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
3134 \ifdim\wd0 > 0pt
3135 \ifpdf
3136 % For pdfTeX and LuaTeX
3137 \ifurefurlonlylink
3138 % PDF plus option to not display url, show just arg
3139 \unhbox0
3140 \else
3141 % PDF, normally display both arg and url for consistency,
3142 % visibility, if the pdf is eventually used to print, etc.
3143 \unhbox0\ (\urefcode{#1})%
3144 \fi
3145 \else
3146 \ifxetex
3147 % For XeTeX
3148 \ifurefurlonlylink
3149 % PDF plus option to not display url, show just arg
3150 \unhbox0
3151 \else
3152 % PDF, normally display both arg and url for consistency,
3153 % visibility, if the pdf is eventually used to print, etc.
3154 \unhbox0\ (\urefcode{#1})%
3155 \fi
3156 \else
3157 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3158 \fi
3159 \fi
3160 \else
3161 \urefcode{#1}% only url given, so show it
3162 \fi
3163 \fi
3164 \endlink
3165 \endgroup}
3166
3167 % Allow line breaks around only a few characters (only).
3168 \def\urefcatcodes{%
3169 \catcode`\&=\active \catcode`\.=\active
3170 \catcode`\#=\active \catcode`\?=\active
3171 \catcode`\/=\active
3172 }
3173 {
3174 \urefcatcodes
3175 %
3176 \global\def\urefcode{\begingroup
3177 \setcodequotes
3178 \urefcatcodes
3179 \let&\urefcodeamp
3180 \let.\urefcodedot
3181 \let#\urefcodehash
3182 \let?\urefcodequest
3183 \let/\urefcodeslash
3184 \codex
3185 }
3186 %
3187 % By default, they are just regular characters.
3188 \global\def&{\normalamp}
3189 \global\def.{\normaldot}
3190 \global\def#{\normalhash}
3191 \global\def?{\normalquest}
3192 \global\def/{\normalslash}
3193 }
3194
3195 \def\urefcodeamp{\urefprebreak \&\urefpostbreak}
3196 \def\urefcodedot{\urefprebreak .\urefpostbreak}
3197 \def\urefcodehash{\urefprebreak \#\urefpostbreak}
3198 \def\urefcodequest{\urefprebreak ?\urefpostbreak}
3199 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3200 {
3201 \catcode`\/=\active
3202 \global\def\urefcodeslashfinish{%
3203 \urefprebreak \slashChar
3204 % Allow line break only after the final / in a sequence of
3205 % slashes, to avoid line break between the slashes in http://.
3206 \ifx\next/\else \urefpostbreak \fi
3207 }
3208 }
3209
3210 % By default we'll break after the special characters, but some people like to
3211 % break before the special chars, so allow that. Also allow no breaking at
3212 % all, for manual control.
3213 %
3214 \parseargdef\urefbreakstyle{%
3215 \def\txiarg{#1}%
3216 \ifx\txiarg\wordnone
3217 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3218 \else\ifx\txiarg\wordbefore
3219 \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
3220 \else\ifx\txiarg\wordafter
3221 \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
3222 \else
3223 \errhelp = \EMsimple
3224 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3225 \fi\fi\fi
3226 }
3227 \def\wordafter{after}
3228 \def\wordbefore{before}
3229 \def\wordnone{none}
3230
3231 % Allow a ragged right output to aid breaking long URL's. There can
3232 % be a break at the \allowbreak with no extra glue (if the existing stretch in
3233 % the line is sufficient), a break at the \penalty with extra glue added
3234 % at the end of the line, or no break at all here.
3235 % Changing the value of the penalty and/or the amount of stretch affects how
3236 % preferable one choice is over the other.
3237 % Check test cases in doc/texinfo-tex-test.texi before making any changes.
3238 \def\urefallowbreak{%
3239 \penalty0\relax
3240 \hskip 0pt plus 3 em\relax
3241 \penalty1000\relax
3242 \hskip 0pt plus -3 em\relax
3243 }
3244
3245 \urefbreakstyle after
3246
3247 % @url synonym for @uref, since that's how everyone uses it.
3248 %
3249 \let\url=\uref
3250
3251 % rms does not like angle brackets --karl, 17may97.
3252 % So now @email is just like @uref, unless we are pdf.
3253 %
3254 %\def\email#1{\angleleft{\tt #1}\angleright}
3255 \ifpdforxetex
3256 \def\email#1{\doemail#1,,\finish}
3257 \def\doemail#1,#2,#3\finish{\begingroup
3258 \unsepspaces
3259 \pdfurl{mailto:#1}%
3260 \setbox0 = \hbox{\ignorespaces #2}%
3261 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3262 \endlink
3263 \endgroup}
3264 \else
3265 \let\email=\uref
3266 \fi
3267
3268 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3269 % `example' (@kbd uses ttsl only inside of @example and friends),
3270 % or `code' (@kbd uses normal tty font always).
3271 \parseargdef\kbdinputstyle{%
3272 \def\txiarg{#1}%
3273 \ifx\txiarg\worddistinct
3274 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3275 \else\ifx\txiarg\wordexample
3276 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3277 \else\ifx\txiarg\wordcode
3278 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3279 \else
3280 \errhelp = \EMsimple
3281 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3282 \fi\fi\fi
3283 }
3284 \def\worddistinct{distinct}
3285 \def\wordexample{example}
3286 \def\wordcode{code}
3287
3288 % Default is `distinct'.
3289 \kbdinputstyle distinct
3290
3291 \def\kbd#1{%
3292 \tclose{\kbdfont\setcodequotes#1}%
3293 }
3294
3295 % definition of @key that produces a lozenge. Doesn't adjust to text size.
3296 %\setfont\keyrm\rmshape{8}{1000}{OT1}
3297 %\font\keysy=cmsy9
3298 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3299 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3300 % \vbox{\hrule\kern-0.4pt
3301 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3302 % \kern-0.4pt\hrule}%
3303 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3304
3305 % definition of @key with no lozenge.
3306 %
3307 \def\key#1{{\setregularquotes \tt #1}\null}
3308
3309 % @clicksequence{File @click{} Open ...}
3310 \def\clicksequence#1{\begingroup #1\endgroup}
3311
3312 % @clickstyle @arrow (by default)
3313 \parseargdef\clickstyle{\def\click{#1}}
3314 \def\click{\arrow}
3315
3316 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3317 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3318 %
3319 \def\dmn#1{\thinspace #1}
3320
3321 % @acronym for "FBI", "NATO", and the like.
3322 % We print this one point size smaller, since it's intended for
3323 % all-uppercase.
3324 %
3325 \def\acronym#1{\doacronym #1,,\finish}
3326 \def\doacronym#1,#2,#3\finish{%
3327 {\switchtolsize #1}%
3328 \def\temp{#2}%
3329 \ifx\temp\empty \else
3330 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3331 \fi
3332 \null % reset \spacefactor=1000
3333 }
3334
3335 % @abbr for "Comput. J." and the like.
3336 % No font change, but don't do end-of-sentence spacing.
3337 %
3338 \def\abbr#1{\doabbr #1,,\finish}
3339 \def\doabbr#1,#2,#3\finish{%
3340 {\plainfrenchspacing #1}%
3341 \def\temp{#2}%
3342 \ifx\temp\empty \else
3343 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3344 \fi
3345 \null % reset \spacefactor=1000
3346 }
3347
3348 % @asis just yields its argument. Used with @table, for example.
3349 %
3350 \def\asis#1{#1}
3351
3352 % @math outputs its argument in math mode.
3353 %
3354 % One complication: _ usually means subscripts, but it could also mean
3355 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
3356 % _ active, and distinguish by seeing if the current family is \slfam,
3357 % which is what @var uses.
3358 {
3359 \catcode`\_ = \active
3360 \gdef\mathunderscore{%
3361 \catcode`\_=\active
3362 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3363 }
3364 }
3365 % Another complication: we want \\ (and @\) to output a math (or tt) \.
3366 % FYI, plain.tex uses \\ as a temporary control sequence (for no
3367 % particular reason), but this is not advertised and we don't care.
3368 %
3369 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3370 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3371 %
3372 \def\math{%
3373 \ifmmode\else % only go into math if not in math mode already
3374 \tex
3375 \mathunderscore
3376 \let\\ = \mathbackslash
3377 \mathactive
3378 % make the texinfo accent commands work in math mode
3379 \let\"=\ddot
3380 \let\'=\acute
3381 \let\==\bar
3382 \let\^=\hat
3383 \let\`=\grave
3384 \let\u=\breve
3385 \let\v=\check
3386 \let\~=\tilde
3387 \let\dotaccent=\dot
3388 % have to provide another name for sup operator
3389 \let\mathopsup=\sup
3390 $\expandafter\finishmath\fi
3391 }
3392 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3393
3394 % Some active characters (such as <) are spaced differently in math.
3395 % We have to reset their definitions in case the @math was an argument
3396 % to a command which sets the catcodes (such as @item or @section).
3397 %
3398 {
3399 \catcode`^ = \active
3400 \catcode`< = \active
3401 \catcode`> = \active
3402 \catcode`+ = \active
3403 \catcode`' = \active
3404 \gdef\mathactive{%
3405 \let^ = \ptexhat
3406 \let< = \ptexless
3407 \let> = \ptexgtr
3408 \let+ = \ptexplus
3409 \let' = \ptexquoteright
3410 }
3411 }
3412
3413 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3414 % If in text, use math to place as sub/superscript, but switch
3415 % into text mode, with smaller fonts. This is a different font than the
3416 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3417 % fix it (significant additions to font machinery) until someone notices.
3418 %
3419 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3420 \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
3421 %
3422 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3423 \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
3424
3425 % provide this command from LaTeX as it is very common
3426 \def\frac#1#2{{{#1}\over{#2}}}
3427
3428 % @displaymath.
3429 % \globaldefs is needed to recognize the end lines in \tex and
3430 % \end tex. Set \thisenv as @end displaymath is seen before @end tex.
3431 {\obeylines
3432 \globaldefs=1
3433 \envdef\displaymath{%
3434 \tex%
3435 \def\thisenv{\displaymath}%
3436 \begingroup\let\end\displaymathend%
3437 $$%
3438 }
3439
3440 \def\displaymathend{$$\endgroup\end}%
3441
3442 \def\Edisplaymath{%
3443 \def\thisenv{\tex}%
3444 \end tex
3445 }}
3446
3447
3448 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3449 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3450 % except specified as a normal braced arg, so no newlines to worry about.
3451 %
3452 \def\outfmtnametex{tex}
3453 %
3454 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3455 \long\def\doinlinefmt#1,#2,\finish{%
3456 \def\inlinefmtname{#1}%
3457 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3458 }
3459 %
3460 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3461 % FMTNAME is tex, else ELSE-TEXT.
3462 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3463 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3464 \def\inlinefmtname{#1}%
3465 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3466 }
3467 %
3468 % For raw, must switch into @tex before parsing the argument, to avoid
3469 % setting catcodes prematurely. Doing it this way means that, for
3470 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3471 % ignored. But this isn't important because if people want a literal
3472 % *right* brace they would have to use a command anyway, so they may as
3473 % well use a command to get a left brace too. We could re-use the
3474 % delimiter character idea from \verb, but it seems like overkill.
3475 %
3476 \long\def\inlineraw{\tex \doinlineraw}
3477 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3478 \def\doinlinerawtwo#1,#2,\finish{%
3479 \def\inlinerawname{#1}%
3480 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3481 \endgroup % close group opened by \tex.
3482 }
3483
3484 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3485 %
3486 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3487 \long\def\doinlineifset#1,#2,\finish{%
3488 \def\inlinevarname{#1}%
3489 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3490 \else\ignorespaces#2\fi
3491 }
3492
3493 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3494 %
3495 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3496 \long\def\doinlineifclear#1,#2,\finish{%
3497 \def\inlinevarname{#1}%
3498 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3499 }
3500
3501
3502 \message{glyphs,}
3503 % and logos.
3504
3505 % @@ prints an @, as does @atchar{}.
3506 \def\@{\char64 }
3507 \let\atchar=\@
3508
3509 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3510 \def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}}
3511 \def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}}
3512 \let\{=\lbracechar
3513 \let\}=\rbracechar
3514
3515 % @comma{} to avoid , parsing problems.
3516 \let\comma = ,
3517
3518 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3519 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3520 \let\, = \ptexc
3521 \let\dotaccent = \ptexdot
3522 \def\ringaccent#1{{\accent23 #1}}
3523 \let\tieaccent = \ptext
3524 \let\ubaraccent = \ptexb
3525 \let\udotaccent = \d
3526
3527 % Other special characters: @questiondown @exclamdown @ordf @ordm
3528 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3529 \def\questiondown{?`}
3530 \def\exclamdown{!`}
3531 \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
3532 \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
3533
3534 % Dotless i and dotless j, used for accents.
3535 \def\imacro{i}
3536 \def\jmacro{j}
3537 \def\dotless#1{%
3538 \def\temp{#1}%
3539 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3540 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3541 \else \errmessage{@dotless can be used only with i or j}%
3542 \fi\fi
3543 }
3544
3545 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3546 % period following counts as ending a sentence. (Idea found in latex.)
3547 %
3548 \edef\TeX{\TeX \spacefactor=1000 }
3549
3550 % @LaTeX{} logo. Not quite the same results as the definition in
3551 % latex.ltx, since we use a different font for the raised A; it's most
3552 % convenient for us to use an explicitly smaller font, rather than using
3553 % the \scriptstyle font (since we don't reset \scriptstyle and
3554 % \scriptscriptstyle).
3555 %
3556 \def\LaTeX{%
3557 L\kern-.36em
3558 {\setbox0=\hbox{T}%
3559 \vbox to \ht0{\hbox{%
3560 \ifx\textnominalsize\xwordpt
3561 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
3562 % Revert to plain's \scriptsize, which is 7pt.
3563 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3564 \else
3565 \ifx\curfontsize\smallword
3566 % For footnotes and indices
3567 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3568 \else
3569 % For 11pt, we can use our lllsize.
3570 \switchtolllsize A%
3571 \fi
3572 \fi
3573 }%
3574 \vss
3575 }}%
3576 \kern-.15em
3577 \TeX
3578 }
3579 \def\smallword{small}
3580
3581 % Some math mode symbols. Define \ensuremath to switch into math mode
3582 % unless we are already there. Expansion tricks may not be needed here,
3583 % but safer, and can't hurt.
3584 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3585 \def\ensuredmath#1{$\relax#1$}
3586 %
3587 \def\bullet{\ensuremath\ptexbullet}
3588 \def\geq{\ensuremath\ge}
3589 \def\leq{\ensuremath\le}
3590 \def\minus{\ensuremath-}
3591
3592 % @dots{} outputs an ellipsis using the current font.
3593 % We do .5em per period so that it has the same spacing in the cm
3594 % typewriter fonts as three actual period characters; on the other hand,
3595 % in other typewriter fonts three periods are wider than 1.5em. So do
3596 % whichever is larger.
3597 %
3598 \def\dots{%
3599 \leavevmode
3600 \setbox0=\hbox{...}% get width of three periods
3601 \ifdim\wd0 > 1.5em
3602 \dimen0 = \wd0
3603 \else
3604 \dimen0 = 1.5em
3605 \fi
3606 \hbox to \dimen0{%
3607 \hskip 0pt plus.25fil
3608 .\hskip 0pt plus1fil
3609 .\hskip 0pt plus1fil
3610 .\hskip 0pt plus.5fil
3611 }%
3612 }
3613
3614 % @enddots{} is an end-of-sentence ellipsis.
3615 %
3616 \def\enddots{%
3617 \dots
3618 \spacefactor=\endofsentencespacefactor
3619 }
3620
3621 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3622 %
3623 % Since these characters are used in examples, they should be an even number of
3624 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3625 %
3626 \def\point{$\star$}
3627 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3628 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3629 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3630 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3631 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3632
3633 % The @error{} command.
3634 % Adapted from the TeXbook's \boxit.
3635 %
3636 \newbox\errorbox
3637 %
3638 {\ttfont \global\dimen0 = 3em}% Width of the box.
3639 \dimen2 = .55pt % Thickness of rules
3640 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3641 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3642 %
3643 \setbox\errorbox=\hbox to \dimen0{\hfil
3644 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3645 \advance\hsize by -2\dimen2 % Rules.
3646 \vbox{%
3647 \hrule height\dimen2
3648 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3649 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3650 \kern3pt\vrule width\dimen2}% Space to right.
3651 \hrule height\dimen2}
3652 \hfil}
3653 %
3654 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3655
3656 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3657 %
3658 \def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}}
3659
3660 % @euro{} comes from a separate font, depending on the current style.
3661 % We use the free feym* fonts from the eurosym package by Henrik
3662 % Theiling, which support regular, slanted, bold and bold slanted (and
3663 % "outlined" (blackboard board, sort of) versions, which we don't need).
3664 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3665 %
3666 % Although only regular is the truly official Euro symbol, we ignore
3667 % that. The Euro is designed to be slightly taller than the regular
3668 % font height.
3669 %
3670 % feymr - regular
3671 % feymo - slanted
3672 % feybr - bold
3673 % feybo - bold slanted
3674 %
3675 % There is no good (free) typewriter version, to my knowledge.
3676 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3677 % Hmm.
3678 %
3679 % Also doesn't work in math. Do we need to do math with euro symbols?
3680 % Hope not.
3681 %
3682 %
3683 \def\euro{{\eurofont e}}
3684 \def\eurofont{%
3685 % We set the font at each command, rather than predefining it in
3686 % \textfonts and the other font-switching commands, so that
3687 % installations which never need the symbol don't have to have the
3688 % font installed.
3689 %
3690 % There is only one designed size (nominal 10pt), so we always scale
3691 % that to the current nominal size.
3692 %
3693 % By the way, simply using "at 1em" works for cmr10 and the like, but
3694 % does not work for cmbx10 and other extended/shrunken fonts.
3695 %
3696 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3697 %
3698 \ifx\curfontstyle\bfstylename
3699 % bold:
3700 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3701 \else
3702 % regular:
3703 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3704 \fi
3705 \thiseurofont
3706 }
3707
3708 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3709 % sometimes we redefine the original macro, and the alias should reflect
3710 % the redefinition.
3711 %
3712 % Use LaTeX names for the Icelandic letters.
3713 \def\DH{{\ecfont \char"D0}} % Eth
3714 \def\dh{{\ecfont \char"F0}} % eth
3715 \def\TH{{\ecfont \char"DE}} % Thorn
3716 \def\th{{\ecfont \char"FE}} % thorn
3717 %
3718 \def\guillemetleft{{\ecfont \char"13}}
3719 \def\guillemotleft{\guillemetleft}
3720 \def\guillemetright{{\ecfont \char"14}}
3721 \def\guillemotright{\guillemetright}
3722 \def\guilsinglleft{{\ecfont \char"0E}}
3723 \def\guilsinglright{{\ecfont \char"0F}}
3724 \def\quotedblbase{{\ecfont \char"12}}
3725 \def\quotesinglbase{{\ecfont \char"0D}}
3726 %
3727 \def\L{{\ecfont \char"8A}} % L with stroke
3728 \def\l{{\ecfont \char"AA}} % l with stroke
3729 %
3730 % This positioning is not perfect (see the ogonek LaTeX package), but
3731 % we have the precomposed glyphs for the most common cases. We put the
3732 % tests to use those glyphs in the single \ogonek macro so we have fewer
3733 % dummy definitions to worry about for index entries, etc.
3734 %
3735 % ogonek is also used with other letters in Lithuanian (IOU), but using
3736 % the precomposed glyphs for those is not so easy since they aren't in
3737 % the same EC font.
3738 \def\ogonek#1{{%
3739 \def\temp{#1}%
3740 \ifx\temp\macrocharA\Aogonek
3741 \else\ifx\temp\macrochara\aogonek
3742 \else\ifx\temp\macrocharE\Eogonek
3743 \else\ifx\temp\macrochare\eogonek
3744 \else
3745 \ecfont \setbox0=\hbox{#1}%
3746 \ifdim\ht0=1ex\accent"0C #1%
3747 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3748 \fi
3749 \fi\fi\fi\fi
3750 }%
3751 }
3752 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3753 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3754 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3755 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3756 %
3757 % Use the European Computer Modern fonts (cm-super in outline format)
3758 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3759 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3760 % package and follow the same conventions.
3761 %
3762 \def\ecfont{\etcfont{e}}
3763 \def\tcfont{\etcfont{t}}
3764 %
3765 \def\etcfont#1{%
3766 % We can't distinguish serif/sans and italic/slanted, but this
3767 % is used for crude hacks anyway (like adding French and German
3768 % quotes to documents typeset with CM, where we lose kerning), so
3769 % hopefully nobody will notice/care.
3770 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3771 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3772 \ifusingtt
3773 % typewriter:
3774 {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}%
3775 % else
3776 {\ifx\curfontstyle\bfstylename
3777 \etcfontbold{#1}%
3778 \else
3779 \ifrmisbold
3780 \etcfontbold{#1}%
3781 \else
3782 % regular:
3783 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space
3784 at \nominalsize
3785 \fi
3786 \fi}%
3787 \thisecfont
3788 }
3789
3790 \def\etcfontbold#1{%
3791 % bold:
3792 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3793 }
3794
3795 % @registeredsymbol - R in a circle. The font for the R should really
3796 % be smaller yet, but lllsize is the best we can do for now.
3797 % Adapted from the plain.tex definition of \copyright.
3798 %
3799 \def\registeredsymbol{%
3800 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
3801 \hfil\crcr\Orb}}%
3802 }$%
3803 }
3804
3805 % @textdegree - the normal degrees sign.
3806 %
3807 \def\textdegree{%
3808 \ifmmode ^\circ
3809 \else {\tcfont \char 176}%
3810 \fi}
3811
3812 % Laurent Siebenmann reports \Orb undefined with:
3813 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3814 % so we'll define it if necessary.
3815 %
3816 \ifx\Orb\thisisundefined
3817 \def\Orb{\mathhexbox20D}
3818 \fi
3819
3820 % Quotes.
3821 \chardef\quoteleft=`\`
3822 \chardef\quoteright=`\'
3823
3824 % only change font for tt for correct kerning and to avoid using
3825 % \ecfont unless necessary.
3826 \def\quotedblleft{%
3827 \ifusingtt{{\ecfont\char"10}}{{\char"5C}}%
3828 }
3829
3830 \def\quotedblright{%
3831 \ifusingtt{{\ecfont\char"11}}{{\char`\"}}%
3832 }
3833
3834
3835 \message{page headings,}
3836
3837 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3838 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3839
3840 % First the title page. Must do @settitle before @titlepage.
3841 \newif\ifseenauthor
3842 \newif\iffinishedtitlepage
3843
3844 % @setcontentsaftertitlepage used to do an implicit @contents or
3845 % @shortcontents after @end titlepage, but it is now obsolete.
3846 \def\setcontentsaftertitlepage{%
3847 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3848 command; move your @contents command if you want the contents
3849 after the title page.}}%
3850 \def\setshortcontentsaftertitlepage{%
3851 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3852 command; move your @shortcontents and @contents commands if you
3853 want the contents after the title page.}}%
3854
3855 \parseargdef\shorttitlepage{%
3856 {\headingsoff \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3857 \endgroup\page\hbox{}\page}\pageone}
3858
3859 \envdef\titlepage{%
3860 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3861 \begingroup
3862 \parindent=0pt \textfonts
3863 \headingsoff
3864 % Leave some space at the very top of the page.
3865 \vglue\titlepagetopglue
3866 % No rule at page bottom unless we print one at the top with @title.
3867 \finishedtitlepagetrue
3868 %
3869 % Most title ``pages'' are actually two pages long, with space
3870 % at the top of the second. We don't want the ragged left on the second.
3871 \let\oldpage = \page
3872 \def\page{%
3873 \iffinishedtitlepage\else
3874 \finishtitlepage
3875 \fi
3876 \let\page = \oldpage
3877 \page
3878 \null
3879 }%
3880 }
3881
3882 \def\Etitlepage{%
3883 \iffinishedtitlepage\else
3884 \finishtitlepage
3885 \fi
3886 % It is important to do the page break before ending the group,
3887 % because the headline and footline are only empty inside the group.
3888 % If we use the new definition of \page, we always get a blank page
3889 % after the title page, which we certainly don't want.
3890 \oldpage
3891 \pageone
3892 \endgroup
3893 %
3894 }
3895
3896 \def\finishtitlepage{%
3897 \ifseenauthor \vskip4pt \else \vskip 0pt plus 1filll \fi
3898 \hrule height 2pt width \hsize
3899 \vskip\titlepagebottomglue
3900 \finishedtitlepagetrue
3901 }
3902
3903 % Settings used for typesetting titles: no hyphenation, no indentation,
3904 % don't worry much about spacing, ragged right. This should be used
3905 % inside a \vbox, and fonts need to be set appropriately first. \par should
3906 % be specified before the end of the \vbox, since a vbox is a group.
3907 %
3908 \def\raggedtitlesettings{%
3909 \rm
3910 \hyphenpenalty=10000
3911 \parindent=0pt
3912 \tolerance=5000
3913 \ptexraggedright
3914 }
3915
3916 % Macros to be used within @titlepage:
3917
3918 \let\subtitlerm=\rmfont
3919 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3920
3921 \let\savedtitle\empty
3922 \let\savedsubtitlegroup\empty
3923 \let\savedauthorgroup\empty
3924
3925 \parseargdef\title{%
3926 \expandafter\ifx\thisenv\documentinfo
3927 \gdef\savedtitle{#1}%
3928 \else
3929 \checkenv\titlepage
3930 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3931 % print a rule at the page bottom also.
3932 \finishedtitlepagefalse
3933 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3934 \fi
3935 }
3936
3937 \parseargdef\subtitle{%
3938 \expandafter\ifx\thisenv\documentinfo
3939 \ifx\savedsubtitlegroup\empty
3940 \gdef\savedsubtitlegroup{\savedsubtitle{#1}}%
3941 \else
3942 \expandafter\gdef\expandafter\savedsubtitlegroup\expandafter{%
3943 \savedsubtitlegroup\savedsubtitle{#1}}%
3944 \fi
3945 \else
3946 \checkenv\titlepage
3947 {\subtitlefont \rightline{#1}}%
3948 \fi
3949 }
3950
3951 % @author should come last, but may come many times.
3952 % It can also be used inside @quotation.
3953 %
3954 \parseargdef\author{%
3955 \expandafter\ifx\thisenv\documentinfo
3956 \ifx\savedauthorgroup\empty
3957 \gdef\savedauthorgroup{\savedauthor{#1}}%
3958 \else
3959 \expandafter\gdef\expandafter\savedauthorgroup\expandafter{%
3960 \savedauthorgroup\savedauthor{#1}}%
3961 \fi
3962 \else
3963 \def\temp{\quotation}%
3964 \ifx\thisenv\temp
3965 \def\quotationauthor{#1}% printed in \Equotation.
3966 \else
3967 \checkenv\titlepage
3968 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3969 {\secfonts\rm \leftline{#1}}%
3970 \fi
3971 \fi
3972 }
3973
3974 % @maketitle
3975 {\obeylines
3976 \gdef\maketitle{%
3977 \titlepage
3978 \ifx\savedtitle\empty\else
3979 \title \savedtitle
3980 \ifx\savedsubtitlegroup\empty\else
3981 \savedsubtitlegroup
3982 \fi\fi
3983 \ifx\savedauthorgroup\empty\else
3984 \savedauthorgroup
3985 \fi
3986 % start verso page if either copying or publication text is given
3987 \ifx\copyingtext\relax
3988 \ifx\publicationtext\relax\else
3989 \page \vskip 0pt plus 1filll
3990 \fi
3991 \else
3992 \page \vskip 0pt plus 1filll
3993 \fi
3994 \ifx\publicationtext\relax\else
3995 \insertpublication
3996 \sp 1
3997 \fi
3998 \ifx\copyingtext\relax\else
3999 \insertcopying
4000 \fi
4001 \end titlepage
4002 }
4003
4004 % \savedauthor{#1}, called with braces. output an @author line.
4005 \gdef\savedauthor#1{%
4006 \author#1
4007 }
4008
4009 % \savedsubtitle{#1}, called with braces. output a @subtitle line.
4010 \gdef\savedsubtitle#1{%
4011 \subtitle#1
4012 }
4013 } % \obeylines
4014
4015 % @documentinfo block
4016 \envdef\documentinfo{%
4017 }
4018 \def\Edocumentinfo{}%
4019
4020
4021 % Set up page headings and footings.
4022
4023 \let\thispage=\folio
4024
4025 \newtoks\evenheadline % headline on even pages
4026 \newtoks\oddheadline % headline on odd pages
4027 \newtoks\evenchapheadline% headline on even pages with a new chapter
4028 \newtoks\oddchapheadline % headline on odd pages with a new chapter
4029 \newtoks\evenfootline % footline on even pages
4030 \newtoks\oddfootline % footline on odd pages
4031
4032 % Now make \makeheadline and \makefootline in Plain TeX use those variables
4033 \headline={{\textfonts\rm\frenchspacingsetting
4034 \ifchapterpage
4035 \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
4036 \else
4037 \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
4038 \fi}}
4039
4040 \footline={{\textfonts\rm\frenchspacingsetting
4041 \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}%
4042 \HEADINGShook}
4043 \let\HEADINGShook=\relax
4044
4045 % Commands to set those variables.
4046 % For example, this is what @headings on does
4047 % @evenheading @thistitle|@thispage|@thischapter
4048 % @oddheading @thischapter|@thispage|@thistitle
4049 % @evenfooting @thisfile||
4050 % @oddfooting ||@thisfile
4051
4052
4053 \def\evenheading{\parsearg\evenheadingxxx}
4054 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
4055 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
4056 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
4057 \global\evenchapheadline=\evenheadline}
4058
4059 \def\oddheading{\parsearg\oddheadingxxx}
4060 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
4061 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
4062 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}%
4063 \global\oddchapheadline=\oddheadline}
4064
4065 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
4066
4067 \def\evenfooting{\parsearg\evenfootingxxx}
4068 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
4069 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
4070 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
4071
4072 \def\oddfooting{\parsearg\oddfootingxxx}
4073 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
4074 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
4075 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
4076 %
4077 % Leave some space for the footline. Hopefully ok to assume
4078 % @evenfooting will not be used by itself.
4079 \global\advance\txipageheight by -12pt
4080 \global\advance\vsize by -12pt
4081 }
4082
4083 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
4084
4085 % @evenheadingmarks top \thischapter <- chapter at the top of a page
4086 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
4087 %
4088 % The same set of arguments for:
4089 %
4090 % @oddheadingmarks
4091 % @evenfootingmarks
4092 % @oddfootingmarks
4093 % @everyheadingmarks
4094 % @everyfootingmarks
4095
4096 % These define \getoddheadingmarks, \getevenheadingmarks,
4097 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
4098 % \gettopheadingmarks, \getbottomheadingmarks.
4099 %
4100 \def\evenheadingmarks{\headingmarks{even}{heading}}
4101 \def\oddheadingmarks{\headingmarks{odd}{heading}}
4102 \def\evenfootingmarks{\headingmarks{even}{footing}}
4103 \def\oddfootingmarks{\headingmarks{odd}{footing}}
4104 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
4105 \headingmarks{odd}{heading}{#1} }
4106 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
4107 \headingmarks{odd}{footing}{#1} }
4108 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
4109 \def\headingmarks#1#2#3 {%
4110 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
4111 \global\expandafter\let\csname get#1#2marks\endcsname \temp
4112 }
4113
4114 \everyheadingmarks bottom
4115 \everyfootingmarks bottom
4116
4117 % @headings double turns headings on for double-sided printing.
4118 % @headings single turns headings on for single-sided printing.
4119 % @headings off turns them off.
4120 % @headings on same as @headings double, retained for compatibility.
4121 % @headings after turns on double-sided headings after this page.
4122 % @headings doubleafter turns on double-sided headings after this page.
4123 % @headings singleafter turns on single-sided headings after this page.
4124 % By default, they are off at the start of a document,
4125 % and turned `on' after @end titlepage.
4126
4127 \parseargdef\headings{\csname HEADINGS#1\endcsname}
4128
4129 \def\headingsoff{% non-global headings elimination
4130 \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}%
4131 \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}%
4132 }
4133
4134 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
4135
4136 % Set the page number to 1.
4137 \def\pageone{
4138 \global\pageno=1
4139 \global\arabiccount = \pagecount
4140 }
4141
4142 \let\contentsalignmacro = \chappager
4143
4144 % \def\HEADINGSon{\HEADINGSdouble} % defined by \CHAPPAGon
4145
4146 % For double-sided printing, put current file name in lower left corner,
4147 % chapter name on inside top of right hand pages, document
4148 % title on inside top of left hand pages, and page numbers on outside top
4149 % edge of all pages.
4150 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdouble}
4151 \let\HEADINGSdoubleafter=\HEADINGSafter
4152 \def\HEADINGSdouble{%
4153 \global\evenfootline={\hfil}
4154 \global\oddfootline={\hfil}
4155 \global\evenheadline={\line{\folio\hfil\thistitle}}
4156 \global\oddheadline={\line{\thischapter\hfil\folio}}
4157 \global\evenchapheadline={\line{\folio\hfil\thistitle}}
4158 \global\oddchapheadline={\line{\hfil\folio}}
4159 \global\let\contentsalignmacro = \chapoddpage
4160 }
4161
4162 % For single-sided printing, chapter title goes across top left of page,
4163 % page number on top right.
4164 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsingle}
4165 \def\HEADINGSsingle{%
4166 \global\evenfootline={\hfil}
4167 \global\oddfootline={\hfil}
4168 \global\evenheadline={\line{\thischapter\hfil\folio}}
4169 \global\oddheadline={\line{\thischapter\hfil\folio}}
4170 \global\evenchapheadline={\line{\hfil\folio}}
4171 \global\oddchapheadline={\line{\hfil\folio}}
4172 \global\let\contentsalignmacro = \chappager
4173 }
4174
4175 % for @setchapternewpage off
4176 \def\HEADINGSsinglechapoff{%
4177 \global\evenfootline={\hfil}
4178 \global\oddfootline={\hfil}
4179 \global\evenheadline={\line{\thischapter\hfil\folio}}
4180 \global\oddheadline={\line{\thischapter\hfil\folio}}
4181 \global\evenchapheadline=\evenheadline
4182 \global\oddchapheadline=\oddheadline
4183 \global\let\contentsalignmacro = \chappager
4184 }
4185
4186 % Subroutines used in generating headings
4187 % This produces Day Month Year style of output.
4188 % Only define if not already defined, in case a txi-??.tex file has set
4189 % up a different format (e.g., txi-cs.tex does this).
4190 \ifx\today\thisisundefined
4191 \def\today{%
4192 \number\day\space
4193 \ifcase\month
4194 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
4195 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
4196 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
4197 \fi
4198 \space\number\year}
4199 \fi
4200
4201 % @settitle line... specifies the title of the document, for headings.
4202 % It generates no output of its own.
4203 \def\thistitle{\putwordNoTitle}
4204 \def\settitle{\parsearg{\gdef\thistitle}}
4205
4206
4207 \message{tables,}
4208 % Tables -- @table, @ftable, @vtable, @item(x).
4209
4210 % default indentation of table text
4211 \newdimen\tableindent \tableindent=.8in
4212 % default indentation of @itemize and @enumerate text
4213 \newdimen\itemindent \itemindent=.3in
4214 % margin between end of table item and start of table text.
4215 \newdimen\itemmargin \itemmargin=.1in
4216
4217 % used internally for \itemindent minus \itemmargin
4218 \newdimen\itemmax
4219
4220 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
4221 % these defs.
4222 % They also define \itemindex
4223 % to index the item name in whatever manner is desired (perhaps none).
4224
4225 \newif\ifitemxneedsnegativevskip
4226
4227 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4228
4229 \def\internalBitem{\smallbreak \parsearg\itemzzz}
4230 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
4231
4232 \def\itemzzz #1{\begingroup %
4233 \advance\hsize by -\rightskip
4234 \advance\hsize by -\tableindent
4235 \setbox0=\hbox{\itemindicate{#1}}%
4236 \itemindex{#1}%
4237 \nobreak % This prevents a break before @itemx.
4238 %
4239 % If the item text does not fit in the space we have, put it on a line
4240 % by itself, and do not allow a page break either before or after that
4241 % line. We do not start a paragraph here because then if the next
4242 % command is, e.g., @kindex, the whatsit would get put into the
4243 % horizontal list on a line by itself, resulting in extra blank space.
4244 \ifdim \wd0>\itemmax
4245 %
4246 % Make this a paragraph so we get the \parskip glue and wrapping,
4247 % but leave it ragged-right.
4248 \begingroup
4249 \advance\leftskip by-\tableindent
4250 \advance\hsize by\tableindent
4251 \advance\rightskip by0pt plus1fil\relax
4252 \leavevmode\unhbox0\par
4253 \endgroup
4254 %
4255 % We're going to be starting a paragraph, but we don't want the
4256 % \parskip glue -- logically it's part of the @item we just started.
4257 \nobreak \vskip-\parskip
4258 %
4259 % Stop a page break at the \parskip glue coming up. However, if
4260 % what follows is an environment such as @example, there will be no
4261 % \parskip glue; then the negative vskip we just inserted would
4262 % cause the example and the item to crash together. So we use this
4263 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4264 % \parskip glue after all. Section titles are handled this way also.
4265 %
4266 \penalty 10001
4267 \endgroup
4268 \itemxneedsnegativevskipfalse
4269 \else
4270 % The item text fits into the space. Start a paragraph, so that the
4271 % following text (if any) will end up on the same line.
4272 \noindent
4273 % Do this with kerns and \unhbox so that if there is a footnote in
4274 % the item text, it can migrate to the main vertical list and
4275 % eventually be printed.
4276 \nobreak\kern-\tableindent
4277 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4278 \unhbox0
4279 \nobreak\kern\dimen0
4280 \endgroup
4281 \itemxneedsnegativevskiptrue
4282 \fi
4283 }
4284
4285 \def\item{\errmessage{@item while not in a list environment}}
4286 \def\itemx{\errmessage{@itemx while not in a list environment}}
4287
4288 % @table, @ftable, @vtable.
4289 \envdef\table{%
4290 \let\itemindex\gobble
4291 \tablecheck{table}%
4292 }
4293 \envdef\ftable{%
4294 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4295 \tablecheck{ftable}%
4296 }
4297 \envdef\vtable{%
4298 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4299 \tablecheck{vtable}%
4300 }
4301 \def\tablecheck#1{%
4302 \ifnum \the\catcode`\^^M=\active
4303 \endgroup
4304 \errmessage{This command won't work in this context; perhaps the problem is
4305 that we are \inenvironment\thisenv}%
4306 \def\next{\doignore{#1}}%
4307 \else
4308 \let\next\tablex
4309 \fi
4310 \next
4311 }
4312 \def\tablex#1{%
4313 \def\itemindicate{#1}%
4314 \parsearg\tabley
4315 }
4316 \def\tabley#1{%
4317 {%
4318 \makevalueexpandable
4319 \edef\temp{\noexpand\tablez #1\space\space\space}%
4320 \expandafter
4321 }\temp \endtablez
4322 }
4323 \def\tablez #1 #2 #3 #4\endtablez{%
4324 \aboveenvbreak
4325 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4326 \ifnum 0#2>0 \tableindent=#2\mil \fi
4327 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4328 \itemmax=\tableindent
4329 \advance \itemmax by -\itemmargin
4330 \advance \leftskip by \tableindent
4331 \exdentamount=\tableindent
4332 \parindent = 0pt
4333 \parskip = \smallskipamount
4334 \ifdim \parskip=0pt \parskip=2pt \fi
4335 \let\item = \internalBitem
4336 \let\itemx = \internalBitemx
4337 }
4338 \def\Etable{\endgraf\afterenvbreak}
4339 \let\Eftable\Etable
4340 \let\Evtable\Etable
4341 \let\Eitemize\Etable
4342 \let\Eenumerate\Etable
4343
4344 % This is the counter used by @enumerate, which is really @itemize
4345
4346 \newcount \itemno
4347
4348 \envdef\itemize{\parsearg\doitemize}
4349
4350 \def\doitemize#1{%
4351 \aboveenvbreak
4352 \itemmax=\itemindent
4353 \advance\itemmax by -\itemmargin
4354 \advance\leftskip by \itemindent
4355 \exdentamount=\itemindent
4356 \parindent=0pt
4357 \parskip=\smallskipamount
4358 \ifdim\parskip=0pt \parskip=2pt \fi
4359 %
4360 % Try typesetting the item mark so that if the document erroneously says
4361 % something like @itemize @samp (intending @table), there's an error
4362 % right away at the @itemize. It's not the best error message in the
4363 % world, but it's better than leaving it to the @item. This means if
4364 % the user wants an empty mark, they have to say @w{} not just @w.
4365 \def\itemcontents{#1}%
4366 \setbox0 = \hbox{\itemcontents}%
4367 %
4368 % @itemize with no arg is equivalent to @itemize @bullet.
4369 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4370 %
4371 \let\item=\itemizeitem
4372 }
4373
4374 % Definition of @item while inside @itemize and @enumerate.
4375 %
4376 \def\itemizeitem{%
4377 \advance\itemno by 1 % for enumerations
4378 {\let\par=\endgraf \smallbreak}% reasonable place to break
4379 {%
4380 % If the document has an @itemize directly after a section title, a
4381 % \nobreak will be last on the list, and \sectionheading will have
4382 % done a \vskip-\parskip. In that case, we don't want to zero
4383 % parskip, or the item text will crash with the heading. On the
4384 % other hand, when there is normal text preceding the item (as there
4385 % usually is), we do want to zero parskip, or there would be too much
4386 % space. In that case, we won't have a \nobreak before. At least
4387 % that's the theory.
4388 \ifnum\lastpenalty<10000 \parskip=0in \fi
4389 \noindent
4390 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4391 %
4392 \ifinner\else
4393 \vadjust{\penalty 1200}% not good to break after first line of item.
4394 \fi
4395 % We can be in inner vertical mode in a footnote, although an
4396 % @itemize looks awful there.
4397 }%
4398 \flushcr
4399 }
4400
4401 % \splitoff TOKENS\endmark defines \first to be the first token in
4402 % TOKENS, and \rest to be the remainder.
4403 %
4404 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4405
4406 % Allow an optional argument of an uppercase letter, lowercase letter,
4407 % or number, to specify the first label in the enumerated list. No
4408 % argument is the same as `1'.
4409 %
4410 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4411 \def\enumeratey #1 #2\endenumeratey{%
4412 % If we were given no argument, pretend we were given `1'.
4413 \def\thearg{#1}%
4414 \ifx\thearg\empty \def\thearg{1}\fi
4415 %
4416 % Detect if the argument is a single token. If so, it might be a
4417 % letter. Otherwise, the only valid thing it can be is a number.
4418 % (We will always have one token, because of the test we just made.
4419 % This is a good thing, since \splitoff doesn't work given nothing at
4420 % all -- the first parameter is undelimited.)
4421 \expandafter\splitoff\thearg\endmark
4422 \ifx\rest\empty
4423 % Only one token in the argument. It could still be anything.
4424 % A ``lowercase letter'' is one whose \lccode is nonzero.
4425 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4426 % not equal to itself.
4427 % Otherwise, we assume it's a number.
4428 %
4429 % We need the \relax at the end of the \ifnum lines to stop TeX from
4430 % continuing to look for a <number>.
4431 %
4432 \ifnum\lccode\expandafter`\thearg=0\relax
4433 \numericenumerate % a number (we hope)
4434 \else
4435 % It's a letter.
4436 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4437 \lowercaseenumerate % lowercase letter
4438 \else
4439 \uppercaseenumerate % uppercase letter
4440 \fi
4441 \fi
4442 \else
4443 % Multiple tokens in the argument. We hope it's a number.
4444 \numericenumerate
4445 \fi
4446 }
4447
4448 % An @enumerate whose labels are integers. The starting integer is
4449 % given in \thearg.
4450 %
4451 \def\numericenumerate{%
4452 \itemno = \thearg
4453 \startenumeration{\the\itemno}%
4454 }
4455
4456 % The starting (lowercase) letter is in \thearg.
4457 \def\lowercaseenumerate{%
4458 \itemno = \expandafter`\thearg
4459 \startenumeration{%
4460 % Be sure we're not beyond the end of the alphabet.
4461 \ifnum\itemno=0
4462 \errmessage{No more lowercase letters in @enumerate; get a bigger
4463 alphabet}%
4464 \fi
4465 \char\lccode\itemno
4466 }%
4467 }
4468
4469 % The starting (uppercase) letter is in \thearg.
4470 \def\uppercaseenumerate{%
4471 \itemno = \expandafter`\thearg
4472 \startenumeration{%
4473 % Be sure we're not beyond the end of the alphabet.
4474 \ifnum\itemno=0
4475 \errmessage{No more uppercase letters in @enumerate; get a bigger
4476 alphabet}
4477 \fi
4478 \char\uccode\itemno
4479 }%
4480 }
4481
4482 % Call \doitemize, adding a period to the first argument and supplying the
4483 % common last two arguments. Also subtract one from the initial value in
4484 % \itemno, since @item increments \itemno.
4485 %
4486 \def\startenumeration#1{%
4487 \advance\itemno by -1
4488 \doitemize{#1.}\flushcr
4489 }
4490
4491
4492 % @multitable macros
4493
4494 % Macros used to set up halign preamble:
4495 %
4496 \let\endsetuptable\relax
4497 \def\xendsetuptable{\endsetuptable}
4498 \let\columnfractions\relax
4499 \def\xcolumnfractions{\columnfractions}
4500 \newif\ifsetpercent
4501
4502 % #1 is the @columnfraction, usually a decimal number like .5, but might
4503 % be just 1. We just use it, whatever it is.
4504 %
4505 \def\pickupwholefraction#1 {%
4506 \global\advance\colcount by 1
4507 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4508 \setuptable
4509 }
4510
4511 \newcount\colcount
4512 \def\setuptable#1{%
4513 \def\firstarg{#1}%
4514 \ifx\firstarg\xendsetuptable
4515 \let\go = \relax
4516 \else
4517 \ifx\firstarg\xcolumnfractions
4518 \global\setpercenttrue
4519 \else
4520 \ifsetpercent
4521 \let\go\pickupwholefraction
4522 \else
4523 \global\advance\colcount by 1
4524 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4525 % separator; typically that is always in the input, anyway.
4526 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4527 \fi
4528 \fi
4529 \ifx\go\pickupwholefraction
4530 % Put the argument back for the \pickupwholefraction call, so
4531 % we'll always have a period there to be parsed.
4532 \def\go{\pickupwholefraction#1}%
4533 \else
4534 \let\go = \setuptable
4535 \fi%
4536 \fi
4537 \go
4538 }
4539
4540 % @headitem starts a heading row, which we typeset in bold. Assignments
4541 % have to be global since we are inside the implicit group of an
4542 % alignment entry. \everycr below resets \everytab so we don't have to
4543 % undo it ourselves.
4544 \def\headitemfont{\b}% for people to use in the template row; not changeable
4545 \def\headitem{%
4546 \crcr % must appear first
4547 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4548 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4549 \the\everytab % for the first item
4550 }%
4551 %
4552 % default for tables with no headings.
4553 \let\headitemcrhook=\relax
4554 %
4555 \def\tab{\checkenv\multitable &\the\everytab}%
4556
4557 \newtoks\everytab % insert after every tab.
4558 %
4559 \envdef\multitable{%
4560 \vskip\parskip
4561 \startsavinginserts
4562 %
4563 % @item within a multitable starts a normal row.
4564 % We use \def instead of \let so that if one of the multitable entries
4565 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4566 % \endtemplate) expanding \doitemize.
4567 \def\item{\crcr}%
4568 %
4569 \tolerance=9500
4570 \hbadness=9500
4571 \parskip=0pt
4572 \parindent=6pt
4573 \overfullrule=0pt
4574 \global\colcount=0
4575 %
4576 \everycr = {%
4577 \noalign{%
4578 \global\everytab={}% Reset from possible headitem.
4579 \global\colcount=0 % Reset the column counter.
4580 %
4581 % Check for saved footnotes, etc.:
4582 \checkinserts
4583 %
4584 % Perhaps a \nobreak, then reset:
4585 \headitemcrhook
4586 \global\let\headitemcrhook=\relax
4587 }%
4588 }%
4589 %
4590 \parsearg\domultitable
4591 }
4592 \def\domultitable#1{%
4593 % To parse everything between @multitable and @item:
4594 \setuptable#1 \endsetuptable
4595 %
4596 % This preamble sets up a generic column definition, which will
4597 % be used as many times as user calls for columns.
4598 % \vtop will set a single line and will also let text wrap and
4599 % continue for many paragraphs if desired.
4600 \halign\bgroup &%
4601 \global\advance\colcount by 1
4602 \strut
4603 \vtop{%
4604 \advance\hsize by -1\leftskip
4605 % Find the correct column width
4606 \hsize=\expandafter\csname col\the\colcount\endcsname
4607 %
4608 \advance\rightskip by -1\rightskip % Zero leaving only any stretch
4609 \ifnum\colcount=1
4610 \advance\hsize by\leftskip % Add indent of surrounding text
4611 \else
4612 % In order to keep entries from bumping into each other.
4613 \leftskip=12pt
4614 \ifsetpercent \else
4615 % If a template has been used
4616 \advance\hsize by \leftskip
4617 \fi
4618 \fi
4619 \noindent\ignorespaces##\unskip\strut
4620 }\cr
4621 }
4622 \def\Emultitable{%
4623 \crcr
4624 \egroup % end the \halign
4625 \global\setpercentfalse
4626 }
4627
4628
4629 \message{conditionals,}
4630
4631 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotlatex, @ifnotplaintext,
4632 % @ifnotxml always succeed. They currently do nothing; we don't
4633 % attempt to check whether the conditionals are properly nested. But we
4634 % have to remember that they are conditionals, so that @end doesn't
4635 % attempt to close an environment group.
4636 %
4637 \def\makecond#1{%
4638 \expandafter\let\csname #1\endcsname = \relax
4639 \expandafter\let\csname iscond.#1\endcsname = 1
4640 }
4641 \makecond{iftex}
4642 \makecond{ifnotdocbook}
4643 \makecond{ifnothtml}
4644 \makecond{ifnotinfo}
4645 \makecond{ifnotlatex}
4646 \makecond{ifnotplaintext}
4647 \makecond{ifnotxml}
4648
4649 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4650 %
4651 \def\direntry{\doignore{direntry}}
4652 \def\documentdescription{\doignore{documentdescription}}
4653 \def\docbook{\doignore{docbook}}
4654 \def\html{\doignore{html}}
4655 \def\ifdocbook{\doignore{ifdocbook}}
4656 \def\ifhtml{\doignore{ifhtml}}
4657 \def\ifinfo{\doignore{ifinfo}}
4658 \def\iflatex{\doignore{iflatex}}
4659 \def\ifnottex{\doignore{ifnottex}}
4660 \def\ifplaintext{\doignore{ifplaintext}}
4661 \def\ifxml{\doignore{ifxml}}
4662 \def\ignore{\doignore{ignore}}
4663 \def\latex{\doignore{latex}}
4664 \def\menu{\doignore{menu}}
4665 \def\xml{\doignore{xml}}
4666
4667 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4668 %
4669 % A count to remember the depth of nesting.
4670 \newcount\doignorecount
4671
4672 \def\doignore#1{\begingroup
4673 % Scan in ``verbatim'' mode:
4674 \obeylines
4675 \catcode`\@ = \other
4676 \catcode`\{ = \other
4677 \catcode`\} = \other
4678 %
4679 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4680 \spaceisspace
4681 %
4682 % Count number of #1's that we've seen.
4683 \doignorecount = 0
4684 %
4685 % Swallow text until we reach the matching `@end #1'.
4686 \dodoignore{#1}%
4687 }
4688
4689 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4690 \obeylines %
4691 %
4692 \gdef\dodoignore#1{%
4693 % #1 contains the command name as a string, e.g., `ifinfo'.
4694 %
4695 % Define a command to find the next `@end #1'.
4696 \long\def\doignoretext##1^^M@end #1{%
4697 \doignoretextyyy##1^^M@#1\_STOP_}%
4698 %
4699 % And this command to find another #1 command, at the beginning of a
4700 % line. (Otherwise, we would consider a line `@c @ifset', for
4701 % example, to count as an @ifset for nesting.)
4702 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4703 %
4704 % And now expand that command.
4705 \doignoretext ^^M%
4706 }%
4707 }
4708
4709 \def\doignoreyyy#1{%
4710 \def\temp{#1}%
4711 \ifx\temp\empty % Nothing found.
4712 \let\next\doignoretextzzz
4713 \else % Found a nested condition, ...
4714 \advance\doignorecount by 1
4715 \let\next\doignoretextyyy % ..., look for another.
4716 % If we're here, #1 ends with ^^M\ifinfo (for example).
4717 \fi
4718 \next #1% the token \_STOP_ is present just after this macro.
4719 }
4720
4721 % We have to swallow the remaining "\_STOP_".
4722 %
4723 \def\doignoretextzzz#1{%
4724 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4725 \let\next\enddoignore
4726 \else % Still inside a nested condition.
4727 \advance\doignorecount by -1
4728 \let\next\doignoretext % Look for the next @end.
4729 \fi
4730 \next
4731 }
4732
4733 % Finish off ignored text.
4734 { \obeylines%
4735 % Ignore anything after the last `@end #1'; this matters in verbatim
4736 % environments, where otherwise the newline after an ignored conditional
4737 % would result in a blank line in the output.
4738 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4739 }
4740
4741
4742 % @set VAR sets the variable VAR to an empty value.
4743 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4744 %
4745 % Since we want to separate VAR from REST-OF-LINE (which might be
4746 % empty), we can't just use \parsearg; we have to insert a space of our
4747 % own to delimit the rest of the line, and then take it out again if we
4748 % didn't need it.
4749 % We rely on the fact that \parsearg sets \catcode`\ =10.
4750 %
4751 \parseargdef\set{\setyyy#1 \endsetyyy}
4752 \def\setyyy#1 #2\endsetyyy{%
4753 {%
4754 \makevalueexpandable
4755 \def\temp{#2}%
4756 \edef\next{\gdef\makecsname{SET#1}}%
4757 \ifx\temp\empty
4758 \next{}%
4759 \else
4760 \setzzz#2\endsetzzz
4761 \fi
4762 }%
4763 }
4764 % Remove the trailing space \setxxx inserted.
4765 \def\setzzz#1 \endsetzzz{\next{#1}}
4766
4767 % @clear VAR clears (i.e., unsets) the variable VAR.
4768 %
4769 \parseargdef\clear{%
4770 {%
4771 \makevalueexpandable
4772 \global\expandafter\let\csname SET#1\endcsname=\relax
4773 }%
4774 }
4775
4776 % @value{foo} gets the text saved in variable foo.
4777 \def\value{\begingroup\makevalueexpandable\valuexxx}
4778 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4779 {
4780 \catcode`\-=\active \catcode`\_=\active
4781 %
4782 \gdef\makevalueexpandable{%
4783 \let\value = \expandablevalue
4784 % We don't want these characters active, ...
4785 \catcode`\-=\other \catcode`\_=\other
4786 % ..., but we might end up with active ones in the argument if
4787 % we're called from @code, as @code{@value{foo-bar_}}, though.
4788 % So \let them to their normal equivalents.
4789 \let-\normaldash \let_\normalunderscore
4790 }
4791 }
4792
4793 \def\expandablevalue#1{%
4794 \expandafter\ifx\csname SET#1\endcsname\relax
4795 {[No value for ``#1'']}%
4796 \message{Variable `#1', used in @value, is not set.}%
4797 \else
4798 \csname SET#1\endcsname
4799 \fi
4800 }
4801
4802 % Like \expandablevalue, but completely expandable (the \message in the
4803 % definition above operates at the execution level of TeX). Used when
4804 % writing to auxiliary files, due to the expansion that \write does.
4805 % If flag is undefined, pass through an unexpanded @value command: maybe it
4806 % will be set by the time it is read back in.
4807 %
4808 % NB flag names containing - or _ may not work here.
4809 \def\dummyvalue#1{%
4810 \expandafter\ifx\csname SET#1\endcsname\relax
4811 \string\value{#1}%
4812 \else
4813 \csname SET#1\endcsname
4814 \fi
4815 }
4816
4817 % Used for @value's in index entries to form the sort key: expand the @value
4818 % if possible, otherwise sort late.
4819 \def\indexnofontsvalue#1{%
4820 \expandafter\ifx\csname SET#1\endcsname\relax
4821 ZZZZZZZ%
4822 \else
4823 \csname SET#1\endcsname
4824 \fi
4825 }
4826
4827 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4828 % with @set.
4829 %
4830 % To get the special treatment we need for `@end ifset,' we call
4831 % \makecond and then redefine.
4832 %
4833 \makecond{ifset}
4834 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4835 \def\doifset#1#2{%
4836 {%
4837 \makevalueexpandable
4838 \let\next=\empty
4839 \expandafter\ifx\csname SET#2\endcsname\relax
4840 #1% If not set, redefine \next.
4841 \fi
4842 \expandafter
4843 }\next
4844 }
4845 \def\ifsetfail{\doignore{ifset}}
4846
4847 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4848 % defined with @set, or has been undefined with @clear.
4849 %
4850 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4851 % above code: if the variable is not set, do nothing, if it is set,
4852 % then redefine \next to \ifclearfail.
4853 %
4854 \makecond{ifclear}
4855 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4856 \def\ifclearfail{\doignore{ifclear}}
4857
4858 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4859 % without the @) is in fact defined. We can only feasibly check at the
4860 % TeX level, so something like `mathcode' is going to considered
4861 % defined even though it is not a Texinfo command.
4862 %
4863 \makecond{ifcommanddefined}
4864 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4865 %
4866 \def\doifcmddefined#1#2{{%
4867 \makevalueexpandable
4868 \let\next=\empty
4869 \expandafter\ifx\csname #2\endcsname\relax
4870 #1% If not defined, \let\next as above.
4871 \fi
4872 \expandafter
4873 }\next
4874 }
4875 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4876
4877 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4878 \makecond{ifcommandnotdefined}
4879 \def\ifcommandnotdefined{%
4880 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4881 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4882
4883 % Set the `txicommandconditionals' variable, so documents have a way to
4884 % test if the @ifcommand...defined conditionals are available.
4885 \set txicommandconditionals
4886
4887 % @dircategory CATEGORY -- specify a category of the dir file
4888 % which this file should belong to. Ignore this in TeX.
4889 \let\dircategory=\comment
4890
4891 % @defininfoenclose.
4892 \let\definfoenclose=\comment
4893
4894
4895 \message{indexing,}
4896 % Index generation facilities
4897
4898 % Define \newwrite to be identical to plain tex's \newwrite
4899 % except not \outer, so it can be used within macros and \if's.
4900 \edef\newwrite{\makecsname{ptexnewwrite}}
4901
4902 % \newindex {IX} defines an index named IX.
4903 % It automatically defines \IXindex such that
4904 % \IXindex ...rest of line... puts an entry in the index IX.
4905 % It also defines \IXindfile to be the number of the output channel for
4906 % the file that accumulates this index. The file's extension is IX.
4907 %
4908 \def\newindex#1{%
4909 \expandafter\chardef\csname#1indfile\endcsname=0
4910 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4911 \noexpand\doindex{#1}}
4912 }
4913
4914 % @defindex foo == \newindex{foo}
4915 %
4916 \def\defindex{\parsearg\newindex}
4917
4918 % Define @defcodeindex, like @defindex except put all entries in @code.
4919 %
4920 \def\defcodeindex{\parsearg\newcodeindex}
4921 %
4922 \def\newcodeindex#1{%
4923 \expandafter\chardef\csname#1indfile\endcsname=0
4924 \expandafter\xdef\csname#1index\endcsname{%
4925 \noexpand\docodeindex{#1}}%
4926 }
4927
4928 % The default indices:
4929 \newindex{cp}% concepts,
4930 \newcodeindex{fn}% functions,
4931 \newcodeindex{vr}% variables,
4932 \newcodeindex{tp}% types,
4933 \newcodeindex{ky}% keys
4934 \newcodeindex{pg}% and programs.
4935
4936
4937 % @synindex foo bar makes index foo feed into index bar.
4938 % Do this instead of @defindex foo if you don't want it as a separate index.
4939 %
4940 % @syncodeindex foo bar similar, but put all entries made for index foo
4941 % inside @code.
4942 %
4943 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4944 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4945
4946 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4947 % #3 the target index (bar).
4948 \def\dosynindex#1#2#3{%
4949 \requireopenindexfile{#3}%
4950 % redefine \fooindfile:
4951 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4952 \expandafter\let\csname#2indfile\endcsname=\temp
4953 % redefine \fooindex:
4954 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4955 }
4956
4957 % Define \doindex, the driver for all index macros.
4958 % Argument #1 is generated by the calling \fooindex macro,
4959 % and it is the two-letter name of the index.
4960
4961 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4962 \def\doindexxxx #1{\doind{\indexname}{#1}}
4963
4964 % like the previous two, but they put @code around the argument.
4965 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4966 \def\docodeindexxxx #1{\docind{\indexname}{#1}}
4967
4968
4969 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4970 % preventing its expansion. This is used only for control words,
4971 % not control letters, because the \space would be incorrect for
4972 % control characters, but is needed to separate the control word
4973 % from whatever follows.
4974 %
4975 % These can be used both for control words that take an argument and
4976 % those that do not. If it is followed by {arg} in the input, then
4977 % that will dutifully get written to the index (or wherever).
4978 %
4979 % For control letters, we have \definedummyletter, which omits the
4980 % space.
4981 %
4982 \def\definedummyword #1{\def#1{\string#1\space}}%
4983 \def\definedummyletter#1{\def#1{\string#1}}%
4984
4985 % Used for the aux, toc and index files to prevent expansion of Texinfo
4986 % commands. Most of the commands are controlled through the
4987 % \ifdummies conditional.
4988 %
4989 \def\atdummies{%
4990 \dummiestrue
4991 %
4992 \definedummyletter\@%
4993 \definedummyletter\ %
4994 \definedummyletter\{%
4995 \definedummyletter\}%
4996 \definedummyletter\&%
4997 %
4998 \definedummyletter\_%
4999 \definedummyletter\-%
5000 %
5001 \definedummyword\subentry
5002 %
5003 % We want to disable all macros so that they are not expanded by \write.
5004 \let\commondummyword\definedummyword
5005 \macrolist
5006 \let\value\dummyvalue
5007 %
5008 \turnoffactive
5009 }
5010
5011 \newif\ifdummies
5012 \newif\ifindexnofonts
5013
5014 \def\commondummyletter#1{%
5015 \expandafter\let\csname\string#1:impl\endcsname#1%
5016 \edef#1{%
5017 \noexpand\ifindexnofonts
5018 % empty expansion
5019 \noexpand\else
5020 \noexpand\ifdummies\string#1%
5021 \noexpand\else
5022 \noexpand\jumptwofi % dispose of the \fi
5023 \expandafter\noexpand\csname\string#1:impl\endcsname
5024 \noexpand\fi
5025 \noexpand\fi}%
5026 }
5027
5028 \def\commondummyaccent#1{%
5029 \expandafter\let\csname\string#1:impl\endcsname#1%
5030 \edef#1{%
5031 \noexpand\ifindexnofonts
5032 \noexpand\expandafter % dispose of \else ... \fi
5033 \noexpand\asis
5034 \noexpand\else
5035 \noexpand\ifdummies\string#1%
5036 \noexpand\else
5037 \noexpand\jumptwofi % dispose of the \fi
5038 \expandafter\noexpand\csname\string#1:impl\endcsname
5039 \noexpand\fi
5040 \noexpand\fi}%
5041 }
5042
5043 % Like \commondummyaccent but add a \space at the end of the dummy expansion
5044 % #2 is the expansion used for \indexnofonts. #2 is always followed by
5045 % \asis to remove a pair of following braces.
5046 \def\commondummyword#1#2{%
5047 \expandafter\let\csname\string#1:impl\endcsname#1%
5048 \expandafter\def\csname\string#1:ixnf\endcsname{#2\asis}%
5049 \edef#1{%
5050 \noexpand\ifindexnofonts
5051 \noexpand\expandafter % dispose of \else ... \fi
5052 \expandafter\noexpand\csname\string#1:ixnf\endcsname
5053 \noexpand\else
5054 \noexpand\ifdummies\string#1\space
5055 \noexpand\else
5056 \noexpand\jumptwofi % dispose of the \fi \fi
5057 \expandafter\noexpand\csname\string#1:impl\endcsname
5058 \noexpand\fi
5059 \noexpand\fi}%
5060 }
5061 \def\jumptwofi#1\fi\fi{\fi\fi#1}
5062
5063 % For \atdummies and \indexnofonts. \atdummies sets
5064 % \dummiestrue and \indexnofonts sets \indexnofontstrue.
5065 \def\definedummies{
5066 % @-sign is always an escape character when reading auxiliary files
5067 \escapechar = `\@
5068 %
5069 \commondummyletter\!%
5070 \commondummyaccent\"%
5071 \commondummyaccent\'%
5072 \commondummyletter\*%
5073 \commondummyaccent\,%
5074 \commondummyletter\.%
5075 \commondummyletter\/%
5076 \commondummyletter\:%
5077 \commondummyaccent\=%
5078 \commondummyletter\?%
5079 \commondummyaccent\^%
5080 \commondummyaccent\`%
5081 \commondummyaccent\~%
5082 %
5083 % Control letters and accents.
5084 \commondummyword\u {}%
5085 \commondummyword\v {}%
5086 \commondummyword\H {}%
5087 \commondummyword\dotaccent {}%
5088 \commondummyword\ogonek {}%
5089 \commondummyword\ringaccent {}%
5090 \commondummyword\tieaccent {}%
5091 \commondummyword\ubaraccent {}%
5092 \commondummyword\udotaccent {}%
5093 \commondummyword\dotless {}%
5094 %
5095 % Texinfo font commands.
5096 \commondummyword\b {}%
5097 \commondummyword\i {}%
5098 \commondummyword\r {}%
5099 \commondummyword\sansserif {}%
5100 \commondummyword\sc {}%
5101 \commondummyword\slanted {}%
5102 \commondummyword\t {}%
5103 %
5104 % Commands that take arguments.
5105 \commondummyword\abbr {}%
5106 \commondummyword\acronym {}%
5107 \commondummyword\anchor {}%
5108 \commondummyword\cite {}%
5109 \commondummyword\code {}%
5110 \commondummyword\command {}%
5111 \commondummyword\dfn {}%
5112 \commondummyword\dmn {}%
5113 \commondummyword\email {}%
5114 \commondummyword\emph {}%
5115 \commondummyword\env {}%
5116 \commondummyword\file {}%
5117 \commondummyword\image {}%
5118 \commondummyword\indicateurl{}%
5119 \commondummyword\inforef {}%
5120 \commondummyword\kbd {}%
5121 \commondummyword\key {}%
5122 \commondummyword\link {}%
5123 \commondummyword\math {}%
5124 \commondummyword\option {}%
5125 \commondummyword\pxref {}%
5126 \commondummyword\ref {}%
5127 \commondummyword\samp {}%
5128 \commondummyword\strong {}%
5129 \commondummyword\tie {}%
5130 \commondummyword\U {}%
5131 \commondummyword\uref {}%
5132 \commondummyword\url {}%
5133 \commondummyword\var {}%
5134 \commondummyword\verb {}%
5135 \commondummyword\w {}%
5136 \commondummyword\xref {}%
5137 %
5138 \commondummyword\AA {AA}%
5139 \commondummyword\AE {AE}%
5140 \commondummyword\DH {DZZ}%
5141 \commondummyword\L {L}%
5142 \commondummyword\O {O}%
5143 \commondummyword\OE {OE}%
5144 \commondummyword\TH {TH}%
5145 \commondummyword\aa {aa}%
5146 \commondummyword\ae {ae}%
5147 \commondummyword\dh {dzz}%
5148 \commondummyword\exclamdown {!}%
5149 \commondummyword\l {l}%
5150 \commondummyword\o {o}%
5151 \commondummyword\oe {oe}%
5152 \commondummyword\ordf {a}%
5153 \commondummyword\ordm {o}%
5154 \commondummyword\questiondown {?}%
5155 \commondummyword\ss {ss}%
5156 \commondummyword\th {th}%
5157 %
5158 \commondummyword\LaTeX {LaTeX}%
5159 \commondummyword\TeX {TeX}%
5160 %
5161 % Assorted special characters.
5162 \commondummyword\ampchar {\normalamp}%
5163 \commondummyword\atchar {\@}%
5164 \commondummyword\arrow {->}%
5165 \commondummyword\backslashchar {\realbackslash}%
5166 \commondummyword\bullet {bullet}%
5167 \commondummyword\comma {,}%
5168 \commondummyword\copyright {copyright}%
5169 \commondummyword\dots {...}%
5170 \commondummyword\enddots {...}%
5171 \commondummyword\entrybreak {}%
5172 \commondummyword\equiv {===}%
5173 \commondummyword\error {error}%
5174 \commondummyword\euro {euro}%
5175 \commondummyword\expansion {==>}%
5176 \commondummyword\geq {>=}%
5177 \commondummyword\guillemetleft {<<}%
5178 \commondummyword\guillemetright {>>}%
5179 \commondummyword\guilsinglleft {<}%
5180 \commondummyword\guilsinglright {>}%
5181 \commondummyword\lbracechar {\{}%
5182 \commondummyword\leq {<=}%
5183 \commondummyword\mathopsup {sup}%
5184 \commondummyword\minus {-}%
5185 \commondummyword\pounds {pounds}%
5186 \commondummyword\point {.}%
5187 \commondummyword\print {-|}%
5188 \commondummyword\quotedblbase {"}%
5189 \commondummyword\quotedblleft {"}%
5190 \commondummyword\quotedblright {"}%
5191 \commondummyword\quoteleft {`}%
5192 \commondummyword\quoteright {'}%
5193 \commondummyword\quotesinglbase {,}%
5194 \commondummyword\rbracechar {\}}%
5195 \commondummyword\registeredsymbol {R}%
5196 \commondummyword\result {=>}%
5197 \commondummyword\sub {}%
5198 \commondummyword\sup {}%
5199 \commondummyword\textdegree {o}%
5200 }
5201
5202 \let\indexlbrace\relax
5203 \let\indexrbrace\relax
5204 \let\indexatchar\relax
5205 \let\indexbackslash\relax
5206
5207 {\catcode`\@=0
5208 \catcode`\\=13
5209 @gdef@backslashdisappear{@def\{}}
5210 }
5211
5212 {
5213 \catcode`\<=13
5214 \catcode`\-=13
5215 \catcode`\`=13
5216 \gdef\indexnonalnumdisappear{%
5217 \ifflagclear{txiindexlquoteignore}{}{%
5218 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5219 % (Introduced for FSFS 2nd ed.)
5220 \let`=\empty
5221 }%
5222 %
5223 \ifflagclear{txiindexbackslashignore}{}{%
5224 \backslashdisappear
5225 }%
5226 \ifflagclear{txiindexhyphenignore}{}{%
5227 \def-{}%
5228 }%
5229 \ifflagclear{txiindexlessthanignore}{}{%
5230 \def<{}%
5231 }%
5232 \ifflagclear{txiindexatsignignore}{}{%
5233 \def\@{}%
5234 }%
5235 }
5236
5237 \gdef\indexnonalnumreappear{%
5238 \let-\normaldash
5239 \let<\normalless
5240 }
5241 }
5242
5243
5244 % \indexnofonts is used when outputting the strings to sort the index
5245 % by, and when constructing control sequence names. It eliminates all
5246 % control sequences and just writes whatever the best ASCII sort string
5247 % would be for a given command (usually its argument).
5248 %
5249 \def\indexnofonts{%
5250 \indexnofontstrue
5251 %
5252 \def\ { }%
5253 \def\@{@}%
5254 \def\_{\normalunderscore}%
5255 \def\-{}% @- shouldn't affect sorting
5256 %
5257 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5258 \uccode`\1=`\} \uppercase{\def\}{1}}%
5259 \def\lbracechar##1{\{}%
5260 \def\rbracechar##1{\}}%
5261 %
5262 %
5263 % We need to get rid of all macros, leaving only the arguments (if present).
5264 % Of course this is not nearly correct, but it is the best we can do for now.
5265 %
5266 % Since macro invocations are followed by braces, we can just redefine them
5267 % to take a single TeX argument. The case of a macro invocation that
5268 % goes to end-of-line is not handled.
5269 %
5270 \def\commondummyword##1{\let##1\asis}%
5271 \macrolist
5272 \let\value\indexnofontsvalue
5273 }
5274
5275
5276
5277
5278 % #1 is the index name, #2 is the entry text.
5279 \def\doind#1#2{%
5280 \iflinks
5281 {%
5282 %
5283 \requireopenindexfile{#1}%
5284 \edef\writeto{\csname#1indfile\endcsname}%
5285 %
5286 \def\indextext{#2}%
5287 \safewhatsit\doindwrite
5288 }%
5289 \fi
5290 }
5291
5292 % Same as \doind, but for code indices
5293 \def\docind#1#2{%
5294 \iflinks
5295 {%
5296 %
5297 \requireopenindexfile{#1}%
5298 \edef\writeto{\csname#1indfile\endcsname}%
5299 %
5300 \def\indextext{#2}%
5301 \safewhatsit\docindwrite
5302 }%
5303 \fi
5304 }
5305
5306 % Check if an index file has been opened, and if not, open it.
5307 \def\requireopenindexfile#1{%
5308 \ifnum\csname #1indfile\endcsname=0
5309 \expandafter\newwrite \csname#1indfile\endcsname
5310 \edef\suffix{#1}%
5311 % A .fls suffix would conflict with the file extension for the output
5312 % of -recorder, so use .f1s instead.
5313 \ifx\suffix\indexisfl\def\suffix{f1}\fi
5314 % Open the file
5315 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5316 % Using \immediate above here prevents an object entering into the current
5317 % box, which could confound checks such as those in \safewhatsit for
5318 % preceding skips.
5319 \typeout{Writing index file \jobname.\suffix}%
5320 \fi}
5321 \def\indexisfl{fl}
5322
5323 % Definition for writing index entry sort key.
5324 {
5325 \catcode`\-=13
5326 \gdef\indexwritesortas{%
5327 \begingroup
5328 \indexnonalnumreappear
5329 \indexwritesortasxxx}
5330 \gdef\indexwritesortasxxx#1{%
5331 \xdef\indexsortkey{#1}\endgroup}
5332 }
5333
5334 \def\indexwriteseealso#1{
5335 \gdef\pagenumbertext{\string\seealso{#1}}%
5336 }
5337 \def\indexwriteseeentry#1{
5338 \gdef\pagenumbertext{\string\seeentry{#1}}%
5339 }
5340
5341 % The default definitions
5342 \def\sortas#1{}%
5343 \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
5344 \def\putwordSeeAlso{See also}
5345 \def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
5346
5347
5348 % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
5349 % * Set \bracedtext to "{aaa}{bbb}"
5350 % * Set \fullindexsortkey to "aaa @subentry ZZZ"
5351 % * If @seealso occurs, set \pagenumbertext
5352 %
5353 \def\splitindexentry#1{%
5354 \gdef\fullindexsortkey{}%
5355 \xdef\bracedtext{}%
5356 \def\sep{}%
5357 \def\seealso##1{}%
5358 \def\seeentry##1{}%
5359 \expandafter\doindexsegment#1\subentry\finish\subentry
5360 }
5361
5362 % append the results from the next segment
5363 \def\doindexsegment#1\subentry{%
5364 \def\segment{#1}%
5365 \ifx\segment\isfinish
5366 \else
5367 %
5368 % Fully expand the segment, throwing away any @sortas directives, and
5369 % trim spaces.
5370 \edef\trimmed{\segment}%
5371 \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5372 \ifincodeindex
5373 \edef\trimmed{\noexpand\code{\trimmed}}%
5374 \fi
5375 %
5376 \xdef\bracedtext{\bracedtext{\trimmed}}%
5377 %
5378 % Get the string to sort by. Process the segment with all
5379 % font commands turned off.
5380 \bgroup
5381 \let\sortas\indexwritesortas
5382 \let\seealso\indexwriteseealso
5383 \let\seeentry\indexwriteseeentry
5384 \indexnofonts
5385 % The braces around the commands are recognized by texindex.
5386 \def\lbracechar{{\string\indexlbrace}}%
5387 \def\rbracechar{{\string\indexrbrace}}%
5388 \let\{=\lbracechar
5389 \let\}=\rbracechar
5390 \def\@{{\string\indexatchar}}%
5391 \def\atchar##1{\@}%
5392 \def\backslashchar{{\string\indexbackslash}}%
5393 \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
5394 %
5395 \let\indexsortkey\empty
5396 \global\let\pagenumbertext\empty
5397 % Execute the segment and throw away the typeset output. This executes
5398 % any @sortas or @seealso commands in this segment.
5399 \setbox\dummybox = \hbox{\segment}%
5400 \ifx\indexsortkey\empty{%
5401 \indexnonalnumdisappear
5402 \xdef\trimmed{\segment}%
5403 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5404 \xdef\indexsortkey{\trimmed}%
5405 \ifx\indexsortkey\empty
5406 \message{Empty index sort key near line \the\inputlineno}%
5407 \xdef\indexsortkey{ }%
5408 \fi
5409 }\fi
5410 %
5411 % Append to \fullindexsortkey.
5412 \edef\tmp{\gdef\noexpand\fullindexsortkey{%
5413 \fullindexsortkey\sep\indexsortkey}}%
5414 \tmp
5415 \egroup
5416 \def\sep{\subentry}%
5417 %
5418 \expandafter\doindexsegment
5419 \fi
5420 }
5421 \def\isfinish{\finish}%
5422 \newbox\dummybox % used above
5423
5424 \let\subentry\relax
5425
5426 % Use \ instead of @ in index files. To support old texi2dvi and texindex.
5427 % This works without changing the escape character used in the toc or aux
5428 % files because the index entries are fully expanded here, and \string uses
5429 % the current value of \escapechar.
5430 \def\escapeisbackslash{\escapechar=`\\}
5431
5432 % Uncomment to use \ in index files by default. Old texi2dvi (before 2019)
5433 % didn't support @ as the escape character (as it checked for "\entry" in
5434 % the files, and not "@entry").
5435 % In the future we can remove this flag and simplify the code for
5436 % index files and backslashes, once the support is no longer likely to be
5437 % useful.
5438 %
5439 % \set txiindexescapeisbackslash
5440
5441 % Write the entry in \indextext to the index file.
5442 %
5443
5444 \newif\ifincodeindex
5445 \def\doindwrite{\incodeindexfalse\doindwritex}
5446 \def\docindwrite{\incodeindextrue\doindwritex}
5447
5448 \def\doindwritex{%
5449 \maybemarginindex
5450 %
5451 \atdummies
5452 %
5453 \ifflagclear{txiindexescapeisbackslash}{}{\escapeisbackslash}%
5454 %
5455 % For texindex which always views { and } as separators.
5456 \def\{{\lbracechar{}}%
5457 \def\}{\rbracechar{}}%
5458 \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
5459 %
5460 % Split the entry into primary entry and any subentries, and get the index
5461 % sort key.
5462 \splitindexentry\indextext
5463 %
5464 % Set up the complete index entry, with both the sort key and
5465 % the original text, including any font commands. We write
5466 % three arguments to \entry to the .?? file (four in the
5467 % subentry case), texindex reduces to two when writing the .??s
5468 % sorted result.
5469 %
5470 \edef\temp{%
5471 \write\writeto{%
5472 \string\entry{\fullindexsortkey}%
5473 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
5474 \bracedtext}%
5475 }%
5476 \temp
5477 }
5478
5479 % Put the index entry in the margin if desired (undocumented).
5480 \def\maybemarginindex{%
5481 \ifx\SETmarginindex\relax\else
5482 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
5483 \fi
5484 }
5485 \let\SETmarginindex=\relax
5486
5487
5488 % Take care of unwanted page breaks/skips around a whatsit:
5489 %
5490 % If a skip is the last thing on the list now, preserve it
5491 % by backing up by \lastskip, doing the \write, then inserting
5492 % the skip again. Otherwise, the whatsit generated by the
5493 % \write or \pdfdest will make \lastskip zero. The result is that
5494 % sequences like this:
5495 % @end defun
5496 % @tindex whatever
5497 % @defun ...
5498 % will have extra space inserted, because the \medbreak in the
5499 % start of the @defun won't see the skip inserted by the @end of
5500 % the previous defun.
5501 %
5502 % But don't do any of this if we're not in vertical mode. We
5503 % don't want to do a \vskip and prematurely end a paragraph.
5504 %
5505 % Avoid page breaks due to these extra skips, too.
5506 %
5507 % But wait, there is a catch there:
5508 % We'll have to check whether \lastskip is zero skip. \ifdim is not
5509 % sufficient for this purpose, as it ignores stretch and shrink parts
5510 % of the skip. The only way seems to be to check the textual
5511 % representation of the skip.
5512 %
5513 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5514 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5515 %
5516 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5517 %
5518 \newskip\whatsitskip
5519 \newcount\whatsitpenalty
5520 %
5521 % ..., ready, GO:
5522 %
5523 \def\safewhatsit#1{\ifhmode
5524 #1%
5525 \else
5526 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5527 \whatsitskip = \lastskip
5528 \edef\lastskipmacro{\the\lastskip}%
5529 \whatsitpenalty = \lastpenalty
5530 %
5531 % If \lastskip is nonzero, that means the last item was a
5532 % skip. And since a skip is discardable, that means this
5533 % -\whatsitskip glue we're inserting is preceded by a
5534 % non-discardable item, therefore it is not a potential
5535 % breakpoint, therefore no \nobreak needed.
5536 \ifx\lastskipmacro\zeroskipmacro
5537 \else
5538 \vskip-\whatsitskip
5539 \fi
5540 %
5541 #1%
5542 %
5543 \ifx\lastskipmacro\zeroskipmacro
5544 % If \lastskip was zero, perhaps the last item was a penalty, and
5545 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5546 % to re-insert the same penalty (values >10000 are used for various
5547 % signals); since we just inserted a non-discardable item, any
5548 % following glue (such as a \parskip) would be a breakpoint. For example:
5549 % @deffn deffn-whatever
5550 % @vindex index-whatever
5551 % Description.
5552 % would allow a break between the index-whatever whatsit
5553 % and the "Description." paragraph.
5554 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5555 \else
5556 % On the other hand, if we had a nonzero \lastskip,
5557 % this make-up glue would be preceded by a non-discardable item
5558 % (the whatsit from the \write), so we must insert a \nobreak.
5559 \nobreak\vskip\whatsitskip
5560 \fi
5561 \fi}
5562
5563 % The index entry written in the file actually looks like
5564 % \entry {sortstring}{page}{topic}
5565 % or
5566 % \entry {sortstring}{page}{topic}{subtopic}
5567 % The texindex program reads in these files and writes files
5568 % containing these kinds of lines:
5569 % \initial {c}
5570 % before the first topic whose initial is c
5571 % \entry {topic}{pagelist}
5572 % for a topic that is used without subtopics
5573 % \primary {topic}
5574 % \entry {topic}{}
5575 % for the beginning of a topic that is used with subtopics
5576 % \secondary {subtopic}{pagelist}
5577 % for each subtopic.
5578 % \secondary {subtopic}{}
5579 % for a subtopic with sub-subtopics
5580 % \tertiary {subtopic}{subsubtopic}{pagelist}
5581 % for each sub-subtopic.
5582
5583 % Define the user-accessible indexing commands
5584 % @findex, @vindex, @kindex, @cindex.
5585
5586 \def\findex {\fnindex}
5587 \def\kindex {\kyindex}
5588 \def\cindex {\cpindex}
5589 \def\vindex {\vrindex}
5590 \def\tindex {\tpindex}
5591 \def\pindex {\pgindex}
5592
5593 % Define the macros used in formatting output of the sorted index material.
5594
5595 % @printindex causes a particular index (the ??s file) to get printed.
5596 % It does not print any chapter heading (usually an @unnumbered).
5597 %
5598 \parseargdef\printindex{\begingroup
5599 \dobreak \chapheadingskip{10000}%
5600 %
5601 \smallfonts \rm
5602 \tolerance = 9500
5603 \plainfrenchspacing
5604 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5605 \let\entry\indexentry
5606 \ifxetex\xetexpreauxfile\fi
5607 %
5608 % See comment in \requireopenindexfile.
5609 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5610 %
5611 % See if the index file exists and is nonempty.
5612 \openin 1 \jobname.\indexname s
5613 \ifeof 1
5614 % \enddoublecolumns gets confused if there is no text in the index,
5615 % and it loses the chapter title and the aux file entries for the
5616 % index. The easiest way to prevent this problem is to make sure
5617 % there is some text.
5618 \putwordIndexNonexistent
5619 \typeout{No file \jobname.\indexname s.}%
5620 \else
5621 % If the index file exists but is empty, then \openin leaves \ifeof
5622 % false. We have to make TeX try to read something from the file, so
5623 % it can discover if there is anything in it.
5624 \read 1 to \thisline
5625 \ifeof 1
5626 \putwordIndexIsEmpty
5627 \else
5628 \expandafter\printindexzz\thisline\relax\relax\finish%
5629 \fi
5630 \fi
5631 \closein 1
5632 \ifxetex\xetexpostauxfile\fi
5633 \endgroup}
5634
5635 % Checked in @bye
5636 \let\byeerror\relax
5637
5638 % If the index file starts with a backslash, forgo reading the index
5639 % file altogether. If somebody upgrades texinfo.tex they may still have
5640 % old index files using \ as the escape character. Reading this would
5641 % at best lead to typesetting garbage, at worst a TeX syntax error.
5642 \def\printindexzz#1#2\finish{%
5643 \ifflagclear{txiindexescapeisbackslash}{%
5644 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
5645 \ifflagclear{txiskipindexfileswithbackslash}{%
5646 % Delay the error message until the very end to give a chance
5647 % for the whole index to be output as input for texindex.
5648 \global\def\byeerror{%
5649 ERROR: A sorted index file in an obsolete format was skipped.
5650 To fix this problem, please upgrade your version of 'texi2dvi'
5651 or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
5652 If you are using an old version of 'texindex' (part of the Texinfo
5653 distribution), you may also need to upgrade to a newer version (at least 6.0).
5654 You may be able to typeset the index if you run
5655 'texindex \jobname.\indexname' yourself.
5656 You could also try setting the 'txiindexescapeisbackslash' flag by
5657 running a command like
5658 'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do
5659 this, Texinfo will try to use index files in the old format.
5660 If you continue to have problems, deleting the index files and starting again
5661 might help (with 'rm \jobname.?? \jobname.??s')%
5662 }%
5663 }{%
5664 (Skipped sorted index file in obsolete format)
5665 }%
5666 \else
5667 \begindoublecolumns
5668 \ifxetex\xetexpreauxfile\fi
5669 \input \jobname.\indexname s
5670 \ifxetex\xetexpostauxfile\fi
5671 \enddoublecolumns
5672 \fi
5673 }{%
5674 \begindoublecolumns
5675 \catcode`\\=0\relax
5676 %
5677 % Make @ an escape character to give macros a chance to work. This
5678 % should work because we (hopefully) don't otherwise use @ in index files.
5679 %\catcode`\@=12\relax
5680 \catcode`\@=0\relax
5681 \ifxetex\xetexpreauxfile\fi
5682 \input \jobname.\indexname s
5683 \ifxetex\xetexpostauxfile\fi
5684 \enddoublecolumns
5685 }%
5686 }
5687
5688 \def\indexentry#1#2{%
5689 \let\entrypagetarget\empty
5690 \ifflagclear{txilinkindextext}{}{%
5691 \ifpdforxetex
5692 % link the index text to the page if no comma appears in the
5693 % list of pages, i.e. there is only one page
5694 \checkpagelistcomma{#2}\pagelistcomma
5695 \expandafter\ifcase\pagelistcomma
5696 \def\entrypagetarget{#2}%
5697 \fi
5698 \fi%
5699 }%
5700 \entryinternal{#1}{#2}%
5701 }
5702
5703 \def\checkpagelistcomma#1#2{%
5704 \checkpagelistcommaxx#2#1,\finish
5705 }
5706 \def\checkpagelistcommaxx#1#2,#3\finish{%
5707 \def\tmp{#3}%
5708 \ifx\tmp\empty
5709 \def#1{0\relax}
5710 \else
5711 \def#1{1\relax}
5712 \fi
5713 }
5714
5715
5716 % These macros are used by the sorted index file itself.
5717 % Change them to control the appearance of the index.
5718
5719 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5720 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5721 \catcode`\$=3
5722 \gdef\initialglyphs{%
5723 % special control sequences used in the index sort key
5724 \let\indexlbrace\{%
5725 \let\indexrbrace\}%
5726 \let\indexatchar\@%
5727 \def\indexbackslash{\math{\backslash}}%
5728 %
5729 % Some changes for non-alphabetic characters. Using the glyphs from the
5730 % math fonts looks more consistent than the typewriter font used elsewhere
5731 % for these characters.
5732 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
5733 %
5734 % In case @\ is used for backslash
5735 \uppercase{\let\\=~}
5736 % Can't get bold backslash so don't use bold forward slash
5737 \catcode`\/=13
5738 \def/{{\secrmnotbold \normalslash}}%
5739 \def-{{\normaldash\normaldash}}% en dash `--'
5740 \def^{{\chapbf \normalcaret}}%
5741 \def~{{\chapbf \normaltilde}}%
5742 \def\_{%
5743 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5744 \def|{$\vert$}%
5745 \def<{$\less$}%
5746 \def>{$\gtr$}%
5747 \def+{$\normalplus$}%
5748 }}
5749
5750 \def\initial{%
5751 \bgroup
5752 \initialx
5753 }
5754
5755 \def\initialx#1{%
5756 % Remove any glue we may have, we'll be inserting our own.
5757 \removelastskip
5758 %
5759 % We like breaks before the index initials, so insert a bonus.
5760 % The glue before the bonus allows a little bit of space at the
5761 % bottom of a column to reduce an increase in inter-line spacing.
5762 \nobreak
5763 \vskip 0pt plus 5\baselineskip
5764 \penalty -300
5765 \vskip 0pt plus -5\baselineskip
5766 %
5767 % Typeset the initial. Making this add up to a whole number of
5768 % baselineskips increases the chance of the dots lining up from column
5769 % to column. It still won't often be perfect, because of the stretch
5770 % we need before each entry, but it's better.
5771 %
5772 % No shrink because it confuses \balancecolumns.
5773 \vskip 1.67\baselineskip plus 1\baselineskip
5774 \doindexinitialentry{#1}%
5775 \initialglyphs
5776 \leftline{%
5777 \secfonts \kern-0.05em \secbf #1}%
5778 % \secfonts is inside the argument of \leftline so that the change of
5779 % \baselineskip will not affect any glue inserted before the vbox that
5780 % \leftline creates.
5781 % Do our best not to break after the initial.
5782 \nobreak
5783 \vskip .33\baselineskip plus .1\baselineskip
5784 \egroup % \initialglyphs
5785 }
5786
5787 \def\doindexinitialentry#1{%
5788 \ifpdforxetex
5789 \global\advance\idxinitialno by 1
5790 \def\indexlbrace{\{}%
5791 \def\indexrbrace{\}}%
5792 \def\indexbackslash{\realbackslash}%
5793 \def\indexatchar{\@}%
5794 \writetocentry{idxinitial}{\asis #1\empty}{IDX\the\idxinitialno}%
5795 % The @asis removes a pair of braces around e.g. {@indexatchar} that
5796 % are output by texindex. \empty is an argument to \asis in case #1
5797 % is empty.
5798 %
5799 \pdfmkdest{idx.\asis #1.IDX\the\idxinitialno}%
5800 \fi
5801 }
5802
5803 % No listing in TOC
5804 \def\idxinitialentry#1#2#3#4{}
5805
5806 % For index initials.
5807 \newcount\idxinitialno \idxinitialno=1
5808
5809
5810 \newdimen\entryrightmargin
5811 \entryrightmargin=0pt
5812
5813 % amount to indent subsequent lines in an entry when it spans more than
5814 % one line.
5815 \newdimen\entrycontskip
5816 \entrycontskip=1em
5817
5818 % for PDF output, whether to make the text of the entry a link to the section.
5819 % set for @contents and @shortcontents.
5820 \newif\iflinkentrytext
5821
5822 % \entryinternal typesets a paragraph consisting of the text (#1), dot
5823 % leaders, and then page number (#2) flushed to the right margin. It is
5824 % used for index and table of contents entries. The paragraph is indented
5825 % by \leftskip.
5826 % For PDF output, if \linkentrytexttrue and \tocnodetarget is set, link text
5827 % to the referenced node. Else if \entrypagetarget is set, link text to the
5828 % page.
5829 \def\entryinternal{%
5830 \begingroup
5831 %
5832 % Start a new paragraph if necessary, so our assignments below can't
5833 % affect previous text.
5834 \par
5835 %
5836 % No extra space above this paragraph.
5837 \parskip = 0in
5838 %
5839 \def\entrybreak{\hfil\break}% An undocumented command
5840 %
5841 % Swallow the left brace of the text (first parameter):
5842 \afterassignment\doentry
5843 \let\temp =
5844 }
5845 \def\entrybreak{\unskip\space\ignorespaces}%
5846 \def\doentry{%
5847 % Save the text of the entry in \boxA
5848 \global\setbox\boxA=\hbox\bgroup
5849 \bgroup % Instead of the swallowed brace.
5850 \noindent
5851 \aftergroup\finishentry
5852 % And now comes the text of the entry.
5853 % Not absorbing as a macro argument reduces the chance of problems
5854 % with catcodes occurring.
5855 }
5856 {\catcode`\@=11
5857 % #1 is the page number
5858 \gdef\finishentry#1{%
5859 \egroup % end \boxA
5860 \dimen@ = \wd\boxA % Length of text of entry
5861 % add any leaders and page number to \boxA.
5862 \global\setbox\boxA=\hbox\bgroup
5863 \ifpdforxetex
5864 \iflinkentrytext
5865 \ifx\tocnodetarget\empty
5866 \unhbox\boxA
5867 \else
5868 \startxreflink{\tocnodetarget}{}%
5869 \unhbox\boxA
5870 \endlink
5871 \fi
5872 \else
5873 \ifx\entrypagetarget\empty
5874 \unhbox\boxA
5875 \else
5876 \pdflinkpage{\entrypagetarget}{\unhbox\boxA}%
5877 \fi
5878 \fi
5879 \else
5880 \unhbox\boxA
5881 \fi
5882 %
5883 % Get the width of the page numbers, and only use
5884 % leaders if they are present.
5885 \global\setbox\boxB = \hbox{#1}%
5886 \ifdim\wd\boxB = 0pt
5887 \null\nobreak\hfill\ %
5888 \else
5889 %
5890 \null\nobreak\indexdotfill % Have leaders before the page number.
5891 %
5892 \hskip\skip\thinshrinkable
5893 \ifpdforxetex
5894 \ifx\tocnodetarget\empty
5895 \pdfgettoks#1.%
5896 \the\toksA
5897 \else
5898 % Should just be a single page number in toc
5899 \startxreflink{\tocnodetarget}{}%
5900 #1\endlink
5901 \fi
5902 \else
5903 #1%
5904 \fi
5905 \fi
5906 \egroup % end \boxA
5907 %
5908 % now output
5909 \ifdim\wd\boxB = 0pt
5910 \noindent\unhbox\boxA\par
5911 \nobreak
5912 \else\bgroup
5913 % We want the text of the entries to be aligned to the left, and the
5914 % page numbers to be aligned to the right.
5915 %
5916 \parindent = 0pt
5917 \advance\leftskip by 0pt plus 1fil
5918 \advance\leftskip by 0pt plus -1fill
5919 \rightskip = 0pt plus -1fil
5920 \advance\rightskip by 0pt plus 1fill
5921 % Cause last line, which could consist of page numbers on their own
5922 % if the list of page numbers is long, to be aligned to the right.
5923 \parfillskip=0pt plus -1fill
5924 %
5925 \advance\rightskip by \entryrightmargin
5926 %
5927 \dimen@ii = \hsize
5928 \advance\dimen@ii by -1\leftskip
5929 \advance\dimen@ii by -1\entryrightmargin
5930 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5931 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5932 \advance\leftskip by 0pt plus 1fill % ragged right
5933 %
5934 % Indent all lines but the first one.
5935 \advance\leftskip by \entrycontskip
5936 \advance\parindent by -\entrycontskip
5937 \fi\fi
5938 \indent % start paragraph
5939 \unhbox\boxA
5940 %
5941 % Do not prefer a separate line ending with a hyphen to fewer lines.
5942 \finalhyphendemerits = 0
5943 %
5944 % Word spacing - no stretch
5945 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5946 %
5947 \linepenalty=1000 % Discourage line breaks.
5948 \hyphenpenalty=5000 % Discourage hyphenation.
5949 %
5950 \par % format the paragraph
5951 \egroup % The \vbox
5952 \fi
5953 \endgroup
5954 }}
5955
5956 \newskip\thinshrinkable
5957 \skip\thinshrinkable=.15em minus .15em
5958
5959 % Like plain.tex's \dotfill, except uses up at least 0.5 em.
5960 % The filll stretch here overpowers both the fil and fill stretch to push
5961 % the page number to the right.
5962 \def\indexdotfill{\cleaders
5963 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 0.5em plus 1filll}
5964
5965 \def\primary #1{\line{#1\hfil}}
5966
5967 \def\secondary{\indententry{0.5cm}}
5968 \def\tertiary{\indententry{1cm}}
5969
5970 \def\indententry#1#2#3{%
5971 \bgroup
5972 \leftskip=#1
5973 \entry{#2}{#3}%
5974 \egroup
5975 }
5976
5977 % Define two-column mode, which we use to typeset indexes.
5978 % Adapted from the TeXbook, page 416, which is to say,
5979 % the manmac.tex format used to print the TeXbook itself.
5980 \catcode`\@=11 % private names
5981
5982 \newbox\partialpage
5983 \newdimen\doublecolumnhsize
5984
5985 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5986 % If not much space left on page, start a new page.
5987 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5988 %
5989 % Grab any single-column material above us.
5990 \output = {%
5991 \savetopmark
5992 %
5993 \global\setbox\partialpage = \vbox{%
5994 % Unvbox the main output page.
5995 \unvbox\PAGE
5996 \kern-\topskip \kern\baselineskip
5997 }%
5998 }%
5999 \eject % run that output routine to set \partialpage
6000 %
6001 % Use the double-column output routine for subsequent pages.
6002 \output = {\doublecolumnout}%
6003 %
6004 % Change the page size parameters. We could do this once outside this
6005 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
6006 % format, but then we repeat the same computation. Repeating a couple
6007 % of assignments once per index is clearly meaningless for the
6008 % execution time, so we may as well do it in one place.
6009 %
6010 % First we halve the line length, less a little for the gutter between
6011 % the columns. We compute the gutter based on the line length, so it
6012 % changes automatically with the paper format. The magic constant
6013 % below is chosen so that the gutter has the same value (well, +-<1pt)
6014 % as it did when we hard-coded it.
6015 %
6016 % We put the result in a separate register, \doublecolumnhsize, so we
6017 % can restore it in \pagesofar, after \hsize itself has (potentially)
6018 % been clobbered.
6019 %
6020 \doublecolumnhsize = \hsize
6021 \advance\doublecolumnhsize by -.04154\hsize
6022 \divide\doublecolumnhsize by 2
6023 \hsize = \doublecolumnhsize
6024 %
6025 % Get the available space for the double columns -- the normal
6026 % (undoubled) page height minus any material left over from the
6027 % previous page.
6028 \advance\vsize by -\ht\partialpage
6029 \vsize = 2\vsize
6030 %
6031 % For the benefit of balancing columns
6032 \advance\baselineskip by 0pt plus 0.5pt
6033 }
6034
6035 % The double-column output routine for all double-column pages except
6036 % the last, which is done by \balancecolumns.
6037 %
6038 \def\doublecolumnout{%
6039 %
6040 \savetopmark
6041 \splittopskip=\topskip \splitmaxdepth=\maxdepth
6042 \dimen@ = \vsize
6043 \divide\dimen@ by 2
6044 %
6045 % box0 will be the left-hand column, box2 the right.
6046 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
6047 \global\advance\vsize by 2\ht\partialpage
6048 \onepageout\pagesofar % empty except for the first time we are called
6049 \unvbox\PAGE
6050 \penalty\outputpenalty
6051 }
6052 %
6053 % Re-output the contents of the output page -- any previous material,
6054 % followed by the two boxes we just split, in box0 and box2.
6055 \def\pagesofar{%
6056 \unvbox\partialpage
6057 %
6058 \hsize = \doublecolumnhsize
6059 \wd0=\hsize \wd2=\hsize
6060 \hbox to\txipagewidth{\box0\hfil\box2}%
6061 }
6062
6063
6064 % Finished with double columns.
6065 \def\enddoublecolumns{%
6066 % The following penalty ensures that the page builder is exercised
6067 % _before_ we change the output routine. This is necessary in the
6068 % following situation:
6069 %
6070 % The last section of the index consists only of a single entry.
6071 % Before this section, \pagetotal is less than \pagegoal, so no
6072 % break occurs before the last section starts. However, the last
6073 % section, consisting of \initial and the single \entry, does not
6074 % fit on the page and has to be broken off. Without the following
6075 % penalty the page builder will not be exercised until \eject
6076 % below, and by that time we'll already have changed the output
6077 % routine to the \balancecolumns version, so the next-to-last
6078 % double-column page will be processed with \balancecolumns, which
6079 % is wrong: The two columns will go to the main vertical list, with
6080 % the broken-off section in the recent contributions. As soon as
6081 % the output routine finishes, TeX starts reconsidering the page
6082 % break. The two columns and the broken-off section both fit on the
6083 % page, because the two columns now take up only half of the page
6084 % goal. When TeX sees \eject from below which follows the final
6085 % section, it invokes the new output routine that we've set after
6086 % \balancecolumns below; \onepageout will try to fit the two columns
6087 % and the final section into the vbox of \txipageheight (see
6088 % \pagebody), causing an overfull box.
6089 %
6090 % Note that glue won't work here, because glue does not exercise the
6091 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
6092 \penalty0
6093 %
6094 \output = {%
6095 % Split the last of the double-column material.
6096 \savetopmark
6097 \balancecolumns
6098 }%
6099 \eject % call the \output just set
6100 \ifdim\pagetotal=0pt
6101 % Having called \balancecolumns once, we do not
6102 % want to call it again. Therefore, reset \output to its normal
6103 % definition right away.
6104 \global\output=\expandafter{\the\defaultoutput}
6105 %
6106 \endgroup % started in \begindoublecolumns
6107 % Leave the double-column material on the current page, no automatic
6108 % page break.
6109 \box\balancedcolumns
6110 %
6111 % \pagegoal was set to the doubled \vsize above, since we restarted
6112 % the current page. We're now back to normal single-column
6113 % typesetting, so reset \pagegoal to the normal \vsize.
6114 \global\vsize = \txipageheight %
6115 \pagegoal = \txipageheight %
6116 \else
6117 % We had some left-over material. This might happen when \doublecolumnout
6118 % is called in \balancecolumns. Try again.
6119 \expandafter\enddoublecolumns
6120 \fi
6121 }
6122 \newbox\balancedcolumns
6123 \setbox\balancedcolumns=\vbox{shouldnt see this}%
6124 %
6125 % Only called for the last of the double column material. \doublecolumnout
6126 % does the others.
6127 \def\balancecolumns{%
6128 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
6129 \dimen@ = \ht0
6130 \ifdim\dimen@<7\baselineskip
6131 % Don't split a short final column in two.
6132 \setbox2=\vbox{}%
6133 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
6134 \else
6135 % double the leading vertical space
6136 \advance\dimen@ by \topskip
6137 \advance\dimen@ by-\baselineskip
6138 \divide\dimen@ by 2 % target to split to
6139 \dimen@ii = \dimen@
6140 \splittopskip = \topskip
6141 % Loop until left column is at least as high as the right column.
6142 {%
6143 \vbadness = 10000
6144 \loop
6145 \global\setbox3 = \copy0
6146 \global\setbox1 = \vsplit3 to \dimen@
6147 \ifdim\ht1<\ht3
6148 \global\advance\dimen@ by 1pt
6149 \repeat
6150 }%
6151 % Now the left column is in box 1, and the right column in box 3.
6152 %
6153 % Check whether the left column has come out higher than the page itself.
6154 % (Note that we have doubled \vsize for the double columns, so
6155 % the actual height of the page is 0.5\vsize).
6156 \ifdim2\ht1>\vsize
6157 % It appears that we have been called upon to balance too much material.
6158 % Output some of it with \doublecolumnout, leaving the rest on the page.
6159 \setbox\PAGE=\box0
6160 \doublecolumnout
6161 \else
6162 % Compare the heights of the two columns.
6163 \ifdim4\ht1>5\ht3
6164 % Column heights are too different, so don't make their bottoms
6165 % flush with each other.
6166 \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
6167 \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
6168 \else
6169 % Make column bottoms flush with each other.
6170 \setbox2=\vbox to\ht1{\unvbox3\unskip}%
6171 \setbox0=\vbox to\ht1{\unvbox1\unskip}%
6172 \fi
6173 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
6174 \fi
6175 \fi
6176 %
6177 }
6178 \catcode`\@ = \other
6179
6180
6181 \message{sectioning,}
6182 % Chapters, sections, etc.
6183
6184 % Let's start with @part.
6185 \parseargdef\part{\partzzz{#1}}
6186 \def\partzzz#1{%
6187 \chapoddpage
6188 \null
6189 \vskip.3\vsize % move it down on the page a bit
6190 \begingroup
6191 \noindent \titlefonts\rm #1\par % the text
6192 \let\lastnode=\empty % no node to associate with
6193 \writetocentry{part}{#1}{}% but put it in the toc
6194 \headingsoff % no headline or footline on the part page
6195 % This outputs a mark at the end of the page that clears \thischapter
6196 % and \thissection, as is done in \startcontents.
6197 \let\pchapsepmacro\relax
6198 \chapmacro{}{Yomitfromtoc}{}%
6199 \gdef\thispart{#1}%
6200 \chapoddpage
6201 \endgroup
6202 }
6203
6204 % Name of current part, if any.
6205 % Note: unlike @thischapter etc. defined below, the name of the part
6206 % is always set before a page with a heading or footing is shipped out,
6207 % so there is no need to keep the value of these in "marks".
6208 \def\thispart{}%
6209
6210 % \unnumberedno is an oxymoron. But we count the unnumbered
6211 % sections so that we can refer to them unambiguously in the pdf
6212 % outlines by their "section number". We avoid collisions with chapter
6213 % numbers by starting them at 10000. (If a document ever has 10000
6214 % chapters, we're in trouble anyway, I'm sure.)
6215 \newcount\unnumberedno \unnumberedno = 10000
6216 \newcount\chapno
6217 \newcount\secno \secno=0
6218 \newcount\subsecno \subsecno=0
6219 \newcount\subsubsecno \subsubsecno=0
6220
6221 % This counter is funny since it counts through charcodes of letters A, B, ...
6222 \newcount\appendixno \appendixno = `\@
6223 %
6224 % \def\appendixletter{\char\the\appendixno}
6225 % We do the following ugly conditional instead of the above simple
6226 % construct for the sake of pdftex, which needs the actual
6227 % letter in the expansion, not just typeset.
6228 %
6229 \def\appendixletter{%
6230 \ifnum\appendixno=`A A%
6231 \else\ifnum\appendixno=`B B%
6232 \else\ifnum\appendixno=`C C%
6233 \else\ifnum\appendixno=`D D%
6234 \else\ifnum\appendixno=`E E%
6235 \else\ifnum\appendixno=`F F%
6236 \else\ifnum\appendixno=`G G%
6237 \else\ifnum\appendixno=`H H%
6238 \else\ifnum\appendixno=`I I%
6239 \else\ifnum\appendixno=`J J%
6240 \else\ifnum\appendixno=`K K%
6241 \else\ifnum\appendixno=`L L%
6242 \else\ifnum\appendixno=`M M%
6243 \else\ifnum\appendixno=`N N%
6244 \else\ifnum\appendixno=`O O%
6245 \else\ifnum\appendixno=`P P%
6246 \else\ifnum\appendixno=`Q Q%
6247 \else\ifnum\appendixno=`R R%
6248 \else\ifnum\appendixno=`S S%
6249 \else\ifnum\appendixno=`T T%
6250 \else\ifnum\appendixno=`U U%
6251 \else\ifnum\appendixno=`V V%
6252 \else\ifnum\appendixno=`W W%
6253 \else\ifnum\appendixno=`X X%
6254 \else\ifnum\appendixno=`Y Y%
6255 \else\ifnum\appendixno=`Z Z%
6256 % The \the is necessary, despite appearances, because \appendixletter is
6257 % expanded while writing the .toc file. \char\appendixno is not
6258 % expandable, thus it is written literally, thus all appendixes come out
6259 % with the same letter (or @) in the toc without it.
6260 \else\char\the\appendixno
6261 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6262 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6263
6264 % Each @chapter defines these (using marks) as the number+name, number
6265 % and name of the chapter. Page headings and footings can use
6266 % these. @section does likewise.
6267 \def\thischapter{}
6268 \def\thischapternum{}
6269 \def\thischaptername{}
6270 \def\thissection{}
6271 \def\thissectionnum{}
6272 \def\thissectionname{}
6273
6274 \newcount\absseclevel % used to calculate proper heading level
6275 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6276
6277 % @raisesections: treat @section as chapter, @subsection as section, etc.
6278 \def\raisesections{\global\advance\secbase by -1}
6279
6280 % @lowersections: treat @chapter as section, @section as subsection, etc.
6281 \def\lowersections{\global\advance\secbase by 1}
6282
6283 % we only have subsub.
6284 \chardef\maxseclevel = 3
6285 %
6286 % A numbered section within an unnumbered changes to unnumbered too.
6287 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
6288 \chardef\unnlevel = \maxseclevel
6289 %
6290 % Trace whether the current chapter is an appendix or not:
6291 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6292 \def\chapheadtype{N}
6293
6294 % Choose a heading macro
6295 % #1 is heading type
6296 % #2 is heading level
6297 % #3 is text for heading
6298 \def\genhead#1#2#3{%
6299 % Compute the abs. sec. level:
6300 \absseclevel=#2
6301 \advance\absseclevel by \secbase
6302 % Make sure \absseclevel doesn't fall outside the range:
6303 \ifnum \absseclevel < 0
6304 \absseclevel = 0
6305 \else
6306 \ifnum \absseclevel > 3
6307 \absseclevel = 3
6308 \fi
6309 \fi
6310 % The heading type:
6311 \def\headtype{#1}%
6312 \if \headtype U%
6313 \ifnum \absseclevel < \unnlevel
6314 \chardef\unnlevel = \absseclevel
6315 \fi
6316 \else
6317 % Check for appendix sections:
6318 \ifnum \absseclevel = 0
6319 \edef\chapheadtype{\headtype}%
6320 \else
6321 \if \headtype A\if \chapheadtype N%
6322 \errmessage{@appendix... within a non-appendix chapter}%
6323 \fi\fi
6324 \fi
6325 % Check for numbered within unnumbered:
6326 \ifnum \absseclevel > \unnlevel
6327 \def\headtype{U}%
6328 \else
6329 \chardef\unnlevel = 3
6330 \fi
6331 \fi
6332 % Now print the heading:
6333 \if \headtype U%
6334 \ifcase\absseclevel
6335 \unnumberedzzz{#3}%
6336 \or \unnumberedseczzz{#3}%
6337 \or \unnumberedsubseczzz{#3}%
6338 \or \unnumberedsubsubseczzz{#3}%
6339 \fi
6340 \else
6341 \if \headtype A%
6342 \ifcase\absseclevel
6343 \appendixzzz{#3}%
6344 \or \appendixsectionzzz{#3}%
6345 \or \appendixsubseczzz{#3}%
6346 \or \appendixsubsubseczzz{#3}%
6347 \fi
6348 \else
6349 \ifcase\absseclevel
6350 \chapterzzz{#3}%
6351 \or \seczzz{#3}%
6352 \or \numberedsubseczzz{#3}%
6353 \or \numberedsubsubseczzz{#3}%
6354 \fi
6355 \fi
6356 \fi
6357 \suppressfirstparagraphindent
6358 }
6359
6360 % an interface:
6361 \def\numhead{\genhead N}
6362 \def\apphead{\genhead A}
6363 \def\unnmhead{\genhead U}
6364
6365 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6366 % all lower-level sectioning counters to zero.
6367 %
6368 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
6369 % (e.g., figures), q.v. By default (before any chapter), that is empty.
6370 \let\chaplevelprefix = \empty
6371 %
6372 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6373 \def\chapterzzz#1{%
6374 % section resetting is \global in case the chapter is in a group, such
6375 % as an @include file.
6376 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6377 \global\advance\chapno by 1
6378 %
6379 % Used for \float.
6380 \gdef\chaplevelprefix{\the\chapno.}%
6381 \resetallfloatnos
6382 %
6383 % \putwordChapter can contain complex things in translations.
6384 \toks0=\expandafter{\putwordChapter}%
6385 \message{\the\toks0 \space \the\chapno}%
6386 %
6387 % Write the actual heading.
6388 \chapmacro{#1}{Ynumbered}{\the\chapno}%
6389 %
6390 % So @section and the like are numbered underneath this chapter.
6391 \global\let\section = \numberedsec
6392 \global\let\subsection = \numberedsubsec
6393 \global\let\subsubsection = \numberedsubsubsec
6394 }
6395
6396 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6397 %
6398 \def\appendixzzz#1{%
6399 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6400 \global\advance\appendixno by 1
6401 \gdef\chaplevelprefix{\appendixletter.}%
6402 \resetallfloatnos
6403 %
6404 % \putwordAppendix can contain complex things in translations.
6405 \toks0=\expandafter{\putwordAppendix}%
6406 \message{\the\toks0 \space \appendixletter}%
6407 %
6408 \chapmacro{#1}{Yappendix}{\appendixletter}%
6409 %
6410 \global\let\section = \appendixsec
6411 \global\let\subsection = \appendixsubsec
6412 \global\let\subsubsection = \appendixsubsubsec
6413 }
6414
6415 % normally unnmhead0 calls unnumberedzzz:
6416 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
6417 \def\unnumberedzzz#1{%
6418 \global\advance\unnumberedno by 1
6419 %
6420 % Since an unnumbered has no number, no prefix for figures.
6421 \global\let\chaplevelprefix = \empty
6422 \resetallfloatnos
6423 %
6424 % This used to be simply \message{#1}, but TeX fully expands the
6425 % argument to \message. Therefore, if #1 contained @-commands, TeX
6426 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6427 % expanded @cite (which turns out to cause errors because \cite is meant
6428 % to be executed, not expanded).
6429 %
6430 % Anyway, we don't want the fully-expanded definition of @cite to appear
6431 % as a result of the \message, we just want `@cite' itself. We use
6432 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6433 % simply yielding the contents of <toks register>. (We also do this for
6434 % the toc entries.)
6435 \toks0 = {#1}%
6436 \message{(\the\toks0)}%
6437 %
6438 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6439 %
6440 \global\let\section = \unnumberedsec
6441 \global\let\subsection = \unnumberedsubsec
6442 \global\let\subsubsection = \unnumberedsubsubsec
6443 }
6444
6445 % @centerchap is like @unnumbered, but the heading is centered.
6446 \outer\parseargdef\centerchap{%
6447 \let\centerparametersmaybe = \centerparameters
6448 \unnmhead0{#1}%
6449 \let\centerparametersmaybe = \relax
6450 }
6451
6452 % @top is like @unnumbered.
6453 \let\top\unnumbered
6454
6455 % Sections.
6456 %
6457 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6458 \def\seczzz#1{%
6459 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6460 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6461 }
6462
6463 % normally calls appendixsectionzzz:
6464 \outer\parseargdef\appendixsection{\apphead1{#1}}
6465 \def\appendixsectionzzz#1{%
6466 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6467 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6468 }
6469 \let\appendixsec\appendixsection
6470
6471 % normally calls unnumberedseczzz:
6472 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6473 \def\unnumberedseczzz#1{%
6474 \global\advance\unnumberedno by 1
6475 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno}%
6476 }
6477
6478 % Subsections.
6479 %
6480 % normally calls numberedsubseczzz:
6481 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6482 \def\numberedsubseczzz#1{%
6483 \global\subsubsecno=0 \global\advance\subsecno by 1
6484 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6485 }
6486
6487 % normally calls appendixsubseczzz:
6488 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6489 \def\appendixsubseczzz#1{%
6490 \global\subsubsecno=0 \global\advance\subsecno by 1
6491 \sectionheading{#1}{subsec}{Yappendix}%
6492 {\appendixletter.\the\secno.\the\subsecno}%
6493 }
6494
6495 % normally calls unnumberedsubseczzz:
6496 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6497 \def\unnumberedsubseczzz#1{%
6498 \global\advance\unnumberedno by 1
6499 \sectionheading{#1}{subsec}{Ynothing}{\the\unnumberedno}%
6500 }
6501
6502 % Subsubsections.
6503 %
6504 % normally numberedsubsubseczzz:
6505 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6506 \def\numberedsubsubseczzz#1{%
6507 \global\advance\subsubsecno by 1
6508 \sectionheading{#1}{subsubsec}{Ynumbered}%
6509 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6510 }
6511
6512 % normally appendixsubsubseczzz:
6513 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6514 \def\appendixsubsubseczzz#1{%
6515 \global\advance\subsubsecno by 1
6516 \sectionheading{#1}{subsubsec}{Yappendix}%
6517 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6518 }
6519
6520 % normally unnumberedsubsubseczzz:
6521 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6522 \def\unnumberedsubsubseczzz#1{%
6523 \global\advance\unnumberedno by 1
6524 \sectionheading{#1}{subsubsec}{Ynothing}{\the\unnumberedno}%
6525 }
6526
6527 % These macros control what the section commands do, according
6528 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6529 % Define them by default for a numbered chapter.
6530 \let\section = \numberedsec
6531 \let\subsection = \numberedsubsec
6532 \let\subsubsection = \numberedsubsubsec
6533
6534 % Define @majorheading, @heading and @subheading
6535
6536 \def\majorheading{%
6537 {\advance\chapheadingskip by 10pt \chapbreak }%
6538 \parsearg\chapheadingzzz
6539 }
6540
6541 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6542 \def\chapheadingzzz#1{%
6543 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6544 \nobreak\bigskip \nobreak
6545 \suppressfirstparagraphindent
6546 }
6547
6548 % @heading, @subheading, @subsubheading.
6549 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6550 \suppressfirstparagraphindent}
6551 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6552 \suppressfirstparagraphindent}
6553 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6554 \suppressfirstparagraphindent}
6555
6556 % @xrefname - give text with printed name for linking to node and allow
6557 % referencing node, but do not print any heading.
6558 \parseargdef\xrefname{\donoderef{Yomitfromtoc}{#1}}%
6559
6560 % These macros generate a chapter, section, etc. heading only
6561 % (including whitespace, linebreaking, etc. around it),
6562 % given all the information in convenient, parsed form.
6563
6564 % Args are the skip and penalty (usually negative)
6565 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6566
6567 % Parameter controlling skip before chapter headings (if needed)
6568 \newskip\chapheadingskip
6569
6570 % Define plain chapter starts, and page on/off switching for it.
6571 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6572
6573 % Start a new page
6574 \def\chappager{\par\vfill\supereject}
6575
6576 % \chapoddpage - start on an odd page for a new chapter
6577 % Because \domark is called before \chapoddpage, the filler page will
6578 % get the headings for the next chapter, which is wrong. But we don't
6579 % care -- we just disable all headings on the filler page.
6580 \def\chapoddpage{%
6581 \chappager
6582 \ifodd\pageno \else
6583 \begingroup
6584 \headingsoff
6585 \null
6586 \chappager
6587 \endgroup
6588 \fi
6589 }
6590
6591 \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname\HEADINGSon}
6592
6593 \def\CHAPPAGoff{%
6594 \global\let\contentsalignmacro = \chappager
6595 \global\let\pchapsepmacro=\chapbreak
6596 \global\def\HEADINGSon{\HEADINGSsinglechapoff}}
6597
6598 \def\CHAPPAGon{%
6599 \global\let\contentsalignmacro = \chappager
6600 \global\let\pchapsepmacro=\chappager
6601 \global\def\HEADINGSon{\HEADINGSsingle}}
6602
6603 \def\CHAPPAGodd{%
6604 \global\let\contentsalignmacro = \chapoddpage
6605 \global\let\pchapsepmacro=\chapoddpage
6606 \global\def\HEADINGSon{\HEADINGSdouble}}
6607
6608 \setchapternewpage on
6609
6610 % \chapmacro - Chapter opening.
6611 %
6612 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6613 % Yappendix, Yomitfromtoc), #3 the chapter number.
6614 % Not used for @heading series.
6615 %
6616 % To test against our argument.
6617 \def\Ynothingkeyword{Ynothing}
6618 \def\Yappendixkeyword{Yappendix}
6619 \def\Yomitfromtockeyword{Yomitfromtoc}
6620 %
6621 %
6622 % Definitions for @thischapter. These can be overridden in translation
6623 % files.
6624 \def\thischapterAppendix{%
6625 \putwordAppendix{} \thischapternum: \thischaptername}
6626
6627 \def\thischapterChapter{%
6628 \putwordChapter{} \thischapternum: \thischaptername}
6629 %
6630 %
6631 \def\chapmacro#1#2#3{%
6632 \expandafter\ifx\thisenv\titlepage\else
6633 \checkenv{}% chapters, etc., should not start inside an environment.
6634 \fi
6635 % Insert the first mark before the heading break (see notes for \domark).
6636 \let\prevchapterdefs=\currentchapterdefs
6637 \let\prevsectiondefs=\currentsectiondefs
6638 \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6639 \gdef\thissection{}}%
6640 %
6641 \def\temptype{#2}%
6642 \ifx\temptype\Ynothingkeyword
6643 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6644 \gdef\thischapter{\thischaptername}}%
6645 \else\ifx\temptype\Yomitfromtockeyword
6646 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6647 \gdef\thischapter{}}%
6648 \else\ifx\temptype\Yappendixkeyword
6649 \toks0={#1}%
6650 \xdef\currentchapterdefs{%
6651 \gdef\noexpand\thischaptername{\the\toks0}%
6652 \gdef\noexpand\thischapternum{\appendixletter}%
6653 \let\noexpand\thischapter\noexpand\thischapterAppendix
6654 }%
6655 \else
6656 \toks0={#1}%
6657 \xdef\currentchapterdefs{%
6658 \gdef\noexpand\thischaptername{\the\toks0}%
6659 \gdef\noexpand\thischapternum{\the\chapno}%
6660 \let\noexpand\thischapter\noexpand\thischapterChapter
6661 }%
6662 \fi\fi\fi
6663 %
6664 % Output the mark. Pass it through \safewhatsit, to take care of
6665 % the preceding space.
6666 \safewhatsit\domark
6667 %
6668 % Insert the chapter heading break.
6669 \pchapsepmacro
6670 %
6671 % Now the second mark, after the heading break. No break points
6672 % between here and the heading.
6673 \let\prevchapterdefs=\currentchapterdefs
6674 \let\prevsectiondefs=\currentsectiondefs
6675 \domark
6676 %
6677 {%
6678 \chapfonts \rm
6679 \let\footnote=\errfootnoteheading % give better error message
6680 %
6681 % Only insert the separating space if we have a chapter/appendix
6682 % number, and don't print the unnumbered ``number''.
6683 \ifx\temptype\Ynothingkeyword
6684 \setbox0 = \hbox{}%
6685 \def\toctype{unnchap}%
6686 \else\ifx\temptype\Yomitfromtockeyword
6687 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6688 \def\toctype{omit}%
6689 \else\ifx\temptype\Yappendixkeyword
6690 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6691 \def\toctype{app}%
6692 \else
6693 \setbox0 = \hbox{#3\enspace}%
6694 \def\toctype{numchap}%
6695 \fi\fi\fi
6696 %
6697 % Write the toc entry for this chapter. Must come before the
6698 % \donoderef, because we include the current node name in the toc
6699 % entry, and \donoderef resets it to empty.
6700 \writetocentry{\toctype}{#1}{#3}%
6701 %
6702 % For pdftex, we have to write out the node definition (aka, make
6703 % the pdfdest) after any page break, but before the actual text has
6704 % been typeset. If the destination for the pdf outline is after the
6705 % text, then jumping from the outline may wind up with the text not
6706 % being visible, for instance under high magnification.
6707 \donoderef{#2}{#1}%
6708 %
6709 % Typeset the actual heading.
6710 \nobreak % Avoid page breaks at the interline glue.
6711 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6712 \unhbox0 #1\par}%
6713 }%
6714 \nobreak\bigskip % no page break after a chapter title
6715 \nobreak
6716 }
6717
6718 % @centerchap -- centered and unnumbered.
6719 \let\centerparametersmaybe = \relax
6720 \def\centerparameters{%
6721 \advance\rightskip by 3\rightskip
6722 \leftskip = \rightskip
6723 \parfillskip = 0pt
6724 }
6725
6726
6727 % Section titles. These macros combine the section number parts and
6728 % call the generic \sectionheading to do the printing.
6729 %
6730 \newskip\secheadingskip
6731 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6732
6733 % Subsection titles.
6734 \newskip\subsecheadingskip
6735 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6736
6737 % Subsubsection titles.
6738 \def\subsubsecheadingskip{\subsecheadingskip}
6739 \def\subsubsecheadingbreak{\subsecheadingbreak}
6740
6741 % Definition for @thissection. This can be overridden in translation
6742 % files.
6743 \def\thissectionDef{%
6744 \putwordSection{} \thissectionnum: \thissectionname}
6745 %
6746
6747
6748 % Print any size, any type, section title.
6749 %
6750 % #1 is the text of the title,
6751 % #2 is the section level (sec/subsec/subsubsec),
6752 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6753 % #4 is the section number.
6754 %
6755 \def\seckeyword{sec}
6756 %
6757 \def\sectionheading#1#2#3#4{%
6758 {%
6759 \def\sectionlevel{#2}%
6760 \def\temptype{#3}%
6761 %
6762 % It is ok for the @heading series commands to appear inside an
6763 % environment (it's been historically allowed, though the logic is
6764 % dubious), but not the others.
6765 \ifx\temptype\Yomitfromtockeyword\else
6766 \checkenv{}% non-@*heading should not be in an environment.
6767 \fi
6768 \let\footnote=\errfootnoteheading
6769 %
6770 % Switch to the right set of fonts.
6771 \csname #2fonts\endcsname \rm
6772 %
6773 % Insert first mark before the heading break (see notes for \domark).
6774 \let\prevsectiondefs=\currentsectiondefs
6775 \ifx\temptype\Ynothingkeyword
6776 \ifx\sectionlevel\seckeyword
6777 \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6778 \gdef\thissection{\thissectionname}}%
6779 \fi
6780 \else\ifx\temptype\Yomitfromtockeyword
6781 % Don't redefine \thissection.
6782 \else\ifx\temptype\Yappendixkeyword
6783 \ifx\sectionlevel\seckeyword
6784 \toks0={#1}%
6785 \xdef\currentsectiondefs{%
6786 \gdef\noexpand\thissectionname{\the\toks0}%
6787 \gdef\noexpand\thissectionnum{#4}%
6788 \let\noexpand\thissection\noexpand\thissectionDef
6789 }%
6790 \fi
6791 \else
6792 \ifx\sectionlevel\seckeyword
6793 \toks0={#1}%
6794 \xdef\currentsectiondefs{%
6795 \gdef\noexpand\thissectionname{\the\toks0}%
6796 \gdef\noexpand\thissectionnum{#4}%
6797 \let\noexpand\thissection\noexpand\thissectionDef
6798 }%
6799 \fi
6800 \fi\fi\fi
6801 %
6802 % Go into vertical mode. Usually we'll already be there, but we
6803 % don't want the following whatsit to end up in a preceding paragraph
6804 % if the document didn't happen to have a blank line.
6805 \par
6806 %
6807 % Output the mark. Pass it through \safewhatsit, to take care of
6808 % the preceding space.
6809 \safewhatsit\domark
6810 %
6811 % Insert space above the heading.
6812 \csname #2headingbreak\endcsname
6813 %
6814 % Now the second mark, after the heading break. No break points
6815 % between here and the heading.
6816 \global\let\prevsectiondefs=\currentsectiondefs
6817 \domark
6818 %
6819 % Only insert the space after the number if we have a section number.
6820 \ifx\temptype\Ynothingkeyword
6821 \setbox0 = \hbox{}%
6822 \def\toctype{unn}%
6823 \else\ifx\temptype\Yomitfromtockeyword
6824 % for @headings -- no section number, don't include in toc.
6825 \setbox0 = \hbox{}%
6826 \def\toctype{omit}%
6827 \let\sectionlevel=\empty
6828 \else\ifx\temptype\Yappendixkeyword
6829 \setbox0 = \hbox{#4\enspace}%
6830 \def\toctype{app}%
6831 \else
6832 \setbox0 = \hbox{#4\enspace}%
6833 \def\toctype{num}%
6834 \fi\fi\fi
6835 %
6836 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6837 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6838 %
6839 % Write the node reference (= pdf destination for pdftex).
6840 % Again, see comments in \chapmacro.
6841 \donoderef{#3}{#1}%
6842 %
6843 % Interline glue will be inserted when the vbox is completed.
6844 % That glue will be a valid breakpoint for the page, since it'll be
6845 % preceded by a whatsit (usually from the \donoderef, or from the
6846 % \writetocentry if there was no node). We don't want to allow that
6847 % break, since then the whatsits could end up on page n while the
6848 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6849 \nobreak
6850 %
6851 % Output the actual section heading.
6852 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6853 \hangindent=\wd0 % zero if no section number
6854 \unhbox0 #1}%
6855 }%
6856 % Add extra space after the heading -- half of whatever came above it.
6857 % Don't allow stretch, though.
6858 \kern .5 \csname #2headingskip\endcsname
6859 %
6860 % Do not let the kern be a potential breakpoint, as it would be if it
6861 % was followed by glue.
6862 \nobreak
6863 %
6864 % We'll almost certainly start a paragraph next, so don't let that
6865 % glue accumulate. (Not a breakpoint because it's preceded by a
6866 % discardable item.) However, when a paragraph is not started next
6867 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6868 % or the negative glue will cause weirdly wrong output, typically
6869 % obscuring the section heading with something else.
6870 \vskip-\parskip
6871 %
6872 % This is so the last item on the main vertical list is a known
6873 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6874 % and do the needful.
6875 \penalty 10001
6876 }
6877
6878
6879 \message{toc,}
6880 % Table of contents.
6881 \newwrite\tocfile
6882
6883 % Write an entry to the toc file, opening it if necessary.
6884 % Called from @chapter, etc.
6885 %
6886 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6887 % We append the current node name (if any) and page number as additional
6888 % arguments for the \{chap,sec,...}entry macros which will eventually
6889 % read this. The node name is used in the pdf outlines as the
6890 % destination to jump to.
6891 %
6892 % We open the .toc file for writing here instead of at @setfilename (or
6893 % any other fixed time) so that @contents can be anywhere in the document.
6894 % But if #1 is `omit', then we don't do anything. This is used for the
6895 % table of contents chapter openings themselves.
6896 %
6897 \newif\iftocfileopened
6898 \def\omitkeyword{omit}%
6899 %
6900 \def\writetocentry#1#2#3{%
6901 \edef\writetoctype{#1}%
6902 \ifx\writetoctype\omitkeyword \else
6903 \iftocfileopened\else
6904 \immediate\openout\tocfile = \jobname.toc
6905 \global\tocfileopenedtrue
6906 \fi
6907 %
6908 \iflinks
6909 {\atdummies
6910 \edef\temp{%
6911 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6912 \temp
6913 }%
6914 \fi
6915 \fi
6916 %
6917 % Tell \shipout to create a pdf destination on each page, if we're
6918 % writing pdf. These are used in the table of contents. We can't
6919 % just write one on every page because the title pages are numbered
6920 % 1 and 2 (the page numbers aren't printed), and so are the first
6921 % two pages of the document. Thus, we'd have two destinations named
6922 % `1', and two named `2'.
6923 \ifpdforxetex
6924 \global\pdfmakepagedesttrue
6925 \fi
6926 }
6927
6928
6929 % These characters do not print properly in the Computer Modern roman
6930 % fonts, so we must take special care. This is more or less redundant
6931 % with the Texinfo input format setup at the end of this file.
6932 %
6933 \def\activecatcodes{%
6934 \catcode`\"=\active
6935 \catcode`\$=\active
6936 \catcode`\<=\active
6937 \catcode`\>=\active
6938 \catcode`\\=\active
6939 \catcode`\^=\active
6940 \catcode`\_=\active
6941 \catcode`\|=\active
6942 \catcode`\~=\active
6943 }
6944
6945
6946 % Read the toc file, which is essentially Texinfo input.
6947 \def\readtocfile{%
6948 \setupdatafile
6949 \activecatcodes
6950 \input \tocreadfilename
6951 }
6952
6953 % process toc file to find the maximum width of the section numbers for
6954 % each chapter
6955 \def\findsecnowidths{%
6956 \begingroup
6957 \setupdatafile
6958 \activecatcodes
6959 \secentryfonts
6960 % Redefinitions
6961 \def\numchapentry##1##2##3##4{%
6962 \def\curchapname{secnowidth-##2}%
6963 \curchapmax=0pt
6964 }%
6965 \let\appentry\numchapentry
6966 %
6967 \def\numsecentry##1##2##3##4{%
6968 \def\cursecname{secnowidth-##2}%
6969 \cursecmax=0pt
6970 %
6971 \setbox0=\hbox{##2}%
6972 \ifdim\wd0>\curchapmax
6973 \curchapmax=\wd0
6974 \expandafter\xdef\csname\curchapname\endcsname{\the\wd0}%
6975 \fi
6976 }%
6977 \let\appsecentry\numsecentry
6978 %
6979 \def\numsubsecentry##1##2##3##4{%
6980 \def\curssecname{secnowidth-##2}%
6981 \curssecmax=0pt
6982 %
6983 \setbox0=\hbox{##2}%
6984 \ifdim\wd0>\cursecmax
6985 \cursecmax=\wd0
6986 \expandafter\xdef\csname\cursecname\endcsname{\the\wd0}%
6987 \fi
6988 }%
6989 \let\appsubsecentry\numsubsecentry
6990 %
6991 \def\numsubsubsecentry##1##2##3##4{%
6992 \setbox0=\hbox{##2}%
6993 \ifdim\wd0>\curssecmax
6994 \curssecmax=\wd0
6995 \expandafter\xdef\csname\curssecname\endcsname{\the\wd0}%
6996 \fi
6997 }%
6998 \let\appsubsubsecentry\numsubsubsecentry
6999 %
7000 % Discard any output by outputting to dummy vbox, in case the toc file
7001 % contains macros that we have not redefined above.
7002 \setbox\dummybox\vbox\bgroup
7003 \input \tocreadfilename\relax
7004 \egroup
7005 \endgroup
7006 }
7007 \newdimen\curchapmax
7008 \newdimen\cursecmax
7009 \newdimen\curssecmax
7010
7011
7012 % set #1 to the maximum section width for #2
7013 \def\retrievesecnowidth#1#2{%
7014 \expandafter\let\expandafter\savedsecnowidth \csname secnowidth-#2\endcsname
7015 \ifx\savedsecnowidth\relax
7016 #1=0pt
7017 \else
7018 #1=\savedsecnowidth
7019 \fi
7020 }
7021 \newdimen\secnowidthchap
7022 \secnowidthchap=0pt
7023 \newdimen\secnowidthsec
7024 \secnowidthsec=0pt
7025 \newdimen\secnowidthssec
7026 \secnowidthssec=0pt
7027
7028
7029 \newskip\contentsrightmargin \contentsrightmargin=1in
7030 \newcount\savepageno
7031 \newcount\lastnegativepageno \lastnegativepageno = -1
7032
7033 % Prepare to read what we've written to \tocfile.
7034 %
7035 \def\startcontents#1#2{%
7036 % If @setchapternewpage on, and @headings double, the contents should
7037 % start on an odd page, unlike chapters.
7038 \contentsalignmacro
7039 \immediate\closeout\tocfile
7040 %
7041 #2%
7042 % Don't need to put `Contents' or `Short Contents' in the headline.
7043 % It is abundantly clear what they are.
7044 \chapmacro{#1}{Yomitfromtoc}{}%
7045 %
7046 \savepageno = \pageno
7047 \begingroup % Set up to handle contents files properly.
7048 \raggedbottom % Worry more about breakpoints than the bottom.
7049 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
7050 %
7051 % Roman numerals for page numbers.
7052 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
7053 \def\thistitle{}% no title in double-sided headings
7054 % Record where the Roman numerals started.
7055 \ifnum\romancount=0 \global\romancount=\pagecount \fi
7056 \linkentrytexttrue
7057 }
7058
7059 % \raggedbottom in plain.tex hardcodes \topskip so override it
7060 \catcode`\@=11
7061 \def\raggedbottom{\advance\topskip by 0pt plus30pt \r@ggedbottomtrue}
7062 \catcode`\@=\other
7063
7064 % redefined for the two-volume lispref. We always output on
7065 % \jobname.toc even if this is redefined.
7066 %
7067 \def\tocreadfilename{\jobname.toc}
7068
7069 % Normal (long) toc.
7070 %
7071 \def\contents{%
7072 \startcontents{\putwordTOC}{\contentsmkdest}%
7073 \ifxetex\xetexpreauxfile\fi
7074 \penalty2 % mark beginning of contents
7075 \openin 1 \tocreadfilename\space
7076 \ifeof 1 \else
7077 \findsecnowidths
7078 \readtocfile
7079 \fi
7080 \vfill \eject
7081 \contentsalignmacro % in case @setchapternewpage odd is in effect
7082 \ifeof 1 \else
7083 \pdfmakeoutlines
7084 \fi
7085 \closein 1
7086 \ifxetex\xetexpostauxfile\fi
7087 \endgroup
7088 \contentsendroman
7089 }
7090
7091 \def\contentsmkdest{%
7092 \pdfmkdest{txi.CONTENTS}%
7093 }
7094
7095 % And just the chapters.
7096 \def\summarycontents{%
7097 \startcontents{\putwordShortTOC}{}%
7098 %
7099 \let\partentry = \shortpartentry
7100 \let\numchapentry = \shortchapentry
7101 \let\appentry = \shortchapentry
7102 \let\unnchapentry = \shortunnchapentry
7103 % We want a true roman here for the page numbers.
7104 \secfonts
7105 \let\rm=\shortcontrm \let\bf=\shortcontbf
7106 \let\sl=\shortcontsl \let\tt=\shortconttt
7107 \rm
7108 \hyphenpenalty = 10000
7109 \advance\baselineskip by 1pt % Open it up a little.
7110 \extrasecnoskip=0.4pt
7111 \def\numsecentry##1##2##3##4{}
7112 \let\appsecentry = \numsecentry
7113 \let\unnsecentry = \numsecentry
7114 \let\numsubsecentry = \numsecentry
7115 \let\appsubsecentry = \numsecentry
7116 \let\unnsubsecentry = \numsecentry
7117 \let\numsubsubsecentry = \numsecentry
7118 \let\appsubsubsecentry = \numsecentry
7119 \let\unnsubsubsecentry = \numsecentry
7120 \ifxetex\xetexpreauxfile\fi
7121 \openin 1 \tocreadfilename\space
7122 \ifeof 1 \else
7123 \readtocfile
7124 \fi
7125 \closein 1
7126 \ifxetex\xetexpostauxfile\fi
7127 \vfill \eject
7128 \contentsalignmacro % in case @setchapternewpage odd is in effect
7129 \endgroup
7130 \contentsendroman
7131 }
7132 \let\shortcontents = \summarycontents
7133
7134 % Get ready to use Arabic numerals again
7135 \def\contentsendroman{%
7136 \lastnegativepageno = \pageno
7137 \global\pageno=1
7138 \contentsendcount = \pagecount
7139 }
7140
7141 % Typeset the label for a chapter or appendix for the short contents.
7142 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
7143 %
7144 \def\shortchaplabel#1{%
7145 % This space should be enough, since a single number is .5em, and the
7146 % widest letter (M) is 1em, at least in the Computer Modern fonts.
7147 % But use \hss just in case.
7148 %
7149 % We'd like to right-justify chapter numbers, but that looks strange
7150 % with appendix letters. And right-justifying numbers and
7151 % left-justifying letters looks strange when there is less than 10
7152 % chapters. Have to read the whole toc once to know how many chapters
7153 % there are before deciding ...
7154 \hbox to 1em{#1\hss}%
7155 }
7156
7157 % These macros generate individual entries in the table of contents,
7158 % and are read in from the *.toc file.
7159 %
7160 % The arguments are like:
7161 % \def\numchapentry#1#2#3#4
7162 % #1 - the chapter or section name.
7163 % #2 - section number
7164 % #3 - level of section (e.g "chap", "sec")
7165 % #4 - page number
7166
7167 % Parts, in the main contents. Ignore the page number, which is
7168 % conventionally not printed.
7169 \def\partentry#1#2#3#4{%
7170 \ifnum\lastpenalty = 2
7171 % use less space if at very first entry of contents
7172 \vskip 1\baselineskip plus .33\baselineskip minus .25\baselineskip
7173 \else
7174 \vskip 2\baselineskip plus .66\baselineskip minus .5\baselineskip
7175 \fi
7176 % Add stretch and a bonus for breaking the page before the part heading.
7177 % This reduces the chance of the page being broken immediately after the
7178 % part heading, before a following chapter heading.
7179 \vskip 0pt plus 3\baselineskip
7180 \penalty-300
7181 \vskip 0pt plus -3\baselineskip
7182 \begingroup
7183 \secfonts \rm
7184 \entryinternal{#1}{}%
7185 \endgroup
7186 \afterpartentrytrue
7187 }
7188 \newif\ifafterpartentry
7189 %
7190 % Parts, in the short toc.
7191 \def\shortpartentry#1#2#3#4{%
7192 \penalty-300
7193 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
7194 \tocentry{{\bf #1}}{}{}{}%
7195 }
7196
7197 % Chapters, in the main contents.
7198 \def\numchapentry#1#2#3#4{%
7199 \retrievesecnowidth\secnowidthchap{#2}%
7200 \dochapentry{#1}{#2}{#3}{#4}%
7201 }
7202
7203 % Chapters, in the short toc.
7204 \def\shortchapentry#1#2#3#4{%
7205 \tocentry{#1}{\shortchaplabel{#2}}{#3}{#4}%
7206 }
7207
7208 % Appendices, in the main contents.
7209 % Need the word Appendix, and a fixed-size box.
7210 %
7211 \def\appendixbox#1{%
7212 % We use M since it's probably the widest letter.
7213 \setbox0 = \hbox{\putwordAppendix{} M}%
7214 \hbox to \wd0{\putwordAppendix{} #1\hss}}
7215 %
7216 \def\appentry#1#2#3#4{%
7217 \retrievesecnowidth\secnowidthchap{#2}%
7218 \dochapentry{\appendixbox{#2}\hskip.7em#1}{}{#3}{#4}%
7219 }
7220
7221 % Unnumbered chapters.
7222 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{}{#3}{#4}}
7223 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{}{#3}{#4}}
7224
7225 % Sections.
7226 \def\numsecentry#1#2#3#4{%
7227 \retrievesecnowidth\secnowidthsec{#2}%
7228 \dosecentry{#1}{#2}{#3}{#4}%
7229 }
7230 \let\appsecentry=\numsecentry
7231 \def\unnsecentry#1#2#3#4{%
7232 \retrievesecnowidth\secnowidthsec{#2}%
7233 \dosecentry{#1}{}{#3}{#4}%
7234 }
7235
7236 % Subsections.
7237 \def\numsubsecentry#1#2#3#4{%
7238 \retrievesecnowidth\secnowidthssec{#2}%
7239 \dosubsecentry{#1}{#2}{#3}{#4}%
7240 }
7241 \let\appsubsecentry=\numsubsecentry
7242 \def\unnsubsecentry#1#2#3#4{%
7243 \retrievesecnowidth\secnowidthssec{#2}%
7244 \dosubsecentry{#1}{}{#3}{#4}%
7245 }
7246
7247 % And subsubsections.
7248 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#2}{#3}{#4}}
7249 \let\appsubsubsecentry=\numsubsubsecentry
7250 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{}{#3}{#4}}
7251
7252 % This parameter controls the indentation of the various levels.
7253 % Same as \defaultparindent.
7254 \newdimen\tocindent \tocindent = 15pt
7255
7256 % Now for the actual typesetting. In all these, #1 is the text, #2 is
7257 % a section number if present, #3 is the node, and #4 is the page number.
7258 %
7259 % If the toc has to be broken over pages, we want it to be at chapters
7260 % if at all possible; hence the \penalty.
7261 \def\dochapentry#1#2#3#4{%
7262 \ifafterpartentry
7263 \afterpartentryfalse
7264 \penalty5000
7265 \else
7266 \penalty-300
7267 \fi
7268 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
7269 \begingroup
7270 % Move the page numbers slightly to the right
7271 \advance\entryrightmargin by -0.05em
7272 \chapentryfonts
7273 \extrasecnoskip=0.4em % separate chapter number more
7274 \tocentry{#1}{#2}{#3}{#4}%
7275 \endgroup
7276 \nobreak\vskip .25\baselineskip plus.1\baselineskip
7277 }
7278
7279 \def\dosecentry#1#2#3#4{\begingroup
7280 \secnowidth=\secnowidthchap
7281 \secentryfonts \leftskip=\tocindent
7282 \tocentry{#1}{#2}{#3}{#4}%
7283 \endgroup}
7284
7285 \def\dosubsecentry#1#2#3#4{\begingroup
7286 \secnowidth=\secnowidthsec
7287 \subsecentryfonts \leftskip=2\tocindent
7288 \tocentry{#1}{#2}{#3}{#4}%
7289 \endgroup}
7290
7291 \def\dosubsubsecentry#1#2#3#4{\begingroup
7292 \secnowidth=\secnowidthssec
7293 \subsubsecentryfonts \leftskip=3\tocindent
7294 \tocentry{#1}{#2}{#3}{#4}%
7295 \endgroup}
7296
7297 % Used for the maximum width of a section number so we can align
7298 % section titles.
7299 \newdimen\secnowidth
7300 \secnowidth=0pt
7301 \newdimen\extrasecnoskip
7302 \extrasecnoskip=0pt
7303
7304 \let\tocnodetarget\empty
7305 \let\entrypagetarget\empty
7306
7307 % \tocentry{TITLE}{SEC NO}{NODE}{PAGE}
7308 %
7309 \def\tocentry#1#2#3#4{%
7310 \def\tocnodetarget{#3}%
7311 \def\secno{#2}%
7312 \ifx\empty\secno
7313 \entryinternal{#1}{#4}%
7314 \else
7315 \ifdim 0pt=\secnowidth
7316 \setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}%
7317 \else
7318 \advance\secnowidth by \labelspace
7319 \advance\secnowidth by \extrasecnoskip
7320 \setbox0=\hbox to \secnowidth{%
7321 #2\hskip\labelspace\hskip\extrasecnoskip\hfill}%
7322 \fi
7323 \entrycontskip=\wd0
7324 \entryinternal{\box0 #1}{#4}%
7325 \fi
7326 }
7327 \newdimen\labelspace
7328 \labelspace=0.6em
7329
7330 \def\chapentryfonts{\secfonts \rm}
7331 \def\secentryfonts{\textfonts}
7332 \def\subsecentryfonts{\textfonts}
7333 \def\subsubsecentryfonts{\textfonts}
7334
7335
7336 \message{environments,}
7337 % @foo ... @end foo.
7338
7339 % @tex ... @end tex escapes into raw TeX temporarily.
7340 % One exception: @ is still an escape character, so that @end tex works.
7341 % But \@ or @@ will get a plain @ character.
7342
7343 \envdef\tex{%
7344 \setregularquotes
7345 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
7346 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
7347 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
7348 \catcode `\%=14
7349 \catcode `\+=\other
7350 \catcode `\"=\other
7351 \catcode `\|=\other
7352 \catcode `\<=\other
7353 \catcode `\>=\other
7354 \catcode `\`=\other
7355 \catcode `\'=\other
7356 %
7357 % ' is active in math mode (mathcode"8000). So reset it, and all our
7358 % other math active characters (just in case), to plain's definitions.
7359 \mathactive
7360 %
7361 % Inverse of the list at the beginning of the file.
7362 \let\b=\ptexb
7363 \let\bullet=\ptexbullet
7364 \let\c=\ptexc
7365 \let\,=\ptexcomma
7366 \let\.=\ptexdot
7367 \let\dots=\ptexdots
7368 \let\equiv=\ptexequiv
7369 \let\!=\ptexexclam
7370 \let\i=\ptexi
7371 \let\indent=\ptexindent
7372 \let\noindent=\ptexnoindent
7373 \let\{=\ptexlbrace
7374 \let\+=\tabalign
7375 \let\}=\ptexrbrace
7376 \let\/=\ptexslash
7377 \let\sp=\ptexsp
7378 \let\*=\ptexstar
7379 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7380 \let\t=\ptext
7381 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7382 \let\frenchspacing=\plainfrenchspacing
7383 %
7384 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7385 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7386 \def\@{@}%
7387 }
7388 % There is no need to define \Etex.
7389
7390 % Define @lisp ... @end lisp.
7391 % @lisp environment forms a group so it can rebind things,
7392 % including the definition of @end lisp (which normally is erroneous).
7393
7394 % Amount to narrow the margins by for @lisp.
7395 \newskip\lispnarrowing \lispnarrowing=0.4in
7396
7397 % This is the definition that ^^M gets inside @lisp, @example, and other
7398 % such environments. \null is better than a space, since it doesn't
7399 % have any width.
7400 \def\lisppar{\null\endgraf}
7401
7402 % This space is always present above and below environments.
7403 \newskip\envskipamount \envskipamount = 0pt
7404
7405 % Make spacing and below environment symmetrical. We use \parskip here
7406 % to help in doing that, since in @example-like environments \parskip
7407 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7408 % start of the next paragraph will insert \parskip.
7409 %
7410 \def\aboveenvbreak{{%
7411 % =10000 instead of <10000 because of a special case in \itemzzz and
7412 % \sectionheading, q.v.
7413 \ifnum \lastpenalty=10000 \else
7414 \advance\envskipamount by \parskip
7415 \endgraf
7416 \ifdim\lastskip<\envskipamount
7417 \removelastskip
7418 \ifnum\lastpenalty<10000
7419 % Penalize breaking before the environment, because preceding text
7420 % often leads into it.
7421 \penalty100
7422 \fi
7423 \vskip\envskipamount
7424 \fi
7425 \fi
7426 }}
7427
7428 \def\afterenvbreak{{%
7429 % =10000 instead of <10000 because of a special case in \itemzzz and
7430 % \sectionheading, q.v.
7431 \ifnum \lastpenalty=10000 \else
7432 \advance\envskipamount by \parskip
7433 \endgraf
7434 \ifdim\lastskip<\envskipamount
7435 \removelastskip
7436 % it's not a good place to break if the last penalty was \nobreak
7437 % or better ...
7438 \ifnum\lastpenalty<10000 \penalty-50 \fi
7439 \vskip\envskipamount
7440 \fi
7441 \fi
7442 }}
7443
7444 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7445 % also clear it, so that its embedded environments do the narrowing again.
7446 \let\nonarrowing=\relax
7447
7448 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7449 % environment contents.
7450
7451 %
7452 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7453 \def\ctr{{\hskip 6pt\circle\char'010}}
7454 \def\cbl{{\circle\char'012\hskip -6pt}}
7455 \def\cbr{{\hskip 6pt\circle\char'011}}
7456 \def\carttop{\hbox to \cartouter{\hskip\lskip
7457 \ctl\leaders\hrule height\circthick\hfil\ctr
7458 \hskip\rskip}}
7459 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7460 \cbl\leaders\hrule height\circthick\hfil\cbr
7461 \hskip\rskip}}
7462 %
7463 \newskip\lskip\newskip\rskip
7464
7465 % only require the font if @cartouche is actually used
7466 \def\cartouchefontdefs{%
7467 \font\circle=lcircle10\relax
7468 \circthick=\fontdimen8\circle
7469 }
7470 \newdimen\circthick
7471 \newdimen\cartouter\newdimen\cartinner
7472 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7473
7474 \envparseargdef\cartouche{%
7475 \cartouchefontdefs
7476 \ifhmode\par\fi % can't be in the midst of a paragraph.
7477 \startsavinginserts
7478 \lskip=\leftskip \rskip=\rightskip
7479 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7480 %
7481 % Set paragraph width for text inside cartouche. There are
7482 % left and right margins of 3pt each plus two vrules 0.4pt each.
7483 \cartinner=\hsize \advance\cartinner by-\lskip
7484 \advance\cartinner by-\rskip
7485 \advance\cartinner by -6.8pt
7486 %
7487 % For drawing top and bottom of cartouche. Each corner char
7488 % adds 6pt and we take off the width of a rule to line up with the
7489 % right boundary perfectly.
7490 \cartouter=\hsize
7491 \advance\cartouter by 11.6pt
7492 %
7493 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7494 %
7495 % If this cartouche directly follows a sectioning command, we need the
7496 % \parskip glue (backspaced over by default) or the cartouche can
7497 % collide with the section heading.
7498 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7499 %
7500 \setbox\groupbox=\vtop\bgroup
7501 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7502 \carttop
7503 \hbox\bgroup
7504 \hskip\lskip
7505 \vrule\kern3pt
7506 \vbox\bgroup
7507 \hsize=\cartinner
7508 \baselineskip=\normbskip
7509 \lineskip=\normlskip
7510 \parskip=\normpskip
7511 \def\arg{#1}%
7512 \ifx\arg\empty\else
7513 \centerV{\hfil \bf #1 \hfil}%
7514 \fi
7515 \kern3pt
7516 \vskip -\parskip
7517 }
7518 \def\Ecartouche{%
7519 \ifhmode\par\fi
7520 \kern3pt
7521 \egroup
7522 \kern3pt\vrule
7523 \hskip\rskip
7524 \egroup
7525 \cartbot
7526 \egroup
7527 \addgroupbox
7528 \checkinserts
7529 }
7530
7531
7532 % This macro is called at the beginning of all the @example variants,
7533 % inside a group.
7534 \newdimen\nonfillparindent
7535 \def\nonfillstart{%
7536 \aboveenvbreak
7537 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7538 \sepspaces % Make spaces be word-separators rather than space tokens.
7539 \let\par = \lisppar % don't ignore blank lines
7540 \obeylines % each line of input is a line of output
7541 \parskip = 0pt
7542 % Turn off paragraph indentation but redefine \indent to emulate
7543 % the normal \indent.
7544 \nonfillparindent=\parindent
7545 \parindent = 0pt
7546 \let\indent\nonfillindent
7547 %
7548 \emergencystretch = 0pt % don't try to avoid overfull boxes
7549 \ifx\nonarrowing\relax
7550 \advance \leftskip by \lispnarrowing
7551 \exdentamount=\lispnarrowing
7552 \else
7553 \let\nonarrowing = \relax
7554 \fi
7555 \let\exdent=\nofillexdent
7556 }
7557
7558 \begingroup
7559 \obeyspaces
7560 % We want to swallow spaces (but not other tokens) after the fake
7561 % @indent in our nonfill-environments, where spaces are normally
7562 % active and set to @tie, resulting in them not being ignored after
7563 % @indent.
7564 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7565 \gdef\nonfillindentcheck{%
7566 \ifx\temp %
7567 \expandafter\nonfillindentgobble%
7568 \else%
7569 \leavevmode\nonfillindentbox%
7570 \fi%
7571 }%
7572 \endgroup
7573 \def\nonfillindentgobble#1{\nonfillindent}
7574 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7575
7576 % If you want all examples etc. small: @set dispenvsize small.
7577 % If you want even small examples the full size: @set dispenvsize nosmall.
7578 % This affects the following displayed environments:
7579 % @example, @display, @format, @lisp, @verbatim
7580 %
7581 \def\smallword{small}
7582 \def\nosmallword{nosmall}
7583 \let\SETdispenvsize\relax
7584 \def\setnormaldispenv{%
7585 \ifx\SETdispenvsize\smallword
7586 % end paragraph for sake of leading, in case document has no blank
7587 % line. This is redundant with what happens in \aboveenvbreak, but
7588 % we need to do it before changing the fonts, and it's inconvenient
7589 % to change the fonts afterward.
7590 \ifnum \lastpenalty=10000 \else \endgraf \fi
7591 \smallexamplefonts \rm
7592 \fi
7593 }
7594 \def\setsmalldispenv{%
7595 \ifx\SETdispenvsize\nosmallword
7596 \else
7597 \ifnum \lastpenalty=10000 \else \endgraf \fi
7598 \smallexamplefonts \rm
7599 \fi
7600 }
7601
7602 % We often define two environments, @foo and @smallfoo.
7603 % Let's do it in one command. #1 is the env name, #2 the definition.
7604 \def\makedispenvdef#1#2{%
7605 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7606 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7607 \expandafter\let\csname E#1\endcsname \afterenvbreak
7608 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7609 }
7610
7611 % Define two environment synonyms (#1 and #2) for an environment.
7612 \def\maketwodispenvdef#1#2#3{%
7613 \makedispenvdef{#1}{#3}%
7614 \makedispenvdef{#2}{#3}%
7615 }
7616 %
7617 % @lisp: indented, narrowed, typewriter font;
7618 % @example: same as @lisp.
7619 %
7620 % @smallexample and @smalllisp: use smaller fonts.
7621 % Originally contributed by Pavel@xerox.
7622 %
7623 \maketwodispenvdef{lisp}{example}{%
7624 \nonfillstart
7625 \tt\setcodequotes
7626 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7627 \parsearg\gobble
7628 }
7629 % @display/@smalldisplay: same as @lisp except keep current font.
7630 %
7631 \makedispenvdef{display}{%
7632 \nonfillstart
7633 \gobble
7634 }
7635
7636 % @format/@smallformat: same as @display except don't narrow margins.
7637 %
7638 \makedispenvdef{format}{%
7639 \let\nonarrowing = t%
7640 \nonfillstart
7641 \gobble
7642 }
7643
7644 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7645 \envdef\flushleft{%
7646 \let\nonarrowing = t%
7647 \nonfillstart
7648 \gobble
7649 }
7650 \let\Eflushleft = \afterenvbreak
7651
7652 % @flushright.
7653 %
7654 \envdef\flushright{%
7655 \let\nonarrowing = t%
7656 \nonfillstart
7657 \advance\leftskip by 0pt plus 1fill\relax
7658 \gobble
7659 }
7660 \let\Eflushright = \afterenvbreak
7661
7662
7663 % @raggedright does more-or-less normal line breaking but no right
7664 % justification. From plain.tex.
7665 \envdef\raggedright{%
7666 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7667 }
7668 \let\Eraggedright\par
7669
7670
7671 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7672 % and narrows the margins. We keep \parskip nonzero in general, since
7673 % we're doing normal filling. So, when using \aboveenvbreak and
7674 % \afterenvbreak, temporarily make \parskip 0.
7675 %
7676 \makedispenvdef{quotation}{\quotationstart}
7677 %
7678 \def\quotationstart{%
7679 \indentedblockstart % same as \indentedblock, but increase right margin too.
7680 \ifx\nonarrowing\relax
7681 \advance\rightskip by \lispnarrowing
7682 \fi
7683 \parsearg\quotationlabel
7684 }
7685
7686 % We have retained a nonzero parskip for the environment, since we're
7687 % doing normal filling.
7688 %
7689 \def\Equotation{%
7690 \par
7691 \ifx\quotationauthor\thisisundefined\else
7692 % indent a bit.
7693 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7694 \fi
7695 {\parskip=0pt \afterenvbreak}%
7696 }
7697 \def\Esmallquotation{\Equotation}
7698
7699 % If we're given an argument, typeset it in bold with a colon after.
7700 \def\quotationlabel#1{%
7701 \def\temp{#1}%
7702 \ifx\temp\empty \else
7703 {\bf #1: }%
7704 \fi
7705 }
7706
7707 % @indentedblock is like @quotation, but indents only on the left and
7708 % has no optional argument.
7709 %
7710 \makedispenvdef{indentedblock}{\indentedblockstart}
7711 %
7712 \def\indentedblockstart{%
7713 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7714 \parindent=0pt
7715 %
7716 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7717 \ifx\nonarrowing\relax
7718 \advance\leftskip by \lispnarrowing
7719 \exdentamount = \lispnarrowing
7720 \else
7721 \let\nonarrowing = \relax
7722 \fi
7723 }
7724
7725 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7726 %
7727 \def\Eindentedblock{%
7728 \par
7729 {\parskip=0pt \afterenvbreak}%
7730 }
7731 \def\Esmallindentedblock{\Eindentedblock}
7732
7733
7734 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7735 % If we want to allow any <char> as delimiter,
7736 % we need the curly braces so that makeinfo sees the @verb command, eg:
7737 % `@verbx...x' would look like the '@verbx' command. [email protected]
7738 %
7739 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7740 %
7741 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7742 % active too. Otherwise, they get lost as the first character on a
7743 % verbatim line.
7744 \def\dospecials{%
7745 \do\ \do\\\do\{\do\}\do\$\do\&%
7746 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7747 \do\<\do\>\do\|\do\@\do+\do\"%
7748 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7749 % @set txicodequotebacktick will not have effect on @verb and
7750 % @verbatim, and ?` and !` ligatures won't get disabled.
7751 %\do\`\do\'%
7752 }
7753 %
7754 % [Knuth] p. 380
7755 \def\uncatcodespecials{%
7756 \def\do##1{\catcode`##1=\other}\dospecials}
7757 %
7758 % Setup for the @verb command.
7759 %
7760 % Eight spaces for a tab
7761 \begingroup
7762 \catcode`\^^I=\active
7763 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7764 \endgroup
7765 %
7766 \def\setupverb{%
7767 \tt
7768 \def\par{\leavevmode\endgraf}%
7769 \parindent = 0pt
7770 \setcodequotes
7771 \tabeightspaces
7772 % Respect line breaks,
7773 % print special symbols as themselves, and
7774 % make each space count
7775 % must do in this order:
7776 \obeylines \uncatcodespecials \sepspaces
7777 }
7778
7779 % Setup for the @verbatim environment
7780 %
7781 % Real tab expansion.
7782 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7783 %
7784 % We typeset each line of the verbatim in an \hbox, so we can handle
7785 % tabs.
7786 \newbox\verbbox
7787 \def\starttabbox{\setbox\verbbox=\hbox\bgroup}
7788 %
7789 \begingroup
7790 \catcode`\^^I=\active
7791 \gdef\tabexpand{%
7792 \catcode`\^^I=\active
7793 \def^^I{\leavevmode\egroup
7794 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7795 \divide\dimen\verbbox by\tabw
7796 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7797 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7798 \wd\verbbox=\dimen\verbbox
7799 \leavevmode\box\verbbox \starttabbox
7800 }%
7801 }
7802 \endgroup
7803
7804 % start the verbatim environment.
7805 \def\setupverbatim{%
7806 \let\nonarrowing = t%
7807 \nonfillstart
7808 \tt % easiest (and conventionally used) font for verbatim
7809 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
7810 \tabexpand
7811 \setcodequotes
7812 % Respect line breaks,
7813 % print special symbols as themselves, and
7814 % make each space count.
7815 % Must do in this order:
7816 \obeylines \uncatcodespecials \sepspaces
7817 }
7818
7819 % Do the @verb magic: verbatim text is quoted by unique
7820 % delimiter characters. Before first delimiter expect a
7821 % right brace, after last delimiter expect closing brace:
7822 %
7823 % \def\doverb'{'<char>#1<char>'}'{#1}
7824 %
7825 % [Knuth] p. 382; only eat outer {}
7826 \begingroup
7827 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7828 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7829 \endgroup
7830 %
7831 \def\verb{\begingroup\setupverb\doverb}
7832 %
7833 %
7834 % Do the @verbatim magic: define the macro \doverbatim so that
7835 % the (first) argument ends when '@end verbatim' is reached, ie:
7836 %
7837 % \def\doverbatim#1@end verbatim{#1}
7838 %
7839 % For Texinfo it's a lot easier than for LaTeX,
7840 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7841 % we need not redefine '\', '{' and '}'.
7842 %
7843 % Inspired by LaTeX's verbatim command set [latex.ltx]
7844 %
7845 \begingroup
7846 \catcode`\ =\active
7847 \obeylines %
7848 % ignore everything up to the first ^^M, that's the newline at the end
7849 % of the @verbatim input line itself. Otherwise we get an extra blank
7850 % line in the output.
7851 \xdef\doverbatim#1^^M#2@end verbatim{%
7852 \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
7853 % We really want {...\end verbatim} in the body of the macro, but
7854 % without the active space; thus we have to use \xdef and \gobble.
7855 % The \egroup ends the \verbbox started at the end of the last line in
7856 % the block.
7857 \endgroup
7858 %
7859 \envdef\verbatim{%
7860 \setnormaldispenv\setupverbatim\doverbatim
7861 }
7862 \let\Everbatim = \afterenvbreak
7863
7864
7865 % @verbatiminclude FILE - insert text of file in verbatim environment.
7866 %
7867 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7868 %
7869 \def\doverbatiminclude#1{%
7870 {%
7871 \makevalueexpandable
7872 \setupverbatim
7873 {%
7874 \indexnofonts % Allow `@@' and other weird things in file names.
7875 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7876 \edef\tmp{\noexpand\input #1 }
7877 \expandafter
7878 }\expandafter\starttabbox\tmp\egroup
7879 \afterenvbreak
7880 }%
7881 }
7882
7883 % @copying ... @end copying.
7884 % Save the text away for @insertcopying later.
7885 %
7886 % We save the uninterpreted tokens, rather than creating a box.
7887 % Saving the text in a box would be much easier, but then all the
7888 % typesetting commands (@smallbook, font changes, etc.) have to be done
7889 % beforehand -- and a) we want @copying to be done first in the source
7890 % file; b) letting users define the frontmatter in as flexible order as
7891 % possible is desirable.
7892 %
7893 \def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying}
7894 {\catcode`\ =\other
7895 \gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7896 }
7897 \let\copyingtext\relax
7898
7899 \def\insertcopying{%
7900 \begingroup
7901 \parindent = 0pt % paragraph indentation looks wrong on title page
7902 \scanexp\copyingtext
7903 \endgroup
7904 }
7905
7906 \def\publication{\checkenv{}\begingroup\macrobodyctxt\dopublication}
7907 {\catcode`\ =\other
7908 \gdef\dopublication#1@end publication{\endgroup\def\publicationtext{#1}}
7909 }
7910 \let\publicationtext\relax
7911
7912 \def\insertpublication{%
7913 \begingroup
7914 \parindent = 0pt % paragraph indentation looks wrong on title page
7915 \scanexp\publicationtext
7916 \endgroup
7917 }
7918
7919 \message{defuns,}
7920 % @defun etc.
7921
7922 \newskip\defbodyindent \defbodyindent=.4in
7923 \newskip\defargsindent \defargsindent=50pt
7924 \newskip\deflastargmargin \deflastargmargin=18pt
7925 \newcount\defunpenalty
7926
7927 % Start the processing of @deffn:
7928 \def\startdefun{%
7929 \ifnum\lastpenalty<10000
7930 \medbreak
7931 \defunpenalty=10003 % Will keep this @deffn together with the
7932 % following @def command, see below.
7933 \else
7934 % If there are two @def commands in a row, we'll have a \nobreak,
7935 % which is there to keep the function description together with its
7936 % header. But if there's nothing but headers, we need to allow a
7937 % break somewhere. Check specifically for penalty 10002, inserted
7938 % by \printdefunline, instead of 10000, since the sectioning
7939 % commands also insert a nobreak penalty, and we don't want to allow
7940 % a break between a section heading and a defun.
7941 %
7942 % As a further refinement, we avoid "club" headers by signalling
7943 % with penalty of 10003 after the very first @deffn in the
7944 % sequence (see above), and penalty of 10002 after any following
7945 % @def command.
7946 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7947 %
7948 % Similarly, after a section heading, do not allow a break.
7949 % But do insert the glue.
7950 \medskip % preceded by discardable penalty, so not a breakpoint
7951 \fi
7952 %
7953 \parindent=0in
7954 \advance\leftskip by \defbodyindent
7955 \exdentamount=\defbodyindent
7956 }
7957
7958 % Called as \printdefunline \deffooheader{text}
7959 %
7960 \def\printdefunline#1#2{%
7961 \begingroup
7962 \plainfrenchspacing
7963 % call \deffooheader:
7964 #1#2 \endheader
7965 % common ending:
7966 \interlinepenalty = 10000
7967 \advance\rightskip by 0pt plus 1fil\relax
7968 \endgraf
7969 \nobreak\vskip -\parskip
7970 \penalty\defunpenalty % signal to \startdefun and \deffoox
7971 % Some of the @defun-type tags do not enable magic parentheses,
7972 % rendering the following check redundant. But we don't optimize.
7973 \checkparencounts
7974 \endgroup
7975 }
7976
7977 \def\Edefun{\endgraf\medbreak}
7978
7979 % @defblock, @defline do not automatically create index entries
7980 \envdef\defblock{%
7981 \startdefun
7982 }
7983 \let\Edefblock\Edefun
7984
7985 \def\defline{%
7986 \doingtypefnfalse
7987 \parseargusing\activeparens{\printdefunline\deflineheader}%
7988 }
7989 \def\deflineheader#1 #2 #3\endheader{%
7990 \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
7991 }
7992
7993 \def\deftypeline{%
7994 \doingtypefntrue
7995 \parseargusing\activeparens{\printdefunline\deftypelineheader}%
7996 }
7997 \def\deftypelineheader#1 #2 #3 #4\endheader{%
7998 \printdefname{#1}{#2}{#3}\magicamp\defunargs{#4\unskip}%
7999 }
8000
8001 % \makedefun{deffoo} (\deffooheader parameters) { (\deffooheader expansion) }
8002 %
8003 % Define \deffoo, \deffoox \Edeffoo and \deffooheader.
8004 \def\makedefun#1{%
8005 \expandafter\let\csname E#1\endcsname = \Edefun
8006 \edef\temp{\noexpand\domakedefun
8007 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
8008 \temp
8009 }
8010 \def\domakedefun#1#2#3{%
8011 \envdef#1{%
8012 \startdefun
8013 \doingtypefnfalse % distinguish typed functions from all else
8014 \parseargusing\activeparens{\printdefunline#3}%
8015 }%
8016 \def#2{%
8017 % First, check whether we are in the right environment:
8018 \checkenv#1%
8019 %
8020 % As in \startdefun, allow line break if we have multiple x headers
8021 % in a row. It's not a great place, though.
8022 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
8023 %
8024 \doingtypefnfalse % distinguish typed functions from all else
8025 \parseargusing\activeparens{\printdefunline#3}%
8026 }%
8027 \def#3% definition of \deffooheader follows
8028 }
8029
8030 \newif\ifdoingtypefn % doing typed function?
8031 \newif\ifrettypeownline % typeset return type on its own line?
8032
8033 % @deftypefnnewline on|off says whether the return type of typed functions
8034 % are printed on their own line. This affects @deftypefn, @deftypefun,
8035 % @deftypeop, and @deftypemethod.
8036 %
8037 \parseargdef\deftypefnnewline{%
8038 \def\temp{#1}%
8039 \ifx\temp\onword
8040 \expandafter\let\csname SETtxideftypefnnl\endcsname
8041 = \empty
8042 \else\ifx\temp\offword
8043 \expandafter\let\csname SETtxideftypefnnl\endcsname
8044 = \relax
8045 \else
8046 \errhelp = \EMsimple
8047 \errmessage{Unknown @txideftypefnnl value `\temp',
8048 must be on|off}%
8049 \fi\fi
8050 }
8051
8052 % Untyped functions:
8053
8054 % @deffn category name args
8055 \makedefun{deffn}#1 #2 #3\endheader{%
8056 \doind{fn}{\code{#2}}%
8057 \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
8058 }
8059
8060 % @defop category class name args
8061 \makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
8062 \def\defopheaderx#1#2 #3 #4\endheader{%
8063 \doind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
8064 \printdefname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
8065 }
8066
8067 % Typed functions:
8068
8069 % @deftypefn category type name args
8070 \makedefun{deftypefn}#1 #2 #3 #4\endheader{%
8071 \doind{fn}{\code{#3}}%
8072 \doingtypefntrue
8073 \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
8074 }
8075
8076 % @deftypeop category class type name args
8077 \makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
8078 \def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
8079 \doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
8080 \doingtypefntrue
8081 \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
8082 }
8083
8084 % Typed variables:
8085
8086 % @deftypevr category type var args
8087 \makedefun{deftypevr}#1 #2 #3 #4\endheader{%
8088 \doind{vr}{\code{#3}}%
8089 \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
8090 }
8091
8092 % @deftypecv category class type var args
8093 \makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
8094 \def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
8095 \doind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
8096 \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
8097 }
8098
8099 % Untyped variables:
8100
8101 % @defvr category var args
8102 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
8103
8104 % @defcv category class var args
8105 \makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}}
8106 \def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} }
8107
8108 % Types:
8109
8110 % @deftp category name args
8111 \makedefun{deftp}#1 #2 #3\endheader{%
8112 \doind{tp}{\code{#2}}%
8113 \printdefname{#1}{}{#2}\defunargs{#3\unskip}%
8114 }
8115
8116 % Remaining @defun-like shortcuts:
8117 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
8118 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
8119 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
8120 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
8121 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
8122 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
8123 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
8124 \makedefun{defmethod}{\defopheaderx\putwordMethodon}
8125 \makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon}
8126 \makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof}
8127 \makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof}
8128
8129 % \printdefname, which formats the name of the @def (not the args).
8130 % #1 is the category, such as "Function".
8131 % #2 is the return type, if any.
8132 % #3 is the function name.
8133 %
8134 % We are followed by (but not passed) the arguments, if any.
8135 %
8136 \def\printdefname#1#2#3{%
8137 \par
8138 % Get the values of \leftskip and \rightskip as they were outside the @def...
8139 \advance\leftskip by -\defbodyindent
8140 %
8141 % Determine if we are typesetting the return type of a typed function
8142 % on a line by itself.
8143 \rettypeownlinefalse
8144 \ifdoingtypefn % doing a typed function specifically?
8145 % then check user option for putting return type on its own line:
8146 \ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}%
8147 \fi
8148 %
8149 % How we'll format the category name. Putting it in brackets helps
8150 % distinguish it from the body text that may end up on the next line
8151 % just below it.
8152 \def\temp{#1}%
8153 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
8154 %
8155 % Figure out line sizes for the paragraph shape. We'll always have at
8156 % least two.
8157 \tempnum = 2
8158 %
8159 % The first line needs space for \box0; but if \rightskip is nonzero,
8160 % we need only space for the part of \box0 which exceeds it:
8161 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
8162 %
8163 % If doing a return type on its own line, we'll have another line.
8164 \ifrettypeownline
8165 \advance\tempnum by 1
8166 \def\maybeshapeline{0in \hsize}%
8167 \else
8168 \def\maybeshapeline{}%
8169 \fi
8170 %
8171 % The continuations:
8172 \dimen2=\hsize \advance\dimen2 by -\defargsindent
8173 %
8174 % The final paragraph shape:
8175 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
8176 %
8177 % Put the category name at the right margin.
8178 \noindent
8179 \hbox to 0pt{%
8180 \hfil\box0 \kern-\hsize
8181 % \hsize has to be shortened this way:
8182 \kern\leftskip
8183 % Intentionally do not respect \rightskip, since we need the space.
8184 }%
8185 %
8186 % Allow all lines to be underfull without complaint:
8187 \tolerance=10000 \hbadness=10000
8188 \exdentamount=\defbodyindent
8189 {%
8190 \def\^^M{}% for line continuation
8191 %
8192 % defun fonts. We use typewriter by default (used to be bold) because:
8193 % . we're printing identifiers, they should be in tt in principle.
8194 % . in languages with many accents, such as Czech or French, it's
8195 % common to leave accents off identifiers. The result looks ok in
8196 % tt, but exceedingly strange in rm.
8197 % . we don't want -- and --- to be treated as ligatures.
8198 % . this still does not fix the ?` and !` ligatures, but so far no
8199 % one has made identifiers using them :).
8200 \df \tt
8201 \def\temp{#2}% text of the return type
8202 \ifx\temp\empty\else
8203 \tclose{\temp}% typeset the return type
8204 \ifrettypeownline
8205 % put return type on its own line; prohibit line break following:
8206 \hfil\vadjust{\nobreak}\break
8207 \else
8208 \space % type on same line, so just followed by a space
8209 \fi
8210 \fi % no return type
8211 #3% output function name
8212 }%
8213 \ifflagclear{txidefnamenospace}{%
8214 {\rm\enskip}% hskip 0.5 em of \rmfont
8215 }{}%
8216 %
8217 \parenbrackglyphs
8218 % arguments will be output next, if any.
8219 }
8220
8221 % Print arguments. Use slanted for @def*, typewriter for @deftype*.
8222 \def\defunargs#1{%
8223 \bgroup
8224 \def\^^M{}% for line continuation
8225 \df \ifdoingtypefn \tt \else \sl \fi
8226 \ifflagclear{txicodevaristt}{}%
8227 % use \ttsl for @var in both @def* and @deftype*.
8228 % the kern prevents an italic correction at end, which appears
8229 % too much for ttsl.
8230 {\def\var##1{{\setregularquotes \ttsl ##1\kern 0pt }}}%
8231 #1%
8232 \egroup
8233 }
8234
8235 % We want ()&[] to print specially on the defun line.
8236 %
8237 \def\activeparens{%
8238 \catcode`\(=\active \catcode`\)=\active
8239 \catcode`\[=\active \catcode`\]=\active
8240 \catcode`\&=\active
8241 }
8242
8243 % Make control sequences which act like normal parenthesis chars.
8244 \let\lparen = ( \let\rparen = )
8245
8246 % Be sure that we always have a definition for `(', etc. For example,
8247 % if the fn name has parens in it, \parenbrackglyphs will not be in
8248 % effect yet, so TeX would otherwise complain about undefined control
8249 % sequence.
8250 {
8251 \activeparens
8252 \gdef\defcharsdefault{%
8253 \let(=\lparen \let)=\rparen
8254 \let[=\lbrack \let]=\rbrack
8255 \let& = \&%
8256 }
8257 \globaldefs=1 \defcharsdefault
8258
8259 \gdef\parenbrackglyphs{\let(=\opnr\let)=\cpnr\let[=\lbrb\let]=\rbrb}
8260 \gdef\magicamp{\let&=\amprm}
8261 }
8262 \let\ampchar\&
8263
8264 \def\amprm#1 {{\rm\&#1 }}
8265
8266 \newcount\parencount
8267 % opening and closing parentheses in roman font
8268 \def\opnr{%
8269 \ptexslash % italic correction
8270 \global\advance\parencount by 1
8271 {\sf(}%
8272 }
8273 \def\cpnr{%
8274 \ptexslash % italic correction
8275 {\sf)}%
8276 \global\advance\parencount by -1
8277 }
8278
8279 \newcount\brackcount
8280 % left and right square brackets in bold font
8281 \def\lbrb{%
8282 \global\advance\brackcount by 1
8283 {\bf[}%
8284 }
8285 \def\rbrb{%
8286 {\bf]}%
8287 \global\advance\brackcount by -1
8288 }
8289
8290 \def\checkparencounts{%
8291 \ifnum\parencount=0 \else \badparencount \fi
8292 \ifnum\brackcount=0 \else \badbrackcount \fi
8293 }
8294 % these should not use \errmessage; the glibc manual, at least, actually
8295 % has such constructs (when documenting function pointers).
8296 \def\badparencount{%
8297 \message{Warning: unbalanced parentheses in @def...}%
8298 \global\parencount=0
8299 }
8300 \def\badbrackcount{%
8301 \message{Warning: unbalanced square brackets in @def...}%
8302 \global\brackcount=0
8303 }
8304
8305
8306 \message{macros,}
8307 % @macro.
8308
8309 % To do this right we need a feature of e-TeX, \scantokens,
8310 % which we arrange to emulate with a temporary file in ordinary TeX.
8311 \ifx\eTeXversion\thisisundefined
8312 \newwrite\macscribble
8313 \def\scantokens#1{%
8314 \toks0={#1}%
8315 \immediate\openout\macscribble=\jobname.tmp
8316 \immediate\write\macscribble{\the\toks0}%
8317 \immediate\closeout\macscribble
8318 \input \jobname.tmp
8319 }
8320 \fi
8321
8322 % Used at the time of macro expansion.
8323 % Argument is macro body with arguments substituted
8324 \def\scanmacro#1{%
8325 \newlinechar`\^^M
8326 \def\xeatspaces##1{\eatleadingcrthen\eatspaces{##1}}%
8327 %
8328 % Process the macro body under the current catcode regime.
8329 \scantokens{#1@comment}%
8330 %
8331 % The \comment is to remove the \newlinechar added by \scantokens, and
8332 % can be noticed by \parsearg. Note \c isn't used because this means cedilla
8333 % in math mode.
8334 }
8335
8336 % Used for copying and captions
8337 \def\scanexp#1{%
8338 \expandafter\scanmacro\expandafter{#1}%
8339 }
8340
8341 \newcount\paramno % Count of parameters
8342 \newtoks\macname % Macro name
8343 \newif\ifrecursive % Is it recursive?
8344
8345 % List of all defined macros in the form
8346 % \commondummyword\macro1\commondummyword\macro2...
8347 % Currently is also contains all @aliases; the list can be split
8348 % if there is a need.
8349 \def\macrolist{}
8350
8351 % Add the macro to \macrolist
8352 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
8353 \def\addtomacrolistxxx#1{%
8354 \toks0 = \expandafter{\macrolist\commondummyword#1}%
8355 \xdef\macrolist{\the\toks0}%
8356 }
8357
8358 % Utility routines.
8359 % This does \let #1 = #2, with \csnames; that is,
8360 % \let \csname#1\endcsname = \csname#2\endcsname
8361 % (except of course we have to play expansion games).
8362 %
8363 \def\cslet#1#2{%
8364 \expandafter\let
8365 \csname#1\expandafter\endcsname
8366 \csname#2\endcsname
8367 }
8368
8369 % Trim leading and trailing spaces off a string.
8370 % Concepts from aro-bend problem 15 (see CTAN).
8371 {\catcode`\@=11
8372 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
8373 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
8374 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
8375 \def\unbrace#1{#1}
8376 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
8377 }
8378
8379 % Trim a single leading ^^M off a string, then call #1
8380 {\catcode`\^^M=\active \catcode`\Q=3%
8381 \gdef\eatleadingcrthen #1#2{\eatlcra #1Q#2Q^^MQ}%
8382 \gdef\eatlcra #1#2Q^^M{\eatlcrb #1#2Q}%
8383 \gdef\eatlcrb #1Q#2Q#3Q{#1{#2}}%
8384 }
8385
8386 % Trim a single trailing ^^M off a string.
8387 {\catcode`\^^M=\other \catcode`\Q=3%
8388 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8389 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8390 \gdef\eatcrb#1Q#2Q{#1}%
8391 }
8392
8393 % Macro bodies are absorbed as an argument in a context where
8394 % all characters are catcode 10, 11 or 12, except \ which is active
8395 % (as in normal texinfo). It is necessary to change the definition of \
8396 % to recognize macro arguments; this is the job of \mbodybackslash.
8397 %
8398 % Non-ASCII encodings make 8-bit characters active, so un-activate
8399 % them to avoid their expansion. Must do this non-globally, to
8400 % confine the change to the current group.
8401 %
8402 % It's necessary to have hard CRs when the macro is executed. This is
8403 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8404 % body, and then making it the \newlinechar in \scanmacro.
8405 %
8406 \def\scanctxt{% used as subroutine
8407 \catcode`\"=\other
8408 \catcode`\+=\other
8409 \catcode`\<=\other
8410 \catcode`\>=\other
8411 \catcode`\^=\other
8412 \catcode`\_=\other
8413 \catcode`\|=\other
8414 \catcode`\~=\other
8415 \catcode`\@=\other
8416 \catcode`\^^M=\other
8417 \catcode`\\=\active
8418 \passthroughcharstrue
8419 }
8420
8421 \def\macrobodyctxt{% used for @macro definitions and @copying
8422 \scanctxt
8423 \catcode`\ =\other
8424 \catcode`\{=\other
8425 \catcode`\}=\other
8426 }
8427
8428 % Used when scanning braced macro arguments. Note, however, that catcode
8429 % changes here are ineffectual if the macro invocation was nested inside
8430 % an argument to another Texinfo command.
8431 \def\macroargctxt{%
8432 \scanctxt
8433 \catcode`\ =\active
8434 }
8435
8436 \def\macrolineargctxt{% used for whole-line arguments without braces
8437 \scanctxt
8438 \catcode`\{=\other
8439 \catcode`\}=\other
8440 }
8441
8442 % \mbodybackslash is the definition of \ in @macro bodies.
8443 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8444 % where N is the macro parameter number.
8445 % We define \csname macarg.\endcsname to be \realbackslash, so
8446 % \\ in macro replacement text gets you a backslash.
8447 %
8448 {\catcode`@=0 @catcode`@\=@active
8449 @gdef@usembodybackslash{@let\=@mbodybackslash}
8450 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8451 }
8452 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8453
8454 \def\margbackslash#1{\char`\#1 }
8455
8456 \def\macro{\recursivefalse\parsearg\macroxxx}
8457 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8458
8459 \def\macroxxx#1{%
8460 \getargs{#1}% now \macname is the macname and \argl the arglist
8461 \ifx\argl\empty % no arguments
8462 \paramno=0\relax
8463 \else
8464 \expandafter\parsemargdef \argl;%
8465 \if\paramno>256\relax
8466 \ifx\eTeXversion\thisisundefined
8467 \errhelp = \EMsimple
8468 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8469 \fi
8470 \fi
8471 \fi
8472 \if1\csname ismacro.\the\macname\endcsname
8473 \message{Warning: redefining \the\macname}%
8474 \else
8475 \expandafter\ifx\csname \the\macname\endcsname \relax
8476 \else \errmessage{Macro name \the\macname\space already defined}\fi
8477 \global\cslet{macsave.\the\macname}{\the\macname}%
8478 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8479 \addtomacrolist{\the\macname}%
8480 \fi
8481 \begingroup \macrobodyctxt \usembodybackslash
8482 \ifrecursive \expandafter\parsermacbody
8483 \else \expandafter\parsemacbody
8484 \fi}
8485
8486 \parseargdef\unmacro{%
8487 \if1\csname ismacro.#1\endcsname
8488 \global\cslet{#1}{macsave.#1}%
8489 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8490 % Remove the macro name from \macrolist:
8491 \begingroup
8492 \expandafter\let\csname#1\endcsname \relax
8493 \let\commondummyword\unmacrodo
8494 \xdef\macrolist{\macrolist}%
8495 \endgroup
8496 \fi
8497 }
8498
8499 % Called by \do from \dounmacro on each macro. The idea is to omit any
8500 % macro definitions that have been changed to \relax.
8501 %
8502 \def\unmacrodo#1{%
8503 \ifx #1\relax
8504 % remove this
8505 \else
8506 \noexpand\commondummyword \noexpand#1%
8507 \fi
8508 }
8509
8510 % \getargs -- Parse the arguments to a @macro line. Set \macname to
8511 % the name of the macro, and \argl to the braced argument list.
8512 \def\getargs#1{\getargsxxx#1{}}
8513 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8514 \def\getmacname#1 #2\relax{\macname={#1}}
8515 \def\getmacargs#1{\def\argl{#1}}
8516 % This made use of the feature that if the last token of a
8517 % <parameter list> is #, then the preceding argument is delimited by
8518 % an opening brace, and that opening brace is not consumed.
8519
8520 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8521 \edef\texiatcatcode{\the\catcode`\@}
8522 \catcode `@=11\relax
8523
8524 % Parse the optional {params} list to @macro or @rmacro.
8525 % Set \paramno to the number of arguments,
8526 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8527 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
8528 % list to some hook where the argument is to be expanded. If there are
8529 % less than 10 arguments that hook is to be replaced by ##N where N
8530 % is the position in that list, that is to say the macro arguments are to be
8531 % defined `a la TeX in the macro body.
8532 %
8533 % That gets used by \mbodybackslash (above).
8534 %
8535 % If there are 10 or more arguments, a different technique is used: see
8536 % \parsemmanyargdef@@.
8537 %
8538 \def\parsemargdef#1;{%
8539 \paramno=0\def\paramlist{}%
8540 \let\hash\relax
8541 % \hash is redefined to `#' later to get it into definitions
8542 \let\xeatspaces\relax
8543 \parsemargdefxxx#1,;,%
8544 \ifnum\paramno<10\relax\else
8545 \paramno0\relax
8546 \parsemmanyargdef@@#1,;,% 10 or more arguments
8547 \fi
8548 }
8549 \def\parsemargdefxxx#1,{%
8550 \if#1;\let\next=\relax
8551 \else \let\next=\parsemargdefxxx
8552 \advance\paramno by 1
8553 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8554 {\xeatspaces{\hash\the\paramno}}%
8555 \edef\paramlist{\paramlist\hash\the\paramno,}%
8556 \fi\next}
8557
8558 % \parsemacbody, \parsermacbody
8559 %
8560 % Read recursive and nonrecursive macro bodies. (They're different since
8561 % rec and nonrec macros end differently.)
8562 %
8563 % We are in \macrobodyctxt, and the \xdef causes backslashes in the macro
8564 % body to be transformed.
8565 % Set \macrobody to the body of the macro, and call \macrodef.
8566 %
8567 \catcode `\@\texiatcatcode
8568 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8569 \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
8570 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8571 \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
8572 \catcode `\@=11\relax
8573
8574 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8575
8576 % If there are 10 or more arguments, a different technique is used, where the
8577 % hook remains in the body, and when macro is to be expanded the body is
8578 % processed again to replace the arguments.
8579 %
8580 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8581 % argument N value and then \edef the body (nothing else will expand because of
8582 % the catcode regime under which the body was input).
8583 %
8584 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8585 % arguments, no macro can have more than 256 arguments (else error).
8586 %
8587 % In case that there are 10 or more arguments we parse again the arguments
8588 % list to set new definitions for the \macarg.BLAH macros corresponding to
8589 % each BLAH argument. It was anyhow needed to parse already once this list
8590 % in order to count the arguments, and as macros with at most 9 arguments
8591 % are by far more frequent than macro with 10 or more arguments, defining
8592 % twice the \macarg.BLAH macros does not cost too much processing power.
8593 \def\parsemmanyargdef@@#1,{%
8594 \if#1;\let\next=\relax
8595 \else
8596 \let\next=\parsemmanyargdef@@
8597 \edef\tempb{\eatspaces{#1}}%
8598 \expandafter\def\expandafter\tempa
8599 \expandafter{\csname macarg.\tempb\endcsname}%
8600 % Note that we need some extra \noexpand\noexpand, this is because we
8601 % don't want \the to be expanded in the \parsermacbody as it uses an
8602 % \xdef .
8603 \expandafter\edef\tempa
8604 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8605 \advance\paramno by 1\relax
8606 \fi\next}
8607
8608
8609 \let\endargs@\relax
8610 \let\nil@\relax
8611 \def\nilm@{\nil@}%
8612 \long\def\nillm@{\nil@}%
8613
8614 % This macro is expanded during the Texinfo macro expansion, not during its
8615 % definition. It gets all the arguments' values and assigns them to macros
8616 % macarg.ARGNAME
8617 %
8618 % #1 is the macro name
8619 % #2 is the list of argument names
8620 % #3 is the list of argument values
8621 \def\getargvals@#1#2#3{%
8622 \def\macargdeflist@{}%
8623 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8624 \def\paramlist{#2,\nil@}%
8625 \def\macroname{#1}%
8626 \begingroup
8627 \macroargctxt
8628 \def\argvaluelist{#3,\nil@}%
8629 \def\@tempa{#3}%
8630 \ifx\@tempa\empty
8631 \setemptyargvalues@
8632 \else
8633 \getargvals@@
8634 \fi
8635 }
8636 \def\getargvals@@{%
8637 \ifx\paramlist\nilm@
8638 % Some sanity check needed here that \argvaluelist is also empty.
8639 \ifx\argvaluelist\nillm@
8640 \else
8641 \errhelp = \EMsimple
8642 \errmessage{Too many arguments in macro `\macroname'!}%
8643 \fi
8644 \let\next\macargexpandinbody@
8645 \else
8646 \ifx\argvaluelist\nillm@
8647 % No more arguments values passed to macro. Set remaining named-arg
8648 % macros to empty.
8649 \let\next\setemptyargvalues@
8650 \else
8651 % pop current arg name into \@tempb
8652 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8653 \expandafter\@tempa\expandafter{\paramlist}%
8654 % pop current argument value into \@tempc
8655 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8656 \expandafter\@tempa\expandafter{\argvaluelist}%
8657 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8658 % First place the new argument macro definition into \@tempd
8659 \expandafter\macname\expandafter{\@tempc}%
8660 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8661 \expandafter\def\expandafter\@tempe\expandafter{%
8662 \csname macarg.\@tempb\endcsname}%
8663 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8664 \push@\@tempd\macargdeflist@
8665 \let\next\getargvals@@
8666 \fi
8667 \fi
8668 \next
8669 }
8670
8671 \def\push@#1#2{%
8672 \expandafter\expandafter\expandafter\def
8673 \expandafter\expandafter\expandafter#2%
8674 \expandafter\expandafter\expandafter{%
8675 \expandafter#1#2}%
8676 }
8677
8678 % Replace arguments by their values in the macro body, and place the result
8679 % in macro \@tempa.
8680 %
8681 \def\macvalstoargs@{%
8682 % To do this we use the property that token registers that are \the'ed
8683 % within an \edef expand only once. So we are going to place all argument
8684 % values into respective token registers.
8685 %
8686 % First we save the token context, and initialize argument numbering.
8687 \begingroup
8688 \paramno0\relax
8689 % Then, for each argument number #N, we place the corresponding argument
8690 % value into a new token list register \toks#N
8691 \expandafter\putargsintokens@\saveparamlist@,;,%
8692 % Then, we expand the body so that argument are replaced by their
8693 % values. The trick for values not to be expanded themselves is that they
8694 % are within tokens and that tokens expand only once in an \edef .
8695 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8696 % Now we restore the token stack pointer to free the token list registers
8697 % which we have used, but we make sure that expanded body is saved after
8698 % group.
8699 \expandafter
8700 \endgroup
8701 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8702 }
8703
8704 % Define the named-macro outside of this group and then close this group.
8705 %
8706 \def\macargexpandinbody@{%
8707 \expandafter
8708 \endgroup
8709 \macargdeflist@
8710 % First the replace in body the macro arguments by their values, the result
8711 % is in \@tempa .
8712 \macvalstoargs@
8713 % Then we point at the \norecurse or \gobble (for recursive) macro value
8714 % with \@tempb .
8715 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8716 % Depending on whether it is recursive or not, we need some tailing
8717 % \egroup .
8718 \ifx\@tempb\gobble
8719 \let\@tempc\relax
8720 \else
8721 \let\@tempc\egroup
8722 \fi
8723 % And now we do the real job:
8724 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8725 \@tempd
8726 }
8727
8728 \def\putargsintokens@#1,{%
8729 \if#1;\let\next\relax
8730 \else
8731 \let\next\putargsintokens@
8732 % First we allocate the new token list register, and give it a temporary
8733 % alias \@tempb .
8734 \toksdef\@tempb\the\paramno
8735 % Then we place the argument value into that token list register.
8736 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8737 \expandafter\@tempb\expandafter{\@tempa}%
8738 \advance\paramno by 1\relax
8739 \fi
8740 \next
8741 }
8742
8743 % Trailing missing arguments are set to empty.
8744 %
8745 \def\setemptyargvalues@{%
8746 \ifx\paramlist\nilm@
8747 \let\next\macargexpandinbody@
8748 \else
8749 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8750 \let\next\setemptyargvalues@
8751 \fi
8752 \next
8753 }
8754
8755 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8756 \expandafter\def\expandafter\@tempa\expandafter{%
8757 \expandafter\def\csname macarg.#1\endcsname{}}%
8758 \push@\@tempa\macargdeflist@
8759 \def\paramlist{#2}%
8760 }
8761
8762 % #1 is the element target macro
8763 % #2 is the list macro
8764 % #3,#4\endargs@ is the list value
8765 \def\pop@#1#2#3,#4\endargs@{%
8766 \def#1{#3}%
8767 \def#2{#4}%
8768 }
8769 \long\def\longpop@#1#2#3,#4\endargs@{%
8770 \long\def#1{#3}%
8771 \long\def#2{#4}%
8772 }
8773
8774
8775 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8776
8777
8778 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8779 % \macrobody has the body of the macro in it, with placeholders for
8780 % its parameters, looking like "\xeatspaces{\hash 1}".
8781 % \paramno is the number of parameters
8782 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8783 % There are four cases: macros of zero, one, up to nine, and many arguments.
8784 % \xdef is used so that macro definitions will survive the file
8785 % they're defined in: @include reads the file inside a group.
8786 %
8787 \def\macrodef{%
8788 \let\hash=##% convert placeholders to macro parameter chars
8789 \ifnum\paramno=1
8790 \long\def\xeatspaces##1{##1}%
8791 % We don't use \xeatspaces for single-argument macros, because we
8792 % want to keep ends of lines. This definition removes \xeatspaces
8793 % when \macrobody is expanded below.
8794 \else
8795 \def\xeatspaces{\string\xeatspaces}%
8796 % This expands \xeatspaces as a sequence of character tokens, which
8797 % stops \scantokens inserting an extra space after the control sequence.
8798 \fi
8799 \ifcase\paramno
8800 % 0
8801 \expandafter\xdef\csname\the\macname\endcsname{%
8802 \begingroup
8803 \noexpand\spaceisspace
8804 \noexpand\ignoreactivenewline
8805 \noexpand\expandafter % skip any whitespace after the macro name.
8806 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8807 \expandafter\xdef\csname\the\macname @@@\endcsname{%
8808 \endgroup
8809 \noexpand\scanmacro{\macrobody}}%
8810 \or % 1
8811 \expandafter\xdef\csname\the\macname\endcsname{%
8812 \begingroup
8813 \noexpand\braceorline
8814 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8815 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8816 \endgroup
8817 \noexpand\scanmacro{\macrobody}%
8818 }%
8819 \else % at most 9
8820 \ifnum\paramno<10\relax
8821 % @MACNAME sets the context for reading the macro argument
8822 % @MACNAME@@ gets the argument, processes backslashes and appends a
8823 % comma.
8824 % @MACNAME@@@ removes braces surrounding the argument list.
8825 % @MACNAME@@@@ scans the macro body with arguments substituted.
8826 \expandafter\xdef\csname\the\macname\endcsname{%
8827 \begingroup
8828 \noexpand\expandafter % This \expandafter skip any spaces after the
8829 \noexpand\macroargctxt % macro before we change the catcode of space.
8830 \noexpand\expandafter
8831 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8832 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8833 \noexpand\passargtomacro
8834 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8835 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8836 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8837 \expandaftergroup{\expandafter\xdef\csname\the\macname @@@@\endcsname}%
8838 \paramlist{%
8839 \endgroup\noexpand\scanmacro{\macrobody}}%
8840 \else % 10 or more:
8841 \expandafter\xdef\csname\the\macname\endcsname{%
8842 \noexpand\getargvals@{\the\macname}{\argl}%
8843 }%
8844 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8845 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8846 \fi
8847 \fi}
8848
8849 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8850
8851 % utility definition to avoid excessive use of \expandafter. call
8852 % as \expandaftergroup{CONTENT}\WORD to expand \WORD exactly once and remove
8853 % braces around CONTENT.
8854 \def\expandaftergroup#1#2{%
8855 \expandafter\expandaftergroupx\expandafter{#2}{#1}%
8856 }
8857 \def\expandaftergroupx#1#2{%
8858 #2#1%
8859 }
8860
8861 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8862
8863
8864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8865 %
8866 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8867 @catcode`@_=11 % private names
8868 @catcode`@!=11 % used as argument separator
8869
8870 % \passargtomacro#1#2 -
8871 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8872 % compressed to one.
8873 %
8874 % This implementation works by expansion, and not execution (so we cannot use
8875 % \def or similar). This reduces the risk of this failing in contexts where
8876 % complete expansion is done with no execution (for example, in writing out to
8877 % an auxiliary file for an index entry).
8878 %
8879 % State is kept in the input stream: the argument passed to
8880 % @look_ahead, @gobble_and_check_finish and @add_segment is
8881 %
8882 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8883 %
8884 % where:
8885 % THE_MACRO - name of the macro we want to call
8886 % ARG_RESULT - argument list we build to pass to that macro
8887 % PENDING_BS - either a backslash or nothing
8888 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8889
8890 @gdef@passargtomacro#1#2{%
8891 @add_segment #1!{}@relax#2\@_finish\%
8892 }
8893 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8894
8895 % #1 - THE_MACRO ARG_RESULT
8896 % #2 - PENDING_BS
8897 % #3 - NEXT_TOKEN
8898 % #4 used to look ahead
8899 %
8900 % If the next token is not a backslash, process the rest of the argument;
8901 % otherwise, remove the next token.
8902 @gdef@look_ahead#1!#2#3#4{%
8903 @ifx#4\%
8904 @expandafter@gobble_and_check_finish
8905 @else
8906 @expandafter@add_segment
8907 @fi#1!{#2}#4#4%
8908 }
8909
8910 % #1 - THE_MACRO ARG_RESULT
8911 % #2 - PENDING_BS
8912 % #3 - NEXT_TOKEN
8913 % #4 should be a backslash, which is gobbled.
8914 % #5 looks ahead
8915 %
8916 % Double backslash found. Add a single backslash, and look ahead.
8917 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8918 @add_segment#1\!{}#5#5%
8919 }
8920
8921 @gdef@is_fi{@fi}
8922
8923 % #1 - THE_MACRO ARG_RESULT
8924 % #2 - PENDING_BS
8925 % #3 - NEXT_TOKEN
8926 % #4 is input stream until next backslash
8927 %
8928 % Input stream is either at the start of the argument, or just after a
8929 % backslash sequence, either a lone backslash, or a doubled backslash.
8930 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8931 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8932 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8933 % a backslash just before the start of the input stream that has not been
8934 % added to ARG_RESULT.
8935 @gdef@add_segment#1!#2#3#4\{%
8936 @ifx#3@_finish
8937 @call_the_macro#1!%
8938 @else
8939 % append the pending backslash to the result, followed by the next segment
8940 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8941 % this @fi is discarded by @look_ahead.
8942 % we can't get rid of it with \expandafter because we don't know how
8943 % long #4 is.
8944 }
8945
8946 % #1 - THE_MACRO
8947 % #2 - ARG_RESULT
8948 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8949 % conditional.
8950 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8951
8952 }
8953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8954
8955 % \braceorline MAC is used for a one-argument macro MAC. It checks
8956 % whether the next non-whitespace character is a {. It sets the context
8957 % for reading the argument (slightly different in the two cases). Then,
8958 % to read the argument, in the whole-line case, it then calls the regular
8959 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8960 %
8961 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8962 \def\braceorlinexxx{%
8963 \ifx\nchar\bgroup
8964 \macroargctxt
8965 \expandafter\passargtomacro
8966 \else
8967 \macrolineargctxt\expandafter\parsearg
8968 \fi \macnamexxx}
8969
8970
8971 % @linemacro
8972
8973 \parseargdef\linemacro{%
8974 \getargs{#1}% now \macname is the macname and \argl the arglist
8975 \ifx\argl\empty
8976 \paramno=0
8977 \let\hash\relax
8978 \def\paramlist{\hash 1\endlinemacro}%
8979 \else
8980 \expandafter\linegetparamlist\argl;%
8981 \fi
8982 \begingroup \macrobodyctxt \usembodybackslash
8983 \parselinemacrobody
8984 }
8985
8986 % Build up \paramlist which will be used as the parameter text for the macro.
8987 % At the end it will be like "#1 #2 #3\endlinemacro".
8988 \def\linegetparamlist#1;{%
8989 \paramno=0\def\paramlist{}%
8990 \let\hash\relax
8991 \linegetparamlistxxx#1,;,%
8992 }
8993 \def\linegetparamlistxxx#1,{%
8994 \if#1;\let\next=\linegetparamlistxxxx
8995 \else \let\next=\linegetparamlistxxx
8996 \advance\paramno by 1
8997 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8998 {\hash\the\paramno}%
8999 \edef\paramlist{\paramlist\hash\the\paramno\space}%
9000 \fi\next}
9001 \def\linegetparamlistxxxx{%
9002 \expandafter\fixparamlist\paramlist\fixparamlist
9003 }
9004 % Replace final space token
9005 \def\fixparamlist#1 \fixparamlist{%
9006 \def\paramlist{#1\endlinemacro}%
9007 }
9008
9009 % Read the body of the macro, replacing backslash-surrounded variables
9010 %
9011 {\catcode`\ =\other\long\gdef\parselinemacrobody#1@end linemacro{%
9012 \xdef\macrobody{#1}%
9013 \endgroup
9014 \linemacrodef
9015 }}
9016
9017 % Make the definition
9018 \def\linemacrodef{%
9019 \let\hash=##%
9020 \expandafter\xdef\csname\the\macname\endcsname{%
9021 \bgroup
9022 \noexpand\parsearg
9023 \expandafter\noexpand\csname\the\macname @@\endcsname
9024 }
9025 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
9026 \egroup
9027 \expandafter\noexpand
9028 \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
9029 }
9030 \expandaftergroup{\expandafter\xdef\csname\the\macname @@@\endcsname}%
9031 \paramlist{%
9032 \newlinechar=13 % split \macrobody into lines
9033 \noexpand\scantokens{\macrobody}%
9034 }
9035 }
9036
9037
9038
9039 % @alias.
9040 % We need some trickery to remove the optional spaces around the equal
9041 % sign. Make them active and then expand them all to nothing.
9042 %
9043 \def\alias{\parseargusing\obeyspaces\aliasxxx}
9044 \def\aliasxxx #1{\aliasyyy#1\relax}
9045 \def\aliasyyy #1=#2\relax{%
9046 {%
9047 \expandafter\let\obeyedspace=\empty
9048 \addtomacrolist{#1}%
9049 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
9050 }%
9051 \next
9052 }
9053
9054
9055 \message{cross references,}
9056
9057 \newwrite\auxfile
9058 \newif\ifhavexrefs % True if xref values are known.
9059 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
9060
9061 % @inforef is relatively simple.
9062 \def\inforef #1{\inforefzzz #1,,,,**}
9063 \def\inforefzzz #1,#2,#3,#4**{%
9064 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
9065 node \samp{\ignorespaces#1{}}}
9066
9067 % @node's only job in TeX is to define \lastnode, which is used in
9068 % cross-references. The @node line might or might not have commas, and
9069 % might or might not have spaces before the first comma, like:
9070 % @node foo , bar , ...
9071 % We don't want such trailing spaces in the node name.
9072 %
9073 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
9074 %
9075 % also remove a trailing comma, in case of something like this:
9076 % @node Help-Cross, , , Cross-refs
9077 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
9078 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
9079
9080 % Used so that the @top node doesn't have to be wrapped in an @ifnottex
9081 % conditional.
9082 % \doignore goes to more effort to skip nested conditionals but we don't need
9083 % that here.
9084 \def\omittopnode{%
9085 \ifx\lastnode\wordTop
9086 \expandafter\ignorenode\fi
9087 }
9088 \def\wordTop{Top}
9089
9090 % Until the next @node, @part or @bye command, divert output to a box that
9091 % is not output.
9092 \def\ignorenode{\setbox\dummybox\vbox\bgroup
9093 \def\part{\egroup\part}%
9094 \def\node{\egroup\node}%
9095 \ignorenodebye
9096 }
9097
9098 {\let\bye\relax
9099 \gdef\ignorenodebye{\let\bye\ignorenodebyedef}
9100 \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
9101 % The redefinition of \bye here is because it is declared \outer
9102
9103 \let\lastnode=\empty
9104
9105 % Write a cross-reference definition for the current node. #1 is the
9106 % type (Ynumbered, Yappendix, Ynothing). #2 is the section title.
9107 %
9108 \def\donoderef#1#2{%
9109 \ifx\lastnode\empty\else
9110 \setref{\lastnode}{#1}{#2}%
9111 \global\let\lastnode=\empty
9112 \setnodeseenonce
9113 \fi
9114 }
9115 \def\setnodeseenonce{
9116 \global\nodeseentrue
9117 \let\setnodeseenonce\relax
9118 }
9119
9120 % @nodedescription, @nodedescriptionblock - do nothing for TeX
9121 \parseargdef\nodedescription{}
9122 \def\nodedescriptionblock{\doignore{nodedescriptionblock}}
9123
9124
9125 % @anchor{NAME} -- define xref target at arbitrary point.
9126 %
9127 \newcount\savesfregister
9128 %
9129 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
9130 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
9131 \def\anchor#1{%
9132 \savesf \setref{#1}{Yanchor}{#1}\restoresf \ignorespaces
9133 }
9134
9135 % @namedanchor{NAME, XREFNAME} -- define xref target at arbitrary point
9136 % with label text for cross-references to it.
9137 \def\namedanchor#1{\donamedanchor#1\finish}%
9138 \def\donamedanchor#1,#2\finish{%
9139 \savesf \setref{#1}{Yanchor}{\ignorespaces #2\unskip}\restoresf \ignorespaces
9140 }
9141
9142 % \setref{NAME}{SNT}{TITLE} defines a cross-reference point NAME (a node
9143 % or an anchor), which consists of three parts:
9144 % 1) NAME-title - the current sectioning name
9145 % 2) NAME-snt - section number and type, passed as the SNT arg.
9146 % 3) NAME-pg - the page number.
9147 %
9148 % This is called from \donoderef, \anchor, and \dofloat. In the case of
9149 % floats, there is an additional part, which is not written here:
9150 % 4) NAME-lof - the text as it should appear in a @listoffloats.
9151 %
9152 \def\setref#1#2#3{%
9153 \pdfmkdest{#1}%
9154 \iflinks
9155 {%
9156 \requireauxfile
9157 \atdummies % preserve commands, but don't expand them
9158 % match definition in \xrdef, \refx, \xrefX.
9159 \def\value##1{##1}%
9160 \edef\writexrdef##1##2{%
9161 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
9162 ##1}{##2}}% these are parameters of \writexrdef
9163 }%
9164 \toks0 = {#3}%
9165 \immediate \writexrdef{title}{\the\toks0 }%
9166 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
9167 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
9168 }%
9169 \fi
9170 }
9171
9172 % @xrefautosectiontitle on|off says whether @section(ing) names are used
9173 % automatically in xrefs, if the third arg is not explicitly specified.
9174 % This was provided as a "secret" @set xref-automatic-section-title
9175 % variable, now it's official.
9176 %
9177 \parseargdef\xrefautomaticsectiontitle{%
9178 \def\temp{#1}%
9179 \ifx\temp\onword
9180 \expandafter\let\csname SETxref-automatic-section-title\endcsname
9181 = \empty
9182 \else\ifx\temp\offword
9183 \expandafter\let\csname SETxref-automatic-section-title\endcsname
9184 = \relax
9185 \else
9186 \errhelp = \EMsimple
9187 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
9188 must be on|off}%
9189 \fi\fi
9190 }
9191
9192 %
9193 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
9194 % the node name, #2 the name of the Info cross-reference, #3 the printed
9195 % node name, #4 the name of the Info file, #5 the name of the printed
9196 % manual. All but the node name can be omitted.
9197 %
9198 \def\pxref{\putwordsee{} \xrefXX}
9199 \def\xref{\putwordSee{} \xrefXX}
9200 \def\ref{\xrefXX}
9201
9202 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
9203 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
9204 %
9205 \newbox\toprefbox
9206 \newbox\printedrefnamebox
9207 \newbox\infofilenamebox
9208 \newbox\printedmanualbox
9209 %
9210 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
9211 \unsepspaces
9212 %
9213 \getprintedrefname{#1}{#3}{#5}%
9214 \def\infofilename{\ignorespaces #4}%
9215 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
9216 %
9217 \startxreflink{#1}{#4}%
9218 \getrefx{#1-title}\Xthisreftitle
9219 %
9220 % Float references are printed completely differently: "Figure 1.2"
9221 % instead of "[somenode], p.3". \iffloat distinguishes them by
9222 % \Xthisreftitle being set to a magic string.
9223 \iffloat\Xthisreftitle
9224 % If the user specified the print name (third arg) to the ref,
9225 % print it instead of our usual "Figure 1.2".
9226 \ifdim\wd\printedrefnamebox = 0pt
9227 \refx{#1-snt}%
9228 \else
9229 \printedrefname
9230 \fi
9231 %
9232 % If the user also gave the printed manual name (fifth arg), append
9233 % "in MANUALNAME".
9234 \ifdim \wd\printedmanualbox > 0pt
9235 \space \putwordin{} \cite{\printedmanual}%
9236 \fi
9237 \else
9238 % node/anchor (non-float) references.
9239 %
9240 % If we use \unhbox to print the node names, TeX does not insert
9241 % empty discretionaries after hyphens, which means that it will not
9242 % find a line break at a hyphen in a node names. Since some manuals
9243 % are best written with fairly long node names, containing hyphens,
9244 % this is a loss. Therefore, we give the text of the node name
9245 % again, so it is as if TeX is seeing it for the first time.
9246 %
9247 \ifdim \wd\printedmanualbox > 0pt
9248 % Cross-manual reference with a printed manual name.
9249 %
9250 \crossmanualxref{\cite{\printedmanual\unskip}}%
9251 \else\ifdim \wd\infofilenamebox > 0pt
9252 % Cross-manual reference with only an info filename (arg 4), no
9253 % printed manual name (arg 5). This is essentially the same as
9254 % the case above; we output the filename, since we have nothing else.
9255 %
9256 \crossmanualxref{\code{\infofilename\unskip}}%
9257 \else
9258 % Reference within this manual.
9259 %
9260 % Only output a following space if the -snt ref is nonempty, as is
9261 % the case for @unnumbered and @anchor.
9262 \getrefx{#1-snt}\tmp
9263 \ifx\tmp\empty\else
9264 \ifx\tmp\Yanchor\else
9265 \tmp\space
9266 \fi
9267 \fi
9268 %
9269 % output the `[mynode]' via the macro below so it can be overridden.
9270 \xrefprintnodename\printedrefname
9271 %
9272 \ifflagclear{txiomitxrefpg}{%
9273 % We always want a comma
9274 ,%
9275 % output the `page 3'.
9276 \turnoffactive \putpageref{#1}%
9277 % Add a , if xref followed by a space
9278 \if\space\noexpand\tokenafterxref ,%
9279 \else\ifx\ \tokenafterxref ,% @TAB
9280 \else\ifx\*\tokenafterxref ,% @*
9281 \else\ifx\ \tokenafterxref ,% @SPACE
9282 \else\ifx\
9283 \tokenafterxref ,% @NL
9284 \else\ifx\tie\tokenafterxref ,% @tie
9285 \fi\fi\fi\fi\fi\fi
9286 }{}%
9287 \fi\fi
9288 \fi
9289 \endlink
9290 \endgroup}
9291
9292 % \getprintedrefname{NODE}{LABEL}{MANUAL}
9293 % - set \printedrefname and \printedmanual
9294 %
9295 \def\getprintedrefname#1#2#3{%
9296 % Get args without leading/trailing spaces.
9297 \def\printedrefname{\ignorespaces #2}%
9298 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
9299 %
9300 \def\printedmanual{\ignorespaces #3}%
9301 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
9302 %
9303 % If the printed reference name (arg #2) was not explicitly given in
9304 % the @xref, figure out what we want to use.
9305 \ifdim \wd\printedrefnamebox = 0pt
9306 % No printed node name was explicitly given.
9307 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
9308 % Not auto section-title: use node name inside the square brackets.
9309 \def\printedrefname{\ignorespaces #1}%
9310 \else
9311 % Auto section-title: use chapter/section title inside
9312 % the square brackets if we have it.
9313 \ifdim \wd\printedmanualbox > 0pt
9314 % It is in another manual, so we don't have it; use node name.
9315 \def\printedrefname{\ignorespaces #1}%
9316 \else
9317 \ifhavexrefs
9318 % We (should) know the real title if we have the xref values.
9319 \def\printedrefname{\refx{#1-title}}%
9320 \else
9321 % Otherwise just copy the Info node name.
9322 \def\printedrefname{\ignorespaces #1}%
9323 \fi
9324 \fi
9325 \fi
9326 \fi
9327 }
9328
9329 % \startxreflink{NODE}{FILE} - start link in pdf output.
9330 \def\startxreflink#1#2{%
9331 \ifpdforxetex
9332 % For pdfTeX and LuaTeX
9333 {\indexnofonts
9334 \makevalueexpandable
9335 \turnoffactive
9336 % This expands tokens, so do it after making catcode changes, so _
9337 % etc. don't get their TeX definitions. This ignores all spaces in
9338 % #2, including (wrongly) those in the middle of the filename.
9339 \getfilename{#2}%
9340 %
9341 % This (wrongly) does not take account of leading or trailing
9342 % spaces in #1, which should be ignored.
9343 \setpdfdestname{#1}%
9344 %
9345 \ifx\pdfdestname\empty
9346 \def\pdfdestname{Top}% no empty targets
9347 \fi
9348 %
9349 \leavevmode
9350 \ifpdf
9351 \startlink attr{/Border [0 0 0]}%
9352 \ifnum\filenamelength>0
9353 goto file{\the\filename.pdf} name{\pdfdestname}%
9354 \else
9355 goto name{\pdfdestname}%
9356 \fi
9357 \else % XeTeX
9358 \ifnum\filenamelength>0
9359 % With default settings,
9360 % XeTeX (xdvipdfmx) replaces link destination names with integers.
9361 % In this case, the replaced destination names of
9362 % remote PDFs are no longer known. In order to avoid a replacement,
9363 % you can use xdvipdfmx's command line option `-C 0x0010'.
9364 % If you use XeTeX 0.99996+ (TeX Live 2016+),
9365 % this command line option is no longer necessary
9366 % because we can use the `dvipdfmx:config' special.
9367 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
9368 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
9369 \else
9370 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
9371 << /S /GoTo /D (\pdfdestname) >> >>}%
9372 \fi
9373 \fi
9374 }%
9375 \setcolor{\linkcolor}%
9376 \fi
9377 }
9378
9379 % can be overridden in translation files
9380 \def\putpageref#1{%
9381 \space\putwordpage\tie\refx{#1-pg}}
9382
9383 % Output a cross-manual xref to #1. Used just above (twice).
9384 %
9385 % Only include the text "Section ``foo'' in" if the foo is neither
9386 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
9387 % "see The Foo Manual", the idea being to refer to the whole manual.
9388 %
9389 % But, this being TeX, we can't easily compare our node name against the
9390 % string "Top" while ignoring the possible spaces before and after in
9391 % the input. By adding the arbitrary 7sp below, we make it much less
9392 % likely that a real node name would have the same width as "Top" (e.g.,
9393 % in a monospaced font). Hopefully it will never happen in practice.
9394 %
9395 % For the same basic reason, we retypeset the "Top" at every
9396 % reference, since the current font is indeterminate.
9397 %
9398 \def\crossmanualxref#1{%
9399 \setbox\toprefbox = \hbox{Top\kern7sp}%
9400 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
9401 \ifdim \wd2 > 7sp % nonempty?
9402 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
9403 \putwordSection{} ``\printedrefname'' \putwordin{}\space
9404 \fi
9405 \fi
9406 #1%
9407 }
9408
9409 % This macro is called from \xrefX for the `[nodename]' part of xref
9410 % output. It's a separate macro only so it can be changed more easily,
9411 % since square brackets don't work well in some documents. Particularly
9412 % one that Bob is working on :).
9413 %
9414 \def\xrefprintnodename#1{[#1]}
9415
9416 % @link{NODENAME, LABEL, MANUAL} - create a "plain" link, with no
9417 % page number. Not useful if printed on paper.
9418 %
9419 \def\link#1{\linkX[#1,,,]}
9420 \def\linkX[#1,#2,#3,#4]{%
9421 \begingroup
9422 \unsepspaces
9423 \getprintedrefname{#1}{#2}{#3}%
9424 \startxreflink{#1}{#3}%
9425 \printedrefname
9426 \endlink
9427 \endgroup
9428 }
9429
9430
9431 % Things referred to by \setref.
9432 %
9433 \def\Ynothing{}
9434 \def\Yomitfromtoc{}
9435 \def\Yanchor{\isanchor} \let\isanchor\relax
9436 \def\Ynumbered{%
9437 \ifnum\secno=0
9438 \putwordChapter@tie \the\chapno
9439 \else \ifnum\subsecno=0
9440 \putwordSection@tie \the\chapno.\the\secno
9441 \else \ifnum\subsubsecno=0
9442 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9443 \else
9444 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9445 \fi\fi\fi
9446 }
9447 \def\Yappendix{%
9448 \ifnum\secno=0
9449 \putwordAppendix@tie @char\the\appendixno{}%
9450 \else \ifnum\subsecno=0
9451 \putwordSection@tie @char\the\appendixno.\the\secno
9452 \else \ifnum\subsubsecno=0
9453 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9454 \else
9455 \putwordSection@tie
9456 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9457 \fi\fi\fi
9458 }
9459
9460 % \refx{NAME} - reference a cross-reference string named NAME.
9461 \def\refx#1{%
9462 \getrefx{#1}\thisrefX
9463 \ifx\thisrefX\relax
9464 % If not defined, say something at least.
9465 \angleleft un\-de\-fined\angleright
9466 \iflinks
9467 \ifhavexrefs
9468 {\toks0 = {#1}% avoid expansion of possibly-complex value
9469 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9470 \else
9471 \ifwarnedxrefs\else
9472 \global\warnedxrefstrue
9473 \message{Cross reference values unknown; you must run TeX again.}%
9474 \fi
9475 \fi
9476 \fi
9477 \else
9478 % It's defined, so just use it.
9479 \thisrefX
9480 \fi
9481 }
9482
9483 % Set #2 to xref string #1
9484 \def\getrefx#1#2{%
9485 \requireauxfile
9486 {%
9487 \indexnofonts
9488 \turnoffactive
9489 \def\value##1{##1}%
9490 \expandafter\global\expandafter\let\expandafter#2\csname XR#1\endcsname
9491 }%
9492 }
9493
9494 % This is the macro invoked by entries in the aux file. Define a control
9495 % sequence for a cross-reference target (we prepend XR to the control sequence
9496 % name to avoid collisions). The value is the page number. If this is a float
9497 % type, we have more work to do.
9498 %
9499 \def\xrdef#1#2{%
9500 {% Expand the node or anchor name to remove control sequences.
9501 % \turnoffactive stops 8-bit characters being changed to commands
9502 % like @'e. \refx does the same to retrieve the value in the definition.
9503 \indexnofonts
9504 \turnoffactive
9505 \def\value##1{##1}%
9506 \xdef\safexrefname{#1}%
9507 }%
9508 %
9509 \bgroup
9510 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
9511 \egroup
9512 % We put the \gdef inside a group to avoid the definitions building up on
9513 % TeX's save stack, which can cause it to run out of space for aux files with
9514 % thousands of lines. \gdef doesn't use the save stack, but \csname does
9515 % when it defines an unknown control sequence as \relax.
9516 %
9517 % Was that xref control sequence that we just defined for a float?
9518 \expandafter\iffloat\csname XR\safexrefname\endcsname
9519 % it was a float, and we have the (safe) float type in \iffloattype.
9520 \expandafter\let\expandafter\floatlist
9521 \csname floatlist\iffloattype\endcsname
9522 %
9523 % Is this the first time we've seen this float type?
9524 \expandafter\ifx\floatlist\relax
9525 \toks0 = {\do}% yes, so just \do
9526 \else
9527 % had it before, so preserve previous elements in list.
9528 \toks0 = \expandafter{\floatlist\do}%
9529 \fi
9530 %
9531 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9532 % for later use in \listoffloats.
9533 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9534 {\safexrefname}}%
9535 \fi
9536 \ignorespaces % ignore ends of line in aux file
9537 }
9538
9539 % If working on a large document in chapters, it is convenient to
9540 % be able to disable indexing, cross-referencing, and contents, for test runs.
9541 % This is done with @novalidate at the beginning of the file.
9542 %
9543 \newif\iflinks \linkstrue % by default we want the aux files.
9544 \let\novalidate = \linksfalse
9545
9546 % Used when writing to the aux file, or when using data from it.
9547 \def\requireauxfile{%
9548 \iflinks
9549 \tryauxfile
9550 % Open the new aux file. TeX will close it automatically at exit.
9551 \immediate\openout\auxfile=\jobname.aux
9552 \fi
9553 \global\let\requireauxfile=\relax % Only do this once.
9554 }
9555
9556 % Read the last existing aux file, if any. No error if none exists.
9557 %
9558 \def\tryauxfile{%
9559 \ifxetex\xetexpreauxfile\fi
9560 \openin 1 \jobname.aux
9561 \ifeof 1 \else
9562 \readdatafile{aux}%
9563 \global\havexrefstrue
9564 \fi
9565 \closein 1
9566 \ifxetex\xetexpostauxfile\fi
9567 }
9568
9569 \def\setupdatafile{%
9570 \catcode`\^^@=\other
9571 \catcode`\^^A=\other
9572 \catcode`\^^B=\other
9573 \catcode`\^^C=\other
9574 \catcode`\^^D=\other
9575 \catcode`\^^E=\other
9576 \catcode`\^^F=\other
9577 \catcode`\^^G=\other
9578 \catcode`\^^H=\other
9579 \catcode`\^^K=\other
9580 \catcode`\^^L=\other
9581 \catcode`\^^N=\other
9582 \catcode`\^^P=\other
9583 \catcode`\^^Q=\other
9584 \catcode`\^^R=\other
9585 \catcode`\^^S=\other
9586 \catcode`\^^T=\other
9587 \catcode`\^^U=\other
9588 \catcode`\^^V=\other
9589 \catcode`\^^W=\other
9590 \catcode`\^^X=\other
9591 \catcode`\^^Z=\other
9592 \catcode`\^^[=\other
9593 \catcode`\^^\=\other
9594 \catcode`\^^]=\other
9595 \catcode`\^^^=\other
9596 \catcode`\^^_=\other
9597 \catcode`\^=\other
9598 %
9599 % Special characters. Should be turned off anyway, but...
9600 \catcode`\~=\other
9601 \catcode`\[=\other
9602 \catcode`\]=\other
9603 \catcode`\"=\other
9604 \catcode`\_=\active
9605 \catcode`\|=\active
9606 \catcode`\<=\active
9607 \catcode`\>=\active
9608 \catcode`\$=\other
9609 \catcode`\#=\other
9610 \catcode`\&=\other
9611 \catcode`\%=\other
9612 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9613 %
9614 \catcode`\\=\active
9615 %
9616 % @ is our escape character in .aux files, and we need braces.
9617 \catcode`\{=1
9618 \catcode`\}=2
9619 \catcode`\@=0
9620 }
9621
9622 \def\readdatafile#1{%
9623 \begingroup
9624 \setupdatafile
9625 \input\jobname.#1
9626 \endgroup}
9627
9628
9629 \message{insertions,}
9630 % including footnotes.
9631
9632 \newcount \footnoteno
9633
9634 % The trailing space in the following definition for supereject is
9635 % vital for proper filling; pages come out unaligned when you do a
9636 % pagealignmacro call if that space before the closing brace is
9637 % removed. (Generally, numeric constants should always be followed by a
9638 % space to prevent strange expansion errors.)
9639 \def\supereject{\par\penalty -20000\footnoteno =0 }
9640
9641 % @footnotestyle is meaningful for Info output only.
9642 \let\footnotestyle=\comment
9643
9644 {\catcode `\@=11
9645 %
9646 % Auto-number footnotes. Otherwise like plain.
9647 \gdef\footnote{%
9648 \global\advance\footnoteno by \@ne
9649 %
9650 % Output for the footnote marker. If we are immediately after another
9651 % footnote, output a comma and small space first.
9652 \edef\thisfootno{$^{\ifnum\lastpenalty=3 ,\mskip 1mu \fi\the\footnoteno}$}%
9653 %
9654 % In case the footnote comes at the end of a sentence, preserve the
9655 % extra spacing after we do the footnote number.
9656 \let\@sf\empty
9657 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9658 %
9659 % Remove inadvertent blank space before typesetting the footnote number.
9660 \unskip
9661 %
9662 % \scriptspace is 0.5pt by default and gives excessive space before the
9663 % comma if we have multiple footnote markers in a row.
9664 \bgroup\scriptspace=0pt
9665 \thisfootno\@sf
9666 \egroup
9667 \dofootnote
9668 }%
9669
9670 % marker for immediately after a footnote marker
9671 \gdef\footnoteendmarker{\penalty3 }
9672
9673 % Do not require the footnote text as a parameter; otherwise, @ifset
9674 % (and anything else that uses \parseargline) fails inside footnotes
9675 % because the tokens are fixed when the footnote is read.
9676 %
9677 \gdef\dofootnote{%
9678 \insert\footins\bgroup
9679 \aftergroup\footnoteendmarker
9680 %
9681 % Nested footnotes are not supported in TeX, that would take a lot
9682 % more work. (\startsavinginserts does not suffice.)
9683 \let\footnote=\errfootnotenest
9684 %
9685 % We want to typeset this text as a normal paragraph, even if the
9686 % footnote reference occurs in (for example) a display environment.
9687 % So reset some parameters.
9688 \hsize=\txipagewidth
9689 \interlinepenalty\interfootnotelinepenalty
9690 \splittopskip\ht\strutbox % top baseline for broken footnotes
9691 \splitmaxdepth\dp\strutbox
9692 \floatingpenalty\@MM
9693 \leftskip\z@skip
9694 \rightskip\z@skip
9695 \spaceskip\z@skip
9696 \xspaceskip\z@skip
9697 \parindent\defaultparindent
9698 %
9699 \smallfonts \rm
9700 %
9701 % Because we use hanging indentation in footnotes, a @noindent appears
9702 % to exdent this text, so make it be a no-op. makeinfo does not use
9703 % hanging indentation so @noindent can still be needed within footnote
9704 % text after an @example or the like (not that this is good style).
9705 \let\noindent = \relax
9706 %
9707 % Hang the footnote text off the number. Use \everypar in case the
9708 % footnote extends for more than one paragraph.
9709 \everypar = {\hang}%
9710 \textindent{$^{\the\footnoteno}$}%
9711 %
9712 % Don't crash into the line above the footnote text. Since this
9713 % expands into a box, it must come within the paragraph, lest it
9714 % provide a place where TeX can split the footnote.
9715 \footstrut
9716 %
9717 % Eat opening brace and invoke rest of plain TeX footnote routine.
9718 \futurelet\next\fo@t
9719 }
9720 }%end \catcode `\@=11
9721
9722 \def\errfootnotenest{%
9723 \errhelp=\EMsimple
9724 \errmessage{Nested footnotes not supported in texinfo.tex,
9725 even though they work in makeinfo; sorry}
9726 }
9727
9728 \def\errfootnoteheading{%
9729 \errhelp=\EMsimple
9730 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9731 }
9732
9733 % In case a @footnote appears in a vbox, save the footnote text and create
9734 % the real \insert just after the vbox finished. Otherwise, the insertion
9735 % would be lost.
9736 % Similarly, if a @footnote appears inside an alignment, save the footnote
9737 % text to a box and make the \insert when a row of the table is finished.
9738 % And the same can be done for other insert classes. --kasal, 16nov03.
9739 %
9740 % Replace the \insert primitive by a cheating macro.
9741 % Deeper inside, just make sure that the saved insertions are not spilled
9742 % out prematurely.
9743 %
9744 \def\startsavinginserts{%
9745 \ifx \insert\ptexinsert
9746 \let\insert\saveinsert
9747 \else
9748 \let\checkinserts\relax
9749 \fi
9750 }
9751
9752 % This \insert replacement works for both \insert\footins{foo} and
9753 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9754 %
9755 \def\saveinsert#1{%
9756 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9757 \afterassignment\next
9758 % swallow the left brace
9759 \let\temp =
9760 }
9761 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9762 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9763
9764 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9765
9766 \def\placesaveins#1{%
9767 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9768 {\box#1}%
9769 }
9770
9771 % eat @SAVE -- beware, all of them have catcode \other:
9772 {
9773 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9774 \gdef\gobblesave @SAVE{}
9775 }
9776
9777 % initialization:
9778 \def\newsaveins #1{%
9779 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9780 \next
9781 }
9782 \def\newsaveinsX #1{%
9783 \csname newbox\endcsname #1%
9784 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9785 \checksaveins #1}%
9786 }
9787
9788 % initialize:
9789 \let\checkinserts\empty
9790 \newsaveins\footins
9791 \newsaveins\margin
9792
9793
9794 % @image. We use the macros from epsf.tex to support this.
9795 % If epsf.tex is not installed and @image is used, we complain.
9796 %
9797 % Check for and read epsf.tex up front. If we read it only at @image
9798 % time, we might be inside a group, and then its definitions would get
9799 % undone and the next image would fail.
9800 \openin 1 = epsf.tex
9801 \ifeof 1 \else
9802 % Do not bother showing banner with epsf.tex v2.7k (available in
9803 % doc/epsf.tex and on ctan).
9804 \def\epsfannounce{\toks0 = }%
9805 \input epsf.tex
9806 \fi
9807 \closein 1
9808 %
9809 % We will only complain once about lack of epsf.tex.
9810 \newif\ifwarnednoepsf
9811 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9812 work. It is also included in the Texinfo distribution, or you can get
9813 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
9814 %
9815 \def\image#1{%
9816 \ifx\epsfbox\thisisundefined
9817 \ifwarnednoepsf \else
9818 \errhelp = \noepsfhelp
9819 \errmessage{epsf.tex not found, images will be ignored}%
9820 \global\warnednoepsftrue
9821 \fi
9822 \else
9823 \imagexxx #1,,,,,\finish
9824 \fi
9825 }
9826
9827 % Approximate height of a line in the standard text font.
9828 \newdimen\capheight
9829 \setbox0=\vbox{\tenrm H}
9830 \capheight=\ht0
9831
9832 %
9833 % Arguments to @image:
9834 % #1 is (mandatory) image filename; we tack on .eps extension.
9835 % #2 is (optional) width, #3 is (optional) height.
9836 % #4 is (ignored optional) html alt text.
9837 % #5 is (ignored optional) extension.
9838 % #6 is just the usual extra ignored arg for parsing stuff.
9839 \newif\ifimagevmode
9840 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9841 \catcode`\^^M = 5 % in case we're inside an example
9842 \normalturnoffactive % allow _ et al. in names
9843 \makevalueexpandable
9844 \ifvmode
9845 \imagevmodetrue
9846 \medskip
9847 % Usually we'll have text after the image which will insert
9848 % \parskip glue, so insert it here too to equalize the space
9849 % above and below.
9850 \vskip\parskip
9851 %
9852 % Place image in a \vtop for a top page margin that is (close to) correct,
9853 % as \topskip glue is relative to the first baseline.
9854 \vtop\bgroup \kern -\capheight \vskip-\parskip
9855 \fi
9856 %
9857 \ifx\centersub\centerV
9858 % For @center @image, enter vertical mode and add vertical space
9859 % Enter an extra \parskip because @center doesn't add space itself.
9860 \vbox\bgroup\vskip\parskip\medskip\vskip\parskip
9861 \else
9862 % Enter horizontal mode so that indentation from an enclosing
9863 % environment such as @quotation is respected.
9864 % However, if we're at the top level, we don't want the
9865 % normal paragraph indentation.
9866 \imageindent
9867 \fi
9868 %
9869 % Output the image.
9870 \ifpdf
9871 % For pdfTeX and LuaTeX <= 0.80
9872 \dopdfimage{#1}{#2}{#3}%
9873 \else
9874 \ifxetex
9875 \doxeteximage{#1}{#2}{#3}%
9876 \else
9877 % For epsf.tex
9878 % \epsfbox itself resets \epsf?size at each figure.
9879 \setbox0 = \hbox{\ignorespaces #2}%
9880 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9881 \setbox0 = \hbox{\ignorespaces #3}%
9882 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9883 \epsfbox{#1.eps}%
9884 \fi
9885 \fi
9886 %
9887 \ifimagevmode
9888 \egroup
9889 \medskip % space after a standalone image
9890 \fi
9891 \ifx\centersub\centerV % @center @image
9892 \medskip
9893 \egroup % close \vbox
9894 \fi
9895 \endgroup}
9896
9897
9898 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9899 % etc. We don't actually implement floating yet, we always include the
9900 % float "here". But it seemed the best name for the future.
9901 %
9902 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9903
9904 % There may be a space before second and/or third parameter; delete it.
9905 \def\eatcommaspace#1, {#1,}
9906
9907 % #1 is the optional FLOATTYPE, the text label for this float, typically
9908 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9909 % this float will not be numbered and cannot be referred to.
9910 %
9911 % #2 is the optional xref label. Also must be present for the float to
9912 % be referable.
9913 %
9914 % #3 is the optional positioning argument; for now, it is ignored. It
9915 % will somehow specify the positions allowed to float to (here, top, bottom).
9916 %
9917 % We keep a separate counter for each FLOATTYPE, which we reset at each
9918 % chapter-level command.
9919 \let\resetallfloatnos=\empty
9920 %
9921 \def\dofloat#1,#2,#3,#4\finish{%
9922 \let\thiscaption=\empty
9923 \let\thisshortcaption=\empty
9924 %
9925 % don't lose footnotes inside @float.
9926 %
9927 % BEWARE: when the floats start float, we have to issue warning whenever an
9928 % insert appears inside a float which could possibly float. --kasal, 26may04
9929 %
9930 \startsavinginserts
9931 %
9932 % We can't be used inside a paragraph.
9933 \par
9934 %
9935 \vtop\bgroup
9936 \def\floattype{#1}%
9937 \def\floatlabel{#2}%
9938 \def\floatloc{#3}% we do nothing with this yet.
9939 %
9940 \ifx\floattype\empty
9941 \let\safefloattype=\empty
9942 \else
9943 {%
9944 % the floattype might have accents or other special characters,
9945 % but we need to use it in a control sequence name.
9946 \indexnofonts
9947 \turnoffactive
9948 \xdef\safefloattype{\floattype}%
9949 }%
9950 \fi
9951 %
9952 % If label is given but no type, we handle that as the empty type.
9953 \ifx\floatlabel\empty \else
9954 % We want each FLOATTYPE to be numbered separately (Figure 1,
9955 % Table 1, Figure 2, ...). (And if no label, no number.)
9956 %
9957 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9958 \global\advance\floatno by 1
9959 %
9960 {%
9961 % This magic value for the third argument of \setref is output as
9962 % the XREFLABEL-title value. \xrefX uses it to distinguish float
9963 % labels (which have a completely different output format) from
9964 % node and anchor labels. And \xrdef uses it to construct the
9965 % lists of floats.
9966 %
9967 \edef\tmp{\noexpand\setref{\noexpand\floatlabel}{Yfloat}%
9968 {\floatmagic=\safefloattype}}%
9969 \tmp
9970 }%
9971 \fi
9972 %
9973 % start with \parskip glue, I guess.
9974 \vskip\parskip
9975 %
9976 % Don't suppress indentation if a float happens to start a section.
9977 \restorefirstparagraphindent
9978 }
9979
9980 % we have these possibilities:
9981 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9982 % @float Foo,lbl & no caption: Foo 1.1
9983 % @float Foo & @caption{Cap}: Foo: Cap
9984 % @float Foo & no caption: Foo
9985 % @float ,lbl & Caption{Cap}: 1.1: Cap
9986 % @float ,lbl & no caption: 1.1
9987 % @float & @caption{Cap}: Cap
9988 % @float & no caption:
9989 %
9990 \def\Efloat{%
9991 \let\floatident = \empty
9992 %
9993 % In all cases, if we have a float type, it comes first.
9994 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9995 %
9996 % If we have an xref label, the number comes next.
9997 \ifx\floatlabel\empty \else
9998 \ifx\floattype\empty \else % if also had float type, need tie first.
9999 \appendtomacro\floatident{\tie}%
10000 \fi
10001 % the number.
10002 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
10003 \fi
10004 %
10005 % Start the printed caption with what we've constructed in
10006 % \floatident, but keep it separate; we need \floatident again.
10007 \let\captionline = \floatident
10008 %
10009 \ifx\thiscaption\empty \else
10010 \ifx\floatident\empty \else
10011 \appendtomacro\captionline{: }% had ident, so need a colon between
10012 \fi
10013 %
10014 % caption text.
10015 \appendtomacro\captionline{\scanexp\thiscaption}%
10016 \fi
10017 %
10018 % If we have anything to print, print it, with space before.
10019 % Eventually this needs to become an \insert.
10020 \ifx\captionline\empty \else
10021 \vskip.5\parskip
10022 \captionline
10023 %
10024 % Space below caption.
10025 \vskip\parskip
10026 \fi
10027 %
10028 % If have an xref label, write the list of floats info. Do this
10029 % after the caption, to avoid chance of it being a breakpoint.
10030 \ifx\floatlabel\empty \else
10031 % Write the text that goes in the lof to the aux file as
10032 % \floatlabel-lof. Besides \floatident, we include the short
10033 % caption if specified, else the full caption if specified, else nothing.
10034 {%
10035 \requireauxfile
10036 \atdummies
10037 %
10038 \ifx\thisshortcaption\empty
10039 \def\gtemp{\thiscaption}%
10040 \else
10041 \def\gtemp{\thisshortcaption}%
10042 \fi
10043 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
10044 \ifx\gtemp\empty \else : \gtemp \fi}}%
10045 }%
10046 \fi
10047 \egroup % end of \vtop
10048 %
10049 \checkinserts
10050 }
10051
10052 % Append the tokens #2 to the definition of macro #1, not expanding either.
10053 %
10054 \def\appendtomacro#1#2{%
10055 \expandafter\def\expandafter#1\expandafter{#1#2}%
10056 }
10057
10058 % @caption, @shortcaption
10059 %
10060 \def\caption{\docaption\thiscaption}
10061 \def\shortcaption{\docaption\thisshortcaption}
10062 \def\docaption{\checkenv\float \bgroup\scanctxt\docaptionz}
10063 \def\docaptionz#1#2{\egroup \def#1{#2}}
10064
10065 % The parameter is the control sequence identifying the counter we are
10066 % going to use. Create it if it doesn't exist and assign it to \floatno.
10067 \def\getfloatno#1{%
10068 \ifx#1\relax
10069 % Haven't seen this figure type before.
10070 \csname newcount\endcsname #1%
10071 %
10072 % Remember to reset this floatno at the next chap.
10073 \expandafter\gdef\expandafter\resetallfloatnos
10074 \expandafter{\resetallfloatnos #1=0 }%
10075 \fi
10076 \let\floatno#1%
10077 }
10078
10079 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
10080 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
10081 % first read the @float command.
10082 %
10083 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
10084
10085 % Magic string used for the XREFLABEL-title value, so \xrefX can
10086 % distinguish floats from other xref types.
10087 \def\floatmagic{!!float!!}
10088
10089 % #1 is the control sequence we are passed; we expand into a conditional
10090 % which is true if #1 represents a float ref. That is, the magic
10091 % value which we passed to \setref above.
10092 %
10093 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
10094 %
10095 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
10096 % (safe) float type for this float. We set \iffloattype to #2.
10097 %
10098 \def\doiffloat#1=#2=#3\finish{%
10099 \def\temp{#1}%
10100 \def\iffloattype{#2}%
10101 \ifx\temp\floatmagic
10102 }
10103
10104 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
10105 %
10106 \parseargdef\listoffloats{%
10107 \def\floattype{#1}% floattype
10108 {%
10109 % the floattype might have accents or other special characters,
10110 % but we need to use it in a control sequence name.
10111 \indexnofonts
10112 \turnoffactive
10113 \xdef\safefloattype{\floattype}%
10114 }%
10115 %
10116 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
10117 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
10118 \ifhavexrefs
10119 % if the user said @listoffloats foo but never @float foo.
10120 \message{\linenumber No `\safefloattype' floats to list.}%
10121 \fi
10122 \else
10123 \begingroup
10124 \leftskip=\tocindent % indent these entries like a toc
10125 \let\do=\listoffloatsdo
10126 \csname floatlist\safefloattype\endcsname
10127 \endgroup
10128 \fi
10129 }
10130
10131 % This is called on each entry in a list of floats. We're passed the
10132 % xref label, in the form LABEL-title, which is how we save it in the
10133 % aux file. We strip off the -title and look up \XRLABEL-lof, which
10134 % has the text we're supposed to typeset here.
10135 %
10136 % Figures without xref labels will not be included in the list (since
10137 % they won't appear in the aux file).
10138 %
10139 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
10140 \def\listoffloatsdoentry#1-title\finish{{%
10141 % Can't fully expand XR#1-lof because it can contain anything. Just
10142 % pass the control sequence. On the other hand, XR#1-pg is just the
10143 % page number, and we want to fully expand that so we can get a link
10144 % in pdf output.
10145 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
10146 %
10147 % use the same \entry macro we use to generate the TOC and index.
10148 \let\entry\entryinternal
10149 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
10150 \writeentry
10151 }}
10152
10153
10154 \message{localization,}
10155
10156 % For single-language documents, @documentlanguage is usually given very
10157 % early, just after @documentencoding. Single argument is the language
10158 % (de) or locale (de_DE) abbreviation.
10159 %
10160 {
10161 \catcode`\_ = \active
10162 \globaldefs=1
10163 \parseargdef\documentlanguage{%
10164 \tex % read txi-??.tex file in plain TeX.
10165 % Read the file by the name they passed if it exists.
10166 \let_ = \normalunderscore % normal _ character for filename test
10167 \openin 1 txi-#1.tex
10168 \ifeof 1
10169 \documentlanguagetrywithoutunderscore #1_\finish
10170 \else
10171 \globaldefs = 1 % everything in the txi-LL files needs to persist
10172 \input txi-#1.tex
10173 \fi
10174 \closein 1
10175 \endgroup % end raw TeX
10176 }
10177 %
10178 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
10179 % try txi-de.tex.
10180 %
10181 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
10182 \openin 1 txi-#1.tex
10183 \ifeof 1
10184 \def\lang{#1}%
10185 \def\enword{en}%
10186 \ifx\lang\enword
10187 % for English only, keep on going rather than issuing a fatal error
10188 % message, as txi-en.tex likely doesn't contain any changes from the
10189 % defaults. note that this is a problem if we already loaded another
10190 % language file and want to switch back to English.
10191 \message{Cannot read language file txi-#1.tex}%
10192 \else
10193 \errhelp = \nolanghelp
10194 \errmessage{Cannot read language file txi-#1.tex}%
10195 \fi
10196 \else
10197 \globaldefs = 1 % everything in the txi-LL files needs to persist
10198 \input txi-#1.tex
10199 \fi
10200 \closein 1
10201 }
10202 }% end of special _ catcode
10203 %
10204 \newhelp\nolanghelp{The given language definition file cannot be found or
10205 is empty. Maybe you need to install it? Putting it in the current
10206 directory should work if nowhere else does.}
10207
10208 % This macro is called from txi-??.tex files; the first argument is the
10209 % \language name to set (without the "\lang@" prefix), the second and
10210 % third args are \{left,right}hyphenmin.
10211 %
10212 % The language names to pass are determined when the format is built.
10213 % See the etex.log file created at that time, e.g.,
10214 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
10215 %
10216 % With TeX Live 2008, etex now includes hyphenation patterns for all
10217 % available languages. This means we can support hyphenation in
10218 % Texinfo, at least to some extent. (This still doesn't solve the
10219 % accented characters problem.)
10220 %
10221 \catcode`@=11
10222 \def\txisetlanguage#1#2#3{%
10223 % do not set the language if the name is undefined in the current TeX.
10224 \expandafter\ifx\csname lang@#1\endcsname \relax
10225 \message{no patterns for #1}%
10226 \else
10227 \global\language = \csname lang@#1\endcsname
10228 \fi
10229 % but there is no harm in adjusting the hyphenmin values regardless.
10230 \global\lefthyphenmin = #2\relax
10231 \global\righthyphenmin = #3\relax
10232 }
10233
10234 % XeTeX and LuaTeX can handle Unicode natively.
10235 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
10236 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
10237 %
10238 \newif\iftxinativeunicodecapable
10239 \newif\iftxiusebytewiseio
10240
10241 \ifxetex
10242 \txinativeunicodecapabletrue
10243 \txiusebytewiseiofalse
10244 \else
10245 \ifluatex
10246 \txinativeunicodecapabletrue
10247 \txiusebytewiseiofalse
10248 \else
10249 \txinativeunicodecapablefalse
10250 \txiusebytewiseiotrue
10251 \fi
10252 \fi
10253
10254 \let\xetexpreauxfile\relax
10255 \let\xetexpostauxfile\relax
10256
10257 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
10258 % for non-UTF-8 (byte-wise) encodings.
10259 %
10260 \def\setbytewiseio{%
10261 \ifxetex
10262 % For document root file
10263 \XeTeXinputencoding "bytes"
10264 %
10265 % Setting for subsequent files to be read with @include.
10266 \XeTeXdefaultencoding "bytes"
10267 %
10268 % Use UTF-8 for reading auxiliary index and TOC files, which are
10269 % always output in UTF-8 with XeTeX.
10270 \def\xetexpreauxfile{\XeTeXdefaultencoding "UTF-8"}%
10271 \def\xetexpostauxfile{\XeTeXdefaultencoding "bytes"}%
10272 \fi
10273
10274 \ifluatex
10275 \directlua{
10276 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
10277 local function convert_char (char)
10278 return utf8_char(byte(char))
10279 end
10280
10281 local function convert_line (line)
10282 return gsub(line, ".", convert_char)
10283 end
10284
10285 callback.register("process_input_buffer", convert_line)
10286
10287 local function convert_line_out (line)
10288 local line_out = ""
10289 for c in string.utfvalues(line) do
10290 line_out = line_out .. string.char(c)
10291 end
10292 return line_out
10293 end
10294
10295 callback.register("process_output_buffer", convert_line_out)
10296 }
10297 \fi
10298
10299 \txiusebytewiseiotrue
10300 }
10301
10302
10303 % Helpers for encodings.
10304 % Set the catcode of characters 128 through 255 to the specified number.
10305 %
10306 \def\setnonasciicharscatcode#1{%
10307 \count255=128
10308 \loop\ifnum\count255<256
10309 \global\catcode\count255=#1\relax
10310 \advance\count255 by 1
10311 \repeat
10312 }
10313
10314 \def\setnonasciicharscatcodenonglobal#1{%
10315 \count255=128
10316 \loop\ifnum\count255<256
10317 \catcode\count255=#1\relax
10318 \advance\count255 by 1
10319 \repeat
10320 }
10321
10322 % @documentencoding sets the definition of non-ASCII characters
10323 % according to the specified encoding.
10324 %
10325 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
10326 \def\documentencodingzzz#1{%
10327 %
10328 % Encoding being declared for the document.
10329 \def\declaredencoding{\csname #1.enc\endcsname}%
10330 %
10331 % Supported encodings: names converted to tokens in order to be able
10332 % to compare them with \ifx.
10333 \def\ascii{\csname US-ASCII.enc\endcsname}%
10334 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
10335 \def\latone{\csname ISO-8859-1.enc\endcsname}%
10336 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
10337 \def\utfeight{\csname UTF-8.enc\endcsname}%
10338 %
10339 \ifx \declaredencoding \ascii
10340 \asciichardefs
10341 %
10342 \else \ifx \declaredencoding \lattwo
10343 \iftxinativeunicodecapable
10344 \setbytewiseio
10345 \fi
10346 \setnonasciicharscatcode\active
10347 \lattwochardefs
10348 %
10349 \else \ifx \declaredencoding \latone
10350 \iftxinativeunicodecapable
10351 \setbytewiseio
10352 \fi
10353 \setnonasciicharscatcode\active
10354 \latonechardefs
10355 %
10356 \else \ifx \declaredencoding \latnine
10357 \iftxinativeunicodecapable
10358 \setbytewiseio
10359 \fi
10360 \setnonasciicharscatcode\active
10361 \latninechardefs
10362 %
10363 \else \ifx \declaredencoding \utfeight
10364 \iftxinativeunicodecapable
10365 % For native Unicode handling (XeTeX and LuaTeX)
10366 \nativeunicodechardefs
10367 \else
10368 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX).
10369 % Since we already invoke \utfeightchardefs at the top level,
10370 % making non-ascii chars active is sufficient.
10371 \setnonasciicharscatcode\active
10372 \fi
10373 %
10374 \else
10375 \message{Ignoring unknown document encoding: #1.}%
10376 %
10377 \fi % utfeight
10378 \fi % latnine
10379 \fi % latone
10380 \fi % lattwo
10381 \fi % ascii
10382 %
10383 \ifxetex
10384 \ifx \declaredencoding \utfeight
10385 \else
10386 \ifx \declaredencoding \ascii
10387 \else
10388 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
10389 non-ASCII characters in auxiliary files.}%
10390 \fi
10391 \fi
10392 \fi
10393 }
10394
10395 % A message to be logged when using a character that isn't available
10396 % the default font encoding (OT1).
10397 %
10398 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
10399
10400 % Take account of \c (plain) vs. \, (Texinfo) difference.
10401 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
10402
10403 \def\gdefchar#1#2{%
10404 \gdef#1{%
10405 \ifpassthroughchars
10406 \string#1%
10407 \else
10408 #2%
10409 \fi
10410 }}
10411
10412 \begingroup
10413
10414 % Make non-ASCII characters active for defining the character definition
10415 % macros.
10416 \setnonasciicharscatcode\active
10417
10418 % Latin1 (ISO-8859-1) character definitions.
10419 \gdef\latonechardefs{%
10420 \gdefchar^^a0{\tie}
10421 \gdefchar^^a1{\exclamdown}
10422 \gdefchar^^a2{{\tcfont \char162}} % cent
10423 \gdefchar^^a3{\pounds{}}
10424 \gdefchar^^a4{{\tcfont \char164}} % currency
10425 \gdefchar^^a5{{\tcfont \char165}} % yen
10426 \gdefchar^^a6{{\tcfont \char166}} % broken bar
10427 \gdefchar^^a7{\S}
10428 \gdefchar^^a8{\"{}}
10429 \gdefchar^^a9{\copyright{}}
10430 \gdefchar^^aa{\ordf}
10431 \gdefchar^^ab{\guillemetleft{}}
10432 \gdefchar^^ac{\ensuremath\lnot}
10433 \gdefchar^^ad{\-}
10434 \gdefchar^^ae{\registeredsymbol{}}
10435 \gdefchar^^af{\={}}
10436 %
10437 \gdefchar^^b0{\textdegree}
10438 \gdefchar^^b1{\ensuremath\pm}
10439 \gdefchar^^b2{$^2$}
10440 \gdefchar^^b3{$^3$}
10441 \gdefchar^^b4{\'{}}
10442 \gdefchar^^b5{$\mu$}
10443 \gdefchar^^b6{\P}
10444 \gdefchar^^b7{\ensuremath\cdot}
10445 \gdefchar^^b8{\cedilla\ }
10446 \gdefchar^^b9{$^1$}
10447 \gdefchar^^ba{\ordm}
10448 \gdefchar^^bb{\guillemetright{}}
10449 \gdefchar^^bc{$1\over4$}
10450 \gdefchar^^bd{$1\over2$}
10451 \gdefchar^^be{$3\over4$}
10452 \gdefchar^^bf{\questiondown}
10453 %
10454 \gdefchar^^c0{\`A}
10455 \gdefchar^^c1{\'A}
10456 \gdefchar^^c2{\^A}
10457 \gdefchar^^c3{\~A}
10458 \gdefchar^^c4{\"A}
10459 \gdefchar^^c5{\AA}
10460 \gdefchar^^c6{\AE}
10461 \gdefchar^^c7{\cedilla C}
10462 \gdefchar^^c8{\`E}
10463 \gdefchar^^c9{\'E}
10464 \gdefchar^^ca{\^E}
10465 \gdefchar^^cb{\"E}
10466 \gdefchar^^cc{\`I}
10467 \gdefchar^^cd{\'I}
10468 \gdefchar^^ce{\^I}
10469 \gdefchar^^cf{\"I}
10470 %
10471 \gdefchar^^d0{\DH}
10472 \gdefchar^^d1{\~N}
10473 \gdefchar^^d2{\`O}
10474 \gdefchar^^d3{\'O}
10475 \gdefchar^^d4{\^O}
10476 \gdefchar^^d5{\~O}
10477 \gdefchar^^d6{\"O}
10478 \gdefchar^^d7{\ensuremath\times}
10479 \gdefchar^^d8{\O}
10480 \gdefchar^^d9{\`U}
10481 \gdefchar^^da{\'U}
10482 \gdefchar^^db{\^U}
10483 \gdefchar^^dc{\"U}
10484 \gdefchar^^dd{\'Y}
10485 \gdefchar^^de{\TH}
10486 \gdefchar^^df{\ss}
10487 %
10488 \gdefchar^^e0{\`a}
10489 \gdefchar^^e1{\'a}
10490 \gdefchar^^e2{\^a}
10491 \gdefchar^^e3{\~a}
10492 \gdefchar^^e4{\"a}
10493 \gdefchar^^e5{\aa}
10494 \gdefchar^^e6{\ae}
10495 \gdefchar^^e7{\cedilla c}
10496 \gdefchar^^e8{\`e}
10497 \gdefchar^^e9{\'e}
10498 \gdefchar^^ea{\^e}
10499 \gdefchar^^eb{\"e}
10500 \gdefchar^^ec{\`{\dotless i}}
10501 \gdefchar^^ed{\'{\dotless i}}
10502 \gdefchar^^ee{\^{\dotless i}}
10503 \gdefchar^^ef{\"{\dotless i}}
10504 %
10505 \gdefchar^^f0{\dh}
10506 \gdefchar^^f1{\~n}
10507 \gdefchar^^f2{\`o}
10508 \gdefchar^^f3{\'o}
10509 \gdefchar^^f4{\^o}
10510 \gdefchar^^f5{\~o}
10511 \gdefchar^^f6{\"o}
10512 \gdefchar^^f7{\ensuremath\div}
10513 \gdefchar^^f8{\o}
10514 \gdefchar^^f9{\`u}
10515 \gdefchar^^fa{\'u}
10516 \gdefchar^^fb{\^u}
10517 \gdefchar^^fc{\"u}
10518 \gdefchar^^fd{\'y}
10519 \gdefchar^^fe{\th}
10520 \gdefchar^^ff{\"y}
10521 }
10522
10523 % Latin9 (ISO-8859-15) encoding character definitions.
10524 \gdef\latninechardefs{%
10525 % Encoding is almost identical to Latin1.
10526 \latonechardefs
10527 %
10528 \gdefchar^^a4{\euro{}}
10529 \gdefchar^^a6{\v S}
10530 \gdefchar^^a8{\v s}
10531 \gdefchar^^b4{\v Z}
10532 \gdefchar^^b8{\v z}
10533 \gdefchar^^bc{\OE}
10534 \gdefchar^^bd{\oe}
10535 \gdefchar^^be{\"Y}
10536 }
10537
10538 % Latin2 (ISO-8859-2) character definitions.
10539 \gdef\lattwochardefs{%
10540 \gdefchar^^a0{\tie}
10541 \gdefchar^^a1{\ogonek{A}}
10542 \gdefchar^^a2{\u{}}
10543 \gdefchar^^a3{\L}
10544 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10545 \gdefchar^^a5{\v L}
10546 \gdefchar^^a6{\'S}
10547 \gdefchar^^a7{\S}
10548 \gdefchar^^a8{\"{}}
10549 \gdefchar^^a9{\v S}
10550 \gdefchar^^aa{\cedilla S}
10551 \gdefchar^^ab{\v T}
10552 \gdefchar^^ac{\'Z}
10553 \gdefchar^^ad{\-}
10554 \gdefchar^^ae{\v Z}
10555 \gdefchar^^af{\dotaccent Z}
10556 %
10557 \gdefchar^^b0{\textdegree}
10558 \gdefchar^^b1{\ogonek{a}}
10559 \gdefchar^^b2{\ogonek{ }}
10560 \gdefchar^^b3{\l}
10561 \gdefchar^^b4{\'{}}
10562 \gdefchar^^b5{\v l}
10563 \gdefchar^^b6{\'s}
10564 \gdefchar^^b7{\v{}}
10565 \gdefchar^^b8{\cedilla\ }
10566 \gdefchar^^b9{\v s}
10567 \gdefchar^^ba{\cedilla s}
10568 \gdefchar^^bb{\v t}
10569 \gdefchar^^bc{\'z}
10570 \gdefchar^^bd{\H{}}
10571 \gdefchar^^be{\v z}
10572 \gdefchar^^bf{\dotaccent z}
10573 %
10574 \gdefchar^^c0{\'R}
10575 \gdefchar^^c1{\'A}
10576 \gdefchar^^c2{\^A}
10577 \gdefchar^^c3{\u A}
10578 \gdefchar^^c4{\"A}
10579 \gdefchar^^c5{\'L}
10580 \gdefchar^^c6{\'C}
10581 \gdefchar^^c7{\cedilla C}
10582 \gdefchar^^c8{\v C}
10583 \gdefchar^^c9{\'E}
10584 \gdefchar^^ca{\ogonek{E}}
10585 \gdefchar^^cb{\"E}
10586 \gdefchar^^cc{\v E}
10587 \gdefchar^^cd{\'I}
10588 \gdefchar^^ce{\^I}
10589 \gdefchar^^cf{\v D}
10590 %
10591 \gdefchar^^d0{\DH}
10592 \gdefchar^^d1{\'N}
10593 \gdefchar^^d2{\v N}
10594 \gdefchar^^d3{\'O}
10595 \gdefchar^^d4{\^O}
10596 \gdefchar^^d5{\H O}
10597 \gdefchar^^d6{\"O}
10598 \gdefchar^^d7{\ensuremath\times}
10599 \gdefchar^^d8{\v R}
10600 \gdefchar^^d9{\ringaccent U}
10601 \gdefchar^^da{\'U}
10602 \gdefchar^^db{\H U}
10603 \gdefchar^^dc{\"U}
10604 \gdefchar^^dd{\'Y}
10605 \gdefchar^^de{\cedilla T}
10606 \gdefchar^^df{\ss}
10607 %
10608 \gdefchar^^e0{\'r}
10609 \gdefchar^^e1{\'a}
10610 \gdefchar^^e2{\^a}
10611 \gdefchar^^e3{\u a}
10612 \gdefchar^^e4{\"a}
10613 \gdefchar^^e5{\'l}
10614 \gdefchar^^e6{\'c}
10615 \gdefchar^^e7{\cedilla c}
10616 \gdefchar^^e8{\v c}
10617 \gdefchar^^e9{\'e}
10618 \gdefchar^^ea{\ogonek{e}}
10619 \gdefchar^^eb{\"e}
10620 \gdefchar^^ec{\v e}
10621 \gdefchar^^ed{\'{\dotless{i}}}
10622 \gdefchar^^ee{\^{\dotless{i}}}
10623 \gdefchar^^ef{\v d}
10624 %
10625 \gdefchar^^f0{\dh}
10626 \gdefchar^^f1{\'n}
10627 \gdefchar^^f2{\v n}
10628 \gdefchar^^f3{\'o}
10629 \gdefchar^^f4{\^o}
10630 \gdefchar^^f5{\H o}
10631 \gdefchar^^f6{\"o}
10632 \gdefchar^^f7{\ensuremath\div}
10633 \gdefchar^^f8{\v r}
10634 \gdefchar^^f9{\ringaccent u}
10635 \gdefchar^^fa{\'u}
10636 \gdefchar^^fb{\H u}
10637 \gdefchar^^fc{\"u}
10638 \gdefchar^^fd{\'y}
10639 \gdefchar^^fe{\cedilla t}
10640 \gdefchar^^ff{\dotaccent{}}
10641 }
10642
10643 \endgroup % active chars
10644
10645 % UTF-8 character definitions.
10646 %
10647 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10648 % changes for Texinfo conventions. It is included here under the GPL by
10649 % permission from Frank Mittelbach and the LaTeX team.
10650 %
10651 \newcount\countUTFx
10652 \newcount\countUTFy
10653 \newcount\countUTFz
10654
10655 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10656 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10657 %
10658 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10659 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10660 %
10661 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10662 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10663
10664 \gdef\UTFviiiDefined#1{%
10665 \ifx #1\relax
10666 \ifutfviiidefinedwarning
10667 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10668 \fi
10669 \else
10670 \expandafter #1%
10671 \fi
10672 }
10673 \newif\ifutfviiidefinedwarning
10674 \utfviiidefinedwarningtrue
10675
10676 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10677 \begingroup
10678 \catcode`\~13
10679 \catcode`\$12
10680 \catcode`\"12
10681
10682 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10683 % substituting ~ and $ with a character token of that value.
10684 \gdef\UTFviiiLoop{%
10685 \catcode\countUTFx\active
10686 \uccode`\~\countUTFx
10687 \uccode`\$\countUTFx
10688 \uppercase\expandafter{\UTFviiiTmp}%
10689 \advance\countUTFx by 1
10690 \ifnum\countUTFx < \countUTFy
10691 \expandafter\UTFviiiLoop
10692 \fi}
10693 %
10694 % For bytes other than the first in a UTF-8 sequence. Not expected to
10695 % be expanded except when writing to auxiliary files.
10696 \countUTFx = "80
10697 \countUTFy = "C2
10698 \def\UTFviiiTmp{%
10699 \gdef~{%
10700 \ifpassthroughchars $\fi}}%
10701 \UTFviiiLoop
10702
10703 \countUTFx = "C2
10704 \countUTFy = "E0
10705 \def\UTFviiiTmp{%
10706 \gdef~{%
10707 \ifpassthroughchars $%
10708 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10709 \UTFviiiLoop
10710
10711 \countUTFx = "E0
10712 \countUTFy = "F0
10713 \def\UTFviiiTmp{%
10714 \gdef~{%
10715 \ifpassthroughchars $%
10716 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10717 \UTFviiiLoop
10718
10719 \countUTFx = "F0
10720 \countUTFy = "F4
10721 \def\UTFviiiTmp{%
10722 \gdef~{%
10723 \ifpassthroughchars $%
10724 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10725 }}%
10726 \UTFviiiLoop
10727 %
10728 % for pdftex only, used to expand ASCII to UTF-16BE.
10729 \gdef\asciitounicode{%
10730 \countUTFx = "20
10731 \countUTFy = "80
10732 \def\UTFviiiTmp{%
10733 \def~{\nullbyte $}}%
10734 \UTFviiiLoop
10735 }
10736 {\catcode0=11 \gdef\nullbyte{^^00}}%
10737 \endgroup
10738
10739 \def\globallet{\global\let} % save some \expandafter's below
10740
10741 % @U{xxxx} to produce U+xxxx, if we support it.
10742 \def\U#1{%
10743 \expandafter\ifx\csname uni:#1\endcsname \relax
10744 \iftxinativeunicodecapable
10745 % All Unicode characters can be used if native Unicode handling is
10746 % active. However, if the font does not have the glyph,
10747 % letters are missing.
10748 \begingroup
10749 \uccode`\.="#1\relax
10750 \uppercase{.}
10751 \endgroup
10752 \else
10753 \errhelp = \EMsimple
10754 \errmessage{Unicode character U+#1 not supported, sorry}%
10755 \fi
10756 \else
10757 \csname uni:#1\endcsname
10758 \fi
10759 }
10760
10761 % These macros are used here to construct the names of macros
10762 % that expand to the definitions for UTF-8 sequences.
10763 \def\UTFviiiTwoOctetsName#1#2{%
10764 \csname u8:#1\string #2\endcsname}%
10765 \def\UTFviiiThreeOctetsName#1#2#3{%
10766 \csname u8:#1\string #2\string #3\endcsname}%
10767 \def\UTFviiiFourOctetsName#1#2#3#4{%
10768 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10769
10770 % generate UTF-16 from codepoint
10771 \def\utfsixteentotoks#1#2{%
10772 \countUTFz = "#2\relax
10773 \ifnum \countUTFz > 65535
10774 % doesn't work for codepoints > U+FFFF
10775 % we don't define glyphs for any of these anyway, so it doesn't matter
10776 #1={U+#2}%
10777 \else
10778 \countUTFx = \countUTFz
10779 \divide\countUTFx by 256
10780 \countUTFy = \countUTFx
10781 \multiply\countUTFx by 256
10782 \advance\countUTFz by -\countUTFx
10783 \uccode`,=\countUTFy
10784 \uccode`;=\countUTFz
10785 \ifnum\countUTFy = 0
10786 \uppercase{#1={\nullbyte\string;}}%
10787 \else\ifnum\countUTFz = 0
10788 \uppercase{#1={\string,\nullbyte}}%
10789 \else
10790 \uppercase{#1={\string,\string;}}%
10791 \fi\fi
10792 % NB \uppercase cannot insert a null byte
10793 \fi
10794 }
10795
10796 \newif\ifutfbytespdf
10797 \utfbytespdffalse
10798
10799 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10800 % provide a definition macro to replace a Unicode character;
10801 % this gets used by the @U command
10802 %
10803 \begingroup
10804 \catcode`\"=12
10805 \catcode`\<=12
10806 \catcode`\.=12
10807 \catcode`\,=12
10808 \catcode`\;=12
10809 \catcode`\!=12
10810 \catcode`\~=13
10811 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10812 \countUTFz = "#1\relax
10813 \begingroup
10814 \parseXMLCharref
10815 %
10816 % Completely expand \UTFviiiTmp, which looks like:
10817 % 1. \UTFviiTwoOctetsName B1 B2
10818 % 2. \csname u8:B1 \string B2 \endcsname
10819 % 3. \u8: B1 B2 (a single control sequence token)
10820 \xdef\UTFviiiTmp{\UTFviiiTmp}%
10821 %
10822 \ifpdf
10823 \toksA={#2}%
10824 \utfsixteentotoks\toksB{#1}%
10825 \expandafter\xdef\UTFviiiTmp{%
10826 \noexpand\ifutfbytespdf\noexpand\utfbytes{\the\toksB}%
10827 \noexpand\else\the\toksA\noexpand\fi}%
10828 \else
10829 \expandafter\gdef\UTFviiiTmp{#2}%
10830 \fi
10831 %
10832 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10833 \message{Internal error, already defined: #1}%
10834 \fi
10835 %
10836 % define an additional control sequence for this code point.
10837 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10838 \endgroup}
10839 %
10840 % Given the value in \countUTFz as a Unicode code point, set
10841 % \UTFviiiTmp to one of the \UTVviii*OctetsName macros followed by
10842 % the corresponding UTF-8 sequence.
10843 \gdef\parseXMLCharref{%
10844 \ifnum\countUTFz < "20\relax
10845 \errhelp = \EMsimple
10846 \errmessage{Cannot define Unicode char value < 0020}%
10847 \else\ifnum\countUTFz < "800\relax
10848 \parseUTFviiiA,%
10849 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10850 \else\ifnum\countUTFz < "10000\relax
10851 \parseUTFviiiA;%
10852 \parseUTFviiiA,%
10853 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10854 \else
10855 \parseUTFviiiA;%
10856 \parseUTFviiiA,%
10857 \parseUTFviiiA!%
10858 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10859 \fi\fi\fi
10860 }
10861
10862 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10863 % It must be a non-initial byte in the sequence.
10864 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10865 % of the bytes.
10866 \gdef\parseUTFviiiA#1{%
10867 \countUTFx = \countUTFz
10868 \divide\countUTFz by 64
10869 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10870 \multiply\countUTFz by 64
10871
10872 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10873 % in order to get the last five bits.
10874 \advance\countUTFx by -\countUTFz
10875
10876 % Convert this to the byte in the UTF-8 sequence.
10877 \advance\countUTFx by 128
10878 \uccode `#1\countUTFx
10879 \countUTFz = \countUTFy}
10880
10881 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10882 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10883 % sequence.
10884 % #2 is one of the \UTFviii*OctetsName macros.
10885 % #3 is always a full stop (.)
10886 % #4 is a template for the other bytes in the sequence. The values for these
10887 % bytes is substituted in here with \uppercase using the \uccode's.
10888 \gdef\parseUTFviiiB#1#2#3#4{%
10889 \advance\countUTFz by "#10\relax
10890 \uccode `#3\countUTFz
10891 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10892 \endgroup
10893
10894 % For native Unicode handling (XeTeX and LuaTeX),
10895 % provide a definition macro that sets a catcode to `other' non-globally
10896 %
10897 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10898 \catcode"#1=\other
10899 }
10900
10901 % Suppress ligature creation from adjacent characters.
10902 \ifluatex
10903 % Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice
10904 % to suppress the "ff" ligature. Using a kern appears to be the only
10905 % workaround.
10906 \def\nolig{\kern0pt{}}
10907 \else
10908 \def\nolig{{}}
10909 \fi
10910
10911 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10912 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10913 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10914 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10915 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10916 %
10917 % Many of our renditions are less than wonderful, and all the missing
10918 % characters are available somewhere. Loading the necessary fonts
10919 % awaits user request. We can't truly support Unicode without
10920 % reimplementing everything that's been done in LaTeX for many years,
10921 % plus probably using luatex or xetex, and who knows what else.
10922 % We won't be doing that here in this simple file. But we can try to at
10923 % least make most of the characters not bomb out.
10924 %
10925 \def\unicodechardefs{%
10926 \DeclareUnicodeCharacter{0020}{ } % space
10927 \DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number
10928 \DeclareUnicodeCharacter{0022}{\char"22 }%
10929 \DeclareUnicodeCharacter{0023}{\char"23 }%
10930 \DeclareUnicodeCharacter{0024}{\char"24 }%
10931 \DeclareUnicodeCharacter{0025}{\char"25 }%
10932 \DeclareUnicodeCharacter{0026}{\char"26 }%
10933 \DeclareUnicodeCharacter{0027}{\char"27 }%
10934 \DeclareUnicodeCharacter{0028}{\char"28 }%
10935 \DeclareUnicodeCharacter{0029}{\char"29 }%
10936 \DeclareUnicodeCharacter{002A}{\char"2A }%
10937 \DeclareUnicodeCharacter{002B}{\char"2B }%
10938 \DeclareUnicodeCharacter{002C}{\char"2C }%
10939 \DeclareUnicodeCharacter{002D}{\char"2D }%
10940 \DeclareUnicodeCharacter{002E}{\char"2E }%
10941 \DeclareUnicodeCharacter{002F}{\char"2F }%
10942 \DeclareUnicodeCharacter{0030}{0}%
10943 \DeclareUnicodeCharacter{0031}{1}%
10944 \DeclareUnicodeCharacter{0032}{2}%
10945 \DeclareUnicodeCharacter{0033}{3}%
10946 \DeclareUnicodeCharacter{0034}{4}%
10947 \DeclareUnicodeCharacter{0035}{5}%
10948 \DeclareUnicodeCharacter{0036}{6}%
10949 \DeclareUnicodeCharacter{0037}{7}%
10950 \DeclareUnicodeCharacter{0038}{8}%
10951 \DeclareUnicodeCharacter{0039}{9}%
10952 \DeclareUnicodeCharacter{003A}{\char"3A }%
10953 \DeclareUnicodeCharacter{003B}{\char"3B }%
10954 \DeclareUnicodeCharacter{003C}{\char"3C }%
10955 \DeclareUnicodeCharacter{003D}{\char"3D }%
10956 \DeclareUnicodeCharacter{003E}{\char"3E }%
10957 \DeclareUnicodeCharacter{003F}{\char"3F }%
10958 \DeclareUnicodeCharacter{0040}{\char"40 }%
10959 \DeclareUnicodeCharacter{0041}{A}%
10960 \DeclareUnicodeCharacter{0042}{B}%
10961 \DeclareUnicodeCharacter{0043}{C}%
10962 \DeclareUnicodeCharacter{0044}{D}%
10963 \DeclareUnicodeCharacter{0045}{E}%
10964 \DeclareUnicodeCharacter{0046}{F}%
10965 \DeclareUnicodeCharacter{0047}{G}%
10966 \DeclareUnicodeCharacter{0048}{H}%
10967 \DeclareUnicodeCharacter{0049}{I}%
10968 \DeclareUnicodeCharacter{004A}{J}%
10969 \DeclareUnicodeCharacter{004B}{K}%
10970 \DeclareUnicodeCharacter{004C}{L}%
10971 \DeclareUnicodeCharacter{004D}{M}%
10972 \DeclareUnicodeCharacter{004E}{N}%
10973 \DeclareUnicodeCharacter{004F}{O}%
10974 \DeclareUnicodeCharacter{0050}{P}%
10975 \DeclareUnicodeCharacter{0051}{Q}%
10976 \DeclareUnicodeCharacter{0052}{R}%
10977 \DeclareUnicodeCharacter{0053}{S}%
10978 \DeclareUnicodeCharacter{0054}{T}%
10979 \DeclareUnicodeCharacter{0055}{U}%
10980 \DeclareUnicodeCharacter{0056}{V}%
10981 \DeclareUnicodeCharacter{0057}{W}%
10982 \DeclareUnicodeCharacter{0058}{X}%
10983 \DeclareUnicodeCharacter{0059}{Y}%
10984 \DeclareUnicodeCharacter{005A}{Z}%
10985 \DeclareUnicodeCharacter{005B}{\char"5B }%
10986 \DeclareUnicodeCharacter{005C}{\char"5C }%
10987 \DeclareUnicodeCharacter{005D}{\char"5D }%
10988 \DeclareUnicodeCharacter{005E}{\char"5E }%
10989 \DeclareUnicodeCharacter{005F}{\char"5F }%
10990 \DeclareUnicodeCharacter{0060}{\char"60 }%
10991 \DeclareUnicodeCharacter{0061}{a}%
10992 \DeclareUnicodeCharacter{0062}{b}%
10993 \DeclareUnicodeCharacter{0063}{c}%
10994 \DeclareUnicodeCharacter{0064}{d}%
10995 \DeclareUnicodeCharacter{0065}{e}%
10996 \DeclareUnicodeCharacter{0066}{f}%
10997 \DeclareUnicodeCharacter{0067}{g}%
10998 \DeclareUnicodeCharacter{0068}{h}%
10999 \DeclareUnicodeCharacter{0069}{i}%
11000 \DeclareUnicodeCharacter{006A}{j}%
11001 \DeclareUnicodeCharacter{006B}{k}%
11002 \DeclareUnicodeCharacter{006C}{l}%
11003 \DeclareUnicodeCharacter{006D}{m}%
11004 \DeclareUnicodeCharacter{006E}{n}%
11005 \DeclareUnicodeCharacter{006F}{o}%
11006 \DeclareUnicodeCharacter{0070}{p}%
11007 \DeclareUnicodeCharacter{0071}{q}%
11008 \DeclareUnicodeCharacter{0072}{r}%
11009 \DeclareUnicodeCharacter{0073}{s}%
11010 \DeclareUnicodeCharacter{0074}{t}%
11011 \DeclareUnicodeCharacter{0075}{u}%
11012 \DeclareUnicodeCharacter{0076}{v}%
11013 \DeclareUnicodeCharacter{0077}{w}%
11014 \DeclareUnicodeCharacter{0078}{x}%
11015 \DeclareUnicodeCharacter{0079}{y}%
11016 \DeclareUnicodeCharacter{007A}{z}%
11017 \DeclareUnicodeCharacter{007B}{\char"7B }%
11018 \DeclareUnicodeCharacter{007C}{\char"7C }%
11019 \DeclareUnicodeCharacter{007D}{\char"7D }%
11020 \DeclareUnicodeCharacter{007E}{\char"7E }%
11021 % \DeclareUnicodeCharacter{007F}{} % DEL
11022 %
11023 \DeclareUnicodeCharacter{00A0}{\tie}%
11024 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
11025 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
11026 \DeclareUnicodeCharacter{00A3}{\pounds{}}%
11027 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
11028 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
11029 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
11030 \DeclareUnicodeCharacter{00A7}{\S}%
11031 \DeclareUnicodeCharacter{00A8}{\"{ }}%
11032 \DeclareUnicodeCharacter{00A9}{\copyright{}}%
11033 \DeclareUnicodeCharacter{00AA}{\ordf}%
11034 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
11035 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
11036 \DeclareUnicodeCharacter{00AD}{\-}%
11037 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
11038 \DeclareUnicodeCharacter{00AF}{\={ }}%
11039 %
11040 \DeclareUnicodeCharacter{00B0}{\textdegree}%
11041 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
11042 \DeclareUnicodeCharacter{00B2}{$^2$}%
11043 \DeclareUnicodeCharacter{00B3}{$^3$}%
11044 \DeclareUnicodeCharacter{00B4}{\'{ }}%
11045 \DeclareUnicodeCharacter{00B5}{$\mu$}%
11046 \DeclareUnicodeCharacter{00B6}{\P}%
11047 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
11048 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
11049 \DeclareUnicodeCharacter{00B9}{$^1$}%
11050 \DeclareUnicodeCharacter{00BA}{\ordm}%
11051 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
11052 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
11053 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
11054 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
11055 \DeclareUnicodeCharacter{00BF}{\questiondown}%
11056 %
11057 \DeclareUnicodeCharacter{00C0}{\`A}%
11058 \DeclareUnicodeCharacter{00C1}{\'A}%
11059 \DeclareUnicodeCharacter{00C2}{\^A}%
11060 \DeclareUnicodeCharacter{00C3}{\~A}%
11061 \DeclareUnicodeCharacter{00C4}{\"A}%
11062 \DeclareUnicodeCharacter{00C5}{\AA}%
11063 \DeclareUnicodeCharacter{00C6}{\AE}%
11064 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
11065 \DeclareUnicodeCharacter{00C8}{\`E}%
11066 \DeclareUnicodeCharacter{00C9}{\'E}%
11067 \DeclareUnicodeCharacter{00CA}{\^E}%
11068 \DeclareUnicodeCharacter{00CB}{\"E}%
11069 \DeclareUnicodeCharacter{00CC}{\`I}%
11070 \DeclareUnicodeCharacter{00CD}{\'I}%
11071 \DeclareUnicodeCharacter{00CE}{\^I}%
11072 \DeclareUnicodeCharacter{00CF}{\"I}%
11073 %
11074 \DeclareUnicodeCharacter{00D0}{\DH}%
11075 \DeclareUnicodeCharacter{00D1}{\~N}%
11076 \DeclareUnicodeCharacter{00D2}{\`O}%
11077 \DeclareUnicodeCharacter{00D3}{\'O}%
11078 \DeclareUnicodeCharacter{00D4}{\^O}%
11079 \DeclareUnicodeCharacter{00D5}{\~O}%
11080 \DeclareUnicodeCharacter{00D6}{\"O}%
11081 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
11082 \DeclareUnicodeCharacter{00D8}{\O}%
11083 \DeclareUnicodeCharacter{00D9}{\`U}%
11084 \DeclareUnicodeCharacter{00DA}{\'U}%
11085 \DeclareUnicodeCharacter{00DB}{\^U}%
11086 \DeclareUnicodeCharacter{00DC}{\"U}%
11087 \DeclareUnicodeCharacter{00DD}{\'Y}%
11088 \DeclareUnicodeCharacter{00DE}{\TH}%
11089 \DeclareUnicodeCharacter{00DF}{\ss}%
11090 %
11091 \DeclareUnicodeCharacter{00E0}{\`a}%
11092 \DeclareUnicodeCharacter{00E1}{\'a}%
11093 \DeclareUnicodeCharacter{00E2}{\^a}%
11094 \DeclareUnicodeCharacter{00E3}{\~a}%
11095 \DeclareUnicodeCharacter{00E4}{\"a}%
11096 \DeclareUnicodeCharacter{00E5}{\aa}%
11097 \DeclareUnicodeCharacter{00E6}{\ae}%
11098 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
11099 \DeclareUnicodeCharacter{00E8}{\`e}%
11100 \DeclareUnicodeCharacter{00E9}{\'e}%
11101 \DeclareUnicodeCharacter{00EA}{\^e}%
11102 \DeclareUnicodeCharacter{00EB}{\"e}%
11103 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
11104 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
11105 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
11106 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
11107 %
11108 \DeclareUnicodeCharacter{00F0}{\dh}%
11109 \DeclareUnicodeCharacter{00F1}{\~n}%
11110 \DeclareUnicodeCharacter{00F2}{\`o}%
11111 \DeclareUnicodeCharacter{00F3}{\'o}%
11112 \DeclareUnicodeCharacter{00F4}{\^o}%
11113 \DeclareUnicodeCharacter{00F5}{\~o}%
11114 \DeclareUnicodeCharacter{00F6}{\"o}%
11115 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
11116 \DeclareUnicodeCharacter{00F8}{\o}%
11117 \DeclareUnicodeCharacter{00F9}{\`u}%
11118 \DeclareUnicodeCharacter{00FA}{\'u}%
11119 \DeclareUnicodeCharacter{00FB}{\^u}%
11120 \DeclareUnicodeCharacter{00FC}{\"u}%
11121 \DeclareUnicodeCharacter{00FD}{\'y}%
11122 \DeclareUnicodeCharacter{00FE}{\th}%
11123 \DeclareUnicodeCharacter{00FF}{\"y}%
11124 %
11125 \DeclareUnicodeCharacter{0100}{\=A}%
11126 \DeclareUnicodeCharacter{0101}{\=a}%
11127 \DeclareUnicodeCharacter{0102}{\u{A}}%
11128 \DeclareUnicodeCharacter{0103}{\u{a}}%
11129 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
11130 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
11131 \DeclareUnicodeCharacter{0106}{\'C}%
11132 \DeclareUnicodeCharacter{0107}{\'c}%
11133 \DeclareUnicodeCharacter{0108}{\^C}%
11134 \DeclareUnicodeCharacter{0109}{\^c}%
11135 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
11136 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
11137 \DeclareUnicodeCharacter{010C}{\v{C}}%
11138 \DeclareUnicodeCharacter{010D}{\v{c}}%
11139 \DeclareUnicodeCharacter{010E}{\v{D}}%
11140 \DeclareUnicodeCharacter{010F}{d'}%
11141 %
11142 \DeclareUnicodeCharacter{0110}{\DH}%
11143 \DeclareUnicodeCharacter{0111}{\dh}%
11144 \DeclareUnicodeCharacter{0112}{\=E}%
11145 \DeclareUnicodeCharacter{0113}{\=e}%
11146 \DeclareUnicodeCharacter{0114}{\u{E}}%
11147 \DeclareUnicodeCharacter{0115}{\u{e}}%
11148 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
11149 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
11150 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
11151 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
11152 \DeclareUnicodeCharacter{011A}{\v{E}}%
11153 \DeclareUnicodeCharacter{011B}{\v{e}}%
11154 \DeclareUnicodeCharacter{011C}{\^G}%
11155 \DeclareUnicodeCharacter{011D}{\^g}%
11156 \DeclareUnicodeCharacter{011E}{\u{G}}%
11157 \DeclareUnicodeCharacter{011F}{\u{g}}%
11158 %
11159 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
11160 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
11161 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
11162 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
11163 \DeclareUnicodeCharacter{0124}{\^H}%
11164 \DeclareUnicodeCharacter{0125}{\^h}%
11165 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
11166 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
11167 \DeclareUnicodeCharacter{0128}{\~I}%
11168 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
11169 \DeclareUnicodeCharacter{012A}{\=I}%
11170 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
11171 \DeclareUnicodeCharacter{012C}{\u{I}}%
11172 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
11173 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
11174 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
11175 %
11176 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
11177 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
11178 \DeclareUnicodeCharacter{0132}{IJ}%
11179 \DeclareUnicodeCharacter{0133}{ij}%
11180 \DeclareUnicodeCharacter{0134}{\^J}%
11181 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
11182 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
11183 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
11184 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
11185 \DeclareUnicodeCharacter{0139}{\'L}%
11186 \DeclareUnicodeCharacter{013A}{\'l}%
11187 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
11188 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
11189 \DeclareUnicodeCharacter{013D}{L'}% should kern
11190 \DeclareUnicodeCharacter{013E}{l'}% should kern
11191 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
11192 %
11193 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
11194 \DeclareUnicodeCharacter{0141}{\L}%
11195 \DeclareUnicodeCharacter{0142}{\l}%
11196 \DeclareUnicodeCharacter{0143}{\'N}%
11197 \DeclareUnicodeCharacter{0144}{\'n}%
11198 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
11199 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
11200 \DeclareUnicodeCharacter{0147}{\v{N}}%
11201 \DeclareUnicodeCharacter{0148}{\v{n}}%
11202 \DeclareUnicodeCharacter{0149}{'n}%
11203 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
11204 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
11205 \DeclareUnicodeCharacter{014C}{\=O}%
11206 \DeclareUnicodeCharacter{014D}{\=o}%
11207 \DeclareUnicodeCharacter{014E}{\u{O}}%
11208 \DeclareUnicodeCharacter{014F}{\u{o}}%
11209 %
11210 \DeclareUnicodeCharacter{0150}{\H{O}}%
11211 \DeclareUnicodeCharacter{0151}{\H{o}}%
11212 \DeclareUnicodeCharacter{0152}{\OE}%
11213 \DeclareUnicodeCharacter{0153}{\oe}%
11214 \DeclareUnicodeCharacter{0154}{\'R}%
11215 \DeclareUnicodeCharacter{0155}{\'r}%
11216 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
11217 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
11218 \DeclareUnicodeCharacter{0158}{\v{R}}%
11219 \DeclareUnicodeCharacter{0159}{\v{r}}%
11220 \DeclareUnicodeCharacter{015A}{\'S}%
11221 \DeclareUnicodeCharacter{015B}{\'s}%
11222 \DeclareUnicodeCharacter{015C}{\^S}%
11223 \DeclareUnicodeCharacter{015D}{\^s}%
11224 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
11225 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
11226 %
11227 \DeclareUnicodeCharacter{0160}{\v{S}}%
11228 \DeclareUnicodeCharacter{0161}{\v{s}}%
11229 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
11230 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
11231 \DeclareUnicodeCharacter{0164}{\v{T}}%
11232 \DeclareUnicodeCharacter{0165}{\v{t}}%
11233 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
11234 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
11235 \DeclareUnicodeCharacter{0168}{\~U}%
11236 \DeclareUnicodeCharacter{0169}{\~u}%
11237 \DeclareUnicodeCharacter{016A}{\=U}%
11238 \DeclareUnicodeCharacter{016B}{\=u}%
11239 \DeclareUnicodeCharacter{016C}{\u{U}}%
11240 \DeclareUnicodeCharacter{016D}{\u{u}}%
11241 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
11242 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
11243 %
11244 \DeclareUnicodeCharacter{0170}{\H{U}}%
11245 \DeclareUnicodeCharacter{0171}{\H{u}}%
11246 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
11247 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
11248 \DeclareUnicodeCharacter{0174}{\^W}%
11249 \DeclareUnicodeCharacter{0175}{\^w}%
11250 \DeclareUnicodeCharacter{0176}{\^Y}%
11251 \DeclareUnicodeCharacter{0177}{\^y}%
11252 \DeclareUnicodeCharacter{0178}{\"Y}%
11253 \DeclareUnicodeCharacter{0179}{\'Z}%
11254 \DeclareUnicodeCharacter{017A}{\'z}%
11255 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
11256 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
11257 \DeclareUnicodeCharacter{017D}{\v{Z}}%
11258 \DeclareUnicodeCharacter{017E}{\v{z}}%
11259 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
11260 %
11261 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
11262 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
11263 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
11264 \DeclareUnicodeCharacter{01C7}{LJ}%
11265 \DeclareUnicodeCharacter{01C8}{Lj}%
11266 \DeclareUnicodeCharacter{01C9}{lj}%
11267 \DeclareUnicodeCharacter{01CA}{NJ}%
11268 \DeclareUnicodeCharacter{01CB}{Nj}%
11269 \DeclareUnicodeCharacter{01CC}{nj}%
11270 \DeclareUnicodeCharacter{01CD}{\v{A}}%
11271 \DeclareUnicodeCharacter{01CE}{\v{a}}%
11272 \DeclareUnicodeCharacter{01CF}{\v{I}}%
11273 %
11274 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
11275 \DeclareUnicodeCharacter{01D1}{\v{O}}%
11276 \DeclareUnicodeCharacter{01D2}{\v{o}}%
11277 \DeclareUnicodeCharacter{01D3}{\v{U}}%
11278 \DeclareUnicodeCharacter{01D4}{\v{u}}%
11279 %
11280 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
11281 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
11282 \DeclareUnicodeCharacter{01E6}{\v{G}}%
11283 \DeclareUnicodeCharacter{01E7}{\v{g}}%
11284 \DeclareUnicodeCharacter{01E8}{\v{K}}%
11285 \DeclareUnicodeCharacter{01E9}{\v{k}}%
11286 %
11287 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
11288 \DeclareUnicodeCharacter{01F1}{DZ}%
11289 \DeclareUnicodeCharacter{01F2}{Dz}%
11290 \DeclareUnicodeCharacter{01F3}{dz}%
11291 \DeclareUnicodeCharacter{01F4}{\'G}%
11292 \DeclareUnicodeCharacter{01F5}{\'g}%
11293 \DeclareUnicodeCharacter{01F8}{\`N}%
11294 \DeclareUnicodeCharacter{01F9}{\`n}%
11295 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
11296 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
11297 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
11298 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
11299 %
11300 \DeclareUnicodeCharacter{021E}{\v{H}}%
11301 \DeclareUnicodeCharacter{021F}{\v{h}}%
11302 %
11303 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
11304 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
11305 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
11306 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
11307 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
11308 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
11309 %
11310 \DeclareUnicodeCharacter{0232}{\=Y}%
11311 \DeclareUnicodeCharacter{0233}{\=y}%
11312 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
11313 %
11314 \DeclareUnicodeCharacter{02BC}{'}%
11315 %
11316 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
11317 %
11318 % Greek letters upper case
11319 \DeclareUnicodeCharacter{0391}{{\it A}}%
11320 \DeclareUnicodeCharacter{0392}{{\it B}}%
11321 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
11322 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
11323 \DeclareUnicodeCharacter{0395}{{\it E}}%
11324 \DeclareUnicodeCharacter{0396}{{\it Z}}%
11325 \DeclareUnicodeCharacter{0397}{{\it H}}%
11326 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
11327 \DeclareUnicodeCharacter{0399}{{\it I}}%
11328 \DeclareUnicodeCharacter{039A}{{\it K}}%
11329 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
11330 \DeclareUnicodeCharacter{039C}{{\it M}}%
11331 \DeclareUnicodeCharacter{039D}{{\it N}}%
11332 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
11333 \DeclareUnicodeCharacter{039F}{{\it O}}%
11334 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
11335 \DeclareUnicodeCharacter{03A1}{{\it P}}%
11336 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
11337 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
11338 \DeclareUnicodeCharacter{03A4}{{\it T}}%
11339 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
11340 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
11341 \DeclareUnicodeCharacter{03A7}{{\it X}}%
11342 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
11343 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
11344 %
11345 % Vowels with accents
11346 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
11347 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
11348 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
11349 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
11350 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
11351 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
11352 %
11353 % Standalone accent
11354 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
11355 %
11356 % Greek letters lower case
11357 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
11358 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
11359 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
11360 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
11361 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
11362 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
11363 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
11364 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
11365 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
11366 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
11367 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
11368 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
11369 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
11370 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
11371 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
11372 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
11373 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
11374 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
11375 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
11376 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
11377 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
11378 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
11379 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
11380 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
11381 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
11382 %
11383 % More Greek vowels with accents
11384 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
11385 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
11386 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
11387 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
11388 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
11389 %
11390 % Variant Greek letters
11391 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
11392 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
11393 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
11394 %
11395 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
11396 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
11397 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
11398 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
11399 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
11400 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
11401 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
11402 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
11403 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
11404 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
11405 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
11406 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
11407 %
11408 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
11409 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
11410 %
11411 \DeclareUnicodeCharacter{1E20}{\=G}%
11412 \DeclareUnicodeCharacter{1E21}{\=g}%
11413 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
11414 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
11415 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
11416 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
11417 \DeclareUnicodeCharacter{1E26}{\"H}%
11418 \DeclareUnicodeCharacter{1E27}{\"h}%
11419 %
11420 \DeclareUnicodeCharacter{1E30}{\'K}%
11421 \DeclareUnicodeCharacter{1E31}{\'k}%
11422 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
11423 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
11424 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
11425 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
11426 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
11427 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
11428 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
11429 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
11430 \DeclareUnicodeCharacter{1E3E}{\'M}%
11431 \DeclareUnicodeCharacter{1E3F}{\'m}%
11432 %
11433 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
11434 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
11435 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
11436 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
11437 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
11438 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
11439 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
11440 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
11441 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
11442 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
11443 %
11444 \DeclareUnicodeCharacter{1E54}{\'P}%
11445 \DeclareUnicodeCharacter{1E55}{\'p}%
11446 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
11447 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
11448 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
11449 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
11450 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
11451 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
11452 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
11453 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
11454 %
11455 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
11456 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
11457 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
11458 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
11459 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
11460 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
11461 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
11462 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
11463 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
11464 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
11465 %
11466 \DeclareUnicodeCharacter{1E7C}{\~V}%
11467 \DeclareUnicodeCharacter{1E7D}{\~v}%
11468 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
11469 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
11470 %
11471 \DeclareUnicodeCharacter{1E80}{\`W}%
11472 \DeclareUnicodeCharacter{1E81}{\`w}%
11473 \DeclareUnicodeCharacter{1E82}{\'W}%
11474 \DeclareUnicodeCharacter{1E83}{\'w}%
11475 \DeclareUnicodeCharacter{1E84}{\"W}%
11476 \DeclareUnicodeCharacter{1E85}{\"w}%
11477 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
11478 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
11479 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
11480 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
11481 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
11482 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
11483 \DeclareUnicodeCharacter{1E8C}{\"X}%
11484 \DeclareUnicodeCharacter{1E8D}{\"x}%
11485 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
11486 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
11487 %
11488 \DeclareUnicodeCharacter{1E90}{\^Z}%
11489 \DeclareUnicodeCharacter{1E91}{\^z}%
11490 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
11491 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
11492 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
11493 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
11494 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
11495 \DeclareUnicodeCharacter{1E97}{\"t}%
11496 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
11497 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
11498 %
11499 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
11500 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
11501 %
11502 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
11503 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
11504 \DeclareUnicodeCharacter{1EBC}{\~E}%
11505 \DeclareUnicodeCharacter{1EBD}{\~e}%
11506 %
11507 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
11508 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
11509 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
11510 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
11511 %
11512 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
11513 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
11514 %
11515 \DeclareUnicodeCharacter{1EF2}{\`Y}%
11516 \DeclareUnicodeCharacter{1EF3}{\`y}%
11517 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
11518 %
11519 \DeclareUnicodeCharacter{1EF8}{\~Y}%
11520 \DeclareUnicodeCharacter{1EF9}{\~y}%
11521 %
11522 % Exotic spaces
11523 \DeclareUnicodeCharacter{2007}{\hphantom{0}}%
11524 %
11525 % Punctuation
11526 \DeclareUnicodeCharacter{2013}{--}%
11527 \DeclareUnicodeCharacter{2014}{---}%
11528 \DeclareUnicodeCharacter{2018}{\quoteleft\nolig}%
11529 \DeclareUnicodeCharacter{2019}{\quoteright\nolig}%
11530 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
11531 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
11532 \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
11533 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
11534 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
11535 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
11536 \DeclareUnicodeCharacter{2022}{\bullet{}}%
11537 \DeclareUnicodeCharacter{202F}{\thinspace}%
11538 \DeclareUnicodeCharacter{2026}{\dots{}}%
11539 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
11540 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
11541 %
11542 \DeclareUnicodeCharacter{20AC}{\euro{}}%
11543 %
11544 \DeclareUnicodeCharacter{2192}{\arrow}%
11545 \DeclareUnicodeCharacter{21D2}{\result{}}%
11546 %
11547 % Mathematical symbols
11548 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
11549 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
11550 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
11551 \DeclareUnicodeCharacter{2212}{\minus{}}%
11552 \DeclareUnicodeCharacter{2217}{\ast}%
11553 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
11554 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
11555 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
11556 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
11557 \DeclareUnicodeCharacter{2261}{\equiv{}}%
11558 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
11559 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
11560 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
11561 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
11562 %
11563 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
11564 \DeclareUnicodeCharacter{2032}{\ensuremath{^\prime}}%
11565 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
11566 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
11567 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
11568 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
11569 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
11570 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11571 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11572 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11573 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11574 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11575 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11576 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11577 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11578 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11579 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11580 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11581 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11582 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11583 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11584 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11585 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11586 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11587 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11588 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11589 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11590 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11591 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11592 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11593 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11594 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11595 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11596 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11597 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11598 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11599 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11600 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11601 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11602 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11603 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11604 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11605 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11606 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11607 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11608 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11609 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11610 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11611 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11612 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11613 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11614 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11615 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11616 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11617 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11618 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11619 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11620 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11621 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11622 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11623 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11624 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11625 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11626 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11627 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11628 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11629 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11630 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11631 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11632 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11633 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11634 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11635 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11636 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11637 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11638 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11639 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11640 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11641 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11642 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11643 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11644 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11645 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11646 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11647 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11648 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11649 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11650 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11651 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11652 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11653 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11654 %
11655 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11656 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11657 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11658 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11659 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
11660 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11661 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11662 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11663 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11664 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11665 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11666 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11667 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11668 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11669 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11670 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11671 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11672 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11673 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11674 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11675 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11676 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11677 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11678 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11679 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11680 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11681 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11682 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11683 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11684 %
11685 \global\mathchardef\checkmark="1370% actually the square root sign
11686 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11687 %
11688 % These are all the combining accents. We need these empty definitions
11689 % at present for the sake of PDF outlines.
11690 \DeclareUnicodeCharacter{0300}{}%
11691 \DeclareUnicodeCharacter{0301}{}%
11692 \DeclareUnicodeCharacter{0302}{}%
11693 \DeclareUnicodeCharacter{0303}{}%
11694 \DeclareUnicodeCharacter{0305}{}%
11695 \DeclareUnicodeCharacter{0306}{}%
11696 \DeclareUnicodeCharacter{0307}{}%
11697 \DeclareUnicodeCharacter{0308}{}%
11698 \DeclareUnicodeCharacter{030A}{}%
11699 \DeclareUnicodeCharacter{030B}{}%
11700 \DeclareUnicodeCharacter{030C}{}%
11701 \DeclareUnicodeCharacter{0323}{}%
11702 \DeclareUnicodeCharacter{0327}{}%
11703 \DeclareUnicodeCharacter{0328}{}%
11704 \DeclareUnicodeCharacter{0331}{}%
11705 \DeclareUnicodeCharacter{0361}{}%
11706 }% end of \unicodechardefs
11707
11708 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11709 % It makes the setting that replace UTF-8 byte sequence.
11710 \def\utfeightchardefs{%
11711 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11712 \unicodechardefs
11713 }
11714
11715 % Whether the active definitions of non-ASCII characters expand to
11716 % non-active tokens with the same character code. This is used to
11717 % write characters literally, instead of using active definitions for
11718 % printing the correct glyphs.
11719 \newif\ifpassthroughchars
11720 \passthroughcharsfalse
11721
11722 % For native Unicode handling (XeTeX and LuaTeX),
11723 % provide a definition macro to replace/pass-through a Unicode character
11724 %
11725 \def\DeclareUnicodeCharacterNative#1#2{%
11726 \ifnum"#1>"7F % only make non-ASCII chars active
11727 \catcode"#1=\active
11728 \def\dodeclareunicodecharacternative##1##2##3{%
11729 \begingroup
11730 \uccode`\~="##2\relax
11731 \uppercase{\gdef~}{%
11732 \ifpassthroughchars
11733 ##1%
11734 \else
11735 ##3%
11736 \fi
11737 }
11738 \endgroup
11739 }
11740 \begingroup
11741 \uccode`\.="#1\relax
11742 \uppercase{\def\UTFNativeTmp{.}}%
11743 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11744 \endgroup
11745 \fi
11746 }
11747
11748 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11749 % It activates the setting that replaces Unicode characters.
11750 \def\nativeunicodechardefs{%
11751 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11752 \unicodechardefs
11753 }
11754
11755 % For native Unicode handling (XeTeX and LuaTeX),
11756 % make the character token expand
11757 % to the sequences given in \unicodechardefs for printing.
11758 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11759 \def\UTFAtUTmp{#2}
11760 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11761 }
11762
11763 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11764 \def\nativeunicodechardefsatu{%
11765 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11766 \unicodechardefs
11767 }
11768
11769 % US-ASCII character definitions.
11770 \def\asciichardefs{% nothing need be done
11771 \relax
11772 }
11773
11774 % Define all Unicode characters we know about
11775 \iftxinativeunicodecapable
11776 \nativeunicodechardefsatu
11777 \else
11778 \utfeightchardefs
11779 \fi
11780
11781
11782 \message{formatting,}
11783
11784 \newdimen\defaultparindent \defaultparindent = 15pt
11785
11786 \chapheadingskip = 15pt plus 4pt minus 2pt
11787 \secheadingskip = 12pt plus 3pt minus 2pt
11788 \subsecheadingskip = 9pt plus 2pt minus 2pt
11789
11790 % Prevent underfull vbox error messages.
11791 \vbadness = 10000
11792
11793 % Don't be very finicky about underfull hboxes, either.
11794 \hbadness = 6666
11795
11796 % Following George Bush, get rid of widows and orphans.
11797 \widowpenalty=10000
11798 \clubpenalty=10000
11799
11800 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11801 % using an old version of TeX, don't do anything. We want the amount of
11802 % stretch added to depend on the line length, hence the dependence on
11803 % \hsize. We call this whenever the paper size is set.
11804 %
11805 \def\setemergencystretch{%
11806 \ifx\emergencystretch\thisisundefined
11807 % Allow us to assign to \emergencystretch anyway.
11808 \def\emergencystretch{\dimen0}%
11809 \else
11810 \emergencystretch = .15\hsize
11811 \fi
11812 }
11813
11814 % Parameters in order: 1) textheight; 2) textwidth;
11815 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11816 % 7) physical page height; 8) physical page width.
11817 %
11818 % We also call \setleading{\textleading}, so the caller should define
11819 % \textleading. The caller should also set \parskip.
11820 %
11821 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11822 \voffset = #3\relax
11823 \topskip = #6\relax
11824 \splittopskip = \topskip
11825 %
11826 \vsize = #1\relax
11827 \advance\vsize by \topskip
11828 \txipageheight = \vsize
11829 %
11830 \hsize = #2\relax
11831 \txipagewidth = \hsize
11832 %
11833 \normaloffset = #4\relax
11834 \bindingoffset = #5\relax
11835 %
11836 \ifpdf
11837 \pdfpageheight #7\relax
11838 \pdfpagewidth #8\relax
11839 % if we don't reset these, they will remain at "1 true in" of
11840 % whatever layout pdftex was dumped with.
11841 \pdfhorigin = 1 true in
11842 \pdfvorigin = 1 true in
11843 \else
11844 \ifxetex
11845 \pdfpageheight #7\relax
11846 \pdfpagewidth #8\relax
11847 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11848 \else
11849 \special{papersize=#8,#7}%
11850 \fi
11851 \fi
11852 %
11853 \setleading{\textleading}
11854 %
11855 \parindent = \defaultparindent
11856 \setemergencystretch
11857 }
11858
11859 % @letterpaper (the default).
11860 \def\letterpaper{{\globaldefs = 1
11861 \parskip = 3pt plus 2pt minus 1pt
11862 \textleading = 13.2pt
11863 %
11864 % If page is nothing but text, make it come out even.
11865 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11866 {\voffset}{.25in}%
11867 {\bindingoffset}{36pt}%
11868 {11in}{8.5in}%
11869 }}
11870
11871 % Use @smallbook to reset parameters for 7x9.25 trim size.
11872 \def\smallbook{{\globaldefs = 1
11873 \parskip = 2pt plus 1pt
11874 \textleading = 12pt
11875 %
11876 \internalpagesizes{7.5in}{5in}%
11877 {-.2in}{0in}%
11878 {\bindingoffset}{16pt}%
11879 {9.25in}{7in}%
11880 %
11881 \lispnarrowing = 0.3in
11882 \tolerance = 700
11883 \contentsrightmargin = 0pt
11884 \defbodyindent = .5cm
11885 }}
11886
11887 % Use @afourpaper to print on European A4 paper.
11888 \def\afourpaper{{\globaldefs = 1
11889 \parskip = 3pt plus 2pt minus 1pt
11890 \textleading = 13.2pt
11891 %
11892 % Double-side printing via postscript on Laserjet 4050
11893 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11894 % To change the settings for a different printer or situation, adjust
11895 % \normaloffset until the front-side and back-side texts align. Then
11896 % do the same for \bindingoffset. You can set these for testing in
11897 % your texinfo source file like this:
11898 % @tex
11899 % \global\normaloffset = -6mm
11900 % \global\bindingoffset = 10mm
11901 % @end tex
11902 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11903 {\voffset}{\hoffset}%
11904 {\bindingoffset}{44pt}%
11905 {297mm}{210mm}%
11906 %
11907 \tolerance = 700
11908 \contentsrightmargin = 0pt
11909 \defbodyindent = 5mm
11910 }}
11911
11912 % Use @afivepaper to print on European A5 paper.
11913 % From [email protected], 2 July 2000.
11914 % He also recommends making @example and @lisp be small.
11915 \def\afivepaper{{\globaldefs = 1
11916 \parskip = 2pt plus 1pt minus 0.1pt
11917 \textleading = 12.5pt
11918 %
11919 \internalpagesizes{160mm}{120mm}%
11920 {\voffset}{-11.4mm}%
11921 {\bindingoffset}{8pt}%
11922 {210mm}{148mm}%
11923 %
11924 \lispnarrowing = 0.2in
11925 \tolerance = 800
11926 \contentsrightmargin = 0pt
11927 \defbodyindent = 2mm
11928 \tableindent = 12mm
11929 }}
11930
11931 % A specific text layout, 24x15cm overall, intended for A4 paper.
11932 \def\afourlatex{{\globaldefs = 1
11933 \afourpaper
11934 \internalpagesizes{237mm}{150mm}%
11935 {\voffset}{4.6mm}%
11936 {\bindingoffset}{7mm}%
11937 {297mm}{210mm}%
11938 %
11939 % Must explicitly reset to 0 because we call \afourpaper.
11940 \globaldefs = 0
11941 }}
11942
11943 % Use @afourwide to print on A4 paper in landscape format.
11944 \def\afourwide{{\globaldefs = 1
11945 \afourpaper
11946 \internalpagesizes{241mm}{165mm}%
11947 {\voffset}{-2.95mm}%
11948 {\bindingoffset}{7mm}%
11949 {297mm}{210mm}%
11950 \globaldefs = 0
11951 }}
11952
11953 \def\bsixpaper{{\globaldefs = 1
11954 \afourpaper
11955 \internalpagesizes{140mm}{100mm}%
11956 {-6.35mm}{-12.7mm}%
11957 {\bindingoffset}{14pt}%
11958 {176mm}{125mm}%
11959 \let\SETdispenvsize=\smallword
11960 \lispnarrowing = 0.2in
11961 \globaldefs = 0
11962 }}
11963
11964
11965 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11966 % Perhaps we should allow setting the margins, \topskip, \parskip,
11967 % and/or leading, also. Or perhaps we should compute them somehow.
11968 %
11969 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11970 \def\pagesizesyyy#1,#2,#3\finish{{%
11971 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11972 \globaldefs = 1
11973 %
11974 \parskip = 3pt plus 2pt minus 1pt
11975 \setleading{\textleading}%
11976 %
11977 \dimen0 = #1\relax
11978 \advance\dimen0 by 2.5in % default 1in margin above heading line
11979 % and 1.5in to include heading, footing and
11980 % bottom margin
11981 %
11982 \dimen2 = \hsize
11983 \advance\dimen2 by 2in % default to 1 inch margin on each side
11984 %
11985 \internalpagesizes{#1}{\hsize}%
11986 {\voffset}{\normaloffset}%
11987 {\bindingoffset}{44pt}%
11988 {\dimen0}{\dimen2}%
11989 }}
11990
11991 % Set default to letter.
11992 %
11993 \letterpaper
11994
11995 % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
11996 \hfuzz = 1pt
11997
11998
11999 \message{microtype,}
12000
12001 % protrusion, from Thanh's protcode.tex.
12002 \def\mtsetprotcode#1{%
12003 \rpcode#1`\!=200 \rpcode#1`\,=700 \rpcode#1`\-=700 \rpcode#1`\.=700
12004 \rpcode#1`\;=500 \rpcode#1`\:=500 \rpcode#1`\?=200
12005 \rpcode#1`\'=700
12006 \rpcode#1 34=500 % ''
12007 \rpcode#1 123=300 % --
12008 \rpcode#1 124=200 % ---
12009 \rpcode#1`\)=50 \rpcode#1`\A=50 \rpcode#1`\F=50 \rpcode#1`\K=50
12010 \rpcode#1`\L=50 \rpcode#1`\T=50 \rpcode#1`\V=50 \rpcode#1`\W=50
12011 \rpcode#1`\X=50 \rpcode#1`\Y=50 \rpcode#1`\k=50 \rpcode#1`\r=50
12012 \rpcode#1`\t=50 \rpcode#1`\v=50 \rpcode#1`\w=50 \rpcode#1`\x=50
12013 \rpcode#1`\y=50
12014 %
12015 \lpcode#1`\`=700
12016 \lpcode#1 92=500 % ``
12017 \lpcode#1`\(=50 \lpcode#1`\A=50 \lpcode#1`\J=50 \lpcode#1`\T=50
12018 \lpcode#1`\V=50 \lpcode#1`\W=50 \lpcode#1`\X=50 \lpcode#1`\Y=50
12019 \lpcode#1`\v=50 \lpcode#1`\w=50 \lpcode#1`\x=50 \lpcode#1`\y=0
12020 %
12021 \mtadjustprotcode#1\relax
12022 }
12023
12024 \newcount\countC
12025 \def\mtadjustprotcode#1{%
12026 \countC=0
12027 \loop
12028 \ifcase\lpcode#1\countC\else
12029 \mtadjustcp\lpcode#1\countC
12030 \fi
12031 \ifcase\rpcode#1\countC\else
12032 \mtadjustcp\rpcode#1\countC
12033 \fi
12034 \advance\countC 1
12035 \ifnum\countC < 256 \repeat
12036 }
12037
12038 \newcount\countB
12039 \def\mtadjustcp#1#2#3{%
12040 \setbox\boxA=\hbox{%
12041 \ifx#2\font\else#2\fi
12042 \char#3}%
12043 \countB=\wd\boxA
12044 \multiply\countB #1#2#3\relax
12045 \divide\countB \fontdimen6 #2\relax
12046 #1#2#3=\countB\relax
12047 }
12048
12049 \ifxetex % XeTeX
12050 \mtsetprotcode\textrm
12051 \def\mtfontexpand#1{}
12052 \else
12053 \ifluatex % LuaTeX
12054 \mtsetprotcode\textrm
12055 \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
12056 \else
12057 \ifpdf % pdfTeX
12058 \mtsetprotcode\textrm
12059 \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
12060 \else % TeX
12061 \def\mtfontexpand#1{}
12062 \fi
12063 \fi
12064 \fi
12065
12066
12067 \newif\ifmicrotype
12068
12069 \def\microtypeON{%
12070 \microtypetrue
12071 %
12072 \ifxetex % XeTeX
12073 \XeTeXprotrudechars=2
12074 \else
12075 \ifluatex % LuaTeX
12076 \adjustspacing=2
12077 \protrudechars=2
12078 \else
12079 \ifpdf % pdfTeX
12080 \pdfadjustspacing=2
12081 \pdfprotrudechars=2
12082 \fi
12083 \fi
12084 \fi
12085 %
12086 \mtfontexpand\textrm
12087 \mtfontexpand\textsl
12088 \mtfontexpand\textbf
12089 }
12090
12091 \def\microtypeOFF{%
12092 \microtypefalse
12093 %
12094 \ifxetex % XeTeX
12095 \XeTeXprotrudechars=0
12096 \else
12097 \ifluatex % LuaTeX
12098 \adjustspacing=0
12099 \protrudechars=0
12100 \else
12101 \ifpdf % pdfTeX
12102 \pdfadjustspacing=0
12103 \pdfprotrudechars=0
12104 \fi
12105 \fi
12106 \fi
12107 }
12108
12109 \microtypeOFF
12110
12111 \parseargdef\microtype{%
12112 \def\txiarg{#1}%
12113 \ifx\txiarg\onword
12114 \microtypeON
12115 \else\ifx\txiarg\offword
12116 \microtypeOFF
12117 \else
12118 \errhelp = \EMsimple
12119 \errmessage{Unknown @microtype option `\txiarg', must be on|off}%
12120 \fi\fi
12121 }
12122
12123
12124 \message{and turning on texinfo input format.}
12125
12126 % Make UTF-8 the default encoding.
12127 \documentencodingzzz{UTF-8}
12128
12129 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
12130 \catcode`\^^K = 10 % treat vertical tab as whitespace
12131
12132 % DEL is a comment character, in case @c does not suffice.
12133 \catcode`\^^? = 14
12134
12135 % Define macros to output various characters with catcode for normal text.
12136 \catcode`\"=\other \def\normaldoublequote{"}
12137 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
12138 \catcode`\+=\other \def\normalplus{+}
12139 \catcode`\<=\other \def\normalless{<}
12140 \catcode`\>=\other \def\normalgreater{>}
12141 \catcode`\^=\other \def\normalcaret{^}
12142 \catcode`\_=\other \def\normalunderscore{_}
12143 \catcode`\|=\other \def\normalverticalbar{|}
12144 \catcode`\~=\other \def\normaltilde{~}
12145
12146 % Set catcodes for Texinfo file
12147
12148 % Active characters for printing the wanted glyph.
12149 % Most of these we simply print from the \tt font, but for some, we can
12150 % use math or other variants that look better in normal text.
12151 %
12152 \catcode`\"=\active
12153 \def\activedoublequote{{\tt\char34}}
12154 \let"=\activedoublequote
12155 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
12156 \chardef\hatchar=`\^
12157 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
12158
12159 \catcode`\_=\active
12160 \def_{\ifusingtt\normalunderscore\_}
12161 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
12162 \let\realunder=_
12163
12164 \catcode`\|=\active \def|{{\tt\char124}}
12165
12166 \chardef \less=`\<
12167 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
12168 \chardef \gtr=`\>
12169 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
12170 \catcode`\+=\active \def+{{\tt \char 43}}
12171 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
12172 \catcode`\-=\active \let-=\normaldash
12173
12174
12175 % used for headline/footline in the output routine, in case the page
12176 % breaks in the middle of an @tex block.
12177 \def\texinfochars{%
12178 \let< = \activeless
12179 \let> = \activegtr
12180 \let~ = \activetilde
12181 \let^ = \activehat
12182 \setregularquotes
12183 \let\b = \strong
12184 \let\i = \smartitalic
12185 % in principle, all other definitions in \tex have to be undone too.
12186 }
12187
12188 % Used sometimes to turn off (effectively) the active characters even after
12189 % parsing them.
12190 \def\turnoffactive{%
12191 \passthroughcharstrue
12192 \let-=\normaldash
12193 \let"=\normaldoublequote
12194 \let$=\normaldollar %$ font-lock fix
12195 \let+=\normalplus
12196 \let<=\normalless
12197 \let>=\normalgreater
12198 \let^=\normalcaret
12199 \let_=\normalunderscore
12200 \let|=\normalverticalbar
12201 \let~=\normaltilde
12202 \otherbackslash
12203 \setregularquotes
12204 \unsepspaces
12205 }
12206
12207 % If a .fmt file is being used, characters that might appear in a file
12208 % name cannot be active until we have parsed the command line.
12209 % So turn them off again, and have \loadconf turn them back on.
12210 \catcode`+=\other \catcode`\_=\other
12211
12212
12213 % \backslashcurfont outputs one backslash character in current font,
12214 % as in \char`\\.
12215 \global\chardef\backslashcurfont=`\\
12216
12217 % Print a typewriter backslash. For math mode, we can't simply use
12218 % \backslashcurfont: the story here is that in math mode, the \char
12219 % of \backslashcurfont ends up printing the roman \ from the math symbol
12220 % font (because \char in math mode uses the \mathcode, and plain.tex
12221 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
12222 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
12223 % ignored family value; char position "5C). We can't use " for the
12224 % usual hex value because it has already been made active.
12225
12226 \def\ttbackslash{{\tt \ifmmode \mathchar29020 \else \backslashcurfont \fi}}
12227 \let\backslashchar = \ttbackslash % \backslashchar{} is for user documents.
12228
12229 % These are made active for url-breaking, so need
12230 % active definitions as the normal characters.
12231 \def\normaldot{.}
12232 \def\normalquest{?}
12233 \def\normalslash{/}
12234
12235 % \newlinesloadsconf - call \loadconf as soon as possible in the
12236 % file, e.g. at the first newline.
12237 %
12238 {\catcode`\^=7
12239 \catcode`\^^M=13
12240 \gdef\newlineloadsconf{%
12241 \catcode`\^^M=13 %
12242 \newlineloadsconfzz%
12243 }
12244 \gdef\newlineloadsconfzz#1^^M{%
12245 \def\c{\loadconf\c}%
12246 % Definition for the first newline read in the file
12247 \def ^^M{\loadconf}%
12248 % In case the first line has a whole-line or environment command on it
12249 \let\originalparsearg\parsearg%
12250 \def\parsearg{\loadconf\originalparsearg}%
12251 %
12252 % \startenvironment is in the expansion of commands defined with \envdef
12253 \let\originalstartenvironment\startenvironment%
12254 \def\startenvironment{\loadconf\startenvironment}%
12255 }}
12256
12257
12258 % Emergency active definition of newline, in case an active newline token
12259 % appears by mistake.
12260 {\catcode`\^=7 \catcode13=13%
12261 \gdef\enableemergencynewline{%
12262 \gdef^^M{%
12263 \par%
12264 %<warning: active newline>\par%
12265 }}}
12266
12267
12268 % \loadconf gets called at the beginning of every Texinfo file.
12269 % If texinfo.cnf is present on the system, read it. Useful for site-wide
12270 % @afourpaper, etc. Not opening texinfo.cnf directly in texinfo.tex
12271 % makes it possible to make a format file for Texinfo.
12272 %
12273 \gdef\loadconf{%
12274 \relax % Terminate the filename if running as "tex '&texinfo' FILE.texi".
12275 %
12276 % Turn off the definitions that trigger \loadconf
12277 \everyjobreset
12278 \catcode13=5 % regular end of line
12279 \enableemergencynewline
12280 \let\c=\comment
12281 \let\parsearg\originalparsearg
12282 \let\startenvironment\originalstartenvironment
12283 %
12284 % Also turn back on active characters that might appear in the input
12285 % file name, in case not using a pre-dumped format.
12286 \catcode`+=\active
12287 \catcode`\_=\active
12288 %
12289 \openin 1 texinfo.cnf
12290 \ifeof 1 \else \input texinfo.cnf \fi
12291 \closein 1
12292 }
12293
12294 % Redefine some control sequences to be controlled by the \ifdummies
12295 % and \ifindexnofonts switches. Do this at the end so that the control
12296 % sequences are all defined.
12297 \definedummies
12298
12299
12300
12301
12302 \catcode`\@=0
12303
12304 % \realbackslash is an actual character `\' with catcode other.
12305 {\catcode`\\=\other @gdef@realbackslash{\}}
12306
12307 % In Texinfo, backslash is an active character; it prints the backslash
12308 % in fixed width font.
12309 \catcode`\\=\active % @ for escape char from now on.
12310
12311 @let\ = @ttbackslash
12312
12313 % If in a .fmt file, print the version number.
12314 % \eatinput stops the `\input texinfo' from showing up.
12315 % After that, `\' should revert to printing a backslash.
12316 % Turn on active characters that we couldn't do earlier because
12317 % they might have appeared in the input file name.
12318 %
12319 @everyjob{@message{[Texinfo version @texinfoversion]}%
12320 @global@let\ = @eatinput
12321 @catcode`+=@active @catcode`@_=@active}
12322
12323 {@catcode`@^=7 @catcode`@^^M=13%
12324 @gdef@eatinput input texinfo#1^^M{@loadconf}}
12325
12326 @def@everyjobreset{@ifx\@eatinput @let\ = @ttbackslash @fi}
12327
12328 % \otherbackslash defines an active \ to be a literal `\' character with
12329 % catcode other.
12330 @gdef@otherbackslash{@let\=@realbackslash}
12331
12332 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
12333 % the literal character `\'.
12334 %
12335 {@catcode`- = @active
12336 @gdef@normalturnoffactive{%
12337 @turnoffactive
12338 @let\=@ttbackslash
12339 }
12340 }
12341
12342 % Say @foo, not \foo, in error messages.
12343 @escapechar = `@@
12344
12345 % These look ok in all fonts, so just make them not special.
12346 % @hashchar{} gets its own user-level command, because of #line.
12347 @catcode`@& = @other @def@normalamp{&}
12348 @catcode`@# = @other @def@normalhash{#}
12349 @catcode`@% = @other @def@normalpercent{%}
12350
12351 @let @hashchar = @normalhash
12352
12353 @c Finally, make ` and ' active, so that txicodequoteundirected and
12354 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
12355 @c don't make ` and ' active, @code will not get them as active chars.
12356 @c Do this last of all since we use ` in the previous @catcode assignments.
12357 @catcode`@'=@active
12358 @catcode`@`=@active
12359
12360 @c Local variables:
12361 @c eval: (add-hook 'before-save-hook 'time-stamp nil t)
12362 @c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
12363 @c page-delimiter: "^\\\\message"
12364 @c End:
12365
12366 @newlineloadsconf