texinfo.tex revision 1.1.1.5 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{2022-12-10.11}
7 %
8 % Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc.
9 %
10 % This texinfo.tex file is free software: you can redistribute it and/or
11 % modify it under the terms of the GNU General Public License as
12 % published by the Free Software Foundation, either version 3 of the
13 % License, or (at your option) any later version.
14 %
15 % This texinfo.tex file is distributed in the hope that it will be
16 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 % General Public License for more details.
19 %
20 % You should have received a copy of the GNU General Public License
21 % along with this program. If not, see <https://www.gnu.org/licenses/>.
22 %
23 % As a special exception, when this file is read by TeX when processing
24 % a Texinfo source document, you may use the result without
25 % restriction. This Exception is an additional permission under section 7
26 % of the GNU General Public License, version 3 ("GPLv3").
27 %
28 % Please try the latest version of texinfo.tex before submitting bug
29 % reports; you can get the latest version from:
30 % https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
31 % https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
32 % https://www.gnu.org/software/texinfo/ (the Texinfo home page)
33 % The texinfo.tex in any given distribution could well be out
34 % of date, so if that's what you're using, please check.
35 %
36 % Send bug reports to bug-texinfo (a] gnu.org. Please include a
37 % complete document in each bug report with which we can reproduce the
38 % problem. Patches are, of course, greatly appreciated.
39 %
40 % To process a Texinfo manual with TeX, it's most reliable to use the
41 % texi2dvi shell script that comes with the distribution. For a simple
42 % manual foo.texi, however, you can get away with this:
43 % tex foo.texi
44 % texindex foo.??
45 % tex foo.texi
46 % tex foo.texi
47 % dvips foo.dvi -o # or whatever; this makes foo.ps.
48 % The extra TeX runs get the cross-reference information correct.
49 % Sometimes one run after texindex suffices, and sometimes you need more
50 % than two; texi2dvi does it as many times as necessary.
51 %
52 % It is possible to adapt texinfo.tex for other languages, to some
53 % extent. You can get the existing language-specific files from the
54 % full Texinfo distribution.
55 %
56 % The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
57
58
59 \message{Loading texinfo [version \texinfoversion]:}
60
61 % If in a .fmt file, print the version number
62 % and turn on active characters that we couldn't do earlier because
63 % they might have appeared in the input file name.
64 \everyjob{\message{[Texinfo version \texinfoversion]}%
65 \catcode`+=\active \catcode`\_=\active}
66
67 % LaTeX's \typeout. This ensures that the messages it is used for
68 % are identical in format to the corresponding ones from latex/pdflatex.
69 \def\typeout{\immediate\write17}%
70
71 \chardef\other=12
72
73 % We never want plain's \outer definition of \+ in Texinfo.
74 % For @tex, we can use \tabalign.
75 \let\+ = \relax
76
77 % Save some plain tex macros whose names we will redefine.
78 \let\ptexb=\b
79 \let\ptexbullet=\bullet
80 \let\ptexc=\c
81 \let\ptexcomma=\,
82 \let\ptexdot=\.
83 \let\ptexdots=\dots
84 \let\ptexend=\end
85 \let\ptexequiv=\equiv
86 \let\ptexexclam=\!
87 \let\ptexfootnote=\footnote
88 \let\ptexgtr=>
89 \let\ptexhat=^
90 \let\ptexi=\i
91 \let\ptexindent=\indent
92 \let\ptexinsert=\insert
93 \let\ptexlbrace=\{
94 \let\ptexless=<
95 \let\ptexnewwrite\newwrite
96 \let\ptexnoindent=\noindent
97 \let\ptexplus=+
98 \let\ptexraggedright=\raggedright
99 \let\ptexrbrace=\}
100 \let\ptexslash=\/
101 \let\ptexsp=\sp
102 \let\ptexstar=\*
103 \let\ptexsup=\sup
104 \let\ptext=\t
105 \let\ptextop=\top
106 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
107
108 % If this character appears in an error message or help string, it
109 % starts a new line in the output.
110 \newlinechar = `^^J
111
112 % Use TeX 3.0's \inputlineno to get the line number, for better error
113 % messages, but if we're using an old version of TeX, don't do anything.
114 %
115 \ifx\inputlineno\thisisundefined
116 \let\linenumber = \empty % Pre-3.0.
117 \else
118 \def\linenumber{l.\the\inputlineno:\space}
119 \fi
120
121 % Set up fixed words for English if not already set.
122 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
123 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
124 \ifx\putworderror\undefined \gdef\putworderror{error}\fi
125 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
126 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
127 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
128 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
129 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
130 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
131 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
132 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
133 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
134 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
135 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
136 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
137 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
138 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
139 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
140 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
141 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
142 %
143 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
144 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
145 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
146 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
147 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
148 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
149 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
150 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
151 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
152 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
153 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
154 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
155 %
156 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
157 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
158 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
159 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
160 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
161
162 % Give the space character the catcode for a space.
163 \def\spaceisspace{\catcode`\ =10\relax}
164
165 % Likewise for ^^M, the end of line character.
166 \def\endlineisspace{\catcode13=10\relax}
167
168 \chardef\dashChar = `\-
169 \chardef\slashChar = `\/
170 \chardef\underChar = `\_
171
172 % Ignore a token.
173 %
174 \def\gobble#1{}
175
176 % The following is used inside several \edef's.
177 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
178
179 % Hyphenation fixes.
180 \hyphenation{
181 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
182 ap-pen-dix bit-map bit-maps
183 data-base data-bases eshell fall-ing half-way long-est man-u-script
184 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
185 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
186 spell-ing spell-ings
187 stand-alone strong-est time-stamp time-stamps which-ever white-space
188 wide-spread wrap-around
189 }
190
191 % Sometimes it is convenient to have everything in the transcript file
192 % and nothing on the terminal. We don't just call \tracingall here,
193 % since that produces some useless output on the terminal. We also make
194 % some effort to order the tracing commands to reduce output in the log
195 % file; cf. trace.sty in LaTeX.
196 %
197 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
198 \def\loggingall{%
199 \tracingstats2
200 \tracingpages1
201 \tracinglostchars2 % 2 gives us more in etex
202 \tracingparagraphs1
203 \tracingoutput1
204 \tracingmacros2
205 \tracingrestores1
206 \showboxbreadth\maxdimen \showboxdepth\maxdimen
207 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
208 \tracingscantokens1
209 \tracingifs1
210 \tracinggroups1
211 \tracingnesting2
212 \tracingassigns1
213 \fi
214 \tracingcommands3 % 3 gives us more in etex
215 \errorcontextlines16
216 }%
217
218 % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
219 % aren't perfect, it's not the end of the world, being an error message,
220 % after all.
221 %
222 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
223 \def\doerrormsg#1{\errmessage{#1}}
224
225 % add check for \lastpenalty to plain's definitions. If the last thing
226 % we did was a \nobreak, we don't want to insert more space.
227 %
228 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
229 \removelastskip\penalty-50\smallskip\fi\fi}
230 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
231 \removelastskip\penalty-100\medskip\fi\fi}
232 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
233 \removelastskip\penalty-200\bigskip\fi\fi}
234
235 % Output routine
237 %
238
239 % For a final copy, take out the rectangles
240 % that mark overfull boxes (in case you have decided
241 % that the text looks ok even though it passes the margin).
242 %
243 \def\finalout{\overfullrule=0pt }
244
245 % Output a mark which sets \thischapter, \thissection and \thiscolor.
246 % We dump everything together because we only have one kind of mark.
247 % This works because we only use \botmark / \topmark, not \firstmark.
248 %
249 % A mark contains a subexpression of the \ifcase ... \fi construct.
250 % \get*marks macros below extract the needed part using \ifcase.
251 %
252 % Another complication is to let the user choose whether \thischapter
253 % (\thissection) refers to the chapter (section) in effect at the top
254 % of a page, or that at the bottom of a page.
255
256 % \domark is called twice inside \chapmacro, to add one
257 % mark before the section break, and one after.
258 % In the second call \prevchapterdefs is the same as \currentchapterdefs,
259 % and \prevsectiondefs is the same as \currentsectiondefs.
260 % Then if the page is not broken at the mark, some of the previous
261 % section appears on the page, and we can get the name of this section
262 % from \firstmark for @everyheadingmarks top.
263 % @everyheadingmarks bottom uses \botmark.
264 %
265 % See page 260 of The TeXbook.
266 \def\domark{%
267 \toks0=\expandafter{\currentchapterdefs}%
268 \toks2=\expandafter{\currentsectiondefs}%
269 \toks4=\expandafter{\prevchapterdefs}%
270 \toks6=\expandafter{\prevsectiondefs}%
271 \toks8=\expandafter{\currentcolordefs}%
272 \mark{%
273 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
274 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
275 \noexpand\else \the\toks8 % 2: color marks
276 }%
277 }
278
279 % \gettopheadingmarks, \getbottomheadingmarks,
280 % \getcolormarks - extract needed part of mark.
281 %
282 % \topmark doesn't work for the very first chapter (after the title
283 % page or the contents), so we use \firstmark there -- this gets us
284 % the mark with the chapter defs, unless the user sneaks in, e.g.,
285 % @setcolor (or @url, or @link, etc.) between @contents and the very
286 % first @chapter.
287 \def\gettopheadingmarks{%
288 \ifcase0\the\savedtopmark\fi
289 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
290 }
291 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
292 \def\getcolormarks{\ifcase2\the\savedtopmark\fi}
293
294 % Avoid "undefined control sequence" errors.
295 \def\currentchapterdefs{}
296 \def\currentsectiondefs{}
297 \def\currentsection{}
298 \def\prevchapterdefs{}
299 \def\prevsectiondefs{}
300 \def\currentcolordefs{}
301
302 % Margin to add to right of even pages, to left of odd pages.
303 \newdimen\bindingoffset
304 \newdimen\normaloffset
305 \newdimen\txipagewidth \newdimen\txipageheight
306
307 % Main output routine.
308 %
309 \chardef\PAGE = 255
310 \newtoks\defaultoutput
311 \defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
312 \output=\expandafter{\the\defaultoutput}
313
314 \newbox\headlinebox
315 \newbox\footlinebox
316
317 % When outputting the double column layout for indices, an output routine
318 % is run several times, hiding the original value of \topmark. Hence, save
319 % \topmark at the beginning.
320 %
321 \newtoks\savedtopmark
322 \newif\iftopmarksaved
323 \topmarksavedtrue
324 \def\savetopmark{%
325 \iftopmarksaved\else
326 \global\savedtopmark=\expandafter{\topmark}%
327 \global\topmarksavedtrue
328 \fi
329 }
330
331 % \onepageout takes a vbox as an argument.
332 % \shipout a vbox for a single page, adding an optional header, footer
333 % and footnote. This also causes index entries for this page to be written
334 % to the auxiliary files.
335 %
336 \def\onepageout#1{%
337 \hoffset=\normaloffset
338 %
339 \ifodd\pageno \advance\hoffset by \bindingoffset
340 \else \advance\hoffset by -\bindingoffset\fi
341 %
342 \checkchapterpage
343 %
344 % Make the heading and footing. \makeheadline and \makefootline
345 % use the contents of \headline and \footline.
346 \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
347 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
348 \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
349 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
350 \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
351 %
352 {%
353 % Set context for writing to auxiliary files like index files.
354 % Have to do this stuff outside the \shipout because we want it to
355 % take effect in \write's, yet the group defined by the \vbox ends
356 % before the \shipout runs.
357 %
358 \atdummies % don't expand commands in the output.
359 \turnoffactive
360 \shipout\vbox{%
361 % Do this early so pdf references go to the beginning of the page.
362 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
363 %
364 \unvbox\headlinebox
365 \pagebody{#1}%
366 \ifdim\ht\footlinebox > 0pt
367 % Only leave this space if the footline is nonempty.
368 % (We lessened \vsize for it in \oddfootingyyy.)
369 % The \baselineskip=24pt in plain's \makefootline has no effect.
370 \vskip 24pt
371 \unvbox\footlinebox
372 \fi
373 %
374 }%
375 }%
376 \global\topmarksavedfalse
377 \advancepageno
378 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
379 }
380
381 \newinsert\margin \dimen\margin=\maxdimen
382
383 % Main part of page, including any footnotes
384 \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
385 {\catcode`\@ =11
386 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
387 % marginal hacks, juha (a] viisa.uucp (Juha Takala)
388 \ifvoid\margin\else % marginal info is present
389 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
390 \dimen@=\dp#1\relax \unvbox#1\relax
391 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
392 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
393 }
394
395 % Check if we are on the first page of a chapter. Used for printing headings.
396 \newif\ifchapterpage
397 \def\checkchapterpage{%
398 % Get the chapter that was current at the end of the last page
399 \ifcase1\the\savedtopmark\fi
400 \let\prevchaptername\thischaptername
401 %
402 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
403 \let\curchaptername\thischaptername
404 %
405 \ifx\curchaptername\prevchaptername
406 \chapterpagefalse
407 \else
408 \chapterpagetrue
409 \fi
410 }
411
412 % Argument parsing
413
414 % Parse an argument, then pass it to #1. The argument is the rest of
415 % the input line (except we remove a trailing comment). #1 should be a
416 % macro which expects an ordinary undelimited TeX argument.
417 % For example, \def\foo{\parsearg\fooxxx}.
418 %
419 \def\parsearg{\parseargusing{}}
420 \def\parseargusing#1#2{%
421 \def\argtorun{#2}%
422 \begingroup
423 \obeylines
424 \spaceisspace
425 #1%
426 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
427 }
428
429 {\obeylines %
430 \gdef\parseargline#1^^M{%
431 \endgroup % End of the group started in \parsearg.
432 \argremovecomment #1\comment\ArgTerm%
433 }%
434 }
435
436 % First remove any @comment, then any @c comment. Pass the result on to
437 % \argcheckspaces.
438 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
439 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
440
441 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
442 %
443 % \argremovec might leave us with trailing space, e.g.,
444 % @end itemize @c foo
445 % This space token undergoes the same procedure and is eventually removed
446 % by \finishparsearg.
447 %
448 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
449 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
450 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
451 \def\temp{#3}%
452 \ifx\temp\empty
453 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
454 \let\temp\finishparsearg
455 \else
456 \let\temp\argcheckspaces
457 \fi
458 % Put the space token in:
459 \temp#1 #3\ArgTerm
460 }
461
462 % If a _delimited_ argument is enclosed in braces, they get stripped; so
463 % to get _exactly_ the rest of the line, we had to prevent such situation.
464 % We prepended an \empty token at the very beginning and we expand it now,
465 % just before passing the control to \argtorun.
466 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
467 % either the null string, or it ends with \^^M---thus there is no danger
468 % that a pair of braces would be stripped.
469 %
470 % But first, we have to remove the trailing space token.
471 %
472 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
473
474
475 % \parseargdef - define a command taking an argument on the line
476 %
477 % \parseargdef\foo{...}
478 % is roughly equivalent to
479 % \def\foo{\parsearg\Xfoo}
480 % \def\Xfoo#1{...}
481 \def\parseargdef#1{%
482 \expandafter \doparseargdef \csname\string#1\endcsname #1%
483 }
484 \def\doparseargdef#1#2{%
485 \def#2{\parsearg#1}%
486 \def#1##1%
487 }
488
489 % Several utility definitions with active space:
490 {
491 \obeyspaces
492 \gdef\obeyedspace{ }
493
494 % Make each space character in the input produce a normal interword
495 % space in the output. Don't allow a line break at this space, as this
496 % is used only in environments like @example, where each line of input
497 % should produce a line of output anyway.
498 %
499 \gdef\sepspaces{\obeyspaces\let =\tie}
500
501 % If an index command is used in an @example environment, any spaces
502 % therein should become regular spaces in the raw index file, not the
503 % expansion of \tie (\leavevmode \penalty \@M \ ).
504 \gdef\unsepspaces{\let =\space}
505 }
506
507
508 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
509
510 % Define the framework for environments in texinfo.tex. It's used like this:
511 %
512 % \envdef\foo{...}
513 % \def\Efoo{...}
514 %
515 % It's the responsibility of \envdef to insert \begingroup before the
516 % actual body; @end closes the group after calling \Efoo. \envdef also
517 % defines \thisenv, so the current environment is known; @end checks
518 % whether the environment name matches. The \checkenv macro can also be
519 % used to check whether the current environment is the one expected.
520 %
521 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
522 % are not treated as environments; they don't open a group. (The
523 % implementation of @end takes care not to call \endgroup in this
524 % special case.)
525
526
527 % At run-time, environments start with this:
528 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
529 % initialize
530 \let\thisenv\empty
531
532 % ... but they get defined via ``\envdef\foo{...}'':
533 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
534 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
535
536 % Check whether we're in the right environment:
537 \def\checkenv#1{%
538 \def\temp{#1}%
539 \ifx\thisenv\temp
540 \else
541 \badenverr
542 \fi
543 }
544
545 % Environment mismatch, #1 expected:
546 \def\badenverr{%
547 \errhelp = \EMsimple
548 \errmessage{This command can appear only \inenvironment\temp,
549 not \inenvironment\thisenv}%
550 }
551 \def\inenvironment#1{%
552 \ifx#1\empty
553 outside of any environment%
554 \else
555 in environment \expandafter\string#1%
556 \fi
557 }
558
559
560 % @end foo calls \checkenv and executes the definition of \Efoo.
561 \parseargdef\end{%
562 \if 1\csname iscond.#1\endcsname
563 \else
564 % The general wording of \badenverr may not be ideal.
565 \expandafter\checkenv\csname#1\endcsname
566 \csname E#1\endcsname
567 \endgroup
568 \fi
569 }
570
571 \newhelp\EMsimple{Press RETURN to continue.}
572
573
574 % Be sure we're in horizontal mode when doing a tie, since we make space
575 % equivalent to this in @example-like environments. Otherwise, a space
576 % at the beginning of a line will start with \penalty -- and
577 % since \penalty is valid in vertical mode, we'd end up putting the
578 % penalty on the vertical list instead of in the new paragraph.
579 {\catcode`@ = 11
580 % Avoid using \@M directly, because that causes trouble
581 % if the definition is written into an index file.
582 \global\let\tiepenalty = \@M
583 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
584 }
585
586 % @: forces normal size whitespace following.
587 \def\:{\spacefactor=1000 }
588
589 % @* forces a line break.
590 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
591
592 % @/ allows a line break.
593 \let\/=\allowbreak
594
595 % @. is an end-of-sentence period.
596 \def\.{.\spacefactor=\endofsentencespacefactor\space}
597
598 % @! is an end-of-sentence bang.
599 \def\!{!\spacefactor=\endofsentencespacefactor\space}
600
601 % @? is an end-of-sentence query.
602 \def\?{?\spacefactor=\endofsentencespacefactor\space}
603
604 % @w prevents a word break. Without the \leavevmode, @w at the
605 % beginning of a paragraph, when TeX is still in vertical mode, would
606 % produce a whole line of output instead of starting the paragraph.
607 \def\w#1{\leavevmode\hbox{#1}}
608
609 % @group ... @end group forces ... to be all on one page, by enclosing
610 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
611 % to keep its height that of a normal line. According to the rules for
612 % \topskip (p.114 of the TeXbook), the glue inserted is
613 % max (\topskip - \ht (first item), 0). If that height is large,
614 % therefore, no glue is inserted, and the space between the headline and
615 % the text is small, which looks bad.
616 %
617 % Another complication is that the group might be very large. This can
618 % cause the glue on the previous page to be unduly stretched, because it
619 % does not have much material. In this case, it's better to add an
620 % explicit \vfill so that the extra space is at the bottom. The
621 % threshold for doing this is if the group is more than \vfilllimit
622 % percent of a page (\vfilllimit can be changed inside of @tex).
623 %
624 \newbox\groupbox
625 \def\vfilllimit{0.7}
626 %
627 \envdef\group{%
628 \ifnum\catcode`\^^M=\active \else
629 \errhelp = \groupinvalidhelp
630 \errmessage{@group invalid in context where filling is enabled}%
631 \fi
632 \startsavinginserts
633 %
634 \setbox\groupbox = \vtop\bgroup
635 % Do @comment since we are called inside an environment such as
636 % @example, where each end-of-line in the input causes an
637 % end-of-line in the output. We don't want the end-of-line after
638 % the `@group' to put extra space in the output. Since @group
639 % should appear on a line by itself (according to the Texinfo
640 % manual), we don't worry about eating any user text.
641 \comment
642 }
643 %
644 % The \vtop produces a box with normal height and large depth; thus, TeX puts
645 % \baselineskip glue before it, and (when the next line of text is done)
646 % \lineskip glue after it. Thus, space below is not quite equal to space
647 % above. But it's pretty close.
648 \def\Egroup{%
649 % To get correct interline space between the last line of the group
650 % and the first line afterwards, we have to propagate \prevdepth.
651 \endgraf % Not \par, as it may have been set to \lisppar.
652 \global\dimen1 = \prevdepth
653 \egroup % End the \vtop.
654 \addgroupbox
655 \prevdepth = \dimen1
656 \checkinserts
657 }
658
659 \def\addgroupbox{
660 % \dimen0 is the vertical size of the group's box.
661 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
662 % \dimen2 is how much space is left on the page (more or less).
663 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
664 % if the group doesn't fit on the current page, and it's a big big
665 % group, force a page break.
666 \ifdim \dimen0 > \dimen2
667 \ifdim \pagetotal < \vfilllimit\txipageheight
668 \page
669 \fi
670 \fi
671 \box\groupbox
672 }
673
674 %
675 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
676 % message, so this ends up printing `@group can only ...'.
677 %
678 \newhelp\groupinvalidhelp{%
679 group can only be used in environments such as @example,^^J%
680 where each line of input produces a line of output.}
681
682 % @need space-in-mils
683 % forces a page break if there is not space-in-mils remaining.
684
685 \newdimen\mil \mil=0.001in
686
687 \parseargdef\need{%
688 % Ensure vertical mode, so we don't make a big box in the middle of a
689 % paragraph.
690 \par
691 %
692 % If the @need value is less than one line space, it's useless.
693 \dimen0 = #1\mil
694 \dimen2 = \ht\strutbox
695 \advance\dimen2 by \dp\strutbox
696 \ifdim\dimen0 > \dimen2
697 % This is similar to the 'needspace' module in LaTeX.
698 % The first penalty allows a break if the end of the page is
699 % not too far away. Following penalties and skips are discarded.
700 % Otherwise, require at least \dimen0 of vertical space.
701 %
702 % (We used to use a \vtop to reserve space, but this had spacing issues
703 % when followed by a section heading, as it was not a "discardable item".
704 % This also has the benefit of providing glue before the page break if
705 % there isn't enough space.)
706 \vskip0pt plus \dimen0
707 \penalty-100
708 \vskip0pt plus -\dimen0
709 \vskip \dimen0
710 \penalty9999
711 \vskip -\dimen0
712 \penalty0\relax % this hides the above glue from \safewhatsit and \dobreak
713 \fi
714 }
715
716 % @br forces paragraph break (and is undocumented).
717
718 \let\br = \par
719
720 % @page forces the start of a new page.
721 %
722 \def\page{\par\vfill\supereject}
723
724 % @exdent text....
725 % outputs text on separate line in roman font, starting at standard page margin
726
727 % This records the amount of indent in the innermost environment.
728 % That's how much \exdent should take out.
729 \newskip\exdentamount
730
731 % This defn is used inside fill environments such as @defun.
732 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
733
734 % This defn is used inside nofill environments such as @example.
735 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
736 \leftline{\hskip\leftskip{\rm#1}}}}
737
738 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
739 % paragraph. For more general purposes, use the \margin insertion
740 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
741 %
742 \newskip\inmarginspacing \inmarginspacing=1cm
743 \def\strutdepth{\dp\strutbox}
744 %
745 \def\doinmargin#1#2{\strut\vadjust{%
746 \nobreak
747 \kern-\strutdepth
748 \vtop to \strutdepth{%
749 \baselineskip=\strutdepth
750 \vss
751 % if you have multiple lines of stuff to put here, you'll need to
752 % make the vbox yourself of the appropriate size.
753 \ifx#1l%
754 \llap{\ignorespaces #2\hskip\inmarginspacing}%
755 \else
756 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
757 \fi
758 \null
759 }%
760 }}
761 \def\inleftmargin{\doinmargin l}
762 \def\inrightmargin{\doinmargin r}
763 %
764 % @inmargin{TEXT [, RIGHT-TEXT]}
765 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
766 % else use TEXT for both).
767 %
768 \def\inmargin#1{\parseinmargin #1,,\finish}
769 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
770 \setbox0 = \hbox{\ignorespaces #2}%
771 \ifdim\wd0 > 0pt
772 \def\lefttext{#1}% have both texts
773 \def\righttext{#2}%
774 \else
775 \def\lefttext{#1}% have only one text
776 \def\righttext{#1}%
777 \fi
778 %
779 \ifodd\pageno
780 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
781 \else
782 \def\temp{\inleftmargin\lefttext}%
783 \fi
784 \temp
785 }
786
787 % @include FILE -- \input text of FILE.
788 %
789 \def\include{\parseargusing\filenamecatcodes\includezzz}
790 \def\includezzz#1{%
791 \pushthisfilestack
792 \def\thisfile{#1}%
793 {%
794 \makevalueexpandable % we want to expand any @value in FILE.
795 \turnoffactive % and allow special characters in the expansion
796 \indexnofonts % Allow `@@' and other weird things in file names.
797 \wlog{texinfo.tex: doing @include of #1^^J}%
798 \edef\temp{\noexpand\input #1 }%
799 %
800 % This trickery is to read FILE outside of a group, in case it makes
801 % definitions, etc.
802 \expandafter
803 }\temp
804 \popthisfilestack
805 }
806 \def\filenamecatcodes{%
807 \catcode`\\=\other
808 \catcode`~=\other
809 \catcode`^=\other
810 \catcode`_=\other
811 \catcode`|=\other
812 \catcode`<=\other
813 \catcode`>=\other
814 \catcode`+=\other
815 \catcode`-=\other
816 \catcode`\`=\other
817 \catcode`\'=\other
818 }
819
820 \def\pushthisfilestack{%
821 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
822 }
823 \def\pushthisfilestackX{%
824 \expandafter\pushthisfilestackY\thisfile\StackTerm
825 }
826 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
827 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
828 }
829
830 \def\popthisfilestack{\errthisfilestackempty}
831 \def\errthisfilestackempty{\errmessage{Internal error:
832 the stack of filenames is empty.}}
833 %
834 \def\thisfile{}
835
836 % @center line
837 % outputs that line, centered.
838 %
839 \parseargdef\center{%
840 \ifhmode
841 \let\centersub\centerH
842 \else
843 \let\centersub\centerV
844 \fi
845 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
846 \let\centersub\relax % don't let the definition persist, just in case
847 }
848 \def\centerH#1{{%
849 \hfil\break
850 \advance\hsize by -\leftskip
851 \advance\hsize by -\rightskip
852 \line{#1}%
853 \break
854 }}
855 %
856 \newcount\centerpenalty
857 \def\centerV#1{%
858 % The idea here is the same as in \startdefun, \cartouche, etc.: if
859 % @center is the first thing after a section heading, we need to wipe
860 % out the negative parskip inserted by \sectionheading, but still
861 % prevent a page break here.
862 \centerpenalty = \lastpenalty
863 \ifnum\centerpenalty>10000 \vskip\parskip \fi
864 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
865 \line{\kern\leftskip #1\kern\rightskip}%
866 }
867
868 % @sp n outputs n lines of vertical space
869 %
870 \parseargdef\sp{\vskip #1\baselineskip}
871
872 % @comment ...line which is ignored...
873 % @c is the same as @comment
874 % @ignore ... @end ignore is another way to write a comment
875
876
877 \def\c{\begingroup \catcode`\^^M=\active%
878 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
879 \cxxx}
880 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
881 %
882 \let\comment\c
883
884 % @paragraphindent NCHARS
885 % We'll use ems for NCHARS, close enough.
886 % NCHARS can also be the word `asis' or `none'.
887 % We cannot feasibly implement @paragraphindent asis, though.
888 %
889 \def\asisword{asis} % no translation, these are keywords
890 \def\noneword{none}
891 %
892 \parseargdef\paragraphindent{%
893 \def\temp{#1}%
894 \ifx\temp\asisword
895 \else
896 \ifx\temp\noneword
897 \defaultparindent = 0pt
898 \else
899 \defaultparindent = #1em
900 \fi
901 \fi
902 \parindent = \defaultparindent
903 }
904
905 % @exampleindent NCHARS
906 % We'll use ems for NCHARS like @paragraphindent.
907 % It seems @exampleindent asis isn't necessary, but
908 % I preserve it to make it similar to @paragraphindent.
909 \parseargdef\exampleindent{%
910 \def\temp{#1}%
911 \ifx\temp\asisword
912 \else
913 \ifx\temp\noneword
914 \lispnarrowing = 0pt
915 \else
916 \lispnarrowing = #1em
917 \fi
918 \fi
919 }
920
921 % @firstparagraphindent WORD
922 % If WORD is `none', then suppress indentation of the first paragraph
923 % after a section heading. If WORD is `insert', then do indent at such
924 % paragraphs.
925 %
926 % The paragraph indentation is suppressed or not by calling
927 % \suppressfirstparagraphindent, which the sectioning commands do.
928 % We switch the definition of this back and forth according to WORD.
929 % By default, we suppress indentation.
930 %
931 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
932 \def\insertword{insert}
933 %
934 \parseargdef\firstparagraphindent{%
935 \def\temp{#1}%
936 \ifx\temp\noneword
937 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
938 \else\ifx\temp\insertword
939 \let\suppressfirstparagraphindent = \relax
940 \else
941 \errhelp = \EMsimple
942 \errmessage{Unknown @firstparagraphindent option `\temp'}%
943 \fi\fi
944 }
945
946 % Here is how we actually suppress indentation. Redefine \everypar to
947 % \kern backwards by \parindent, and then reset itself to empty.
948 %
949 % We also make \indent itself not actually do anything until the next
950 % paragraph.
951 %
952 \gdef\dosuppressfirstparagraphindent{%
953 \gdef\indent {\restorefirstparagraphindent \indent}%
954 \gdef\noindent{\restorefirstparagraphindent \noindent}%
955 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
956 }
957 %
958 \gdef\restorefirstparagraphindent{%
959 \global\let\indent = \ptexindent
960 \global\let\noindent = \ptexnoindent
961 \global\everypar = {}%
962 }
963
964 % leave vertical mode without cancelling any first paragraph indent
965 \gdef\imageindent{%
966 \toks0=\everypar
967 \everypar={}%
968 \ptexnoindent
969 \global\everypar=\toks0
970 }
971
972
973 % @refill is a no-op.
974 \let\refill=\relax
975
976 % @setfilename INFO-FILENAME - ignored
977 \let\setfilename=\comment
978
979 % @bye.
980 \outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
981
982
983 \message{pdf,}
984 % adobe `portable' document format
985 \newcount\tempnum
986 \newcount\lnkcount
987 \newtoks\filename
988 \newcount\filenamelength
989 \newcount\pgn
990 \newtoks\toksA
991 \newtoks\toksB
992 \newtoks\toksC
993 \newtoks\toksD
994 \newbox\boxA
995 \newbox\boxB
996 \newcount\countA
997 \newif\ifpdf
998 \newif\ifpdfmakepagedest
999
1000 %
1001 % For LuaTeX
1002 %
1003
1004 \newif\iftxiuseunicodedestname
1005 \txiuseunicodedestnamefalse % For pdfTeX etc.
1006
1007 \ifx\luatexversion\thisisundefined
1008 \else
1009 % Use Unicode destination names
1010 \txiuseunicodedestnametrue
1011 % Escape PDF strings with converting UTF-16 from UTF-8
1012 \begingroup
1013 \catcode`\%=12
1014 \directlua{
1015 function UTF16oct(str)
1016 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1017 for c in string.utfvalues(str) do
1018 if c < 0x10000 then
1019 tex.sprint(
1020 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1021 string.char(0x5c) .. string.char(0x25) .. '03o',
1022 math.floor(c / 256), math.floor(c % 256)))
1023 else
1024 c = c - 0x10000
1025 local c_hi = c / 1024 + 0xd800
1026 local c_lo = c % 1024 + 0xdc00
1027 tex.sprint(
1028 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1029 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1030 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1031 string.char(0x5c) .. string.char(0x25) .. '03o',
1032 math.floor(c_hi / 256), math.floor(c_hi % 256),
1033 math.floor(c_lo / 256), math.floor(c_lo % 256)))
1034 end
1035 end
1036 end
1037 }
1038 \endgroup
1039 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1040 % Escape PDF strings without converting
1041 \begingroup
1042 \directlua{
1043 function PDFescstr(str)
1044 for c in string.bytes(str) do
1045 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1046 tex.sprint(-2,
1047 string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1048 c))
1049 else
1050 tex.sprint(-2, string.char(c))
1051 end
1052 end
1053 end
1054 }
1055 % The -2 in the arguments here gives all the input to TeX catcode 12
1056 % (other) or 10 (space), preventing undefined control sequence errors. See
1057 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
1058 %
1059 \endgroup
1060 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1061 \ifnum\luatexversion>84
1062 % For LuaTeX >= 0.85
1063 \def\pdfdest{\pdfextension dest}
1064 \let\pdfoutput\outputmode
1065 \def\pdfliteral{\pdfextension literal}
1066 \def\pdfcatalog{\pdfextension catalog}
1067 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1068 \let\pdfximage\saveimageresource
1069 \let\pdfrefximage\useimageresource
1070 \let\pdflastximage\lastsavedimageresourceindex
1071 \def\pdfendlink{\pdfextension endlink\relax}
1072 \def\pdfoutline{\pdfextension outline}
1073 \def\pdfstartlink{\pdfextension startlink}
1074 \def\pdffontattr{\pdfextension fontattr}
1075 \def\pdfobj{\pdfextension obj}
1076 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1077 \let\pdfpagewidth\pagewidth
1078 \let\pdfpageheight\pageheight
1079 \edef\pdfhorigin{\pdfvariable horigin}
1080 \edef\pdfvorigin{\pdfvariable vorigin}
1081 \fi
1082 \fi
1083
1084 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1085 % can be set). So we test for \relax and 0 as well as being undefined.
1086 \ifx\pdfoutput\thisisundefined
1087 \else
1088 \ifx\pdfoutput\relax
1089 \else
1090 \ifcase\pdfoutput
1091 \else
1092 \pdftrue
1093 \fi
1094 \fi
1095 \fi
1096
1097 \newif\ifpdforxetex
1098 \pdforxetexfalse
1099 \ifpdf
1100 \pdforxetextrue
1101 \fi
1102 \ifx\XeTeXrevision\thisisundefined\else
1103 \pdforxetextrue
1104 \fi
1105
1106
1107 % Output page labels information.
1108 % See PDF reference v.1.7 p.594, section 8.3.1.
1109 \ifpdf
1110 \def\pagelabels{%
1111 \def\title{0 << /P (T-) /S /D >>}%
1112 \edef\roman{\the\romancount << /S /r >>}%
1113 \edef\arabic{\the\arabiccount << /S /D >>}%
1114 %
1115 % Page label ranges must be increasing. Remove any duplicates.
1116 % (There is a slight chance of this being wrong if e.g. there is
1117 % a @contents but no @titlepage, etc.)
1118 %
1119 \ifnum\romancount=0 \def\roman{}\fi
1120 \ifnum\arabiccount=0 \def\title{}%
1121 \else
1122 \ifnum\romancount=\arabiccount \def\roman{}\fi
1123 \fi
1124 %
1125 \ifnum\romancount<\arabiccount
1126 \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax
1127 \else
1128 \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax
1129 \fi
1130 }
1131 \else
1132 \let\pagelabels\relax
1133 \fi
1134
1135 \newcount\pagecount \pagecount=0
1136 \newcount\romancount \romancount=0
1137 \newcount\arabiccount \arabiccount=0
1138 \ifpdf
1139 \let\ptxadvancepageno\advancepageno
1140 \def\advancepageno{%
1141 \ptxadvancepageno\global\advance\pagecount by 1
1142 }
1143 \fi
1144
1145
1146 % PDF uses PostScript string constants for the names of xref targets,
1147 % for display in the outlines, and in other places. Thus, we have to
1148 % double any backslashes. Otherwise, a name like "\node" will be
1149 % interpreted as a newline (\n), followed by o, d, e. Not good.
1150 %
1151 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1152 % related messages. The final outcome is that it is up to the TeX user
1153 % to double the backslashes and otherwise make the string valid, so
1154 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1155 % do this reliably, so we use it.
1156
1157 % #1 is a control sequence in which to do the replacements,
1158 % which we \xdef.
1159 \def\txiescapepdf#1{%
1160 \ifx\pdfescapestring\thisisundefined
1161 % No primitive available; should we give a warning or log?
1162 % Many times it won't matter.
1163 \xdef#1{#1}%
1164 \else
1165 % The expandable \pdfescapestring primitive escapes parentheses,
1166 % backslashes, and other special chars.
1167 \xdef#1{\pdfescapestring{#1}}%
1168 \fi
1169 }
1170 \def\txiescapepdfutfsixteen#1{%
1171 \ifx\pdfescapestrutfsixteen\thisisundefined
1172 % No UTF-16 converting macro available.
1173 \txiescapepdf{#1}%
1174 \else
1175 \xdef#1{\pdfescapestrutfsixteen{#1}}%
1176 \fi
1177 }
1178
1179 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1180 with PDF output, and none of those formats could be found. (.eps cannot
1181 be supported due to the design of the PDF format; use regular TeX (DVI
1182 output) for that.)}
1183
1184 \ifpdf
1185 %
1186 % Color manipulation macros using ideas from pdfcolor.tex,
1187 % except using rgb instead of cmyk; the latter is said to render as a
1188 % very dark gray on-screen and a very dark halftone in print, instead
1189 % of actual black. The dark red here is dark enough to print on paper as
1190 % nearly black, but still distinguishable for online viewing. We use
1191 % black by default, though.
1192 \def\rgbDarkRed{0.50 0.09 0.12}
1193 \def\rgbBlack{0 0 0}
1194 %
1195 % rg sets the color for filling (usual text, etc.);
1196 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1197 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1198 %
1199 % Set color, and create a mark which defines \thiscolor accordingly,
1200 % so that \makeheadline knows which color to restore.
1201 \def\setcolor#1{%
1202 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1203 \domark
1204 \pdfsetcolor{#1}%
1205 }
1206 %
1207 \def\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 \def\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
2142 % Set the font macro #1 to the font named \fontprefix#2.
2143 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2144 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2145 % Example:
2146 % #1 = \textrm
2147 % #2 = \rmshape
2148 % #3 = 10
2149 % #4 = \mainmagstep
2150 % #5 = OT1
2151 %
2152 \def\setfont#1#2#3#4#5{%
2153 \font#1=\fontprefix#2#3 scaled #4
2154 \csname cmap#5\endcsname#1%
2155 }
2156 % This is what gets called when #5 of \setfont is empty.
2157 \let\cmap\gobble
2158 %
2159 % (end of cmaps)
2160
2161 % Use cm as the default font prefix.
2162 % To specify the font prefix, you must define \fontprefix
2163 % before you read in texinfo.tex.
2164 \ifx\fontprefix\thisisundefined
2165 \def\fontprefix{cm}
2166 \fi
2167 % Support font families that don't use the same naming scheme as CM.
2168 \def\rmshape{r}
2169 \def\rmbshape{bx} % where the normal face is bold
2170 \def\bfshape{b}
2171 \def\bxshape{bx}
2172 \def\ttshape{tt}
2173 \def\ttbshape{tt}
2174 \def\ttslshape{sltt}
2175 \def\itshape{ti}
2176 \def\itbshape{bxti}
2177 \def\slshape{sl}
2178 \def\slbshape{bxsl}
2179 \def\sfshape{ss}
2180 \def\sfbshape{ss}
2181 \def\scshape{csc}
2182 \def\scbshape{csc}
2183
2184 % Definitions for a main text size of 11pt. (The default in Texinfo.)
2185 %
2186 \def\definetextfontsizexi{%
2187 % Text fonts (11.2pt, magstep1).
2188 \def\textnominalsize{11pt}
2189 \edef\mainmagstep{\magstephalf}
2190 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2191 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2192 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2193 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2194 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2195 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2196 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2197 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2198 \font\texti=cmmi10 scaled \mainmagstep
2199 \font\textsy=cmsy10 scaled \mainmagstep
2200 \def\textecsize{1095}
2201
2202 % A few fonts for @defun names and args.
2203 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2204 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2205 \setfont\defsl\slshape{10}{\magstep1}{OT1}
2206 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2207 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2208 \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2209
2210 % Fonts for indices, footnotes, small examples (9pt).
2211 \def\smallnominalsize{9pt}
2212 \setfont\smallrm\rmshape{9}{1000}{OT1}
2213 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2214 \setfont\smallbf\bfshape{10}{900}{OT1}
2215 \setfont\smallit\itshape{9}{1000}{OT1IT}
2216 \setfont\smallsl\slshape{9}{1000}{OT1}
2217 \setfont\smallsf\sfshape{9}{1000}{OT1}
2218 \setfont\smallsc\scshape{10}{900}{OT1}
2219 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2220 \font\smalli=cmmi9
2221 \font\smallsy=cmsy9
2222 \def\smallecsize{0900}
2223
2224 % Fonts for small examples (8pt).
2225 \def\smallernominalsize{8pt}
2226 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2227 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2228 \setfont\smallerbf\bfshape{10}{800}{OT1}
2229 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2230 \setfont\smallersl\slshape{8}{1000}{OT1}
2231 \setfont\smallersf\sfshape{8}{1000}{OT1}
2232 \setfont\smallersc\scshape{10}{800}{OT1}
2233 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2234 \font\smalleri=cmmi8
2235 \font\smallersy=cmsy8
2236 \def\smallerecsize{0800}
2237
2238 % Fonts for math mode superscripts (7pt).
2239 \def\sevennominalsize{7pt}
2240 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2241 \setfont\seventt\ttshape{10}{700}{OT1TT}
2242 \setfont\sevenbf\bfshape{10}{700}{OT1}
2243 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2244 \setfont\sevensl\slshape{10}{700}{OT1}
2245 \setfont\sevensf\sfshape{10}{700}{OT1}
2246 \setfont\sevensc\scshape{10}{700}{OT1}
2247 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2248 \font\seveni=cmmi7
2249 \font\sevensy=cmsy7
2250 \def\sevenecsize{0700}
2251
2252 % Fonts for title page (20.4pt):
2253 \def\titlenominalsize{20pt}
2254 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2255 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2256 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2257 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2258 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2259 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2260 \let\titlebf=\titlerm
2261 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2262 \font\titlei=cmmi12 scaled \magstep3
2263 \font\titlesy=cmsy10 scaled \magstep4
2264 \def\titleecsize{2074}
2265
2266 % Chapter (and unnumbered) fonts (17.28pt).
2267 \def\chapnominalsize{17pt}
2268 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2269 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2270 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2271 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2272 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2273 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2274 \let\chapbf=\chaprm
2275 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2276 \font\chapi=cmmi12 scaled \magstep2
2277 \font\chapsy=cmsy10 scaled \magstep3
2278 \def\chapecsize{1728}
2279
2280 % Section fonts (14.4pt).
2281 \def\secnominalsize{14pt}
2282 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2283 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2284 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2285 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2286 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2287 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2288 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2289 \let\secbf\secrm
2290 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2291 \font\seci=cmmi12 scaled \magstep1
2292 \font\secsy=cmsy10 scaled \magstep2
2293 \def\sececsize{1440}
2294
2295 % Subsection fonts (13.15pt).
2296 \def\ssecnominalsize{13pt}
2297 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2298 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2299 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2300 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2301 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2302 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2303 \let\ssecbf\ssecrm
2304 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2305 \font\sseci=cmmi12 scaled \magstephalf
2306 \font\ssecsy=cmsy10 scaled 1315
2307 \def\ssececsize{1200}
2308
2309 % Reduced fonts for @acronym in text (10pt).
2310 \def\reducednominalsize{10pt}
2311 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2312 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2313 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2314 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2315 \setfont\reducedsl\slshape{10}{1000}{OT1}
2316 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2317 \setfont\reducedsc\scshape{10}{1000}{OT1}
2318 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2319 \font\reducedi=cmmi10
2320 \font\reducedsy=cmsy10
2321 \def\reducedecsize{1000}
2322
2323 \textleading = 13.2pt % line spacing for 11pt CM
2324 \textfonts % reset the current fonts
2325 \rm
2326 } % end of 11pt text font size definitions, \definetextfontsizexi
2327
2328
2329 % Definitions to make the main text be 10pt Computer Modern, with
2330 % section, chapter, etc., sizes following suit. This is for the GNU
2331 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2332 % future. Used with @smallbook, which sets the leading to 12pt.
2333 %
2334 \def\definetextfontsizex{%
2335 % Text fonts (10pt).
2336 \def\textnominalsize{10pt}
2337 \edef\mainmagstep{1000}
2338 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2339 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2340 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2341 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2342 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2343 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2344 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2345 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2346 \font\texti=cmmi10 scaled \mainmagstep
2347 \font\textsy=cmsy10 scaled \mainmagstep
2348 \def\textecsize{1000}
2349
2350 % A few fonts for @defun names and args.
2351 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2352 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2353 \setfont\defsl\slshape{10}{\magstephalf}{OT1}
2354 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2355 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2356 \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2357
2358 % Fonts for indices, footnotes, small examples (9pt).
2359 \def\smallnominalsize{9pt}
2360 \setfont\smallrm\rmshape{9}{1000}{OT1}
2361 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2362 \setfont\smallbf\bfshape{10}{900}{OT1}
2363 \setfont\smallit\itshape{9}{1000}{OT1IT}
2364 \setfont\smallsl\slshape{9}{1000}{OT1}
2365 \setfont\smallsf\sfshape{9}{1000}{OT1}
2366 \setfont\smallsc\scshape{10}{900}{OT1}
2367 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2368 \font\smalli=cmmi9
2369 \font\smallsy=cmsy9
2370 \def\smallecsize{0900}
2371
2372 % Fonts for small examples (8pt).
2373 \def\smallernominalsize{8pt}
2374 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2375 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2376 \setfont\smallerbf\bfshape{10}{800}{OT1}
2377 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2378 \setfont\smallersl\slshape{8}{1000}{OT1}
2379 \setfont\smallersf\sfshape{8}{1000}{OT1}
2380 \setfont\smallersc\scshape{10}{800}{OT1}
2381 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2382 \font\smalleri=cmmi8
2383 \font\smallersy=cmsy8
2384 \def\smallerecsize{0800}
2385
2386 % Fonts for math mode superscripts (7pt).
2387 \def\sevennominalsize{7pt}
2388 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2389 \setfont\seventt\ttshape{10}{700}{OT1TT}
2390 \setfont\sevenbf\bfshape{10}{700}{OT1}
2391 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2392 \setfont\sevensl\slshape{10}{700}{OT1}
2393 \setfont\sevensf\sfshape{10}{700}{OT1}
2394 \setfont\sevensc\scshape{10}{700}{OT1}
2395 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2396 \font\seveni=cmmi7
2397 \font\sevensy=cmsy7
2398 \def\sevenecsize{0700}
2399
2400 % Fonts for title page (20.4pt):
2401 \def\titlenominalsize{20pt}
2402 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2403 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2404 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2405 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2406 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2407 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2408 \let\titlebf=\titlerm
2409 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2410 \font\titlei=cmmi12 scaled \magstep3
2411 \font\titlesy=cmsy10 scaled \magstep4
2412 \def\titleecsize{2074}
2413
2414 % Chapter fonts (14.4pt).
2415 \def\chapnominalsize{14pt}
2416 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2417 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2418 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2419 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2420 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2421 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2422 \let\chapbf\chaprm
2423 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2424 \font\chapi=cmmi12 scaled \magstep1
2425 \font\chapsy=cmsy10 scaled \magstep2
2426 \def\chapecsize{1440}
2427
2428 % Section fonts (12pt).
2429 \def\secnominalsize{12pt}
2430 \setfont\secrm\rmbshape{12}{1000}{OT1}
2431 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2432 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2433 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2434 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2435 \setfont\secsf\sfbshape{12}{1000}{OT1}
2436 \let\secbf\secrm
2437 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2438 \font\seci=cmmi12
2439 \font\secsy=cmsy10 scaled \magstep1
2440 \def\sececsize{1200}
2441
2442 % Subsection fonts (10pt).
2443 \def\ssecnominalsize{10pt}
2444 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2445 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2446 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2447 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2448 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2449 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2450 \let\ssecbf\ssecrm
2451 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2452 \font\sseci=cmmi10
2453 \font\ssecsy=cmsy10
2454 \def\ssececsize{1000}
2455
2456 % Reduced fonts for @acronym in text (9pt).
2457 \def\reducednominalsize{9pt}
2458 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2459 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2460 \setfont\reducedbf\bfshape{10}{900}{OT1}
2461 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2462 \setfont\reducedsl\slshape{9}{1000}{OT1}
2463 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2464 \setfont\reducedsc\scshape{10}{900}{OT1}
2465 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2466 \font\reducedi=cmmi9
2467 \font\reducedsy=cmsy9
2468 \def\reducedecsize{0900}
2469
2470 \divide\parskip by 2 % reduce space between paragraphs
2471 \textleading = 12pt % line spacing for 10pt CM
2472 \textfonts % reset the current fonts
2473 \rm
2474 } % end of 10pt text font size definitions, \definetextfontsizex
2475
2476 % Fonts for short table of contents.
2477 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2478 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2479 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2480 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2481
2482
2483 % We provide the user-level command
2484 % @fonttextsize 10
2485 % (or 11) to redefine the text font size. pt is assumed.
2486 %
2487 \def\xiword{11}
2488 \def\xword{10}
2489 \def\xwordpt{10pt}
2490 %
2491 \parseargdef\fonttextsize{%
2492 \def\textsizearg{#1}%
2493 %\wlog{doing @fonttextsize \textsizearg}%
2494 %
2495 % Set \globaldefs so that documents can use this inside @tex, since
2496 % makeinfo 4.8 does not support it, but we need it nonetheless.
2497 %
2498 \begingroup \globaldefs=1
2499 \ifx\textsizearg\xword \definetextfontsizex
2500 \else \ifx\textsizearg\xiword \definetextfontsizexi
2501 \else
2502 \errhelp=\EMsimple
2503 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2504 \fi\fi
2505 \endgroup
2506 }
2507
2508 %
2509 % Change the current font style to #1, remembering it in \curfontstyle.
2510 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2511 % italics, not bold italics.
2512 %
2513 \def\setfontstyle#1{%
2514 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2515 \csname #1font\endcsname % change the current font
2516 }
2517
2518 \def\rm{\fam=0 \setfontstyle{rm}}
2519 \def\it{\fam=\itfam \setfontstyle{it}}
2520 \def\sl{\fam=\slfam \setfontstyle{sl}}
2521 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2522 \def\tt{\fam=\ttfam \setfontstyle{tt}}
2523
2524 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
2525 % So we set up a \sf.
2526 \newfam\sffam
2527 \def\sf{\fam=\sffam \setfontstyle{sf}}
2528
2529 % We don't need math for this font style.
2530 \def\ttsl{\setfontstyle{ttsl}}
2531
2532
2533 % In order for the font changes to affect most math symbols and letters,
2534 % we have to define the \textfont of the standard families.
2535 % We don't bother to reset \scriptscriptfont; awaiting user need.
2536 %
2537 \def\resetmathfonts{%
2538 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2539 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2540 \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2541 %
2542 % Fonts for superscript. Note that the 7pt fonts are used regardless
2543 % of the current font size.
2544 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
2545 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
2546 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
2547 \scriptfont\sffam=\sevensf
2548 }
2549
2550
2551
2552 % \defineassignfonts{SIZE} -
2553 % Define sequence \assignfontsSIZE, which switches between font sizes
2554 % by redefining the meanings of \STYLEfont. (Just \STYLE additionally sets
2555 % the current \fam for math mode.)
2556 %
2557 \def\defineassignfonts#1{%
2558 \expandafter\edef\csname assignfonts#1\endcsname{%
2559 \let\noexpand\rmfont\csname #1rm\endcsname
2560 \let\noexpand\itfont\csname #1it\endcsname
2561 \let\noexpand\slfont\csname #1sl\endcsname
2562 \let\noexpand\bffont\csname #1bf\endcsname
2563 \let\noexpand\ttfont\csname #1tt\endcsname
2564 \let\noexpand\smallcaps\csname #1sc\endcsname
2565 \let\noexpand\sffont \csname #1sf\endcsname
2566 \let\noexpand\ifont \csname #1i\endcsname
2567 \let\noexpand\syfont \csname #1sy\endcsname
2568 \let\noexpand\ttslfont\csname #1ttsl\endcsname
2569 }
2570 }
2571
2572 \def\assignfonts#1{%
2573 \csname assignfonts#1\endcsname
2574 }
2575
2576 \newif\ifrmisbold
2577
2578 % Select smaller font size with the current style. Used to change font size
2579 % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
2580 % normal roman text, also use bold fonts for roman text in the smaller size.
2581 \def\switchtolllsize{%
2582 \expandafter\assignfonts\expandafter{\lllsize}%
2583 \ifrmisbold
2584 \let\rmfont\bffont
2585 \fi
2586 \csname\curfontstyle\endcsname
2587 }%
2588
2589 \def\switchtolsize{%
2590 \expandafter\assignfonts\expandafter{\lsize}%
2591 \ifrmisbold
2592 \let\rmfont\bffont
2593 \fi
2594 \csname\curfontstyle\endcsname
2595 }%
2596
2597 % Define the font-changing commands (all called \...fonts).
2598 % Each font-changing command also sets the names \lsize (one size lower)
2599 % and \lllsize (three sizes lower). These relative commands are used
2600 % in, e.g., the LaTeX logo and acronyms.
2601 %
2602 % Note: The fonts used for \ifont are for "math italics" (\itfont is for
2603 % italics in regular text). \syfont is also used in math mode only.
2604 %
2605 \def\definefontsetatsize#1#2#3#4#5{%
2606 \defineassignfonts{#1}%
2607 \expandafter\def\csname #1fonts\endcsname{%
2608 \def\curfontsize{#1}%
2609 \def\lsize{#2}\def\lllsize{#3}%
2610 \csname rmisbold#5\endcsname
2611 \csname assignfonts#1\endcsname
2612 \resetmathfonts
2613 \setleading{#4}%
2614 }}
2615
2616 \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
2617 \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
2618 \definefontsetatsize{chap} {sec} {text} {19pt} {true}
2619 \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
2620 \definefontsetatsize{ssec} {text} {small} {15pt} {true}
2621 \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
2622 \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
2623 \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2624
2625 \def\titlefont#1{{\titlefonts\rm #1}}
2626 \let\subsecfonts = \ssecfonts
2627 \let\subsubsecfonts = \ssecfonts
2628
2629 % Define these just so they can be easily changed for other fonts.
2630 \def\angleleft{$\langle$}
2631 \def\angleright{$\rangle$}
2632
2633 % Set the fonts to use with the @small... environments.
2634 \let\smallexamplefonts = \smallfonts
2635
2636 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2637 % can fit this many characters:
2638 % 8.5x11=86 smallbook=72 a4=90 a5=69
2639 % If we use \scriptfonts (8pt), then we can fit this many characters:
2640 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2641 % For me, subjectively, the few extra characters that fit aren't worth
2642 % the additional smallness of 8pt. So I'm making the default 9pt.
2643 %
2644 % By the way, for comparison, here's what fits with @example (10pt):
2645 % 8.5x11=71 smallbook=60 a4=75 a5=58
2646 % --karl, 24jan03.
2647
2648 % Set up the default fonts, so we can use them for creating boxes.
2649 %
2650 \definetextfontsizexi
2651
2652
2653 % Check if we are currently using a typewriter font. Since all the
2654 % Computer Modern typewriter fonts have zero interword stretch (and
2655 % shrink), and it is reasonable to expect all typewriter fonts to have
2656 % this property, we can check that font parameter. #1 is what to
2657 % print if we are indeed using \tt; #2 is what to print otherwise.
2658 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
2659
2660 % Same as above, but check for italic font. Actually this also catches
2661 % non-italic slanted fonts since it is impossible to distinguish them from
2662 % italic fonts. But since this is only used by $ and it uses \sl anyway
2663 % this is not a problem.
2664 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
2665
2666
2667 % Check if internal flag is clear, i.e. has not been @set.
2668 \def\ifflagclear#1#2#3{%
2669 \expandafter\ifx\csname SET#1\endcsname\relax
2670 #2\else#3\fi
2671 }
2672
2673 {
2674 \catcode`\'=\active
2675 \catcode`\`=\active
2676
2677 \gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
2678 \gdef\setregularquotes{\let`\lq \let'\rq}
2679 }
2680
2681 % Allow an option to not use regular directed right quote/apostrophe
2682 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2683 % The undirected quote is ugly, so don't make it the default, but it
2684 % works for pasting with more pdf viewers (at least evince), the
2685 % lilypond developers report. xpdf does work with the regular 0x27.
2686 %
2687 \def\codequoteright{%
2688 \ifusingtt
2689 {\ifflagclear{txicodequoteundirected}%
2690 {\ifflagclear{codequoteundirected}%
2691 {'}%
2692 {\char'15 }}%
2693 {\char'15 }}%
2694 {'}%
2695 }
2696
2697 % and a similar option for the left quote char vs. a grave accent.
2698 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2699 % the code environments to do likewise.
2700 % \relax disables Spanish ligatures ?` and !` of \tt font.
2701 %
2702 \def\codequoteleft{%
2703 \ifusingtt
2704 {\ifflagclear{txicodequotebacktick}%
2705 {\ifflagclear{codequotebacktick}%
2706 {\relax`}%
2707 {\char'22 }}%
2708 {\char'22 }}%
2709 {\relax`}%
2710 }
2711
2712 % Commands to set the quote options.
2713 %
2714 \parseargdef\codequoteundirected{%
2715 \def\temp{#1}%
2716 \ifx\temp\onword
2717 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2718 = t%
2719 \else\ifx\temp\offword
2720 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2721 = \relax
2722 \else
2723 \errhelp = \EMsimple
2724 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2725 \fi\fi
2726 }
2727 %
2728 \parseargdef\codequotebacktick{%
2729 \def\temp{#1}%
2730 \ifx\temp\onword
2731 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2732 = t%
2733 \else\ifx\temp\offword
2734 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2735 = \relax
2736 \else
2737 \errhelp = \EMsimple
2738 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2739 \fi\fi
2740 }
2741
2742 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2743 \def\noligaturesquoteleft{\relax\lq}
2744
2745 % Count depth in font-changes, for error checks
2746 \newcount\fontdepth \fontdepth=0
2747
2748 % Font commands.
2749
2750 % #1 is the font command (\sl or \it), #2 is the text to slant.
2751 % If we are in a monospaced environment, however, 1) always use \ttsl,
2752 % and 2) do not add an italic correction.
2753 \def\dosmartslant#1#2{%
2754 \ifusingtt
2755 {{\ttsl #2}\let\next=\relax}%
2756 {\def\next{{#1#2}\smartitaliccorrection}}%
2757 \next
2758 }
2759 \def\smartslanted{\dosmartslant\sl}
2760 \def\smartitalic{\dosmartslant\it}
2761
2762 % Output an italic correction unless the following character is such as
2763 % not to need one.
2764 \def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx}
2765 \def\smartitaliccorrectionx{%
2766 \ifx\next,%
2767 \else\ifx\next-%
2768 \else\ifx\next.%
2769 \else\ifx\next\.%
2770 \else\ifx\next\comma%
2771 \else\ptexslash
2772 \fi\fi\fi\fi\fi
2773 \aftersmartic
2774 }
2775
2776 % @cite unconditionally uses \sl with \smartitaliccorrection.
2777 \def\cite#1{{\sl #1}\smartitaliccorrection}
2778
2779 % @var unconditionally uses \sl. This gives consistency for
2780 % parameter names whether they are in @def, @table @code or a
2781 % regular paragraph.
2782 % To get ttsl font for @var when used in code context, @set txicodevaristt.
2783 % The \null is to reset \spacefactor.
2784 \def\aftersmartic{}
2785 \def\var#1{%
2786 \let\saveaftersmartic = \aftersmartic
2787 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2788 %
2789 \ifflagclear{txicodevaristt}%
2790 {\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
2791 {\def\varnext{\smartslanted{#1}}}%
2792 \varnext
2793 }
2794
2795 % To be removed after next release
2796 \def\SETtxicodevaristt{}% @set txicodevaristt
2797
2798 \let\i=\smartitalic
2799 \let\slanted=\smartslanted
2800 \let\dfn=\smartslanted
2801 \let\emph=\smartitalic
2802
2803 % @r for roman font, used for code comment
2804 \def\r#1{{%
2805 \usenormaldash % get --, --- ligatures even if in @code
2806 \defcharsdefault % in case on def line
2807 \rm #1}}
2808 {\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}}
2809
2810 % @sc, undocumented @ii.
2811 \def\sc#1{{\smallcaps#1}} % smallcaps font
2812 \def\ii#1{{\it #1}} % italic font
2813
2814 % @b, explicit bold. Also @strong.
2815 \def\b#1{{\bf #1}}
2816 \let\strong=\b
2817
2818 % @sansserif, explicit sans.
2819 \def\sansserif#1{{\sf #1}}
2820
2821 % We can't just use \exhyphenpenalty, because that only has effect at
2822 % the end of a paragraph. Restore normal hyphenation at the end of the
2823 % group within which \nohyphenation is presumably called.
2824 %
2825 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2826 \def\restorehyphenation{\hyphenchar\font = `- }
2827
2828 \newif\iffrenchspacing
2829 \frenchspacingfalse
2830
2831 % Set sfcode to normal for the chars that usually have another value.
2832 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2833 % sometimes \x has an active definition that messes things up.
2834 %
2835 \catcode`@=11
2836 \def\plainfrenchspacing{%
2837 \iffrenchspacing\else
2838 \frenchspacingtrue
2839 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2840 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2841 \def\endofsentencespacefactor{1000}% for @. and friends
2842 \fi
2843 }
2844 \def\plainnonfrenchspacing{%
2845 \iffrenchspacing
2846 \frenchspacingfalse
2847 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2848 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2849 \def\endofsentencespacefactor{3000}% for @. and friends
2850 \fi
2851 }
2852 \catcode`@=\other
2853 \def\endofsentencespacefactor{3000}% default
2854
2855 % @frenchspacing on|off says whether to put extra space after punctuation.
2856 %
2857 \def\onword{on}
2858 \def\offword{off}
2859 %
2860 \let\frenchspacingsetting\plainnonfrenchspacing % used in output routine
2861 \parseargdef\frenchspacing{%
2862 \def\temp{#1}%
2863 \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing
2864 \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing
2865 \else
2866 \errhelp = \EMsimple
2867 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
2868 \fi\fi
2869 \frenchspacingsetting
2870 }
2871
2872
2873 % @t, explicit typewriter.
2874 \def\t#1{%
2875 {\tt \defcharsdefault \plainfrenchspacing #1}%
2876 \null
2877 }
2878
2879 % @samp.
2880 \def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
2881
2882 % @indicateurl is \samp, that is, with quotes.
2883 \let\indicateurl=\samp
2884
2885 % @code (and similar) prints in typewriter, but with spaces the same
2886 % size as normal in the surrounding text, without hyphenation, etc.
2887 % This is a subroutine for that.
2888 \def\tclose#1{%
2889 {%
2890 % Change normal interword space to be same as for the current font.
2891 \spaceskip = \fontdimen2\font
2892 %
2893 % Switch to typewriter.
2894 \tt
2895 %
2896 % But `\ ' produces the large typewriter interword space.
2897 \def\ {{\spaceskip = 0pt{} }}%
2898 %
2899 % Turn off hyphenation.
2900 \nohyphenation
2901 %
2902 \plainfrenchspacing
2903 #1%
2904 }%
2905 \null % reset spacefactor to 1000
2906 }
2907
2908 % We *must* turn on hyphenation at `-' and `_' in @code.
2909 % (But see \codedashfinish below.)
2910 % Otherwise, it is too hard to avoid overfull hboxes
2911 % in the Emacs manual, the Library manual, etc.
2912 %
2913 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2914 % both hyphenation at - and hyphenation within words.
2915 % We must therefore turn them both off (\tclose does that)
2916 % and arrange explicitly to hyphenate at a dash. -- rms.
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-\normaldash
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 \nohyphenation \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 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3747 \endgroup\page\hbox{}\page}
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
4798 % Used for the aux, toc and index files to prevent expansion of Texinfo
4799 % commands.
4800 %
4801 \def\atdummies{%
4802 \definedummyletter\@%
4803 \definedummyletter\ %
4804 \definedummyletter\{%
4805 \definedummyletter\}%
4806 \definedummyletter\&%
4807 %
4808 % Do the redefinitions.
4809 \definedummies
4810 \otherbackslash
4811 }
4812
4813 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4814 % preventing its expansion. This is used only for control words,
4815 % not control letters, because the \space would be incorrect for
4816 % control characters, but is needed to separate the control word
4817 % from whatever follows.
4818 %
4819 % These can be used both for control words that take an argument and
4820 % those that do not. If it is followed by {arg} in the input, then
4821 % that will dutifully get written to the index (or wherever).
4822 %
4823 % For control letters, we have \definedummyletter, which omits the
4824 % space.
4825 %
4826 \def\definedummyword #1{\def#1{\string#1\space}}%
4827 \def\definedummyletter#1{\def#1{\string#1}}%
4828 \let\definedummyaccent\definedummyletter
4829
4830 % Called from \atdummies to prevent the expansion of commands.
4831 %
4832 \def\definedummies{%
4833 %
4834 \let\commondummyword\definedummyword
4835 \let\commondummyletter\definedummyletter
4836 \let\commondummyaccent\definedummyaccent
4837 \commondummiesnofonts
4838 %
4839 \definedummyletter\_%
4840 \definedummyletter\-%
4841 %
4842 % Non-English letters.
4843 \definedummyword\AA
4844 \definedummyword\AE
4845 \definedummyword\DH
4846 \definedummyword\L
4847 \definedummyword\O
4848 \definedummyword\OE
4849 \definedummyword\TH
4850 \definedummyword\aa
4851 \definedummyword\ae
4852 \definedummyword\dh
4853 \definedummyword\exclamdown
4854 \definedummyword\l
4855 \definedummyword\o
4856 \definedummyword\oe
4857 \definedummyword\ordf
4858 \definedummyword\ordm
4859 \definedummyword\questiondown
4860 \definedummyword\ss
4861 \definedummyword\th
4862 %
4863 % Although these internal commands shouldn't show up, sometimes they do.
4864 \definedummyword\bf
4865 \definedummyword\gtr
4866 \definedummyword\hat
4867 \definedummyword\less
4868 \definedummyword\sf
4869 \definedummyword\sl
4870 \definedummyword\tclose
4871 \definedummyword\tt
4872 %
4873 \definedummyword\LaTeX
4874 \definedummyword\TeX
4875 %
4876 % Assorted special characters.
4877 \definedummyword\ampchar
4878 \definedummyword\atchar
4879 \definedummyword\arrow
4880 \definedummyword\backslashchar
4881 \definedummyword\bullet
4882 \definedummyword\comma
4883 \definedummyword\copyright
4884 \definedummyword\registeredsymbol
4885 \definedummyword\dots
4886 \definedummyword\enddots
4887 \definedummyword\entrybreak
4888 \definedummyword\equiv
4889 \definedummyword\error
4890 \definedummyword\euro
4891 \definedummyword\expansion
4892 \definedummyword\geq
4893 \definedummyword\guillemetleft
4894 \definedummyword\guillemetright
4895 \definedummyword\guilsinglleft
4896 \definedummyword\guilsinglright
4897 \definedummyword\lbracechar
4898 \definedummyword\leq
4899 \definedummyword\mathopsup
4900 \definedummyword\minus
4901 \definedummyword\ogonek
4902 \definedummyword\pounds
4903 \definedummyword\point
4904 \definedummyword\print
4905 \definedummyword\quotedblbase
4906 \definedummyword\quotedblleft
4907 \definedummyword\quotedblright
4908 \definedummyword\quoteleft
4909 \definedummyword\quoteright
4910 \definedummyword\quotesinglbase
4911 \definedummyword\rbracechar
4912 \definedummyword\result
4913 \definedummyword\sub
4914 \definedummyword\sup
4915 \definedummyword\textdegree
4916 %
4917 \definedummyword\subentry
4918 %
4919 % We want to disable all macros so that they are not expanded by \write.
4920 \macrolist
4921 \let\value\dummyvalue
4922 %
4923 \normalturnoffactive
4924 }
4925
4926 % \commondummiesnofonts: common to \definedummies and \indexnofonts.
4927 % Define \commondummyletter, \commondummyaccent and \commondummyword before
4928 % using. Used for accents, font commands, and various control letters.
4929 %
4930 \def\commondummiesnofonts{%
4931 % Control letters and accents.
4932 \commondummyletter\!%
4933 \commondummyaccent\"%
4934 \commondummyaccent\'%
4935 \commondummyletter\*%
4936 \commondummyaccent\,%
4937 \commondummyletter\.%
4938 \commondummyletter\/%
4939 \commondummyletter\:%
4940 \commondummyaccent\=%
4941 \commondummyletter\?%
4942 \commondummyaccent\^%
4943 \commondummyaccent\`%
4944 \commondummyaccent\~%
4945 \commondummyword\u
4946 \commondummyword\v
4947 \commondummyword\H
4948 \commondummyword\dotaccent
4949 \commondummyword\ogonek
4950 \commondummyword\ringaccent
4951 \commondummyword\tieaccent
4952 \commondummyword\ubaraccent
4953 \commondummyword\udotaccent
4954 \commondummyword\dotless
4955 %
4956 % Texinfo font commands.
4957 \commondummyword\b
4958 \commondummyword\i
4959 \commondummyword\r
4960 \commondummyword\sansserif
4961 \commondummyword\sc
4962 \commondummyword\slanted
4963 \commondummyword\t
4964 %
4965 % Commands that take arguments.
4966 \commondummyword\abbr
4967 \commondummyword\acronym
4968 \commondummyword\anchor
4969 \commondummyword\cite
4970 \commondummyword\code
4971 \commondummyword\command
4972 \commondummyword\dfn
4973 \commondummyword\dmn
4974 \commondummyword\email
4975 \commondummyword\emph
4976 \commondummyword\env
4977 \commondummyword\file
4978 \commondummyword\image
4979 \commondummyword\indicateurl
4980 \commondummyword\inforef
4981 \commondummyword\kbd
4982 \commondummyword\key
4983 \commondummyword\math
4984 \commondummyword\option
4985 \commondummyword\pxref
4986 \commondummyword\ref
4987 \commondummyword\samp
4988 \commondummyword\strong
4989 \commondummyword\tie
4990 \commondummyword\U
4991 \commondummyword\uref
4992 \commondummyword\url
4993 \commondummyword\var
4994 \commondummyword\verb
4995 \commondummyword\w
4996 \commondummyword\xref
4997 }
4998
4999 \let\indexlbrace\relax
5000 \let\indexrbrace\relax
5001 \let\indexatchar\relax
5002 \let\indexbackslash\relax
5003
5004 {\catcode`\@=0
5005 \catcode`\\=13
5006 @gdef@backslashdisappear{@def\{}}
5007 }
5008
5009 {
5010 \catcode`\<=13
5011 \catcode`\-=13
5012 \catcode`\`=13
5013 \gdef\indexnonalnumdisappear{%
5014 \ifflagclear{txiindexlquoteignore}{}{%
5015 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5016 % (Introduced for FSFS 2nd ed.)
5017 \let`=\empty
5018 }%
5019 %
5020 \ifflagclear{txiindexbackslashignore}{}{%
5021 \backslashdisappear
5022 }%
5023 \ifflagclear{txiindexhyphenignore}{}{%
5024 \def-{}%
5025 }%
5026 \ifflagclear{txiindexlessthanignore}{}{%
5027 \def<{}%
5028 }%
5029 \ifflagclear{txiindexatsignignore}{}{%
5030 \def\@{}%
5031 }%
5032 }
5033
5034 \gdef\indexnonalnumreappear{%
5035 \let-\normaldash
5036 \let<\normalless
5037 }
5038 }
5039
5040
5041 % \indexnofonts is used when outputting the strings to sort the index
5042 % by, and when constructing control sequence names. It eliminates all
5043 % control sequences and just writes whatever the best ASCII sort string
5044 % would be for a given command (usually its argument).
5045 %
5046 \def\indexnofonts{%
5047 % Accent commands should become @asis.
5048 \def\commondummyaccent##1{\let##1\asis}%
5049 % We can just ignore other control letters.
5050 \def\commondummyletter##1{\let##1\empty}%
5051 % All control words become @asis by default; overrides below.
5052 \let\commondummyword\commondummyaccent
5053 \commondummiesnofonts
5054 %
5055 % Don't no-op \tt, since it isn't a user-level command
5056 % and is used in the definitions of the active chars like <, >, |, etc.
5057 % Likewise with the other plain tex font commands.
5058 %\let\tt=\asis
5059 %
5060 \def\ { }%
5061 \def\@{@}%
5062 \def\_{\normalunderscore}%
5063 \def\-{}% @- shouldn't affect sorting
5064 %
5065 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5066 \uccode`\1=`\} \uppercase{\def\}{1}}%
5067 \let\lbracechar\{%
5068 \let\rbracechar\}%
5069 %
5070 % Non-English letters.
5071 \def\AA{AA}%
5072 \def\AE{AE}%
5073 \def\DH{DZZ}%
5074 \def\L{L}%
5075 \def\OE{OE}%
5076 \def\O{O}%
5077 \def\TH{TH}%
5078 \def\aa{aa}%
5079 \def\ae{ae}%
5080 \def\dh{dzz}%
5081 \def\exclamdown{!}%
5082 \def\l{l}%
5083 \def\oe{oe}%
5084 \def\ordf{a}%
5085 \def\ordm{o}%
5086 \def\o{o}%
5087 \def\questiondown{?}%
5088 \def\ss{ss}%
5089 \def\th{th}%
5090 %
5091 \let\do\indexnofontsdef
5092 %
5093 \do\LaTeX{LaTeX}%
5094 \do\TeX{TeX}%
5095 %
5096 % Assorted special characters.
5097 \do\atchar{@}%
5098 \do\arrow{->}%
5099 \do\bullet{bullet}%
5100 \do\comma{,}%
5101 \do\copyright{copyright}%
5102 \do\dots{...}%
5103 \do\enddots{...}%
5104 \do\equiv{==}%
5105 \do\error{error}%
5106 \do\euro{euro}%
5107 \do\expansion{==>}%
5108 \do\geq{>=}%
5109 \do\guillemetleft{<<}%
5110 \do\guillemetright{>>}%
5111 \do\guilsinglleft{<}%
5112 \do\guilsinglright{>}%
5113 \do\leq{<=}%
5114 \do\lbracechar{\{}%
5115 \do\minus{-}%
5116 \do\point{.}%
5117 \do\pounds{pounds}%
5118 \do\print{-|}%
5119 \do\quotedblbase{"}%
5120 \do\quotedblleft{"}%
5121 \do\quotedblright{"}%
5122 \do\quoteleft{`}%
5123 \do\quoteright{'}%
5124 \do\quotesinglbase{,}%
5125 \do\rbracechar{\}}%
5126 \do\registeredsymbol{R}%
5127 \do\result{=>}%
5128 \do\textdegree{o}%
5129 %
5130 % We need to get rid of all macros, leaving only the arguments (if present).
5131 % Of course this is not nearly correct, but it is the best we can do for now.
5132 % makeinfo does not expand macros in the argument to @deffn, which ends up
5133 % writing an index entry, and texindex isn't prepared for an index sort entry
5134 % that starts with \.
5135 %
5136 % Since macro invocations are followed by braces, we can just redefine them
5137 % to take a single TeX argument. The case of a macro invocation that
5138 % goes to end-of-line is not handled.
5139 %
5140 \macrolist
5141 \let\value\indexnofontsvalue
5142 }
5143
5144 % Give the control sequence a definition that removes the {} that follows
5145 % its use, e.g. @AA{} -> AA
5146 \def\indexnofontsdef#1#2{\def#1##1{#2}}%
5147
5148
5150
5151
5152 % #1 is the index name, #2 is the entry text.
5153 \def\doind#1#2{%
5154 \iflinks
5155 {%
5156 %
5157 \requireopenindexfile{#1}%
5158 \edef\writeto{\csname#1indfile\endcsname}%
5159 %
5160 \def\indextext{#2}%
5161 \safewhatsit\doindwrite
5162 }%
5163 \fi
5164 }
5165
5166 % Same as \doind, but for code indices
5167 \def\docind#1#2{%
5168 \iflinks
5169 {%
5170 %
5171 \requireopenindexfile{#1}%
5172 \edef\writeto{\csname#1indfile\endcsname}%
5173 %
5174 \def\indextext{#2}%
5175 \safewhatsit\docindwrite
5176 }%
5177 \fi
5178 }
5179
5180 % Check if an index file has been opened, and if not, open it.
5181 \def\requireopenindexfile#1{%
5182 \ifnum\csname #1indfile\endcsname=0
5183 \expandafter\newwrite \csname#1indfile\endcsname
5184 \edef\suffix{#1}%
5185 % A .fls suffix would conflict with the file extension for the output
5186 % of -recorder, so use .f1s instead.
5187 \ifx\suffix\indexisfl\def\suffix{f1}\fi
5188 % Open the file
5189 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5190 % Using \immediate above here prevents an object entering into the current
5191 % box, which could confound checks such as those in \safewhatsit for
5192 % preceding skips.
5193 \typeout{Writing index file \jobname.\suffix}%
5194 \fi}
5195 \def\indexisfl{fl}
5196
5197 % Definition for writing index entry sort key.
5198 {
5199 \catcode`\-=13
5200 \gdef\indexwritesortas{%
5201 \begingroup
5202 \indexnonalnumreappear
5203 \indexwritesortasxxx}
5204 \gdef\indexwritesortasxxx#1{%
5205 \xdef\indexsortkey{#1}\endgroup}
5206 }
5207
5208 \def\indexwriteseealso#1{
5209 \gdef\pagenumbertext{\string\seealso{#1}}%
5210 }
5211 \def\indexwriteseeentry#1{
5212 \gdef\pagenumbertext{\string\seeentry{#1}}%
5213 }
5214
5215 % The default definitions
5216 \def\sortas#1{}%
5217 \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
5218 \def\putwordSeeAlso{See also}
5219 \def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
5220
5221
5222 % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
5223 % * Set \bracedtext to "{aaa}{bbb}"
5224 % * Set \fullindexsortkey to "aaa @subentry ZZZ"
5225 % * If @seealso occurs, set \pagenumbertext
5226 %
5227 \def\splitindexentry#1{%
5228 \gdef\fullindexsortkey{}%
5229 \xdef\bracedtext{}%
5230 \def\sep{}%
5231 \def\seealso##1{}%
5232 \def\seeentry##1{}%
5233 \expandafter\doindexsegment#1\subentry\finish\subentry
5234 }
5235
5236 % append the results from the next segment
5237 \def\doindexsegment#1\subentry{%
5238 \def\segment{#1}%
5239 \ifx\segment\isfinish
5240 \else
5241 %
5242 % Fully expand the segment, throwing away any @sortas directives, and
5243 % trim spaces.
5244 \edef\trimmed{\segment}%
5245 \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5246 \ifincodeindex
5247 \edef\trimmed{\noexpand\code{\trimmed}}%
5248 \fi
5249 %
5250 \xdef\bracedtext{\bracedtext{\trimmed}}%
5251 %
5252 % Get the string to sort by. Process the segment with all
5253 % font commands turned off.
5254 \bgroup
5255 \let\sortas\indexwritesortas
5256 \let\seealso\indexwriteseealso
5257 \let\seeentry\indexwriteseeentry
5258 \indexnofonts
5259 % The braces around the commands are recognized by texindex.
5260 \def\lbracechar{{\string\indexlbrace}}%
5261 \def\rbracechar{{\string\indexrbrace}}%
5262 \let\{=\lbracechar
5263 \let\}=\rbracechar
5264 \def\@{{\string\indexatchar}}%
5265 \def\atchar##1{\@}%
5266 \def\backslashchar{{\string\indexbackslash}}%
5267 \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
5268 %
5269 \let\indexsortkey\empty
5270 \global\let\pagenumbertext\empty
5271 % Execute the segment and throw away the typeset output. This executes
5272 % any @sortas or @seealso commands in this segment.
5273 \setbox\dummybox = \hbox{\segment}%
5274 \ifx\indexsortkey\empty{%
5275 \indexnonalnumdisappear
5276 \xdef\trimmed{\segment}%
5277 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5278 \xdef\indexsortkey{\trimmed}%
5279 \ifx\indexsortkey\empty
5280 \message{Empty index sort key near line \the\inputlineno}%
5281 \xdef\indexsortkey{ }%
5282 \fi
5283 }\fi
5284 %
5285 % Append to \fullindexsortkey.
5286 \edef\tmp{\gdef\noexpand\fullindexsortkey{%
5287 \fullindexsortkey\sep\indexsortkey}}%
5288 \tmp
5289 \egroup
5290 \def\sep{\subentry}%
5291 %
5292 \expandafter\doindexsegment
5293 \fi
5294 }
5295 \def\isfinish{\finish}%
5296 \newbox\dummybox % used above
5297
5298 \let\subentry\relax
5299
5300 % Use \ instead of @ in index files. To support old texi2dvi and texindex.
5301 % This works without changing the escape character used in the toc or aux
5302 % files because the index entries are fully expanded here, and \string uses
5303 % the current value of \escapechar.
5304 \def\escapeisbackslash{\escapechar=`\\}
5305
5306 % Use \ in index files by default. texi2dvi didn't support @ as the escape
5307 % character (as it checked for "\entry" in the files, and not "@entry"). When
5308 % the new version of texi2dvi has had a chance to become more prevalent, then
5309 % the escape character can change back to @ again. This should be an easy
5310 % change to make now because both @ and \ are only used as escape characters in
5311 % index files, never standing for themselves.
5312 %
5313 \set txiindexescapeisbackslash
5314
5315 % Write the entry in \indextext to the index file.
5316 %
5317
5318 \newif\ifincodeindex
5319 \def\doindwrite{\incodeindexfalse\doindwritex}
5320 \def\docindwrite{\incodeindextrue\doindwritex}
5321
5322 \def\doindwritex{%
5323 \maybemarginindex
5324 %
5325 \atdummies
5326 %
5327 \ifflagclear{txiindexescapeisbackslash}{}{\escapeisbackslash}%
5328 %
5329 % For texindex which always views { and } as separators.
5330 \def\{{\lbracechar{}}%
5331 \def\}{\rbracechar{}}%
5332 \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
5333 %
5334 % Split the entry into primary entry and any subentries, and get the index
5335 % sort key.
5336 \splitindexentry\indextext
5337 %
5338 % Set up the complete index entry, with both the sort key and
5339 % the original text, including any font commands. We write
5340 % three arguments to \entry to the .?? file (four in the
5341 % subentry case), texindex reduces to two when writing the .??s
5342 % sorted result.
5343 %
5344 \edef\temp{%
5345 \write\writeto{%
5346 \string\entry{\fullindexsortkey}%
5347 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
5348 \bracedtext}%
5349 }%
5350 \temp
5351 }
5352
5353 % Put the index entry in the margin if desired (undocumented).
5354 \def\maybemarginindex{%
5355 \ifx\SETmarginindex\relax\else
5356 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
5357 \fi
5358 }
5359 \let\SETmarginindex=\relax
5360
5361
5362 % Take care of unwanted page breaks/skips around a whatsit:
5363 %
5364 % If a skip is the last thing on the list now, preserve it
5365 % by backing up by \lastskip, doing the \write, then inserting
5366 % the skip again. Otherwise, the whatsit generated by the
5367 % \write or \pdfdest will make \lastskip zero. The result is that
5368 % sequences like this:
5369 % @end defun
5370 % @tindex whatever
5371 % @defun ...
5372 % will have extra space inserted, because the \medbreak in the
5373 % start of the @defun won't see the skip inserted by the @end of
5374 % the previous defun.
5375 %
5376 % But don't do any of this if we're not in vertical mode. We
5377 % don't want to do a \vskip and prematurely end a paragraph.
5378 %
5379 % Avoid page breaks due to these extra skips, too.
5380 %
5381 % But wait, there is a catch there:
5382 % We'll have to check whether \lastskip is zero skip. \ifdim is not
5383 % sufficient for this purpose, as it ignores stretch and shrink parts
5384 % of the skip. The only way seems to be to check the textual
5385 % representation of the skip.
5386 %
5387 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5388 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5389 %
5390 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5391 %
5392 \newskip\whatsitskip
5393 \newcount\whatsitpenalty
5394 %
5395 % ..., ready, GO:
5396 %
5397 \def\safewhatsit#1{\ifhmode
5398 #1%
5399 \else
5400 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5401 \whatsitskip = \lastskip
5402 \edef\lastskipmacro{\the\lastskip}%
5403 \whatsitpenalty = \lastpenalty
5404 %
5405 % If \lastskip is nonzero, that means the last item was a
5406 % skip. And since a skip is discardable, that means this
5407 % -\whatsitskip glue we're inserting is preceded by a
5408 % non-discardable item, therefore it is not a potential
5409 % breakpoint, therefore no \nobreak needed.
5410 \ifx\lastskipmacro\zeroskipmacro
5411 \else
5412 \vskip-\whatsitskip
5413 \fi
5414 %
5415 #1%
5416 %
5417 \ifx\lastskipmacro\zeroskipmacro
5418 % If \lastskip was zero, perhaps the last item was a penalty, and
5419 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5420 % to re-insert the same penalty (values >10000 are used for various
5421 % signals); since we just inserted a non-discardable item, any
5422 % following glue (such as a \parskip) would be a breakpoint. For example:
5423 % @deffn deffn-whatever
5424 % @vindex index-whatever
5425 % Description.
5426 % would allow a break between the index-whatever whatsit
5427 % and the "Description." paragraph.
5428 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5429 \else
5430 % On the other hand, if we had a nonzero \lastskip,
5431 % this make-up glue would be preceded by a non-discardable item
5432 % (the whatsit from the \write), so we must insert a \nobreak.
5433 \nobreak\vskip\whatsitskip
5434 \fi
5435 \fi}
5436
5437 % The index entry written in the file actually looks like
5438 % \entry {sortstring}{page}{topic}
5439 % or
5440 % \entry {sortstring}{page}{topic}{subtopic}
5441 % The texindex program reads in these files and writes files
5442 % containing these kinds of lines:
5443 % \initial {c}
5444 % before the first topic whose initial is c
5445 % \entry {topic}{pagelist}
5446 % for a topic that is used without subtopics
5447 % \primary {topic}
5448 % \entry {topic}{}
5449 % for the beginning of a topic that is used with subtopics
5450 % \secondary {subtopic}{pagelist}
5451 % for each subtopic.
5452 % \secondary {subtopic}{}
5453 % for a subtopic with sub-subtopics
5454 % \tertiary {subtopic}{subsubtopic}{pagelist}
5455 % for each sub-subtopic.
5456
5457 % Define the user-accessible indexing commands
5458 % @findex, @vindex, @kindex, @cindex.
5459
5460 \def\findex {\fnindex}
5461 \def\kindex {\kyindex}
5462 \def\cindex {\cpindex}
5463 \def\vindex {\vrindex}
5464 \def\tindex {\tpindex}
5465 \def\pindex {\pgindex}
5466
5467 % Define the macros used in formatting output of the sorted index material.
5468
5469 % @printindex causes a particular index (the ??s file) to get printed.
5470 % It does not print any chapter heading (usually an @unnumbered).
5471 %
5472 \parseargdef\printindex{\begingroup
5473 \dobreak \chapheadingskip{10000}%
5474 %
5475 \smallfonts \rm
5476 \tolerance = 9500
5477 \plainfrenchspacing
5478 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5479 %
5480 % See comment in \requireopenindexfile.
5481 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5482 %
5483 % See if the index file exists and is nonempty.
5484 \openin 1 \jobname.\indexname s
5485 \ifeof 1
5486 % \enddoublecolumns gets confused if there is no text in the index,
5487 % and it loses the chapter title and the aux file entries for the
5488 % index. The easiest way to prevent this problem is to make sure
5489 % there is some text.
5490 \putwordIndexNonexistent
5491 \typeout{No file \jobname.\indexname s.}%
5492 \else
5493 % If the index file exists but is empty, then \openin leaves \ifeof
5494 % false. We have to make TeX try to read something from the file, so
5495 % it can discover if there is anything in it.
5496 \read 1 to \thisline
5497 \ifeof 1
5498 \putwordIndexIsEmpty
5499 \else
5500 \expandafter\printindexzz\thisline\relax\relax\finish%
5501 \fi
5502 \fi
5503 \closein 1
5504 \endgroup}
5505
5506 % If the index file starts with a backslash, forgo reading the index
5507 % file altogether. If somebody upgrades texinfo.tex they may still have
5508 % old index files using \ as the escape character. Reading this would
5509 % at best lead to typesetting garbage, at worst a TeX syntax error.
5510 \def\printindexzz#1#2\finish{%
5511 \ifflagclear{txiindexescapeisbackslash}{%
5512 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
5513 \ifflagclear{txiskipindexfileswithbackslash}{%
5514 \errmessage{%
5515 ERROR: A sorted index file in an obsolete format was skipped.
5516 To fix this problem, please upgrade your version of 'texi2dvi'
5517 or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
5518 If you are using an old version of 'texindex' (part of the Texinfo
5519 distribution), you may also need to upgrade to a newer version (at least 6.0).
5520 You may be able to typeset the index if you run
5521 'texindex \jobname.\indexname' yourself.
5522 You could also try setting the 'txiindexescapeisbackslash' flag by
5523 running a command like
5524 'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do
5525 this, Texinfo will try to use index files in the old format.
5526 If you continue to have problems, deleting the index files and starting again
5527 might help (with 'rm \jobname.?? \jobname.??s')%
5528 }%
5529 }{%
5530 (Skipped sorted index file in obsolete format)
5531 }%
5532 \else
5533 \begindoublecolumns
5534 \input \jobname.\indexname s
5535 \enddoublecolumns
5536 \fi
5537 }{%
5538 \begindoublecolumns
5539 \catcode`\\=0\relax
5540 %
5541 % Make @ an escape character to give macros a chance to work. This
5542 % should work because we (hopefully) don't otherwise use @ in index files.
5543 %\catcode`\@=12\relax
5544 \catcode`\@=0\relax
5545 \input \jobname.\indexname s
5546 \enddoublecolumns
5547 }%
5548 }
5549
5550 % These macros are used by the sorted index file itself.
5551 % Change them to control the appearance of the index.
5552
5553 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5554 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5555 \catcode`\$=3
5556 \gdef\initialglyphs{%
5557 % special control sequences used in the index sort key
5558 \let\indexlbrace\{%
5559 \let\indexrbrace\}%
5560 \let\indexatchar\@%
5561 \def\indexbackslash{\math{\backslash}}%
5562 %
5563 % Some changes for non-alphabetic characters. Using the glyphs from the
5564 % math fonts looks more consistent than the typewriter font used elsewhere
5565 % for these characters.
5566 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
5567 %
5568 % In case @\ is used for backslash
5569 \uppercase{\let\\=~}
5570 % Can't get bold backslash so don't use bold forward slash
5571 \catcode`\/=13
5572 \def/{{\secrmnotbold \normalslash}}%
5573 \def-{{\normaldash\normaldash}}% en dash `--'
5574 \def^{{\chapbf \normalcaret}}%
5575 \def~{{\chapbf \normaltilde}}%
5576 \def\_{%
5577 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5578 \def|{$\vert$}%
5579 \def<{$\less$}%
5580 \def>{$\gtr$}%
5581 \def+{$\normalplus$}%
5582 }}
5583
5584 \def\initial{%
5585 \bgroup
5586 \initialglyphs
5587 \initialx
5588 }
5589
5590 \def\initialx#1{%
5591 % Remove any glue we may have, we'll be inserting our own.
5592 \removelastskip
5593 %
5594 % We like breaks before the index initials, so insert a bonus.
5595 % The glue before the bonus allows a little bit of space at the
5596 % bottom of a column to reduce an increase in inter-line spacing.
5597 \nobreak
5598 \vskip 0pt plus 5\baselineskip
5599 \penalty -300
5600 \vskip 0pt plus -5\baselineskip
5601 %
5602 % Typeset the initial. Making this add up to a whole number of
5603 % baselineskips increases the chance of the dots lining up from column
5604 % to column. It still won't often be perfect, because of the stretch
5605 % we need before each entry, but it's better.
5606 %
5607 % No shrink because it confuses \balancecolumns.
5608 \vskip 1.67\baselineskip plus 1\baselineskip
5609 \leftline{\secfonts \kern-0.05em \secbf #1}%
5610 % \secfonts is inside the argument of \leftline so that the change of
5611 % \baselineskip will not affect any glue inserted before the vbox that
5612 % \leftline creates.
5613 % Do our best not to break after the initial.
5614 \nobreak
5615 \vskip .33\baselineskip plus .1\baselineskip
5616 \egroup % \initialglyphs
5617 }
5618
5619 \newdimen\entryrightmargin
5620 \entryrightmargin=0pt
5621
5622 % for PDF output, whether to make the text of the entry a link to the page
5623 % number. set for @contents and @shortcontents where there is only one
5624 % page number.
5625 \newif\iflinkentrytext
5626
5627 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5628 % then page number (#2) flushed to the right margin. It is used for index
5629 % and table of contents entries. The paragraph is indented by \leftskip.
5630 %
5631 \def\entry{%
5632 \begingroup
5633 %
5634 % Start a new paragraph if necessary, so our assignments below can't
5635 % affect previous text.
5636 \par
5637 %
5638 % No extra space above this paragraph.
5639 \parskip = 0in
5640 %
5641 % When reading the text of entry, convert explicit line breaks
5642 % from @* into spaces. The user might give these in long section
5643 % titles, for instance.
5644 \def\*{\unskip\space\ignorespaces}%
5645 \def\entrybreak{\hfil\break}% An undocumented command
5646 %
5647 % Swallow the left brace of the text (first parameter):
5648 \afterassignment\doentry
5649 \let\temp =
5650 }
5651 \def\entrybreak{\unskip\space\ignorespaces}%
5652 \def\doentry{%
5653 % Save the text of the entry in \boxA
5654 \global\setbox\boxA=\hbox\bgroup
5655 \bgroup % Instead of the swallowed brace.
5656 \noindent
5657 \aftergroup\finishentry
5658 % And now comes the text of the entry.
5659 % Not absorbing as a macro argument reduces the chance of problems
5660 % with catcodes occurring.
5661 }
5662 {\catcode`\@=11
5663 % #1 is the page number
5664 \gdef\finishentry#1{%
5665 \egroup % end \boxA
5666 \dimen@ = \wd\boxA % Length of text of entry
5667 % add any leaders and page number to \boxA.
5668 \global\setbox\boxA=\hbox\bgroup
5669 \ifpdforxetex
5670 \iflinkentrytext
5671 \pdflinkpage{#1}{\unhbox\boxA}%
5672 \else
5673 \unhbox\boxA
5674 \fi
5675 \else
5676 \unhbox\boxA
5677 \fi
5678 %
5679 % Get the width of the page numbers, and only use
5680 % leaders if they are present.
5681 \global\setbox\boxB = \hbox{#1}%
5682 \ifdim\wd\boxB = 0pt
5683 \null\nobreak\hfill\ %
5684 \else
5685 %
5686 \null\nobreak\indexdotfill % Have leaders before the page number.
5687 %
5688 \ifpdforxetex
5689 \pdfgettoks#1.%
5690 \hskip\skip\thinshrinkable\the\toksA
5691 \else
5692 \hskip\skip\thinshrinkable #1%
5693 \fi
5694 \fi
5695 \egroup % end \boxA
5696 %
5697 % now output
5698 \ifdim\wd\boxB = 0pt
5699 \noindent\unhbox\boxA\par
5700 \nobreak
5701 \else\bgroup
5702 % We want the text of the entries to be aligned to the left, and the
5703 % page numbers to be aligned to the right.
5704 %
5705 \parindent = 0pt
5706 \advance\leftskip by 0pt plus 1fil
5707 \advance\leftskip by 0pt plus -1fill
5708 \rightskip = 0pt plus -1fil
5709 \advance\rightskip by 0pt plus 1fill
5710 % Cause last line, which could consist of page numbers on their own
5711 % if the list of page numbers is long, to be aligned to the right.
5712 \parfillskip=0pt plus -1fill
5713 %
5714 \advance\rightskip by \entryrightmargin
5715 % Determine how far we can stretch into the margin.
5716 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5717 % fit on one line in @letterpaper format.
5718 \ifdim\entryrightmargin>2.1em
5719 \dimen@i=2.1em
5720 \else
5721 \dimen@i=0em
5722 \fi
5723 \advance \parfillskip by 0pt minus 1\dimen@i
5724 %
5725 \dimen@ii = \hsize
5726 \advance\dimen@ii by -1\leftskip
5727 \advance\dimen@ii by -1\entryrightmargin
5728 \advance\dimen@ii by 1\dimen@i
5729 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5730 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5731 % Try to split the text roughly evenly. \dimen@ will be the length of
5732 % the first line.
5733 \dimen@ = 0.7\dimen@
5734 \dimen@ii = \hsize
5735 \ifnum\dimen@>\dimen@ii
5736 % If the entry is too long (for example, if it needs more than
5737 % two lines), use all the space in the first line.
5738 \dimen@ = \dimen@ii
5739 \fi
5740 \advance\leftskip by 0pt plus 1fill % ragged right
5741 \advance \dimen@ by 1\rightskip
5742 \parshape = 2 0pt \dimen@ 0em \dimen@ii
5743 % Ideally we'd add a finite glue at the end of the first line only,
5744 % instead of using \parshape with explicit line lengths, but TeX
5745 % doesn't seem to provide a way to do such a thing.
5746 %
5747 % Indent all lines but the first one.
5748 \advance\leftskip by 1em
5749 \advance\parindent by -1em
5750 \fi\fi
5751 \indent % start paragraph
5752 \unhbox\boxA
5753 %
5754 % Do not prefer a separate line ending with a hyphen to fewer lines.
5755 \finalhyphendemerits = 0
5756 %
5757 % Word spacing - no stretch
5758 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5759 %
5760 \linepenalty=1000 % Discourage line breaks.
5761 \hyphenpenalty=5000 % Discourage hyphenation.
5762 %
5763 \par % format the paragraph
5764 \egroup % The \vbox
5765 \fi
5766 \endgroup
5767 }}
5768
5769 \newskip\thinshrinkable
5770 \skip\thinshrinkable=.15em minus .15em
5771
5772 % Like plain.tex's \dotfill, except uses up at least 1 em.
5773 % The filll stretch here overpowers both the fil and fill stretch to push
5774 % the page number to the right.
5775 \def\indexdotfill{\cleaders
5776 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5777
5778
5779 \def\primary #1{\line{#1\hfil}}
5780
5781 \def\secondary{\indententry{0.5cm}}
5782 \def\tertiary{\indententry{1cm}}
5783
5784 \def\indententry#1#2#3{%
5785 \bgroup
5786 \leftskip=#1
5787 \entry{#2}{#3}%
5788 \egroup
5789 }
5790
5791 % Define two-column mode, which we use to typeset indexes.
5792 % Adapted from the TeXbook, page 416, which is to say,
5793 % the manmac.tex format used to print the TeXbook itself.
5794 \catcode`\@=11 % private names
5795
5796 \newbox\partialpage
5797 \newdimen\doublecolumnhsize
5798
5799 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5800 % If not much space left on page, start a new page.
5801 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5802 %
5803 % Grab any single-column material above us.
5804 \output = {%
5805 \savetopmark
5806 %
5807 \global\setbox\partialpage = \vbox{%
5808 % Unvbox the main output page.
5809 \unvbox\PAGE
5810 \kern-\topskip \kern\baselineskip
5811 }%
5812 }%
5813 \eject % run that output routine to set \partialpage
5814 %
5815 % Use the double-column output routine for subsequent pages.
5816 \output = {\doublecolumnout}%
5817 %
5818 % Change the page size parameters. We could do this once outside this
5819 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5820 % format, but then we repeat the same computation. Repeating a couple
5821 % of assignments once per index is clearly meaningless for the
5822 % execution time, so we may as well do it in one place.
5823 %
5824 % First we halve the line length, less a little for the gutter between
5825 % the columns. We compute the gutter based on the line length, so it
5826 % changes automatically with the paper format. The magic constant
5827 % below is chosen so that the gutter has the same value (well, +-<1pt)
5828 % as it did when we hard-coded it.
5829 %
5830 % We put the result in a separate register, \doublecolumhsize, so we
5831 % can restore it in \pagesofar, after \hsize itself has (potentially)
5832 % been clobbered.
5833 %
5834 \doublecolumnhsize = \hsize
5835 \advance\doublecolumnhsize by -.04154\hsize
5836 \divide\doublecolumnhsize by 2
5837 \hsize = \doublecolumnhsize
5838 %
5839 % Get the available space for the double columns -- the normal
5840 % (undoubled) page height minus any material left over from the
5841 % previous page.
5842 \advance\vsize by -\ht\partialpage
5843 \vsize = 2\vsize
5844 %
5845 % For the benefit of balancing columns
5846 \advance\baselineskip by 0pt plus 0.5pt
5847 }
5848
5849 % The double-column output routine for all double-column pages except
5850 % the last, which is done by \balancecolumns.
5851 %
5852 \def\doublecolumnout{%
5853 %
5854 \savetopmark
5855 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5856 \dimen@ = \vsize
5857 \divide\dimen@ by 2
5858 %
5859 % box0 will be the left-hand column, box2 the right.
5860 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
5861 \global\advance\vsize by 2\ht\partialpage
5862 \onepageout\pagesofar % empty except for the first time we are called
5863 \unvbox\PAGE
5864 \penalty\outputpenalty
5865 }
5866 %
5867 % Re-output the contents of the output page -- any previous material,
5868 % followed by the two boxes we just split, in box0 and box2.
5869 \def\pagesofar{%
5870 \unvbox\partialpage
5871 %
5872 \hsize = \doublecolumnhsize
5873 \wd0=\hsize \wd2=\hsize
5874 \hbox to\txipagewidth{\box0\hfil\box2}%
5875 }
5876
5877
5878 % Finished with double columns.
5879 \def\enddoublecolumns{%
5880 % The following penalty ensures that the page builder is exercised
5881 % _before_ we change the output routine. This is necessary in the
5882 % following situation:
5883 %
5884 % The last section of the index consists only of a single entry.
5885 % Before this section, \pagetotal is less than \pagegoal, so no
5886 % break occurs before the last section starts. However, the last
5887 % section, consisting of \initial and the single \entry, does not
5888 % fit on the page and has to be broken off. Without the following
5889 % penalty the page builder will not be exercised until \eject
5890 % below, and by that time we'll already have changed the output
5891 % routine to the \balancecolumns version, so the next-to-last
5892 % double-column page will be processed with \balancecolumns, which
5893 % is wrong: The two columns will go to the main vertical list, with
5894 % the broken-off section in the recent contributions. As soon as
5895 % the output routine finishes, TeX starts reconsidering the page
5896 % break. The two columns and the broken-off section both fit on the
5897 % page, because the two columns now take up only half of the page
5898 % goal. When TeX sees \eject from below which follows the final
5899 % section, it invokes the new output routine that we've set after
5900 % \balancecolumns below; \onepageout will try to fit the two columns
5901 % and the final section into the vbox of \txipageheight (see
5902 % \pagebody), causing an overfull box.
5903 %
5904 % Note that glue won't work here, because glue does not exercise the
5905 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5906 \penalty0
5907 %
5908 \output = {%
5909 % Split the last of the double-column material.
5910 \savetopmark
5911 \balancecolumns
5912 }%
5913 \eject % call the \output just set
5914 \ifdim\pagetotal=0pt
5915 % Having called \balancecolumns once, we do not
5916 % want to call it again. Therefore, reset \output to its normal
5917 % definition right away.
5918 \global\output=\expandafter{\the\defaultoutput}
5919 %
5920 \endgroup % started in \begindoublecolumns
5921 % Leave the double-column material on the current page, no automatic
5922 % page break.
5923 \box\balancedcolumns
5924 %
5925 % \pagegoal was set to the doubled \vsize above, since we restarted
5926 % the current page. We're now back to normal single-column
5927 % typesetting, so reset \pagegoal to the normal \vsize.
5928 \global\vsize = \txipageheight %
5929 \pagegoal = \txipageheight %
5930 \else
5931 % We had some left-over material. This might happen when \doublecolumnout
5932 % is called in \balancecolumns. Try again.
5933 \expandafter\enddoublecolumns
5934 \fi
5935 }
5936 \newbox\balancedcolumns
5937 \setbox\balancedcolumns=\vbox{shouldnt see this}%
5938 %
5939 % Only called for the last of the double column material. \doublecolumnout
5940 % does the others.
5941 \def\balancecolumns{%
5942 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
5943 \dimen@ = \ht0
5944 \ifdim\dimen@<7\baselineskip
5945 % Don't split a short final column in two.
5946 \setbox2=\vbox{}%
5947 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5948 \else
5949 % double the leading vertical space
5950 \advance\dimen@ by \topskip
5951 \advance\dimen@ by-\baselineskip
5952 \divide\dimen@ by 2 % target to split to
5953 \dimen@ii = \dimen@
5954 \splittopskip = \topskip
5955 % Loop until left column is at least as high as the right column.
5956 {%
5957 \vbadness = 10000
5958 \loop
5959 \global\setbox3 = \copy0
5960 \global\setbox1 = \vsplit3 to \dimen@
5961 \ifdim\ht1<\ht3
5962 \global\advance\dimen@ by 1pt
5963 \repeat
5964 }%
5965 % Now the left column is in box 1, and the right column in box 3.
5966 %
5967 % Check whether the left column has come out higher than the page itself.
5968 % (Note that we have doubled \vsize for the double columns, so
5969 % the actual height of the page is 0.5\vsize).
5970 \ifdim2\ht1>\vsize
5971 % It appears that we have been called upon to balance too much material.
5972 % Output some of it with \doublecolumnout, leaving the rest on the page.
5973 \setbox\PAGE=\box0
5974 \doublecolumnout
5975 \else
5976 % Compare the heights of the two columns.
5977 \ifdim4\ht1>5\ht3
5978 % Column heights are too different, so don't make their bottoms
5979 % flush with each other.
5980 \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
5981 \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
5982 \else
5983 % Make column bottoms flush with each other.
5984 \setbox2=\vbox to\ht1{\unvbox3\unskip}%
5985 \setbox0=\vbox to\ht1{\unvbox1\unskip}%
5986 \fi
5987 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5988 \fi
5989 \fi
5990 %
5991 }
5992 \catcode`\@ = \other
5993
5994
5995 \message{sectioning,}
5996 % Chapters, sections, etc.
5997
5998 % Let's start with @part.
5999 \parseargdef\part{\partzzz{#1}}
6000 \def\partzzz#1{%
6001 \chapoddpage
6002 \null
6003 \vskip.3\vsize % move it down on the page a bit
6004 \begingroup
6005 \noindent \titlefonts\rm #1\par % the text
6006 \let\lastnode=\empty % no node to associate with
6007 \writetocentry{part}{#1}{}% but put it in the toc
6008 \headingsoff % no headline or footline on the part page
6009 % This outputs a mark at the end of the page that clears \thischapter
6010 % and \thissection, as is done in \startcontents.
6011 \let\pchapsepmacro\relax
6012 \chapmacro{}{Yomitfromtoc}{}%
6013 \chapoddpage
6014 \endgroup
6015 }
6016
6017 % \unnumberedno is an oxymoron. But we count the unnumbered
6018 % sections so that we can refer to them unambiguously in the pdf
6019 % outlines by their "section number". We avoid collisions with chapter
6020 % numbers by starting them at 10000. (If a document ever has 10000
6021 % chapters, we're in trouble anyway, I'm sure.)
6022 \newcount\unnumberedno \unnumberedno = 10000
6023 \newcount\chapno
6024 \newcount\secno \secno=0
6025 \newcount\subsecno \subsecno=0
6026 \newcount\subsubsecno \subsubsecno=0
6027
6028 % This counter is funny since it counts through charcodes of letters A, B, ...
6029 \newcount\appendixno \appendixno = `\@
6030 %
6031 % \def\appendixletter{\char\the\appendixno}
6032 % We do the following ugly conditional instead of the above simple
6033 % construct for the sake of pdftex, which needs the actual
6034 % letter in the expansion, not just typeset.
6035 %
6036 \def\appendixletter{%
6037 \ifnum\appendixno=`A A%
6038 \else\ifnum\appendixno=`B B%
6039 \else\ifnum\appendixno=`C C%
6040 \else\ifnum\appendixno=`D D%
6041 \else\ifnum\appendixno=`E E%
6042 \else\ifnum\appendixno=`F F%
6043 \else\ifnum\appendixno=`G G%
6044 \else\ifnum\appendixno=`H H%
6045 \else\ifnum\appendixno=`I I%
6046 \else\ifnum\appendixno=`J J%
6047 \else\ifnum\appendixno=`K K%
6048 \else\ifnum\appendixno=`L L%
6049 \else\ifnum\appendixno=`M M%
6050 \else\ifnum\appendixno=`N N%
6051 \else\ifnum\appendixno=`O O%
6052 \else\ifnum\appendixno=`P P%
6053 \else\ifnum\appendixno=`Q Q%
6054 \else\ifnum\appendixno=`R R%
6055 \else\ifnum\appendixno=`S S%
6056 \else\ifnum\appendixno=`T T%
6057 \else\ifnum\appendixno=`U U%
6058 \else\ifnum\appendixno=`V V%
6059 \else\ifnum\appendixno=`W W%
6060 \else\ifnum\appendixno=`X X%
6061 \else\ifnum\appendixno=`Y Y%
6062 \else\ifnum\appendixno=`Z Z%
6063 % The \the is necessary, despite appearances, because \appendixletter is
6064 % expanded while writing the .toc file. \char\appendixno is not
6065 % expandable, thus it is written literally, thus all appendixes come out
6066 % with the same letter (or @) in the toc without it.
6067 \else\char\the\appendixno
6068 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6069 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6070
6071 % Each @chapter defines these (using marks) as the number+name, number
6072 % and name of the chapter. Page headings and footings can use
6073 % these. @section does likewise.
6074 \def\thischapter{}
6075 \def\thischapternum{}
6076 \def\thischaptername{}
6077 \def\thissection{}
6078 \def\thissectionnum{}
6079 \def\thissectionname{}
6080
6081 \newcount\absseclevel % used to calculate proper heading level
6082 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6083
6084 % @raisesections: treat @section as chapter, @subsection as section, etc.
6085 \def\raisesections{\global\advance\secbase by -1}
6086
6087 % @lowersections: treat @chapter as section, @section as subsection, etc.
6088 \def\lowersections{\global\advance\secbase by 1}
6089
6090 % we only have subsub.
6091 \chardef\maxseclevel = 3
6092 %
6093 % A numbered section within an unnumbered changes to unnumbered too.
6094 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
6095 \chardef\unnlevel = \maxseclevel
6096 %
6097 % Trace whether the current chapter is an appendix or not:
6098 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6099 \def\chapheadtype{N}
6100
6101 % Choose a heading macro
6102 % #1 is heading type
6103 % #2 is heading level
6104 % #3 is text for heading
6105 \def\genhead#1#2#3{%
6106 % Compute the abs. sec. level:
6107 \absseclevel=#2
6108 \advance\absseclevel by \secbase
6109 % Make sure \absseclevel doesn't fall outside the range:
6110 \ifnum \absseclevel < 0
6111 \absseclevel = 0
6112 \else
6113 \ifnum \absseclevel > 3
6114 \absseclevel = 3
6115 \fi
6116 \fi
6117 % The heading type:
6118 \def\headtype{#1}%
6119 \if \headtype U%
6120 \ifnum \absseclevel < \unnlevel
6121 \chardef\unnlevel = \absseclevel
6122 \fi
6123 \else
6124 % Check for appendix sections:
6125 \ifnum \absseclevel = 0
6126 \edef\chapheadtype{\headtype}%
6127 \else
6128 \if \headtype A\if \chapheadtype N%
6129 \errmessage{@appendix... within a non-appendix chapter}%
6130 \fi\fi
6131 \fi
6132 % Check for numbered within unnumbered:
6133 \ifnum \absseclevel > \unnlevel
6134 \def\headtype{U}%
6135 \else
6136 \chardef\unnlevel = 3
6137 \fi
6138 \fi
6139 % Now print the heading:
6140 \if \headtype U%
6141 \ifcase\absseclevel
6142 \unnumberedzzz{#3}%
6143 \or \unnumberedseczzz{#3}%
6144 \or \unnumberedsubseczzz{#3}%
6145 \or \unnumberedsubsubseczzz{#3}%
6146 \fi
6147 \else
6148 \if \headtype A%
6149 \ifcase\absseclevel
6150 \appendixzzz{#3}%
6151 \or \appendixsectionzzz{#3}%
6152 \or \appendixsubseczzz{#3}%
6153 \or \appendixsubsubseczzz{#3}%
6154 \fi
6155 \else
6156 \ifcase\absseclevel
6157 \chapterzzz{#3}%
6158 \or \seczzz{#3}%
6159 \or \numberedsubseczzz{#3}%
6160 \or \numberedsubsubseczzz{#3}%
6161 \fi
6162 \fi
6163 \fi
6164 \suppressfirstparagraphindent
6165 }
6166
6167 % an interface:
6168 \def\numhead{\genhead N}
6169 \def\apphead{\genhead A}
6170 \def\unnmhead{\genhead U}
6171
6172 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6173 % all lower-level sectioning counters to zero.
6174 %
6175 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
6176 % (e.g., figures), q.v. By default (before any chapter), that is empty.
6177 \let\chaplevelprefix = \empty
6178 %
6179 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6180 \def\chapterzzz#1{%
6181 % section resetting is \global in case the chapter is in a group, such
6182 % as an @include file.
6183 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6184 \global\advance\chapno by 1
6185 %
6186 % Used for \float.
6187 \gdef\chaplevelprefix{\the\chapno.}%
6188 \resetallfloatnos
6189 %
6190 % \putwordChapter can contain complex things in translations.
6191 \toks0=\expandafter{\putwordChapter}%
6192 \message{\the\toks0 \space \the\chapno}%
6193 %
6194 % Write the actual heading.
6195 \chapmacro{#1}{Ynumbered}{\the\chapno}%
6196 %
6197 % So @section and the like are numbered underneath this chapter.
6198 \global\let\section = \numberedsec
6199 \global\let\subsection = \numberedsubsec
6200 \global\let\subsubsection = \numberedsubsubsec
6201 }
6202
6203 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6204 %
6205 \def\appendixzzz#1{%
6206 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6207 \global\advance\appendixno by 1
6208 \gdef\chaplevelprefix{\appendixletter.}%
6209 \resetallfloatnos
6210 %
6211 % \putwordAppendix can contain complex things in translations.
6212 \toks0=\expandafter{\putwordAppendix}%
6213 \message{\the\toks0 \space \appendixletter}%
6214 %
6215 \chapmacro{#1}{Yappendix}{\appendixletter}%
6216 %
6217 \global\let\section = \appendixsec
6218 \global\let\subsection = \appendixsubsec
6219 \global\let\subsubsection = \appendixsubsubsec
6220 }
6221
6222 % normally unnmhead0 calls unnumberedzzz:
6223 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
6224 \def\unnumberedzzz#1{%
6225 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6226 \global\advance\unnumberedno by 1
6227 %
6228 % Since an unnumbered has no number, no prefix for figures.
6229 \global\let\chaplevelprefix = \empty
6230 \resetallfloatnos
6231 %
6232 % This used to be simply \message{#1}, but TeX fully expands the
6233 % argument to \message. Therefore, if #1 contained @-commands, TeX
6234 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6235 % expanded @cite (which turns out to cause errors because \cite is meant
6236 % to be executed, not expanded).
6237 %
6238 % Anyway, we don't want the fully-expanded definition of @cite to appear
6239 % as a result of the \message, we just want `@cite' itself. We use
6240 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6241 % simply yielding the contents of <toks register>. (We also do this for
6242 % the toc entries.)
6243 \toks0 = {#1}%
6244 \message{(\the\toks0)}%
6245 %
6246 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6247 %
6248 \global\let\section = \unnumberedsec
6249 \global\let\subsection = \unnumberedsubsec
6250 \global\let\subsubsection = \unnumberedsubsubsec
6251 }
6252
6253 % @centerchap is like @unnumbered, but the heading is centered.
6254 \outer\parseargdef\centerchap{%
6255 \let\centerparametersmaybe = \centerparameters
6256 \unnmhead0{#1}%
6257 \let\centerparametersmaybe = \relax
6258 }
6259
6260 % @top is like @unnumbered.
6261 \let\top\unnumbered
6262
6263 % Sections.
6264 %
6265 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6266 \def\seczzz#1{%
6267 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6268 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6269 }
6270
6271 % normally calls appendixsectionzzz:
6272 \outer\parseargdef\appendixsection{\apphead1{#1}}
6273 \def\appendixsectionzzz#1{%
6274 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6275 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6276 }
6277 \let\appendixsec\appendixsection
6278
6279 % normally calls unnumberedseczzz:
6280 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6281 \def\unnumberedseczzz#1{%
6282 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6283 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6284 }
6285
6286 % Subsections.
6287 %
6288 % normally calls numberedsubseczzz:
6289 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6290 \def\numberedsubseczzz#1{%
6291 \global\subsubsecno=0 \global\advance\subsecno by 1
6292 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6293 }
6294
6295 % normally calls appendixsubseczzz:
6296 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6297 \def\appendixsubseczzz#1{%
6298 \global\subsubsecno=0 \global\advance\subsecno by 1
6299 \sectionheading{#1}{subsec}{Yappendix}%
6300 {\appendixletter.\the\secno.\the\subsecno}%
6301 }
6302
6303 % normally calls unnumberedsubseczzz:
6304 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6305 \def\unnumberedsubseczzz#1{%
6306 \global\subsubsecno=0 \global\advance\subsecno by 1
6307 \sectionheading{#1}{subsec}{Ynothing}%
6308 {\the\unnumberedno.\the\secno.\the\subsecno}%
6309 }
6310
6311 % Subsubsections.
6312 %
6313 % normally numberedsubsubseczzz:
6314 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6315 \def\numberedsubsubseczzz#1{%
6316 \global\advance\subsubsecno by 1
6317 \sectionheading{#1}{subsubsec}{Ynumbered}%
6318 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6319 }
6320
6321 % normally appendixsubsubseczzz:
6322 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6323 \def\appendixsubsubseczzz#1{%
6324 \global\advance\subsubsecno by 1
6325 \sectionheading{#1}{subsubsec}{Yappendix}%
6326 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6327 }
6328
6329 % normally unnumberedsubsubseczzz:
6330 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6331 \def\unnumberedsubsubseczzz#1{%
6332 \global\advance\subsubsecno by 1
6333 \sectionheading{#1}{subsubsec}{Ynothing}%
6334 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6335 }
6336
6337 % These macros control what the section commands do, according
6338 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6339 % Define them by default for a numbered chapter.
6340 \let\section = \numberedsec
6341 \let\subsection = \numberedsubsec
6342 \let\subsubsection = \numberedsubsubsec
6343
6344 % Define @majorheading, @heading and @subheading
6345
6346 \def\majorheading{%
6347 {\advance\chapheadingskip by 10pt \chapbreak }%
6348 \parsearg\chapheadingzzz
6349 }
6350
6351 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6352 \def\chapheadingzzz#1{%
6353 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6354 \nobreak\bigskip \nobreak
6355 \suppressfirstparagraphindent
6356 }
6357
6358 % @heading, @subheading, @subsubheading.
6359 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6360 \suppressfirstparagraphindent}
6361 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6362 \suppressfirstparagraphindent}
6363 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6364 \suppressfirstparagraphindent}
6365
6366 % These macros generate a chapter, section, etc. heading only
6367 % (including whitespace, linebreaking, etc. around it),
6368 % given all the information in convenient, parsed form.
6369
6370 % Args are the skip and penalty (usually negative)
6371 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6372
6373 % Parameter controlling skip before chapter headings (if needed)
6374 \newskip\chapheadingskip
6375
6376 % Define plain chapter starts, and page on/off switching for it.
6377 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6378
6379 % Start a new page
6380 \def\chappager{\par\vfill\supereject}
6381
6382 % \chapoddpage - start on an odd page for a new chapter
6383 % Because \domark is called before \chapoddpage, the filler page will
6384 % get the headings for the next chapter, which is wrong. But we don't
6385 % care -- we just disable all headings on the filler page.
6386 \def\chapoddpage{%
6387 \chappager
6388 \ifodd\pageno \else
6389 \begingroup
6390 \headingsoff
6391 \null
6392 \chappager
6393 \endgroup
6394 \fi
6395 }
6396
6397 \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname\HEADINGSon}
6398
6399 \def\CHAPPAGoff{%
6400 \global\let\contentsalignmacro = \chappager
6401 \global\let\pchapsepmacro=\chapbreak
6402 \global\def\HEADINGSon{\HEADINGSsinglechapoff}}
6403
6404 \def\CHAPPAGon{%
6405 \global\let\contentsalignmacro = \chappager
6406 \global\let\pchapsepmacro=\chappager
6407 \global\def\HEADINGSon{\HEADINGSsingle}}
6408
6409 \def\CHAPPAGodd{%
6410 \global\let\contentsalignmacro = \chapoddpage
6411 \global\let\pchapsepmacro=\chapoddpage
6412 \global\def\HEADINGSon{\HEADINGSdouble}}
6413
6414 \setchapternewpage on
6415
6416 % \chapmacro - Chapter opening.
6417 %
6418 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6419 % Yappendix, Yomitfromtoc), #3 the chapter number.
6420 % Not used for @heading series.
6421 %
6422 % To test against our argument.
6423 \def\Ynothingkeyword{Ynothing}
6424 \def\Yappendixkeyword{Yappendix}
6425 \def\Yomitfromtockeyword{Yomitfromtoc}
6426 %
6427 %
6428 % Definitions for @thischapter. These can be overridden in translation
6429 % files.
6430 \def\thischapterAppendix{%
6431 \putwordAppendix{} \thischapternum: \thischaptername}
6432
6433 \def\thischapterChapter{%
6434 \putwordChapter{} \thischapternum: \thischaptername}
6435 %
6436 %
6437 \def\chapmacro#1#2#3{%
6438 \expandafter\ifx\thisenv\titlepage\else
6439 \checkenv{}% chapters, etc., should not start inside an environment.
6440 \fi
6441 % Insert the first mark before the heading break (see notes for \domark).
6442 \let\prevchapterdefs=\currentchapterdefs
6443 \let\prevsectiondefs=\currentsectiondefs
6444 \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6445 \gdef\thissection{}}%
6446 %
6447 \def\temptype{#2}%
6448 \ifx\temptype\Ynothingkeyword
6449 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6450 \gdef\thischapter{\thischaptername}}%
6451 \else\ifx\temptype\Yomitfromtockeyword
6452 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6453 \gdef\thischapter{}}%
6454 \else\ifx\temptype\Yappendixkeyword
6455 \toks0={#1}%
6456 \xdef\currentchapterdefs{%
6457 \gdef\noexpand\thischaptername{\the\toks0}%
6458 \gdef\noexpand\thischapternum{\appendixletter}%
6459 \let\noexpand\thischapter\noexpand\thischapterAppendix
6460 }%
6461 \else
6462 \toks0={#1}%
6463 \xdef\currentchapterdefs{%
6464 \gdef\noexpand\thischaptername{\the\toks0}%
6465 \gdef\noexpand\thischapternum{\the\chapno}%
6466 \let\noexpand\thischapter\noexpand\thischapterChapter
6467 }%
6468 \fi\fi\fi
6469 %
6470 % Output the mark. Pass it through \safewhatsit, to take care of
6471 % the preceding space.
6472 \safewhatsit\domark
6473 %
6474 % Insert the chapter heading break.
6475 \pchapsepmacro
6476 %
6477 % Now the second mark, after the heading break. No break points
6478 % between here and the heading.
6479 \let\prevchapterdefs=\currentchapterdefs
6480 \let\prevsectiondefs=\currentsectiondefs
6481 \domark
6482 %
6483 {%
6484 \chapfonts \rm
6485 \let\footnote=\errfootnoteheading % give better error message
6486 %
6487 % Have to define \currentsection before calling \donoderef, because the
6488 % xref code eventually uses it. On the other hand, it has to be called
6489 % after \pchapsepmacro, or the headline will change too soon.
6490 \gdef\currentsection{#1}%
6491 %
6492 % Only insert the separating space if we have a chapter/appendix
6493 % number, and don't print the unnumbered ``number''.
6494 \ifx\temptype\Ynothingkeyword
6495 \setbox0 = \hbox{}%
6496 \def\toctype{unnchap}%
6497 \else\ifx\temptype\Yomitfromtockeyword
6498 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6499 \def\toctype{omit}%
6500 \else\ifx\temptype\Yappendixkeyword
6501 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6502 \def\toctype{app}%
6503 \else
6504 \setbox0 = \hbox{#3\enspace}%
6505 \def\toctype{numchap}%
6506 \fi\fi\fi
6507 %
6508 % Write the toc entry for this chapter. Must come before the
6509 % \donoderef, because we include the current node name in the toc
6510 % entry, and \donoderef resets it to empty.
6511 \writetocentry{\toctype}{#1}{#3}%
6512 %
6513 % For pdftex, we have to write out the node definition (aka, make
6514 % the pdfdest) after any page break, but before the actual text has
6515 % been typeset. If the destination for the pdf outline is after the
6516 % text, then jumping from the outline may wind up with the text not
6517 % being visible, for instance under high magnification.
6518 \donoderef{#2}%
6519 %
6520 % Typeset the actual heading.
6521 \nobreak % Avoid page breaks at the interline glue.
6522 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6523 \unhbox0 #1\par}%
6524 }%
6525 \nobreak\bigskip % no page break after a chapter title
6526 \nobreak
6527 }
6528
6529 % @centerchap -- centered and unnumbered.
6530 \let\centerparametersmaybe = \relax
6531 \def\centerparameters{%
6532 \advance\rightskip by 3\rightskip
6533 \leftskip = \rightskip
6534 \parfillskip = 0pt
6535 }
6536
6537
6538 % Section titles. These macros combine the section number parts and
6539 % call the generic \sectionheading to do the printing.
6540 %
6541 \newskip\secheadingskip
6542 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6543
6544 % Subsection titles.
6545 \newskip\subsecheadingskip
6546 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6547
6548 % Subsubsection titles.
6549 \def\subsubsecheadingskip{\subsecheadingskip}
6550 \def\subsubsecheadingbreak{\subsecheadingbreak}
6551
6552 % Definition for @thissection. This can be overridden in translation
6553 % files.
6554 \def\thissectionDef{%
6555 \putwordSection{} \thissectionnum: \thissectionname}
6556 %
6557
6558
6559 % Print any size, any type, section title.
6560 %
6561 % #1 is the text of the title,
6562 % #2 is the section level (sec/subsec/subsubsec),
6563 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6564 % #4 is the section number.
6565 %
6566 \def\seckeyword{sec}
6567 %
6568 \def\sectionheading#1#2#3#4{%
6569 {%
6570 \def\sectionlevel{#2}%
6571 \def\temptype{#3}%
6572 %
6573 % It is ok for the @heading series commands to appear inside an
6574 % environment (it's been historically allowed, though the logic is
6575 % dubious), but not the others.
6576 \ifx\temptype\Yomitfromtockeyword\else
6577 \checkenv{}% non-@*heading should not be in an environment.
6578 \fi
6579 \let\footnote=\errfootnoteheading
6580 %
6581 % Switch to the right set of fonts.
6582 \csname #2fonts\endcsname \rm
6583 %
6584 % Insert first mark before the heading break (see notes for \domark).
6585 \let\prevsectiondefs=\currentsectiondefs
6586 \ifx\temptype\Ynothingkeyword
6587 \ifx\sectionlevel\seckeyword
6588 \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6589 \gdef\thissection{\thissectionname}}%
6590 \fi
6591 \else\ifx\temptype\Yomitfromtockeyword
6592 % Don't redefine \thissection.
6593 \else\ifx\temptype\Yappendixkeyword
6594 \ifx\sectionlevel\seckeyword
6595 \toks0={#1}%
6596 \xdef\currentsectiondefs{%
6597 \gdef\noexpand\thissectionname{\the\toks0}%
6598 \gdef\noexpand\thissectionnum{#4}%
6599 \let\noexpand\thissection\noexpand\thissectionDef
6600 }%
6601 \fi
6602 \else
6603 \ifx\sectionlevel\seckeyword
6604 \toks0={#1}%
6605 \xdef\currentsectiondefs{%
6606 \gdef\noexpand\thissectionname{\the\toks0}%
6607 \gdef\noexpand\thissectionnum{#4}%
6608 \let\noexpand\thissection\noexpand\thissectionDef
6609 }%
6610 \fi
6611 \fi\fi\fi
6612 %
6613 % Go into vertical mode. Usually we'll already be there, but we
6614 % don't want the following whatsit to end up in a preceding paragraph
6615 % if the document didn't happen to have a blank line.
6616 \par
6617 %
6618 % Output the mark. Pass it through \safewhatsit, to take care of
6619 % the preceding space.
6620 \safewhatsit\domark
6621 %
6622 % Insert space above the heading.
6623 \csname #2headingbreak\endcsname
6624 %
6625 % Now the second mark, after the heading break. No break points
6626 % between here and the heading.
6627 \global\let\prevsectiondefs=\currentsectiondefs
6628 \domark
6629 %
6630 % Only insert the space after the number if we have a section number.
6631 \ifx\temptype\Ynothingkeyword
6632 \setbox0 = \hbox{}%
6633 \def\toctype{unn}%
6634 \gdef\currentsection{#1}%
6635 \else\ifx\temptype\Yomitfromtockeyword
6636 % for @headings -- no section number, don't include in toc,
6637 % and don't redefine \currentsection.
6638 \setbox0 = \hbox{}%
6639 \def\toctype{omit}%
6640 \let\sectionlevel=\empty
6641 \else\ifx\temptype\Yappendixkeyword
6642 \setbox0 = \hbox{#4\enspace}%
6643 \def\toctype{app}%
6644 \gdef\currentsection{#1}%
6645 \else
6646 \setbox0 = \hbox{#4\enspace}%
6647 \def\toctype{num}%
6648 \gdef\currentsection{#1}%
6649 \fi\fi\fi
6650 %
6651 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6652 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6653 %
6654 % Write the node reference (= pdf destination for pdftex).
6655 % Again, see comments in \chapmacro.
6656 \donoderef{#3}%
6657 %
6658 % Interline glue will be inserted when the vbox is completed.
6659 % That glue will be a valid breakpoint for the page, since it'll be
6660 % preceded by a whatsit (usually from the \donoderef, or from the
6661 % \writetocentry if there was no node). We don't want to allow that
6662 % break, since then the whatsits could end up on page n while the
6663 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6664 \nobreak
6665 %
6666 % Output the actual section heading.
6667 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6668 \hangindent=\wd0 % zero if no section number
6669 \unhbox0 #1}%
6670 }%
6671 % Add extra space after the heading -- half of whatever came above it.
6672 % Don't allow stretch, though.
6673 \kern .5 \csname #2headingskip\endcsname
6674 %
6675 % Do not let the kern be a potential breakpoint, as it would be if it
6676 % was followed by glue.
6677 \nobreak
6678 %
6679 % We'll almost certainly start a paragraph next, so don't let that
6680 % glue accumulate. (Not a breakpoint because it's preceded by a
6681 % discardable item.) However, when a paragraph is not started next
6682 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6683 % or the negative glue will cause weirdly wrong output, typically
6684 % obscuring the section heading with something else.
6685 \vskip-\parskip
6686 %
6687 % This is so the last item on the main vertical list is a known
6688 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6689 % and do the needful.
6690 \penalty 10001
6691 }
6692
6693
6694 \message{toc,}
6695 % Table of contents.
6696 \newwrite\tocfile
6697
6698 % Write an entry to the toc file, opening it if necessary.
6699 % Called from @chapter, etc.
6700 %
6701 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6702 % We append the current node name (if any) and page number as additional
6703 % arguments for the \{chap,sec,...}entry macros which will eventually
6704 % read this. The node name is used in the pdf outlines as the
6705 % destination to jump to.
6706 %
6707 % We open the .toc file for writing here instead of at @setfilename (or
6708 % any other fixed time) so that @contents can be anywhere in the document.
6709 % But if #1 is `omit', then we don't do anything. This is used for the
6710 % table of contents chapter openings themselves.
6711 %
6712 \newif\iftocfileopened
6713 \def\omitkeyword{omit}%
6714 %
6715 \def\writetocentry#1#2#3{%
6716 \edef\writetoctype{#1}%
6717 \ifx\writetoctype\omitkeyword \else
6718 \iftocfileopened\else
6719 \immediate\openout\tocfile = \jobname.toc
6720 \global\tocfileopenedtrue
6721 \fi
6722 %
6723 \iflinks
6724 {\atdummies
6725 \edef\temp{%
6726 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6727 \temp
6728 }%
6729 \fi
6730 \fi
6731 %
6732 % Tell \shipout to create a pdf destination on each page, if we're
6733 % writing pdf. These are used in the table of contents. We can't
6734 % just write one on every page because the title pages are numbered
6735 % 1 and 2 (the page numbers aren't printed), and so are the first
6736 % two pages of the document. Thus, we'd have two destinations named
6737 % `1', and two named `2'.
6738 \ifpdforxetex
6739 \global\pdfmakepagedesttrue
6740 \fi
6741 }
6742
6743
6744 % These characters do not print properly in the Computer Modern roman
6745 % fonts, so we must take special care. This is more or less redundant
6746 % with the Texinfo input format setup at the end of this file.
6747 %
6748 \def\activecatcodes{%
6749 \catcode`\"=\active
6750 \catcode`\$=\active
6751 \catcode`\<=\active
6752 \catcode`\>=\active
6753 \catcode`\\=\active
6754 \catcode`\^=\active
6755 \catcode`\_=\active
6756 \catcode`\|=\active
6757 \catcode`\~=\active
6758 }
6759
6760
6761 % Read the toc file, which is essentially Texinfo input.
6762 \def\readtocfile{%
6763 \setupdatafile
6764 \activecatcodes
6765 \input \tocreadfilename
6766 }
6767
6768 \newskip\contentsrightmargin \contentsrightmargin=1in
6769 \newcount\savepageno
6770 \newcount\lastnegativepageno \lastnegativepageno = -1
6771
6772 % Prepare to read what we've written to \tocfile.
6773 %
6774 \def\startcontents#1{%
6775 % If @setchapternewpage on, and @headings double, the contents should
6776 % start on an odd page, unlike chapters.
6777 \contentsalignmacro
6778 \immediate\closeout\tocfile
6779 %
6780 % Don't need to put `Contents' or `Short Contents' in the headline.
6781 % It is abundantly clear what they are.
6782 \chapmacro{#1}{Yomitfromtoc}{}%
6783 %
6784 \savepageno = \pageno
6785 \begingroup % Set up to handle contents files properly.
6786 \raggedbottom % Worry more about breakpoints than the bottom.
6787 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6788 %
6789 % Roman numerals for page numbers.
6790 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6791 \def\thistitle{}% no title in double-sided headings
6792 % Record where the Roman numerals started.
6793 \ifnum\romancount=0 \global\romancount=\pagecount \fi
6794 \linkentrytexttrue
6795 }
6796
6797 % \raggedbottom in plain.tex hardcodes \topskip so override it
6798 \catcode`\@=11
6799 \def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue}
6800 \catcode`\@=\other
6801
6802 % redefined for the two-volume lispref. We always output on
6803 % \jobname.toc even if this is redefined.
6804 %
6805 \def\tocreadfilename{\jobname.toc}
6806
6807 % Normal (long) toc.
6808 %
6809 \def\contents{%
6810 \startcontents{\putwordTOC}%
6811 \openin 1 \tocreadfilename\space
6812 \ifeof 1 \else
6813 \readtocfile
6814 \fi
6815 \vfill \eject
6816 \contentsalignmacro % in case @setchapternewpage odd is in effect
6817 \ifeof 1 \else
6818 \pdfmakeoutlines
6819 \fi
6820 \closein 1
6821 \endgroup
6822 \contentsendroman
6823 }
6824
6825 % And just the chapters.
6826 \def\summarycontents{%
6827 \startcontents{\putwordShortTOC}%
6828 %
6829 \let\partentry = \shortpartentry
6830 \let\numchapentry = \shortchapentry
6831 \let\appentry = \shortchapentry
6832 \let\unnchapentry = \shortunnchapentry
6833 % We want a true roman here for the page numbers.
6834 \secfonts
6835 \let\rm=\shortcontrm \let\bf=\shortcontbf
6836 \let\sl=\shortcontsl \let\tt=\shortconttt
6837 \rm
6838 \hyphenpenalty = 10000
6839 \advance\baselineskip by 1pt % Open it up a little.
6840 \def\numsecentry##1##2##3##4{}
6841 \let\appsecentry = \numsecentry
6842 \let\unnsecentry = \numsecentry
6843 \let\numsubsecentry = \numsecentry
6844 \let\appsubsecentry = \numsecentry
6845 \let\unnsubsecentry = \numsecentry
6846 \let\numsubsubsecentry = \numsecentry
6847 \let\appsubsubsecentry = \numsecentry
6848 \let\unnsubsubsecentry = \numsecentry
6849 \openin 1 \tocreadfilename\space
6850 \ifeof 1 \else
6851 \readtocfile
6852 \fi
6853 \closein 1
6854 \vfill \eject
6855 \contentsalignmacro % in case @setchapternewpage odd is in effect
6856 \endgroup
6857 \contentsendroman
6858 }
6859 \let\shortcontents = \summarycontents
6860
6861 % Get ready to use Arabic numerals again
6862 \def\contentsendroman{%
6863 \lastnegativepageno = \pageno
6864 \global\pageno = \savepageno
6865 %
6866 % If \romancount > \arabiccount, the contents are at the end of the
6867 % document. Otherwise, advance where the Arabic numerals start for
6868 % the page numbers.
6869 \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi
6870 }
6871
6872 % Typeset the label for a chapter or appendix for the short contents.
6873 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6874 %
6875 \def\shortchaplabel#1{%
6876 % This space should be enough, since a single number is .5em, and the
6877 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6878 % But use \hss just in case.
6879 % (This space doesn't include the extra space that gets added after
6880 % the label; that gets put in by \shortchapentry above.)
6881 %
6882 % We'd like to right-justify chapter numbers, but that looks strange
6883 % with appendix letters. And right-justifying numbers and
6884 % left-justifying letters looks strange when there is less than 10
6885 % chapters. Have to read the whole toc once to know how many chapters
6886 % there are before deciding ...
6887 \hbox to 1em{#1\hss}%
6888 }
6889
6890 % These macros generate individual entries in the table of contents.
6891 % The first argument is the chapter or section name.
6892 % The last argument is the page number.
6893 % The arguments in between are the chapter number, section number, ...
6894
6895 % Parts, in the main contents. Replace the part number, which doesn't
6896 % exist, with an empty box. Let's hope all the numbers have the same width.
6897 % Also ignore the page number, which is conventionally not printed.
6898 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6899 \def\partentry#1#2#3#4{%
6900 % Add stretch and a bonus for breaking the page before the part heading.
6901 % This reduces the chance of the page being broken immediately after the
6902 % part heading, before a following chapter heading.
6903 \vskip 0pt plus 5\baselineskip
6904 \penalty-300
6905 \vskip 0pt plus -5\baselineskip
6906 \dochapentry{\numeralbox\labelspace#1}{}%
6907 }
6908 %
6909 % Parts, in the short toc.
6910 \def\shortpartentry#1#2#3#4{%
6911 \penalty-300
6912 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6913 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6914 }
6915
6916 % Chapters, in the main contents.
6917 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6918
6919 % Chapters, in the short toc.
6920 % See comments in \dochapentry re vbox and related settings.
6921 \def\shortchapentry#1#2#3#4{%
6922 \tocentry{\shortchaplabel{#2}\labelspace #1}{#4}%
6923 }
6924
6925 % Appendices, in the main contents.
6926 % Need the word Appendix, and a fixed-size box.
6927 %
6928 \def\appendixbox#1{%
6929 % We use M since it's probably the widest letter.
6930 \setbox0 = \hbox{\putwordAppendix{} M}%
6931 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6932 %
6933 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6934
6935 % Unnumbered chapters.
6936 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6937 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{#4}}
6938
6939 % Sections.
6940 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6941 \let\appsecentry=\numsecentry
6942 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6943
6944 % Subsections.
6945 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6946 \let\appsubsecentry=\numsubsecentry
6947 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6948
6949 % And subsubsections.
6950 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6951 \let\appsubsubsecentry=\numsubsubsecentry
6952 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6953
6954 % This parameter controls the indentation of the various levels.
6955 % Same as \defaultparindent.
6956 \newdimen\tocindent \tocindent = 15pt
6957
6958 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6959 % page number.
6960 %
6961 % If the toc has to be broken over pages, we want it to be at chapters
6962 % if at all possible; hence the \penalty.
6963 \def\dochapentry#1#2{%
6964 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6965 \begingroup
6966 % Move the page numbers slightly to the right
6967 \advance\entryrightmargin by -0.05em
6968 \chapentryfonts
6969 \tocentry{#1}{#2}%
6970 \endgroup
6971 \nobreak\vskip .25\baselineskip plus.1\baselineskip
6972 }
6973
6974 \def\dosecentry#1#2{\begingroup
6975 \secentryfonts \leftskip=\tocindent
6976 \tocentry{#1}{#2}%
6977 \endgroup}
6978
6979 \def\dosubsecentry#1#2{\begingroup
6980 \subsecentryfonts \leftskip=2\tocindent
6981 \tocentry{#1}{#2}%
6982 \endgroup}
6983
6984 \def\dosubsubsecentry#1#2{\begingroup
6985 \subsubsecentryfonts \leftskip=3\tocindent
6986 \tocentry{#1}{#2}%
6987 \endgroup}
6988
6989 % We use the same \entry macro as for the index entries.
6990 \let\tocentry = \entry
6991
6992 % Space between chapter (or whatever) number and the title.
6993 \def\labelspace{\hskip1em \relax}
6994
6995 \def\chapentryfonts{\secfonts \rm}
6996 \def\secentryfonts{\textfonts}
6997 \def\subsecentryfonts{\textfonts}
6998 \def\subsubsecentryfonts{\textfonts}
6999
7000
7001 \message{environments,}
7002 % @foo ... @end foo.
7003
7004 % @tex ... @end tex escapes into raw TeX temporarily.
7005 % One exception: @ is still an escape character, so that @end tex works.
7006 % But \@ or @@ will get a plain @ character.
7007
7008 \envdef\tex{%
7009 \setregularquotes
7010 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
7011 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
7012 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
7013 \catcode `\%=14
7014 \catcode `\+=\other
7015 \catcode `\"=\other
7016 \catcode `\|=\other
7017 \catcode `\<=\other
7018 \catcode `\>=\other
7019 \catcode `\`=\other
7020 \catcode `\'=\other
7021 %
7022 % ' is active in math mode (mathcode"8000). So reset it, and all our
7023 % other math active characters (just in case), to plain's definitions.
7024 \mathactive
7025 %
7026 % Inverse of the list at the beginning of the file.
7027 \let\b=\ptexb
7028 \let\bullet=\ptexbullet
7029 \let\c=\ptexc
7030 \let\,=\ptexcomma
7031 \let\.=\ptexdot
7032 \let\dots=\ptexdots
7033 \let\equiv=\ptexequiv
7034 \let\!=\ptexexclam
7035 \let\i=\ptexi
7036 \let\indent=\ptexindent
7037 \let\noindent=\ptexnoindent
7038 \let\{=\ptexlbrace
7039 \let\+=\tabalign
7040 \let\}=\ptexrbrace
7041 \let\/=\ptexslash
7042 \let\sp=\ptexsp
7043 \let\*=\ptexstar
7044 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7045 \let\t=\ptext
7046 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7047 \let\frenchspacing=\plainfrenchspacing
7048 %
7049 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7050 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7051 \def\@{@}%
7052 }
7053 % There is no need to define \Etex.
7054
7055 % Define @lisp ... @end lisp.
7056 % @lisp environment forms a group so it can rebind things,
7057 % including the definition of @end lisp (which normally is erroneous).
7058
7059 % Amount to narrow the margins by for @lisp.
7060 \newskip\lispnarrowing \lispnarrowing=0.4in
7061
7062 % This is the definition that ^^M gets inside @lisp, @example, and other
7063 % such environments. \null is better than a space, since it doesn't
7064 % have any width.
7065 \def\lisppar{\null\endgraf}
7066
7067 % This space is always present above and below environments.
7068 \newskip\envskipamount \envskipamount = 0pt
7069
7070 % Make spacing and below environment symmetrical. We use \parskip here
7071 % to help in doing that, since in @example-like environments \parskip
7072 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7073 % start of the next paragraph will insert \parskip.
7074 %
7075 \def\aboveenvbreak{{%
7076 % =10000 instead of <10000 because of a special case in \itemzzz and
7077 % \sectionheading, q.v.
7078 \ifnum \lastpenalty=10000 \else
7079 \advance\envskipamount by \parskip
7080 \endgraf
7081 \ifdim\lastskip<\envskipamount
7082 \removelastskip
7083 \ifnum\lastpenalty<10000
7084 % Penalize breaking before the environment, because preceding text
7085 % often leads into it.
7086 \penalty100
7087 \fi
7088 \vskip\envskipamount
7089 \fi
7090 \fi
7091 }}
7092
7093 \def\afterenvbreak{{%
7094 % =10000 instead of <10000 because of a special case in \itemzzz and
7095 % \sectionheading, q.v.
7096 \ifnum \lastpenalty=10000 \else
7097 \advance\envskipamount by \parskip
7098 \endgraf
7099 \ifdim\lastskip<\envskipamount
7100 \removelastskip
7101 % it's not a good place to break if the last penalty was \nobreak
7102 % or better ...
7103 \ifnum\lastpenalty<10000 \penalty-50 \fi
7104 \vskip\envskipamount
7105 \fi
7106 \fi
7107 }}
7108
7109 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7110 % also clear it, so that its embedded environments do the narrowing again.
7111 \let\nonarrowing=\relax
7112
7113 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7114 % environment contents.
7115
7116 %
7117 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7118 \def\ctr{{\hskip 6pt\circle\char'010}}
7119 \def\cbl{{\circle\char'012\hskip -6pt}}
7120 \def\cbr{{\hskip 6pt\circle\char'011}}
7121 \def\carttop{\hbox to \cartouter{\hskip\lskip
7122 \ctl\leaders\hrule height\circthick\hfil\ctr
7123 \hskip\rskip}}
7124 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7125 \cbl\leaders\hrule height\circthick\hfil\cbr
7126 \hskip\rskip}}
7127 %
7128 \newskip\lskip\newskip\rskip
7129
7130 % only require the font if @cartouche is actually used
7131 \def\cartouchefontdefs{%
7132 \font\circle=lcircle10\relax
7133 \circthick=\fontdimen8\circle
7134 }
7135 \newdimen\circthick
7136 \newdimen\cartouter\newdimen\cartinner
7137 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7138
7139
7140 \envdef\cartouche{%
7141 \cartouchefontdefs
7142 \ifhmode\par\fi % can't be in the midst of a paragraph.
7143 \startsavinginserts
7144 \lskip=\leftskip \rskip=\rightskip
7145 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7146 %
7147 % Set paragraph width for text inside cartouche. There are
7148 % left and right margins of 3pt each plus two vrules 0.4pt each.
7149 \cartinner=\hsize \advance\cartinner by-\lskip
7150 \advance\cartinner by-\rskip
7151 \advance\cartinner by -6.8pt
7152 %
7153 % For drawing top and bottom of cartouche. Each corner char
7154 % adds 6pt and we take off the width of a rule to line up with the
7155 % right boundary perfectly.
7156 \cartouter=\hsize
7157 \advance\cartouter by 11.6pt
7158 %
7159 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7160 %
7161 % If this cartouche directly follows a sectioning command, we need the
7162 % \parskip glue (backspaced over by default) or the cartouche can
7163 % collide with the section heading.
7164 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7165 %
7166 \setbox\groupbox=\vtop\bgroup
7167 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7168 \carttop
7169 \hbox\bgroup
7170 \hskip\lskip
7171 \vrule\kern3pt
7172 \vbox\bgroup
7173 \kern3pt
7174 \hsize=\cartinner
7175 \baselineskip=\normbskip
7176 \lineskip=\normlskip
7177 \parskip=\normpskip
7178 \vskip -\parskip
7179 \comment % For explanation, see the end of def\group.
7180 }
7181 \def\Ecartouche{%
7182 \ifhmode\par\fi
7183 \kern3pt
7184 \egroup
7185 \kern3pt\vrule
7186 \hskip\rskip
7187 \egroup
7188 \cartbot
7189 \egroup
7190 \addgroupbox
7191 \checkinserts
7192 }
7193
7194
7195 % This macro is called at the beginning of all the @example variants,
7196 % inside a group.
7197 \newdimen\nonfillparindent
7198 \def\nonfillstart{%
7199 \aboveenvbreak
7200 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7201 \sepspaces % Make spaces be word-separators rather than space tokens.
7202 \let\par = \lisppar % don't ignore blank lines
7203 \obeylines % each line of input is a line of output
7204 \parskip = 0pt
7205 % Turn off paragraph indentation but redefine \indent to emulate
7206 % the normal \indent.
7207 \nonfillparindent=\parindent
7208 \parindent = 0pt
7209 \let\indent\nonfillindent
7210 %
7211 \emergencystretch = 0pt % don't try to avoid overfull boxes
7212 \ifx\nonarrowing\relax
7213 \advance \leftskip by \lispnarrowing
7214 \exdentamount=\lispnarrowing
7215 \else
7216 \let\nonarrowing = \relax
7217 \fi
7218 \let\exdent=\nofillexdent
7219 }
7220
7221 \begingroup
7222 \obeyspaces
7223 % We want to swallow spaces (but not other tokens) after the fake
7224 % @indent in our nonfill-environments, where spaces are normally
7225 % active and set to @tie, resulting in them not being ignored after
7226 % @indent.
7227 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7228 \gdef\nonfillindentcheck{%
7229 \ifx\temp %
7230 \expandafter\nonfillindentgobble%
7231 \else%
7232 \leavevmode\nonfillindentbox%
7233 \fi%
7234 }%
7235 \endgroup
7236 \def\nonfillindentgobble#1{\nonfillindent}
7237 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7238
7239 % If you want all examples etc. small: @set dispenvsize small.
7240 % If you want even small examples the full size: @set dispenvsize nosmall.
7241 % This affects the following displayed environments:
7242 % @example, @display, @format, @lisp, @verbatim
7243 %
7244 \def\smallword{small}
7245 \def\nosmallword{nosmall}
7246 \let\SETdispenvsize\relax
7247 \def\setnormaldispenv{%
7248 \ifx\SETdispenvsize\smallword
7249 % end paragraph for sake of leading, in case document has no blank
7250 % line. This is redundant with what happens in \aboveenvbreak, but
7251 % we need to do it before changing the fonts, and it's inconvenient
7252 % to change the fonts afterward.
7253 \ifnum \lastpenalty=10000 \else \endgraf \fi
7254 \smallexamplefonts \rm
7255 \fi
7256 }
7257 \def\setsmalldispenv{%
7258 \ifx\SETdispenvsize\nosmallword
7259 \else
7260 \ifnum \lastpenalty=10000 \else \endgraf \fi
7261 \smallexamplefonts \rm
7262 \fi
7263 }
7264
7265 % We often define two environments, @foo and @smallfoo.
7266 % Let's do it in one command. #1 is the env name, #2 the definition.
7267 \def\makedispenvdef#1#2{%
7268 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7269 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7270 \expandafter\let\csname E#1\endcsname \afterenvbreak
7271 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7272 }
7273
7274 % Define two environment synonyms (#1 and #2) for an environment.
7275 \def\maketwodispenvdef#1#2#3{%
7276 \makedispenvdef{#1}{#3}%
7277 \makedispenvdef{#2}{#3}%
7278 }
7279 %
7280 % @lisp: indented, narrowed, typewriter font;
7281 % @example: same as @lisp.
7282 %
7283 % @smallexample and @smalllisp: use smaller fonts.
7284 % Originally contributed by Pavel@xerox.
7285 %
7286 \maketwodispenvdef{lisp}{example}{%
7287 \nonfillstart
7288 \tt\setcodequotes
7289 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7290 \parsearg\gobble
7291 }
7292 % @display/@smalldisplay: same as @lisp except keep current font.
7293 %
7294 \makedispenvdef{display}{%
7295 \nonfillstart
7296 \gobble
7297 }
7298
7299 % @format/@smallformat: same as @display except don't narrow margins.
7300 %
7301 \makedispenvdef{format}{%
7302 \let\nonarrowing = t%
7303 \nonfillstart
7304 \gobble
7305 }
7306
7307 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7308 \envdef\flushleft{%
7309 \let\nonarrowing = t%
7310 \nonfillstart
7311 \gobble
7312 }
7313 \let\Eflushleft = \afterenvbreak
7314
7315 % @flushright.
7316 %
7317 \envdef\flushright{%
7318 \let\nonarrowing = t%
7319 \nonfillstart
7320 \advance\leftskip by 0pt plus 1fill\relax
7321 \gobble
7322 }
7323 \let\Eflushright = \afterenvbreak
7324
7325
7326 % @raggedright does more-or-less normal line breaking but no right
7327 % justification. From plain.tex.
7328 \envdef\raggedright{%
7329 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7330 }
7331 \let\Eraggedright\par
7332
7333
7334 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7335 % and narrows the margins. We keep \parskip nonzero in general, since
7336 % we're doing normal filling. So, when using \aboveenvbreak and
7337 % \afterenvbreak, temporarily make \parskip 0.
7338 %
7339 \makedispenvdef{quotation}{\quotationstart}
7340 %
7341 \def\quotationstart{%
7342 \indentedblockstart % same as \indentedblock, but increase right margin too.
7343 \ifx\nonarrowing\relax
7344 \advance\rightskip by \lispnarrowing
7345 \fi
7346 \parsearg\quotationlabel
7347 }
7348
7349 % We have retained a nonzero parskip for the environment, since we're
7350 % doing normal filling.
7351 %
7352 \def\Equotation{%
7353 \par
7354 \ifx\quotationauthor\thisisundefined\else
7355 % indent a bit.
7356 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7357 \fi
7358 {\parskip=0pt \afterenvbreak}%
7359 }
7360 \def\Esmallquotation{\Equotation}
7361
7362 % If we're given an argument, typeset it in bold with a colon after.
7363 \def\quotationlabel#1{%
7364 \def\temp{#1}%
7365 \ifx\temp\empty \else
7366 {\bf #1: }%
7367 \fi
7368 }
7369
7370 % @indentedblock is like @quotation, but indents only on the left and
7371 % has no optional argument.
7372 %
7373 \makedispenvdef{indentedblock}{\indentedblockstart}
7374 %
7375 \def\indentedblockstart{%
7376 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7377 \parindent=0pt
7378 %
7379 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7380 \ifx\nonarrowing\relax
7381 \advance\leftskip by \lispnarrowing
7382 \exdentamount = \lispnarrowing
7383 \else
7384 \let\nonarrowing = \relax
7385 \fi
7386 }
7387
7388 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7389 %
7390 \def\Eindentedblock{%
7391 \par
7392 {\parskip=0pt \afterenvbreak}%
7393 }
7394 \def\Esmallindentedblock{\Eindentedblock}
7395
7396
7397 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7398 % If we want to allow any <char> as delimiter,
7399 % we need the curly braces so that makeinfo sees the @verb command, eg:
7400 % `@verbx...x' would look like the '@verbx' command. --janneke (a] gnu.org
7401 %
7402 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7403 %
7404 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7405 % active too. Otherwise, they get lost as the first character on a
7406 % verbatim line.
7407 \def\dospecials{%
7408 \do\ \do\\\do\{\do\}\do\$\do\&%
7409 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7410 \do\<\do\>\do\|\do\@\do+\do\"%
7411 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7412 % @set txicodequotebacktick will not have effect on @verb and
7413 % @verbatim, and ?` and !` ligatures won't get disabled.
7414 %\do\`\do\'%
7415 }
7416 %
7417 % [Knuth] p. 380
7418 \def\uncatcodespecials{%
7419 \def\do##1{\catcode`##1=\other}\dospecials}
7420 %
7421 % Setup for the @verb command.
7422 %
7423 % Eight spaces for a tab
7424 \begingroup
7425 \catcode`\^^I=\active
7426 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7427 \endgroup
7428 %
7429 \def\setupverb{%
7430 \tt
7431 \def\par{\leavevmode\endgraf}%
7432 \setcodequotes
7433 \tabeightspaces
7434 \nohyphenation
7435 % Respect line breaks,
7436 % print special symbols as themselves, and
7437 % make each space count
7438 % must do in this order:
7439 \obeylines \uncatcodespecials \sepspaces
7440 }
7441
7442 % Setup for the @verbatim environment
7443 %
7444 % Real tab expansion.
7445 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7446 %
7447 % We typeset each line of the verbatim in an \hbox, so we can handle
7448 % tabs.
7449 \newbox\verbbox
7450 \def\starttabbox{\setbox\verbbox=\hbox\bgroup}
7451 %
7452 \begingroup
7453 \catcode`\^^I=\active
7454 \gdef\tabexpand{%
7455 \catcode`\^^I=\active
7456 \def^^I{\leavevmode\egroup
7457 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7458 \divide\dimen\verbbox by\tabw
7459 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7460 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7461 \wd\verbbox=\dimen\verbbox
7462 \leavevmode\box\verbbox \starttabbox
7463 }%
7464 }
7465 \endgroup
7466
7467 % start the verbatim environment.
7468 \def\setupverbatim{%
7469 \let\nonarrowing = t%
7470 \nonfillstart
7471 \tt % easiest (and conventionally used) font for verbatim
7472 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
7473 \tabexpand
7474 \setcodequotes
7475 % Respect line breaks,
7476 % print special symbols as themselves, and
7477 % make each space count.
7478 % Must do in this order:
7479 \obeylines \uncatcodespecials \sepspaces
7480 }
7481
7482 % Do the @verb magic: verbatim text is quoted by unique
7483 % delimiter characters. Before first delimiter expect a
7484 % right brace, after last delimiter expect closing brace:
7485 %
7486 % \def\doverb'{'<char>#1<char>'}'{#1}
7487 %
7488 % [Knuth] p. 382; only eat outer {}
7489 \begingroup
7490 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7491 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7492 \endgroup
7493 %
7494 \def\verb{\begingroup\setupverb\doverb}
7495 %
7496 %
7497 % Do the @verbatim magic: define the macro \doverbatim so that
7498 % the (first) argument ends when '@end verbatim' is reached, ie:
7499 %
7500 % \def\doverbatim#1@end verbatim{#1}
7501 %
7502 % For Texinfo it's a lot easier than for LaTeX,
7503 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7504 % we need not redefine '\', '{' and '}'.
7505 %
7506 % Inspired by LaTeX's verbatim command set [latex.ltx]
7507 %
7508 \begingroup
7509 \catcode`\ =\active
7510 \obeylines %
7511 % ignore everything up to the first ^^M, that's the newline at the end
7512 % of the @verbatim input line itself. Otherwise we get an extra blank
7513 % line in the output.
7514 \xdef\doverbatim#1^^M#2@end verbatim{%
7515 \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
7516 % We really want {...\end verbatim} in the body of the macro, but
7517 % without the active space; thus we have to use \xdef and \gobble.
7518 % The \egroup ends the \verbbox started at the end of the last line in
7519 % the block.
7520 \endgroup
7521 %
7522 \envdef\verbatim{%
7523 \setnormaldispenv\setupverbatim\doverbatim
7524 }
7525 \let\Everbatim = \afterenvbreak
7526
7527
7528 % @verbatiminclude FILE - insert text of file in verbatim environment.
7529 %
7530 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7531 %
7532 \def\doverbatiminclude#1{%
7533 {%
7534 \makevalueexpandable
7535 \setupverbatim
7536 {%
7537 \indexnofonts % Allow `@@' and other weird things in file names.
7538 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7539 \edef\tmp{\noexpand\input #1 }
7540 \expandafter
7541 }\expandafter\starttabbox\tmp\egroup
7542 \afterenvbreak
7543 }%
7544 }
7545
7546 % @copying ... @end copying.
7547 % Save the text away for @insertcopying later.
7548 %
7549 % We save the uninterpreted tokens, rather than creating a box.
7550 % Saving the text in a box would be much easier, but then all the
7551 % typesetting commands (@smallbook, font changes, etc.) have to be done
7552 % beforehand -- and a) we want @copying to be done first in the source
7553 % file; b) letting users define the frontmatter in as flexible order as
7554 % possible is desirable.
7555 %
7556 \def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying}
7557 {\catcode`\ =\other
7558 \gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7559 }
7560
7561 \def\insertcopying{%
7562 \begingroup
7563 \parindent = 0pt % paragraph indentation looks wrong on title page
7564 \scanexp\copyingtext
7565 \endgroup
7566 }
7567
7568
7569 \message{defuns,}
7570 % @defun etc.
7571
7572 \newskip\defbodyindent \defbodyindent=.4in
7573 \newskip\defargsindent \defargsindent=50pt
7574 \newskip\deflastargmargin \deflastargmargin=18pt
7575 \newcount\defunpenalty
7576
7577 % Start the processing of @deffn:
7578 \def\startdefun{%
7579 \ifnum\lastpenalty<10000
7580 \medbreak
7581 \defunpenalty=10003 % Will keep this @deffn together with the
7582 % following @def command, see below.
7583 \else
7584 % If there are two @def commands in a row, we'll have a \nobreak,
7585 % which is there to keep the function description together with its
7586 % header. But if there's nothing but headers, we need to allow a
7587 % break somewhere. Check specifically for penalty 10002, inserted
7588 % by \printdefunline, instead of 10000, since the sectioning
7589 % commands also insert a nobreak penalty, and we don't want to allow
7590 % a break between a section heading and a defun.
7591 %
7592 % As a further refinement, we avoid "club" headers by signalling
7593 % with penalty of 10003 after the very first @deffn in the
7594 % sequence (see above), and penalty of 10002 after any following
7595 % @def command.
7596 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7597 %
7598 % Similarly, after a section heading, do not allow a break.
7599 % But do insert the glue.
7600 \medskip % preceded by discardable penalty, so not a breakpoint
7601 \fi
7602 %
7603 \parindent=0in
7604 \advance\leftskip by \defbodyindent
7605 \exdentamount=\defbodyindent
7606 }
7607
7608 \def\dodefunx#1{%
7609 % First, check whether we are in the right environment:
7610 \checkenv#1%
7611 %
7612 % As above, allow line break if we have multiple x headers in a row.
7613 % It's not a great place, though.
7614 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7615 %
7616 % And now, it's time to reuse the body of the original defun:
7617 \expandafter\gobbledefun#1%
7618 }
7619 \def\gobbledefun#1\startdefun{}
7620
7621 % \printdefunline \deffnheader{text}
7622 %
7623 \def\printdefunline#1#2{%
7624 \begingroup
7625 \plainfrenchspacing
7626 % call \deffnheader:
7627 #1#2 \endheader
7628 % common ending:
7629 \interlinepenalty = 10000
7630 \advance\rightskip by 0pt plus 1fil\relax
7631 \endgraf
7632 \nobreak\vskip -\parskip
7633 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7634 % Some of the @defun-type tags do not enable magic parentheses,
7635 % rendering the following check redundant. But we don't optimize.
7636 \checkparencounts
7637 \endgroup
7638 }
7639
7640 \def\Edefun{\endgraf\medbreak}
7641
7642 % \makedefun{deffoo}{ (definition of \deffooheader) }
7643 %
7644 % Define \deffoo, \deffoox \Edeffoo and \deffooheader.
7645 \def\makedefun#1{%
7646 \expandafter\let\csname E#1\endcsname = \Edefun
7647 \edef\temp{\noexpand\domakedefun
7648 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7649 \temp
7650 }
7651 \def\domakedefun#1#2#3{%
7652 \envdef#1{%
7653 \startdefun
7654 \doingtypefnfalse % distinguish typed functions from all else
7655 \parseargusing\activeparens{\printdefunline#3}%
7656 }%
7657 \def#2{\dodefunx#1}%
7658 \def#3%
7659 }
7660
7661 \newif\ifdoingtypefn % doing typed function?
7662 \newif\ifrettypeownline % typeset return type on its own line?
7663
7664 % @deftypefnnewline on|off says whether the return type of typed functions
7665 % are printed on their own line. This affects @deftypefn, @deftypefun,
7666 % @deftypeop, and @deftypemethod.
7667 %
7668 \parseargdef\deftypefnnewline{%
7669 \def\temp{#1}%
7670 \ifx\temp\onword
7671 \expandafter\let\csname SETtxideftypefnnl\endcsname
7672 = \empty
7673 \else\ifx\temp\offword
7674 \expandafter\let\csname SETtxideftypefnnl\endcsname
7675 = \relax
7676 \else
7677 \errhelp = \EMsimple
7678 \errmessage{Unknown @txideftypefnnl value `\temp',
7679 must be on|off}%
7680 \fi\fi
7681 }
7682
7683 % Untyped functions:
7684
7685 % @deffn category name args
7686 \makedefun{deffn}#1 #2 #3\endheader{%
7687 \doind{fn}{\code{#2}}%
7688 \defname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
7689 }
7690
7691 % @defop category class name args
7692 \makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
7693 \def\defopheaderx#1#2 #3 #4\endheader{%
7694 \doind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
7695 \defname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
7696 }
7697
7698 % Typed functions:
7699
7700 % @deftypefn category type name args
7701 \makedefun{deftypefn}#1 #2 #3 #4\endheader{%
7702 \doind{fn}{\code{#3}}%
7703 \doingtypefntrue
7704 \defname{#1}{#2}{#3}\defunargs{#4\unskip}%
7705 }
7706
7707 % @deftypeop category class type name args
7708 \makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
7709 \def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
7710 \doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
7711 \doingtypefntrue
7712 \defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
7713 }
7714
7715 % Typed variables:
7716
7717 % @deftypevr category type var args
7718 \makedefun{deftypevr}#1 #2 #3 #4\endheader{%
7719 \doind{vr}{\code{#3}}%
7720 \defname{#1}{#2}{#3}\defunargs{#4\unskip}%
7721 }
7722
7723 % @deftypecv category class type var args
7724 \makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
7725 \def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
7726 \doind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
7727 \defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
7728 }
7729
7730 % Untyped variables:
7731
7732 % @defvr category var args
7733 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7734
7735 % @defcv category class var args
7736 \makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}}
7737 \def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} }
7738
7739 % Types:
7740
7741 % @deftp category name args
7742 \makedefun{deftp}#1 #2 #3\endheader{%
7743 \doind{tp}{\code{#2}}%
7744 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7745 }
7746
7747 % Remaining @defun-like shortcuts:
7748 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7749 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7750 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7751 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7752 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7753 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7754 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7755 \makedefun{defmethod}{\defopheaderx\putwordMethodon}
7756 \makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon}
7757 \makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof}
7758 \makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof}
7759
7760 % \defname, which formats the name of the @def (not the args).
7761 % #1 is the category, such as "Function".
7762 % #2 is the return type, if any.
7763 % #3 is the function name.
7764 %
7765 % We are followed by (but not passed) the arguments, if any.
7766 %
7767 \def\defname#1#2#3{%
7768 \par
7769 % Get the values of \leftskip and \rightskip as they were outside the @def...
7770 \advance\leftskip by -\defbodyindent
7771 %
7772 % Determine if we are typesetting the return type of a typed function
7773 % on a line by itself.
7774 \rettypeownlinefalse
7775 \ifdoingtypefn % doing a typed function specifically?
7776 % then check user option for putting return type on its own line:
7777 \ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}%
7778 \fi
7779 %
7780 % How we'll format the category name. Putting it in brackets helps
7781 % distinguish it from the body text that may end up on the next line
7782 % just below it.
7783 \def\temp{#1}%
7784 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7785 %
7786 % Figure out line sizes for the paragraph shape. We'll always have at
7787 % least two.
7788 \tempnum = 2
7789 %
7790 % The first line needs space for \box0; but if \rightskip is nonzero,
7791 % we need only space for the part of \box0 which exceeds it:
7792 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7793 %
7794 % If doing a return type on its own line, we'll have another line.
7795 \ifrettypeownline
7796 \advance\tempnum by 1
7797 \def\maybeshapeline{0in \hsize}%
7798 \else
7799 \def\maybeshapeline{}%
7800 \fi
7801 %
7802 % The continuations:
7803 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7804 %
7805 % The final paragraph shape:
7806 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7807 %
7808 % Put the category name at the right margin.
7809 \noindent
7810 \hbox to 0pt{%
7811 \hfil\box0 \kern-\hsize
7812 % \hsize has to be shortened this way:
7813 \kern\leftskip
7814 % Intentionally do not respect \rightskip, since we need the space.
7815 }%
7816 %
7817 % Allow all lines to be underfull without complaint:
7818 \tolerance=10000 \hbadness=10000
7819 \exdentamount=\defbodyindent
7820 {%
7821 % defun fonts. We use typewriter by default (used to be bold) because:
7822 % . we're printing identifiers, they should be in tt in principle.
7823 % . in languages with many accents, such as Czech or French, it's
7824 % common to leave accents off identifiers. The result looks ok in
7825 % tt, but exceedingly strange in rm.
7826 % . we don't want -- and --- to be treated as ligatures.
7827 % . this still does not fix the ?` and !` ligatures, but so far no
7828 % one has made identifiers using them :).
7829 \df \tt
7830 \def\temp{#2}% text of the return type
7831 \ifx\temp\empty\else
7832 \tclose{\temp}% typeset the return type
7833 \ifrettypeownline
7834 % put return type on its own line; prohibit line break following:
7835 \hfil\vadjust{\nobreak}\break
7836 \else
7837 \space % type on same line, so just followed by a space
7838 \fi
7839 \fi % no return type
7840 #3% output function name
7841 }%
7842 \ifflagclear{txidefnamenospace}{%
7843 {\rm\enskip}% hskip 0.5 em of \rmfont
7844 }{}%
7845 %
7846 \boldbrax
7847 % arguments will be output next, if any.
7848 }
7849
7850 % Print arguments. Use slanted for @def*, typewriter for @deftype*.
7851 \def\defunargs#1{%
7852 \df \ifdoingtypefn \tt \else \sl \fi
7853 \ifflagclear{txicodevaristt}{}%
7854 {\def\var##1{{\setregularquotes \ttsl ##1}}}%
7855 #1%
7856 }
7857
7858 % We want ()&[] to print specially on the defun line.
7859 %
7860 \def\activeparens{%
7861 \catcode`\(=\active \catcode`\)=\active
7862 \catcode`\[=\active \catcode`\]=\active
7863 \catcode`\&=\active
7864 }
7865
7866 % Make control sequences which act like normal parenthesis chars.
7867 \let\lparen = ( \let\rparen = )
7868
7869 % Be sure that we always have a definition for `(', etc. For example,
7870 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7871 % so TeX would otherwise complain about undefined control sequence.
7872 {
7873 \activeparens
7874 \gdef\defcharsdefault{%
7875 \let(=\lparen \let)=\rparen
7876 \let[=\lbrack \let]=\rbrack
7877 \let& = \&%
7878 }
7879 \globaldefs=1 \defcharsdefault
7880
7881 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7882 \gdef\magicamp{\let&=\amprm}
7883 }
7884 \let\ampchar\&
7885
7886 \newcount\parencount
7887
7888 % If we encounter &foo, then turn on ()-hacking afterwards
7889 \newif\ifampseen
7890 \def\amprm#1 {\ampseentrue{\bf\ }}
7891
7892 \def\parenfont{%
7893 \ifampseen
7894 % At the first level, print parens in roman,
7895 % otherwise use the default font.
7896 \ifnum \parencount=1 \rm \fi
7897 \else
7898 % The \sf parens (in \boldbrax) actually are a little bolder than
7899 % the contained text. This is especially needed for [ and ] .
7900 \sf
7901 \fi
7902 }
7903 \def\infirstlevel#1{%
7904 \ifampseen
7905 \ifnum\parencount=1
7906 #1%
7907 \fi
7908 \fi
7909 }
7910 \def\bfafterword#1 {#1 \bf}
7911
7912 \def\opnr{%
7913 \global\advance\parencount by 1
7914 {\parenfont(}%
7915 \infirstlevel \bfafterword
7916 }
7917 \def\clnr{%
7918 {\parenfont)}%
7919 \infirstlevel \sl
7920 \global\advance\parencount by -1
7921 }
7922
7923 \newcount\brackcount
7924 \def\lbrb{%
7925 \global\advance\brackcount by 1
7926 {\bf[}%
7927 }
7928 \def\rbrb{%
7929 {\bf]}%
7930 \global\advance\brackcount by -1
7931 }
7932
7933 \def\checkparencounts{%
7934 \ifnum\parencount=0 \else \badparencount \fi
7935 \ifnum\brackcount=0 \else \badbrackcount \fi
7936 }
7937 % these should not use \errmessage; the glibc manual, at least, actually
7938 % has such constructs (when documenting function pointers).
7939 \def\badparencount{%
7940 \message{Warning: unbalanced parentheses in @def...}%
7941 \global\parencount=0
7942 }
7943 \def\badbrackcount{%
7944 \message{Warning: unbalanced square brackets in @def...}%
7945 \global\brackcount=0
7946 }
7947
7948
7949 \message{macros,}
7950 % @macro.
7951
7952 % To do this right we need a feature of e-TeX, \scantokens,
7953 % which we arrange to emulate with a temporary file in ordinary TeX.
7954 \ifx\eTeXversion\thisisundefined
7955 \newwrite\macscribble
7956 \def\scantokens#1{%
7957 \toks0={#1}%
7958 \immediate\openout\macscribble=\jobname.tmp
7959 \immediate\write\macscribble{\the\toks0}%
7960 \immediate\closeout\macscribble
7961 \input \jobname.tmp
7962 }
7963 \fi
7964
7965 \let\E=\expandafter
7966
7967 % Used at the time of macro expansion.
7968 % Argument is macro body with arguments substituted
7969 \def\scanmacro#1{%
7970 \newlinechar`\^^M
7971 % expand the expansion of \eatleadingcr twice to maybe remove a leading
7972 % newline (and \else and \fi tokens), then call \eatspaces on the result.
7973 \def\xeatspaces##1{%
7974 \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
7975 }}%
7976 \def\xempty##1{}%
7977 %
7978 % Process the macro body under the current catcode regime.
7979 \scantokens{#1@comment}%
7980 %
7981 % The \comment is to remove the \newlinechar added by \scantokens, and
7982 % can be noticed by \parsearg. Note \c isn't used because this means cedilla
7983 % in math mode.
7984 }
7985
7986 % Used for copying and captions
7987 \def\scanexp#1{%
7988 \expandafter\scanmacro\expandafter{#1}%
7989 }
7990
7991 \newcount\paramno % Count of parameters
7992 \newtoks\macname % Macro name
7993 \newif\ifrecursive % Is it recursive?
7994
7995 % List of all defined macros in the form
7996 % \commondummyword\macro1\commondummyword\macro2...
7997 % Currently is also contains all @aliases; the list can be split
7998 % if there is a need.
7999 \def\macrolist{}
8000
8001 % Add the macro to \macrolist
8002 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
8003 \def\addtomacrolistxxx#1{%
8004 \toks0 = \expandafter{\macrolist\commondummyword#1}%
8005 \xdef\macrolist{\the\toks0}%
8006 }
8007
8008 % Utility routines.
8009 % This does \let #1 = #2, with \csnames; that is,
8010 % \let \csname#1\endcsname = \csname#2\endcsname
8011 % (except of course we have to play expansion games).
8012 %
8013 \def\cslet#1#2{%
8014 \expandafter\let
8015 \csname#1\expandafter\endcsname
8016 \csname#2\endcsname
8017 }
8018
8019 % Trim leading and trailing spaces off a string.
8020 % Concepts from aro-bend problem 15 (see CTAN).
8021 {\catcode`\@=11
8022 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
8023 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
8024 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
8025 \def\unbrace#1{#1}
8026 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
8027 }
8028
8029 {\catcode`\^^M=\other%
8030 \gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
8031 % Warning: this won't work for a delimited argument
8032 % or for an empty argument
8033
8034 % Trim a single trailing ^^M off a string.
8035 {\catcode`\^^M=\other \catcode`\Q=3%
8036 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8037 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8038 \gdef\eatcrb#1Q#2Q{#1}%
8039 }
8040
8041 % Macro bodies are absorbed as an argument in a context where
8042 % all characters are catcode 10, 11 or 12, except \ which is active
8043 % (as in normal texinfo). It is necessary to change the definition of \
8044 % to recognize macro arguments; this is the job of \mbodybackslash.
8045 %
8046 % Non-ASCII encodings make 8-bit characters active, so un-activate
8047 % them to avoid their expansion. Must do this non-globally, to
8048 % confine the change to the current group.
8049 %
8050 % It's necessary to have hard CRs when the macro is executed. This is
8051 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8052 % body, and then making it the \newlinechar in \scanmacro.
8053 %
8054 \def\scanctxt{% used as subroutine
8055 \catcode`\"=\other
8056 \catcode`\+=\other
8057 \catcode`\<=\other
8058 \catcode`\>=\other
8059 \catcode`\^=\other
8060 \catcode`\_=\other
8061 \catcode`\|=\other
8062 \catcode`\~=\other
8063 \catcode`\@=\other
8064 \catcode`\^^M=\other
8065 \catcode`\\=\active
8066 \passthroughcharstrue
8067 }
8068
8069 \def\macrobodyctxt{% used for @macro definitions and @copying
8070 \scanctxt
8071 \catcode`\ =\other
8072 \catcode`\{=\other
8073 \catcode`\}=\other
8074 }
8075
8076 % Used when scanning braced macro arguments. Note, however, that catcode
8077 % changes here are ineffectual if the macro invocation was nested inside
8078 % an argument to another Texinfo command.
8079 \def\macroargctxt{%
8080 \scanctxt
8081 \catcode`\ =\active
8082 }
8083
8084 \def\macrolineargctxt{% used for whole-line arguments without braces
8085 \scanctxt
8086 \catcode`\{=\other
8087 \catcode`\}=\other
8088 }
8089
8090 % \mbodybackslash is the definition of \ in @macro bodies.
8091 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8092 % where N is the macro parameter number.
8093 % We define \csname macarg.\endcsname to be \realbackslash, so
8094 % \\ in macro replacement text gets you a backslash.
8095 %
8096 {\catcode`@=0 @catcode`@\=@active
8097 @gdef@usembodybackslash{@let\=@mbodybackslash}
8098 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8099 }
8100 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8101
8102 \def\margbackslash#1{\char`\#1 }
8103
8104 \def\macro{\recursivefalse\parsearg\macroxxx}
8105 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8106
8107 \def\macroxxx#1{%
8108 \getargs{#1}% now \macname is the macname and \argl the arglist
8109 \ifx\argl\empty % no arguments
8110 \paramno=0\relax
8111 \else
8112 \expandafter\parsemargdef \argl;%
8113 \if\paramno>256\relax
8114 \ifx\eTeXversion\thisisundefined
8115 \errhelp = \EMsimple
8116 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8117 \fi
8118 \fi
8119 \fi
8120 \if1\csname ismacro.\the\macname\endcsname
8121 \message{Warning: redefining \the\macname}%
8122 \else
8123 \expandafter\ifx\csname \the\macname\endcsname \relax
8124 \else \errmessage{Macro name \the\macname\space already defined}\fi
8125 \global\cslet{macsave.\the\macname}{\the\macname}%
8126 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8127 \addtomacrolist{\the\macname}%
8128 \fi
8129 \begingroup \macrobodyctxt \usembodybackslash
8130 \ifrecursive \expandafter\parsermacbody
8131 \else \expandafter\parsemacbody
8132 \fi}
8133
8134 \parseargdef\unmacro{%
8135 \if1\csname ismacro.#1\endcsname
8136 \global\cslet{#1}{macsave.#1}%
8137 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8138 % Remove the macro name from \macrolist:
8139 \begingroup
8140 \expandafter\let\csname#1\endcsname \relax
8141 \let\commondummyword\unmacrodo
8142 \xdef\macrolist{\macrolist}%
8143 \endgroup
8144 \else
8145 \errmessage{Macro #1 not defined}%
8146 \fi
8147 }
8148
8149 % Called by \do from \dounmacro on each macro. The idea is to omit any
8150 % macro definitions that have been changed to \relax.
8151 %
8152 \def\unmacrodo#1{%
8153 \ifx #1\relax
8154 % remove this
8155 \else
8156 \noexpand\commondummyword \noexpand#1%
8157 \fi
8158 }
8159
8160 % \getargs -- Parse the arguments to a @macro line. Set \macname to
8161 % the name of the macro, and \argl to the braced argument list.
8162 \def\getargs#1{\getargsxxx#1{}}
8163 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8164 \def\getmacname#1 #2\relax{\macname={#1}}
8165 \def\getmacargs#1{\def\argl{#1}}
8166 % This made use of the feature that if the last token of a
8167 % <parameter list> is #, then the preceding argument is delimited by
8168 % an opening brace, and that opening brace is not consumed.
8169
8170 % Parse the optional {params} list to @macro or @rmacro.
8171 % Set \paramno to the number of arguments,
8172 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8173 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
8174 % list to some hook where the argument is to be expanded. If there are
8175 % less than 10 arguments that hook is to be replaced by ##N where N
8176 % is the position in that list, that is to say the macro arguments are to be
8177 % defined `a la TeX in the macro body.
8178 %
8179 % That gets used by \mbodybackslash (above).
8180 %
8181 % If there are 10 or more arguments, a different technique is used: see
8182 % \parsemmanyargdef.
8183 %
8184 \def\parsemargdef#1;{%
8185 \paramno=0\def\paramlist{}%
8186 \let\hash\relax
8187 % \hash is redefined to `#' later to get it into definitions
8188 \let\xeatspaces\relax
8189 \let\xempty\relax
8190 \parsemargdefxxx#1,;,%
8191 \ifnum\paramno<10\relax\else
8192 \paramno0\relax
8193 \parsemmanyargdef@@#1,;,% 10 or more arguments
8194 \fi
8195 }
8196 \def\parsemargdefxxx#1,{%
8197 \if#1;\let\next=\relax
8198 \else \let\next=\parsemargdefxxx
8199 \advance\paramno by 1
8200 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8201 {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
8202 \edef\paramlist{\paramlist\hash\the\paramno,}%
8203 \fi\next}
8204 % the \xempty{} is to give \eatleadingcr an argument in the case of an
8205 % empty macro argument.
8206
8207 % \parsemacbody, \parsermacbody
8208 %
8209 % Read recursive and nonrecursive macro bodies. (They're different since
8210 % rec and nonrec macros end differently.)
8211 %
8212 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
8213 % body to be transformed.
8214 % Set \macrobody to the body of the macro, and call \defmacro.
8215 %
8216 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8217 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8218 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8219 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8220
8221 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8222 \edef\texiatcatcode{\the\catcode`\@}
8223 \catcode `@=11\relax
8224
8225 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8226
8227 % If there are 10 or more arguments, a different technique is used, where the
8228 % hook remains in the body, and when macro is to be expanded the body is
8229 % processed again to replace the arguments.
8230 %
8231 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8232 % argument N value and then \edef the body (nothing else will expand because of
8233 % the catcode regime under which the body was input).
8234 %
8235 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8236 % arguments, no macro can have more than 256 arguments (else error).
8237 %
8238 % In case that there are 10 or more arguments we parse again the arguments
8239 % list to set new definitions for the \macarg.BLAH macros corresponding to
8240 % each BLAH argument. It was anyhow needed to parse already once this list
8241 % in order to count the arguments, and as macros with at most 9 arguments
8242 % are by far more frequent than macro with 10 or more arguments, defining
8243 % twice the \macarg.BLAH macros does not cost too much processing power.
8244 \def\parsemmanyargdef@@#1,{%
8245 \if#1;\let\next=\relax
8246 \else
8247 \let\next=\parsemmanyargdef@@
8248 \edef\tempb{\eatspaces{#1}}%
8249 \expandafter\def\expandafter\tempa
8250 \expandafter{\csname macarg.\tempb\endcsname}%
8251 % Note that we need some extra \noexpand\noexpand, this is because we
8252 % don't want \the to be expanded in the \parsermacbody as it uses an
8253 % \xdef .
8254 \expandafter\edef\tempa
8255 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8256 \advance\paramno by 1\relax
8257 \fi\next}
8258
8259
8260 \let\endargs@\relax
8261 \let\nil@\relax
8262 \def\nilm@{\nil@}%
8263 \long\def\nillm@{\nil@}%
8264
8265 % This macro is expanded during the Texinfo macro expansion, not during its
8266 % definition. It gets all the arguments' values and assigns them to macros
8267 % macarg.ARGNAME
8268 %
8269 % #1 is the macro name
8270 % #2 is the list of argument names
8271 % #3 is the list of argument values
8272 \def\getargvals@#1#2#3{%
8273 \def\macargdeflist@{}%
8274 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8275 \def\paramlist{#2,\nil@}%
8276 \def\macroname{#1}%
8277 \begingroup
8278 \macroargctxt
8279 \def\argvaluelist{#3,\nil@}%
8280 \def\@tempa{#3}%
8281 \ifx\@tempa\empty
8282 \setemptyargvalues@
8283 \else
8284 \getargvals@@
8285 \fi
8286 }
8287 \def\getargvals@@{%
8288 \ifx\paramlist\nilm@
8289 % Some sanity check needed here that \argvaluelist is also empty.
8290 \ifx\argvaluelist\nillm@
8291 \else
8292 \errhelp = \EMsimple
8293 \errmessage{Too many arguments in macro `\macroname'!}%
8294 \fi
8295 \let\next\macargexpandinbody@
8296 \else
8297 \ifx\argvaluelist\nillm@
8298 % No more arguments values passed to macro. Set remaining named-arg
8299 % macros to empty.
8300 \let\next\setemptyargvalues@
8301 \else
8302 % pop current arg name into \@tempb
8303 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8304 \expandafter\@tempa\expandafter{\paramlist}%
8305 % pop current argument value into \@tempc
8306 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8307 \expandafter\@tempa\expandafter{\argvaluelist}%
8308 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8309 % First place the new argument macro definition into \@tempd
8310 \expandafter\macname\expandafter{\@tempc}%
8311 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8312 \expandafter\def\expandafter\@tempe\expandafter{%
8313 \csname macarg.\@tempb\endcsname}%
8314 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8315 \push@\@tempd\macargdeflist@
8316 \let\next\getargvals@@
8317 \fi
8318 \fi
8319 \next
8320 }
8321
8322 \def\push@#1#2{%
8323 \expandafter\expandafter\expandafter\def
8324 \expandafter\expandafter\expandafter#2%
8325 \expandafter\expandafter\expandafter{%
8326 \expandafter#1#2}%
8327 }
8328
8329 % Replace arguments by their values in the macro body, and place the result
8330 % in macro \@tempa.
8331 %
8332 \def\macvalstoargs@{%
8333 % To do this we use the property that token registers that are \the'ed
8334 % within an \edef expand only once. So we are going to place all argument
8335 % values into respective token registers.
8336 %
8337 % First we save the token context, and initialize argument numbering.
8338 \begingroup
8339 \paramno0\relax
8340 % Then, for each argument number #N, we place the corresponding argument
8341 % value into a new token list register \toks#N
8342 \expandafter\putargsintokens@\saveparamlist@,;,%
8343 % Then, we expand the body so that argument are replaced by their
8344 % values. The trick for values not to be expanded themselves is that they
8345 % are within tokens and that tokens expand only once in an \edef .
8346 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8347 % Now we restore the token stack pointer to free the token list registers
8348 % which we have used, but we make sure that expanded body is saved after
8349 % group.
8350 \expandafter
8351 \endgroup
8352 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8353 }
8354
8355 % Define the named-macro outside of this group and then close this group.
8356 %
8357 \def\macargexpandinbody@{%
8358 \expandafter
8359 \endgroup
8360 \macargdeflist@
8361 % First the replace in body the macro arguments by their values, the result
8362 % is in \@tempa .
8363 \macvalstoargs@
8364 % Then we point at the \norecurse or \gobble (for recursive) macro value
8365 % with \@tempb .
8366 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8367 % Depending on whether it is recursive or not, we need some tailing
8368 % \egroup .
8369 \ifx\@tempb\gobble
8370 \let\@tempc\relax
8371 \else
8372 \let\@tempc\egroup
8373 \fi
8374 % And now we do the real job:
8375 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8376 \@tempd
8377 }
8378
8379 \def\putargsintokens@#1,{%
8380 \if#1;\let\next\relax
8381 \else
8382 \let\next\putargsintokens@
8383 % First we allocate the new token list register, and give it a temporary
8384 % alias \@tempb .
8385 \toksdef\@tempb\the\paramno
8386 % Then we place the argument value into that token list register.
8387 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8388 \expandafter\@tempb\expandafter{\@tempa}%
8389 \advance\paramno by 1\relax
8390 \fi
8391 \next
8392 }
8393
8394 % Trailing missing arguments are set to empty.
8395 %
8396 \def\setemptyargvalues@{%
8397 \ifx\paramlist\nilm@
8398 \let\next\macargexpandinbody@
8399 \else
8400 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8401 \let\next\setemptyargvalues@
8402 \fi
8403 \next
8404 }
8405
8406 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8407 \expandafter\def\expandafter\@tempa\expandafter{%
8408 \expandafter\def\csname macarg.#1\endcsname{}}%
8409 \push@\@tempa\macargdeflist@
8410 \def\paramlist{#2}%
8411 }
8412
8413 % #1 is the element target macro
8414 % #2 is the list macro
8415 % #3,#4\endargs@ is the list value
8416 \def\pop@#1#2#3,#4\endargs@{%
8417 \def#1{#3}%
8418 \def#2{#4}%
8419 }
8420 \long\def\longpop@#1#2#3,#4\endargs@{%
8421 \long\def#1{#3}%
8422 \long\def#2{#4}%
8423 }
8424
8425
8426 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8427
8428
8429 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8430 % \macrobody has the body of the macro in it, with placeholders for
8431 % its parameters, looking like "\xeatspaces{\hash 1}".
8432 % \paramno is the number of parameters
8433 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8434 % There are four cases: macros of zero, one, up to nine, and many arguments.
8435 % \xdef is used so that macro definitions will survive the file
8436 % they're defined in: @include reads the file inside a group.
8437 %
8438 \def\defmacro{%
8439 \let\hash=##% convert placeholders to macro parameter chars
8440 \ifnum\paramno=1
8441 \def\xeatspaces##1{##1}%
8442 % This removes the pair of braces around the argument. We don't
8443 % use \eatspaces, because this can cause ends of lines to be lost
8444 % when the argument to \eatspaces is read, leading to line-based
8445 % commands like "@itemize" not being read correctly.
8446 \else
8447 \let\xeatspaces\relax % suppress expansion
8448 \fi
8449 \ifcase\paramno
8450 % 0
8451 \expandafter\xdef\csname\the\macname\endcsname{%
8452 \begingroup
8453 \noexpand\spaceisspace
8454 \noexpand\endlineisspace
8455 \noexpand\expandafter % skip any whitespace after the macro name.
8456 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8457 \expandafter\xdef\csname\the\macname @@@\endcsname{%
8458 \endgroup
8459 \noexpand\scanmacro{\macrobody}}%
8460 \or % 1
8461 \expandafter\xdef\csname\the\macname\endcsname{%
8462 \begingroup
8463 \noexpand\braceorline
8464 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8465 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8466 \endgroup
8467 \noexpand\scanmacro{\macrobody}%
8468 }%
8469 \else % at most 9
8470 \ifnum\paramno<10\relax
8471 % @MACNAME sets the context for reading the macro argument
8472 % @MACNAME@@ gets the argument, processes backslashes and appends a
8473 % comma.
8474 % @MACNAME@@@ removes braces surrounding the argument list.
8475 % @MACNAME@@@@ scans the macro body with arguments substituted.
8476 \expandafter\xdef\csname\the\macname\endcsname{%
8477 \begingroup
8478 \noexpand\expandafter % This \expandafter skip any spaces after the
8479 \noexpand\macroargctxt % macro before we change the catcode of space.
8480 \noexpand\expandafter
8481 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8482 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8483 \noexpand\passargtomacro
8484 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8485 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8486 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8487 \expandafter\expandafter
8488 \expandafter\xdef
8489 \expandafter\expandafter
8490 \csname\the\macname @@@@\endcsname\paramlist{%
8491 \endgroup\noexpand\scanmacro{\macrobody}}%
8492 \else % 10 or more:
8493 \expandafter\xdef\csname\the\macname\endcsname{%
8494 \noexpand\getargvals@{\the\macname}{\argl}%
8495 }%
8496 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8497 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8498 \fi
8499 \fi}
8500
8501 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8502
8503 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8504
8505
8506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8507 %
8508 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8509 @catcode`@_=11 % private names
8510 @catcode`@!=11 % used as argument separator
8511
8512 % \passargtomacro#1#2 -
8513 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8514 % compressed to one.
8515 %
8516 % This implementation works by expansion, and not execution (so we cannot use
8517 % \def or similar). This reduces the risk of this failing in contexts where
8518 % complete expansion is done with no execution (for example, in writing out to
8519 % an auxiliary file for an index entry).
8520 %
8521 % State is kept in the input stream: the argument passed to
8522 % @look_ahead, @gobble_and_check_finish and @add_segment is
8523 %
8524 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8525 %
8526 % where:
8527 % THE_MACRO - name of the macro we want to call
8528 % ARG_RESULT - argument list we build to pass to that macro
8529 % PENDING_BS - either a backslash or nothing
8530 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8531
8532 @gdef@passargtomacro#1#2{%
8533 @add_segment #1!{}@relax#2\@_finish\%
8534 }
8535 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8536
8537 % #1 - THE_MACRO ARG_RESULT
8538 % #2 - PENDING_BS
8539 % #3 - NEXT_TOKEN
8540 % #4 used to look ahead
8541 %
8542 % If the next token is not a backslash, process the rest of the argument;
8543 % otherwise, remove the next token.
8544 @gdef@look_ahead#1!#2#3#4{%
8545 @ifx#4\%
8546 @expandafter@gobble_and_check_finish
8547 @else
8548 @expandafter@add_segment
8549 @fi#1!{#2}#4#4%
8550 }
8551
8552 % #1 - THE_MACRO ARG_RESULT
8553 % #2 - PENDING_BS
8554 % #3 - NEXT_TOKEN
8555 % #4 should be a backslash, which is gobbled.
8556 % #5 looks ahead
8557 %
8558 % Double backslash found. Add a single backslash, and look ahead.
8559 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8560 @add_segment#1\!{}#5#5%
8561 }
8562
8563 @gdef@is_fi{@fi}
8564
8565 % #1 - THE_MACRO ARG_RESULT
8566 % #2 - PENDING_BS
8567 % #3 - NEXT_TOKEN
8568 % #4 is input stream until next backslash
8569 %
8570 % Input stream is either at the start of the argument, or just after a
8571 % backslash sequence, either a lone backslash, or a doubled backslash.
8572 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8573 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8574 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8575 % a backslash just before the start of the input stream that has not been
8576 % added to ARG_RESULT.
8577 @gdef@add_segment#1!#2#3#4\{%
8578 @ifx#3@_finish
8579 @call_the_macro#1!%
8580 @else
8581 % append the pending backslash to the result, followed by the next segment
8582 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8583 % this @fi is discarded by @look_ahead.
8584 % we can't get rid of it with \expandafter because we don't know how
8585 % long #4 is.
8586 }
8587
8588 % #1 - THE_MACRO
8589 % #2 - ARG_RESULT
8590 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8591 % conditional.
8592 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8593
8594 }
8595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8596
8597 % \braceorline MAC is used for a one-argument macro MAC. It checks
8598 % whether the next non-whitespace character is a {. It sets the context
8599 % for reading the argument (slightly different in the two cases). Then,
8600 % to read the argument, in the whole-line case, it then calls the regular
8601 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8602 %
8603 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8604 \def\braceorlinexxx{%
8605 \ifx\nchar\bgroup
8606 \macroargctxt
8607 \expandafter\passargtomacro
8608 \else
8609 \macrolineargctxt\expandafter\parsearg
8610 \fi \macnamexxx}
8611
8612
8613 % @alias.
8614 % We need some trickery to remove the optional spaces around the equal
8615 % sign. Make them active and then expand them all to nothing.
8616 %
8617 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8618 \def\aliasxxx #1{\aliasyyy#1\relax}
8619 \def\aliasyyy #1=#2\relax{%
8620 {%
8621 \expandafter\let\obeyedspace=\empty
8622 \addtomacrolist{#1}%
8623 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8624 }%
8625 \next
8626 }
8627
8628
8629 \message{cross references,}
8630
8631 \newwrite\auxfile
8632 \newif\ifhavexrefs % True if xref values are known.
8633 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8634
8635 % @inforef is relatively simple.
8636 \def\inforef #1{\inforefzzz #1,,,,**}
8637 \def\inforefzzz #1,#2,#3,#4**{%
8638 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8639 node \samp{\ignorespaces#1{}}}
8640
8641 % @node's only job in TeX is to define \lastnode, which is used in
8642 % cross-references. The @node line might or might not have commas, and
8643 % might or might not have spaces before the first comma, like:
8644 % @node foo , bar , ...
8645 % We don't want such trailing spaces in the node name.
8646 %
8647 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8648 %
8649 % also remove a trailing comma, in case of something like this:
8650 % @node Help-Cross, , , Cross-refs
8651 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8652 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
8653
8654 % Used so that the @top node doesn't have to be wrapped in an @ifnottex
8655 % conditional.
8656 % \doignore goes to more effort to skip nested conditionals but we don't need
8657 % that here.
8658 \def\omittopnode{%
8659 \ifx\lastnode\wordTop
8660 \expandafter\ignorenode\fi
8661 }
8662 \def\wordTop{Top}
8663
8664 % Until the next @node, @part or @bye command, divert output to a box that
8665 % is not output.
8666 \def\ignorenode{\setbox\dummybox\vbox\bgroup
8667 \def\part{\egroup\part}%
8668 \def\node{\egroup\node}%
8669 \ignorenodebye
8670 }
8671
8672 {\let\bye\relax
8673 \gdef\ignorenodebye{\let\bye\ignorenodebyedef}
8674 \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
8675 % The redefinition of \bye here is because it is declared \outer
8676
8677 \let\lastnode=\empty
8678
8679 % Write a cross-reference definition for the current node. #1 is the
8680 % type (Ynumbered, Yappendix, Ynothing).
8681 %
8682 \def\donoderef#1{%
8683 \ifx\lastnode\empty\else
8684 \setref{\lastnode}{#1}%
8685 \global\let\lastnode=\empty
8686 \fi
8687 }
8688
8689 % @anchor{NAME} -- define xref target at arbitrary point.
8690 %
8691 \newcount\savesfregister
8692 %
8693 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8694 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8695 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8696
8697 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8698 % anchor), which consists of three parts:
8699 % 1) NAME-title - the current sectioning name taken from \currentsection,
8700 % or the anchor name.
8701 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8702 % empty for anchors.
8703 % 3) NAME-pg - the page number.
8704 %
8705 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8706 % floats, there is an additional part, which is not written here:
8707 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8708 %
8709 \def\setref#1#2{%
8710 \pdfmkdest{#1}%
8711 \iflinks
8712 {%
8713 \requireauxfile
8714 \atdummies % preserve commands, but don't expand them
8715 % match definition in \xrdef, \refx, \xrefX.
8716 \def\value##1{##1}%
8717 \edef\writexrdef##1##2{%
8718 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8719 ##1}{##2}}% these are parameters of \writexrdef
8720 }%
8721 \toks0 = \expandafter{\currentsection}%
8722 \immediate \writexrdef{title}{\the\toks0 }%
8723 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8724 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8725 }%
8726 \fi
8727 }
8728
8729 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8730 % automatically in xrefs, if the third arg is not explicitly specified.
8731 % This was provided as a "secret" @set xref-automatic-section-title
8732 % variable, now it's official.
8733 %
8734 \parseargdef\xrefautomaticsectiontitle{%
8735 \def\temp{#1}%
8736 \ifx\temp\onword
8737 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8738 = \empty
8739 \else\ifx\temp\offword
8740 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8741 = \relax
8742 \else
8743 \errhelp = \EMsimple
8744 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8745 must be on|off}%
8746 \fi\fi
8747 }
8748
8749 %
8751 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8752 % the node name, #2 the name of the Info cross-reference, #3 the printed
8753 % node name, #4 the name of the Info file, #5 the name of the printed
8754 % manual. All but the node name can be omitted.
8755 %
8756 \def\pxref{\putwordsee{} \xrefXX}
8757 \def\xref{\putwordSee{} \xrefXX}
8758 \def\ref{\xrefXX}
8759
8760 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8761 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8762 %
8763 \newbox\toprefbox
8764 \newbox\printedrefnamebox
8765 \newbox\infofilenamebox
8766 \newbox\printedmanualbox
8767 %
8768 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8769 \unsepspaces
8770 %
8771 % Get args without leading/trailing spaces.
8772 \def\printedrefname{\ignorespaces #3}%
8773 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8774 %
8775 \def\infofilename{\ignorespaces #4}%
8776 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8777 %
8778 \def\printedmanual{\ignorespaces #5}%
8779 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8780 %
8781 % If the printed reference name (arg #3) was not explicitly given in
8782 % the @xref, figure out what we want to use.
8783 \ifdim \wd\printedrefnamebox = 0pt
8784 % No printed node name was explicitly given.
8785 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8786 % Not auto section-title: use node name inside the square brackets.
8787 \def\printedrefname{\ignorespaces #1}%
8788 \else
8789 % Auto section-title: use chapter/section title inside
8790 % the square brackets if we have it.
8791 \ifdim \wd\printedmanualbox > 0pt
8792 % It is in another manual, so we don't have it; use node name.
8793 \def\printedrefname{\ignorespaces #1}%
8794 \else
8795 \ifhavexrefs
8796 % We (should) know the real title if we have the xref values.
8797 \def\printedrefname{\refx{#1-title}}%
8798 \else
8799 % Otherwise just copy the Info node name.
8800 \def\printedrefname{\ignorespaces #1}%
8801 \fi%
8802 \fi
8803 \fi
8804 \fi
8805 %
8806 % Make link in pdf output.
8807 \ifpdf
8808 % For pdfTeX and LuaTeX
8809 {\indexnofonts
8810 \makevalueexpandable
8811 \turnoffactive
8812 % This expands tokens, so do it after making catcode changes, so _
8813 % etc. don't get their TeX definitions. This ignores all spaces in
8814 % #4, including (wrongly) those in the middle of the filename.
8815 \getfilename{#4}%
8816 %
8817 % This (wrongly) does not take account of leading or trailing
8818 % spaces in #1, which should be ignored.
8819 \setpdfdestname{#1}%
8820 %
8821 \ifx\pdfdestname\empty
8822 \def\pdfdestname{Top}% no empty targets
8823 \fi
8824 %
8825 \leavevmode
8826 \startlink attr{/Border [0 0 0]}%
8827 \ifnum\filenamelength>0
8828 goto file{\the\filename.pdf} name{\pdfdestname}%
8829 \else
8830 goto name{\pdfmkpgn{\pdfdestname}}%
8831 \fi
8832 }%
8833 \setcolor{\linkcolor}%
8834 \else
8835 \ifx\XeTeXrevision\thisisundefined
8836 \else
8837 % For XeTeX
8838 {\indexnofonts
8839 \makevalueexpandable
8840 \turnoffactive
8841 % This expands tokens, so do it after making catcode changes, so _
8842 % etc. don't get their TeX definitions. This ignores all spaces in
8843 % #4, including (wrongly) those in the middle of the filename.
8844 \getfilename{#4}%
8845 %
8846 % This (wrongly) does not take account of leading or trailing
8847 % spaces in #1, which should be ignored.
8848 \setpdfdestname{#1}%
8849 %
8850 \ifx\pdfdestname\empty
8851 \def\pdfdestname{Top}% no empty targets
8852 \fi
8853 %
8854 \leavevmode
8855 \ifnum\filenamelength>0
8856 % With default settings,
8857 % XeTeX (xdvipdfmx) replaces link destination names with integers.
8858 % In this case, the replaced destination names of
8859 % remote PDFs are no longer known. In order to avoid a replacement,
8860 % you can use xdvipdfmx's command line option `-C 0x0010'.
8861 % If you use XeTeX 0.99996+ (TeX Live 2016+),
8862 % this command line option is no longer necessary
8863 % because we can use the `dvipdfmx:config' special.
8864 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8865 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
8866 \else
8867 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8868 << /S /GoTo /D (\pdfdestname) >> >>}%
8869 \fi
8870 }%
8871 \setcolor{\linkcolor}%
8872 \fi
8873 \fi
8874 {%
8875 % Have to otherify everything special to allow the \csname to
8876 % include an _ in the xref name, etc.
8877 \indexnofonts
8878 \turnoffactive
8879 \def\value##1{##1}%
8880 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8881 \csname XR#1-title\endcsname
8882 }%
8883 %
8884 % Float references are printed completely differently: "Figure 1.2"
8885 % instead of "[somenode], p.3". \iffloat distinguishes them by
8886 % \Xthisreftitle being set to a magic string.
8887 \iffloat\Xthisreftitle
8888 % If the user specified the print name (third arg) to the ref,
8889 % print it instead of our usual "Figure 1.2".
8890 \ifdim\wd\printedrefnamebox = 0pt
8891 \refx{#1-snt}%
8892 \else
8893 \printedrefname
8894 \fi
8895 %
8896 % If the user also gave the printed manual name (fifth arg), append
8897 % "in MANUALNAME".
8898 \ifdim \wd\printedmanualbox > 0pt
8899 \space \putwordin{} \cite{\printedmanual}%
8900 \fi
8901 \else
8902 % node/anchor (non-float) references.
8903 %
8904 % If we use \unhbox to print the node names, TeX does not insert
8905 % empty discretionaries after hyphens, which means that it will not
8906 % find a line break at a hyphen in a node names. Since some manuals
8907 % are best written with fairly long node names, containing hyphens,
8908 % this is a loss. Therefore, we give the text of the node name
8909 % again, so it is as if TeX is seeing it for the first time.
8910 %
8911 \ifdim \wd\printedmanualbox > 0pt
8912 % Cross-manual reference with a printed manual name.
8913 %
8914 \crossmanualxref{\cite{\printedmanual\unskip}}%
8915 %
8916 \else\ifdim \wd\infofilenamebox > 0pt
8917 % Cross-manual reference with only an info filename (arg 4), no
8918 % printed manual name (arg 5). This is essentially the same as
8919 % the case above; we output the filename, since we have nothing else.
8920 %
8921 \crossmanualxref{\code{\infofilename\unskip}}%
8922 %
8923 \else
8924 % Reference within this manual.
8925 %
8926 % Only output a following space if the -snt ref is nonempty, as the ref
8927 % will be empty for @unnumbered and @anchor.
8928 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
8929 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8930 %
8931 % output the `[mynode]' via the macro below so it can be overridden.
8932 \xrefprintnodename\printedrefname
8933 %
8934 \ifflagclear{txiomitxrefpg}{%
8935 % We always want a comma
8936 ,%
8937 % output the `page 3'.
8938 \turnoffactive \putpageref{#1}%
8939 % Add a , if xref followed by a space
8940 \if\space\noexpand\tokenafterxref ,%
8941 \else\ifx\ \tokenafterxref ,% @TAB
8942 \else\ifx\*\tokenafterxref ,% @*
8943 \else\ifx\ \tokenafterxref ,% @SPACE
8944 \else\ifx\
8945 \tokenafterxref ,% @NL
8946 \else\ifx\tie\tokenafterxref ,% @tie
8947 \fi\fi\fi\fi\fi\fi
8948 }{}%
8949 \fi\fi
8950 \fi
8951 \endlink
8952 \endgroup}
8953
8954 % can be overridden in translation files
8955 \def\putpageref#1{%
8956 \space\putwordpage\tie\refx{#1-pg}}
8957
8958 % Output a cross-manual xref to #1. Used just above (twice).
8959 %
8960 % Only include the text "Section ``foo'' in" if the foo is neither
8961 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
8962 % "see The Foo Manual", the idea being to refer to the whole manual.
8963 %
8964 % But, this being TeX, we can't easily compare our node name against the
8965 % string "Top" while ignoring the possible spaces before and after in
8966 % the input. By adding the arbitrary 7sp below, we make it much less
8967 % likely that a real node name would have the same width as "Top" (e.g.,
8968 % in a monospaced font). Hopefully it will never happen in practice.
8969 %
8970 % For the same basic reason, we retypeset the "Top" at every
8971 % reference, since the current font is indeterminate.
8972 %
8973 \def\crossmanualxref#1{%
8974 \setbox\toprefbox = \hbox{Top\kern7sp}%
8975 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
8976 \ifdim \wd2 > 7sp % nonempty?
8977 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
8978 \putwordSection{} ``\printedrefname'' \putwordin{}\space
8979 \fi
8980 \fi
8981 #1%
8982 }
8983
8984 % This macro is called from \xrefX for the `[nodename]' part of xref
8985 % output. It's a separate macro only so it can be changed more easily,
8986 % since square brackets don't work well in some documents. Particularly
8987 % one that Bob is working on :).
8988 %
8989 \def\xrefprintnodename#1{[#1]}
8990
8991 % Things referred to by \setref.
8992 %
8993 \def\Ynothing{}
8994 \def\Yomitfromtoc{}
8995 \def\Ynumbered{%
8996 \ifnum\secno=0
8997 \putwordChapter@tie \the\chapno
8998 \else \ifnum\subsecno=0
8999 \putwordSection@tie \the\chapno.\the\secno
9000 \else \ifnum\subsubsecno=0
9001 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9002 \else
9003 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9004 \fi\fi\fi
9005 }
9006 \def\Yappendix{%
9007 \ifnum\secno=0
9008 \putwordAppendix@tie @char\the\appendixno{}%
9009 \else \ifnum\subsecno=0
9010 \putwordSection@tie @char\the\appendixno.\the\secno
9011 \else \ifnum\subsubsecno=0
9012 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9013 \else
9014 \putwordSection@tie
9015 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9016 \fi\fi\fi
9017 }
9018
9019 % \refx{NAME} - reference a cross-reference string named NAME.
9020 \def\refx#1{%
9021 \requireauxfile
9022 {%
9023 \indexnofonts
9024 \turnoffactive
9025 \def\value##1{##1}%
9026 \expandafter\global\expandafter\let\expandafter\thisrefX
9027 \csname XR#1\endcsname
9028 }%
9029 \ifx\thisrefX\relax
9030 % If not defined, say something at least.
9031 \angleleft un\-de\-fined\angleright
9032 \iflinks
9033 \ifhavexrefs
9034 {\toks0 = {#1}% avoid expansion of possibly-complex value
9035 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9036 \else
9037 \ifwarnedxrefs\else
9038 \global\warnedxrefstrue
9039 \message{Cross reference values unknown; you must run TeX again.}%
9040 \fi
9041 \fi
9042 \fi
9043 \else
9044 % It's defined, so just use it.
9045 \thisrefX
9046 \fi
9047 }
9048
9049 % This is the macro invoked by entries in the aux file. Define a control
9050 % sequence for a cross-reference target (we prepend XR to the control sequence
9051 % name to avoid collisions). The value is the page number. If this is a float
9052 % type, we have more work to do.
9053 %
9054 \def\xrdef#1#2{%
9055 {% Expand the node or anchor name to remove control sequences.
9056 % \turnoffactive stops 8-bit characters being changed to commands
9057 % like @'e. \refx does the same to retrieve the value in the definition.
9058 \indexnofonts
9059 \turnoffactive
9060 \def\value##1{##1}%
9061 \xdef\safexrefname{#1}%
9062 }%
9063 %
9064 \bgroup
9065 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
9066 \egroup
9067 % We put the \gdef inside a group to avoid the definitions building up on
9068 % TeX's save stack, which can cause it to run out of space for aux files with
9069 % thousands of lines. \gdef doesn't use the save stack, but \csname does
9070 % when it defines an unknown control sequence as \relax.
9071 %
9072 % Was that xref control sequence that we just defined for a float?
9073 \expandafter\iffloat\csname XR\safexrefname\endcsname
9074 % it was a float, and we have the (safe) float type in \iffloattype.
9075 \expandafter\let\expandafter\floatlist
9076 \csname floatlist\iffloattype\endcsname
9077 %
9078 % Is this the first time we've seen this float type?
9079 \expandafter\ifx\floatlist\relax
9080 \toks0 = {\do}% yes, so just \do
9081 \else
9082 % had it before, so preserve previous elements in list.
9083 \toks0 = \expandafter{\floatlist\do}%
9084 \fi
9085 %
9086 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9087 % for later use in \listoffloats.
9088 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9089 {\safexrefname}}%
9090 \fi
9091 }
9092
9093 % If working on a large document in chapters, it is convenient to
9094 % be able to disable indexing, cross-referencing, and contents, for test runs.
9095 % This is done with @novalidate at the beginning of the file.
9096 %
9097 \newif\iflinks \linkstrue % by default we want the aux files.
9098 \let\novalidate = \linksfalse
9099
9100 % Used when writing to the aux file, or when using data from it.
9101 \def\requireauxfile{%
9102 \iflinks
9103 \tryauxfile
9104 % Open the new aux file. TeX will close it automatically at exit.
9105 \immediate\openout\auxfile=\jobname.aux
9106 \fi
9107 \global\let\requireauxfile=\relax % Only do this once.
9108 }
9109
9110 % Read the last existing aux file, if any. No error if none exists.
9111 %
9112 \def\tryauxfile{%
9113 \openin 1 \jobname.aux
9114 \ifeof 1 \else
9115 \readdatafile{aux}%
9116 \global\havexrefstrue
9117 \fi
9118 \closein 1
9119 }
9120
9121 \def\setupdatafile{%
9122 \catcode`\^^@=\other
9123 \catcode`\^^A=\other
9124 \catcode`\^^B=\other
9125 \catcode`\^^C=\other
9126 \catcode`\^^D=\other
9127 \catcode`\^^E=\other
9128 \catcode`\^^F=\other
9129 \catcode`\^^G=\other
9130 \catcode`\^^H=\other
9131 \catcode`\^^K=\other
9132 \catcode`\^^L=\other
9133 \catcode`\^^N=\other
9134 \catcode`\^^P=\other
9135 \catcode`\^^Q=\other
9136 \catcode`\^^R=\other
9137 \catcode`\^^S=\other
9138 \catcode`\^^T=\other
9139 \catcode`\^^U=\other
9140 \catcode`\^^V=\other
9141 \catcode`\^^W=\other
9142 \catcode`\^^X=\other
9143 \catcode`\^^Z=\other
9144 \catcode`\^^[=\other
9145 \catcode`\^^\=\other
9146 \catcode`\^^]=\other
9147 \catcode`\^^^=\other
9148 \catcode`\^^_=\other
9149 \catcode`\^=\other
9150 %
9151 % Special characters. Should be turned off anyway, but...
9152 \catcode`\~=\other
9153 \catcode`\[=\other
9154 \catcode`\]=\other
9155 \catcode`\"=\other
9156 \catcode`\_=\active
9157 \catcode`\|=\active
9158 \catcode`\<=\active
9159 \catcode`\>=\active
9160 \catcode`\$=\other
9161 \catcode`\#=\other
9162 \catcode`\&=\other
9163 \catcode`\%=\other
9164 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9165 %
9166 \catcode`\\=\active
9167 %
9168 % @ is our escape character in .aux files, and we need braces.
9169 \catcode`\{=1
9170 \catcode`\}=2
9171 \catcode`\@=0
9172 }
9173
9174 \def\readdatafile#1{%
9175 \begingroup
9176 \setupdatafile
9177 \input\jobname.#1
9178 \endgroup}
9179
9180
9181 \message{insertions,}
9182 % including footnotes.
9183
9184 \newcount \footnoteno
9185
9186 % The trailing space in the following definition for supereject is
9187 % vital for proper filling; pages come out unaligned when you do a
9188 % pagealignmacro call if that space before the closing brace is
9189 % removed. (Generally, numeric constants should always be followed by a
9190 % space to prevent strange expansion errors.)
9191 \def\supereject{\par\penalty -20000\footnoteno =0 }
9192
9193 % @footnotestyle is meaningful for Info output only.
9194 \let\footnotestyle=\comment
9195
9196 {\catcode `\@=11
9197 %
9198 % Auto-number footnotes. Otherwise like plain.
9199 \gdef\footnote{%
9200 \global\advance\footnoteno by \@ne
9201 \edef\thisfootno{$^{\the\footnoteno}$}%
9202 %
9203 % In case the footnote comes at the end of a sentence, preserve the
9204 % extra spacing after we do the footnote number.
9205 \let\@sf\empty
9206 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9207 %
9208 % Remove inadvertent blank space before typesetting the footnote number.
9209 \unskip
9210 \thisfootno\@sf
9211 \dofootnote
9212 }%
9213
9214 % Don't bother with the trickery in plain.tex to not require the
9215 % footnote text as a parameter. Our footnotes don't need to be so general.
9216 %
9217 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9218 % \parseargline) fails inside footnotes because the tokens are fixed when
9219 % the footnote is read. --karl, 16nov96.
9220 %
9221 \gdef\dofootnote{%
9222 \insert\footins\bgroup
9223 %
9224 % Nested footnotes are not supported in TeX, that would take a lot
9225 % more work. (\startsavinginserts does not suffice.)
9226 \let\footnote=\errfootnotenest
9227 %
9228 % We want to typeset this text as a normal paragraph, even if the
9229 % footnote reference occurs in (for example) a display environment.
9230 % So reset some parameters.
9231 \hsize=\txipagewidth
9232 \interlinepenalty\interfootnotelinepenalty
9233 \splittopskip\ht\strutbox % top baseline for broken footnotes
9234 \splitmaxdepth\dp\strutbox
9235 \floatingpenalty\@MM
9236 \leftskip\z@skip
9237 \rightskip\z@skip
9238 \spaceskip\z@skip
9239 \xspaceskip\z@skip
9240 \parindent\defaultparindent
9241 %
9242 \smallfonts \rm
9243 %
9244 % Because we use hanging indentation in footnotes, a @noindent appears
9245 % to exdent this text, so make it be a no-op. makeinfo does not use
9246 % hanging indentation so @noindent can still be needed within footnote
9247 % text after an @example or the like (not that this is good style).
9248 \let\noindent = \relax
9249 %
9250 % Hang the footnote text off the number. Use \everypar in case the
9251 % footnote extends for more than one paragraph.
9252 \everypar = {\hang}%
9253 \textindent{\thisfootno}%
9254 %
9255 % Don't crash into the line above the footnote text. Since this
9256 % expands into a box, it must come within the paragraph, lest it
9257 % provide a place where TeX can split the footnote.
9258 \footstrut
9259 %
9260 % Invoke rest of plain TeX footnote routine.
9261 \futurelet\next\fo@t
9262 }
9263 }%end \catcode `\@=11
9264
9265 \def\errfootnotenest{%
9266 \errhelp=\EMsimple
9267 \errmessage{Nested footnotes not supported in texinfo.tex,
9268 even though they work in makeinfo; sorry}
9269 }
9270
9271 \def\errfootnoteheading{%
9272 \errhelp=\EMsimple
9273 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9274 }
9275
9276 % In case a @footnote appears in a vbox, save the footnote text and create
9277 % the real \insert just after the vbox finished. Otherwise, the insertion
9278 % would be lost.
9279 % Similarly, if a @footnote appears inside an alignment, save the footnote
9280 % text to a box and make the \insert when a row of the table is finished.
9281 % And the same can be done for other insert classes. --kasal, 16nov03.
9282 %
9283 % Replace the \insert primitive by a cheating macro.
9284 % Deeper inside, just make sure that the saved insertions are not spilled
9285 % out prematurely.
9286 %
9287 \def\startsavinginserts{%
9288 \ifx \insert\ptexinsert
9289 \let\insert\saveinsert
9290 \else
9291 \let\checkinserts\relax
9292 \fi
9293 }
9294
9295 % This \insert replacement works for both \insert\footins{foo} and
9296 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9297 %
9298 \def\saveinsert#1{%
9299 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9300 \afterassignment\next
9301 % swallow the left brace
9302 \let\temp =
9303 }
9304 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9305 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9306
9307 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9308
9309 \def\placesaveins#1{%
9310 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9311 {\box#1}%
9312 }
9313
9314 % eat @SAVE -- beware, all of them have catcode \other:
9315 {
9316 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9317 \gdef\gobblesave @SAVE{}
9318 }
9319
9320 % initialization:
9321 \def\newsaveins #1{%
9322 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9323 \next
9324 }
9325 \def\newsaveinsX #1{%
9326 \csname newbox\endcsname #1%
9327 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9328 \checksaveins #1}%
9329 }
9330
9331 % initialize:
9332 \let\checkinserts\empty
9333 \newsaveins\footins
9334 \newsaveins\margin
9335
9336
9337 % @image. We use the macros from epsf.tex to support this.
9338 % If epsf.tex is not installed and @image is used, we complain.
9339 %
9340 % Check for and read epsf.tex up front. If we read it only at @image
9341 % time, we might be inside a group, and then its definitions would get
9342 % undone and the next image would fail.
9343 \openin 1 = epsf.tex
9344 \ifeof 1 \else
9345 % Do not bother showing banner with epsf.tex v2.7k (available in
9346 % doc/epsf.tex and on ctan).
9347 \def\epsfannounce{\toks0 = }%
9348 \input epsf.tex
9349 \fi
9350 \closein 1
9351 %
9352 % We will only complain once about lack of epsf.tex.
9353 \newif\ifwarnednoepsf
9354 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9355 work. It is also included in the Texinfo distribution, or you can get
9356 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
9357 %
9358 \def\image#1{%
9359 \ifx\epsfbox\thisisundefined
9360 \ifwarnednoepsf \else
9361 \errhelp = \noepsfhelp
9362 \errmessage{epsf.tex not found, images will be ignored}%
9363 \global\warnednoepsftrue
9364 \fi
9365 \else
9366 \imagexxx #1,,,,,\finish
9367 \fi
9368 }
9369
9370 % Approximate height of a line in the standard text font.
9371 \newdimen\capheight
9372 \setbox0=\vbox{\tenrm H}
9373 \capheight=\ht0
9374
9375 %
9376 % Arguments to @image:
9377 % #1 is (mandatory) image filename; we tack on .eps extension.
9378 % #2 is (optional) width, #3 is (optional) height.
9379 % #4 is (ignored optional) html alt text.
9380 % #5 is (ignored optional) extension.
9381 % #6 is just the usual extra ignored arg for parsing stuff.
9382 \newif\ifimagevmode
9383 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9384 \catcode`\^^M = 5 % in case we're inside an example
9385 \normalturnoffactive % allow _ et al. in names
9386 \makevalueexpandable
9387 \ifvmode
9388 \imagevmodetrue
9389 \medskip
9390 % Usually we'll have text after the image which will insert
9391 % \parskip glue, so insert it here too to equalize the space
9392 % above and below.
9393 \vskip\parskip
9394 %
9395 % Place image in a \vtop for a top page margin that is (close to) correct,
9396 % as \topskip glue is relative to the first baseline.
9397 \vtop\bgroup \kern -\capheight \vskip-\parskip
9398 \fi
9399 %
9400 \ifx\centersub\centerV
9401 % For @center @image, enter vertical mode and add vertical space
9402 % Enter an extra \parskip because @center doesn't add space itself.
9403 \vbox\bgroup\vskip\parskip\medskip\vskip\parskip
9404 \else
9405 % Enter horizontal mode so that indentation from an enclosing
9406 % environment such as @quotation is respected.
9407 % However, if we're at the top level, we don't want the
9408 % normal paragraph indentation.
9409 \imageindent
9410 \fi
9411 %
9412 % Output the image.
9413 \ifpdf
9414 % For pdfTeX and LuaTeX <= 0.80
9415 \dopdfimage{#1}{#2}{#3}%
9416 \else
9417 \ifx\XeTeXrevision\thisisundefined
9418 % For epsf.tex
9419 % \epsfbox itself resets \epsf?size at each figure.
9420 \setbox0 = \hbox{\ignorespaces #2}%
9421 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9422 \setbox0 = \hbox{\ignorespaces #3}%
9423 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9424 \epsfbox{#1.eps}%
9425 \else
9426 % For XeTeX
9427 \doxeteximage{#1}{#2}{#3}%
9428 \fi
9429 \fi
9430 %
9431 \ifimagevmode
9432 \egroup
9433 \medskip % space after a standalone image
9434 \fi
9435 \ifx\centersub\centerV % @center @image
9436 \medskip
9437 \egroup % close \vbox
9438 \fi
9439 \endgroup}
9440
9441
9442 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9443 % etc. We don't actually implement floating yet, we always include the
9444 % float "here". But it seemed the best name for the future.
9445 %
9446 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9447
9448 % There may be a space before second and/or third parameter; delete it.
9449 \def\eatcommaspace#1, {#1,}
9450
9451 % #1 is the optional FLOATTYPE, the text label for this float, typically
9452 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9453 % this float will not be numbered and cannot be referred to.
9454 %
9455 % #2 is the optional xref label. Also must be present for the float to
9456 % be referable.
9457 %
9458 % #3 is the optional positioning argument; for now, it is ignored. It
9459 % will somehow specify the positions allowed to float to (here, top, bottom).
9460 %
9461 % We keep a separate counter for each FLOATTYPE, which we reset at each
9462 % chapter-level command.
9463 \let\resetallfloatnos=\empty
9464 %
9465 \def\dofloat#1,#2,#3,#4\finish{%
9466 \let\thiscaption=\empty
9467 \let\thisshortcaption=\empty
9468 %
9469 % don't lose footnotes inside @float.
9470 %
9471 % BEWARE: when the floats start float, we have to issue warning whenever an
9472 % insert appears inside a float which could possibly float. --kasal, 26may04
9473 %
9474 \startsavinginserts
9475 %
9476 % We can't be used inside a paragraph.
9477 \par
9478 %
9479 \vtop\bgroup
9480 \def\floattype{#1}%
9481 \def\floatlabel{#2}%
9482 \def\floatloc{#3}% we do nothing with this yet.
9483 %
9484 \ifx\floattype\empty
9485 \let\safefloattype=\empty
9486 \else
9487 {%
9488 % the floattype might have accents or other special characters,
9489 % but we need to use it in a control sequence name.
9490 \indexnofonts
9491 \turnoffactive
9492 \xdef\safefloattype{\floattype}%
9493 }%
9494 \fi
9495 %
9496 % If label is given but no type, we handle that as the empty type.
9497 \ifx\floatlabel\empty \else
9498 % We want each FLOATTYPE to be numbered separately (Figure 1,
9499 % Table 1, Figure 2, ...). (And if no label, no number.)
9500 %
9501 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9502 \global\advance\floatno by 1
9503 %
9504 {%
9505 % This magic value for \currentsection is output by \setref as the
9506 % XREFLABEL-title value. \xrefX uses it to distinguish float
9507 % labels (which have a completely different output format) from
9508 % node and anchor labels. And \xrdef uses it to construct the
9509 % lists of floats.
9510 %
9511 \edef\currentsection{\floatmagic=\safefloattype}%
9512 \setref{\floatlabel}{Yfloat}%
9513 }%
9514 \fi
9515 %
9516 % start with \parskip glue, I guess.
9517 \vskip\parskip
9518 %
9519 % Don't suppress indentation if a float happens to start a section.
9520 \restorefirstparagraphindent
9521 }
9522
9523 % we have these possibilities:
9524 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9525 % @float Foo,lbl & no caption: Foo 1.1
9526 % @float Foo & @caption{Cap}: Foo: Cap
9527 % @float Foo & no caption: Foo
9528 % @float ,lbl & Caption{Cap}: 1.1: Cap
9529 % @float ,lbl & no caption: 1.1
9530 % @float & @caption{Cap}: Cap
9531 % @float & no caption:
9532 %
9533 \def\Efloat{%
9534 \let\floatident = \empty
9535 %
9536 % In all cases, if we have a float type, it comes first.
9537 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9538 %
9539 % If we have an xref label, the number comes next.
9540 \ifx\floatlabel\empty \else
9541 \ifx\floattype\empty \else % if also had float type, need tie first.
9542 \appendtomacro\floatident{\tie}%
9543 \fi
9544 % the number.
9545 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9546 \fi
9547 %
9548 % Start the printed caption with what we've constructed in
9549 % \floatident, but keep it separate; we need \floatident again.
9550 \let\captionline = \floatident
9551 %
9552 \ifx\thiscaption\empty \else
9553 \ifx\floatident\empty \else
9554 \appendtomacro\captionline{: }% had ident, so need a colon between
9555 \fi
9556 %
9557 % caption text.
9558 \appendtomacro\captionline{\scanexp\thiscaption}%
9559 \fi
9560 %
9561 % If we have anything to print, print it, with space before.
9562 % Eventually this needs to become an \insert.
9563 \ifx\captionline\empty \else
9564 \vskip.5\parskip
9565 \captionline
9566 %
9567 % Space below caption.
9568 \vskip\parskip
9569 \fi
9570 %
9571 % If have an xref label, write the list of floats info. Do this
9572 % after the caption, to avoid chance of it being a breakpoint.
9573 \ifx\floatlabel\empty \else
9574 % Write the text that goes in the lof to the aux file as
9575 % \floatlabel-lof. Besides \floatident, we include the short
9576 % caption if specified, else the full caption if specified, else nothing.
9577 {%
9578 \requireauxfile
9579 \atdummies
9580 %
9581 \ifx\thisshortcaption\empty
9582 \def\gtemp{\thiscaption}%
9583 \else
9584 \def\gtemp{\thisshortcaption}%
9585 \fi
9586 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9587 \ifx\gtemp\empty \else : \gtemp \fi}}%
9588 }%
9589 \fi
9590 \egroup % end of \vtop
9591 %
9592 \checkinserts
9593 }
9594
9595 % Append the tokens #2 to the definition of macro #1, not expanding either.
9596 %
9597 \def\appendtomacro#1#2{%
9598 \expandafter\def\expandafter#1\expandafter{#1#2}%
9599 }
9600
9601 % @caption, @shortcaption
9602 %
9603 \def\caption{\docaption\thiscaption}
9604 \def\shortcaption{\docaption\thisshortcaption}
9605 \def\docaption{\checkenv\float \bgroup\scanctxt\defcaption}
9606 \def\defcaption#1#2{\egroup \def#1{#2}}
9607
9608 % The parameter is the control sequence identifying the counter we are
9609 % going to use. Create it if it doesn't exist and assign it to \floatno.
9610 \def\getfloatno#1{%
9611 \ifx#1\relax
9612 % Haven't seen this figure type before.
9613 \csname newcount\endcsname #1%
9614 %
9615 % Remember to reset this floatno at the next chap.
9616 \expandafter\gdef\expandafter\resetallfloatnos
9617 \expandafter{\resetallfloatnos #1=0 }%
9618 \fi
9619 \let\floatno#1%
9620 }
9621
9622 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9623 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9624 % first read the @float command.
9625 %
9626 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9627
9628 % Magic string used for the XREFLABEL-title value, so \xrefX can
9629 % distinguish floats from other xref types.
9630 \def\floatmagic{!!float!!}
9631
9632 % #1 is the control sequence we are passed; we expand into a conditional
9633 % which is true if #1 represents a float ref. That is, the magic
9634 % \currentsection value which we \setref above.
9635 %
9636 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9637 %
9638 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9639 % (safe) float type for this float. We set \iffloattype to #2.
9640 %
9641 \def\doiffloat#1=#2=#3\finish{%
9642 \def\temp{#1}%
9643 \def\iffloattype{#2}%
9644 \ifx\temp\floatmagic
9645 }
9646
9647 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9648 %
9649 \parseargdef\listoffloats{%
9650 \def\floattype{#1}% floattype
9651 {%
9652 % the floattype might have accents or other special characters,
9653 % but we need to use it in a control sequence name.
9654 \indexnofonts
9655 \turnoffactive
9656 \xdef\safefloattype{\floattype}%
9657 }%
9658 %
9659 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9660 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9661 \ifhavexrefs
9662 % if the user said @listoffloats foo but never @float foo.
9663 \message{\linenumber No `\safefloattype' floats to list.}%
9664 \fi
9665 \else
9666 \begingroup
9667 \leftskip=\tocindent % indent these entries like a toc
9668 \let\do=\listoffloatsdo
9669 \csname floatlist\safefloattype\endcsname
9670 \endgroup
9671 \fi
9672 }
9673
9674 % This is called on each entry in a list of floats. We're passed the
9675 % xref label, in the form LABEL-title, which is how we save it in the
9676 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9677 % has the text we're supposed to typeset here.
9678 %
9679 % Figures without xref labels will not be included in the list (since
9680 % they won't appear in the aux file).
9681 %
9682 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9683 \def\listoffloatsdoentry#1-title\finish{{%
9684 % Can't fully expand XR#1-lof because it can contain anything. Just
9685 % pass the control sequence. On the other hand, XR#1-pg is just the
9686 % page number, and we want to fully expand that so we can get a link
9687 % in pdf output.
9688 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9689 %
9690 % use the same \entry macro we use to generate the TOC and index.
9691 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9692 \writeentry
9693 }}
9694
9695
9696 \message{localization,}
9697
9698 % For single-language documents, @documentlanguage is usually given very
9699 % early, just after @documentencoding. Single argument is the language
9700 % (de) or locale (de_DE) abbreviation.
9701 %
9702 {
9703 \catcode`\_ = \active
9704 \globaldefs=1
9705 \parseargdef\documentlanguage{%
9706 \tex % read txi-??.tex file in plain TeX.
9707 % Read the file by the name they passed if it exists.
9708 \let_ = \normalunderscore % normal _ character for filename test
9709 \openin 1 txi-#1.tex
9710 \ifeof 1
9711 \documentlanguagetrywithoutunderscore #1_\finish
9712 \else
9713 \globaldefs = 1 % everything in the txi-LL files needs to persist
9714 \input txi-#1.tex
9715 \fi
9716 \closein 1
9717 \endgroup % end raw TeX
9718 }
9719 %
9720 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9721 % try txi-de.tex.
9722 %
9723 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9724 \openin 1 txi-#1.tex
9725 \ifeof 1
9726 \errhelp = \nolanghelp
9727 \errmessage{Cannot read language file txi-#1.tex}%
9728 \else
9729 \globaldefs = 1 % everything in the txi-LL files needs to persist
9730 \input txi-#1.tex
9731 \fi
9732 \closein 1
9733 }
9734 }% end of special _ catcode
9735 %
9736 \newhelp\nolanghelp{The given language definition file cannot be found or
9737 is empty. Maybe you need to install it? Putting it in the current
9738 directory should work if nowhere else does.}
9739
9740 % This macro is called from txi-??.tex files; the first argument is the
9741 % \language name to set (without the "\lang@" prefix), the second and
9742 % third args are \{left,right}hyphenmin.
9743 %
9744 % The language names to pass are determined when the format is built.
9745 % See the etex.log file created at that time, e.g.,
9746 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9747 %
9748 % With TeX Live 2008, etex now includes hyphenation patterns for all
9749 % available languages. This means we can support hyphenation in
9750 % Texinfo, at least to some extent. (This still doesn't solve the
9751 % accented characters problem.)
9752 %
9753 \catcode`@=11
9754 \def\txisetlanguage#1#2#3{%
9755 % do not set the language if the name is undefined in the current TeX.
9756 \expandafter\ifx\csname lang@#1\endcsname \relax
9757 \message{no patterns for #1}%
9758 \else
9759 \global\language = \csname lang@#1\endcsname
9760 \fi
9761 % but there is no harm in adjusting the hyphenmin values regardless.
9762 \global\lefthyphenmin = #2\relax
9763 \global\righthyphenmin = #3\relax
9764 }
9765
9766 % XeTeX and LuaTeX can handle Unicode natively.
9767 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9768 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9769 %
9770 \newif\iftxinativeunicodecapable
9771 \newif\iftxiusebytewiseio
9772
9773 \ifx\XeTeXrevision\thisisundefined
9774 \ifx\luatexversion\thisisundefined
9775 \txinativeunicodecapablefalse
9776 \txiusebytewiseiotrue
9777 \else
9778 \txinativeunicodecapabletrue
9779 \txiusebytewiseiofalse
9780 \fi
9781 \else
9782 \txinativeunicodecapabletrue
9783 \txiusebytewiseiofalse
9784 \fi
9785
9786 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9787 % for non-UTF-8 (byte-wise) encodings.
9788 %
9789 \def\setbytewiseio{%
9790 \ifx\XeTeXrevision\thisisundefined
9791 \else
9792 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9793 \XeTeXinputencoding "bytes" % For document root file
9794 % Unfortunately, there seems to be no corresponding XeTeX command for
9795 % output encoding. This is a problem for auxiliary index and TOC files.
9796 % The only solution would be perhaps to write out @U{...} sequences in
9797 % place of non-ASCII characters.
9798 \fi
9799
9800 \ifx\luatexversion\thisisundefined
9801 \else
9802 \directlua{
9803 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9804 local function convert_char (char)
9805 return utf8_char(byte(char))
9806 end
9807
9808 local function convert_line (line)
9809 return gsub(line, ".", convert_char)
9810 end
9811
9812 callback.register("process_input_buffer", convert_line)
9813
9814 local function convert_line_out (line)
9815 local line_out = ""
9816 for c in string.utfvalues(line) do
9817 line_out = line_out .. string.char(c)
9818 end
9819 return line_out
9820 end
9821
9822 callback.register("process_output_buffer", convert_line_out)
9823 }
9824 \fi
9825
9826 \txiusebytewiseiotrue
9827 }
9828
9829
9830 % Helpers for encodings.
9831 % Set the catcode of characters 128 through 255 to the specified number.
9832 %
9833 \def\setnonasciicharscatcode#1{%
9834 \count255=128
9835 \loop\ifnum\count255<256
9836 \global\catcode\count255=#1\relax
9837 \advance\count255 by 1
9838 \repeat
9839 }
9840
9841 \def\setnonasciicharscatcodenonglobal#1{%
9842 \count255=128
9843 \loop\ifnum\count255<256
9844 \catcode\count255=#1\relax
9845 \advance\count255 by 1
9846 \repeat
9847 }
9848
9849 % @documentencoding sets the definition of non-ASCII characters
9850 % according to the specified encoding.
9851 %
9852 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9853 \def\documentencodingzzz#1{%
9854 %
9855 % Encoding being declared for the document.
9856 \def\declaredencoding{\csname #1.enc\endcsname}%
9857 %
9858 % Supported encodings: names converted to tokens in order to be able
9859 % to compare them with \ifx.
9860 \def\ascii{\csname US-ASCII.enc\endcsname}%
9861 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9862 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9863 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9864 \def\utfeight{\csname UTF-8.enc\endcsname}%
9865 %
9866 \ifx \declaredencoding \ascii
9867 \asciichardefs
9868 %
9869 \else \ifx \declaredencoding \lattwo
9870 \iftxinativeunicodecapable
9871 \setbytewiseio
9872 \fi
9873 \setnonasciicharscatcode\active
9874 \lattwochardefs
9875 %
9876 \else \ifx \declaredencoding \latone
9877 \iftxinativeunicodecapable
9878 \setbytewiseio
9879 \fi
9880 \setnonasciicharscatcode\active
9881 \latonechardefs
9882 %
9883 \else \ifx \declaredencoding \latnine
9884 \iftxinativeunicodecapable
9885 \setbytewiseio
9886 \fi
9887 \setnonasciicharscatcode\active
9888 \latninechardefs
9889 %
9890 \else \ifx \declaredencoding \utfeight
9891 \iftxinativeunicodecapable
9892 % For native Unicode handling (XeTeX and LuaTeX)
9893 \nativeunicodechardefs
9894 \else
9895 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
9896 \setnonasciicharscatcode\active
9897 % since we already invoked \utfeightchardefs at the top level
9898 % (below), do not re-invoke it, otherwise our check for duplicated
9899 % definitions gets triggered. Making non-ascii chars active is
9900 % sufficient.
9901 \fi
9902 %
9903 \else
9904 \message{Ignoring unknown document encoding: #1.}%
9905 %
9906 \fi % utfeight
9907 \fi % latnine
9908 \fi % latone
9909 \fi % lattwo
9910 \fi % ascii
9911 %
9912 \ifx\XeTeXrevision\thisisundefined
9913 \else
9914 \ifx \declaredencoding \utfeight
9915 \else
9916 \ifx \declaredencoding \ascii
9917 \else
9918 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
9919 non-ASCII characters in auxiliary files.}%
9920 \fi
9921 \fi
9922 \fi
9923 }
9924
9925 % emacs-page
9926 % A message to be logged when using a character that isn't available
9927 % the default font encoding (OT1).
9928 %
9929 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9930
9931 % Take account of \c (plain) vs. \, (Texinfo) difference.
9932 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9933
9934 % First, make active non-ASCII characters in order for them to be
9935 % correctly categorized when TeX reads the replacement text of
9936 % macros containing the character definitions.
9937 \setnonasciicharscatcode\active
9938 %
9939
9940 \def\gdefchar#1#2{%
9941 \gdef#1{%
9942 \ifpassthroughchars
9943 \string#1%
9944 \else
9945 #2%
9946 \fi
9947 }}
9948
9949 % Latin1 (ISO-8859-1) character definitions.
9950 \def\latonechardefs{%
9951 \gdefchar^^a0{\tie}
9952 \gdefchar^^a1{\exclamdown}
9953 \gdefchar^^a2{{\tcfont \char162}} % cent
9954 \gdefchar^^a3{\pounds{}}
9955 \gdefchar^^a4{{\tcfont \char164}} % currency
9956 \gdefchar^^a5{{\tcfont \char165}} % yen
9957 \gdefchar^^a6{{\tcfont \char166}} % broken bar
9958 \gdefchar^^a7{\S}
9959 \gdefchar^^a8{\"{}}
9960 \gdefchar^^a9{\copyright{}}
9961 \gdefchar^^aa{\ordf}
9962 \gdefchar^^ab{\guillemetleft{}}
9963 \gdefchar^^ac{\ensuremath\lnot}
9964 \gdefchar^^ad{\-}
9965 \gdefchar^^ae{\registeredsymbol{}}
9966 \gdefchar^^af{\={}}
9967 %
9968 \gdefchar^^b0{\textdegree}
9969 \gdefchar^^b1{$\pm$}
9970 \gdefchar^^b2{$^2$}
9971 \gdefchar^^b3{$^3$}
9972 \gdefchar^^b4{\'{}}
9973 \gdefchar^^b5{$\mu$}
9974 \gdefchar^^b6{\P}
9975 \gdefchar^^b7{\ensuremath\cdot}
9976 \gdefchar^^b8{\cedilla\ }
9977 \gdefchar^^b9{$^1$}
9978 \gdefchar^^ba{\ordm}
9979 \gdefchar^^bb{\guillemetright{}}
9980 \gdefchar^^bc{$1\over4$}
9981 \gdefchar^^bd{$1\over2$}
9982 \gdefchar^^be{$3\over4$}
9983 \gdefchar^^bf{\questiondown}
9984 %
9985 \gdefchar^^c0{\`A}
9986 \gdefchar^^c1{\'A}
9987 \gdefchar^^c2{\^A}
9988 \gdefchar^^c3{\~A}
9989 \gdefchar^^c4{\"A}
9990 \gdefchar^^c5{\ringaccent A}
9991 \gdefchar^^c6{\AE}
9992 \gdefchar^^c7{\cedilla C}
9993 \gdefchar^^c8{\`E}
9994 \gdefchar^^c9{\'E}
9995 \gdefchar^^ca{\^E}
9996 \gdefchar^^cb{\"E}
9997 \gdefchar^^cc{\`I}
9998 \gdefchar^^cd{\'I}
9999 \gdefchar^^ce{\^I}
10000 \gdefchar^^cf{\"I}
10001 %
10002 \gdefchar^^d0{\DH}
10003 \gdefchar^^d1{\~N}
10004 \gdefchar^^d2{\`O}
10005 \gdefchar^^d3{\'O}
10006 \gdefchar^^d4{\^O}
10007 \gdefchar^^d5{\~O}
10008 \gdefchar^^d6{\"O}
10009 \gdefchar^^d7{$\times$}
10010 \gdefchar^^d8{\O}
10011 \gdefchar^^d9{\`U}
10012 \gdefchar^^da{\'U}
10013 \gdefchar^^db{\^U}
10014 \gdefchar^^dc{\"U}
10015 \gdefchar^^dd{\'Y}
10016 \gdefchar^^de{\TH}
10017 \gdefchar^^df{\ss}
10018 %
10019 \gdefchar^^e0{\`a}
10020 \gdefchar^^e1{\'a}
10021 \gdefchar^^e2{\^a}
10022 \gdefchar^^e3{\~a}
10023 \gdefchar^^e4{\"a}
10024 \gdefchar^^e5{\ringaccent a}
10025 \gdefchar^^e6{\ae}
10026 \gdefchar^^e7{\cedilla c}
10027 \gdefchar^^e8{\`e}
10028 \gdefchar^^e9{\'e}
10029 \gdefchar^^ea{\^e}
10030 \gdefchar^^eb{\"e}
10031 \gdefchar^^ec{\`{\dotless i}}
10032 \gdefchar^^ed{\'{\dotless i}}
10033 \gdefchar^^ee{\^{\dotless i}}
10034 \gdefchar^^ef{\"{\dotless i}}
10035 %
10036 \gdefchar^^f0{\dh}
10037 \gdefchar^^f1{\~n}
10038 \gdefchar^^f2{\`o}
10039 \gdefchar^^f3{\'o}
10040 \gdefchar^^f4{\^o}
10041 \gdefchar^^f5{\~o}
10042 \gdefchar^^f6{\"o}
10043 \gdefchar^^f7{$\div$}
10044 \gdefchar^^f8{\o}
10045 \gdefchar^^f9{\`u}
10046 \gdefchar^^fa{\'u}
10047 \gdefchar^^fb{\^u}
10048 \gdefchar^^fc{\"u}
10049 \gdefchar^^fd{\'y}
10050 \gdefchar^^fe{\th}
10051 \gdefchar^^ff{\"y}
10052 }
10053
10054 % Latin9 (ISO-8859-15) encoding character definitions.
10055 \def\latninechardefs{%
10056 % Encoding is almost identical to Latin1.
10057 \latonechardefs
10058 %
10059 \gdefchar^^a4{\euro{}}
10060 \gdefchar^^a6{\v S}
10061 \gdefchar^^a8{\v s}
10062 \gdefchar^^b4{\v Z}
10063 \gdefchar^^b8{\v z}
10064 \gdefchar^^bc{\OE}
10065 \gdefchar^^bd{\oe}
10066 \gdefchar^^be{\"Y}
10067 }
10068
10069 % Latin2 (ISO-8859-2) character definitions.
10070 \def\lattwochardefs{%
10071 \gdefchar^^a0{\tie}
10072 \gdefchar^^a1{\ogonek{A}}
10073 \gdefchar^^a2{\u{}}
10074 \gdefchar^^a3{\L}
10075 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10076 \gdefchar^^a5{\v L}
10077 \gdefchar^^a6{\'S}
10078 \gdefchar^^a7{\S}
10079 \gdefchar^^a8{\"{}}
10080 \gdefchar^^a9{\v S}
10081 \gdefchar^^aa{\cedilla S}
10082 \gdefchar^^ab{\v T}
10083 \gdefchar^^ac{\'Z}
10084 \gdefchar^^ad{\-}
10085 \gdefchar^^ae{\v Z}
10086 \gdefchar^^af{\dotaccent Z}
10087 %
10088 \gdefchar^^b0{\textdegree}
10089 \gdefchar^^b1{\ogonek{a}}
10090 \gdefchar^^b2{\ogonek{ }}
10091 \gdefchar^^b3{\l}
10092 \gdefchar^^b4{\'{}}
10093 \gdefchar^^b5{\v l}
10094 \gdefchar^^b6{\'s}
10095 \gdefchar^^b7{\v{}}
10096 \gdefchar^^b8{\cedilla\ }
10097 \gdefchar^^b9{\v s}
10098 \gdefchar^^ba{\cedilla s}
10099 \gdefchar^^bb{\v t}
10100 \gdefchar^^bc{\'z}
10101 \gdefchar^^bd{\H{}}
10102 \gdefchar^^be{\v z}
10103 \gdefchar^^bf{\dotaccent z}
10104 %
10105 \gdefchar^^c0{\'R}
10106 \gdefchar^^c1{\'A}
10107 \gdefchar^^c2{\^A}
10108 \gdefchar^^c3{\u A}
10109 \gdefchar^^c4{\"A}
10110 \gdefchar^^c5{\'L}
10111 \gdefchar^^c6{\'C}
10112 \gdefchar^^c7{\cedilla C}
10113 \gdefchar^^c8{\v C}
10114 \gdefchar^^c9{\'E}
10115 \gdefchar^^ca{\ogonek{E}}
10116 \gdefchar^^cb{\"E}
10117 \gdefchar^^cc{\v E}
10118 \gdefchar^^cd{\'I}
10119 \gdefchar^^ce{\^I}
10120 \gdefchar^^cf{\v D}
10121 %
10122 \gdefchar^^d0{\DH}
10123 \gdefchar^^d1{\'N}
10124 \gdefchar^^d2{\v N}
10125 \gdefchar^^d3{\'O}
10126 \gdefchar^^d4{\^O}
10127 \gdefchar^^d5{\H O}
10128 \gdefchar^^d6{\"O}
10129 \gdefchar^^d7{$\times$}
10130 \gdefchar^^d8{\v R}
10131 \gdefchar^^d9{\ringaccent U}
10132 \gdefchar^^da{\'U}
10133 \gdefchar^^db{\H U}
10134 \gdefchar^^dc{\"U}
10135 \gdefchar^^dd{\'Y}
10136 \gdefchar^^de{\cedilla T}
10137 \gdefchar^^df{\ss}
10138 %
10139 \gdefchar^^e0{\'r}
10140 \gdefchar^^e1{\'a}
10141 \gdefchar^^e2{\^a}
10142 \gdefchar^^e3{\u a}
10143 \gdefchar^^e4{\"a}
10144 \gdefchar^^e5{\'l}
10145 \gdefchar^^e6{\'c}
10146 \gdefchar^^e7{\cedilla c}
10147 \gdefchar^^e8{\v c}
10148 \gdefchar^^e9{\'e}
10149 \gdefchar^^ea{\ogonek{e}}
10150 \gdefchar^^eb{\"e}
10151 \gdefchar^^ec{\v e}
10152 \gdefchar^^ed{\'{\dotless{i}}}
10153 \gdefchar^^ee{\^{\dotless{i}}}
10154 \gdefchar^^ef{\v d}
10155 %
10156 \gdefchar^^f0{\dh}
10157 \gdefchar^^f1{\'n}
10158 \gdefchar^^f2{\v n}
10159 \gdefchar^^f3{\'o}
10160 \gdefchar^^f4{\^o}
10161 \gdefchar^^f5{\H o}
10162 \gdefchar^^f6{\"o}
10163 \gdefchar^^f7{$\div$}
10164 \gdefchar^^f8{\v r}
10165 \gdefchar^^f9{\ringaccent u}
10166 \gdefchar^^fa{\'u}
10167 \gdefchar^^fb{\H u}
10168 \gdefchar^^fc{\"u}
10169 \gdefchar^^fd{\'y}
10170 \gdefchar^^fe{\cedilla t}
10171 \gdefchar^^ff{\dotaccent{}}
10172 }
10173
10174 % UTF-8 character definitions.
10175 %
10176 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10177 % changes for Texinfo conventions. It is included here under the GPL by
10178 % permission from Frank Mittelbach and the LaTeX team.
10179 %
10180 \newcount\countUTFx
10181 \newcount\countUTFy
10182 \newcount\countUTFz
10183
10184 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10185 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10186 %
10187 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10188 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10189 %
10190 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10191 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10192
10193 \gdef\UTFviiiDefined#1{%
10194 \ifx #1\relax
10195 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10196 \else
10197 \expandafter #1%
10198 \fi
10199 }
10200
10201 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10202 \begingroup
10203 \catcode`\~13
10204 \catcode`\$12
10205 \catcode`\"12
10206
10207 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10208 % substituting ~ and $ with a character token of that value.
10209 \def\UTFviiiLoop{%
10210 \global\catcode\countUTFx\active
10211 \uccode`\~\countUTFx
10212 \uccode`\$\countUTFx
10213 \uppercase\expandafter{\UTFviiiTmp}%
10214 \advance\countUTFx by 1
10215 \ifnum\countUTFx < \countUTFy
10216 \expandafter\UTFviiiLoop
10217 \fi}
10218
10219 % For bytes other than the first in a UTF-8 sequence. Not expected to
10220 % be expanded except when writing to auxiliary files.
10221 \countUTFx = "80
10222 \countUTFy = "C2
10223 \def\UTFviiiTmp{%
10224 \gdef~{%
10225 \ifpassthroughchars $\fi}}%
10226 \UTFviiiLoop
10227
10228 \countUTFx = "C2
10229 \countUTFy = "E0
10230 \def\UTFviiiTmp{%
10231 \gdef~{%
10232 \ifpassthroughchars $%
10233 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10234 \UTFviiiLoop
10235
10236 \countUTFx = "E0
10237 \countUTFy = "F0
10238 \def\UTFviiiTmp{%
10239 \gdef~{%
10240 \ifpassthroughchars $%
10241 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10242 \UTFviiiLoop
10243
10244 \countUTFx = "F0
10245 \countUTFy = "F4
10246 \def\UTFviiiTmp{%
10247 \gdef~{%
10248 \ifpassthroughchars $%
10249 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10250 }}%
10251 \UTFviiiLoop
10252 \endgroup
10253
10254 \def\globallet{\global\let} % save some \expandafter's below
10255
10256 % @U{xxxx} to produce U+xxxx, if we support it.
10257 \def\U#1{%
10258 \expandafter\ifx\csname uni:#1\endcsname \relax
10259 \iftxinativeunicodecapable
10260 % All Unicode characters can be used if native Unicode handling is
10261 % active. However, if the font does not have the glyph,
10262 % letters are missing.
10263 \begingroup
10264 \uccode`\.="#1\relax
10265 \uppercase{.}
10266 \endgroup
10267 \else
10268 \errhelp = \EMsimple
10269 \errmessage{Unicode character U+#1 not supported, sorry}%
10270 \fi
10271 \else
10272 \csname uni:#1\endcsname
10273 \fi
10274 }
10275
10276 % These macros are used here to construct the name of a control
10277 % sequence to be defined.
10278 \def\UTFviiiTwoOctetsName#1#2{%
10279 \csname u8:#1\string #2\endcsname}%
10280 \def\UTFviiiThreeOctetsName#1#2#3{%
10281 \csname u8:#1\string #2\string #3\endcsname}%
10282 \def\UTFviiiFourOctetsName#1#2#3#4{%
10283 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10284
10285 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10286 % provide a definition macro to replace a Unicode character;
10287 % this gets used by the @U command
10288 %
10289 \begingroup
10290 \catcode`\"=12
10291 \catcode`\<=12
10292 \catcode`\.=12
10293 \catcode`\,=12
10294 \catcode`\;=12
10295 \catcode`\!=12
10296 \catcode`\~=13
10297 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10298 \countUTFz = "#1\relax
10299 \begingroup
10300 \parseXMLCharref
10301
10302 % Give \u8:... its definition. The sequence of seven \expandafter's
10303 % expands after the \gdef three times, e.g.
10304 %
10305 % 1. \UTFviiTwoOctetsName B1 B2
10306 % 2. \csname u8:B1 \string B2 \endcsname
10307 % 3. \u8: B1 B2 (a single control sequence token)
10308 %
10309 \expandafter\expandafter
10310 \expandafter\expandafter
10311 \expandafter\expandafter
10312 \expandafter\gdef \UTFviiiTmp{#2}%
10313 %
10314 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10315 \message{Internal error, already defined: #1}%
10316 \fi
10317 %
10318 % define an additional control sequence for this code point.
10319 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10320 \endgroup}
10321 %
10322 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10323 % to the corresponding UTF-8 sequence.
10324 \gdef\parseXMLCharref{%
10325 \ifnum\countUTFz < "20\relax
10326 \errhelp = \EMsimple
10327 \errmessage{Cannot define Unicode char value < 0020}%
10328 \else\ifnum\countUTFz < "800\relax
10329 \parseUTFviiiA,%
10330 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10331 \else\ifnum\countUTFz < "10000\relax
10332 \parseUTFviiiA;%
10333 \parseUTFviiiA,%
10334 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10335 \else
10336 \parseUTFviiiA;%
10337 \parseUTFviiiA,%
10338 \parseUTFviiiA!%
10339 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10340 \fi\fi\fi
10341 }
10342
10343 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10344 % It must be a non-initial byte in the sequence.
10345 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10346 % of the bytes.
10347 \gdef\parseUTFviiiA#1{%
10348 \countUTFx = \countUTFz
10349 \divide\countUTFz by 64
10350 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10351 \multiply\countUTFz by 64
10352
10353 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10354 % in order to get the last five bits.
10355 \advance\countUTFx by -\countUTFz
10356
10357 % Convert this to the byte in the UTF-8 sequence.
10358 \advance\countUTFx by 128
10359 \uccode `#1\countUTFx
10360 \countUTFz = \countUTFy}
10361
10362 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10363 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10364 % sequence.
10365 % #2 is one of the \UTFviii*OctetsName macros.
10366 % #3 is always a full stop (.)
10367 % #4 is a template for the other bytes in the sequence. The values for these
10368 % bytes is substituted in here with \uppercase using the \uccode's.
10369 \gdef\parseUTFviiiB#1#2#3#4{%
10370 \advance\countUTFz by "#10\relax
10371 \uccode `#3\countUTFz
10372 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10373 \endgroup
10374
10375 % For native Unicode handling (XeTeX and LuaTeX),
10376 % provide a definition macro that sets a catcode to `other' non-globally
10377 %
10378 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10379 \catcode"#1=\other
10380 }
10381
10382 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10383 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10384 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10385 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10386 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10387 %
10388 % Many of our renditions are less than wonderful, and all the missing
10389 % characters are available somewhere. Loading the necessary fonts
10390 % awaits user request. We can't truly support Unicode without
10391 % reimplementing everything that's been done in LaTeX for many years,
10392 % plus probably using luatex or xetex, and who knows what else.
10393 % We won't be doing that here in this simple file. But we can try to at
10394 % least make most of the characters not bomb out.
10395 %
10396 \def\unicodechardefs{%
10397 \DeclareUnicodeCharacter{0020}{ } % space
10398 \DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number
10399 \DeclareUnicodeCharacter{0022}{\char"22 }%
10400 \DeclareUnicodeCharacter{0023}{\char"23 }%
10401 \DeclareUnicodeCharacter{0024}{\char"24 }%
10402 \DeclareUnicodeCharacter{0025}{\char"25 }%
10403 \DeclareUnicodeCharacter{0026}{\char"26 }%
10404 \DeclareUnicodeCharacter{0027}{\char"27 }%
10405 \DeclareUnicodeCharacter{0028}{\char"28 }%
10406 \DeclareUnicodeCharacter{0029}{\char"29 }%
10407 \DeclareUnicodeCharacter{002A}{\char"2A }%
10408 \DeclareUnicodeCharacter{002B}{\char"2B }%
10409 \DeclareUnicodeCharacter{002C}{\char"2C }%
10410 \DeclareUnicodeCharacter{002D}{\char"2D }%
10411 \DeclareUnicodeCharacter{002E}{\char"2E }%
10412 \DeclareUnicodeCharacter{002F}{\char"2F }%
10413 \DeclareUnicodeCharacter{0030}{0}%
10414 \DeclareUnicodeCharacter{0031}{1}%
10415 \DeclareUnicodeCharacter{0032}{2}%
10416 \DeclareUnicodeCharacter{0033}{3}%
10417 \DeclareUnicodeCharacter{0034}{4}%
10418 \DeclareUnicodeCharacter{0035}{5}%
10419 \DeclareUnicodeCharacter{0036}{6}%
10420 \DeclareUnicodeCharacter{0037}{7}%
10421 \DeclareUnicodeCharacter{0038}{8}%
10422 \DeclareUnicodeCharacter{0039}{9}%
10423 \DeclareUnicodeCharacter{003A}{\char"3A }%
10424 \DeclareUnicodeCharacter{003B}{\char"3B }%
10425 \DeclareUnicodeCharacter{003C}{\char"3C }%
10426 \DeclareUnicodeCharacter{003D}{\char"3D }%
10427 \DeclareUnicodeCharacter{003E}{\char"3E }%
10428 \DeclareUnicodeCharacter{003F}{\char"3F }%
10429 \DeclareUnicodeCharacter{0040}{\char"40 }%
10430 \DeclareUnicodeCharacter{0041}{A}%
10431 \DeclareUnicodeCharacter{0042}{B}%
10432 \DeclareUnicodeCharacter{0043}{C}%
10433 \DeclareUnicodeCharacter{0044}{D}%
10434 \DeclareUnicodeCharacter{0045}{E}%
10435 \DeclareUnicodeCharacter{0046}{F}%
10436 \DeclareUnicodeCharacter{0047}{G}%
10437 \DeclareUnicodeCharacter{0048}{H}%
10438 \DeclareUnicodeCharacter{0049}{I}%
10439 \DeclareUnicodeCharacter{004A}{J}%
10440 \DeclareUnicodeCharacter{004B}{K}%
10441 \DeclareUnicodeCharacter{004C}{L}%
10442 \DeclareUnicodeCharacter{004D}{M}%
10443 \DeclareUnicodeCharacter{004E}{N}%
10444 \DeclareUnicodeCharacter{004F}{O}%
10445 \DeclareUnicodeCharacter{0050}{P}%
10446 \DeclareUnicodeCharacter{0051}{Q}%
10447 \DeclareUnicodeCharacter{0052}{R}%
10448 \DeclareUnicodeCharacter{0053}{S}%
10449 \DeclareUnicodeCharacter{0054}{T}%
10450 \DeclareUnicodeCharacter{0055}{U}%
10451 \DeclareUnicodeCharacter{0056}{V}%
10452 \DeclareUnicodeCharacter{0057}{W}%
10453 \DeclareUnicodeCharacter{0058}{X}%
10454 \DeclareUnicodeCharacter{0059}{Y}%
10455 \DeclareUnicodeCharacter{005A}{Z}%
10456 \DeclareUnicodeCharacter{005B}{\char"5B }%
10457 \DeclareUnicodeCharacter{005C}{\char"5C }%
10458 \DeclareUnicodeCharacter{005D}{\char"5D }%
10459 \DeclareUnicodeCharacter{005E}{\char"5E }%
10460 \DeclareUnicodeCharacter{005F}{\char"5F }%
10461 \DeclareUnicodeCharacter{0060}{\char"60 }%
10462 \DeclareUnicodeCharacter{0061}{a}%
10463 \DeclareUnicodeCharacter{0062}{b}%
10464 \DeclareUnicodeCharacter{0063}{c}%
10465 \DeclareUnicodeCharacter{0064}{d}%
10466 \DeclareUnicodeCharacter{0065}{e}%
10467 \DeclareUnicodeCharacter{0066}{f}%
10468 \DeclareUnicodeCharacter{0067}{g}%
10469 \DeclareUnicodeCharacter{0068}{h}%
10470 \DeclareUnicodeCharacter{0069}{i}%
10471 \DeclareUnicodeCharacter{006A}{j}%
10472 \DeclareUnicodeCharacter{006B}{k}%
10473 \DeclareUnicodeCharacter{006C}{l}%
10474 \DeclareUnicodeCharacter{006D}{m}%
10475 \DeclareUnicodeCharacter{006E}{n}%
10476 \DeclareUnicodeCharacter{006F}{o}%
10477 \DeclareUnicodeCharacter{0070}{p}%
10478 \DeclareUnicodeCharacter{0071}{q}%
10479 \DeclareUnicodeCharacter{0072}{r}%
10480 \DeclareUnicodeCharacter{0073}{s}%
10481 \DeclareUnicodeCharacter{0074}{t}%
10482 \DeclareUnicodeCharacter{0075}{u}%
10483 \DeclareUnicodeCharacter{0076}{v}%
10484 \DeclareUnicodeCharacter{0077}{w}%
10485 \DeclareUnicodeCharacter{0078}{x}%
10486 \DeclareUnicodeCharacter{0079}{y}%
10487 \DeclareUnicodeCharacter{007A}{z}%
10488 \DeclareUnicodeCharacter{007B}{\char"7B }%
10489 \DeclareUnicodeCharacter{007C}{\char"7C }%
10490 \DeclareUnicodeCharacter{007D}{\char"7D }%
10491 \DeclareUnicodeCharacter{007E}{\char"7E }%
10492 % \DeclareUnicodeCharacter{007F}{} % DEL
10493 %
10494 \DeclareUnicodeCharacter{00A0}{\tie}%
10495 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10496 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10497 \DeclareUnicodeCharacter{00A3}{\pounds{}}%
10498 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10499 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10500 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10501 \DeclareUnicodeCharacter{00A7}{\S}%
10502 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10503 \DeclareUnicodeCharacter{00A9}{\copyright{}}%
10504 \DeclareUnicodeCharacter{00AA}{\ordf}%
10505 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
10506 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10507 \DeclareUnicodeCharacter{00AD}{\-}%
10508 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
10509 \DeclareUnicodeCharacter{00AF}{\={ }}%
10510 %
10511 \DeclareUnicodeCharacter{00B0}{\textdegree}%
10512 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10513 \DeclareUnicodeCharacter{00B2}{$^2$}%
10514 \DeclareUnicodeCharacter{00B3}{$^3$}%
10515 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10516 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10517 \DeclareUnicodeCharacter{00B6}{\P}%
10518 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10519 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10520 \DeclareUnicodeCharacter{00B9}{$^1$}%
10521 \DeclareUnicodeCharacter{00BA}{\ordm}%
10522 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
10523 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10524 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10525 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10526 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10527 %
10528 \DeclareUnicodeCharacter{00C0}{\`A}%
10529 \DeclareUnicodeCharacter{00C1}{\'A}%
10530 \DeclareUnicodeCharacter{00C2}{\^A}%
10531 \DeclareUnicodeCharacter{00C3}{\~A}%
10532 \DeclareUnicodeCharacter{00C4}{\"A}%
10533 \DeclareUnicodeCharacter{00C5}{\AA}%
10534 \DeclareUnicodeCharacter{00C6}{\AE}%
10535 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10536 \DeclareUnicodeCharacter{00C8}{\`E}%
10537 \DeclareUnicodeCharacter{00C9}{\'E}%
10538 \DeclareUnicodeCharacter{00CA}{\^E}%
10539 \DeclareUnicodeCharacter{00CB}{\"E}%
10540 \DeclareUnicodeCharacter{00CC}{\`I}%
10541 \DeclareUnicodeCharacter{00CD}{\'I}%
10542 \DeclareUnicodeCharacter{00CE}{\^I}%
10543 \DeclareUnicodeCharacter{00CF}{\"I}%
10544 %
10545 \DeclareUnicodeCharacter{00D0}{\DH}%
10546 \DeclareUnicodeCharacter{00D1}{\~N}%
10547 \DeclareUnicodeCharacter{00D2}{\`O}%
10548 \DeclareUnicodeCharacter{00D3}{\'O}%
10549 \DeclareUnicodeCharacter{00D4}{\^O}%
10550 \DeclareUnicodeCharacter{00D5}{\~O}%
10551 \DeclareUnicodeCharacter{00D6}{\"O}%
10552 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10553 \DeclareUnicodeCharacter{00D8}{\O}%
10554 \DeclareUnicodeCharacter{00D9}{\`U}%
10555 \DeclareUnicodeCharacter{00DA}{\'U}%
10556 \DeclareUnicodeCharacter{00DB}{\^U}%
10557 \DeclareUnicodeCharacter{00DC}{\"U}%
10558 \DeclareUnicodeCharacter{00DD}{\'Y}%
10559 \DeclareUnicodeCharacter{00DE}{\TH}%
10560 \DeclareUnicodeCharacter{00DF}{\ss}%
10561 %
10562 \DeclareUnicodeCharacter{00E0}{\`a}%
10563 \DeclareUnicodeCharacter{00E1}{\'a}%
10564 \DeclareUnicodeCharacter{00E2}{\^a}%
10565 \DeclareUnicodeCharacter{00E3}{\~a}%
10566 \DeclareUnicodeCharacter{00E4}{\"a}%
10567 \DeclareUnicodeCharacter{00E5}{\aa}%
10568 \DeclareUnicodeCharacter{00E6}{\ae}%
10569 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10570 \DeclareUnicodeCharacter{00E8}{\`e}%
10571 \DeclareUnicodeCharacter{00E9}{\'e}%
10572 \DeclareUnicodeCharacter{00EA}{\^e}%
10573 \DeclareUnicodeCharacter{00EB}{\"e}%
10574 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10575 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10576 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10577 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10578 %
10579 \DeclareUnicodeCharacter{00F0}{\dh}%
10580 \DeclareUnicodeCharacter{00F1}{\~n}%
10581 \DeclareUnicodeCharacter{00F2}{\`o}%
10582 \DeclareUnicodeCharacter{00F3}{\'o}%
10583 \DeclareUnicodeCharacter{00F4}{\^o}%
10584 \DeclareUnicodeCharacter{00F5}{\~o}%
10585 \DeclareUnicodeCharacter{00F6}{\"o}%
10586 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10587 \DeclareUnicodeCharacter{00F8}{\o}%
10588 \DeclareUnicodeCharacter{00F9}{\`u}%
10589 \DeclareUnicodeCharacter{00FA}{\'u}%
10590 \DeclareUnicodeCharacter{00FB}{\^u}%
10591 \DeclareUnicodeCharacter{00FC}{\"u}%
10592 \DeclareUnicodeCharacter{00FD}{\'y}%
10593 \DeclareUnicodeCharacter{00FE}{\th}%
10594 \DeclareUnicodeCharacter{00FF}{\"y}%
10595 %
10596 \DeclareUnicodeCharacter{0100}{\=A}%
10597 \DeclareUnicodeCharacter{0101}{\=a}%
10598 \DeclareUnicodeCharacter{0102}{\u{A}}%
10599 \DeclareUnicodeCharacter{0103}{\u{a}}%
10600 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10601 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10602 \DeclareUnicodeCharacter{0106}{\'C}%
10603 \DeclareUnicodeCharacter{0107}{\'c}%
10604 \DeclareUnicodeCharacter{0108}{\^C}%
10605 \DeclareUnicodeCharacter{0109}{\^c}%
10606 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10607 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10608 \DeclareUnicodeCharacter{010C}{\v{C}}%
10609 \DeclareUnicodeCharacter{010D}{\v{c}}%
10610 \DeclareUnicodeCharacter{010E}{\v{D}}%
10611 \DeclareUnicodeCharacter{010F}{d'}%
10612 %
10613 \DeclareUnicodeCharacter{0110}{\DH}%
10614 \DeclareUnicodeCharacter{0111}{\dh}%
10615 \DeclareUnicodeCharacter{0112}{\=E}%
10616 \DeclareUnicodeCharacter{0113}{\=e}%
10617 \DeclareUnicodeCharacter{0114}{\u{E}}%
10618 \DeclareUnicodeCharacter{0115}{\u{e}}%
10619 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10620 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10621 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10622 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10623 \DeclareUnicodeCharacter{011A}{\v{E}}%
10624 \DeclareUnicodeCharacter{011B}{\v{e}}%
10625 \DeclareUnicodeCharacter{011C}{\^G}%
10626 \DeclareUnicodeCharacter{011D}{\^g}%
10627 \DeclareUnicodeCharacter{011E}{\u{G}}%
10628 \DeclareUnicodeCharacter{011F}{\u{g}}%
10629 %
10630 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10631 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10632 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10633 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10634 \DeclareUnicodeCharacter{0124}{\^H}%
10635 \DeclareUnicodeCharacter{0125}{\^h}%
10636 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10637 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10638 \DeclareUnicodeCharacter{0128}{\~I}%
10639 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10640 \DeclareUnicodeCharacter{012A}{\=I}%
10641 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10642 \DeclareUnicodeCharacter{012C}{\u{I}}%
10643 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10644 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10645 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10646 %
10647 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10648 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10649 \DeclareUnicodeCharacter{0132}{IJ}%
10650 \DeclareUnicodeCharacter{0133}{ij}%
10651 \DeclareUnicodeCharacter{0134}{\^J}%
10652 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10653 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10654 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10655 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10656 \DeclareUnicodeCharacter{0139}{\'L}%
10657 \DeclareUnicodeCharacter{013A}{\'l}%
10658 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10659 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10660 \DeclareUnicodeCharacter{013D}{L'}% should kern
10661 \DeclareUnicodeCharacter{013E}{l'}% should kern
10662 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10663 %
10664 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10665 \DeclareUnicodeCharacter{0141}{\L}%
10666 \DeclareUnicodeCharacter{0142}{\l}%
10667 \DeclareUnicodeCharacter{0143}{\'N}%
10668 \DeclareUnicodeCharacter{0144}{\'n}%
10669 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10670 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10671 \DeclareUnicodeCharacter{0147}{\v{N}}%
10672 \DeclareUnicodeCharacter{0148}{\v{n}}%
10673 \DeclareUnicodeCharacter{0149}{'n}%
10674 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10675 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10676 \DeclareUnicodeCharacter{014C}{\=O}%
10677 \DeclareUnicodeCharacter{014D}{\=o}%
10678 \DeclareUnicodeCharacter{014E}{\u{O}}%
10679 \DeclareUnicodeCharacter{014F}{\u{o}}%
10680 %
10681 \DeclareUnicodeCharacter{0150}{\H{O}}%
10682 \DeclareUnicodeCharacter{0151}{\H{o}}%
10683 \DeclareUnicodeCharacter{0152}{\OE}%
10684 \DeclareUnicodeCharacter{0153}{\oe}%
10685 \DeclareUnicodeCharacter{0154}{\'R}%
10686 \DeclareUnicodeCharacter{0155}{\'r}%
10687 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10688 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10689 \DeclareUnicodeCharacter{0158}{\v{R}}%
10690 \DeclareUnicodeCharacter{0159}{\v{r}}%
10691 \DeclareUnicodeCharacter{015A}{\'S}%
10692 \DeclareUnicodeCharacter{015B}{\'s}%
10693 \DeclareUnicodeCharacter{015C}{\^S}%
10694 \DeclareUnicodeCharacter{015D}{\^s}%
10695 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10696 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10697 %
10698 \DeclareUnicodeCharacter{0160}{\v{S}}%
10699 \DeclareUnicodeCharacter{0161}{\v{s}}%
10700 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10701 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10702 \DeclareUnicodeCharacter{0164}{\v{T}}%
10703 \DeclareUnicodeCharacter{0165}{\v{t}}%
10704 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10705 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10706 \DeclareUnicodeCharacter{0168}{\~U}%
10707 \DeclareUnicodeCharacter{0169}{\~u}%
10708 \DeclareUnicodeCharacter{016A}{\=U}%
10709 \DeclareUnicodeCharacter{016B}{\=u}%
10710 \DeclareUnicodeCharacter{016C}{\u{U}}%
10711 \DeclareUnicodeCharacter{016D}{\u{u}}%
10712 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10713 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10714 %
10715 \DeclareUnicodeCharacter{0170}{\H{U}}%
10716 \DeclareUnicodeCharacter{0171}{\H{u}}%
10717 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10718 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10719 \DeclareUnicodeCharacter{0174}{\^W}%
10720 \DeclareUnicodeCharacter{0175}{\^w}%
10721 \DeclareUnicodeCharacter{0176}{\^Y}%
10722 \DeclareUnicodeCharacter{0177}{\^y}%
10723 \DeclareUnicodeCharacter{0178}{\"Y}%
10724 \DeclareUnicodeCharacter{0179}{\'Z}%
10725 \DeclareUnicodeCharacter{017A}{\'z}%
10726 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10727 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10728 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10729 \DeclareUnicodeCharacter{017E}{\v{z}}%
10730 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10731 %
10732 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10733 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10734 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10735 \DeclareUnicodeCharacter{01C7}{LJ}%
10736 \DeclareUnicodeCharacter{01C8}{Lj}%
10737 \DeclareUnicodeCharacter{01C9}{lj}%
10738 \DeclareUnicodeCharacter{01CA}{NJ}%
10739 \DeclareUnicodeCharacter{01CB}{Nj}%
10740 \DeclareUnicodeCharacter{01CC}{nj}%
10741 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10742 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10743 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10744 %
10745 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10746 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10747 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10748 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10749 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10750 %
10751 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10752 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10753 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10754 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10755 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10756 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10757 %
10758 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10759 \DeclareUnicodeCharacter{01F1}{DZ}%
10760 \DeclareUnicodeCharacter{01F2}{Dz}%
10761 \DeclareUnicodeCharacter{01F3}{dz}%
10762 \DeclareUnicodeCharacter{01F4}{\'G}%
10763 \DeclareUnicodeCharacter{01F5}{\'g}%
10764 \DeclareUnicodeCharacter{01F8}{\`N}%
10765 \DeclareUnicodeCharacter{01F9}{\`n}%
10766 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10767 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10768 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10769 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10770 %
10771 \DeclareUnicodeCharacter{021E}{\v{H}}%
10772 \DeclareUnicodeCharacter{021F}{\v{h}}%
10773 %
10774 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10775 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10776 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10777 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10778 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10779 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10780 %
10781 \DeclareUnicodeCharacter{0232}{\=Y}%
10782 \DeclareUnicodeCharacter{0233}{\=y}%
10783 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10784 %
10785 \DeclareUnicodeCharacter{02BC}{'}%
10786 %
10787 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10788 %
10789 % Greek letters upper case
10790 \DeclareUnicodeCharacter{0391}{{\it A}}%
10791 \DeclareUnicodeCharacter{0392}{{\it B}}%
10792 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10793 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10794 \DeclareUnicodeCharacter{0395}{{\it E}}%
10795 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10796 \DeclareUnicodeCharacter{0397}{{\it H}}%
10797 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10798 \DeclareUnicodeCharacter{0399}{{\it I}}%
10799 \DeclareUnicodeCharacter{039A}{{\it K}}%
10800 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10801 \DeclareUnicodeCharacter{039C}{{\it M}}%
10802 \DeclareUnicodeCharacter{039D}{{\it N}}%
10803 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10804 \DeclareUnicodeCharacter{039F}{{\it O}}%
10805 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10806 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10807 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10808 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10809 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10810 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10811 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10812 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10813 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10814 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10815 %
10816 % Vowels with accents
10817 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10818 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10819 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10820 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10821 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10822 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10823 %
10824 % Standalone accent
10825 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10826 %
10827 % Greek letters lower case
10828 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10829 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10830 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10831 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10832 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10833 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10834 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10835 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10836 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10837 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10838 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10839 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10840 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10841 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10842 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10843 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10844 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10845 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10846 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10847 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10848 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10849 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10850 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10851 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10852 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10853 %
10854 % More Greek vowels with accents
10855 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10856 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10857 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10858 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10859 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10860 %
10861 % Variant Greek letters
10862 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10863 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10864 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10865 %
10866 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10867 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10868 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10869 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10870 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10871 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10872 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10873 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10874 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10875 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10876 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10877 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10878 %
10879 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10880 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10881 %
10882 \DeclareUnicodeCharacter{1E20}{\=G}%
10883 \DeclareUnicodeCharacter{1E21}{\=g}%
10884 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10885 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10886 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10887 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10888 \DeclareUnicodeCharacter{1E26}{\"H}%
10889 \DeclareUnicodeCharacter{1E27}{\"h}%
10890 %
10891 \DeclareUnicodeCharacter{1E30}{\'K}%
10892 \DeclareUnicodeCharacter{1E31}{\'k}%
10893 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10894 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10895 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10896 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10897 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10898 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10899 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10900 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10901 \DeclareUnicodeCharacter{1E3E}{\'M}%
10902 \DeclareUnicodeCharacter{1E3F}{\'m}%
10903 %
10904 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10905 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10906 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10907 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10908 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10909 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10910 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10911 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10912 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10913 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10914 %
10915 \DeclareUnicodeCharacter{1E54}{\'P}%
10916 \DeclareUnicodeCharacter{1E55}{\'p}%
10917 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10918 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10919 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10920 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10921 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10922 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10923 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10924 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10925 %
10926 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10927 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10928 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10929 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10930 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10931 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10932 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10933 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10934 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10935 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10936 %
10937 \DeclareUnicodeCharacter{1E7C}{\~V}%
10938 \DeclareUnicodeCharacter{1E7D}{\~v}%
10939 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10940 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10941 %
10942 \DeclareUnicodeCharacter{1E80}{\`W}%
10943 \DeclareUnicodeCharacter{1E81}{\`w}%
10944 \DeclareUnicodeCharacter{1E82}{\'W}%
10945 \DeclareUnicodeCharacter{1E83}{\'w}%
10946 \DeclareUnicodeCharacter{1E84}{\"W}%
10947 \DeclareUnicodeCharacter{1E85}{\"w}%
10948 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10949 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10950 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10951 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10952 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10953 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10954 \DeclareUnicodeCharacter{1E8C}{\"X}%
10955 \DeclareUnicodeCharacter{1E8D}{\"x}%
10956 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10957 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10958 %
10959 \DeclareUnicodeCharacter{1E90}{\^Z}%
10960 \DeclareUnicodeCharacter{1E91}{\^z}%
10961 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10962 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10963 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10964 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
10965 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
10966 \DeclareUnicodeCharacter{1E97}{\"t}%
10967 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
10968 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
10969 %
10970 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
10971 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
10972 %
10973 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
10974 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
10975 \DeclareUnicodeCharacter{1EBC}{\~E}%
10976 \DeclareUnicodeCharacter{1EBD}{\~e}%
10977 %
10978 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
10979 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
10980 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
10981 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
10982 %
10983 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
10984 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
10985 %
10986 \DeclareUnicodeCharacter{1EF2}{\`Y}%
10987 \DeclareUnicodeCharacter{1EF3}{\`y}%
10988 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
10989 %
10990 \DeclareUnicodeCharacter{1EF8}{\~Y}%
10991 \DeclareUnicodeCharacter{1EF9}{\~y}%
10992 %
10993 % Exotic spaces
10994 \DeclareUnicodeCharacter{2007}{\hphantom{0}}%
10995 %
10996 % Punctuation
10997 \DeclareUnicodeCharacter{2013}{--}%
10998 \DeclareUnicodeCharacter{2014}{---}%
10999 \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
11000 \DeclareUnicodeCharacter{2019}{\quoteright{}}%
11001 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
11002 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
11003 \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
11004 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
11005 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
11006 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
11007 \DeclareUnicodeCharacter{2022}{\bullet{}}%
11008 \DeclareUnicodeCharacter{202F}{\thinspace}%
11009 \DeclareUnicodeCharacter{2026}{\dots{}}%
11010 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
11011 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
11012 %
11013 \DeclareUnicodeCharacter{20AC}{\euro{}}%
11014 %
11015 \DeclareUnicodeCharacter{2192}{\arrow}%
11016 \DeclareUnicodeCharacter{21D2}{\result{}}%
11017 %
11018 % Mathematical symbols
11019 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
11020 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
11021 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
11022 \DeclareUnicodeCharacter{2212}{\minus{}}%
11023 \DeclareUnicodeCharacter{2217}{\ast}%
11024 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
11025 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
11026 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
11027 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
11028 \DeclareUnicodeCharacter{2261}{\equiv{}}%
11029 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
11030 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
11031 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
11032 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
11033 %
11034 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
11035 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
11036 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
11037 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
11038 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
11039 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
11040 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
11041 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11042 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11043 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11044 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11045 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11046 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11047 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11048 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11049 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11050 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11051 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11052 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11053 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11054 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11055 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11056 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11057 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11058 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11059 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11060 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11061 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11062 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11063 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11064 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11065 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11066 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11067 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11068 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11069 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11070 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11071 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11072 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11073 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11074 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11075 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11076 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11077 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11078 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11079 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11080 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11081 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11082 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11083 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11084 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11085 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11086 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11087 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11088 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11089 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11090 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11091 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11092 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11093 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11094 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11095 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11096 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11097 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11098 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11099 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11100 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11101 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11102 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11103 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11104 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11105 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11106 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11107 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11108 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11109 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11110 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11111 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11112 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11113 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11114 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11115 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11116 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11117 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11118 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11119 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11120 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11121 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11122 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11123 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11124 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11125 %
11126 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11127 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11128 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11129 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11130 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
11131 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11132 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11133 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11134 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11135 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11136 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11137 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11138 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11139 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11140 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11141 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11142 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11143 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11144 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11145 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11146 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11147 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11148 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11149 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11150 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11151 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11152 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11153 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11154 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11155 %
11156 \global\mathchardef\checkmark="1370% actually the square root sign
11157 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11158 }% end of \unicodechardefs
11159
11160 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11161 % It makes the setting that replace UTF-8 byte sequence.
11162 \def\utfeightchardefs{%
11163 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11164 \unicodechardefs
11165 }
11166
11167 % Whether the active definitions of non-ASCII characters expand to
11168 % non-active tokens with the same character code. This is used to
11169 % write characters literally, instead of using active definitions for
11170 % printing the correct glyphs.
11171 \newif\ifpassthroughchars
11172 \passthroughcharsfalse
11173
11174 % For native Unicode handling (XeTeX and LuaTeX),
11175 % provide a definition macro to replace/pass-through a Unicode character
11176 %
11177 \def\DeclareUnicodeCharacterNative#1#2{%
11178 \ifnum"#1>"7F % only make non-ASCII chars active
11179 \catcode"#1=\active
11180 \def\dodeclareunicodecharacternative##1##2##3{%
11181 \begingroup
11182 \uccode`\~="##2\relax
11183 \uppercase{\gdef~}{%
11184 \ifpassthroughchars
11185 ##1%
11186 \else
11187 ##3%
11188 \fi
11189 }
11190 \endgroup
11191 }
11192 \begingroup
11193 \uccode`\.="#1\relax
11194 \uppercase{\def\UTFNativeTmp{.}}%
11195 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11196 \endgroup
11197 \fi
11198 }
11199
11200 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11201 % It activates the setting that replaces Unicode characters.
11202 \def\nativeunicodechardefs{%
11203 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11204 \unicodechardefs
11205 }
11206
11207 % For native Unicode handling (XeTeX and LuaTeX),
11208 % make the character token expand
11209 % to the sequences given in \unicodechardefs for printing.
11210 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11211 \def\UTFAtUTmp{#2}
11212 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11213 }
11214
11215 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11216 \def\nativeunicodechardefsatu{%
11217 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11218 \unicodechardefs
11219 }
11220
11221 % US-ASCII character definitions.
11222 \def\asciichardefs{% nothing need be done
11223 \relax
11224 }
11225
11226 % Define all Unicode characters we know about. This makes UTF-8 the default
11227 % input encoding and allows @U to work.
11228 \iftxinativeunicodecapable
11229 \nativeunicodechardefsatu
11230 \else
11231 \utfeightchardefs
11232 \fi
11233
11234 \message{formatting,}
11235
11236 \newdimen\defaultparindent \defaultparindent = 15pt
11237
11238 \chapheadingskip = 15pt plus 4pt minus 2pt
11239 \secheadingskip = 12pt plus 3pt minus 2pt
11240 \subsecheadingskip = 9pt plus 2pt minus 2pt
11241
11242 % Prevent underfull vbox error messages.
11243 \vbadness = 10000
11244
11245 % Don't be very finicky about underfull hboxes, either.
11246 \hbadness = 6666
11247
11248 % Following George Bush, get rid of widows and orphans.
11249 \widowpenalty=10000
11250 \clubpenalty=10000
11251
11252 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11253 % using an old version of TeX, don't do anything. We want the amount of
11254 % stretch added to depend on the line length, hence the dependence on
11255 % \hsize. We call this whenever the paper size is set.
11256 %
11257 \def\setemergencystretch{%
11258 \ifx\emergencystretch\thisisundefined
11259 % Allow us to assign to \emergencystretch anyway.
11260 \def\emergencystretch{\dimen0}%
11261 \else
11262 \emergencystretch = .15\hsize
11263 \fi
11264 }
11265
11266 % Parameters in order: 1) textheight; 2) textwidth;
11267 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11268 % 7) physical page height; 8) physical page width.
11269 %
11270 % We also call \setleading{\textleading}, so the caller should define
11271 % \textleading. The caller should also set \parskip.
11272 %
11273 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11274 \voffset = #3\relax
11275 \topskip = #6\relax
11276 \splittopskip = \topskip
11277 %
11278 \vsize = #1\relax
11279 \advance\vsize by \topskip
11280 \txipageheight = \vsize
11281 %
11282 \hsize = #2\relax
11283 \txipagewidth = \hsize
11284 %
11285 \normaloffset = #4\relax
11286 \bindingoffset = #5\relax
11287 %
11288 \ifpdf
11289 \pdfpageheight #7\relax
11290 \pdfpagewidth #8\relax
11291 % if we don't reset these, they will remain at "1 true in" of
11292 % whatever layout pdftex was dumped with.
11293 \pdfhorigin = 1 true in
11294 \pdfvorigin = 1 true in
11295 \else
11296 \ifx\XeTeXrevision\thisisundefined
11297 \special{papersize=#8,#7}%
11298 \else
11299 \pdfpageheight #7\relax
11300 \pdfpagewidth #8\relax
11301 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11302 \fi
11303 \fi
11304 %
11305 \setleading{\textleading}
11306 %
11307 \parindent = \defaultparindent
11308 \setemergencystretch
11309 }
11310
11311 % @letterpaper (the default).
11312 \def\letterpaper{{\globaldefs = 1
11313 \parskip = 3pt plus 2pt minus 1pt
11314 \textleading = 13.2pt
11315 %
11316 % If page is nothing but text, make it come out even.
11317 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11318 {\voffset}{.25in}%
11319 {\bindingoffset}{36pt}%
11320 {11in}{8.5in}%
11321 }}
11322
11323 % Use @smallbook to reset parameters for 7x9.25 trim size.
11324 \def\smallbook{{\globaldefs = 1
11325 \parskip = 2pt plus 1pt
11326 \textleading = 12pt
11327 %
11328 \internalpagesizes{7.5in}{5in}%
11329 {-.2in}{0in}%
11330 {\bindingoffset}{16pt}%
11331 {9.25in}{7in}%
11332 %
11333 \lispnarrowing = 0.3in
11334 \tolerance = 700
11335 \contentsrightmargin = 0pt
11336 \defbodyindent = .5cm
11337 }}
11338
11339 % Use @afourpaper to print on European A4 paper.
11340 \def\afourpaper{{\globaldefs = 1
11341 \parskip = 3pt plus 2pt minus 1pt
11342 \textleading = 13.2pt
11343 %
11344 % Double-side printing via postscript on Laserjet 4050
11345 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11346 % To change the settings for a different printer or situation, adjust
11347 % \normaloffset until the front-side and back-side texts align. Then
11348 % do the same for \bindingoffset. You can set these for testing in
11349 % your texinfo source file like this:
11350 % @tex
11351 % \global\normaloffset = -6mm
11352 % \global\bindingoffset = 10mm
11353 % @end tex
11354 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11355 {\voffset}{\hoffset}%
11356 {\bindingoffset}{44pt}%
11357 {297mm}{210mm}%
11358 %
11359 \tolerance = 700
11360 \contentsrightmargin = 0pt
11361 \defbodyindent = 5mm
11362 }}
11363
11364 % Use @afivepaper to print on European A5 paper.
11365 % From romildo (a] urano.iceb.ufop.br, 2 July 2000.
11366 % He also recommends making @example and @lisp be small.
11367 \def\afivepaper{{\globaldefs = 1
11368 \parskip = 2pt plus 1pt minus 0.1pt
11369 \textleading = 12.5pt
11370 %
11371 \internalpagesizes{160mm}{120mm}%
11372 {\voffset}{-11.4mm}%
11373 {\bindingoffset}{8pt}%
11374 {210mm}{148mm}%
11375 %
11376 \lispnarrowing = 0.2in
11377 \tolerance = 800
11378 \contentsrightmargin = 0pt
11379 \defbodyindent = 2mm
11380 \tableindent = 12mm
11381 }}
11382
11383 % A specific text layout, 24x15cm overall, intended for A4 paper.
11384 \def\afourlatex{{\globaldefs = 1
11385 \afourpaper
11386 \internalpagesizes{237mm}{150mm}%
11387 {\voffset}{4.6mm}%
11388 {\bindingoffset}{7mm}%
11389 {297mm}{210mm}%
11390 %
11391 % Must explicitly reset to 0 because we call \afourpaper.
11392 \globaldefs = 0
11393 }}
11394
11395 % Use @afourwide to print on A4 paper in landscape format.
11396 \def\afourwide{{\globaldefs = 1
11397 \afourpaper
11398 \internalpagesizes{241mm}{165mm}%
11399 {\voffset}{-2.95mm}%
11400 {\bindingoffset}{7mm}%
11401 {297mm}{210mm}%
11402 \globaldefs = 0
11403 }}
11404
11405 \def\bsixpaper{{\globaldefs = 1
11406 \afourpaper
11407 \internalpagesizes{140mm}{100mm}%
11408 {-6.35mm}{-12.7mm}%
11409 {\bindingoffset}{14pt}%
11410 {176mm}{125mm}%
11411 \let\SETdispenvsize=\smallword
11412 \lispnarrowing = 0.2in
11413 \globaldefs = 0
11414 }}
11415
11416
11417 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11418 % Perhaps we should allow setting the margins, \topskip, \parskip,
11419 % and/or leading, also. Or perhaps we should compute them somehow.
11420 %
11421 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11422 \def\pagesizesyyy#1,#2,#3\finish{{%
11423 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11424 \globaldefs = 1
11425 %
11426 \parskip = 3pt plus 2pt minus 1pt
11427 \setleading{\textleading}%
11428 %
11429 \dimen0 = #1\relax
11430 \advance\dimen0 by 2.5in % default 1in margin above heading line
11431 % and 1.5in to include heading, footing and
11432 % bottom margin
11433 %
11434 \dimen2 = \hsize
11435 \advance\dimen2 by 2in % default to 1 inch margin on each side
11436 %
11437 \internalpagesizes{#1}{\hsize}%
11438 {\voffset}{\normaloffset}%
11439 {\bindingoffset}{44pt}%
11440 {\dimen0}{\dimen2}%
11441 }}
11442
11443 % Set default to letter.
11444 %
11445 \letterpaper
11446
11447 % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
11448 \hfuzz = 1pt
11449
11450
11451 \message{microtype,}
11452
11453 % protrusion, from Thanh's protcode.tex.
11454 \def\mtsetprotcode#1{%
11455 \rpcode#1`\!=200 \rpcode#1`\,=700 \rpcode#1`\-=700 \rpcode#1`\.=700
11456 \rpcode#1`\;=500 \rpcode#1`\:=500 \rpcode#1`\?=200
11457 \rpcode#1`\'=700
11458 \rpcode#1 34=500 % ''
11459 \rpcode#1 123=300 % --
11460 \rpcode#1 124=200 % ---
11461 \rpcode#1`\)=50 \rpcode#1`\A=50 \rpcode#1`\F=50 \rpcode#1`\K=50
11462 \rpcode#1`\L=50 \rpcode#1`\T=50 \rpcode#1`\V=50 \rpcode#1`\W=50
11463 \rpcode#1`\X=50 \rpcode#1`\Y=50 \rpcode#1`\k=50 \rpcode#1`\r=50
11464 \rpcode#1`\t=50 \rpcode#1`\v=50 \rpcode#1`\w=50 \rpcode#1`\x=50
11465 \rpcode#1`\y=50
11466 %
11467 \lpcode#1`\`=700
11468 \lpcode#1 92=500 % ``
11469 \lpcode#1`\(=50 \lpcode#1`\A=50 \lpcode#1`\J=50 \lpcode#1`\T=50
11470 \lpcode#1`\V=50 \lpcode#1`\W=50 \lpcode#1`\X=50 \lpcode#1`\Y=50
11471 \lpcode#1`\v=50 \lpcode#1`\w=50 \lpcode#1`\x=50 \lpcode#1`\y=0
11472 %
11473 \mtadjustprotcode#1\relax
11474 }
11475
11476 \newcount\countC
11477 \def\mtadjustprotcode#1{%
11478 \countC=0
11479 \loop
11480 \ifcase\lpcode#1\countC\else
11481 \mtadjustcp\lpcode#1\countC
11482 \fi
11483 \ifcase\rpcode#1\countC\else
11484 \mtadjustcp\rpcode#1\countC
11485 \fi
11486 \advance\countC 1
11487 \ifnum\countC < 256 \repeat
11488 }
11489
11490 \newcount\countB
11491 \def\mtadjustcp#1#2#3{%
11492 \setbox\boxA=\hbox{%
11493 \ifx#2\font\else#2\fi
11494 \char#3}%
11495 \countB=\wd\boxA
11496 \multiply\countB #1#2#3\relax
11497 \divide\countB \fontdimen6 #2\relax
11498 #1#2#3=\countB\relax
11499 }
11500
11501 \ifx\XeTeXrevision\thisisundefined
11502 \ifx\luatexversion\thisisundefined
11503 \ifpdf % pdfTeX
11504 \mtsetprotcode\textrm
11505 \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
11506 \else % TeX
11507 \def\mtfontexpand#1{}
11508 \fi
11509 \else % LuaTeX
11510 \mtsetprotcode\textrm
11511 \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
11512 \fi
11513 \else % XeTeX
11514 \mtsetprotcode\textrm
11515 \def\mtfontexpand#1{}
11516 \fi
11517
11518
11519 \newif\ifmicrotype
11520
11521 \def\microtypeON{%
11522 \microtypetrue
11523 %
11524 \ifx\XeTeXrevision\thisisundefined
11525 \ifx\luatexversion\thisisundefined
11526 \ifpdf % pdfTeX
11527 \pdfadjustspacing=2
11528 \pdfprotrudechars=2
11529 \fi
11530 \else % LuaTeX
11531 \adjustspacing=2
11532 \protrudechars=2
11533 \fi
11534 \else % XeTeX
11535 \XeTeXprotrudechars=2
11536 \fi
11537 %
11538 \mtfontexpand\textrm
11539 \mtfontexpand\textsl
11540 \mtfontexpand\textbf
11541 }
11542
11543 \def\microtypeOFF{%
11544 \microtypefalse
11545 %
11546 \ifx\XeTeXrevision\thisisundefined
11547 \ifx\luatexversion\thisisundefined
11548 \ifpdf % pdfTeX
11549 \pdfadjustspacing=0
11550 \pdfprotrudechars=0
11551 \fi
11552 \else % LuaTeX
11553 \adjustspacing=0
11554 \protrudechars=0
11555 \fi
11556 \else % XeTeX
11557 \XeTeXprotrudechars=0
11558 \fi
11559 }
11560
11561 \microtypeON
11562
11563 \parseargdef\microtype{%
11564 \def\txiarg{#1}%
11565 \ifx\txiarg\onword
11566 \microtypeON
11567 \else\ifx\txiarg\offword
11568 \microtypeOFF
11569 \else
11570 \errhelp = \EMsimple
11571 \errmessage{Unknown @microtype option `\txiarg', must be on|off}%
11572 \fi\fi
11573 }
11574
11575
11576 \message{and turning on texinfo input format.}
11577
11578 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11579 \catcode`\^^K = 10 % treat vertical tab as whitespace
11580
11581 % DEL is a comment character, in case @c does not suffice.
11582 \catcode`\^^? = 14
11583
11584 % Define macros to output various characters with catcode for normal text.
11585 \catcode`\"=\other \def\normaldoublequote{"}
11586 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11587 \catcode`\+=\other \def\normalplus{+}
11588 \catcode`\<=\other \def\normalless{<}
11589 \catcode`\>=\other \def\normalgreater{>}
11590 \catcode`\^=\other \def\normalcaret{^}
11591 \catcode`\_=\other \def\normalunderscore{_}
11592 \catcode`\|=\other \def\normalverticalbar{|}
11593 \catcode`\~=\other \def\normaltilde{~}
11594
11595 % Set catcodes for Texinfo file
11596
11597 % Active characters for printing the wanted glyph.
11598 % Most of these we simply print from the \tt font, but for some, we can
11599 % use math or other variants that look better in normal text.
11600 %
11601 \catcode`\"=\active
11602 \def\activedoublequote{{\tt\char34}}
11603 \let"=\activedoublequote
11604 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11605 \chardef\hatchar=`\^
11606 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11607
11608 \catcode`\_=\active
11609 \def_{\ifusingtt\normalunderscore\_}
11610 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11611 \let\realunder=_
11612
11613 \catcode`\|=\active \def|{{\tt\char124}}
11614
11615 \chardef \less=`\<
11616 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11617 \chardef \gtr=`\>
11618 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11619 \catcode`\+=\active \def+{{\tt \char 43}}
11620 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11621 \catcode`\-=\active \let-=\normaldash
11622
11623
11624 % used for headline/footline in the output routine, in case the page
11625 % breaks in the middle of an @tex block.
11626 \def\texinfochars{%
11627 \let< = \activeless
11628 \let> = \activegtr
11629 \let~ = \activetilde
11630 \let^ = \activehat
11631 \setregularquotes
11632 \let\b = \strong
11633 \let\i = \smartitalic
11634 % in principle, all other definitions in \tex have to be undone too.
11635 }
11636
11637 % Used sometimes to turn off (effectively) the active characters even after
11638 % parsing them.
11639 \def\turnoffactive{%
11640 \normalturnoffactive
11641 \otherbackslash
11642 }
11643
11644 \catcode`\@=0
11645
11646 % \backslashcurfont outputs one backslash character in current font,
11647 % as in \char`\\.
11648 \global\chardef\backslashcurfont=`\\
11649
11650 % \realbackslash is an actual character `\' with catcode other.
11651 {\catcode`\\=\other @gdef@realbackslash{\}}
11652
11653 % In Texinfo, backslash is an active character; it prints the backslash
11654 % in fixed width font.
11655 \catcode`\\=\active % @ for escape char from now on.
11656
11657 % Print a typewriter backslash. For math mode, we can't simply use
11658 % \backslashcurfont: the story here is that in math mode, the \char
11659 % of \backslashcurfont ends up printing the roman \ from the math symbol
11660 % font (because \char in math mode uses the \mathcode, and plain.tex
11661 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11662 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11663 % ignored family value; char position "5C). We can't use " for the
11664 % usual hex value because it has already been made active.
11665
11666 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11667 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11668
11669 % \otherbackslash defines an active \ to be a literal `\' character with
11670 % catcode other.
11671 @gdef@otherbackslash{@let\=@realbackslash}
11672
11673 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11674 % the literal character `\'.
11675 %
11676 {@catcode`- = @active
11677 @gdef@normalturnoffactive{%
11678 @passthroughcharstrue
11679 @let-=@normaldash
11680 @let"=@normaldoublequote
11681 @let$=@normaldollar %$ font-lock fix
11682 @let+=@normalplus
11683 @let<=@normalless
11684 @let>=@normalgreater
11685 @let^=@normalcaret
11686 @let_=@normalunderscore
11687 @let|=@normalverticalbar
11688 @let~=@normaltilde
11689 @let\=@ttbackslash
11690 @setregularquotes
11691 @unsepspaces
11692 }
11693 }
11694
11695 % If a .fmt file is being used, characters that might appear in a file
11696 % name cannot be active until we have parsed the command line.
11697 % So turn them off again, and have @fixbackslash turn them back on.
11698 @catcode`+=@other @catcode`@_=@other
11699
11700 % \enablebackslashhack - allow file to begin `\input texinfo'
11701 %
11702 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11703 % That is what \eatinput is for; after that, the `\' should revert to printing
11704 % a backslash.
11705 % If the file did not have a `\input texinfo', then it is turned off after
11706 % the first line; otherwise the first `\' in the file would cause an error.
11707 % This is used on the very last line of this file, texinfo.tex.
11708 % We also use @c to call @fixbackslash, in case ends of lines are hidden.
11709 {
11710 @catcode`@^=7
11711 @catcode`@^^M=13@gdef@enablebackslashhack{%
11712 @global@let\ = @eatinput%
11713 @catcode`@^^M=13%
11714 @def@c{@fixbackslash@c}%
11715 % Definition for the newline at the end of this file.
11716 @def ^^M{@let^^M@secondlinenl}%
11717 % Definition for a newline in the main Texinfo file.
11718 @gdef @secondlinenl{@fixbackslash}%
11719 % In case the first line has a whole-line command on it
11720 @let@originalparsearg@parsearg
11721 @def@parsearg{@fixbackslash@originalparsearg}
11722 }}
11723
11724 {@catcode`@^=7 @catcode`@^^M=13%
11725 @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11726
11727 % Emergency active definition of newline, in case an active newline token
11728 % appears by mistake.
11729 {@catcode`@^=7 @catcode13=13%
11730 @gdef@enableemergencynewline{%
11731 @gdef^^M{%
11732 @par%
11733 %<warning: active newline>@par%
11734 }}}
11735
11736
11737 @gdef@fixbackslash{%
11738 @ifx\@eatinput @let\ = @ttbackslash @fi
11739 @catcode13=5 % regular end of line
11740 @enableemergencynewline
11741 @let@c=@comment
11742 @let@parsearg@originalparsearg
11743 % Also turn back on active characters that might appear in the input
11744 % file name, in case not using a pre-dumped format.
11745 @catcode`+=@active
11746 @catcode`@_=@active
11747 %
11748 % If texinfo.cnf is present on the system, read it.
11749 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11750 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11751 % directly in this file, texinfo.tex, makes it possible to make a format
11752 % file for Texinfo.
11753 %
11754 @openin 1 texinfo.cnf
11755 @ifeof 1 @else @input texinfo.cnf @fi
11756 @closein 1
11757 }
11758
11759
11760 % Say @foo, not \foo, in error messages.
11761 @escapechar = `@@
11762
11763 % These (along with & and #) are made active for url-breaking, so need
11764 % active definitions as the normal characters.
11765 @def@normaldot{.}
11766 @def@normalquest{?}
11767 @def@normalslash{/}
11768
11769 % These look ok in all fonts, so just make them not special.
11770 % @hashchar{} gets its own user-level command, because of #line.
11771 @catcode`@& = @other @def@normalamp{&}
11772 @catcode`@# = @other @def@normalhash{#}
11773 @catcode`@% = @other @def@normalpercent{%}
11774
11775 @let @hashchar = @normalhash
11776
11777 @c Finally, make ` and ' active, so that txicodequoteundirected and
11778 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11779 @c don't make ` and ' active, @code will not get them as active chars.
11780 @c Do this last of all since we use ` in the previous @catcode assignments.
11781 @catcode`@'=@active
11782 @catcode`@`=@active
11783 @setregularquotes
11784
11785 @c Local variables:
11786 @c eval: (add-hook 'before-save-hook 'time-stamp nil t)
11787 @c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
11788 @c page-delimiter: "^\\\\message\\|emacs-page"
11789 @c End:
11790
11791 @c vim:sw=2:
11792
11793 @enablebackslashhack
11794
11795