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-01-02.21}
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, or @link, etc.) between @contents and the very
279 % first @chapter.
280 \def\gettopheadingmarks{%
281 \ifcase0\the\savedtopmark\fi
282 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
283 }
284 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
285 \def\getcolormarks{\ifcase2\the\savedtopmark\fi}
286
287 % Avoid "undefined control sequence" errors.
288 \def\currentchapterdefs{}
289 \def\currentsectiondefs{}
290 \def\currentsection{}
291 \def\prevchapterdefs{}
292 \def\prevsectiondefs{}
293 \def\currentcolordefs{}
294
295 % Margin to add to right of even pages, to left of odd pages.
296 \newdimen\bindingoffset
297 \newdimen\normaloffset
298 \newdimen\txipagewidth \newdimen\txipageheight
299
300 % Main output routine.
301 %
302 \chardef\PAGE = 255
303 \newtoks\defaultoutput
304 \defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
305 \output=\expandafter{\the\defaultoutput}
306
307 \newbox\headlinebox
308 \newbox\footlinebox
309
310 % When outputting the double column layout for indices, an output routine
311 % is run several times, hiding the original value of \topmark. Hence, save
312 % \topmark at the beginning.
313 %
314 \newtoks\savedtopmark
315 \newif\iftopmarksaved
316 \topmarksavedtrue
317 \def\savetopmark{%
318 \iftopmarksaved\else
319 \global\savedtopmark=\expandafter{\topmark}%
320 \global\topmarksavedtrue
321 \fi
322 }
323
324 % \onepageout takes a vbox as an argument.
325 % \shipout a vbox for a single page, adding an optional header, footer
326 % and footnote. This also causes index entries for this page to be written
327 % to the auxiliary files.
328 %
329 \def\onepageout#1{%
330 \hoffset=\normaloffset
331 %
332 \ifodd\pageno \advance\hoffset by \bindingoffset
333 \else \advance\hoffset by -\bindingoffset\fi
334 %
335 \checkchapterpage
336 %
337 % Make the heading and footing. \makeheadline and \makefootline
338 % use the contents of \headline and \footline.
339 \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
340 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
341 \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
342 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
343 \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
344 %
345 {%
346 % Set context for writing to auxiliary files like index files.
347 % Have to do this stuff outside the \shipout because we want it to
348 % take effect in \write's, yet the group defined by the \vbox ends
349 % before the \shipout runs.
350 %
351 \atdummies % don't expand commands in the output.
352 \turnoffactive
353 \shipout\vbox{%
354 % Do this early so pdf references go to the beginning of the page.
355 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
356 %
357 \unvbox\headlinebox
358 \pagebody{#1}%
359 \ifdim\ht\footlinebox > 0pt
360 % Only leave this space if the footline is nonempty.
361 % (We lessened \vsize for it in \oddfootingyyy.)
362 % The \baselineskip=24pt in plain's \makefootline has no effect.
363 \vskip 24pt
364 \unvbox\footlinebox
365 \fi
366 %
367 }%
368 }%
369 \global\topmarksavedfalse
370 \advancepageno
371 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
372 }
373
374 \newinsert\margin \dimen\margin=\maxdimen
375
376 % Main part of page, including any footnotes
377 \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
378 {\catcode`\@ =11
379 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
380 % marginal hacks, [email protected] (Juha Takala)
381 \ifvoid\margin\else % marginal info is present
382 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
383 \dimen@=\dp#1\relax \unvbox#1\relax
384 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
385 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
386 }
387
388 % Check if we are on the first page of a chapter. Used for printing headings.
389 \newif\ifchapterpage
390 \def\checkchapterpage{%
391 % Get the chapter that was current at the end of the last page
392 \ifcase1\the\savedtopmark\fi
393 \let\prevchaptername\thischaptername
394 %
395 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
396 \let\curchaptername\thischaptername
397 %
398 \ifx\curchaptername\prevchaptername
399 \chapterpagefalse
400 \else
401 \chapterpagetrue
402 \fi
403 }
404
405 % Argument parsing
406
407 % Parse an argument, then pass it to #1. The argument is the rest of
408 % the input line (except we remove a trailing comment). #1 should be a
409 % macro which expects an ordinary undelimited TeX argument.
410 % For example, \def\foo{\parsearg\fooxxx}.
411 %
412 \def\parsearg{\parseargusing{}}
413 \def\parseargusing#1#2{%
414 \def\argtorun{#2}%
415 \begingroup
416 \obeylines
417 \spaceisspace
418 #1%
419 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
420 }
421
422 {\obeylines %
423 \gdef\parseargline#1^^M{%
424 \endgroup % End of the group started in \parsearg.
425 \argremovecomment #1\comment\ArgTerm%
426 }%
427 }
428
429 % First remove any @comment, then any @c comment. Pass the result on to
430 % \argcheckspaces.
431 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
432 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
433
434 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
435 %
436 % \argremovec might leave us with trailing space, e.g.,
437 % @end itemize @c foo
438 % This space token undergoes the same procedure and is eventually removed
439 % by \finishparsearg.
440 %
441 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
442 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
443 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
444 \def\temp{#3}%
445 \ifx\temp\empty
446 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
447 \let\temp\finishparsearg
448 \else
449 \let\temp\argcheckspaces
450 \fi
451 % Put the space token in:
452 \temp#1 #3\ArgTerm
453 }
454
455 % If a _delimited_ argument is enclosed in braces, they get stripped; so
456 % to get _exactly_ the rest of the line, we had to prevent such situation.
457 % We prepended an \empty token at the very beginning and we expand it now,
458 % just before passing the control to \argtorun.
459 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
460 % either the null string, or it ends with \^^M---thus there is no danger
461 % that a pair of braces would be stripped.
462 %
463 % But first, we have to remove the trailing space token.
464 %
465 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
466
467
468 % \parseargdef - define a command taking an argument on the line
469 %
470 % \parseargdef\foo{...}
471 % is roughly equivalent to
472 % \def\foo{\parsearg\Xfoo}
473 % \def\Xfoo#1{...}
474 \def\parseargdef#1{%
475 \expandafter \doparseargdef \csname\string#1\endcsname #1%
476 }
477 \def\doparseargdef#1#2{%
478 \def#2{\parsearg#1}%
479 \def#1##1%
480 }
481
482 % Several utility definitions with active space:
483 {
484 \obeyspaces
485 \gdef\obeyedspace{ }
486
487 % Make each space character in the input produce a normal interword
488 % space in the output. Don't allow a line break at this space, as this
489 % is used only in environments like @example, where each line of input
490 % should produce a line of output anyway.
491 %
492 \gdef\sepspaces{\obeyspaces\let =\tie}
493
494 % If an index command is used in an @example environment, any spaces
495 % therein should become regular spaces in the raw index file, not the
496 % expansion of \tie (\leavevmode \penalty \@M \ ).
497 \gdef\unsepspaces{\let =\space}
498 }
499
500
501 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
502
503 % Define the framework for environments in texinfo.tex. It's used like this:
504 %
505 % \envdef\foo{...}
506 % \def\Efoo{...}
507 %
508 % It's the responsibility of \envdef to insert \begingroup before the
509 % actual body; @end closes the group after calling \Efoo. \envdef also
510 % defines \thisenv, so the current environment is known; @end checks
511 % whether the environment name matches. The \checkenv macro can also be
512 % used to check whether the current environment is the one expected.
513 %
514 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
515 % are not treated as environments; they don't open a group. (The
516 % implementation of @end takes care not to call \endgroup in this
517 % special case.)
518
519
520 % At run-time, environments start with this:
521 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
522 % initialize
523 \let\thisenv\empty
524
525 % ... but they get defined via ``\envdef\foo{...}'':
526 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
527 \long\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
528
529 % Check whether we're in the right environment:
530 \def\checkenv#1{%
531 \def\temp{#1}%
532 \ifx\thisenv\temp
533 \else
534 \badenverr
535 \fi
536 }
537
538 % Environment mismatch, #1 expected:
539 \def\badenverr{%
540 \errhelp = \EMsimple
541 \errmessage{This command can appear only \inenvironment\temp,
542 not \inenvironment\thisenv}%
543 }
544 \def\inenvironment#1{%
545 \ifx#1\empty
546 outside of any environment%
547 \else
548 in environment \expandafter\string#1%
549 \fi
550 }
551
552
553 % @end foo calls \checkenv and executes the definition of \Efoo.
554 \parseargdef\end{%
555 \if 1\csname iscond.#1\endcsname
556 \else
557 % The general wording of \badenverr may not be ideal.
558 \expandafter\checkenv\csname#1\endcsname
559 \csname E#1\endcsname
560 \endgroup
561 \fi
562 }
563
564 \newhelp\EMsimple{Press RETURN to continue.}
565
566
567 % Be sure we're in horizontal mode when doing a tie, since we make space
568 % equivalent to this in @example-like environments. Otherwise, a space
569 % at the beginning of a line will start with \penalty -- and
570 % since \penalty is valid in vertical mode, we'd end up putting the
571 % penalty on the vertical list instead of in the new paragraph.
572 {\catcode`@ = 11
573 % Avoid using \@M directly, because that causes trouble
574 % if the definition is written into an index file.
575 \global\let\tiepenalty = \@M
576 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
577 }
578
579 % @: forces normal size whitespace following.
580 \def\:{\spacefactor=1000 }
581
582 % @* forces a line break.
583 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
584
585 % @/ allows a line break.
586 \let\/=\allowbreak
587
588 % @- allows explicit insertion of hyphenation points
589 \def\-{\discretionary{\normaldash}{}{}}%
590
591 % @. is an end-of-sentence period.
592 \def\.{.\spacefactor=\endofsentencespacefactor\space}
593
594 % @! is an end-of-sentence bang.
595 \def\!{!\spacefactor=\endofsentencespacefactor\space}
596
597 % @? is an end-of-sentence query.
598 \def\?{?\spacefactor=\endofsentencespacefactor\space}
599
600 % @w prevents a word break. Without the \leavevmode, @w at the
601 % beginning of a paragraph, when TeX is still in vertical mode, would
602 % produce a whole line of output instead of starting the paragraph.
603 \def\w#1{\leavevmode\hbox{#1}}
604
605 % @group ... @end group forces ... to be all on one page, by enclosing
606 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
607 % to keep its height that of a normal line. According to the rules for
608 % \topskip (p.114 of the TeXbook), the glue inserted is
609 % max (\topskip - \ht (first item), 0). If that height is large,
610 % therefore, no glue is inserted, and the space between the headline and
611 % the text is small, which looks bad.
612 %
613 % Another complication is that the group might be very large. This can
614 % cause the glue on the previous page to be unduly stretched, because it
615 % does not have much material. In this case, it's better to add an
616 % explicit \vfill so that the extra space is at the bottom. The
617 % threshold for doing this is if the group is more than \vfilllimit
618 % percent of a page (\vfilllimit can be changed inside of @tex).
619 %
620 \newbox\groupbox
621 \def\vfilllimit{0.7}
622 %
623 \envdef\group{%
624 \ifnum\catcode`\^^M=\active \else
625 \errhelp = \groupinvalidhelp
626 \errmessage{@group invalid in context where filling is enabled}%
627 \fi
628 \startsavinginserts
629 %
630 \setbox\groupbox = \vtop\bgroup
631 % Do @comment since we are called inside an environment such as
632 % @example, where each end-of-line in the input causes an
633 % end-of-line in the output. We don't want the end-of-line after
634 % the `@group' to put extra space in the output. Since @group
635 % should appear on a line by itself (according to the Texinfo
636 % manual), we don't worry about eating any user text.
637 \comment
638 }
639 %
640 % The \vtop produces a box with normal height and large depth; thus, TeX puts
641 % \baselineskip glue before it, and (when the next line of text is done)
642 % \lineskip glue after it. Thus, space below is not quite equal to space
643 % above. But it's pretty close.
644 \def\Egroup{%
645 % To get correct interline space between the last line of the group
646 % and the first line afterwards, we have to propagate \prevdepth.
647 \endgraf % Not \par, as it may have been set to \lisppar.
648 \global\dimen1 = \prevdepth
649 \egroup % End the \vtop.
650 \addgroupbox
651 \prevdepth = \dimen1
652 \checkinserts
653 }
654
655 \def\addgroupbox{
656 % \dimen0 is the vertical size of the group's box.
657 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
658 % \dimen2 is how much space is left on the page (more or less).
659 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
660 % if the group doesn't fit on the current page, and it's a big big
661 % group, force a page break.
662 \ifdim \dimen0 > \dimen2
663 \ifdim \pagetotal < \vfilllimit\txipageheight
664 \page
665 \fi
666 \fi
667 \box\groupbox
668 }
669
670 %
671 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
672 % message, so this ends up printing `@group can only ...'.
673 %
674 \newhelp\groupinvalidhelp{%
675 group can only be used in environments such as @example,^^J%
676 where each line of input produces a line of output.}
677
678 % @need space-in-mils
679 % forces a page break if there is not space-in-mils remaining.
680
681 \newdimen\mil \mil=0.001in
682
683 \parseargdef\need{%
684 % Ensure vertical mode, so we don't make a big box in the middle of a
685 % paragraph.
686 \par
687 %
688 % If the @need value is less than one line space, it's useless.
689 \dimen0 = #1\mil
690 \dimen2 = \ht\strutbox
691 \advance\dimen2 by \dp\strutbox
692 \ifdim\dimen0 > \dimen2
693 % This is similar to the 'needspace' module in LaTeX.
694 % The first penalty allows a break if the end of the page is
695 % not too far away. Following penalties and skips are discarded.
696 % Otherwise, require at least \dimen0 of vertical space.
697 %
698 % (We used to use a \vtop to reserve space, but this had spacing issues
699 % when followed by a section heading, as it was not a "discardable item".
700 % This also has the benefit of providing glue before the page break if
701 % there isn't enough space.)
702 \vskip0pt plus \dimen0
703 \penalty-100
704 \vskip0pt plus -\dimen0
705 \vskip \dimen0
706 \penalty9999
707 \vskip -\dimen0
708 \penalty0\relax % this hides the above glue from \safewhatsit and \dobreak
709 \fi
710 }
711
712 % @br forces paragraph break (and is undocumented).
713
714 \let\br = \par
715
716 % @page forces the start of a new page.
717 %
718 \def\page{\par\vfill\supereject}
719
720 % @exdent text....
721 % outputs text on separate line in roman font, starting at standard page margin
722
723 % This records the amount of indent in the innermost environment.
724 % That's how much \exdent should take out.
725 \newskip\exdentamount
726
727 % This defn is used inside fill environments such as @defun.
728 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
729
730 % This defn is used inside nofill environments such as @example.
731 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
732 \leftline{\hskip\leftskip{\rm#1}}}}
733
734 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
735 % paragraph. For more general purposes, use the \margin insertion
736 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
737 %
738 \newskip\inmarginspacing \inmarginspacing=1cm
739 \def\strutdepth{\dp\strutbox}
740 %
741 \def\doinmargin#1#2{\strut\vadjust{%
742 \nobreak
743 \kern-\strutdepth
744 \vtop to \strutdepth{%
745 \baselineskip=\strutdepth
746 \vss
747 % if you have multiple lines of stuff to put here, you'll need to
748 % make the vbox yourself of the appropriate size.
749 \ifx#1l%
750 \llap{\ignorespaces #2\hskip\inmarginspacing}%
751 \else
752 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
753 \fi
754 \null
755 }%
756 }}
757 \def\inleftmargin{\doinmargin l}
758 \def\inrightmargin{\doinmargin r}
759 %
760 % @inmargin{TEXT [, RIGHT-TEXT]}
761 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
762 % else use TEXT for both).
763 %
764 \def\inmargin#1{\parseinmargin #1,,\finish}
765 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
766 \setbox0 = \hbox{\ignorespaces #2}%
767 \ifdim\wd0 > 0pt
768 \def\lefttext{#1}% have both texts
769 \def\righttext{#2}%
770 \else
771 \def\lefttext{#1}% have only one text
772 \def\righttext{#1}%
773 \fi
774 %
775 \ifodd\pageno
776 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
777 \else
778 \def\temp{\inleftmargin\lefttext}%
779 \fi
780 \temp
781 }
782
783 % @include FILE -- \input text of FILE.
784 %
785 \def\include{\parseargusing\filenamecatcodes\includezzz}
786 \def\includezzz#1{%
787 \pushthisfilestack
788 \def\thisfile{#1}%
789 {%
790 \makevalueexpandable % we want to expand any @value in FILE.
791 \turnoffactive % and allow special characters in the expansion
792 \indexnofonts % Allow `@@' and other weird things in file names.
793 \wlog{texinfo.tex: doing @include of #1^^J}%
794 \edef\temp{\noexpand\input #1 }%
795 %
796 % This trickery is to read FILE outside of a group, in case it makes
797 % definitions, etc.
798 \expandafter
799 }\temp
800 \popthisfilestack
801 }
802 \def\filenamecatcodes{%
803 \catcode`\\=\other
804 \catcode`~=\other
805 \catcode`^=\other
806 \catcode`_=\other
807 \catcode`|=\other
808 \catcode`<=\other
809 \catcode`>=\other
810 \catcode`+=\other
811 \catcode`-=\other
812 \catcode`\`=\other
813 \catcode`\'=\other
814 }
815
816 \def\pushthisfilestack{%
817 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
818 }
819 \def\pushthisfilestackX{%
820 \expandafter\pushthisfilestackY\thisfile\StackTerm
821 }
822 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
823 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
824 }
825
826 \def\popthisfilestack{\errthisfilestackempty}
827 \def\errthisfilestackempty{\errmessage{Internal error:
828 the stack of filenames is empty.}}
829 %
830 \def\thisfile{}
831
832 % @center line
833 % outputs that line, centered.
834 %
835 \parseargdef\center{%
836 \ifhmode
837 \let\centersub\centerH
838 \else
839 \let\centersub\centerV
840 \fi
841 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
842 \let\centersub\relax % don't let the definition persist, just in case
843 }
844 \def\centerH#1{{%
845 \hfil\break
846 \advance\hsize by -\leftskip
847 \advance\hsize by -\rightskip
848 \line{#1}%
849 \break
850 }}
851 %
852 \newcount\centerpenalty
853 \def\centerV#1{%
854 % The idea here is the same as in \startdefun, \cartouche, etc.: if
855 % @center is the first thing after a section heading, we need to wipe
856 % out the negative parskip inserted by \sectionheading, but still
857 % prevent a page break here.
858 \centerpenalty = \lastpenalty
859 \ifnum\centerpenalty>10000 \vskip\parskip \fi
860 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
861 \line{\kern\leftskip #1\kern\rightskip}%
862 }
863
864 % @sp n outputs n lines of vertical space
865 %
866 \parseargdef\sp{\vskip #1\baselineskip}
867
868 % @comment ...line which is ignored...
869 % @c is the same as @comment
870 % @ignore ... @end ignore is another way to write a comment
871
872
873 \def\c{\begingroup \catcode`\^^M=\active%
874 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
875 \cxxx}
876 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
877 %
878 \let\comment\c
879
880 % @paragraphindent NCHARS
881 % We'll use ems for NCHARS, close enough.
882 % NCHARS can also be the word `asis' or `none'.
883 % We cannot feasibly implement @paragraphindent asis, though.
884 %
885 \def\asisword{asis} % no translation, these are keywords
886 \def\noneword{none}
887 %
888 \parseargdef\paragraphindent{%
889 \def\temp{#1}%
890 \ifx\temp\asisword
891 \else
892 \ifx\temp\noneword
893 \defaultparindent = 0pt
894 \else
895 \defaultparindent = #1em
896 \fi
897 \fi
898 \parindent = \defaultparindent
899 }
900
901 % @exampleindent NCHARS
902 % We'll use ems for NCHARS like @paragraphindent.
903 % It seems @exampleindent asis isn't necessary, but
904 % I preserve it to make it similar to @paragraphindent.
905 \parseargdef\exampleindent{%
906 \def\temp{#1}%
907 \ifx\temp\asisword
908 \else
909 \ifx\temp\noneword
910 \lispnarrowing = 0pt
911 \else
912 \lispnarrowing = #1em
913 \fi
914 \fi
915 }
916
917 % @firstparagraphindent WORD
918 % If WORD is `none', then suppress indentation of the first paragraph
919 % after a section heading. If WORD is `insert', then do indent at such
920 % paragraphs.
921 %
922 % The paragraph indentation is suppressed or not by calling
923 % \suppressfirstparagraphindent, which the sectioning commands do.
924 % We switch the definition of this back and forth according to WORD.
925 % By default, we suppress indentation.
926 %
927 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
928 \def\insertword{insert}
929 %
930 \parseargdef\firstparagraphindent{%
931 \def\temp{#1}%
932 \ifx\temp\noneword
933 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
934 \else\ifx\temp\insertword
935 \let\suppressfirstparagraphindent = \relax
936 \else
937 \errhelp = \EMsimple
938 \errmessage{Unknown @firstparagraphindent option `\temp'}%
939 \fi\fi
940 }
941
942 % Here is how we actually suppress indentation. Redefine \everypar to
943 % \kern backwards by \parindent, and then reset itself to empty.
944 %
945 % We also make \indent itself not actually do anything until the next
946 % paragraph.
947 %
948 \gdef\dosuppressfirstparagraphindent{%
949 \gdef\indent {\restorefirstparagraphindent \indent}%
950 \gdef\noindent{\restorefirstparagraphindent \noindent}%
951 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
952 }
953 %
954 \gdef\restorefirstparagraphindent{%
955 \global\let\indent = \ptexindent
956 \global\let\noindent = \ptexnoindent
957 \global\everypar = {}%
958 }
959
960 % leave vertical mode without cancelling any first paragraph indent
961 \gdef\imageindent{%
962 \toks0=\everypar
963 \everypar={}%
964 \ptexnoindent
965 \global\everypar=\toks0
966 }
967
968
969 % @refill is a no-op.
970 \let\refill=\relax
971
972 % @setfilename INFO-FILENAME - ignored
973 \let\setfilename=\comment
974
975 % @bye.
976 \outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
977
978
979 \message{pdf,}
980 % adobe `portable' document format
981 \newcount\tempnum
982 \newcount\lnkcount
983 \newtoks\filename
984 \newcount\filenamelength
985 \newcount\pgn
986 \newtoks\toksA
987 \newtoks\toksB
988 \newtoks\toksC
989 \newtoks\toksD
990 \newbox\boxA
991 \newbox\boxB
992 \newcount\countA
993 \newif\ifpdf
994 \newif\ifpdfmakepagedest
995
996 %
997 % For LuaTeX
998 %
999
1000 \newif\iftxiuseunicodedestname
1001 \txiuseunicodedestnamefalse % For pdfTeX etc.
1002
1003 \ifx\luatexversion\thisisundefined
1004 \else
1005 % Use Unicode destination names
1006 \txiuseunicodedestnametrue
1007 % Escape PDF strings with converting UTF-16 from UTF-8
1008 \begingroup
1009 \catcode`\%=12
1010 \directlua{
1011 function UTF16oct(str)
1012 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1013 for c in string.utfvalues(str) do
1014 if c < 0x10000 then
1015 tex.sprint(
1016 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1017 string.char(0x5c) .. string.char(0x25) .. '03o',
1018 math.floor(c / 256), math.floor(c % 256)))
1019 else
1020 c = c - 0x10000
1021 local c_hi = c / 1024 + 0xd800
1022 local c_lo = c % 1024 + 0xdc00
1023 tex.sprint(
1024 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1025 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1026 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1027 string.char(0x5c) .. string.char(0x25) .. '03o',
1028 math.floor(c_hi / 256), math.floor(c_hi % 256),
1029 math.floor(c_lo / 256), math.floor(c_lo % 256)))
1030 end
1031 end
1032 end
1033 }
1034 \endgroup
1035 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1036 % Escape PDF strings without converting
1037 \begingroup
1038 \directlua{
1039 function PDFescstr(str)
1040 for c in string.bytes(str) do
1041 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1042 tex.sprint(-2,
1043 string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1044 c))
1045 else
1046 tex.sprint(-2, string.char(c))
1047 end
1048 end
1049 end
1050 }
1051 % The -2 in the arguments here gives all the input to TeX catcode 12
1052 % (other) or 10 (space), preventing undefined control sequence errors. See
1053 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
1054 %
1055 \endgroup
1056 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1057 \ifnum\luatexversion>84
1058 % For LuaTeX >= 0.85
1059 \def\pdfdest{\pdfextension dest}
1060 \let\pdfoutput\outputmode
1061 \def\pdfliteral{\pdfextension literal}
1062 \def\pdfcatalog{\pdfextension catalog}
1063 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1064 \let\pdfximage\saveimageresource
1065 \let\pdfrefximage\useimageresource
1066 \let\pdflastximage\lastsavedimageresourceindex
1067 \def\pdfendlink{\pdfextension endlink\relax}
1068 \def\pdfoutline{\pdfextension outline}
1069 \def\pdfstartlink{\pdfextension startlink}
1070 \def\pdffontattr{\pdfextension fontattr}
1071 \def\pdfobj{\pdfextension obj}
1072 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1073 \let\pdfpagewidth\pagewidth
1074 \let\pdfpageheight\pageheight
1075 \edef\pdfhorigin{\pdfvariable horigin}
1076 \edef\pdfvorigin{\pdfvariable vorigin}
1077 \fi
1078 \fi
1079
1080 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1081 % can be set). So we test for \relax and 0 as well as being undefined.
1082 \ifx\pdfoutput\thisisundefined
1083 \else
1084 \ifx\pdfoutput\relax
1085 \else
1086 \ifcase\pdfoutput
1087 \else
1088 \pdftrue
1089 \fi
1090 \fi
1091 \fi
1092
1093 \newif\ifpdforxetex
1094 \pdforxetexfalse
1095 \ifpdf
1096 \pdforxetextrue
1097 \fi
1098 \ifx\XeTeXrevision\thisisundefined\else
1099 \pdforxetextrue
1100 \fi
1101
1102
1103 % Output page labels information.
1104 % See PDF reference v.1.7 p.594, section 8.3.1.
1105 \ifpdf
1106 \def\pagelabels{%
1107 \def\title{0 << /P (T-) /S /D >>}%
1108 \edef\roman{\the\romancount << /S /r >>}%
1109 \edef\arabic{\the\arabiccount << /S /D >>}%
1110 %
1111 % Page label ranges must be increasing. Remove any duplicates.
1112 % (There is a slight chance of this being wrong if e.g. there is
1113 % a @contents but no @titlepage, etc.)
1114 %
1115 \ifnum\romancount=0 \def\roman{}\fi
1116 \ifnum\arabiccount=0 \def\title{}%
1117 \else
1118 \ifnum\romancount=\arabiccount \def\roman{}\fi
1119 \fi
1120 %
1121 \ifnum\romancount<\arabiccount
1122 \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax
1123 \else
1124 \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax
1125 \fi
1126 }
1127 \else
1128 \let\pagelabels\relax
1129 \fi
1130
1131 \newcount\pagecount \pagecount=0
1132 \newcount\romancount \romancount=0
1133 \newcount\arabiccount \arabiccount=0
1134 \ifpdf
1135 \let\ptxadvancepageno\advancepageno
1136 \def\advancepageno{%
1137 \ptxadvancepageno\global\advance\pagecount by 1
1138 }
1139 \fi
1140
1141
1142 % PDF uses PostScript string constants for the names of xref targets,
1143 % for display in the outlines, and in other places. Thus, we have to
1144 % double any backslashes. Otherwise, a name like "\node" will be
1145 % interpreted as a newline (\n), followed by o, d, e. Not good.
1146 %
1147 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1148 % related messages. The final outcome is that it is up to the TeX user
1149 % to double the backslashes and otherwise make the string valid, so
1150 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1151 % do this reliably, so we use it.
1152
1153 % #1 is a control sequence in which to do the replacements,
1154 % which we \xdef.
1155 \def\txiescapepdf#1{%
1156 \ifx\pdfescapestring\thisisundefined
1157 % No primitive available; should we give a warning or log?
1158 % Many times it won't matter.
1159 \xdef#1{#1}%
1160 \else
1161 % The expandable \pdfescapestring primitive escapes parentheses,
1162 % backslashes, and other special chars.
1163 \xdef#1{\pdfescapestring{#1}}%
1164 \fi
1165 }
1166 \def\txiescapepdfutfsixteen#1{%
1167 \ifx\pdfescapestrutfsixteen\thisisundefined
1168 % No UTF-16 converting macro available.
1169 \txiescapepdf{#1}%
1170 \else
1171 \xdef#1{\pdfescapestrutfsixteen{#1}}%
1172 \fi
1173 }
1174
1175 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1176 with PDF output, and none of those formats could be found. (.eps cannot
1177 be supported due to the design of the PDF format; use regular TeX (DVI
1178 output) for that.)}
1179
1180 \ifpdf
1181 %
1182 % Color manipulation macros using ideas from pdfcolor.tex,
1183 % except using rgb instead of cmyk; the latter is said to render as a
1184 % very dark gray on-screen and a very dark halftone in print, instead
1185 % of actual black. The dark red here is dark enough to print on paper as
1186 % nearly black, but still distinguishable for online viewing. We use
1187 % black by default, though.
1188 \def\rgbDarkRed{0.50 0.09 0.12}
1189 \def\rgbBlack{0 0 0}
1190 %
1191 % rg sets the color for filling (usual text, etc.);
1192 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1193 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1194 %
1195 % Set color, and create a mark which defines \thiscolor accordingly,
1196 % so that \makeheadline knows which color to restore.
1197 \def\curcolor{0 0 0}%
1198 \def\setcolor#1{%
1199 \ifx#1\curcolor\else
1200 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1201 \domark
1202 \pdfsetcolor{#1}%
1203 \xdef\curcolor{#1}%
1204 \fi
1205 }
1206 %
1207 \let\maincolor\rgbBlack
1208 \pdfsetcolor{\maincolor}
1209 \edef\thiscolor{\maincolor}
1210 \def\currentcolordefs{}
1211 %
1212 \def\makefootline{%
1213 \baselineskip24pt
1214 \line{\pdfsetcolor{\maincolor}\the\footline}%
1215 }
1216 %
1217 \def\makeheadline{%
1218 \vbox to 0pt{%
1219 \vskip-22.5pt
1220 \line{%
1221 \vbox to8.5pt{}%
1222 % Extract \thiscolor definition from the marks.
1223 \getcolormarks
1224 % Typeset the headline with \maincolor, then restore the color.
1225 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1226 }%
1227 \vss
1228 }%
1229 \nointerlineskip
1230 }
1231 %
1232 %
1233 \pdfcatalog{/PageMode /UseOutlines}
1234 %
1235 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1236 \def\dopdfimage#1#2#3{%
1237 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1238 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1239 %
1240 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1241 % others). Let's try in that order, PDF first since if
1242 % someone has a scalable image, presumably better to use that than a
1243 % bitmap.
1244 \let\pdfimgext=\empty
1245 \begingroup
1246 \openin 1 #1.pdf \ifeof 1
1247 \openin 1 #1.PDF \ifeof 1
1248 \openin 1 #1.png \ifeof 1
1249 \openin 1 #1.jpg \ifeof 1
1250 \openin 1 #1.jpeg \ifeof 1
1251 \openin 1 #1.JPG \ifeof 1
1252 \errhelp = \nopdfimagehelp
1253 \errmessage{Could not find image file #1 for pdf}%
1254 \else \gdef\pdfimgext{JPG}%
1255 \fi
1256 \else \gdef\pdfimgext{jpeg}%
1257 \fi
1258 \else \gdef\pdfimgext{jpg}%
1259 \fi
1260 \else \gdef\pdfimgext{png}%
1261 \fi
1262 \else \gdef\pdfimgext{PDF}%
1263 \fi
1264 \else \gdef\pdfimgext{pdf}%
1265 \fi
1266 \closein 1
1267 \endgroup
1268 %
1269 % without \immediate, ancient pdftex seg faults when the same image is
1270 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1271 \ifnum\pdftexversion < 14
1272 \immediate\pdfimage
1273 \else
1274 \immediate\pdfximage
1275 \fi
1276 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1277 \ifdim \wd2 >0pt height \pdfimageheight \fi
1278 \ifnum\pdftexversion<13
1279 #1.\pdfimgext
1280 \else
1281 {#1.\pdfimgext}%
1282 \fi
1283 \ifnum\pdftexversion < 14 \else
1284 \pdfrefximage \pdflastximage
1285 \fi}
1286 %
1287 \def\setpdfdestname#1{{%
1288 % We have to set dummies so commands such as @code, and characters
1289 % such as \, aren't expanded when present in a section title.
1290 \indexnofonts
1291 \makevalueexpandable
1292 \turnoffactive
1293 \iftxiuseunicodedestname
1294 \ifx \declaredencoding \latone
1295 % Pass through Latin-1 characters.
1296 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1297 \else
1298 \ifx \declaredencoding \utfeight
1299 % Pass through Unicode characters.
1300 \else
1301 % Use ASCII approximations in destination names.
1302 \passthroughcharsfalse
1303 \fi
1304 \fi
1305 \else
1306 % Use ASCII approximations in destination names.
1307 \passthroughcharsfalse
1308 \fi
1309 \def\pdfdestname{#1}%
1310 \txiescapepdf\pdfdestname
1311 }}
1312 %
1313 \def\setpdfoutlinetext#1{{%
1314 \indexnofonts
1315 \makevalueexpandable
1316 \turnoffactive
1317 \ifx \declaredencoding \latone
1318 % The PDF format can use an extended form of Latin-1 in bookmark
1319 % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1320 % the "PDFDocEncoding".
1321 \passthroughcharstrue
1322 % Pass through Latin-1 characters.
1323 % LuaTeX: Convert to Unicode
1324 % pdfTeX: Use Latin-1 as PDFDocEncoding
1325 \def\pdfoutlinetext{#1}%
1326 \else
1327 \ifx \declaredencoding \utfeight
1328 \ifx\luatexversion\thisisundefined
1329 % For pdfTeX with UTF-8.
1330 % TODO: the PDF format can use UTF-16 in bookmark strings,
1331 % but the code for this isn't done yet.
1332 % Use ASCII approximations.
1333 \passthroughcharsfalse
1334 \def\pdfoutlinetext{#1}%
1335 \else
1336 % For LuaTeX with UTF-8.
1337 % Pass through Unicode characters for title texts.
1338 \passthroughcharstrue
1339 \def\pdfoutlinetext{#1}%
1340 \fi
1341 \else
1342 % For non-Latin-1 or non-UTF-8 encodings.
1343 % Use ASCII approximations.
1344 \passthroughcharsfalse
1345 \def\pdfoutlinetext{#1}%
1346 \fi
1347 \fi
1348 % LuaTeX: Convert to UTF-16
1349 % pdfTeX: Use Latin-1 as PDFDocEncoding
1350 \txiescapepdfutfsixteen\pdfoutlinetext
1351 }}
1352 %
1353 \def\pdfmkdest#1{%
1354 \setpdfdestname{#1}%
1355 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1356 }
1357 %
1358 % used to mark target names; must be expandable.
1359 \def\pdfmkpgn#1{#1}
1360 %
1361 % by default, use black for everything.
1362 \def\urlcolor{\rgbBlack}
1363 \let\linkcolor\rgbBlack
1364 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1365 %
1366 % Adding outlines to PDF; macros for calculating structure of outlines
1367 % come from Petr Olsak
1368 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1369 \else \csname#1\endcsname \fi}
1370 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1371 \advance\tempnum by 1
1372 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1373 %
1374 % #1 is the section text, which is what will be displayed in the
1375 % outline by the pdf viewer. #2 is the pdf expression for the number
1376 % of subentries (or empty, for subsubsections). #3 is the node text,
1377 % which might be empty if this toc entry had no corresponding node.
1378 % #4 is the page number
1379 %
1380 \def\dopdfoutline#1#2#3#4{%
1381 % Generate a link to the node text if that exists; else, use the
1382 % page number. We could generate a destination for the section
1383 % text in the case where a section has no node, but it doesn't
1384 % seem worth the trouble, since most documents are normally structured.
1385 \setpdfoutlinetext{#1}
1386 \setpdfdestname{#3}
1387 \ifx\pdfdestname\empty
1388 \def\pdfdestname{#4}%
1389 \fi
1390 %
1391 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
1392 }
1393 %
1394 \def\pdfmakeoutlines{%
1395 \begingroup
1396 % Read toc silently, to get counts of subentries for \pdfoutline.
1397 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1398 \def\numchapentry##1##2##3##4{%
1399 \def\thischapnum{##2}%
1400 \def\thissecnum{0}%
1401 \def\thissubsecnum{0}%
1402 }%
1403 \def\numsecentry##1##2##3##4{%
1404 \advancenumber{chap\thischapnum}%
1405 \def\thissecnum{##2}%
1406 \def\thissubsecnum{0}%
1407 }%
1408 \def\numsubsecentry##1##2##3##4{%
1409 \advancenumber{sec\thissecnum}%
1410 \def\thissubsecnum{##2}%
1411 }%
1412 \def\numsubsubsecentry##1##2##3##4{%
1413 \advancenumber{subsec\thissubsecnum}%
1414 }%
1415 \def\thischapnum{0}%
1416 \def\thissecnum{0}%
1417 \def\thissubsecnum{0}%
1418 %
1419 % use \def rather than \let here because we redefine \chapentry et
1420 % al. a second time, below.
1421 \def\appentry{\numchapentry}%
1422 \def\appsecentry{\numsecentry}%
1423 \def\appsubsecentry{\numsubsecentry}%
1424 \def\appsubsubsecentry{\numsubsubsecentry}%
1425 \def\unnchapentry{\numchapentry}%
1426 \def\unnsecentry{\numsecentry}%
1427 \def\unnsubsecentry{\numsubsecentry}%
1428 \def\unnsubsubsecentry{\numsubsubsecentry}%
1429 \readdatafile{toc}%
1430 %
1431 % Read toc second time, this time actually producing the outlines.
1432 % The `-' means take the \expnumber as the absolute number of
1433 % subentries, which we calculated on our first read of the .toc above.
1434 %
1435 % We use the node names as the destinations.
1436 %
1437 % Currently we prefix the section name with the section number
1438 % for chapter and appendix headings only in order to avoid too much
1439 % horizontal space being required in the PDF viewer.
1440 \def\numchapentry##1##2##3##4{%
1441 \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1442 \def\unnchapentry##1##2##3##4{%
1443 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1444 \def\numsecentry##1##2##3##4{%
1445 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1446 \def\numsubsecentry##1##2##3##4{%
1447 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1448 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1449 \dopdfoutline{##1}{}{##3}{##4}}%
1450 %
1451 % PDF outlines are displayed using system fonts, instead of
1452 % document fonts. Therefore we cannot use special characters,
1453 % since the encoding is unknown. For example, the eogonek from
1454 % Latin 2 (0xea) gets translated to a | character. Info from
1455 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1456 %
1457 % TODO this right, we have to translate 8-bit characters to
1458 % their "best" equivalent, based on the @documentencoding. Too
1459 % much work for too little return. Just use the ASCII equivalents
1460 % we use for the index sort strings.
1461 %
1462 \indexnofonts
1463 \setupdatafile
1464 % We can have normal brace characters in the PDF outlines, unlike
1465 % Texinfo index files. So set that up.
1466 \def\{{\lbracecharliteral}%
1467 \def\}{\rbracecharliteral}%
1468 \catcode`\\=\active \otherbackslash
1469 \input \tocreadfilename
1470 \endgroup
1471 }
1472 {\catcode`[=1 \catcode`]=2
1473 \catcode`{=\other \catcode`}=\other
1474 \gdef\lbracecharliteral[{]%
1475 \gdef\rbracecharliteral[}]%
1476 ]
1477 %
1478 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1479 \ifx\PP\D\let\nextsp\relax
1480 \else\let\nextsp\skipspaces
1481 \addtokens{\filename}{\PP}%
1482 \advance\filenamelength by 1
1483 \fi
1484 \nextsp}
1485 \def\getfilename#1{%
1486 \filenamelength=0
1487 % If we don't expand the argument now, \skipspaces will get
1488 % snagged on things like "@value{foo}".
1489 \edef\temp{#1}%
1490 \expandafter\skipspaces\temp|\relax
1491 }
1492 \ifnum\pdftexversion < 14
1493 \let \startlink \pdfannotlink
1494 \else
1495 \let \startlink \pdfstartlink
1496 \fi
1497 % make a live url in pdf output.
1498 \def\pdfurl#1{%
1499 \begingroup
1500 % it seems we really need yet another set of dummies; have not
1501 % tried to figure out what each command should do in the context
1502 % of @url. for now, just make @/ a no-op, that's the only one
1503 % people have actually reported a problem with.
1504 %
1505 \normalturnoffactive
1506 \def\@{@}%
1507 \let\/=\empty
1508 \makevalueexpandable
1509 % do we want to go so far as to use \indexnofonts instead of just
1510 % special-casing \var here?
1511 \def\var##1{##1}%
1512 %
1513 \leavevmode\setcolor{\urlcolor}%
1514 \startlink attr{/Border [0 0 0]}%
1515 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1516 \endgroup}
1517 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
1518 % be a simple number, or a list of numbers in the case of an index
1519 % entry.
1520 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1521 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1522 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1523 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1524 \def\maketoks{%
1525 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1526 \ifx\first0\adn0
1527 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1528 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1529 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1530 \else
1531 \ifnum0=\countA\else\makelink\fi
1532 \ifx\first.\let\next=\done\else
1533 \let\next=\maketoks
1534 \addtokens{\toksB}{\the\toksD}
1535 \ifx\first,\addtokens{\toksB}{\space}\fi
1536 \fi
1537 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1538 \next}
1539 \def\makelink{\addtokens{\toksB}%
1540 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1541 \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1542 \def\pdflinkpage#1#2{%
1543 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1544 \setcolor{\linkcolor}#2\endlink}
1545 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1546 \else
1547 % non-pdf mode
1548 \let\pdfmkdest = \gobble
1549 \let\pdfurl = \gobble
1550 \let\endlink = \relax
1551 \let\setcolor = \gobble
1552 \let\pdfsetcolor = \gobble
1553 \let\pdfmakeoutlines = \relax
1554 \fi % \ifx\pdfoutput
1555
1556 %
1557 % For XeTeX
1558 %
1559 \ifx\XeTeXrevision\thisisundefined
1560 \else
1561 %
1562 % XeTeX version check
1563 %
1564 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1565 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1566 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1567 % For avoiding PDF destination name replacement, we use this special
1568 % instead of xdvipdfmx's command line option `-C 0x0010'.
1569 \special{dvipdfmx:config C 0x0010}
1570 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1571 % It can handle Unicode destination names for PDF.
1572 \txiuseunicodedestnametrue
1573 \else
1574 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1575 % `dvipdfmx:config' special.
1576 % So for avoiding PDF destination name replacement,
1577 % xdvipdfmx's command line option `-C 0x0010' is necessary.
1578 %
1579 % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1580 % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1581 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1582 \txiuseunicodedestnamefalse
1583 \fi
1584 %
1585 % Color support
1586 %
1587 \def\rgbDarkRed{0.50 0.09 0.12}
1588 \def\rgbBlack{0 0 0}
1589 %
1590 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1591 %
1592 % Set color, and create a mark which defines \thiscolor accordingly,
1593 % so that \makeheadline knows which color to restore.
1594 \def\setcolor#1{%
1595 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1596 \domark
1597 \pdfsetcolor{#1}%
1598 }
1599 %
1600 \def\maincolor{\rgbBlack}
1601 \pdfsetcolor{\maincolor}
1602 \edef\thiscolor{\maincolor}
1603 \def\currentcolordefs{}
1604 %
1605 \def\makefootline{%
1606 \baselineskip24pt
1607 \line{\pdfsetcolor{\maincolor}\the\footline}%
1608 }
1609 %
1610 \def\makeheadline{%
1611 \vbox to 0pt{%
1612 \vskip-22.5pt
1613 \line{%
1614 \vbox to8.5pt{}%
1615 % Extract \thiscolor definition from the marks.
1616 \getcolormarks
1617 % Typeset the headline with \maincolor, then restore the color.
1618 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1619 }%
1620 \vss
1621 }%
1622 \nointerlineskip
1623 }
1624 %
1625 % PDF outline support
1626 %
1627 % Emulate pdfTeX primitive
1628 \def\pdfdest name#1 xyz{%
1629 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1630 }
1631 %
1632 \def\setpdfdestname#1{{%
1633 % We have to set dummies so commands such as @code, and characters
1634 % such as \, aren't expanded when present in a section title.
1635 \indexnofonts
1636 \makevalueexpandable
1637 \turnoffactive
1638 \iftxiuseunicodedestname
1639 % Pass through Unicode characters.
1640 \else
1641 % Use ASCII approximations in destination names.
1642 \passthroughcharsfalse
1643 \fi
1644 \def\pdfdestname{#1}%
1645 \txiescapepdf\pdfdestname
1646 }}
1647 %
1648 \def\setpdfoutlinetext#1{{%
1649 \turnoffactive
1650 % Always use Unicode characters in title texts.
1651 \def\pdfoutlinetext{#1}%
1652 % For XeTeX, xdvipdfmx converts to UTF-16.
1653 % So we do not convert.
1654 \txiescapepdf\pdfoutlinetext
1655 }}
1656 %
1657 \def\pdfmkdest#1{%
1658 \setpdfdestname{#1}%
1659 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1660 }
1661 %
1662 % by default, use black for everything.
1663 \def\urlcolor{\rgbBlack}
1664 \def\linkcolor{\rgbBlack}
1665 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1666 %
1667 \def\dopdfoutline#1#2#3#4{%
1668 \setpdfoutlinetext{#1}
1669 \setpdfdestname{#3}
1670 \ifx\pdfdestname\empty
1671 \def\pdfdestname{#4}%
1672 \fi
1673 %
1674 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1675 << /S /GoTo /D (\pdfdestname) >> >> }%
1676 }
1677 %
1678 \def\pdfmakeoutlines{%
1679 \begingroup
1680 %
1681 % For XeTeX, counts of subentries are not necessary.
1682 % Therefore, we read toc only once.
1683 %
1684 % We use node names as destinations.
1685 %
1686 % Currently we prefix the section name with the section number
1687 % for chapter and appendix headings only in order to avoid too much
1688 % horizontal space being required in the PDF viewer.
1689 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1690 \def\numchapentry##1##2##3##4{%
1691 \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
1692 \def\numsecentry##1##2##3##4{%
1693 \dopdfoutline{##1}{2}{##3}{##4}}%
1694 \def\numsubsecentry##1##2##3##4{%
1695 \dopdfoutline{##1}{3}{##3}{##4}}%
1696 \def\numsubsubsecentry##1##2##3##4{%
1697 \dopdfoutline{##1}{4}{##3}{##4}}%
1698 %
1699 \let\appentry\numchapentry%
1700 \let\appsecentry\numsecentry%
1701 \let\appsubsecentry\numsubsecentry%
1702 \let\appsubsubsecentry\numsubsubsecentry%
1703 \def\unnchapentry##1##2##3##4{%
1704 \dopdfoutline{##1}{1}{##3}{##4}}%
1705 \let\unnsecentry\numsecentry%
1706 \let\unnsubsecentry\numsubsecentry%
1707 \let\unnsubsubsecentry\numsubsubsecentry%
1708 %
1709 % For XeTeX, xdvipdfmx converts strings to UTF-16.
1710 % Therefore, the encoding and the language may not be considered.
1711 %
1712 \indexnofonts
1713 \setupdatafile
1714 % We can have normal brace characters in the PDF outlines, unlike
1715 % Texinfo index files. So set that up.
1716 \def\{{\lbracecharliteral}%
1717 \def\}{\rbracecharliteral}%
1718 \catcode`\\=\active \otherbackslash
1719 \input \tocreadfilename
1720 \endgroup
1721 }
1722 {\catcode`[=1 \catcode`]=2
1723 \catcode`{=\other \catcode`}=\other
1724 \gdef\lbracecharliteral[{]%
1725 \gdef\rbracecharliteral[}]%
1726 ]
1727
1728 \special{pdf:docview << /PageMode /UseOutlines >> }
1729 % ``\special{pdf:tounicode ...}'' is not necessary
1730 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1731 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1732 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1733 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1734 %
1735 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1736 \ifx\PP\D\let\nextsp\relax
1737 \else\let\nextsp\skipspaces
1738 \addtokens{\filename}{\PP}%
1739 \advance\filenamelength by 1
1740 \fi
1741 \nextsp}
1742 \def\getfilename#1{%
1743 \filenamelength=0
1744 % If we don't expand the argument now, \skipspaces will get
1745 % snagged on things like "@value{foo}".
1746 \edef\temp{#1}%
1747 \expandafter\skipspaces\temp|\relax
1748 }
1749 % make a live url in pdf output.
1750 \def\pdfurl#1{%
1751 \begingroup
1752 % it seems we really need yet another set of dummies; have not
1753 % tried to figure out what each command should do in the context
1754 % of @url. for now, just make @/ a no-op, that's the only one
1755 % people have actually reported a problem with.
1756 %
1757 \normalturnoffactive
1758 \def\@{@}%
1759 \let\/=\empty
1760 \makevalueexpandable
1761 % do we want to go so far as to use \indexnofonts instead of just
1762 % special-casing \var here?
1763 \def\var##1{##1}%
1764 %
1765 \leavevmode\setcolor{\urlcolor}%
1766 \special{pdf:bann << /Border [0 0 0]
1767 /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1768 \endgroup}
1769 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1770 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1771 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1772 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1773 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1774 \def\maketoks{%
1775 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1776 \ifx\first0\adn0
1777 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1778 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1779 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1780 \else
1781 \ifnum0=\countA\else\makelink\fi
1782 \ifx\first.\let\next=\done\else
1783 \let\next=\maketoks
1784 \addtokens{\toksB}{\the\toksD}
1785 \ifx\first,\addtokens{\toksB}{\space}\fi
1786 \fi
1787 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1788 \next}
1789 \def\makelink{\addtokens{\toksB}%
1790 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1791 \def\pdflink#1{\pdflinkpage{#1}{#1}}%
1792 \def\pdflinkpage#1#2{%
1793 \special{pdf:bann << /Border [0 0 0]
1794 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1795 \setcolor{\linkcolor}#2\endlink}
1796 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1797 %
1798 %
1799 % @image support
1800 %
1801 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1802 \def\doxeteximage#1#2#3{%
1803 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1804 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1805 %
1806 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1807 % others). Let's try in that order, PDF first since if
1808 % someone has a scalable image, presumably better to use that than a
1809 % bitmap.
1810 \let\xeteximgext=\empty
1811 \begingroup
1812 \openin 1 #1.pdf \ifeof 1
1813 \openin 1 #1.PDF \ifeof 1
1814 \openin 1 #1.png \ifeof 1
1815 \openin 1 #1.jpg \ifeof 1
1816 \openin 1 #1.jpeg \ifeof 1
1817 \openin 1 #1.JPG \ifeof 1
1818 \errmessage{Could not find image file #1 for XeTeX}%
1819 \else \gdef\xeteximgext{JPG}%
1820 \fi
1821 \else \gdef\xeteximgext{jpeg}%
1822 \fi
1823 \else \gdef\xeteximgext{jpg}%
1824 \fi
1825 \else \gdef\xeteximgext{png}%
1826 \fi
1827 \else \gdef\xeteximgext{PDF}%
1828 \fi
1829 \else \gdef\xeteximgext{pdf}%
1830 \fi
1831 \closein 1
1832 \endgroup
1833 %
1834 % Putting an \hbox around the image can prevent an over-long line
1835 % after the image.
1836 \hbox\bgroup
1837 \def\xetexpdfext{pdf}%
1838 \ifx\xeteximgext\xetexpdfext
1839 \XeTeXpdffile "#1".\xeteximgext ""
1840 \else
1841 \def\xetexpdfext{PDF}%
1842 \ifx\xeteximgext\xetexpdfext
1843 \XeTeXpdffile "#1".\xeteximgext ""
1844 \else
1845 \XeTeXpicfile "#1".\xeteximgext ""
1846 \fi
1847 \fi
1848 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1849 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1850 \egroup
1851 }
1852 \fi
1853
1854
1855 %
1856 \message{fonts,}
1857
1858 % Set the baselineskip to #1, and the lineskip and strut size
1859 % correspondingly. There is no deep meaning behind these magic numbers
1860 % used as factors; they just match (closely enough) what Knuth defined.
1861 %
1862 \def\lineskipfactor{.08333}
1863 \def\strutheightpercent{.70833}
1864 \def\strutdepthpercent {.29167}
1865 %
1866 % can get a sort of poor man's double spacing by redefining this.
1867 \def\baselinefactor{1}
1868 %
1869 \newdimen\textleading
1870 \def\setleading#1{%
1871 \dimen0 = #1\relax
1872 \normalbaselineskip = \baselinefactor\dimen0
1873 \normallineskip = \lineskipfactor\normalbaselineskip
1874 \normalbaselines
1875 \setbox\strutbox =\hbox{%
1876 \vrule width0pt height\strutheightpercent\baselineskip
1877 depth \strutdepthpercent \baselineskip
1878 }%
1879 }
1880
1881 % PDF CMaps. See also LaTeX's t1.cmap.
1882 %
1883 % do nothing with this by default.
1884 \expandafter\let\csname cmapOT1\endcsname\gobble
1885 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1886 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1887
1888 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1889 % (\pdffontattr was introduced many years ago, but people still run
1890 % older pdftex's; it's easy to conditionalize, so we do.)
1891 \ifpdf \ifx\pdffontattr\thisisundefined \else
1892 \begingroup
1893 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1894 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1895 %%DocumentNeededResources: ProcSet (CIDInit)
1896 %%IncludeResource: ProcSet (CIDInit)
1897 %%BeginResource: CMap (TeX-OT1-0)
1898 %%Title: (TeX-OT1-0 TeX OT1 0)
1899 %%Version: 1.000
1900 %%EndComments
1901 /CIDInit /ProcSet findresource begin
1902 12 dict begin
1903 begincmap
1904 /CIDSystemInfo
1905 << /Registry (TeX)
1906 /Ordering (OT1)
1907 /Supplement 0
1908 >> def
1909 /CMapName /TeX-OT1-0 def
1910 /CMapType 2 def
1911 1 begincodespacerange
1912 <00> <7F>
1913 endcodespacerange
1914 8 beginbfrange
1915 <00> <01> <0393>
1916 <09> <0A> <03A8>
1917 <23> <26> <0023>
1918 <28> <3B> <0028>
1919 <3F> <5B> <003F>
1920 <5D> <5E> <005D>
1921 <61> <7A> <0061>
1922 <7B> <7C> <2013>
1923 endbfrange
1924 40 beginbfchar
1925 <02> <0398>
1926 <03> <039B>
1927 <04> <039E>
1928 <05> <03A0>
1929 <06> <03A3>
1930 <07> <03D2>
1931 <08> <03A6>
1932 <0B> <00660066>
1933 <0C> <00660069>
1934 <0D> <0066006C>
1935 <0E> <006600660069>
1936 <0F> <00660066006C>
1937 <10> <0131>
1938 <11> <0237>
1939 <12> <0060>
1940 <13> <00B4>
1941 <14> <02C7>
1942 <15> <02D8>
1943 <16> <00AF>
1944 <17> <02DA>
1945 <18> <00B8>
1946 <19> <00DF>
1947 <1A> <00E6>
1948 <1B> <0153>
1949 <1C> <00F8>
1950 <1D> <00C6>
1951 <1E> <0152>
1952 <1F> <00D8>
1953 <21> <0021>
1954 <22> <201D>
1955 <27> <2019>
1956 <3C> <00A1>
1957 <3D> <003D>
1958 <3E> <00BF>
1959 <5C> <201C>
1960 <5F> <02D9>
1961 <60> <2018>
1962 <7D> <02DD>
1963 <7E> <007E>
1964 <7F> <00A8>
1965 endbfchar
1966 endcmap
1967 CMapName currentdict /CMap defineresource pop
1968 end
1969 end
1970 %%EndResource
1971 %%EOF
1972 }\endgroup
1973 \expandafter\edef\csname cmapOT1\endcsname#1{%
1974 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1975 }%
1976 %
1977 % \cmapOT1IT
1978 \begingroup
1979 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1980 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1981 %%DocumentNeededResources: ProcSet (CIDInit)
1982 %%IncludeResource: ProcSet (CIDInit)
1983 %%BeginResource: CMap (TeX-OT1IT-0)
1984 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1985 %%Version: 1.000
1986 %%EndComments
1987 /CIDInit /ProcSet findresource begin
1988 12 dict begin
1989 begincmap
1990 /CIDSystemInfo
1991 << /Registry (TeX)
1992 /Ordering (OT1IT)
1993 /Supplement 0
1994 >> def
1995 /CMapName /TeX-OT1IT-0 def
1996 /CMapType 2 def
1997 1 begincodespacerange
1998 <00> <7F>
1999 endcodespacerange
2000 8 beginbfrange
2001 <00> <01> <0393>
2002 <09> <0A> <03A8>
2003 <25> <26> <0025>
2004 <28> <3B> <0028>
2005 <3F> <5B> <003F>
2006 <5D> <5E> <005D>
2007 <61> <7A> <0061>
2008 <7B> <7C> <2013>
2009 endbfrange
2010 42 beginbfchar
2011 <02> <0398>
2012 <03> <039B>
2013 <04> <039E>
2014 <05> <03A0>
2015 <06> <03A3>
2016 <07> <03D2>
2017 <08> <03A6>
2018 <0B> <00660066>
2019 <0C> <00660069>
2020 <0D> <0066006C>
2021 <0E> <006600660069>
2022 <0F> <00660066006C>
2023 <10> <0131>
2024 <11> <0237>
2025 <12> <0060>
2026 <13> <00B4>
2027 <14> <02C7>
2028 <15> <02D8>
2029 <16> <00AF>
2030 <17> <02DA>
2031 <18> <00B8>
2032 <19> <00DF>
2033 <1A> <00E6>
2034 <1B> <0153>
2035 <1C> <00F8>
2036 <1D> <00C6>
2037 <1E> <0152>
2038 <1F> <00D8>
2039 <21> <0021>
2040 <22> <201D>
2041 <23> <0023>
2042 <24> <00A3>
2043 <27> <2019>
2044 <3C> <00A1>
2045 <3D> <003D>
2046 <3E> <00BF>
2047 <5C> <201C>
2048 <5F> <02D9>
2049 <60> <2018>
2050 <7D> <02DD>
2051 <7E> <007E>
2052 <7F> <00A8>
2053 endbfchar
2054 endcmap
2055 CMapName currentdict /CMap defineresource pop
2056 end
2057 end
2058 %%EndResource
2059 %%EOF
2060 }\endgroup
2061 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2062 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2063 }%
2064 %
2065 % \cmapOT1TT
2066 \begingroup
2067 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2068 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2069 %%DocumentNeededResources: ProcSet (CIDInit)
2070 %%IncludeResource: ProcSet (CIDInit)
2071 %%BeginResource: CMap (TeX-OT1TT-0)
2072 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2073 %%Version: 1.000
2074 %%EndComments
2075 /CIDInit /ProcSet findresource begin
2076 12 dict begin
2077 begincmap
2078 /CIDSystemInfo
2079 << /Registry (TeX)
2080 /Ordering (OT1TT)
2081 /Supplement 0
2082 >> def
2083 /CMapName /TeX-OT1TT-0 def
2084 /CMapType 2 def
2085 1 begincodespacerange
2086 <00> <7F>
2087 endcodespacerange
2088 5 beginbfrange
2089 <00> <01> <0393>
2090 <09> <0A> <03A8>
2091 <21> <26> <0021>
2092 <28> <5F> <0028>
2093 <61> <7E> <0061>
2094 endbfrange
2095 32 beginbfchar
2096 <02> <0398>
2097 <03> <039B>
2098 <04> <039E>
2099 <05> <03A0>
2100 <06> <03A3>
2101 <07> <03D2>
2102 <08> <03A6>
2103 <0B> <2191>
2104 <0C> <2193>
2105 <0D> <0027>
2106 <0E> <00A1>
2107 <0F> <00BF>
2108 <10> <0131>
2109 <11> <0237>
2110 <12> <0060>
2111 <13> <00B4>
2112 <14> <02C7>
2113 <15> <02D8>
2114 <16> <00AF>
2115 <17> <02DA>
2116 <18> <00B8>
2117 <19> <00DF>
2118 <1A> <00E6>
2119 <1B> <0153>
2120 <1C> <00F8>
2121 <1D> <00C6>
2122 <1E> <0152>
2123 <1F> <00D8>
2124 <20> <2423>
2125 <27> <2019>
2126 <60> <2018>
2127 <7F> <00A8>
2128 endbfchar
2129 endcmap
2130 CMapName currentdict /CMap defineresource pop
2131 end
2132 end
2133 %%EndResource
2134 %%EOF
2135 }\endgroup
2136 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2137 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2138 }%
2139 \fi\fi
2140 %
2141 % This is what gets called when #5 of \setfont is empty.
2142 \let\cmap\gobble
2143 %
2144 % (end of cmaps)
2145
2146
2147 % Set the font macro #1 to the font named \fontprefix#2.
2148 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2149 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2150 % Example:
2151 % #1 = \textrm
2152 % #2 = \rmshape
2153 % #3 = 10
2154 % #4 = \mainmagstep
2155 % #5 = OT1
2156 %
2157 \def\setfont#1#2#3#4#5{%
2158 \font#1=\fontprefix#2#3 scaled #4
2159 \csname cmap#5\endcsname#1%
2160 \ifx#2\ttshape\hyphenchar#1=-1 \fi
2161 \ifx#2\ttbshape\hyphenchar#1=-1 \fi
2162 \ifx#2\ttslshape\hyphenchar#1=-1 \fi
2163 }
2164
2165 % Use cm as the default font prefix.
2166 % To specify the font prefix, you must define \fontprefix
2167 % before you read in texinfo.tex.
2168 \ifx\fontprefix\thisisundefined
2169 \def\fontprefix{cm}
2170 \fi
2171 % Support font families that don't use the same naming scheme as CM.
2172 \def\rmshape{r}
2173 \def\rmbshape{bx} % where the normal face is bold
2174 \def\bfshape{b}
2175 \def\bxshape{bx}
2176 \def\ttshape{tt}
2177 \def\ttbshape{tt}
2178 \def\ttslshape{sltt}
2179 \def\itshape{ti}
2180 \def\itbshape{bxti}
2181 \def\slshape{sl}
2182 \def\slbshape{bxsl}
2183 \def\sfshape{ss}
2184 \def\sfbshape{ss}
2185 \def\scshape{csc}
2186 \def\scbshape{csc}
2187
2188 % Definitions for a main text size of 11pt. (The default in Texinfo.)
2189 %
2190 \def\definetextfontsizexi{%
2191 % Text fonts (11.2pt, magstep1).
2192 \def\textnominalsize{11pt}
2193 \edef\mainmagstep{\magstephalf}
2194 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2195 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2196 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2197 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2198 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2199 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2200 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2201 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2202 \font\texti=cmmi10 scaled \mainmagstep
2203 \font\textsy=cmsy10 scaled \mainmagstep
2204 \def\textecsize{1095}
2205
2206 % A few fonts for @defun names and args.
2207 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2208 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2209 \setfont\defsl\slshape{10}{\magstep1}{OT1}
2210 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2211 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2212 \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2213
2214 % Fonts for indices, footnotes, small examples (9pt).
2215 \def\smallnominalsize{9pt}
2216 \setfont\smallrm\rmshape{9}{1000}{OT1}
2217 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2218 \setfont\smallbf\bfshape{10}{900}{OT1}
2219 \setfont\smallit\itshape{9}{1000}{OT1IT}
2220 \setfont\smallsl\slshape{9}{1000}{OT1}
2221 \setfont\smallsf\sfshape{9}{1000}{OT1}
2222 \setfont\smallsc\scshape{10}{900}{OT1}
2223 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2224 \font\smalli=cmmi9
2225 \font\smallsy=cmsy9
2226 \def\smallecsize{0900}
2227
2228 % Fonts for small examples (8pt).
2229 \def\smallernominalsize{8pt}
2230 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2231 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2232 \setfont\smallerbf\bfshape{10}{800}{OT1}
2233 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2234 \setfont\smallersl\slshape{8}{1000}{OT1}
2235 \setfont\smallersf\sfshape{8}{1000}{OT1}
2236 \setfont\smallersc\scshape{10}{800}{OT1}
2237 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2238 \font\smalleri=cmmi8
2239 \font\smallersy=cmsy8
2240 \def\smallerecsize{0800}
2241
2242 % Fonts for math mode superscripts (7pt).
2243 \def\sevennominalsize{7pt}
2244 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2245 \setfont\seventt\ttshape{10}{700}{OT1TT}
2246 \setfont\sevenbf\bfshape{10}{700}{OT1}
2247 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2248 \setfont\sevensl\slshape{10}{700}{OT1}
2249 \setfont\sevensf\sfshape{10}{700}{OT1}
2250 \setfont\sevensc\scshape{10}{700}{OT1}
2251 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2252 \font\seveni=cmmi7
2253 \font\sevensy=cmsy7
2254 \def\sevenecsize{0700}
2255
2256 % Fonts for title page (20.4pt):
2257 \def\titlenominalsize{20pt}
2258 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2259 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2260 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2261 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2262 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2263 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2264 \let\titlebf=\titlerm
2265 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2266 \font\titlei=cmmi12 scaled \magstep3
2267 \font\titlesy=cmsy10 scaled \magstep4
2268 \def\titleecsize{2074}
2269
2270 % Chapter (and unnumbered) fonts (17.28pt).
2271 \def\chapnominalsize{17pt}
2272 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2273 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2274 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2275 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2276 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2277 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2278 \let\chapbf=\chaprm
2279 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2280 \font\chapi=cmmi12 scaled \magstep2
2281 \font\chapsy=cmsy10 scaled \magstep3
2282 \def\chapecsize{1728}
2283
2284 % Section fonts (14.4pt).
2285 \def\secnominalsize{14pt}
2286 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2287 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2288 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2289 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2290 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2291 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2292 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2293 \let\secbf\secrm
2294 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2295 \font\seci=cmmi12 scaled \magstep1
2296 \font\secsy=cmsy10 scaled \magstep2
2297 \def\sececsize{1440}
2298
2299 % Subsection fonts (13.15pt).
2300 \def\ssecnominalsize{13pt}
2301 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2302 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2303 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2304 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2305 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2306 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2307 \let\ssecbf\ssecrm
2308 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2309 \font\sseci=cmmi12 scaled \magstephalf
2310 \font\ssecsy=cmsy10 scaled 1315
2311 \def\ssececsize{1200}
2312
2313 % Reduced fonts for @acronym in text (10pt).
2314 \def\reducednominalsize{10pt}
2315 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2316 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2317 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2318 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2319 \setfont\reducedsl\slshape{10}{1000}{OT1}
2320 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2321 \setfont\reducedsc\scshape{10}{1000}{OT1}
2322 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2323 \font\reducedi=cmmi10
2324 \font\reducedsy=cmsy10
2325 \def\reducedecsize{1000}
2326
2327 \textleading = 13.2pt % line spacing for 11pt CM
2328 \textfonts % reset the current fonts
2329 \rm
2330 } % end of 11pt text font size definitions, \definetextfontsizexi
2331
2332
2333 % Definitions to make the main text be 10pt Computer Modern, with
2334 % section, chapter, etc., sizes following suit. This is for the GNU
2335 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2336 % future. Used with @smallbook, which sets the leading to 12pt.
2337 %
2338 \def\definetextfontsizex{%
2339 % Text fonts (10pt).
2340 \def\textnominalsize{10pt}
2341 \edef\mainmagstep{1000}
2342 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2343 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2344 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2345 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2346 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2347 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2348 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2349 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2350 \font\texti=cmmi10 scaled \mainmagstep
2351 \font\textsy=cmsy10 scaled \mainmagstep
2352 \def\textecsize{1000}
2353
2354 % A few fonts for @defun names and args.
2355 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2356 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2357 \setfont\defsl\slshape{10}{\magstephalf}{OT1}
2358 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2359 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2360 \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2361
2362 % Fonts for indices, footnotes, small examples (9pt).
2363 \def\smallnominalsize{9pt}
2364 \setfont\smallrm\rmshape{9}{1000}{OT1}
2365 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2366 \setfont\smallbf\bfshape{10}{900}{OT1}
2367 \setfont\smallit\itshape{9}{1000}{OT1IT}
2368 \setfont\smallsl\slshape{9}{1000}{OT1}
2369 \setfont\smallsf\sfshape{9}{1000}{OT1}
2370 \setfont\smallsc\scshape{10}{900}{OT1}
2371 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2372 \font\smalli=cmmi9
2373 \font\smallsy=cmsy9
2374 \def\smallecsize{0900}
2375
2376 % Fonts for small examples (8pt).
2377 \def\smallernominalsize{8pt}
2378 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2379 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2380 \setfont\smallerbf\bfshape{10}{800}{OT1}
2381 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2382 \setfont\smallersl\slshape{8}{1000}{OT1}
2383 \setfont\smallersf\sfshape{8}{1000}{OT1}
2384 \setfont\smallersc\scshape{10}{800}{OT1}
2385 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2386 \font\smalleri=cmmi8
2387 \font\smallersy=cmsy8
2388 \def\smallerecsize{0800}
2389
2390 % Fonts for math mode superscripts (7pt).
2391 \def\sevennominalsize{7pt}
2392 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2393 \setfont\seventt\ttshape{10}{700}{OT1TT}
2394 \setfont\sevenbf\bfshape{10}{700}{OT1}
2395 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2396 \setfont\sevensl\slshape{10}{700}{OT1}
2397 \setfont\sevensf\sfshape{10}{700}{OT1}
2398 \setfont\sevensc\scshape{10}{700}{OT1}
2399 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2400 \font\seveni=cmmi7
2401 \font\sevensy=cmsy7
2402 \def\sevenecsize{0700}
2403
2404 % Fonts for title page (20.4pt):
2405 \def\titlenominalsize{20pt}
2406 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2407 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2408 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2409 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2410 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2411 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2412 \let\titlebf=\titlerm
2413 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2414 \font\titlei=cmmi12 scaled \magstep3
2415 \font\titlesy=cmsy10 scaled \magstep4
2416 \def\titleecsize{2074}
2417
2418 % Chapter fonts (14.4pt).
2419 \def\chapnominalsize{14pt}
2420 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2421 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2422 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2423 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2424 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2425 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2426 \let\chapbf\chaprm
2427 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2428 \font\chapi=cmmi12 scaled \magstep1
2429 \font\chapsy=cmsy10 scaled \magstep2
2430 \def\chapecsize{1440}
2431
2432 % Section fonts (12pt).
2433 \def\secnominalsize{12pt}
2434 \setfont\secrm\rmbshape{12}{1000}{OT1}
2435 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2436 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2437 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2438 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2439 \setfont\secsf\sfbshape{12}{1000}{OT1}
2440 \let\secbf\secrm
2441 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2442 \font\seci=cmmi12
2443 \font\secsy=cmsy10 scaled \magstep1
2444 \def\sececsize{1200}
2445
2446 % Subsection fonts (10pt).
2447 \def\ssecnominalsize{10pt}
2448 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2449 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2450 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2451 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2452 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2453 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2454 \let\ssecbf\ssecrm
2455 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2456 \font\sseci=cmmi10
2457 \font\ssecsy=cmsy10
2458 \def\ssececsize{1000}
2459
2460 % Reduced fonts for @acronym in text (9pt).
2461 \def\reducednominalsize{9pt}
2462 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2463 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2464 \setfont\reducedbf\bfshape{10}{900}{OT1}
2465 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2466 \setfont\reducedsl\slshape{9}{1000}{OT1}
2467 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2468 \setfont\reducedsc\scshape{10}{900}{OT1}
2469 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2470 \font\reducedi=cmmi9
2471 \font\reducedsy=cmsy9
2472 \def\reducedecsize{0900}
2473
2474 \divide\parskip by 2 % reduce space between paragraphs
2475 \textleading = 12pt % line spacing for 10pt CM
2476 \textfonts % reset the current fonts
2477 \rm
2478 } % end of 10pt text font size definitions, \definetextfontsizex
2479
2480 % Fonts for short table of contents.
2481 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2482 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2483 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2484 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2485
2486
2487 % We provide the user-level command
2488 % @fonttextsize 10
2489 % (or 11) to redefine the text font size. pt is assumed.
2490 %
2491 \def\xiword{11}
2492 \def\xword{10}
2493 \def\xwordpt{10pt}
2494 %
2495 \parseargdef\fonttextsize{%
2496 \def\textsizearg{#1}%
2497 %\wlog{doing @fonttextsize \textsizearg}%
2498 %
2499 % Set \globaldefs so that documents can use this inside @tex, since
2500 % makeinfo 4.8 does not support it, but we need it nonetheless.
2501 %
2502 \begingroup \globaldefs=1
2503 \ifx\textsizearg\xword \definetextfontsizex
2504 \else \ifx\textsizearg\xiword \definetextfontsizexi
2505 \else
2506 \errhelp=\EMsimple
2507 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2508 \fi\fi
2509 \endgroup
2510 }
2511
2512 %
2513 % Change the current font style to #1, remembering it in \curfontstyle.
2514 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2515 % italics, not bold italics.
2516 %
2517 \def\setfontstyle#1{%
2518 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2519 \csname #1font\endcsname % change the current font
2520 }
2521
2522 \def\rm{\fam=0 \setfontstyle{rm}}
2523 \def\it{\fam=\itfam \setfontstyle{it}}
2524 \def\sl{\fam=\slfam \setfontstyle{sl}}
2525 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2526 \def\tt{\fam=\ttfam \setfontstyle{tt}}
2527
2528 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
2529 % So we set up a \sf.
2530 \newfam\sffam
2531 \def\sf{\fam=\sffam \setfontstyle{sf}}
2532
2533 % We don't need math for this font style.
2534 \def\ttsl{\setfontstyle{ttsl}}
2535
2536
2537 % In order for the font changes to affect most math symbols and letters,
2538 % we have to define the \textfont of the standard families.
2539 % We don't bother to reset \scriptscriptfont; awaiting user need.
2540 %
2541 \def\resetmathfonts{%
2542 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2543 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2544 \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2545 %
2546 % Fonts for superscript. Note that the 7pt fonts are used regardless
2547 % of the current font size.
2548 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
2549 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
2550 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
2551 \scriptfont\sffam=\sevensf
2552 }
2553
2554
2555
2556 % \defineassignfonts{SIZE} -
2557 % Define sequence \assignfontsSIZE, which switches between font sizes
2558 % by redefining the meanings of \STYLEfont. (Just \STYLE additionally sets
2559 % the current \fam for math mode.)
2560 %
2561 \def\defineassignfonts#1{%
2562 \expandafter\edef\csname assignfonts#1\endcsname{%
2563 \let\noexpand\rmfont\csname #1rm\endcsname
2564 \let\noexpand\itfont\csname #1it\endcsname
2565 \let\noexpand\slfont\csname #1sl\endcsname
2566 \let\noexpand\bffont\csname #1bf\endcsname
2567 \let\noexpand\ttfont\csname #1tt\endcsname
2568 \let\noexpand\smallcaps\csname #1sc\endcsname
2569 \let\noexpand\sffont \csname #1sf\endcsname
2570 \let\noexpand\ifont \csname #1i\endcsname
2571 \let\noexpand\syfont \csname #1sy\endcsname
2572 \let\noexpand\ttslfont\csname #1ttsl\endcsname
2573 }
2574 }
2575
2576 \def\assignfonts#1{%
2577 \csname assignfonts#1\endcsname
2578 }
2579
2580 \newif\ifrmisbold
2581
2582 % Select smaller font size with the current style. Used to change font size
2583 % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
2584 % normal roman text, also use bold fonts for roman text in the smaller size.
2585 \def\switchtolllsize{%
2586 \expandafter\assignfonts\expandafter{\lllsize}%
2587 \ifrmisbold
2588 \let\rmfont\bffont
2589 \fi
2590 \csname\curfontstyle\endcsname
2591 }%
2592
2593 \def\switchtolsize{%
2594 \expandafter\assignfonts\expandafter{\lsize}%
2595 \ifrmisbold
2596 \let\rmfont\bffont
2597 \fi
2598 \csname\curfontstyle\endcsname
2599 }%
2600
2601 % Define the font-changing commands (all called \...fonts).
2602 % Each font-changing command also sets the names \lsize (one size lower)
2603 % and \lllsize (three sizes lower). These relative commands are used
2604 % in, e.g., the LaTeX logo and acronyms.
2605 %
2606 % Note: The fonts used for \ifont are for "math italics" (\itfont is for
2607 % italics in regular text). \syfont is also used in math mode only.
2608 %
2609 \def\definefontsetatsize#1#2#3#4#5{%
2610 \defineassignfonts{#1}%
2611 \expandafter\def\csname #1fonts\endcsname{%
2612 \def\curfontsize{#1}%
2613 \def\lsize{#2}\def\lllsize{#3}%
2614 \csname rmisbold#5\endcsname
2615 \csname assignfonts#1\endcsname
2616 \resetmathfonts
2617 \setleading{#4}%
2618 }}
2619
2620 \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
2621 \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
2622 \definefontsetatsize{chap} {sec} {text} {19pt} {true}
2623 \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
2624 \definefontsetatsize{ssec} {text} {small} {15pt} {true}
2625 \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
2626 \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
2627 \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2628
2629 \def\titlefont#1{{\titlefonts\rm #1}}
2630 \let\subsecfonts = \ssecfonts
2631 \let\subsubsecfonts = \ssecfonts
2632
2633 % Define these just so they can be easily changed for other fonts.
2634 \def\angleleft{$\langle$}
2635 \def\angleright{$\rangle$}
2636
2637 % Set the fonts to use with the @small... environments.
2638 \let\smallexamplefonts = \smallfonts
2639
2640 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2641 % can fit this many characters:
2642 % 8.5x11=86 smallbook=72 a4=90 a5=69
2643 % If we use \scriptfonts (8pt), then we can fit this many characters:
2644 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2645 % For me, subjectively, the few extra characters that fit aren't worth
2646 % the additional smallness of 8pt. So I'm making the default 9pt.
2647 %
2648 % By the way, for comparison, here's what fits with @example (10pt):
2649 % 8.5x11=71 smallbook=60 a4=75 a5=58
2650 % --karl, 24jan03.
2651
2652 % Set up the default fonts, so we can use them for creating boxes.
2653 %
2654 \definetextfontsizexi
2655
2656
2657 % Check if we are currently using a typewriter font. Since all the
2658 % Computer Modern typewriter fonts have zero interword stretch (and
2659 % shrink), and it is reasonable to expect all typewriter fonts to have
2660 % this property, we can check that font parameter. #1 is what to
2661 % print if we are indeed using \tt; #2 is what to print otherwise.
2662 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
2663
2664 % Same as above, but check for italic font. Actually this also catches
2665 % non-italic slanted fonts since it is impossible to distinguish them from
2666 % italic fonts. But since this is only used by $ and it uses \sl anyway
2667 % this is not a problem.
2668 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
2669
2670
2671 % Check if internal flag is clear, i.e. has not been @set.
2672 \def\ifflagclear#1#2#3{%
2673 \expandafter\ifx\csname SET#1\endcsname\relax
2674 #2\else#3\fi
2675 }
2676
2677 {
2678 \catcode`\'=\active
2679 \catcode`\`=\active
2680
2681 \gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
2682 \gdef\setregularquotes{\let`\lq \let'\rq}
2683 }
2684 \setregularquotes
2685
2686 % Allow an option to not use regular directed right quote/apostrophe
2687 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2688 % The undirected quote is ugly, so don't make it the default, but it
2689 % works for pasting with more pdf viewers (at least evince), the
2690 % lilypond developers report. xpdf does work with the regular 0x27.
2691 %
2692 \def\codequoteright{%
2693 \ifusingtt
2694 {\ifflagclear{txicodequoteundirected}%
2695 {\ifflagclear{codequoteundirected}%
2696 {'}%
2697 {\char'15 }}%
2698 {\char'15 }}%
2699 {'}%
2700 }
2701
2702 % and a similar option for the left quote char vs. a grave accent.
2703 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2704 % the code environments to do likewise.
2705 % \relax disables Spanish ligatures ?` and !` of \tt font.
2706 %
2707 \def\codequoteleft{%
2708 \ifusingtt
2709 {\ifflagclear{txicodequotebacktick}%
2710 {\ifflagclear{codequotebacktick}%
2711 {\relax`}%
2712 {\char'22 }}%
2713 {\char'22 }}%
2714 {\relax`}%
2715 }
2716
2717 % Commands to set the quote options.
2718 %
2719 \parseargdef\codequoteundirected{%
2720 \def\temp{#1}%
2721 \ifx\temp\onword
2722 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2723 = t%
2724 \else\ifx\temp\offword
2725 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2726 = \relax
2727 \else
2728 \errhelp = \EMsimple
2729 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2730 \fi\fi
2731 }
2732 %
2733 \parseargdef\codequotebacktick{%
2734 \def\temp{#1}%
2735 \ifx\temp\onword
2736 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2737 = t%
2738 \else\ifx\temp\offword
2739 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2740 = \relax
2741 \else
2742 \errhelp = \EMsimple
2743 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2744 \fi\fi
2745 }
2746
2747 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2748 \def\noligaturesquoteleft{\relax\lq}
2749
2750 % Count depth in font-changes, for error checks
2751 \newcount\fontdepth \fontdepth=0
2752
2753 % Font commands.
2754
2755 % #1 is the font command (\sl or \it), #2 is the text to slant.
2756 % If we are in a monospaced environment, however, 1) always use \ttsl,
2757 % and 2) do not add an italic correction.
2758 \def\dosmartslant#1#2{%
2759 \ifusingtt
2760 {{\ttsl #2}\let\next=\relax}%
2761 {\def\next{{#1#2}\smartitaliccorrection}}%
2762 \next
2763 }
2764 \def\smartslanted{\dosmartslant\sl}
2765 \def\smartitalic{\dosmartslant\it}
2766
2767 % Output an italic correction unless the following character is such as
2768 % not to need one.
2769 \def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx}
2770 \def\smartitaliccorrectionx{%
2771 \ifx\next,%
2772 \else\ifx\next-%
2773 \else\ifx\next.%
2774 \else\ifx\next\.%
2775 \else\ifx\next\comma%
2776 \else\ptexslash
2777 \fi\fi\fi\fi\fi
2778 \aftersmartic
2779 }
2780
2781 % @cite unconditionally uses \sl with \smartitaliccorrection.
2782 \def\cite#1{{\sl #1}\smartitaliccorrection}
2783
2784 % @var unconditionally uses \sl. This gives consistency for
2785 % parameter names whether they are in @def, @table @code or a
2786 % regular paragraph.
2787 % To get ttsl font for @var when used in code context, @set txicodevaristt.
2788 % The \null is to reset \spacefactor.
2789 \def\aftersmartic{}
2790 \def\var#1{%
2791 \let\saveaftersmartic = \aftersmartic
2792 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2793 %
2794 \ifflagclear{txicodevaristt}%
2795 {\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
2796 {\def\varnext{\smartslanted{#1}}}%
2797 \varnext
2798 }
2799
2800 % To be removed after next release
2801 \def\SETtxicodevaristt{}% @set txicodevaristt
2802
2803 \let\i=\smartitalic
2804 \let\slanted=\smartslanted
2805 \let\dfn=\smartslanted
2806 \let\emph=\smartitalic
2807
2808 % @r for roman font, used for code comment
2809 \def\r#1{{%
2810 \usenormaldash % get --, --- ligatures even if in @code
2811 \defcharsdefault % in case on def line
2812 \rm #1}}
2813 {\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}}
2814
2815 % @sc, undocumented @ii.
2816 \def\sc#1{{\smallcaps#1}} % smallcaps font
2817 \def\ii#1{{\it #1}} % italic font
2818
2819 % @b, explicit bold. Also @strong.
2820 \def\b#1{{\bf #1}}
2821 \let\strong=\b
2822
2823 % @sansserif, explicit sans.
2824 \def\sansserif#1{{\sf #1}}
2825
2826 \newif\iffrenchspacing
2827 \frenchspacingfalse
2828
2829 % Set sfcode to normal for the chars that usually have another value.
2830 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2831 % sometimes \x has an active definition that messes things up.
2832 %
2833 \catcode`@=11
2834 \def\plainfrenchspacing{%
2835 \iffrenchspacing\else
2836 \frenchspacingtrue
2837 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2838 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2839 \def\endofsentencespacefactor{1000}% for @. and friends
2840 \fi
2841 }
2842 \def\plainnonfrenchspacing{%
2843 \iffrenchspacing
2844 \frenchspacingfalse
2845 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2846 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2847 \def\endofsentencespacefactor{3000}% for @. and friends
2848 \fi
2849 }
2850 \catcode`@=\other
2851 \def\endofsentencespacefactor{3000}% default
2852
2853 % @frenchspacing on|off says whether to put extra space after punctuation.
2854 %
2855 \def\onword{on}
2856 \def\offword{off}
2857 %
2858 \let\frenchspacingsetting\plainnonfrenchspacing % used in output routine
2859 \parseargdef\frenchspacing{%
2860 \def\temp{#1}%
2861 \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing
2862 \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing
2863 \else
2864 \errhelp = \EMsimple
2865 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
2866 \fi\fi
2867 \frenchspacingsetting
2868 }
2869
2870
2871 % @t, explicit typewriter.
2872 \def\t#1{%
2873 {\tt \defcharsdefault \plainfrenchspacing #1}%
2874 \null
2875 }
2876
2877 % @samp.
2878 \def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
2879
2880 % @indicateurl is \samp, that is, with quotes.
2881 \let\indicateurl=\samp
2882
2883 % @code (and similar) prints in typewriter, but with spaces the same
2884 % size as normal in the surrounding text, without hyphenation, etc.
2885 % This is a subroutine for that.
2886 \def\tclose#1{%
2887 {%
2888 % Change normal interword space to be same as for the current font.
2889 \spaceskip = \fontdimen2\font
2890 %
2891 % Switch to typewriter.
2892 \tt
2893 %
2894 % `\ ' produces the large typewriter interword space.
2895 \def\ {{\spaceskip = 0pt{} }}%
2896 %
2897 \plainfrenchspacing
2898 #1%
2899 }%
2900 \null % reset spacefactor to 1000
2901 }
2902
2903 % This is for LuaTeX: It is not sufficient to disable hyphenation at
2904 % explicit dashes by setting `\hyphenchar` to -1.
2905 \def\dashnobreak{%
2906 \normaldash
2907 \penalty 10000 }
2908
2909 % We must turn on hyphenation at `-' and `_' in @code.
2910 % Otherwise, it is too hard to avoid overfull hboxes
2911 % in the Emacs manual, the Library manual, etc.
2912 % We explicitly allow hyphenation at these characters
2913 % using \discretionary.
2914 %
2915 % Hyphenation at - and hyphenation within words was turned off
2916 % by default for the tt fonts using the \hyphenchar parameter of TeX.
2917 {
2918 \catcode`\-=\active \catcode`\_=\active
2919 \catcode`\'=\active \catcode`\`=\active
2920 \global\let'=\rq \global\let`=\lq % default definitions
2921 %
2922 \global\def\code{\begingroup
2923 \setcodequotes
2924 \catcode\dashChar=\active \catcode\underChar=\active
2925 \ifallowcodebreaks
2926 \let-\codedash
2927 \let_\codeunder
2928 \else
2929 \let-\dashnobreak
2930 \let_\realunder
2931 \fi
2932 % Given -foo (with a single dash), we do not want to allow a break
2933 % after the hyphen.
2934 \global\let\codedashprev=\codedash
2935 %
2936 \codex
2937 }
2938 %
2939 \gdef\codedash{\futurelet\next\codedashfinish}
2940 \gdef\codedashfinish{%
2941 \normaldash % always output the dash character itself.
2942 %
2943 % Now, output a discretionary to allow a line break, unless
2944 % (a) the next character is a -, or
2945 % (b) the preceding character is a -.
2946 % E.g., given --posix, we do not want to allow a break after either -.
2947 % Given --foo-bar, we do want to allow a break between the - and the b.
2948 \ifx\next\codedash \else
2949 \ifx\codedashprev\codedash
2950 \else \discretionary{}{}{}\fi
2951 \fi
2952 % we need the space after the = for the case when \next itself is a
2953 % space token; it would get swallowed otherwise. As in @code{- a}.
2954 \global\let\codedashprev= \next
2955 }
2956 }
2957 \def\normaldash{-}
2958 %
2959 \def\codex #1{\tclose{#1}\endgroup}
2960
2961 \def\codeunder{%
2962 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2963 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2964 % will therefore expand the active definition of _, which is us
2965 % (inside @code that is), therefore an endless loop.
2966 \ifusingtt{\ifmmode
2967 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2968 \else\normalunderscore \fi
2969 \discretionary{}{}{}}%
2970 {\_}%
2971 }
2972
2973 % An additional complication: the above will allow breaks after, e.g.,
2974 % each of the four underscores in __typeof__. This is bad.
2975 % @allowcodebreaks provides a document-level way to turn breaking at -
2976 % and _ on and off.
2977 %
2978 \newif\ifallowcodebreaks \allowcodebreakstrue
2979
2980 \def\keywordtrue{true}
2981 \def\keywordfalse{false}
2982
2983 \parseargdef\allowcodebreaks{%
2984 \def\txiarg{#1}%
2985 \ifx\txiarg\keywordtrue
2986 \allowcodebreakstrue
2987 \else\ifx\txiarg\keywordfalse
2988 \allowcodebreaksfalse
2989 \else
2990 \errhelp = \EMsimple
2991 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2992 \fi\fi
2993 }
2994
2995 % For @command, @env, @file, @option quotes seem unnecessary,
2996 % so use \code rather than \samp.
2997 \let\command=\code
2998 \let\env=\code
2999 \let\file=\code
3000 \let\option=\code
3001
3002 % @uref (abbreviation for `urlref') aka @url takes an optional
3003 % (comma-separated) second argument specifying the text to display and
3004 % an optional third arg as text to display instead of (rather than in
3005 % addition to) the url itself. First (mandatory) arg is the url.
3006
3007 % TeX-only option to allow changing PDF output to show only the second
3008 % arg (if given), and not the url (which is then just the link target).
3009 \newif\ifurefurlonlylink
3010
3011 % The default \pretolerance setting stops the penalty inserted in
3012 % \urefallowbreak being a discouragement to line breaking. Set it to
3013 % a negative value for this paragraph only. Hopefully this does not
3014 % conflict with redefinitions of \par done elsewhere.
3015 \def\nopretolerance{%
3016 \pretolerance=-1
3017 \def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
3018 }
3019
3020 % The main macro is \urefbreak, which allows breaking at expected
3021 % places within the url.
3022 \def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
3023 \let\uref=\urefbreak
3024 %
3025 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
3026 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
3027 \unsepspaces
3028 \pdfurl{#1}%
3029 \setbox0 = \hbox{\ignorespaces #3}%
3030 \ifdim\wd0 > 0pt
3031 \unhbox0 % third arg given, show only that
3032 \else
3033 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
3034 \ifdim\wd0 > 0pt
3035 \ifpdf
3036 % For pdfTeX and LuaTeX
3037 \ifurefurlonlylink
3038 % PDF plus option to not display url, show just arg
3039 \unhbox0
3040 \else
3041 % PDF, normally display both arg and url for consistency,
3042 % visibility, if the pdf is eventually used to print, etc.
3043 \unhbox0\ (\urefcode{#1})%
3044 \fi
3045 \else
3046 \ifx\XeTeXrevision\thisisundefined
3047 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3048 \else
3049 % For XeTeX
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 \fi
3059 \fi
3060 \else
3061 \urefcode{#1}% only url given, so show it
3062 \fi
3063 \fi
3064 \endlink
3065 \endgroup}
3066
3067 % Allow line breaks around only a few characters (only).
3068 \def\urefcatcodes{%
3069 \catcode`\&=\active \catcode`\.=\active
3070 \catcode`\#=\active \catcode`\?=\active
3071 \catcode`\/=\active
3072 }
3073 {
3074 \urefcatcodes
3075 %
3076 \global\def\urefcode{\begingroup
3077 \setcodequotes
3078 \urefcatcodes
3079 \let&\urefcodeamp
3080 \let.\urefcodedot
3081 \let#\urefcodehash
3082 \let?\urefcodequest
3083 \let/\urefcodeslash
3084 \codex
3085 }
3086 %
3087 % By default, they are just regular characters.
3088 \global\def&{\normalamp}
3089 \global\def.{\normaldot}
3090 \global\def#{\normalhash}
3091 \global\def?{\normalquest}
3092 \global\def/{\normalslash}
3093 }
3094
3095 \def\urefcodeamp{\urefprebreak \&\urefpostbreak}
3096 \def\urefcodedot{\urefprebreak .\urefpostbreak}
3097 \def\urefcodehash{\urefprebreak \#\urefpostbreak}
3098 \def\urefcodequest{\urefprebreak ?\urefpostbreak}
3099 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3100 {
3101 \catcode`\/=\active
3102 \global\def\urefcodeslashfinish{%
3103 \urefprebreak \slashChar
3104 % Allow line break only after the final / in a sequence of
3105 % slashes, to avoid line break between the slashes in http://.
3106 \ifx\next/\else \urefpostbreak \fi
3107 }
3108 }
3109
3110 % By default we'll break after the special characters, but some people like to
3111 % break before the special chars, so allow that. Also allow no breaking at
3112 % all, for manual control.
3113 %
3114 \parseargdef\urefbreakstyle{%
3115 \def\txiarg{#1}%
3116 \ifx\txiarg\wordnone
3117 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3118 \else\ifx\txiarg\wordbefore
3119 \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
3120 \else\ifx\txiarg\wordafter
3121 \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
3122 \else
3123 \errhelp = \EMsimple
3124 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3125 \fi\fi\fi
3126 }
3127 \def\wordafter{after}
3128 \def\wordbefore{before}
3129 \def\wordnone{none}
3130
3131 % Allow a ragged right output to aid breaking long URL's. There can
3132 % be a break at the \allowbreak with no extra glue (if the existing stretch in
3133 % the line is sufficient), a break at the \penalty with extra glue added
3134 % at the end of the line, or no break at all here.
3135 % Changing the value of the penalty and/or the amount of stretch affects how
3136 % preferable one choice is over the other.
3137 \def\urefallowbreak{%
3138 \penalty0\relax
3139 \hskip 0pt plus 2 em\relax
3140 \penalty1000\relax
3141 \hskip 0pt plus -2 em\relax
3142 }
3143
3144 \urefbreakstyle after
3145
3146 % @url synonym for @uref, since that's how everyone uses it.
3147 %
3148 \let\url=\uref
3149
3150 % rms does not like angle brackets --karl, 17may97.
3151 % So now @email is just like @uref, unless we are pdf.
3152 %
3153 %\def\email#1{\angleleft{\tt #1}\angleright}
3154 \ifpdforxetex
3155 \def\email#1{\doemail#1,,\finish}
3156 \def\doemail#1,#2,#3\finish{\begingroup
3157 \unsepspaces
3158 \pdfurl{mailto:#1}%
3159 \setbox0 = \hbox{\ignorespaces #2}%
3160 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3161 \endlink
3162 \endgroup}
3163 \else
3164 \let\email=\uref
3165 \fi
3166
3167 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3168 % `example' (@kbd uses ttsl only inside of @example and friends),
3169 % or `code' (@kbd uses normal tty font always).
3170 \parseargdef\kbdinputstyle{%
3171 \def\txiarg{#1}%
3172 \ifx\txiarg\worddistinct
3173 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3174 \else\ifx\txiarg\wordexample
3175 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3176 \else\ifx\txiarg\wordcode
3177 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3178 \else
3179 \errhelp = \EMsimple
3180 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3181 \fi\fi\fi
3182 }
3183 \def\worddistinct{distinct}
3184 \def\wordexample{example}
3185 \def\wordcode{code}
3186
3187 % Default is `distinct'.
3188 \kbdinputstyle distinct
3189
3190 \def\kbd#1{%
3191 \tclose{\kbdfont\setcodequotes#1}%
3192 }
3193
3194 % definition of @key that produces a lozenge. Doesn't adjust to text size.
3195 %\setfont\keyrm\rmshape{8}{1000}{OT1}
3196 %\font\keysy=cmsy9
3197 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3198 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3199 % \vbox{\hrule\kern-0.4pt
3200 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3201 % \kern-0.4pt\hrule}%
3202 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3203
3204 % definition of @key with no lozenge.
3205 %
3206 \def\key#1{{\setregularquotes \tt #1}\null}
3207
3208 % @clicksequence{File @click{} Open ...}
3209 \def\clicksequence#1{\begingroup #1\endgroup}
3210
3211 % @clickstyle @arrow (by default)
3212 \parseargdef\clickstyle{\def\click{#1}}
3213 \def\click{\arrow}
3214
3215 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3216 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3217 %
3218 \def\dmn#1{\thinspace #1}
3219
3220 % @acronym for "FBI", "NATO", and the like.
3221 % We print this one point size smaller, since it's intended for
3222 % all-uppercase.
3223 %
3224 \def\acronym#1{\doacronym #1,,\finish}
3225 \def\doacronym#1,#2,#3\finish{%
3226 {\switchtolsize #1}%
3227 \def\temp{#2}%
3228 \ifx\temp\empty \else
3229 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3230 \fi
3231 \null % reset \spacefactor=1000
3232 }
3233
3234 % @abbr for "Comput. J." and the like.
3235 % No font change, but don't do end-of-sentence spacing.
3236 %
3237 \def\abbr#1{\doabbr #1,,\finish}
3238 \def\doabbr#1,#2,#3\finish{%
3239 {\plainfrenchspacing #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 % @asis just yields its argument. Used with @table, for example.
3248 %
3249 \def\asis#1{#1}
3250
3251 % @math outputs its argument in math mode.
3252 %
3253 % One complication: _ usually means subscripts, but it could also mean
3254 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
3255 % _ active, and distinguish by seeing if the current family is \slfam,
3256 % which is what @var uses.
3257 {
3258 \catcode`\_ = \active
3259 \gdef\mathunderscore{%
3260 \catcode`\_=\active
3261 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3262 }
3263 }
3264 % Another complication: we want \\ (and @\) to output a math (or tt) \.
3265 % FYI, plain.tex uses \\ as a temporary control sequence (for no
3266 % particular reason), but this is not advertised and we don't care.
3267 %
3268 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3269 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3270 %
3271 \def\math{%
3272 \ifmmode\else % only go into math if not in math mode already
3273 \tex
3274 \mathunderscore
3275 \let\\ = \mathbackslash
3276 \mathactive
3277 % make the texinfo accent commands work in math mode
3278 \let\"=\ddot
3279 \let\'=\acute
3280 \let\==\bar
3281 \let\^=\hat
3282 \let\`=\grave
3283 \let\u=\breve
3284 \let\v=\check
3285 \let\~=\tilde
3286 \let\dotaccent=\dot
3287 % have to provide another name for sup operator
3288 \let\mathopsup=\sup
3289 $\expandafter\finishmath\fi
3290 }
3291 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3292
3293 % Some active characters (such as <) are spaced differently in math.
3294 % We have to reset their definitions in case the @math was an argument
3295 % to a command which sets the catcodes (such as @item or @section).
3296 %
3297 {
3298 \catcode`^ = \active
3299 \catcode`< = \active
3300 \catcode`> = \active
3301 \catcode`+ = \active
3302 \catcode`' = \active
3303 \gdef\mathactive{%
3304 \let^ = \ptexhat
3305 \let< = \ptexless
3306 \let> = \ptexgtr
3307 \let+ = \ptexplus
3308 \let' = \ptexquoteright
3309 }
3310 }
3311
3312 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3313 % If in text, use math to place as sub/superscript, but switch
3314 % into text mode, with smaller fonts. This is a different font than the
3315 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3316 % fix it (significant additions to font machinery) until someone notices.
3317 %
3318 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3319 \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
3320 %
3321 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3322 \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
3323
3324 % provide this command from LaTeX as it is very common
3325 \def\frac#1#2{{{#1}\over{#2}}}
3326
3327 % @displaymath.
3328 % \globaldefs is needed to recognize the end lines in \tex and
3329 % \end tex. Set \thisenv as @end displaymath is seen before @end tex.
3330 {\obeylines
3331 \globaldefs=1
3332 \envdef\displaymath{%
3333 \tex%
3334 \def\thisenv{\displaymath}%
3335 \begingroup\let\end\displaymathend%
3336 $$%
3337 }
3338
3339 \def\displaymathend{$$\endgroup\end}%
3340
3341 \def\Edisplaymath{%
3342 \def\thisenv{\tex}%
3343 \end tex
3344 }}
3345
3346
3347 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3348 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3349 % except specified as a normal braced arg, so no newlines to worry about.
3350 %
3351 \def\outfmtnametex{tex}
3352 %
3353 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3354 \long\def\doinlinefmt#1,#2,\finish{%
3355 \def\inlinefmtname{#1}%
3356 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3357 }
3358 %
3359 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3360 % FMTNAME is tex, else ELSE-TEXT.
3361 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3362 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3363 \def\inlinefmtname{#1}%
3364 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3365 }
3366 %
3367 % For raw, must switch into @tex before parsing the argument, to avoid
3368 % setting catcodes prematurely. Doing it this way means that, for
3369 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3370 % ignored. But this isn't important because if people want a literal
3371 % *right* brace they would have to use a command anyway, so they may as
3372 % well use a command to get a left brace too. We could re-use the
3373 % delimiter character idea from \verb, but it seems like overkill.
3374 %
3375 \long\def\inlineraw{\tex \doinlineraw}
3376 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3377 \def\doinlinerawtwo#1,#2,\finish{%
3378 \def\inlinerawname{#1}%
3379 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3380 \endgroup % close group opened by \tex.
3381 }
3382
3383 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3384 %
3385 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3386 \long\def\doinlineifset#1,#2,\finish{%
3387 \def\inlinevarname{#1}%
3388 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3389 \else\ignorespaces#2\fi
3390 }
3391
3392 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3393 %
3394 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3395 \long\def\doinlineifclear#1,#2,\finish{%
3396 \def\inlinevarname{#1}%
3397 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3398 }
3399
3400
3401 \message{glyphs,}
3402 % and logos.
3403
3404 % @@ prints an @, as does @atchar{}.
3405 \def\@{\char64 }
3406 \let\atchar=\@
3407
3408 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3409 \def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}}
3410 \def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}}
3411 \let\{=\lbracechar
3412 \let\}=\rbracechar
3413
3414 % @comma{} to avoid , parsing problems.
3415 \let\comma = ,
3416
3417 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3418 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3419 \let\, = \ptexc
3420 \let\dotaccent = \ptexdot
3421 \def\ringaccent#1{{\accent23 #1}}
3422 \let\tieaccent = \ptext
3423 \let\ubaraccent = \ptexb
3424 \let\udotaccent = \d
3425
3426 % Other special characters: @questiondown @exclamdown @ordf @ordm
3427 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3428 \def\questiondown{?`}
3429 \def\exclamdown{!`}
3430 \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
3431 \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
3432
3433 % Dotless i and dotless j, used for accents.
3434 \def\imacro{i}
3435 \def\jmacro{j}
3436 \def\dotless#1{%
3437 \def\temp{#1}%
3438 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3439 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3440 \else \errmessage{@dotless can be used only with i or j}%
3441 \fi\fi
3442 }
3443
3444 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3445 % period following counts as ending a sentence. (Idea found in latex.)
3446 %
3447 \edef\TeX{\TeX \spacefactor=1000 }
3448
3449 % @LaTeX{} logo. Not quite the same results as the definition in
3450 % latex.ltx, since we use a different font for the raised A; it's most
3451 % convenient for us to use an explicitly smaller font, rather than using
3452 % the \scriptstyle font (since we don't reset \scriptstyle and
3453 % \scriptscriptstyle).
3454 %
3455 \def\LaTeX{%
3456 L\kern-.36em
3457 {\setbox0=\hbox{T}%
3458 \vbox to \ht0{\hbox{%
3459 \ifx\textnominalsize\xwordpt
3460 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
3461 % Revert to plain's \scriptsize, which is 7pt.
3462 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3463 \else
3464 \ifx\curfontsize\smallword
3465 % For footnotes and indices
3466 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3467 \else
3468 % For 11pt, we can use our lllsize.
3469 \switchtolllsize A%
3470 \fi
3471 \fi
3472 }%
3473 \vss
3474 }}%
3475 \kern-.15em
3476 \TeX
3477 }
3478 \def\smallword{small}
3479
3480 % Some math mode symbols. Define \ensuremath to switch into math mode
3481 % unless we are already there. Expansion tricks may not be needed here,
3482 % but safer, and can't hurt.
3483 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3484 \def\ensuredmath#1{$\relax#1$}
3485 %
3486 \def\bullet{\ensuremath\ptexbullet}
3487 \def\geq{\ensuremath\ge}
3488 \def\leq{\ensuremath\le}
3489 \def\minus{\ensuremath-}
3490
3491 % @dots{} outputs an ellipsis using the current font.
3492 % We do .5em per period so that it has the same spacing in the cm
3493 % typewriter fonts as three actual period characters; on the other hand,
3494 % in other typewriter fonts three periods are wider than 1.5em. So do
3495 % whichever is larger.
3496 %
3497 \def\dots{%
3498 \leavevmode
3499 \setbox0=\hbox{...}% get width of three periods
3500 \ifdim\wd0 > 1.5em
3501 \dimen0 = \wd0
3502 \else
3503 \dimen0 = 1.5em
3504 \fi
3505 \hbox to \dimen0{%
3506 \hskip 0pt plus.25fil
3507 .\hskip 0pt plus1fil
3508 .\hskip 0pt plus1fil
3509 .\hskip 0pt plus.5fil
3510 }%
3511 }
3512
3513 % @enddots{} is an end-of-sentence ellipsis.
3514 %
3515 \def\enddots{%
3516 \dots
3517 \spacefactor=\endofsentencespacefactor
3518 }
3519
3520 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3521 %
3522 % Since these characters are used in examples, they should be an even number of
3523 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3524 %
3525 \def\point{$\star$}
3526 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3527 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3528 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3529 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3530 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3531
3532 % The @error{} command.
3533 % Adapted from the TeXbook's \boxit.
3534 %
3535 \newbox\errorbox
3536 %
3537 {\ttfont \global\dimen0 = 3em}% Width of the box.
3538 \dimen2 = .55pt % Thickness of rules
3539 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3540 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3541 %
3542 \setbox\errorbox=\hbox to \dimen0{\hfil
3543 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3544 \advance\hsize by -2\dimen2 % Rules.
3545 \vbox{%
3546 \hrule height\dimen2
3547 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3548 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3549 \kern3pt\vrule width\dimen2}% Space to right.
3550 \hrule height\dimen2}
3551 \hfil}
3552 %
3553 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3554
3555 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3556 %
3557 \def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}}
3558
3559 % @euro{} comes from a separate font, depending on the current style.
3560 % We use the free feym* fonts from the eurosym package by Henrik
3561 % Theiling, which support regular, slanted, bold and bold slanted (and
3562 % "outlined" (blackboard board, sort of) versions, which we don't need).
3563 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3564 %
3565 % Although only regular is the truly official Euro symbol, we ignore
3566 % that. The Euro is designed to be slightly taller than the regular
3567 % font height.
3568 %
3569 % feymr - regular
3570 % feymo - slanted
3571 % feybr - bold
3572 % feybo - bold slanted
3573 %
3574 % There is no good (free) typewriter version, to my knowledge.
3575 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3576 % Hmm.
3577 %
3578 % Also doesn't work in math. Do we need to do math with euro symbols?
3579 % Hope not.
3580 %
3581 %
3582 \def\euro{{\eurofont e}}
3583 \def\eurofont{%
3584 % We set the font at each command, rather than predefining it in
3585 % \textfonts and the other font-switching commands, so that
3586 % installations which never need the symbol don't have to have the
3587 % font installed.
3588 %
3589 % There is only one designed size (nominal 10pt), so we always scale
3590 % that to the current nominal size.
3591 %
3592 % By the way, simply using "at 1em" works for cmr10 and the like, but
3593 % does not work for cmbx10 and other extended/shrunken fonts.
3594 %
3595 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3596 %
3597 \ifx\curfontstyle\bfstylename
3598 % bold:
3599 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3600 \else
3601 % regular:
3602 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3603 \fi
3604 \thiseurofont
3605 }
3606
3607 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3608 % sometimes we redefine the original macro, and the alias should reflect
3609 % the redefinition.
3610 %
3611 % Use LaTeX names for the Icelandic letters.
3612 \def\DH{{\ecfont \char"D0}} % Eth
3613 \def\dh{{\ecfont \char"F0}} % eth
3614 \def\TH{{\ecfont \char"DE}} % Thorn
3615 \def\th{{\ecfont \char"FE}} % thorn
3616 %
3617 \def\guillemetleft{{\ecfont \char"13}}
3618 \def\guillemotleft{\guillemetleft}
3619 \def\guillemetright{{\ecfont \char"14}}
3620 \def\guillemotright{\guillemetright}
3621 \def\guilsinglleft{{\ecfont \char"0E}}
3622 \def\guilsinglright{{\ecfont \char"0F}}
3623 \def\quotedblbase{{\ecfont \char"12}}
3624 \def\quotesinglbase{{\ecfont \char"0D}}
3625 %
3626 \def\L{{\ecfont \char"8A}} % L with stroke
3627 \def\l{{\ecfont \char"AA}} % l with stroke
3628 %
3629 % This positioning is not perfect (see the ogonek LaTeX package), but
3630 % we have the precomposed glyphs for the most common cases. We put the
3631 % tests to use those glyphs in the single \ogonek macro so we have fewer
3632 % dummy definitions to worry about for index entries, etc.
3633 %
3634 % ogonek is also used with other letters in Lithuanian (IOU), but using
3635 % the precomposed glyphs for those is not so easy since they aren't in
3636 % the same EC font.
3637 \def\ogonek#1{{%
3638 \def\temp{#1}%
3639 \ifx\temp\macrocharA\Aogonek
3640 \else\ifx\temp\macrochara\aogonek
3641 \else\ifx\temp\macrocharE\Eogonek
3642 \else\ifx\temp\macrochare\eogonek
3643 \else
3644 \ecfont \setbox0=\hbox{#1}%
3645 \ifdim\ht0=1ex\accent"0C #1%
3646 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3647 \fi
3648 \fi\fi\fi\fi
3649 }%
3650 }
3651 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3652 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3653 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3654 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3655 %
3656 % Use the European Computer Modern fonts (cm-super in outline format)
3657 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3658 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3659 % package and follow the same conventions.
3660 %
3661 \def\ecfont{\etcfont{e}}
3662 \def\tcfont{\etcfont{t}}
3663 %
3664 \def\etcfont#1{%
3665 % We can't distinguish serif/sans and italic/slanted, but this
3666 % is used for crude hacks anyway (like adding French and German
3667 % quotes to documents typeset with CM, where we lose kerning), so
3668 % hopefully nobody will notice/care.
3669 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3670 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3671 \ifusingtt
3672 % typewriter:
3673 {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}%
3674 % else
3675 {\ifx\curfontstyle\bfstylename
3676 % bold:
3677 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3678 \else
3679 % regular:
3680 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3681 \fi}%
3682 \thisecfont
3683 }
3684
3685 % @registeredsymbol - R in a circle. The font for the R should really
3686 % be smaller yet, but lllsize is the best we can do for now.
3687 % Adapted from the plain.tex definition of \copyright.
3688 %
3689 \def\registeredsymbol{%
3690 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
3691 \hfil\crcr\Orb}}%
3692 }$%
3693 }
3694
3695 % @textdegree - the normal degrees sign.
3696 %
3697 \def\textdegree{%
3698 \ifmmode ^\circ
3699 \else {\tcfont \char 176}%
3700 \fi}
3701
3702 % Laurent Siebenmann reports \Orb undefined with:
3703 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3704 % so we'll define it if necessary.
3705 %
3706 \ifx\Orb\thisisundefined
3707 \def\Orb{\mathhexbox20D}
3708 \fi
3709
3710 % Quotes.
3711 \chardef\quoteleft=`\`
3712 \chardef\quoteright=`\'
3713
3714 % only change font for tt for correct kerning and to avoid using
3715 % \ecfont unless necessary.
3716 \def\quotedblleft{%
3717 \ifusingtt{{\ecfont\char"10}}{{\char"5C}}%
3718 }
3719
3720 \def\quotedblright{%
3721 \ifusingtt{{\ecfont\char"11}}{{\char`\"}}%
3722 }
3723
3724
3725 \message{page headings,}
3726
3727 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3728 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3729
3730 % First the title page. Must do @settitle before @titlepage.
3731 \newif\ifseenauthor
3732 \newif\iffinishedtitlepage
3733
3734 % @setcontentsaftertitlepage used to do an implicit @contents or
3735 % @shortcontents after @end titlepage, but it is now obsolete.
3736 \def\setcontentsaftertitlepage{%
3737 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3738 command; move your @contents command if you want the contents
3739 after the title page.}}%
3740 \def\setshortcontentsaftertitlepage{%
3741 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3742 command; move your @shortcontents and @contents commands if you
3743 want the contents after the title page.}}%
3744
3745 \parseargdef\shorttitlepage{%
3746 {\headingsoff \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3747 \endgroup\page\hbox{}\page}\pageone}
3748
3749 \envdef\titlepage{%
3750 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3751 \begingroup
3752 \parindent=0pt \textfonts
3753 \headingsoff
3754 % Leave some space at the very top of the page.
3755 \vglue\titlepagetopglue
3756 % No rule at page bottom unless we print one at the top with @title.
3757 \finishedtitlepagetrue
3758 %
3759 % Most title ``pages'' are actually two pages long, with space
3760 % at the top of the second. We don't want the ragged left on the second.
3761 \let\oldpage = \page
3762 \def\page{%
3763 \iffinishedtitlepage\else
3764 \finishtitlepage
3765 \fi
3766 \let\page = \oldpage
3767 \page
3768 \null
3769 }%
3770 }
3771
3772 \def\Etitlepage{%
3773 \iffinishedtitlepage\else
3774 \finishtitlepage
3775 \fi
3776 % It is important to do the page break before ending the group,
3777 % because the headline and footline are only empty inside the group.
3778 % If we use the new definition of \page, we always get a blank page
3779 % after the title page, which we certainly don't want.
3780 \oldpage
3781 \pageone
3782 \endgroup
3783 %
3784 }
3785
3786 \def\finishtitlepage{%
3787 \vskip4pt \hrule height 2pt width \hsize
3788 \vskip\titlepagebottomglue
3789 \finishedtitlepagetrue
3790 }
3791
3792 % Settings used for typesetting titles: no hyphenation, no indentation,
3793 % don't worry much about spacing, ragged right. This should be used
3794 % inside a \vbox, and fonts need to be set appropriately first. \par should
3795 % be specified before the end of the \vbox, since a vbox is a group.
3796 %
3797 \def\raggedtitlesettings{%
3798 \rm
3799 \hyphenpenalty=10000
3800 \parindent=0pt
3801 \tolerance=5000
3802 \ptexraggedright
3803 }
3804
3805 % Macros to be used within @titlepage:
3806
3807 \let\subtitlerm=\rmfont
3808 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3809
3810 \parseargdef\title{%
3811 \checkenv\titlepage
3812 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3813 % print a rule at the page bottom also.
3814 \finishedtitlepagefalse
3815 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3816 }
3817
3818 \parseargdef\subtitle{%
3819 \checkenv\titlepage
3820 {\subtitlefont \rightline{#1}}%
3821 }
3822
3823 % @author should come last, but may come many times.
3824 % It can also be used inside @quotation.
3825 %
3826 \parseargdef\author{%
3827 \def\temp{\quotation}%
3828 \ifx\thisenv\temp
3829 \def\quotationauthor{#1}% printed in \Equotation.
3830 \else
3831 \checkenv\titlepage
3832 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3833 {\secfonts\rm \leftline{#1}}%
3834 \fi
3835 }
3836
3837
3838 % Set up page headings and footings.
3839
3840 \let\thispage=\folio
3841
3842 \newtoks\evenheadline % headline on even pages
3843 \newtoks\oddheadline % headline on odd pages
3844 \newtoks\evenchapheadline% headline on even pages with a new chapter
3845 \newtoks\oddchapheadline % headline on odd pages with a new chapter
3846 \newtoks\evenfootline % footline on even pages
3847 \newtoks\oddfootline % footline on odd pages
3848
3849 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3850 \headline={{\textfonts\rm\frenchspacingsetting
3851 \ifchapterpage
3852 \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
3853 \else
3854 \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
3855 \fi}}
3856
3857 \footline={{\textfonts\rm\frenchspacingsetting
3858 \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}%
3859 \HEADINGShook}
3860 \let\HEADINGShook=\relax
3861
3862 % Commands to set those variables.
3863 % For example, this is what @headings on does
3864 % @evenheading @thistitle|@thispage|@thischapter
3865 % @oddheading @thischapter|@thispage|@thistitle
3866 % @evenfooting @thisfile||
3867 % @oddfooting ||@thisfile
3868
3869
3870 \def\evenheading{\parsearg\evenheadingxxx}
3871 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3872 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3873 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
3874 \global\evenchapheadline=\evenheadline}
3875
3876 \def\oddheading{\parsearg\oddheadingxxx}
3877 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3878 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3879 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3880 \global\oddchapheadline=\oddheadline}
3881
3882 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3883
3884 \def\evenfooting{\parsearg\evenfootingxxx}
3885 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3886 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3887 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3888
3889 \def\oddfooting{\parsearg\oddfootingxxx}
3890 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3891 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3892 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3893 %
3894 % Leave some space for the footline. Hopefully ok to assume
3895 % @evenfooting will not be used by itself.
3896 \global\advance\txipageheight by -12pt
3897 \global\advance\vsize by -12pt
3898 }
3899
3900 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3901
3902 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3903 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3904 %
3905 % The same set of arguments for:
3906 %
3907 % @oddheadingmarks
3908 % @evenfootingmarks
3909 % @oddfootingmarks
3910 % @everyheadingmarks
3911 % @everyfootingmarks
3912
3913 % These define \getoddheadingmarks, \getevenheadingmarks,
3914 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3915 % \gettopheadingmarks, \getbottomheadingmarks.
3916 %
3917 \def\evenheadingmarks{\headingmarks{even}{heading}}
3918 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3919 \def\evenfootingmarks{\headingmarks{even}{footing}}
3920 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3921 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3922 \headingmarks{odd}{heading}{#1} }
3923 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3924 \headingmarks{odd}{footing}{#1} }
3925 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3926 \def\headingmarks#1#2#3 {%
3927 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3928 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3929 }
3930
3931 \everyheadingmarks bottom
3932 \everyfootingmarks bottom
3933
3934 % @headings double turns headings on for double-sided printing.
3935 % @headings single turns headings on for single-sided printing.
3936 % @headings off turns them off.
3937 % @headings on same as @headings double, retained for compatibility.
3938 % @headings after turns on double-sided headings after this page.
3939 % @headings doubleafter turns on double-sided headings after this page.
3940 % @headings singleafter turns on single-sided headings after this page.
3941 % By default, they are off at the start of a document,
3942 % and turned `on' after @end titlepage.
3943
3944 \parseargdef\headings{\csname HEADINGS#1\endcsname}
3945
3946 \def\headingsoff{% non-global headings elimination
3947 \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}%
3948 \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}%
3949 }
3950
3951 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3952
3953 % When we turn headings on, set the page number to 1.
3954 \def\pageone{
3955 \global\pageno=1
3956 \global\arabiccount = \pagecount
3957 }
3958
3959 % For double-sided printing, put current file name in lower left corner,
3960 % chapter name on inside top of right hand pages, document
3961 % title on inside top of left hand pages, and page numbers on outside top
3962 % edge of all pages.
3963 \def\HEADINGSdouble{%
3964 \pageone
3965 \HEADINGSdoublex
3966 }
3967 \let\contentsalignmacro = \chappager
3968
3969 % For single-sided printing, chapter title goes across top left of page,
3970 % page number on top right.
3971 \def\HEADINGSsingle{%
3972 \pageone
3973 \HEADINGSsinglex
3974 }
3975 % \def\HEADINGSon{\HEADINGSdouble} % defined by \CHAPPAGon
3976
3977 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3978 \let\HEADINGSdoubleafter=\HEADINGSafter
3979 \def\HEADINGSdoublex{%
3980 \global\evenfootline={\hfil}
3981 \global\oddfootline={\hfil}
3982 \global\evenheadline={\line{\folio\hfil\thistitle}}
3983 \global\oddheadline={\line{\thischapter\hfil\folio}}
3984 \global\evenchapheadline={\line{\folio\hfil\thistitle}}
3985 \global\oddchapheadline={\line{\hfil\folio}}
3986 \global\let\contentsalignmacro = \chapoddpage
3987 }
3988
3989 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3990 \def\HEADINGSsinglex{%
3991 \global\evenfootline={\hfil}
3992 \global\oddfootline={\hfil}
3993 \global\evenheadline={\line{\thischapter\hfil\folio}}
3994 \global\oddheadline={\line{\thischapter\hfil\folio}}
3995 \global\evenchapheadline={\line{\hfil\folio}}
3996 \global\oddchapheadline={\line{\hfil\folio}}
3997 \global\let\contentsalignmacro = \chappager
3998 }
3999
4000 % for @setchapternewpage off
4001 \def\HEADINGSsinglechapoff{%
4002 \pageone
4003 \global\evenfootline={\hfil}
4004 \global\oddfootline={\hfil}
4005 \global\evenheadline={\line{\thischapter\hfil\folio}}
4006 \global\oddheadline={\line{\thischapter\hfil\folio}}
4007 \global\evenchapheadline=\evenheadline
4008 \global\oddchapheadline=\oddheadline
4009 \global\let\contentsalignmacro = \chappager
4010 }
4011
4012 % Subroutines used in generating headings
4013 % This produces Day Month Year style of output.
4014 % Only define if not already defined, in case a txi-??.tex file has set
4015 % up a different format (e.g., txi-cs.tex does this).
4016 \ifx\today\thisisundefined
4017 \def\today{%
4018 \number\day\space
4019 \ifcase\month
4020 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
4021 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
4022 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
4023 \fi
4024 \space\number\year}
4025 \fi
4026
4027 % @settitle line... specifies the title of the document, for headings.
4028 % It generates no output of its own.
4029 \def\thistitle{\putwordNoTitle}
4030 \def\settitle{\parsearg{\gdef\thistitle}}
4031
4032
4033 \message{tables,}
4034 % Tables -- @table, @ftable, @vtable, @item(x).
4035
4036 % default indentation of table text
4037 \newdimen\tableindent \tableindent=.8in
4038 % default indentation of @itemize and @enumerate text
4039 \newdimen\itemindent \itemindent=.3in
4040 % margin between end of table item and start of table text.
4041 \newdimen\itemmargin \itemmargin=.1in
4042
4043 % used internally for \itemindent minus \itemmargin
4044 \newdimen\itemmax
4045
4046 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
4047 % these defs.
4048 % They also define \itemindex
4049 % to index the item name in whatever manner is desired (perhaps none).
4050
4051 \newif\ifitemxneedsnegativevskip
4052
4053 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4054
4055 \def\internalBitem{\smallbreak \parsearg\itemzzz}
4056 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
4057
4058 \def\itemzzz #1{\begingroup %
4059 \advance\hsize by -\rightskip
4060 \advance\hsize by -\tableindent
4061 \setbox0=\hbox{\itemindicate{#1}}%
4062 \itemindex{#1}%
4063 \nobreak % This prevents a break before @itemx.
4064 %
4065 % If the item text does not fit in the space we have, put it on a line
4066 % by itself, and do not allow a page break either before or after that
4067 % line. We do not start a paragraph here because then if the next
4068 % command is, e.g., @kindex, the whatsit would get put into the
4069 % horizontal list on a line by itself, resulting in extra blank space.
4070 \ifdim \wd0>\itemmax
4071 %
4072 % Make this a paragraph so we get the \parskip glue and wrapping,
4073 % but leave it ragged-right.
4074 \begingroup
4075 \advance\leftskip by-\tableindent
4076 \advance\hsize by\tableindent
4077 \advance\rightskip by0pt plus1fil\relax
4078 \leavevmode\unhbox0\par
4079 \endgroup
4080 %
4081 % We're going to be starting a paragraph, but we don't want the
4082 % \parskip glue -- logically it's part of the @item we just started.
4083 \nobreak \vskip-\parskip
4084 %
4085 % Stop a page break at the \parskip glue coming up. However, if
4086 % what follows is an environment such as @example, there will be no
4087 % \parskip glue; then the negative vskip we just inserted would
4088 % cause the example and the item to crash together. So we use this
4089 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4090 % \parskip glue after all. Section titles are handled this way also.
4091 %
4092 \penalty 10001
4093 \endgroup
4094 \itemxneedsnegativevskipfalse
4095 \else
4096 % The item text fits into the space. Start a paragraph, so that the
4097 % following text (if any) will end up on the same line.
4098 \noindent
4099 % Do this with kerns and \unhbox so that if there is a footnote in
4100 % the item text, it can migrate to the main vertical list and
4101 % eventually be printed.
4102 \nobreak\kern-\tableindent
4103 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4104 \unhbox0
4105 \nobreak\kern\dimen0
4106 \endgroup
4107 \itemxneedsnegativevskiptrue
4108 \fi
4109 }
4110
4111 \def\item{\errmessage{@item while not in a list environment}}
4112 \def\itemx{\errmessage{@itemx while not in a list environment}}
4113
4114 % @table, @ftable, @vtable.
4115 \envdef\table{%
4116 \let\itemindex\gobble
4117 \tablecheck{table}%
4118 }
4119 \envdef\ftable{%
4120 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4121 \tablecheck{ftable}%
4122 }
4123 \envdef\vtable{%
4124 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4125 \tablecheck{vtable}%
4126 }
4127 \def\tablecheck#1{%
4128 \ifnum \the\catcode`\^^M=\active
4129 \endgroup
4130 \errmessage{This command won't work in this context; perhaps the problem is
4131 that we are \inenvironment\thisenv}%
4132 \def\next{\doignore{#1}}%
4133 \else
4134 \let\next\tablex
4135 \fi
4136 \next
4137 }
4138 \def\tablex#1{%
4139 \def\itemindicate{#1}%
4140 \parsearg\tabley
4141 }
4142 \def\tabley#1{%
4143 {%
4144 \makevalueexpandable
4145 \edef\temp{\noexpand\tablez #1\space\space\space}%
4146 \expandafter
4147 }\temp \endtablez
4148 }
4149 \def\tablez #1 #2 #3 #4\endtablez{%
4150 \aboveenvbreak
4151 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4152 \ifnum 0#2>0 \tableindent=#2\mil \fi
4153 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4154 \itemmax=\tableindent
4155 \advance \itemmax by -\itemmargin
4156 \advance \leftskip by \tableindent
4157 \exdentamount=\tableindent
4158 \parindent = 0pt
4159 \parskip = \smallskipamount
4160 \ifdim \parskip=0pt \parskip=2pt \fi
4161 \let\item = \internalBitem
4162 \let\itemx = \internalBitemx
4163 }
4164 \def\Etable{\endgraf\afterenvbreak}
4165 \let\Eftable\Etable
4166 \let\Evtable\Etable
4167 \let\Eitemize\Etable
4168 \let\Eenumerate\Etable
4169
4170 % This is the counter used by @enumerate, which is really @itemize
4171
4172 \newcount \itemno
4173
4174 \envdef\itemize{\parsearg\doitemize}
4175
4176 \def\doitemize#1{%
4177 \aboveenvbreak
4178 \itemmax=\itemindent
4179 \advance\itemmax by -\itemmargin
4180 \advance\leftskip by \itemindent
4181 \exdentamount=\itemindent
4182 \parindent=0pt
4183 \parskip=\smallskipamount
4184 \ifdim\parskip=0pt \parskip=2pt \fi
4185 %
4186 % Try typesetting the item mark so that if the document erroneously says
4187 % something like @itemize @samp (intending @table), there's an error
4188 % right away at the @itemize. It's not the best error message in the
4189 % world, but it's better than leaving it to the @item. This means if
4190 % the user wants an empty mark, they have to say @w{} not just @w.
4191 \def\itemcontents{#1}%
4192 \setbox0 = \hbox{\itemcontents}%
4193 %
4194 % @itemize with no arg is equivalent to @itemize @bullet.
4195 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4196 %
4197 \let\item=\itemizeitem
4198 }
4199
4200 % Definition of @item while inside @itemize and @enumerate.
4201 %
4202 \def\itemizeitem{%
4203 \advance\itemno by 1 % for enumerations
4204 {\let\par=\endgraf \smallbreak}% reasonable place to break
4205 {%
4206 % If the document has an @itemize directly after a section title, a
4207 % \nobreak will be last on the list, and \sectionheading will have
4208 % done a \vskip-\parskip. In that case, we don't want to zero
4209 % parskip, or the item text will crash with the heading. On the
4210 % other hand, when there is normal text preceding the item (as there
4211 % usually is), we do want to zero parskip, or there would be too much
4212 % space. In that case, we won't have a \nobreak before. At least
4213 % that's the theory.
4214 \ifnum\lastpenalty<10000 \parskip=0in \fi
4215 \noindent
4216 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4217 %
4218 \ifinner\else
4219 \vadjust{\penalty 1200}% not good to break after first line of item.
4220 \fi
4221 % We can be in inner vertical mode in a footnote, although an
4222 % @itemize looks awful there.
4223 }%
4224 \flushcr
4225 }
4226
4227 % \splitoff TOKENS\endmark defines \first to be the first token in
4228 % TOKENS, and \rest to be the remainder.
4229 %
4230 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4231
4232 % Allow an optional argument of an uppercase letter, lowercase letter,
4233 % or number, to specify the first label in the enumerated list. No
4234 % argument is the same as `1'.
4235 %
4236 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4237 \def\enumeratey #1 #2\endenumeratey{%
4238 % If we were given no argument, pretend we were given `1'.
4239 \def\thearg{#1}%
4240 \ifx\thearg\empty \def\thearg{1}\fi
4241 %
4242 % Detect if the argument is a single token. If so, it might be a
4243 % letter. Otherwise, the only valid thing it can be is a number.
4244 % (We will always have one token, because of the test we just made.
4245 % This is a good thing, since \splitoff doesn't work given nothing at
4246 % all -- the first parameter is undelimited.)
4247 \expandafter\splitoff\thearg\endmark
4248 \ifx\rest\empty
4249 % Only one token in the argument. It could still be anything.
4250 % A ``lowercase letter'' is one whose \lccode is nonzero.
4251 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4252 % not equal to itself.
4253 % Otherwise, we assume it's a number.
4254 %
4255 % We need the \relax at the end of the \ifnum lines to stop TeX from
4256 % continuing to look for a <number>.
4257 %
4258 \ifnum\lccode\expandafter`\thearg=0\relax
4259 \numericenumerate % a number (we hope)
4260 \else
4261 % It's a letter.
4262 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4263 \lowercaseenumerate % lowercase letter
4264 \else
4265 \uppercaseenumerate % uppercase letter
4266 \fi
4267 \fi
4268 \else
4269 % Multiple tokens in the argument. We hope it's a number.
4270 \numericenumerate
4271 \fi
4272 }
4273
4274 % An @enumerate whose labels are integers. The starting integer is
4275 % given in \thearg.
4276 %
4277 \def\numericenumerate{%
4278 \itemno = \thearg
4279 \startenumeration{\the\itemno}%
4280 }
4281
4282 % The starting (lowercase) letter is in \thearg.
4283 \def\lowercaseenumerate{%
4284 \itemno = \expandafter`\thearg
4285 \startenumeration{%
4286 % Be sure we're not beyond the end of the alphabet.
4287 \ifnum\itemno=0
4288 \errmessage{No more lowercase letters in @enumerate; get a bigger
4289 alphabet}%
4290 \fi
4291 \char\lccode\itemno
4292 }%
4293 }
4294
4295 % The starting (uppercase) letter is in \thearg.
4296 \def\uppercaseenumerate{%
4297 \itemno = \expandafter`\thearg
4298 \startenumeration{%
4299 % Be sure we're not beyond the end of the alphabet.
4300 \ifnum\itemno=0
4301 \errmessage{No more uppercase letters in @enumerate; get a bigger
4302 alphabet}
4303 \fi
4304 \char\uccode\itemno
4305 }%
4306 }
4307
4308 % Call \doitemize, adding a period to the first argument and supplying the
4309 % common last two arguments. Also subtract one from the initial value in
4310 % \itemno, since @item increments \itemno.
4311 %
4312 \def\startenumeration#1{%
4313 \advance\itemno by -1
4314 \doitemize{#1.}\flushcr
4315 }
4316
4317
4318 % @multitable macros
4319
4320 % Macros used to set up halign preamble:
4321 %
4322 \let\endsetuptable\relax
4323 \def\xendsetuptable{\endsetuptable}
4324 \let\columnfractions\relax
4325 \def\xcolumnfractions{\columnfractions}
4326 \newif\ifsetpercent
4327
4328 % #1 is the @columnfraction, usually a decimal number like .5, but might
4329 % be just 1. We just use it, whatever it is.
4330 %
4331 \def\pickupwholefraction#1 {%
4332 \global\advance\colcount by 1
4333 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4334 \setuptable
4335 }
4336
4337 \newcount\colcount
4338 \def\setuptable#1{%
4339 \def\firstarg{#1}%
4340 \ifx\firstarg\xendsetuptable
4341 \let\go = \relax
4342 \else
4343 \ifx\firstarg\xcolumnfractions
4344 \global\setpercenttrue
4345 \else
4346 \ifsetpercent
4347 \let\go\pickupwholefraction
4348 \else
4349 \global\advance\colcount by 1
4350 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4351 % separator; typically that is always in the input, anyway.
4352 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4353 \fi
4354 \fi
4355 \ifx\go\pickupwholefraction
4356 % Put the argument back for the \pickupwholefraction call, so
4357 % we'll always have a period there to be parsed.
4358 \def\go{\pickupwholefraction#1}%
4359 \else
4360 \let\go = \setuptable
4361 \fi%
4362 \fi
4363 \go
4364 }
4365
4366 % @headitem starts a heading row, which we typeset in bold. Assignments
4367 % have to be global since we are inside the implicit group of an
4368 % alignment entry. \everycr below resets \everytab so we don't have to
4369 % undo it ourselves.
4370 \def\headitemfont{\b}% for people to use in the template row; not changeable
4371 \def\headitem{%
4372 \crcr % must appear first
4373 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4374 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4375 \the\everytab % for the first item
4376 }%
4377 %
4378 % default for tables with no headings.
4379 \let\headitemcrhook=\relax
4380 %
4381 \def\tab{\checkenv\multitable &\the\everytab}%
4382
4383 \newtoks\everytab % insert after every tab.
4384 %
4385 \envdef\multitable{%
4386 \vskip\parskip
4387 \startsavinginserts
4388 %
4389 % @item within a multitable starts a normal row.
4390 % We use \def instead of \let so that if one of the multitable entries
4391 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4392 % \endtemplate) expanding \doitemize.
4393 \def\item{\crcr}%
4394 %
4395 \tolerance=9500
4396 \hbadness=9500
4397 \parskip=0pt
4398 \parindent=6pt
4399 \overfullrule=0pt
4400 \global\colcount=0
4401 %
4402 \everycr = {%
4403 \noalign{%
4404 \global\everytab={}% Reset from possible headitem.
4405 \global\colcount=0 % Reset the column counter.
4406 %
4407 % Check for saved footnotes, etc.:
4408 \checkinserts
4409 %
4410 % Perhaps a \nobreak, then reset:
4411 \headitemcrhook
4412 \global\let\headitemcrhook=\relax
4413 }%
4414 }%
4415 %
4416 \parsearg\domultitable
4417 }
4418 \def\domultitable#1{%
4419 % To parse everything between @multitable and @item:
4420 \setuptable#1 \endsetuptable
4421 %
4422 % This preamble sets up a generic column definition, which will
4423 % be used as many times as user calls for columns.
4424 % \vtop will set a single line and will also let text wrap and
4425 % continue for many paragraphs if desired.
4426 \halign\bgroup &%
4427 \global\advance\colcount by 1
4428 \strut
4429 \vtop{%
4430 \advance\hsize by -1\leftskip
4431 % Find the correct column width
4432 \hsize=\expandafter\csname col\the\colcount\endcsname
4433 %
4434 \advance\rightskip by -1\rightskip % Zero leaving only any stretch
4435 \ifnum\colcount=1
4436 \advance\hsize by\leftskip % Add indent of surrounding text
4437 \else
4438 % In order to keep entries from bumping into each other.
4439 \leftskip=12pt
4440 \ifsetpercent \else
4441 % If a template has been used
4442 \advance\hsize by \leftskip
4443 \fi
4444 \fi
4445 \noindent\ignorespaces##\unskip\strut
4446 }\cr
4447 }
4448 \def\Emultitable{%
4449 \crcr
4450 \egroup % end the \halign
4451 \global\setpercentfalse
4452 }
4453
4454
4455 \message{conditionals,}
4456
4457 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotlatex, @ifnotplaintext,
4458 % @ifnotxml always succeed. They currently do nothing; we don't
4459 % attempt to check whether the conditionals are properly nested. But we
4460 % have to remember that they are conditionals, so that @end doesn't
4461 % attempt to close an environment group.
4462 %
4463 \def\makecond#1{%
4464 \expandafter\let\csname #1\endcsname = \relax
4465 \expandafter\let\csname iscond.#1\endcsname = 1
4466 }
4467 \makecond{iftex}
4468 \makecond{ifnotdocbook}
4469 \makecond{ifnothtml}
4470 \makecond{ifnotinfo}
4471 \makecond{ifnotlatex}
4472 \makecond{ifnotplaintext}
4473 \makecond{ifnotxml}
4474
4475 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4476 %
4477 \def\direntry{\doignore{direntry}}
4478 \def\documentdescription{\doignore{documentdescription}}
4479 \def\docbook{\doignore{docbook}}
4480 \def\html{\doignore{html}}
4481 \def\ifdocbook{\doignore{ifdocbook}}
4482 \def\ifhtml{\doignore{ifhtml}}
4483 \def\ifinfo{\doignore{ifinfo}}
4484 \def\iflatex{\doignore{iflatex}}
4485 \def\ifnottex{\doignore{ifnottex}}
4486 \def\ifplaintext{\doignore{ifplaintext}}
4487 \def\ifxml{\doignore{ifxml}}
4488 \def\ignore{\doignore{ignore}}
4489 \def\latex{\doignore{latex}}
4490 \def\menu{\doignore{menu}}
4491 \def\xml{\doignore{xml}}
4492
4493 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4494 %
4495 % A count to remember the depth of nesting.
4496 \newcount\doignorecount
4497
4498 \def\doignore#1{\begingroup
4499 % Scan in ``verbatim'' mode:
4500 \obeylines
4501 \catcode`\@ = \other
4502 \catcode`\{ = \other
4503 \catcode`\} = \other
4504 %
4505 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4506 \spaceisspace
4507 %
4508 % Count number of #1's that we've seen.
4509 \doignorecount = 0
4510 %
4511 % Swallow text until we reach the matching `@end #1'.
4512 \dodoignore{#1}%
4513 }
4514
4515 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4516 \obeylines %
4517 %
4518 \gdef\dodoignore#1{%
4519 % #1 contains the command name as a string, e.g., `ifinfo'.
4520 %
4521 % Define a command to find the next `@end #1'.
4522 \long\def\doignoretext##1^^M@end #1{%
4523 \doignoretextyyy##1^^M@#1\_STOP_}%
4524 %
4525 % And this command to find another #1 command, at the beginning of a
4526 % line. (Otherwise, we would consider a line `@c @ifset', for
4527 % example, to count as an @ifset for nesting.)
4528 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4529 %
4530 % And now expand that command.
4531 \doignoretext ^^M%
4532 }%
4533 }
4534
4535 \def\doignoreyyy#1{%
4536 \def\temp{#1}%
4537 \ifx\temp\empty % Nothing found.
4538 \let\next\doignoretextzzz
4539 \else % Found a nested condition, ...
4540 \advance\doignorecount by 1
4541 \let\next\doignoretextyyy % ..., look for another.
4542 % If we're here, #1 ends with ^^M\ifinfo (for example).
4543 \fi
4544 \next #1% the token \_STOP_ is present just after this macro.
4545 }
4546
4547 % We have to swallow the remaining "\_STOP_".
4548 %
4549 \def\doignoretextzzz#1{%
4550 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4551 \let\next\enddoignore
4552 \else % Still inside a nested condition.
4553 \advance\doignorecount by -1
4554 \let\next\doignoretext % Look for the next @end.
4555 \fi
4556 \next
4557 }
4558
4559 % Finish off ignored text.
4560 { \obeylines%
4561 % Ignore anything after the last `@end #1'; this matters in verbatim
4562 % environments, where otherwise the newline after an ignored conditional
4563 % would result in a blank line in the output.
4564 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4565 }
4566
4567
4568 % @set VAR sets the variable VAR to an empty value.
4569 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4570 %
4571 % Since we want to separate VAR from REST-OF-LINE (which might be
4572 % empty), we can't just use \parsearg; we have to insert a space of our
4573 % own to delimit the rest of the line, and then take it out again if we
4574 % didn't need it.
4575 % We rely on the fact that \parsearg sets \catcode`\ =10.
4576 %
4577 \parseargdef\set{\setyyy#1 \endsetyyy}
4578 \def\setyyy#1 #2\endsetyyy{%
4579 {%
4580 \makevalueexpandable
4581 \def\temp{#2}%
4582 \edef\next{\gdef\makecsname{SET#1}}%
4583 \ifx\temp\empty
4584 \next{}%
4585 \else
4586 \setzzz#2\endsetzzz
4587 \fi
4588 }%
4589 }
4590 % Remove the trailing space \setxxx inserted.
4591 \def\setzzz#1 \endsetzzz{\next{#1}}
4592
4593 % @clear VAR clears (i.e., unsets) the variable VAR.
4594 %
4595 \parseargdef\clear{%
4596 {%
4597 \makevalueexpandable
4598 \global\expandafter\let\csname SET#1\endcsname=\relax
4599 }%
4600 }
4601
4602 % @value{foo} gets the text saved in variable foo.
4603 \def\value{\begingroup\makevalueexpandable\valuexxx}
4604 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4605 {
4606 \catcode`\-=\active \catcode`\_=\active
4607 %
4608 \gdef\makevalueexpandable{%
4609 \let\value = \expandablevalue
4610 % We don't want these characters active, ...
4611 \catcode`\-=\other \catcode`\_=\other
4612 % ..., but we might end up with active ones in the argument if
4613 % we're called from @code, as @code{@value{foo-bar_}}, though.
4614 % So \let them to their normal equivalents.
4615 \let-\normaldash \let_\normalunderscore
4616 }
4617 }
4618
4619 \def\expandablevalue#1{%
4620 \expandafter\ifx\csname SET#1\endcsname\relax
4621 {[No value for ``#1'']}%
4622 \message{Variable `#1', used in @value, is not set.}%
4623 \else
4624 \csname SET#1\endcsname
4625 \fi
4626 }
4627
4628 % Like \expandablevalue, but completely expandable (the \message in the
4629 % definition above operates at the execution level of TeX). Used when
4630 % writing to auxiliary files, due to the expansion that \write does.
4631 % If flag is undefined, pass through an unexpanded @value command: maybe it
4632 % will be set by the time it is read back in.
4633 %
4634 % NB flag names containing - or _ may not work here.
4635 \def\dummyvalue#1{%
4636 \expandafter\ifx\csname SET#1\endcsname\relax
4637 \string\value{#1}%
4638 \else
4639 \csname SET#1\endcsname
4640 \fi
4641 }
4642
4643 % Used for @value's in index entries to form the sort key: expand the @value
4644 % if possible, otherwise sort late.
4645 \def\indexnofontsvalue#1{%
4646 \expandafter\ifx\csname SET#1\endcsname\relax
4647 ZZZZZZZ%
4648 \else
4649 \csname SET#1\endcsname
4650 \fi
4651 }
4652
4653 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4654 % with @set.
4655 %
4656 % To get the special treatment we need for `@end ifset,' we call
4657 % \makecond and then redefine.
4658 %
4659 \makecond{ifset}
4660 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4661 \def\doifset#1#2{%
4662 {%
4663 \makevalueexpandable
4664 \let\next=\empty
4665 \expandafter\ifx\csname SET#2\endcsname\relax
4666 #1% If not set, redefine \next.
4667 \fi
4668 \expandafter
4669 }\next
4670 }
4671 \def\ifsetfail{\doignore{ifset}}
4672
4673 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4674 % defined with @set, or has been undefined with @clear.
4675 %
4676 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4677 % above code: if the variable is not set, do nothing, if it is set,
4678 % then redefine \next to \ifclearfail.
4679 %
4680 \makecond{ifclear}
4681 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4682 \def\ifclearfail{\doignore{ifclear}}
4683
4684 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4685 % without the @) is in fact defined. We can only feasibly check at the
4686 % TeX level, so something like `mathcode' is going to considered
4687 % defined even though it is not a Texinfo command.
4688 %
4689 \makecond{ifcommanddefined}
4690 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4691 %
4692 \def\doifcmddefined#1#2{{%
4693 \makevalueexpandable
4694 \let\next=\empty
4695 \expandafter\ifx\csname #2\endcsname\relax
4696 #1% If not defined, \let\next as above.
4697 \fi
4698 \expandafter
4699 }\next
4700 }
4701 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4702
4703 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4704 \makecond{ifcommandnotdefined}
4705 \def\ifcommandnotdefined{%
4706 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4707 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4708
4709 % Set the `txicommandconditionals' variable, so documents have a way to
4710 % test if the @ifcommand...defined conditionals are available.
4711 \set txicommandconditionals
4712
4713 % @dircategory CATEGORY -- specify a category of the dir file
4714 % which this file should belong to. Ignore this in TeX.
4715 \let\dircategory=\comment
4716
4717 % @defininfoenclose.
4718 \let\definfoenclose=\comment
4719
4720
4721 \message{indexing,}
4722 % Index generation facilities
4723
4724 % Define \newwrite to be identical to plain tex's \newwrite
4725 % except not \outer, so it can be used within macros and \if's.
4726 \edef\newwrite{\makecsname{ptexnewwrite}}
4727
4728 % \newindex {foo} defines an index named IX.
4729 % It automatically defines \IXindex such that
4730 % \IXindex ...rest of line... puts an entry in the index IX.
4731 % It also defines \IXindfile to be the number of the output channel for
4732 % the file that accumulates this index. The file's extension is IX.
4733 % The name of an index should be no more than 2 characters long
4734 % for the sake of vms.
4735 %
4736 \def\newindex#1{%
4737 \expandafter\chardef\csname#1indfile\endcsname=0
4738 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4739 \noexpand\doindex{#1}}
4740 }
4741
4742 % @defindex foo == \newindex{foo}
4743 %
4744 \def\defindex{\parsearg\newindex}
4745
4746 % Define @defcodeindex, like @defindex except put all entries in @code.
4747 %
4748 \def\defcodeindex{\parsearg\newcodeindex}
4749 %
4750 \def\newcodeindex#1{%
4751 \expandafter\chardef\csname#1indfile\endcsname=0
4752 \expandafter\xdef\csname#1index\endcsname{%
4753 \noexpand\docodeindex{#1}}%
4754 }
4755
4756 % The default indices:
4757 \newindex{cp}% concepts,
4758 \newcodeindex{fn}% functions,
4759 \newcodeindex{vr}% variables,
4760 \newcodeindex{tp}% types,
4761 \newcodeindex{ky}% keys
4762 \newcodeindex{pg}% and programs.
4763
4764
4765 % @synindex foo bar makes index foo feed into index bar.
4766 % Do this instead of @defindex foo if you don't want it as a separate index.
4767 %
4768 % @syncodeindex foo bar similar, but put all entries made for index foo
4769 % inside @code.
4770 %
4771 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4772 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4773
4774 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4775 % #3 the target index (bar).
4776 \def\dosynindex#1#2#3{%
4777 \requireopenindexfile{#3}%
4778 % redefine \fooindfile:
4779 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4780 \expandafter\let\csname#2indfile\endcsname=\temp
4781 % redefine \fooindex:
4782 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4783 }
4784
4785 % Define \doindex, the driver for all index macros.
4786 % Argument #1 is generated by the calling \fooindex macro,
4787 % and it is the two-letter name of the index.
4788
4789 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4790 \def\doindexxxx #1{\doind{\indexname}{#1}}
4791
4792 % like the previous two, but they put @code around the argument.
4793 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4794 \def\docodeindexxxx #1{\docind{\indexname}{#1}}
4795
4796
4797 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4798 % preventing its expansion. This is used only for control words,
4799 % not control letters, because the \space would be incorrect for
4800 % control characters, but is needed to separate the control word
4801 % from whatever follows.
4802 %
4803 % These can be used both for control words that take an argument and
4804 % those that do not. If it is followed by {arg} in the input, then
4805 % that will dutifully get written to the index (or wherever).
4806 %
4807 % For control letters, we have \definedummyletter, which omits the
4808 % space.
4809 %
4810 \def\definedummyword #1{\def#1{\string#1\space}}%
4811 \def\definedummyletter#1{\def#1{\string#1}}%
4812
4813 % Used for the aux, toc and index files to prevent expansion of Texinfo
4814 % commands. Most of the commands are controlled through the
4815 % \ifdummies conditional.
4816 %
4817 \def\atdummies{%
4818 \dummiestrue
4819 %
4820 \definedummyletter\@%
4821 \definedummyletter\ %
4822 \definedummyletter\{%
4823 \definedummyletter\}%
4824 \definedummyletter\&%
4825 %
4826 \definedummyletter\_%
4827 \definedummyletter\-%
4828 %
4829 \definedummyword\subentry
4830 %
4831 % We want to disable all macros so that they are not expanded by \write.
4832 \let\commondummyword\definedummyword
4833 \macrolist
4834 \let\value\dummyvalue
4835 %
4836 \turnoffactive
4837 }
4838
4839 \newif\ifdummies
4840 \newif\ifindexnofonts
4841
4842 \def\commondummyletter#1{%
4843 \expandafter\let\csname\string#1:impl\endcsname#1%
4844 \edef#1{%
4845 \noexpand\ifindexnofonts
4846 % empty expansion
4847 \noexpand\else
4848 \noexpand\ifdummies\string#1%
4849 \noexpand\else
4850 \noexpand\jumptwofi % dispose of the \fi
4851 \expandafter\noexpand\csname\string#1:impl\endcsname
4852 \noexpand\fi
4853 \noexpand\fi}%
4854 }
4855
4856 \def\commondummyaccent#1{%
4857 \expandafter\let\csname\string#1:impl\endcsname#1%
4858 \edef#1{%
4859 \noexpand\ifindexnofonts
4860 \noexpand\expandafter % dispose of \else ... \fi
4861 \noexpand\asis
4862 \noexpand\else
4863 \noexpand\ifdummies\string#1%
4864 \noexpand\else
4865 \noexpand\jumptwofi % dispose of the \fi
4866 \expandafter\noexpand\csname\string#1:impl\endcsname
4867 \noexpand\fi
4868 \noexpand\fi}%
4869 }
4870
4871 % Like \commondummyaccent but add a \space at the end of the dummy expansion
4872 % #2 is the expansion used for \indexnofonts. #2 is always followed by
4873 % \asis to remove a pair of following braces.
4874 \def\commondummyword#1#2{%
4875 \expandafter\let\csname\string#1:impl\endcsname#1%
4876 \expandafter\def\csname\string#1:ixnf\endcsname{#2\asis}%
4877 \edef#1{%
4878 \noexpand\ifindexnofonts
4879 \noexpand\expandafter % dispose of \else ... \fi
4880 \expandafter\noexpand\csname\string#1:ixnf\endcsname
4881 \noexpand\else
4882 \noexpand\ifdummies\string#1\space
4883 \noexpand\else
4884 \noexpand\jumptwofi % dispose of the \fi \fi
4885 \expandafter\noexpand\csname\string#1:impl\endcsname
4886 \noexpand\fi
4887 \noexpand\fi}%
4888 }
4889 \def\jumptwofi#1\fi\fi{\fi\fi#1}
4890
4891 % For \atdummies and \indexnofonts. \atdummies sets
4892 % \dummiestrue and \indexnofonts sets \indexnofontstrue.
4893 \def\definedummies{
4894 % @-sign is always an escape character when reading auxiliary files
4895 \escapechar = `\@
4896 %
4897 \commondummyletter\!%
4898 \commondummyaccent\"%
4899 \commondummyaccent\'%
4900 \commondummyletter\*%
4901 \commondummyaccent\,%
4902 \commondummyletter\.%
4903 \commondummyletter\/%
4904 \commondummyletter\:%
4905 \commondummyaccent\=%
4906 \commondummyletter\?%
4907 \commondummyaccent\^%
4908 \commondummyaccent\`%
4909 \commondummyaccent\~%
4910 %
4911 % Control letters and accents.
4912 \commondummyword\u {}%
4913 \commondummyword\v {}%
4914 \commondummyword\H {}%
4915 \commondummyword\dotaccent {}%
4916 \commondummyword\ogonek {}%
4917 \commondummyword\ringaccent {}%
4918 \commondummyword\tieaccent {}%
4919 \commondummyword\ubaraccent {}%
4920 \commondummyword\udotaccent {}%
4921 \commondummyword\dotless {}%
4922 %
4923 % Texinfo font commands.
4924 \commondummyword\b {}%
4925 \commondummyword\i {}%
4926 \commondummyword\r {}%
4927 \commondummyword\sansserif {}%
4928 \commondummyword\sc {}%
4929 \commondummyword\slanted {}%
4930 \commondummyword\t {}%
4931 %
4932 % Commands that take arguments.
4933 \commondummyword\abbr {}%
4934 \commondummyword\acronym {}%
4935 \commondummyword\anchor {}%
4936 \commondummyword\cite {}%
4937 \commondummyword\code {}%
4938 \commondummyword\command {}%
4939 \commondummyword\dfn {}%
4940 \commondummyword\dmn {}%
4941 \commondummyword\email {}%
4942 \commondummyword\emph {}%
4943 \commondummyword\env {}%
4944 \commondummyword\file {}%
4945 \commondummyword\image {}%
4946 \commondummyword\indicateurl{}%
4947 \commondummyword\inforef {}%
4948 \commondummyword\kbd {}%
4949 \commondummyword\key {}%
4950 \commondummyword\math {}%
4951 \commondummyword\option {}%
4952 \commondummyword\pxref {}%
4953 \commondummyword\ref {}%
4954 \commondummyword\samp {}%
4955 \commondummyword\strong {}%
4956 \commondummyword\tie {}%
4957 \commondummyword\U {}%
4958 \commondummyword\uref {}%
4959 \commondummyword\url {}%
4960 \commondummyword\var {}%
4961 \commondummyword\verb {}%
4962 \commondummyword\w {}%
4963 \commondummyword\xref {}%
4964 %
4965 \commondummyword\AA {AA}%
4966 \commondummyword\AE {AE}%
4967 \commondummyword\DH {DZZ}%
4968 \commondummyword\L {L}%
4969 \commondummyword\O {O}%
4970 \commondummyword\OE {OE}%
4971 \commondummyword\TH {TH}%
4972 \commondummyword\aa {aa}%
4973 \commondummyword\ae {ae}%
4974 \commondummyword\dh {dzz}%
4975 \commondummyword\exclamdown {!}%
4976 \commondummyword\l {l}%
4977 \commondummyword\o {o}%
4978 \commondummyword\oe {oe}%
4979 \commondummyword\ordf {a}%
4980 \commondummyword\ordm {o}%
4981 \commondummyword\questiondown {?}%
4982 \commondummyword\ss {ss}%
4983 \commondummyword\th {th}%
4984 %
4985 \commondummyword\LaTeX {LaTeX}%
4986 \commondummyword\TeX {TeX}%
4987 %
4988 % Assorted special characters.
4989 \commondummyword\ampchar {\normalamp}%
4990 \commondummyword\atchar {\@}%
4991 \commondummyword\arrow {->}%
4992 \commondummyword\backslashchar {}%
4993 \commondummyword\bullet {bullet}%
4994 \commondummyword\comma {,}%
4995 \commondummyword\copyright {copyright}%
4996 \commondummyword\dots {...}%
4997 \commondummyword\enddots {...}%
4998 \commondummyword\entrybreak {}%
4999 \commondummyword\equiv {===}%
5000 \commondummyword\error {error}%
5001 \commondummyword\euro {euro}%
5002 \commondummyword\expansion {==>}%
5003 \commondummyword\geq {>=}%
5004 \commondummyword\guillemetleft {<<}%
5005 \commondummyword\guillemetright {>>}%
5006 \commondummyword\guilsinglleft {<}%
5007 \commondummyword\guilsinglright {>}%
5008 \commondummyword\lbracechar {\{}%
5009 \commondummyword\leq {<=}%
5010 \commondummyword\mathopsup {sup}%
5011 \commondummyword\minus {-}%
5012 \commondummyword\pounds {pounds}%
5013 \commondummyword\point {.}%
5014 \commondummyword\print {-|}%
5015 \commondummyword\quotedblbase {"}%
5016 \commondummyword\quotedblleft {"}%
5017 \commondummyword\quotedblright {"}%
5018 \commondummyword\quoteleft {`}%
5019 \commondummyword\quoteright {'}%
5020 \commondummyword\quotesinglbase {,}%
5021 \commondummyword\rbracechar {\}}%
5022 \commondummyword\registeredsymbol {R}%
5023 \commondummyword\result {=>}%
5024 \commondummyword\sub {}%
5025 \commondummyword\sup {}%
5026 \commondummyword\textdegree {o}%
5027 }
5028
5029 \let\indexlbrace\relax
5030 \let\indexrbrace\relax
5031 \let\indexatchar\relax
5032 \let\indexbackslash\relax
5033
5034 {\catcode`\@=0
5035 \catcode`\\=13
5036 @gdef@backslashdisappear{@def\{}}
5037 }
5038
5039 {
5040 \catcode`\<=13
5041 \catcode`\-=13
5042 \catcode`\`=13
5043 \gdef\indexnonalnumdisappear{%
5044 \ifflagclear{txiindexlquoteignore}{}{%
5045 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5046 % (Introduced for FSFS 2nd ed.)
5047 \let`=\empty
5048 }%
5049 %
5050 \ifflagclear{txiindexbackslashignore}{}{%
5051 \backslashdisappear
5052 }%
5053 \ifflagclear{txiindexhyphenignore}{}{%
5054 \def-{}%
5055 }%
5056 \ifflagclear{txiindexlessthanignore}{}{%
5057 \def<{}%
5058 }%
5059 \ifflagclear{txiindexatsignignore}{}{%
5060 \def\@{}%
5061 }%
5062 }
5063
5064 \gdef\indexnonalnumreappear{%
5065 \let-\normaldash
5066 \let<\normalless
5067 }
5068 }
5069
5070
5071 % \indexnofonts is used when outputting the strings to sort the index
5072 % by, and when constructing control sequence names. It eliminates all
5073 % control sequences and just writes whatever the best ASCII sort string
5074 % would be for a given command (usually its argument).
5075 %
5076 \def\indexnofonts{%
5077 \indexnofontstrue
5078 %
5079 \def\ { }%
5080 \def\@{@}%
5081 \def\_{\normalunderscore}%
5082 \def\-{}% @- shouldn't affect sorting
5083 %
5084 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5085 \uccode`\1=`\} \uppercase{\def\}{1}}%
5086 \let\lbracechar\{%
5087 \let\rbracechar\}%
5088 %
5089 %
5090 % We need to get rid of all macros, leaving only the arguments (if present).
5091 % Of course this is not nearly correct, but it is the best we can do for now.
5092 % makeinfo does not expand macros in the argument to @deffn, which ends up
5093 % writing an index entry, and texindex isn't prepared for an index sort entry
5094 % that starts with \.
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, \doublecolumhsize, 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 = \savepageno
6821 %
6822 % If \romancount > \arabiccount, the contents are at the end of the
6823 % document. Otherwise, advance where the Arabic numerals start for
6824 % the page numbers.
6825 \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi
6826 }
6827
6828 % Typeset the label for a chapter or appendix for the short contents.
6829 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6830 %
6831 \def\shortchaplabel#1{%
6832 % This space should be enough, since a single number is .5em, and the
6833 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6834 % But use \hss just in case.
6835 % (This space doesn't include the extra space that gets added after
6836 % the label; that gets put in by \shortchapentry above.)
6837 %
6838 % We'd like to right-justify chapter numbers, but that looks strange
6839 % with appendix letters. And right-justifying numbers and
6840 % left-justifying letters looks strange when there is less than 10
6841 % chapters. Have to read the whole toc once to know how many chapters
6842 % there are before deciding ...
6843 \hbox to 1em{#1\hss}%
6844 }
6845
6846 % These macros generate individual entries in the table of contents.
6847 % The first argument is the chapter or section name.
6848 % The last argument is the page number.
6849 % The arguments in between are the chapter number, section number, ...
6850
6851 % Parts, in the main contents. Replace the part number, which doesn't
6852 % exist, with an empty box. Let's hope all the numbers have the same width.
6853 % Also ignore the page number, which is conventionally not printed.
6854 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6855 \def\partentry#1#2#3#4{%
6856 % Add stretch and a bonus for breaking the page before the part heading.
6857 % This reduces the chance of the page being broken immediately after the
6858 % part heading, before a following chapter heading.
6859 \vskip 0pt plus 5\baselineskip
6860 \penalty-300
6861 \vskip 0pt plus -5\baselineskip
6862 \dochapentry{\numeralbox\labelspace#1}{}%
6863 }
6864 %
6865 % Parts, in the short toc.
6866 \def\shortpartentry#1#2#3#4{%
6867 \penalty-300
6868 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6869 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6870 }
6871
6872 % Chapters, in the main contents.
6873 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6874
6875 % Chapters, in the short toc.
6876 % See comments in \dochapentry re vbox and related settings.
6877 \def\shortchapentry#1#2#3#4{%
6878 \tocentry{\shortchaplabel{#2}\labelspace #1}{#4}%
6879 }
6880
6881 % Appendices, in the main contents.
6882 % Need the word Appendix, and a fixed-size box.
6883 %
6884 \def\appendixbox#1{%
6885 % We use M since it's probably the widest letter.
6886 \setbox0 = \hbox{\putwordAppendix{} M}%
6887 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6888 %
6889 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6890
6891 % Unnumbered chapters.
6892 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6893 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{#4}}
6894
6895 % Sections.
6896 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6897 \let\appsecentry=\numsecentry
6898 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6899
6900 % Subsections.
6901 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6902 \let\appsubsecentry=\numsubsecentry
6903 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6904
6905 % And subsubsections.
6906 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6907 \let\appsubsubsecentry=\numsubsubsecentry
6908 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6909
6910 % This parameter controls the indentation of the various levels.
6911 % Same as \defaultparindent.
6912 \newdimen\tocindent \tocindent = 15pt
6913
6914 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6915 % page number.
6916 %
6917 % If the toc has to be broken over pages, we want it to be at chapters
6918 % if at all possible; hence the \penalty.
6919 \def\dochapentry#1#2{%
6920 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6921 \begingroup
6922 % Move the page numbers slightly to the right
6923 \advance\entryrightmargin by -0.05em
6924 \chapentryfonts
6925 \tocentry{#1}{#2}%
6926 \endgroup
6927 \nobreak\vskip .25\baselineskip plus.1\baselineskip
6928 }
6929
6930 \def\dosecentry#1#2{\begingroup
6931 \secentryfonts \leftskip=\tocindent
6932 \tocentry{#1}{#2}%
6933 \endgroup}
6934
6935 \def\dosubsecentry#1#2{\begingroup
6936 \subsecentryfonts \leftskip=2\tocindent
6937 \tocentry{#1}{#2}%
6938 \endgroup}
6939
6940 \def\dosubsubsecentry#1#2{\begingroup
6941 \subsubsecentryfonts \leftskip=3\tocindent
6942 \tocentry{#1}{#2}%
6943 \endgroup}
6944
6945 % We use the same \entry macro as for the index entries.
6946 \let\tocentry = \entry
6947
6948 % Space between chapter (or whatever) number and the title.
6949 \def\labelspace{\hskip1em \relax}
6950
6951 \def\chapentryfonts{\secfonts \rm}
6952 \def\secentryfonts{\textfonts}
6953 \def\subsecentryfonts{\textfonts}
6954 \def\subsubsecentryfonts{\textfonts}
6955
6956
6957 \message{environments,}
6958 % @foo ... @end foo.
6959
6960 % @tex ... @end tex escapes into raw TeX temporarily.
6961 % One exception: @ is still an escape character, so that @end tex works.
6962 % But \@ or @@ will get a plain @ character.
6963
6964 \envdef\tex{%
6965 \setregularquotes
6966 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6967 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6968 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6969 \catcode `\%=14
6970 \catcode `\+=\other
6971 \catcode `\"=\other
6972 \catcode `\|=\other
6973 \catcode `\<=\other
6974 \catcode `\>=\other
6975 \catcode `\`=\other
6976 \catcode `\'=\other
6977 %
6978 % ' is active in math mode (mathcode"8000). So reset it, and all our
6979 % other math active characters (just in case), to plain's definitions.
6980 \mathactive
6981 %
6982 % Inverse of the list at the beginning of the file.
6983 \let\b=\ptexb
6984 \let\bullet=\ptexbullet
6985 \let\c=\ptexc
6986 \let\,=\ptexcomma
6987 \let\.=\ptexdot
6988 \let\dots=\ptexdots
6989 \let\equiv=\ptexequiv
6990 \let\!=\ptexexclam
6991 \let\i=\ptexi
6992 \let\indent=\ptexindent
6993 \let\noindent=\ptexnoindent
6994 \let\{=\ptexlbrace
6995 \let\+=\tabalign
6996 \let\}=\ptexrbrace
6997 \let\/=\ptexslash
6998 \let\sp=\ptexsp
6999 \let\*=\ptexstar
7000 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7001 \let\t=\ptext
7002 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7003 \let\frenchspacing=\plainfrenchspacing
7004 %
7005 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7006 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7007 \def\@{@}%
7008 }
7009 % There is no need to define \Etex.
7010
7011 % Define @lisp ... @end lisp.
7012 % @lisp environment forms a group so it can rebind things,
7013 % including the definition of @end lisp (which normally is erroneous).
7014
7015 % Amount to narrow the margins by for @lisp.
7016 \newskip\lispnarrowing \lispnarrowing=0.4in
7017
7018 % This is the definition that ^^M gets inside @lisp, @example, and other
7019 % such environments. \null is better than a space, since it doesn't
7020 % have any width.
7021 \def\lisppar{\null\endgraf}
7022
7023 % This space is always present above and below environments.
7024 \newskip\envskipamount \envskipamount = 0pt
7025
7026 % Make spacing and below environment symmetrical. We use \parskip here
7027 % to help in doing that, since in @example-like environments \parskip
7028 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7029 % start of the next paragraph will insert \parskip.
7030 %
7031 \def\aboveenvbreak{{%
7032 % =10000 instead of <10000 because of a special case in \itemzzz and
7033 % \sectionheading, q.v.
7034 \ifnum \lastpenalty=10000 \else
7035 \advance\envskipamount by \parskip
7036 \endgraf
7037 \ifdim\lastskip<\envskipamount
7038 \removelastskip
7039 \ifnum\lastpenalty<10000
7040 % Penalize breaking before the environment, because preceding text
7041 % often leads into it.
7042 \penalty100
7043 \fi
7044 \vskip\envskipamount
7045 \fi
7046 \fi
7047 }}
7048
7049 \def\afterenvbreak{{%
7050 % =10000 instead of <10000 because of a special case in \itemzzz and
7051 % \sectionheading, q.v.
7052 \ifnum \lastpenalty=10000 \else
7053 \advance\envskipamount by \parskip
7054 \endgraf
7055 \ifdim\lastskip<\envskipamount
7056 \removelastskip
7057 % it's not a good place to break if the last penalty was \nobreak
7058 % or better ...
7059 \ifnum\lastpenalty<10000 \penalty-50 \fi
7060 \vskip\envskipamount
7061 \fi
7062 \fi
7063 }}
7064
7065 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7066 % also clear it, so that its embedded environments do the narrowing again.
7067 \let\nonarrowing=\relax
7068
7069 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7070 % environment contents.
7071
7072 %
7073 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7074 \def\ctr{{\hskip 6pt\circle\char'010}}
7075 \def\cbl{{\circle\char'012\hskip -6pt}}
7076 \def\cbr{{\hskip 6pt\circle\char'011}}
7077 \def\carttop{\hbox to \cartouter{\hskip\lskip
7078 \ctl\leaders\hrule height\circthick\hfil\ctr
7079 \hskip\rskip}}
7080 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7081 \cbl\leaders\hrule height\circthick\hfil\cbr
7082 \hskip\rskip}}
7083 %
7084 \newskip\lskip\newskip\rskip
7085
7086 % only require the font if @cartouche is actually used
7087 \def\cartouchefontdefs{%
7088 \font\circle=lcircle10\relax
7089 \circthick=\fontdimen8\circle
7090 }
7091 \newdimen\circthick
7092 \newdimen\cartouter\newdimen\cartinner
7093 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7094
7095 \envparseargdef\cartouche{%
7096 \cartouchefontdefs
7097 \ifhmode\par\fi % can't be in the midst of a paragraph.
7098 \startsavinginserts
7099 \lskip=\leftskip \rskip=\rightskip
7100 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7101 %
7102 % Set paragraph width for text inside cartouche. There are
7103 % left and right margins of 3pt each plus two vrules 0.4pt each.
7104 \cartinner=\hsize \advance\cartinner by-\lskip
7105 \advance\cartinner by-\rskip
7106 \advance\cartinner by -6.8pt
7107 %
7108 % For drawing top and bottom of cartouche. Each corner char
7109 % adds 6pt and we take off the width of a rule to line up with the
7110 % right boundary perfectly.
7111 \cartouter=\hsize
7112 \advance\cartouter by 11.6pt
7113 %
7114 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7115 %
7116 % If this cartouche directly follows a sectioning command, we need the
7117 % \parskip glue (backspaced over by default) or the cartouche can
7118 % collide with the section heading.
7119 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7120 %
7121 \setbox\groupbox=\vtop\bgroup
7122 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7123 \carttop
7124 \hbox\bgroup
7125 \hskip\lskip
7126 \vrule\kern3pt
7127 \vbox\bgroup
7128 \hsize=\cartinner
7129 \baselineskip=\normbskip
7130 \lineskip=\normlskip
7131 \parskip=\normpskip
7132 \def\arg{#1}%
7133 \ifx\arg\empty\else
7134 \centerV{\hfil \bf #1 \hfil}%
7135 \fi
7136 \kern3pt
7137 \vskip -\parskip
7138 }
7139 \def\Ecartouche{%
7140 \ifhmode\par\fi
7141 \kern3pt
7142 \egroup
7143 \kern3pt\vrule
7144 \hskip\rskip
7145 \egroup
7146 \cartbot
7147 \egroup
7148 \addgroupbox
7149 \checkinserts
7150 }
7151
7152
7153 % This macro is called at the beginning of all the @example variants,
7154 % inside a group.
7155 \newdimen\nonfillparindent
7156 \def\nonfillstart{%
7157 \aboveenvbreak
7158 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7159 \sepspaces % Make spaces be word-separators rather than space tokens.
7160 \let\par = \lisppar % don't ignore blank lines
7161 \obeylines % each line of input is a line of output
7162 \parskip = 0pt
7163 % Turn off paragraph indentation but redefine \indent to emulate
7164 % the normal \indent.
7165 \nonfillparindent=\parindent
7166 \parindent = 0pt
7167 \let\indent\nonfillindent
7168 %
7169 \emergencystretch = 0pt % don't try to avoid overfull boxes
7170 \ifx\nonarrowing\relax
7171 \advance \leftskip by \lispnarrowing
7172 \exdentamount=\lispnarrowing
7173 \else
7174 \let\nonarrowing = \relax
7175 \fi
7176 \let\exdent=\nofillexdent
7177 }
7178
7179 \begingroup
7180 \obeyspaces
7181 % We want to swallow spaces (but not other tokens) after the fake
7182 % @indent in our nonfill-environments, where spaces are normally
7183 % active and set to @tie, resulting in them not being ignored after
7184 % @indent.
7185 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7186 \gdef\nonfillindentcheck{%
7187 \ifx\temp %
7188 \expandafter\nonfillindentgobble%
7189 \else%
7190 \leavevmode\nonfillindentbox%
7191 \fi%
7192 }%
7193 \endgroup
7194 \def\nonfillindentgobble#1{\nonfillindent}
7195 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7196
7197 % If you want all examples etc. small: @set dispenvsize small.
7198 % If you want even small examples the full size: @set dispenvsize nosmall.
7199 % This affects the following displayed environments:
7200 % @example, @display, @format, @lisp, @verbatim
7201 %
7202 \def\smallword{small}
7203 \def\nosmallword{nosmall}
7204 \let\SETdispenvsize\relax
7205 \def\setnormaldispenv{%
7206 \ifx\SETdispenvsize\smallword
7207 % end paragraph for sake of leading, in case document has no blank
7208 % line. This is redundant with what happens in \aboveenvbreak, but
7209 % we need to do it before changing the fonts, and it's inconvenient
7210 % to change the fonts afterward.
7211 \ifnum \lastpenalty=10000 \else \endgraf \fi
7212 \smallexamplefonts \rm
7213 \fi
7214 }
7215 \def\setsmalldispenv{%
7216 \ifx\SETdispenvsize\nosmallword
7217 \else
7218 \ifnum \lastpenalty=10000 \else \endgraf \fi
7219 \smallexamplefonts \rm
7220 \fi
7221 }
7222
7223 % We often define two environments, @foo and @smallfoo.
7224 % Let's do it in one command. #1 is the env name, #2 the definition.
7225 \def\makedispenvdef#1#2{%
7226 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7227 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7228 \expandafter\let\csname E#1\endcsname \afterenvbreak
7229 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7230 }
7231
7232 % Define two environment synonyms (#1 and #2) for an environment.
7233 \def\maketwodispenvdef#1#2#3{%
7234 \makedispenvdef{#1}{#3}%
7235 \makedispenvdef{#2}{#3}%
7236 }
7237 %
7238 % @lisp: indented, narrowed, typewriter font;
7239 % @example: same as @lisp.
7240 %
7241 % @smallexample and @smalllisp: use smaller fonts.
7242 % Originally contributed by Pavel@xerox.
7243 %
7244 \maketwodispenvdef{lisp}{example}{%
7245 \nonfillstart
7246 \tt\setcodequotes
7247 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7248 \parsearg\gobble
7249 }
7250 % @display/@smalldisplay: same as @lisp except keep current font.
7251 %
7252 \makedispenvdef{display}{%
7253 \nonfillstart
7254 \gobble
7255 }
7256
7257 % @format/@smallformat: same as @display except don't narrow margins.
7258 %
7259 \makedispenvdef{format}{%
7260 \let\nonarrowing = t%
7261 \nonfillstart
7262 \gobble
7263 }
7264
7265 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7266 \envdef\flushleft{%
7267 \let\nonarrowing = t%
7268 \nonfillstart
7269 \gobble
7270 }
7271 \let\Eflushleft = \afterenvbreak
7272
7273 % @flushright.
7274 %
7275 \envdef\flushright{%
7276 \let\nonarrowing = t%
7277 \nonfillstart
7278 \advance\leftskip by 0pt plus 1fill\relax
7279 \gobble
7280 }
7281 \let\Eflushright = \afterenvbreak
7282
7283
7284 % @raggedright does more-or-less normal line breaking but no right
7285 % justification. From plain.tex.
7286 \envdef\raggedright{%
7287 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7288 }
7289 \let\Eraggedright\par
7290
7291
7292 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7293 % and narrows the margins. We keep \parskip nonzero in general, since
7294 % we're doing normal filling. So, when using \aboveenvbreak and
7295 % \afterenvbreak, temporarily make \parskip 0.
7296 %
7297 \makedispenvdef{quotation}{\quotationstart}
7298 %
7299 \def\quotationstart{%
7300 \indentedblockstart % same as \indentedblock, but increase right margin too.
7301 \ifx\nonarrowing\relax
7302 \advance\rightskip by \lispnarrowing
7303 \fi
7304 \parsearg\quotationlabel
7305 }
7306
7307 % We have retained a nonzero parskip for the environment, since we're
7308 % doing normal filling.
7309 %
7310 \def\Equotation{%
7311 \par
7312 \ifx\quotationauthor\thisisundefined\else
7313 % indent a bit.
7314 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7315 \fi
7316 {\parskip=0pt \afterenvbreak}%
7317 }
7318 \def\Esmallquotation{\Equotation}
7319
7320 % If we're given an argument, typeset it in bold with a colon after.
7321 \def\quotationlabel#1{%
7322 \def\temp{#1}%
7323 \ifx\temp\empty \else
7324 {\bf #1: }%
7325 \fi
7326 }
7327
7328 % @indentedblock is like @quotation, but indents only on the left and
7329 % has no optional argument.
7330 %
7331 \makedispenvdef{indentedblock}{\indentedblockstart}
7332 %
7333 \def\indentedblockstart{%
7334 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7335 \parindent=0pt
7336 %
7337 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7338 \ifx\nonarrowing\relax
7339 \advance\leftskip by \lispnarrowing
7340 \exdentamount = \lispnarrowing
7341 \else
7342 \let\nonarrowing = \relax
7343 \fi
7344 }
7345
7346 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7347 %
7348 \def\Eindentedblock{%
7349 \par
7350 {\parskip=0pt \afterenvbreak}%
7351 }
7352 \def\Esmallindentedblock{\Eindentedblock}
7353
7354
7355 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7356 % If we want to allow any <char> as delimiter,
7357 % we need the curly braces so that makeinfo sees the @verb command, eg:
7358 % `@verbx...x' would look like the '@verbx' command. [email protected]
7359 %
7360 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7361 %
7362 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7363 % active too. Otherwise, they get lost as the first character on a
7364 % verbatim line.
7365 \def\dospecials{%
7366 \do\ \do\\\do\{\do\}\do\$\do\&%
7367 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7368 \do\<\do\>\do\|\do\@\do+\do\"%
7369 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7370 % @set txicodequotebacktick will not have effect on @verb and
7371 % @verbatim, and ?` and !` ligatures won't get disabled.
7372 %\do\`\do\'%
7373 }
7374 %
7375 % [Knuth] p. 380
7376 \def\uncatcodespecials{%
7377 \def\do##1{\catcode`##1=\other}\dospecials}
7378 %
7379 % Setup for the @verb command.
7380 %
7381 % Eight spaces for a tab
7382 \begingroup
7383 \catcode`\^^I=\active
7384 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7385 \endgroup
7386 %
7387 \def\setupverb{%
7388 \tt
7389 \def\par{\leavevmode\endgraf}%
7390 \setcodequotes
7391 \tabeightspaces
7392 % Respect line breaks,
7393 % print special symbols as themselves, and
7394 % make each space count
7395 % must do in this order:
7396 \obeylines \uncatcodespecials \sepspaces
7397 }
7398
7399 % Setup for the @verbatim environment
7400 %
7401 % Real tab expansion.
7402 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7403 %
7404 % We typeset each line of the verbatim in an \hbox, so we can handle
7405 % tabs.
7406 \newbox\verbbox
7407 \def\starttabbox{\setbox\verbbox=\hbox\bgroup}
7408 %
7409 \begingroup
7410 \catcode`\^^I=\active
7411 \gdef\tabexpand{%
7412 \catcode`\^^I=\active
7413 \def^^I{\leavevmode\egroup
7414 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7415 \divide\dimen\verbbox by\tabw
7416 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7417 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7418 \wd\verbbox=\dimen\verbbox
7419 \leavevmode\box\verbbox \starttabbox
7420 }%
7421 }
7422 \endgroup
7423
7424 % start the verbatim environment.
7425 \def\setupverbatim{%
7426 \let\nonarrowing = t%
7427 \nonfillstart
7428 \tt % easiest (and conventionally used) font for verbatim
7429 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
7430 \tabexpand
7431 \setcodequotes
7432 % Respect line breaks,
7433 % print special symbols as themselves, and
7434 % make each space count.
7435 % Must do in this order:
7436 \obeylines \uncatcodespecials \sepspaces
7437 }
7438
7439 % Do the @verb magic: verbatim text is quoted by unique
7440 % delimiter characters. Before first delimiter expect a
7441 % right brace, after last delimiter expect closing brace:
7442 %
7443 % \def\doverb'{'<char>#1<char>'}'{#1}
7444 %
7445 % [Knuth] p. 382; only eat outer {}
7446 \begingroup
7447 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7448 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7449 \endgroup
7450 %
7451 \def\verb{\begingroup\setupverb\doverb}
7452 %
7453 %
7454 % Do the @verbatim magic: define the macro \doverbatim so that
7455 % the (first) argument ends when '@end verbatim' is reached, ie:
7456 %
7457 % \def\doverbatim#1@end verbatim{#1}
7458 %
7459 % For Texinfo it's a lot easier than for LaTeX,
7460 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7461 % we need not redefine '\', '{' and '}'.
7462 %
7463 % Inspired by LaTeX's verbatim command set [latex.ltx]
7464 %
7465 \begingroup
7466 \catcode`\ =\active
7467 \obeylines %
7468 % ignore everything up to the first ^^M, that's the newline at the end
7469 % of the @verbatim input line itself. Otherwise we get an extra blank
7470 % line in the output.
7471 \xdef\doverbatim#1^^M#2@end verbatim{%
7472 \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
7473 % We really want {...\end verbatim} in the body of the macro, but
7474 % without the active space; thus we have to use \xdef and \gobble.
7475 % The \egroup ends the \verbbox started at the end of the last line in
7476 % the block.
7477 \endgroup
7478 %
7479 \envdef\verbatim{%
7480 \setnormaldispenv\setupverbatim\doverbatim
7481 }
7482 \let\Everbatim = \afterenvbreak
7483
7484
7485 % @verbatiminclude FILE - insert text of file in verbatim environment.
7486 %
7487 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7488 %
7489 \def\doverbatiminclude#1{%
7490 {%
7491 \makevalueexpandable
7492 \setupverbatim
7493 {%
7494 \indexnofonts % Allow `@@' and other weird things in file names.
7495 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7496 \edef\tmp{\noexpand\input #1 }
7497 \expandafter
7498 }\expandafter\starttabbox\tmp\egroup
7499 \afterenvbreak
7500 }%
7501 }
7502
7503 % @copying ... @end copying.
7504 % Save the text away for @insertcopying later.
7505 %
7506 % We save the uninterpreted tokens, rather than creating a box.
7507 % Saving the text in a box would be much easier, but then all the
7508 % typesetting commands (@smallbook, font changes, etc.) have to be done
7509 % beforehand -- and a) we want @copying to be done first in the source
7510 % file; b) letting users define the frontmatter in as flexible order as
7511 % possible is desirable.
7512 %
7513 \def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying}
7514 {\catcode`\ =\other
7515 \gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7516 }
7517
7518 \def\insertcopying{%
7519 \begingroup
7520 \parindent = 0pt % paragraph indentation looks wrong on title page
7521 \scanexp\copyingtext
7522 \endgroup
7523 }
7524
7525
7526 \message{defuns,}
7527 % @defun etc.
7528
7529 \newskip\defbodyindent \defbodyindent=.4in
7530 \newskip\defargsindent \defargsindent=50pt
7531 \newskip\deflastargmargin \deflastargmargin=18pt
7532 \newcount\defunpenalty
7533
7534 % Start the processing of @deffn:
7535 \def\startdefun{%
7536 \ifnum\lastpenalty<10000
7537 \medbreak
7538 \defunpenalty=10003 % Will keep this @deffn together with the
7539 % following @def command, see below.
7540 \else
7541 % If there are two @def commands in a row, we'll have a \nobreak,
7542 % which is there to keep the function description together with its
7543 % header. But if there's nothing but headers, we need to allow a
7544 % break somewhere. Check specifically for penalty 10002, inserted
7545 % by \printdefunline, instead of 10000, since the sectioning
7546 % commands also insert a nobreak penalty, and we don't want to allow
7547 % a break between a section heading and a defun.
7548 %
7549 % As a further refinement, we avoid "club" headers by signalling
7550 % with penalty of 10003 after the very first @deffn in the
7551 % sequence (see above), and penalty of 10002 after any following
7552 % @def command.
7553 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7554 %
7555 % Similarly, after a section heading, do not allow a break.
7556 % But do insert the glue.
7557 \medskip % preceded by discardable penalty, so not a breakpoint
7558 \fi
7559 %
7560 \parindent=0in
7561 \advance\leftskip by \defbodyindent
7562 \exdentamount=\defbodyindent
7563 }
7564
7565 \newtoks\defidx
7566 \newtoks\deftext
7567
7568 \def\useindex#1{\defidx={#1}\ignorespaces}
7569
7570 % Called as \printdefunline \deffooheader{text}
7571 %
7572 \def\printdefunline#1#2{%
7573 \begingroup
7574 \plainfrenchspacing
7575 % call \deffooheader:
7576 #1#2 \endheader
7577 % create the index entry
7578 \defcharsdefault
7579 \edef\temp{\noexpand\doind{\the\defidx}{\the\deftext}}%
7580 \temp
7581 % common ending:
7582 \interlinepenalty = 10000
7583 \advance\rightskip by 0pt plus 1fil\relax
7584 \endgraf
7585 \nobreak\vskip -\parskip
7586 \penalty\defunpenalty % signal to \startdefun and \deffoox
7587 % Some of the @defun-type tags do not enable magic parentheses,
7588 % rendering the following check redundant. But we don't optimize.
7589 \checkparencounts
7590 \endgroup
7591 }
7592
7593 \def\Edefun{\endgraf\medbreak}
7594
7595 % \makedefun{deffoo} (\deffooheader parameters) { (\deffooheader expansion) }
7596 %
7597 % Define \deffoo, \deffoox \Edeffoo and \deffooheader.
7598 \def\makedefun#1{%
7599 \expandafter\let\csname E#1\endcsname = \Edefun
7600 \edef\temp{\noexpand\domakedefun
7601 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7602 \temp
7603 }
7604 \def\domakedefun#1#2#3{%
7605 \envdef#1{%
7606 \startdefun
7607 \doingtypefnfalse % distinguish typed functions from all else
7608 \parseargusing\activeparens{\printdefunline#3}%
7609 }%
7610 \def#2{%
7611 % First, check whether we are in the right environment:
7612 \checkenv#1%
7613 %
7614 % As in \startdefun, allow line break if we have multiple x headers
7615 % in a row. It's not a great place, though.
7616 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7617 %
7618 \doingtypefnfalse % distinguish typed functions from all else
7619 \parseargusing\activeparens{\printdefunline#3}%
7620 }%
7621 \def#3% definition of \deffooheader follows
7622 }
7623
7624 \newif\ifdoingtypefn % doing typed function?
7625 \newif\ifrettypeownline % typeset return type on its own line?
7626
7627 % @deftypefnnewline on|off says whether the return type of typed functions
7628 % are printed on their own line. This affects @deftypefn, @deftypefun,
7629 % @deftypeop, and @deftypemethod.
7630 %
7631 \parseargdef\deftypefnnewline{%
7632 \def\temp{#1}%
7633 \ifx\temp\onword
7634 \expandafter\let\csname SETtxideftypefnnl\endcsname
7635 = \empty
7636 \else\ifx\temp\offword
7637 \expandafter\let\csname SETtxideftypefnnl\endcsname
7638 = \relax
7639 \else
7640 \errhelp = \EMsimple
7641 \errmessage{Unknown @txideftypefnnl value `\temp',
7642 must be on|off}%
7643 \fi\fi
7644 }
7645
7646 \def\defind#1#2{
7647 \defidx={#1}%
7648 \deftext={#2}%
7649 }
7650
7651 % Untyped functions:
7652
7653 % @deffn category name args
7654 \makedefun{deffn}#1 #2 #3\endheader{%
7655 \defind{fn}{\code{#2}}%
7656 \defname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
7657 }
7658
7659 % @defop category class name args
7660 \makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
7661 \def\defopheaderx#1#2 #3 #4\endheader{%
7662 \defind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
7663 \defname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
7664 }
7665
7666 % Typed functions:
7667
7668 % @deftypefn category type name args
7669 \makedefun{deftypefn}#1 #2 #3 #4\endheader{%
7670 \defind{fn}{\code{#3}}%
7671 \doingtypefntrue
7672 \defname{#1}{#2}{#3}\defunargs{#4\unskip}%
7673 }
7674
7675 % @deftypeop category class type name args
7676 \makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
7677 \def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
7678 \defind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
7679 \doingtypefntrue
7680 \defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
7681 }
7682
7683 % Typed variables:
7684
7685 % @deftypevr category type var args
7686 \makedefun{deftypevr}#1 #2 #3 #4\endheader{%
7687 \defind{vr}{\code{#3}}%
7688 \defname{#1}{#2}{#3}\defunargs{#4\unskip}%
7689 }
7690
7691 % @deftypecv category class type var args
7692 \makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
7693 \def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
7694 \defind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
7695 \defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
7696 }
7697
7698 % Untyped variables:
7699
7700 % @defvr category var args
7701 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7702
7703 % @defcv category class var args
7704 \makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}}
7705 \def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} }
7706
7707 % Types:
7708
7709 % @deftp category name args
7710 \makedefun{deftp}#1 #2 #3\endheader{%
7711 \defind{tp}{\code{#2}}%
7712 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7713 }
7714
7715 % Remaining @defun-like shortcuts:
7716 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7717 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7718 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7719 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7720 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7721 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7722 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7723 \makedefun{defmethod}{\defopheaderx\putwordMethodon}
7724 \makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon}
7725 \makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof}
7726 \makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof}
7727
7728 % \defname, which formats the name of the @def (not the args).
7729 % #1 is the category, such as "Function".
7730 % #2 is the return type, if any.
7731 % #3 is the function name.
7732 %
7733 % We are followed by (but not passed) the arguments, if any.
7734 %
7735 \def\defname#1#2#3{%
7736 \par
7737 % Get the values of \leftskip and \rightskip as they were outside the @def...
7738 \advance\leftskip by -\defbodyindent
7739 %
7740 % Determine if we are typesetting the return type of a typed function
7741 % on a line by itself.
7742 \rettypeownlinefalse
7743 \ifdoingtypefn % doing a typed function specifically?
7744 % then check user option for putting return type on its own line:
7745 \ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}%
7746 \fi
7747 %
7748 % How we'll format the category name. Putting it in brackets helps
7749 % distinguish it from the body text that may end up on the next line
7750 % just below it.
7751 \def\temp{#1}%
7752 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7753 %
7754 % Figure out line sizes for the paragraph shape. We'll always have at
7755 % least two.
7756 \tempnum = 2
7757 %
7758 % The first line needs space for \box0; but if \rightskip is nonzero,
7759 % we need only space for the part of \box0 which exceeds it:
7760 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7761 %
7762 % If doing a return type on its own line, we'll have another line.
7763 \ifrettypeownline
7764 \advance\tempnum by 1
7765 \def\maybeshapeline{0in \hsize}%
7766 \else
7767 \def\maybeshapeline{}%
7768 \fi
7769 %
7770 % The continuations:
7771 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7772 %
7773 % The final paragraph shape:
7774 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7775 %
7776 % Put the category name at the right margin.
7777 \noindent
7778 \hbox to 0pt{%
7779 \hfil\box0 \kern-\hsize
7780 % \hsize has to be shortened this way:
7781 \kern\leftskip
7782 % Intentionally do not respect \rightskip, since we need the space.
7783 }%
7784 %
7785 % Allow all lines to be underfull without complaint:
7786 \tolerance=10000 \hbadness=10000
7787 \exdentamount=\defbodyindent
7788 {%
7789 % defun fonts. We use typewriter by default (used to be bold) because:
7790 % . we're printing identifiers, they should be in tt in principle.
7791 % . in languages with many accents, such as Czech or French, it's
7792 % common to leave accents off identifiers. The result looks ok in
7793 % tt, but exceedingly strange in rm.
7794 % . we don't want -- and --- to be treated as ligatures.
7795 % . this still does not fix the ?` and !` ligatures, but so far no
7796 % one has made identifiers using them :).
7797 \df \tt
7798 \def\temp{#2}% text of the return type
7799 \ifx\temp\empty\else
7800 \tclose{\temp}% typeset the return type
7801 \ifrettypeownline
7802 % put return type on its own line; prohibit line break following:
7803 \hfil\vadjust{\nobreak}\break
7804 \else
7805 \space % type on same line, so just followed by a space
7806 \fi
7807 \fi % no return type
7808 #3% output function name
7809 }%
7810 \ifflagclear{txidefnamenospace}{%
7811 {\rm\enskip}% hskip 0.5 em of \rmfont
7812 }{}%
7813 %
7814 \boldbrax
7815 % arguments will be output next, if any.
7816 }
7817
7818 % Print arguments. Use slanted for @def*, typewriter for @deftype*.
7819 \def\defunargs#1{%
7820 \bgroup
7821 \df \ifdoingtypefn \tt \else \sl \fi
7822 \ifflagclear{txicodevaristt}{}%
7823 {\def\var##1{{\setregularquotes \ttsl ##1}}}%
7824 #1%
7825 \egroup
7826 }
7827
7828 % We want ()&[] to print specially on the defun line.
7829 %
7830 \def\activeparens{%
7831 \catcode`\(=\active \catcode`\)=\active
7832 \catcode`\[=\active \catcode`\]=\active
7833 \catcode`\&=\active
7834 }
7835
7836 % Make control sequences which act like normal parenthesis chars.
7837 \let\lparen = ( \let\rparen = )
7838
7839 % Be sure that we always have a definition for `(', etc. For example,
7840 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7841 % so TeX would otherwise complain about undefined control sequence.
7842 {
7843 \activeparens
7844 \gdef\defcharsdefault{%
7845 \let(=\lparen \let)=\rparen
7846 \let[=\lbrack \let]=\rbrack
7847 \let& = \&%
7848 }
7849 \globaldefs=1 \defcharsdefault
7850
7851 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7852 \gdef\magicamp{\let&=\amprm}
7853 }
7854 \let\ampchar\&
7855
7856 \newcount\parencount
7857
7858 % If we encounter &foo, then turn on ()-hacking afterwards
7859 \newif\ifampseen
7860 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
7861
7862 \def\parenfont{%
7863 \ifampseen
7864 % At the first level, print parens in roman,
7865 % otherwise use the default font.
7866 \ifnum \parencount=1 \rm \fi
7867 \else
7868 % The \sf parens (in \boldbrax) actually are a little bolder than
7869 % the contained text. This is especially needed for [ and ] .
7870 \sf
7871 \fi
7872 }
7873 \def\infirstlevel#1{%
7874 \ifampseen
7875 \ifnum\parencount=1
7876 #1%
7877 \fi
7878 \fi
7879 }
7880 \def\bfafterword#1 {#1 \bf}
7881
7882 \def\opnr{%
7883 \global\advance\parencount by 1
7884 {\parenfont(}%
7885 \infirstlevel \bfafterword
7886 }
7887 \def\clnr{%
7888 {\parenfont)}%
7889 \infirstlevel \sl
7890 \global\advance\parencount by -1
7891 }
7892
7893 \newcount\brackcount
7894 \def\lbrb{%
7895 \global\advance\brackcount by 1
7896 {\bf[}%
7897 }
7898 \def\rbrb{%
7899 {\bf]}%
7900 \global\advance\brackcount by -1
7901 }
7902
7903 \def\checkparencounts{%
7904 \ifnum\parencount=0 \else \badparencount \fi
7905 \ifnum\brackcount=0 \else \badbrackcount \fi
7906 }
7907 % these should not use \errmessage; the glibc manual, at least, actually
7908 % has such constructs (when documenting function pointers).
7909 \def\badparencount{%
7910 \message{Warning: unbalanced parentheses in @def...}%
7911 \global\parencount=0
7912 }
7913 \def\badbrackcount{%
7914 \message{Warning: unbalanced square brackets in @def...}%
7915 \global\brackcount=0
7916 }
7917
7918
7919 \message{macros,}
7920 % @macro.
7921
7922 % To do this right we need a feature of e-TeX, \scantokens,
7923 % which we arrange to emulate with a temporary file in ordinary TeX.
7924 \ifx\eTeXversion\thisisundefined
7925 \newwrite\macscribble
7926 \def\scantokens#1{%
7927 \toks0={#1}%
7928 \immediate\openout\macscribble=\jobname.tmp
7929 \immediate\write\macscribble{\the\toks0}%
7930 \immediate\closeout\macscribble
7931 \input \jobname.tmp
7932 }
7933 \fi
7934
7935 \let\E=\expandafter
7936
7937 % Used at the time of macro expansion.
7938 % Argument is macro body with arguments substituted
7939 \def\scanmacro#1{%
7940 \newlinechar`\^^M
7941 % expand the expansion of \eatleadingcr twice to maybe remove a leading
7942 % newline (and \else and \fi tokens), then call \eatspaces on the result.
7943 \def\xeatspaces##1{%
7944 \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
7945 }}%
7946 \def\xempty##1{}%
7947 %
7948 % Process the macro body under the current catcode regime.
7949 \scantokens{#1@comment}%
7950 %
7951 % The \comment is to remove the \newlinechar added by \scantokens, and
7952 % can be noticed by \parsearg. Note \c isn't used because this means cedilla
7953 % in math mode.
7954 }
7955
7956 % Used for copying and captions
7957 \def\scanexp#1{%
7958 \expandafter\scanmacro\expandafter{#1}%
7959 }
7960
7961 \newcount\paramno % Count of parameters
7962 \newtoks\macname % Macro name
7963 \newif\ifrecursive % Is it recursive?
7964
7965 % List of all defined macros in the form
7966 % \commondummyword\macro1\commondummyword\macro2...
7967 % Currently is also contains all @aliases; the list can be split
7968 % if there is a need.
7969 \def\macrolist{}
7970
7971 % Add the macro to \macrolist
7972 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7973 \def\addtomacrolistxxx#1{%
7974 \toks0 = \expandafter{\macrolist\commondummyword#1}%
7975 \xdef\macrolist{\the\toks0}%
7976 }
7977
7978 % Utility routines.
7979 % This does \let #1 = #2, with \csnames; that is,
7980 % \let \csname#1\endcsname = \csname#2\endcsname
7981 % (except of course we have to play expansion games).
7982 %
7983 \def\cslet#1#2{%
7984 \expandafter\let
7985 \csname#1\expandafter\endcsname
7986 \csname#2\endcsname
7987 }
7988
7989 % Trim leading and trailing spaces off a string.
7990 % Concepts from aro-bend problem 15 (see CTAN).
7991 {\catcode`\@=11
7992 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7993 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7994 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7995 \def\unbrace#1{#1}
7996 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
7997 }
7998
7999 {\catcode`\^^M=\other%
8000 \gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
8001 % Warning: this won't work for a delimited argument
8002 % or for an empty argument
8003
8004 % Trim a single trailing ^^M off a string.
8005 {\catcode`\^^M=\other \catcode`\Q=3%
8006 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8007 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8008 \gdef\eatcrb#1Q#2Q{#1}%
8009 }
8010
8011 % Macro bodies are absorbed as an argument in a context where
8012 % all characters are catcode 10, 11 or 12, except \ which is active
8013 % (as in normal texinfo). It is necessary to change the definition of \
8014 % to recognize macro arguments; this is the job of \mbodybackslash.
8015 %
8016 % Non-ASCII encodings make 8-bit characters active, so un-activate
8017 % them to avoid their expansion. Must do this non-globally, to
8018 % confine the change to the current group.
8019 %
8020 % It's necessary to have hard CRs when the macro is executed. This is
8021 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8022 % body, and then making it the \newlinechar in \scanmacro.
8023 %
8024 \def\scanctxt{% used as subroutine
8025 \catcode`\"=\other
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`\^^M=\other
8035 \catcode`\\=\active
8036 \passthroughcharstrue
8037 }
8038
8039 \def\macrobodyctxt{% used for @macro definitions and @copying
8040 \scanctxt
8041 \catcode`\ =\other
8042 \catcode`\{=\other
8043 \catcode`\}=\other
8044 }
8045
8046 % Used when scanning braced macro arguments. Note, however, that catcode
8047 % changes here are ineffectual if the macro invocation was nested inside
8048 % an argument to another Texinfo command.
8049 \def\macroargctxt{%
8050 \scanctxt
8051 \catcode`\ =\active
8052 }
8053
8054 \def\macrolineargctxt{% used for whole-line arguments without braces
8055 \scanctxt
8056 \catcode`\{=\other
8057 \catcode`\}=\other
8058 }
8059
8060 % \mbodybackslash is the definition of \ in @macro bodies.
8061 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8062 % where N is the macro parameter number.
8063 % We define \csname macarg.\endcsname to be \realbackslash, so
8064 % \\ in macro replacement text gets you a backslash.
8065 %
8066 {\catcode`@=0 @catcode`@\=@active
8067 @gdef@usembodybackslash{@let\=@mbodybackslash}
8068 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8069 }
8070 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8071
8072 \def\margbackslash#1{\char`\#1 }
8073
8074 \def\macro{\recursivefalse\parsearg\macroxxx}
8075 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8076
8077 \def\macroxxx#1{%
8078 \getargs{#1}% now \macname is the macname and \argl the arglist
8079 \ifx\argl\empty % no arguments
8080 \paramno=0\relax
8081 \else
8082 \expandafter\parsemargdef \argl;%
8083 \if\paramno>256\relax
8084 \ifx\eTeXversion\thisisundefined
8085 \errhelp = \EMsimple
8086 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8087 \fi
8088 \fi
8089 \fi
8090 \if1\csname ismacro.\the\macname\endcsname
8091 \message{Warning: redefining \the\macname}%
8092 \else
8093 \expandafter\ifx\csname \the\macname\endcsname \relax
8094 \else \errmessage{Macro name \the\macname\space already defined}\fi
8095 \global\cslet{macsave.\the\macname}{\the\macname}%
8096 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8097 \addtomacrolist{\the\macname}%
8098 \fi
8099 \begingroup \macrobodyctxt \usembodybackslash
8100 \ifrecursive \expandafter\parsermacbody
8101 \else \expandafter\parsemacbody
8102 \fi}
8103
8104 \parseargdef\unmacro{%
8105 \if1\csname ismacro.#1\endcsname
8106 \global\cslet{#1}{macsave.#1}%
8107 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8108 % Remove the macro name from \macrolist:
8109 \begingroup
8110 \expandafter\let\csname#1\endcsname \relax
8111 \let\commondummyword\unmacrodo
8112 \xdef\macrolist{\macrolist}%
8113 \endgroup
8114 \else
8115 \errmessage{Macro #1 not defined}%
8116 \fi
8117 }
8118
8119 % Called by \do from \dounmacro on each macro. The idea is to omit any
8120 % macro definitions that have been changed to \relax.
8121 %
8122 \def\unmacrodo#1{%
8123 \ifx #1\relax
8124 % remove this
8125 \else
8126 \noexpand\commondummyword \noexpand#1%
8127 \fi
8128 }
8129
8130 % \getargs -- Parse the arguments to a @macro line. Set \macname to
8131 % the name of the macro, and \argl to the braced argument list.
8132 \def\getargs#1{\getargsxxx#1{}}
8133 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8134 \def\getmacname#1 #2\relax{\macname={#1}}
8135 \def\getmacargs#1{\def\argl{#1}}
8136 % This made use of the feature that if the last token of a
8137 % <parameter list> is #, then the preceding argument is delimited by
8138 % an opening brace, and that opening brace is not consumed.
8139
8140 % Parse the optional {params} list to @macro or @rmacro.
8141 % Set \paramno to the number of arguments,
8142 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8143 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
8144 % list to some hook where the argument is to be expanded. If there are
8145 % less than 10 arguments that hook is to be replaced by ##N where N
8146 % is the position in that list, that is to say the macro arguments are to be
8147 % defined `a la TeX in the macro body.
8148 %
8149 % That gets used by \mbodybackslash (above).
8150 %
8151 % If there are 10 or more arguments, a different technique is used: see
8152 % \parsemmanyargdef.
8153 %
8154 \def\parsemargdef#1;{%
8155 \paramno=0\def\paramlist{}%
8156 \let\hash\relax
8157 % \hash is redefined to `#' later to get it into definitions
8158 \let\xeatspaces\relax
8159 \let\xempty\relax
8160 \parsemargdefxxx#1,;,%
8161 \ifnum\paramno<10\relax\else
8162 \paramno0\relax
8163 \parsemmanyargdef@@#1,;,% 10 or more arguments
8164 \fi
8165 }
8166 \def\parsemargdefxxx#1,{%
8167 \if#1;\let\next=\relax
8168 \else \let\next=\parsemargdefxxx
8169 \advance\paramno by 1
8170 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8171 {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
8172 \edef\paramlist{\paramlist\hash\the\paramno,}%
8173 \fi\next}
8174 % the \xempty{} is to give \eatleadingcr an argument in the case of an
8175 % empty macro argument.
8176
8177 % \parsemacbody, \parsermacbody
8178 %
8179 % Read recursive and nonrecursive macro bodies. (They're different since
8180 % rec and nonrec macros end differently.)
8181 %
8182 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
8183 % body to be transformed.
8184 % Set \macrobody to the body of the macro, and call \defmacro.
8185 %
8186 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8187 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8188 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8189 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8190
8191 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8192 \edef\texiatcatcode{\the\catcode`\@}
8193 \catcode `@=11\relax
8194
8195 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8196
8197 % If there are 10 or more arguments, a different technique is used, where the
8198 % hook remains in the body, and when macro is to be expanded the body is
8199 % processed again to replace the arguments.
8200 %
8201 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8202 % argument N value and then \edef the body (nothing else will expand because of
8203 % the catcode regime under which the body was input).
8204 %
8205 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8206 % arguments, no macro can have more than 256 arguments (else error).
8207 %
8208 % In case that there are 10 or more arguments we parse again the arguments
8209 % list to set new definitions for the \macarg.BLAH macros corresponding to
8210 % each BLAH argument. It was anyhow needed to parse already once this list
8211 % in order to count the arguments, and as macros with at most 9 arguments
8212 % are by far more frequent than macro with 10 or more arguments, defining
8213 % twice the \macarg.BLAH macros does not cost too much processing power.
8214 \def\parsemmanyargdef@@#1,{%
8215 \if#1;\let\next=\relax
8216 \else
8217 \let\next=\parsemmanyargdef@@
8218 \edef\tempb{\eatspaces{#1}}%
8219 \expandafter\def\expandafter\tempa
8220 \expandafter{\csname macarg.\tempb\endcsname}%
8221 % Note that we need some extra \noexpand\noexpand, this is because we
8222 % don't want \the to be expanded in the \parsermacbody as it uses an
8223 % \xdef .
8224 \expandafter\edef\tempa
8225 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8226 \advance\paramno by 1\relax
8227 \fi\next}
8228
8229
8230 \let\endargs@\relax
8231 \let\nil@\relax
8232 \def\nilm@{\nil@}%
8233 \long\def\nillm@{\nil@}%
8234
8235 % This macro is expanded during the Texinfo macro expansion, not during its
8236 % definition. It gets all the arguments' values and assigns them to macros
8237 % macarg.ARGNAME
8238 %
8239 % #1 is the macro name
8240 % #2 is the list of argument names
8241 % #3 is the list of argument values
8242 \def\getargvals@#1#2#3{%
8243 \def\macargdeflist@{}%
8244 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8245 \def\paramlist{#2,\nil@}%
8246 \def\macroname{#1}%
8247 \begingroup
8248 \macroargctxt
8249 \def\argvaluelist{#3,\nil@}%
8250 \def\@tempa{#3}%
8251 \ifx\@tempa\empty
8252 \setemptyargvalues@
8253 \else
8254 \getargvals@@
8255 \fi
8256 }
8257 \def\getargvals@@{%
8258 \ifx\paramlist\nilm@
8259 % Some sanity check needed here that \argvaluelist is also empty.
8260 \ifx\argvaluelist\nillm@
8261 \else
8262 \errhelp = \EMsimple
8263 \errmessage{Too many arguments in macro `\macroname'!}%
8264 \fi
8265 \let\next\macargexpandinbody@
8266 \else
8267 \ifx\argvaluelist\nillm@
8268 % No more arguments values passed to macro. Set remaining named-arg
8269 % macros to empty.
8270 \let\next\setemptyargvalues@
8271 \else
8272 % pop current arg name into \@tempb
8273 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8274 \expandafter\@tempa\expandafter{\paramlist}%
8275 % pop current argument value into \@tempc
8276 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8277 \expandafter\@tempa\expandafter{\argvaluelist}%
8278 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8279 % First place the new argument macro definition into \@tempd
8280 \expandafter\macname\expandafter{\@tempc}%
8281 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8282 \expandafter\def\expandafter\@tempe\expandafter{%
8283 \csname macarg.\@tempb\endcsname}%
8284 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8285 \push@\@tempd\macargdeflist@
8286 \let\next\getargvals@@
8287 \fi
8288 \fi
8289 \next
8290 }
8291
8292 \def\push@#1#2{%
8293 \expandafter\expandafter\expandafter\def
8294 \expandafter\expandafter\expandafter#2%
8295 \expandafter\expandafter\expandafter{%
8296 \expandafter#1#2}%
8297 }
8298
8299 % Replace arguments by their values in the macro body, and place the result
8300 % in macro \@tempa.
8301 %
8302 \def\macvalstoargs@{%
8303 % To do this we use the property that token registers that are \the'ed
8304 % within an \edef expand only once. So we are going to place all argument
8305 % values into respective token registers.
8306 %
8307 % First we save the token context, and initialize argument numbering.
8308 \begingroup
8309 \paramno0\relax
8310 % Then, for each argument number #N, we place the corresponding argument
8311 % value into a new token list register \toks#N
8312 \expandafter\putargsintokens@\saveparamlist@,;,%
8313 % Then, we expand the body so that argument are replaced by their
8314 % values. The trick for values not to be expanded themselves is that they
8315 % are within tokens and that tokens expand only once in an \edef .
8316 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8317 % Now we restore the token stack pointer to free the token list registers
8318 % which we have used, but we make sure that expanded body is saved after
8319 % group.
8320 \expandafter
8321 \endgroup
8322 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8323 }
8324
8325 % Define the named-macro outside of this group and then close this group.
8326 %
8327 \def\macargexpandinbody@{%
8328 \expandafter
8329 \endgroup
8330 \macargdeflist@
8331 % First the replace in body the macro arguments by their values, the result
8332 % is in \@tempa .
8333 \macvalstoargs@
8334 % Then we point at the \norecurse or \gobble (for recursive) macro value
8335 % with \@tempb .
8336 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8337 % Depending on whether it is recursive or not, we need some tailing
8338 % \egroup .
8339 \ifx\@tempb\gobble
8340 \let\@tempc\relax
8341 \else
8342 \let\@tempc\egroup
8343 \fi
8344 % And now we do the real job:
8345 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8346 \@tempd
8347 }
8348
8349 \def\putargsintokens@#1,{%
8350 \if#1;\let\next\relax
8351 \else
8352 \let\next\putargsintokens@
8353 % First we allocate the new token list register, and give it a temporary
8354 % alias \@tempb .
8355 \toksdef\@tempb\the\paramno
8356 % Then we place the argument value into that token list register.
8357 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8358 \expandafter\@tempb\expandafter{\@tempa}%
8359 \advance\paramno by 1\relax
8360 \fi
8361 \next
8362 }
8363
8364 % Trailing missing arguments are set to empty.
8365 %
8366 \def\setemptyargvalues@{%
8367 \ifx\paramlist\nilm@
8368 \let\next\macargexpandinbody@
8369 \else
8370 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8371 \let\next\setemptyargvalues@
8372 \fi
8373 \next
8374 }
8375
8376 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8377 \expandafter\def\expandafter\@tempa\expandafter{%
8378 \expandafter\def\csname macarg.#1\endcsname{}}%
8379 \push@\@tempa\macargdeflist@
8380 \def\paramlist{#2}%
8381 }
8382
8383 % #1 is the element target macro
8384 % #2 is the list macro
8385 % #3,#4\endargs@ is the list value
8386 \def\pop@#1#2#3,#4\endargs@{%
8387 \def#1{#3}%
8388 \def#2{#4}%
8389 }
8390 \long\def\longpop@#1#2#3,#4\endargs@{%
8391 \long\def#1{#3}%
8392 \long\def#2{#4}%
8393 }
8394
8395
8396 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8397
8398
8399 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8400 % \macrobody has the body of the macro in it, with placeholders for
8401 % its parameters, looking like "\xeatspaces{\hash 1}".
8402 % \paramno is the number of parameters
8403 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8404 % There are four cases: macros of zero, one, up to nine, and many arguments.
8405 % \xdef is used so that macro definitions will survive the file
8406 % they're defined in: @include reads the file inside a group.
8407 %
8408 \def\defmacro{%
8409 \let\hash=##% convert placeholders to macro parameter chars
8410 \ifnum\paramno=1
8411 \def\xeatspaces##1{##1}%
8412 % This removes the pair of braces around the argument. We don't
8413 % use \eatspaces, because this can cause ends of lines to be lost
8414 % when the argument to \eatspaces is read, leading to line-based
8415 % commands like "@itemize" not being read correctly.
8416 \else
8417 \let\xeatspaces\relax % suppress expansion
8418 \fi
8419 \ifcase\paramno
8420 % 0
8421 \expandafter\xdef\csname\the\macname\endcsname{%
8422 \begingroup
8423 \noexpand\spaceisspace
8424 \noexpand\endlineisspace
8425 \noexpand\expandafter % skip any whitespace after the macro name.
8426 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8427 \expandafter\xdef\csname\the\macname @@@\endcsname{%
8428 \endgroup
8429 \noexpand\scanmacro{\macrobody}}%
8430 \or % 1
8431 \expandafter\xdef\csname\the\macname\endcsname{%
8432 \begingroup
8433 \noexpand\braceorline
8434 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8435 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8436 \endgroup
8437 \noexpand\scanmacro{\macrobody}%
8438 }%
8439 \else % at most 9
8440 \ifnum\paramno<10\relax
8441 % @MACNAME sets the context for reading the macro argument
8442 % @MACNAME@@ gets the argument, processes backslashes and appends a
8443 % comma.
8444 % @MACNAME@@@ removes braces surrounding the argument list.
8445 % @MACNAME@@@@ scans the macro body with arguments substituted.
8446 \expandafter\xdef\csname\the\macname\endcsname{%
8447 \begingroup
8448 \noexpand\expandafter % This \expandafter skip any spaces after the
8449 \noexpand\macroargctxt % macro before we change the catcode of space.
8450 \noexpand\expandafter
8451 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8452 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8453 \noexpand\passargtomacro
8454 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8455 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8456 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8457 \expandafter\expandafter
8458 \expandafter\xdef
8459 \expandafter\expandafter
8460 \csname\the\macname @@@@\endcsname\paramlist{%
8461 \endgroup\noexpand\scanmacro{\macrobody}}%
8462 \else % 10 or more:
8463 \expandafter\xdef\csname\the\macname\endcsname{%
8464 \noexpand\getargvals@{\the\macname}{\argl}%
8465 }%
8466 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8467 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8468 \fi
8469 \fi}
8470
8471 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8472
8473 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8474
8475
8476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8477 %
8478 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8479 @catcode`@_=11 % private names
8480 @catcode`@!=11 % used as argument separator
8481
8482 % \passargtomacro#1#2 -
8483 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8484 % compressed to one.
8485 %
8486 % This implementation works by expansion, and not execution (so we cannot use
8487 % \def or similar). This reduces the risk of this failing in contexts where
8488 % complete expansion is done with no execution (for example, in writing out to
8489 % an auxiliary file for an index entry).
8490 %
8491 % State is kept in the input stream: the argument passed to
8492 % @look_ahead, @gobble_and_check_finish and @add_segment is
8493 %
8494 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8495 %
8496 % where:
8497 % THE_MACRO - name of the macro we want to call
8498 % ARG_RESULT - argument list we build to pass to that macro
8499 % PENDING_BS - either a backslash or nothing
8500 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8501
8502 @gdef@passargtomacro#1#2{%
8503 @add_segment #1!{}@relax#2\@_finish\%
8504 }
8505 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8506
8507 % #1 - THE_MACRO ARG_RESULT
8508 % #2 - PENDING_BS
8509 % #3 - NEXT_TOKEN
8510 % #4 used to look ahead
8511 %
8512 % If the next token is not a backslash, process the rest of the argument;
8513 % otherwise, remove the next token.
8514 @gdef@look_ahead#1!#2#3#4{%
8515 @ifx#4\%
8516 @expandafter@gobble_and_check_finish
8517 @else
8518 @expandafter@add_segment
8519 @fi#1!{#2}#4#4%
8520 }
8521
8522 % #1 - THE_MACRO ARG_RESULT
8523 % #2 - PENDING_BS
8524 % #3 - NEXT_TOKEN
8525 % #4 should be a backslash, which is gobbled.
8526 % #5 looks ahead
8527 %
8528 % Double backslash found. Add a single backslash, and look ahead.
8529 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8530 @add_segment#1\!{}#5#5%
8531 }
8532
8533 @gdef@is_fi{@fi}
8534
8535 % #1 - THE_MACRO ARG_RESULT
8536 % #2 - PENDING_BS
8537 % #3 - NEXT_TOKEN
8538 % #4 is input stream until next backslash
8539 %
8540 % Input stream is either at the start of the argument, or just after a
8541 % backslash sequence, either a lone backslash, or a doubled backslash.
8542 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8543 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8544 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8545 % a backslash just before the start of the input stream that has not been
8546 % added to ARG_RESULT.
8547 @gdef@add_segment#1!#2#3#4\{%
8548 @ifx#3@_finish
8549 @call_the_macro#1!%
8550 @else
8551 % append the pending backslash to the result, followed by the next segment
8552 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8553 % this @fi is discarded by @look_ahead.
8554 % we can't get rid of it with \expandafter because we don't know how
8555 % long #4 is.
8556 }
8557
8558 % #1 - THE_MACRO
8559 % #2 - ARG_RESULT
8560 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8561 % conditional.
8562 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8563
8564 }
8565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8566
8567 % \braceorline MAC is used for a one-argument macro MAC. It checks
8568 % whether the next non-whitespace character is a {. It sets the context
8569 % for reading the argument (slightly different in the two cases). Then,
8570 % to read the argument, in the whole-line case, it then calls the regular
8571 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8572 %
8573 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8574 \def\braceorlinexxx{%
8575 \ifx\nchar\bgroup
8576 \macroargctxt
8577 \expandafter\passargtomacro
8578 \else
8579 \macrolineargctxt\expandafter\parsearg
8580 \fi \macnamexxx}
8581
8582
8583 % @alias.
8584 % We need some trickery to remove the optional spaces around the equal
8585 % sign. Make them active and then expand them all to nothing.
8586 %
8587 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8588 \def\aliasxxx #1{\aliasyyy#1\relax}
8589 \def\aliasyyy #1=#2\relax{%
8590 {%
8591 \expandafter\let\obeyedspace=\empty
8592 \addtomacrolist{#1}%
8593 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8594 }%
8595 \next
8596 }
8597
8598
8599 \message{cross references,}
8600
8601 \newwrite\auxfile
8602 \newif\ifhavexrefs % True if xref values are known.
8603 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8604
8605 % @inforef is relatively simple.
8606 \def\inforef #1{\inforefzzz #1,,,,**}
8607 \def\inforefzzz #1,#2,#3,#4**{%
8608 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8609 node \samp{\ignorespaces#1{}}}
8610
8611 % @node's only job in TeX is to define \lastnode, which is used in
8612 % cross-references. The @node line might or might not have commas, and
8613 % might or might not have spaces before the first comma, like:
8614 % @node foo , bar , ...
8615 % We don't want such trailing spaces in the node name.
8616 %
8617 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8618 %
8619 % also remove a trailing comma, in case of something like this:
8620 % @node Help-Cross, , , Cross-refs
8621 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8622 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
8623
8624 % Used so that the @top node doesn't have to be wrapped in an @ifnottex
8625 % conditional.
8626 % \doignore goes to more effort to skip nested conditionals but we don't need
8627 % that here.
8628 \def\omittopnode{%
8629 \ifx\lastnode\wordTop
8630 \expandafter\ignorenode\fi
8631 }
8632 \def\wordTop{Top}
8633
8634 % Until the next @node, @part or @bye command, divert output to a box that
8635 % is not output.
8636 \def\ignorenode{\setbox\dummybox\vbox\bgroup
8637 \def\part{\egroup\part}%
8638 \def\node{\egroup\node}%
8639 \ignorenodebye
8640 }
8641
8642 {\let\bye\relax
8643 \gdef\ignorenodebye{\let\bye\ignorenodebyedef}
8644 \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
8645 % The redefinition of \bye here is because it is declared \outer
8646
8647 \let\lastnode=\empty
8648
8649 % Write a cross-reference definition for the current node. #1 is the
8650 % type (Ynumbered, Yappendix, Ynothing).
8651 %
8652 \def\donoderef#1{%
8653 \ifx\lastnode\empty\else
8654 \setref{\lastnode}{#1}%
8655 \global\let\lastnode=\empty
8656 \fi
8657 }
8658
8659 % @anchor{NAME} -- define xref target at arbitrary point.
8660 %
8661 \newcount\savesfregister
8662 %
8663 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8664 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8665 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8666
8667 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8668 % anchor), which consists of three parts:
8669 % 1) NAME-title - the current sectioning name taken from \currentsection,
8670 % or the anchor name.
8671 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8672 % empty for anchors.
8673 % 3) NAME-pg - the page number.
8674 %
8675 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8676 % floats, there is an additional part, which is not written here:
8677 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8678 %
8679 \def\setref#1#2{%
8680 \pdfmkdest{#1}%
8681 \iflinks
8682 {%
8683 \requireauxfile
8684 \atdummies % preserve commands, but don't expand them
8685 % match definition in \xrdef, \refx, \xrefX.
8686 \def\value##1{##1}%
8687 \edef\writexrdef##1##2{%
8688 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8689 ##1}{##2}}% these are parameters of \writexrdef
8690 }%
8691 \toks0 = \expandafter{\currentsection}%
8692 \immediate \writexrdef{title}{\the\toks0 }%
8693 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8694 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8695 }%
8696 \fi
8697 }
8698
8699 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8700 % automatically in xrefs, if the third arg is not explicitly specified.
8701 % This was provided as a "secret" @set xref-automatic-section-title
8702 % variable, now it's official.
8703 %
8704 \parseargdef\xrefautomaticsectiontitle{%
8705 \def\temp{#1}%
8706 \ifx\temp\onword
8707 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8708 = \empty
8709 \else\ifx\temp\offword
8710 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8711 = \relax
8712 \else
8713 \errhelp = \EMsimple
8714 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8715 must be on|off}%
8716 \fi\fi
8717 }
8718
8719 %
8720 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8721 % the node name, #2 the name of the Info cross-reference, #3 the printed
8722 % node name, #4 the name of the Info file, #5 the name of the printed
8723 % manual. All but the node name can be omitted.
8724 %
8725 \def\pxref{\putwordsee{} \xrefXX}
8726 \def\xref{\putwordSee{} \xrefXX}
8727 \def\ref{\xrefXX}
8728
8729 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8730 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8731 %
8732 \newbox\toprefbox
8733 \newbox\printedrefnamebox
8734 \newbox\infofilenamebox
8735 \newbox\printedmanualbox
8736 %
8737 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8738 \unsepspaces
8739 %
8740 % Get args without leading/trailing spaces.
8741 \def\printedrefname{\ignorespaces #3}%
8742 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8743 %
8744 \def\infofilename{\ignorespaces #4}%
8745 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8746 %
8747 \def\printedmanual{\ignorespaces #5}%
8748 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8749 %
8750 % If the printed reference name (arg #3) was not explicitly given in
8751 % the @xref, figure out what we want to use.
8752 \ifdim \wd\printedrefnamebox = 0pt
8753 % No printed node name was explicitly given.
8754 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8755 % Not auto section-title: use node name inside the square brackets.
8756 \def\printedrefname{\ignorespaces #1}%
8757 \else
8758 % Auto section-title: use chapter/section title inside
8759 % the square brackets if we have it.
8760 \ifdim \wd\printedmanualbox > 0pt
8761 % It is in another manual, so we don't have it; use node name.
8762 \def\printedrefname{\ignorespaces #1}%
8763 \else
8764 \ifhavexrefs
8765 % We (should) know the real title if we have the xref values.
8766 \def\printedrefname{\refx{#1-title}}%
8767 \else
8768 % Otherwise just copy the Info node name.
8769 \def\printedrefname{\ignorespaces #1}%
8770 \fi%
8771 \fi
8772 \fi
8773 \fi
8774 %
8775 % Make link in pdf output.
8776 \ifpdf
8777 % For pdfTeX and LuaTeX
8778 {\indexnofonts
8779 \makevalueexpandable
8780 \turnoffactive
8781 % This expands tokens, so do it after making catcode changes, so _
8782 % etc. don't get their TeX definitions. This ignores all spaces in
8783 % #4, including (wrongly) those in the middle of the filename.
8784 \getfilename{#4}%
8785 %
8786 % This (wrongly) does not take account of leading or trailing
8787 % spaces in #1, which should be ignored.
8788 \setpdfdestname{#1}%
8789 %
8790 \ifx\pdfdestname\empty
8791 \def\pdfdestname{Top}% no empty targets
8792 \fi
8793 %
8794 \leavevmode
8795 \startlink attr{/Border [0 0 0]}%
8796 \ifnum\filenamelength>0
8797 goto file{\the\filename.pdf} name{\pdfdestname}%
8798 \else
8799 goto name{\pdfmkpgn{\pdfdestname}}%
8800 \fi
8801 }%
8802 \setcolor{\linkcolor}%
8803 \else
8804 \ifx\XeTeXrevision\thisisundefined
8805 \else
8806 % For XeTeX
8807 {\indexnofonts
8808 \makevalueexpandable
8809 \turnoffactive
8810 % This expands tokens, so do it after making catcode changes, so _
8811 % etc. don't get their TeX definitions. This ignores all spaces in
8812 % #4, including (wrongly) those in the middle of the filename.
8813 \getfilename{#4}%
8814 %
8815 % This (wrongly) does not take account of leading or trailing
8816 % spaces in #1, which should be ignored.
8817 \setpdfdestname{#1}%
8818 %
8819 \ifx\pdfdestname\empty
8820 \def\pdfdestname{Top}% no empty targets
8821 \fi
8822 %
8823 \leavevmode
8824 \ifnum\filenamelength>0
8825 % With default settings,
8826 % XeTeX (xdvipdfmx) replaces link destination names with integers.
8827 % In this case, the replaced destination names of
8828 % remote PDFs are no longer known. In order to avoid a replacement,
8829 % you can use xdvipdfmx's command line option `-C 0x0010'.
8830 % If you use XeTeX 0.99996+ (TeX Live 2016+),
8831 % this command line option is no longer necessary
8832 % because we can use the `dvipdfmx:config' special.
8833 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8834 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
8835 \else
8836 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8837 << /S /GoTo /D (\pdfdestname) >> >>}%
8838 \fi
8839 }%
8840 \setcolor{\linkcolor}%
8841 \fi
8842 \fi
8843 {%
8844 % Have to otherify everything special to allow the \csname to
8845 % include an _ in the xref name, etc.
8846 \indexnofonts
8847 \turnoffactive
8848 \def\value##1{##1}%
8849 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8850 \csname XR#1-title\endcsname
8851 }%
8852 %
8853 % Float references are printed completely differently: "Figure 1.2"
8854 % instead of "[somenode], p.3". \iffloat distinguishes them by
8855 % \Xthisreftitle being set to a magic string.
8856 \iffloat\Xthisreftitle
8857 % If the user specified the print name (third arg) to the ref,
8858 % print it instead of our usual "Figure 1.2".
8859 \ifdim\wd\printedrefnamebox = 0pt
8860 \refx{#1-snt}%
8861 \else
8862 \printedrefname
8863 \fi
8864 %
8865 % If the user also gave the printed manual name (fifth arg), append
8866 % "in MANUALNAME".
8867 \ifdim \wd\printedmanualbox > 0pt
8868 \space \putwordin{} \cite{\printedmanual}%
8869 \fi
8870 \else
8871 % node/anchor (non-float) references.
8872 %
8873 % If we use \unhbox to print the node names, TeX does not insert
8874 % empty discretionaries after hyphens, which means that it will not
8875 % find a line break at a hyphen in a node names. Since some manuals
8876 % are best written with fairly long node names, containing hyphens,
8877 % this is a loss. Therefore, we give the text of the node name
8878 % again, so it is as if TeX is seeing it for the first time.
8879 %
8880 \ifdim \wd\printedmanualbox > 0pt
8881 % Cross-manual reference with a printed manual name.
8882 %
8883 \crossmanualxref{\cite{\printedmanual\unskip}}%
8884 %
8885 \else\ifdim \wd\infofilenamebox > 0pt
8886 % Cross-manual reference with only an info filename (arg 4), no
8887 % printed manual name (arg 5). This is essentially the same as
8888 % the case above; we output the filename, since we have nothing else.
8889 %
8890 \crossmanualxref{\code{\infofilename\unskip}}%
8891 %
8892 \else
8893 % Reference within this manual.
8894 %
8895 % Only output a following space if the -snt ref is nonempty, as the ref
8896 % will be empty for @unnumbered and @anchor.
8897 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
8898 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8899 %
8900 % output the `[mynode]' via the macro below so it can be overridden.
8901 \xrefprintnodename\printedrefname
8902 %
8903 \ifflagclear{txiomitxrefpg}{%
8904 % We always want a comma
8905 ,%
8906 % output the `page 3'.
8907 \turnoffactive \putpageref{#1}%
8908 % Add a , if xref followed by a space
8909 \if\space\noexpand\tokenafterxref ,%
8910 \else\ifx\ \tokenafterxref ,% @TAB
8911 \else\ifx\*\tokenafterxref ,% @*
8912 \else\ifx\ \tokenafterxref ,% @SPACE
8913 \else\ifx\
8914 \tokenafterxref ,% @NL
8915 \else\ifx\tie\tokenafterxref ,% @tie
8916 \fi\fi\fi\fi\fi\fi
8917 }{}%
8918 \fi\fi
8919 \fi
8920 \endlink
8921 \endgroup}
8922
8923 % can be overridden in translation files
8924 \def\putpageref#1{%
8925 \space\putwordpage\tie\refx{#1-pg}}
8926
8927 % Output a cross-manual xref to #1. Used just above (twice).
8928 %
8929 % Only include the text "Section ``foo'' in" if the foo is neither
8930 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
8931 % "see The Foo Manual", the idea being to refer to the whole manual.
8932 %
8933 % But, this being TeX, we can't easily compare our node name against the
8934 % string "Top" while ignoring the possible spaces before and after in
8935 % the input. By adding the arbitrary 7sp below, we make it much less
8936 % likely that a real node name would have the same width as "Top" (e.g.,
8937 % in a monospaced font). Hopefully it will never happen in practice.
8938 %
8939 % For the same basic reason, we retypeset the "Top" at every
8940 % reference, since the current font is indeterminate.
8941 %
8942 \def\crossmanualxref#1{%
8943 \setbox\toprefbox = \hbox{Top\kern7sp}%
8944 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
8945 \ifdim \wd2 > 7sp % nonempty?
8946 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
8947 \putwordSection{} ``\printedrefname'' \putwordin{}\space
8948 \fi
8949 \fi
8950 #1%
8951 }
8952
8953 % This macro is called from \xrefX for the `[nodename]' part of xref
8954 % output. It's a separate macro only so it can be changed more easily,
8955 % since square brackets don't work well in some documents. Particularly
8956 % one that Bob is working on :).
8957 %
8958 \def\xrefprintnodename#1{[#1]}
8959
8960 % Things referred to by \setref.
8961 %
8962 \def\Ynothing{}
8963 \def\Yomitfromtoc{}
8964 \def\Ynumbered{%
8965 \ifnum\secno=0
8966 \putwordChapter@tie \the\chapno
8967 \else \ifnum\subsecno=0
8968 \putwordSection@tie \the\chapno.\the\secno
8969 \else \ifnum\subsubsecno=0
8970 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
8971 \else
8972 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
8973 \fi\fi\fi
8974 }
8975 \def\Yappendix{%
8976 \ifnum\secno=0
8977 \putwordAppendix@tie @char\the\appendixno{}%
8978 \else \ifnum\subsecno=0
8979 \putwordSection@tie @char\the\appendixno.\the\secno
8980 \else \ifnum\subsubsecno=0
8981 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
8982 \else
8983 \putwordSection@tie
8984 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
8985 \fi\fi\fi
8986 }
8987
8988 % \refx{NAME} - reference a cross-reference string named NAME.
8989 \def\refx#1{%
8990 \requireauxfile
8991 {%
8992 \indexnofonts
8993 \turnoffactive
8994 \def\value##1{##1}%
8995 \expandafter\global\expandafter\let\expandafter\thisrefX
8996 \csname XR#1\endcsname
8997 }%
8998 \ifx\thisrefX\relax
8999 % If not defined, say something at least.
9000 \angleleft un\-de\-fined\angleright
9001 \iflinks
9002 \ifhavexrefs
9003 {\toks0 = {#1}% avoid expansion of possibly-complex value
9004 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9005 \else
9006 \ifwarnedxrefs\else
9007 \global\warnedxrefstrue
9008 \message{Cross reference values unknown; you must run TeX again.}%
9009 \fi
9010 \fi
9011 \fi
9012 \else
9013 % It's defined, so just use it.
9014 \thisrefX
9015 \fi
9016 }
9017
9018 % This is the macro invoked by entries in the aux file. Define a control
9019 % sequence for a cross-reference target (we prepend XR to the control sequence
9020 % name to avoid collisions). The value is the page number. If this is a float
9021 % type, we have more work to do.
9022 %
9023 \def\xrdef#1#2{%
9024 {% Expand the node or anchor name to remove control sequences.
9025 % \turnoffactive stops 8-bit characters being changed to commands
9026 % like @'e. \refx does the same to retrieve the value in the definition.
9027 \indexnofonts
9028 \turnoffactive
9029 \def\value##1{##1}%
9030 \xdef\safexrefname{#1}%
9031 }%
9032 %
9033 \bgroup
9034 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
9035 \egroup
9036 % We put the \gdef inside a group to avoid the definitions building up on
9037 % TeX's save stack, which can cause it to run out of space for aux files with
9038 % thousands of lines. \gdef doesn't use the save stack, but \csname does
9039 % when it defines an unknown control sequence as \relax.
9040 %
9041 % Was that xref control sequence that we just defined for a float?
9042 \expandafter\iffloat\csname XR\safexrefname\endcsname
9043 % it was a float, and we have the (safe) float type in \iffloattype.
9044 \expandafter\let\expandafter\floatlist
9045 \csname floatlist\iffloattype\endcsname
9046 %
9047 % Is this the first time we've seen this float type?
9048 \expandafter\ifx\floatlist\relax
9049 \toks0 = {\do}% yes, so just \do
9050 \else
9051 % had it before, so preserve previous elements in list.
9052 \toks0 = \expandafter{\floatlist\do}%
9053 \fi
9054 %
9055 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9056 % for later use in \listoffloats.
9057 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9058 {\safexrefname}}%
9059 \fi
9060 }
9061
9062 % If working on a large document in chapters, it is convenient to
9063 % be able to disable indexing, cross-referencing, and contents, for test runs.
9064 % This is done with @novalidate at the beginning of the file.
9065 %
9066 \newif\iflinks \linkstrue % by default we want the aux files.
9067 \let\novalidate = \linksfalse
9068
9069 % Used when writing to the aux file, or when using data from it.
9070 \def\requireauxfile{%
9071 \iflinks
9072 \tryauxfile
9073 % Open the new aux file. TeX will close it automatically at exit.
9074 \immediate\openout\auxfile=\jobname.aux
9075 \fi
9076 \global\let\requireauxfile=\relax % Only do this once.
9077 }
9078
9079 % Read the last existing aux file, if any. No error if none exists.
9080 %
9081 \def\tryauxfile{%
9082 \openin 1 \jobname.aux
9083 \ifeof 1 \else
9084 \readdatafile{aux}%
9085 \global\havexrefstrue
9086 \fi
9087 \closein 1
9088 }
9089
9090 \def\setupdatafile{%
9091 \catcode`\^^@=\other
9092 \catcode`\^^A=\other
9093 \catcode`\^^B=\other
9094 \catcode`\^^C=\other
9095 \catcode`\^^D=\other
9096 \catcode`\^^E=\other
9097 \catcode`\^^F=\other
9098 \catcode`\^^G=\other
9099 \catcode`\^^H=\other
9100 \catcode`\^^K=\other
9101 \catcode`\^^L=\other
9102 \catcode`\^^N=\other
9103 \catcode`\^^P=\other
9104 \catcode`\^^Q=\other
9105 \catcode`\^^R=\other
9106 \catcode`\^^S=\other
9107 \catcode`\^^T=\other
9108 \catcode`\^^U=\other
9109 \catcode`\^^V=\other
9110 \catcode`\^^W=\other
9111 \catcode`\^^X=\other
9112 \catcode`\^^Z=\other
9113 \catcode`\^^[=\other
9114 \catcode`\^^\=\other
9115 \catcode`\^^]=\other
9116 \catcode`\^^^=\other
9117 \catcode`\^^_=\other
9118 \catcode`\^=\other
9119 %
9120 % Special characters. Should be turned off anyway, but...
9121 \catcode`\~=\other
9122 \catcode`\[=\other
9123 \catcode`\]=\other
9124 \catcode`\"=\other
9125 \catcode`\_=\active
9126 \catcode`\|=\active
9127 \catcode`\<=\active
9128 \catcode`\>=\active
9129 \catcode`\$=\other
9130 \catcode`\#=\other
9131 \catcode`\&=\other
9132 \catcode`\%=\other
9133 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9134 %
9135 \catcode`\\=\active
9136 %
9137 % @ is our escape character in .aux files, and we need braces.
9138 \catcode`\{=1
9139 \catcode`\}=2
9140 \catcode`\@=0
9141 }
9142
9143 \def\readdatafile#1{%
9144 \begingroup
9145 \setupdatafile
9146 \input\jobname.#1
9147 \endgroup}
9148
9149
9150 \message{insertions,}
9151 % including footnotes.
9152
9153 \newcount \footnoteno
9154
9155 % The trailing space in the following definition for supereject is
9156 % vital for proper filling; pages come out unaligned when you do a
9157 % pagealignmacro call if that space before the closing brace is
9158 % removed. (Generally, numeric constants should always be followed by a
9159 % space to prevent strange expansion errors.)
9160 \def\supereject{\par\penalty -20000\footnoteno =0 }
9161
9162 % @footnotestyle is meaningful for Info output only.
9163 \let\footnotestyle=\comment
9164
9165 {\catcode `\@=11
9166 %
9167 % Auto-number footnotes. Otherwise like plain.
9168 \gdef\footnote{%
9169 \global\advance\footnoteno by \@ne
9170 \edef\thisfootno{$^{\the\footnoteno}$}%
9171 %
9172 % In case the footnote comes at the end of a sentence, preserve the
9173 % extra spacing after we do the footnote number.
9174 \let\@sf\empty
9175 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9176 %
9177 % Remove inadvertent blank space before typesetting the footnote number.
9178 \unskip
9179 \thisfootno\@sf
9180 \dofootnote
9181 }%
9182
9183 % Don't bother with the trickery in plain.tex to not require the
9184 % footnote text as a parameter. Our footnotes don't need to be so general.
9185 %
9186 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9187 % \parseargline) fails inside footnotes because the tokens are fixed when
9188 % the footnote is read. --karl, 16nov96.
9189 %
9190 \gdef\dofootnote{%
9191 \insert\footins\bgroup
9192 %
9193 % Nested footnotes are not supported in TeX, that would take a lot
9194 % more work. (\startsavinginserts does not suffice.)
9195 \let\footnote=\errfootnotenest
9196 %
9197 % We want to typeset this text as a normal paragraph, even if the
9198 % footnote reference occurs in (for example) a display environment.
9199 % So reset some parameters.
9200 \hsize=\txipagewidth
9201 \interlinepenalty\interfootnotelinepenalty
9202 \splittopskip\ht\strutbox % top baseline for broken footnotes
9203 \splitmaxdepth\dp\strutbox
9204 \floatingpenalty\@MM
9205 \leftskip\z@skip
9206 \rightskip\z@skip
9207 \spaceskip\z@skip
9208 \xspaceskip\z@skip
9209 \parindent\defaultparindent
9210 %
9211 \smallfonts \rm
9212 %
9213 % Because we use hanging indentation in footnotes, a @noindent appears
9214 % to exdent this text, so make it be a no-op. makeinfo does not use
9215 % hanging indentation so @noindent can still be needed within footnote
9216 % text after an @example or the like (not that this is good style).
9217 \let\noindent = \relax
9218 %
9219 % Hang the footnote text off the number. Use \everypar in case the
9220 % footnote extends for more than one paragraph.
9221 \everypar = {\hang}%
9222 \textindent{\thisfootno}%
9223 %
9224 % Don't crash into the line above the footnote text. Since this
9225 % expands into a box, it must come within the paragraph, lest it
9226 % provide a place where TeX can split the footnote.
9227 \footstrut
9228 %
9229 % Invoke rest of plain TeX footnote routine.
9230 \futurelet\next\fo@t
9231 }
9232 }%end \catcode `\@=11
9233
9234 \def\errfootnotenest{%
9235 \errhelp=\EMsimple
9236 \errmessage{Nested footnotes not supported in texinfo.tex,
9237 even though they work in makeinfo; sorry}
9238 }
9239
9240 \def\errfootnoteheading{%
9241 \errhelp=\EMsimple
9242 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9243 }
9244
9245 % In case a @footnote appears in a vbox, save the footnote text and create
9246 % the real \insert just after the vbox finished. Otherwise, the insertion
9247 % would be lost.
9248 % Similarly, if a @footnote appears inside an alignment, save the footnote
9249 % text to a box and make the \insert when a row of the table is finished.
9250 % And the same can be done for other insert classes. --kasal, 16nov03.
9251 %
9252 % Replace the \insert primitive by a cheating macro.
9253 % Deeper inside, just make sure that the saved insertions are not spilled
9254 % out prematurely.
9255 %
9256 \def\startsavinginserts{%
9257 \ifx \insert\ptexinsert
9258 \let\insert\saveinsert
9259 \else
9260 \let\checkinserts\relax
9261 \fi
9262 }
9263
9264 % This \insert replacement works for both \insert\footins{foo} and
9265 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9266 %
9267 \def\saveinsert#1{%
9268 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9269 \afterassignment\next
9270 % swallow the left brace
9271 \let\temp =
9272 }
9273 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9274 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9275
9276 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9277
9278 \def\placesaveins#1{%
9279 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9280 {\box#1}%
9281 }
9282
9283 % eat @SAVE -- beware, all of them have catcode \other:
9284 {
9285 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9286 \gdef\gobblesave @SAVE{}
9287 }
9288
9289 % initialization:
9290 \def\newsaveins #1{%
9291 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9292 \next
9293 }
9294 \def\newsaveinsX #1{%
9295 \csname newbox\endcsname #1%
9296 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9297 \checksaveins #1}%
9298 }
9299
9300 % initialize:
9301 \let\checkinserts\empty
9302 \newsaveins\footins
9303 \newsaveins\margin
9304
9305
9306 % @image. We use the macros from epsf.tex to support this.
9307 % If epsf.tex is not installed and @image is used, we complain.
9308 %
9309 % Check for and read epsf.tex up front. If we read it only at @image
9310 % time, we might be inside a group, and then its definitions would get
9311 % undone and the next image would fail.
9312 \openin 1 = epsf.tex
9313 \ifeof 1 \else
9314 % Do not bother showing banner with epsf.tex v2.7k (available in
9315 % doc/epsf.tex and on ctan).
9316 \def\epsfannounce{\toks0 = }%
9317 \input epsf.tex
9318 \fi
9319 \closein 1
9320 %
9321 % We will only complain once about lack of epsf.tex.
9322 \newif\ifwarnednoepsf
9323 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9324 work. It is also included in the Texinfo distribution, or you can get
9325 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
9326 %
9327 \def\image#1{%
9328 \ifx\epsfbox\thisisundefined
9329 \ifwarnednoepsf \else
9330 \errhelp = \noepsfhelp
9331 \errmessage{epsf.tex not found, images will be ignored}%
9332 \global\warnednoepsftrue
9333 \fi
9334 \else
9335 \imagexxx #1,,,,,\finish
9336 \fi
9337 }
9338
9339 % Approximate height of a line in the standard text font.
9340 \newdimen\capheight
9341 \setbox0=\vbox{\tenrm H}
9342 \capheight=\ht0
9343
9344 %
9345 % Arguments to @image:
9346 % #1 is (mandatory) image filename; we tack on .eps extension.
9347 % #2 is (optional) width, #3 is (optional) height.
9348 % #4 is (ignored optional) html alt text.
9349 % #5 is (ignored optional) extension.
9350 % #6 is just the usual extra ignored arg for parsing stuff.
9351 \newif\ifimagevmode
9352 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9353 \catcode`\^^M = 5 % in case we're inside an example
9354 \normalturnoffactive % allow _ et al. in names
9355 \makevalueexpandable
9356 \ifvmode
9357 \imagevmodetrue
9358 \medskip
9359 % Usually we'll have text after the image which will insert
9360 % \parskip glue, so insert it here too to equalize the space
9361 % above and below.
9362 \vskip\parskip
9363 %
9364 % Place image in a \vtop for a top page margin that is (close to) correct,
9365 % as \topskip glue is relative to the first baseline.
9366 \vtop\bgroup \kern -\capheight \vskip-\parskip
9367 \fi
9368 %
9369 \ifx\centersub\centerV
9370 % For @center @image, enter vertical mode and add vertical space
9371 % Enter an extra \parskip because @center doesn't add space itself.
9372 \vbox\bgroup\vskip\parskip\medskip\vskip\parskip
9373 \else
9374 % Enter horizontal mode so that indentation from an enclosing
9375 % environment such as @quotation is respected.
9376 % However, if we're at the top level, we don't want the
9377 % normal paragraph indentation.
9378 \imageindent
9379 \fi
9380 %
9381 % Output the image.
9382 \ifpdf
9383 % For pdfTeX and LuaTeX <= 0.80
9384 \dopdfimage{#1}{#2}{#3}%
9385 \else
9386 \ifx\XeTeXrevision\thisisundefined
9387 % For epsf.tex
9388 % \epsfbox itself resets \epsf?size at each figure.
9389 \setbox0 = \hbox{\ignorespaces #2}%
9390 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9391 \setbox0 = \hbox{\ignorespaces #3}%
9392 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9393 \epsfbox{#1.eps}%
9394 \else
9395 % For XeTeX
9396 \doxeteximage{#1}{#2}{#3}%
9397 \fi
9398 \fi
9399 %
9400 \ifimagevmode
9401 \egroup
9402 \medskip % space after a standalone image
9403 \fi
9404 \ifx\centersub\centerV % @center @image
9405 \medskip
9406 \egroup % close \vbox
9407 \fi
9408 \endgroup}
9409
9410
9411 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9412 % etc. We don't actually implement floating yet, we always include the
9413 % float "here". But it seemed the best name for the future.
9414 %
9415 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9416
9417 % There may be a space before second and/or third parameter; delete it.
9418 \def\eatcommaspace#1, {#1,}
9419
9420 % #1 is the optional FLOATTYPE, the text label for this float, typically
9421 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9422 % this float will not be numbered and cannot be referred to.
9423 %
9424 % #2 is the optional xref label. Also must be present for the float to
9425 % be referable.
9426 %
9427 % #3 is the optional positioning argument; for now, it is ignored. It
9428 % will somehow specify the positions allowed to float to (here, top, bottom).
9429 %
9430 % We keep a separate counter for each FLOATTYPE, which we reset at each
9431 % chapter-level command.
9432 \let\resetallfloatnos=\empty
9433 %
9434 \def\dofloat#1,#2,#3,#4\finish{%
9435 \let\thiscaption=\empty
9436 \let\thisshortcaption=\empty
9437 %
9438 % don't lose footnotes inside @float.
9439 %
9440 % BEWARE: when the floats start float, we have to issue warning whenever an
9441 % insert appears inside a float which could possibly float. --kasal, 26may04
9442 %
9443 \startsavinginserts
9444 %
9445 % We can't be used inside a paragraph.
9446 \par
9447 %
9448 \vtop\bgroup
9449 \def\floattype{#1}%
9450 \def\floatlabel{#2}%
9451 \def\floatloc{#3}% we do nothing with this yet.
9452 %
9453 \ifx\floattype\empty
9454 \let\safefloattype=\empty
9455 \else
9456 {%
9457 % the floattype might have accents or other special characters,
9458 % but we need to use it in a control sequence name.
9459 \indexnofonts
9460 \turnoffactive
9461 \xdef\safefloattype{\floattype}%
9462 }%
9463 \fi
9464 %
9465 % If label is given but no type, we handle that as the empty type.
9466 \ifx\floatlabel\empty \else
9467 % We want each FLOATTYPE to be numbered separately (Figure 1,
9468 % Table 1, Figure 2, ...). (And if no label, no number.)
9469 %
9470 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9471 \global\advance\floatno by 1
9472 %
9473 {%
9474 % This magic value for \currentsection is output by \setref as the
9475 % XREFLABEL-title value. \xrefX uses it to distinguish float
9476 % labels (which have a completely different output format) from
9477 % node and anchor labels. And \xrdef uses it to construct the
9478 % lists of floats.
9479 %
9480 \edef\currentsection{\floatmagic=\safefloattype}%
9481 \setref{\floatlabel}{Yfloat}%
9482 }%
9483 \fi
9484 %
9485 % start with \parskip glue, I guess.
9486 \vskip\parskip
9487 %
9488 % Don't suppress indentation if a float happens to start a section.
9489 \restorefirstparagraphindent
9490 }
9491
9492 % we have these possibilities:
9493 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9494 % @float Foo,lbl & no caption: Foo 1.1
9495 % @float Foo & @caption{Cap}: Foo: Cap
9496 % @float Foo & no caption: Foo
9497 % @float ,lbl & Caption{Cap}: 1.1: Cap
9498 % @float ,lbl & no caption: 1.1
9499 % @float & @caption{Cap}: Cap
9500 % @float & no caption:
9501 %
9502 \def\Efloat{%
9503 \let\floatident = \empty
9504 %
9505 % In all cases, if we have a float type, it comes first.
9506 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9507 %
9508 % If we have an xref label, the number comes next.
9509 \ifx\floatlabel\empty \else
9510 \ifx\floattype\empty \else % if also had float type, need tie first.
9511 \appendtomacro\floatident{\tie}%
9512 \fi
9513 % the number.
9514 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9515 \fi
9516 %
9517 % Start the printed caption with what we've constructed in
9518 % \floatident, but keep it separate; we need \floatident again.
9519 \let\captionline = \floatident
9520 %
9521 \ifx\thiscaption\empty \else
9522 \ifx\floatident\empty \else
9523 \appendtomacro\captionline{: }% had ident, so need a colon between
9524 \fi
9525 %
9526 % caption text.
9527 \appendtomacro\captionline{\scanexp\thiscaption}%
9528 \fi
9529 %
9530 % If we have anything to print, print it, with space before.
9531 % Eventually this needs to become an \insert.
9532 \ifx\captionline\empty \else
9533 \vskip.5\parskip
9534 \captionline
9535 %
9536 % Space below caption.
9537 \vskip\parskip
9538 \fi
9539 %
9540 % If have an xref label, write the list of floats info. Do this
9541 % after the caption, to avoid chance of it being a breakpoint.
9542 \ifx\floatlabel\empty \else
9543 % Write the text that goes in the lof to the aux file as
9544 % \floatlabel-lof. Besides \floatident, we include the short
9545 % caption if specified, else the full caption if specified, else nothing.
9546 {%
9547 \requireauxfile
9548 \atdummies
9549 %
9550 \ifx\thisshortcaption\empty
9551 \def\gtemp{\thiscaption}%
9552 \else
9553 \def\gtemp{\thisshortcaption}%
9554 \fi
9555 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9556 \ifx\gtemp\empty \else : \gtemp \fi}}%
9557 }%
9558 \fi
9559 \egroup % end of \vtop
9560 %
9561 \checkinserts
9562 }
9563
9564 % Append the tokens #2 to the definition of macro #1, not expanding either.
9565 %
9566 \def\appendtomacro#1#2{%
9567 \expandafter\def\expandafter#1\expandafter{#1#2}%
9568 }
9569
9570 % @caption, @shortcaption
9571 %
9572 \def\caption{\docaption\thiscaption}
9573 \def\shortcaption{\docaption\thisshortcaption}
9574 \def\docaption{\checkenv\float \bgroup\scanctxt\defcaption}
9575 \def\defcaption#1#2{\egroup \def#1{#2}}
9576
9577 % The parameter is the control sequence identifying the counter we are
9578 % going to use. Create it if it doesn't exist and assign it to \floatno.
9579 \def\getfloatno#1{%
9580 \ifx#1\relax
9581 % Haven't seen this figure type before.
9582 \csname newcount\endcsname #1%
9583 %
9584 % Remember to reset this floatno at the next chap.
9585 \expandafter\gdef\expandafter\resetallfloatnos
9586 \expandafter{\resetallfloatnos #1=0 }%
9587 \fi
9588 \let\floatno#1%
9589 }
9590
9591 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9592 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9593 % first read the @float command.
9594 %
9595 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9596
9597 % Magic string used for the XREFLABEL-title value, so \xrefX can
9598 % distinguish floats from other xref types.
9599 \def\floatmagic{!!float!!}
9600
9601 % #1 is the control sequence we are passed; we expand into a conditional
9602 % which is true if #1 represents a float ref. That is, the magic
9603 % \currentsection value which we \setref above.
9604 %
9605 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9606 %
9607 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9608 % (safe) float type for this float. We set \iffloattype to #2.
9609 %
9610 \def\doiffloat#1=#2=#3\finish{%
9611 \def\temp{#1}%
9612 \def\iffloattype{#2}%
9613 \ifx\temp\floatmagic
9614 }
9615
9616 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9617 %
9618 \parseargdef\listoffloats{%
9619 \def\floattype{#1}% floattype
9620 {%
9621 % the floattype might have accents or other special characters,
9622 % but we need to use it in a control sequence name.
9623 \indexnofonts
9624 \turnoffactive
9625 \xdef\safefloattype{\floattype}%
9626 }%
9627 %
9628 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9629 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9630 \ifhavexrefs
9631 % if the user said @listoffloats foo but never @float foo.
9632 \message{\linenumber No `\safefloattype' floats to list.}%
9633 \fi
9634 \else
9635 \begingroup
9636 \leftskip=\tocindent % indent these entries like a toc
9637 \let\do=\listoffloatsdo
9638 \csname floatlist\safefloattype\endcsname
9639 \endgroup
9640 \fi
9641 }
9642
9643 % This is called on each entry in a list of floats. We're passed the
9644 % xref label, in the form LABEL-title, which is how we save it in the
9645 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9646 % has the text we're supposed to typeset here.
9647 %
9648 % Figures without xref labels will not be included in the list (since
9649 % they won't appear in the aux file).
9650 %
9651 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9652 \def\listoffloatsdoentry#1-title\finish{{%
9653 % Can't fully expand XR#1-lof because it can contain anything. Just
9654 % pass the control sequence. On the other hand, XR#1-pg is just the
9655 % page number, and we want to fully expand that so we can get a link
9656 % in pdf output.
9657 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9658 %
9659 % use the same \entry macro we use to generate the TOC and index.
9660 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9661 \writeentry
9662 }}
9663
9664
9665 \message{localization,}
9666
9667 % For single-language documents, @documentlanguage is usually given very
9668 % early, just after @documentencoding. Single argument is the language
9669 % (de) or locale (de_DE) abbreviation.
9670 %
9671 {
9672 \catcode`\_ = \active
9673 \globaldefs=1
9674 \parseargdef\documentlanguage{%
9675 \tex % read txi-??.tex file in plain TeX.
9676 % Read the file by the name they passed if it exists.
9677 \let_ = \normalunderscore % normal _ character for filename test
9678 \openin 1 txi-#1.tex
9679 \ifeof 1
9680 \documentlanguagetrywithoutunderscore #1_\finish
9681 \else
9682 \globaldefs = 1 % everything in the txi-LL files needs to persist
9683 \input txi-#1.tex
9684 \fi
9685 \closein 1
9686 \endgroup % end raw TeX
9687 }
9688 %
9689 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9690 % try txi-de.tex.
9691 %
9692 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9693 \openin 1 txi-#1.tex
9694 \ifeof 1
9695 \errhelp = \nolanghelp
9696 \errmessage{Cannot read language file txi-#1.tex}%
9697 \else
9698 \globaldefs = 1 % everything in the txi-LL files needs to persist
9699 \input txi-#1.tex
9700 \fi
9701 \closein 1
9702 }
9703 }% end of special _ catcode
9704 %
9705 \newhelp\nolanghelp{The given language definition file cannot be found or
9706 is empty. Maybe you need to install it? Putting it in the current
9707 directory should work if nowhere else does.}
9708
9709 % This macro is called from txi-??.tex files; the first argument is the
9710 % \language name to set (without the "\lang@" prefix), the second and
9711 % third args are \{left,right}hyphenmin.
9712 %
9713 % The language names to pass are determined when the format is built.
9714 % See the etex.log file created at that time, e.g.,
9715 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9716 %
9717 % With TeX Live 2008, etex now includes hyphenation patterns for all
9718 % available languages. This means we can support hyphenation in
9719 % Texinfo, at least to some extent. (This still doesn't solve the
9720 % accented characters problem.)
9721 %
9722 \catcode`@=11
9723 \def\txisetlanguage#1#2#3{%
9724 % do not set the language if the name is undefined in the current TeX.
9725 \expandafter\ifx\csname lang@#1\endcsname \relax
9726 \message{no patterns for #1}%
9727 \else
9728 \global\language = \csname lang@#1\endcsname
9729 \fi
9730 % but there is no harm in adjusting the hyphenmin values regardless.
9731 \global\lefthyphenmin = #2\relax
9732 \global\righthyphenmin = #3\relax
9733 }
9734
9735 % XeTeX and LuaTeX can handle Unicode natively.
9736 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9737 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9738 %
9739 \newif\iftxinativeunicodecapable
9740 \newif\iftxiusebytewiseio
9741
9742 \ifx\XeTeXrevision\thisisundefined
9743 \ifx\luatexversion\thisisundefined
9744 \txinativeunicodecapablefalse
9745 \txiusebytewiseiotrue
9746 \else
9747 \txinativeunicodecapabletrue
9748 \txiusebytewiseiofalse
9749 \fi
9750 \else
9751 \txinativeunicodecapabletrue
9752 \txiusebytewiseiofalse
9753 \fi
9754
9755 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9756 % for non-UTF-8 (byte-wise) encodings.
9757 %
9758 \def\setbytewiseio{%
9759 \ifx\XeTeXrevision\thisisundefined
9760 \else
9761 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9762 \XeTeXinputencoding "bytes" % For document root file
9763 % Unfortunately, there seems to be no corresponding XeTeX command for
9764 % output encoding. This is a problem for auxiliary index and TOC files.
9765 % The only solution would be perhaps to write out @U{...} sequences in
9766 % place of non-ASCII characters.
9767 \fi
9768
9769 \ifx\luatexversion\thisisundefined
9770 \else
9771 \directlua{
9772 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9773 local function convert_char (char)
9774 return utf8_char(byte(char))
9775 end
9776
9777 local function convert_line (line)
9778 return gsub(line, ".", convert_char)
9779 end
9780
9781 callback.register("process_input_buffer", convert_line)
9782
9783 local function convert_line_out (line)
9784 local line_out = ""
9785 for c in string.utfvalues(line) do
9786 line_out = line_out .. string.char(c)
9787 end
9788 return line_out
9789 end
9790
9791 callback.register("process_output_buffer", convert_line_out)
9792 }
9793 \fi
9794
9795 \txiusebytewiseiotrue
9796 }
9797
9798
9799 % Helpers for encodings.
9800 % Set the catcode of characters 128 through 255 to the specified number.
9801 %
9802 \def\setnonasciicharscatcode#1{%
9803 \count255=128
9804 \loop\ifnum\count255<256
9805 \global\catcode\count255=#1\relax
9806 \advance\count255 by 1
9807 \repeat
9808 }
9809
9810 \def\setnonasciicharscatcodenonglobal#1{%
9811 \count255=128
9812 \loop\ifnum\count255<256
9813 \catcode\count255=#1\relax
9814 \advance\count255 by 1
9815 \repeat
9816 }
9817
9818 % @documentencoding sets the definition of non-ASCII characters
9819 % according to the specified encoding.
9820 %
9821 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9822 \def\documentencodingzzz#1{%
9823 %
9824 % Encoding being declared for the document.
9825 \def\declaredencoding{\csname #1.enc\endcsname}%
9826 %
9827 % Supported encodings: names converted to tokens in order to be able
9828 % to compare them with \ifx.
9829 \def\ascii{\csname US-ASCII.enc\endcsname}%
9830 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9831 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9832 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9833 \def\utfeight{\csname UTF-8.enc\endcsname}%
9834 %
9835 \ifx \declaredencoding \ascii
9836 \asciichardefs
9837 %
9838 \else \ifx \declaredencoding \lattwo
9839 \iftxinativeunicodecapable
9840 \setbytewiseio
9841 \fi
9842 \setnonasciicharscatcode\active
9843 \lattwochardefs
9844 %
9845 \else \ifx \declaredencoding \latone
9846 \iftxinativeunicodecapable
9847 \setbytewiseio
9848 \fi
9849 \setnonasciicharscatcode\active
9850 \latonechardefs
9851 %
9852 \else \ifx \declaredencoding \latnine
9853 \iftxinativeunicodecapable
9854 \setbytewiseio
9855 \fi
9856 \setnonasciicharscatcode\active
9857 \latninechardefs
9858 %
9859 \else \ifx \declaredencoding \utfeight
9860 \iftxinativeunicodecapable
9861 % For native Unicode handling (XeTeX and LuaTeX)
9862 \nativeunicodechardefs
9863 \else
9864 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX).
9865 % Since we already invoke \utfeightchardefs at the top level,
9866 % making non-ascii chars active is sufficient.
9867 \setnonasciicharscatcode\active
9868 \fi
9869 %
9870 \else
9871 \message{Ignoring unknown document encoding: #1.}%
9872 %
9873 \fi % utfeight
9874 \fi % latnine
9875 \fi % latone
9876 \fi % lattwo
9877 \fi % ascii
9878 %
9879 \ifx\XeTeXrevision\thisisundefined
9880 \else
9881 \ifx \declaredencoding \utfeight
9882 \else
9883 \ifx \declaredencoding \ascii
9884 \else
9885 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
9886 non-ASCII characters in auxiliary files.}%
9887 \fi
9888 \fi
9889 \fi
9890 }
9891
9892 % A message to be logged when using a character that isn't available
9893 % the default font encoding (OT1).
9894 %
9895 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9896
9897 % Take account of \c (plain) vs. \, (Texinfo) difference.
9898 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9899
9900 \def\gdefchar#1#2{%
9901 \gdef#1{%
9902 \ifpassthroughchars
9903 \string#1%
9904 \else
9905 #2%
9906 \fi
9907 }}
9908
9909 \begingroup
9910
9911 % Make non-ASCII characters active for defining the character definition
9912 % macros.
9913 \setnonasciicharscatcode\active
9914
9915 % Latin1 (ISO-8859-1) character definitions.
9916 \gdef\latonechardefs{%
9917 \gdefchar^^a0{\tie}
9918 \gdefchar^^a1{\exclamdown}
9919 \gdefchar^^a2{{\tcfont \char162}} % cent
9920 \gdefchar^^a3{\pounds{}}
9921 \gdefchar^^a4{{\tcfont \char164}} % currency
9922 \gdefchar^^a5{{\tcfont \char165}} % yen
9923 \gdefchar^^a6{{\tcfont \char166}} % broken bar
9924 \gdefchar^^a7{\S}
9925 \gdefchar^^a8{\"{}}
9926 \gdefchar^^a9{\copyright{}}
9927 \gdefchar^^aa{\ordf}
9928 \gdefchar^^ab{\guillemetleft{}}
9929 \gdefchar^^ac{\ensuremath\lnot}
9930 \gdefchar^^ad{\-}
9931 \gdefchar^^ae{\registeredsymbol{}}
9932 \gdefchar^^af{\={}}
9933 %
9934 \gdefchar^^b0{\textdegree}
9935 \gdefchar^^b1{$\pm$}
9936 \gdefchar^^b2{$^2$}
9937 \gdefchar^^b3{$^3$}
9938 \gdefchar^^b4{\'{}}
9939 \gdefchar^^b5{$\mu$}
9940 \gdefchar^^b6{\P}
9941 \gdefchar^^b7{\ensuremath\cdot}
9942 \gdefchar^^b8{\cedilla\ }
9943 \gdefchar^^b9{$^1$}
9944 \gdefchar^^ba{\ordm}
9945 \gdefchar^^bb{\guillemetright{}}
9946 \gdefchar^^bc{$1\over4$}
9947 \gdefchar^^bd{$1\over2$}
9948 \gdefchar^^be{$3\over4$}
9949 \gdefchar^^bf{\questiondown}
9950 %
9951 \gdefchar^^c0{\`A}
9952 \gdefchar^^c1{\'A}
9953 \gdefchar^^c2{\^A}
9954 \gdefchar^^c3{\~A}
9955 \gdefchar^^c4{\"A}
9956 \gdefchar^^c5{\ringaccent A}
9957 \gdefchar^^c6{\AE}
9958 \gdefchar^^c7{\cedilla C}
9959 \gdefchar^^c8{\`E}
9960 \gdefchar^^c9{\'E}
9961 \gdefchar^^ca{\^E}
9962 \gdefchar^^cb{\"E}
9963 \gdefchar^^cc{\`I}
9964 \gdefchar^^cd{\'I}
9965 \gdefchar^^ce{\^I}
9966 \gdefchar^^cf{\"I}
9967 %
9968 \gdefchar^^d0{\DH}
9969 \gdefchar^^d1{\~N}
9970 \gdefchar^^d2{\`O}
9971 \gdefchar^^d3{\'O}
9972 \gdefchar^^d4{\^O}
9973 \gdefchar^^d5{\~O}
9974 \gdefchar^^d6{\"O}
9975 \gdefchar^^d7{$\times$}
9976 \gdefchar^^d8{\O}
9977 \gdefchar^^d9{\`U}
9978 \gdefchar^^da{\'U}
9979 \gdefchar^^db{\^U}
9980 \gdefchar^^dc{\"U}
9981 \gdefchar^^dd{\'Y}
9982 \gdefchar^^de{\TH}
9983 \gdefchar^^df{\ss}
9984 %
9985 \gdefchar^^e0{\`a}
9986 \gdefchar^^e1{\'a}
9987 \gdefchar^^e2{\^a}
9988 \gdefchar^^e3{\~a}
9989 \gdefchar^^e4{\"a}
9990 \gdefchar^^e5{\ringaccent a}
9991 \gdefchar^^e6{\ae}
9992 \gdefchar^^e7{\cedilla c}
9993 \gdefchar^^e8{\`e}
9994 \gdefchar^^e9{\'e}
9995 \gdefchar^^ea{\^e}
9996 \gdefchar^^eb{\"e}
9997 \gdefchar^^ec{\`{\dotless i}}
9998 \gdefchar^^ed{\'{\dotless i}}
9999 \gdefchar^^ee{\^{\dotless i}}
10000 \gdefchar^^ef{\"{\dotless i}}
10001 %
10002 \gdefchar^^f0{\dh}
10003 \gdefchar^^f1{\~n}
10004 \gdefchar^^f2{\`o}
10005 \gdefchar^^f3{\'o}
10006 \gdefchar^^f4{\^o}
10007 \gdefchar^^f5{\~o}
10008 \gdefchar^^f6{\"o}
10009 \gdefchar^^f7{$\div$}
10010 \gdefchar^^f8{\o}
10011 \gdefchar^^f9{\`u}
10012 \gdefchar^^fa{\'u}
10013 \gdefchar^^fb{\^u}
10014 \gdefchar^^fc{\"u}
10015 \gdefchar^^fd{\'y}
10016 \gdefchar^^fe{\th}
10017 \gdefchar^^ff{\"y}
10018 }
10019
10020 % Latin9 (ISO-8859-15) encoding character definitions.
10021 \gdef\latninechardefs{%
10022 % Encoding is almost identical to Latin1.
10023 \latonechardefs
10024 %
10025 \gdefchar^^a4{\euro{}}
10026 \gdefchar^^a6{\v S}
10027 \gdefchar^^a8{\v s}
10028 \gdefchar^^b4{\v Z}
10029 \gdefchar^^b8{\v z}
10030 \gdefchar^^bc{\OE}
10031 \gdefchar^^bd{\oe}
10032 \gdefchar^^be{\"Y}
10033 }
10034
10035 % Latin2 (ISO-8859-2) character definitions.
10036 \gdef\lattwochardefs{%
10037 \gdefchar^^a0{\tie}
10038 \gdefchar^^a1{\ogonek{A}}
10039 \gdefchar^^a2{\u{}}
10040 \gdefchar^^a3{\L}
10041 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10042 \gdefchar^^a5{\v L}
10043 \gdefchar^^a6{\'S}
10044 \gdefchar^^a7{\S}
10045 \gdefchar^^a8{\"{}}
10046 \gdefchar^^a9{\v S}
10047 \gdefchar^^aa{\cedilla S}
10048 \gdefchar^^ab{\v T}
10049 \gdefchar^^ac{\'Z}
10050 \gdefchar^^ad{\-}
10051 \gdefchar^^ae{\v Z}
10052 \gdefchar^^af{\dotaccent Z}
10053 %
10054 \gdefchar^^b0{\textdegree}
10055 \gdefchar^^b1{\ogonek{a}}
10056 \gdefchar^^b2{\ogonek{ }}
10057 \gdefchar^^b3{\l}
10058 \gdefchar^^b4{\'{}}
10059 \gdefchar^^b5{\v l}
10060 \gdefchar^^b6{\'s}
10061 \gdefchar^^b7{\v{}}
10062 \gdefchar^^b8{\cedilla\ }
10063 \gdefchar^^b9{\v s}
10064 \gdefchar^^ba{\cedilla s}
10065 \gdefchar^^bb{\v t}
10066 \gdefchar^^bc{\'z}
10067 \gdefchar^^bd{\H{}}
10068 \gdefchar^^be{\v z}
10069 \gdefchar^^bf{\dotaccent z}
10070 %
10071 \gdefchar^^c0{\'R}
10072 \gdefchar^^c1{\'A}
10073 \gdefchar^^c2{\^A}
10074 \gdefchar^^c3{\u A}
10075 \gdefchar^^c4{\"A}
10076 \gdefchar^^c5{\'L}
10077 \gdefchar^^c6{\'C}
10078 \gdefchar^^c7{\cedilla C}
10079 \gdefchar^^c8{\v C}
10080 \gdefchar^^c9{\'E}
10081 \gdefchar^^ca{\ogonek{E}}
10082 \gdefchar^^cb{\"E}
10083 \gdefchar^^cc{\v E}
10084 \gdefchar^^cd{\'I}
10085 \gdefchar^^ce{\^I}
10086 \gdefchar^^cf{\v D}
10087 %
10088 \gdefchar^^d0{\DH}
10089 \gdefchar^^d1{\'N}
10090 \gdefchar^^d2{\v N}
10091 \gdefchar^^d3{\'O}
10092 \gdefchar^^d4{\^O}
10093 \gdefchar^^d5{\H O}
10094 \gdefchar^^d6{\"O}
10095 \gdefchar^^d7{$\times$}
10096 \gdefchar^^d8{\v R}
10097 \gdefchar^^d9{\ringaccent U}
10098 \gdefchar^^da{\'U}
10099 \gdefchar^^db{\H U}
10100 \gdefchar^^dc{\"U}
10101 \gdefchar^^dd{\'Y}
10102 \gdefchar^^de{\cedilla T}
10103 \gdefchar^^df{\ss}
10104 %
10105 \gdefchar^^e0{\'r}
10106 \gdefchar^^e1{\'a}
10107 \gdefchar^^e2{\^a}
10108 \gdefchar^^e3{\u a}
10109 \gdefchar^^e4{\"a}
10110 \gdefchar^^e5{\'l}
10111 \gdefchar^^e6{\'c}
10112 \gdefchar^^e7{\cedilla c}
10113 \gdefchar^^e8{\v c}
10114 \gdefchar^^e9{\'e}
10115 \gdefchar^^ea{\ogonek{e}}
10116 \gdefchar^^eb{\"e}
10117 \gdefchar^^ec{\v e}
10118 \gdefchar^^ed{\'{\dotless{i}}}
10119 \gdefchar^^ee{\^{\dotless{i}}}
10120 \gdefchar^^ef{\v d}
10121 %
10122 \gdefchar^^f0{\dh}
10123 \gdefchar^^f1{\'n}
10124 \gdefchar^^f2{\v n}
10125 \gdefchar^^f3{\'o}
10126 \gdefchar^^f4{\^o}
10127 \gdefchar^^f5{\H o}
10128 \gdefchar^^f6{\"o}
10129 \gdefchar^^f7{$\div$}
10130 \gdefchar^^f8{\v r}
10131 \gdefchar^^f9{\ringaccent u}
10132 \gdefchar^^fa{\'u}
10133 \gdefchar^^fb{\H u}
10134 \gdefchar^^fc{\"u}
10135 \gdefchar^^fd{\'y}
10136 \gdefchar^^fe{\cedilla t}
10137 \gdefchar^^ff{\dotaccent{}}
10138 }
10139
10140 \endgroup % active chars
10141
10142 % UTF-8 character definitions.
10143 %
10144 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10145 % changes for Texinfo conventions. It is included here under the GPL by
10146 % permission from Frank Mittelbach and the LaTeX team.
10147 %
10148 \newcount\countUTFx
10149 \newcount\countUTFy
10150 \newcount\countUTFz
10151
10152 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10153 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10154 %
10155 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10156 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10157 %
10158 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10159 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10160
10161 \gdef\UTFviiiDefined#1{%
10162 \ifx #1\relax
10163 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10164 \else
10165 \expandafter #1%
10166 \fi
10167 }
10168
10169 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10170 \begingroup
10171 \catcode`\~13
10172 \catcode`\$12
10173 \catcode`\"12
10174
10175 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10176 % substituting ~ and $ with a character token of that value.
10177 \def\UTFviiiLoop{%
10178 \global\catcode\countUTFx\active
10179 \uccode`\~\countUTFx
10180 \uccode`\$\countUTFx
10181 \uppercase\expandafter{\UTFviiiTmp}%
10182 \advance\countUTFx by 1
10183 \ifnum\countUTFx < \countUTFy
10184 \expandafter\UTFviiiLoop
10185 \fi}
10186
10187 % For bytes other than the first in a UTF-8 sequence. Not expected to
10188 % be expanded except when writing to auxiliary files.
10189 \countUTFx = "80
10190 \countUTFy = "C2
10191 \def\UTFviiiTmp{%
10192 \gdef~{%
10193 \ifpassthroughchars $\fi}}%
10194 \UTFviiiLoop
10195
10196 \countUTFx = "C2
10197 \countUTFy = "E0
10198 \def\UTFviiiTmp{%
10199 \gdef~{%
10200 \ifpassthroughchars $%
10201 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10202 \UTFviiiLoop
10203
10204 \countUTFx = "E0
10205 \countUTFy = "F0
10206 \def\UTFviiiTmp{%
10207 \gdef~{%
10208 \ifpassthroughchars $%
10209 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10210 \UTFviiiLoop
10211
10212 \countUTFx = "F0
10213 \countUTFy = "F4
10214 \def\UTFviiiTmp{%
10215 \gdef~{%
10216 \ifpassthroughchars $%
10217 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10218 }}%
10219 \UTFviiiLoop
10220 \endgroup
10221
10222 \def\globallet{\global\let} % save some \expandafter's below
10223
10224 % @U{xxxx} to produce U+xxxx, if we support it.
10225 \def\U#1{%
10226 \expandafter\ifx\csname uni:#1\endcsname \relax
10227 \iftxinativeunicodecapable
10228 % All Unicode characters can be used if native Unicode handling is
10229 % active. However, if the font does not have the glyph,
10230 % letters are missing.
10231 \begingroup
10232 \uccode`\.="#1\relax
10233 \uppercase{.}
10234 \endgroup
10235 \else
10236 \errhelp = \EMsimple
10237 \errmessage{Unicode character U+#1 not supported, sorry}%
10238 \fi
10239 \else
10240 \csname uni:#1\endcsname
10241 \fi
10242 }
10243
10244 % These macros are used here to construct the name of a control
10245 % sequence to be defined.
10246 \def\UTFviiiTwoOctetsName#1#2{%
10247 \csname u8:#1\string #2\endcsname}%
10248 \def\UTFviiiThreeOctetsName#1#2#3{%
10249 \csname u8:#1\string #2\string #3\endcsname}%
10250 \def\UTFviiiFourOctetsName#1#2#3#4{%
10251 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10252
10253 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10254 % provide a definition macro to replace a Unicode character;
10255 % this gets used by the @U command
10256 %
10257 \begingroup
10258 \catcode`\"=12
10259 \catcode`\<=12
10260 \catcode`\.=12
10261 \catcode`\,=12
10262 \catcode`\;=12
10263 \catcode`\!=12
10264 \catcode`\~=13
10265 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10266 \countUTFz = "#1\relax
10267 \begingroup
10268 \parseXMLCharref
10269
10270 % Give \u8:... its definition. The sequence of seven \expandafter's
10271 % expands after the \gdef three times, e.g.
10272 %
10273 % 1. \UTFviiTwoOctetsName B1 B2
10274 % 2. \csname u8:B1 \string B2 \endcsname
10275 % 3. \u8: B1 B2 (a single control sequence token)
10276 %
10277 \expandafter\expandafter
10278 \expandafter\expandafter
10279 \expandafter\expandafter
10280 \expandafter\gdef \UTFviiiTmp{#2}%
10281 %
10282 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10283 \message{Internal error, already defined: #1}%
10284 \fi
10285 %
10286 % define an additional control sequence for this code point.
10287 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10288 \endgroup}
10289 %
10290 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10291 % to the corresponding UTF-8 sequence.
10292 \gdef\parseXMLCharref{%
10293 \ifnum\countUTFz < "20\relax
10294 \errhelp = \EMsimple
10295 \errmessage{Cannot define Unicode char value < 0020}%
10296 \else\ifnum\countUTFz < "800\relax
10297 \parseUTFviiiA,%
10298 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10299 \else\ifnum\countUTFz < "10000\relax
10300 \parseUTFviiiA;%
10301 \parseUTFviiiA,%
10302 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10303 \else
10304 \parseUTFviiiA;%
10305 \parseUTFviiiA,%
10306 \parseUTFviiiA!%
10307 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10308 \fi\fi\fi
10309 }
10310
10311 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10312 % It must be a non-initial byte in the sequence.
10313 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10314 % of the bytes.
10315 \gdef\parseUTFviiiA#1{%
10316 \countUTFx = \countUTFz
10317 \divide\countUTFz by 64
10318 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10319 \multiply\countUTFz by 64
10320
10321 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10322 % in order to get the last five bits.
10323 \advance\countUTFx by -\countUTFz
10324
10325 % Convert this to the byte in the UTF-8 sequence.
10326 \advance\countUTFx by 128
10327 \uccode `#1\countUTFx
10328 \countUTFz = \countUTFy}
10329
10330 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10331 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10332 % sequence.
10333 % #2 is one of the \UTFviii*OctetsName macros.
10334 % #3 is always a full stop (.)
10335 % #4 is a template for the other bytes in the sequence. The values for these
10336 % bytes is substituted in here with \uppercase using the \uccode's.
10337 \gdef\parseUTFviiiB#1#2#3#4{%
10338 \advance\countUTFz by "#10\relax
10339 \uccode `#3\countUTFz
10340 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10341 \endgroup
10342
10343 % For native Unicode handling (XeTeX and LuaTeX),
10344 % provide a definition macro that sets a catcode to `other' non-globally
10345 %
10346 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10347 \catcode"#1=\other
10348 }
10349
10350 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10351 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10352 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10353 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10354 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10355 %
10356 % Many of our renditions are less than wonderful, and all the missing
10357 % characters are available somewhere. Loading the necessary fonts
10358 % awaits user request. We can't truly support Unicode without
10359 % reimplementing everything that's been done in LaTeX for many years,
10360 % plus probably using luatex or xetex, and who knows what else.
10361 % We won't be doing that here in this simple file. But we can try to at
10362 % least make most of the characters not bomb out.
10363 %
10364 \def\unicodechardefs{%
10365 \DeclareUnicodeCharacter{0020}{ } % space
10366 \DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number
10367 \DeclareUnicodeCharacter{0022}{\char"22 }%
10368 \DeclareUnicodeCharacter{0023}{\char"23 }%
10369 \DeclareUnicodeCharacter{0024}{\char"24 }%
10370 \DeclareUnicodeCharacter{0025}{\char"25 }%
10371 \DeclareUnicodeCharacter{0026}{\char"26 }%
10372 \DeclareUnicodeCharacter{0027}{\char"27 }%
10373 \DeclareUnicodeCharacter{0028}{\char"28 }%
10374 \DeclareUnicodeCharacter{0029}{\char"29 }%
10375 \DeclareUnicodeCharacter{002A}{\char"2A }%
10376 \DeclareUnicodeCharacter{002B}{\char"2B }%
10377 \DeclareUnicodeCharacter{002C}{\char"2C }%
10378 \DeclareUnicodeCharacter{002D}{\char"2D }%
10379 \DeclareUnicodeCharacter{002E}{\char"2E }%
10380 \DeclareUnicodeCharacter{002F}{\char"2F }%
10381 \DeclareUnicodeCharacter{0030}{0}%
10382 \DeclareUnicodeCharacter{0031}{1}%
10383 \DeclareUnicodeCharacter{0032}{2}%
10384 \DeclareUnicodeCharacter{0033}{3}%
10385 \DeclareUnicodeCharacter{0034}{4}%
10386 \DeclareUnicodeCharacter{0035}{5}%
10387 \DeclareUnicodeCharacter{0036}{6}%
10388 \DeclareUnicodeCharacter{0037}{7}%
10389 \DeclareUnicodeCharacter{0038}{8}%
10390 \DeclareUnicodeCharacter{0039}{9}%
10391 \DeclareUnicodeCharacter{003A}{\char"3A }%
10392 \DeclareUnicodeCharacter{003B}{\char"3B }%
10393 \DeclareUnicodeCharacter{003C}{\char"3C }%
10394 \DeclareUnicodeCharacter{003D}{\char"3D }%
10395 \DeclareUnicodeCharacter{003E}{\char"3E }%
10396 \DeclareUnicodeCharacter{003F}{\char"3F }%
10397 \DeclareUnicodeCharacter{0040}{\char"40 }%
10398 \DeclareUnicodeCharacter{0041}{A}%
10399 \DeclareUnicodeCharacter{0042}{B}%
10400 \DeclareUnicodeCharacter{0043}{C}%
10401 \DeclareUnicodeCharacter{0044}{D}%
10402 \DeclareUnicodeCharacter{0045}{E}%
10403 \DeclareUnicodeCharacter{0046}{F}%
10404 \DeclareUnicodeCharacter{0047}{G}%
10405 \DeclareUnicodeCharacter{0048}{H}%
10406 \DeclareUnicodeCharacter{0049}{I}%
10407 \DeclareUnicodeCharacter{004A}{J}%
10408 \DeclareUnicodeCharacter{004B}{K}%
10409 \DeclareUnicodeCharacter{004C}{L}%
10410 \DeclareUnicodeCharacter{004D}{M}%
10411 \DeclareUnicodeCharacter{004E}{N}%
10412 \DeclareUnicodeCharacter{004F}{O}%
10413 \DeclareUnicodeCharacter{0050}{P}%
10414 \DeclareUnicodeCharacter{0051}{Q}%
10415 \DeclareUnicodeCharacter{0052}{R}%
10416 \DeclareUnicodeCharacter{0053}{S}%
10417 \DeclareUnicodeCharacter{0054}{T}%
10418 \DeclareUnicodeCharacter{0055}{U}%
10419 \DeclareUnicodeCharacter{0056}{V}%
10420 \DeclareUnicodeCharacter{0057}{W}%
10421 \DeclareUnicodeCharacter{0058}{X}%
10422 \DeclareUnicodeCharacter{0059}{Y}%
10423 \DeclareUnicodeCharacter{005A}{Z}%
10424 \DeclareUnicodeCharacter{005B}{\char"5B }%
10425 \DeclareUnicodeCharacter{005C}{\char"5C }%
10426 \DeclareUnicodeCharacter{005D}{\char"5D }%
10427 \DeclareUnicodeCharacter{005E}{\char"5E }%
10428 \DeclareUnicodeCharacter{005F}{\char"5F }%
10429 \DeclareUnicodeCharacter{0060}{\char"60 }%
10430 \DeclareUnicodeCharacter{0061}{a}%
10431 \DeclareUnicodeCharacter{0062}{b}%
10432 \DeclareUnicodeCharacter{0063}{c}%
10433 \DeclareUnicodeCharacter{0064}{d}%
10434 \DeclareUnicodeCharacter{0065}{e}%
10435 \DeclareUnicodeCharacter{0066}{f}%
10436 \DeclareUnicodeCharacter{0067}{g}%
10437 \DeclareUnicodeCharacter{0068}{h}%
10438 \DeclareUnicodeCharacter{0069}{i}%
10439 \DeclareUnicodeCharacter{006A}{j}%
10440 \DeclareUnicodeCharacter{006B}{k}%
10441 \DeclareUnicodeCharacter{006C}{l}%
10442 \DeclareUnicodeCharacter{006D}{m}%
10443 \DeclareUnicodeCharacter{006E}{n}%
10444 \DeclareUnicodeCharacter{006F}{o}%
10445 \DeclareUnicodeCharacter{0070}{p}%
10446 \DeclareUnicodeCharacter{0071}{q}%
10447 \DeclareUnicodeCharacter{0072}{r}%
10448 \DeclareUnicodeCharacter{0073}{s}%
10449 \DeclareUnicodeCharacter{0074}{t}%
10450 \DeclareUnicodeCharacter{0075}{u}%
10451 \DeclareUnicodeCharacter{0076}{v}%
10452 \DeclareUnicodeCharacter{0077}{w}%
10453 \DeclareUnicodeCharacter{0078}{x}%
10454 \DeclareUnicodeCharacter{0079}{y}%
10455 \DeclareUnicodeCharacter{007A}{z}%
10456 \DeclareUnicodeCharacter{007B}{\char"7B }%
10457 \DeclareUnicodeCharacter{007C}{\char"7C }%
10458 \DeclareUnicodeCharacter{007D}{\char"7D }%
10459 \DeclareUnicodeCharacter{007E}{\char"7E }%
10460 % \DeclareUnicodeCharacter{007F}{} % DEL
10461 %
10462 \DeclareUnicodeCharacter{00A0}{\tie}%
10463 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10464 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10465 \DeclareUnicodeCharacter{00A3}{\pounds{}}%
10466 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10467 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10468 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10469 \DeclareUnicodeCharacter{00A7}{\S}%
10470 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10471 \DeclareUnicodeCharacter{00A9}{\copyright{}}%
10472 \DeclareUnicodeCharacter{00AA}{\ordf}%
10473 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
10474 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10475 \DeclareUnicodeCharacter{00AD}{\-}%
10476 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
10477 \DeclareUnicodeCharacter{00AF}{\={ }}%
10478 %
10479 \DeclareUnicodeCharacter{00B0}{\textdegree}%
10480 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10481 \DeclareUnicodeCharacter{00B2}{$^2$}%
10482 \DeclareUnicodeCharacter{00B3}{$^3$}%
10483 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10484 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10485 \DeclareUnicodeCharacter{00B6}{\P}%
10486 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10487 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10488 \DeclareUnicodeCharacter{00B9}{$^1$}%
10489 \DeclareUnicodeCharacter{00BA}{\ordm}%
10490 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
10491 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10492 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10493 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10494 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10495 %
10496 \DeclareUnicodeCharacter{00C0}{\`A}%
10497 \DeclareUnicodeCharacter{00C1}{\'A}%
10498 \DeclareUnicodeCharacter{00C2}{\^A}%
10499 \DeclareUnicodeCharacter{00C3}{\~A}%
10500 \DeclareUnicodeCharacter{00C4}{\"A}%
10501 \DeclareUnicodeCharacter{00C5}{\AA}%
10502 \DeclareUnicodeCharacter{00C6}{\AE}%
10503 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10504 \DeclareUnicodeCharacter{00C8}{\`E}%
10505 \DeclareUnicodeCharacter{00C9}{\'E}%
10506 \DeclareUnicodeCharacter{00CA}{\^E}%
10507 \DeclareUnicodeCharacter{00CB}{\"E}%
10508 \DeclareUnicodeCharacter{00CC}{\`I}%
10509 \DeclareUnicodeCharacter{00CD}{\'I}%
10510 \DeclareUnicodeCharacter{00CE}{\^I}%
10511 \DeclareUnicodeCharacter{00CF}{\"I}%
10512 %
10513 \DeclareUnicodeCharacter{00D0}{\DH}%
10514 \DeclareUnicodeCharacter{00D1}{\~N}%
10515 \DeclareUnicodeCharacter{00D2}{\`O}%
10516 \DeclareUnicodeCharacter{00D3}{\'O}%
10517 \DeclareUnicodeCharacter{00D4}{\^O}%
10518 \DeclareUnicodeCharacter{00D5}{\~O}%
10519 \DeclareUnicodeCharacter{00D6}{\"O}%
10520 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10521 \DeclareUnicodeCharacter{00D8}{\O}%
10522 \DeclareUnicodeCharacter{00D9}{\`U}%
10523 \DeclareUnicodeCharacter{00DA}{\'U}%
10524 \DeclareUnicodeCharacter{00DB}{\^U}%
10525 \DeclareUnicodeCharacter{00DC}{\"U}%
10526 \DeclareUnicodeCharacter{00DD}{\'Y}%
10527 \DeclareUnicodeCharacter{00DE}{\TH}%
10528 \DeclareUnicodeCharacter{00DF}{\ss}%
10529 %
10530 \DeclareUnicodeCharacter{00E0}{\`a}%
10531 \DeclareUnicodeCharacter{00E1}{\'a}%
10532 \DeclareUnicodeCharacter{00E2}{\^a}%
10533 \DeclareUnicodeCharacter{00E3}{\~a}%
10534 \DeclareUnicodeCharacter{00E4}{\"a}%
10535 \DeclareUnicodeCharacter{00E5}{\aa}%
10536 \DeclareUnicodeCharacter{00E6}{\ae}%
10537 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10538 \DeclareUnicodeCharacter{00E8}{\`e}%
10539 \DeclareUnicodeCharacter{00E9}{\'e}%
10540 \DeclareUnicodeCharacter{00EA}{\^e}%
10541 \DeclareUnicodeCharacter{00EB}{\"e}%
10542 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10543 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10544 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10545 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10546 %
10547 \DeclareUnicodeCharacter{00F0}{\dh}%
10548 \DeclareUnicodeCharacter{00F1}{\~n}%
10549 \DeclareUnicodeCharacter{00F2}{\`o}%
10550 \DeclareUnicodeCharacter{00F3}{\'o}%
10551 \DeclareUnicodeCharacter{00F4}{\^o}%
10552 \DeclareUnicodeCharacter{00F5}{\~o}%
10553 \DeclareUnicodeCharacter{00F6}{\"o}%
10554 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10555 \DeclareUnicodeCharacter{00F8}{\o}%
10556 \DeclareUnicodeCharacter{00F9}{\`u}%
10557 \DeclareUnicodeCharacter{00FA}{\'u}%
10558 \DeclareUnicodeCharacter{00FB}{\^u}%
10559 \DeclareUnicodeCharacter{00FC}{\"u}%
10560 \DeclareUnicodeCharacter{00FD}{\'y}%
10561 \DeclareUnicodeCharacter{00FE}{\th}%
10562 \DeclareUnicodeCharacter{00FF}{\"y}%
10563 %
10564 \DeclareUnicodeCharacter{0100}{\=A}%
10565 \DeclareUnicodeCharacter{0101}{\=a}%
10566 \DeclareUnicodeCharacter{0102}{\u{A}}%
10567 \DeclareUnicodeCharacter{0103}{\u{a}}%
10568 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10569 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10570 \DeclareUnicodeCharacter{0106}{\'C}%
10571 \DeclareUnicodeCharacter{0107}{\'c}%
10572 \DeclareUnicodeCharacter{0108}{\^C}%
10573 \DeclareUnicodeCharacter{0109}{\^c}%
10574 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10575 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10576 \DeclareUnicodeCharacter{010C}{\v{C}}%
10577 \DeclareUnicodeCharacter{010D}{\v{c}}%
10578 \DeclareUnicodeCharacter{010E}{\v{D}}%
10579 \DeclareUnicodeCharacter{010F}{d'}%
10580 %
10581 \DeclareUnicodeCharacter{0110}{\DH}%
10582 \DeclareUnicodeCharacter{0111}{\dh}%
10583 \DeclareUnicodeCharacter{0112}{\=E}%
10584 \DeclareUnicodeCharacter{0113}{\=e}%
10585 \DeclareUnicodeCharacter{0114}{\u{E}}%
10586 \DeclareUnicodeCharacter{0115}{\u{e}}%
10587 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10588 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10589 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10590 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10591 \DeclareUnicodeCharacter{011A}{\v{E}}%
10592 \DeclareUnicodeCharacter{011B}{\v{e}}%
10593 \DeclareUnicodeCharacter{011C}{\^G}%
10594 \DeclareUnicodeCharacter{011D}{\^g}%
10595 \DeclareUnicodeCharacter{011E}{\u{G}}%
10596 \DeclareUnicodeCharacter{011F}{\u{g}}%
10597 %
10598 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10599 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10600 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10601 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10602 \DeclareUnicodeCharacter{0124}{\^H}%
10603 \DeclareUnicodeCharacter{0125}{\^h}%
10604 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10605 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10606 \DeclareUnicodeCharacter{0128}{\~I}%
10607 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10608 \DeclareUnicodeCharacter{012A}{\=I}%
10609 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10610 \DeclareUnicodeCharacter{012C}{\u{I}}%
10611 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10612 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10613 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10614 %
10615 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10616 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10617 \DeclareUnicodeCharacter{0132}{IJ}%
10618 \DeclareUnicodeCharacter{0133}{ij}%
10619 \DeclareUnicodeCharacter{0134}{\^J}%
10620 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10621 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10622 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10623 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10624 \DeclareUnicodeCharacter{0139}{\'L}%
10625 \DeclareUnicodeCharacter{013A}{\'l}%
10626 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10627 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10628 \DeclareUnicodeCharacter{013D}{L'}% should kern
10629 \DeclareUnicodeCharacter{013E}{l'}% should kern
10630 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10631 %
10632 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10633 \DeclareUnicodeCharacter{0141}{\L}%
10634 \DeclareUnicodeCharacter{0142}{\l}%
10635 \DeclareUnicodeCharacter{0143}{\'N}%
10636 \DeclareUnicodeCharacter{0144}{\'n}%
10637 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10638 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10639 \DeclareUnicodeCharacter{0147}{\v{N}}%
10640 \DeclareUnicodeCharacter{0148}{\v{n}}%
10641 \DeclareUnicodeCharacter{0149}{'n}%
10642 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10643 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10644 \DeclareUnicodeCharacter{014C}{\=O}%
10645 \DeclareUnicodeCharacter{014D}{\=o}%
10646 \DeclareUnicodeCharacter{014E}{\u{O}}%
10647 \DeclareUnicodeCharacter{014F}{\u{o}}%
10648 %
10649 \DeclareUnicodeCharacter{0150}{\H{O}}%
10650 \DeclareUnicodeCharacter{0151}{\H{o}}%
10651 \DeclareUnicodeCharacter{0152}{\OE}%
10652 \DeclareUnicodeCharacter{0153}{\oe}%
10653 \DeclareUnicodeCharacter{0154}{\'R}%
10654 \DeclareUnicodeCharacter{0155}{\'r}%
10655 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10656 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10657 \DeclareUnicodeCharacter{0158}{\v{R}}%
10658 \DeclareUnicodeCharacter{0159}{\v{r}}%
10659 \DeclareUnicodeCharacter{015A}{\'S}%
10660 \DeclareUnicodeCharacter{015B}{\'s}%
10661 \DeclareUnicodeCharacter{015C}{\^S}%
10662 \DeclareUnicodeCharacter{015D}{\^s}%
10663 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10664 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10665 %
10666 \DeclareUnicodeCharacter{0160}{\v{S}}%
10667 \DeclareUnicodeCharacter{0161}{\v{s}}%
10668 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10669 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10670 \DeclareUnicodeCharacter{0164}{\v{T}}%
10671 \DeclareUnicodeCharacter{0165}{\v{t}}%
10672 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10673 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10674 \DeclareUnicodeCharacter{0168}{\~U}%
10675 \DeclareUnicodeCharacter{0169}{\~u}%
10676 \DeclareUnicodeCharacter{016A}{\=U}%
10677 \DeclareUnicodeCharacter{016B}{\=u}%
10678 \DeclareUnicodeCharacter{016C}{\u{U}}%
10679 \DeclareUnicodeCharacter{016D}{\u{u}}%
10680 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10681 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10682 %
10683 \DeclareUnicodeCharacter{0170}{\H{U}}%
10684 \DeclareUnicodeCharacter{0171}{\H{u}}%
10685 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10686 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10687 \DeclareUnicodeCharacter{0174}{\^W}%
10688 \DeclareUnicodeCharacter{0175}{\^w}%
10689 \DeclareUnicodeCharacter{0176}{\^Y}%
10690 \DeclareUnicodeCharacter{0177}{\^y}%
10691 \DeclareUnicodeCharacter{0178}{\"Y}%
10692 \DeclareUnicodeCharacter{0179}{\'Z}%
10693 \DeclareUnicodeCharacter{017A}{\'z}%
10694 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10695 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10696 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10697 \DeclareUnicodeCharacter{017E}{\v{z}}%
10698 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10699 %
10700 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10701 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10702 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10703 \DeclareUnicodeCharacter{01C7}{LJ}%
10704 \DeclareUnicodeCharacter{01C8}{Lj}%
10705 \DeclareUnicodeCharacter{01C9}{lj}%
10706 \DeclareUnicodeCharacter{01CA}{NJ}%
10707 \DeclareUnicodeCharacter{01CB}{Nj}%
10708 \DeclareUnicodeCharacter{01CC}{nj}%
10709 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10710 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10711 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10712 %
10713 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10714 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10715 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10716 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10717 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10718 %
10719 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10720 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10721 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10722 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10723 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10724 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10725 %
10726 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10727 \DeclareUnicodeCharacter{01F1}{DZ}%
10728 \DeclareUnicodeCharacter{01F2}{Dz}%
10729 \DeclareUnicodeCharacter{01F3}{dz}%
10730 \DeclareUnicodeCharacter{01F4}{\'G}%
10731 \DeclareUnicodeCharacter{01F5}{\'g}%
10732 \DeclareUnicodeCharacter{01F8}{\`N}%
10733 \DeclareUnicodeCharacter{01F9}{\`n}%
10734 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10735 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10736 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10737 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10738 %
10739 \DeclareUnicodeCharacter{021E}{\v{H}}%
10740 \DeclareUnicodeCharacter{021F}{\v{h}}%
10741 %
10742 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10743 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10744 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10745 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10746 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10747 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10748 %
10749 \DeclareUnicodeCharacter{0232}{\=Y}%
10750 \DeclareUnicodeCharacter{0233}{\=y}%
10751 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10752 %
10753 \DeclareUnicodeCharacter{02BC}{'}%
10754 %
10755 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10756 %
10757 % Greek letters upper case
10758 \DeclareUnicodeCharacter{0391}{{\it A}}%
10759 \DeclareUnicodeCharacter{0392}{{\it B}}%
10760 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10761 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10762 \DeclareUnicodeCharacter{0395}{{\it E}}%
10763 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10764 \DeclareUnicodeCharacter{0397}{{\it H}}%
10765 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10766 \DeclareUnicodeCharacter{0399}{{\it I}}%
10767 \DeclareUnicodeCharacter{039A}{{\it K}}%
10768 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10769 \DeclareUnicodeCharacter{039C}{{\it M}}%
10770 \DeclareUnicodeCharacter{039D}{{\it N}}%
10771 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10772 \DeclareUnicodeCharacter{039F}{{\it O}}%
10773 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10774 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10775 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10776 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10777 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10778 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10779 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10780 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10781 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10782 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10783 %
10784 % Vowels with accents
10785 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10786 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10787 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10788 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10789 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10790 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10791 %
10792 % Standalone accent
10793 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10794 %
10795 % Greek letters lower case
10796 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10797 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10798 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10799 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10800 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10801 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10802 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10803 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10804 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10805 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10806 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10807 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10808 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10809 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10810 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10811 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10812 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10813 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10814 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10815 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10816 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10817 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10818 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10819 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10820 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10821 %
10822 % More Greek vowels with accents
10823 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10824 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10825 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10826 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10827 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10828 %
10829 % Variant Greek letters
10830 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10831 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10832 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10833 %
10834 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10835 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10836 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10837 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10838 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10839 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10840 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10841 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10842 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10843 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10844 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10845 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10846 %
10847 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10848 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10849 %
10850 \DeclareUnicodeCharacter{1E20}{\=G}%
10851 \DeclareUnicodeCharacter{1E21}{\=g}%
10852 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10853 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10854 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10855 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10856 \DeclareUnicodeCharacter{1E26}{\"H}%
10857 \DeclareUnicodeCharacter{1E27}{\"h}%
10858 %
10859 \DeclareUnicodeCharacter{1E30}{\'K}%
10860 \DeclareUnicodeCharacter{1E31}{\'k}%
10861 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10862 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10863 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10864 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10865 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10866 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10867 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10868 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10869 \DeclareUnicodeCharacter{1E3E}{\'M}%
10870 \DeclareUnicodeCharacter{1E3F}{\'m}%
10871 %
10872 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10873 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10874 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10875 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10876 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10877 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10878 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10879 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10880 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10881 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10882 %
10883 \DeclareUnicodeCharacter{1E54}{\'P}%
10884 \DeclareUnicodeCharacter{1E55}{\'p}%
10885 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10886 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10887 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10888 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10889 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10890 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10891 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10892 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10893 %
10894 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10895 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10896 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10897 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10898 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10899 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10900 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10901 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10902 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10903 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10904 %
10905 \DeclareUnicodeCharacter{1E7C}{\~V}%
10906 \DeclareUnicodeCharacter{1E7D}{\~v}%
10907 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10908 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10909 %
10910 \DeclareUnicodeCharacter{1E80}{\`W}%
10911 \DeclareUnicodeCharacter{1E81}{\`w}%
10912 \DeclareUnicodeCharacter{1E82}{\'W}%
10913 \DeclareUnicodeCharacter{1E83}{\'w}%
10914 \DeclareUnicodeCharacter{1E84}{\"W}%
10915 \DeclareUnicodeCharacter{1E85}{\"w}%
10916 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10917 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10918 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10919 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10920 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10921 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10922 \DeclareUnicodeCharacter{1E8C}{\"X}%
10923 \DeclareUnicodeCharacter{1E8D}{\"x}%
10924 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10925 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10926 %
10927 \DeclareUnicodeCharacter{1E90}{\^Z}%
10928 \DeclareUnicodeCharacter{1E91}{\^z}%
10929 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10930 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10931 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10932 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
10933 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
10934 \DeclareUnicodeCharacter{1E97}{\"t}%
10935 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
10936 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
10937 %
10938 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
10939 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
10940 %
10941 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
10942 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
10943 \DeclareUnicodeCharacter{1EBC}{\~E}%
10944 \DeclareUnicodeCharacter{1EBD}{\~e}%
10945 %
10946 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
10947 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
10948 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
10949 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
10950 %
10951 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
10952 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
10953 %
10954 \DeclareUnicodeCharacter{1EF2}{\`Y}%
10955 \DeclareUnicodeCharacter{1EF3}{\`y}%
10956 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
10957 %
10958 \DeclareUnicodeCharacter{1EF8}{\~Y}%
10959 \DeclareUnicodeCharacter{1EF9}{\~y}%
10960 %
10961 % Exotic spaces
10962 \DeclareUnicodeCharacter{2007}{\hphantom{0}}%
10963 %
10964 % Punctuation
10965 \DeclareUnicodeCharacter{2013}{--}%
10966 \DeclareUnicodeCharacter{2014}{---}%
10967 \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
10968 \DeclareUnicodeCharacter{2019}{\quoteright{}}%
10969 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
10970 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
10971 \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
10972 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
10973 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
10974 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
10975 \DeclareUnicodeCharacter{2022}{\bullet{}}%
10976 \DeclareUnicodeCharacter{202F}{\thinspace}%
10977 \DeclareUnicodeCharacter{2026}{\dots{}}%
10978 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
10979 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
10980 %
10981 \DeclareUnicodeCharacter{20AC}{\euro{}}%
10982 %
10983 \DeclareUnicodeCharacter{2192}{\arrow}%
10984 \DeclareUnicodeCharacter{21D2}{\result{}}%
10985 %
10986 % Mathematical symbols
10987 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
10988 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
10989 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
10990 \DeclareUnicodeCharacter{2212}{\minus{}}%
10991 \DeclareUnicodeCharacter{2217}{\ast}%
10992 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
10993 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
10994 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
10995 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
10996 \DeclareUnicodeCharacter{2261}{\equiv{}}%
10997 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
10998 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
10999 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
11000 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
11001 %
11002 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
11003 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
11004 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
11005 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
11006 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
11007 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
11008 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
11009 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11010 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11011 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11012 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11013 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11014 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11015 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11016 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11017 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11018 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11019 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11020 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11021 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11022 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11023 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11024 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11025 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11026 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11027 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11028 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11029 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11030 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11031 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11032 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11033 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11034 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11035 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11036 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11037 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11038 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11039 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11040 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11041 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11042 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11043 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11044 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11045 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11046 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11047 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11048 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11049 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11050 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11051 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11052 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11053 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11054 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11055 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11056 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11057 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11058 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11059 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11060 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11061 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11062 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11063 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11064 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11065 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11066 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11067 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11068 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11069 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11070 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11071 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11072 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11073 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11074 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11075 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11076 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11077 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11078 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11079 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11080 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11081 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11082 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11083 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11084 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11085 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11086 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11087 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11088 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11089 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11090 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11091 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11092 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11093 %
11094 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11095 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11096 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11097 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11098 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
11099 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11100 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11101 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11102 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11103 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11104 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11105 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11106 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11107 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11108 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11109 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11110 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11111 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11112 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11113 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11114 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11115 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11116 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11117 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11118 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11119 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11120 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11121 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11122 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11123 %
11124 \global\mathchardef\checkmark="1370% actually the square root sign
11125 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11126 }% end of \unicodechardefs
11127
11128 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11129 % It makes the setting that replace UTF-8 byte sequence.
11130 \def\utfeightchardefs{%
11131 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11132 \unicodechardefs
11133 }
11134
11135 % Whether the active definitions of non-ASCII characters expand to
11136 % non-active tokens with the same character code. This is used to
11137 % write characters literally, instead of using active definitions for
11138 % printing the correct glyphs.
11139 \newif\ifpassthroughchars
11140 \passthroughcharsfalse
11141
11142 % For native Unicode handling (XeTeX and LuaTeX),
11143 % provide a definition macro to replace/pass-through a Unicode character
11144 %
11145 \def\DeclareUnicodeCharacterNative#1#2{%
11146 \ifnum"#1>"7F % only make non-ASCII chars active
11147 \catcode"#1=\active
11148 \def\dodeclareunicodecharacternative##1##2##3{%
11149 \begingroup
11150 \uccode`\~="##2\relax
11151 \uppercase{\gdef~}{%
11152 \ifpassthroughchars
11153 ##1%
11154 \else
11155 ##3%
11156 \fi
11157 }
11158 \endgroup
11159 }
11160 \begingroup
11161 \uccode`\.="#1\relax
11162 \uppercase{\def\UTFNativeTmp{.}}%
11163 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11164 \endgroup
11165 \fi
11166 }
11167
11168 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11169 % It activates the setting that replaces Unicode characters.
11170 \def\nativeunicodechardefs{%
11171 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11172 \unicodechardefs
11173 }
11174
11175 % For native Unicode handling (XeTeX and LuaTeX),
11176 % make the character token expand
11177 % to the sequences given in \unicodechardefs for printing.
11178 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11179 \def\UTFAtUTmp{#2}
11180 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11181 }
11182
11183 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11184 \def\nativeunicodechardefsatu{%
11185 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11186 \unicodechardefs
11187 }
11188
11189 % US-ASCII character definitions.
11190 \def\asciichardefs{% nothing need be done
11191 \relax
11192 }
11193
11194 % Define all Unicode characters we know about
11195 \iftxinativeunicodecapable
11196 \nativeunicodechardefsatu
11197 \else
11198 \utfeightchardefs
11199 \fi
11200
11201
11202 \message{formatting,}
11203
11204 \newdimen\defaultparindent \defaultparindent = 15pt
11205
11206 \chapheadingskip = 15pt plus 4pt minus 2pt
11207 \secheadingskip = 12pt plus 3pt minus 2pt
11208 \subsecheadingskip = 9pt plus 2pt minus 2pt
11209
11210 % Prevent underfull vbox error messages.
11211 \vbadness = 10000
11212
11213 % Don't be very finicky about underfull hboxes, either.
11214 \hbadness = 6666
11215
11216 % Following George Bush, get rid of widows and orphans.
11217 \widowpenalty=10000
11218 \clubpenalty=10000
11219
11220 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11221 % using an old version of TeX, don't do anything. We want the amount of
11222 % stretch added to depend on the line length, hence the dependence on
11223 % \hsize. We call this whenever the paper size is set.
11224 %
11225 \def\setemergencystretch{%
11226 \ifx\emergencystretch\thisisundefined
11227 % Allow us to assign to \emergencystretch anyway.
11228 \def\emergencystretch{\dimen0}%
11229 \else
11230 \emergencystretch = .15\hsize
11231 \fi
11232 }
11233
11234 % Parameters in order: 1) textheight; 2) textwidth;
11235 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11236 % 7) physical page height; 8) physical page width.
11237 %
11238 % We also call \setleading{\textleading}, so the caller should define
11239 % \textleading. The caller should also set \parskip.
11240 %
11241 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11242 \voffset = #3\relax
11243 \topskip = #6\relax
11244 \splittopskip = \topskip
11245 %
11246 \vsize = #1\relax
11247 \advance\vsize by \topskip
11248 \txipageheight = \vsize
11249 %
11250 \hsize = #2\relax
11251 \txipagewidth = \hsize
11252 %
11253 \normaloffset = #4\relax
11254 \bindingoffset = #5\relax
11255 %
11256 \ifpdf
11257 \pdfpageheight #7\relax
11258 \pdfpagewidth #8\relax
11259 % if we don't reset these, they will remain at "1 true in" of
11260 % whatever layout pdftex was dumped with.
11261 \pdfhorigin = 1 true in
11262 \pdfvorigin = 1 true in
11263 \else
11264 \ifx\XeTeXrevision\thisisundefined
11265 \special{papersize=#8,#7}%
11266 \else
11267 \pdfpageheight #7\relax
11268 \pdfpagewidth #8\relax
11269 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11270 \fi
11271 \fi
11272 %
11273 \setleading{\textleading}
11274 %
11275 \parindent = \defaultparindent
11276 \setemergencystretch
11277 }
11278
11279 % @letterpaper (the default).
11280 \def\letterpaper{{\globaldefs = 1
11281 \parskip = 3pt plus 2pt minus 1pt
11282 \textleading = 13.2pt
11283 %
11284 % If page is nothing but text, make it come out even.
11285 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11286 {\voffset}{.25in}%
11287 {\bindingoffset}{36pt}%
11288 {11in}{8.5in}%
11289 }}
11290
11291 % Use @smallbook to reset parameters for 7x9.25 trim size.
11292 \def\smallbook{{\globaldefs = 1
11293 \parskip = 2pt plus 1pt
11294 \textleading = 12pt
11295 %
11296 \internalpagesizes{7.5in}{5in}%
11297 {-.2in}{0in}%
11298 {\bindingoffset}{16pt}%
11299 {9.25in}{7in}%
11300 %
11301 \lispnarrowing = 0.3in
11302 \tolerance = 700
11303 \contentsrightmargin = 0pt
11304 \defbodyindent = .5cm
11305 }}
11306
11307 % Use @afourpaper to print on European A4 paper.
11308 \def\afourpaper{{\globaldefs = 1
11309 \parskip = 3pt plus 2pt minus 1pt
11310 \textleading = 13.2pt
11311 %
11312 % Double-side printing via postscript on Laserjet 4050
11313 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11314 % To change the settings for a different printer or situation, adjust
11315 % \normaloffset until the front-side and back-side texts align. Then
11316 % do the same for \bindingoffset. You can set these for testing in
11317 % your texinfo source file like this:
11318 % @tex
11319 % \global\normaloffset = -6mm
11320 % \global\bindingoffset = 10mm
11321 % @end tex
11322 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11323 {\voffset}{\hoffset}%
11324 {\bindingoffset}{44pt}%
11325 {297mm}{210mm}%
11326 %
11327 \tolerance = 700
11328 \contentsrightmargin = 0pt
11329 \defbodyindent = 5mm
11330 }}
11331
11332 % Use @afivepaper to print on European A5 paper.
11333 % From [email protected], 2 July 2000.
11334 % He also recommends making @example and @lisp be small.
11335 \def\afivepaper{{\globaldefs = 1
11336 \parskip = 2pt plus 1pt minus 0.1pt
11337 \textleading = 12.5pt
11338 %
11339 \internalpagesizes{160mm}{120mm}%
11340 {\voffset}{-11.4mm}%
11341 {\bindingoffset}{8pt}%
11342 {210mm}{148mm}%
11343 %
11344 \lispnarrowing = 0.2in
11345 \tolerance = 800
11346 \contentsrightmargin = 0pt
11347 \defbodyindent = 2mm
11348 \tableindent = 12mm
11349 }}
11350
11351 % A specific text layout, 24x15cm overall, intended for A4 paper.
11352 \def\afourlatex{{\globaldefs = 1
11353 \afourpaper
11354 \internalpagesizes{237mm}{150mm}%
11355 {\voffset}{4.6mm}%
11356 {\bindingoffset}{7mm}%
11357 {297mm}{210mm}%
11358 %
11359 % Must explicitly reset to 0 because we call \afourpaper.
11360 \globaldefs = 0
11361 }}
11362
11363 % Use @afourwide to print on A4 paper in landscape format.
11364 \def\afourwide{{\globaldefs = 1
11365 \afourpaper
11366 \internalpagesizes{241mm}{165mm}%
11367 {\voffset}{-2.95mm}%
11368 {\bindingoffset}{7mm}%
11369 {297mm}{210mm}%
11370 \globaldefs = 0
11371 }}
11372
11373 \def\bsixpaper{{\globaldefs = 1
11374 \afourpaper
11375 \internalpagesizes{140mm}{100mm}%
11376 {-6.35mm}{-12.7mm}%
11377 {\bindingoffset}{14pt}%
11378 {176mm}{125mm}%
11379 \let\SETdispenvsize=\smallword
11380 \lispnarrowing = 0.2in
11381 \globaldefs = 0
11382 }}
11383
11384
11385 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11386 % Perhaps we should allow setting the margins, \topskip, \parskip,
11387 % and/or leading, also. Or perhaps we should compute them somehow.
11388 %
11389 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11390 \def\pagesizesyyy#1,#2,#3\finish{{%
11391 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11392 \globaldefs = 1
11393 %
11394 \parskip = 3pt plus 2pt minus 1pt
11395 \setleading{\textleading}%
11396 %
11397 \dimen0 = #1\relax
11398 \advance\dimen0 by 2.5in % default 1in margin above heading line
11399 % and 1.5in to include heading, footing and
11400 % bottom margin
11401 %
11402 \dimen2 = \hsize
11403 \advance\dimen2 by 2in % default to 1 inch margin on each side
11404 %
11405 \internalpagesizes{#1}{\hsize}%
11406 {\voffset}{\normaloffset}%
11407 {\bindingoffset}{44pt}%
11408 {\dimen0}{\dimen2}%
11409 }}
11410
11411 % Set default to letter.
11412 %
11413 \letterpaper
11414
11415 % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
11416 \hfuzz = 1pt
11417
11418
11419 \message{microtype,}
11420
11421 % protrusion, from Thanh's protcode.tex.
11422 \def\mtsetprotcode#1{%
11423 \rpcode#1`\!=200 \rpcode#1`\,=700 \rpcode#1`\-=700 \rpcode#1`\.=700
11424 \rpcode#1`\;=500 \rpcode#1`\:=500 \rpcode#1`\?=200
11425 \rpcode#1`\'=700
11426 \rpcode#1 34=500 % ''
11427 \rpcode#1 123=300 % --
11428 \rpcode#1 124=200 % ---
11429 \rpcode#1`\)=50 \rpcode#1`\A=50 \rpcode#1`\F=50 \rpcode#1`\K=50
11430 \rpcode#1`\L=50 \rpcode#1`\T=50 \rpcode#1`\V=50 \rpcode#1`\W=50
11431 \rpcode#1`\X=50 \rpcode#1`\Y=50 \rpcode#1`\k=50 \rpcode#1`\r=50
11432 \rpcode#1`\t=50 \rpcode#1`\v=50 \rpcode#1`\w=50 \rpcode#1`\x=50
11433 \rpcode#1`\y=50
11434 %
11435 \lpcode#1`\`=700
11436 \lpcode#1 92=500 % ``
11437 \lpcode#1`\(=50 \lpcode#1`\A=50 \lpcode#1`\J=50 \lpcode#1`\T=50
11438 \lpcode#1`\V=50 \lpcode#1`\W=50 \lpcode#1`\X=50 \lpcode#1`\Y=50
11439 \lpcode#1`\v=50 \lpcode#1`\w=50 \lpcode#1`\x=50 \lpcode#1`\y=0
11440 %
11441 \mtadjustprotcode#1\relax
11442 }
11443
11444 \newcount\countC
11445 \def\mtadjustprotcode#1{%
11446 \countC=0
11447 \loop
11448 \ifcase\lpcode#1\countC\else
11449 \mtadjustcp\lpcode#1\countC
11450 \fi
11451 \ifcase\rpcode#1\countC\else
11452 \mtadjustcp\rpcode#1\countC
11453 \fi
11454 \advance\countC 1
11455 \ifnum\countC < 256 \repeat
11456 }
11457
11458 \newcount\countB
11459 \def\mtadjustcp#1#2#3{%
11460 \setbox\boxA=\hbox{%
11461 \ifx#2\font\else#2\fi
11462 \char#3}%
11463 \countB=\wd\boxA
11464 \multiply\countB #1#2#3\relax
11465 \divide\countB \fontdimen6 #2\relax
11466 #1#2#3=\countB\relax
11467 }
11468
11469 \ifx\XeTeXrevision\thisisundefined
11470 \ifx\luatexversion\thisisundefined
11471 \ifpdf % pdfTeX
11472 \mtsetprotcode\textrm
11473 \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
11474 \else % TeX
11475 \def\mtfontexpand#1{}
11476 \fi
11477 \else % LuaTeX
11478 \mtsetprotcode\textrm
11479 \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
11480 \fi
11481 \else % XeTeX
11482 \mtsetprotcode\textrm
11483 \def\mtfontexpand#1{}
11484 \fi
11485
11486
11487 \newif\ifmicrotype
11488
11489 \def\microtypeON{%
11490 \microtypetrue
11491 %
11492 \ifx\XeTeXrevision\thisisundefined
11493 \ifx\luatexversion\thisisundefined
11494 \ifpdf % pdfTeX
11495 \pdfadjustspacing=2
11496 \pdfprotrudechars=2
11497 \fi
11498 \else % LuaTeX
11499 \adjustspacing=2
11500 \protrudechars=2
11501 \fi
11502 \else % XeTeX
11503 \XeTeXprotrudechars=2
11504 \fi
11505 %
11506 \mtfontexpand\textrm
11507 \mtfontexpand\textsl
11508 \mtfontexpand\textbf
11509 }
11510
11511 \def\microtypeOFF{%
11512 \microtypefalse
11513 %
11514 \ifx\XeTeXrevision\thisisundefined
11515 \ifx\luatexversion\thisisundefined
11516 \ifpdf % pdfTeX
11517 \pdfadjustspacing=0
11518 \pdfprotrudechars=0
11519 \fi
11520 \else % LuaTeX
11521 \adjustspacing=0
11522 \protrudechars=0
11523 \fi
11524 \else % XeTeX
11525 \XeTeXprotrudechars=0
11526 \fi
11527 }
11528
11529 \microtypeOFF
11530
11531 \parseargdef\microtype{%
11532 \def\txiarg{#1}%
11533 \ifx\txiarg\onword
11534 \microtypeON
11535 \else\ifx\txiarg\offword
11536 \microtypeOFF
11537 \else
11538 \errhelp = \EMsimple
11539 \errmessage{Unknown @microtype option `\txiarg', must be on|off}%
11540 \fi\fi
11541 }
11542
11543
11544 \message{and turning on texinfo input format.}
11545
11546 % Make UTF-8 the default encoding.
11547 \documentencodingzzz{UTF-8}
11548
11549 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11550 \catcode`\^^K = 10 % treat vertical tab as whitespace
11551
11552 % DEL is a comment character, in case @c does not suffice.
11553 \catcode`\^^? = 14
11554
11555 % Define macros to output various characters with catcode for normal text.
11556 \catcode`\"=\other \def\normaldoublequote{"}
11557 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11558 \catcode`\+=\other \def\normalplus{+}
11559 \catcode`\<=\other \def\normalless{<}
11560 \catcode`\>=\other \def\normalgreater{>}
11561 \catcode`\^=\other \def\normalcaret{^}
11562 \catcode`\_=\other \def\normalunderscore{_}
11563 \catcode`\|=\other \def\normalverticalbar{|}
11564 \catcode`\~=\other \def\normaltilde{~}
11565
11566 % Set catcodes for Texinfo file
11567
11568 % Active characters for printing the wanted glyph.
11569 % Most of these we simply print from the \tt font, but for some, we can
11570 % use math or other variants that look better in normal text.
11571 %
11572 \catcode`\"=\active
11573 \def\activedoublequote{{\tt\char34}}
11574 \let"=\activedoublequote
11575 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11576 \chardef\hatchar=`\^
11577 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11578
11579 \catcode`\_=\active
11580 \def_{\ifusingtt\normalunderscore\_}
11581 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11582 \let\realunder=_
11583
11584 \catcode`\|=\active \def|{{\tt\char124}}
11585
11586 \chardef \less=`\<
11587 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11588 \chardef \gtr=`\>
11589 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11590 \catcode`\+=\active \def+{{\tt \char 43}}
11591 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11592 \catcode`\-=\active \let-=\normaldash
11593
11594
11595 % used for headline/footline in the output routine, in case the page
11596 % breaks in the middle of an @tex block.
11597 \def\texinfochars{%
11598 \let< = \activeless
11599 \let> = \activegtr
11600 \let~ = \activetilde
11601 \let^ = \activehat
11602 \setregularquotes
11603 \let\b = \strong
11604 \let\i = \smartitalic
11605 % in principle, all other definitions in \tex have to be undone too.
11606 }
11607
11608 % Used sometimes to turn off (effectively) the active characters even after
11609 % parsing them.
11610 \def\turnoffactive{%
11611 \passthroughcharstrue
11612 \let-=\normaldash
11613 \let"=\normaldoublequote
11614 \let$=\normaldollar %$ font-lock fix
11615 \let+=\normalplus
11616 \let<=\normalless
11617 \let>=\normalgreater
11618 \let^=\normalcaret
11619 \let_=\normalunderscore
11620 \let|=\normalverticalbar
11621 \let~=\normaltilde
11622 \otherbackslash
11623 \setregularquotes
11624 \unsepspaces
11625 }
11626
11627 % If a .fmt file is being used, characters that might appear in a file
11628 % name cannot be active until we have parsed the command line.
11629 % So turn them off again, and have \loadconf turn them back on.
11630 \catcode`+=\other \catcode`\_=\other
11631
11632
11633 % \backslashcurfont outputs one backslash character in current font,
11634 % as in \char`\\.
11635 \global\chardef\backslashcurfont=`\\
11636
11637 % Print a typewriter backslash. For math mode, we can't simply use
11638 % \backslashcurfont: the story here is that in math mode, the \char
11639 % of \backslashcurfont ends up printing the roman \ from the math symbol
11640 % font (because \char in math mode uses the \mathcode, and plain.tex
11641 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11642 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11643 % ignored family value; char position "5C). We can't use " for the
11644 % usual hex value because it has already been made active.
11645
11646 \def\ttbackslash{{\tt \ifmmode \mathchar29020 \else \backslashcurfont \fi}}
11647 \let\backslashchar = \ttbackslash % \backslashchar{} is for user documents.
11648
11649 % These are made active for url-breaking, so need
11650 % active definitions as the normal characters.
11651 \def\normaldot{.}
11652 \def\normalquest{?}
11653 \def\normalslash{/}
11654
11655 % \newlinesloadsconf - call \loadconf as soon as possible in the
11656 % file, e.g. at the first newline.
11657 %
11658 {\catcode`\^=7
11659 \catcode`\^^M=13
11660 \gdef\newlineloadsconf{%
11661 \catcode`\^^M=13 %
11662 \newlineloadsconfzz%
11663 }
11664 \gdef\newlineloadsconfzz#1^^M{%
11665 \def\c{\loadconf\c}%
11666 % Definition for the first newline read in the file
11667 \def ^^M{\loadconf}%
11668 % In case the first line has a whole-line command on it
11669 \let\originalparsearg\parsearg%
11670 \def\parsearg{\loadconf\originalparsearg}%
11671 }}
11672
11673
11674 % Emergency active definition of newline, in case an active newline token
11675 % appears by mistake.
11676 {\catcode`\^=7 \catcode13=13%
11677 \gdef\enableemergencynewline{%
11678 \gdef^^M{%
11679 \par%
11680 %<warning: active newline>\par%
11681 }}}
11682
11683
11684 % \loadconf gets called at the beginning of every Texinfo file.
11685 % If texinfo.cnf is present on the system, read it. Useful for site-wide
11686 % @afourpaper, etc. Not opening texinfo.cnf directly in texinfo.tex
11687 % makes it possible to make a format file for Texinfo.
11688 %
11689 \gdef\loadconf{%
11690 \relax % Terminate the filename if running as "tex '&texinfo' FILE.texi".
11691 %
11692 % Turn off the definitions that trigger \loadconf
11693 \everyjobreset
11694 \catcode13=5 % regular end of line
11695 \enableemergencynewline
11696 \let\c=\comment
11697 \let\parsearg\originalparsearg
11698 %
11699 % Also turn back on active characters that might appear in the input
11700 % file name, in case not using a pre-dumped format.
11701 \catcode`+=\active
11702 \catcode`\_=\active
11703 %
11704 \openin 1 texinfo.cnf
11705 \ifeof 1 \else \input texinfo.cnf \fi
11706 \closein 1
11707 }
11708
11709 % Redefine some control sequences to be controlled by the \ifdummies
11710 % and \ifindexnofonts switches. Do this at the end so that the control
11711 % sequences are all defined.
11712 \definedummies
11713
11714
11715
11716
11717 \catcode`\@=0
11718
11719 % \realbackslash is an actual character `\' with catcode other.
11720 {\catcode`\\=\other @gdef@realbackslash{\}}
11721
11722 % In Texinfo, backslash is an active character; it prints the backslash
11723 % in fixed width font.
11724 \catcode`\\=\active % @ for escape char from now on.
11725
11726 @let\ = @ttbackslash
11727
11728 % If in a .fmt file, print the version number.
11729 % \eatinput stops the `\input texinfo' from showing up.
11730 % After that, `\' should revert to printing a backslash.
11731 % Turn on active characters that we couldn't do earlier because
11732 % they might have appeared in the input file name.
11733 %
11734 @everyjob{@message{[Texinfo version @texinfoversion]}%
11735 @global@let\ = @eatinput
11736 @catcode`+=@active @catcode`@_=@active}
11737
11738 {@catcode`@^=7 @catcode`@^^M=13%
11739 @gdef@eatinput input texinfo#1^^M{@loadconf}}
11740
11741 @def@everyjobreset{@ifx\@eatinput @let\ = @ttbackslash @fi}
11742
11743 % \otherbackslash defines an active \ to be a literal `\' character with
11744 % catcode other.
11745 @gdef@otherbackslash{@let\=@realbackslash}
11746
11747 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11748 % the literal character `\'.
11749 %
11750 {@catcode`- = @active
11751 @gdef@normalturnoffactive{%
11752 @turnoffactive
11753 @let\=@ttbackslash
11754 }
11755 }
11756
11757 % Say @foo, not \foo, in error messages.
11758 @escapechar = `@@
11759
11760 % These look ok in all fonts, so just make them not special.
11761 % @hashchar{} gets its own user-level command, because of #line.
11762 @catcode`@& = @other @def@normalamp{&}
11763 @catcode`@# = @other @def@normalhash{#}
11764 @catcode`@% = @other @def@normalpercent{%}
11765
11766 @let @hashchar = @normalhash
11767
11768 @c Finally, make ` and ' active, so that txicodequoteundirected and
11769 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11770 @c don't make ` and ' active, @code will not get them as active chars.
11771 @c Do this last of all since we use ` in the previous @catcode assignments.
11772 @catcode`@'=@active
11773 @catcode`@`=@active
11774
11775 @c Local variables:
11776 @c eval: (add-hook 'before-save-hook 'time-stamp nil t)
11777 @c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
11778 @c page-delimiter: "^\\\\message"
11779 @c End:
11780
11781 @newlineloadsconf