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{2023-06-08.14}
7 %
8 % Copyright 1985, 1986, 1988, 1990-2023 Free Software Foundation, Inc.
9 %
10 % This texinfo.tex file is free software: you can redistribute it and/or
11 % modify it under the terms of the GNU General Public License as
12 % published by the Free Software Foundation, either version 3 of the
13 % License, or (at your option) any later version.
14 %
15 % This texinfo.tex file is distributed in the hope that it will be
16 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 % General Public License for more details.
19 %
20 % You should have received a copy of the GNU General Public License
21 % along with this program. If not, see <https://www.gnu.org/licenses/>.
22 %
23 % As a special exception, when this file is read by TeX when processing
24 % a Texinfo source document, you may use the result without
25 % restriction. This Exception is an additional permission under section 7
26 % of the GNU General Public License, version 3 ("GPLv3").
27 %
28 % Please try the latest version of texinfo.tex before submitting bug
29 % reports; you can get the latest version from:
30 % https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
31 % https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
32 % https://www.gnu.org/software/texinfo/ (the Texinfo home page)
33 % The texinfo.tex in any given distribution could well be out
34 % of date, so if that's what you're using, please check.
35 %
36 % Send bug reports to [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 % Likewise for ^^M, the end of line character.
160 \def\endlineisspace{\catcode13=10\relax}
161
162 \chardef\dashChar = `\-
163 \chardef\slashChar = `\/
164 \chardef\underChar = `\_
165
166 % Ignore a token.
167 %
168 \def\gobble#1{}
169
170 % The following is used inside several \edef's.
171 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
172
173 % Hyphenation fixes.
174 \hyphenation{
175 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
176 ap-pen-dix bit-map bit-maps
177 data-base data-bases eshell fall-ing half-way long-est man-u-script
178 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
179 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
180 spell-ing spell-ings
181 stand-alone strong-est time-stamp time-stamps which-ever white-space
182 wide-spread wrap-around
183 }
184
185 % Sometimes it is convenient to have everything in the transcript file
186 % and nothing on the terminal. We don't just call \tracingall here,
187 % since that produces some useless output on the terminal. We also make
188 % some effort to order the tracing commands to reduce output in the log
189 % file; cf. trace.sty in LaTeX.
190 %
191 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
192 \def\loggingall{%
193 \tracingstats2
194 \tracingpages1
195 \tracinglostchars2 % 2 gives us more in etex
196 \tracingparagraphs1
197 \tracingoutput1
198 \tracingmacros2
199 \tracingrestores1
200 \showboxbreadth\maxdimen \showboxdepth\maxdimen
201 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
202 \tracingscantokens1
203 \tracingifs1
204 \tracinggroups1
205 \tracingnesting2
206 \tracingassigns1
207 \fi
208 \tracingcommands3 % 3 gives us more in etex
209 \errorcontextlines16
210 }%
211
212 % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
213 % aren't perfect, it's not the end of the world, being an error message,
214 % after all.
215 %
216 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
217 \def\doerrormsg#1{\errmessage{#1}}
218
219 % add check for \lastpenalty to plain's definitions. If the last thing
220 % we did was a \nobreak, we don't want to insert more space.
221 %
222 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
223 \removelastskip\penalty-50\smallskip\fi\fi}
224 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
225 \removelastskip\penalty-100\medskip\fi\fi}
226 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
227 \removelastskip\penalty-200\bigskip\fi\fi}
228
229 % Output routine
230 %
231
232 % For a final copy, take out the rectangles
233 % that mark overfull boxes (in case you have decided
234 % that the text looks ok even though it passes the margin).
235 %
236 \def\finalout{\overfullrule=0pt }
237
238 % Output a mark which sets \thischapter, \thissection and \thiscolor.
239 % We dump everything together because we only have one kind of mark.
240 % This works because we only use \botmark / \topmark, not \firstmark.
241 %
242 % A mark contains a subexpression of the \ifcase ... \fi construct.
243 % \get*marks macros below extract the needed part using \ifcase.
244 %
245 % Another complication is to let the user choose whether \thischapter
246 % (\thissection) refers to the chapter (section) in effect at the top
247 % of a page, or that at the bottom of a page.
248
249 % \domark is called twice inside \chapmacro, to add one
250 % mark before the section break, and one after.
251 % In the second call \prevchapterdefs is the same as \currentchapterdefs,
252 % and \prevsectiondefs is the same as \currentsectiondefs.
253 % Then if the page is not broken at the mark, some of the previous
254 % section appears on the page, and we can get the name of this section
255 % from \firstmark for @everyheadingmarks top.
256 % @everyheadingmarks bottom uses \botmark.
257 %
258 % See page 260 of The TeXbook.
259 \def\domark{%
260 \toks0=\expandafter{\currentchapterdefs}%
261 \toks2=\expandafter{\currentsectiondefs}%
262 \toks4=\expandafter{\prevchapterdefs}%
263 \toks6=\expandafter{\prevsectiondefs}%
264 \toks8=\expandafter{\currentcolordefs}%
265 \mark{%
266 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
267 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
268 \noexpand\else \the\toks8 % 2: color marks
269 }%
270 }
271
272 % \gettopheadingmarks, \getbottomheadingmarks,
273 % \getcolormarks - extract needed part of mark.
274 %
275 % \topmark doesn't work for the very first chapter (after the title
276 % page or the contents), so we use \firstmark there -- this gets us
277 % the mark with the chapter defs, unless the user sneaks in, e.g.,
278 % @setcolor (or @url etc.) between @contents and the very first @chapter.
279 \def\gettopheadingmarks{%
280 \ifcase0\the\savedtopmark\fi
281 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
282 }
283 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
284 \def\getcolormarks{\ifcase2\the\savedtopmark\fi}
285
286 % Avoid "undefined control sequence" errors.
287 \def\currentchapterdefs{}
288 \def\currentsectiondefs{}
289 \def\currentsection{}
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 % \argcheckspaces.
430 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
431 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
432
433 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
434 %
435 % \argremovec might leave us with trailing space, e.g.,
436 % @end itemize @c foo
437 % This space token undergoes the same procedure and is eventually removed
438 % by \finishparsearg.
439 %
440 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
441 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
442 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
443 \def\temp{#3}%
444 \ifx\temp\empty
445 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
446 \let\temp\finishparsearg
447 \else
448 \let\temp\argcheckspaces
449 \fi
450 % Put the space token in:
451 \temp#1 #3\ArgTerm
452 }
453
454 % If a _delimited_ argument is enclosed in braces, they get stripped; so
455 % to get _exactly_ the rest of the line, we had to prevent such situation.
456 % We prepended an \empty token at the very beginning and we expand it now,
457 % just before passing the control to \argtorun.
458 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
459 % either the null string, or it ends with \^^M---thus there is no danger
460 % that a pair of braces would be stripped.
461 %
462 % But first, we have to remove the trailing space token.
463 %
464 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
465
466
467 % \parseargdef - define a command taking an argument on the line
468 %
469 % \parseargdef\foo{...}
470 % is roughly equivalent to
471 % \def\foo{\parsearg\Xfoo}
472 % \def\Xfoo#1{...}
473 \def\parseargdef#1{%
474 \expandafter \doparseargdef \csname\string#1\endcsname #1%
475 }
476 \def\doparseargdef#1#2{%
477 \def#2{\parsearg#1}%
478 \def#1##1%
479 }
480
481 % Several utility definitions with active space:
482 {
483 \obeyspaces
484 \gdef\obeyedspace{ }
485
486 % Make each space character in the input produce a normal interword
487 % space in the output. Don't allow a line break at this space, as this
488 % is used only in environments like @example, where each line of input
489 % should produce a line of output anyway.
490 %
491 \gdef\sepspaces{\obeyspaces\let =\tie}
492
493 % If an index command is used in an @example environment, any spaces
494 % therein should become regular spaces in the raw index file, not the
495 % expansion of \tie (\leavevmode \penalty \@M \ ).
496 \gdef\unsepspaces{\let =\space}
497 }
498
499
500 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
501
502 % Define the framework for environments in texinfo.tex. It's used like this:
503 %
504 % \envdef\foo{...}
505 % \def\Efoo{...}
506 %
507 % It's the responsibility of \envdef to insert \begingroup before the
508 % actual body; @end closes the group after calling \Efoo. \envdef also
509 % defines \thisenv, so the current environment is known; @end checks
510 % whether the environment name matches. The \checkenv macro can also be
511 % used to check whether the current environment is the one expected.
512 %
513 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
514 % are not treated as environments; they don't open a group. (The
515 % implementation of @end takes care not to call \endgroup in this
516 % special case.)
517
518
519 % At run-time, environments start with this:
520 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
521 % initialize
522 \let\thisenv\empty
523
524 % ... but they get defined via ``\envdef\foo{...}'':
525 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
526 \long\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
527
528 % Check whether we're in the right environment:
529 \def\checkenv#1{%
530 \def\temp{#1}%
531 \ifx\thisenv\temp
532 \else
533 \badenverr
534 \fi
535 }
536
537 % Environment mismatch, #1 expected:
538 \def\badenverr{%
539 \errhelp = \EMsimple
540 \errmessage{This command can appear only \inenvironment\temp,
541 not \inenvironment\thisenv}%
542 }
543 \def\inenvironment#1{%
544 \ifx#1\empty
545 outside of any environment%
546 \else
547 in environment \expandafter\string#1%
548 \fi
549 }
550
551
552 % @end foo calls \checkenv and executes the definition of \Efoo.
553 \parseargdef\end{%
554 \if 1\csname iscond.#1\endcsname
555 \else
556 % The general wording of \badenverr may not be ideal.
557 \expandafter\checkenv\csname#1\endcsname
558 \csname E#1\endcsname
559 \endgroup
560 \fi
561 }
562
563 \newhelp\EMsimple{Press RETURN to continue.}
564
565
566 % Be sure we're in horizontal mode when doing a tie, since we make space
567 % equivalent to this in @example-like environments. Otherwise, a space
568 % at the beginning of a line will start with \penalty -- and
569 % since \penalty is valid in vertical mode, we'd end up putting the
570 % penalty on the vertical list instead of in the new paragraph.
571 {\catcode`@ = 11
572 % Avoid using \@M directly, because that causes trouble
573 % if the definition is written into an index file.
574 \global\let\tiepenalty = \@M
575 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
576 }
577
578 % @: forces normal size whitespace following.
579 \def\:{\spacefactor=1000 }
580
581 % @* forces a line break.
582 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
583
584 % @/ allows a line break.
585 \let\/=\allowbreak
586
587 % @- allows explicit insertion of hyphenation points
588 \def\-{\discretionary{\normaldash}{}{}}%
589
590 % @. is an end-of-sentence period.
591 \def\.{.\spacefactor=\endofsentencespacefactor\space}
592
593 % @! is an end-of-sentence bang.
594 \def\!{!\spacefactor=\endofsentencespacefactor\space}
595
596 % @? is an end-of-sentence query.
597 \def\?{?\spacefactor=\endofsentencespacefactor\space}
598
599 % @w prevents a word break. Without the \leavevmode, @w at the
600 % beginning of a paragraph, when TeX is still in vertical mode, would
601 % produce a whole line of output instead of starting the paragraph.
602 \def\w#1{\leavevmode\hbox{#1}}
603
604 % @group ... @end group forces ... to be all on one page, by enclosing
605 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
606 % to keep its height that of a normal line. According to the rules for
607 % \topskip (p.114 of the TeXbook), the glue inserted is
608 % max (\topskip - \ht (first item), 0). If that height is large,
609 % therefore, no glue is inserted, and the space between the headline and
610 % the text is small, which looks bad.
611 %
612 % Another complication is that the group might be very large. This can
613 % cause the glue on the previous page to be unduly stretched, because it
614 % does not have much material. In this case, it's better to add an
615 % explicit \vfill so that the extra space is at the bottom. The
616 % threshold for doing this is if the group is more than \vfilllimit
617 % percent of a page (\vfilllimit can be changed inside of @tex).
618 %
619 \newbox\groupbox
620 \def\vfilllimit{0.7}
621 %
622 \envdef\group{%
623 \ifnum\catcode`\^^M=\active \else
624 \errhelp = \groupinvalidhelp
625 \errmessage{@group invalid in context where filling is enabled}%
626 \fi
627 \startsavinginserts
628 %
629 \setbox\groupbox = \vtop\bgroup
630 % Do @comment since we are called inside an environment such as
631 % @example, where each end-of-line in the input causes an
632 % end-of-line in the output. We don't want the end-of-line after
633 % the `@group' to put extra space in the output. Since @group
634 % should appear on a line by itself (according to the Texinfo
635 % manual), we don't worry about eating any user text.
636 \comment
637 }
638 %
639 % The \vtop produces a box with normal height and large depth; thus, TeX puts
640 % \baselineskip glue before it, and (when the next line of text is done)
641 % \lineskip glue after it. Thus, space below is not quite equal to space
642 % above. But it's pretty close.
643 \def\Egroup{%
644 % To get correct interline space between the last line of the group
645 % and the first line afterwards, we have to propagate \prevdepth.
646 \endgraf % Not \par, as it may have been set to \lisppar.
647 \global\dimen1 = \prevdepth
648 \egroup % End the \vtop.
649 \addgroupbox
650 \prevdepth = \dimen1
651 \checkinserts
652 }
653
654 \def\addgroupbox{
655 % \dimen0 is the vertical size of the group's box.
656 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
657 % \dimen2 is how much space is left on the page (more or less).
658 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
659 % if the group doesn't fit on the current page, and it's a big big
660 % group, force a page break.
661 \ifdim \dimen0 > \dimen2
662 \ifdim \pagetotal < \vfilllimit\txipageheight
663 \page
664 \fi
665 \fi
666 \box\groupbox
667 }
668
669 %
670 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
671 % message, so this ends up printing `@group can only ...'.
672 %
673 \newhelp\groupinvalidhelp{%
674 group can only be used in environments such as @example,^^J%
675 where each line of input produces a line of output.}
676
677 % @need space-in-mils
678 % forces a page break if there is not space-in-mils remaining.
679
680 \newdimen\mil \mil=0.001in
681
682 \parseargdef\need{%
683 % Ensure vertical mode, so we don't make a big box in the middle of a
684 % paragraph.
685 \par
686 %
687 % If the @need value is less than one line space, it's useless.
688 \dimen0 = #1\mil
689 \dimen2 = \ht\strutbox
690 \advance\dimen2 by \dp\strutbox
691 \ifdim\dimen0 > \dimen2
692 % This is similar to the 'needspace' module in LaTeX.
693 % The first penalty allows a break if the end of the page is
694 % not too far away. Following penalties and skips are discarded.
695 % Otherwise, require at least \dimen0 of vertical space.
696 %
697 % (We used to use a \vtop to reserve space, but this had spacing issues
698 % when followed by a section heading, as it was not a "discardable item".
699 % This also has the benefit of providing glue before the page break if
700 % there isn't enough space.)
701 \vskip0pt plus \dimen0
702 \penalty-100
703 \vskip0pt plus -\dimen0
704 \vskip \dimen0
705 \penalty9999
706 \vskip -\dimen0
707 \penalty0\relax % this hides the above glue from \safewhatsit and \dobreak
708 \fi
709 }
710
711 % @br forces paragraph break (and is undocumented).
712
713 \let\br = \par
714
715 % @page forces the start of a new page.
716 %
717 \def\page{\par\vfill\supereject}
718
719 % @exdent text....
720 % outputs text on separate line in roman font, starting at standard page margin
721
722 % This records the amount of indent in the innermost environment.
723 % That's how much \exdent should take out.
724 \newskip\exdentamount
725
726 % This defn is used inside fill environments such as @defun.
727 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
728
729 % This defn is used inside nofill environments such as @example.
730 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
731 \leftline{\hskip\leftskip{\rm#1}}}}
732
733 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
734 % paragraph. For more general purposes, use the \margin insertion
735 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
736 %
737 \newskip\inmarginspacing \inmarginspacing=1cm
738 \def\strutdepth{\dp\strutbox}
739 %
740 \def\doinmargin#1#2{\strut\vadjust{%
741 \nobreak
742 \kern-\strutdepth
743 \vtop to \strutdepth{%
744 \baselineskip=\strutdepth
745 \vss
746 % if you have multiple lines of stuff to put here, you'll need to
747 % make the vbox yourself of the appropriate size.
748 \ifx#1l%
749 \llap{\ignorespaces #2\hskip\inmarginspacing}%
750 \else
751 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
752 \fi
753 \null
754 }%
755 }}
756 \def\inleftmargin{\doinmargin l}
757 \def\inrightmargin{\doinmargin r}
758 %
759 % @inmargin{TEXT [, RIGHT-TEXT]}
760 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
761 % else use TEXT for both).
762 %
763 \def\inmargin#1{\parseinmargin #1,,\finish}
764 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
765 \setbox0 = \hbox{\ignorespaces #2}%
766 \ifdim\wd0 > 0pt
767 \def\lefttext{#1}% have both texts
768 \def\righttext{#2}%
769 \else
770 \def\lefttext{#1}% have only one text
771 \def\righttext{#1}%
772 \fi
773 %
774 \ifodd\pageno
775 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
776 \else
777 \def\temp{\inleftmargin\lefttext}%
778 \fi
779 \temp
780 }
781
782 % @include FILE -- \input text of FILE.
783 %
784 \def\include{\parseargusing\filenamecatcodes\includezzz}
785 \def\includezzz#1{%
786 \pushthisfilestack
787 \def\thisfile{#1}%
788 {%
789 \makevalueexpandable % we want to expand any @value in FILE.
790 \turnoffactive % and allow special characters in the expansion
791 \indexnofonts % Allow `@@' and other weird things in file names.
792 \wlog{texinfo.tex: doing @include of #1^^J}%
793 \edef\temp{\noexpand\input #1 }%
794 %
795 % This trickery is to read FILE outside of a group, in case it makes
796 % definitions, etc.
797 \expandafter
798 }\temp
799 \popthisfilestack
800 }
801 \def\filenamecatcodes{%
802 \catcode`\\=\other
803 \catcode`~=\other
804 \catcode`^=\other
805 \catcode`_=\other
806 \catcode`|=\other
807 \catcode`<=\other
808 \catcode`>=\other
809 \catcode`+=\other
810 \catcode`-=\other
811 \catcode`\`=\other
812 \catcode`\'=\other
813 }
814
815 \def\pushthisfilestack{%
816 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
817 }
818 \def\pushthisfilestackX{%
819 \expandafter\pushthisfilestackY\thisfile\StackTerm
820 }
821 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
822 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
823 }
824
825 \def\popthisfilestack{\errthisfilestackempty}
826 \def\errthisfilestackempty{\errmessage{Internal error:
827 the stack of filenames is empty.}}
828 %
829 \def\thisfile{}
830
831 % @center line
832 % outputs that line, centered.
833 %
834 \parseargdef\center{%
835 \ifhmode
836 \let\centersub\centerH
837 \else
838 \let\centersub\centerV
839 \fi
840 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
841 \let\centersub\relax % don't let the definition persist, just in case
842 }
843 \def\centerH#1{{%
844 \hfil\break
845 \advance\hsize by -\leftskip
846 \advance\hsize by -\rightskip
847 \line{#1}%
848 \break
849 }}
850 %
851 \newcount\centerpenalty
852 \def\centerV#1{%
853 % The idea here is the same as in \startdefun, \cartouche, etc.: if
854 % @center is the first thing after a section heading, we need to wipe
855 % out the negative parskip inserted by \sectionheading, but still
856 % prevent a page break here.
857 \centerpenalty = \lastpenalty
858 \ifnum\centerpenalty>10000 \vskip\parskip \fi
859 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
860 \line{\kern\leftskip #1\kern\rightskip}%
861 }
862
863 % @sp n outputs n lines of vertical space
864 %
865 \parseargdef\sp{\vskip #1\baselineskip}
866
867 % @comment ...line which is ignored...
868 % @c is the same as @comment
869 % @ignore ... @end ignore is another way to write a comment
870
871
872 \def\c{\begingroup \catcode`\^^M=\active%
873 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
874 \cxxx}
875 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
876 %
877 \let\comment\c
878
879 % @paragraphindent NCHARS
880 % We'll use ems for NCHARS, close enough.
881 % NCHARS can also be the word `asis' or `none'.
882 % We cannot feasibly implement @paragraphindent asis, though.
883 %
884 \def\asisword{asis} % no translation, these are keywords
885 \def\noneword{none}
886 %
887 \parseargdef\paragraphindent{%
888 \def\temp{#1}%
889 \ifx\temp\asisword
890 \else
891 \ifx\temp\noneword
892 \defaultparindent = 0pt
893 \else
894 \defaultparindent = #1em
895 \fi
896 \fi
897 \parindent = \defaultparindent
898 }
899
900 % @exampleindent NCHARS
901 % We'll use ems for NCHARS like @paragraphindent.
902 % It seems @exampleindent asis isn't necessary, but
903 % I preserve it to make it similar to @paragraphindent.
904 \parseargdef\exampleindent{%
905 \def\temp{#1}%
906 \ifx\temp\asisword
907 \else
908 \ifx\temp\noneword
909 \lispnarrowing = 0pt
910 \else
911 \lispnarrowing = #1em
912 \fi
913 \fi
914 }
915
916 % @firstparagraphindent WORD
917 % If WORD is `none', then suppress indentation of the first paragraph
918 % after a section heading. If WORD is `insert', then do indent at such
919 % paragraphs.
920 %
921 % The paragraph indentation is suppressed or not by calling
922 % \suppressfirstparagraphindent, which the sectioning commands do.
923 % We switch the definition of this back and forth according to WORD.
924 % By default, we suppress indentation.
925 %
926 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
927 \def\insertword{insert}
928 %
929 \parseargdef\firstparagraphindent{%
930 \def\temp{#1}%
931 \ifx\temp\noneword
932 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
933 \else\ifx\temp\insertword
934 \let\suppressfirstparagraphindent = \relax
935 \else
936 \errhelp = \EMsimple
937 \errmessage{Unknown @firstparagraphindent option `\temp'}%
938 \fi\fi
939 }
940
941 % Here is how we actually suppress indentation. Redefine \everypar to
942 % \kern backwards by \parindent, and then reset itself to empty.
943 %
944 % We also make \indent itself not actually do anything until the next
945 % paragraph.
946 %
947 \gdef\dosuppressfirstparagraphindent{%
948 \gdef\indent {\restorefirstparagraphindent \indent}%
949 \gdef\noindent{\restorefirstparagraphindent \noindent}%
950 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
951 }
952 %
953 \gdef\restorefirstparagraphindent{%
954 \global\let\indent = \ptexindent
955 \global\let\noindent = \ptexnoindent
956 \global\everypar = {}%
957 }
958
959 % leave vertical mode without cancelling any first paragraph indent
960 \gdef\imageindent{%
961 \toks0=\everypar
962 \everypar={}%
963 \ptexnoindent
964 \global\everypar=\toks0
965 }
966
967
968 % @refill is a no-op.
969 \let\refill=\relax
970
971 % @setfilename INFO-FILENAME - ignored
972 \let\setfilename=\comment
973
974 % @bye.
975 \outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
976
977
978 \message{pdf,}
979 % adobe `portable' document format
980 \newcount\tempnum
981 \newcount\lnkcount
982 \newtoks\filename
983 \newcount\filenamelength
984 \newcount\pgn
985 \newtoks\toksA
986 \newtoks\toksB
987 \newtoks\toksC
988 \newtoks\toksD
989 \newbox\boxA
990 \newbox\boxB
991 \newcount\countA
992 \newif\ifpdf
993 \newif\ifpdfmakepagedest
994
995 %
996 % For LuaTeX
997 %
998
999 \newif\iftxiuseunicodedestname
1000 \txiuseunicodedestnamefalse % For pdfTeX etc.
1001
1002 \ifx\luatexversion\thisisundefined
1003 \else
1004 % Use Unicode destination names
1005 \txiuseunicodedestnametrue
1006 % Escape PDF strings with converting UTF-16 from UTF-8
1007 \begingroup
1008 \catcode`\%=12
1009 \directlua{
1010 function UTF16oct(str)
1011 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1012 for c in string.utfvalues(str) do
1013 if c < 0x10000 then
1014 tex.sprint(
1015 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1016 string.char(0x5c) .. string.char(0x25) .. '03o',
1017 math.floor(c / 256), math.floor(c % 256)))
1018 else
1019 c = c - 0x10000
1020 local c_hi = c / 1024 + 0xd800
1021 local c_lo = c % 1024 + 0xdc00
1022 tex.sprint(
1023 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1024 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1025 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1026 string.char(0x5c) .. string.char(0x25) .. '03o',
1027 math.floor(c_hi / 256), math.floor(c_hi % 256),
1028 math.floor(c_lo / 256), math.floor(c_lo % 256)))
1029 end
1030 end
1031 end
1032 }
1033 \endgroup
1034 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1035 % Escape PDF strings without converting
1036 \begingroup
1037 \directlua{
1038 function PDFescstr(str)
1039 for c in string.bytes(str) do
1040 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1041 tex.sprint(-2,
1042 string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1043 c))
1044 else
1045 tex.sprint(-2, string.char(c))
1046 end
1047 end
1048 end
1049 }
1050 % The -2 in the arguments here gives all the input to TeX catcode 12
1051 % (other) or 10 (space), preventing undefined control sequence errors. See
1052 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
1053 %
1054 \endgroup
1055 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1056 \ifnum\luatexversion>84
1057 % For LuaTeX >= 0.85
1058 \def\pdfdest{\pdfextension dest}
1059 \let\pdfoutput\outputmode
1060 \def\pdfliteral{\pdfextension literal}
1061 \def\pdfcatalog{\pdfextension catalog}
1062 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1063 \let\pdfximage\saveimageresource
1064 \let\pdfrefximage\useimageresource
1065 \let\pdflastximage\lastsavedimageresourceindex
1066 \def\pdfendlink{\pdfextension endlink\relax}
1067 \def\pdfoutline{\pdfextension outline}
1068 \def\pdfstartlink{\pdfextension startlink}
1069 \def\pdffontattr{\pdfextension fontattr}
1070 \def\pdfobj{\pdfextension obj}
1071 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1072 \let\pdfpagewidth\pagewidth
1073 \let\pdfpageheight\pageheight
1074 \edef\pdfhorigin{\pdfvariable horigin}
1075 \edef\pdfvorigin{\pdfvariable vorigin}
1076 \fi
1077 \fi
1078
1079 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1080 % can be set). So we test for \relax and 0 as well as being undefined.
1081 \ifx\pdfoutput\thisisundefined
1082 \else
1083 \ifx\pdfoutput\relax
1084 \else
1085 \ifcase\pdfoutput
1086 \else
1087 \pdftrue
1088 \fi
1089 \fi
1090 \fi
1091
1092 \newif\ifpdforxetex
1093 \pdforxetexfalse
1094 \ifpdf
1095 \pdforxetextrue
1096 \fi
1097 \ifx\XeTeXrevision\thisisundefined\else
1098 \pdforxetextrue
1099 \fi
1100
1101
1102 % Output page labels information.
1103 % See PDF reference v.1.7 p.594, section 8.3.1.
1104 % Page label ranges must be increasing.
1105 \ifpdf
1106 \def\pagelabels{%
1107 \def\title{0 << /P (T-) /S /D >>}%
1108 %
1109 % support @contents at very end of document
1110 \ifnum\contentsendcount=\pagecount
1111 \ifnum\arabiccount<\romancount
1112 \pdfcatalog{/PageLabels << /Nums
1113 [\title
1114 \the\arabiccount << /S /D >>
1115 \the\romancount << /S /r >>
1116 ] >> }\relax
1117 \fi
1118 % no contents in document
1119 \else\ifnum\contentsendcount=0
1120 \pdfcatalog{/PageLabels << /Nums
1121 [\title
1122 \the\arabiccount << /S /D >>
1123 ] >> }\relax
1124 \else
1125 \pdfcatalog{/PageLabels << /Nums
1126 [\title
1127 \the\romancount << /S /r >>
1128 \the\contentsendcount << /S /D >>
1129 ] >> }\relax
1130 \fi\fi
1131 }
1132 \else
1133 \let\pagelabels\relax
1134 \fi
1135
1136 \newcount\pagecount \pagecount=0
1137 \newcount\romancount \romancount=0
1138 \newcount\arabiccount \arabiccount=0
1139 \newcount\contentsendcount \contentsendcount=0
1140
1141 \ifpdf
1142 \let\ptxadvancepageno\advancepageno
1143 \def\advancepageno{%
1144 \ptxadvancepageno\global\advance\pagecount by 1
1145 }
1146 \fi
1147
1148
1149 % PDF uses PostScript string constants for the names of xref targets,
1150 % for display in the outlines, and in other places. Thus, we have to
1151 % double any backslashes. Otherwise, a name like "\node" will be
1152 % interpreted as a newline (\n), followed by o, d, e. Not good.
1153 %
1154 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1155 % related messages. The final outcome is that it is up to the TeX user
1156 % to double the backslashes and otherwise make the string valid, so
1157 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1158 % do this reliably, so we use it.
1159
1160 % #1 is a control sequence in which to do the replacements,
1161 % which we \xdef.
1162 \def\txiescapepdf#1{%
1163 \ifx\pdfescapestring\thisisundefined
1164 % No primitive available; should we give a warning or log?
1165 % Many times it won't matter.
1166 \xdef#1{#1}%
1167 \else
1168 % The expandable \pdfescapestring primitive escapes parentheses,
1169 % backslashes, and other special chars.
1170 \xdef#1{\pdfescapestring{#1}}%
1171 \fi
1172 }
1173 \def\txiescapepdfutfsixteen#1{%
1174 \ifx\pdfescapestrutfsixteen\thisisundefined
1175 % No UTF-16 converting macro available.
1176 \txiescapepdf{#1}%
1177 \else
1178 \xdef#1{\pdfescapestrutfsixteen{#1}}%
1179 \fi
1180 }
1181
1182 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1183 with PDF output, and none of those formats could be found. (.eps cannot
1184 be supported due to the design of the PDF format; use regular TeX (DVI
1185 output) for that.)}
1186
1187 \ifpdf
1188 %
1189 % Color manipulation macros using ideas from pdfcolor.tex,
1190 % except using rgb instead of cmyk; the latter is said to render as a
1191 % very dark gray on-screen and a very dark halftone in print, instead
1192 % of actual black. The dark red here is dark enough to print on paper as
1193 % nearly black, but still distinguishable for online viewing. We use
1194 % black by default, though.
1195 \def\rgbDarkRed{0.50 0.09 0.12}
1196 \def\rgbBlack{0 0 0}
1197 %
1198 % rg sets the color for filling (usual text, etc.);
1199 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1200 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1201 %
1202 % Set color, and create a mark which defines \thiscolor accordingly,
1203 % so that \makeheadline knows which color to restore.
1204 \def\curcolor{0 0 0}%
1205 \def\setcolor#1{%
1206 \ifx#1\curcolor\else
1207 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1208 \domark
1209 \pdfsetcolor{#1}%
1210 \xdef\curcolor{#1}%
1211 \fi
1212 }
1213 %
1214 \let\maincolor\rgbBlack
1215 \pdfsetcolor{\maincolor}
1216 \edef\thiscolor{\maincolor}
1217 \def\currentcolordefs{}
1218 %
1219 \def\makefootline{%
1220 \baselineskip24pt
1221 \line{\pdfsetcolor{\maincolor}\the\footline}%
1222 }
1223 %
1224 \def\makeheadline{%
1225 \vbox to 0pt{%
1226 \vskip-22.5pt
1227 \line{%
1228 \vbox to8.5pt{}%
1229 % Extract \thiscolor definition from the marks.
1230 \getcolormarks
1231 % Typeset the headline with \maincolor, then restore the color.
1232 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1233 }%
1234 \vss
1235 }%
1236 \nointerlineskip
1237 }
1238 %
1239 %
1240 \pdfcatalog{/PageMode /UseOutlines}
1241 %
1242 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1243 \def\dopdfimage#1#2#3{%
1244 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1245 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1246 %
1247 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1248 % others). Let's try in that order, PDF first since if
1249 % someone has a scalable image, presumably better to use that than a
1250 % bitmap.
1251 \let\pdfimgext=\empty
1252 \begingroup
1253 \openin 1 #1.pdf \ifeof 1
1254 \openin 1 #1.PDF \ifeof 1
1255 \openin 1 #1.png \ifeof 1
1256 \openin 1 #1.jpg \ifeof 1
1257 \openin 1 #1.jpeg \ifeof 1
1258 \openin 1 #1.JPG \ifeof 1
1259 \errhelp = \nopdfimagehelp
1260 \errmessage{Could not find image file #1 for pdf}%
1261 \else \gdef\pdfimgext{JPG}%
1262 \fi
1263 \else \gdef\pdfimgext{jpeg}%
1264 \fi
1265 \else \gdef\pdfimgext{jpg}%
1266 \fi
1267 \else \gdef\pdfimgext{png}%
1268 \fi
1269 \else \gdef\pdfimgext{PDF}%
1270 \fi
1271 \else \gdef\pdfimgext{pdf}%
1272 \fi
1273 \closein 1
1274 \endgroup
1275 %
1276 % without \immediate, ancient pdftex seg faults when the same image is
1277 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1278 \ifnum\pdftexversion < 14
1279 \immediate\pdfimage
1280 \else
1281 \immediate\pdfximage
1282 \fi
1283 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1284 \ifdim \wd2 >0pt height \pdfimageheight \fi
1285 \ifnum\pdftexversion<13
1286 #1.\pdfimgext
1287 \else
1288 {#1.\pdfimgext}%
1289 \fi
1290 \ifnum\pdftexversion < 14 \else
1291 \pdfrefximage \pdflastximage
1292 \fi}
1293 %
1294 \def\setpdfdestname#1{{%
1295 % We have to set dummies so commands such as @code, and characters
1296 % such as \, aren't expanded when present in a section title.
1297 \indexnofonts
1298 \makevalueexpandable
1299 \turnoffactive
1300 \iftxiuseunicodedestname
1301 \ifx \declaredencoding \latone
1302 % Pass through Latin-1 characters.
1303 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1304 \else
1305 \ifx \declaredencoding \utfeight
1306 % Pass through Unicode characters.
1307 \else
1308 % Use ASCII approximations in destination names.
1309 \passthroughcharsfalse
1310 \fi
1311 \fi
1312 \else
1313 % Use ASCII approximations in destination names.
1314 \passthroughcharsfalse
1315 \fi
1316 \def\pdfdestname{#1}%
1317 \txiescapepdf\pdfdestname
1318 }}
1319 %
1320 \def\setpdfoutlinetext#1{{%
1321 \indexnofonts
1322 \makevalueexpandable
1323 \turnoffactive
1324 \ifx \declaredencoding \latone
1325 % The PDF format can use an extended form of Latin-1 in bookmark
1326 % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1327 % the "PDFDocEncoding".
1328 \passthroughcharstrue
1329 % Pass through Latin-1 characters.
1330 % LuaTeX: Convert to Unicode
1331 % pdfTeX: Use Latin-1 as PDFDocEncoding
1332 \def\pdfoutlinetext{#1}%
1333 \else
1334 \ifx \declaredencoding \utfeight
1335 \ifx\luatexversion\thisisundefined
1336 % For pdfTeX with UTF-8.
1337 % TODO: the PDF format can use UTF-16 in bookmark strings,
1338 % but the code for this isn't done yet.
1339 % Use ASCII approximations.
1340 \passthroughcharsfalse
1341 \def\pdfoutlinetext{#1}%
1342 \else
1343 % For LuaTeX with UTF-8.
1344 % Pass through Unicode characters for title texts.
1345 \passthroughcharstrue
1346 \def\pdfoutlinetext{#1}%
1347 \fi
1348 \else
1349 % For non-Latin-1 or non-UTF-8 encodings.
1350 % Use ASCII approximations.
1351 \passthroughcharsfalse
1352 \def\pdfoutlinetext{#1}%
1353 \fi
1354 \fi
1355 % LuaTeX: Convert to UTF-16
1356 % pdfTeX: Use Latin-1 as PDFDocEncoding
1357 \txiescapepdfutfsixteen\pdfoutlinetext
1358 }}
1359 %
1360 \def\pdfmkdest#1{%
1361 \setpdfdestname{#1}%
1362 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1363 }
1364 %
1365 % used to mark target names; must be expandable.
1366 \def\pdfmkpgn#1{#1}
1367 %
1368 % by default, use black for everything.
1369 \def\urlcolor{\rgbBlack}
1370 \let\linkcolor\rgbBlack
1371 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1372 %
1373 % Adding outlines to PDF; macros for calculating structure of outlines
1374 % come from Petr Olsak
1375 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1376 \else \csname#1\endcsname \fi}
1377 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1378 \advance\tempnum by 1
1379 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1380 %
1381 % #1 is the section text, which is what will be displayed in the
1382 % outline by the pdf viewer. #2 is the pdf expression for the number
1383 % of subentries (or empty, for subsubsections). #3 is the node text,
1384 % which might be empty if this toc entry had no corresponding node.
1385 % #4 is the page number
1386 %
1387 \def\dopdfoutline#1#2#3#4{%
1388 % Generate a link to the node text if that exists; else, use the
1389 % page number. We could generate a destination for the section
1390 % text in the case where a section has no node, but it doesn't
1391 % seem worth the trouble, since most documents are normally structured.
1392 \setpdfoutlinetext{#1}
1393 \setpdfdestname{#3}
1394 \ifx\pdfdestname\empty
1395 \def\pdfdestname{#4}%
1396 \fi
1397 %
1398 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
1399 }
1400 %
1401 \def\pdfmakeoutlines{%
1402 \begingroup
1403 % Read toc silently, to get counts of subentries for \pdfoutline.
1404 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1405 \def\numchapentry##1##2##3##4{%
1406 \def\thischapnum{##2}%
1407 \def\thissecnum{0}%
1408 \def\thissubsecnum{0}%
1409 }%
1410 \def\numsecentry##1##2##3##4{%
1411 \advancenumber{chap\thischapnum}%
1412 \def\thissecnum{##2}%
1413 \def\thissubsecnum{0}%
1414 }%
1415 \def\numsubsecentry##1##2##3##4{%
1416 \advancenumber{sec\thissecnum}%
1417 \def\thissubsecnum{##2}%
1418 }%
1419 \def\numsubsubsecentry##1##2##3##4{%
1420 \advancenumber{subsec\thissubsecnum}%
1421 }%
1422 \def\thischapnum{0}%
1423 \def\thissecnum{0}%
1424 \def\thissubsecnum{0}%
1425 %
1426 % use \def rather than \let here because we redefine \chapentry et
1427 % al. a second time, below.
1428 \def\appentry{\numchapentry}%
1429 \def\appsecentry{\numsecentry}%
1430 \def\appsubsecentry{\numsubsecentry}%
1431 \def\appsubsubsecentry{\numsubsubsecentry}%
1432 \def\unnchapentry{\numchapentry}%
1433 \def\unnsecentry{\numsecentry}%
1434 \def\unnsubsecentry{\numsubsecentry}%
1435 \def\unnsubsubsecentry{\numsubsubsecentry}%
1436 \readdatafile{toc}%
1437 %
1438 % Read toc second time, this time actually producing the outlines.
1439 % The `-' means take the \expnumber as the absolute number of
1440 % subentries, which we calculated on our first read of the .toc above.
1441 %
1442 % We use the node names as the destinations.
1443 %
1444 % Currently we prefix the section name with the section number
1445 % for chapter and appendix headings only in order to avoid too much
1446 % horizontal space being required in the PDF viewer.
1447 \def\numchapentry##1##2##3##4{%
1448 \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1449 \def\unnchapentry##1##2##3##4{%
1450 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1451 \def\numsecentry##1##2##3##4{%
1452 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1453 \def\numsubsecentry##1##2##3##4{%
1454 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1455 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1456 \dopdfoutline{##1}{}{##3}{##4}}%
1457 %
1458 % PDF outlines are displayed using system fonts, instead of
1459 % document fonts. Therefore we cannot use special characters,
1460 % since the encoding is unknown. For example, the eogonek from
1461 % Latin 2 (0xea) gets translated to a | character. Info from
1462 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1463 %
1464 % TODO this right, we have to translate 8-bit characters to
1465 % their "best" equivalent, based on the @documentencoding. Too
1466 % much work for too little return. Just use the ASCII equivalents
1467 % we use for the index sort strings.
1468 %
1469 \indexnofonts
1470 \setupdatafile
1471 % We can have normal brace characters in the PDF outlines, unlike
1472 % Texinfo index files. So set that up.
1473 \def\{{\lbracecharliteral}%
1474 \def\}{\rbracecharliteral}%
1475 \catcode`\\=\active \otherbackslash
1476 \input \tocreadfilename
1477 \endgroup
1478 }
1479 {\catcode`[=1 \catcode`]=2
1480 \catcode`{=\other \catcode`}=\other
1481 \gdef\lbracecharliteral[{]%
1482 \gdef\rbracecharliteral[}]%
1483 ]
1484 %
1485 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1486 \ifx\PP\D\let\nextsp\relax
1487 \else\let\nextsp\skipspaces
1488 \addtokens{\filename}{\PP}%
1489 \advance\filenamelength by 1
1490 \fi
1491 \nextsp}
1492 \def\getfilename#1{%
1493 \filenamelength=0
1494 % If we don't expand the argument now, \skipspaces will get
1495 % snagged on things like "@value{foo}".
1496 \edef\temp{#1}%
1497 \expandafter\skipspaces\temp|\relax
1498 }
1499 \ifnum\pdftexversion < 14
1500 \let \startlink \pdfannotlink
1501 \else
1502 \let \startlink \pdfstartlink
1503 \fi
1504 % make a live url in pdf output.
1505 \def\pdfurl#1{%
1506 \begingroup
1507 % it seems we really need yet another set of dummies; have not
1508 % tried to figure out what each command should do in the context
1509 % of @url. for now, just make @/ a no-op, that's the only one
1510 % people have actually reported a problem with.
1511 %
1512 \normalturnoffactive
1513 \def\@{@}%
1514 \let\/=\empty
1515 \makevalueexpandable
1516 % do we want to go so far as to use \indexnofonts instead of just
1517 % special-casing \var here?
1518 \def\var##1{##1}%
1519 %
1520 \leavevmode\setcolor{\urlcolor}%
1521 \startlink attr{/Border [0 0 0]}%
1522 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1523 \endgroup}
1524 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
1525 % be a simple number, or a list of numbers in the case of an index
1526 % entry.
1527 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1528 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1529 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1530 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1531 \def\maketoks{%
1532 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1533 \ifx\first0\adn0
1534 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1535 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1536 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1537 \else
1538 \ifnum0=\countA\else\makelink\fi
1539 \ifx\first.\let\next=\done\else
1540 \let\next=\maketoks
1541 \addtokens{\toksB}{\the\toksD}
1542 \ifx\first,\addtokens{\toksB}{\space}\fi
1543 \fi
1544 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1545 \next}
1546 \def\makelink{\addtokens{\toksB}%
1547 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1548 \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1549 \def\pdflinkpage#1#2{%
1550 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1551 \setcolor{\linkcolor}#2\endlink}
1552 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1553 \else
1554 % non-pdf mode
1555 \let\pdfmkdest = \gobble
1556 \let\pdfurl = \gobble
1557 \let\endlink = \relax
1558 \let\setcolor = \gobble
1559 \let\pdfsetcolor = \gobble
1560 \let\pdfmakeoutlines = \relax
1561 \fi % \ifx\pdfoutput
1562
1563 %
1564 % For XeTeX
1565 %
1566 \ifx\XeTeXrevision\thisisundefined
1567 \else
1568 %
1569 % XeTeX version check
1570 %
1571 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1572 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1573 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1574 % For avoiding PDF destination name replacement, we use this special
1575 % instead of xdvipdfmx's command line option `-C 0x0010'.
1576 \special{dvipdfmx:config C 0x0010}
1577 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1578 % It can handle Unicode destination names for PDF.
1579 \txiuseunicodedestnametrue
1580 \else
1581 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1582 % `dvipdfmx:config' special.
1583 % So for avoiding PDF destination name replacement,
1584 % xdvipdfmx's command line option `-C 0x0010' is necessary.
1585 %
1586 % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1587 % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1588 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1589 \txiuseunicodedestnamefalse
1590 \fi
1591 %
1592 % Color support
1593 %
1594 \def\rgbDarkRed{0.50 0.09 0.12}
1595 \def\rgbBlack{0 0 0}
1596 %
1597 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1598 %
1599 % Set color, and create a mark which defines \thiscolor accordingly,
1600 % so that \makeheadline knows which color to restore.
1601 \def\setcolor#1{%
1602 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1603 \domark
1604 \pdfsetcolor{#1}%
1605 }
1606 %
1607 \def\maincolor{\rgbBlack}
1608 \pdfsetcolor{\maincolor}
1609 \edef\thiscolor{\maincolor}
1610 \def\currentcolordefs{}
1611 %
1612 \def\makefootline{%
1613 \baselineskip24pt
1614 \line{\pdfsetcolor{\maincolor}\the\footline}%
1615 }
1616 %
1617 \def\makeheadline{%
1618 \vbox to 0pt{%
1619 \vskip-22.5pt
1620 \line{%
1621 \vbox to8.5pt{}%
1622 % Extract \thiscolor definition from the marks.
1623 \getcolormarks
1624 % Typeset the headline with \maincolor, then restore the color.
1625 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1626 }%
1627 \vss
1628 }%
1629 \nointerlineskip
1630 }
1631 %
1632 % PDF outline support
1633 %
1634 % Emulate pdfTeX primitive
1635 \def\pdfdest name#1 xyz{%
1636 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1637 }
1638 %
1639 \def\setpdfdestname#1{{%
1640 % We have to set dummies so commands such as @code, and characters
1641 % such as \, aren't expanded when present in a section title.
1642 \indexnofonts
1643 \makevalueexpandable
1644 \turnoffactive
1645 \iftxiuseunicodedestname
1646 % Pass through Unicode characters.
1647 \else
1648 % Use ASCII approximations in destination names.
1649 \passthroughcharsfalse
1650 \fi
1651 \def\pdfdestname{#1}%
1652 \txiescapepdf\pdfdestname
1653 }}
1654 %
1655 \def\setpdfoutlinetext#1{{%
1656 \turnoffactive
1657 % Always use Unicode characters in title texts.
1658 \def\pdfoutlinetext{#1}%
1659 % For XeTeX, xdvipdfmx converts to UTF-16.
1660 % So we do not convert.
1661 \txiescapepdf\pdfoutlinetext
1662 }}
1663 %
1664 \def\pdfmkdest#1{%
1665 \setpdfdestname{#1}%
1666 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1667 }
1668 %
1669 % by default, use black for everything.
1670 \def\urlcolor{\rgbBlack}
1671 \def\linkcolor{\rgbBlack}
1672 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1673 %
1674 \def\dopdfoutline#1#2#3#4{%
1675 \setpdfoutlinetext{#1}
1676 \setpdfdestname{#3}
1677 \ifx\pdfdestname\empty
1678 \def\pdfdestname{#4}%
1679 \fi
1680 %
1681 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1682 << /S /GoTo /D (\pdfdestname) >> >> }%
1683 }
1684 %
1685 \def\pdfmakeoutlines{%
1686 \begingroup
1687 %
1688 % For XeTeX, counts of subentries are not necessary.
1689 % Therefore, we read toc only once.
1690 %
1691 % We use node names as destinations.
1692 %
1693 % Currently we prefix the section name with the section number
1694 % for chapter and appendix headings only in order to avoid too much
1695 % horizontal space being required in the PDF viewer.
1696 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1697 \def\numchapentry##1##2##3##4{%
1698 \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
1699 \def\numsecentry##1##2##3##4{%
1700 \dopdfoutline{##1}{2}{##3}{##4}}%
1701 \def\numsubsecentry##1##2##3##4{%
1702 \dopdfoutline{##1}{3}{##3}{##4}}%
1703 \def\numsubsubsecentry##1##2##3##4{%
1704 \dopdfoutline{##1}{4}{##3}{##4}}%
1705 %
1706 \let\appentry\numchapentry%
1707 \let\appsecentry\numsecentry%
1708 \let\appsubsecentry\numsubsecentry%
1709 \let\appsubsubsecentry\numsubsubsecentry%
1710 \def\unnchapentry##1##2##3##4{%
1711 \dopdfoutline{##1}{1}{##3}{##4}}%
1712 \let\unnsecentry\numsecentry%
1713 \let\unnsubsecentry\numsubsecentry%
1714 \let\unnsubsubsecentry\numsubsubsecentry%
1715 %
1716 % For XeTeX, xdvipdfmx converts strings to UTF-16.
1717 % Therefore, the encoding and the language may not be considered.
1718 %
1719 \indexnofonts
1720 \setupdatafile
1721 % We can have normal brace characters in the PDF outlines, unlike
1722 % Texinfo index files. So set that up.
1723 \def\{{\lbracecharliteral}%
1724 \def\}{\rbracecharliteral}%
1725 \catcode`\\=\active \otherbackslash
1726 \input \tocreadfilename
1727 \endgroup
1728 }
1729 {\catcode`[=1 \catcode`]=2
1730 \catcode`{=\other \catcode`}=\other
1731 \gdef\lbracecharliteral[{]%
1732 \gdef\rbracecharliteral[}]%
1733 ]
1734
1735 \special{pdf:docview << /PageMode /UseOutlines >> }
1736 % ``\special{pdf:tounicode ...}'' is not necessary
1737 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1738 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1739 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1740 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1741 %
1742 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1743 \ifx\PP\D\let\nextsp\relax
1744 \else\let\nextsp\skipspaces
1745 \addtokens{\filename}{\PP}%
1746 \advance\filenamelength by 1
1747 \fi
1748 \nextsp}
1749 \def\getfilename#1{%
1750 \filenamelength=0
1751 % If we don't expand the argument now, \skipspaces will get
1752 % snagged on things like "@value{foo}".
1753 \edef\temp{#1}%
1754 \expandafter\skipspaces\temp|\relax
1755 }
1756 % make a live url in pdf output.
1757 \def\pdfurl#1{%
1758 \begingroup
1759 % it seems we really need yet another set of dummies; have not
1760 % tried to figure out what each command should do in the context
1761 % of @url. for now, just make @/ a no-op, that's the only one
1762 % people have actually reported a problem with.
1763 %
1764 \normalturnoffactive
1765 \def\@{@}%
1766 \let\/=\empty
1767 \makevalueexpandable
1768 % do we want to go so far as to use \indexnofonts instead of just
1769 % special-casing \var here?
1770 \def\var##1{##1}%
1771 %
1772 \leavevmode\setcolor{\urlcolor}%
1773 \special{pdf:bann << /Border [0 0 0]
1774 /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1775 \endgroup}
1776 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1777 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1778 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1779 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1780 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1781 \def\maketoks{%
1782 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1783 \ifx\first0\adn0
1784 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1785 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1786 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1787 \else
1788 \ifnum0=\countA\else\makelink\fi
1789 \ifx\first.\let\next=\done\else
1790 \let\next=\maketoks
1791 \addtokens{\toksB}{\the\toksD}
1792 \ifx\first,\addtokens{\toksB}{\space}\fi
1793 \fi
1794 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1795 \next}
1796 \def\makelink{\addtokens{\toksB}%
1797 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1798 \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1799 \def\pdflinkpage#1#2{%
1800 \special{pdf:bann << /Border [0 0 0]
1801 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1802 \setcolor{\linkcolor}#2\endlink}
1803 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1804 %
1805 %
1806 % @image support
1807 %
1808 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1809 \def\doxeteximage#1#2#3{%
1810 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1811 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1812 %
1813 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1814 % others). Let's try in that order, PDF first since if
1815 % someone has a scalable image, presumably better to use that than a
1816 % bitmap.
1817 \let\xeteximgext=\empty
1818 \begingroup
1819 \openin 1 #1.pdf \ifeof 1
1820 \openin 1 #1.PDF \ifeof 1
1821 \openin 1 #1.png \ifeof 1
1822 \openin 1 #1.jpg \ifeof 1
1823 \openin 1 #1.jpeg \ifeof 1
1824 \openin 1 #1.JPG \ifeof 1
1825 \errmessage{Could not find image file #1 for XeTeX}%
1826 \else \gdef\xeteximgext{JPG}%
1827 \fi
1828 \else \gdef\xeteximgext{jpeg}%
1829 \fi
1830 \else \gdef\xeteximgext{jpg}%
1831 \fi
1832 \else \gdef\xeteximgext{png}%
1833 \fi
1834 \else \gdef\xeteximgext{PDF}%
1835 \fi
1836 \else \gdef\xeteximgext{pdf}%
1837 \fi
1838 \closein 1
1839 \endgroup
1840 %
1841 % Putting an \hbox around the image can prevent an over-long line
1842 % after the image.
1843 \hbox\bgroup
1844 \def\xetexpdfext{pdf}%
1845 \ifx\xeteximgext\xetexpdfext
1846 \XeTeXpdffile "#1".\xeteximgext ""
1847 \else
1848 \def\xetexpdfext{PDF}%
1849 \ifx\xeteximgext\xetexpdfext
1850 \XeTeXpdffile "#1".\xeteximgext ""
1851 \else
1852 \XeTeXpicfile "#1".\xeteximgext ""
1853 \fi
1854 \fi
1855 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1856 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1857 \egroup
1858 }
1859 \fi
1860
1861
1862 %
1863 \message{fonts,}
1864
1865 % Set the baselineskip to #1, and the lineskip and strut size
1866 % correspondingly. There is no deep meaning behind these magic numbers
1867 % used as factors; they just match (closely enough) what Knuth defined.
1868 %
1869 \def\lineskipfactor{.08333}
1870 \def\strutheightpercent{.70833}
1871 \def\strutdepthpercent {.29167}
1872 %
1873 % can get a sort of poor man's double spacing by redefining this.
1874 \def\baselinefactor{1}
1875 %
1876 \newdimen\textleading
1877 \def\setleading#1{%
1878 \dimen0 = #1\relax
1879 \normalbaselineskip = \baselinefactor\dimen0
1880 \normallineskip = \lineskipfactor\normalbaselineskip
1881 \normalbaselines
1882 \setbox\strutbox =\hbox{%
1883 \vrule width0pt height\strutheightpercent\baselineskip
1884 depth \strutdepthpercent \baselineskip
1885 }%
1886 }
1887
1888 % PDF CMaps. See also LaTeX's t1.cmap.
1889 %
1890 % do nothing with this by default.
1891 \expandafter\let\csname cmapOT1\endcsname\gobble
1892 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1893 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1894
1895 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1896 % (\pdffontattr was introduced many years ago, but people still run
1897 % older pdftex's; it's easy to conditionalize, so we do.)
1898 \ifpdf \ifx\pdffontattr\thisisundefined \else
1899 \begingroup
1900 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1901 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1902 %%DocumentNeededResources: ProcSet (CIDInit)
1903 %%IncludeResource: ProcSet (CIDInit)
1904 %%BeginResource: CMap (TeX-OT1-0)
1905 %%Title: (TeX-OT1-0 TeX OT1 0)
1906 %%Version: 1.000
1907 %%EndComments
1908 /CIDInit /ProcSet findresource begin
1909 12 dict begin
1910 begincmap
1911 /CIDSystemInfo
1912 << /Registry (TeX)
1913 /Ordering (OT1)
1914 /Supplement 0
1915 >> def
1916 /CMapName /TeX-OT1-0 def
1917 /CMapType 2 def
1918 1 begincodespacerange
1919 <00> <7F>
1920 endcodespacerange
1921 8 beginbfrange
1922 <00> <01> <0393>
1923 <09> <0A> <03A8>
1924 <23> <26> <0023>
1925 <28> <3B> <0028>
1926 <3F> <5B> <003F>
1927 <5D> <5E> <005D>
1928 <61> <7A> <0061>
1929 <7B> <7C> <2013>
1930 endbfrange
1931 40 beginbfchar
1932 <02> <0398>
1933 <03> <039B>
1934 <04> <039E>
1935 <05> <03A0>
1936 <06> <03A3>
1937 <07> <03D2>
1938 <08> <03A6>
1939 <0B> <00660066>
1940 <0C> <00660069>
1941 <0D> <0066006C>
1942 <0E> <006600660069>
1943 <0F> <00660066006C>
1944 <10> <0131>
1945 <11> <0237>
1946 <12> <0060>
1947 <13> <00B4>
1948 <14> <02C7>
1949 <15> <02D8>
1950 <16> <00AF>
1951 <17> <02DA>
1952 <18> <00B8>
1953 <19> <00DF>
1954 <1A> <00E6>
1955 <1B> <0153>
1956 <1C> <00F8>
1957 <1D> <00C6>
1958 <1E> <0152>
1959 <1F> <00D8>
1960 <21> <0021>
1961 <22> <201D>
1962 <27> <2019>
1963 <3C> <00A1>
1964 <3D> <003D>
1965 <3E> <00BF>
1966 <5C> <201C>
1967 <5F> <02D9>
1968 <60> <2018>
1969 <7D> <02DD>
1970 <7E> <007E>
1971 <7F> <00A8>
1972 endbfchar
1973 endcmap
1974 CMapName currentdict /CMap defineresource pop
1975 end
1976 end
1977 %%EndResource
1978 %%EOF
1979 }\endgroup
1980 \expandafter\edef\csname cmapOT1\endcsname#1{%
1981 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1982 }%
1983 %
1984 % \cmapOT1IT
1985 \begingroup
1986 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1987 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1988 %%DocumentNeededResources: ProcSet (CIDInit)
1989 %%IncludeResource: ProcSet (CIDInit)
1990 %%BeginResource: CMap (TeX-OT1IT-0)
1991 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1992 %%Version: 1.000
1993 %%EndComments
1994 /CIDInit /ProcSet findresource begin
1995 12 dict begin
1996 begincmap
1997 /CIDSystemInfo
1998 << /Registry (TeX)
1999 /Ordering (OT1IT)
2000 /Supplement 0
2001 >> def
2002 /CMapName /TeX-OT1IT-0 def
2003 /CMapType 2 def
2004 1 begincodespacerange
2005 <00> <7F>
2006 endcodespacerange
2007 8 beginbfrange
2008 <00> <01> <0393>
2009 <09> <0A> <03A8>
2010 <25> <26> <0025>
2011 <28> <3B> <0028>
2012 <3F> <5B> <003F>
2013 <5D> <5E> <005D>
2014 <61> <7A> <0061>
2015 <7B> <7C> <2013>
2016 endbfrange
2017 42 beginbfchar
2018 <02> <0398>
2019 <03> <039B>
2020 <04> <039E>
2021 <05> <03A0>
2022 <06> <03A3>
2023 <07> <03D2>
2024 <08> <03A6>
2025 <0B> <00660066>
2026 <0C> <00660069>
2027 <0D> <0066006C>
2028 <0E> <006600660069>
2029 <0F> <00660066006C>
2030 <10> <0131>
2031 <11> <0237>
2032 <12> <0060>
2033 <13> <00B4>
2034 <14> <02C7>
2035 <15> <02D8>
2036 <16> <00AF>
2037 <17> <02DA>
2038 <18> <00B8>
2039 <19> <00DF>
2040 <1A> <00E6>
2041 <1B> <0153>
2042 <1C> <00F8>
2043 <1D> <00C6>
2044 <1E> <0152>
2045 <1F> <00D8>
2046 <21> <0021>
2047 <22> <201D>
2048 <23> <0023>
2049 <24> <00A3>
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 cmapOT1IT\endcsname#1{%
2069 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2070 }%
2071 %
2072 % \cmapOT1TT
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-OT1TT-0)
2079 %%Title: (TeX-OT1TT-0 TeX OT1TT 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 (OT1TT)
2088 /Supplement 0
2089 >> def
2090 /CMapName /TeX-OT1TT-0 def
2091 /CMapType 2 def
2092 1 begincodespacerange
2093 <00> <7F>
2094 endcodespacerange
2095 5 beginbfrange
2096 <00> <01> <0393>
2097 <09> <0A> <03A8>
2098 <21> <26> <0021>
2099 <28> <5F> <0028>
2100 <61> <7E> <0061>
2101 endbfrange
2102 32 beginbfchar
2103 <02> <0398>
2104 <03> <039B>
2105 <04> <039E>
2106 <05> <03A0>
2107 <06> <03A3>
2108 <07> <03D2>
2109 <08> <03A6>
2110 <0B> <2191>
2111 <0C> <2193>
2112 <0D> <0027>
2113 <0E> <00A1>
2114 <0F> <00BF>
2115 <10> <0131>
2116 <11> <0237>
2117 <12> <0060>
2118 <13> <00B4>
2119 <14> <02C7>
2120 <15> <02D8>
2121 <16> <00AF>
2122 <17> <02DA>
2123 <18> <00B8>
2124 <19> <00DF>
2125 <1A> <00E6>
2126 <1B> <0153>
2127 <1C> <00F8>
2128 <1D> <00C6>
2129 <1E> <0152>
2130 <1F> <00D8>
2131 <20> <2423>
2132 <27> <2019>
2133 <60> <2018>
2134 <7F> <00A8>
2135 endbfchar
2136 endcmap
2137 CMapName currentdict /CMap defineresource pop
2138 end
2139 end
2140 %%EndResource
2141 %%EOF
2142 }\endgroup
2143 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2144 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2145 }%
2146 \fi\fi
2147 %
2148 % This is what gets called when #5 of \setfont is empty.
2149 \let\cmap\gobble
2150 %
2151 % (end of cmaps)
2152
2153
2154 % Set the font macro #1 to the font named \fontprefix#2.
2155 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2156 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2157 % Example:
2158 % #1 = \textrm
2159 % #2 = \rmshape
2160 % #3 = 10
2161 % #4 = \mainmagstep
2162 % #5 = OT1
2163 %
2164 \def\setfont#1#2#3#4#5{%
2165 \font#1=\fontprefix#2#3 scaled #4
2166 \csname cmap#5\endcsname#1%
2167 \ifx#2\ttshape\hyphenchar#1=-1 \fi
2168 \ifx#2\ttbshape\hyphenchar#1=-1 \fi
2169 \ifx#2\ttslshape\hyphenchar#1=-1 \fi
2170 }
2171
2172 % Use cm as the default font prefix.
2173 % To specify the font prefix, you must define \fontprefix
2174 % before you read in texinfo.tex.
2175 \ifx\fontprefix\thisisundefined
2176 \def\fontprefix{cm}
2177 \fi
2178 % Support font families that don't use the same naming scheme as CM.
2179 \def\rmshape{r}
2180 \def\rmbshape{bx} % where the normal face is bold
2181 \def\bfshape{b}
2182 \def\bxshape{bx}
2183 \def\ttshape{tt}
2184 \def\ttbshape{tt}
2185 \def\ttslshape{sltt}
2186 \def\itshape{ti}
2187 \def\itbshape{bxti}
2188 \def\slshape{sl}
2189 \def\slbshape{bxsl}
2190 \def\sfshape{ss}
2191 \def\sfbshape{ss}
2192 \def\scshape{csc}
2193 \def\scbshape{csc}
2194
2195 % Definitions for a main text size of 11pt. (The default in Texinfo.)
2196 %
2197 \def\definetextfontsizexi{%
2198 % Text fonts (11.2pt, magstep1).
2199 \def\textnominalsize{11pt}
2200 \edef\mainmagstep{\magstephalf}
2201 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2202 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2203 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2204 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2205 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2206 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2207 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2208 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2209 \font\texti=cmmi10 scaled \mainmagstep
2210 \font\textsy=cmsy10 scaled \mainmagstep
2211 \def\textecsize{1095}
2212
2213 % A few fonts for @defun names and args.
2214 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2215 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2216 \setfont\defsl\slshape{10}{\magstep1}{OT1}
2217 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2218 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2219 \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2220
2221 % Fonts for indices, footnotes, small examples (9pt).
2222 \def\smallnominalsize{9pt}
2223 \setfont\smallrm\rmshape{9}{1000}{OT1}
2224 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2225 \setfont\smallbf\bfshape{10}{900}{OT1}
2226 \setfont\smallit\itshape{9}{1000}{OT1IT}
2227 \setfont\smallsl\slshape{9}{1000}{OT1}
2228 \setfont\smallsf\sfshape{9}{1000}{OT1}
2229 \setfont\smallsc\scshape{10}{900}{OT1}
2230 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2231 \font\smalli=cmmi9
2232 \font\smallsy=cmsy9
2233 \def\smallecsize{0900}
2234
2235 % Fonts for small examples (8pt).
2236 \def\smallernominalsize{8pt}
2237 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2238 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2239 \setfont\smallerbf\bfshape{10}{800}{OT1}
2240 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2241 \setfont\smallersl\slshape{8}{1000}{OT1}
2242 \setfont\smallersf\sfshape{8}{1000}{OT1}
2243 \setfont\smallersc\scshape{10}{800}{OT1}
2244 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2245 \font\smalleri=cmmi8
2246 \font\smallersy=cmsy8
2247 \def\smallerecsize{0800}
2248
2249 % Fonts for math mode superscripts (7pt).
2250 \def\sevennominalsize{7pt}
2251 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2252 \setfont\seventt\ttshape{10}{700}{OT1TT}
2253 \setfont\sevenbf\bfshape{10}{700}{OT1}
2254 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2255 \setfont\sevensl\slshape{10}{700}{OT1}
2256 \setfont\sevensf\sfshape{10}{700}{OT1}
2257 \setfont\sevensc\scshape{10}{700}{OT1}
2258 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2259 \font\seveni=cmmi7
2260 \font\sevensy=cmsy7
2261 \def\sevenecsize{0700}
2262
2263 % Fonts for title page (20.4pt):
2264 \def\titlenominalsize{20pt}
2265 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2266 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2267 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2268 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2269 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2270 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2271 \let\titlebf=\titlerm
2272 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2273 \font\titlei=cmmi12 scaled \magstep3
2274 \font\titlesy=cmsy10 scaled \magstep4
2275 \def\titleecsize{2074}
2276
2277 % Chapter (and unnumbered) fonts (17.28pt).
2278 \def\chapnominalsize{17pt}
2279 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2280 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2281 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2282 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2283 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2284 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2285 \let\chapbf=\chaprm
2286 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2287 \font\chapi=cmmi12 scaled \magstep2
2288 \font\chapsy=cmsy10 scaled \magstep3
2289 \def\chapecsize{1728}
2290
2291 % Section fonts (14.4pt).
2292 \def\secnominalsize{14pt}
2293 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2294 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2295 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2296 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2297 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2298 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2299 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2300 \let\secbf\secrm
2301 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2302 \font\seci=cmmi12 scaled \magstep1
2303 \font\secsy=cmsy10 scaled \magstep2
2304 \def\sececsize{1440}
2305
2306 % Subsection fonts (13.15pt).
2307 \def\ssecnominalsize{13pt}
2308 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2309 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2310 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2311 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2312 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2313 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2314 \let\ssecbf\ssecrm
2315 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2316 \font\sseci=cmmi12 scaled \magstephalf
2317 \font\ssecsy=cmsy10 scaled 1315
2318 \def\ssececsize{1200}
2319
2320 % Reduced fonts for @acronym in text (10pt).
2321 \def\reducednominalsize{10pt}
2322 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2323 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2324 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2325 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2326 \setfont\reducedsl\slshape{10}{1000}{OT1}
2327 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2328 \setfont\reducedsc\scshape{10}{1000}{OT1}
2329 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2330 \font\reducedi=cmmi10
2331 \font\reducedsy=cmsy10
2332 \def\reducedecsize{1000}
2333
2334 \textleading = 13.2pt % line spacing for 11pt CM
2335 \textfonts % reset the current fonts
2336 \rm
2337 } % end of 11pt text font size definitions, \definetextfontsizexi
2338
2339
2340 % Definitions to make the main text be 10pt Computer Modern, with
2341 % section, chapter, etc., sizes following suit. This is for the GNU
2342 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2343 % future. Used with @smallbook, which sets the leading to 12pt.
2344 %
2345 \def\definetextfontsizex{%
2346 % Text fonts (10pt).
2347 \def\textnominalsize{10pt}
2348 \edef\mainmagstep{1000}
2349 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2350 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2351 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2352 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2353 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2354 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2355 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2356 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2357 \font\texti=cmmi10 scaled \mainmagstep
2358 \font\textsy=cmsy10 scaled \mainmagstep
2359 \def\textecsize{1000}
2360
2361 % A few fonts for @defun names and args.
2362 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2363 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2364 \setfont\defsl\slshape{10}{\magstephalf}{OT1}
2365 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2366 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2367 \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2368
2369 % Fonts for indices, footnotes, small examples (9pt).
2370 \def\smallnominalsize{9pt}
2371 \setfont\smallrm\rmshape{9}{1000}{OT1}
2372 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2373 \setfont\smallbf\bfshape{10}{900}{OT1}
2374 \setfont\smallit\itshape{9}{1000}{OT1IT}
2375 \setfont\smallsl\slshape{9}{1000}{OT1}
2376 \setfont\smallsf\sfshape{9}{1000}{OT1}
2377 \setfont\smallsc\scshape{10}{900}{OT1}
2378 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2379 \font\smalli=cmmi9
2380 \font\smallsy=cmsy9
2381 \def\smallecsize{0900}
2382
2383 % Fonts for small examples (8pt).
2384 \def\smallernominalsize{8pt}
2385 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2386 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2387 \setfont\smallerbf\bfshape{10}{800}{OT1}
2388 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2389 \setfont\smallersl\slshape{8}{1000}{OT1}
2390 \setfont\smallersf\sfshape{8}{1000}{OT1}
2391 \setfont\smallersc\scshape{10}{800}{OT1}
2392 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2393 \font\smalleri=cmmi8
2394 \font\smallersy=cmsy8
2395 \def\smallerecsize{0800}
2396
2397 % Fonts for math mode superscripts (7pt).
2398 \def\sevennominalsize{7pt}
2399 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2400 \setfont\seventt\ttshape{10}{700}{OT1TT}
2401 \setfont\sevenbf\bfshape{10}{700}{OT1}
2402 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2403 \setfont\sevensl\slshape{10}{700}{OT1}
2404 \setfont\sevensf\sfshape{10}{700}{OT1}
2405 \setfont\sevensc\scshape{10}{700}{OT1}
2406 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2407 \font\seveni=cmmi7
2408 \font\sevensy=cmsy7
2409 \def\sevenecsize{0700}
2410
2411 % Fonts for title page (20.4pt):
2412 \def\titlenominalsize{20pt}
2413 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2414 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2415 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2416 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2417 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2418 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2419 \let\titlebf=\titlerm
2420 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2421 \font\titlei=cmmi12 scaled \magstep3
2422 \font\titlesy=cmsy10 scaled \magstep4
2423 \def\titleecsize{2074}
2424
2425 % Chapter fonts (14.4pt).
2426 \def\chapnominalsize{14pt}
2427 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2428 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2429 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2430 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2431 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2432 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2433 \let\chapbf\chaprm
2434 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2435 \font\chapi=cmmi12 scaled \magstep1
2436 \font\chapsy=cmsy10 scaled \magstep2
2437 \def\chapecsize{1440}
2438
2439 % Section fonts (12pt).
2440 \def\secnominalsize{12pt}
2441 \setfont\secrm\rmbshape{12}{1000}{OT1}
2442 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2443 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2444 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2445 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2446 \setfont\secsf\sfbshape{12}{1000}{OT1}
2447 \let\secbf\secrm
2448 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2449 \font\seci=cmmi12
2450 \font\secsy=cmsy10 scaled \magstep1
2451 \def\sececsize{1200}
2452
2453 % Subsection fonts (10pt).
2454 \def\ssecnominalsize{10pt}
2455 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2456 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2457 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2458 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2459 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2460 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2461 \let\ssecbf\ssecrm
2462 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2463 \font\sseci=cmmi10
2464 \font\ssecsy=cmsy10
2465 \def\ssececsize{1000}
2466
2467 % Reduced fonts for @acronym in text (9pt).
2468 \def\reducednominalsize{9pt}
2469 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2470 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2471 \setfont\reducedbf\bfshape{10}{900}{OT1}
2472 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2473 \setfont\reducedsl\slshape{9}{1000}{OT1}
2474 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2475 \setfont\reducedsc\scshape{10}{900}{OT1}
2476 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2477 \font\reducedi=cmmi9
2478 \font\reducedsy=cmsy9
2479 \def\reducedecsize{0900}
2480
2481 \divide\parskip by 2 % reduce space between paragraphs
2482 \textleading = 12pt % line spacing for 10pt CM
2483 \textfonts % reset the current fonts
2484 \rm
2485 } % end of 10pt text font size definitions, \definetextfontsizex
2486
2487 % Fonts for short table of contents.
2488 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2489 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2490 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2491 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2492
2493
2494 % We provide the user-level command
2495 % @fonttextsize 10
2496 % (or 11) to redefine the text font size. pt is assumed.
2497 %
2498 \def\xiword{11}
2499 \def\xword{10}
2500 \def\xwordpt{10pt}
2501 %
2502 \parseargdef\fonttextsize{%
2503 \def\textsizearg{#1}%
2504 %\wlog{doing @fonttextsize \textsizearg}%
2505 %
2506 % Set \globaldefs so that documents can use this inside @tex, since
2507 % makeinfo 4.8 does not support it, but we need it nonetheless.
2508 %
2509 \begingroup \globaldefs=1
2510 \ifx\textsizearg\xword \definetextfontsizex
2511 \else \ifx\textsizearg\xiword \definetextfontsizexi
2512 \else
2513 \errhelp=\EMsimple
2514 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2515 \fi\fi
2516 \endgroup
2517 }
2518
2519 %
2520 % Change the current font style to #1, remembering it in \curfontstyle.
2521 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2522 % italics, not bold italics.
2523 %
2524 \def\setfontstyle#1{%
2525 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2526 \csname #1font\endcsname % change the current font
2527 }
2528
2529 \def\rm{\fam=0 \setfontstyle{rm}}
2530 \def\it{\fam=\itfam \setfontstyle{it}}
2531 \def\sl{\fam=\slfam \setfontstyle{sl}}
2532 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2533 \def\tt{\fam=\ttfam \setfontstyle{tt}}
2534
2535 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
2536 % So we set up a \sf.
2537 \newfam\sffam
2538 \def\sf{\fam=\sffam \setfontstyle{sf}}
2539
2540 % We don't need math for this font style.
2541 \def\ttsl{\setfontstyle{ttsl}}
2542
2543
2544 % In order for the font changes to affect most math symbols and letters,
2545 % we have to define the \textfont of the standard families.
2546 % We don't bother to reset \scriptscriptfont; awaiting user need.
2547 %
2548 \def\resetmathfonts{%
2549 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2550 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2551 \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2552 %
2553 % Fonts for superscript. Note that the 7pt fonts are used regardless
2554 % of the current font size.
2555 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
2556 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
2557 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
2558 \scriptfont\sffam=\sevensf
2559 }
2560
2561
2562
2563 % \defineassignfonts{SIZE} -
2564 % Define sequence \assignfontsSIZE, which switches between font sizes
2565 % by redefining the meanings of \STYLEfont. (Just \STYLE additionally sets
2566 % the current \fam for math mode.)
2567 %
2568 \def\defineassignfonts#1{%
2569 \expandafter\edef\csname assignfonts#1\endcsname{%
2570 \let\noexpand\rmfont\csname #1rm\endcsname
2571 \let\noexpand\itfont\csname #1it\endcsname
2572 \let\noexpand\slfont\csname #1sl\endcsname
2573 \let\noexpand\bffont\csname #1bf\endcsname
2574 \let\noexpand\ttfont\csname #1tt\endcsname
2575 \let\noexpand\smallcaps\csname #1sc\endcsname
2576 \let\noexpand\sffont \csname #1sf\endcsname
2577 \let\noexpand\ifont \csname #1i\endcsname
2578 \let\noexpand\syfont \csname #1sy\endcsname
2579 \let\noexpand\ttslfont\csname #1ttsl\endcsname
2580 }
2581 }
2582
2583 \def\assignfonts#1{%
2584 \csname assignfonts#1\endcsname
2585 }
2586
2587 \newif\ifrmisbold
2588
2589 % Select smaller font size with the current style. Used to change font size
2590 % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
2591 % normal roman text, also use bold fonts for roman text in the smaller size.
2592 \def\switchtolllsize{%
2593 \expandafter\assignfonts\expandafter{\lllsize}%
2594 \ifrmisbold
2595 \let\rmfont\bffont
2596 \fi
2597 \csname\curfontstyle\endcsname
2598 }%
2599
2600 \def\switchtolsize{%
2601 \expandafter\assignfonts\expandafter{\lsize}%
2602 \ifrmisbold
2603 \let\rmfont\bffont
2604 \fi
2605 \csname\curfontstyle\endcsname
2606 }%
2607
2608 % Define the font-changing commands (all called \...fonts).
2609 % Each font-changing command also sets the names \lsize (one size lower)
2610 % and \lllsize (three sizes lower). These relative commands are used
2611 % in, e.g., the LaTeX logo and acronyms.
2612 %
2613 % Note: The fonts used for \ifont are for "math italics" (\itfont is for
2614 % italics in regular text). \syfont is also used in math mode only.
2615 %
2616 \def\definefontsetatsize#1#2#3#4#5{%
2617 \defineassignfonts{#1}%
2618 \expandafter\def\csname #1fonts\endcsname{%
2619 \def\curfontsize{#1}%
2620 \def\lsize{#2}\def\lllsize{#3}%
2621 \csname rmisbold#5\endcsname
2622 \csname assignfonts#1\endcsname
2623 \resetmathfonts
2624 \setleading{#4}%
2625 }}
2626
2627 \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
2628 \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
2629 \definefontsetatsize{chap} {sec} {text} {19pt} {true}
2630 \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
2631 \definefontsetatsize{ssec} {text} {small} {15pt} {true}
2632 \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
2633 \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
2634 \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2635
2636 \def\titlefont#1{{\titlefonts\rm #1}}
2637 \let\subsecfonts = \ssecfonts
2638 \let\subsubsecfonts = \ssecfonts
2639
2640 % Define these just so they can be easily changed for other fonts.
2641 \def\angleleft{$\langle$}
2642 \def\angleright{$\rangle$}
2643
2644 % Set the fonts to use with the @small... environments.
2645 \let\smallexamplefonts = \smallfonts
2646
2647 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2648 % can fit this many characters:
2649 % 8.5x11=86 smallbook=72 a4=90 a5=69
2650 % If we use \scriptfonts (8pt), then we can fit this many characters:
2651 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2652 % For me, subjectively, the few extra characters that fit aren't worth
2653 % the additional smallness of 8pt. So I'm making the default 9pt.
2654 %
2655 % By the way, for comparison, here's what fits with @example (10pt):
2656 % 8.5x11=71 smallbook=60 a4=75 a5=58
2657 % --karl, 24jan03.
2658
2659 % Set up the default fonts, so we can use them for creating boxes.
2660 %
2661 \definetextfontsizexi
2662
2663
2664 % Check if we are currently using a typewriter font. Since all the
2665 % Computer Modern typewriter fonts have zero interword stretch (and
2666 % shrink), and it is reasonable to expect all typewriter fonts to have
2667 % this property, we can check that font parameter. #1 is what to
2668 % print if we are indeed using \tt; #2 is what to print otherwise.
2669 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
2670
2671 % Same as above, but check for italic font. Actually this also catches
2672 % non-italic slanted fonts since it is impossible to distinguish them from
2673 % italic fonts. But since this is only used by $ and it uses \sl anyway
2674 % this is not a problem.
2675 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
2676
2677
2678 % Check if internal flag is clear, i.e. has not been @set.
2679 \def\ifflagclear#1#2#3{%
2680 \expandafter\ifx\csname SET#1\endcsname\relax
2681 #2\else#3\fi
2682 }
2683
2684 {
2685 \catcode`\'=\active
2686 \catcode`\`=\active
2687
2688 \gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
2689 \gdef\setregularquotes{\let`\lq \let'\rq}
2690 }
2691 \setregularquotes
2692
2693 % output for ' in @code
2694 % in tt font hex 0D (undirected) or 27 (curly right quote)
2695 %
2696 \def\codequoteright{%
2697 \ifusingtt
2698 {\ifflagclear{txicodequoteundirected}%
2699 {\ifflagclear{codequoteundirected}%
2700 {'}%
2701 {\char"0D }}%
2702 {\char"0D }}%
2703 {'}%
2704 }
2705
2706 % output for ` in @code
2707 % in tt font hex 12 (grave accent) or 60 (curly left quote)
2708 % \relax disables Spanish ligatures ?` and !` of \tt font.
2709 %
2710 \def\codequoteleft{%
2711 \ifusingtt
2712 {\ifflagclear{txicodequotebacktick}%
2713 {\ifflagclear{codequotebacktick}%
2714 {\relax`}%
2715 {\char"12 }}%
2716 {\char"12 }}%
2717 {\relax`}%
2718 }
2719
2720 % Commands to set the quote options.
2721 %
2722 \parseargdef\codequoteundirected{%
2723 \def\temp{#1}%
2724 \ifx\temp\onword
2725 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2726 = t%
2727 \else\ifx\temp\offword
2728 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2729 = \relax
2730 \else
2731 \errhelp = \EMsimple
2732 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2733 \fi\fi
2734 }
2735
2736 \parseargdef\codequotebacktick{%
2737 \def\temp{#1}%
2738 \ifx\temp\onword
2739 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2740 = t%
2741 \else\ifx\temp\offword
2742 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2743 = \relax
2744 \else
2745 \errhelp = \EMsimple
2746 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2747 \fi\fi
2748 }
2749
2750 % Turn them on by default
2751 \let\SETtxicodequoteundirected = t
2752 \let\SETtxicodequotebacktick = t
2753
2754
2755 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2756 \def\noligaturesquoteleft{\relax\lq}
2757
2758 % Count depth in font-changes, for error checks
2759 \newcount\fontdepth \fontdepth=0
2760
2761 % Font commands.
2762
2763 % #1 is the font command (\sl or \it), #2 is the text to slant.
2764 % If we are in a monospaced environment, however, 1) always use \ttsl,
2765 % and 2) do not add an italic correction.
2766 \def\dosmartslant#1#2{%
2767 \ifusingtt
2768 {{\ttsl #2}\let\next=\relax}%
2769 {\def\next{{#1#2}\smartitaliccorrection}}%
2770 \next
2771 }
2772 \def\smartslanted{\dosmartslant\sl}
2773 \def\smartitalic{\dosmartslant\it}
2774
2775 % Output an italic correction unless the following character is such as
2776 % not to need one.
2777 \def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx}
2778 \def\smartitaliccorrectionx{%
2779 \ifx\next,%
2780 \else\ifx\next-%
2781 \else\ifx\next.%
2782 \else\ifx\next\.%
2783 \else\ifx\next\comma%
2784 \else\ptexslash
2785 \fi\fi\fi\fi\fi
2786 \aftersmartic
2787 }
2788
2789 % @cite unconditionally uses \sl with \smartitaliccorrection.
2790 \def\cite#1{{\sl #1}\smartitaliccorrection}
2791
2792 % @var unconditionally uses \sl. This gives consistency for
2793 % parameter names whether they are in @def, @table @code or a
2794 % regular paragraph.
2795 % To get ttsl font for @var when used in code context, @set txicodevaristt.
2796 % The \null is to reset \spacefactor.
2797 \def\aftersmartic{}
2798 \def\var#1{%
2799 \let\saveaftersmartic = \aftersmartic
2800 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2801 %
2802 \ifflagclear{txicodevaristt}%
2803 {\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
2804 {\def\varnext{\smartslanted{#1}}}%
2805 \varnext
2806 }
2807
2808 % To be removed after next release
2809 \def\SETtxicodevaristt{}% @set txicodevaristt
2810
2811 \let\i=\smartitalic
2812 \let\slanted=\smartslanted
2813 \let\dfn=\smartslanted
2814 \let\emph=\smartitalic
2815
2816 % @r for roman font, used for code comment
2817 \def\r#1{{%
2818 \usenormaldash % get --, --- ligatures even if in @code
2819 \defcharsdefault % in case on def line
2820 \rm #1}}
2821 {\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}}
2822
2823 % @sc, undocumented @ii.
2824 \def\sc#1{{\smallcaps#1}} % smallcaps font
2825 \def\ii#1{{\it #1}} % italic font
2826
2827 % @b, explicit bold. Also @strong.
2828 \def\b#1{{\bf #1}}
2829 \let\strong=\b
2830
2831 % @sansserif, explicit sans.
2832 \def\sansserif#1{{\sf #1}}
2833
2834 \newif\iffrenchspacing
2835 \frenchspacingfalse
2836
2837 % Set sfcode to normal for the chars that usually have another value.
2838 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2839 % sometimes \x has an active definition that messes things up.
2840 %
2841 \catcode`@=11
2842 \def\plainfrenchspacing{%
2843 \iffrenchspacing\else
2844 \frenchspacingtrue
2845 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2846 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2847 \def\endofsentencespacefactor{1000}% for @. and friends
2848 \fi
2849 }
2850 \def\plainnonfrenchspacing{%
2851 \iffrenchspacing
2852 \frenchspacingfalse
2853 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2854 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2855 \def\endofsentencespacefactor{3000}% for @. and friends
2856 \fi
2857 }
2858 \catcode`@=\other
2859 \def\endofsentencespacefactor{3000}% default
2860
2861 % @frenchspacing on|off says whether to put extra space after punctuation.
2862 %
2863 \def\onword{on}
2864 \def\offword{off}
2865 %
2866 \let\frenchspacingsetting\plainnonfrenchspacing % used in output routine
2867 \parseargdef\frenchspacing{%
2868 \def\temp{#1}%
2869 \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing
2870 \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing
2871 \else
2872 \errhelp = \EMsimple
2873 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
2874 \fi\fi
2875 \frenchspacingsetting
2876 }
2877
2878
2879 % @t, explicit typewriter.
2880 \def\t#1{%
2881 {\tt \defcharsdefault \plainfrenchspacing #1}%
2882 \null
2883 }
2884
2885 % @samp.
2886 \def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
2887
2888 % @indicateurl is \samp, that is, with quotes.
2889 \let\indicateurl=\samp
2890
2891 % @code (and similar) prints in typewriter, but with spaces the same
2892 % size as normal in the surrounding text, without hyphenation, etc.
2893 % This is a subroutine for that.
2894 \def\tclose#1{%
2895 {%
2896 % Change normal interword space to be same as for the current font.
2897 \spaceskip = \fontdimen2\font
2898 %
2899 % Switch to typewriter.
2900 \tt
2901 %
2902 % `\ ' produces the large typewriter interword space.
2903 \def\ {{\spaceskip = 0pt{} }}%
2904 %
2905 \plainfrenchspacing
2906 #1%
2907 }%
2908 \null % reset spacefactor to 1000
2909 }
2910
2911 % This is for LuaTeX: It is not sufficient to disable hyphenation at
2912 % explicit dashes by setting `\hyphenchar` to -1.
2913 \def\dashnobreak{%
2914 \normaldash
2915 \penalty 10000 }
2916
2917 % We must turn on hyphenation at `-' and `_' in @code.
2918 % Otherwise, it is too hard to avoid overfull hboxes
2919 % in the Emacs manual, the Library manual, etc.
2920 % We explicitly allow hyphenation at these characters
2921 % using \discretionary.
2922 %
2923 % Hyphenation at - and hyphenation within words was turned off
2924 % by default for the tt fonts using the \hyphenchar parameter of TeX.
2925 {
2926 \catcode`\-=\active \catcode`\_=\active
2927 \catcode`\'=\active \catcode`\`=\active
2928 \global\let'=\rq \global\let`=\lq % default definitions
2929 %
2930 \global\def\code{\begingroup
2931 \setcodequotes
2932 \catcode\dashChar=\active \catcode\underChar=\active
2933 \ifallowcodebreaks
2934 \let-\codedash
2935 \let_\codeunder
2936 \else
2937 \let-\dashnobreak
2938 \let_\realunder
2939 \fi
2940 \codex
2941 }
2942 %
2943 \gdef\codedash{\futurelet\next\codedashfinish}
2944 \gdef\codedashfinish{%
2945 \normaldash % always output the dash character itself.
2946 %
2947 % Now, output a discretionary to allow a line break, unless
2948 % (a) the next character is a -, or
2949 % (b) the preceding character is a -, or
2950 % (c) we are at the start of the string.
2951 % In both cases (b) and (c), \codedashnobreak should be set to \codedash.
2952 %
2953 % E.g., given --posix, we do not want to allow a break after either -.
2954 % Given --foo-bar, we do want to allow a break between the - and the b.
2955 \ifx\next\codedash \else
2956 \ifx\codedashnobreak\codedash
2957 \else \discretionary{}{}{}\fi
2958 \fi
2959 % we need the space after the = for the case when \next itself is a
2960 % space token; it would get swallowed otherwise. As in @code{- a}.
2961 \global\let\codedashnobreak= \next
2962 }
2963 }
2964 \def\normaldash{-}
2965 %
2966 \def\codex #1{\tclose{%
2967 % Given -foo (with a single dash), we do not want to allow a break
2968 % after the -. \codedashnobreak is set to the first character in
2969 % @code.
2970 \futurelet\codedashnobreak\relax
2971 #1%
2972 }\endgroup}
2973
2974 \def\codeunder{%
2975 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2976 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2977 % will therefore expand the active definition of _, which is us
2978 % (inside @code that is), therefore an endless loop.
2979 \ifusingtt{\ifmmode
2980 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2981 \else\normalunderscore \fi
2982 \discretionary{}{}{}}%
2983 {\_}%
2984 }
2985
2986 % An additional complication: the above will allow breaks after, e.g.,
2987 % each of the four underscores in __typeof__. This is bad.
2988 % @allowcodebreaks provides a document-level way to turn breaking at -
2989 % and _ on and off.
2990 %
2991 \newif\ifallowcodebreaks \allowcodebreakstrue
2992
2993 \def\keywordtrue{true}
2994 \def\keywordfalse{false}
2995
2996 \parseargdef\allowcodebreaks{%
2997 \def\txiarg{#1}%
2998 \ifx\txiarg\keywordtrue
2999 \allowcodebreakstrue
3000 \else\ifx\txiarg\keywordfalse
3001 \allowcodebreaksfalse
3002 \else
3003 \errhelp = \EMsimple
3004 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
3005 \fi\fi
3006 }
3007
3008 % For @command, @env, @file, @option quotes seem unnecessary,
3009 % so use \code rather than \samp.
3010 \let\command=\code
3011 \let\env=\code
3012 \let\file=\code
3013 \let\option=\code
3014
3015 % @uref (abbreviation for `urlref') aka @url takes an optional
3016 % (comma-separated) second argument specifying the text to display and
3017 % an optional third arg as text to display instead of (rather than in
3018 % addition to) the url itself. First (mandatory) arg is the url.
3019
3020 % TeX-only option to allow changing PDF output to show only the second
3021 % arg (if given), and not the url (which is then just the link target).
3022 \newif\ifurefurlonlylink
3023
3024 % The default \pretolerance setting stops the penalty inserted in
3025 % \urefallowbreak being a discouragement to line breaking. Set it to
3026 % a negative value for this paragraph only. Hopefully this does not
3027 % conflict with redefinitions of \par done elsewhere.
3028 \def\nopretolerance{%
3029 \pretolerance=-1
3030 \def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
3031 }
3032
3033 % The main macro is \urefbreak, which allows breaking at expected
3034 % places within the url.
3035 \def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
3036 \let\uref=\urefbreak
3037 %
3038 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
3039 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
3040 \unsepspaces
3041 \pdfurl{#1}%
3042 \setbox0 = \hbox{\ignorespaces #3}%
3043 \ifdim\wd0 > 0pt
3044 \unhbox0 % third arg given, show only that
3045 \else
3046 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
3047 \ifdim\wd0 > 0pt
3048 \ifpdf
3049 % For pdfTeX and LuaTeX
3050 \ifurefurlonlylink
3051 % PDF plus option to not display url, show just arg
3052 \unhbox0
3053 \else
3054 % PDF, normally display both arg and url for consistency,
3055 % visibility, if the pdf is eventually used to print, etc.
3056 \unhbox0\ (\urefcode{#1})%
3057 \fi
3058 \else
3059 \ifx\XeTeXrevision\thisisundefined
3060 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3061 \else
3062 % For XeTeX
3063 \ifurefurlonlylink
3064 % PDF plus option to not display url, show just arg
3065 \unhbox0
3066 \else
3067 % PDF, normally display both arg and url for consistency,
3068 % visibility, if the pdf is eventually used to print, etc.
3069 \unhbox0\ (\urefcode{#1})%
3070 \fi
3071 \fi
3072 \fi
3073 \else
3074 \urefcode{#1}% only url given, so show it
3075 \fi
3076 \fi
3077 \endlink
3078 \endgroup}
3079
3080 % Allow line breaks around only a few characters (only).
3081 \def\urefcatcodes{%
3082 \catcode`\&=\active \catcode`\.=\active
3083 \catcode`\#=\active \catcode`\?=\active
3084 \catcode`\/=\active
3085 }
3086 {
3087 \urefcatcodes
3088 %
3089 \global\def\urefcode{\begingroup
3090 \setcodequotes
3091 \urefcatcodes
3092 \let&\urefcodeamp
3093 \let.\urefcodedot
3094 \let#\urefcodehash
3095 \let?\urefcodequest
3096 \let/\urefcodeslash
3097 \codex
3098 }
3099 %
3100 % By default, they are just regular characters.
3101 \global\def&{\normalamp}
3102 \global\def.{\normaldot}
3103 \global\def#{\normalhash}
3104 \global\def?{\normalquest}
3105 \global\def/{\normalslash}
3106 }
3107
3108 \def\urefcodeamp{\urefprebreak \&\urefpostbreak}
3109 \def\urefcodedot{\urefprebreak .\urefpostbreak}
3110 \def\urefcodehash{\urefprebreak \#\urefpostbreak}
3111 \def\urefcodequest{\urefprebreak ?\urefpostbreak}
3112 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3113 {
3114 \catcode`\/=\active
3115 \global\def\urefcodeslashfinish{%
3116 \urefprebreak \slashChar
3117 % Allow line break only after the final / in a sequence of
3118 % slashes, to avoid line break between the slashes in http://.
3119 \ifx\next/\else \urefpostbreak \fi
3120 }
3121 }
3122
3123 % By default we'll break after the special characters, but some people like to
3124 % break before the special chars, so allow that. Also allow no breaking at
3125 % all, for manual control.
3126 %
3127 \parseargdef\urefbreakstyle{%
3128 \def\txiarg{#1}%
3129 \ifx\txiarg\wordnone
3130 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3131 \else\ifx\txiarg\wordbefore
3132 \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
3133 \else\ifx\txiarg\wordafter
3134 \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
3135 \else
3136 \errhelp = \EMsimple
3137 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3138 \fi\fi\fi
3139 }
3140 \def\wordafter{after}
3141 \def\wordbefore{before}
3142 \def\wordnone{none}
3143
3144 % Allow a ragged right output to aid breaking long URL's. There can
3145 % be a break at the \allowbreak with no extra glue (if the existing stretch in
3146 % the line is sufficient), a break at the \penalty with extra glue added
3147 % at the end of the line, or no break at all here.
3148 % Changing the value of the penalty and/or the amount of stretch affects how
3149 % preferable one choice is over the other.
3150 \def\urefallowbreak{%
3151 \penalty0\relax
3152 \hskip 0pt plus 2 em\relax
3153 \penalty1000\relax
3154 \hskip 0pt plus -2 em\relax
3155 }
3156
3157 \urefbreakstyle after
3158
3159 % @url synonym for @uref, since that's how everyone uses it.
3160 %
3161 \let\url=\uref
3162
3163 % rms does not like angle brackets --karl, 17may97.
3164 % So now @email is just like @uref, unless we are pdf.
3165 %
3166 %\def\email#1{\angleleft{\tt #1}\angleright}
3167 \ifpdforxetex
3168 \def\email#1{\doemail#1,,\finish}
3169 \def\doemail#1,#2,#3\finish{\begingroup
3170 \unsepspaces
3171 \pdfurl{mailto:#1}%
3172 \setbox0 = \hbox{\ignorespaces #2}%
3173 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3174 \endlink
3175 \endgroup}
3176 \else
3177 \let\email=\uref
3178 \fi
3179
3180 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3181 % `example' (@kbd uses ttsl only inside of @example and friends),
3182 % or `code' (@kbd uses normal tty font always).
3183 \parseargdef\kbdinputstyle{%
3184 \def\txiarg{#1}%
3185 \ifx\txiarg\worddistinct
3186 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3187 \else\ifx\txiarg\wordexample
3188 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3189 \else\ifx\txiarg\wordcode
3190 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3191 \else
3192 \errhelp = \EMsimple
3193 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3194 \fi\fi\fi
3195 }
3196 \def\worddistinct{distinct}
3197 \def\wordexample{example}
3198 \def\wordcode{code}
3199
3200 % Default is `distinct'.
3201 \kbdinputstyle distinct
3202
3203 \def\kbd#1{%
3204 \tclose{\kbdfont\setcodequotes#1}%
3205 }
3206
3207 % definition of @key that produces a lozenge. Doesn't adjust to text size.
3208 %\setfont\keyrm\rmshape{8}{1000}{OT1}
3209 %\font\keysy=cmsy9
3210 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3211 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3212 % \vbox{\hrule\kern-0.4pt
3213 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3214 % \kern-0.4pt\hrule}%
3215 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3216
3217 % definition of @key with no lozenge.
3218 %
3219 \def\key#1{{\setregularquotes \tt #1}\null}
3220
3221 % @clicksequence{File @click{} Open ...}
3222 \def\clicksequence#1{\begingroup #1\endgroup}
3223
3224 % @clickstyle @arrow (by default)
3225 \parseargdef\clickstyle{\def\click{#1}}
3226 \def\click{\arrow}
3227
3228 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3229 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3230 %
3231 \def\dmn#1{\thinspace #1}
3232
3233 % @acronym for "FBI", "NATO", and the like.
3234 % We print this one point size smaller, since it's intended for
3235 % all-uppercase.
3236 %
3237 \def\acronym#1{\doacronym #1,,\finish}
3238 \def\doacronym#1,#2,#3\finish{%
3239 {\switchtolsize #1}%
3240 \def\temp{#2}%
3241 \ifx\temp\empty \else
3242 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3243 \fi
3244 \null % reset \spacefactor=1000
3245 }
3246
3247 % @abbr for "Comput. J." and the like.
3248 % No font change, but don't do end-of-sentence spacing.
3249 %
3250 \def\abbr#1{\doabbr #1,,\finish}
3251 \def\doabbr#1,#2,#3\finish{%
3252 {\plainfrenchspacing #1}%
3253 \def\temp{#2}%
3254 \ifx\temp\empty \else
3255 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3256 \fi
3257 \null % reset \spacefactor=1000
3258 }
3259
3260 % @asis just yields its argument. Used with @table, for example.
3261 %
3262 \def\asis#1{#1}
3263
3264 % @math outputs its argument in math mode.
3265 %
3266 % One complication: _ usually means subscripts, but it could also mean
3267 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
3268 % _ active, and distinguish by seeing if the current family is \slfam,
3269 % which is what @var uses.
3270 {
3271 \catcode`\_ = \active
3272 \gdef\mathunderscore{%
3273 \catcode`\_=\active
3274 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3275 }
3276 }
3277 % Another complication: we want \\ (and @\) to output a math (or tt) \.
3278 % FYI, plain.tex uses \\ as a temporary control sequence (for no
3279 % particular reason), but this is not advertised and we don't care.
3280 %
3281 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3282 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3283 %
3284 \def\math{%
3285 \ifmmode\else % only go into math if not in math mode already
3286 \tex
3287 \mathunderscore
3288 \let\\ = \mathbackslash
3289 \mathactive
3290 % make the texinfo accent commands work in math mode
3291 \let\"=\ddot
3292 \let\'=\acute
3293 \let\==\bar
3294 \let\^=\hat
3295 \let\`=\grave
3296 \let\u=\breve
3297 \let\v=\check
3298 \let\~=\tilde
3299 \let\dotaccent=\dot
3300 % have to provide another name for sup operator
3301 \let\mathopsup=\sup
3302 $\expandafter\finishmath\fi
3303 }
3304 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3305
3306 % Some active characters (such as <) are spaced differently in math.
3307 % We have to reset their definitions in case the @math was an argument
3308 % to a command which sets the catcodes (such as @item or @section).
3309 %
3310 {
3311 \catcode`^ = \active
3312 \catcode`< = \active
3313 \catcode`> = \active
3314 \catcode`+ = \active
3315 \catcode`' = \active
3316 \gdef\mathactive{%
3317 \let^ = \ptexhat
3318 \let< = \ptexless
3319 \let> = \ptexgtr
3320 \let+ = \ptexplus
3321 \let' = \ptexquoteright
3322 }
3323 }
3324
3325 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3326 % If in text, use math to place as sub/superscript, but switch
3327 % into text mode, with smaller fonts. This is a different font than the
3328 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3329 % fix it (significant additions to font machinery) until someone notices.
3330 %
3331 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3332 \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
3333 %
3334 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3335 \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
3336
3337 % provide this command from LaTeX as it is very common
3338 \def\frac#1#2{{{#1}\over{#2}}}
3339
3340 % @displaymath.
3341 % \globaldefs is needed to recognize the end lines in \tex and
3342 % \end tex. Set \thisenv as @end displaymath is seen before @end tex.
3343 {\obeylines
3344 \globaldefs=1
3345 \envdef\displaymath{%
3346 \tex%
3347 \def\thisenv{\displaymath}%
3348 \begingroup\let\end\displaymathend%
3349 $$%
3350 }
3351
3352 \def\displaymathend{$$\endgroup\end}%
3353
3354 \def\Edisplaymath{%
3355 \def\thisenv{\tex}%
3356 \end tex
3357 }}
3358
3359
3360 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3361 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3362 % except specified as a normal braced arg, so no newlines to worry about.
3363 %
3364 \def\outfmtnametex{tex}
3365 %
3366 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3367 \long\def\doinlinefmt#1,#2,\finish{%
3368 \def\inlinefmtname{#1}%
3369 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3370 }
3371 %
3372 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3373 % FMTNAME is tex, else ELSE-TEXT.
3374 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3375 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3376 \def\inlinefmtname{#1}%
3377 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3378 }
3379 %
3380 % For raw, must switch into @tex before parsing the argument, to avoid
3381 % setting catcodes prematurely. Doing it this way means that, for
3382 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3383 % ignored. But this isn't important because if people want a literal
3384 % *right* brace they would have to use a command anyway, so they may as
3385 % well use a command to get a left brace too. We could re-use the
3386 % delimiter character idea from \verb, but it seems like overkill.
3387 %
3388 \long\def\inlineraw{\tex \doinlineraw}
3389 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3390 \def\doinlinerawtwo#1,#2,\finish{%
3391 \def\inlinerawname{#1}%
3392 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3393 \endgroup % close group opened by \tex.
3394 }
3395
3396 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3397 %
3398 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3399 \long\def\doinlineifset#1,#2,\finish{%
3400 \def\inlinevarname{#1}%
3401 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3402 \else\ignorespaces#2\fi
3403 }
3404
3405 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3406 %
3407 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3408 \long\def\doinlineifclear#1,#2,\finish{%
3409 \def\inlinevarname{#1}%
3410 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3411 }
3412
3413
3414 \message{glyphs,}
3415 % and logos.
3416
3417 % @@ prints an @, as does @atchar{}.
3418 \def\@{\char64 }
3419 \let\atchar=\@
3420
3421 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3422 \def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}}
3423 \def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}}
3424 \let\{=\lbracechar
3425 \let\}=\rbracechar
3426
3427 % @comma{} to avoid , parsing problems.
3428 \let\comma = ,
3429
3430 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3431 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3432 \let\, = \ptexc
3433 \let\dotaccent = \ptexdot
3434 \def\ringaccent#1{{\accent23 #1}}
3435 \let\tieaccent = \ptext
3436 \let\ubaraccent = \ptexb
3437 \let\udotaccent = \d
3438
3439 % Other special characters: @questiondown @exclamdown @ordf @ordm
3440 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3441 \def\questiondown{?`}
3442 \def\exclamdown{!`}
3443 \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
3444 \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
3445
3446 % Dotless i and dotless j, used for accents.
3447 \def\imacro{i}
3448 \def\jmacro{j}
3449 \def\dotless#1{%
3450 \def\temp{#1}%
3451 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3452 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3453 \else \errmessage{@dotless can be used only with i or j}%
3454 \fi\fi
3455 }
3456
3457 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3458 % period following counts as ending a sentence. (Idea found in latex.)
3459 %
3460 \edef\TeX{\TeX \spacefactor=1000 }
3461
3462 % @LaTeX{} logo. Not quite the same results as the definition in
3463 % latex.ltx, since we use a different font for the raised A; it's most
3464 % convenient for us to use an explicitly smaller font, rather than using
3465 % the \scriptstyle font (since we don't reset \scriptstyle and
3466 % \scriptscriptstyle).
3467 %
3468 \def\LaTeX{%
3469 L\kern-.36em
3470 {\setbox0=\hbox{T}%
3471 \vbox to \ht0{\hbox{%
3472 \ifx\textnominalsize\xwordpt
3473 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
3474 % Revert to plain's \scriptsize, which is 7pt.
3475 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3476 \else
3477 \ifx\curfontsize\smallword
3478 % For footnotes and indices
3479 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3480 \else
3481 % For 11pt, we can use our lllsize.
3482 \switchtolllsize A%
3483 \fi
3484 \fi
3485 }%
3486 \vss
3487 }}%
3488 \kern-.15em
3489 \TeX
3490 }
3491 \def\smallword{small}
3492
3493 % Some math mode symbols. Define \ensuremath to switch into math mode
3494 % unless we are already there. Expansion tricks may not be needed here,
3495 % but safer, and can't hurt.
3496 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3497 \def\ensuredmath#1{$\relax#1$}
3498 %
3499 \def\bullet{\ensuremath\ptexbullet}
3500 \def\geq{\ensuremath\ge}
3501 \def\leq{\ensuremath\le}
3502 \def\minus{\ensuremath-}
3503
3504 % @dots{} outputs an ellipsis using the current font.
3505 % We do .5em per period so that it has the same spacing in the cm
3506 % typewriter fonts as three actual period characters; on the other hand,
3507 % in other typewriter fonts three periods are wider than 1.5em. So do
3508 % whichever is larger.
3509 %
3510 \def\dots{%
3511 \leavevmode
3512 \setbox0=\hbox{...}% get width of three periods
3513 \ifdim\wd0 > 1.5em
3514 \dimen0 = \wd0
3515 \else
3516 \dimen0 = 1.5em
3517 \fi
3518 \hbox to \dimen0{%
3519 \hskip 0pt plus.25fil
3520 .\hskip 0pt plus1fil
3521 .\hskip 0pt plus1fil
3522 .\hskip 0pt plus.5fil
3523 }%
3524 }
3525
3526 % @enddots{} is an end-of-sentence ellipsis.
3527 %
3528 \def\enddots{%
3529 \dots
3530 \spacefactor=\endofsentencespacefactor
3531 }
3532
3533 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3534 %
3535 % Since these characters are used in examples, they should be an even number of
3536 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3537 %
3538 \def\point{$\star$}
3539 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3540 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3541 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3542 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3543 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3544
3545 % The @error{} command.
3546 % Adapted from the TeXbook's \boxit.
3547 %
3548 \newbox\errorbox
3549 %
3550 {\ttfont \global\dimen0 = 3em}% Width of the box.
3551 \dimen2 = .55pt % Thickness of rules
3552 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3553 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3554 %
3555 \setbox\errorbox=\hbox to \dimen0{\hfil
3556 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3557 \advance\hsize by -2\dimen2 % Rules.
3558 \vbox{%
3559 \hrule height\dimen2
3560 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3561 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3562 \kern3pt\vrule width\dimen2}% Space to right.
3563 \hrule height\dimen2}
3564 \hfil}
3565 %
3566 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3567
3568 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3569 %
3570 \def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}}
3571
3572 % @euro{} comes from a separate font, depending on the current style.
3573 % We use the free feym* fonts from the eurosym package by Henrik
3574 % Theiling, which support regular, slanted, bold and bold slanted (and
3575 % "outlined" (blackboard board, sort of) versions, which we don't need).
3576 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3577 %
3578 % Although only regular is the truly official Euro symbol, we ignore
3579 % that. The Euro is designed to be slightly taller than the regular
3580 % font height.
3581 %
3582 % feymr - regular
3583 % feymo - slanted
3584 % feybr - bold
3585 % feybo - bold slanted
3586 %
3587 % There is no good (free) typewriter version, to my knowledge.
3588 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3589 % Hmm.
3590 %
3591 % Also doesn't work in math. Do we need to do math with euro symbols?
3592 % Hope not.
3593 %
3594 %
3595 \def\euro{{\eurofont e}}
3596 \def\eurofont{%
3597 % We set the font at each command, rather than predefining it in
3598 % \textfonts and the other font-switching commands, so that
3599 % installations which never need the symbol don't have to have the
3600 % font installed.
3601 %
3602 % There is only one designed size (nominal 10pt), so we always scale
3603 % that to the current nominal size.
3604 %
3605 % By the way, simply using "at 1em" works for cmr10 and the like, but
3606 % does not work for cmbx10 and other extended/shrunken fonts.
3607 %
3608 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3609 %
3610 \ifx\curfontstyle\bfstylename
3611 % bold:
3612 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3613 \else
3614 % regular:
3615 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3616 \fi
3617 \thiseurofont
3618 }
3619
3620 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3621 % sometimes we redefine the original macro, and the alias should reflect
3622 % the redefinition.
3623 %
3624 % Use LaTeX names for the Icelandic letters.
3625 \def\DH{{\ecfont \char"D0}} % Eth
3626 \def\dh{{\ecfont \char"F0}} % eth
3627 \def\TH{{\ecfont \char"DE}} % Thorn
3628 \def\th{{\ecfont \char"FE}} % thorn
3629 %
3630 \def\guillemetleft{{\ecfont \char"13}}
3631 \def\guillemotleft{\guillemetleft}
3632 \def\guillemetright{{\ecfont \char"14}}
3633 \def\guillemotright{\guillemetright}
3634 \def\guilsinglleft{{\ecfont \char"0E}}
3635 \def\guilsinglright{{\ecfont \char"0F}}
3636 \def\quotedblbase{{\ecfont \char"12}}
3637 \def\quotesinglbase{{\ecfont \char"0D}}
3638 %
3639 \def\L{{\ecfont \char"8A}} % L with stroke
3640 \def\l{{\ecfont \char"AA}} % l with stroke
3641 %
3642 % This positioning is not perfect (see the ogonek LaTeX package), but
3643 % we have the precomposed glyphs for the most common cases. We put the
3644 % tests to use those glyphs in the single \ogonek macro so we have fewer
3645 % dummy definitions to worry about for index entries, etc.
3646 %
3647 % ogonek is also used with other letters in Lithuanian (IOU), but using
3648 % the precomposed glyphs for those is not so easy since they aren't in
3649 % the same EC font.
3650 \def\ogonek#1{{%
3651 \def\temp{#1}%
3652 \ifx\temp\macrocharA\Aogonek
3653 \else\ifx\temp\macrochara\aogonek
3654 \else\ifx\temp\macrocharE\Eogonek
3655 \else\ifx\temp\macrochare\eogonek
3656 \else
3657 \ecfont \setbox0=\hbox{#1}%
3658 \ifdim\ht0=1ex\accent"0C #1%
3659 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3660 \fi
3661 \fi\fi\fi\fi
3662 }%
3663 }
3664 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3665 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3666 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3667 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3668 %
3669 % Use the European Computer Modern fonts (cm-super in outline format)
3670 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3671 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3672 % package and follow the same conventions.
3673 %
3674 \def\ecfont{\etcfont{e}}
3675 \def\tcfont{\etcfont{t}}
3676 %
3677 \def\etcfont#1{%
3678 % We can't distinguish serif/sans and italic/slanted, but this
3679 % is used for crude hacks anyway (like adding French and German
3680 % quotes to documents typeset with CM, where we lose kerning), so
3681 % hopefully nobody will notice/care.
3682 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3683 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3684 \ifusingtt
3685 % typewriter:
3686 {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}%
3687 % else
3688 {\ifx\curfontstyle\bfstylename
3689 % bold:
3690 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3691 \else
3692 % regular:
3693 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3694 \fi}%
3695 \thisecfont
3696 }
3697
3698 % @registeredsymbol - R in a circle. The font for the R should really
3699 % be smaller yet, but lllsize is the best we can do for now.
3700 % Adapted from the plain.tex definition of \copyright.
3701 %
3702 \def\registeredsymbol{%
3703 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
3704 \hfil\crcr\Orb}}%
3705 }$%
3706 }
3707
3708 % @textdegree - the normal degrees sign.
3709 %
3710 \def\textdegree{%
3711 \ifmmode ^\circ
3712 \else {\tcfont \char 176}%
3713 \fi}
3714
3715 % Laurent Siebenmann reports \Orb undefined with:
3716 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3717 % so we'll define it if necessary.
3718 %
3719 \ifx\Orb\thisisundefined
3720 \def\Orb{\mathhexbox20D}
3721 \fi
3722
3723 % Quotes.
3724 \chardef\quoteleft=`\`
3725 \chardef\quoteright=`\'
3726
3727 % only change font for tt for correct kerning and to avoid using
3728 % \ecfont unless necessary.
3729 \def\quotedblleft{%
3730 \ifusingtt{{\ecfont\char"10}}{{\char"5C}}%
3731 }
3732
3733 \def\quotedblright{%
3734 \ifusingtt{{\ecfont\char"11}}{{\char`\"}}%
3735 }
3736
3737
3738 \message{page headings,}
3739
3740 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3741 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3742
3743 % First the title page. Must do @settitle before @titlepage.
3744 \newif\ifseenauthor
3745 \newif\iffinishedtitlepage
3746
3747 % @setcontentsaftertitlepage used to do an implicit @contents or
3748 % @shortcontents after @end titlepage, but it is now obsolete.
3749 \def\setcontentsaftertitlepage{%
3750 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3751 command; move your @contents command if you want the contents
3752 after the title page.}}%
3753 \def\setshortcontentsaftertitlepage{%
3754 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3755 command; move your @shortcontents and @contents commands if you
3756 want the contents after the title page.}}%
3757
3758 \parseargdef\shorttitlepage{%
3759 {\headingsoff \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3760 \endgroup\page\hbox{}\page}\pageone}
3761
3762 \envdef\titlepage{%
3763 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3764 \begingroup
3765 \parindent=0pt \textfonts
3766 \headingsoff
3767 % Leave some space at the very top of the page.
3768 \vglue\titlepagetopglue
3769 % No rule at page bottom unless we print one at the top with @title.
3770 \finishedtitlepagetrue
3771 %
3772 % Most title ``pages'' are actually two pages long, with space
3773 % at the top of the second. We don't want the ragged left on the second.
3774 \let\oldpage = \page
3775 \def\page{%
3776 \iffinishedtitlepage\else
3777 \finishtitlepage
3778 \fi
3779 \let\page = \oldpage
3780 \page
3781 \null
3782 }%
3783 }
3784
3785 \def\Etitlepage{%
3786 \iffinishedtitlepage\else
3787 \finishtitlepage
3788 \fi
3789 % It is important to do the page break before ending the group,
3790 % because the headline and footline are only empty inside the group.
3791 % If we use the new definition of \page, we always get a blank page
3792 % after the title page, which we certainly don't want.
3793 \oldpage
3794 \pageone
3795 \endgroup
3796 %
3797 }
3798
3799 \def\finishtitlepage{%
3800 \vskip4pt \hrule height 2pt width \hsize
3801 \vskip\titlepagebottomglue
3802 \finishedtitlepagetrue
3803 }
3804
3805 % Settings used for typesetting titles: no hyphenation, no indentation,
3806 % don't worry much about spacing, ragged right. This should be used
3807 % inside a \vbox, and fonts need to be set appropriately first. \par should
3808 % be specified before the end of the \vbox, since a vbox is a group.
3809 %
3810 \def\raggedtitlesettings{%
3811 \rm
3812 \hyphenpenalty=10000
3813 \parindent=0pt
3814 \tolerance=5000
3815 \ptexraggedright
3816 }
3817
3818 % Macros to be used within @titlepage:
3819
3820 \let\subtitlerm=\rmfont
3821 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3822
3823 \parseargdef\title{%
3824 \checkenv\titlepage
3825 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3826 % print a rule at the page bottom also.
3827 \finishedtitlepagefalse
3828 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3829 }
3830
3831 \parseargdef\subtitle{%
3832 \checkenv\titlepage
3833 {\subtitlefont \rightline{#1}}%
3834 }
3835
3836 % @author should come last, but may come many times.
3837 % It can also be used inside @quotation.
3838 %
3839 \parseargdef\author{%
3840 \def\temp{\quotation}%
3841 \ifx\thisenv\temp
3842 \def\quotationauthor{#1}% printed in \Equotation.
3843 \else
3844 \checkenv\titlepage
3845 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3846 {\secfonts\rm \leftline{#1}}%
3847 \fi
3848 }
3849
3850
3851 % Set up page headings and footings.
3852
3853 \let\thispage=\folio
3854
3855 \newtoks\evenheadline % headline on even pages
3856 \newtoks\oddheadline % headline on odd pages
3857 \newtoks\evenchapheadline% headline on even pages with a new chapter
3858 \newtoks\oddchapheadline % headline on odd pages with a new chapter
3859 \newtoks\evenfootline % footline on even pages
3860 \newtoks\oddfootline % footline on odd pages
3861
3862 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3863 \headline={{\textfonts\rm\frenchspacingsetting
3864 \ifchapterpage
3865 \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
3866 \else
3867 \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
3868 \fi}}
3869
3870 \footline={{\textfonts\rm\frenchspacingsetting
3871 \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}%
3872 \HEADINGShook}
3873 \let\HEADINGShook=\relax
3874
3875 % Commands to set those variables.
3876 % For example, this is what @headings on does
3877 % @evenheading @thistitle|@thispage|@thischapter
3878 % @oddheading @thischapter|@thispage|@thistitle
3879 % @evenfooting @thisfile||
3880 % @oddfooting ||@thisfile
3881
3882
3883 \def\evenheading{\parsearg\evenheadingxxx}
3884 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3885 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3886 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
3887 \global\evenchapheadline=\evenheadline}
3888
3889 \def\oddheading{\parsearg\oddheadingxxx}
3890 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3891 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3892 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3893 \global\oddchapheadline=\oddheadline}
3894
3895 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3896
3897 \def\evenfooting{\parsearg\evenfootingxxx}
3898 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3899 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3900 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3901
3902 \def\oddfooting{\parsearg\oddfootingxxx}
3903 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3904 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3905 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3906 %
3907 % Leave some space for the footline. Hopefully ok to assume
3908 % @evenfooting will not be used by itself.
3909 \global\advance\txipageheight by -12pt
3910 \global\advance\vsize by -12pt
3911 }
3912
3913 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3914
3915 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3916 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3917 %
3918 % The same set of arguments for:
3919 %
3920 % @oddheadingmarks
3921 % @evenfootingmarks
3922 % @oddfootingmarks
3923 % @everyheadingmarks
3924 % @everyfootingmarks
3925
3926 % These define \getoddheadingmarks, \getevenheadingmarks,
3927 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3928 % \gettopheadingmarks, \getbottomheadingmarks.
3929 %
3930 \def\evenheadingmarks{\headingmarks{even}{heading}}
3931 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3932 \def\evenfootingmarks{\headingmarks{even}{footing}}
3933 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3934 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3935 \headingmarks{odd}{heading}{#1} }
3936 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3937 \headingmarks{odd}{footing}{#1} }
3938 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3939 \def\headingmarks#1#2#3 {%
3940 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3941 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3942 }
3943
3944 \everyheadingmarks bottom
3945 \everyfootingmarks bottom
3946
3947 % @headings double turns headings on for double-sided printing.
3948 % @headings single turns headings on for single-sided printing.
3949 % @headings off turns them off.
3950 % @headings on same as @headings double, retained for compatibility.
3951 % @headings after turns on double-sided headings after this page.
3952 % @headings doubleafter turns on double-sided headings after this page.
3953 % @headings singleafter turns on single-sided headings after this page.
3954 % By default, they are off at the start of a document,
3955 % and turned `on' after @end titlepage.
3956
3957 \parseargdef\headings{\csname HEADINGS#1\endcsname}
3958
3959 \def\headingsoff{% non-global headings elimination
3960 \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}%
3961 \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}%
3962 }
3963
3964 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3965
3966 % Set the page number to 1.
3967 \def\pageone{
3968 \global\pageno=1
3969 \global\arabiccount = \pagecount
3970 }
3971
3972 \let\contentsalignmacro = \chappager
3973
3974 % \def\HEADINGSon{\HEADINGSdouble} % defined by \CHAPPAGon
3975
3976 % For double-sided printing, put current file name in lower left corner,
3977 % chapter name on inside top of right hand pages, document
3978 % title on inside top of left hand pages, and page numbers on outside top
3979 % edge of all pages.
3980 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdouble}
3981 \let\HEADINGSdoubleafter=\HEADINGSafter
3982 \def\HEADINGSdouble{%
3983 \global\evenfootline={\hfil}
3984 \global\oddfootline={\hfil}
3985 \global\evenheadline={\line{\folio\hfil\thistitle}}
3986 \global\oddheadline={\line{\thischapter\hfil\folio}}
3987 \global\evenchapheadline={\line{\folio\hfil\thistitle}}
3988 \global\oddchapheadline={\line{\hfil\folio}}
3989 \global\let\contentsalignmacro = \chapoddpage
3990 }
3991
3992 % For single-sided printing, chapter title goes across top left of page,
3993 % page number on top right.
3994 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsingle}
3995 \def\HEADINGSsingle{%
3996 \global\evenfootline={\hfil}
3997 \global\oddfootline={\hfil}
3998 \global\evenheadline={\line{\thischapter\hfil\folio}}
3999 \global\oddheadline={\line{\thischapter\hfil\folio}}
4000 \global\evenchapheadline={\line{\hfil\folio}}
4001 \global\oddchapheadline={\line{\hfil\folio}}
4002 \global\let\contentsalignmacro = \chappager
4003 }
4004
4005 % for @setchapternewpage off
4006 \def\HEADINGSsinglechapoff{%
4007 \global\evenfootline={\hfil}
4008 \global\oddfootline={\hfil}
4009 \global\evenheadline={\line{\thischapter\hfil\folio}}
4010 \global\oddheadline={\line{\thischapter\hfil\folio}}
4011 \global\evenchapheadline=\evenheadline
4012 \global\oddchapheadline=\oddheadline
4013 \global\let\contentsalignmacro = \chappager
4014 }
4015
4016 % Subroutines used in generating headings
4017 % This produces Day Month Year style of output.
4018 % Only define if not already defined, in case a txi-??.tex file has set
4019 % up a different format (e.g., txi-cs.tex does this).
4020 \ifx\today\thisisundefined
4021 \def\today{%
4022 \number\day\space
4023 \ifcase\month
4024 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
4025 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
4026 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
4027 \fi
4028 \space\number\year}
4029 \fi
4030
4031 % @settitle line... specifies the title of the document, for headings.
4032 % It generates no output of its own.
4033 \def\thistitle{\putwordNoTitle}
4034 \def\settitle{\parsearg{\gdef\thistitle}}
4035
4036
4037 \message{tables,}
4038 % Tables -- @table, @ftable, @vtable, @item(x).
4039
4040 % default indentation of table text
4041 \newdimen\tableindent \tableindent=.8in
4042 % default indentation of @itemize and @enumerate text
4043 \newdimen\itemindent \itemindent=.3in
4044 % margin between end of table item and start of table text.
4045 \newdimen\itemmargin \itemmargin=.1in
4046
4047 % used internally for \itemindent minus \itemmargin
4048 \newdimen\itemmax
4049
4050 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
4051 % these defs.
4052 % They also define \itemindex
4053 % to index the item name in whatever manner is desired (perhaps none).
4054
4055 \newif\ifitemxneedsnegativevskip
4056
4057 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4058
4059 \def\internalBitem{\smallbreak \parsearg\itemzzz}
4060 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
4061
4062 \def\itemzzz #1{\begingroup %
4063 \advance\hsize by -\rightskip
4064 \advance\hsize by -\tableindent
4065 \setbox0=\hbox{\itemindicate{#1}}%
4066 \itemindex{#1}%
4067 \nobreak % This prevents a break before @itemx.
4068 %
4069 % If the item text does not fit in the space we have, put it on a line
4070 % by itself, and do not allow a page break either before or after that
4071 % line. We do not start a paragraph here because then if the next
4072 % command is, e.g., @kindex, the whatsit would get put into the
4073 % horizontal list on a line by itself, resulting in extra blank space.
4074 \ifdim \wd0>\itemmax
4075 %
4076 % Make this a paragraph so we get the \parskip glue and wrapping,
4077 % but leave it ragged-right.
4078 \begingroup
4079 \advance\leftskip by-\tableindent
4080 \advance\hsize by\tableindent
4081 \advance\rightskip by0pt plus1fil\relax
4082 \leavevmode\unhbox0\par
4083 \endgroup
4084 %
4085 % We're going to be starting a paragraph, but we don't want the
4086 % \parskip glue -- logically it's part of the @item we just started.
4087 \nobreak \vskip-\parskip
4088 %
4089 % Stop a page break at the \parskip glue coming up. However, if
4090 % what follows is an environment such as @example, there will be no
4091 % \parskip glue; then the negative vskip we just inserted would
4092 % cause the example and the item to crash together. So we use this
4093 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4094 % \parskip glue after all. Section titles are handled this way also.
4095 %
4096 \penalty 10001
4097 \endgroup
4098 \itemxneedsnegativevskipfalse
4099 \else
4100 % The item text fits into the space. Start a paragraph, so that the
4101 % following text (if any) will end up on the same line.
4102 \noindent
4103 % Do this with kerns and \unhbox so that if there is a footnote in
4104 % the item text, it can migrate to the main vertical list and
4105 % eventually be printed.
4106 \nobreak\kern-\tableindent
4107 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4108 \unhbox0
4109 \nobreak\kern\dimen0
4110 \endgroup
4111 \itemxneedsnegativevskiptrue
4112 \fi
4113 }
4114
4115 \def\item{\errmessage{@item while not in a list environment}}
4116 \def\itemx{\errmessage{@itemx while not in a list environment}}
4117
4118 % @table, @ftable, @vtable.
4119 \envdef\table{%
4120 \let\itemindex\gobble
4121 \tablecheck{table}%
4122 }
4123 \envdef\ftable{%
4124 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4125 \tablecheck{ftable}%
4126 }
4127 \envdef\vtable{%
4128 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4129 \tablecheck{vtable}%
4130 }
4131 \def\tablecheck#1{%
4132 \ifnum \the\catcode`\^^M=\active
4133 \endgroup
4134 \errmessage{This command won't work in this context; perhaps the problem is
4135 that we are \inenvironment\thisenv}%
4136 \def\next{\doignore{#1}}%
4137 \else
4138 \let\next\tablex
4139 \fi
4140 \next
4141 }
4142 \def\tablex#1{%
4143 \def\itemindicate{#1}%
4144 \parsearg\tabley
4145 }
4146 \def\tabley#1{%
4147 {%
4148 \makevalueexpandable
4149 \edef\temp{\noexpand\tablez #1\space\space\space}%
4150 \expandafter
4151 }\temp \endtablez
4152 }
4153 \def\tablez #1 #2 #3 #4\endtablez{%
4154 \aboveenvbreak
4155 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4156 \ifnum 0#2>0 \tableindent=#2\mil \fi
4157 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4158 \itemmax=\tableindent
4159 \advance \itemmax by -\itemmargin
4160 \advance \leftskip by \tableindent
4161 \exdentamount=\tableindent
4162 \parindent = 0pt
4163 \parskip = \smallskipamount
4164 \ifdim \parskip=0pt \parskip=2pt \fi
4165 \let\item = \internalBitem
4166 \let\itemx = \internalBitemx
4167 }
4168 \def\Etable{\endgraf\afterenvbreak}
4169 \let\Eftable\Etable
4170 \let\Evtable\Etable
4171 \let\Eitemize\Etable
4172 \let\Eenumerate\Etable
4173
4174 % This is the counter used by @enumerate, which is really @itemize
4175
4176 \newcount \itemno
4177
4178 \envdef\itemize{\parsearg\doitemize}
4179
4180 \def\doitemize#1{%
4181 \aboveenvbreak
4182 \itemmax=\itemindent
4183 \advance\itemmax by -\itemmargin
4184 \advance\leftskip by \itemindent
4185 \exdentamount=\itemindent
4186 \parindent=0pt
4187 \parskip=\smallskipamount
4188 \ifdim\parskip=0pt \parskip=2pt \fi
4189 %
4190 % Try typesetting the item mark so that if the document erroneously says
4191 % something like @itemize @samp (intending @table), there's an error
4192 % right away at the @itemize. It's not the best error message in the
4193 % world, but it's better than leaving it to the @item. This means if
4194 % the user wants an empty mark, they have to say @w{} not just @w.
4195 \def\itemcontents{#1}%
4196 \setbox0 = \hbox{\itemcontents}%
4197 %
4198 % @itemize with no arg is equivalent to @itemize @bullet.
4199 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4200 %
4201 \let\item=\itemizeitem
4202 }
4203
4204 % Definition of @item while inside @itemize and @enumerate.
4205 %
4206 \def\itemizeitem{%
4207 \advance\itemno by 1 % for enumerations
4208 {\let\par=\endgraf \smallbreak}% reasonable place to break
4209 {%
4210 % If the document has an @itemize directly after a section title, a
4211 % \nobreak will be last on the list, and \sectionheading will have
4212 % done a \vskip-\parskip. In that case, we don't want to zero
4213 % parskip, or the item text will crash with the heading. On the
4214 % other hand, when there is normal text preceding the item (as there
4215 % usually is), we do want to zero parskip, or there would be too much
4216 % space. In that case, we won't have a \nobreak before. At least
4217 % that's the theory.
4218 \ifnum\lastpenalty<10000 \parskip=0in \fi
4219 \noindent
4220 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4221 %
4222 \ifinner\else
4223 \vadjust{\penalty 1200}% not good to break after first line of item.
4224 \fi
4225 % We can be in inner vertical mode in a footnote, although an
4226 % @itemize looks awful there.
4227 }%
4228 \flushcr
4229 }
4230
4231 % \splitoff TOKENS\endmark defines \first to be the first token in
4232 % TOKENS, and \rest to be the remainder.
4233 %
4234 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4235
4236 % Allow an optional argument of an uppercase letter, lowercase letter,
4237 % or number, to specify the first label in the enumerated list. No
4238 % argument is the same as `1'.
4239 %
4240 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4241 \def\enumeratey #1 #2\endenumeratey{%
4242 % If we were given no argument, pretend we were given `1'.
4243 \def\thearg{#1}%
4244 \ifx\thearg\empty \def\thearg{1}\fi
4245 %
4246 % Detect if the argument is a single token. If so, it might be a
4247 % letter. Otherwise, the only valid thing it can be is a number.
4248 % (We will always have one token, because of the test we just made.
4249 % This is a good thing, since \splitoff doesn't work given nothing at
4250 % all -- the first parameter is undelimited.)
4251 \expandafter\splitoff\thearg\endmark
4252 \ifx\rest\empty
4253 % Only one token in the argument. It could still be anything.
4254 % A ``lowercase letter'' is one whose \lccode is nonzero.
4255 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4256 % not equal to itself.
4257 % Otherwise, we assume it's a number.
4258 %
4259 % We need the \relax at the end of the \ifnum lines to stop TeX from
4260 % continuing to look for a <number>.
4261 %
4262 \ifnum\lccode\expandafter`\thearg=0\relax
4263 \numericenumerate % a number (we hope)
4264 \else
4265 % It's a letter.
4266 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4267 \lowercaseenumerate % lowercase letter
4268 \else
4269 \uppercaseenumerate % uppercase letter
4270 \fi
4271 \fi
4272 \else
4273 % Multiple tokens in the argument. We hope it's a number.
4274 \numericenumerate
4275 \fi
4276 }
4277
4278 % An @enumerate whose labels are integers. The starting integer is
4279 % given in \thearg.
4280 %
4281 \def\numericenumerate{%
4282 \itemno = \thearg
4283 \startenumeration{\the\itemno}%
4284 }
4285
4286 % The starting (lowercase) letter is in \thearg.
4287 \def\lowercaseenumerate{%
4288 \itemno = \expandafter`\thearg
4289 \startenumeration{%
4290 % Be sure we're not beyond the end of the alphabet.
4291 \ifnum\itemno=0
4292 \errmessage{No more lowercase letters in @enumerate; get a bigger
4293 alphabet}%
4294 \fi
4295 \char\lccode\itemno
4296 }%
4297 }
4298
4299 % The starting (uppercase) letter is in \thearg.
4300 \def\uppercaseenumerate{%
4301 \itemno = \expandafter`\thearg
4302 \startenumeration{%
4303 % Be sure we're not beyond the end of the alphabet.
4304 \ifnum\itemno=0
4305 \errmessage{No more uppercase letters in @enumerate; get a bigger
4306 alphabet}
4307 \fi
4308 \char\uccode\itemno
4309 }%
4310 }
4311
4312 % Call \doitemize, adding a period to the first argument and supplying the
4313 % common last two arguments. Also subtract one from the initial value in
4314 % \itemno, since @item increments \itemno.
4315 %
4316 \def\startenumeration#1{%
4317 \advance\itemno by -1
4318 \doitemize{#1.}\flushcr
4319 }
4320
4321
4322 % @multitable macros
4323
4324 % Macros used to set up halign preamble:
4325 %
4326 \let\endsetuptable\relax
4327 \def\xendsetuptable{\endsetuptable}
4328 \let\columnfractions\relax
4329 \def\xcolumnfractions{\columnfractions}
4330 \newif\ifsetpercent
4331
4332 % #1 is the @columnfraction, usually a decimal number like .5, but might
4333 % be just 1. We just use it, whatever it is.
4334 %
4335 \def\pickupwholefraction#1 {%
4336 \global\advance\colcount by 1
4337 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4338 \setuptable
4339 }
4340
4341 \newcount\colcount
4342 \def\setuptable#1{%
4343 \def\firstarg{#1}%
4344 \ifx\firstarg\xendsetuptable
4345 \let\go = \relax
4346 \else
4347 \ifx\firstarg\xcolumnfractions
4348 \global\setpercenttrue
4349 \else
4350 \ifsetpercent
4351 \let\go\pickupwholefraction
4352 \else
4353 \global\advance\colcount by 1
4354 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4355 % separator; typically that is always in the input, anyway.
4356 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4357 \fi
4358 \fi
4359 \ifx\go\pickupwholefraction
4360 % Put the argument back for the \pickupwholefraction call, so
4361 % we'll always have a period there to be parsed.
4362 \def\go{\pickupwholefraction#1}%
4363 \else
4364 \let\go = \setuptable
4365 \fi%
4366 \fi
4367 \go
4368 }
4369
4370 % @headitem starts a heading row, which we typeset in bold. Assignments
4371 % have to be global since we are inside the implicit group of an
4372 % alignment entry. \everycr below resets \everytab so we don't have to
4373 % undo it ourselves.
4374 \def\headitemfont{\b}% for people to use in the template row; not changeable
4375 \def\headitem{%
4376 \crcr % must appear first
4377 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4378 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4379 \the\everytab % for the first item
4380 }%
4381 %
4382 % default for tables with no headings.
4383 \let\headitemcrhook=\relax
4384 %
4385 \def\tab{\checkenv\multitable &\the\everytab}%
4386
4387 \newtoks\everytab % insert after every tab.
4388 %
4389 \envdef\multitable{%
4390 \vskip\parskip
4391 \startsavinginserts
4392 %
4393 % @item within a multitable starts a normal row.
4394 % We use \def instead of \let so that if one of the multitable entries
4395 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4396 % \endtemplate) expanding \doitemize.
4397 \def\item{\crcr}%
4398 %
4399 \tolerance=9500
4400 \hbadness=9500
4401 \parskip=0pt
4402 \parindent=6pt
4403 \overfullrule=0pt
4404 \global\colcount=0
4405 %
4406 \everycr = {%
4407 \noalign{%
4408 \global\everytab={}% Reset from possible headitem.
4409 \global\colcount=0 % Reset the column counter.
4410 %
4411 % Check for saved footnotes, etc.:
4412 \checkinserts
4413 %
4414 % Perhaps a \nobreak, then reset:
4415 \headitemcrhook
4416 \global\let\headitemcrhook=\relax
4417 }%
4418 }%
4419 %
4420 \parsearg\domultitable
4421 }
4422 \def\domultitable#1{%
4423 % To parse everything between @multitable and @item:
4424 \setuptable#1 \endsetuptable
4425 %
4426 % This preamble sets up a generic column definition, which will
4427 % be used as many times as user calls for columns.
4428 % \vtop will set a single line and will also let text wrap and
4429 % continue for many paragraphs if desired.
4430 \halign\bgroup &%
4431 \global\advance\colcount by 1
4432 \strut
4433 \vtop{%
4434 \advance\hsize by -1\leftskip
4435 % Find the correct column width
4436 \hsize=\expandafter\csname col\the\colcount\endcsname
4437 %
4438 \advance\rightskip by -1\rightskip % Zero leaving only any stretch
4439 \ifnum\colcount=1
4440 \advance\hsize by\leftskip % Add indent of surrounding text
4441 \else
4442 % In order to keep entries from bumping into each other.
4443 \leftskip=12pt
4444 \ifsetpercent \else
4445 % If a template has been used
4446 \advance\hsize by \leftskip
4447 \fi
4448 \fi
4449 \noindent\ignorespaces##\unskip\strut
4450 }\cr
4451 }
4452 \def\Emultitable{%
4453 \crcr
4454 \egroup % end the \halign
4455 \global\setpercentfalse
4456 }
4457
4458
4459 \message{conditionals,}
4460
4461 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotlatex, @ifnotplaintext,
4462 % @ifnotxml always succeed. They currently do nothing; we don't
4463 % attempt to check whether the conditionals are properly nested. But we
4464 % have to remember that they are conditionals, so that @end doesn't
4465 % attempt to close an environment group.
4466 %
4467 \def\makecond#1{%
4468 \expandafter\let\csname #1\endcsname = \relax
4469 \expandafter\let\csname iscond.#1\endcsname = 1
4470 }
4471 \makecond{iftex}
4472 \makecond{ifnotdocbook}
4473 \makecond{ifnothtml}
4474 \makecond{ifnotinfo}
4475 \makecond{ifnotlatex}
4476 \makecond{ifnotplaintext}
4477 \makecond{ifnotxml}
4478
4479 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4480 %
4481 \def\direntry{\doignore{direntry}}
4482 \def\documentdescription{\doignore{documentdescription}}
4483 \def\docbook{\doignore{docbook}}
4484 \def\html{\doignore{html}}
4485 \def\ifdocbook{\doignore{ifdocbook}}
4486 \def\ifhtml{\doignore{ifhtml}}
4487 \def\ifinfo{\doignore{ifinfo}}
4488 \def\iflatex{\doignore{iflatex}}
4489 \def\ifnottex{\doignore{ifnottex}}
4490 \def\ifplaintext{\doignore{ifplaintext}}
4491 \def\ifxml{\doignore{ifxml}}
4492 \def\ignore{\doignore{ignore}}
4493 \def\latex{\doignore{latex}}
4494 \def\menu{\doignore{menu}}
4495 \def\xml{\doignore{xml}}
4496
4497 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4498 %
4499 % A count to remember the depth of nesting.
4500 \newcount\doignorecount
4501
4502 \def\doignore#1{\begingroup
4503 % Scan in ``verbatim'' mode:
4504 \obeylines
4505 \catcode`\@ = \other
4506 \catcode`\{ = \other
4507 \catcode`\} = \other
4508 %
4509 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4510 \spaceisspace
4511 %
4512 % Count number of #1's that we've seen.
4513 \doignorecount = 0
4514 %
4515 % Swallow text until we reach the matching `@end #1'.
4516 \dodoignore{#1}%
4517 }
4518
4519 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4520 \obeylines %
4521 %
4522 \gdef\dodoignore#1{%
4523 % #1 contains the command name as a string, e.g., `ifinfo'.
4524 %
4525 % Define a command to find the next `@end #1'.
4526 \long\def\doignoretext##1^^M@end #1{%
4527 \doignoretextyyy##1^^M@#1\_STOP_}%
4528 %
4529 % And this command to find another #1 command, at the beginning of a
4530 % line. (Otherwise, we would consider a line `@c @ifset', for
4531 % example, to count as an @ifset for nesting.)
4532 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4533 %
4534 % And now expand that command.
4535 \doignoretext ^^M%
4536 }%
4537 }
4538
4539 \def\doignoreyyy#1{%
4540 \def\temp{#1}%
4541 \ifx\temp\empty % Nothing found.
4542 \let\next\doignoretextzzz
4543 \else % Found a nested condition, ...
4544 \advance\doignorecount by 1
4545 \let\next\doignoretextyyy % ..., look for another.
4546 % If we're here, #1 ends with ^^M\ifinfo (for example).
4547 \fi
4548 \next #1% the token \_STOP_ is present just after this macro.
4549 }
4550
4551 % We have to swallow the remaining "\_STOP_".
4552 %
4553 \def\doignoretextzzz#1{%
4554 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4555 \let\next\enddoignore
4556 \else % Still inside a nested condition.
4557 \advance\doignorecount by -1
4558 \let\next\doignoretext % Look for the next @end.
4559 \fi
4560 \next
4561 }
4562
4563 % Finish off ignored text.
4564 { \obeylines%
4565 % Ignore anything after the last `@end #1'; this matters in verbatim
4566 % environments, where otherwise the newline after an ignored conditional
4567 % would result in a blank line in the output.
4568 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4569 }
4570
4571
4572 % @set VAR sets the variable VAR to an empty value.
4573 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4574 %
4575 % Since we want to separate VAR from REST-OF-LINE (which might be
4576 % empty), we can't just use \parsearg; we have to insert a space of our
4577 % own to delimit the rest of the line, and then take it out again if we
4578 % didn't need it.
4579 % We rely on the fact that \parsearg sets \catcode`\ =10.
4580 %
4581 \parseargdef\set{\setyyy#1 \endsetyyy}
4582 \def\setyyy#1 #2\endsetyyy{%
4583 {%
4584 \makevalueexpandable
4585 \def\temp{#2}%
4586 \edef\next{\gdef\makecsname{SET#1}}%
4587 \ifx\temp\empty
4588 \next{}%
4589 \else
4590 \setzzz#2\endsetzzz
4591 \fi
4592 }%
4593 }
4594 % Remove the trailing space \setxxx inserted.
4595 \def\setzzz#1 \endsetzzz{\next{#1}}
4596
4597 % @clear VAR clears (i.e., unsets) the variable VAR.
4598 %
4599 \parseargdef\clear{%
4600 {%
4601 \makevalueexpandable
4602 \global\expandafter\let\csname SET#1\endcsname=\relax
4603 }%
4604 }
4605
4606 % @value{foo} gets the text saved in variable foo.
4607 \def\value{\begingroup\makevalueexpandable\valuexxx}
4608 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4609 {
4610 \catcode`\-=\active \catcode`\_=\active
4611 %
4612 \gdef\makevalueexpandable{%
4613 \let\value = \expandablevalue
4614 % We don't want these characters active, ...
4615 \catcode`\-=\other \catcode`\_=\other
4616 % ..., but we might end up with active ones in the argument if
4617 % we're called from @code, as @code{@value{foo-bar_}}, though.
4618 % So \let them to their normal equivalents.
4619 \let-\normaldash \let_\normalunderscore
4620 }
4621 }
4622
4623 \def\expandablevalue#1{%
4624 \expandafter\ifx\csname SET#1\endcsname\relax
4625 {[No value for ``#1'']}%
4626 \message{Variable `#1', used in @value, is not set.}%
4627 \else
4628 \csname SET#1\endcsname
4629 \fi
4630 }
4631
4632 % Like \expandablevalue, but completely expandable (the \message in the
4633 % definition above operates at the execution level of TeX). Used when
4634 % writing to auxiliary files, due to the expansion that \write does.
4635 % If flag is undefined, pass through an unexpanded @value command: maybe it
4636 % will be set by the time it is read back in.
4637 %
4638 % NB flag names containing - or _ may not work here.
4639 \def\dummyvalue#1{%
4640 \expandafter\ifx\csname SET#1\endcsname\relax
4641 \string\value{#1}%
4642 \else
4643 \csname SET#1\endcsname
4644 \fi
4645 }
4646
4647 % Used for @value's in index entries to form the sort key: expand the @value
4648 % if possible, otherwise sort late.
4649 \def\indexnofontsvalue#1{%
4650 \expandafter\ifx\csname SET#1\endcsname\relax
4651 ZZZZZZZ%
4652 \else
4653 \csname SET#1\endcsname
4654 \fi
4655 }
4656
4657 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4658 % with @set.
4659 %
4660 % To get the special treatment we need for `@end ifset,' we call
4661 % \makecond and then redefine.
4662 %
4663 \makecond{ifset}
4664 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4665 \def\doifset#1#2{%
4666 {%
4667 \makevalueexpandable
4668 \let\next=\empty
4669 \expandafter\ifx\csname SET#2\endcsname\relax
4670 #1% If not set, redefine \next.
4671 \fi
4672 \expandafter
4673 }\next
4674 }
4675 \def\ifsetfail{\doignore{ifset}}
4676
4677 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4678 % defined with @set, or has been undefined with @clear.
4679 %
4680 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4681 % above code: if the variable is not set, do nothing, if it is set,
4682 % then redefine \next to \ifclearfail.
4683 %
4684 \makecond{ifclear}
4685 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4686 \def\ifclearfail{\doignore{ifclear}}
4687
4688 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4689 % without the @) is in fact defined. We can only feasibly check at the
4690 % TeX level, so something like `mathcode' is going to considered
4691 % defined even though it is not a Texinfo command.
4692 %
4693 \makecond{ifcommanddefined}
4694 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4695 %
4696 \def\doifcmddefined#1#2{{%
4697 \makevalueexpandable
4698 \let\next=\empty
4699 \expandafter\ifx\csname #2\endcsname\relax
4700 #1% If not defined, \let\next as above.
4701 \fi
4702 \expandafter
4703 }\next
4704 }
4705 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4706
4707 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4708 \makecond{ifcommandnotdefined}
4709 \def\ifcommandnotdefined{%
4710 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4711 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4712
4713 % Set the `txicommandconditionals' variable, so documents have a way to
4714 % test if the @ifcommand...defined conditionals are available.
4715 \set txicommandconditionals
4716
4717 % @dircategory CATEGORY -- specify a category of the dir file
4718 % which this file should belong to. Ignore this in TeX.
4719 \let\dircategory=\comment
4720
4721 % @defininfoenclose.
4722 \let\definfoenclose=\comment
4723
4724
4725 \message{indexing,}
4726 % Index generation facilities
4727
4728 % Define \newwrite to be identical to plain tex's \newwrite
4729 % except not \outer, so it can be used within macros and \if's.
4730 \edef\newwrite{\makecsname{ptexnewwrite}}
4731
4732 % \newindex {IX} defines an index named IX.
4733 % It automatically defines \IXindex such that
4734 % \IXindex ...rest of line... puts an entry in the index IX.
4735 % It also defines \IXindfile to be the number of the output channel for
4736 % the file that accumulates this index. The file's extension is IX.
4737 %
4738 \def\newindex#1{%
4739 \expandafter\chardef\csname#1indfile\endcsname=0
4740 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4741 \noexpand\doindex{#1}}
4742 }
4743
4744 % @defindex foo == \newindex{foo}
4745 %
4746 \def\defindex{\parsearg\newindex}
4747
4748 % Define @defcodeindex, like @defindex except put all entries in @code.
4749 %
4750 \def\defcodeindex{\parsearg\newcodeindex}
4751 %
4752 \def\newcodeindex#1{%
4753 \expandafter\chardef\csname#1indfile\endcsname=0
4754 \expandafter\xdef\csname#1index\endcsname{%
4755 \noexpand\docodeindex{#1}}%
4756 }
4757
4758 % The default indices:
4759 \newindex{cp}% concepts,
4760 \newcodeindex{fn}% functions,
4761 \newcodeindex{vr}% variables,
4762 \newcodeindex{tp}% types,
4763 \newcodeindex{ky}% keys
4764 \newcodeindex{pg}% and programs.
4765
4766
4767 % @synindex foo bar makes index foo feed into index bar.
4768 % Do this instead of @defindex foo if you don't want it as a separate index.
4769 %
4770 % @syncodeindex foo bar similar, but put all entries made for index foo
4771 % inside @code.
4772 %
4773 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4774 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4775
4776 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4777 % #3 the target index (bar).
4778 \def\dosynindex#1#2#3{%
4779 \requireopenindexfile{#3}%
4780 % redefine \fooindfile:
4781 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4782 \expandafter\let\csname#2indfile\endcsname=\temp
4783 % redefine \fooindex:
4784 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4785 }
4786
4787 % Define \doindex, the driver for all index macros.
4788 % Argument #1 is generated by the calling \fooindex macro,
4789 % and it is the two-letter name of the index.
4790
4791 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4792 \def\doindexxxx #1{\doind{\indexname}{#1}}
4793
4794 % like the previous two, but they put @code around the argument.
4795 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4796 \def\docodeindexxxx #1{\docind{\indexname}{#1}}
4797
4798
4799 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4800 % preventing its expansion. This is used only for control words,
4801 % not control letters, because the \space would be incorrect for
4802 % control characters, but is needed to separate the control word
4803 % from whatever follows.
4804 %
4805 % These can be used both for control words that take an argument and
4806 % those that do not. If it is followed by {arg} in the input, then
4807 % that will dutifully get written to the index (or wherever).
4808 %
4809 % For control letters, we have \definedummyletter, which omits the
4810 % space.
4811 %
4812 \def\definedummyword #1{\def#1{\string#1\space}}%
4813 \def\definedummyletter#1{\def#1{\string#1}}%
4814
4815 % Used for the aux, toc and index files to prevent expansion of Texinfo
4816 % commands. Most of the commands are controlled through the
4817 % \ifdummies conditional.
4818 %
4819 \def\atdummies{%
4820 \dummiestrue
4821 %
4822 \definedummyletter\@%
4823 \definedummyletter\ %
4824 \definedummyletter\{%
4825 \definedummyletter\}%
4826 \definedummyletter\&%
4827 %
4828 \definedummyletter\_%
4829 \definedummyletter\-%
4830 %
4831 \definedummyword\subentry
4832 %
4833 % We want to disable all macros so that they are not expanded by \write.
4834 \let\commondummyword\definedummyword
4835 \macrolist
4836 \let\value\dummyvalue
4837 %
4838 \turnoffactive
4839 }
4840
4841 \newif\ifdummies
4842 \newif\ifindexnofonts
4843
4844 \def\commondummyletter#1{%
4845 \expandafter\let\csname\string#1:impl\endcsname#1%
4846 \edef#1{%
4847 \noexpand\ifindexnofonts
4848 % empty expansion
4849 \noexpand\else
4850 \noexpand\ifdummies\string#1%
4851 \noexpand\else
4852 \noexpand\jumptwofi % dispose of the \fi
4853 \expandafter\noexpand\csname\string#1:impl\endcsname
4854 \noexpand\fi
4855 \noexpand\fi}%
4856 }
4857
4858 \def\commondummyaccent#1{%
4859 \expandafter\let\csname\string#1:impl\endcsname#1%
4860 \edef#1{%
4861 \noexpand\ifindexnofonts
4862 \noexpand\expandafter % dispose of \else ... \fi
4863 \noexpand\asis
4864 \noexpand\else
4865 \noexpand\ifdummies\string#1%
4866 \noexpand\else
4867 \noexpand\jumptwofi % dispose of the \fi
4868 \expandafter\noexpand\csname\string#1:impl\endcsname
4869 \noexpand\fi
4870 \noexpand\fi}%
4871 }
4872
4873 % Like \commondummyaccent but add a \space at the end of the dummy expansion
4874 % #2 is the expansion used for \indexnofonts. #2 is always followed by
4875 % \asis to remove a pair of following braces.
4876 \def\commondummyword#1#2{%
4877 \expandafter\let\csname\string#1:impl\endcsname#1%
4878 \expandafter\def\csname\string#1:ixnf\endcsname{#2\asis}%
4879 \edef#1{%
4880 \noexpand\ifindexnofonts
4881 \noexpand\expandafter % dispose of \else ... \fi
4882 \expandafter\noexpand\csname\string#1:ixnf\endcsname
4883 \noexpand\else
4884 \noexpand\ifdummies\string#1\space
4885 \noexpand\else
4886 \noexpand\jumptwofi % dispose of the \fi \fi
4887 \expandafter\noexpand\csname\string#1:impl\endcsname
4888 \noexpand\fi
4889 \noexpand\fi}%
4890 }
4891 \def\jumptwofi#1\fi\fi{\fi\fi#1}
4892
4893 % For \atdummies and \indexnofonts. \atdummies sets
4894 % \dummiestrue and \indexnofonts sets \indexnofontstrue.
4895 \def\definedummies{
4896 % @-sign is always an escape character when reading auxiliary files
4897 \escapechar = `\@
4898 %
4899 \commondummyletter\!%
4900 \commondummyaccent\"%
4901 \commondummyaccent\'%
4902 \commondummyletter\*%
4903 \commondummyaccent\,%
4904 \commondummyletter\.%
4905 \commondummyletter\/%
4906 \commondummyletter\:%
4907 \commondummyaccent\=%
4908 \commondummyletter\?%
4909 \commondummyaccent\^%
4910 \commondummyaccent\`%
4911 \commondummyaccent\~%
4912 %
4913 % Control letters and accents.
4914 \commondummyword\u {}%
4915 \commondummyword\v {}%
4916 \commondummyword\H {}%
4917 \commondummyword\dotaccent {}%
4918 \commondummyword\ogonek {}%
4919 \commondummyword\ringaccent {}%
4920 \commondummyword\tieaccent {}%
4921 \commondummyword\ubaraccent {}%
4922 \commondummyword\udotaccent {}%
4923 \commondummyword\dotless {}%
4924 %
4925 % Texinfo font commands.
4926 \commondummyword\b {}%
4927 \commondummyword\i {}%
4928 \commondummyword\r {}%
4929 \commondummyword\sansserif {}%
4930 \commondummyword\sc {}%
4931 \commondummyword\slanted {}%
4932 \commondummyword\t {}%
4933 %
4934 % Commands that take arguments.
4935 \commondummyword\abbr {}%
4936 \commondummyword\acronym {}%
4937 \commondummyword\anchor {}%
4938 \commondummyword\cite {}%
4939 \commondummyword\code {}%
4940 \commondummyword\command {}%
4941 \commondummyword\dfn {}%
4942 \commondummyword\dmn {}%
4943 \commondummyword\email {}%
4944 \commondummyword\emph {}%
4945 \commondummyword\env {}%
4946 \commondummyword\file {}%
4947 \commondummyword\image {}%
4948 \commondummyword\indicateurl{}%
4949 \commondummyword\inforef {}%
4950 \commondummyword\kbd {}%
4951 \commondummyword\key {}%
4952 \commondummyword\link {}%
4953 \commondummyword\math {}%
4954 \commondummyword\option {}%
4955 \commondummyword\pxref {}%
4956 \commondummyword\ref {}%
4957 \commondummyword\samp {}%
4958 \commondummyword\strong {}%
4959 \commondummyword\tie {}%
4960 \commondummyword\U {}%
4961 \commondummyword\uref {}%
4962 \commondummyword\url {}%
4963 \commondummyword\var {}%
4964 \commondummyword\verb {}%
4965 \commondummyword\w {}%
4966 \commondummyword\xref {}%
4967 %
4968 \commondummyword\AA {AA}%
4969 \commondummyword\AE {AE}%
4970 \commondummyword\DH {DZZ}%
4971 \commondummyword\L {L}%
4972 \commondummyword\O {O}%
4973 \commondummyword\OE {OE}%
4974 \commondummyword\TH {TH}%
4975 \commondummyword\aa {aa}%
4976 \commondummyword\ae {ae}%
4977 \commondummyword\dh {dzz}%
4978 \commondummyword\exclamdown {!}%
4979 \commondummyword\l {l}%
4980 \commondummyword\o {o}%
4981 \commondummyword\oe {oe}%
4982 \commondummyword\ordf {a}%
4983 \commondummyword\ordm {o}%
4984 \commondummyword\questiondown {?}%
4985 \commondummyword\ss {ss}%
4986 \commondummyword\th {th}%
4987 %
4988 \commondummyword\LaTeX {LaTeX}%
4989 \commondummyword\TeX {TeX}%
4990 %
4991 % Assorted special characters.
4992 \commondummyword\ampchar {\normalamp}%
4993 \commondummyword\atchar {\@}%
4994 \commondummyword\arrow {->}%
4995 \commondummyword\backslashchar {\realbackslash}%
4996 \commondummyword\bullet {bullet}%
4997 \commondummyword\comma {,}%
4998 \commondummyword\copyright {copyright}%
4999 \commondummyword\dots {...}%
5000 \commondummyword\enddots {...}%
5001 \commondummyword\entrybreak {}%
5002 \commondummyword\equiv {===}%
5003 \commondummyword\error {error}%
5004 \commondummyword\euro {euro}%
5005 \commondummyword\expansion {==>}%
5006 \commondummyword\geq {>=}%
5007 \commondummyword\guillemetleft {<<}%
5008 \commondummyword\guillemetright {>>}%
5009 \commondummyword\guilsinglleft {<}%
5010 \commondummyword\guilsinglright {>}%
5011 \commondummyword\lbracechar {\{}%
5012 \commondummyword\leq {<=}%
5013 \commondummyword\mathopsup {sup}%
5014 \commondummyword\minus {-}%
5015 \commondummyword\pounds {pounds}%
5016 \commondummyword\point {.}%
5017 \commondummyword\print {-|}%
5018 \commondummyword\quotedblbase {"}%
5019 \commondummyword\quotedblleft {"}%
5020 \commondummyword\quotedblright {"}%
5021 \commondummyword\quoteleft {`}%
5022 \commondummyword\quoteright {'}%
5023 \commondummyword\quotesinglbase {,}%
5024 \commondummyword\rbracechar {\}}%
5025 \commondummyword\registeredsymbol {R}%
5026 \commondummyword\result {=>}%
5027 \commondummyword\sub {}%
5028 \commondummyword\sup {}%
5029 \commondummyword\textdegree {o}%
5030 }
5031
5032 \let\indexlbrace\relax
5033 \let\indexrbrace\relax
5034 \let\indexatchar\relax
5035 \let\indexbackslash\relax
5036
5037 {\catcode`\@=0
5038 \catcode`\\=13
5039 @gdef@backslashdisappear{@def\{}}
5040 }
5041
5042 {
5043 \catcode`\<=13
5044 \catcode`\-=13
5045 \catcode`\`=13
5046 \gdef\indexnonalnumdisappear{%
5047 \ifflagclear{txiindexlquoteignore}{}{%
5048 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5049 % (Introduced for FSFS 2nd ed.)
5050 \let`=\empty
5051 }%
5052 %
5053 \ifflagclear{txiindexbackslashignore}{}{%
5054 \backslashdisappear
5055 }%
5056 \ifflagclear{txiindexhyphenignore}{}{%
5057 \def-{}%
5058 }%
5059 \ifflagclear{txiindexlessthanignore}{}{%
5060 \def<{}%
5061 }%
5062 \ifflagclear{txiindexatsignignore}{}{%
5063 \def\@{}%
5064 }%
5065 }
5066
5067 \gdef\indexnonalnumreappear{%
5068 \let-\normaldash
5069 \let<\normalless
5070 }
5071 }
5072
5073
5074 % \indexnofonts is used when outputting the strings to sort the index
5075 % by, and when constructing control sequence names. It eliminates all
5076 % control sequences and just writes whatever the best ASCII sort string
5077 % would be for a given command (usually its argument).
5078 %
5079 \def\indexnofonts{%
5080 \indexnofontstrue
5081 %
5082 \def\ { }%
5083 \def\@{@}%
5084 \def\_{\normalunderscore}%
5085 \def\-{}% @- shouldn't affect sorting
5086 %
5087 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5088 \uccode`\1=`\} \uppercase{\def\}{1}}%
5089 \let\lbracechar\{%
5090 \let\rbracechar\}%
5091 %
5092 %
5093 % We need to get rid of all macros, leaving only the arguments (if present).
5094 % Of course this is not nearly correct, but it is the best we can do for now.
5095 %
5096 % Since macro invocations are followed by braces, we can just redefine them
5097 % to take a single TeX argument. The case of a macro invocation that
5098 % goes to end-of-line is not handled.
5099 %
5100 \def\commondummyword##1{\let##1\asis}%
5101 \macrolist
5102 \let\value\indexnofontsvalue
5103 }
5104
5105
5106
5107
5108 % #1 is the index name, #2 is the entry text.
5109 \def\doind#1#2{%
5110 \iflinks
5111 {%
5112 %
5113 \requireopenindexfile{#1}%
5114 \edef\writeto{\csname#1indfile\endcsname}%
5115 %
5116 \def\indextext{#2}%
5117 \safewhatsit\doindwrite
5118 }%
5119 \fi
5120 }
5121
5122 % Same as \doind, but for code indices
5123 \def\docind#1#2{%
5124 \iflinks
5125 {%
5126 %
5127 \requireopenindexfile{#1}%
5128 \edef\writeto{\csname#1indfile\endcsname}%
5129 %
5130 \def\indextext{#2}%
5131 \safewhatsit\docindwrite
5132 }%
5133 \fi
5134 }
5135
5136 % Check if an index file has been opened, and if not, open it.
5137 \def\requireopenindexfile#1{%
5138 \ifnum\csname #1indfile\endcsname=0
5139 \expandafter\newwrite \csname#1indfile\endcsname
5140 \edef\suffix{#1}%
5141 % A .fls suffix would conflict with the file extension for the output
5142 % of -recorder, so use .f1s instead.
5143 \ifx\suffix\indexisfl\def\suffix{f1}\fi
5144 % Open the file
5145 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5146 % Using \immediate above here prevents an object entering into the current
5147 % box, which could confound checks such as those in \safewhatsit for
5148 % preceding skips.
5149 \typeout{Writing index file \jobname.\suffix}%
5150 \fi}
5151 \def\indexisfl{fl}
5152
5153 % Definition for writing index entry sort key.
5154 {
5155 \catcode`\-=13
5156 \gdef\indexwritesortas{%
5157 \begingroup
5158 \indexnonalnumreappear
5159 \indexwritesortasxxx}
5160 \gdef\indexwritesortasxxx#1{%
5161 \xdef\indexsortkey{#1}\endgroup}
5162 }
5163
5164 \def\indexwriteseealso#1{
5165 \gdef\pagenumbertext{\string\seealso{#1}}%
5166 }
5167 \def\indexwriteseeentry#1{
5168 \gdef\pagenumbertext{\string\seeentry{#1}}%
5169 }
5170
5171 % The default definitions
5172 \def\sortas#1{}%
5173 \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
5174 \def\putwordSeeAlso{See also}
5175 \def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
5176
5177
5178 % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
5179 % * Set \bracedtext to "{aaa}{bbb}"
5180 % * Set \fullindexsortkey to "aaa @subentry ZZZ"
5181 % * If @seealso occurs, set \pagenumbertext
5182 %
5183 \def\splitindexentry#1{%
5184 \gdef\fullindexsortkey{}%
5185 \xdef\bracedtext{}%
5186 \def\sep{}%
5187 \def\seealso##1{}%
5188 \def\seeentry##1{}%
5189 \expandafter\doindexsegment#1\subentry\finish\subentry
5190 }
5191
5192 % append the results from the next segment
5193 \def\doindexsegment#1\subentry{%
5194 \def\segment{#1}%
5195 \ifx\segment\isfinish
5196 \else
5197 %
5198 % Fully expand the segment, throwing away any @sortas directives, and
5199 % trim spaces.
5200 \edef\trimmed{\segment}%
5201 \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5202 \ifincodeindex
5203 \edef\trimmed{\noexpand\code{\trimmed}}%
5204 \fi
5205 %
5206 \xdef\bracedtext{\bracedtext{\trimmed}}%
5207 %
5208 % Get the string to sort by. Process the segment with all
5209 % font commands turned off.
5210 \bgroup
5211 \let\sortas\indexwritesortas
5212 \let\seealso\indexwriteseealso
5213 \let\seeentry\indexwriteseeentry
5214 \indexnofonts
5215 % The braces around the commands are recognized by texindex.
5216 \def\lbracechar{{\string\indexlbrace}}%
5217 \def\rbracechar{{\string\indexrbrace}}%
5218 \let\{=\lbracechar
5219 \let\}=\rbracechar
5220 \def\@{{\string\indexatchar}}%
5221 \def\atchar##1{\@}%
5222 \def\backslashchar{{\string\indexbackslash}}%
5223 \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
5224 %
5225 \let\indexsortkey\empty
5226 \global\let\pagenumbertext\empty
5227 % Execute the segment and throw away the typeset output. This executes
5228 % any @sortas or @seealso commands in this segment.
5229 \setbox\dummybox = \hbox{\segment}%
5230 \ifx\indexsortkey\empty{%
5231 \indexnonalnumdisappear
5232 \xdef\trimmed{\segment}%
5233 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5234 \xdef\indexsortkey{\trimmed}%
5235 \ifx\indexsortkey\empty
5236 \message{Empty index sort key near line \the\inputlineno}%
5237 \xdef\indexsortkey{ }%
5238 \fi
5239 }\fi
5240 %
5241 % Append to \fullindexsortkey.
5242 \edef\tmp{\gdef\noexpand\fullindexsortkey{%
5243 \fullindexsortkey\sep\indexsortkey}}%
5244 \tmp
5245 \egroup
5246 \def\sep{\subentry}%
5247 %
5248 \expandafter\doindexsegment
5249 \fi
5250 }
5251 \def\isfinish{\finish}%
5252 \newbox\dummybox % used above
5253
5254 \let\subentry\relax
5255
5256 % Use \ instead of @ in index files. To support old texi2dvi and texindex.
5257 % This works without changing the escape character used in the toc or aux
5258 % files because the index entries are fully expanded here, and \string uses
5259 % the current value of \escapechar.
5260 \def\escapeisbackslash{\escapechar=`\\}
5261
5262 % Use \ in index files by default. texi2dvi didn't support @ as the escape
5263 % character (as it checked for "\entry" in the files, and not "@entry"). When
5264 % the new version of texi2dvi has had a chance to become more prevalent, then
5265 % the escape character can change back to @ again. This should be an easy
5266 % change to make now because both @ and \ are only used as escape characters in
5267 % index files, never standing for themselves.
5268 %
5269 \set txiindexescapeisbackslash
5270
5271 % Write the entry in \indextext to the index file.
5272 %
5273
5274 \newif\ifincodeindex
5275 \def\doindwrite{\incodeindexfalse\doindwritex}
5276 \def\docindwrite{\incodeindextrue\doindwritex}
5277
5278 \def\doindwritex{%
5279 \maybemarginindex
5280 %
5281 \atdummies
5282 %
5283 \ifflagclear{txiindexescapeisbackslash}{}{\escapeisbackslash}%
5284 %
5285 % For texindex which always views { and } as separators.
5286 \def\{{\lbracechar{}}%
5287 \def\}{\rbracechar{}}%
5288 \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
5289 %
5290 % Split the entry into primary entry and any subentries, and get the index
5291 % sort key.
5292 \splitindexentry\indextext
5293 %
5294 % Set up the complete index entry, with both the sort key and
5295 % the original text, including any font commands. We write
5296 % three arguments to \entry to the .?? file (four in the
5297 % subentry case), texindex reduces to two when writing the .??s
5298 % sorted result.
5299 %
5300 \edef\temp{%
5301 \write\writeto{%
5302 \string\entry{\fullindexsortkey}%
5303 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
5304 \bracedtext}%
5305 }%
5306 \temp
5307 }
5308
5309 % Put the index entry in the margin if desired (undocumented).
5310 \def\maybemarginindex{%
5311 \ifx\SETmarginindex\relax\else
5312 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
5313 \fi
5314 }
5315 \let\SETmarginindex=\relax
5316
5317
5318 % Take care of unwanted page breaks/skips around a whatsit:
5319 %
5320 % If a skip is the last thing on the list now, preserve it
5321 % by backing up by \lastskip, doing the \write, then inserting
5322 % the skip again. Otherwise, the whatsit generated by the
5323 % \write or \pdfdest will make \lastskip zero. The result is that
5324 % sequences like this:
5325 % @end defun
5326 % @tindex whatever
5327 % @defun ...
5328 % will have extra space inserted, because the \medbreak in the
5329 % start of the @defun won't see the skip inserted by the @end of
5330 % the previous defun.
5331 %
5332 % But don't do any of this if we're not in vertical mode. We
5333 % don't want to do a \vskip and prematurely end a paragraph.
5334 %
5335 % Avoid page breaks due to these extra skips, too.
5336 %
5337 % But wait, there is a catch there:
5338 % We'll have to check whether \lastskip is zero skip. \ifdim is not
5339 % sufficient for this purpose, as it ignores stretch and shrink parts
5340 % of the skip. The only way seems to be to check the textual
5341 % representation of the skip.
5342 %
5343 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5344 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5345 %
5346 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5347 %
5348 \newskip\whatsitskip
5349 \newcount\whatsitpenalty
5350 %
5351 % ..., ready, GO:
5352 %
5353 \def\safewhatsit#1{\ifhmode
5354 #1%
5355 \else
5356 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5357 \whatsitskip = \lastskip
5358 \edef\lastskipmacro{\the\lastskip}%
5359 \whatsitpenalty = \lastpenalty
5360 %
5361 % If \lastskip is nonzero, that means the last item was a
5362 % skip. And since a skip is discardable, that means this
5363 % -\whatsitskip glue we're inserting is preceded by a
5364 % non-discardable item, therefore it is not a potential
5365 % breakpoint, therefore no \nobreak needed.
5366 \ifx\lastskipmacro\zeroskipmacro
5367 \else
5368 \vskip-\whatsitskip
5369 \fi
5370 %
5371 #1%
5372 %
5373 \ifx\lastskipmacro\zeroskipmacro
5374 % If \lastskip was zero, perhaps the last item was a penalty, and
5375 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5376 % to re-insert the same penalty (values >10000 are used for various
5377 % signals); since we just inserted a non-discardable item, any
5378 % following glue (such as a \parskip) would be a breakpoint. For example:
5379 % @deffn deffn-whatever
5380 % @vindex index-whatever
5381 % Description.
5382 % would allow a break between the index-whatever whatsit
5383 % and the "Description." paragraph.
5384 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5385 \else
5386 % On the other hand, if we had a nonzero \lastskip,
5387 % this make-up glue would be preceded by a non-discardable item
5388 % (the whatsit from the \write), so we must insert a \nobreak.
5389 \nobreak\vskip\whatsitskip
5390 \fi
5391 \fi}
5392
5393 % The index entry written in the file actually looks like
5394 % \entry {sortstring}{page}{topic}
5395 % or
5396 % \entry {sortstring}{page}{topic}{subtopic}
5397 % The texindex program reads in these files and writes files
5398 % containing these kinds of lines:
5399 % \initial {c}
5400 % before the first topic whose initial is c
5401 % \entry {topic}{pagelist}
5402 % for a topic that is used without subtopics
5403 % \primary {topic}
5404 % \entry {topic}{}
5405 % for the beginning of a topic that is used with subtopics
5406 % \secondary {subtopic}{pagelist}
5407 % for each subtopic.
5408 % \secondary {subtopic}{}
5409 % for a subtopic with sub-subtopics
5410 % \tertiary {subtopic}{subsubtopic}{pagelist}
5411 % for each sub-subtopic.
5412
5413 % Define the user-accessible indexing commands
5414 % @findex, @vindex, @kindex, @cindex.
5415
5416 \def\findex {\fnindex}
5417 \def\kindex {\kyindex}
5418 \def\cindex {\cpindex}
5419 \def\vindex {\vrindex}
5420 \def\tindex {\tpindex}
5421 \def\pindex {\pgindex}
5422
5423 % Define the macros used in formatting output of the sorted index material.
5424
5425 % @printindex causes a particular index (the ??s file) to get printed.
5426 % It does not print any chapter heading (usually an @unnumbered).
5427 %
5428 \parseargdef\printindex{\begingroup
5429 \dobreak \chapheadingskip{10000}%
5430 %
5431 \smallfonts \rm
5432 \tolerance = 9500
5433 \plainfrenchspacing
5434 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5435 %
5436 % See comment in \requireopenindexfile.
5437 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5438 %
5439 % See if the index file exists and is nonempty.
5440 \openin 1 \jobname.\indexname s
5441 \ifeof 1
5442 % \enddoublecolumns gets confused if there is no text in the index,
5443 % and it loses the chapter title and the aux file entries for the
5444 % index. The easiest way to prevent this problem is to make sure
5445 % there is some text.
5446 \putwordIndexNonexistent
5447 \typeout{No file \jobname.\indexname s.}%
5448 \else
5449 % If the index file exists but is empty, then \openin leaves \ifeof
5450 % false. We have to make TeX try to read something from the file, so
5451 % it can discover if there is anything in it.
5452 \read 1 to \thisline
5453 \ifeof 1
5454 \putwordIndexIsEmpty
5455 \else
5456 \expandafter\printindexzz\thisline\relax\relax\finish%
5457 \fi
5458 \fi
5459 \closein 1
5460 \endgroup}
5461
5462 % If the index file starts with a backslash, forgo reading the index
5463 % file altogether. If somebody upgrades texinfo.tex they may still have
5464 % old index files using \ as the escape character. Reading this would
5465 % at best lead to typesetting garbage, at worst a TeX syntax error.
5466 \def\printindexzz#1#2\finish{%
5467 \ifflagclear{txiindexescapeisbackslash}{%
5468 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
5469 \ifflagclear{txiskipindexfileswithbackslash}{%
5470 \errmessage{%
5471 ERROR: A sorted index file in an obsolete format was skipped.
5472 To fix this problem, please upgrade your version of 'texi2dvi'
5473 or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
5474 If you are using an old version of 'texindex' (part of the Texinfo
5475 distribution), you may also need to upgrade to a newer version (at least 6.0).
5476 You may be able to typeset the index if you run
5477 'texindex \jobname.\indexname' yourself.
5478 You could also try setting the 'txiindexescapeisbackslash' flag by
5479 running a command like
5480 'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do
5481 this, Texinfo will try to use index files in the old format.
5482 If you continue to have problems, deleting the index files and starting again
5483 might help (with 'rm \jobname.?? \jobname.??s')%
5484 }%
5485 }{%
5486 (Skipped sorted index file in obsolete format)
5487 }%
5488 \else
5489 \begindoublecolumns
5490 \input \jobname.\indexname s
5491 \enddoublecolumns
5492 \fi
5493 }{%
5494 \begindoublecolumns
5495 \catcode`\\=0\relax
5496 %
5497 % Make @ an escape character to give macros a chance to work. This
5498 % should work because we (hopefully) don't otherwise use @ in index files.
5499 %\catcode`\@=12\relax
5500 \catcode`\@=0\relax
5501 \input \jobname.\indexname s
5502 \enddoublecolumns
5503 }%
5504 }
5505
5506 % These macros are used by the sorted index file itself.
5507 % Change them to control the appearance of the index.
5508
5509 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5510 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5511 \catcode`\$=3
5512 \gdef\initialglyphs{%
5513 % special control sequences used in the index sort key
5514 \let\indexlbrace\{%
5515 \let\indexrbrace\}%
5516 \let\indexatchar\@%
5517 \def\indexbackslash{\math{\backslash}}%
5518 %
5519 % Some changes for non-alphabetic characters. Using the glyphs from the
5520 % math fonts looks more consistent than the typewriter font used elsewhere
5521 % for these characters.
5522 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
5523 %
5524 % In case @\ is used for backslash
5525 \uppercase{\let\\=~}
5526 % Can't get bold backslash so don't use bold forward slash
5527 \catcode`\/=13
5528 \def/{{\secrmnotbold \normalslash}}%
5529 \def-{{\normaldash\normaldash}}% en dash `--'
5530 \def^{{\chapbf \normalcaret}}%
5531 \def~{{\chapbf \normaltilde}}%
5532 \def\_{%
5533 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5534 \def|{$\vert$}%
5535 \def<{$\less$}%
5536 \def>{$\gtr$}%
5537 \def+{$\normalplus$}%
5538 }}
5539
5540 \def\initial{%
5541 \bgroup
5542 \initialglyphs
5543 \initialx
5544 }
5545
5546 \def\initialx#1{%
5547 % Remove any glue we may have, we'll be inserting our own.
5548 \removelastskip
5549 %
5550 % We like breaks before the index initials, so insert a bonus.
5551 % The glue before the bonus allows a little bit of space at the
5552 % bottom of a column to reduce an increase in inter-line spacing.
5553 \nobreak
5554 \vskip 0pt plus 5\baselineskip
5555 \penalty -300
5556 \vskip 0pt plus -5\baselineskip
5557 %
5558 % Typeset the initial. Making this add up to a whole number of
5559 % baselineskips increases the chance of the dots lining up from column
5560 % to column. It still won't often be perfect, because of the stretch
5561 % we need before each entry, but it's better.
5562 %
5563 % No shrink because it confuses \balancecolumns.
5564 \vskip 1.67\baselineskip plus 1\baselineskip
5565 \leftline{\secfonts \kern-0.05em \secbf #1}%
5566 % \secfonts is inside the argument of \leftline so that the change of
5567 % \baselineskip will not affect any glue inserted before the vbox that
5568 % \leftline creates.
5569 % Do our best not to break after the initial.
5570 \nobreak
5571 \vskip .33\baselineskip plus .1\baselineskip
5572 \egroup % \initialglyphs
5573 }
5574
5575 \newdimen\entryrightmargin
5576 \entryrightmargin=0pt
5577
5578 % for PDF output, whether to make the text of the entry a link to the page
5579 % number. set for @contents and @shortcontents where there is only one
5580 % page number.
5581 \newif\iflinkentrytext
5582
5583 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5584 % then page number (#2) flushed to the right margin. It is used for index
5585 % and table of contents entries. The paragraph is indented by \leftskip.
5586 %
5587 \def\entry{%
5588 \begingroup
5589 %
5590 % Start a new paragraph if necessary, so our assignments below can't
5591 % affect previous text.
5592 \par
5593 %
5594 % No extra space above this paragraph.
5595 \parskip = 0in
5596 %
5597 % When reading the text of entry, convert explicit line breaks
5598 % from @* into spaces. The user might give these in long section
5599 % titles, for instance.
5600 \def\*{\unskip\space\ignorespaces}%
5601 \def\entrybreak{\hfil\break}% An undocumented command
5602 %
5603 % Swallow the left brace of the text (first parameter):
5604 \afterassignment\doentry
5605 \let\temp =
5606 }
5607 \def\entrybreak{\unskip\space\ignorespaces}%
5608 \def\doentry{%
5609 % Save the text of the entry in \boxA
5610 \global\setbox\boxA=\hbox\bgroup
5611 \bgroup % Instead of the swallowed brace.
5612 \noindent
5613 \aftergroup\finishentry
5614 % And now comes the text of the entry.
5615 % Not absorbing as a macro argument reduces the chance of problems
5616 % with catcodes occurring.
5617 }
5618 {\catcode`\@=11
5619 % #1 is the page number
5620 \gdef\finishentry#1{%
5621 \egroup % end \boxA
5622 \dimen@ = \wd\boxA % Length of text of entry
5623 % add any leaders and page number to \boxA.
5624 \global\setbox\boxA=\hbox\bgroup
5625 \ifpdforxetex
5626 \iflinkentrytext
5627 \pdflinkpage{#1}{\unhbox\boxA}%
5628 \else
5629 \unhbox\boxA
5630 \fi
5631 \else
5632 \unhbox\boxA
5633 \fi
5634 %
5635 % Get the width of the page numbers, and only use
5636 % leaders if they are present.
5637 \global\setbox\boxB = \hbox{#1}%
5638 \ifdim\wd\boxB = 0pt
5639 \null\nobreak\hfill\ %
5640 \else
5641 %
5642 \null\nobreak\indexdotfill % Have leaders before the page number.
5643 %
5644 \ifpdforxetex
5645 \pdfgettoks#1.%
5646 \hskip\skip\thinshrinkable\the\toksA
5647 \else
5648 \hskip\skip\thinshrinkable #1%
5649 \fi
5650 \fi
5651 \egroup % end \boxA
5652 %
5653 % now output
5654 \ifdim\wd\boxB = 0pt
5655 \noindent\unhbox\boxA\par
5656 \nobreak
5657 \else\bgroup
5658 % We want the text of the entries to be aligned to the left, and the
5659 % page numbers to be aligned to the right.
5660 %
5661 \parindent = 0pt
5662 \advance\leftskip by 0pt plus 1fil
5663 \advance\leftskip by 0pt plus -1fill
5664 \rightskip = 0pt plus -1fil
5665 \advance\rightskip by 0pt plus 1fill
5666 % Cause last line, which could consist of page numbers on their own
5667 % if the list of page numbers is long, to be aligned to the right.
5668 \parfillskip=0pt plus -1fill
5669 %
5670 \advance\rightskip by \entryrightmargin
5671 % Determine how far we can stretch into the margin.
5672 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5673 % fit on one line in @letterpaper format.
5674 \ifdim\entryrightmargin>2.1em
5675 \dimen@i=2.1em
5676 \else
5677 \dimen@i=0em
5678 \fi
5679 \advance \parfillskip by 0pt minus 1\dimen@i
5680 %
5681 \dimen@ii = \hsize
5682 \advance\dimen@ii by -1\leftskip
5683 \advance\dimen@ii by -1\entryrightmargin
5684 \advance\dimen@ii by 1\dimen@i
5685 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5686 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5687 % Try to split the text roughly evenly. \dimen@ will be the length of
5688 % the first line.
5689 \dimen@ = 0.7\dimen@
5690 \dimen@ii = \hsize
5691 \ifnum\dimen@>\dimen@ii
5692 % If the entry is too long (for example, if it needs more than
5693 % two lines), use all the space in the first line.
5694 \dimen@ = \dimen@ii
5695 \fi
5696 \advance\leftskip by 0pt plus 1fill % ragged right
5697 \advance \dimen@ by 1\rightskip
5698 \parshape = 2 0pt \dimen@ 0em \dimen@ii
5699 % Ideally we'd add a finite glue at the end of the first line only,
5700 % instead of using \parshape with explicit line lengths, but TeX
5701 % doesn't seem to provide a way to do such a thing.
5702 %
5703 % Indent all lines but the first one.
5704 \advance\leftskip by 1em
5705 \advance\parindent by -1em
5706 \fi\fi
5707 \indent % start paragraph
5708 \unhbox\boxA
5709 %
5710 % Do not prefer a separate line ending with a hyphen to fewer lines.
5711 \finalhyphendemerits = 0
5712 %
5713 % Word spacing - no stretch
5714 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5715 %
5716 \linepenalty=1000 % Discourage line breaks.
5717 \hyphenpenalty=5000 % Discourage hyphenation.
5718 %
5719 \par % format the paragraph
5720 \egroup % The \vbox
5721 \fi
5722 \endgroup
5723 }}
5724
5725 \newskip\thinshrinkable
5726 \skip\thinshrinkable=.15em minus .15em
5727
5728 % Like plain.tex's \dotfill, except uses up at least 1 em.
5729 % The filll stretch here overpowers both the fil and fill stretch to push
5730 % the page number to the right.
5731 \def\indexdotfill{\cleaders
5732 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5733
5734
5735 \def\primary #1{\line{#1\hfil}}
5736
5737 \def\secondary{\indententry{0.5cm}}
5738 \def\tertiary{\indententry{1cm}}
5739
5740 \def\indententry#1#2#3{%
5741 \bgroup
5742 \leftskip=#1
5743 \entry{#2}{#3}%
5744 \egroup
5745 }
5746
5747 % Define two-column mode, which we use to typeset indexes.
5748 % Adapted from the TeXbook, page 416, which is to say,
5749 % the manmac.tex format used to print the TeXbook itself.
5750 \catcode`\@=11 % private names
5751
5752 \newbox\partialpage
5753 \newdimen\doublecolumnhsize
5754
5755 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5756 % If not much space left on page, start a new page.
5757 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5758 %
5759 % Grab any single-column material above us.
5760 \output = {%
5761 \savetopmark
5762 %
5763 \global\setbox\partialpage = \vbox{%
5764 % Unvbox the main output page.
5765 \unvbox\PAGE
5766 \kern-\topskip \kern\baselineskip
5767 }%
5768 }%
5769 \eject % run that output routine to set \partialpage
5770 %
5771 % Use the double-column output routine for subsequent pages.
5772 \output = {\doublecolumnout}%
5773 %
5774 % Change the page size parameters. We could do this once outside this
5775 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5776 % format, but then we repeat the same computation. Repeating a couple
5777 % of assignments once per index is clearly meaningless for the
5778 % execution time, so we may as well do it in one place.
5779 %
5780 % First we halve the line length, less a little for the gutter between
5781 % the columns. We compute the gutter based on the line length, so it
5782 % changes automatically with the paper format. The magic constant
5783 % below is chosen so that the gutter has the same value (well, +-<1pt)
5784 % as it did when we hard-coded it.
5785 %
5786 % We put the result in a separate register, \doublecolumnhsize, so we
5787 % can restore it in \pagesofar, after \hsize itself has (potentially)
5788 % been clobbered.
5789 %
5790 \doublecolumnhsize = \hsize
5791 \advance\doublecolumnhsize by -.04154\hsize
5792 \divide\doublecolumnhsize by 2
5793 \hsize = \doublecolumnhsize
5794 %
5795 % Get the available space for the double columns -- the normal
5796 % (undoubled) page height minus any material left over from the
5797 % previous page.
5798 \advance\vsize by -\ht\partialpage
5799 \vsize = 2\vsize
5800 %
5801 % For the benefit of balancing columns
5802 \advance\baselineskip by 0pt plus 0.5pt
5803 }
5804
5805 % The double-column output routine for all double-column pages except
5806 % the last, which is done by \balancecolumns.
5807 %
5808 \def\doublecolumnout{%
5809 %
5810 \savetopmark
5811 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5812 \dimen@ = \vsize
5813 \divide\dimen@ by 2
5814 %
5815 % box0 will be the left-hand column, box2 the right.
5816 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
5817 \global\advance\vsize by 2\ht\partialpage
5818 \onepageout\pagesofar % empty except for the first time we are called
5819 \unvbox\PAGE
5820 \penalty\outputpenalty
5821 }
5822 %
5823 % Re-output the contents of the output page -- any previous material,
5824 % followed by the two boxes we just split, in box0 and box2.
5825 \def\pagesofar{%
5826 \unvbox\partialpage
5827 %
5828 \hsize = \doublecolumnhsize
5829 \wd0=\hsize \wd2=\hsize
5830 \hbox to\txipagewidth{\box0\hfil\box2}%
5831 }
5832
5833
5834 % Finished with double columns.
5835 \def\enddoublecolumns{%
5836 % The following penalty ensures that the page builder is exercised
5837 % _before_ we change the output routine. This is necessary in the
5838 % following situation:
5839 %
5840 % The last section of the index consists only of a single entry.
5841 % Before this section, \pagetotal is less than \pagegoal, so no
5842 % break occurs before the last section starts. However, the last
5843 % section, consisting of \initial and the single \entry, does not
5844 % fit on the page and has to be broken off. Without the following
5845 % penalty the page builder will not be exercised until \eject
5846 % below, and by that time we'll already have changed the output
5847 % routine to the \balancecolumns version, so the next-to-last
5848 % double-column page will be processed with \balancecolumns, which
5849 % is wrong: The two columns will go to the main vertical list, with
5850 % the broken-off section in the recent contributions. As soon as
5851 % the output routine finishes, TeX starts reconsidering the page
5852 % break. The two columns and the broken-off section both fit on the
5853 % page, because the two columns now take up only half of the page
5854 % goal. When TeX sees \eject from below which follows the final
5855 % section, it invokes the new output routine that we've set after
5856 % \balancecolumns below; \onepageout will try to fit the two columns
5857 % and the final section into the vbox of \txipageheight (see
5858 % \pagebody), causing an overfull box.
5859 %
5860 % Note that glue won't work here, because glue does not exercise the
5861 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5862 \penalty0
5863 %
5864 \output = {%
5865 % Split the last of the double-column material.
5866 \savetopmark
5867 \balancecolumns
5868 }%
5869 \eject % call the \output just set
5870 \ifdim\pagetotal=0pt
5871 % Having called \balancecolumns once, we do not
5872 % want to call it again. Therefore, reset \output to its normal
5873 % definition right away.
5874 \global\output=\expandafter{\the\defaultoutput}
5875 %
5876 \endgroup % started in \begindoublecolumns
5877 % Leave the double-column material on the current page, no automatic
5878 % page break.
5879 \box\balancedcolumns
5880 %
5881 % \pagegoal was set to the doubled \vsize above, since we restarted
5882 % the current page. We're now back to normal single-column
5883 % typesetting, so reset \pagegoal to the normal \vsize.
5884 \global\vsize = \txipageheight %
5885 \pagegoal = \txipageheight %
5886 \else
5887 % We had some left-over material. This might happen when \doublecolumnout
5888 % is called in \balancecolumns. Try again.
5889 \expandafter\enddoublecolumns
5890 \fi
5891 }
5892 \newbox\balancedcolumns
5893 \setbox\balancedcolumns=\vbox{shouldnt see this}%
5894 %
5895 % Only called for the last of the double column material. \doublecolumnout
5896 % does the others.
5897 \def\balancecolumns{%
5898 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
5899 \dimen@ = \ht0
5900 \ifdim\dimen@<7\baselineskip
5901 % Don't split a short final column in two.
5902 \setbox2=\vbox{}%
5903 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5904 \else
5905 % double the leading vertical space
5906 \advance\dimen@ by \topskip
5907 \advance\dimen@ by-\baselineskip
5908 \divide\dimen@ by 2 % target to split to
5909 \dimen@ii = \dimen@
5910 \splittopskip = \topskip
5911 % Loop until left column is at least as high as the right column.
5912 {%
5913 \vbadness = 10000
5914 \loop
5915 \global\setbox3 = \copy0
5916 \global\setbox1 = \vsplit3 to \dimen@
5917 \ifdim\ht1<\ht3
5918 \global\advance\dimen@ by 1pt
5919 \repeat
5920 }%
5921 % Now the left column is in box 1, and the right column in box 3.
5922 %
5923 % Check whether the left column has come out higher than the page itself.
5924 % (Note that we have doubled \vsize for the double columns, so
5925 % the actual height of the page is 0.5\vsize).
5926 \ifdim2\ht1>\vsize
5927 % It appears that we have been called upon to balance too much material.
5928 % Output some of it with \doublecolumnout, leaving the rest on the page.
5929 \setbox\PAGE=\box0
5930 \doublecolumnout
5931 \else
5932 % Compare the heights of the two columns.
5933 \ifdim4\ht1>5\ht3
5934 % Column heights are too different, so don't make their bottoms
5935 % flush with each other.
5936 \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
5937 \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
5938 \else
5939 % Make column bottoms flush with each other.
5940 \setbox2=\vbox to\ht1{\unvbox3\unskip}%
5941 \setbox0=\vbox to\ht1{\unvbox1\unskip}%
5942 \fi
5943 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5944 \fi
5945 \fi
5946 %
5947 }
5948 \catcode`\@ = \other
5949
5950
5951 \message{sectioning,}
5952 % Chapters, sections, etc.
5953
5954 % Let's start with @part.
5955 \parseargdef\part{\partzzz{#1}}
5956 \def\partzzz#1{%
5957 \chapoddpage
5958 \null
5959 \vskip.3\vsize % move it down on the page a bit
5960 \begingroup
5961 \noindent \titlefonts\rm #1\par % the text
5962 \let\lastnode=\empty % no node to associate with
5963 \writetocentry{part}{#1}{}% but put it in the toc
5964 \headingsoff % no headline or footline on the part page
5965 % This outputs a mark at the end of the page that clears \thischapter
5966 % and \thissection, as is done in \startcontents.
5967 \let\pchapsepmacro\relax
5968 \chapmacro{}{Yomitfromtoc}{}%
5969 \chapoddpage
5970 \endgroup
5971 }
5972
5973 % \unnumberedno is an oxymoron. But we count the unnumbered
5974 % sections so that we can refer to them unambiguously in the pdf
5975 % outlines by their "section number". We avoid collisions with chapter
5976 % numbers by starting them at 10000. (If a document ever has 10000
5977 % chapters, we're in trouble anyway, I'm sure.)
5978 \newcount\unnumberedno \unnumberedno = 10000
5979 \newcount\chapno
5980 \newcount\secno \secno=0
5981 \newcount\subsecno \subsecno=0
5982 \newcount\subsubsecno \subsubsecno=0
5983
5984 % This counter is funny since it counts through charcodes of letters A, B, ...
5985 \newcount\appendixno \appendixno = `\@
5986 %
5987 % \def\appendixletter{\char\the\appendixno}
5988 % We do the following ugly conditional instead of the above simple
5989 % construct for the sake of pdftex, which needs the actual
5990 % letter in the expansion, not just typeset.
5991 %
5992 \def\appendixletter{%
5993 \ifnum\appendixno=`A A%
5994 \else\ifnum\appendixno=`B B%
5995 \else\ifnum\appendixno=`C C%
5996 \else\ifnum\appendixno=`D D%
5997 \else\ifnum\appendixno=`E E%
5998 \else\ifnum\appendixno=`F F%
5999 \else\ifnum\appendixno=`G G%
6000 \else\ifnum\appendixno=`H H%
6001 \else\ifnum\appendixno=`I I%
6002 \else\ifnum\appendixno=`J J%
6003 \else\ifnum\appendixno=`K K%
6004 \else\ifnum\appendixno=`L L%
6005 \else\ifnum\appendixno=`M M%
6006 \else\ifnum\appendixno=`N N%
6007 \else\ifnum\appendixno=`O O%
6008 \else\ifnum\appendixno=`P P%
6009 \else\ifnum\appendixno=`Q Q%
6010 \else\ifnum\appendixno=`R R%
6011 \else\ifnum\appendixno=`S S%
6012 \else\ifnum\appendixno=`T T%
6013 \else\ifnum\appendixno=`U U%
6014 \else\ifnum\appendixno=`V V%
6015 \else\ifnum\appendixno=`W W%
6016 \else\ifnum\appendixno=`X X%
6017 \else\ifnum\appendixno=`Y Y%
6018 \else\ifnum\appendixno=`Z Z%
6019 % The \the is necessary, despite appearances, because \appendixletter is
6020 % expanded while writing the .toc file. \char\appendixno is not
6021 % expandable, thus it is written literally, thus all appendixes come out
6022 % with the same letter (or @) in the toc without it.
6023 \else\char\the\appendixno
6024 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6025 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6026
6027 % Each @chapter defines these (using marks) as the number+name, number
6028 % and name of the chapter. Page headings and footings can use
6029 % these. @section does likewise.
6030 \def\thischapter{}
6031 \def\thischapternum{}
6032 \def\thischaptername{}
6033 \def\thissection{}
6034 \def\thissectionnum{}
6035 \def\thissectionname{}
6036
6037 \newcount\absseclevel % used to calculate proper heading level
6038 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6039
6040 % @raisesections: treat @section as chapter, @subsection as section, etc.
6041 \def\raisesections{\global\advance\secbase by -1}
6042
6043 % @lowersections: treat @chapter as section, @section as subsection, etc.
6044 \def\lowersections{\global\advance\secbase by 1}
6045
6046 % we only have subsub.
6047 \chardef\maxseclevel = 3
6048 %
6049 % A numbered section within an unnumbered changes to unnumbered too.
6050 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
6051 \chardef\unnlevel = \maxseclevel
6052 %
6053 % Trace whether the current chapter is an appendix or not:
6054 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6055 \def\chapheadtype{N}
6056
6057 % Choose a heading macro
6058 % #1 is heading type
6059 % #2 is heading level
6060 % #3 is text for heading
6061 \def\genhead#1#2#3{%
6062 % Compute the abs. sec. level:
6063 \absseclevel=#2
6064 \advance\absseclevel by \secbase
6065 % Make sure \absseclevel doesn't fall outside the range:
6066 \ifnum \absseclevel < 0
6067 \absseclevel = 0
6068 \else
6069 \ifnum \absseclevel > 3
6070 \absseclevel = 3
6071 \fi
6072 \fi
6073 % The heading type:
6074 \def\headtype{#1}%
6075 \if \headtype U%
6076 \ifnum \absseclevel < \unnlevel
6077 \chardef\unnlevel = \absseclevel
6078 \fi
6079 \else
6080 % Check for appendix sections:
6081 \ifnum \absseclevel = 0
6082 \edef\chapheadtype{\headtype}%
6083 \else
6084 \if \headtype A\if \chapheadtype N%
6085 \errmessage{@appendix... within a non-appendix chapter}%
6086 \fi\fi
6087 \fi
6088 % Check for numbered within unnumbered:
6089 \ifnum \absseclevel > \unnlevel
6090 \def\headtype{U}%
6091 \else
6092 \chardef\unnlevel = 3
6093 \fi
6094 \fi
6095 % Now print the heading:
6096 \if \headtype U%
6097 \ifcase\absseclevel
6098 \unnumberedzzz{#3}%
6099 \or \unnumberedseczzz{#3}%
6100 \or \unnumberedsubseczzz{#3}%
6101 \or \unnumberedsubsubseczzz{#3}%
6102 \fi
6103 \else
6104 \if \headtype A%
6105 \ifcase\absseclevel
6106 \appendixzzz{#3}%
6107 \or \appendixsectionzzz{#3}%
6108 \or \appendixsubseczzz{#3}%
6109 \or \appendixsubsubseczzz{#3}%
6110 \fi
6111 \else
6112 \ifcase\absseclevel
6113 \chapterzzz{#3}%
6114 \or \seczzz{#3}%
6115 \or \numberedsubseczzz{#3}%
6116 \or \numberedsubsubseczzz{#3}%
6117 \fi
6118 \fi
6119 \fi
6120 \suppressfirstparagraphindent
6121 }
6122
6123 % an interface:
6124 \def\numhead{\genhead N}
6125 \def\apphead{\genhead A}
6126 \def\unnmhead{\genhead U}
6127
6128 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6129 % all lower-level sectioning counters to zero.
6130 %
6131 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
6132 % (e.g., figures), q.v. By default (before any chapter), that is empty.
6133 \let\chaplevelprefix = \empty
6134 %
6135 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6136 \def\chapterzzz#1{%
6137 % section resetting is \global in case the chapter is in a group, such
6138 % as an @include file.
6139 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6140 \global\advance\chapno by 1
6141 %
6142 % Used for \float.
6143 \gdef\chaplevelprefix{\the\chapno.}%
6144 \resetallfloatnos
6145 %
6146 % \putwordChapter can contain complex things in translations.
6147 \toks0=\expandafter{\putwordChapter}%
6148 \message{\the\toks0 \space \the\chapno}%
6149 %
6150 % Write the actual heading.
6151 \chapmacro{#1}{Ynumbered}{\the\chapno}%
6152 %
6153 % So @section and the like are numbered underneath this chapter.
6154 \global\let\section = \numberedsec
6155 \global\let\subsection = \numberedsubsec
6156 \global\let\subsubsection = \numberedsubsubsec
6157 }
6158
6159 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6160 %
6161 \def\appendixzzz#1{%
6162 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6163 \global\advance\appendixno by 1
6164 \gdef\chaplevelprefix{\appendixletter.}%
6165 \resetallfloatnos
6166 %
6167 % \putwordAppendix can contain complex things in translations.
6168 \toks0=\expandafter{\putwordAppendix}%
6169 \message{\the\toks0 \space \appendixletter}%
6170 %
6171 \chapmacro{#1}{Yappendix}{\appendixletter}%
6172 %
6173 \global\let\section = \appendixsec
6174 \global\let\subsection = \appendixsubsec
6175 \global\let\subsubsection = \appendixsubsubsec
6176 }
6177
6178 % normally unnmhead0 calls unnumberedzzz:
6179 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
6180 \def\unnumberedzzz#1{%
6181 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6182 \global\advance\unnumberedno by 1
6183 %
6184 % Since an unnumbered has no number, no prefix for figures.
6185 \global\let\chaplevelprefix = \empty
6186 \resetallfloatnos
6187 %
6188 % This used to be simply \message{#1}, but TeX fully expands the
6189 % argument to \message. Therefore, if #1 contained @-commands, TeX
6190 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6191 % expanded @cite (which turns out to cause errors because \cite is meant
6192 % to be executed, not expanded).
6193 %
6194 % Anyway, we don't want the fully-expanded definition of @cite to appear
6195 % as a result of the \message, we just want `@cite' itself. We use
6196 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6197 % simply yielding the contents of <toks register>. (We also do this for
6198 % the toc entries.)
6199 \toks0 = {#1}%
6200 \message{(\the\toks0)}%
6201 %
6202 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6203 %
6204 \global\let\section = \unnumberedsec
6205 \global\let\subsection = \unnumberedsubsec
6206 \global\let\subsubsection = \unnumberedsubsubsec
6207 }
6208
6209 % @centerchap is like @unnumbered, but the heading is centered.
6210 \outer\parseargdef\centerchap{%
6211 \let\centerparametersmaybe = \centerparameters
6212 \unnmhead0{#1}%
6213 \let\centerparametersmaybe = \relax
6214 }
6215
6216 % @top is like @unnumbered.
6217 \let\top\unnumbered
6218
6219 % Sections.
6220 %
6221 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6222 \def\seczzz#1{%
6223 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6224 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6225 }
6226
6227 % normally calls appendixsectionzzz:
6228 \outer\parseargdef\appendixsection{\apphead1{#1}}
6229 \def\appendixsectionzzz#1{%
6230 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6231 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6232 }
6233 \let\appendixsec\appendixsection
6234
6235 % normally calls unnumberedseczzz:
6236 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6237 \def\unnumberedseczzz#1{%
6238 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6239 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6240 }
6241
6242 % Subsections.
6243 %
6244 % normally calls numberedsubseczzz:
6245 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6246 \def\numberedsubseczzz#1{%
6247 \global\subsubsecno=0 \global\advance\subsecno by 1
6248 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6249 }
6250
6251 % normally calls appendixsubseczzz:
6252 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6253 \def\appendixsubseczzz#1{%
6254 \global\subsubsecno=0 \global\advance\subsecno by 1
6255 \sectionheading{#1}{subsec}{Yappendix}%
6256 {\appendixletter.\the\secno.\the\subsecno}%
6257 }
6258
6259 % normally calls unnumberedsubseczzz:
6260 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6261 \def\unnumberedsubseczzz#1{%
6262 \global\subsubsecno=0 \global\advance\subsecno by 1
6263 \sectionheading{#1}{subsec}{Ynothing}%
6264 {\the\unnumberedno.\the\secno.\the\subsecno}%
6265 }
6266
6267 % Subsubsections.
6268 %
6269 % normally numberedsubsubseczzz:
6270 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6271 \def\numberedsubsubseczzz#1{%
6272 \global\advance\subsubsecno by 1
6273 \sectionheading{#1}{subsubsec}{Ynumbered}%
6274 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6275 }
6276
6277 % normally appendixsubsubseczzz:
6278 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6279 \def\appendixsubsubseczzz#1{%
6280 \global\advance\subsubsecno by 1
6281 \sectionheading{#1}{subsubsec}{Yappendix}%
6282 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6283 }
6284
6285 % normally unnumberedsubsubseczzz:
6286 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6287 \def\unnumberedsubsubseczzz#1{%
6288 \global\advance\subsubsecno by 1
6289 \sectionheading{#1}{subsubsec}{Ynothing}%
6290 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6291 }
6292
6293 % These macros control what the section commands do, according
6294 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6295 % Define them by default for a numbered chapter.
6296 \let\section = \numberedsec
6297 \let\subsection = \numberedsubsec
6298 \let\subsubsection = \numberedsubsubsec
6299
6300 % Define @majorheading, @heading and @subheading
6301
6302 \def\majorheading{%
6303 {\advance\chapheadingskip by 10pt \chapbreak }%
6304 \parsearg\chapheadingzzz
6305 }
6306
6307 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6308 \def\chapheadingzzz#1{%
6309 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6310 \nobreak\bigskip \nobreak
6311 \suppressfirstparagraphindent
6312 }
6313
6314 % @heading, @subheading, @subsubheading.
6315 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6316 \suppressfirstparagraphindent}
6317 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6318 \suppressfirstparagraphindent}
6319 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6320 \suppressfirstparagraphindent}
6321
6322 % These macros generate a chapter, section, etc. heading only
6323 % (including whitespace, linebreaking, etc. around it),
6324 % given all the information in convenient, parsed form.
6325
6326 % Args are the skip and penalty (usually negative)
6327 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6328
6329 % Parameter controlling skip before chapter headings (if needed)
6330 \newskip\chapheadingskip
6331
6332 % Define plain chapter starts, and page on/off switching for it.
6333 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6334
6335 % Start a new page
6336 \def\chappager{\par\vfill\supereject}
6337
6338 % \chapoddpage - start on an odd page for a new chapter
6339 % Because \domark is called before \chapoddpage, the filler page will
6340 % get the headings for the next chapter, which is wrong. But we don't
6341 % care -- we just disable all headings on the filler page.
6342 \def\chapoddpage{%
6343 \chappager
6344 \ifodd\pageno \else
6345 \begingroup
6346 \headingsoff
6347 \null
6348 \chappager
6349 \endgroup
6350 \fi
6351 }
6352
6353 \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname\HEADINGSon}
6354
6355 \def\CHAPPAGoff{%
6356 \global\let\contentsalignmacro = \chappager
6357 \global\let\pchapsepmacro=\chapbreak
6358 \global\def\HEADINGSon{\HEADINGSsinglechapoff}}
6359
6360 \def\CHAPPAGon{%
6361 \global\let\contentsalignmacro = \chappager
6362 \global\let\pchapsepmacro=\chappager
6363 \global\def\HEADINGSon{\HEADINGSsingle}}
6364
6365 \def\CHAPPAGodd{%
6366 \global\let\contentsalignmacro = \chapoddpage
6367 \global\let\pchapsepmacro=\chapoddpage
6368 \global\def\HEADINGSon{\HEADINGSdouble}}
6369
6370 \setchapternewpage on
6371
6372 % \chapmacro - Chapter opening.
6373 %
6374 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6375 % Yappendix, Yomitfromtoc), #3 the chapter number.
6376 % Not used for @heading series.
6377 %
6378 % To test against our argument.
6379 \def\Ynothingkeyword{Ynothing}
6380 \def\Yappendixkeyword{Yappendix}
6381 \def\Yomitfromtockeyword{Yomitfromtoc}
6382 %
6383 %
6384 % Definitions for @thischapter. These can be overridden in translation
6385 % files.
6386 \def\thischapterAppendix{%
6387 \putwordAppendix{} \thischapternum: \thischaptername}
6388
6389 \def\thischapterChapter{%
6390 \putwordChapter{} \thischapternum: \thischaptername}
6391 %
6392 %
6393 \def\chapmacro#1#2#3{%
6394 \expandafter\ifx\thisenv\titlepage\else
6395 \checkenv{}% chapters, etc., should not start inside an environment.
6396 \fi
6397 % Insert the first mark before the heading break (see notes for \domark).
6398 \let\prevchapterdefs=\currentchapterdefs
6399 \let\prevsectiondefs=\currentsectiondefs
6400 \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6401 \gdef\thissection{}}%
6402 %
6403 \def\temptype{#2}%
6404 \ifx\temptype\Ynothingkeyword
6405 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6406 \gdef\thischapter{\thischaptername}}%
6407 \else\ifx\temptype\Yomitfromtockeyword
6408 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6409 \gdef\thischapter{}}%
6410 \else\ifx\temptype\Yappendixkeyword
6411 \toks0={#1}%
6412 \xdef\currentchapterdefs{%
6413 \gdef\noexpand\thischaptername{\the\toks0}%
6414 \gdef\noexpand\thischapternum{\appendixletter}%
6415 \let\noexpand\thischapter\noexpand\thischapterAppendix
6416 }%
6417 \else
6418 \toks0={#1}%
6419 \xdef\currentchapterdefs{%
6420 \gdef\noexpand\thischaptername{\the\toks0}%
6421 \gdef\noexpand\thischapternum{\the\chapno}%
6422 \let\noexpand\thischapter\noexpand\thischapterChapter
6423 }%
6424 \fi\fi\fi
6425 %
6426 % Output the mark. Pass it through \safewhatsit, to take care of
6427 % the preceding space.
6428 \safewhatsit\domark
6429 %
6430 % Insert the chapter heading break.
6431 \pchapsepmacro
6432 %
6433 % Now the second mark, after the heading break. No break points
6434 % between here and the heading.
6435 \let\prevchapterdefs=\currentchapterdefs
6436 \let\prevsectiondefs=\currentsectiondefs
6437 \domark
6438 %
6439 {%
6440 \chapfonts \rm
6441 \let\footnote=\errfootnoteheading % give better error message
6442 %
6443 % Have to define \currentsection before calling \donoderef, because the
6444 % xref code eventually uses it. On the other hand, it has to be called
6445 % after \pchapsepmacro, or the headline will change too soon.
6446 \gdef\currentsection{#1}%
6447 %
6448 % Only insert the separating space if we have a chapter/appendix
6449 % number, and don't print the unnumbered ``number''.
6450 \ifx\temptype\Ynothingkeyword
6451 \setbox0 = \hbox{}%
6452 \def\toctype{unnchap}%
6453 \else\ifx\temptype\Yomitfromtockeyword
6454 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6455 \def\toctype{omit}%
6456 \else\ifx\temptype\Yappendixkeyword
6457 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6458 \def\toctype{app}%
6459 \else
6460 \setbox0 = \hbox{#3\enspace}%
6461 \def\toctype{numchap}%
6462 \fi\fi\fi
6463 %
6464 % Write the toc entry for this chapter. Must come before the
6465 % \donoderef, because we include the current node name in the toc
6466 % entry, and \donoderef resets it to empty.
6467 \writetocentry{\toctype}{#1}{#3}%
6468 %
6469 % For pdftex, we have to write out the node definition (aka, make
6470 % the pdfdest) after any page break, but before the actual text has
6471 % been typeset. If the destination for the pdf outline is after the
6472 % text, then jumping from the outline may wind up with the text not
6473 % being visible, for instance under high magnification.
6474 \donoderef{#2}%
6475 %
6476 % Typeset the actual heading.
6477 \nobreak % Avoid page breaks at the interline glue.
6478 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6479 \unhbox0 #1\par}%
6480 }%
6481 \nobreak\bigskip % no page break after a chapter title
6482 \nobreak
6483 }
6484
6485 % @centerchap -- centered and unnumbered.
6486 \let\centerparametersmaybe = \relax
6487 \def\centerparameters{%
6488 \advance\rightskip by 3\rightskip
6489 \leftskip = \rightskip
6490 \parfillskip = 0pt
6491 }
6492
6493
6494 % Section titles. These macros combine the section number parts and
6495 % call the generic \sectionheading to do the printing.
6496 %
6497 \newskip\secheadingskip
6498 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6499
6500 % Subsection titles.
6501 \newskip\subsecheadingskip
6502 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6503
6504 % Subsubsection titles.
6505 \def\subsubsecheadingskip{\subsecheadingskip}
6506 \def\subsubsecheadingbreak{\subsecheadingbreak}
6507
6508 % Definition for @thissection. This can be overridden in translation
6509 % files.
6510 \def\thissectionDef{%
6511 \putwordSection{} \thissectionnum: \thissectionname}
6512 %
6513
6514
6515 % Print any size, any type, section title.
6516 %
6517 % #1 is the text of the title,
6518 % #2 is the section level (sec/subsec/subsubsec),
6519 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6520 % #4 is the section number.
6521 %
6522 \def\seckeyword{sec}
6523 %
6524 \def\sectionheading#1#2#3#4{%
6525 {%
6526 \def\sectionlevel{#2}%
6527 \def\temptype{#3}%
6528 %
6529 % It is ok for the @heading series commands to appear inside an
6530 % environment (it's been historically allowed, though the logic is
6531 % dubious), but not the others.
6532 \ifx\temptype\Yomitfromtockeyword\else
6533 \checkenv{}% non-@*heading should not be in an environment.
6534 \fi
6535 \let\footnote=\errfootnoteheading
6536 %
6537 % Switch to the right set of fonts.
6538 \csname #2fonts\endcsname \rm
6539 %
6540 % Insert first mark before the heading break (see notes for \domark).
6541 \let\prevsectiondefs=\currentsectiondefs
6542 \ifx\temptype\Ynothingkeyword
6543 \ifx\sectionlevel\seckeyword
6544 \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6545 \gdef\thissection{\thissectionname}}%
6546 \fi
6547 \else\ifx\temptype\Yomitfromtockeyword
6548 % Don't redefine \thissection.
6549 \else\ifx\temptype\Yappendixkeyword
6550 \ifx\sectionlevel\seckeyword
6551 \toks0={#1}%
6552 \xdef\currentsectiondefs{%
6553 \gdef\noexpand\thissectionname{\the\toks0}%
6554 \gdef\noexpand\thissectionnum{#4}%
6555 \let\noexpand\thissection\noexpand\thissectionDef
6556 }%
6557 \fi
6558 \else
6559 \ifx\sectionlevel\seckeyword
6560 \toks0={#1}%
6561 \xdef\currentsectiondefs{%
6562 \gdef\noexpand\thissectionname{\the\toks0}%
6563 \gdef\noexpand\thissectionnum{#4}%
6564 \let\noexpand\thissection\noexpand\thissectionDef
6565 }%
6566 \fi
6567 \fi\fi\fi
6568 %
6569 % Go into vertical mode. Usually we'll already be there, but we
6570 % don't want the following whatsit to end up in a preceding paragraph
6571 % if the document didn't happen to have a blank line.
6572 \par
6573 %
6574 % Output the mark. Pass it through \safewhatsit, to take care of
6575 % the preceding space.
6576 \safewhatsit\domark
6577 %
6578 % Insert space above the heading.
6579 \csname #2headingbreak\endcsname
6580 %
6581 % Now the second mark, after the heading break. No break points
6582 % between here and the heading.
6583 \global\let\prevsectiondefs=\currentsectiondefs
6584 \domark
6585 %
6586 % Only insert the space after the number if we have a section number.
6587 \ifx\temptype\Ynothingkeyword
6588 \setbox0 = \hbox{}%
6589 \def\toctype{unn}%
6590 \gdef\currentsection{#1}%
6591 \else\ifx\temptype\Yomitfromtockeyword
6592 % for @headings -- no section number, don't include in toc,
6593 % and don't redefine \currentsection.
6594 \setbox0 = \hbox{}%
6595 \def\toctype{omit}%
6596 \let\sectionlevel=\empty
6597 \else\ifx\temptype\Yappendixkeyword
6598 \setbox0 = \hbox{#4\enspace}%
6599 \def\toctype{app}%
6600 \gdef\currentsection{#1}%
6601 \else
6602 \setbox0 = \hbox{#4\enspace}%
6603 \def\toctype{num}%
6604 \gdef\currentsection{#1}%
6605 \fi\fi\fi
6606 %
6607 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6608 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6609 %
6610 % Write the node reference (= pdf destination for pdftex).
6611 % Again, see comments in \chapmacro.
6612 \donoderef{#3}%
6613 %
6614 % Interline glue will be inserted when the vbox is completed.
6615 % That glue will be a valid breakpoint for the page, since it'll be
6616 % preceded by a whatsit (usually from the \donoderef, or from the
6617 % \writetocentry if there was no node). We don't want to allow that
6618 % break, since then the whatsits could end up on page n while the
6619 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6620 \nobreak
6621 %
6622 % Output the actual section heading.
6623 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6624 \hangindent=\wd0 % zero if no section number
6625 \unhbox0 #1}%
6626 }%
6627 % Add extra space after the heading -- half of whatever came above it.
6628 % Don't allow stretch, though.
6629 \kern .5 \csname #2headingskip\endcsname
6630 %
6631 % Do not let the kern be a potential breakpoint, as it would be if it
6632 % was followed by glue.
6633 \nobreak
6634 %
6635 % We'll almost certainly start a paragraph next, so don't let that
6636 % glue accumulate. (Not a breakpoint because it's preceded by a
6637 % discardable item.) However, when a paragraph is not started next
6638 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6639 % or the negative glue will cause weirdly wrong output, typically
6640 % obscuring the section heading with something else.
6641 \vskip-\parskip
6642 %
6643 % This is so the last item on the main vertical list is a known
6644 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6645 % and do the needful.
6646 \penalty 10001
6647 }
6648
6649
6650 \message{toc,}
6651 % Table of contents.
6652 \newwrite\tocfile
6653
6654 % Write an entry to the toc file, opening it if necessary.
6655 % Called from @chapter, etc.
6656 %
6657 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6658 % We append the current node name (if any) and page number as additional
6659 % arguments for the \{chap,sec,...}entry macros which will eventually
6660 % read this. The node name is used in the pdf outlines as the
6661 % destination to jump to.
6662 %
6663 % We open the .toc file for writing here instead of at @setfilename (or
6664 % any other fixed time) so that @contents can be anywhere in the document.
6665 % But if #1 is `omit', then we don't do anything. This is used for the
6666 % table of contents chapter openings themselves.
6667 %
6668 \newif\iftocfileopened
6669 \def\omitkeyword{omit}%
6670 %
6671 \def\writetocentry#1#2#3{%
6672 \edef\writetoctype{#1}%
6673 \ifx\writetoctype\omitkeyword \else
6674 \iftocfileopened\else
6675 \immediate\openout\tocfile = \jobname.toc
6676 \global\tocfileopenedtrue
6677 \fi
6678 %
6679 \iflinks
6680 {\atdummies
6681 \edef\temp{%
6682 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6683 \temp
6684 }%
6685 \fi
6686 \fi
6687 %
6688 % Tell \shipout to create a pdf destination on each page, if we're
6689 % writing pdf. These are used in the table of contents. We can't
6690 % just write one on every page because the title pages are numbered
6691 % 1 and 2 (the page numbers aren't printed), and so are the first
6692 % two pages of the document. Thus, we'd have two destinations named
6693 % `1', and two named `2'.
6694 \ifpdforxetex
6695 \global\pdfmakepagedesttrue
6696 \fi
6697 }
6698
6699
6700 % These characters do not print properly in the Computer Modern roman
6701 % fonts, so we must take special care. This is more or less redundant
6702 % with the Texinfo input format setup at the end of this file.
6703 %
6704 \def\activecatcodes{%
6705 \catcode`\"=\active
6706 \catcode`\$=\active
6707 \catcode`\<=\active
6708 \catcode`\>=\active
6709 \catcode`\\=\active
6710 \catcode`\^=\active
6711 \catcode`\_=\active
6712 \catcode`\|=\active
6713 \catcode`\~=\active
6714 }
6715
6716
6717 % Read the toc file, which is essentially Texinfo input.
6718 \def\readtocfile{%
6719 \setupdatafile
6720 \activecatcodes
6721 \input \tocreadfilename
6722 }
6723
6724 \newskip\contentsrightmargin \contentsrightmargin=1in
6725 \newcount\savepageno
6726 \newcount\lastnegativepageno \lastnegativepageno = -1
6727
6728 % Prepare to read what we've written to \tocfile.
6729 %
6730 \def\startcontents#1{%
6731 % If @setchapternewpage on, and @headings double, the contents should
6732 % start on an odd page, unlike chapters.
6733 \contentsalignmacro
6734 \immediate\closeout\tocfile
6735 %
6736 % Don't need to put `Contents' or `Short Contents' in the headline.
6737 % It is abundantly clear what they are.
6738 \chapmacro{#1}{Yomitfromtoc}{}%
6739 %
6740 \savepageno = \pageno
6741 \begingroup % Set up to handle contents files properly.
6742 \raggedbottom % Worry more about breakpoints than the bottom.
6743 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6744 %
6745 % Roman numerals for page numbers.
6746 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6747 \def\thistitle{}% no title in double-sided headings
6748 % Record where the Roman numerals started.
6749 \ifnum\romancount=0 \global\romancount=\pagecount \fi
6750 \linkentrytexttrue
6751 }
6752
6753 % \raggedbottom in plain.tex hardcodes \topskip so override it
6754 \catcode`\@=11
6755 \def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue}
6756 \catcode`\@=\other
6757
6758 % redefined for the two-volume lispref. We always output on
6759 % \jobname.toc even if this is redefined.
6760 %
6761 \def\tocreadfilename{\jobname.toc}
6762
6763 % Normal (long) toc.
6764 %
6765 \def\contents{%
6766 \startcontents{\putwordTOC}%
6767 \openin 1 \tocreadfilename\space
6768 \ifeof 1 \else
6769 \readtocfile
6770 \fi
6771 \vfill \eject
6772 \contentsalignmacro % in case @setchapternewpage odd is in effect
6773 \ifeof 1 \else
6774 \pdfmakeoutlines
6775 \fi
6776 \closein 1
6777 \endgroup
6778 \contentsendroman
6779 }
6780
6781 % And just the chapters.
6782 \def\summarycontents{%
6783 \startcontents{\putwordShortTOC}%
6784 %
6785 \let\partentry = \shortpartentry
6786 \let\numchapentry = \shortchapentry
6787 \let\appentry = \shortchapentry
6788 \let\unnchapentry = \shortunnchapentry
6789 % We want a true roman here for the page numbers.
6790 \secfonts
6791 \let\rm=\shortcontrm \let\bf=\shortcontbf
6792 \let\sl=\shortcontsl \let\tt=\shortconttt
6793 \rm
6794 \hyphenpenalty = 10000
6795 \advance\baselineskip by 1pt % Open it up a little.
6796 \def\numsecentry##1##2##3##4{}
6797 \let\appsecentry = \numsecentry
6798 \let\unnsecentry = \numsecentry
6799 \let\numsubsecentry = \numsecentry
6800 \let\appsubsecentry = \numsecentry
6801 \let\unnsubsecentry = \numsecentry
6802 \let\numsubsubsecentry = \numsecentry
6803 \let\appsubsubsecentry = \numsecentry
6804 \let\unnsubsubsecentry = \numsecentry
6805 \openin 1 \tocreadfilename\space
6806 \ifeof 1 \else
6807 \readtocfile
6808 \fi
6809 \closein 1
6810 \vfill \eject
6811 \contentsalignmacro % in case @setchapternewpage odd is in effect
6812 \endgroup
6813 \contentsendroman
6814 }
6815 \let\shortcontents = \summarycontents
6816
6817 % Get ready to use Arabic numerals again
6818 \def\contentsendroman{%
6819 \lastnegativepageno = \pageno
6820 \global\pageno=1
6821 \contentsendcount = \pagecount
6822 }
6823
6824 % Typeset the label for a chapter or appendix for the short contents.
6825 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6826 %
6827 \def\shortchaplabel#1{%
6828 % This space should be enough, since a single number is .5em, and the
6829 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6830 % But use \hss just in case.
6831 % (This space doesn't include the extra space that gets added after
6832 % the label; that gets put in by \shortchapentry above.)
6833 %
6834 % We'd like to right-justify chapter numbers, but that looks strange
6835 % with appendix letters. And right-justifying numbers and
6836 % left-justifying letters looks strange when there is less than 10
6837 % chapters. Have to read the whole toc once to know how many chapters
6838 % there are before deciding ...
6839 \hbox to 1em{#1\hss}%
6840 }
6841
6842 % These macros generate individual entries in the table of contents.
6843 % The first argument is the chapter or section name.
6844 % The last argument is the page number.
6845 % The arguments in between are the chapter number, section number, ...
6846
6847 % Parts, in the main contents. Replace the part number, which doesn't
6848 % exist, with an empty box. Let's hope all the numbers have the same width.
6849 % Also ignore the page number, which is conventionally not printed.
6850 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6851 \def\partentry#1#2#3#4{%
6852 % Add stretch and a bonus for breaking the page before the part heading.
6853 % This reduces the chance of the page being broken immediately after the
6854 % part heading, before a following chapter heading.
6855 \vskip 0pt plus 5\baselineskip
6856 \penalty-300
6857 \vskip 0pt plus -5\baselineskip
6858 \dochapentry{\numeralbox\labelspace#1}{}%
6859 }
6860 %
6861 % Parts, in the short toc.
6862 \def\shortpartentry#1#2#3#4{%
6863 \penalty-300
6864 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6865 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6866 }
6867
6868 % Chapters, in the main contents.
6869 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6870
6871 % Chapters, in the short toc.
6872 % See comments in \dochapentry re vbox and related settings.
6873 \def\shortchapentry#1#2#3#4{%
6874 \tocentry{\shortchaplabel{#2}\labelspace #1}{#4}%
6875 }
6876
6877 % Appendices, in the main contents.
6878 % Need the word Appendix, and a fixed-size box.
6879 %
6880 \def\appendixbox#1{%
6881 % We use M since it's probably the widest letter.
6882 \setbox0 = \hbox{\putwordAppendix{} M}%
6883 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6884 %
6885 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6886
6887 % Unnumbered chapters.
6888 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6889 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{#4}}
6890
6891 % Sections.
6892 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6893 \let\appsecentry=\numsecentry
6894 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6895
6896 % Subsections.
6897 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6898 \let\appsubsecentry=\numsubsecentry
6899 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6900
6901 % And subsubsections.
6902 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6903 \let\appsubsubsecentry=\numsubsubsecentry
6904 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6905
6906 % This parameter controls the indentation of the various levels.
6907 % Same as \defaultparindent.
6908 \newdimen\tocindent \tocindent = 15pt
6909
6910 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6911 % page number.
6912 %
6913 % If the toc has to be broken over pages, we want it to be at chapters
6914 % if at all possible; hence the \penalty.
6915 \def\dochapentry#1#2{%
6916 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6917 \begingroup
6918 % Move the page numbers slightly to the right
6919 \advance\entryrightmargin by -0.05em
6920 \chapentryfonts
6921 \tocentry{#1}{#2}%
6922 \endgroup
6923 \nobreak\vskip .25\baselineskip plus.1\baselineskip
6924 }
6925
6926 \def\dosecentry#1#2{\begingroup
6927 \secentryfonts \leftskip=\tocindent
6928 \tocentry{#1}{#2}%
6929 \endgroup}
6930
6931 \def\dosubsecentry#1#2{\begingroup
6932 \subsecentryfonts \leftskip=2\tocindent
6933 \tocentry{#1}{#2}%
6934 \endgroup}
6935
6936 \def\dosubsubsecentry#1#2{\begingroup
6937 \subsubsecentryfonts \leftskip=3\tocindent
6938 \tocentry{#1}{#2}%
6939 \endgroup}
6940
6941 % We use the same \entry macro as for the index entries.
6942 \let\tocentry = \entry
6943
6944 % Space between chapter (or whatever) number and the title.
6945 \def\labelspace{\hskip1em \relax}
6946
6947 \def\chapentryfonts{\secfonts \rm}
6948 \def\secentryfonts{\textfonts}
6949 \def\subsecentryfonts{\textfonts}
6950 \def\subsubsecentryfonts{\textfonts}
6951
6952
6953 \message{environments,}
6954 % @foo ... @end foo.
6955
6956 % @tex ... @end tex escapes into raw TeX temporarily.
6957 % One exception: @ is still an escape character, so that @end tex works.
6958 % But \@ or @@ will get a plain @ character.
6959
6960 \envdef\tex{%
6961 \setregularquotes
6962 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6963 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6964 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6965 \catcode `\%=14
6966 \catcode `\+=\other
6967 \catcode `\"=\other
6968 \catcode `\|=\other
6969 \catcode `\<=\other
6970 \catcode `\>=\other
6971 \catcode `\`=\other
6972 \catcode `\'=\other
6973 %
6974 % ' is active in math mode (mathcode"8000). So reset it, and all our
6975 % other math active characters (just in case), to plain's definitions.
6976 \mathactive
6977 %
6978 % Inverse of the list at the beginning of the file.
6979 \let\b=\ptexb
6980 \let\bullet=\ptexbullet
6981 \let\c=\ptexc
6982 \let\,=\ptexcomma
6983 \let\.=\ptexdot
6984 \let\dots=\ptexdots
6985 \let\equiv=\ptexequiv
6986 \let\!=\ptexexclam
6987 \let\i=\ptexi
6988 \let\indent=\ptexindent
6989 \let\noindent=\ptexnoindent
6990 \let\{=\ptexlbrace
6991 \let\+=\tabalign
6992 \let\}=\ptexrbrace
6993 \let\/=\ptexslash
6994 \let\sp=\ptexsp
6995 \let\*=\ptexstar
6996 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
6997 \let\t=\ptext
6998 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
6999 \let\frenchspacing=\plainfrenchspacing
7000 %
7001 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7002 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7003 \def\@{@}%
7004 }
7005 % There is no need to define \Etex.
7006
7007 % Define @lisp ... @end lisp.
7008 % @lisp environment forms a group so it can rebind things,
7009 % including the definition of @end lisp (which normally is erroneous).
7010
7011 % Amount to narrow the margins by for @lisp.
7012 \newskip\lispnarrowing \lispnarrowing=0.4in
7013
7014 % This is the definition that ^^M gets inside @lisp, @example, and other
7015 % such environments. \null is better than a space, since it doesn't
7016 % have any width.
7017 \def\lisppar{\null\endgraf}
7018
7019 % This space is always present above and below environments.
7020 \newskip\envskipamount \envskipamount = 0pt
7021
7022 % Make spacing and below environment symmetrical. We use \parskip here
7023 % to help in doing that, since in @example-like environments \parskip
7024 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7025 % start of the next paragraph will insert \parskip.
7026 %
7027 \def\aboveenvbreak{{%
7028 % =10000 instead of <10000 because of a special case in \itemzzz and
7029 % \sectionheading, q.v.
7030 \ifnum \lastpenalty=10000 \else
7031 \advance\envskipamount by \parskip
7032 \endgraf
7033 \ifdim\lastskip<\envskipamount
7034 \removelastskip
7035 \ifnum\lastpenalty<10000
7036 % Penalize breaking before the environment, because preceding text
7037 % often leads into it.
7038 \penalty100
7039 \fi
7040 \vskip\envskipamount
7041 \fi
7042 \fi
7043 }}
7044
7045 \def\afterenvbreak{{%
7046 % =10000 instead of <10000 because of a special case in \itemzzz and
7047 % \sectionheading, q.v.
7048 \ifnum \lastpenalty=10000 \else
7049 \advance\envskipamount by \parskip
7050 \endgraf
7051 \ifdim\lastskip<\envskipamount
7052 \removelastskip
7053 % it's not a good place to break if the last penalty was \nobreak
7054 % or better ...
7055 \ifnum\lastpenalty<10000 \penalty-50 \fi
7056 \vskip\envskipamount
7057 \fi
7058 \fi
7059 }}
7060
7061 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7062 % also clear it, so that its embedded environments do the narrowing again.
7063 \let\nonarrowing=\relax
7064
7065 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7066 % environment contents.
7067
7068 %
7069 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7070 \def\ctr{{\hskip 6pt\circle\char'010}}
7071 \def\cbl{{\circle\char'012\hskip -6pt}}
7072 \def\cbr{{\hskip 6pt\circle\char'011}}
7073 \def\carttop{\hbox to \cartouter{\hskip\lskip
7074 \ctl\leaders\hrule height\circthick\hfil\ctr
7075 \hskip\rskip}}
7076 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7077 \cbl\leaders\hrule height\circthick\hfil\cbr
7078 \hskip\rskip}}
7079 %
7080 \newskip\lskip\newskip\rskip
7081
7082 % only require the font if @cartouche is actually used
7083 \def\cartouchefontdefs{%
7084 \font\circle=lcircle10\relax
7085 \circthick=\fontdimen8\circle
7086 }
7087 \newdimen\circthick
7088 \newdimen\cartouter\newdimen\cartinner
7089 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7090
7091 \envparseargdef\cartouche{%
7092 \cartouchefontdefs
7093 \ifhmode\par\fi % can't be in the midst of a paragraph.
7094 \startsavinginserts
7095 \lskip=\leftskip \rskip=\rightskip
7096 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7097 %
7098 % Set paragraph width for text inside cartouche. There are
7099 % left and right margins of 3pt each plus two vrules 0.4pt each.
7100 \cartinner=\hsize \advance\cartinner by-\lskip
7101 \advance\cartinner by-\rskip
7102 \advance\cartinner by -6.8pt
7103 %
7104 % For drawing top and bottom of cartouche. Each corner char
7105 % adds 6pt and we take off the width of a rule to line up with the
7106 % right boundary perfectly.
7107 \cartouter=\hsize
7108 \advance\cartouter by 11.6pt
7109 %
7110 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7111 %
7112 % If this cartouche directly follows a sectioning command, we need the
7113 % \parskip glue (backspaced over by default) or the cartouche can
7114 % collide with the section heading.
7115 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7116 %
7117 \setbox\groupbox=\vtop\bgroup
7118 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7119 \carttop
7120 \hbox\bgroup
7121 \hskip\lskip
7122 \vrule\kern3pt
7123 \vbox\bgroup
7124 \hsize=\cartinner
7125 \baselineskip=\normbskip
7126 \lineskip=\normlskip
7127 \parskip=\normpskip
7128 \def\arg{#1}%
7129 \ifx\arg\empty\else
7130 \centerV{\hfil \bf #1 \hfil}%
7131 \fi
7132 \kern3pt
7133 \vskip -\parskip
7134 }
7135 \def\Ecartouche{%
7136 \ifhmode\par\fi
7137 \kern3pt
7138 \egroup
7139 \kern3pt\vrule
7140 \hskip\rskip
7141 \egroup
7142 \cartbot
7143 \egroup
7144 \addgroupbox
7145 \checkinserts
7146 }
7147
7148
7149 % This macro is called at the beginning of all the @example variants,
7150 % inside a group.
7151 \newdimen\nonfillparindent
7152 \def\nonfillstart{%
7153 \aboveenvbreak
7154 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7155 \sepspaces % Make spaces be word-separators rather than space tokens.
7156 \let\par = \lisppar % don't ignore blank lines
7157 \obeylines % each line of input is a line of output
7158 \parskip = 0pt
7159 % Turn off paragraph indentation but redefine \indent to emulate
7160 % the normal \indent.
7161 \nonfillparindent=\parindent
7162 \parindent = 0pt
7163 \let\indent\nonfillindent
7164 %
7165 \emergencystretch = 0pt % don't try to avoid overfull boxes
7166 \ifx\nonarrowing\relax
7167 \advance \leftskip by \lispnarrowing
7168 \exdentamount=\lispnarrowing
7169 \else
7170 \let\nonarrowing = \relax
7171 \fi
7172 \let\exdent=\nofillexdent
7173 }
7174
7175 \begingroup
7176 \obeyspaces
7177 % We want to swallow spaces (but not other tokens) after the fake
7178 % @indent in our nonfill-environments, where spaces are normally
7179 % active and set to @tie, resulting in them not being ignored after
7180 % @indent.
7181 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7182 \gdef\nonfillindentcheck{%
7183 \ifx\temp %
7184 \expandafter\nonfillindentgobble%
7185 \else%
7186 \leavevmode\nonfillindentbox%
7187 \fi%
7188 }%
7189 \endgroup
7190 \def\nonfillindentgobble#1{\nonfillindent}
7191 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7192
7193 % If you want all examples etc. small: @set dispenvsize small.
7194 % If you want even small examples the full size: @set dispenvsize nosmall.
7195 % This affects the following displayed environments:
7196 % @example, @display, @format, @lisp, @verbatim
7197 %
7198 \def\smallword{small}
7199 \def\nosmallword{nosmall}
7200 \let\SETdispenvsize\relax
7201 \def\setnormaldispenv{%
7202 \ifx\SETdispenvsize\smallword
7203 % end paragraph for sake of leading, in case document has no blank
7204 % line. This is redundant with what happens in \aboveenvbreak, but
7205 % we need to do it before changing the fonts, and it's inconvenient
7206 % to change the fonts afterward.
7207 \ifnum \lastpenalty=10000 \else \endgraf \fi
7208 \smallexamplefonts \rm
7209 \fi
7210 }
7211 \def\setsmalldispenv{%
7212 \ifx\SETdispenvsize\nosmallword
7213 \else
7214 \ifnum \lastpenalty=10000 \else \endgraf \fi
7215 \smallexamplefonts \rm
7216 \fi
7217 }
7218
7219 % We often define two environments, @foo and @smallfoo.
7220 % Let's do it in one command. #1 is the env name, #2 the definition.
7221 \def\makedispenvdef#1#2{%
7222 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7223 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7224 \expandafter\let\csname E#1\endcsname \afterenvbreak
7225 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7226 }
7227
7228 % Define two environment synonyms (#1 and #2) for an environment.
7229 \def\maketwodispenvdef#1#2#3{%
7230 \makedispenvdef{#1}{#3}%
7231 \makedispenvdef{#2}{#3}%
7232 }
7233 %
7234 % @lisp: indented, narrowed, typewriter font;
7235 % @example: same as @lisp.
7236 %
7237 % @smallexample and @smalllisp: use smaller fonts.
7238 % Originally contributed by Pavel@xerox.
7239 %
7240 \maketwodispenvdef{lisp}{example}{%
7241 \nonfillstart
7242 \tt\setcodequotes
7243 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7244 \parsearg\gobble
7245 }
7246 % @display/@smalldisplay: same as @lisp except keep current font.
7247 %
7248 \makedispenvdef{display}{%
7249 \nonfillstart
7250 \gobble
7251 }
7252
7253 % @format/@smallformat: same as @display except don't narrow margins.
7254 %
7255 \makedispenvdef{format}{%
7256 \let\nonarrowing = t%
7257 \nonfillstart
7258 \gobble
7259 }
7260
7261 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7262 \envdef\flushleft{%
7263 \let\nonarrowing = t%
7264 \nonfillstart
7265 \gobble
7266 }
7267 \let\Eflushleft = \afterenvbreak
7268
7269 % @flushright.
7270 %
7271 \envdef\flushright{%
7272 \let\nonarrowing = t%
7273 \nonfillstart
7274 \advance\leftskip by 0pt plus 1fill\relax
7275 \gobble
7276 }
7277 \let\Eflushright = \afterenvbreak
7278
7279
7280 % @raggedright does more-or-less normal line breaking but no right
7281 % justification. From plain.tex.
7282 \envdef\raggedright{%
7283 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7284 }
7285 \let\Eraggedright\par
7286
7287
7288 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7289 % and narrows the margins. We keep \parskip nonzero in general, since
7290 % we're doing normal filling. So, when using \aboveenvbreak and
7291 % \afterenvbreak, temporarily make \parskip 0.
7292 %
7293 \makedispenvdef{quotation}{\quotationstart}
7294 %
7295 \def\quotationstart{%
7296 \indentedblockstart % same as \indentedblock, but increase right margin too.
7297 \ifx\nonarrowing\relax
7298 \advance\rightskip by \lispnarrowing
7299 \fi
7300 \parsearg\quotationlabel
7301 }
7302
7303 % We have retained a nonzero parskip for the environment, since we're
7304 % doing normal filling.
7305 %
7306 \def\Equotation{%
7307 \par
7308 \ifx\quotationauthor\thisisundefined\else
7309 % indent a bit.
7310 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7311 \fi
7312 {\parskip=0pt \afterenvbreak}%
7313 }
7314 \def\Esmallquotation{\Equotation}
7315
7316 % If we're given an argument, typeset it in bold with a colon after.
7317 \def\quotationlabel#1{%
7318 \def\temp{#1}%
7319 \ifx\temp\empty \else
7320 {\bf #1: }%
7321 \fi
7322 }
7323
7324 % @indentedblock is like @quotation, but indents only on the left and
7325 % has no optional argument.
7326 %
7327 \makedispenvdef{indentedblock}{\indentedblockstart}
7328 %
7329 \def\indentedblockstart{%
7330 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7331 \parindent=0pt
7332 %
7333 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7334 \ifx\nonarrowing\relax
7335 \advance\leftskip by \lispnarrowing
7336 \exdentamount = \lispnarrowing
7337 \else
7338 \let\nonarrowing = \relax
7339 \fi
7340 }
7341
7342 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7343 %
7344 \def\Eindentedblock{%
7345 \par
7346 {\parskip=0pt \afterenvbreak}%
7347 }
7348 \def\Esmallindentedblock{\Eindentedblock}
7349
7350
7351 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7352 % If we want to allow any <char> as delimiter,
7353 % we need the curly braces so that makeinfo sees the @verb command, eg:
7354 % `@verbx...x' would look like the '@verbx' command. [email protected]
7355 %
7356 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7357 %
7358 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7359 % active too. Otherwise, they get lost as the first character on a
7360 % verbatim line.
7361 \def\dospecials{%
7362 \do\ \do\\\do\{\do\}\do\$\do\&%
7363 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7364 \do\<\do\>\do\|\do\@\do+\do\"%
7365 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7366 % @set txicodequotebacktick will not have effect on @verb and
7367 % @verbatim, and ?` and !` ligatures won't get disabled.
7368 %\do\`\do\'%
7369 }
7370 %
7371 % [Knuth] p. 380
7372 \def\uncatcodespecials{%
7373 \def\do##1{\catcode`##1=\other}\dospecials}
7374 %
7375 % Setup for the @verb command.
7376 %
7377 % Eight spaces for a tab
7378 \begingroup
7379 \catcode`\^^I=\active
7380 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7381 \endgroup
7382 %
7383 \def\setupverb{%
7384 \tt
7385 \def\par{\leavevmode\endgraf}%
7386 \parindent = 0pt
7387 \setcodequotes
7388 \tabeightspaces
7389 % Respect line breaks,
7390 % print special symbols as themselves, and
7391 % make each space count
7392 % must do in this order:
7393 \obeylines \uncatcodespecials \sepspaces
7394 }
7395
7396 % Setup for the @verbatim environment
7397 %
7398 % Real tab expansion.
7399 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7400 %
7401 % We typeset each line of the verbatim in an \hbox, so we can handle
7402 % tabs.
7403 \newbox\verbbox
7404 \def\starttabbox{\setbox\verbbox=\hbox\bgroup}
7405 %
7406 \begingroup
7407 \catcode`\^^I=\active
7408 \gdef\tabexpand{%
7409 \catcode`\^^I=\active
7410 \def^^I{\leavevmode\egroup
7411 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7412 \divide\dimen\verbbox by\tabw
7413 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7414 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7415 \wd\verbbox=\dimen\verbbox
7416 \leavevmode\box\verbbox \starttabbox
7417 }%
7418 }
7419 \endgroup
7420
7421 % start the verbatim environment.
7422 \def\setupverbatim{%
7423 \let\nonarrowing = t%
7424 \nonfillstart
7425 \tt % easiest (and conventionally used) font for verbatim
7426 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
7427 \tabexpand
7428 \setcodequotes
7429 % Respect line breaks,
7430 % print special symbols as themselves, and
7431 % make each space count.
7432 % Must do in this order:
7433 \obeylines \uncatcodespecials \sepspaces
7434 }
7435
7436 % Do the @verb magic: verbatim text is quoted by unique
7437 % delimiter characters. Before first delimiter expect a
7438 % right brace, after last delimiter expect closing brace:
7439 %
7440 % \def\doverb'{'<char>#1<char>'}'{#1}
7441 %
7442 % [Knuth] p. 382; only eat outer {}
7443 \begingroup
7444 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7445 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7446 \endgroup
7447 %
7448 \def\verb{\begingroup\setupverb\doverb}
7449 %
7450 %
7451 % Do the @verbatim magic: define the macro \doverbatim so that
7452 % the (first) argument ends when '@end verbatim' is reached, ie:
7453 %
7454 % \def\doverbatim#1@end verbatim{#1}
7455 %
7456 % For Texinfo it's a lot easier than for LaTeX,
7457 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7458 % we need not redefine '\', '{' and '}'.
7459 %
7460 % Inspired by LaTeX's verbatim command set [latex.ltx]
7461 %
7462 \begingroup
7463 \catcode`\ =\active
7464 \obeylines %
7465 % ignore everything up to the first ^^M, that's the newline at the end
7466 % of the @verbatim input line itself. Otherwise we get an extra blank
7467 % line in the output.
7468 \xdef\doverbatim#1^^M#2@end verbatim{%
7469 \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
7470 % We really want {...\end verbatim} in the body of the macro, but
7471 % without the active space; thus we have to use \xdef and \gobble.
7472 % The \egroup ends the \verbbox started at the end of the last line in
7473 % the block.
7474 \endgroup
7475 %
7476 \envdef\verbatim{%
7477 \setnormaldispenv\setupverbatim\doverbatim
7478 }
7479 \let\Everbatim = \afterenvbreak
7480
7481
7482 % @verbatiminclude FILE - insert text of file in verbatim environment.
7483 %
7484 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7485 %
7486 \def\doverbatiminclude#1{%
7487 {%
7488 \makevalueexpandable
7489 \setupverbatim
7490 {%
7491 \indexnofonts % Allow `@@' and other weird things in file names.
7492 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7493 \edef\tmp{\noexpand\input #1 }
7494 \expandafter
7495 }\expandafter\starttabbox\tmp\egroup
7496 \afterenvbreak
7497 }%
7498 }
7499
7500 % @copying ... @end copying.
7501 % Save the text away for @insertcopying later.
7502 %
7503 % We save the uninterpreted tokens, rather than creating a box.
7504 % Saving the text in a box would be much easier, but then all the
7505 % typesetting commands (@smallbook, font changes, etc.) have to be done
7506 % beforehand -- and a) we want @copying to be done first in the source
7507 % file; b) letting users define the frontmatter in as flexible order as
7508 % possible is desirable.
7509 %
7510 \def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying}
7511 {\catcode`\ =\other
7512 \gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7513 }
7514
7515 \def\insertcopying{%
7516 \begingroup
7517 \parindent = 0pt % paragraph indentation looks wrong on title page
7518 \scanexp\copyingtext
7519 \endgroup
7520 }
7521
7522
7523 \message{defuns,}
7524 % @defun etc.
7525
7526 \newskip\defbodyindent \defbodyindent=.4in
7527 \newskip\defargsindent \defargsindent=50pt
7528 \newskip\deflastargmargin \deflastargmargin=18pt
7529 \newcount\defunpenalty
7530
7531 % Start the processing of @deffn:
7532 \def\startdefun{%
7533 \ifnum\lastpenalty<10000
7534 \medbreak
7535 \defunpenalty=10003 % Will keep this @deffn together with the
7536 % following @def command, see below.
7537 \else
7538 % If there are two @def commands in a row, we'll have a \nobreak,
7539 % which is there to keep the function description together with its
7540 % header. But if there's nothing but headers, we need to allow a
7541 % break somewhere. Check specifically for penalty 10002, inserted
7542 % by \printdefunline, instead of 10000, since the sectioning
7543 % commands also insert a nobreak penalty, and we don't want to allow
7544 % a break between a section heading and a defun.
7545 %
7546 % As a further refinement, we avoid "club" headers by signalling
7547 % with penalty of 10003 after the very first @deffn in the
7548 % sequence (see above), and penalty of 10002 after any following
7549 % @def command.
7550 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7551 %
7552 % Similarly, after a section heading, do not allow a break.
7553 % But do insert the glue.
7554 \medskip % preceded by discardable penalty, so not a breakpoint
7555 \fi
7556 %
7557 \parindent=0in
7558 \advance\leftskip by \defbodyindent
7559 \exdentamount=\defbodyindent
7560 }
7561
7562 % Called as \printdefunline \deffooheader{text}
7563 %
7564 \def\printdefunline#1#2{%
7565 \begingroup
7566 \plainfrenchspacing
7567 % call \deffooheader:
7568 #1#2 \endheader
7569 % common ending:
7570 \interlinepenalty = 10000
7571 \advance\rightskip by 0pt plus 1fil\relax
7572 \endgraf
7573 \nobreak\vskip -\parskip
7574 \penalty\defunpenalty % signal to \startdefun and \deffoox
7575 % Some of the @defun-type tags do not enable magic parentheses,
7576 % rendering the following check redundant. But we don't optimize.
7577 \checkparencounts
7578 \endgroup
7579 }
7580
7581 \def\Edefun{\endgraf\medbreak}
7582
7583 % @defblock, @defline do not automatically create index entries
7584 \envdef\defblock{%
7585 \startdefun
7586 }
7587 \let\Edefblock\Edefun
7588
7589 \def\defline{%
7590 \doingtypefnfalse
7591 \parseargusing\activeparens{\printdefunline\deflineheader}%
7592 }
7593 \def\deflineheader#1 #2 #3\endheader{%
7594 \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
7595 }
7596 \def\deftypeline{%
7597 \doingtypefntrue
7598 \parseargusing\activeparens{\printdefunline\deflineheader}%
7599 }
7600
7601 % \makedefun{deffoo} (\deffooheader parameters) { (\deffooheader expansion) }
7602 %
7603 % Define \deffoo, \deffoox \Edeffoo and \deffooheader.
7604 \def\makedefun#1{%
7605 \expandafter\let\csname E#1\endcsname = \Edefun
7606 \edef\temp{\noexpand\domakedefun
7607 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7608 \temp
7609 }
7610 \def\domakedefun#1#2#3{%
7611 \envdef#1{%
7612 \startdefun
7613 \doingtypefnfalse % distinguish typed functions from all else
7614 \parseargusing\activeparens{\printdefunline#3}%
7615 }%
7616 \def#2{%
7617 % First, check whether we are in the right environment:
7618 \checkenv#1%
7619 %
7620 % As in \startdefun, allow line break if we have multiple x headers
7621 % in a row. It's not a great place, though.
7622 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7623 %
7624 \doingtypefnfalse % distinguish typed functions from all else
7625 \parseargusing\activeparens{\printdefunline#3}%
7626 }%
7627 \def#3% definition of \deffooheader follows
7628 }
7629
7630 \newif\ifdoingtypefn % doing typed function?
7631 \newif\ifrettypeownline % typeset return type on its own line?
7632
7633 % @deftypefnnewline on|off says whether the return type of typed functions
7634 % are printed on their own line. This affects @deftypefn, @deftypefun,
7635 % @deftypeop, and @deftypemethod.
7636 %
7637 \parseargdef\deftypefnnewline{%
7638 \def\temp{#1}%
7639 \ifx\temp\onword
7640 \expandafter\let\csname SETtxideftypefnnl\endcsname
7641 = \empty
7642 \else\ifx\temp\offword
7643 \expandafter\let\csname SETtxideftypefnnl\endcsname
7644 = \relax
7645 \else
7646 \errhelp = \EMsimple
7647 \errmessage{Unknown @txideftypefnnl value `\temp',
7648 must be on|off}%
7649 \fi\fi
7650 }
7651
7652 % Untyped functions:
7653
7654 % @deffn category name args
7655 \makedefun{deffn}#1 #2 #3\endheader{%
7656 \doind{fn}{\code{#2}}%
7657 \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
7658 }
7659
7660 % @defop category class name args
7661 \makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
7662 \def\defopheaderx#1#2 #3 #4\endheader{%
7663 \doind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
7664 \printdefname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
7665 }
7666
7667 % Typed functions:
7668
7669 % @deftypefn category type name args
7670 \makedefun{deftypefn}#1 #2 #3 #4\endheader{%
7671 \doind{fn}{\code{#3}}%
7672 \doingtypefntrue
7673 \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
7674 }
7675
7676 % @deftypeop category class type name args
7677 \makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
7678 \def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
7679 \doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
7680 \doingtypefntrue
7681 \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
7682 }
7683
7684 % Typed variables:
7685
7686 % @deftypevr category type var args
7687 \makedefun{deftypevr}#1 #2 #3 #4\endheader{%
7688 \doind{vr}{\code{#3}}%
7689 \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
7690 }
7691
7692 % @deftypecv category class type var args
7693 \makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
7694 \def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
7695 \doind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
7696 \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
7697 }
7698
7699 % Untyped variables:
7700
7701 % @defvr category var args
7702 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7703
7704 % @defcv category class var args
7705 \makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}}
7706 \def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} }
7707
7708 % Types:
7709
7710 % @deftp category name args
7711 \makedefun{deftp}#1 #2 #3\endheader{%
7712 \doind{tp}{\code{#2}}%
7713 \printdefname{#1}{}{#2}\defunargs{#3\unskip}%
7714 }
7715
7716 % Remaining @defun-like shortcuts:
7717 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7718 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7719 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7720 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7721 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7722 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7723 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7724 \makedefun{defmethod}{\defopheaderx\putwordMethodon}
7725 \makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon}
7726 \makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof}
7727 \makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof}
7728
7729 % \printdefname, which formats the name of the @def (not the args).
7730 % #1 is the category, such as "Function".
7731 % #2 is the return type, if any.
7732 % #3 is the function name.
7733 %
7734 % We are followed by (but not passed) the arguments, if any.
7735 %
7736 \def\printdefname#1#2#3{%
7737 \par
7738 % Get the values of \leftskip and \rightskip as they were outside the @def...
7739 \advance\leftskip by -\defbodyindent
7740 %
7741 % Determine if we are typesetting the return type of a typed function
7742 % on a line by itself.
7743 \rettypeownlinefalse
7744 \ifdoingtypefn % doing a typed function specifically?
7745 % then check user option for putting return type on its own line:
7746 \ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}%
7747 \fi
7748 %
7749 % How we'll format the category name. Putting it in brackets helps
7750 % distinguish it from the body text that may end up on the next line
7751 % just below it.
7752 \def\temp{#1}%
7753 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7754 %
7755 % Figure out line sizes for the paragraph shape. We'll always have at
7756 % least two.
7757 \tempnum = 2
7758 %
7759 % The first line needs space for \box0; but if \rightskip is nonzero,
7760 % we need only space for the part of \box0 which exceeds it:
7761 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7762 %
7763 % If doing a return type on its own line, we'll have another line.
7764 \ifrettypeownline
7765 \advance\tempnum by 1
7766 \def\maybeshapeline{0in \hsize}%
7767 \else
7768 \def\maybeshapeline{}%
7769 \fi
7770 %
7771 % The continuations:
7772 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7773 %
7774 % The final paragraph shape:
7775 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7776 %
7777 % Put the category name at the right margin.
7778 \noindent
7779 \hbox to 0pt{%
7780 \hfil\box0 \kern-\hsize
7781 % \hsize has to be shortened this way:
7782 \kern\leftskip
7783 % Intentionally do not respect \rightskip, since we need the space.
7784 }%
7785 %
7786 % Allow all lines to be underfull without complaint:
7787 \tolerance=10000 \hbadness=10000
7788 \exdentamount=\defbodyindent
7789 {%
7790 % defun fonts. We use typewriter by default (used to be bold) because:
7791 % . we're printing identifiers, they should be in tt in principle.
7792 % . in languages with many accents, such as Czech or French, it's
7793 % common to leave accents off identifiers. The result looks ok in
7794 % tt, but exceedingly strange in rm.
7795 % . we don't want -- and --- to be treated as ligatures.
7796 % . this still does not fix the ?` and !` ligatures, but so far no
7797 % one has made identifiers using them :).
7798 \df \tt
7799 \def\temp{#2}% text of the return type
7800 \ifx\temp\empty\else
7801 \tclose{\temp}% typeset the return type
7802 \ifrettypeownline
7803 % put return type on its own line; prohibit line break following:
7804 \hfil\vadjust{\nobreak}\break
7805 \else
7806 \space % type on same line, so just followed by a space
7807 \fi
7808 \fi % no return type
7809 #3% output function name
7810 }%
7811 \ifflagclear{txidefnamenospace}{%
7812 {\rm\enskip}% hskip 0.5 em of \rmfont
7813 }{}%
7814 %
7815 \boldbrax
7816 % arguments will be output next, if any.
7817 }
7818
7819 % Print arguments. Use slanted for @def*, typewriter for @deftype*.
7820 \def\defunargs#1{%
7821 \bgroup
7822 \df \ifdoingtypefn \tt \else \sl \fi
7823 \ifflagclear{txicodevaristt}{}%
7824 {\def\var##1{{\setregularquotes \ttsl ##1}}}%
7825 #1%
7826 \egroup
7827 }
7828
7829 % We want ()&[] to print specially on the defun line.
7830 %
7831 \def\activeparens{%
7832 \catcode`\(=\active \catcode`\)=\active
7833 \catcode`\[=\active \catcode`\]=\active
7834 \catcode`\&=\active
7835 }
7836
7837 % Make control sequences which act like normal parenthesis chars.
7838 \let\lparen = ( \let\rparen = )
7839
7840 % Be sure that we always have a definition for `(', etc. For example,
7841 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7842 % so TeX would otherwise complain about undefined control sequence.
7843 {
7844 \activeparens
7845 \gdef\defcharsdefault{%
7846 \let(=\lparen \let)=\rparen
7847 \let[=\lbrack \let]=\rbrack
7848 \let& = \&%
7849 }
7850 \globaldefs=1 \defcharsdefault
7851
7852 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7853 \gdef\magicamp{\let&=\amprm}
7854 }
7855 \let\ampchar\&
7856
7857 \newcount\parencount
7858
7859 % If we encounter &foo, then turn on ()-hacking afterwards
7860 \newif\ifampseen
7861 \def\amprm#1 {\ampseentrue{\rm\&#1 }}
7862
7863 \def\parenfont{%
7864 \ifampseen
7865 % At the first level, print parens in roman,
7866 % otherwise use the default font.
7867 \ifnum \parencount=1 \rm \fi
7868 \else
7869 % The \sf parens (in \boldbrax) actually are a little bolder than
7870 % the contained text. This is especially needed for [ and ] .
7871 \sf
7872 \fi
7873 }
7874 \def\infirstlevel#1{%
7875 \ifampseen
7876 \ifnum\parencount=1
7877 #1%
7878 \fi
7879 \fi
7880 }
7881 \def\bfafterword#1 {#1 \bf}
7882
7883 \def\opnr{%
7884 \global\advance\parencount by 1
7885 {\parenfont(}%
7886 \infirstlevel \bfafterword
7887 }
7888 \def\clnr{%
7889 {\parenfont)}%
7890 \infirstlevel \sl
7891 \global\advance\parencount by -1
7892 }
7893
7894 \newcount\brackcount
7895 \def\lbrb{%
7896 \global\advance\brackcount by 1
7897 {\bf[}%
7898 }
7899 \def\rbrb{%
7900 {\bf]}%
7901 \global\advance\brackcount by -1
7902 }
7903
7904 \def\checkparencounts{%
7905 \ifnum\parencount=0 \else \badparencount \fi
7906 \ifnum\brackcount=0 \else \badbrackcount \fi
7907 }
7908 % these should not use \errmessage; the glibc manual, at least, actually
7909 % has such constructs (when documenting function pointers).
7910 \def\badparencount{%
7911 \message{Warning: unbalanced parentheses in @def...}%
7912 \global\parencount=0
7913 }
7914 \def\badbrackcount{%
7915 \message{Warning: unbalanced square brackets in @def...}%
7916 \global\brackcount=0
7917 }
7918
7919
7920 \message{macros,}
7921 % @macro.
7922
7923 % To do this right we need a feature of e-TeX, \scantokens,
7924 % which we arrange to emulate with a temporary file in ordinary TeX.
7925 \ifx\eTeXversion\thisisundefined
7926 \newwrite\macscribble
7927 \def\scantokens#1{%
7928 \toks0={#1}%
7929 \immediate\openout\macscribble=\jobname.tmp
7930 \immediate\write\macscribble{\the\toks0}%
7931 \immediate\closeout\macscribble
7932 \input \jobname.tmp
7933 }
7934 \fi
7935
7936 \let\E=\expandafter
7937
7938 % Used at the time of macro expansion.
7939 % Argument is macro body with arguments substituted
7940 \def\scanmacro#1{%
7941 \newlinechar`\^^M
7942 % expand the expansion of \eatleadingcr twice to maybe remove a leading
7943 % newline (and \else and \fi tokens), then call \eatspaces on the result.
7944 \def\xeatspaces##1{%
7945 \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
7946 }}%
7947 \def\xempty##1{}%
7948 %
7949 % Process the macro body under the current catcode regime.
7950 \scantokens{#1@comment}%
7951 %
7952 % The \comment is to remove the \newlinechar added by \scantokens, and
7953 % can be noticed by \parsearg. Note \c isn't used because this means cedilla
7954 % in math mode.
7955 }
7956
7957 % Used for copying and captions
7958 \def\scanexp#1{%
7959 \expandafter\scanmacro\expandafter{#1}%
7960 }
7961
7962 \newcount\paramno % Count of parameters
7963 \newtoks\macname % Macro name
7964 \newif\ifrecursive % Is it recursive?
7965
7966 % List of all defined macros in the form
7967 % \commondummyword\macro1\commondummyword\macro2...
7968 % Currently is also contains all @aliases; the list can be split
7969 % if there is a need.
7970 \def\macrolist{}
7971
7972 % Add the macro to \macrolist
7973 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7974 \def\addtomacrolistxxx#1{%
7975 \toks0 = \expandafter{\macrolist\commondummyword#1}%
7976 \xdef\macrolist{\the\toks0}%
7977 }
7978
7979 % Utility routines.
7980 % This does \let #1 = #2, with \csnames; that is,
7981 % \let \csname#1\endcsname = \csname#2\endcsname
7982 % (except of course we have to play expansion games).
7983 %
7984 \def\cslet#1#2{%
7985 \expandafter\let
7986 \csname#1\expandafter\endcsname
7987 \csname#2\endcsname
7988 }
7989
7990 % Trim leading and trailing spaces off a string.
7991 % Concepts from aro-bend problem 15 (see CTAN).
7992 {\catcode`\@=11
7993 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7994 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7995 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7996 \def\unbrace#1{#1}
7997 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
7998 }
7999
8000 {\catcode`\^^M=\other%
8001 \gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
8002 % Warning: this won't work for a delimited argument
8003 % or for an empty argument
8004
8005 % Trim a single trailing ^^M off a string.
8006 {\catcode`\^^M=\other \catcode`\Q=3%
8007 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8008 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8009 \gdef\eatcrb#1Q#2Q{#1}%
8010 }
8011
8012 % Macro bodies are absorbed as an argument in a context where
8013 % all characters are catcode 10, 11 or 12, except \ which is active
8014 % (as in normal texinfo). It is necessary to change the definition of \
8015 % to recognize macro arguments; this is the job of \mbodybackslash.
8016 %
8017 % Non-ASCII encodings make 8-bit characters active, so un-activate
8018 % them to avoid their expansion. Must do this non-globally, to
8019 % confine the change to the current group.
8020 %
8021 % It's necessary to have hard CRs when the macro is executed. This is
8022 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8023 % body, and then making it the \newlinechar in \scanmacro.
8024 %
8025 \def\scanctxt{% used as subroutine
8026 \catcode`\"=\other
8027 \catcode`\+=\other
8028 \catcode`\<=\other
8029 \catcode`\>=\other
8030 \catcode`\^=\other
8031 \catcode`\_=\other
8032 \catcode`\|=\other
8033 \catcode`\~=\other
8034 \catcode`\@=\other
8035 \catcode`\^^M=\other
8036 \catcode`\\=\active
8037 \passthroughcharstrue
8038 }
8039
8040 \def\macrobodyctxt{% used for @macro definitions and @copying
8041 \scanctxt
8042 \catcode`\ =\other
8043 \catcode`\{=\other
8044 \catcode`\}=\other
8045 }
8046
8047 % Used when scanning braced macro arguments. Note, however, that catcode
8048 % changes here are ineffectual if the macro invocation was nested inside
8049 % an argument to another Texinfo command.
8050 \def\macroargctxt{%
8051 \scanctxt
8052 \catcode`\ =\active
8053 }
8054
8055 \def\macrolineargctxt{% used for whole-line arguments without braces
8056 \scanctxt
8057 \catcode`\{=\other
8058 \catcode`\}=\other
8059 }
8060
8061 % \mbodybackslash is the definition of \ in @macro bodies.
8062 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8063 % where N is the macro parameter number.
8064 % We define \csname macarg.\endcsname to be \realbackslash, so
8065 % \\ in macro replacement text gets you a backslash.
8066 %
8067 {\catcode`@=0 @catcode`@\=@active
8068 @gdef@usembodybackslash{@let\=@mbodybackslash}
8069 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8070 }
8071 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8072
8073 \def\margbackslash#1{\char`\#1 }
8074
8075 \def\macro{\recursivefalse\parsearg\macroxxx}
8076 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8077
8078 \def\macroxxx#1{%
8079 \getargs{#1}% now \macname is the macname and \argl the arglist
8080 \ifx\argl\empty % no arguments
8081 \paramno=0\relax
8082 \else
8083 \expandafter\parsemargdef \argl;%
8084 \if\paramno>256\relax
8085 \ifx\eTeXversion\thisisundefined
8086 \errhelp = \EMsimple
8087 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8088 \fi
8089 \fi
8090 \fi
8091 \if1\csname ismacro.\the\macname\endcsname
8092 \message{Warning: redefining \the\macname}%
8093 \else
8094 \expandafter\ifx\csname \the\macname\endcsname \relax
8095 \else \errmessage{Macro name \the\macname\space already defined}\fi
8096 \global\cslet{macsave.\the\macname}{\the\macname}%
8097 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8098 \addtomacrolist{\the\macname}%
8099 \fi
8100 \begingroup \macrobodyctxt \usembodybackslash
8101 \ifrecursive \expandafter\parsermacbody
8102 \else \expandafter\parsemacbody
8103 \fi}
8104
8105 \parseargdef\unmacro{%
8106 \if1\csname ismacro.#1\endcsname
8107 \global\cslet{#1}{macsave.#1}%
8108 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8109 % Remove the macro name from \macrolist:
8110 \begingroup
8111 \expandafter\let\csname#1\endcsname \relax
8112 \let\commondummyword\unmacrodo
8113 \xdef\macrolist{\macrolist}%
8114 \endgroup
8115 \else
8116 \errmessage{Macro #1 not defined}%
8117 \fi
8118 }
8119
8120 % Called by \do from \dounmacro on each macro. The idea is to omit any
8121 % macro definitions that have been changed to \relax.
8122 %
8123 \def\unmacrodo#1{%
8124 \ifx #1\relax
8125 % remove this
8126 \else
8127 \noexpand\commondummyword \noexpand#1%
8128 \fi
8129 }
8130
8131 % \getargs -- Parse the arguments to a @macro line. Set \macname to
8132 % the name of the macro, and \argl to the braced argument list.
8133 \def\getargs#1{\getargsxxx#1{}}
8134 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8135 \def\getmacname#1 #2\relax{\macname={#1}}
8136 \def\getmacargs#1{\def\argl{#1}}
8137 % This made use of the feature that if the last token of a
8138 % <parameter list> is #, then the preceding argument is delimited by
8139 % an opening brace, and that opening brace is not consumed.
8140
8141 % Parse the optional {params} list to @macro or @rmacro.
8142 % Set \paramno to the number of arguments,
8143 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8144 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
8145 % list to some hook where the argument is to be expanded. If there are
8146 % less than 10 arguments that hook is to be replaced by ##N where N
8147 % is the position in that list, that is to say the macro arguments are to be
8148 % defined `a la TeX in the macro body.
8149 %
8150 % That gets used by \mbodybackslash (above).
8151 %
8152 % If there are 10 or more arguments, a different technique is used: see
8153 % \parsemmanyargdef.
8154 %
8155 \def\parsemargdef#1;{%
8156 \paramno=0\def\paramlist{}%
8157 \let\hash\relax
8158 % \hash is redefined to `#' later to get it into definitions
8159 \let\xeatspaces\relax
8160 \let\xempty\relax
8161 \parsemargdefxxx#1,;,%
8162 \ifnum\paramno<10\relax\else
8163 \paramno0\relax
8164 \parsemmanyargdef@@#1,;,% 10 or more arguments
8165 \fi
8166 }
8167 \def\parsemargdefxxx#1,{%
8168 \if#1;\let\next=\relax
8169 \else \let\next=\parsemargdefxxx
8170 \advance\paramno by 1
8171 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8172 {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
8173 \edef\paramlist{\paramlist\hash\the\paramno,}%
8174 \fi\next}
8175 % the \xempty{} is to give \eatleadingcr an argument in the case of an
8176 % empty macro argument.
8177
8178 % \parsemacbody, \parsermacbody
8179 %
8180 % Read recursive and nonrecursive macro bodies. (They're different since
8181 % rec and nonrec macros end differently.)
8182 %
8183 % We are in \macrobodyctxt, and the \xdef causes backslashes in the macro
8184 % body to be transformed.
8185 % Set \macrobody to the body of the macro, and call \macrodef.
8186 %
8187 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8188 \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
8189 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8190 \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
8191
8192 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8193 \edef\texiatcatcode{\the\catcode`\@}
8194 \catcode `@=11\relax
8195
8196 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8197
8198 % If there are 10 or more arguments, a different technique is used, where the
8199 % hook remains in the body, and when macro is to be expanded the body is
8200 % processed again to replace the arguments.
8201 %
8202 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8203 % argument N value and then \edef the body (nothing else will expand because of
8204 % the catcode regime under which the body was input).
8205 %
8206 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8207 % arguments, no macro can have more than 256 arguments (else error).
8208 %
8209 % In case that there are 10 or more arguments we parse again the arguments
8210 % list to set new definitions for the \macarg.BLAH macros corresponding to
8211 % each BLAH argument. It was anyhow needed to parse already once this list
8212 % in order to count the arguments, and as macros with at most 9 arguments
8213 % are by far more frequent than macro with 10 or more arguments, defining
8214 % twice the \macarg.BLAH macros does not cost too much processing power.
8215 \def\parsemmanyargdef@@#1,{%
8216 \if#1;\let\next=\relax
8217 \else
8218 \let\next=\parsemmanyargdef@@
8219 \edef\tempb{\eatspaces{#1}}%
8220 \expandafter\def\expandafter\tempa
8221 \expandafter{\csname macarg.\tempb\endcsname}%
8222 % Note that we need some extra \noexpand\noexpand, this is because we
8223 % don't want \the to be expanded in the \parsermacbody as it uses an
8224 % \xdef .
8225 \expandafter\edef\tempa
8226 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8227 \advance\paramno by 1\relax
8228 \fi\next}
8229
8230
8231 \let\endargs@\relax
8232 \let\nil@\relax
8233 \def\nilm@{\nil@}%
8234 \long\def\nillm@{\nil@}%
8235
8236 % This macro is expanded during the Texinfo macro expansion, not during its
8237 % definition. It gets all the arguments' values and assigns them to macros
8238 % macarg.ARGNAME
8239 %
8240 % #1 is the macro name
8241 % #2 is the list of argument names
8242 % #3 is the list of argument values
8243 \def\getargvals@#1#2#3{%
8244 \def\macargdeflist@{}%
8245 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8246 \def\paramlist{#2,\nil@}%
8247 \def\macroname{#1}%
8248 \begingroup
8249 \macroargctxt
8250 \def\argvaluelist{#3,\nil@}%
8251 \def\@tempa{#3}%
8252 \ifx\@tempa\empty
8253 \setemptyargvalues@
8254 \else
8255 \getargvals@@
8256 \fi
8257 }
8258 \def\getargvals@@{%
8259 \ifx\paramlist\nilm@
8260 % Some sanity check needed here that \argvaluelist is also empty.
8261 \ifx\argvaluelist\nillm@
8262 \else
8263 \errhelp = \EMsimple
8264 \errmessage{Too many arguments in macro `\macroname'!}%
8265 \fi
8266 \let\next\macargexpandinbody@
8267 \else
8268 \ifx\argvaluelist\nillm@
8269 % No more arguments values passed to macro. Set remaining named-arg
8270 % macros to empty.
8271 \let\next\setemptyargvalues@
8272 \else
8273 % pop current arg name into \@tempb
8274 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8275 \expandafter\@tempa\expandafter{\paramlist}%
8276 % pop current argument value into \@tempc
8277 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8278 \expandafter\@tempa\expandafter{\argvaluelist}%
8279 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8280 % First place the new argument macro definition into \@tempd
8281 \expandafter\macname\expandafter{\@tempc}%
8282 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8283 \expandafter\def\expandafter\@tempe\expandafter{%
8284 \csname macarg.\@tempb\endcsname}%
8285 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8286 \push@\@tempd\macargdeflist@
8287 \let\next\getargvals@@
8288 \fi
8289 \fi
8290 \next
8291 }
8292
8293 \def\push@#1#2{%
8294 \expandafter\expandafter\expandafter\def
8295 \expandafter\expandafter\expandafter#2%
8296 \expandafter\expandafter\expandafter{%
8297 \expandafter#1#2}%
8298 }
8299
8300 % Replace arguments by their values in the macro body, and place the result
8301 % in macro \@tempa.
8302 %
8303 \def\macvalstoargs@{%
8304 % To do this we use the property that token registers that are \the'ed
8305 % within an \edef expand only once. So we are going to place all argument
8306 % values into respective token registers.
8307 %
8308 % First we save the token context, and initialize argument numbering.
8309 \begingroup
8310 \paramno0\relax
8311 % Then, for each argument number #N, we place the corresponding argument
8312 % value into a new token list register \toks#N
8313 \expandafter\putargsintokens@\saveparamlist@,;,%
8314 % Then, we expand the body so that argument are replaced by their
8315 % values. The trick for values not to be expanded themselves is that they
8316 % are within tokens and that tokens expand only once in an \edef .
8317 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8318 % Now we restore the token stack pointer to free the token list registers
8319 % which we have used, but we make sure that expanded body is saved after
8320 % group.
8321 \expandafter
8322 \endgroup
8323 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8324 }
8325
8326 % Define the named-macro outside of this group and then close this group.
8327 %
8328 \def\macargexpandinbody@{%
8329 \expandafter
8330 \endgroup
8331 \macargdeflist@
8332 % First the replace in body the macro arguments by their values, the result
8333 % is in \@tempa .
8334 \macvalstoargs@
8335 % Then we point at the \norecurse or \gobble (for recursive) macro value
8336 % with \@tempb .
8337 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8338 % Depending on whether it is recursive or not, we need some tailing
8339 % \egroup .
8340 \ifx\@tempb\gobble
8341 \let\@tempc\relax
8342 \else
8343 \let\@tempc\egroup
8344 \fi
8345 % And now we do the real job:
8346 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8347 \@tempd
8348 }
8349
8350 \def\putargsintokens@#1,{%
8351 \if#1;\let\next\relax
8352 \else
8353 \let\next\putargsintokens@
8354 % First we allocate the new token list register, and give it a temporary
8355 % alias \@tempb .
8356 \toksdef\@tempb\the\paramno
8357 % Then we place the argument value into that token list register.
8358 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8359 \expandafter\@tempb\expandafter{\@tempa}%
8360 \advance\paramno by 1\relax
8361 \fi
8362 \next
8363 }
8364
8365 % Trailing missing arguments are set to empty.
8366 %
8367 \def\setemptyargvalues@{%
8368 \ifx\paramlist\nilm@
8369 \let\next\macargexpandinbody@
8370 \else
8371 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8372 \let\next\setemptyargvalues@
8373 \fi
8374 \next
8375 }
8376
8377 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8378 \expandafter\def\expandafter\@tempa\expandafter{%
8379 \expandafter\def\csname macarg.#1\endcsname{}}%
8380 \push@\@tempa\macargdeflist@
8381 \def\paramlist{#2}%
8382 }
8383
8384 % #1 is the element target macro
8385 % #2 is the list macro
8386 % #3,#4\endargs@ is the list value
8387 \def\pop@#1#2#3,#4\endargs@{%
8388 \def#1{#3}%
8389 \def#2{#4}%
8390 }
8391 \long\def\longpop@#1#2#3,#4\endargs@{%
8392 \long\def#1{#3}%
8393 \long\def#2{#4}%
8394 }
8395
8396
8397 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8398
8399
8400 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8401 % \macrobody has the body of the macro in it, with placeholders for
8402 % its parameters, looking like "\xeatspaces{\hash 1}".
8403 % \paramno is the number of parameters
8404 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8405 % There are four cases: macros of zero, one, up to nine, and many arguments.
8406 % \xdef is used so that macro definitions will survive the file
8407 % they're defined in: @include reads the file inside a group.
8408 %
8409 \def\macrodef{%
8410 \let\hash=##% convert placeholders to macro parameter chars
8411 \ifnum\paramno=1
8412 \long\def\xeatspaces##1{##1}%
8413 % We don't use \xeatspaces for single-argument macros, because we
8414 % want to keep ends of lines. This definition removes \xeatspaces
8415 % when \macrobody is expanded below.
8416 \else
8417 \def\xeatspaces{\string\xeatspaces}%
8418 % This expands \xeatspaces as a sequence of character tokens, which
8419 % stops \scantokens inserting an extra space after the control sequence.
8420 \fi
8421 \ifcase\paramno
8422 % 0
8423 \expandafter\xdef\csname\the\macname\endcsname{%
8424 \begingroup
8425 \noexpand\spaceisspace
8426 \noexpand\endlineisspace
8427 \noexpand\expandafter % skip any whitespace after the macro name.
8428 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8429 \expandafter\xdef\csname\the\macname @@@\endcsname{%
8430 \endgroup
8431 \noexpand\scanmacro{\macrobody}}%
8432 \or % 1
8433 \expandafter\xdef\csname\the\macname\endcsname{%
8434 \begingroup
8435 \noexpand\braceorline
8436 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8437 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8438 \endgroup
8439 \noexpand\scanmacro{\macrobody}%
8440 }%
8441 \else % at most 9
8442 \ifnum\paramno<10\relax
8443 % @MACNAME sets the context for reading the macro argument
8444 % @MACNAME@@ gets the argument, processes backslashes and appends a
8445 % comma.
8446 % @MACNAME@@@ removes braces surrounding the argument list.
8447 % @MACNAME@@@@ scans the macro body with arguments substituted.
8448 \expandafter\xdef\csname\the\macname\endcsname{%
8449 \begingroup
8450 \noexpand\expandafter % This \expandafter skip any spaces after the
8451 \noexpand\macroargctxt % macro before we change the catcode of space.
8452 \noexpand\expandafter
8453 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8454 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8455 \noexpand\passargtomacro
8456 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8457 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8458 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8459 \expandafter\expandafter
8460 \expandafter\xdef
8461 \expandafter\expandafter
8462 \csname\the\macname @@@@\endcsname\paramlist{%
8463 \endgroup\noexpand\scanmacro{\macrobody}}%
8464 \else % 10 or more:
8465 \expandafter\xdef\csname\the\macname\endcsname{%
8466 \noexpand\getargvals@{\the\macname}{\argl}%
8467 }%
8468 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8469 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8470 \fi
8471 \fi}
8472
8473 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8474
8475 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8476
8477
8478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8479 %
8480 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8481 @catcode`@_=11 % private names
8482 @catcode`@!=11 % used as argument separator
8483
8484 % \passargtomacro#1#2 -
8485 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8486 % compressed to one.
8487 %
8488 % This implementation works by expansion, and not execution (so we cannot use
8489 % \def or similar). This reduces the risk of this failing in contexts where
8490 % complete expansion is done with no execution (for example, in writing out to
8491 % an auxiliary file for an index entry).
8492 %
8493 % State is kept in the input stream: the argument passed to
8494 % @look_ahead, @gobble_and_check_finish and @add_segment is
8495 %
8496 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8497 %
8498 % where:
8499 % THE_MACRO - name of the macro we want to call
8500 % ARG_RESULT - argument list we build to pass to that macro
8501 % PENDING_BS - either a backslash or nothing
8502 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8503
8504 @gdef@passargtomacro#1#2{%
8505 @add_segment #1!{}@relax#2\@_finish\%
8506 }
8507 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8508
8509 % #1 - THE_MACRO ARG_RESULT
8510 % #2 - PENDING_BS
8511 % #3 - NEXT_TOKEN
8512 % #4 used to look ahead
8513 %
8514 % If the next token is not a backslash, process the rest of the argument;
8515 % otherwise, remove the next token.
8516 @gdef@look_ahead#1!#2#3#4{%
8517 @ifx#4\%
8518 @expandafter@gobble_and_check_finish
8519 @else
8520 @expandafter@add_segment
8521 @fi#1!{#2}#4#4%
8522 }
8523
8524 % #1 - THE_MACRO ARG_RESULT
8525 % #2 - PENDING_BS
8526 % #3 - NEXT_TOKEN
8527 % #4 should be a backslash, which is gobbled.
8528 % #5 looks ahead
8529 %
8530 % Double backslash found. Add a single backslash, and look ahead.
8531 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8532 @add_segment#1\!{}#5#5%
8533 }
8534
8535 @gdef@is_fi{@fi}
8536
8537 % #1 - THE_MACRO ARG_RESULT
8538 % #2 - PENDING_BS
8539 % #3 - NEXT_TOKEN
8540 % #4 is input stream until next backslash
8541 %
8542 % Input stream is either at the start of the argument, or just after a
8543 % backslash sequence, either a lone backslash, or a doubled backslash.
8544 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8545 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8546 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8547 % a backslash just before the start of the input stream that has not been
8548 % added to ARG_RESULT.
8549 @gdef@add_segment#1!#2#3#4\{%
8550 @ifx#3@_finish
8551 @call_the_macro#1!%
8552 @else
8553 % append the pending backslash to the result, followed by the next segment
8554 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8555 % this @fi is discarded by @look_ahead.
8556 % we can't get rid of it with \expandafter because we don't know how
8557 % long #4 is.
8558 }
8559
8560 % #1 - THE_MACRO
8561 % #2 - ARG_RESULT
8562 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8563 % conditional.
8564 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8565
8566 }
8567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8568
8569 % \braceorline MAC is used for a one-argument macro MAC. It checks
8570 % whether the next non-whitespace character is a {. It sets the context
8571 % for reading the argument (slightly different in the two cases). Then,
8572 % to read the argument, in the whole-line case, it then calls the regular
8573 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8574 %
8575 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8576 \def\braceorlinexxx{%
8577 \ifx\nchar\bgroup
8578 \macroargctxt
8579 \expandafter\passargtomacro
8580 \else
8581 \macrolineargctxt\expandafter\parsearg
8582 \fi \macnamexxx}
8583
8584
8585 % @linemacro
8586
8587 \parseargdef\linemacro{%
8588 \getargs{#1}% now \macname is the macname and \argl the arglist
8589 \ifx\argl\empty
8590 \paramno=0
8591 \let\hash\relax
8592 \def\paramlist{\hash 1\endlinemacro}%
8593 \else
8594 \expandafter\linegetparamlist\argl;%
8595 \fi
8596 \begingroup \macrobodyctxt \usembodybackslash
8597 \parselinemacrobody
8598 }
8599
8600 % Build up \paramlist which will be used as the parameter text for the macro.
8601 % At the end it will be like "#1 #2 #3\endlinemacro".
8602 \def\linegetparamlist#1;{%
8603 \paramno=0\def\paramlist{}%
8604 \let\hash\relax
8605 \linegetparamlistxxx#1,;,%
8606 }
8607 \def\linegetparamlistxxx#1,{%
8608 \if#1;\let\next=\linegetparamlistxxxx
8609 \else \let\next=\linegetparamlistxxx
8610 \advance\paramno by 1
8611 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8612 {\hash\the\paramno}%
8613 \edef\paramlist{\paramlist\hash\the\paramno\space}%
8614 \fi\next}
8615 \def\linegetparamlistxxxx{%
8616 \expandafter\fixparamlist\paramlist\fixparamlist
8617 }
8618 % Replace final space token
8619 \def\fixparamlist#1 \fixparamlist{%
8620 \def\paramlist{#1\endlinemacro}%
8621 }
8622
8623 % Read the body of the macro, replacing backslash-surrounded variables
8624 %
8625 {\catcode`\ =\other\long\gdef\parselinemacrobody#1@end linemacro{%
8626 \xdef\macrobody{#1}%
8627 \endgroup
8628 \linemacrodef
8629 }}
8630
8631 % Make the definition
8632 \def\linemacrodef{%
8633 \let\hash=##%
8634 \expandafter\xdef\csname\the\macname\endcsname{%
8635 \bgroup
8636 \noexpand\parsearg
8637 \expandafter\noexpand\csname\the\macname @@\endcsname
8638 }
8639 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8640 \egroup
8641 \expandafter\noexpand
8642 \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
8643 }
8644 \expandafter\expandafter
8645 \expandafter\xdef
8646 \expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
8647 \newlinechar=13 % split \macrobody into lines
8648 \noexpand\scantokens{\macrobody}%
8649 }
8650 }
8651
8652
8653
8654 % @alias.
8655 % We need some trickery to remove the optional spaces around the equal
8656 % sign. Make them active and then expand them all to nothing.
8657 %
8658 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8659 \def\aliasxxx #1{\aliasyyy#1\relax}
8660 \def\aliasyyy #1=#2\relax{%
8661 {%
8662 \expandafter\let\obeyedspace=\empty
8663 \addtomacrolist{#1}%
8664 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8665 }%
8666 \next
8667 }
8668
8669
8670 \message{cross references,}
8671
8672 \newwrite\auxfile
8673 \newif\ifhavexrefs % True if xref values are known.
8674 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8675
8676 % @inforef is relatively simple.
8677 \def\inforef #1{\inforefzzz #1,,,,**}
8678 \def\inforefzzz #1,#2,#3,#4**{%
8679 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8680 node \samp{\ignorespaces#1{}}}
8681
8682 % @node's only job in TeX is to define \lastnode, which is used in
8683 % cross-references. The @node line might or might not have commas, and
8684 % might or might not have spaces before the first comma, like:
8685 % @node foo , bar , ...
8686 % We don't want such trailing spaces in the node name.
8687 %
8688 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8689 %
8690 % also remove a trailing comma, in case of something like this:
8691 % @node Help-Cross, , , Cross-refs
8692 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8693 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
8694
8695 % Used so that the @top node doesn't have to be wrapped in an @ifnottex
8696 % conditional.
8697 % \doignore goes to more effort to skip nested conditionals but we don't need
8698 % that here.
8699 \def\omittopnode{%
8700 \ifx\lastnode\wordTop
8701 \expandafter\ignorenode\fi
8702 }
8703 \def\wordTop{Top}
8704
8705 % Until the next @node, @part or @bye command, divert output to a box that
8706 % is not output.
8707 \def\ignorenode{\setbox\dummybox\vbox\bgroup
8708 \def\part{\egroup\part}%
8709 \def\node{\egroup\node}%
8710 \ignorenodebye
8711 }
8712
8713 {\let\bye\relax
8714 \gdef\ignorenodebye{\let\bye\ignorenodebyedef}
8715 \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
8716 % The redefinition of \bye here is because it is declared \outer
8717
8718 \let\lastnode=\empty
8719
8720 % Write a cross-reference definition for the current node. #1 is the
8721 % type (Ynumbered, Yappendix, Ynothing).
8722 %
8723 \def\donoderef#1{%
8724 \ifx\lastnode\empty\else
8725 \setref{\lastnode}{#1}%
8726 \global\let\lastnode=\empty
8727 \fi
8728 }
8729
8730 % @anchor{NAME} -- define xref target at arbitrary point.
8731 %
8732 \newcount\savesfregister
8733 %
8734 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8735 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8736 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8737
8738 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8739 % anchor), which consists of three parts:
8740 % 1) NAME-title - the current sectioning name taken from \currentsection,
8741 % or the anchor name.
8742 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8743 % empty for anchors.
8744 % 3) NAME-pg - the page number.
8745 %
8746 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8747 % floats, there is an additional part, which is not written here:
8748 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8749 %
8750 \def\setref#1#2{%
8751 \pdfmkdest{#1}%
8752 \iflinks
8753 {%
8754 \requireauxfile
8755 \atdummies % preserve commands, but don't expand them
8756 % match definition in \xrdef, \refx, \xrefX.
8757 \def\value##1{##1}%
8758 \edef\writexrdef##1##2{%
8759 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8760 ##1}{##2}}% these are parameters of \writexrdef
8761 }%
8762 \toks0 = \expandafter{\currentsection}%
8763 \immediate \writexrdef{title}{\the\toks0 }%
8764 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8765 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8766 }%
8767 \fi
8768 }
8769
8770 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8771 % automatically in xrefs, if the third arg is not explicitly specified.
8772 % This was provided as a "secret" @set xref-automatic-section-title
8773 % variable, now it's official.
8774 %
8775 \parseargdef\xrefautomaticsectiontitle{%
8776 \def\temp{#1}%
8777 \ifx\temp\onword
8778 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8779 = \empty
8780 \else\ifx\temp\offword
8781 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8782 = \relax
8783 \else
8784 \errhelp = \EMsimple
8785 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8786 must be on|off}%
8787 \fi\fi
8788 }
8789
8790 %
8791 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8792 % the node name, #2 the name of the Info cross-reference, #3 the printed
8793 % node name, #4 the name of the Info file, #5 the name of the printed
8794 % manual. All but the node name can be omitted.
8795 %
8796 \def\pxref{\putwordsee{} \xrefXX}
8797 \def\xref{\putwordSee{} \xrefXX}
8798 \def\ref{\xrefXX}
8799
8800 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8801 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8802 %
8803 \newbox\toprefbox
8804 \newbox\printedrefnamebox
8805 \newbox\infofilenamebox
8806 \newbox\printedmanualbox
8807 %
8808 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8809 \unsepspaces
8810 %
8811 \getprintedrefname{#1}{#3}{#5}%
8812 \def\infofilename{\ignorespaces #4}%
8813 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8814 %
8815 \startxreflink{#1}{#4}%
8816 {%
8817 % Have to otherify everything special to allow the \csname to
8818 % include an _ in the xref name, etc.
8819 \indexnofonts
8820 \turnoffactive
8821 \def\value##1{##1}%
8822 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8823 \csname XR#1-title\endcsname
8824 }%
8825 %
8826 % Float references are printed completely differently: "Figure 1.2"
8827 % instead of "[somenode], p.3". \iffloat distinguishes them by
8828 % \Xthisreftitle being set to a magic string.
8829 \iffloat\Xthisreftitle
8830 % If the user specified the print name (third arg) to the ref,
8831 % print it instead of our usual "Figure 1.2".
8832 \ifdim\wd\printedrefnamebox = 0pt
8833 \refx{#1-snt}%
8834 \else
8835 \printedrefname
8836 \fi
8837 %
8838 % If the user also gave the printed manual name (fifth arg), append
8839 % "in MANUALNAME".
8840 \ifdim \wd\printedmanualbox > 0pt
8841 \space \putwordin{} \cite{\printedmanual}%
8842 \fi
8843 \else
8844 % node/anchor (non-float) references.
8845 %
8846 % If we use \unhbox to print the node names, TeX does not insert
8847 % empty discretionaries after hyphens, which means that it will not
8848 % find a line break at a hyphen in a node names. Since some manuals
8849 % are best written with fairly long node names, containing hyphens,
8850 % this is a loss. Therefore, we give the text of the node name
8851 % again, so it is as if TeX is seeing it for the first time.
8852 %
8853 \ifdim \wd\printedmanualbox > 0pt
8854 % Cross-manual reference with a printed manual name.
8855 %
8856 \crossmanualxref{\cite{\printedmanual\unskip}}%
8857 %
8858 \else\ifdim \wd\infofilenamebox > 0pt
8859 % Cross-manual reference with only an info filename (arg 4), no
8860 % printed manual name (arg 5). This is essentially the same as
8861 % the case above; we output the filename, since we have nothing else.
8862 %
8863 \crossmanualxref{\code{\infofilename\unskip}}%
8864 %
8865 \else
8866 % Reference within this manual.
8867 %
8868 % Only output a following space if the -snt ref is nonempty, as the ref
8869 % will be empty for @unnumbered and @anchor.
8870 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
8871 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8872 %
8873 % output the `[mynode]' via the macro below so it can be overridden.
8874 \xrefprintnodename\printedrefname
8875 %
8876 \ifflagclear{txiomitxrefpg}{%
8877 % We always want a comma
8878 ,%
8879 % output the `page 3'.
8880 \turnoffactive \putpageref{#1}%
8881 % Add a , if xref followed by a space
8882 \if\space\noexpand\tokenafterxref ,%
8883 \else\ifx\ \tokenafterxref ,% @TAB
8884 \else\ifx\*\tokenafterxref ,% @*
8885 \else\ifx\ \tokenafterxref ,% @SPACE
8886 \else\ifx\
8887 \tokenafterxref ,% @NL
8888 \else\ifx\tie\tokenafterxref ,% @tie
8889 \fi\fi\fi\fi\fi\fi
8890 }{}%
8891 \fi\fi
8892 \fi
8893 \endlink
8894 \endgroup}
8895
8896 % \getprintedrefname{NODE}{LABEL}{MANUAL}
8897 % - set \printedrefname and \printedmanual
8898 %
8899 \def\getprintedrefname#1#2#3{%
8900 % Get args without leading/trailing spaces.
8901 \def\printedrefname{\ignorespaces #2}%
8902 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8903 %
8904 \def\printedmanual{\ignorespaces #3}%
8905 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8906 %
8907 % If the printed reference name (arg #2) was not explicitly given in
8908 % the @xref, figure out what we want to use.
8909 \ifdim \wd\printedrefnamebox = 0pt
8910 % No printed node name was explicitly given.
8911 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8912 % Not auto section-title: use node name inside the square brackets.
8913 \def\printedrefname{\ignorespaces #1}%
8914 \else
8915 % Auto section-title: use chapter/section title inside
8916 % the square brackets if we have it.
8917 \ifdim \wd\printedmanualbox > 0pt
8918 % It is in another manual, so we don't have it; use node name.
8919 \def\printedrefname{\ignorespaces #1}%
8920 \else
8921 \ifhavexrefs
8922 % We (should) know the real title if we have the xref values.
8923 \def\printedrefname{\refx{#1-title}}%
8924 \else
8925 % Otherwise just copy the Info node name.
8926 \def\printedrefname{\ignorespaces #1}%
8927 \fi%
8928 \fi
8929 \fi
8930 \fi
8931 }
8932
8933 % \startxreflink{NODE}{FILE} - start link in pdf output.
8934 \def\startxreflink#1#2{%
8935 \ifpdforxetex
8936 % For pdfTeX and LuaTeX
8937 {\indexnofonts
8938 \makevalueexpandable
8939 \turnoffactive
8940 % This expands tokens, so do it after making catcode changes, so _
8941 % etc. don't get their TeX definitions. This ignores all spaces in
8942 % #2, including (wrongly) those in the middle of the filename.
8943 \getfilename{#2}%
8944 %
8945 % This (wrongly) does not take account of leading or trailing
8946 % spaces in #1, which should be ignored.
8947 \setpdfdestname{#1}%
8948 %
8949 \ifx\pdfdestname\empty
8950 \def\pdfdestname{Top}% no empty targets
8951 \fi
8952 %
8953 \leavevmode
8954 \ifpdf
8955 \startlink attr{/Border [0 0 0]}%
8956 \ifnum\filenamelength>0
8957 goto file{\the\filename.pdf} name{\pdfdestname}%
8958 \else
8959 goto name{\pdfmkpgn{\pdfdestname}}%
8960 \fi
8961 \else % XeTeX
8962 \ifnum\filenamelength>0
8963 % With default settings,
8964 % XeTeX (xdvipdfmx) replaces link destination names with integers.
8965 % In this case, the replaced destination names of
8966 % remote PDFs are no longer known. In order to avoid a replacement,
8967 % you can use xdvipdfmx's command line option `-C 0x0010'.
8968 % If you use XeTeX 0.99996+ (TeX Live 2016+),
8969 % this command line option is no longer necessary
8970 % because we can use the `dvipdfmx:config' special.
8971 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8972 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
8973 \else
8974 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8975 << /S /GoTo /D (\pdfdestname) >> >>}%
8976 \fi
8977 \fi
8978 }%
8979 \setcolor{\linkcolor}%
8980 \fi
8981 }
8982
8983 % can be overridden in translation files
8984 \def\putpageref#1{%
8985 \space\putwordpage\tie\refx{#1-pg}}
8986
8987 % Output a cross-manual xref to #1. Used just above (twice).
8988 %
8989 % Only include the text "Section ``foo'' in" if the foo is neither
8990 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
8991 % "see The Foo Manual", the idea being to refer to the whole manual.
8992 %
8993 % But, this being TeX, we can't easily compare our node name against the
8994 % string "Top" while ignoring the possible spaces before and after in
8995 % the input. By adding the arbitrary 7sp below, we make it much less
8996 % likely that a real node name would have the same width as "Top" (e.g.,
8997 % in a monospaced font). Hopefully it will never happen in practice.
8998 %
8999 % For the same basic reason, we retypeset the "Top" at every
9000 % reference, since the current font is indeterminate.
9001 %
9002 \def\crossmanualxref#1{%
9003 \setbox\toprefbox = \hbox{Top\kern7sp}%
9004 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
9005 \ifdim \wd2 > 7sp % nonempty?
9006 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
9007 \putwordSection{} ``\printedrefname'' \putwordin{}\space
9008 \fi
9009 \fi
9010 #1%
9011 }
9012
9013 % This macro is called from \xrefX for the `[nodename]' part of xref
9014 % output. It's a separate macro only so it can be changed more easily,
9015 % since square brackets don't work well in some documents. Particularly
9016 % one that Bob is working on :).
9017 %
9018 \def\xrefprintnodename#1{[#1]}
9019
9020 % @link{NODENAME, LABEL, MANUAL} - create a "plain" link, with no
9021 % page number. Not useful if printed on paper.
9022 %
9023 \def\link#1{\linkX[#1,,,]}
9024 \def\linkX[#1,#2,#3,#4]{%
9025 \begingroup
9026 \getprintedrefname{#1}{#2}{#3}%
9027 \startxreflink{#1}{#3}%
9028 \printedrefname
9029 \endlink
9030 \endgroup
9031 }
9032
9033
9034 % Things referred to by \setref.
9035 %
9036 \def\Ynothing{}
9037 \def\Yomitfromtoc{}
9038 \def\Ynumbered{%
9039 \ifnum\secno=0
9040 \putwordChapter@tie \the\chapno
9041 \else \ifnum\subsecno=0
9042 \putwordSection@tie \the\chapno.\the\secno
9043 \else \ifnum\subsubsecno=0
9044 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9045 \else
9046 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9047 \fi\fi\fi
9048 }
9049 \def\Yappendix{%
9050 \ifnum\secno=0
9051 \putwordAppendix@tie @char\the\appendixno{}%
9052 \else \ifnum\subsecno=0
9053 \putwordSection@tie @char\the\appendixno.\the\secno
9054 \else \ifnum\subsubsecno=0
9055 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9056 \else
9057 \putwordSection@tie
9058 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9059 \fi\fi\fi
9060 }
9061
9062 % \refx{NAME} - reference a cross-reference string named NAME.
9063 \def\refx#1{%
9064 \requireauxfile
9065 {%
9066 \indexnofonts
9067 \turnoffactive
9068 \def\value##1{##1}%
9069 \expandafter\global\expandafter\let\expandafter\thisrefX
9070 \csname XR#1\endcsname
9071 }%
9072 \ifx\thisrefX\relax
9073 % If not defined, say something at least.
9074 \angleleft un\-de\-fined\angleright
9075 \iflinks
9076 \ifhavexrefs
9077 {\toks0 = {#1}% avoid expansion of possibly-complex value
9078 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9079 \else
9080 \ifwarnedxrefs\else
9081 \global\warnedxrefstrue
9082 \message{Cross reference values unknown; you must run TeX again.}%
9083 \fi
9084 \fi
9085 \fi
9086 \else
9087 % It's defined, so just use it.
9088 \thisrefX
9089 \fi
9090 }
9091
9092 % This is the macro invoked by entries in the aux file. Define a control
9093 % sequence for a cross-reference target (we prepend XR to the control sequence
9094 % name to avoid collisions). The value is the page number. If this is a float
9095 % type, we have more work to do.
9096 %
9097 \def\xrdef#1#2{%
9098 {% Expand the node or anchor name to remove control sequences.
9099 % \turnoffactive stops 8-bit characters being changed to commands
9100 % like @'e. \refx does the same to retrieve the value in the definition.
9101 \indexnofonts
9102 \turnoffactive
9103 \def\value##1{##1}%
9104 \xdef\safexrefname{#1}%
9105 }%
9106 %
9107 \bgroup
9108 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
9109 \egroup
9110 % We put the \gdef inside a group to avoid the definitions building up on
9111 % TeX's save stack, which can cause it to run out of space for aux files with
9112 % thousands of lines. \gdef doesn't use the save stack, but \csname does
9113 % when it defines an unknown control sequence as \relax.
9114 %
9115 % Was that xref control sequence that we just defined for a float?
9116 \expandafter\iffloat\csname XR\safexrefname\endcsname
9117 % it was a float, and we have the (safe) float type in \iffloattype.
9118 \expandafter\let\expandafter\floatlist
9119 \csname floatlist\iffloattype\endcsname
9120 %
9121 % Is this the first time we've seen this float type?
9122 \expandafter\ifx\floatlist\relax
9123 \toks0 = {\do}% yes, so just \do
9124 \else
9125 % had it before, so preserve previous elements in list.
9126 \toks0 = \expandafter{\floatlist\do}%
9127 \fi
9128 %
9129 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9130 % for later use in \listoffloats.
9131 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9132 {\safexrefname}}%
9133 \fi
9134 }
9135
9136 % If working on a large document in chapters, it is convenient to
9137 % be able to disable indexing, cross-referencing, and contents, for test runs.
9138 % This is done with @novalidate at the beginning of the file.
9139 %
9140 \newif\iflinks \linkstrue % by default we want the aux files.
9141 \let\novalidate = \linksfalse
9142
9143 % Used when writing to the aux file, or when using data from it.
9144 \def\requireauxfile{%
9145 \iflinks
9146 \tryauxfile
9147 % Open the new aux file. TeX will close it automatically at exit.
9148 \immediate\openout\auxfile=\jobname.aux
9149 \fi
9150 \global\let\requireauxfile=\relax % Only do this once.
9151 }
9152
9153 % Read the last existing aux file, if any. No error if none exists.
9154 %
9155 \def\tryauxfile{%
9156 \openin 1 \jobname.aux
9157 \ifeof 1 \else
9158 \readdatafile{aux}%
9159 \global\havexrefstrue
9160 \fi
9161 \closein 1
9162 }
9163
9164 \def\setupdatafile{%
9165 \catcode`\^^@=\other
9166 \catcode`\^^A=\other
9167 \catcode`\^^B=\other
9168 \catcode`\^^C=\other
9169 \catcode`\^^D=\other
9170 \catcode`\^^E=\other
9171 \catcode`\^^F=\other
9172 \catcode`\^^G=\other
9173 \catcode`\^^H=\other
9174 \catcode`\^^K=\other
9175 \catcode`\^^L=\other
9176 \catcode`\^^N=\other
9177 \catcode`\^^P=\other
9178 \catcode`\^^Q=\other
9179 \catcode`\^^R=\other
9180 \catcode`\^^S=\other
9181 \catcode`\^^T=\other
9182 \catcode`\^^U=\other
9183 \catcode`\^^V=\other
9184 \catcode`\^^W=\other
9185 \catcode`\^^X=\other
9186 \catcode`\^^Z=\other
9187 \catcode`\^^[=\other
9188 \catcode`\^^\=\other
9189 \catcode`\^^]=\other
9190 \catcode`\^^^=\other
9191 \catcode`\^^_=\other
9192 \catcode`\^=\other
9193 %
9194 % Special characters. Should be turned off anyway, but...
9195 \catcode`\~=\other
9196 \catcode`\[=\other
9197 \catcode`\]=\other
9198 \catcode`\"=\other
9199 \catcode`\_=\active
9200 \catcode`\|=\active
9201 \catcode`\<=\active
9202 \catcode`\>=\active
9203 \catcode`\$=\other
9204 \catcode`\#=\other
9205 \catcode`\&=\other
9206 \catcode`\%=\other
9207 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9208 %
9209 \catcode`\\=\active
9210 %
9211 % @ is our escape character in .aux files, and we need braces.
9212 \catcode`\{=1
9213 \catcode`\}=2
9214 \catcode`\@=0
9215 }
9216
9217 \def\readdatafile#1{%
9218 \begingroup
9219 \setupdatafile
9220 \input\jobname.#1
9221 \endgroup}
9222
9223
9224 \message{insertions,}
9225 % including footnotes.
9226
9227 \newcount \footnoteno
9228
9229 % The trailing space in the following definition for supereject is
9230 % vital for proper filling; pages come out unaligned when you do a
9231 % pagealignmacro call if that space before the closing brace is
9232 % removed. (Generally, numeric constants should always be followed by a
9233 % space to prevent strange expansion errors.)
9234 \def\supereject{\par\penalty -20000\footnoteno =0 }
9235
9236 % @footnotestyle is meaningful for Info output only.
9237 \let\footnotestyle=\comment
9238
9239 {\catcode `\@=11
9240 %
9241 % Auto-number footnotes. Otherwise like plain.
9242 \gdef\footnote{%
9243 \global\advance\footnoteno by \@ne
9244 \edef\thisfootno{$^{\the\footnoteno}$}%
9245 %
9246 % In case the footnote comes at the end of a sentence, preserve the
9247 % extra spacing after we do the footnote number.
9248 \let\@sf\empty
9249 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9250 %
9251 % Remove inadvertent blank space before typesetting the footnote number.
9252 \unskip
9253 \thisfootno\@sf
9254 \dofootnote
9255 }%
9256
9257 % Don't bother with the trickery in plain.tex to not require the
9258 % footnote text as a parameter. Our footnotes don't need to be so general.
9259 %
9260 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9261 % \parseargline) fails inside footnotes because the tokens are fixed when
9262 % the footnote is read. --karl, 16nov96.
9263 %
9264 \gdef\dofootnote{%
9265 \insert\footins\bgroup
9266 %
9267 % Nested footnotes are not supported in TeX, that would take a lot
9268 % more work. (\startsavinginserts does not suffice.)
9269 \let\footnote=\errfootnotenest
9270 %
9271 % We want to typeset this text as a normal paragraph, even if the
9272 % footnote reference occurs in (for example) a display environment.
9273 % So reset some parameters.
9274 \hsize=\txipagewidth
9275 \interlinepenalty\interfootnotelinepenalty
9276 \splittopskip\ht\strutbox % top baseline for broken footnotes
9277 \splitmaxdepth\dp\strutbox
9278 \floatingpenalty\@MM
9279 \leftskip\z@skip
9280 \rightskip\z@skip
9281 \spaceskip\z@skip
9282 \xspaceskip\z@skip
9283 \parindent\defaultparindent
9284 %
9285 \smallfonts \rm
9286 %
9287 % Because we use hanging indentation in footnotes, a @noindent appears
9288 % to exdent this text, so make it be a no-op. makeinfo does not use
9289 % hanging indentation so @noindent can still be needed within footnote
9290 % text after an @example or the like (not that this is good style).
9291 \let\noindent = \relax
9292 %
9293 % Hang the footnote text off the number. Use \everypar in case the
9294 % footnote extends for more than one paragraph.
9295 \everypar = {\hang}%
9296 \textindent{\thisfootno}%
9297 %
9298 % Don't crash into the line above the footnote text. Since this
9299 % expands into a box, it must come within the paragraph, lest it
9300 % provide a place where TeX can split the footnote.
9301 \footstrut
9302 %
9303 % Invoke rest of plain TeX footnote routine.
9304 \futurelet\next\fo@t
9305 }
9306 }%end \catcode `\@=11
9307
9308 \def\errfootnotenest{%
9309 \errhelp=\EMsimple
9310 \errmessage{Nested footnotes not supported in texinfo.tex,
9311 even though they work in makeinfo; sorry}
9312 }
9313
9314 \def\errfootnoteheading{%
9315 \errhelp=\EMsimple
9316 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9317 }
9318
9319 % In case a @footnote appears in a vbox, save the footnote text and create
9320 % the real \insert just after the vbox finished. Otherwise, the insertion
9321 % would be lost.
9322 % Similarly, if a @footnote appears inside an alignment, save the footnote
9323 % text to a box and make the \insert when a row of the table is finished.
9324 % And the same can be done for other insert classes. --kasal, 16nov03.
9325 %
9326 % Replace the \insert primitive by a cheating macro.
9327 % Deeper inside, just make sure that the saved insertions are not spilled
9328 % out prematurely.
9329 %
9330 \def\startsavinginserts{%
9331 \ifx \insert\ptexinsert
9332 \let\insert\saveinsert
9333 \else
9334 \let\checkinserts\relax
9335 \fi
9336 }
9337
9338 % This \insert replacement works for both \insert\footins{foo} and
9339 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9340 %
9341 \def\saveinsert#1{%
9342 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9343 \afterassignment\next
9344 % swallow the left brace
9345 \let\temp =
9346 }
9347 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9348 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9349
9350 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9351
9352 \def\placesaveins#1{%
9353 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9354 {\box#1}%
9355 }
9356
9357 % eat @SAVE -- beware, all of them have catcode \other:
9358 {
9359 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9360 \gdef\gobblesave @SAVE{}
9361 }
9362
9363 % initialization:
9364 \def\newsaveins #1{%
9365 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9366 \next
9367 }
9368 \def\newsaveinsX #1{%
9369 \csname newbox\endcsname #1%
9370 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9371 \checksaveins #1}%
9372 }
9373
9374 % initialize:
9375 \let\checkinserts\empty
9376 \newsaveins\footins
9377 \newsaveins\margin
9378
9379
9380 % @image. We use the macros from epsf.tex to support this.
9381 % If epsf.tex is not installed and @image is used, we complain.
9382 %
9383 % Check for and read epsf.tex up front. If we read it only at @image
9384 % time, we might be inside a group, and then its definitions would get
9385 % undone and the next image would fail.
9386 \openin 1 = epsf.tex
9387 \ifeof 1 \else
9388 % Do not bother showing banner with epsf.tex v2.7k (available in
9389 % doc/epsf.tex and on ctan).
9390 \def\epsfannounce{\toks0 = }%
9391 \input epsf.tex
9392 \fi
9393 \closein 1
9394 %
9395 % We will only complain once about lack of epsf.tex.
9396 \newif\ifwarnednoepsf
9397 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9398 work. It is also included in the Texinfo distribution, or you can get
9399 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
9400 %
9401 \def\image#1{%
9402 \ifx\epsfbox\thisisundefined
9403 \ifwarnednoepsf \else
9404 \errhelp = \noepsfhelp
9405 \errmessage{epsf.tex not found, images will be ignored}%
9406 \global\warnednoepsftrue
9407 \fi
9408 \else
9409 \imagexxx #1,,,,,\finish
9410 \fi
9411 }
9412
9413 % Approximate height of a line in the standard text font.
9414 \newdimen\capheight
9415 \setbox0=\vbox{\tenrm H}
9416 \capheight=\ht0
9417
9418 %
9419 % Arguments to @image:
9420 % #1 is (mandatory) image filename; we tack on .eps extension.
9421 % #2 is (optional) width, #3 is (optional) height.
9422 % #4 is (ignored optional) html alt text.
9423 % #5 is (ignored optional) extension.
9424 % #6 is just the usual extra ignored arg for parsing stuff.
9425 \newif\ifimagevmode
9426 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9427 \catcode`\^^M = 5 % in case we're inside an example
9428 \normalturnoffactive % allow _ et al. in names
9429 \makevalueexpandable
9430 \ifvmode
9431 \imagevmodetrue
9432 \medskip
9433 % Usually we'll have text after the image which will insert
9434 % \parskip glue, so insert it here too to equalize the space
9435 % above and below.
9436 \vskip\parskip
9437 %
9438 % Place image in a \vtop for a top page margin that is (close to) correct,
9439 % as \topskip glue is relative to the first baseline.
9440 \vtop\bgroup \kern -\capheight \vskip-\parskip
9441 \fi
9442 %
9443 \ifx\centersub\centerV
9444 % For @center @image, enter vertical mode and add vertical space
9445 % Enter an extra \parskip because @center doesn't add space itself.
9446 \vbox\bgroup\vskip\parskip\medskip\vskip\parskip
9447 \else
9448 % Enter horizontal mode so that indentation from an enclosing
9449 % environment such as @quotation is respected.
9450 % However, if we're at the top level, we don't want the
9451 % normal paragraph indentation.
9452 \imageindent
9453 \fi
9454 %
9455 % Output the image.
9456 \ifpdf
9457 % For pdfTeX and LuaTeX <= 0.80
9458 \dopdfimage{#1}{#2}{#3}%
9459 \else
9460 \ifx\XeTeXrevision\thisisundefined
9461 % For epsf.tex
9462 % \epsfbox itself resets \epsf?size at each figure.
9463 \setbox0 = \hbox{\ignorespaces #2}%
9464 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9465 \setbox0 = \hbox{\ignorespaces #3}%
9466 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9467 \epsfbox{#1.eps}%
9468 \else
9469 % For XeTeX
9470 \doxeteximage{#1}{#2}{#3}%
9471 \fi
9472 \fi
9473 %
9474 \ifimagevmode
9475 \egroup
9476 \medskip % space after a standalone image
9477 \fi
9478 \ifx\centersub\centerV % @center @image
9479 \medskip
9480 \egroup % close \vbox
9481 \fi
9482 \endgroup}
9483
9484
9485 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9486 % etc. We don't actually implement floating yet, we always include the
9487 % float "here". But it seemed the best name for the future.
9488 %
9489 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9490
9491 % There may be a space before second and/or third parameter; delete it.
9492 \def\eatcommaspace#1, {#1,}
9493
9494 % #1 is the optional FLOATTYPE, the text label for this float, typically
9495 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9496 % this float will not be numbered and cannot be referred to.
9497 %
9498 % #2 is the optional xref label. Also must be present for the float to
9499 % be referable.
9500 %
9501 % #3 is the optional positioning argument; for now, it is ignored. It
9502 % will somehow specify the positions allowed to float to (here, top, bottom).
9503 %
9504 % We keep a separate counter for each FLOATTYPE, which we reset at each
9505 % chapter-level command.
9506 \let\resetallfloatnos=\empty
9507 %
9508 \def\dofloat#1,#2,#3,#4\finish{%
9509 \let\thiscaption=\empty
9510 \let\thisshortcaption=\empty
9511 %
9512 % don't lose footnotes inside @float.
9513 %
9514 % BEWARE: when the floats start float, we have to issue warning whenever an
9515 % insert appears inside a float which could possibly float. --kasal, 26may04
9516 %
9517 \startsavinginserts
9518 %
9519 % We can't be used inside a paragraph.
9520 \par
9521 %
9522 \vtop\bgroup
9523 \def\floattype{#1}%
9524 \def\floatlabel{#2}%
9525 \def\floatloc{#3}% we do nothing with this yet.
9526 %
9527 \ifx\floattype\empty
9528 \let\safefloattype=\empty
9529 \else
9530 {%
9531 % the floattype might have accents or other special characters,
9532 % but we need to use it in a control sequence name.
9533 \indexnofonts
9534 \turnoffactive
9535 \xdef\safefloattype{\floattype}%
9536 }%
9537 \fi
9538 %
9539 % If label is given but no type, we handle that as the empty type.
9540 \ifx\floatlabel\empty \else
9541 % We want each FLOATTYPE to be numbered separately (Figure 1,
9542 % Table 1, Figure 2, ...). (And if no label, no number.)
9543 %
9544 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9545 \global\advance\floatno by 1
9546 %
9547 {%
9548 % This magic value for \currentsection is output by \setref as the
9549 % XREFLABEL-title value. \xrefX uses it to distinguish float
9550 % labels (which have a completely different output format) from
9551 % node and anchor labels. And \xrdef uses it to construct the
9552 % lists of floats.
9553 %
9554 \edef\currentsection{\floatmagic=\safefloattype}%
9555 \setref{\floatlabel}{Yfloat}%
9556 }%
9557 \fi
9558 %
9559 % start with \parskip glue, I guess.
9560 \vskip\parskip
9561 %
9562 % Don't suppress indentation if a float happens to start a section.
9563 \restorefirstparagraphindent
9564 }
9565
9566 % we have these possibilities:
9567 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9568 % @float Foo,lbl & no caption: Foo 1.1
9569 % @float Foo & @caption{Cap}: Foo: Cap
9570 % @float Foo & no caption: Foo
9571 % @float ,lbl & Caption{Cap}: 1.1: Cap
9572 % @float ,lbl & no caption: 1.1
9573 % @float & @caption{Cap}: Cap
9574 % @float & no caption:
9575 %
9576 \def\Efloat{%
9577 \let\floatident = \empty
9578 %
9579 % In all cases, if we have a float type, it comes first.
9580 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9581 %
9582 % If we have an xref label, the number comes next.
9583 \ifx\floatlabel\empty \else
9584 \ifx\floattype\empty \else % if also had float type, need tie first.
9585 \appendtomacro\floatident{\tie}%
9586 \fi
9587 % the number.
9588 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9589 \fi
9590 %
9591 % Start the printed caption with what we've constructed in
9592 % \floatident, but keep it separate; we need \floatident again.
9593 \let\captionline = \floatident
9594 %
9595 \ifx\thiscaption\empty \else
9596 \ifx\floatident\empty \else
9597 \appendtomacro\captionline{: }% had ident, so need a colon between
9598 \fi
9599 %
9600 % caption text.
9601 \appendtomacro\captionline{\scanexp\thiscaption}%
9602 \fi
9603 %
9604 % If we have anything to print, print it, with space before.
9605 % Eventually this needs to become an \insert.
9606 \ifx\captionline\empty \else
9607 \vskip.5\parskip
9608 \captionline
9609 %
9610 % Space below caption.
9611 \vskip\parskip
9612 \fi
9613 %
9614 % If have an xref label, write the list of floats info. Do this
9615 % after the caption, to avoid chance of it being a breakpoint.
9616 \ifx\floatlabel\empty \else
9617 % Write the text that goes in the lof to the aux file as
9618 % \floatlabel-lof. Besides \floatident, we include the short
9619 % caption if specified, else the full caption if specified, else nothing.
9620 {%
9621 \requireauxfile
9622 \atdummies
9623 %
9624 \ifx\thisshortcaption\empty
9625 \def\gtemp{\thiscaption}%
9626 \else
9627 \def\gtemp{\thisshortcaption}%
9628 \fi
9629 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9630 \ifx\gtemp\empty \else : \gtemp \fi}}%
9631 }%
9632 \fi
9633 \egroup % end of \vtop
9634 %
9635 \checkinserts
9636 }
9637
9638 % Append the tokens #2 to the definition of macro #1, not expanding either.
9639 %
9640 \def\appendtomacro#1#2{%
9641 \expandafter\def\expandafter#1\expandafter{#1#2}%
9642 }
9643
9644 % @caption, @shortcaption
9645 %
9646 \def\caption{\docaption\thiscaption}
9647 \def\shortcaption{\docaption\thisshortcaption}
9648 \def\docaption{\checkenv\float \bgroup\scanctxt\docaptionz}
9649 \def\docaptionz#1#2{\egroup \def#1{#2}}
9650
9651 % The parameter is the control sequence identifying the counter we are
9652 % going to use. Create it if it doesn't exist and assign it to \floatno.
9653 \def\getfloatno#1{%
9654 \ifx#1\relax
9655 % Haven't seen this figure type before.
9656 \csname newcount\endcsname #1%
9657 %
9658 % Remember to reset this floatno at the next chap.
9659 \expandafter\gdef\expandafter\resetallfloatnos
9660 \expandafter{\resetallfloatnos #1=0 }%
9661 \fi
9662 \let\floatno#1%
9663 }
9664
9665 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9666 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9667 % first read the @float command.
9668 %
9669 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9670
9671 % Magic string used for the XREFLABEL-title value, so \xrefX can
9672 % distinguish floats from other xref types.
9673 \def\floatmagic{!!float!!}
9674
9675 % #1 is the control sequence we are passed; we expand into a conditional
9676 % which is true if #1 represents a float ref. That is, the magic
9677 % \currentsection value which we \setref above.
9678 %
9679 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9680 %
9681 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9682 % (safe) float type for this float. We set \iffloattype to #2.
9683 %
9684 \def\doiffloat#1=#2=#3\finish{%
9685 \def\temp{#1}%
9686 \def\iffloattype{#2}%
9687 \ifx\temp\floatmagic
9688 }
9689
9690 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9691 %
9692 \parseargdef\listoffloats{%
9693 \def\floattype{#1}% floattype
9694 {%
9695 % the floattype might have accents or other special characters,
9696 % but we need to use it in a control sequence name.
9697 \indexnofonts
9698 \turnoffactive
9699 \xdef\safefloattype{\floattype}%
9700 }%
9701 %
9702 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9703 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9704 \ifhavexrefs
9705 % if the user said @listoffloats foo but never @float foo.
9706 \message{\linenumber No `\safefloattype' floats to list.}%
9707 \fi
9708 \else
9709 \begingroup
9710 \leftskip=\tocindent % indent these entries like a toc
9711 \let\do=\listoffloatsdo
9712 \csname floatlist\safefloattype\endcsname
9713 \endgroup
9714 \fi
9715 }
9716
9717 % This is called on each entry in a list of floats. We're passed the
9718 % xref label, in the form LABEL-title, which is how we save it in the
9719 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9720 % has the text we're supposed to typeset here.
9721 %
9722 % Figures without xref labels will not be included in the list (since
9723 % they won't appear in the aux file).
9724 %
9725 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9726 \def\listoffloatsdoentry#1-title\finish{{%
9727 % Can't fully expand XR#1-lof because it can contain anything. Just
9728 % pass the control sequence. On the other hand, XR#1-pg is just the
9729 % page number, and we want to fully expand that so we can get a link
9730 % in pdf output.
9731 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9732 %
9733 % use the same \entry macro we use to generate the TOC and index.
9734 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9735 \writeentry
9736 }}
9737
9738
9739 \message{localization,}
9740
9741 % For single-language documents, @documentlanguage is usually given very
9742 % early, just after @documentencoding. Single argument is the language
9743 % (de) or locale (de_DE) abbreviation.
9744 %
9745 {
9746 \catcode`\_ = \active
9747 \globaldefs=1
9748 \parseargdef\documentlanguage{%
9749 \tex % read txi-??.tex file in plain TeX.
9750 % Read the file by the name they passed if it exists.
9751 \let_ = \normalunderscore % normal _ character for filename test
9752 \openin 1 txi-#1.tex
9753 \ifeof 1
9754 \documentlanguagetrywithoutunderscore #1_\finish
9755 \else
9756 \globaldefs = 1 % everything in the txi-LL files needs to persist
9757 \input txi-#1.tex
9758 \fi
9759 \closein 1
9760 \endgroup % end raw TeX
9761 }
9762 %
9763 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9764 % try txi-de.tex.
9765 %
9766 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9767 \openin 1 txi-#1.tex
9768 \ifeof 1
9769 \errhelp = \nolanghelp
9770 \errmessage{Cannot read language file txi-#1.tex}%
9771 \else
9772 \globaldefs = 1 % everything in the txi-LL files needs to persist
9773 \input txi-#1.tex
9774 \fi
9775 \closein 1
9776 }
9777 }% end of special _ catcode
9778 %
9779 \newhelp\nolanghelp{The given language definition file cannot be found or
9780 is empty. Maybe you need to install it? Putting it in the current
9781 directory should work if nowhere else does.}
9782
9783 % This macro is called from txi-??.tex files; the first argument is the
9784 % \language name to set (without the "\lang@" prefix), the second and
9785 % third args are \{left,right}hyphenmin.
9786 %
9787 % The language names to pass are determined when the format is built.
9788 % See the etex.log file created at that time, e.g.,
9789 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9790 %
9791 % With TeX Live 2008, etex now includes hyphenation patterns for all
9792 % available languages. This means we can support hyphenation in
9793 % Texinfo, at least to some extent. (This still doesn't solve the
9794 % accented characters problem.)
9795 %
9796 \catcode`@=11
9797 \def\txisetlanguage#1#2#3{%
9798 % do not set the language if the name is undefined in the current TeX.
9799 \expandafter\ifx\csname lang@#1\endcsname \relax
9800 \message{no patterns for #1}%
9801 \else
9802 \global\language = \csname lang@#1\endcsname
9803 \fi
9804 % but there is no harm in adjusting the hyphenmin values regardless.
9805 \global\lefthyphenmin = #2\relax
9806 \global\righthyphenmin = #3\relax
9807 }
9808
9809 % XeTeX and LuaTeX can handle Unicode natively.
9810 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9811 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9812 %
9813 \newif\iftxinativeunicodecapable
9814 \newif\iftxiusebytewiseio
9815
9816 \ifx\XeTeXrevision\thisisundefined
9817 \ifx\luatexversion\thisisundefined
9818 \txinativeunicodecapablefalse
9819 \txiusebytewiseiotrue
9820 \else
9821 \txinativeunicodecapabletrue
9822 \txiusebytewiseiofalse
9823 \fi
9824 \else
9825 \txinativeunicodecapabletrue
9826 \txiusebytewiseiofalse
9827 \fi
9828
9829 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9830 % for non-UTF-8 (byte-wise) encodings.
9831 %
9832 \def\setbytewiseio{%
9833 \ifx\XeTeXrevision\thisisundefined
9834 \else
9835 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9836 \XeTeXinputencoding "bytes" % For document root file
9837 % Unfortunately, there seems to be no corresponding XeTeX command for
9838 % output encoding. This is a problem for auxiliary index and TOC files.
9839 % The only solution would be perhaps to write out @U{...} sequences in
9840 % place of non-ASCII characters.
9841 \fi
9842
9843 \ifx\luatexversion\thisisundefined
9844 \else
9845 \directlua{
9846 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9847 local function convert_char (char)
9848 return utf8_char(byte(char))
9849 end
9850
9851 local function convert_line (line)
9852 return gsub(line, ".", convert_char)
9853 end
9854
9855 callback.register("process_input_buffer", convert_line)
9856
9857 local function convert_line_out (line)
9858 local line_out = ""
9859 for c in string.utfvalues(line) do
9860 line_out = line_out .. string.char(c)
9861 end
9862 return line_out
9863 end
9864
9865 callback.register("process_output_buffer", convert_line_out)
9866 }
9867 \fi
9868
9869 \txiusebytewiseiotrue
9870 }
9871
9872
9873 % Helpers for encodings.
9874 % Set the catcode of characters 128 through 255 to the specified number.
9875 %
9876 \def\setnonasciicharscatcode#1{%
9877 \count255=128
9878 \loop\ifnum\count255<256
9879 \global\catcode\count255=#1\relax
9880 \advance\count255 by 1
9881 \repeat
9882 }
9883
9884 \def\setnonasciicharscatcodenonglobal#1{%
9885 \count255=128
9886 \loop\ifnum\count255<256
9887 \catcode\count255=#1\relax
9888 \advance\count255 by 1
9889 \repeat
9890 }
9891
9892 % @documentencoding sets the definition of non-ASCII characters
9893 % according to the specified encoding.
9894 %
9895 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9896 \def\documentencodingzzz#1{%
9897 %
9898 % Encoding being declared for the document.
9899 \def\declaredencoding{\csname #1.enc\endcsname}%
9900 %
9901 % Supported encodings: names converted to tokens in order to be able
9902 % to compare them with \ifx.
9903 \def\ascii{\csname US-ASCII.enc\endcsname}%
9904 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9905 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9906 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9907 \def\utfeight{\csname UTF-8.enc\endcsname}%
9908 %
9909 \ifx \declaredencoding \ascii
9910 \asciichardefs
9911 %
9912 \else \ifx \declaredencoding \lattwo
9913 \iftxinativeunicodecapable
9914 \setbytewiseio
9915 \fi
9916 \setnonasciicharscatcode\active
9917 \lattwochardefs
9918 %
9919 \else \ifx \declaredencoding \latone
9920 \iftxinativeunicodecapable
9921 \setbytewiseio
9922 \fi
9923 \setnonasciicharscatcode\active
9924 \latonechardefs
9925 %
9926 \else \ifx \declaredencoding \latnine
9927 \iftxinativeunicodecapable
9928 \setbytewiseio
9929 \fi
9930 \setnonasciicharscatcode\active
9931 \latninechardefs
9932 %
9933 \else \ifx \declaredencoding \utfeight
9934 \iftxinativeunicodecapable
9935 % For native Unicode handling (XeTeX and LuaTeX)
9936 \nativeunicodechardefs
9937 \else
9938 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX).
9939 % Since we already invoke \utfeightchardefs at the top level,
9940 % making non-ascii chars active is sufficient.
9941 \setnonasciicharscatcode\active
9942 \fi
9943 %
9944 \else
9945 \message{Ignoring unknown document encoding: #1.}%
9946 %
9947 \fi % utfeight
9948 \fi % latnine
9949 \fi % latone
9950 \fi % lattwo
9951 \fi % ascii
9952 %
9953 \ifx\XeTeXrevision\thisisundefined
9954 \else
9955 \ifx \declaredencoding \utfeight
9956 \else
9957 \ifx \declaredencoding \ascii
9958 \else
9959 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
9960 non-ASCII characters in auxiliary files.}%
9961 \fi
9962 \fi
9963 \fi
9964 }
9965
9966 % A message to be logged when using a character that isn't available
9967 % the default font encoding (OT1).
9968 %
9969 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9970
9971 % Take account of \c (plain) vs. \, (Texinfo) difference.
9972 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9973
9974 \def\gdefchar#1#2{%
9975 \gdef#1{%
9976 \ifpassthroughchars
9977 \string#1%
9978 \else
9979 #2%
9980 \fi
9981 }}
9982
9983 \begingroup
9984
9985 % Make non-ASCII characters active for defining the character definition
9986 % macros.
9987 \setnonasciicharscatcode\active
9988
9989 % Latin1 (ISO-8859-1) character definitions.
9990 \gdef\latonechardefs{%
9991 \gdefchar^^a0{\tie}
9992 \gdefchar^^a1{\exclamdown}
9993 \gdefchar^^a2{{\tcfont \char162}} % cent
9994 \gdefchar^^a3{\pounds{}}
9995 \gdefchar^^a4{{\tcfont \char164}} % currency
9996 \gdefchar^^a5{{\tcfont \char165}} % yen
9997 \gdefchar^^a6{{\tcfont \char166}} % broken bar
9998 \gdefchar^^a7{\S}
9999 \gdefchar^^a8{\"{}}
10000 \gdefchar^^a9{\copyright{}}
10001 \gdefchar^^aa{\ordf}
10002 \gdefchar^^ab{\guillemetleft{}}
10003 \gdefchar^^ac{\ensuremath\lnot}
10004 \gdefchar^^ad{\-}
10005 \gdefchar^^ae{\registeredsymbol{}}
10006 \gdefchar^^af{\={}}
10007 %
10008 \gdefchar^^b0{\textdegree}
10009 \gdefchar^^b1{$\pm$}
10010 \gdefchar^^b2{$^2$}
10011 \gdefchar^^b3{$^3$}
10012 \gdefchar^^b4{\'{}}
10013 \gdefchar^^b5{$\mu$}
10014 \gdefchar^^b6{\P}
10015 \gdefchar^^b7{\ensuremath\cdot}
10016 \gdefchar^^b8{\cedilla\ }
10017 \gdefchar^^b9{$^1$}
10018 \gdefchar^^ba{\ordm}
10019 \gdefchar^^bb{\guillemetright{}}
10020 \gdefchar^^bc{$1\over4$}
10021 \gdefchar^^bd{$1\over2$}
10022 \gdefchar^^be{$3\over4$}
10023 \gdefchar^^bf{\questiondown}
10024 %
10025 \gdefchar^^c0{\`A}
10026 \gdefchar^^c1{\'A}
10027 \gdefchar^^c2{\^A}
10028 \gdefchar^^c3{\~A}
10029 \gdefchar^^c4{\"A}
10030 \gdefchar^^c5{\ringaccent A}
10031 \gdefchar^^c6{\AE}
10032 \gdefchar^^c7{\cedilla C}
10033 \gdefchar^^c8{\`E}
10034 \gdefchar^^c9{\'E}
10035 \gdefchar^^ca{\^E}
10036 \gdefchar^^cb{\"E}
10037 \gdefchar^^cc{\`I}
10038 \gdefchar^^cd{\'I}
10039 \gdefchar^^ce{\^I}
10040 \gdefchar^^cf{\"I}
10041 %
10042 \gdefchar^^d0{\DH}
10043 \gdefchar^^d1{\~N}
10044 \gdefchar^^d2{\`O}
10045 \gdefchar^^d3{\'O}
10046 \gdefchar^^d4{\^O}
10047 \gdefchar^^d5{\~O}
10048 \gdefchar^^d6{\"O}
10049 \gdefchar^^d7{$\times$}
10050 \gdefchar^^d8{\O}
10051 \gdefchar^^d9{\`U}
10052 \gdefchar^^da{\'U}
10053 \gdefchar^^db{\^U}
10054 \gdefchar^^dc{\"U}
10055 \gdefchar^^dd{\'Y}
10056 \gdefchar^^de{\TH}
10057 \gdefchar^^df{\ss}
10058 %
10059 \gdefchar^^e0{\`a}
10060 \gdefchar^^e1{\'a}
10061 \gdefchar^^e2{\^a}
10062 \gdefchar^^e3{\~a}
10063 \gdefchar^^e4{\"a}
10064 \gdefchar^^e5{\ringaccent a}
10065 \gdefchar^^e6{\ae}
10066 \gdefchar^^e7{\cedilla c}
10067 \gdefchar^^e8{\`e}
10068 \gdefchar^^e9{\'e}
10069 \gdefchar^^ea{\^e}
10070 \gdefchar^^eb{\"e}
10071 \gdefchar^^ec{\`{\dotless i}}
10072 \gdefchar^^ed{\'{\dotless i}}
10073 \gdefchar^^ee{\^{\dotless i}}
10074 \gdefchar^^ef{\"{\dotless i}}
10075 %
10076 \gdefchar^^f0{\dh}
10077 \gdefchar^^f1{\~n}
10078 \gdefchar^^f2{\`o}
10079 \gdefchar^^f3{\'o}
10080 \gdefchar^^f4{\^o}
10081 \gdefchar^^f5{\~o}
10082 \gdefchar^^f6{\"o}
10083 \gdefchar^^f7{$\div$}
10084 \gdefchar^^f8{\o}
10085 \gdefchar^^f9{\`u}
10086 \gdefchar^^fa{\'u}
10087 \gdefchar^^fb{\^u}
10088 \gdefchar^^fc{\"u}
10089 \gdefchar^^fd{\'y}
10090 \gdefchar^^fe{\th}
10091 \gdefchar^^ff{\"y}
10092 }
10093
10094 % Latin9 (ISO-8859-15) encoding character definitions.
10095 \gdef\latninechardefs{%
10096 % Encoding is almost identical to Latin1.
10097 \latonechardefs
10098 %
10099 \gdefchar^^a4{\euro{}}
10100 \gdefchar^^a6{\v S}
10101 \gdefchar^^a8{\v s}
10102 \gdefchar^^b4{\v Z}
10103 \gdefchar^^b8{\v z}
10104 \gdefchar^^bc{\OE}
10105 \gdefchar^^bd{\oe}
10106 \gdefchar^^be{\"Y}
10107 }
10108
10109 % Latin2 (ISO-8859-2) character definitions.
10110 \gdef\lattwochardefs{%
10111 \gdefchar^^a0{\tie}
10112 \gdefchar^^a1{\ogonek{A}}
10113 \gdefchar^^a2{\u{}}
10114 \gdefchar^^a3{\L}
10115 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10116 \gdefchar^^a5{\v L}
10117 \gdefchar^^a6{\'S}
10118 \gdefchar^^a7{\S}
10119 \gdefchar^^a8{\"{}}
10120 \gdefchar^^a9{\v S}
10121 \gdefchar^^aa{\cedilla S}
10122 \gdefchar^^ab{\v T}
10123 \gdefchar^^ac{\'Z}
10124 \gdefchar^^ad{\-}
10125 \gdefchar^^ae{\v Z}
10126 \gdefchar^^af{\dotaccent Z}
10127 %
10128 \gdefchar^^b0{\textdegree}
10129 \gdefchar^^b1{\ogonek{a}}
10130 \gdefchar^^b2{\ogonek{ }}
10131 \gdefchar^^b3{\l}
10132 \gdefchar^^b4{\'{}}
10133 \gdefchar^^b5{\v l}
10134 \gdefchar^^b6{\'s}
10135 \gdefchar^^b7{\v{}}
10136 \gdefchar^^b8{\cedilla\ }
10137 \gdefchar^^b9{\v s}
10138 \gdefchar^^ba{\cedilla s}
10139 \gdefchar^^bb{\v t}
10140 \gdefchar^^bc{\'z}
10141 \gdefchar^^bd{\H{}}
10142 \gdefchar^^be{\v z}
10143 \gdefchar^^bf{\dotaccent z}
10144 %
10145 \gdefchar^^c0{\'R}
10146 \gdefchar^^c1{\'A}
10147 \gdefchar^^c2{\^A}
10148 \gdefchar^^c3{\u A}
10149 \gdefchar^^c4{\"A}
10150 \gdefchar^^c5{\'L}
10151 \gdefchar^^c6{\'C}
10152 \gdefchar^^c7{\cedilla C}
10153 \gdefchar^^c8{\v C}
10154 \gdefchar^^c9{\'E}
10155 \gdefchar^^ca{\ogonek{E}}
10156 \gdefchar^^cb{\"E}
10157 \gdefchar^^cc{\v E}
10158 \gdefchar^^cd{\'I}
10159 \gdefchar^^ce{\^I}
10160 \gdefchar^^cf{\v D}
10161 %
10162 \gdefchar^^d0{\DH}
10163 \gdefchar^^d1{\'N}
10164 \gdefchar^^d2{\v N}
10165 \gdefchar^^d3{\'O}
10166 \gdefchar^^d4{\^O}
10167 \gdefchar^^d5{\H O}
10168 \gdefchar^^d6{\"O}
10169 \gdefchar^^d7{$\times$}
10170 \gdefchar^^d8{\v R}
10171 \gdefchar^^d9{\ringaccent U}
10172 \gdefchar^^da{\'U}
10173 \gdefchar^^db{\H U}
10174 \gdefchar^^dc{\"U}
10175 \gdefchar^^dd{\'Y}
10176 \gdefchar^^de{\cedilla T}
10177 \gdefchar^^df{\ss}
10178 %
10179 \gdefchar^^e0{\'r}
10180 \gdefchar^^e1{\'a}
10181 \gdefchar^^e2{\^a}
10182 \gdefchar^^e3{\u a}
10183 \gdefchar^^e4{\"a}
10184 \gdefchar^^e5{\'l}
10185 \gdefchar^^e6{\'c}
10186 \gdefchar^^e7{\cedilla c}
10187 \gdefchar^^e8{\v c}
10188 \gdefchar^^e9{\'e}
10189 \gdefchar^^ea{\ogonek{e}}
10190 \gdefchar^^eb{\"e}
10191 \gdefchar^^ec{\v e}
10192 \gdefchar^^ed{\'{\dotless{i}}}
10193 \gdefchar^^ee{\^{\dotless{i}}}
10194 \gdefchar^^ef{\v d}
10195 %
10196 \gdefchar^^f0{\dh}
10197 \gdefchar^^f1{\'n}
10198 \gdefchar^^f2{\v n}
10199 \gdefchar^^f3{\'o}
10200 \gdefchar^^f4{\^o}
10201 \gdefchar^^f5{\H o}
10202 \gdefchar^^f6{\"o}
10203 \gdefchar^^f7{$\div$}
10204 \gdefchar^^f8{\v r}
10205 \gdefchar^^f9{\ringaccent u}
10206 \gdefchar^^fa{\'u}
10207 \gdefchar^^fb{\H u}
10208 \gdefchar^^fc{\"u}
10209 \gdefchar^^fd{\'y}
10210 \gdefchar^^fe{\cedilla t}
10211 \gdefchar^^ff{\dotaccent{}}
10212 }
10213
10214 \endgroup % active chars
10215
10216 % UTF-8 character definitions.
10217 %
10218 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10219 % changes for Texinfo conventions. It is included here under the GPL by
10220 % permission from Frank Mittelbach and the LaTeX team.
10221 %
10222 \newcount\countUTFx
10223 \newcount\countUTFy
10224 \newcount\countUTFz
10225
10226 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10227 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10228 %
10229 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10230 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10231 %
10232 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10233 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10234
10235 \gdef\UTFviiiDefined#1{%
10236 \ifx #1\relax
10237 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10238 \else
10239 \expandafter #1%
10240 \fi
10241 }
10242
10243 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10244 \begingroup
10245 \catcode`\~13
10246 \catcode`\$12
10247 \catcode`\"12
10248
10249 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10250 % substituting ~ and $ with a character token of that value.
10251 \def\UTFviiiLoop{%
10252 \global\catcode\countUTFx\active
10253 \uccode`\~\countUTFx
10254 \uccode`\$\countUTFx
10255 \uppercase\expandafter{\UTFviiiTmp}%
10256 \advance\countUTFx by 1
10257 \ifnum\countUTFx < \countUTFy
10258 \expandafter\UTFviiiLoop
10259 \fi}
10260
10261 % For bytes other than the first in a UTF-8 sequence. Not expected to
10262 % be expanded except when writing to auxiliary files.
10263 \countUTFx = "80
10264 \countUTFy = "C2
10265 \def\UTFviiiTmp{%
10266 \gdef~{%
10267 \ifpassthroughchars $\fi}}%
10268 \UTFviiiLoop
10269
10270 \countUTFx = "C2
10271 \countUTFy = "E0
10272 \def\UTFviiiTmp{%
10273 \gdef~{%
10274 \ifpassthroughchars $%
10275 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10276 \UTFviiiLoop
10277
10278 \countUTFx = "E0
10279 \countUTFy = "F0
10280 \def\UTFviiiTmp{%
10281 \gdef~{%
10282 \ifpassthroughchars $%
10283 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10284 \UTFviiiLoop
10285
10286 \countUTFx = "F0
10287 \countUTFy = "F4
10288 \def\UTFviiiTmp{%
10289 \gdef~{%
10290 \ifpassthroughchars $%
10291 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10292 }}%
10293 \UTFviiiLoop
10294 \endgroup
10295
10296 \def\globallet{\global\let} % save some \expandafter's below
10297
10298 % @U{xxxx} to produce U+xxxx, if we support it.
10299 \def\U#1{%
10300 \expandafter\ifx\csname uni:#1\endcsname \relax
10301 \iftxinativeunicodecapable
10302 % All Unicode characters can be used if native Unicode handling is
10303 % active. However, if the font does not have the glyph,
10304 % letters are missing.
10305 \begingroup
10306 \uccode`\.="#1\relax
10307 \uppercase{.}
10308 \endgroup
10309 \else
10310 \errhelp = \EMsimple
10311 \errmessage{Unicode character U+#1 not supported, sorry}%
10312 \fi
10313 \else
10314 \csname uni:#1\endcsname
10315 \fi
10316 }
10317
10318 % These macros are used here to construct the name of a control
10319 % sequence to be defined.
10320 \def\UTFviiiTwoOctetsName#1#2{%
10321 \csname u8:#1\string #2\endcsname}%
10322 \def\UTFviiiThreeOctetsName#1#2#3{%
10323 \csname u8:#1\string #2\string #3\endcsname}%
10324 \def\UTFviiiFourOctetsName#1#2#3#4{%
10325 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10326
10327 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10328 % provide a definition macro to replace a Unicode character;
10329 % this gets used by the @U command
10330 %
10331 \begingroup
10332 \catcode`\"=12
10333 \catcode`\<=12
10334 \catcode`\.=12
10335 \catcode`\,=12
10336 \catcode`\;=12
10337 \catcode`\!=12
10338 \catcode`\~=13
10339 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10340 \countUTFz = "#1\relax
10341 \begingroup
10342 \parseXMLCharref
10343
10344 % Give \u8:... its definition. The sequence of seven \expandafter's
10345 % expands after the \gdef three times, e.g.
10346 %
10347 % 1. \UTFviiTwoOctetsName B1 B2
10348 % 2. \csname u8:B1 \string B2 \endcsname
10349 % 3. \u8: B1 B2 (a single control sequence token)
10350 %
10351 \expandafter\expandafter
10352 \expandafter\expandafter
10353 \expandafter\expandafter
10354 \expandafter\gdef \UTFviiiTmp{#2}%
10355 %
10356 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10357 \message{Internal error, already defined: #1}%
10358 \fi
10359 %
10360 % define an additional control sequence for this code point.
10361 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10362 \endgroup}
10363 %
10364 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10365 % to the corresponding UTF-8 sequence.
10366 \gdef\parseXMLCharref{%
10367 \ifnum\countUTFz < "20\relax
10368 \errhelp = \EMsimple
10369 \errmessage{Cannot define Unicode char value < 0020}%
10370 \else\ifnum\countUTFz < "800\relax
10371 \parseUTFviiiA,%
10372 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10373 \else\ifnum\countUTFz < "10000\relax
10374 \parseUTFviiiA;%
10375 \parseUTFviiiA,%
10376 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10377 \else
10378 \parseUTFviiiA;%
10379 \parseUTFviiiA,%
10380 \parseUTFviiiA!%
10381 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10382 \fi\fi\fi
10383 }
10384
10385 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10386 % It must be a non-initial byte in the sequence.
10387 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10388 % of the bytes.
10389 \gdef\parseUTFviiiA#1{%
10390 \countUTFx = \countUTFz
10391 \divide\countUTFz by 64
10392 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10393 \multiply\countUTFz by 64
10394
10395 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10396 % in order to get the last five bits.
10397 \advance\countUTFx by -\countUTFz
10398
10399 % Convert this to the byte in the UTF-8 sequence.
10400 \advance\countUTFx by 128
10401 \uccode `#1\countUTFx
10402 \countUTFz = \countUTFy}
10403
10404 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10405 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10406 % sequence.
10407 % #2 is one of the \UTFviii*OctetsName macros.
10408 % #3 is always a full stop (.)
10409 % #4 is a template for the other bytes in the sequence. The values for these
10410 % bytes is substituted in here with \uppercase using the \uccode's.
10411 \gdef\parseUTFviiiB#1#2#3#4{%
10412 \advance\countUTFz by "#10\relax
10413 \uccode `#3\countUTFz
10414 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10415 \endgroup
10416
10417 % For native Unicode handling (XeTeX and LuaTeX),
10418 % provide a definition macro that sets a catcode to `other' non-globally
10419 %
10420 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10421 \catcode"#1=\other
10422 }
10423
10424 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10425 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10426 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10427 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10428 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10429 %
10430 % Many of our renditions are less than wonderful, and all the missing
10431 % characters are available somewhere. Loading the necessary fonts
10432 % awaits user request. We can't truly support Unicode without
10433 % reimplementing everything that's been done in LaTeX for many years,
10434 % plus probably using luatex or xetex, and who knows what else.
10435 % We won't be doing that here in this simple file. But we can try to at
10436 % least make most of the characters not bomb out.
10437 %
10438 \def\unicodechardefs{%
10439 \DeclareUnicodeCharacter{0020}{ } % space
10440 \DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number
10441 \DeclareUnicodeCharacter{0022}{\char"22 }%
10442 \DeclareUnicodeCharacter{0023}{\char"23 }%
10443 \DeclareUnicodeCharacter{0024}{\char"24 }%
10444 \DeclareUnicodeCharacter{0025}{\char"25 }%
10445 \DeclareUnicodeCharacter{0026}{\char"26 }%
10446 \DeclareUnicodeCharacter{0027}{\char"27 }%
10447 \DeclareUnicodeCharacter{0028}{\char"28 }%
10448 \DeclareUnicodeCharacter{0029}{\char"29 }%
10449 \DeclareUnicodeCharacter{002A}{\char"2A }%
10450 \DeclareUnicodeCharacter{002B}{\char"2B }%
10451 \DeclareUnicodeCharacter{002C}{\char"2C }%
10452 \DeclareUnicodeCharacter{002D}{\char"2D }%
10453 \DeclareUnicodeCharacter{002E}{\char"2E }%
10454 \DeclareUnicodeCharacter{002F}{\char"2F }%
10455 \DeclareUnicodeCharacter{0030}{0}%
10456 \DeclareUnicodeCharacter{0031}{1}%
10457 \DeclareUnicodeCharacter{0032}{2}%
10458 \DeclareUnicodeCharacter{0033}{3}%
10459 \DeclareUnicodeCharacter{0034}{4}%
10460 \DeclareUnicodeCharacter{0035}{5}%
10461 \DeclareUnicodeCharacter{0036}{6}%
10462 \DeclareUnicodeCharacter{0037}{7}%
10463 \DeclareUnicodeCharacter{0038}{8}%
10464 \DeclareUnicodeCharacter{0039}{9}%
10465 \DeclareUnicodeCharacter{003A}{\char"3A }%
10466 \DeclareUnicodeCharacter{003B}{\char"3B }%
10467 \DeclareUnicodeCharacter{003C}{\char"3C }%
10468 \DeclareUnicodeCharacter{003D}{\char"3D }%
10469 \DeclareUnicodeCharacter{003E}{\char"3E }%
10470 \DeclareUnicodeCharacter{003F}{\char"3F }%
10471 \DeclareUnicodeCharacter{0040}{\char"40 }%
10472 \DeclareUnicodeCharacter{0041}{A}%
10473 \DeclareUnicodeCharacter{0042}{B}%
10474 \DeclareUnicodeCharacter{0043}{C}%
10475 \DeclareUnicodeCharacter{0044}{D}%
10476 \DeclareUnicodeCharacter{0045}{E}%
10477 \DeclareUnicodeCharacter{0046}{F}%
10478 \DeclareUnicodeCharacter{0047}{G}%
10479 \DeclareUnicodeCharacter{0048}{H}%
10480 \DeclareUnicodeCharacter{0049}{I}%
10481 \DeclareUnicodeCharacter{004A}{J}%
10482 \DeclareUnicodeCharacter{004B}{K}%
10483 \DeclareUnicodeCharacter{004C}{L}%
10484 \DeclareUnicodeCharacter{004D}{M}%
10485 \DeclareUnicodeCharacter{004E}{N}%
10486 \DeclareUnicodeCharacter{004F}{O}%
10487 \DeclareUnicodeCharacter{0050}{P}%
10488 \DeclareUnicodeCharacter{0051}{Q}%
10489 \DeclareUnicodeCharacter{0052}{R}%
10490 \DeclareUnicodeCharacter{0053}{S}%
10491 \DeclareUnicodeCharacter{0054}{T}%
10492 \DeclareUnicodeCharacter{0055}{U}%
10493 \DeclareUnicodeCharacter{0056}{V}%
10494 \DeclareUnicodeCharacter{0057}{W}%
10495 \DeclareUnicodeCharacter{0058}{X}%
10496 \DeclareUnicodeCharacter{0059}{Y}%
10497 \DeclareUnicodeCharacter{005A}{Z}%
10498 \DeclareUnicodeCharacter{005B}{\char"5B }%
10499 \DeclareUnicodeCharacter{005C}{\char"5C }%
10500 \DeclareUnicodeCharacter{005D}{\char"5D }%
10501 \DeclareUnicodeCharacter{005E}{\char"5E }%
10502 \DeclareUnicodeCharacter{005F}{\char"5F }%
10503 \DeclareUnicodeCharacter{0060}{\char"60 }%
10504 \DeclareUnicodeCharacter{0061}{a}%
10505 \DeclareUnicodeCharacter{0062}{b}%
10506 \DeclareUnicodeCharacter{0063}{c}%
10507 \DeclareUnicodeCharacter{0064}{d}%
10508 \DeclareUnicodeCharacter{0065}{e}%
10509 \DeclareUnicodeCharacter{0066}{f}%
10510 \DeclareUnicodeCharacter{0067}{g}%
10511 \DeclareUnicodeCharacter{0068}{h}%
10512 \DeclareUnicodeCharacter{0069}{i}%
10513 \DeclareUnicodeCharacter{006A}{j}%
10514 \DeclareUnicodeCharacter{006B}{k}%
10515 \DeclareUnicodeCharacter{006C}{l}%
10516 \DeclareUnicodeCharacter{006D}{m}%
10517 \DeclareUnicodeCharacter{006E}{n}%
10518 \DeclareUnicodeCharacter{006F}{o}%
10519 \DeclareUnicodeCharacter{0070}{p}%
10520 \DeclareUnicodeCharacter{0071}{q}%
10521 \DeclareUnicodeCharacter{0072}{r}%
10522 \DeclareUnicodeCharacter{0073}{s}%
10523 \DeclareUnicodeCharacter{0074}{t}%
10524 \DeclareUnicodeCharacter{0075}{u}%
10525 \DeclareUnicodeCharacter{0076}{v}%
10526 \DeclareUnicodeCharacter{0077}{w}%
10527 \DeclareUnicodeCharacter{0078}{x}%
10528 \DeclareUnicodeCharacter{0079}{y}%
10529 \DeclareUnicodeCharacter{007A}{z}%
10530 \DeclareUnicodeCharacter{007B}{\char"7B }%
10531 \DeclareUnicodeCharacter{007C}{\char"7C }%
10532 \DeclareUnicodeCharacter{007D}{\char"7D }%
10533 \DeclareUnicodeCharacter{007E}{\char"7E }%
10534 % \DeclareUnicodeCharacter{007F}{} % DEL
10535 %
10536 \DeclareUnicodeCharacter{00A0}{\tie}%
10537 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10538 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10539 \DeclareUnicodeCharacter{00A3}{\pounds{}}%
10540 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10541 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10542 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10543 \DeclareUnicodeCharacter{00A7}{\S}%
10544 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10545 \DeclareUnicodeCharacter{00A9}{\copyright{}}%
10546 \DeclareUnicodeCharacter{00AA}{\ordf}%
10547 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
10548 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10549 \DeclareUnicodeCharacter{00AD}{\-}%
10550 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
10551 \DeclareUnicodeCharacter{00AF}{\={ }}%
10552 %
10553 \DeclareUnicodeCharacter{00B0}{\textdegree}%
10554 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10555 \DeclareUnicodeCharacter{00B2}{$^2$}%
10556 \DeclareUnicodeCharacter{00B3}{$^3$}%
10557 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10558 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10559 \DeclareUnicodeCharacter{00B6}{\P}%
10560 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10561 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10562 \DeclareUnicodeCharacter{00B9}{$^1$}%
10563 \DeclareUnicodeCharacter{00BA}{\ordm}%
10564 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
10565 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10566 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10567 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10568 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10569 %
10570 \DeclareUnicodeCharacter{00C0}{\`A}%
10571 \DeclareUnicodeCharacter{00C1}{\'A}%
10572 \DeclareUnicodeCharacter{00C2}{\^A}%
10573 \DeclareUnicodeCharacter{00C3}{\~A}%
10574 \DeclareUnicodeCharacter{00C4}{\"A}%
10575 \DeclareUnicodeCharacter{00C5}{\AA}%
10576 \DeclareUnicodeCharacter{00C6}{\AE}%
10577 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10578 \DeclareUnicodeCharacter{00C8}{\`E}%
10579 \DeclareUnicodeCharacter{00C9}{\'E}%
10580 \DeclareUnicodeCharacter{00CA}{\^E}%
10581 \DeclareUnicodeCharacter{00CB}{\"E}%
10582 \DeclareUnicodeCharacter{00CC}{\`I}%
10583 \DeclareUnicodeCharacter{00CD}{\'I}%
10584 \DeclareUnicodeCharacter{00CE}{\^I}%
10585 \DeclareUnicodeCharacter{00CF}{\"I}%
10586 %
10587 \DeclareUnicodeCharacter{00D0}{\DH}%
10588 \DeclareUnicodeCharacter{00D1}{\~N}%
10589 \DeclareUnicodeCharacter{00D2}{\`O}%
10590 \DeclareUnicodeCharacter{00D3}{\'O}%
10591 \DeclareUnicodeCharacter{00D4}{\^O}%
10592 \DeclareUnicodeCharacter{00D5}{\~O}%
10593 \DeclareUnicodeCharacter{00D6}{\"O}%
10594 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10595 \DeclareUnicodeCharacter{00D8}{\O}%
10596 \DeclareUnicodeCharacter{00D9}{\`U}%
10597 \DeclareUnicodeCharacter{00DA}{\'U}%
10598 \DeclareUnicodeCharacter{00DB}{\^U}%
10599 \DeclareUnicodeCharacter{00DC}{\"U}%
10600 \DeclareUnicodeCharacter{00DD}{\'Y}%
10601 \DeclareUnicodeCharacter{00DE}{\TH}%
10602 \DeclareUnicodeCharacter{00DF}{\ss}%
10603 %
10604 \DeclareUnicodeCharacter{00E0}{\`a}%
10605 \DeclareUnicodeCharacter{00E1}{\'a}%
10606 \DeclareUnicodeCharacter{00E2}{\^a}%
10607 \DeclareUnicodeCharacter{00E3}{\~a}%
10608 \DeclareUnicodeCharacter{00E4}{\"a}%
10609 \DeclareUnicodeCharacter{00E5}{\aa}%
10610 \DeclareUnicodeCharacter{00E6}{\ae}%
10611 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10612 \DeclareUnicodeCharacter{00E8}{\`e}%
10613 \DeclareUnicodeCharacter{00E9}{\'e}%
10614 \DeclareUnicodeCharacter{00EA}{\^e}%
10615 \DeclareUnicodeCharacter{00EB}{\"e}%
10616 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10617 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10618 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10619 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10620 %
10621 \DeclareUnicodeCharacter{00F0}{\dh}%
10622 \DeclareUnicodeCharacter{00F1}{\~n}%
10623 \DeclareUnicodeCharacter{00F2}{\`o}%
10624 \DeclareUnicodeCharacter{00F3}{\'o}%
10625 \DeclareUnicodeCharacter{00F4}{\^o}%
10626 \DeclareUnicodeCharacter{00F5}{\~o}%
10627 \DeclareUnicodeCharacter{00F6}{\"o}%
10628 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10629 \DeclareUnicodeCharacter{00F8}{\o}%
10630 \DeclareUnicodeCharacter{00F9}{\`u}%
10631 \DeclareUnicodeCharacter{00FA}{\'u}%
10632 \DeclareUnicodeCharacter{00FB}{\^u}%
10633 \DeclareUnicodeCharacter{00FC}{\"u}%
10634 \DeclareUnicodeCharacter{00FD}{\'y}%
10635 \DeclareUnicodeCharacter{00FE}{\th}%
10636 \DeclareUnicodeCharacter{00FF}{\"y}%
10637 %
10638 \DeclareUnicodeCharacter{0100}{\=A}%
10639 \DeclareUnicodeCharacter{0101}{\=a}%
10640 \DeclareUnicodeCharacter{0102}{\u{A}}%
10641 \DeclareUnicodeCharacter{0103}{\u{a}}%
10642 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10643 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10644 \DeclareUnicodeCharacter{0106}{\'C}%
10645 \DeclareUnicodeCharacter{0107}{\'c}%
10646 \DeclareUnicodeCharacter{0108}{\^C}%
10647 \DeclareUnicodeCharacter{0109}{\^c}%
10648 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10649 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10650 \DeclareUnicodeCharacter{010C}{\v{C}}%
10651 \DeclareUnicodeCharacter{010D}{\v{c}}%
10652 \DeclareUnicodeCharacter{010E}{\v{D}}%
10653 \DeclareUnicodeCharacter{010F}{d'}%
10654 %
10655 \DeclareUnicodeCharacter{0110}{\DH}%
10656 \DeclareUnicodeCharacter{0111}{\dh}%
10657 \DeclareUnicodeCharacter{0112}{\=E}%
10658 \DeclareUnicodeCharacter{0113}{\=e}%
10659 \DeclareUnicodeCharacter{0114}{\u{E}}%
10660 \DeclareUnicodeCharacter{0115}{\u{e}}%
10661 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10662 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10663 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10664 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10665 \DeclareUnicodeCharacter{011A}{\v{E}}%
10666 \DeclareUnicodeCharacter{011B}{\v{e}}%
10667 \DeclareUnicodeCharacter{011C}{\^G}%
10668 \DeclareUnicodeCharacter{011D}{\^g}%
10669 \DeclareUnicodeCharacter{011E}{\u{G}}%
10670 \DeclareUnicodeCharacter{011F}{\u{g}}%
10671 %
10672 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10673 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10674 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10675 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10676 \DeclareUnicodeCharacter{0124}{\^H}%
10677 \DeclareUnicodeCharacter{0125}{\^h}%
10678 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10679 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10680 \DeclareUnicodeCharacter{0128}{\~I}%
10681 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10682 \DeclareUnicodeCharacter{012A}{\=I}%
10683 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10684 \DeclareUnicodeCharacter{012C}{\u{I}}%
10685 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10686 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10687 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10688 %
10689 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10690 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10691 \DeclareUnicodeCharacter{0132}{IJ}%
10692 \DeclareUnicodeCharacter{0133}{ij}%
10693 \DeclareUnicodeCharacter{0134}{\^J}%
10694 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10695 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10696 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10697 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10698 \DeclareUnicodeCharacter{0139}{\'L}%
10699 \DeclareUnicodeCharacter{013A}{\'l}%
10700 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10701 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10702 \DeclareUnicodeCharacter{013D}{L'}% should kern
10703 \DeclareUnicodeCharacter{013E}{l'}% should kern
10704 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10705 %
10706 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10707 \DeclareUnicodeCharacter{0141}{\L}%
10708 \DeclareUnicodeCharacter{0142}{\l}%
10709 \DeclareUnicodeCharacter{0143}{\'N}%
10710 \DeclareUnicodeCharacter{0144}{\'n}%
10711 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10712 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10713 \DeclareUnicodeCharacter{0147}{\v{N}}%
10714 \DeclareUnicodeCharacter{0148}{\v{n}}%
10715 \DeclareUnicodeCharacter{0149}{'n}%
10716 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10717 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10718 \DeclareUnicodeCharacter{014C}{\=O}%
10719 \DeclareUnicodeCharacter{014D}{\=o}%
10720 \DeclareUnicodeCharacter{014E}{\u{O}}%
10721 \DeclareUnicodeCharacter{014F}{\u{o}}%
10722 %
10723 \DeclareUnicodeCharacter{0150}{\H{O}}%
10724 \DeclareUnicodeCharacter{0151}{\H{o}}%
10725 \DeclareUnicodeCharacter{0152}{\OE}%
10726 \DeclareUnicodeCharacter{0153}{\oe}%
10727 \DeclareUnicodeCharacter{0154}{\'R}%
10728 \DeclareUnicodeCharacter{0155}{\'r}%
10729 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10730 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10731 \DeclareUnicodeCharacter{0158}{\v{R}}%
10732 \DeclareUnicodeCharacter{0159}{\v{r}}%
10733 \DeclareUnicodeCharacter{015A}{\'S}%
10734 \DeclareUnicodeCharacter{015B}{\'s}%
10735 \DeclareUnicodeCharacter{015C}{\^S}%
10736 \DeclareUnicodeCharacter{015D}{\^s}%
10737 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10738 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10739 %
10740 \DeclareUnicodeCharacter{0160}{\v{S}}%
10741 \DeclareUnicodeCharacter{0161}{\v{s}}%
10742 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10743 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10744 \DeclareUnicodeCharacter{0164}{\v{T}}%
10745 \DeclareUnicodeCharacter{0165}{\v{t}}%
10746 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10747 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10748 \DeclareUnicodeCharacter{0168}{\~U}%
10749 \DeclareUnicodeCharacter{0169}{\~u}%
10750 \DeclareUnicodeCharacter{016A}{\=U}%
10751 \DeclareUnicodeCharacter{016B}{\=u}%
10752 \DeclareUnicodeCharacter{016C}{\u{U}}%
10753 \DeclareUnicodeCharacter{016D}{\u{u}}%
10754 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10755 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10756 %
10757 \DeclareUnicodeCharacter{0170}{\H{U}}%
10758 \DeclareUnicodeCharacter{0171}{\H{u}}%
10759 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10760 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10761 \DeclareUnicodeCharacter{0174}{\^W}%
10762 \DeclareUnicodeCharacter{0175}{\^w}%
10763 \DeclareUnicodeCharacter{0176}{\^Y}%
10764 \DeclareUnicodeCharacter{0177}{\^y}%
10765 \DeclareUnicodeCharacter{0178}{\"Y}%
10766 \DeclareUnicodeCharacter{0179}{\'Z}%
10767 \DeclareUnicodeCharacter{017A}{\'z}%
10768 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10769 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10770 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10771 \DeclareUnicodeCharacter{017E}{\v{z}}%
10772 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10773 %
10774 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10775 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10776 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10777 \DeclareUnicodeCharacter{01C7}{LJ}%
10778 \DeclareUnicodeCharacter{01C8}{Lj}%
10779 \DeclareUnicodeCharacter{01C9}{lj}%
10780 \DeclareUnicodeCharacter{01CA}{NJ}%
10781 \DeclareUnicodeCharacter{01CB}{Nj}%
10782 \DeclareUnicodeCharacter{01CC}{nj}%
10783 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10784 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10785 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10786 %
10787 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10788 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10789 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10790 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10791 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10792 %
10793 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10794 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10795 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10796 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10797 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10798 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10799 %
10800 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10801 \DeclareUnicodeCharacter{01F1}{DZ}%
10802 \DeclareUnicodeCharacter{01F2}{Dz}%
10803 \DeclareUnicodeCharacter{01F3}{dz}%
10804 \DeclareUnicodeCharacter{01F4}{\'G}%
10805 \DeclareUnicodeCharacter{01F5}{\'g}%
10806 \DeclareUnicodeCharacter{01F8}{\`N}%
10807 \DeclareUnicodeCharacter{01F9}{\`n}%
10808 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10809 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10810 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10811 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10812 %
10813 \DeclareUnicodeCharacter{021E}{\v{H}}%
10814 \DeclareUnicodeCharacter{021F}{\v{h}}%
10815 %
10816 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10817 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10818 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10819 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10820 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10821 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10822 %
10823 \DeclareUnicodeCharacter{0232}{\=Y}%
10824 \DeclareUnicodeCharacter{0233}{\=y}%
10825 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10826 %
10827 \DeclareUnicodeCharacter{02BC}{'}%
10828 %
10829 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10830 %
10831 % Greek letters upper case
10832 \DeclareUnicodeCharacter{0391}{{\it A}}%
10833 \DeclareUnicodeCharacter{0392}{{\it B}}%
10834 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10835 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10836 \DeclareUnicodeCharacter{0395}{{\it E}}%
10837 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10838 \DeclareUnicodeCharacter{0397}{{\it H}}%
10839 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10840 \DeclareUnicodeCharacter{0399}{{\it I}}%
10841 \DeclareUnicodeCharacter{039A}{{\it K}}%
10842 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10843 \DeclareUnicodeCharacter{039C}{{\it M}}%
10844 \DeclareUnicodeCharacter{039D}{{\it N}}%
10845 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10846 \DeclareUnicodeCharacter{039F}{{\it O}}%
10847 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10848 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10849 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10850 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10851 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10852 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10853 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10854 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10855 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10856 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10857 %
10858 % Vowels with accents
10859 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10860 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10861 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10862 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10863 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10864 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10865 %
10866 % Standalone accent
10867 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10868 %
10869 % Greek letters lower case
10870 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10871 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10872 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10873 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10874 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10875 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10876 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10877 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10878 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10879 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10880 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10881 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10882 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10883 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10884 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10885 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10886 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10887 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10888 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10889 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10890 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10891 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10892 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10893 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10894 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10895 %
10896 % More Greek vowels with accents
10897 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10898 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10899 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10900 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10901 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10902 %
10903 % Variant Greek letters
10904 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10905 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10906 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10907 %
10908 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10909 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10910 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10911 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10912 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10913 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10914 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10915 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10916 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10917 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10918 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10919 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10920 %
10921 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10922 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10923 %
10924 \DeclareUnicodeCharacter{1E20}{\=G}%
10925 \DeclareUnicodeCharacter{1E21}{\=g}%
10926 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10927 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10928 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10929 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10930 \DeclareUnicodeCharacter{1E26}{\"H}%
10931 \DeclareUnicodeCharacter{1E27}{\"h}%
10932 %
10933 \DeclareUnicodeCharacter{1E30}{\'K}%
10934 \DeclareUnicodeCharacter{1E31}{\'k}%
10935 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10936 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10937 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10938 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10939 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10940 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10941 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10942 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10943 \DeclareUnicodeCharacter{1E3E}{\'M}%
10944 \DeclareUnicodeCharacter{1E3F}{\'m}%
10945 %
10946 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10947 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10948 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10949 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10950 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10951 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10952 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10953 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10954 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10955 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10956 %
10957 \DeclareUnicodeCharacter{1E54}{\'P}%
10958 \DeclareUnicodeCharacter{1E55}{\'p}%
10959 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10960 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10961 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10962 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10963 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10964 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10965 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10966 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10967 %
10968 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10969 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10970 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10971 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10972 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10973 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10974 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10975 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10976 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10977 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10978 %
10979 \DeclareUnicodeCharacter{1E7C}{\~V}%
10980 \DeclareUnicodeCharacter{1E7D}{\~v}%
10981 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10982 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10983 %
10984 \DeclareUnicodeCharacter{1E80}{\`W}%
10985 \DeclareUnicodeCharacter{1E81}{\`w}%
10986 \DeclareUnicodeCharacter{1E82}{\'W}%
10987 \DeclareUnicodeCharacter{1E83}{\'w}%
10988 \DeclareUnicodeCharacter{1E84}{\"W}%
10989 \DeclareUnicodeCharacter{1E85}{\"w}%
10990 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10991 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10992 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10993 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10994 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10995 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10996 \DeclareUnicodeCharacter{1E8C}{\"X}%
10997 \DeclareUnicodeCharacter{1E8D}{\"x}%
10998 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10999 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
11000 %
11001 \DeclareUnicodeCharacter{1E90}{\^Z}%
11002 \DeclareUnicodeCharacter{1E91}{\^z}%
11003 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
11004 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
11005 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
11006 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
11007 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
11008 \DeclareUnicodeCharacter{1E97}{\"t}%
11009 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
11010 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
11011 %
11012 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
11013 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
11014 %
11015 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
11016 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
11017 \DeclareUnicodeCharacter{1EBC}{\~E}%
11018 \DeclareUnicodeCharacter{1EBD}{\~e}%
11019 %
11020 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
11021 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
11022 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
11023 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
11024 %
11025 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
11026 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
11027 %
11028 \DeclareUnicodeCharacter{1EF2}{\`Y}%
11029 \DeclareUnicodeCharacter{1EF3}{\`y}%
11030 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
11031 %
11032 \DeclareUnicodeCharacter{1EF8}{\~Y}%
11033 \DeclareUnicodeCharacter{1EF9}{\~y}%
11034 %
11035 % Exotic spaces
11036 \DeclareUnicodeCharacter{2007}{\hphantom{0}}%
11037 %
11038 % Punctuation
11039 \DeclareUnicodeCharacter{2013}{--}%
11040 \DeclareUnicodeCharacter{2014}{---}%
11041 \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
11042 \DeclareUnicodeCharacter{2019}{\quoteright{}}%
11043 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
11044 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
11045 \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
11046 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
11047 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
11048 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
11049 \DeclareUnicodeCharacter{2022}{\bullet{}}%
11050 \DeclareUnicodeCharacter{202F}{\thinspace}%
11051 \DeclareUnicodeCharacter{2026}{\dots{}}%
11052 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
11053 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
11054 %
11055 \DeclareUnicodeCharacter{20AC}{\euro{}}%
11056 %
11057 \DeclareUnicodeCharacter{2192}{\arrow}%
11058 \DeclareUnicodeCharacter{21D2}{\result{}}%
11059 %
11060 % Mathematical symbols
11061 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
11062 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
11063 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
11064 \DeclareUnicodeCharacter{2212}{\minus{}}%
11065 \DeclareUnicodeCharacter{2217}{\ast}%
11066 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
11067 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
11068 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
11069 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
11070 \DeclareUnicodeCharacter{2261}{\equiv{}}%
11071 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
11072 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
11073 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
11074 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
11075 %
11076 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
11077 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
11078 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
11079 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
11080 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
11081 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
11082 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
11083 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11084 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11085 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11086 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11087 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11088 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11089 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11090 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11091 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11092 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11093 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11094 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11095 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11096 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11097 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11098 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11099 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11100 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11101 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11102 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11103 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11104 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11105 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11106 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11107 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11108 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11109 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11110 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11111 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11112 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11113 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11114 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11115 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11116 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11117 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11118 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11119 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11120 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11121 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11122 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11123 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11124 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11125 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11126 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11127 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11128 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11129 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11130 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11131 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11132 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11133 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11134 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11135 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11136 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11137 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11138 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11139 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11140 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11141 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11142 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11143 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11144 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11145 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11146 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11147 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11148 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11149 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11150 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11151 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11152 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11153 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11154 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11155 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11156 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11157 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11158 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11159 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11160 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11161 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11162 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11163 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11164 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11165 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11166 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11167 %
11168 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11169 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11170 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11171 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11172 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
11173 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11174 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11175 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11176 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11177 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11178 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11179 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11180 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11181 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11182 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11183 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11184 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11185 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11186 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11187 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11188 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11189 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11190 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11191 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11192 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11193 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11194 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11195 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11196 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11197 %
11198 \global\mathchardef\checkmark="1370% actually the square root sign
11199 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11200 }% end of \unicodechardefs
11201
11202 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11203 % It makes the setting that replace UTF-8 byte sequence.
11204 \def\utfeightchardefs{%
11205 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11206 \unicodechardefs
11207 }
11208
11209 % Whether the active definitions of non-ASCII characters expand to
11210 % non-active tokens with the same character code. This is used to
11211 % write characters literally, instead of using active definitions for
11212 % printing the correct glyphs.
11213 \newif\ifpassthroughchars
11214 \passthroughcharsfalse
11215
11216 % For native Unicode handling (XeTeX and LuaTeX),
11217 % provide a definition macro to replace/pass-through a Unicode character
11218 %
11219 \def\DeclareUnicodeCharacterNative#1#2{%
11220 \ifnum"#1>"7F % only make non-ASCII chars active
11221 \catcode"#1=\active
11222 \def\dodeclareunicodecharacternative##1##2##3{%
11223 \begingroup
11224 \uccode`\~="##2\relax
11225 \uppercase{\gdef~}{%
11226 \ifpassthroughchars
11227 ##1%
11228 \else
11229 ##3%
11230 \fi
11231 }
11232 \endgroup
11233 }
11234 \begingroup
11235 \uccode`\.="#1\relax
11236 \uppercase{\def\UTFNativeTmp{.}}%
11237 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11238 \endgroup
11239 \fi
11240 }
11241
11242 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11243 % It activates the setting that replaces Unicode characters.
11244 \def\nativeunicodechardefs{%
11245 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11246 \unicodechardefs
11247 }
11248
11249 % For native Unicode handling (XeTeX and LuaTeX),
11250 % make the character token expand
11251 % to the sequences given in \unicodechardefs for printing.
11252 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11253 \def\UTFAtUTmp{#2}
11254 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11255 }
11256
11257 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11258 \def\nativeunicodechardefsatu{%
11259 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11260 \unicodechardefs
11261 }
11262
11263 % US-ASCII character definitions.
11264 \def\asciichardefs{% nothing need be done
11265 \relax
11266 }
11267
11268 % Define all Unicode characters we know about
11269 \iftxinativeunicodecapable
11270 \nativeunicodechardefsatu
11271 \else
11272 \utfeightchardefs
11273 \fi
11274
11275
11276 \message{formatting,}
11277
11278 \newdimen\defaultparindent \defaultparindent = 15pt
11279
11280 \chapheadingskip = 15pt plus 4pt minus 2pt
11281 \secheadingskip = 12pt plus 3pt minus 2pt
11282 \subsecheadingskip = 9pt plus 2pt minus 2pt
11283
11284 % Prevent underfull vbox error messages.
11285 \vbadness = 10000
11286
11287 % Don't be very finicky about underfull hboxes, either.
11288 \hbadness = 6666
11289
11290 % Following George Bush, get rid of widows and orphans.
11291 \widowpenalty=10000
11292 \clubpenalty=10000
11293
11294 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11295 % using an old version of TeX, don't do anything. We want the amount of
11296 % stretch added to depend on the line length, hence the dependence on
11297 % \hsize. We call this whenever the paper size is set.
11298 %
11299 \def\setemergencystretch{%
11300 \ifx\emergencystretch\thisisundefined
11301 % Allow us to assign to \emergencystretch anyway.
11302 \def\emergencystretch{\dimen0}%
11303 \else
11304 \emergencystretch = .15\hsize
11305 \fi
11306 }
11307
11308 % Parameters in order: 1) textheight; 2) textwidth;
11309 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11310 % 7) physical page height; 8) physical page width.
11311 %
11312 % We also call \setleading{\textleading}, so the caller should define
11313 % \textleading. The caller should also set \parskip.
11314 %
11315 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11316 \voffset = #3\relax
11317 \topskip = #6\relax
11318 \splittopskip = \topskip
11319 %
11320 \vsize = #1\relax
11321 \advance\vsize by \topskip
11322 \txipageheight = \vsize
11323 %
11324 \hsize = #2\relax
11325 \txipagewidth = \hsize
11326 %
11327 \normaloffset = #4\relax
11328 \bindingoffset = #5\relax
11329 %
11330 \ifpdf
11331 \pdfpageheight #7\relax
11332 \pdfpagewidth #8\relax
11333 % if we don't reset these, they will remain at "1 true in" of
11334 % whatever layout pdftex was dumped with.
11335 \pdfhorigin = 1 true in
11336 \pdfvorigin = 1 true in
11337 \else
11338 \ifx\XeTeXrevision\thisisundefined
11339 \special{papersize=#8,#7}%
11340 \else
11341 \pdfpageheight #7\relax
11342 \pdfpagewidth #8\relax
11343 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11344 \fi
11345 \fi
11346 %
11347 \setleading{\textleading}
11348 %
11349 \parindent = \defaultparindent
11350 \setemergencystretch
11351 }
11352
11353 % @letterpaper (the default).
11354 \def\letterpaper{{\globaldefs = 1
11355 \parskip = 3pt plus 2pt minus 1pt
11356 \textleading = 13.2pt
11357 %
11358 % If page is nothing but text, make it come out even.
11359 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11360 {\voffset}{.25in}%
11361 {\bindingoffset}{36pt}%
11362 {11in}{8.5in}%
11363 }}
11364
11365 % Use @smallbook to reset parameters for 7x9.25 trim size.
11366 \def\smallbook{{\globaldefs = 1
11367 \parskip = 2pt plus 1pt
11368 \textleading = 12pt
11369 %
11370 \internalpagesizes{7.5in}{5in}%
11371 {-.2in}{0in}%
11372 {\bindingoffset}{16pt}%
11373 {9.25in}{7in}%
11374 %
11375 \lispnarrowing = 0.3in
11376 \tolerance = 700
11377 \contentsrightmargin = 0pt
11378 \defbodyindent = .5cm
11379 }}
11380
11381 % Use @afourpaper to print on European A4 paper.
11382 \def\afourpaper{{\globaldefs = 1
11383 \parskip = 3pt plus 2pt minus 1pt
11384 \textleading = 13.2pt
11385 %
11386 % Double-side printing via postscript on Laserjet 4050
11387 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11388 % To change the settings for a different printer or situation, adjust
11389 % \normaloffset until the front-side and back-side texts align. Then
11390 % do the same for \bindingoffset. You can set these for testing in
11391 % your texinfo source file like this:
11392 % @tex
11393 % \global\normaloffset = -6mm
11394 % \global\bindingoffset = 10mm
11395 % @end tex
11396 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11397 {\voffset}{\hoffset}%
11398 {\bindingoffset}{44pt}%
11399 {297mm}{210mm}%
11400 %
11401 \tolerance = 700
11402 \contentsrightmargin = 0pt
11403 \defbodyindent = 5mm
11404 }}
11405
11406 % Use @afivepaper to print on European A5 paper.
11407 % From [email protected], 2 July 2000.
11408 % He also recommends making @example and @lisp be small.
11409 \def\afivepaper{{\globaldefs = 1
11410 \parskip = 2pt plus 1pt minus 0.1pt
11411 \textleading = 12.5pt
11412 %
11413 \internalpagesizes{160mm}{120mm}%
11414 {\voffset}{-11.4mm}%
11415 {\bindingoffset}{8pt}%
11416 {210mm}{148mm}%
11417 %
11418 \lispnarrowing = 0.2in
11419 \tolerance = 800
11420 \contentsrightmargin = 0pt
11421 \defbodyindent = 2mm
11422 \tableindent = 12mm
11423 }}
11424
11425 % A specific text layout, 24x15cm overall, intended for A4 paper.
11426 \def\afourlatex{{\globaldefs = 1
11427 \afourpaper
11428 \internalpagesizes{237mm}{150mm}%
11429 {\voffset}{4.6mm}%
11430 {\bindingoffset}{7mm}%
11431 {297mm}{210mm}%
11432 %
11433 % Must explicitly reset to 0 because we call \afourpaper.
11434 \globaldefs = 0
11435 }}
11436
11437 % Use @afourwide to print on A4 paper in landscape format.
11438 \def\afourwide{{\globaldefs = 1
11439 \afourpaper
11440 \internalpagesizes{241mm}{165mm}%
11441 {\voffset}{-2.95mm}%
11442 {\bindingoffset}{7mm}%
11443 {297mm}{210mm}%
11444 \globaldefs = 0
11445 }}
11446
11447 \def\bsixpaper{{\globaldefs = 1
11448 \afourpaper
11449 \internalpagesizes{140mm}{100mm}%
11450 {-6.35mm}{-12.7mm}%
11451 {\bindingoffset}{14pt}%
11452 {176mm}{125mm}%
11453 \let\SETdispenvsize=\smallword
11454 \lispnarrowing = 0.2in
11455 \globaldefs = 0
11456 }}
11457
11458
11459 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11460 % Perhaps we should allow setting the margins, \topskip, \parskip,
11461 % and/or leading, also. Or perhaps we should compute them somehow.
11462 %
11463 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11464 \def\pagesizesyyy#1,#2,#3\finish{{%
11465 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11466 \globaldefs = 1
11467 %
11468 \parskip = 3pt plus 2pt minus 1pt
11469 \setleading{\textleading}%
11470 %
11471 \dimen0 = #1\relax
11472 \advance\dimen0 by 2.5in % default 1in margin above heading line
11473 % and 1.5in to include heading, footing and
11474 % bottom margin
11475 %
11476 \dimen2 = \hsize
11477 \advance\dimen2 by 2in % default to 1 inch margin on each side
11478 %
11479 \internalpagesizes{#1}{\hsize}%
11480 {\voffset}{\normaloffset}%
11481 {\bindingoffset}{44pt}%
11482 {\dimen0}{\dimen2}%
11483 }}
11484
11485 % Set default to letter.
11486 %
11487 \letterpaper
11488
11489 % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
11490 \hfuzz = 1pt
11491
11492
11493 \message{microtype,}
11494
11495 % protrusion, from Thanh's protcode.tex.
11496 \def\mtsetprotcode#1{%
11497 \rpcode#1`\!=200 \rpcode#1`\,=700 \rpcode#1`\-=700 \rpcode#1`\.=700
11498 \rpcode#1`\;=500 \rpcode#1`\:=500 \rpcode#1`\?=200
11499 \rpcode#1`\'=700
11500 \rpcode#1 34=500 % ''
11501 \rpcode#1 123=300 % --
11502 \rpcode#1 124=200 % ---
11503 \rpcode#1`\)=50 \rpcode#1`\A=50 \rpcode#1`\F=50 \rpcode#1`\K=50
11504 \rpcode#1`\L=50 \rpcode#1`\T=50 \rpcode#1`\V=50 \rpcode#1`\W=50
11505 \rpcode#1`\X=50 \rpcode#1`\Y=50 \rpcode#1`\k=50 \rpcode#1`\r=50
11506 \rpcode#1`\t=50 \rpcode#1`\v=50 \rpcode#1`\w=50 \rpcode#1`\x=50
11507 \rpcode#1`\y=50
11508 %
11509 \lpcode#1`\`=700
11510 \lpcode#1 92=500 % ``
11511 \lpcode#1`\(=50 \lpcode#1`\A=50 \lpcode#1`\J=50 \lpcode#1`\T=50
11512 \lpcode#1`\V=50 \lpcode#1`\W=50 \lpcode#1`\X=50 \lpcode#1`\Y=50
11513 \lpcode#1`\v=50 \lpcode#1`\w=50 \lpcode#1`\x=50 \lpcode#1`\y=0
11514 %
11515 \mtadjustprotcode#1\relax
11516 }
11517
11518 \newcount\countC
11519 \def\mtadjustprotcode#1{%
11520 \countC=0
11521 \loop
11522 \ifcase\lpcode#1\countC\else
11523 \mtadjustcp\lpcode#1\countC
11524 \fi
11525 \ifcase\rpcode#1\countC\else
11526 \mtadjustcp\rpcode#1\countC
11527 \fi
11528 \advance\countC 1
11529 \ifnum\countC < 256 \repeat
11530 }
11531
11532 \newcount\countB
11533 \def\mtadjustcp#1#2#3{%
11534 \setbox\boxA=\hbox{%
11535 \ifx#2\font\else#2\fi
11536 \char#3}%
11537 \countB=\wd\boxA
11538 \multiply\countB #1#2#3\relax
11539 \divide\countB \fontdimen6 #2\relax
11540 #1#2#3=\countB\relax
11541 }
11542
11543 \ifx\XeTeXrevision\thisisundefined
11544 \ifx\luatexversion\thisisundefined
11545 \ifpdf % pdfTeX
11546 \mtsetprotcode\textrm
11547 \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
11548 \else % TeX
11549 \def\mtfontexpand#1{}
11550 \fi
11551 \else % LuaTeX
11552 \mtsetprotcode\textrm
11553 \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
11554 \fi
11555 \else % XeTeX
11556 \mtsetprotcode\textrm
11557 \def\mtfontexpand#1{}
11558 \fi
11559
11560
11561 \newif\ifmicrotype
11562
11563 \def\microtypeON{%
11564 \microtypetrue
11565 %
11566 \ifx\XeTeXrevision\thisisundefined
11567 \ifx\luatexversion\thisisundefined
11568 \ifpdf % pdfTeX
11569 \pdfadjustspacing=2
11570 \pdfprotrudechars=2
11571 \fi
11572 \else % LuaTeX
11573 \adjustspacing=2
11574 \protrudechars=2
11575 \fi
11576 \else % XeTeX
11577 \XeTeXprotrudechars=2
11578 \fi
11579 %
11580 \mtfontexpand\textrm
11581 \mtfontexpand\textsl
11582 \mtfontexpand\textbf
11583 }
11584
11585 \def\microtypeOFF{%
11586 \microtypefalse
11587 %
11588 \ifx\XeTeXrevision\thisisundefined
11589 \ifx\luatexversion\thisisundefined
11590 \ifpdf % pdfTeX
11591 \pdfadjustspacing=0
11592 \pdfprotrudechars=0
11593 \fi
11594 \else % LuaTeX
11595 \adjustspacing=0
11596 \protrudechars=0
11597 \fi
11598 \else % XeTeX
11599 \XeTeXprotrudechars=0
11600 \fi
11601 }
11602
11603 \microtypeOFF
11604
11605 \parseargdef\microtype{%
11606 \def\txiarg{#1}%
11607 \ifx\txiarg\onword
11608 \microtypeON
11609 \else\ifx\txiarg\offword
11610 \microtypeOFF
11611 \else
11612 \errhelp = \EMsimple
11613 \errmessage{Unknown @microtype option `\txiarg', must be on|off}%
11614 \fi\fi
11615 }
11616
11617
11618 \message{and turning on texinfo input format.}
11619
11620 % Make UTF-8 the default encoding.
11621 \documentencodingzzz{UTF-8}
11622
11623 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11624 \catcode`\^^K = 10 % treat vertical tab as whitespace
11625
11626 % DEL is a comment character, in case @c does not suffice.
11627 \catcode`\^^? = 14
11628
11629 % Define macros to output various characters with catcode for normal text.
11630 \catcode`\"=\other \def\normaldoublequote{"}
11631 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11632 \catcode`\+=\other \def\normalplus{+}
11633 \catcode`\<=\other \def\normalless{<}
11634 \catcode`\>=\other \def\normalgreater{>}
11635 \catcode`\^=\other \def\normalcaret{^}
11636 \catcode`\_=\other \def\normalunderscore{_}
11637 \catcode`\|=\other \def\normalverticalbar{|}
11638 \catcode`\~=\other \def\normaltilde{~}
11639
11640 % Set catcodes for Texinfo file
11641
11642 % Active characters for printing the wanted glyph.
11643 % Most of these we simply print from the \tt font, but for some, we can
11644 % use math or other variants that look better in normal text.
11645 %
11646 \catcode`\"=\active
11647 \def\activedoublequote{{\tt\char34}}
11648 \let"=\activedoublequote
11649 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11650 \chardef\hatchar=`\^
11651 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11652
11653 \catcode`\_=\active
11654 \def_{\ifusingtt\normalunderscore\_}
11655 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11656 \let\realunder=_
11657
11658 \catcode`\|=\active \def|{{\tt\char124}}
11659
11660 \chardef \less=`\<
11661 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11662 \chardef \gtr=`\>
11663 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11664 \catcode`\+=\active \def+{{\tt \char 43}}
11665 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11666 \catcode`\-=\active \let-=\normaldash
11667
11668
11669 % used for headline/footline in the output routine, in case the page
11670 % breaks in the middle of an @tex block.
11671 \def\texinfochars{%
11672 \let< = \activeless
11673 \let> = \activegtr
11674 \let~ = \activetilde
11675 \let^ = \activehat
11676 \setregularquotes
11677 \let\b = \strong
11678 \let\i = \smartitalic
11679 % in principle, all other definitions in \tex have to be undone too.
11680 }
11681
11682 % Used sometimes to turn off (effectively) the active characters even after
11683 % parsing them.
11684 \def\turnoffactive{%
11685 \passthroughcharstrue
11686 \let-=\normaldash
11687 \let"=\normaldoublequote
11688 \let$=\normaldollar %$ font-lock fix
11689 \let+=\normalplus
11690 \let<=\normalless
11691 \let>=\normalgreater
11692 \let^=\normalcaret
11693 \let_=\normalunderscore
11694 \let|=\normalverticalbar
11695 \let~=\normaltilde
11696 \otherbackslash
11697 \setregularquotes
11698 \unsepspaces
11699 }
11700
11701 % If a .fmt file is being used, characters that might appear in a file
11702 % name cannot be active until we have parsed the command line.
11703 % So turn them off again, and have \loadconf turn them back on.
11704 \catcode`+=\other \catcode`\_=\other
11705
11706
11707 % \backslashcurfont outputs one backslash character in current font,
11708 % as in \char`\\.
11709 \global\chardef\backslashcurfont=`\\
11710
11711 % Print a typewriter backslash. For math mode, we can't simply use
11712 % \backslashcurfont: the story here is that in math mode, the \char
11713 % of \backslashcurfont ends up printing the roman \ from the math symbol
11714 % font (because \char in math mode uses the \mathcode, and plain.tex
11715 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11716 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11717 % ignored family value; char position "5C). We can't use " for the
11718 % usual hex value because it has already been made active.
11719
11720 \def\ttbackslash{{\tt \ifmmode \mathchar29020 \else \backslashcurfont \fi}}
11721 \let\backslashchar = \ttbackslash % \backslashchar{} is for user documents.
11722
11723 % These are made active for url-breaking, so need
11724 % active definitions as the normal characters.
11725 \def\normaldot{.}
11726 \def\normalquest{?}
11727 \def\normalslash{/}
11728
11729 % \newlinesloadsconf - call \loadconf as soon as possible in the
11730 % file, e.g. at the first newline.
11731 %
11732 {\catcode`\^=7
11733 \catcode`\^^M=13
11734 \gdef\newlineloadsconf{%
11735 \catcode`\^^M=13 %
11736 \newlineloadsconfzz%
11737 }
11738 \gdef\newlineloadsconfzz#1^^M{%
11739 \def\c{\loadconf\c}%
11740 % Definition for the first newline read in the file
11741 \def ^^M{\loadconf}%
11742 % In case the first line has a whole-line command on it
11743 \let\originalparsearg\parsearg%
11744 \def\parsearg{\loadconf\originalparsearg}%
11745 }}
11746
11747
11748 % Emergency active definition of newline, in case an active newline token
11749 % appears by mistake.
11750 {\catcode`\^=7 \catcode13=13%
11751 \gdef\enableemergencynewline{%
11752 \gdef^^M{%
11753 \par%
11754 %<warning: active newline>\par%
11755 }}}
11756
11757
11758 % \loadconf gets called at the beginning of every Texinfo file.
11759 % If texinfo.cnf is present on the system, read it. Useful for site-wide
11760 % @afourpaper, etc. Not opening texinfo.cnf directly in texinfo.tex
11761 % makes it possible to make a format file for Texinfo.
11762 %
11763 \gdef\loadconf{%
11764 \relax % Terminate the filename if running as "tex '&texinfo' FILE.texi".
11765 %
11766 % Turn off the definitions that trigger \loadconf
11767 \everyjobreset
11768 \catcode13=5 % regular end of line
11769 \enableemergencynewline
11770 \let\c=\comment
11771 \let\parsearg\originalparsearg
11772 %
11773 % Also turn back on active characters that might appear in the input
11774 % file name, in case not using a pre-dumped format.
11775 \catcode`+=\active
11776 \catcode`\_=\active
11777 %
11778 \openin 1 texinfo.cnf
11779 \ifeof 1 \else \input texinfo.cnf \fi
11780 \closein 1
11781 }
11782
11783 % Redefine some control sequences to be controlled by the \ifdummies
11784 % and \ifindexnofonts switches. Do this at the end so that the control
11785 % sequences are all defined.
11786 \definedummies
11787
11788
11789
11790
11791 \catcode`\@=0
11792
11793 % \realbackslash is an actual character `\' with catcode other.
11794 {\catcode`\\=\other @gdef@realbackslash{\}}
11795
11796 % In Texinfo, backslash is an active character; it prints the backslash
11797 % in fixed width font.
11798 \catcode`\\=\active % @ for escape char from now on.
11799
11800 @let\ = @ttbackslash
11801
11802 % If in a .fmt file, print the version number.
11803 % \eatinput stops the `\input texinfo' from showing up.
11804 % After that, `\' should revert to printing a backslash.
11805 % Turn on active characters that we couldn't do earlier because
11806 % they might have appeared in the input file name.
11807 %
11808 @everyjob{@message{[Texinfo version @texinfoversion]}%
11809 @global@let\ = @eatinput
11810 @catcode`+=@active @catcode`@_=@active}
11811
11812 {@catcode`@^=7 @catcode`@^^M=13%
11813 @gdef@eatinput input texinfo#1^^M{@loadconf}}
11814
11815 @def@everyjobreset{@ifx\@eatinput @let\ = @ttbackslash @fi}
11816
11817 % \otherbackslash defines an active \ to be a literal `\' character with
11818 % catcode other.
11819 @gdef@otherbackslash{@let\=@realbackslash}
11820
11821 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11822 % the literal character `\'.
11823 %
11824 {@catcode`- = @active
11825 @gdef@normalturnoffactive{%
11826 @turnoffactive
11827 @let\=@ttbackslash
11828 }
11829 }
11830
11831 % Say @foo, not \foo, in error messages.
11832 @escapechar = `@@
11833
11834 % These look ok in all fonts, so just make them not special.
11835 % @hashchar{} gets its own user-level command, because of #line.
11836 @catcode`@& = @other @def@normalamp{&}
11837 @catcode`@# = @other @def@normalhash{#}
11838 @catcode`@% = @other @def@normalpercent{%}
11839
11840 @let @hashchar = @normalhash
11841
11842 @c Finally, make ` and ' active, so that txicodequoteundirected and
11843 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11844 @c don't make ` and ' active, @code will not get them as active chars.
11845 @c Do this last of all since we use ` in the previous @catcode assignments.
11846 @catcode`@'=@active
11847 @catcode`@`=@active
11848
11849 @c Local variables:
11850 @c eval: (add-hook 'before-save-hook 'time-stamp nil t)
11851 @c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
11852 @c page-delimiter: "^\\\\message"
11853 @c End:
11854
11855 @newlineloadsconf