texinfo.tex revision 1.1 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{2021-02-20.11}
7 %
8 % Copyright 1985, 1986, 1988, 1990-2021 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 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
246 \newdimen\topandbottommargin \topandbottommargin=.75in
247
248 % Output a mark which sets \thischapter, \thissection and \thiscolor.
249 % We dump everything together because we only have one kind of mark.
250 % This works because we only use \botmark / \topmark, not \firstmark.
251 %
252 % A mark contains a subexpression of the \ifcase ... \fi construct.
253 % \get*marks macros below extract the needed part using \ifcase.
254 %
255 % Another complication is to let the user choose whether \thischapter
256 % (\thissection) refers to the chapter (section) in effect at the top
257 % of a page, or that at the bottom of a page.
258
259 % \domark is called twice inside \chapmacro, to add one
260 % mark before the section break, and one after.
261 % In the second call \prevchapterdefs is the same as \currentchapterdefs,
262 % and \prevsectiondefs is the same as \currentsectiondefs.
263 % Then if the page is not broken at the mark, some of the previous
264 % section appears on the page, and we can get the name of this section
265 % from \firstmark for @everyheadingmarks top.
266 % @everyheadingmarks bottom uses \botmark.
267 %
268 % See page 260 of The TeXbook.
269 \def\domark{%
270 \toks0=\expandafter{\currentchapterdefs}%
271 \toks2=\expandafter{\currentsectiondefs}%
272 \toks4=\expandafter{\prevchapterdefs}%
273 \toks6=\expandafter{\prevsectiondefs}%
274 \toks8=\expandafter{\currentcolordefs}%
275 \mark{%
276 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
277 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
278 \noexpand\else \the\toks8 % 2: color marks
279 }%
280 }
281
282 % \gettopheadingmarks, \getbottomheadingmarks,
283 % \getcolormarks - extract needed part of mark.
284 %
285 % \topmark doesn't work for the very first chapter (after the title
286 % page or the contents), so we use \firstmark there -- this gets us
287 % the mark with the chapter defs, unless the user sneaks in, e.g.,
288 % @setcolor (or @url, or @link, etc.) between @contents and the very
289 % first @chapter.
290 \def\gettopheadingmarks{%
291 \ifcase0\the\savedtopmark\fi
292 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
293 }
294 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
295 \def\getcolormarks{\ifcase2\the\savedtopmark\fi}
296
297 % Avoid "undefined control sequence" errors.
298 \def\currentchapterdefs{}
299 \def\currentsectiondefs{}
300 \def\currentsection{}
301 \def\prevchapterdefs{}
302 \def\prevsectiondefs{}
303 \def\currentcolordefs{}
304
305 % Margin to add to right of even pages, to left of odd pages.
306 \newdimen\bindingoffset
307 \newdimen\normaloffset
308 \newdimen\txipagewidth \newdimen\txipageheight
309
310 % Main output routine.
311 %
312 \chardef\PAGE = 255
313 \newtoks\defaultoutput
314 \defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
315 \output=\expandafter{\the\defaultoutput}
316
317 \newbox\headlinebox
318 \newbox\footlinebox
319
320 % When outputting the double column layout for indices, an output routine
321 % is run several times, which hides the original value of \topmark. This
322 % can lead to a page heading being output and duplicating the chapter heading
323 % of the index. Hence, save the contents of \topmark at the beginning of
324 % the output routine. The saved contents are valid until we actually
325 % \shipout a page.
326 %
327 % (We used to run a short output routine to actually set \topmark and
328 % \firstmark to the right values, but if this was called with an empty page
329 % containing whatsits for writing index entries, the whatsits would be thrown
330 % away and the index auxiliary file would remain empty.)
331 %
332 \newtoks\savedtopmark
333 \newif\iftopmarksaved
334 \topmarksavedtrue
335 \def\savetopmark{%
336 \iftopmarksaved\else
337 \global\savedtopmark=\expandafter{\topmark}%
338 \global\topmarksavedtrue
339 \fi
340 }
341
342 % \onepageout takes a vbox as an argument.
343 % \shipout a vbox for a single page, adding an optional header, footer
344 % and footnote. This also causes index entries for this page to be written
345 % to the auxiliary files.
346 %
347 \def\onepageout#1{%
348 \hoffset=\normaloffset
349 %
350 \ifodd\pageno \advance\hoffset by \bindingoffset
351 \else \advance\hoffset by -\bindingoffset\fi
352 %
353 \checkchapterpage
354 %
355 % Retrieve the information for the headings from the marks in the page,
356 % and call Plain TeX's \makeheadline and \makefootline, which use the
357 % values in \headline and \footline.
358 %
359 % Common context changes for both heading and footing.
360 % Do this outside of the \shipout so @code etc. will be expanded in
361 % the headline as they should be, not taken literally (outputting ''code).
362 \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
363 %
364 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
365 \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
366 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
367 \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
368 %
369 {%
370 % Set context for writing to auxiliary files like index files.
371 % Have to do this stuff outside the \shipout because we want it to
372 % take effect in \write's, yet the group defined by the \vbox ends
373 % before the \shipout runs.
374 %
375 \atdummies % don't expand commands in the output.
376 \turnoffactive
377 \shipout\vbox{%
378 % Do this early so pdf references go to the beginning of the page.
379 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
380 %
381 \unvbox\headlinebox
382 \pagebody{#1}%
383 \ifdim\ht\footlinebox > 0pt
384 % Only leave this space if the footline is nonempty.
385 % (We lessened \vsize for it in \oddfootingyyy.)
386 % The \baselineskip=24pt in plain's \makefootline has no effect.
387 \vskip 24pt
388 \unvbox\footlinebox
389 \fi
390 %
391 }%
392 }%
393 \global\topmarksavedfalse
394 \advancepageno
395 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
396 }
397
398 \newinsert\margin \dimen\margin=\maxdimen
399
400 % Main part of page, including any footnotes
401 \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
402 {\catcode`\@ =11
403 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
404 % marginal hacks, juha (a] viisa.uucp (Juha Takala)
405 \ifvoid\margin\else % marginal info is present
406 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
407 \dimen@=\dp#1\relax \unvbox#1\relax
408 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
409 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
410 }
411
412 % Check if we are on the first page of a chapter. Used for printing headings.
413 \newif\ifchapterpage
414 \def\checkchapterpage{%
415 % Get the chapter that was current at the end of the last page
416 \ifcase1\the\savedtopmark\fi
417 \let\prevchaptername\thischaptername
418 %
419 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
420 \let\curchaptername\thischaptername
421 %
422 \ifx\curchaptername\prevchaptername
423 \chapterpagefalse
424 \else
425 \chapterpagetrue
426 \fi
427 }
428
429 % Argument parsing
430
431 % Parse an argument, then pass it to #1. The argument is the rest of
432 % the input line (except we remove a trailing comment). #1 should be a
433 % macro which expects an ordinary undelimited TeX argument.
434 % For example, \def\foo{\parsearg\fooxxx}.
435 %
436 \def\parsearg{\parseargusing{}}
437 \def\parseargusing#1#2{%
438 \def\argtorun{#2}%
439 \begingroup
440 \obeylines
441 \spaceisspace
442 #1%
443 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
444 }
445
446 {\obeylines %
447 \gdef\parseargline#1^^M{%
448 \endgroup % End of the group started in \parsearg.
449 \argremovecomment #1\comment\ArgTerm%
450 }%
451 }
452
453 % First remove any @comment, then any @c comment. Pass the result on to
454 % \argcheckspaces.
455 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
456 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
457
458 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
459 %
460 % \argremovec might leave us with trailing space, e.g.,
461 % @end itemize @c foo
462 % This space token undergoes the same procedure and is eventually removed
463 % by \finishparsearg.
464 %
465 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
466 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
467 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
468 \def\temp{#3}%
469 \ifx\temp\empty
470 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
471 \let\temp\finishparsearg
472 \else
473 \let\temp\argcheckspaces
474 \fi
475 % Put the space token in:
476 \temp#1 #3\ArgTerm
477 }
478
479 % If a _delimited_ argument is enclosed in braces, they get stripped; so
480 % to get _exactly_ the rest of the line, we had to prevent such situation.
481 % We prepended an \empty token at the very beginning and we expand it now,
482 % just before passing the control to \argtorun.
483 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
484 % either the null string, or it ends with \^^M---thus there is no danger
485 % that a pair of braces would be stripped.
486 %
487 % But first, we have to remove the trailing space token.
488 %
489 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
490
491
492 % \parseargdef - define a command taking an argument on the line
493 %
494 % \parseargdef\foo{...}
495 % is roughly equivalent to
496 % \def\foo{\parsearg\Xfoo}
497 % \def\Xfoo#1{...}
498 \def\parseargdef#1{%
499 \expandafter \doparseargdef \csname\string#1\endcsname #1%
500 }
501 \def\doparseargdef#1#2{%
502 \def#2{\parsearg#1}%
503 \def#1##1%
504 }
505
506 % Several utility definitions with active space:
507 {
508 \obeyspaces
509 \gdef\obeyedspace{ }
510
511 % Make each space character in the input produce a normal interword
512 % space in the output. Don't allow a line break at this space, as this
513 % is used only in environments like @example, where each line of input
514 % should produce a line of output anyway.
515 %
516 \gdef\sepspaces{\obeyspaces\let =\tie}
517
518 % If an index command is used in an @example environment, any spaces
519 % therein should become regular spaces in the raw index file, not the
520 % expansion of \tie (\leavevmode \penalty \@M \ ).
521 \gdef\unsepspaces{\let =\space}
522 }
523
524
525 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
526
527 % Define the framework for environments in texinfo.tex. It's used like this:
528 %
529 % \envdef\foo{...}
530 % \def\Efoo{...}
531 %
532 % It's the responsibility of \envdef to insert \begingroup before the
533 % actual body; @end closes the group after calling \Efoo. \envdef also
534 % defines \thisenv, so the current environment is known; @end checks
535 % whether the environment name matches. The \checkenv macro can also be
536 % used to check whether the current environment is the one expected.
537 %
538 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
539 % are not treated as environments; they don't open a group. (The
540 % implementation of @end takes care not to call \endgroup in this
541 % special case.)
542
543
544 % At run-time, environments start with this:
545 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
546 % initialize
547 \let\thisenv\empty
548
549 % ... but they get defined via ``\envdef\foo{...}'':
550 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
551 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
552
553 % Check whether we're in the right environment:
554 \def\checkenv#1{%
555 \def\temp{#1}%
556 \ifx\thisenv\temp
557 \else
558 \badenverr
559 \fi
560 }
561
562 % Environment mismatch, #1 expected:
563 \def\badenverr{%
564 \errhelp = \EMsimple
565 \errmessage{This command can appear only \inenvironment\temp,
566 not \inenvironment\thisenv}%
567 }
568 \def\inenvironment#1{%
569 \ifx#1\empty
570 outside of any environment%
571 \else
572 in environment \expandafter\string#1%
573 \fi
574 }
575
576
577 % @end foo calls \checkenv and executes the definition of \Efoo.
578 \parseargdef\end{
579 \if 1\csname iscond.#1\endcsname
580 \else
581 % The general wording of \badenverr may not be ideal.
582 \expandafter\checkenv\csname#1\endcsname
583 \csname E#1\endcsname
584 \endgroup
585 \fi
586 }
587
588 \newhelp\EMsimple{Press RETURN to continue.}
589
590
591 % Be sure we're in horizontal mode when doing a tie, since we make space
592 % equivalent to this in @example-like environments. Otherwise, a space
593 % at the beginning of a line will start with \penalty -- and
594 % since \penalty is valid in vertical mode, we'd end up putting the
595 % penalty on the vertical list instead of in the new paragraph.
596 {\catcode`@ = 11
597 % Avoid using \@M directly, because that causes trouble
598 % if the definition is written into an index file.
599 \global\let\tiepenalty = \@M
600 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
601 }
602
603 % @: forces normal size whitespace following.
604 \def\:{\spacefactor=1000 }
605
606 % @* forces a line break.
607 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
608
609 % @/ allows a line break.
610 \let\/=\allowbreak
611
612 % @. is an end-of-sentence period.
613 \def\.{.\spacefactor=\endofsentencespacefactor\space}
614
615 % @! is an end-of-sentence bang.
616 \def\!{!\spacefactor=\endofsentencespacefactor\space}
617
618 % @? is an end-of-sentence query.
619 \def\?{?\spacefactor=\endofsentencespacefactor\space}
620
621 % @frenchspacing on|off says whether to put extra space after punctuation.
622 %
623 \def\onword{on}
624 \def\offword{off}
625 %
626 \parseargdef\frenchspacing{%
627 \def\temp{#1}%
628 \ifx\temp\onword \plainfrenchspacing
629 \else\ifx\temp\offword \plainnonfrenchspacing
630 \else
631 \errhelp = \EMsimple
632 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
633 \fi\fi
634 }
635
636 % @w prevents a word break. Without the \leavevmode, @w at the
637 % beginning of a paragraph, when TeX is still in vertical mode, would
638 % produce a whole line of output instead of starting the paragraph.
639 \def\w#1{\leavevmode\hbox{#1}}
640
641 % @group ... @end group forces ... to be all on one page, by enclosing
642 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
643 % to keep its height that of a normal line. According to the rules for
644 % \topskip (p.114 of the TeXbook), the glue inserted is
645 % max (\topskip - \ht (first item), 0). If that height is large,
646 % therefore, no glue is inserted, and the space between the headline and
647 % the text is small, which looks bad.
648 %
649 % Another complication is that the group might be very large. This can
650 % cause the glue on the previous page to be unduly stretched, because it
651 % does not have much material. In this case, it's better to add an
652 % explicit \vfill so that the extra space is at the bottom. The
653 % threshold for doing this is if the group is more than \vfilllimit
654 % percent of a page (\vfilllimit can be changed inside of @tex).
655 %
656 \newbox\groupbox
657 \def\vfilllimit{0.7}
658 %
659 \envdef\group{%
660 \ifnum\catcode`\^^M=\active \else
661 \errhelp = \groupinvalidhelp
662 \errmessage{@group invalid in context where filling is enabled}%
663 \fi
664 \startsavinginserts
665 %
666 \setbox\groupbox = \vtop\bgroup
667 % Do @comment since we are called inside an environment such as
668 % @example, where each end-of-line in the input causes an
669 % end-of-line in the output. We don't want the end-of-line after
670 % the `@group' to put extra space in the output. Since @group
671 % should appear on a line by itself (according to the Texinfo
672 % manual), we don't worry about eating any user text.
673 \comment
674 }
675 %
676 % The \vtop produces a box with normal height and large depth; thus, TeX puts
677 % \baselineskip glue before it, and (when the next line of text is done)
678 % \lineskip glue after it. Thus, space below is not quite equal to space
679 % above. But it's pretty close.
680 \def\Egroup{%
681 % To get correct interline space between the last line of the group
682 % and the first line afterwards, we have to propagate \prevdepth.
683 \endgraf % Not \par, as it may have been set to \lisppar.
684 \global\dimen1 = \prevdepth
685 \egroup % End the \vtop.
686 \addgroupbox
687 \prevdepth = \dimen1
688 \checkinserts
689 }
690
691 \def\addgroupbox{
692 % \dimen0 is the vertical size of the group's box.
693 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
694 % \dimen2 is how much space is left on the page (more or less).
695 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
696 % if the group doesn't fit on the current page, and it's a big big
697 % group, force a page break.
698 \ifdim \dimen0 > \dimen2
699 \ifdim \pagetotal < \vfilllimit\txipageheight
700 \page
701 \fi
702 \fi
703 \box\groupbox
704 }
705
706 %
707 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
708 % message, so this ends up printing `@group can only ...'.
709 %
710 \newhelp\groupinvalidhelp{%
711 group can only be used in environments such as @example,^^J%
712 where each line of input produces a line of output.}
713
714 % @need space-in-mils
715 % forces a page break if there is not space-in-mils remaining.
716
717 \newdimen\mil \mil=0.001in
718
719 \parseargdef\need{%
720 % Ensure vertical mode, so we don't make a big box in the middle of a
721 % paragraph.
722 \par
723 %
724 % If the @need value is less than one line space, it's useless.
725 \dimen0 = #1\mil
726 \dimen2 = \ht\strutbox
727 \advance\dimen2 by \dp\strutbox
728 \ifdim\dimen0 > \dimen2
729 %
730 % Do a \strut just to make the height of this box be normal, so the
731 % normal leading is inserted relative to the preceding line.
732 % And a page break here is fine.
733 \vtop to #1\mil{\strut\vfil}%
734 %
735 % TeX does not even consider page breaks if a penalty added to the
736 % main vertical list is 10000 or more. But in order to see if the
737 % empty box we just added fits on the page, we must make it consider
738 % page breaks. On the other hand, we don't want to actually break the
739 % page after the empty box. So we use a penalty of 9999.
740 %
741 % There is an extremely small chance that TeX will actually break the
742 % page at this \penalty, if there are no other feasible breakpoints in
743 % sight. (If the user is using lots of big @group commands, which
744 % almost-but-not-quite fill up a page, TeX will have a hard time doing
745 % good page breaking, for example.) However, I could not construct an
746 % example where a page broke at this \penalty; if it happens in a real
747 % document, then we can reconsider our strategy.
748 \penalty9999
749 %
750 % Back up by the size of the box, whether we did a page break or not.
751 \kern -#1\mil
752 %
753 % Do not allow a page break right after this kern.
754 \nobreak
755 \fi
756 }
757
758 % @br forces paragraph break (and is undocumented).
759
760 \let\br = \par
761
762 % @page forces the start of a new page.
763 %
764 \def\page{\par\vfill\supereject}
765
766 % @exdent text....
767 % outputs text on separate line in roman font, starting at standard page margin
768
769 % This records the amount of indent in the innermost environment.
770 % That's how much \exdent should take out.
771 \newskip\exdentamount
772
773 % This defn is used inside fill environments such as @defun.
774 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
775
776 % This defn is used inside nofill environments such as @example.
777 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
778 \leftline{\hskip\leftskip{\rm#1}}}}
779
780 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
781 % paragraph. For more general purposes, use the \margin insertion
782 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
783 %
784 \newskip\inmarginspacing \inmarginspacing=1cm
785 \def\strutdepth{\dp\strutbox}
786 %
787 \def\doinmargin#1#2{\strut\vadjust{%
788 \nobreak
789 \kern-\strutdepth
790 \vtop to \strutdepth{%
791 \baselineskip=\strutdepth
792 \vss
793 % if you have multiple lines of stuff to put here, you'll need to
794 % make the vbox yourself of the appropriate size.
795 \ifx#1l%
796 \llap{\ignorespaces #2\hskip\inmarginspacing}%
797 \else
798 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
799 \fi
800 \null
801 }%
802 }}
803 \def\inleftmargin{\doinmargin l}
804 \def\inrightmargin{\doinmargin r}
805 %
806 % @inmargin{TEXT [, RIGHT-TEXT]}
807 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
808 % else use TEXT for both).
809 %
810 \def\inmargin#1{\parseinmargin #1,,\finish}
811 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
812 \setbox0 = \hbox{\ignorespaces #2}%
813 \ifdim\wd0 > 0pt
814 \def\lefttext{#1}% have both texts
815 \def\righttext{#2}%
816 \else
817 \def\lefttext{#1}% have only one text
818 \def\righttext{#1}%
819 \fi
820 %
821 \ifodd\pageno
822 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
823 \else
824 \def\temp{\inleftmargin\lefttext}%
825 \fi
826 \temp
827 }
828
829 % @include FILE -- \input text of FILE.
830 %
831 \def\include{\parseargusing\filenamecatcodes\includezzz}
832 \def\includezzz#1{%
833 \pushthisfilestack
834 \def\thisfile{#1}%
835 {%
836 \makevalueexpandable % we want to expand any @value in FILE.
837 \turnoffactive % and allow special characters in the expansion
838 \indexnofonts % Allow `@@' and other weird things in file names.
839 \wlog{texinfo.tex: doing @include of #1^^J}%
840 \edef\temp{\noexpand\input #1 }%
841 %
842 % This trickery is to read FILE outside of a group, in case it makes
843 % definitions, etc.
844 \expandafter
845 }\temp
846 \popthisfilestack
847 }
848 \def\filenamecatcodes{%
849 \catcode`\\=\other
850 \catcode`~=\other
851 \catcode`^=\other
852 \catcode`_=\other
853 \catcode`|=\other
854 \catcode`<=\other
855 \catcode`>=\other
856 \catcode`+=\other
857 \catcode`-=\other
858 \catcode`\`=\other
859 \catcode`\'=\other
860 }
861
862 \def\pushthisfilestack{%
863 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
864 }
865 \def\pushthisfilestackX{%
866 \expandafter\pushthisfilestackY\thisfile\StackTerm
867 }
868 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
869 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
870 }
871
872 \def\popthisfilestack{\errthisfilestackempty}
873 \def\errthisfilestackempty{\errmessage{Internal error:
874 the stack of filenames is empty.}}
875 %
876 \def\thisfile{}
877
878 % @center line
879 % outputs that line, centered.
880 %
881 \parseargdef\center{%
882 \ifhmode
883 \let\centersub\centerH
884 \else
885 \let\centersub\centerV
886 \fi
887 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
888 \let\centersub\relax % don't let the definition persist, just in case
889 }
890 \def\centerH#1{{%
891 \hfil\break
892 \advance\hsize by -\leftskip
893 \advance\hsize by -\rightskip
894 \line{#1}%
895 \break
896 }}
897 %
898 \newcount\centerpenalty
899 \def\centerV#1{%
900 % The idea here is the same as in \startdefun, \cartouche, etc.: if
901 % @center is the first thing after a section heading, we need to wipe
902 % out the negative parskip inserted by \sectionheading, but still
903 % prevent a page break here.
904 \centerpenalty = \lastpenalty
905 \ifnum\centerpenalty>10000 \vskip\parskip \fi
906 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
907 \line{\kern\leftskip #1\kern\rightskip}%
908 }
909
910 % @sp n outputs n lines of vertical space
911 %
912 \parseargdef\sp{\vskip #1\baselineskip}
913
914 % @comment ...line which is ignored...
915 % @c is the same as @comment
916 % @ignore ... @end ignore is another way to write a comment
917
918
919 \def\c{\begingroup \catcode`\^^M=\active%
920 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
921 \cxxx}
922 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
923 %
924 \let\comment\c
925
926 % @paragraphindent NCHARS
927 % We'll use ems for NCHARS, close enough.
928 % NCHARS can also be the word `asis' or `none'.
929 % We cannot feasibly implement @paragraphindent asis, though.
930 %
931 \def\asisword{asis} % no translation, these are keywords
932 \def\noneword{none}
933 %
934 \parseargdef\paragraphindent{%
935 \def\temp{#1}%
936 \ifx\temp\asisword
937 \else
938 \ifx\temp\noneword
939 \defaultparindent = 0pt
940 \else
941 \defaultparindent = #1em
942 \fi
943 \fi
944 \parindent = \defaultparindent
945 }
946
947 % @exampleindent NCHARS
948 % We'll use ems for NCHARS like @paragraphindent.
949 % It seems @exampleindent asis isn't necessary, but
950 % I preserve it to make it similar to @paragraphindent.
951 \parseargdef\exampleindent{%
952 \def\temp{#1}%
953 \ifx\temp\asisword
954 \else
955 \ifx\temp\noneword
956 \lispnarrowing = 0pt
957 \else
958 \lispnarrowing = #1em
959 \fi
960 \fi
961 }
962
963 % @firstparagraphindent WORD
964 % If WORD is `none', then suppress indentation of the first paragraph
965 % after a section heading. If WORD is `insert', then do indent at such
966 % paragraphs.
967 %
968 % The paragraph indentation is suppressed or not by calling
969 % \suppressfirstparagraphindent, which the sectioning commands do.
970 % We switch the definition of this back and forth according to WORD.
971 % By default, we suppress indentation.
972 %
973 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
974 \def\insertword{insert}
975 %
976 \parseargdef\firstparagraphindent{%
977 \def\temp{#1}%
978 \ifx\temp\noneword
979 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
980 \else\ifx\temp\insertword
981 \let\suppressfirstparagraphindent = \relax
982 \else
983 \errhelp = \EMsimple
984 \errmessage{Unknown @firstparagraphindent option `\temp'}%
985 \fi\fi
986 }
987
988 % Here is how we actually suppress indentation. Redefine \everypar to
989 % \kern backwards by \parindent, and then reset itself to empty.
990 %
991 % We also make \indent itself not actually do anything until the next
992 % paragraph.
993 %
994 \gdef\dosuppressfirstparagraphindent{%
995 \gdef\indent {\restorefirstparagraphindent \indent}%
996 \gdef\noindent{\restorefirstparagraphindent \noindent}%
997 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
998 }
999 %
1000 \gdef\restorefirstparagraphindent{%
1001 \global\let\indent = \ptexindent
1002 \global\let\noindent = \ptexnoindent
1003 \global\everypar = {}%
1004 }
1005
1006
1007 % @refill is a no-op.
1008 \let\refill=\relax
1009
1010 % @setfilename INFO-FILENAME - ignored
1011 \let\setfilename=\comment
1012
1013 % @bye.
1014 \outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
1015
1016
1017 \message{pdf,}
1018 % adobe `portable' document format
1019 \newcount\tempnum
1020 \newcount\lnkcount
1021 \newtoks\filename
1022 \newcount\filenamelength
1023 \newcount\pgn
1024 \newtoks\toksA
1025 \newtoks\toksB
1026 \newtoks\toksC
1027 \newtoks\toksD
1028 \newbox\boxA
1029 \newbox\boxB
1030 \newcount\countA
1031 \newif\ifpdf
1032 \newif\ifpdfmakepagedest
1033
1034 %
1035 % For LuaTeX
1036 %
1037
1038 \newif\iftxiuseunicodedestname
1039 \txiuseunicodedestnamefalse % For pdfTeX etc.
1040
1041 \ifx\luatexversion\thisisundefined
1042 \else
1043 % Use Unicode destination names
1044 \txiuseunicodedestnametrue
1045 % Escape PDF strings with converting UTF-16 from UTF-8
1046 \begingroup
1047 \catcode`\%=12
1048 \directlua{
1049 function UTF16oct(str)
1050 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1051 for c in string.utfvalues(str) do
1052 if c < 0x10000 then
1053 tex.sprint(
1054 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1055 string.char(0x5c) .. string.char(0x25) .. '03o',
1056 math.floor(c / 256), math.floor(c % 256)))
1057 else
1058 c = c - 0x10000
1059 local c_hi = c / 1024 + 0xd800
1060 local c_lo = c % 1024 + 0xdc00
1061 tex.sprint(
1062 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1063 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1064 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1065 string.char(0x5c) .. string.char(0x25) .. '03o',
1066 math.floor(c_hi / 256), math.floor(c_hi % 256),
1067 math.floor(c_lo / 256), math.floor(c_lo % 256)))
1068 end
1069 end
1070 end
1071 }
1072 \endgroup
1073 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1074 % Escape PDF strings without converting
1075 \begingroup
1076 \directlua{
1077 function PDFescstr(str)
1078 for c in string.bytes(str) do
1079 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1080 tex.sprint(-2,
1081 string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1082 c))
1083 else
1084 tex.sprint(-2, string.char(c))
1085 end
1086 end
1087 end
1088 }
1089 % The -2 in the arguments here gives all the input to TeX catcode 12
1090 % (other) or 10 (space), preventing undefined control sequence errors. See
1091 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
1092 %
1093 \endgroup
1094 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1095 \ifnum\luatexversion>84
1096 % For LuaTeX >= 0.85
1097 \def\pdfdest{\pdfextension dest}
1098 \let\pdfoutput\outputmode
1099 \def\pdfliteral{\pdfextension literal}
1100 \def\pdfcatalog{\pdfextension catalog}
1101 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1102 \let\pdfximage\saveimageresource
1103 \let\pdfrefximage\useimageresource
1104 \let\pdflastximage\lastsavedimageresourceindex
1105 \def\pdfendlink{\pdfextension endlink\relax}
1106 \def\pdfoutline{\pdfextension outline}
1107 \def\pdfstartlink{\pdfextension startlink}
1108 \def\pdffontattr{\pdfextension fontattr}
1109 \def\pdfobj{\pdfextension obj}
1110 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1111 \let\pdfpagewidth\pagewidth
1112 \let\pdfpageheight\pageheight
1113 \edef\pdfhorigin{\pdfvariable horigin}
1114 \edef\pdfvorigin{\pdfvariable vorigin}
1115 \fi
1116 \fi
1117
1118 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1119 % can be set). So we test for \relax and 0 as well as being undefined.
1120 \ifx\pdfoutput\thisisundefined
1121 \else
1122 \ifx\pdfoutput\relax
1123 \else
1124 \ifcase\pdfoutput
1125 \else
1126 \pdftrue
1127 \fi
1128 \fi
1129 \fi
1130
1131 \newif\ifpdforxetex
1132 \pdforxetexfalse
1133 \ifpdf
1134 \pdforxetextrue
1135 \fi
1136 \ifx\XeTeXrevision\thisisundefined\else
1137 \pdforxetextrue
1138 \fi
1139
1140
1141 % Output page labels information.
1142 % See PDF reference v.1.7 p.594, section 8.3.1.
1143 \ifpdf
1144 \def\pagelabels{%
1145 \def\title{0 << /P (T-) /S /D >>}%
1146 \edef\roman{\the\romancount << /S /r >>}%
1147 \edef\arabic{\the\arabiccount << /S /D >>}%
1148 %
1149 % Page label ranges must be increasing. Remove any duplicates.
1150 % (There is a slight chance of this being wrong if e.g. there is
1151 % a @contents but no @titlepage, etc.)
1152 %
1153 \ifnum\romancount=0 \def\roman{}\fi
1154 \ifnum\arabiccount=0 \def\title{}%
1155 \else
1156 \ifnum\romancount=\arabiccount \def\roman{}\fi
1157 \fi
1158 %
1159 \ifnum\romancount<\arabiccount
1160 \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax
1161 \else
1162 \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax
1163 \fi
1164 }
1165 \else
1166 \let\pagelabels\relax
1167 \fi
1168
1169 \newcount\pagecount \pagecount=0
1170 \newcount\romancount \romancount=0
1171 \newcount\arabiccount \arabiccount=0
1172 \ifpdf
1173 \let\ptxadvancepageno\advancepageno
1174 \def\advancepageno{%
1175 \ptxadvancepageno\global\advance\pagecount by 1
1176 }
1177 \fi
1178
1179
1180 % PDF uses PostScript string constants for the names of xref targets,
1181 % for display in the outlines, and in other places. Thus, we have to
1182 % double any backslashes. Otherwise, a name like "\node" will be
1183 % interpreted as a newline (\n), followed by o, d, e. Not good.
1184 %
1185 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1186 % related messages. The final outcome is that it is up to the TeX user
1187 % to double the backslashes and otherwise make the string valid, so
1188 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1189 % do this reliably, so we use it.
1190
1191 % #1 is a control sequence in which to do the replacements,
1192 % which we \xdef.
1193 \def\txiescapepdf#1{%
1194 \ifx\pdfescapestring\thisisundefined
1195 % No primitive available; should we give a warning or log?
1196 % Many times it won't matter.
1197 \xdef#1{#1}%
1198 \else
1199 % The expandable \pdfescapestring primitive escapes parentheses,
1200 % backslashes, and other special chars.
1201 \xdef#1{\pdfescapestring{#1}}%
1202 \fi
1203 }
1204 \def\txiescapepdfutfsixteen#1{%
1205 \ifx\pdfescapestrutfsixteen\thisisundefined
1206 % No UTF-16 converting macro available.
1207 \txiescapepdf{#1}%
1208 \else
1209 \xdef#1{\pdfescapestrutfsixteen{#1}}%
1210 \fi
1211 }
1212
1213 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1214 with PDF output, and none of those formats could be found. (.eps cannot
1215 be supported due to the design of the PDF format; use regular TeX (DVI
1216 output) for that.)}
1217
1218 \ifpdf
1219 %
1220 % Color manipulation macros using ideas from pdfcolor.tex,
1221 % except using rgb instead of cmyk; the latter is said to render as a
1222 % very dark gray on-screen and a very dark halftone in print, instead
1223 % of actual black. The dark red here is dark enough to print on paper as
1224 % nearly black, but still distinguishable for online viewing. We use
1225 % black by default, though.
1226 \def\rgbDarkRed{0.50 0.09 0.12}
1227 \def\rgbBlack{0 0 0}
1228 %
1229 % rg sets the color for filling (usual text, etc.);
1230 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1231 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1232 %
1233 % Set color, and create a mark which defines \thiscolor accordingly,
1234 % so that \makeheadline knows which color to restore.
1235 \def\setcolor#1{%
1236 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1237 \domark
1238 \pdfsetcolor{#1}%
1239 }
1240 %
1241 \def\maincolor{\rgbBlack}
1242 \pdfsetcolor{\maincolor}
1243 \edef\thiscolor{\maincolor}
1244 \def\currentcolordefs{}
1245 %
1246 \def\makefootline{%
1247 \baselineskip24pt
1248 \line{\pdfsetcolor{\maincolor}\the\footline}%
1249 }
1250 %
1251 \def\makeheadline{%
1252 \vbox to 0pt{%
1253 \vskip-22.5pt
1254 \line{%
1255 \vbox to8.5pt{}%
1256 % Extract \thiscolor definition from the marks.
1257 \getcolormarks
1258 % Typeset the headline with \maincolor, then restore the color.
1259 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1260 }%
1261 \vss
1262 }%
1263 \nointerlineskip
1264 }
1265 %
1266 %
1267 \pdfcatalog{/PageMode /UseOutlines}
1268 %
1269 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1270 \def\dopdfimage#1#2#3{%
1271 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1272 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1273 %
1274 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1275 % others). Let's try in that order, PDF first since if
1276 % someone has a scalable image, presumably better to use that than a
1277 % bitmap.
1278 \let\pdfimgext=\empty
1279 \begingroup
1280 \openin 1 #1.pdf \ifeof 1
1281 \openin 1 #1.PDF \ifeof 1
1282 \openin 1 #1.png \ifeof 1
1283 \openin 1 #1.jpg \ifeof 1
1284 \openin 1 #1.jpeg \ifeof 1
1285 \openin 1 #1.JPG \ifeof 1
1286 \errhelp = \nopdfimagehelp
1287 \errmessage{Could not find image file #1 for pdf}%
1288 \else \gdef\pdfimgext{JPG}%
1289 \fi
1290 \else \gdef\pdfimgext{jpeg}%
1291 \fi
1292 \else \gdef\pdfimgext{jpg}%
1293 \fi
1294 \else \gdef\pdfimgext{png}%
1295 \fi
1296 \else \gdef\pdfimgext{PDF}%
1297 \fi
1298 \else \gdef\pdfimgext{pdf}%
1299 \fi
1300 \closein 1
1301 \endgroup
1302 %
1303 % without \immediate, ancient pdftex seg faults when the same image is
1304 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1305 \ifnum\pdftexversion < 14
1306 \immediate\pdfimage
1307 \else
1308 \immediate\pdfximage
1309 \fi
1310 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1311 \ifdim \wd2 >0pt height \pdfimageheight \fi
1312 \ifnum\pdftexversion<13
1313 #1.\pdfimgext
1314 \else
1315 {#1.\pdfimgext}%
1316 \fi
1317 \ifnum\pdftexversion < 14 \else
1318 \pdfrefximage \pdflastximage
1319 \fi}
1320 %
1321 \def\setpdfdestname#1{{%
1322 % We have to set dummies so commands such as @code, and characters
1323 % such as \, aren't expanded when present in a section title.
1324 \indexnofonts
1325 \makevalueexpandable
1326 \turnoffactive
1327 \iftxiuseunicodedestname
1328 \ifx \declaredencoding \latone
1329 % Pass through Latin-1 characters.
1330 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1331 \else
1332 \ifx \declaredencoding \utfeight
1333 % Pass through Unicode characters.
1334 \else
1335 % Use ASCII approximations in destination names.
1336 \passthroughcharsfalse
1337 \fi
1338 \fi
1339 \else
1340 % Use ASCII approximations in destination names.
1341 \passthroughcharsfalse
1342 \fi
1343 \def\pdfdestname{#1}%
1344 \txiescapepdf\pdfdestname
1345 }}
1346 %
1347 \def\setpdfoutlinetext#1{{%
1348 \indexnofonts
1349 \makevalueexpandable
1350 \turnoffactive
1351 \ifx \declaredencoding \latone
1352 % The PDF format can use an extended form of Latin-1 in bookmark
1353 % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1354 % the "PDFDocEncoding".
1355 \passthroughcharstrue
1356 % Pass through Latin-1 characters.
1357 % LuaTeX: Convert to Unicode
1358 % pdfTeX: Use Latin-1 as PDFDocEncoding
1359 \def\pdfoutlinetext{#1}%
1360 \else
1361 \ifx \declaredencoding \utfeight
1362 \ifx\luatexversion\thisisundefined
1363 % For pdfTeX with UTF-8.
1364 % TODO: the PDF format can use UTF-16 in bookmark strings,
1365 % but the code for this isn't done yet.
1366 % Use ASCII approximations.
1367 \passthroughcharsfalse
1368 \def\pdfoutlinetext{#1}%
1369 \else
1370 % For LuaTeX with UTF-8.
1371 % Pass through Unicode characters for title texts.
1372 \passthroughcharstrue
1373 \def\pdfoutlinetext{#1}%
1374 \fi
1375 \else
1376 % For non-Latin-1 or non-UTF-8 encodings.
1377 % Use ASCII approximations.
1378 \passthroughcharsfalse
1379 \def\pdfoutlinetext{#1}%
1380 \fi
1381 \fi
1382 % LuaTeX: Convert to UTF-16
1383 % pdfTeX: Use Latin-1 as PDFDocEncoding
1384 \txiescapepdfutfsixteen\pdfoutlinetext
1385 }}
1386 %
1387 \def\pdfmkdest#1{%
1388 \setpdfdestname{#1}%
1389 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1390 }
1391 %
1392 % used to mark target names; must be expandable.
1393 \def\pdfmkpgn#1{#1}
1394 %
1395 % by default, use black for everything.
1396 \def\urlcolor{\rgbBlack}
1397 \def\linkcolor{\rgbBlack}
1398 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1399 %
1400 % Adding outlines to PDF; macros for calculating structure of outlines
1401 % come from Petr Olsak
1402 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1403 \else \csname#1\endcsname \fi}
1404 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1405 \advance\tempnum by 1
1406 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1407 %
1408 % #1 is the section text, which is what will be displayed in the
1409 % outline by the pdf viewer. #2 is the pdf expression for the number
1410 % of subentries (or empty, for subsubsections). #3 is the node text,
1411 % which might be empty if this toc entry had no corresponding node.
1412 % #4 is the page number
1413 %
1414 \def\dopdfoutline#1#2#3#4{%
1415 % Generate a link to the node text if that exists; else, use the
1416 % page number. We could generate a destination for the section
1417 % text in the case where a section has no node, but it doesn't
1418 % seem worth the trouble, since most documents are normally structured.
1419 \setpdfoutlinetext{#1}
1420 \setpdfdestname{#3}
1421 \ifx\pdfdestname\empty
1422 \def\pdfdestname{#4}%
1423 \fi
1424 %
1425 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
1426 }
1427 %
1428 \def\pdfmakeoutlines{%
1429 \begingroup
1430 % Read toc silently, to get counts of subentries for \pdfoutline.
1431 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1432 \def\numchapentry##1##2##3##4{%
1433 \def\thischapnum{##2}%
1434 \def\thissecnum{0}%
1435 \def\thissubsecnum{0}%
1436 }%
1437 \def\numsecentry##1##2##3##4{%
1438 \advancenumber{chap\thischapnum}%
1439 \def\thissecnum{##2}%
1440 \def\thissubsecnum{0}%
1441 }%
1442 \def\numsubsecentry##1##2##3##4{%
1443 \advancenumber{sec\thissecnum}%
1444 \def\thissubsecnum{##2}%
1445 }%
1446 \def\numsubsubsecentry##1##2##3##4{%
1447 \advancenumber{subsec\thissubsecnum}%
1448 }%
1449 \def\thischapnum{0}%
1450 \def\thissecnum{0}%
1451 \def\thissubsecnum{0}%
1452 %
1453 % use \def rather than \let here because we redefine \chapentry et
1454 % al. a second time, below.
1455 \def\appentry{\numchapentry}%
1456 \def\appsecentry{\numsecentry}%
1457 \def\appsubsecentry{\numsubsecentry}%
1458 \def\appsubsubsecentry{\numsubsubsecentry}%
1459 \def\unnchapentry{\numchapentry}%
1460 \def\unnsecentry{\numsecentry}%
1461 \def\unnsubsecentry{\numsubsecentry}%
1462 \def\unnsubsubsecentry{\numsubsubsecentry}%
1463 \readdatafile{toc}%
1464 %
1465 % Read toc second time, this time actually producing the outlines.
1466 % The `-' means take the \expnumber as the absolute number of
1467 % subentries, which we calculated on our first read of the .toc above.
1468 %
1469 % We use the node names as the destinations.
1470 %
1471 % Currently we prefix the section name with the section number
1472 % for chapter and appendix headings only in order to avoid too much
1473 % horizontal space being required in the PDF viewer.
1474 \def\numchapentry##1##2##3##4{%
1475 \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1476 \def\unnchapentry##1##2##3##4{%
1477 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1478 \def\numsecentry##1##2##3##4{%
1479 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1480 \def\numsubsecentry##1##2##3##4{%
1481 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1482 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1483 \dopdfoutline{##1}{}{##3}{##4}}%
1484 %
1485 % PDF outlines are displayed using system fonts, instead of
1486 % document fonts. Therefore we cannot use special characters,
1487 % since the encoding is unknown. For example, the eogonek from
1488 % Latin 2 (0xea) gets translated to a | character. Info from
1489 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1490 %
1491 % TODO this right, we have to translate 8-bit characters to
1492 % their "best" equivalent, based on the @documentencoding. Too
1493 % much work for too little return. Just use the ASCII equivalents
1494 % we use for the index sort strings.
1495 %
1496 \indexnofonts
1497 \setupdatafile
1498 % We can have normal brace characters in the PDF outlines, unlike
1499 % Texinfo index files. So set that up.
1500 \def\{{\lbracecharliteral}%
1501 \def\}{\rbracecharliteral}%
1502 \catcode`\\=\active \otherbackslash
1503 \input \tocreadfilename
1504 \endgroup
1505 }
1506 {\catcode`[=1 \catcode`]=2
1507 \catcode`{=\other \catcode`}=\other
1508 \gdef\lbracecharliteral[{]%
1509 \gdef\rbracecharliteral[}]%
1510 ]
1511 %
1512 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1513 \ifx\PP\D\let\nextsp\relax
1514 \else\let\nextsp\skipspaces
1515 \addtokens{\filename}{\PP}%
1516 \advance\filenamelength by 1
1517 \fi
1518 \nextsp}
1519 \def\getfilename#1{%
1520 \filenamelength=0
1521 % If we don't expand the argument now, \skipspaces will get
1522 % snagged on things like "@value{foo}".
1523 \edef\temp{#1}%
1524 \expandafter\skipspaces\temp|\relax
1525 }
1526 \ifnum\pdftexversion < 14
1527 \let \startlink \pdfannotlink
1528 \else
1529 \let \startlink \pdfstartlink
1530 \fi
1531 % make a live url in pdf output.
1532 \def\pdfurl#1{%
1533 \begingroup
1534 % it seems we really need yet another set of dummies; have not
1535 % tried to figure out what each command should do in the context
1536 % of @url. for now, just make @/ a no-op, that's the only one
1537 % people have actually reported a problem with.
1538 %
1539 \normalturnoffactive
1540 \def\@{@}%
1541 \let\/=\empty
1542 \makevalueexpandable
1543 % do we want to go so far as to use \indexnofonts instead of just
1544 % special-casing \var here?
1545 \def\var##1{##1}%
1546 %
1547 \leavevmode\setcolor{\urlcolor}%
1548 \startlink attr{/Border [0 0 0]}%
1549 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1550 \endgroup}
1551 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
1552 % be a simple number, or a list of numbers in the case of an index
1553 % entry.
1554 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1555 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1556 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1557 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1558 \def\maketoks{%
1559 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1560 \ifx\first0\adn0
1561 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1562 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1563 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1564 \else
1565 \ifnum0=\countA\else\makelink\fi
1566 \ifx\first.\let\next=\done\else
1567 \let\next=\maketoks
1568 \addtokens{\toksB}{\the\toksD}
1569 \ifx\first,\addtokens{\toksB}{\space}\fi
1570 \fi
1571 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1572 \next}
1573 \def\makelink{\addtokens{\toksB}%
1574 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1575 \def\pdflink#1{%
1576 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1577 \setcolor{\linkcolor}#1\endlink}
1578 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1579 \else
1580 % non-pdf mode
1581 \let\pdfmkdest = \gobble
1582 \let\pdfurl = \gobble
1583 \let\endlink = \relax
1584 \let\setcolor = \gobble
1585 \let\pdfsetcolor = \gobble
1586 \let\pdfmakeoutlines = \relax
1587 \fi % \ifx\pdfoutput
1588
1589 %
1590 % For XeTeX
1591 %
1592 \ifx\XeTeXrevision\thisisundefined
1593 \else
1594 %
1595 % XeTeX version check
1596 %
1597 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1598 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1599 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1600 % For avoiding PDF destination name replacement, we use this special
1601 % instead of xdvipdfmx's command line option `-C 0x0010'.
1602 \special{dvipdfmx:config C 0x0010}
1603 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1604 % It can handle Unicode destination names for PDF.
1605 \txiuseunicodedestnametrue
1606 \else
1607 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1608 % `dvipdfmx:config' special.
1609 % So for avoiding PDF destination name replacement,
1610 % xdvipdfmx's command line option `-C 0x0010' is necessary.
1611 %
1612 % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1613 % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1614 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1615 \txiuseunicodedestnamefalse
1616 \fi
1617 %
1618 % Color support
1619 %
1620 \def\rgbDarkRed{0.50 0.09 0.12}
1621 \def\rgbBlack{0 0 0}
1622 %
1623 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1624 %
1625 % Set color, and create a mark which defines \thiscolor accordingly,
1626 % so that \makeheadline knows which color to restore.
1627 \def\setcolor#1{%
1628 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1629 \domark
1630 \pdfsetcolor{#1}%
1631 }
1632 %
1633 \def\maincolor{\rgbBlack}
1634 \pdfsetcolor{\maincolor}
1635 \edef\thiscolor{\maincolor}
1636 \def\currentcolordefs{}
1637 %
1638 \def\makefootline{%
1639 \baselineskip24pt
1640 \line{\pdfsetcolor{\maincolor}\the\footline}%
1641 }
1642 %
1643 \def\makeheadline{%
1644 \vbox to 0pt{%
1645 \vskip-22.5pt
1646 \line{%
1647 \vbox to8.5pt{}%
1648 % Extract \thiscolor definition from the marks.
1649 \getcolormarks
1650 % Typeset the headline with \maincolor, then restore the color.
1651 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1652 }%
1653 \vss
1654 }%
1655 \nointerlineskip
1656 }
1657 %
1658 % PDF outline support
1659 %
1660 % Emulate pdfTeX primitive
1661 \def\pdfdest name#1 xyz{%
1662 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1663 }
1664 %
1665 \def\setpdfdestname#1{{%
1666 % We have to set dummies so commands such as @code, and characters
1667 % such as \, aren't expanded when present in a section title.
1668 \indexnofonts
1669 \makevalueexpandable
1670 \turnoffactive
1671 \iftxiuseunicodedestname
1672 % Pass through Unicode characters.
1673 \else
1674 % Use ASCII approximations in destination names.
1675 \passthroughcharsfalse
1676 \fi
1677 \def\pdfdestname{#1}%
1678 \txiescapepdf\pdfdestname
1679 }}
1680 %
1681 \def\setpdfoutlinetext#1{{%
1682 \turnoffactive
1683 % Always use Unicode characters in title texts.
1684 \def\pdfoutlinetext{#1}%
1685 % For XeTeX, xdvipdfmx converts to UTF-16.
1686 % So we do not convert.
1687 \txiescapepdf\pdfoutlinetext
1688 }}
1689 %
1690 \def\pdfmkdest#1{%
1691 \setpdfdestname{#1}%
1692 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1693 }
1694 %
1695 % by default, use black for everything.
1696 \def\urlcolor{\rgbBlack}
1697 \def\linkcolor{\rgbBlack}
1698 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1699 %
1700 \def\dopdfoutline#1#2#3#4{%
1701 \setpdfoutlinetext{#1}
1702 \setpdfdestname{#3}
1703 \ifx\pdfdestname\empty
1704 \def\pdfdestname{#4}%
1705 \fi
1706 %
1707 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1708 << /S /GoTo /D (\pdfdestname) >> >> }%
1709 }
1710 %
1711 \def\pdfmakeoutlines{%
1712 \begingroup
1713 %
1714 % For XeTeX, counts of subentries are not necessary.
1715 % Therefore, we read toc only once.
1716 %
1717 % We use node names as destinations.
1718 %
1719 % Currently we prefix the section name with the section number
1720 % for chapter and appendix headings only in order to avoid too much
1721 % horizontal space being required in the PDF viewer.
1722 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1723 \def\numchapentry##1##2##3##4{%
1724 \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
1725 \def\numsecentry##1##2##3##4{%
1726 \dopdfoutline{##1}{2}{##3}{##4}}%
1727 \def\numsubsecentry##1##2##3##4{%
1728 \dopdfoutline{##1}{3}{##3}{##4}}%
1729 \def\numsubsubsecentry##1##2##3##4{%
1730 \dopdfoutline{##1}{4}{##3}{##4}}%
1731 %
1732 \let\appentry\numchapentry%
1733 \let\appsecentry\numsecentry%
1734 \let\appsubsecentry\numsubsecentry%
1735 \let\appsubsubsecentry\numsubsubsecentry%
1736 \def\unnchapentry##1##2##3##4{%
1737 \dopdfoutline{##1}{1}{##3}{##4}}%
1738 \let\unnsecentry\numsecentry%
1739 \let\unnsubsecentry\numsubsecentry%
1740 \let\unnsubsubsecentry\numsubsubsecentry%
1741 %
1742 % For XeTeX, xdvipdfmx converts strings to UTF-16.
1743 % Therefore, the encoding and the language may not be considered.
1744 %
1745 \indexnofonts
1746 \setupdatafile
1747 % We can have normal brace characters in the PDF outlines, unlike
1748 % Texinfo index files. So set that up.
1749 \def\{{\lbracecharliteral}%
1750 \def\}{\rbracecharliteral}%
1751 \catcode`\\=\active \otherbackslash
1752 \input \tocreadfilename
1753 \endgroup
1754 }
1755 {\catcode`[=1 \catcode`]=2
1756 \catcode`{=\other \catcode`}=\other
1757 \gdef\lbracecharliteral[{]%
1758 \gdef\rbracecharliteral[}]%
1759 ]
1760
1761 \special{pdf:docview << /PageMode /UseOutlines >> }
1762 % ``\special{pdf:tounicode ...}'' is not necessary
1763 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1764 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1765 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1766 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1767 %
1768 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1769 \ifx\PP\D\let\nextsp\relax
1770 \else\let\nextsp\skipspaces
1771 \addtokens{\filename}{\PP}%
1772 \advance\filenamelength by 1
1773 \fi
1774 \nextsp}
1775 \def\getfilename#1{%
1776 \filenamelength=0
1777 % If we don't expand the argument now, \skipspaces will get
1778 % snagged on things like "@value{foo}".
1779 \edef\temp{#1}%
1780 \expandafter\skipspaces\temp|\relax
1781 }
1782 % make a live url in pdf output.
1783 \def\pdfurl#1{%
1784 \begingroup
1785 % it seems we really need yet another set of dummies; have not
1786 % tried to figure out what each command should do in the context
1787 % of @url. for now, just make @/ a no-op, that's the only one
1788 % people have actually reported a problem with.
1789 %
1790 \normalturnoffactive
1791 \def\@{@}%
1792 \let\/=\empty
1793 \makevalueexpandable
1794 % do we want to go so far as to use \indexnofonts instead of just
1795 % special-casing \var here?
1796 \def\var##1{##1}%
1797 %
1798 \leavevmode\setcolor{\urlcolor}%
1799 \special{pdf:bann << /Border [0 0 0]
1800 /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1801 \endgroup}
1802 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1803 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1804 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1805 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1806 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1807 \def\maketoks{%
1808 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1809 \ifx\first0\adn0
1810 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1811 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1812 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1813 \else
1814 \ifnum0=\countA\else\makelink\fi
1815 \ifx\first.\let\next=\done\else
1816 \let\next=\maketoks
1817 \addtokens{\toksB}{\the\toksD}
1818 \ifx\first,\addtokens{\toksB}{\space}\fi
1819 \fi
1820 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1821 \next}
1822 \def\makelink{\addtokens{\toksB}%
1823 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1824 \def\pdflink#1{%
1825 \special{pdf:bann << /Border [0 0 0]
1826 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1827 \setcolor{\linkcolor}#1\endlink}
1828 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1829 %
1830 %
1831 % @image support
1832 %
1833 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1834 \def\doxeteximage#1#2#3{%
1835 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1836 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1837 %
1838 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1839 % others). Let's try in that order, PDF first since if
1840 % someone has a scalable image, presumably better to use that than a
1841 % bitmap.
1842 \let\xeteximgext=\empty
1843 \begingroup
1844 \openin 1 #1.pdf \ifeof 1
1845 \openin 1 #1.PDF \ifeof 1
1846 \openin 1 #1.png \ifeof 1
1847 \openin 1 #1.jpg \ifeof 1
1848 \openin 1 #1.jpeg \ifeof 1
1849 \openin 1 #1.JPG \ifeof 1
1850 \errmessage{Could not find image file #1 for XeTeX}%
1851 \else \gdef\xeteximgext{JPG}%
1852 \fi
1853 \else \gdef\xeteximgext{jpeg}%
1854 \fi
1855 \else \gdef\xeteximgext{jpg}%
1856 \fi
1857 \else \gdef\xeteximgext{png}%
1858 \fi
1859 \else \gdef\xeteximgext{PDF}%
1860 \fi
1861 \else \gdef\xeteximgext{pdf}%
1862 \fi
1863 \closein 1
1864 \endgroup
1865 %
1866 \def\xetexpdfext{pdf}%
1867 \ifx\xeteximgext\xetexpdfext
1868 \XeTeXpdffile "#1".\xeteximgext ""
1869 \else
1870 \def\xetexpdfext{PDF}%
1871 \ifx\xeteximgext\xetexpdfext
1872 \XeTeXpdffile "#1".\xeteximgext ""
1873 \else
1874 \XeTeXpicfile "#1".\xeteximgext ""
1875 \fi
1876 \fi
1877 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1878 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1879 }
1880 \fi
1881
1882
1883 %
1884 \message{fonts,}
1885
1886 % Set the baselineskip to #1, and the lineskip and strut size
1887 % correspondingly. There is no deep meaning behind these magic numbers
1888 % used as factors; they just match (closely enough) what Knuth defined.
1889 %
1890 \def\lineskipfactor{.08333}
1891 \def\strutheightpercent{.70833}
1892 \def\strutdepthpercent {.29167}
1893 %
1894 % can get a sort of poor man's double spacing by redefining this.
1895 \def\baselinefactor{1}
1896 %
1897 \newdimen\textleading
1898 \def\setleading#1{%
1899 \dimen0 = #1\relax
1900 \normalbaselineskip = \baselinefactor\dimen0
1901 \normallineskip = \lineskipfactor\normalbaselineskip
1902 \normalbaselines
1903 \setbox\strutbox =\hbox{%
1904 \vrule width0pt height\strutheightpercent\baselineskip
1905 depth \strutdepthpercent \baselineskip
1906 }%
1907 }
1908
1909 % PDF CMaps. See also LaTeX's t1.cmap.
1910 %
1911 % do nothing with this by default.
1912 \expandafter\let\csname cmapOT1\endcsname\gobble
1913 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1914 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1915
1916 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1917 % (\pdffontattr was introduced many years ago, but people still run
1918 % older pdftex's; it's easy to conditionalize, so we do.)
1919 \ifpdf \ifx\pdffontattr\thisisundefined \else
1920 \begingroup
1921 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1922 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1923 %%DocumentNeededResources: ProcSet (CIDInit)
1924 %%IncludeResource: ProcSet (CIDInit)
1925 %%BeginResource: CMap (TeX-OT1-0)
1926 %%Title: (TeX-OT1-0 TeX OT1 0)
1927 %%Version: 1.000
1928 %%EndComments
1929 /CIDInit /ProcSet findresource begin
1930 12 dict begin
1931 begincmap
1932 /CIDSystemInfo
1933 << /Registry (TeX)
1934 /Ordering (OT1)
1935 /Supplement 0
1936 >> def
1937 /CMapName /TeX-OT1-0 def
1938 /CMapType 2 def
1939 1 begincodespacerange
1940 <00> <7F>
1941 endcodespacerange
1942 8 beginbfrange
1943 <00> <01> <0393>
1944 <09> <0A> <03A8>
1945 <23> <26> <0023>
1946 <28> <3B> <0028>
1947 <3F> <5B> <003F>
1948 <5D> <5E> <005D>
1949 <61> <7A> <0061>
1950 <7B> <7C> <2013>
1951 endbfrange
1952 40 beginbfchar
1953 <02> <0398>
1954 <03> <039B>
1955 <04> <039E>
1956 <05> <03A0>
1957 <06> <03A3>
1958 <07> <03D2>
1959 <08> <03A6>
1960 <0B> <00660066>
1961 <0C> <00660069>
1962 <0D> <0066006C>
1963 <0E> <006600660069>
1964 <0F> <00660066006C>
1965 <10> <0131>
1966 <11> <0237>
1967 <12> <0060>
1968 <13> <00B4>
1969 <14> <02C7>
1970 <15> <02D8>
1971 <16> <00AF>
1972 <17> <02DA>
1973 <18> <00B8>
1974 <19> <00DF>
1975 <1A> <00E6>
1976 <1B> <0153>
1977 <1C> <00F8>
1978 <1D> <00C6>
1979 <1E> <0152>
1980 <1F> <00D8>
1981 <21> <0021>
1982 <22> <201D>
1983 <27> <2019>
1984 <3C> <00A1>
1985 <3D> <003D>
1986 <3E> <00BF>
1987 <5C> <201C>
1988 <5F> <02D9>
1989 <60> <2018>
1990 <7D> <02DD>
1991 <7E> <007E>
1992 <7F> <00A8>
1993 endbfchar
1994 endcmap
1995 CMapName currentdict /CMap defineresource pop
1996 end
1997 end
1998 %%EndResource
1999 %%EOF
2000 }\endgroup
2001 \expandafter\edef\csname cmapOT1\endcsname#1{%
2002 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2003 }%
2004 %
2005 % \cmapOT1IT
2006 \begingroup
2007 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2008 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2009 %%DocumentNeededResources: ProcSet (CIDInit)
2010 %%IncludeResource: ProcSet (CIDInit)
2011 %%BeginResource: CMap (TeX-OT1IT-0)
2012 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
2013 %%Version: 1.000
2014 %%EndComments
2015 /CIDInit /ProcSet findresource begin
2016 12 dict begin
2017 begincmap
2018 /CIDSystemInfo
2019 << /Registry (TeX)
2020 /Ordering (OT1IT)
2021 /Supplement 0
2022 >> def
2023 /CMapName /TeX-OT1IT-0 def
2024 /CMapType 2 def
2025 1 begincodespacerange
2026 <00> <7F>
2027 endcodespacerange
2028 8 beginbfrange
2029 <00> <01> <0393>
2030 <09> <0A> <03A8>
2031 <25> <26> <0025>
2032 <28> <3B> <0028>
2033 <3F> <5B> <003F>
2034 <5D> <5E> <005D>
2035 <61> <7A> <0061>
2036 <7B> <7C> <2013>
2037 endbfrange
2038 42 beginbfchar
2039 <02> <0398>
2040 <03> <039B>
2041 <04> <039E>
2042 <05> <03A0>
2043 <06> <03A3>
2044 <07> <03D2>
2045 <08> <03A6>
2046 <0B> <00660066>
2047 <0C> <00660069>
2048 <0D> <0066006C>
2049 <0E> <006600660069>
2050 <0F> <00660066006C>
2051 <10> <0131>
2052 <11> <0237>
2053 <12> <0060>
2054 <13> <00B4>
2055 <14> <02C7>
2056 <15> <02D8>
2057 <16> <00AF>
2058 <17> <02DA>
2059 <18> <00B8>
2060 <19> <00DF>
2061 <1A> <00E6>
2062 <1B> <0153>
2063 <1C> <00F8>
2064 <1D> <00C6>
2065 <1E> <0152>
2066 <1F> <00D8>
2067 <21> <0021>
2068 <22> <201D>
2069 <23> <0023>
2070 <24> <00A3>
2071 <27> <2019>
2072 <3C> <00A1>
2073 <3D> <003D>
2074 <3E> <00BF>
2075 <5C> <201C>
2076 <5F> <02D9>
2077 <60> <2018>
2078 <7D> <02DD>
2079 <7E> <007E>
2080 <7F> <00A8>
2081 endbfchar
2082 endcmap
2083 CMapName currentdict /CMap defineresource pop
2084 end
2085 end
2086 %%EndResource
2087 %%EOF
2088 }\endgroup
2089 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2090 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2091 }%
2092 %
2093 % \cmapOT1TT
2094 \begingroup
2095 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2096 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2097 %%DocumentNeededResources: ProcSet (CIDInit)
2098 %%IncludeResource: ProcSet (CIDInit)
2099 %%BeginResource: CMap (TeX-OT1TT-0)
2100 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2101 %%Version: 1.000
2102 %%EndComments
2103 /CIDInit /ProcSet findresource begin
2104 12 dict begin
2105 begincmap
2106 /CIDSystemInfo
2107 << /Registry (TeX)
2108 /Ordering (OT1TT)
2109 /Supplement 0
2110 >> def
2111 /CMapName /TeX-OT1TT-0 def
2112 /CMapType 2 def
2113 1 begincodespacerange
2114 <00> <7F>
2115 endcodespacerange
2116 5 beginbfrange
2117 <00> <01> <0393>
2118 <09> <0A> <03A8>
2119 <21> <26> <0021>
2120 <28> <5F> <0028>
2121 <61> <7E> <0061>
2122 endbfrange
2123 32 beginbfchar
2124 <02> <0398>
2125 <03> <039B>
2126 <04> <039E>
2127 <05> <03A0>
2128 <06> <03A3>
2129 <07> <03D2>
2130 <08> <03A6>
2131 <0B> <2191>
2132 <0C> <2193>
2133 <0D> <0027>
2134 <0E> <00A1>
2135 <0F> <00BF>
2136 <10> <0131>
2137 <11> <0237>
2138 <12> <0060>
2139 <13> <00B4>
2140 <14> <02C7>
2141 <15> <02D8>
2142 <16> <00AF>
2143 <17> <02DA>
2144 <18> <00B8>
2145 <19> <00DF>
2146 <1A> <00E6>
2147 <1B> <0153>
2148 <1C> <00F8>
2149 <1D> <00C6>
2150 <1E> <0152>
2151 <1F> <00D8>
2152 <20> <2423>
2153 <27> <2019>
2154 <60> <2018>
2155 <7F> <00A8>
2156 endbfchar
2157 endcmap
2158 CMapName currentdict /CMap defineresource pop
2159 end
2160 end
2161 %%EndResource
2162 %%EOF
2163 }\endgroup
2164 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2165 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2166 }%
2167 \fi\fi
2168
2169
2170 % Set the font macro #1 to the font named \fontprefix#2.
2171 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2172 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2173 % Example:
2174 % #1 = \textrm
2175 % #2 = \rmshape
2176 % #3 = 10
2177 % #4 = \mainmagstep
2178 % #5 = OT1
2179 %
2180 \def\setfont#1#2#3#4#5{%
2181 \font#1=\fontprefix#2#3 scaled #4
2182 \csname cmap#5\endcsname#1%
2183 }
2184 % This is what gets called when #5 of \setfont is empty.
2185 \let\cmap\gobble
2186 %
2187 % (end of cmaps)
2188
2189 % Use cm as the default font prefix.
2190 % To specify the font prefix, you must define \fontprefix
2191 % before you read in texinfo.tex.
2192 \ifx\fontprefix\thisisundefined
2193 \def\fontprefix{cm}
2194 \fi
2195 % Support font families that don't use the same naming scheme as CM.
2196 \def\rmshape{r}
2197 \def\rmbshape{bx} % where the normal face is bold
2198 \def\bfshape{b}
2199 \def\bxshape{bx}
2200 \def\ttshape{tt}
2201 \def\ttbshape{tt}
2202 \def\ttslshape{sltt}
2203 \def\itshape{ti}
2204 \def\itbshape{bxti}
2205 \def\slshape{sl}
2206 \def\slbshape{bxsl}
2207 \def\sfshape{ss}
2208 \def\sfbshape{ss}
2209 \def\scshape{csc}
2210 \def\scbshape{csc}
2211
2212 % Definitions for a main text size of 11pt. (The default in Texinfo.)
2213 %
2214 \def\definetextfontsizexi{%
2215 % Text fonts (11.2pt, magstep1).
2216 \def\textnominalsize{11pt}
2217 \edef\mainmagstep{\magstephalf}
2218 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2219 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2220 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2221 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2222 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2223 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2224 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2225 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2226 \font\texti=cmmi10 scaled \mainmagstep
2227 \font\textsy=cmsy10 scaled \mainmagstep
2228 \def\textecsize{1095}
2229
2230 % A few fonts for @defun names and args.
2231 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2232 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2233 \setfont\defsl\slshape{10}{\magstep1}{OT1}
2234 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2235 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2236 \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2237
2238 % Fonts for indices, footnotes, small examples (9pt).
2239 \def\smallnominalsize{9pt}
2240 \setfont\smallrm\rmshape{9}{1000}{OT1}
2241 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2242 \setfont\smallbf\bfshape{10}{900}{OT1}
2243 \setfont\smallit\itshape{9}{1000}{OT1IT}
2244 \setfont\smallsl\slshape{9}{1000}{OT1}
2245 \setfont\smallsf\sfshape{9}{1000}{OT1}
2246 \setfont\smallsc\scshape{10}{900}{OT1}
2247 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2248 \font\smalli=cmmi9
2249 \font\smallsy=cmsy9
2250 \def\smallecsize{0900}
2251
2252 % Fonts for small examples (8pt).
2253 \def\smallernominalsize{8pt}
2254 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2255 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2256 \setfont\smallerbf\bfshape{10}{800}{OT1}
2257 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2258 \setfont\smallersl\slshape{8}{1000}{OT1}
2259 \setfont\smallersf\sfshape{8}{1000}{OT1}
2260 \setfont\smallersc\scshape{10}{800}{OT1}
2261 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2262 \font\smalleri=cmmi8
2263 \font\smallersy=cmsy8
2264 \def\smallerecsize{0800}
2265
2266 % Fonts for math mode superscripts (7pt).
2267 \def\sevennominalsize{7pt}
2268 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2269 \setfont\seventt\ttshape{10}{700}{OT1TT}
2270 \setfont\sevenbf\bfshape{10}{700}{OT1}
2271 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2272 \setfont\sevensl\slshape{10}{700}{OT1}
2273 \setfont\sevensf\sfshape{10}{700}{OT1}
2274 \setfont\sevensc\scshape{10}{700}{OT1}
2275 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2276 \font\seveni=cmmi7
2277 \font\sevensy=cmsy7
2278 \def\sevenecsize{0700}
2279
2280 % Fonts for title page (20.4pt):
2281 \def\titlenominalsize{20pt}
2282 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2283 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2284 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2285 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2286 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2287 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2288 \let\titlebf=\titlerm
2289 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2290 \font\titlei=cmmi12 scaled \magstep3
2291 \font\titlesy=cmsy10 scaled \magstep4
2292 \def\titleecsize{2074}
2293
2294 % Chapter (and unnumbered) fonts (17.28pt).
2295 \def\chapnominalsize{17pt}
2296 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2297 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2298 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2299 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2300 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2301 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2302 \let\chapbf=\chaprm
2303 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2304 \font\chapi=cmmi12 scaled \magstep2
2305 \font\chapsy=cmsy10 scaled \magstep3
2306 \def\chapecsize{1728}
2307
2308 % Section fonts (14.4pt).
2309 \def\secnominalsize{14pt}
2310 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2311 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2312 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2313 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2314 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2315 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2316 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2317 \let\secbf\secrm
2318 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2319 \font\seci=cmmi12 scaled \magstep1
2320 \font\secsy=cmsy10 scaled \magstep2
2321 \def\sececsize{1440}
2322
2323 % Subsection fonts (13.15pt).
2324 \def\ssecnominalsize{13pt}
2325 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2326 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2327 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2328 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2329 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2330 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2331 \let\ssecbf\ssecrm
2332 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2333 \font\sseci=cmmi12 scaled \magstephalf
2334 \font\ssecsy=cmsy10 scaled 1315
2335 \def\ssececsize{1200}
2336
2337 % Reduced fonts for @acronym in text (10pt).
2338 \def\reducednominalsize{10pt}
2339 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2340 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2341 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2342 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2343 \setfont\reducedsl\slshape{10}{1000}{OT1}
2344 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2345 \setfont\reducedsc\scshape{10}{1000}{OT1}
2346 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2347 \font\reducedi=cmmi10
2348 \font\reducedsy=cmsy10
2349 \def\reducedecsize{1000}
2350
2351 \textleading = 13.2pt % line spacing for 11pt CM
2352 \textfonts % reset the current fonts
2353 \rm
2354 } % end of 11pt text font size definitions, \definetextfontsizexi
2355
2356
2357 % Definitions to make the main text be 10pt Computer Modern, with
2358 % section, chapter, etc., sizes following suit. This is for the GNU
2359 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2360 % future. Used with @smallbook, which sets the leading to 12pt.
2361 %
2362 \def\definetextfontsizex{%
2363 % Text fonts (10pt).
2364 \def\textnominalsize{10pt}
2365 \edef\mainmagstep{1000}
2366 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2367 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2368 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2369 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2370 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2371 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2372 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2373 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2374 \font\texti=cmmi10 scaled \mainmagstep
2375 \font\textsy=cmsy10 scaled \mainmagstep
2376 \def\textecsize{1000}
2377
2378 % A few fonts for @defun names and args.
2379 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2380 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2381 \setfont\defsl\slshape{10}{\magstephalf}{OT1}
2382 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2383 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2384 \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2385
2386 % Fonts for indices, footnotes, small examples (9pt).
2387 \def\smallnominalsize{9pt}
2388 \setfont\smallrm\rmshape{9}{1000}{OT1}
2389 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2390 \setfont\smallbf\bfshape{10}{900}{OT1}
2391 \setfont\smallit\itshape{9}{1000}{OT1IT}
2392 \setfont\smallsl\slshape{9}{1000}{OT1}
2393 \setfont\smallsf\sfshape{9}{1000}{OT1}
2394 \setfont\smallsc\scshape{10}{900}{OT1}
2395 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2396 \font\smalli=cmmi9
2397 \font\smallsy=cmsy9
2398 \def\smallecsize{0900}
2399
2400 % Fonts for small examples (8pt).
2401 \def\smallernominalsize{8pt}
2402 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2403 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2404 \setfont\smallerbf\bfshape{10}{800}{OT1}
2405 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2406 \setfont\smallersl\slshape{8}{1000}{OT1}
2407 \setfont\smallersf\sfshape{8}{1000}{OT1}
2408 \setfont\smallersc\scshape{10}{800}{OT1}
2409 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2410 \font\smalleri=cmmi8
2411 \font\smallersy=cmsy8
2412 \def\smallerecsize{0800}
2413
2414 % Fonts for math mode superscripts (7pt).
2415 \def\sevennominalsize{7pt}
2416 \setfont\sevenrm\rmshape{7}{1000}{OT1}
2417 \setfont\seventt\ttshape{10}{700}{OT1TT}
2418 \setfont\sevenbf\bfshape{10}{700}{OT1}
2419 \setfont\sevenit\itshape{7}{1000}{OT1IT}
2420 \setfont\sevensl\slshape{10}{700}{OT1}
2421 \setfont\sevensf\sfshape{10}{700}{OT1}
2422 \setfont\sevensc\scshape{10}{700}{OT1}
2423 \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2424 \font\seveni=cmmi7
2425 \font\sevensy=cmsy7
2426 \def\sevenecsize{0700}
2427
2428 % Fonts for title page (20.4pt):
2429 \def\titlenominalsize{20pt}
2430 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2431 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2432 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2433 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2434 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2435 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2436 \let\titlebf=\titlerm
2437 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2438 \font\titlei=cmmi12 scaled \magstep3
2439 \font\titlesy=cmsy10 scaled \magstep4
2440 \def\titleecsize{2074}
2441
2442 % Chapter fonts (14.4pt).
2443 \def\chapnominalsize{14pt}
2444 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2445 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2446 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2447 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2448 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2449 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2450 \let\chapbf\chaprm
2451 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2452 \font\chapi=cmmi12 scaled \magstep1
2453 \font\chapsy=cmsy10 scaled \magstep2
2454 \def\chapecsize{1440}
2455
2456 % Section fonts (12pt).
2457 \def\secnominalsize{12pt}
2458 \setfont\secrm\rmbshape{12}{1000}{OT1}
2459 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2460 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2461 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2462 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2463 \setfont\secsf\sfbshape{12}{1000}{OT1}
2464 \let\secbf\secrm
2465 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2466 \font\seci=cmmi12
2467 \font\secsy=cmsy10 scaled \magstep1
2468 \def\sececsize{1200}
2469
2470 % Subsection fonts (10pt).
2471 \def\ssecnominalsize{10pt}
2472 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2473 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2474 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2475 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2476 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2477 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2478 \let\ssecbf\ssecrm
2479 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2480 \font\sseci=cmmi10
2481 \font\ssecsy=cmsy10
2482 \def\ssececsize{1000}
2483
2484 % Reduced fonts for @acronym in text (9pt).
2485 \def\reducednominalsize{9pt}
2486 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2487 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2488 \setfont\reducedbf\bfshape{10}{900}{OT1}
2489 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2490 \setfont\reducedsl\slshape{9}{1000}{OT1}
2491 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2492 \setfont\reducedsc\scshape{10}{900}{OT1}
2493 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2494 \font\reducedi=cmmi9
2495 \font\reducedsy=cmsy9
2496 \def\reducedecsize{0900}
2497
2498 \divide\parskip by 2 % reduce space between paragraphs
2499 \textleading = 12pt % line spacing for 10pt CM
2500 \textfonts % reset the current fonts
2501 \rm
2502 } % end of 10pt text font size definitions, \definetextfontsizex
2503
2504 % Fonts for short table of contents.
2505 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2506 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2507 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2508 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2509
2510
2511 % We provide the user-level command
2512 % @fonttextsize 10
2513 % (or 11) to redefine the text font size. pt is assumed.
2514 %
2515 \def\xiword{11}
2516 \def\xword{10}
2517 \def\xwordpt{10pt}
2518 %
2519 \parseargdef\fonttextsize{%
2520 \def\textsizearg{#1}%
2521 %\wlog{doing @fonttextsize \textsizearg}%
2522 %
2523 % Set \globaldefs so that documents can use this inside @tex, since
2524 % makeinfo 4.8 does not support it, but we need it nonetheless.
2525 %
2526 \begingroup \globaldefs=1
2527 \ifx\textsizearg\xword \definetextfontsizex
2528 \else \ifx\textsizearg\xiword \definetextfontsizexi
2529 \else
2530 \errhelp=\EMsimple
2531 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2532 \fi\fi
2533 \endgroup
2534 }
2535
2536 %
2537 % Change the current font style to #1, remembering it in \curfontstyle.
2538 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2539 % italics, not bold italics.
2540 %
2541 \def\setfontstyle#1{%
2542 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2543 \csname #1font\endcsname % change the current font
2544 }
2545
2546 \def\rm{\fam=0 \setfontstyle{rm}}
2547 \def\it{\fam=\itfam \setfontstyle{it}}
2548 \def\sl{\fam=\slfam \setfontstyle{sl}}
2549 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2550 \def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt}
2551
2552 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
2553 % So we set up a \sf.
2554 \newfam\sffam
2555 \def\sf{\fam=\sffam \setfontstyle{sf}}
2556
2557 % We don't need math for this font style.
2558 \def\ttsl{\setfontstyle{ttsl}}
2559
2560
2561 % In order for the font changes to affect most math symbols and letters,
2562 % we have to define the \textfont of the standard families.
2563 % We don't bother to reset \scriptscriptfont; awaiting user need.
2564 %
2565 \def\resetmathfonts{%
2566 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2567 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2568 \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2569 %
2570 % Fonts for superscript. Note that the 7pt fonts are used regardless
2571 % of the current font size.
2572 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
2573 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
2574 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
2575 \scriptfont\sffam=\sevensf
2576 }
2577
2578 %
2579
2580 % The font-changing commands (all called \...fonts) redefine the meanings
2581 % of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
2582 % to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
2583 % commands hardwire \STYLEfont to set the current font.
2584 %
2585 % The fonts used for \ifont are for "math italics" (\itfont is for italics
2586 % in regular text). \syfont is also used in math mode only.
2587 %
2588 % Each font-changing command also sets the names \lsize (one size lower)
2589 % and \lllsize (three sizes lower). These relative commands are used
2590 % in, e.g., the LaTeX logo and acronyms.
2591 %
2592 % This all needs generalizing, badly.
2593 %
2594
2595 \def\assignfonts#1{%
2596 \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
2597 \expandafter\let\expandafter\itfont\csname #1it\endcsname
2598 \expandafter\let\expandafter\slfont\csname #1sl\endcsname
2599 \expandafter\let\expandafter\bffont\csname #1bf\endcsname
2600 \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
2601 \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
2602 \expandafter\let\expandafter\sffont \csname #1sf\endcsname
2603 \expandafter\let\expandafter\ifont \csname #1i\endcsname
2604 \expandafter\let\expandafter\syfont \csname #1sy\endcsname
2605 \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
2606 }
2607
2608 \newif\ifrmisbold
2609
2610 % Select smaller font size with the current style. Used to change font size
2611 % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
2612 % normal roman text, also use bold fonts for roman text in the smaller size.
2613 \def\switchtolllsize{%
2614 \expandafter\assignfonts\expandafter{\lllsize}%
2615 \ifrmisbold
2616 \let\rmfont\bffont
2617 \fi
2618 \csname\curfontstyle\endcsname
2619 }%
2620
2621 \def\switchtolsize{%
2622 \expandafter\assignfonts\expandafter{\lsize}%
2623 \ifrmisbold
2624 \let\rmfont\bffont
2625 \fi
2626 \csname\curfontstyle\endcsname
2627 }%
2628
2629 \def\definefontsetatsize#1#2#3#4#5{%
2630 \expandafter\def\csname #1fonts\endcsname{%
2631 \def\curfontsize{#1}%
2632 \def\lsize{#2}\def\lllsize{#3}%
2633 \csname rmisbold#5\endcsname
2634 \assignfonts{#1}%
2635 \resetmathfonts
2636 \setleading{#4}%
2637 }}
2638
2639 \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
2640 \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
2641 \definefontsetatsize{chap} {sec} {text} {19pt} {true}
2642 \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
2643 \definefontsetatsize{ssec} {text} {small} {15pt} {true}
2644 \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
2645 \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
2646 \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2647
2648 \def\titlefont#1{{\titlefonts\rm #1}}
2649 \let\subsecfonts = \ssecfonts
2650 \let\subsubsecfonts = \ssecfonts
2651
2652 % Define these just so they can be easily changed for other fonts.
2653 \def\angleleft{$\langle$}
2654 \def\angleright{$\rangle$}
2655
2656 % Set the fonts to use with the @small... environments.
2657 \let\smallexamplefonts = \smallfonts
2658
2659 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2660 % can fit this many characters:
2661 % 8.5x11=86 smallbook=72 a4=90 a5=69
2662 % If we use \scriptfonts (8pt), then we can fit this many characters:
2663 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2664 % For me, subjectively, the few extra characters that fit aren't worth
2665 % the additional smallness of 8pt. So I'm making the default 9pt.
2666 %
2667 % By the way, for comparison, here's what fits with @example (10pt):
2668 % 8.5x11=71 smallbook=60 a4=75 a5=58
2669 % --karl, 24jan03.
2670
2671 % Set up the default fonts, so we can use them for creating boxes.
2672 %
2673 \definetextfontsizexi
2674
2675
2676 % Check if we are currently using a typewriter font. Since all the
2677 % Computer Modern typewriter fonts have zero interword stretch (and
2678 % shrink), and it is reasonable to expect all typewriter fonts to have
2679 % this property, we can check that font parameter.
2680 %
2681 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2682
2683 {
2684 \catcode`\'=\active
2685 \catcode`\`=\active
2686
2687 \gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
2688 \gdef\setregularquotes{\let`\lq \let'\rq}
2689 }
2690
2691 % Allow an option to not use regular directed right quote/apostrophe
2692 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2693 % The undirected quote is ugly, so don't make it the default, but it
2694 % works for pasting with more pdf viewers (at least evince), the
2695 % lilypond developers report. xpdf does work with the regular 0x27.
2696 %
2697 \def\codequoteright{%
2698 \ifmonospace
2699 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2700 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2701 '%
2702 \else \char'15 \fi
2703 \else \char'15 \fi
2704 \else
2705 '%
2706 \fi
2707 }
2708 %
2709 % and a similar option for the left quote char vs. a grave accent.
2710 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2711 % the code environments to do likewise.
2712 %
2713 \def\codequoteleft{%
2714 \ifmonospace
2715 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2716 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2717 % [Knuth] pp. 380,381,391
2718 % \relax disables Spanish ligatures ?` and !` of \tt font.
2719 \relax`%
2720 \else \char'22 \fi
2721 \else \char'22 \fi
2722 \else
2723 \relax`%
2724 \fi
2725 }
2726
2727 % Commands to set the quote options.
2728 %
2729 \parseargdef\codequoteundirected{%
2730 \def\temp{#1}%
2731 \ifx\temp\onword
2732 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2733 = t%
2734 \else\ifx\temp\offword
2735 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2736 = \relax
2737 \else
2738 \errhelp = \EMsimple
2739 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2740 \fi\fi
2741 }
2742 %
2743 \parseargdef\codequotebacktick{%
2744 \def\temp{#1}%
2745 \ifx\temp\onword
2746 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2747 = t%
2748 \else\ifx\temp\offword
2749 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2750 = \relax
2751 \else
2752 \errhelp = \EMsimple
2753 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2754 \fi\fi
2755 }
2756
2757 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2758 \def\noligaturesquoteleft{\relax\lq}
2759
2760 % Count depth in font-changes, for error checks
2761 \newcount\fontdepth \fontdepth=0
2762
2763 % Font commands.
2764
2765 % #1 is the font command (\sl or \it), #2 is the text to slant.
2766 % If we are in a monospaced environment, however, 1) always use \ttsl,
2767 % and 2) do not add an italic correction.
2768 \def\dosmartslant#1#2{%
2769 \ifusingtt
2770 {{\ttsl #2}\let\next=\relax}%
2771 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2772 \next
2773 }
2774 \def\smartslanted{\dosmartslant\sl}
2775 \def\smartitalic{\dosmartslant\it}
2776
2777 % Output an italic correction unless \next (presumed to be the following
2778 % character) is such as not to need one.
2779 \def\smartitaliccorrection{%
2780 \ifx\next,%
2781 \else\ifx\next-%
2782 \else\ifx\next.%
2783 \else\ifx\next\.%
2784 \else\ifx\next\comma%
2785 \else\ptexslash
2786 \fi\fi\fi\fi\fi
2787 \aftersmartic
2788 }
2789
2790 % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2791 \def\ttslanted#1{{\ttsl #1}}
2792
2793 % @cite is like \smartslanted except unconditionally use \sl. We never want
2794 % ttsl for book titles, do we?
2795 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2796
2797 \def\aftersmartic{}
2798 \def\var#1{%
2799 \let\saveaftersmartic = \aftersmartic
2800 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2801 \smartslanted{#1}%
2802 }
2803
2804 \let\i=\smartitalic
2805 \let\slanted=\smartslanted
2806 \let\dfn=\smartslanted
2807 \let\emph=\smartitalic
2808
2809 % Explicit font changes: @r, @sc, undocumented @ii.
2810 \def\r#1{{\rm #1}} % roman font
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 % Set sfcode to normal for the chars that usually have another value.
2829 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2830 % sometimes \x has an active definition that messes things up.
2831 %
2832 \catcode`@=11
2833 \def\plainfrenchspacing{%
2834 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2835 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2836 \def\endofsentencespacefactor{1000}% for @. and friends
2837 }
2838 \def\plainnonfrenchspacing{%
2839 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2840 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2841 \def\endofsentencespacefactor{3000}% for @. and friends
2842 }
2843 \catcode`@=\other
2844 \def\endofsentencespacefactor{3000}% default
2845
2846 % @t, explicit typewriter.
2847 \def\t#1{%
2848 {\tt \plainfrenchspacing #1}%
2849 \null
2850 }
2851
2852 % @samp.
2853 \def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
2854
2855 % @indicateurl is \samp, that is, with quotes.
2856 \let\indicateurl=\samp
2857
2858 % @code (and similar) prints in typewriter, but with spaces the same
2859 % size as normal in the surrounding text, without hyphenation, etc.
2860 % This is a subroutine for that.
2861 \def\tclose#1{%
2862 {%
2863 % Change normal interword space to be same as for the current font.
2864 \spaceskip = \fontdimen2\font
2865 %
2866 % Switch to typewriter.
2867 \tt
2868 %
2869 % But `\ ' produces the large typewriter interword space.
2870 \def\ {{\spaceskip = 0pt{} }}%
2871 %
2872 % Turn off hyphenation.
2873 \nohyphenation
2874 %
2875 \plainfrenchspacing
2876 #1%
2877 }%
2878 \null % reset spacefactor to 1000
2879 }
2880
2881 % We *must* turn on hyphenation at `-' and `_' in @code.
2882 % (But see \codedashfinish below.)
2883 % Otherwise, it is too hard to avoid overfull hboxes
2884 % in the Emacs manual, the Library manual, etc.
2885 %
2886 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2887 % both hyphenation at - and hyphenation within words.
2888 % We must therefore turn them both off (\tclose does that)
2889 % and arrange explicitly to hyphenate at a dash. -- rms.
2890 {
2891 \catcode`\-=\active \catcode`\_=\active
2892 \catcode`\'=\active \catcode`\`=\active
2893 \global\let'=\rq \global\let`=\lq % default definitions
2894 %
2895 \global\def\code{\begingroup
2896 \setcodequotes
2897 \catcode\dashChar=\active \catcode\underChar=\active
2898 \ifallowcodebreaks
2899 \let-\codedash
2900 \let_\codeunder
2901 \else
2902 \let-\normaldash
2903 \let_\realunder
2904 \fi
2905 % Given -foo (with a single dash), we do not want to allow a break
2906 % after the hyphen.
2907 \global\let\codedashprev=\codedash
2908 %
2909 \codex
2910 }
2911 %
2912 \gdef\codedash{\futurelet\next\codedashfinish}
2913 \gdef\codedashfinish{%
2914 \normaldash % always output the dash character itself.
2915 %
2916 % Now, output a discretionary to allow a line break, unless
2917 % (a) the next character is a -, or
2918 % (b) the preceding character is a -.
2919 % E.g., given --posix, we do not want to allow a break after either -.
2920 % Given --foo-bar, we do want to allow a break between the - and the b.
2921 \ifx\next\codedash \else
2922 \ifx\codedashprev\codedash
2923 \else \discretionary{}{}{}\fi
2924 \fi
2925 % we need the space after the = for the case when \next itself is a
2926 % space token; it would get swallowed otherwise. As in @code{- a}.
2927 \global\let\codedashprev= \next
2928 }
2929 }
2930 \def\normaldash{-}
2931 %
2932 \def\codex #1{\tclose{#1}\endgroup}
2933
2934 \def\codeunder{%
2935 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2936 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2937 % will therefore expand the active definition of _, which is us
2938 % (inside @code that is), therefore an endless loop.
2939 \ifusingtt{\ifmmode
2940 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2941 \else\normalunderscore \fi
2942 \discretionary{}{}{}}%
2943 {\_}%
2944 }
2945
2946 % An additional complication: the above will allow breaks after, e.g.,
2947 % each of the four underscores in __typeof__. This is bad.
2948 % @allowcodebreaks provides a document-level way to turn breaking at -
2949 % and _ on and off.
2950 %
2951 \newif\ifallowcodebreaks \allowcodebreakstrue
2952
2953 \def\keywordtrue{true}
2954 \def\keywordfalse{false}
2955
2956 \parseargdef\allowcodebreaks{%
2957 \def\txiarg{#1}%
2958 \ifx\txiarg\keywordtrue
2959 \allowcodebreakstrue
2960 \else\ifx\txiarg\keywordfalse
2961 \allowcodebreaksfalse
2962 \else
2963 \errhelp = \EMsimple
2964 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2965 \fi\fi
2966 }
2967
2968 % For @command, @env, @file, @option quotes seem unnecessary,
2969 % so use \code rather than \samp.
2970 \let\command=\code
2971 \let\env=\code
2972 \let\file=\code
2973 \let\option=\code
2974
2975 % @uref (abbreviation for `urlref') aka @url takes an optional
2976 % (comma-separated) second argument specifying the text to display and
2977 % an optional third arg as text to display instead of (rather than in
2978 % addition to) the url itself. First (mandatory) arg is the url.
2979
2980 % TeX-only option to allow changing PDF output to show only the second
2981 % arg (if given), and not the url (which is then just the link target).
2982 \newif\ifurefurlonlylink
2983
2984 % The default \pretolerance setting stops the penalty inserted in
2985 % \urefallowbreak being a discouragement to line breaking. Set it to
2986 % a negative value for this paragraph only. Hopefully this does not
2987 % conflict with redefinitions of \par done elsewhere.
2988 \def\nopretolerance{%
2989 \pretolerance=-1
2990 \def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
2991 }
2992
2993 % The main macro is \urefbreak, which allows breaking at expected
2994 % places within the url.
2995 \def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
2996 \let\uref=\urefbreak
2997 %
2998 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2999 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
3000 \unsepspaces
3001 \pdfurl{#1}%
3002 \setbox0 = \hbox{\ignorespaces #3}%
3003 \ifdim\wd0 > 0pt
3004 \unhbox0 % third arg given, show only that
3005 \else
3006 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
3007 \ifdim\wd0 > 0pt
3008 \ifpdf
3009 % For pdfTeX and LuaTeX
3010 \ifurefurlonlylink
3011 % PDF plus option to not display url, show just arg
3012 \unhbox0
3013 \else
3014 % PDF, normally display both arg and url for consistency,
3015 % visibility, if the pdf is eventually used to print, etc.
3016 \unhbox0\ (\urefcode{#1})%
3017 \fi
3018 \else
3019 \ifx\XeTeXrevision\thisisundefined
3020 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3021 \else
3022 % For XeTeX
3023 \ifurefurlonlylink
3024 % PDF plus option to not display url, show just arg
3025 \unhbox0
3026 \else
3027 % PDF, normally display both arg and url for consistency,
3028 % visibility, if the pdf is eventually used to print, etc.
3029 \unhbox0\ (\urefcode{#1})%
3030 \fi
3031 \fi
3032 \fi
3033 \else
3034 \urefcode{#1}% only url given, so show it
3035 \fi
3036 \fi
3037 \endlink
3038 \endgroup}
3039
3040 % Allow line breaks around only a few characters (only).
3041 \def\urefcatcodes{%
3042 \catcode`\&=\active \catcode`\.=\active
3043 \catcode`\#=\active \catcode`\?=\active
3044 \catcode`\/=\active
3045 }
3046 {
3047 \urefcatcodes
3048 %
3049 \global\def\urefcode{\begingroup
3050 \setcodequotes
3051 \urefcatcodes
3052 \let&\urefcodeamp
3053 \let.\urefcodedot
3054 \let#\urefcodehash
3055 \let?\urefcodequest
3056 \let/\urefcodeslash
3057 \codex
3058 }
3059 %
3060 % By default, they are just regular characters.
3061 \global\def&{\normalamp}
3062 \global\def.{\normaldot}
3063 \global\def#{\normalhash}
3064 \global\def?{\normalquest}
3065 \global\def/{\normalslash}
3066 }
3067
3068 \def\urefcodeamp{\urefprebreak \&\urefpostbreak}
3069 \def\urefcodedot{\urefprebreak .\urefpostbreak}
3070 \def\urefcodehash{\urefprebreak \#\urefpostbreak}
3071 \def\urefcodequest{\urefprebreak ?\urefpostbreak}
3072 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3073 {
3074 \catcode`\/=\active
3075 \global\def\urefcodeslashfinish{%
3076 \urefprebreak \slashChar
3077 % Allow line break only after the final / in a sequence of
3078 % slashes, to avoid line break between the slashes in http://.
3079 \ifx\next/\else \urefpostbreak \fi
3080 }
3081 }
3082
3083 % By default we'll break after the special characters, but some people like to
3084 % break before the special chars, so allow that. Also allow no breaking at
3085 % all, for manual control.
3086 %
3087 \parseargdef\urefbreakstyle{%
3088 \def\txiarg{#1}%
3089 \ifx\txiarg\wordnone
3090 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3091 \else\ifx\txiarg\wordbefore
3092 \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
3093 \else\ifx\txiarg\wordafter
3094 \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
3095 \else
3096 \errhelp = \EMsimple
3097 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3098 \fi\fi\fi
3099 }
3100 \def\wordafter{after}
3101 \def\wordbefore{before}
3102 \def\wordnone{none}
3103
3104 % Allow a ragged right output to aid breaking long URL's. There can
3105 % be a break at the \allowbreak with no extra glue (if the existing stretch in
3106 % the line is sufficient), a break at the \penalty with extra glue added
3107 % at the end of the line, or no break at all here.
3108 % Changing the value of the penalty and/or the amount of stretch affects how
3109 % preferable one choice is over the other.
3110 \def\urefallowbreak{%
3111 \penalty0\relax
3112 \hskip 0pt plus 2 em\relax
3113 \penalty1000\relax
3114 \hskip 0pt plus -2 em\relax
3115 }
3116
3117 \urefbreakstyle after
3118
3119 % @url synonym for @uref, since that's how everyone uses it.
3120 %
3121 \let\url=\uref
3122
3123 % rms does not like angle brackets --karl, 17may97.
3124 % So now @email is just like @uref, unless we are pdf.
3125 %
3126 %\def\email#1{\angleleft{\tt #1}\angleright}
3127 \ifpdforxetex
3128 \def\email#1{\doemail#1,,\finish}
3129 \def\doemail#1,#2,#3\finish{\begingroup
3130 \unsepspaces
3131 \pdfurl{mailto:#1}%
3132 \setbox0 = \hbox{\ignorespaces #2}%
3133 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3134 \endlink
3135 \endgroup}
3136 \else
3137 \let\email=\uref
3138 \fi
3139
3140 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3141 % `example' (@kbd uses ttsl only inside of @example and friends),
3142 % or `code' (@kbd uses normal tty font always).
3143 \parseargdef\kbdinputstyle{%
3144 \def\txiarg{#1}%
3145 \ifx\txiarg\worddistinct
3146 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3147 \else\ifx\txiarg\wordexample
3148 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3149 \else\ifx\txiarg\wordcode
3150 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3151 \else
3152 \errhelp = \EMsimple
3153 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3154 \fi\fi\fi
3155 }
3156 \def\worddistinct{distinct}
3157 \def\wordexample{example}
3158 \def\wordcode{code}
3159
3160 % Default is `distinct'.
3161 \kbdinputstyle distinct
3162
3163 % @kbd is like @code, except that if the argument is just one @key command,
3164 % then @kbd has no effect.
3165 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
3166
3167 \def\xkey{\key}
3168 \def\kbdsub#1#2#3\par{%
3169 \def\one{#1}\def\three{#3}\def\threex{??}%
3170 \ifx\one\xkey\ifx\threex\three \key{#2}%
3171 \else{\tclose{\kbdfont\setcodequotes\look}}\fi
3172 \else{\tclose{\kbdfont\setcodequotes\look}}\fi
3173 }
3174
3175 % definition of @key that produces a lozenge. Doesn't adjust to text size.
3176 %\setfont\keyrm\rmshape{8}{1000}{OT1}
3177 %\font\keysy=cmsy9
3178 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3179 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3180 % \vbox{\hrule\kern-0.4pt
3181 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3182 % \kern-0.4pt\hrule}%
3183 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3184
3185 % definition of @key with no lozenge. If the current font is already
3186 % monospace, don't change it; that way, we respect @kbdinputstyle. But
3187 % if it isn't monospace, then use \tt.
3188 %
3189 \def\key#1{{\setregularquotes
3190 \nohyphenation
3191 \ifmonospace\else\tt\fi
3192 #1}\null}
3193
3194 % @clicksequence{File @click{} Open ...}
3195 \def\clicksequence#1{\begingroup #1\endgroup}
3196
3197 % @clickstyle @arrow (by default)
3198 \parseargdef\clickstyle{\def\click{#1}}
3199 \def\click{\arrow}
3200
3201 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3202 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3203 %
3204 \def\dmn#1{\thinspace #1}
3205
3206 % @acronym for "FBI", "NATO", and the like.
3207 % We print this one point size smaller, since it's intended for
3208 % all-uppercase.
3209 %
3210 \def\acronym#1{\doacronym #1,,\finish}
3211 \def\doacronym#1,#2,#3\finish{%
3212 {\switchtolsize #1}%
3213 \def\temp{#2}%
3214 \ifx\temp\empty \else
3215 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3216 \fi
3217 \null % reset \spacefactor=1000
3218 }
3219
3220 % @abbr for "Comput. J." and the like.
3221 % No font change, but don't do end-of-sentence spacing.
3222 %
3223 \def\abbr#1{\doabbr #1,,\finish}
3224 \def\doabbr#1,#2,#3\finish{%
3225 {\plainfrenchspacing #1}%
3226 \def\temp{#2}%
3227 \ifx\temp\empty \else
3228 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3229 \fi
3230 \null % reset \spacefactor=1000
3231 }
3232
3233 % @asis just yields its argument. Used with @table, for example.
3234 %
3235 \def\asis#1{#1}
3236
3237 % @math outputs its argument in math mode.
3238 %
3239 % One complication: _ usually means subscripts, but it could also mean
3240 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
3241 % _ active, and distinguish by seeing if the current family is \slfam,
3242 % which is what @var uses.
3243 {
3244 \catcode`\_ = \active
3245 \gdef\mathunderscore{%
3246 \catcode`\_=\active
3247 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3248 }
3249 }
3250 % Another complication: we want \\ (and @\) to output a math (or tt) \.
3251 % FYI, plain.tex uses \\ as a temporary control sequence (for no
3252 % particular reason), but this is not advertised and we don't care.
3253 %
3254 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3255 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3256 %
3257 \def\math{%
3258 \ifmmode\else % only go into math if not in math mode already
3259 \tex
3260 \mathunderscore
3261 \let\\ = \mathbackslash
3262 \mathactive
3263 % make the texinfo accent commands work in math mode
3264 \let\"=\ddot
3265 \let\'=\acute
3266 \let\==\bar
3267 \let\^=\hat
3268 \let\`=\grave
3269 \let\u=\breve
3270 \let\v=\check
3271 \let\~=\tilde
3272 \let\dotaccent=\dot
3273 % have to provide another name for sup operator
3274 \let\mathopsup=\sup
3275 $\expandafter\finishmath\fi
3276 }
3277 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3278
3279 % Some active characters (such as <) are spaced differently in math.
3280 % We have to reset their definitions in case the @math was an argument
3281 % to a command which sets the catcodes (such as @item or @section).
3282 %
3283 {
3284 \catcode`^ = \active
3285 \catcode`< = \active
3286 \catcode`> = \active
3287 \catcode`+ = \active
3288 \catcode`' = \active
3289 \gdef\mathactive{%
3290 \let^ = \ptexhat
3291 \let< = \ptexless
3292 \let> = \ptexgtr
3293 \let+ = \ptexplus
3294 \let' = \ptexquoteright
3295 }
3296 }
3297
3298 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3299 % If in text, use math to place as sub/superscript, but switch
3300 % into text mode, with smaller fonts. This is a different font than the
3301 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3302 % fix it (significant additions to font machinery) until someone notices.
3303 %
3304 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3305 \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
3306 %
3307 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3308 \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
3309
3310 % provide this command from LaTeX as it is very common
3311 \def\frac#1#2{{{#1}\over{#2}}}
3312
3313 % @displaymath.
3314 % \globaldefs is needed to recognize the end lines in \tex and
3315 % \end tex. Set \thisenv as @end displaymath is seen before @end tex.
3316 {\obeylines
3317 \globaldefs=1
3318 \envdef\displaymath{%
3319 \tex%
3320 \def\thisenv{\displaymath}%
3321 \begingroup\let\end\displaymathend%
3322 $$%
3323 }
3324
3325 \def\displaymathend{$$\endgroup\end}%
3326
3327 \def\Edisplaymath{%
3328 \def\thisenv{\tex}%
3329 \end tex
3330 }}
3331
3332
3333 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3334 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3335 % except specified as a normal braced arg, so no newlines to worry about.
3336 %
3337 \def\outfmtnametex{tex}
3338 %
3339 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3340 \long\def\doinlinefmt#1,#2,\finish{%
3341 \def\inlinefmtname{#1}%
3342 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3343 }
3344 %
3345 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3346 % FMTNAME is tex, else ELSE-TEXT.
3347 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3348 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3349 \def\inlinefmtname{#1}%
3350 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3351 }
3352 %
3353 % For raw, must switch into @tex before parsing the argument, to avoid
3354 % setting catcodes prematurely. Doing it this way means that, for
3355 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3356 % ignored. But this isn't important because if people want a literal
3357 % *right* brace they would have to use a command anyway, so they may as
3358 % well use a command to get a left brace too. We could re-use the
3359 % delimiter character idea from \verb, but it seems like overkill.
3360 %
3361 \long\def\inlineraw{\tex \doinlineraw}
3362 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3363 \def\doinlinerawtwo#1,#2,\finish{%
3364 \def\inlinerawname{#1}%
3365 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3366 \endgroup % close group opened by \tex.
3367 }
3368
3369 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3370 %
3371 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3372 \long\def\doinlineifset#1,#2,\finish{%
3373 \def\inlinevarname{#1}%
3374 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3375 \else\ignorespaces#2\fi
3376 }
3377
3378 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3379 %
3380 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3381 \long\def\doinlineifclear#1,#2,\finish{%
3382 \def\inlinevarname{#1}%
3383 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3384 }
3385
3386
3387 \message{glyphs,}
3388 % and logos.
3389
3390 % @@ prints an @, as does @atchar{}.
3391 \def\@{\char64 }
3392 \let\atchar=\@
3393
3394 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3395 \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
3396 \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
3397 \let\{=\lbracechar
3398 \let\}=\rbracechar
3399
3400 % @comma{} to avoid , parsing problems.
3401 \let\comma = ,
3402
3403 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3404 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3405 \let\, = \ptexc
3406 \let\dotaccent = \ptexdot
3407 \def\ringaccent#1{{\accent23 #1}}
3408 \let\tieaccent = \ptext
3409 \let\ubaraccent = \ptexb
3410 \let\udotaccent = \d
3411
3412 % Other special characters: @questiondown @exclamdown @ordf @ordm
3413 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3414 \def\questiondown{?`}
3415 \def\exclamdown{!`}
3416 \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
3417 \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
3418
3419 % Dotless i and dotless j, used for accents.
3420 \def\imacro{i}
3421 \def\jmacro{j}
3422 \def\dotless#1{%
3423 \def\temp{#1}%
3424 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3425 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3426 \else \errmessage{@dotless can be used only with i or j}%
3427 \fi\fi
3428 }
3429
3430 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3431 % period following counts as ending a sentence. (Idea found in latex.)
3432 %
3433 \edef\TeX{\TeX \spacefactor=1000 }
3434
3435 % @LaTeX{} logo. Not quite the same results as the definition in
3436 % latex.ltx, since we use a different font for the raised A; it's most
3437 % convenient for us to use an explicitly smaller font, rather than using
3438 % the \scriptstyle font (since we don't reset \scriptstyle and
3439 % \scriptscriptstyle).
3440 %
3441 \def\LaTeX{%
3442 L\kern-.36em
3443 {\setbox0=\hbox{T}%
3444 \vbox to \ht0{\hbox{%
3445 \ifx\textnominalsize\xwordpt
3446 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
3447 % Revert to plain's \scriptsize, which is 7pt.
3448 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3449 \else
3450 % For 11pt, we can use our lllsize.
3451 \switchtolllsize A%
3452 \fi
3453 }%
3454 \vss
3455 }}%
3456 \kern-.15em
3457 \TeX
3458 }
3459
3460 % Some math mode symbols. Define \ensuremath to switch into math mode
3461 % unless we are already there. Expansion tricks may not be needed here,
3462 % but safer, and can't hurt.
3463 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3464 \def\ensuredmath#1{$\relax#1$}
3465 %
3466 \def\bullet{\ensuremath\ptexbullet}
3467 \def\geq{\ensuremath\ge}
3468 \def\leq{\ensuremath\le}
3469 \def\minus{\ensuremath-}
3470
3471 % @dots{} outputs an ellipsis using the current font.
3472 % We do .5em per period so that it has the same spacing in the cm
3473 % typewriter fonts as three actual period characters; on the other hand,
3474 % in other typewriter fonts three periods are wider than 1.5em. So do
3475 % whichever is larger.
3476 %
3477 \def\dots{%
3478 \leavevmode
3479 \setbox0=\hbox{...}% get width of three periods
3480 \ifdim\wd0 > 1.5em
3481 \dimen0 = \wd0
3482 \else
3483 \dimen0 = 1.5em
3484 \fi
3485 \hbox to \dimen0{%
3486 \hskip 0pt plus.25fil
3487 .\hskip 0pt plus1fil
3488 .\hskip 0pt plus1fil
3489 .\hskip 0pt plus.5fil
3490 }%
3491 }
3492
3493 % @enddots{} is an end-of-sentence ellipsis.
3494 %
3495 \def\enddots{%
3496 \dots
3497 \spacefactor=\endofsentencespacefactor
3498 }
3499
3500 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3501 %
3502 % Since these characters are used in examples, they should be an even number of
3503 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3504 %
3505 \def\point{$\star$}
3506 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3507 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3508 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3509 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3510 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3511
3512 % The @error{} command.
3513 % Adapted from the TeXbook's \boxit.
3514 %
3515 \newbox\errorbox
3516 %
3517 {\ttfont \global\dimen0 = 3em}% Width of the box.
3518 \dimen2 = .55pt % Thickness of rules
3519 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3520 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3521 %
3522 \setbox\errorbox=\hbox to \dimen0{\hfil
3523 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3524 \advance\hsize by -2\dimen2 % Rules.
3525 \vbox{%
3526 \hrule height\dimen2
3527 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3528 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3529 \kern3pt\vrule width\dimen2}% Space to right.
3530 \hrule height\dimen2}
3531 \hfil}
3532 %
3533 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3534
3535 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3536 %
3537 \def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi}
3538
3539 % @euro{} comes from a separate font, depending on the current style.
3540 % We use the free feym* fonts from the eurosym package by Henrik
3541 % Theiling, which support regular, slanted, bold and bold slanted (and
3542 % "outlined" (blackboard board, sort of) versions, which we don't need).
3543 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3544 %
3545 % Although only regular is the truly official Euro symbol, we ignore
3546 % that. The Euro is designed to be slightly taller than the regular
3547 % font height.
3548 %
3549 % feymr - regular
3550 % feymo - slanted
3551 % feybr - bold
3552 % feybo - bold slanted
3553 %
3554 % There is no good (free) typewriter version, to my knowledge.
3555 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3556 % Hmm.
3557 %
3558 % Also doesn't work in math. Do we need to do math with euro symbols?
3559 % Hope not.
3560 %
3561 %
3562 \def\euro{{\eurofont e}}
3563 \def\eurofont{%
3564 % We set the font at each command, rather than predefining it in
3565 % \textfonts and the other font-switching commands, so that
3566 % installations which never need the symbol don't have to have the
3567 % font installed.
3568 %
3569 % There is only one designed size (nominal 10pt), so we always scale
3570 % that to the current nominal size.
3571 %
3572 % By the way, simply using "at 1em" works for cmr10 and the like, but
3573 % does not work for cmbx10 and other extended/shrunken fonts.
3574 %
3575 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3576 %
3577 \ifx\curfontstyle\bfstylename
3578 % bold:
3579 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3580 \else
3581 % regular:
3582 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3583 \fi
3584 \thiseurofont
3585 }
3586
3587 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3588 % sometimes we redefine the original macro, and the alias should reflect
3589 % the redefinition.
3590 %
3591 % Use LaTeX names for the Icelandic letters.
3592 \def\DH{{\ecfont \char"D0}} % Eth
3593 \def\dh{{\ecfont \char"F0}} % eth
3594 \def\TH{{\ecfont \char"DE}} % Thorn
3595 \def\th{{\ecfont \char"FE}} % thorn
3596 %
3597 \def\guillemetleft{{\ecfont \char"13}}
3598 \def\guillemotleft{\guillemetleft}
3599 \def\guillemetright{{\ecfont \char"14}}
3600 \def\guillemotright{\guillemetright}
3601 \def\guilsinglleft{{\ecfont \char"0E}}
3602 \def\guilsinglright{{\ecfont \char"0F}}
3603 \def\quotedblbase{{\ecfont \char"12}}
3604 \def\quotesinglbase{{\ecfont \char"0D}}
3605 %
3606 % This positioning is not perfect (see the ogonek LaTeX package), but
3607 % we have the precomposed glyphs for the most common cases. We put the
3608 % tests to use those glyphs in the single \ogonek macro so we have fewer
3609 % dummy definitions to worry about for index entries, etc.
3610 %
3611 % ogonek is also used with other letters in Lithuanian (IOU), but using
3612 % the precomposed glyphs for those is not so easy since they aren't in
3613 % the same EC font.
3614 \def\ogonek#1{{%
3615 \def\temp{#1}%
3616 \ifx\temp\macrocharA\Aogonek
3617 \else\ifx\temp\macrochara\aogonek
3618 \else\ifx\temp\macrocharE\Eogonek
3619 \else\ifx\temp\macrochare\eogonek
3620 \else
3621 \ecfont \setbox0=\hbox{#1}%
3622 \ifdim\ht0=1ex\accent"0C #1%
3623 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3624 \fi
3625 \fi\fi\fi\fi
3626 }%
3627 }
3628 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3629 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3630 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3631 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3632 %
3633 % Use the European Computer Modern fonts (cm-super in outline format)
3634 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3635 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3636 % package and follow the same conventions.
3637 %
3638 \def\ecfont{\etcfont{e}}
3639 \def\tcfont{\etcfont{t}}
3640 %
3641 \def\etcfont#1{%
3642 % We can't distinguish serif/sans and italic/slanted, but this
3643 % is used for crude hacks anyway (like adding French and German
3644 % quotes to documents typeset with CM, where we lose kerning), so
3645 % hopefully nobody will notice/care.
3646 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3647 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3648 \ifmonospace
3649 % typewriter:
3650 \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3651 \else
3652 \ifx\curfontstyle\bfstylename
3653 % bold:
3654 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3655 \else
3656 % regular:
3657 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3658 \fi
3659 \fi
3660 \thisecfont
3661 }
3662
3663 % @registeredsymbol - R in a circle. The font for the R should really
3664 % be smaller yet, but lllsize is the best we can do for now.
3665 % Adapted from the plain.tex definition of \copyright.
3666 %
3667 \def\registeredsymbol{%
3668 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
3669 \hfil\crcr\Orb}}%
3670 }$%
3671 }
3672
3673 % @textdegree - the normal degrees sign.
3674 %
3675 \def\textdegree{$^\circ$}
3676
3677 % Laurent Siebenmann reports \Orb undefined with:
3678 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3679 % so we'll define it if necessary.
3680 %
3681 \ifx\Orb\thisisundefined
3682 \def\Orb{\mathhexbox20D}
3683 \fi
3684
3685 % Quotes.
3686 \chardef\quoteleft=`\`
3687 \chardef\quoteright=`\'
3688
3689 % only change font for tt for correct kerning and to avoid using
3690 % \ecfont unless necessary.
3691 \def\quotedblleft{%
3692 \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi
3693 }
3694
3695 \def\quotedblright{%
3696 \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi
3697 }
3698
3699
3700 \message{page headings,}
3701
3702 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3703 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3704
3705 % First the title page. Must do @settitle before @titlepage.
3706 \newif\ifseenauthor
3707 \newif\iffinishedtitlepage
3708
3709 % @setcontentsaftertitlepage used to do an implicit @contents or
3710 % @shortcontents after @end titlepage, but it is now obsolete.
3711 \def\setcontentsaftertitlepage{%
3712 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3713 command; move your @contents command if you want the contents
3714 after the title page.}}%
3715 \def\setshortcontentsaftertitlepage{%
3716 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3717 command; move your @shortcontents and @contents commands if you
3718 want the contents after the title page.}}%
3719
3720 \parseargdef\shorttitlepage{%
3721 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3722 \endgroup\page\hbox{}\page}
3723
3724 \envdef\titlepage{%
3725 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3726 \begingroup
3727 \parindent=0pt \textfonts
3728 % Leave some space at the very top of the page.
3729 \vglue\titlepagetopglue
3730 % No rule at page bottom unless we print one at the top with @title.
3731 \finishedtitlepagetrue
3732 %
3733 % Most title ``pages'' are actually two pages long, with space
3734 % at the top of the second. We don't want the ragged left on the second.
3735 \let\oldpage = \page
3736 \def\page{%
3737 \iffinishedtitlepage\else
3738 \finishtitlepage
3739 \fi
3740 \let\page = \oldpage
3741 \page
3742 \null
3743 }%
3744 }
3745
3746 \def\Etitlepage{%
3747 \iffinishedtitlepage\else
3748 \finishtitlepage
3749 \fi
3750 % It is important to do the page break before ending the group,
3751 % because the headline and footline are only empty inside the group.
3752 % If we use the new definition of \page, we always get a blank page
3753 % after the title page, which we certainly don't want.
3754 \oldpage
3755 \endgroup
3756 %
3757 % Need this before the \...aftertitlepage checks so that if they are
3758 % in effect the toc pages will come out with page numbers.
3759 \HEADINGSon
3760 }
3761
3762 \def\finishtitlepage{%
3763 \vskip4pt \hrule height 2pt width \hsize
3764 \vskip\titlepagebottomglue
3765 \finishedtitlepagetrue
3766 }
3767
3768 % Settings used for typesetting titles: no hyphenation, no indentation,
3769 % don't worry much about spacing, ragged right. This should be used
3770 % inside a \vbox, and fonts need to be set appropriately first. \par should
3771 % be specified before the end of the \vbox, since a vbox is a group.
3772 %
3773 \def\raggedtitlesettings{%
3774 \rm
3775 \hyphenpenalty=10000
3776 \parindent=0pt
3777 \tolerance=5000
3778 \ptexraggedright
3779 }
3780
3781 % Macros to be used within @titlepage:
3782
3783 \let\subtitlerm=\rmfont
3784 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3785
3786 \parseargdef\title{%
3787 \checkenv\titlepage
3788 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3789 % print a rule at the page bottom also.
3790 \finishedtitlepagefalse
3791 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3792 }
3793
3794 \parseargdef\subtitle{%
3795 \checkenv\titlepage
3796 {\subtitlefont \rightline{#1}}%
3797 }
3798
3799 % @author should come last, but may come many times.
3800 % It can also be used inside @quotation.
3801 %
3802 \parseargdef\author{%
3803 \def\temp{\quotation}%
3804 \ifx\thisenv\temp
3805 \def\quotationauthor{#1}% printed in \Equotation.
3806 \else
3807 \checkenv\titlepage
3808 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3809 {\secfonts\rm \leftline{#1}}%
3810 \fi
3811 }
3812
3813
3814 % Set up page headings and footings.
3815
3816 \let\thispage=\folio
3817
3818 \newtoks\evenheadline % headline on even pages
3819 \newtoks\oddheadline % headline on odd pages
3820 \newtoks\evenchapheadline% headline on even pages with a new chapter
3821 \newtoks\oddchapheadline % headline on odd pages with a new chapter
3822 \newtoks\evenfootline % footline on even pages
3823 \newtoks\oddfootline % footline on odd pages
3824
3825 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3826 \headline={{\textfonts\rm
3827 \ifchapterpage
3828 \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
3829 \else
3830 \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
3831 \fi}}
3832
3833 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3834 \else \the\evenfootline \fi}\HEADINGShook}
3835 \let\HEADINGShook=\relax
3836
3837 % Commands to set those variables.
3838 % For example, this is what @headings on does
3839 % @evenheading @thistitle|@thispage|@thischapter
3840 % @oddheading @thischapter|@thispage|@thistitle
3841 % @evenfooting @thisfile||
3842 % @oddfooting ||@thisfile
3843
3844
3845 \def\evenheading{\parsearg\evenheadingxxx}
3846 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3847 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3848 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
3849 \global\evenchapheadline=\evenheadline}
3850
3851 \def\oddheading{\parsearg\oddheadingxxx}
3852 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3853 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3854 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3855 \global\oddchapheadline=\oddheadline}
3856
3857 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3858
3859 \def\evenfooting{\parsearg\evenfootingxxx}
3860 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3861 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3862 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3863
3864 \def\oddfooting{\parsearg\oddfootingxxx}
3865 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3866 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3867 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3868 %
3869 % Leave some space for the footline. Hopefully ok to assume
3870 % @evenfooting will not be used by itself.
3871 \global\advance\txipageheight by -12pt
3872 \global\advance\vsize by -12pt
3873 }
3874
3875 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3876
3877 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3878 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3879 %
3880 % The same set of arguments for:
3881 %
3882 % @oddheadingmarks
3883 % @evenfootingmarks
3884 % @oddfootingmarks
3885 % @everyheadingmarks
3886 % @everyfootingmarks
3887
3888 % These define \getoddheadingmarks, \getevenheadingmarks,
3889 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3890 % \gettopheadingmarks, \getbottomheadingmarks.
3891 %
3892 \def\evenheadingmarks{\headingmarks{even}{heading}}
3893 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3894 \def\evenfootingmarks{\headingmarks{even}{footing}}
3895 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3896 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3897 \headingmarks{odd}{heading}{#1} }
3898 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3899 \headingmarks{odd}{footing}{#1} }
3900 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3901 \def\headingmarks#1#2#3 {%
3902 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3903 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3904 }
3905
3906 \everyheadingmarks bottom
3907 \everyfootingmarks bottom
3908
3909 % @headings double turns headings on for double-sided printing.
3910 % @headings single turns headings on for single-sided printing.
3911 % @headings off turns them off.
3912 % @headings on same as @headings double, retained for compatibility.
3913 % @headings after turns on double-sided headings after this page.
3914 % @headings doubleafter turns on double-sided headings after this page.
3915 % @headings singleafter turns on single-sided headings after this page.
3916 % By default, they are off at the start of a document,
3917 % and turned `on' after @end titlepage.
3918
3919 \parseargdef\headings{\csname HEADINGS#1\endcsname}
3920
3921 \def\headingsoff{% non-global headings elimination
3922 \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}%
3923 \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}%
3924 }
3925
3926 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3927 \HEADINGSoff % it's the default
3928
3929 % When we turn headings on, set the page number to 1.
3930 \def\pageone{
3931 \global\pageno=1
3932 \global\arabiccount = \pagecount
3933 }
3934
3935 % For double-sided printing, put current file name in lower left corner,
3936 % chapter name on inside top of right hand pages, document
3937 % title on inside top of left hand pages, and page numbers on outside top
3938 % edge of all pages.
3939 \def\HEADINGSdouble{%
3940 \pageone
3941 \HEADINGSdoublex
3942 }
3943 \let\contentsalignmacro = \chappager
3944
3945 % For single-sided printing, chapter title goes across top left of page,
3946 % page number on top right.
3947 \def\HEADINGSsingle{%
3948 \pageone
3949 \HEADINGSsinglex
3950 }
3951 \def\HEADINGSon{\HEADINGSdouble}
3952
3953 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3954 \let\HEADINGSdoubleafter=\HEADINGSafter
3955 \def\HEADINGSdoublex{%
3956 \global\evenfootline={\hfil}
3957 \global\oddfootline={\hfil}
3958 \global\evenheadline={\line{\folio\hfil\thistitle}}
3959 \global\oddheadline={\line{\thischapter\hfil\folio}}
3960 \global\evenchapheadline={\line{\folio\hfil}}
3961 \global\oddchapheadline={\line{\hfil\folio}}
3962 \global\let\contentsalignmacro = \chapoddpage
3963 }
3964
3965 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3966 \def\HEADINGSsinglex{%
3967 \global\evenfootline={\hfil}
3968 \global\oddfootline={\hfil}
3969 \global\evenheadline={\line{\thischapter\hfil\folio}}
3970 \global\oddheadline={\line{\thischapter\hfil\folio}}
3971 \global\evenchapheadline={\line{\hfil\folio}}
3972 \global\oddchapheadline={\line{\hfil\folio}}
3973 \global\let\contentsalignmacro = \chappager
3974 }
3975
3976 % for @setchapternewpage off
3977 \def\HEADINGSsinglechapoff{%
3978 \pageone
3979 \global\evenfootline={\hfil}
3980 \global\oddfootline={\hfil}
3981 \global\evenheadline={\line{\thischapter\hfil\folio}}
3982 \global\oddheadline={\line{\thischapter\hfil\folio}}
3983 \global\evenchapheadline=\evenheadline
3984 \global\oddchapheadline=\oddheadline
3985 \global\let\contentsalignmacro = \chappager
3986 }
3987
3988 % Subroutines used in generating headings
3989 % This produces Day Month Year style of output.
3990 % Only define if not already defined, in case a txi-??.tex file has set
3991 % up a different format (e.g., txi-cs.tex does this).
3992 \ifx\today\thisisundefined
3993 \def\today{%
3994 \number\day\space
3995 \ifcase\month
3996 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3997 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3998 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3999 \fi
4000 \space\number\year}
4001 \fi
4002
4003 % @settitle line... specifies the title of the document, for headings.
4004 % It generates no output of its own.
4005 \def\thistitle{\putwordNoTitle}
4006 \def\settitle{\parsearg{\gdef\thistitle}}
4007
4008
4009 \message{tables,}
4010 % Tables -- @table, @ftable, @vtable, @item(x).
4011
4012 % default indentation of table text
4013 \newdimen\tableindent \tableindent=.8in
4014 % default indentation of @itemize and @enumerate text
4015 \newdimen\itemindent \itemindent=.3in
4016 % margin between end of table item and start of table text.
4017 \newdimen\itemmargin \itemmargin=.1in
4018
4019 % used internally for \itemindent minus \itemmargin
4020 \newdimen\itemmax
4021
4022 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
4023 % these defs.
4024 % They also define \itemindex
4025 % to index the item name in whatever manner is desired (perhaps none).
4026
4027 \newif\ifitemxneedsnegativevskip
4028
4029 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4030
4031 \def\internalBitem{\smallbreak \parsearg\itemzzz}
4032 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
4033
4034 \def\itemzzz #1{\begingroup %
4035 \advance\hsize by -\rightskip
4036 \advance\hsize by -\tableindent
4037 \setbox0=\hbox{\itemindicate{#1}}%
4038 \itemindex{#1}%
4039 \nobreak % This prevents a break before @itemx.
4040 %
4041 % If the item text does not fit in the space we have, put it on a line
4042 % by itself, and do not allow a page break either before or after that
4043 % line. We do not start a paragraph here because then if the next
4044 % command is, e.g., @kindex, the whatsit would get put into the
4045 % horizontal list on a line by itself, resulting in extra blank space.
4046 \ifdim \wd0>\itemmax
4047 %
4048 % Make this a paragraph so we get the \parskip glue and wrapping,
4049 % but leave it ragged-right.
4050 \begingroup
4051 \advance\leftskip by-\tableindent
4052 \advance\hsize by\tableindent
4053 \advance\rightskip by0pt plus1fil\relax
4054 \leavevmode\unhbox0\par
4055 \endgroup
4056 %
4057 % We're going to be starting a paragraph, but we don't want the
4058 % \parskip glue -- logically it's part of the @item we just started.
4059 \nobreak \vskip-\parskip
4060 %
4061 % Stop a page break at the \parskip glue coming up. However, if
4062 % what follows is an environment such as @example, there will be no
4063 % \parskip glue; then the negative vskip we just inserted would
4064 % cause the example and the item to crash together. So we use this
4065 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4066 % \parskip glue after all. Section titles are handled this way also.
4067 %
4068 \penalty 10001
4069 \endgroup
4070 \itemxneedsnegativevskipfalse
4071 \else
4072 % The item text fits into the space. Start a paragraph, so that the
4073 % following text (if any) will end up on the same line.
4074 \noindent
4075 % Do this with kerns and \unhbox so that if there is a footnote in
4076 % the item text, it can migrate to the main vertical list and
4077 % eventually be printed.
4078 \nobreak\kern-\tableindent
4079 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4080 \unhbox0
4081 \nobreak\kern\dimen0
4082 \endgroup
4083 \itemxneedsnegativevskiptrue
4084 \fi
4085 }
4086
4087 \def\item{\errmessage{@item while not in a list environment}}
4088 \def\itemx{\errmessage{@itemx while not in a list environment}}
4089
4090 % @table, @ftable, @vtable.
4091 \envdef\table{%
4092 \let\itemindex\gobble
4093 \tablecheck{table}%
4094 }
4095 \envdef\ftable{%
4096 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4097 \tablecheck{ftable}%
4098 }
4099 \envdef\vtable{%
4100 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4101 \tablecheck{vtable}%
4102 }
4103 \def\tablecheck#1{%
4104 \ifnum \the\catcode`\^^M=\active
4105 \endgroup
4106 \errmessage{This command won't work in this context; perhaps the problem is
4107 that we are \inenvironment\thisenv}%
4108 \def\next{\doignore{#1}}%
4109 \else
4110 \let\next\tablex
4111 \fi
4112 \next
4113 }
4114 \def\tablex#1{%
4115 \def\itemindicate{#1}%
4116 \parsearg\tabley
4117 }
4118 \def\tabley#1{%
4119 {%
4120 \makevalueexpandable
4121 \edef\temp{\noexpand\tablez #1\space\space\space}%
4122 \expandafter
4123 }\temp \endtablez
4124 }
4125 \def\tablez #1 #2 #3 #4\endtablez{%
4126 \aboveenvbreak
4127 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4128 \ifnum 0#2>0 \tableindent=#2\mil \fi
4129 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4130 \itemmax=\tableindent
4131 \advance \itemmax by -\itemmargin
4132 \advance \leftskip by \tableindent
4133 \exdentamount=\tableindent
4134 \parindent = 0pt
4135 \parskip = \smallskipamount
4136 \ifdim \parskip=0pt \parskip=2pt \fi
4137 \let\item = \internalBitem
4138 \let\itemx = \internalBitemx
4139 }
4140 \def\Etable{\endgraf\afterenvbreak}
4141 \let\Eftable\Etable
4142 \let\Evtable\Etable
4143 \let\Eitemize\Etable
4144 \let\Eenumerate\Etable
4145
4146 % This is the counter used by @enumerate, which is really @itemize
4147
4148 \newcount \itemno
4149
4150 \envdef\itemize{\parsearg\doitemize}
4151
4152 \def\doitemize#1{%
4153 \aboveenvbreak
4154 \itemmax=\itemindent
4155 \advance\itemmax by -\itemmargin
4156 \advance\leftskip by \itemindent
4157 \exdentamount=\itemindent
4158 \parindent=0pt
4159 \parskip=\smallskipamount
4160 \ifdim\parskip=0pt \parskip=2pt \fi
4161 %
4162 % Try typesetting the item mark so that if the document erroneously says
4163 % something like @itemize @samp (intending @table), there's an error
4164 % right away at the @itemize. It's not the best error message in the
4165 % world, but it's better than leaving it to the @item. This means if
4166 % the user wants an empty mark, they have to say @w{} not just @w.
4167 \def\itemcontents{#1}%
4168 \setbox0 = \hbox{\itemcontents}%
4169 %
4170 % @itemize with no arg is equivalent to @itemize @bullet.
4171 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4172 %
4173 \let\item=\itemizeitem
4174 }
4175
4176 % Definition of @item while inside @itemize and @enumerate.
4177 %
4178 \def\itemizeitem{%
4179 \advance\itemno by 1 % for enumerations
4180 {\let\par=\endgraf \smallbreak}% reasonable place to break
4181 {%
4182 % If the document has an @itemize directly after a section title, a
4183 % \nobreak will be last on the list, and \sectionheading will have
4184 % done a \vskip-\parskip. In that case, we don't want to zero
4185 % parskip, or the item text will crash with the heading. On the
4186 % other hand, when there is normal text preceding the item (as there
4187 % usually is), we do want to zero parskip, or there would be too much
4188 % space. In that case, we won't have a \nobreak before. At least
4189 % that's the theory.
4190 \ifnum\lastpenalty<10000 \parskip=0in \fi
4191 \noindent
4192 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4193 %
4194 \ifinner\else
4195 \vadjust{\penalty 1200}% not good to break after first line of item.
4196 \fi
4197 % We can be in inner vertical mode in a footnote, although an
4198 % @itemize looks awful there.
4199 }%
4200 \flushcr
4201 }
4202
4203 % \splitoff TOKENS\endmark defines \first to be the first token in
4204 % TOKENS, and \rest to be the remainder.
4205 %
4206 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4207
4208 % Allow an optional argument of an uppercase letter, lowercase letter,
4209 % or number, to specify the first label in the enumerated list. No
4210 % argument is the same as `1'.
4211 %
4212 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4213 \def\enumeratey #1 #2\endenumeratey{%
4214 % If we were given no argument, pretend we were given `1'.
4215 \def\thearg{#1}%
4216 \ifx\thearg\empty \def\thearg{1}\fi
4217 %
4218 % Detect if the argument is a single token. If so, it might be a
4219 % letter. Otherwise, the only valid thing it can be is a number.
4220 % (We will always have one token, because of the test we just made.
4221 % This is a good thing, since \splitoff doesn't work given nothing at
4222 % all -- the first parameter is undelimited.)
4223 \expandafter\splitoff\thearg\endmark
4224 \ifx\rest\empty
4225 % Only one token in the argument. It could still be anything.
4226 % A ``lowercase letter'' is one whose \lccode is nonzero.
4227 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4228 % not equal to itself.
4229 % Otherwise, we assume it's a number.
4230 %
4231 % We need the \relax at the end of the \ifnum lines to stop TeX from
4232 % continuing to look for a <number>.
4233 %
4234 \ifnum\lccode\expandafter`\thearg=0\relax
4235 \numericenumerate % a number (we hope)
4236 \else
4237 % It's a letter.
4238 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4239 \lowercaseenumerate % lowercase letter
4240 \else
4241 \uppercaseenumerate % uppercase letter
4242 \fi
4243 \fi
4244 \else
4245 % Multiple tokens in the argument. We hope it's a number.
4246 \numericenumerate
4247 \fi
4248 }
4249
4250 % An @enumerate whose labels are integers. The starting integer is
4251 % given in \thearg.
4252 %
4253 \def\numericenumerate{%
4254 \itemno = \thearg
4255 \startenumeration{\the\itemno}%
4256 }
4257
4258 % The starting (lowercase) letter is in \thearg.
4259 \def\lowercaseenumerate{%
4260 \itemno = \expandafter`\thearg
4261 \startenumeration{%
4262 % Be sure we're not beyond the end of the alphabet.
4263 \ifnum\itemno=0
4264 \errmessage{No more lowercase letters in @enumerate; get a bigger
4265 alphabet}%
4266 \fi
4267 \char\lccode\itemno
4268 }%
4269 }
4270
4271 % The starting (uppercase) letter is in \thearg.
4272 \def\uppercaseenumerate{%
4273 \itemno = \expandafter`\thearg
4274 \startenumeration{%
4275 % Be sure we're not beyond the end of the alphabet.
4276 \ifnum\itemno=0
4277 \errmessage{No more uppercase letters in @enumerate; get a bigger
4278 alphabet}
4279 \fi
4280 \char\uccode\itemno
4281 }%
4282 }
4283
4284 % Call \doitemize, adding a period to the first argument and supplying the
4285 % common last two arguments. Also subtract one from the initial value in
4286 % \itemno, since @item increments \itemno.
4287 %
4288 \def\startenumeration#1{%
4289 \advance\itemno by -1
4290 \doitemize{#1.}\flushcr
4291 }
4292
4293 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
4294 % to @enumerate.
4295 %
4296 \def\alphaenumerate{\enumerate{a}}
4297 \def\capsenumerate{\enumerate{A}}
4298 \def\Ealphaenumerate{\Eenumerate}
4299 \def\Ecapsenumerate{\Eenumerate}
4300
4301
4302 % @multitable macros
4303 % Amy Hendrickson, 8/18/94, 3/6/96
4304 %
4305 % @multitable ... @end multitable will make as many columns as desired.
4306 % Contents of each column will wrap at width given in preamble. Width
4307 % can be specified either with sample text given in a template line,
4308 % or in percent of \hsize, the current width of text on page.
4309
4310 % Table can continue over pages but will only break between lines.
4311
4312 % To make preamble:
4313 %
4314 % Either define widths of columns in terms of percent of \hsize:
4315 % @multitable @columnfractions .25 .3 .45
4316 % @item ...
4317 %
4318 % Numbers following @columnfractions are the percent of the total
4319 % current hsize to be used for each column. You may use as many
4320 % columns as desired.
4321
4322
4323 % Or use a template:
4324 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4325 % @item ...
4326 % using the widest term desired in each column.
4327
4328 % Each new table line starts with @item, each subsequent new column
4329 % starts with @tab. Empty columns may be produced by supplying @tab's
4330 % with nothing between them for as many times as empty columns are needed,
4331 % ie, @tab@tab@tab will produce two empty columns.
4332
4333 % @item, @tab do not need to be on their own lines, but it will not hurt
4334 % if they are.
4335
4336 % Sample multitable:
4337
4338 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4339 % @item first col stuff @tab second col stuff @tab third col
4340 % @item
4341 % first col stuff
4342 % @tab
4343 % second col stuff
4344 % @tab
4345 % third col
4346 % @item first col stuff @tab second col stuff
4347 % @tab Many paragraphs of text may be used in any column.
4348 %
4349 % They will wrap at the width determined by the template.
4350 % @item@tab@tab This will be in third column.
4351 % @end multitable
4352
4353 % Default dimensions may be reset by user.
4354 % @multitableparskip is vertical space between paragraphs in table.
4355 % @multitableparindent is paragraph indent in table.
4356 % @multitablecolmargin is horizontal space to be left between columns.
4357 % @multitablelinespace is space to leave between table items, baseline
4358 % to baseline.
4359 % 0pt means it depends on current normal line spacing.
4360 %
4361 \newskip\multitableparskip
4362 \newskip\multitableparindent
4363 \newdimen\multitablecolspace
4364 \newskip\multitablelinespace
4365 \multitableparskip=0pt
4366 \multitableparindent=6pt
4367 \multitablecolspace=12pt
4368 \multitablelinespace=0pt
4369
4370 % Macros used to set up halign preamble:
4371 %
4372 \let\endsetuptable\relax
4373 \def\xendsetuptable{\endsetuptable}
4374 \let\columnfractions\relax
4375 \def\xcolumnfractions{\columnfractions}
4376 \newif\ifsetpercent
4377
4378 % #1 is the @columnfraction, usually a decimal number like .5, but might
4379 % be just 1. We just use it, whatever it is.
4380 %
4381 \def\pickupwholefraction#1 {%
4382 \global\advance\colcount by 1
4383 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4384 \setuptable
4385 }
4386
4387 \newcount\colcount
4388 \def\setuptable#1{%
4389 \def\firstarg{#1}%
4390 \ifx\firstarg\xendsetuptable
4391 \let\go = \relax
4392 \else
4393 \ifx\firstarg\xcolumnfractions
4394 \global\setpercenttrue
4395 \else
4396 \ifsetpercent
4397 \let\go\pickupwholefraction
4398 \else
4399 \global\advance\colcount by 1
4400 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4401 % separator; typically that is always in the input, anyway.
4402 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4403 \fi
4404 \fi
4405 \ifx\go\pickupwholefraction
4406 % Put the argument back for the \pickupwholefraction call, so
4407 % we'll always have a period there to be parsed.
4408 \def\go{\pickupwholefraction#1}%
4409 \else
4410 \let\go = \setuptable
4411 \fi%
4412 \fi
4413 \go
4414 }
4415
4416 % multitable-only commands.
4417 %
4418 % @headitem starts a heading row, which we typeset in bold. Assignments
4419 % have to be global since we are inside the implicit group of an
4420 % alignment entry. \everycr below resets \everytab so we don't have to
4421 % undo it ourselves.
4422 \def\headitemfont{\b}% for people to use in the template row; not changeable
4423 \def\headitem{%
4424 \checkenv\multitable
4425 \crcr
4426 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4427 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4428 \the\everytab % for the first item
4429 }%
4430 %
4431 % default for tables with no headings.
4432 \let\headitemcrhook=\relax
4433 %
4434 % A \tab used to include \hskip1sp. But then the space in a template
4435 % line is not enough. That is bad. So let's go back to just `&' until
4436 % we again encounter the problem the 1sp was intended to solve.
4437 % --karl, nathan (a] acm.org, 20apr99.
4438 \def\tab{\checkenv\multitable &\the\everytab}%
4439
4440 % @multitable ... @end multitable definitions:
4441 %
4442 \newtoks\everytab % insert after every tab.
4443 %
4444 \envdef\multitable{%
4445 \vskip\parskip
4446 \startsavinginserts
4447 %
4448 % @item within a multitable starts a normal row.
4449 % We use \def instead of \let so that if one of the multitable entries
4450 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4451 % \endtemplate) expanding \doitemize.
4452 \def\item{\crcr}%
4453 %
4454 \tolerance=9500
4455 \hbadness=9500
4456 \setmultitablespacing
4457 \parskip=\multitableparskip
4458 \parindent=\multitableparindent
4459 \overfullrule=0pt
4460 \global\colcount=0
4461 %
4462 \everycr = {%
4463 \noalign{%
4464 \global\everytab={}% Reset from possible headitem.
4465 \global\colcount=0 % Reset the column counter.
4466 %
4467 % Check for saved footnotes, etc.:
4468 \checkinserts
4469 %
4470 % Perhaps a \nobreak, then reset:
4471 \headitemcrhook
4472 \global\let\headitemcrhook=\relax
4473 }%
4474 }%
4475 %
4476 \parsearg\domultitable
4477 }
4478 \def\domultitable#1{%
4479 % To parse everything between @multitable and @item:
4480 \setuptable#1 \endsetuptable
4481 %
4482 % This preamble sets up a generic column definition, which will
4483 % be used as many times as user calls for columns.
4484 % \vtop will set a single line and will also let text wrap and
4485 % continue for many paragraphs if desired.
4486 \halign\bgroup &%
4487 \global\advance\colcount by 1
4488 \multistrut
4489 \vtop{%
4490 % Use the current \colcount to find the correct column width:
4491 \hsize=\expandafter\csname col\the\colcount\endcsname
4492 %
4493 % In order to keep entries from bumping into each other
4494 % we will add a \leftskip of \multitablecolspace to all columns after
4495 % the first one.
4496 %
4497 % If a template has been used, we will add \multitablecolspace
4498 % to the width of each template entry.
4499 %
4500 % If the user has set preamble in terms of percent of \hsize we will
4501 % use that dimension as the width of the column, and the \leftskip
4502 % will keep entries from bumping into each other. Table will start at
4503 % left margin and final column will justify at right margin.
4504 %
4505 % Make sure we don't inherit \rightskip from the outer environment.
4506 \rightskip=0pt
4507 \ifnum\colcount=1
4508 % The first column will be indented with the surrounding text.
4509 \advance\hsize by\leftskip
4510 \else
4511 \ifsetpercent \else
4512 % If user has not set preamble in terms of percent of \hsize
4513 % we will advance \hsize by \multitablecolspace.
4514 \advance\hsize by \multitablecolspace
4515 \fi
4516 % In either case we will make \leftskip=\multitablecolspace:
4517 \leftskip=\multitablecolspace
4518 \fi
4519 % Ignoring space at the beginning and end avoids an occasional spurious
4520 % blank line, when TeX decides to break the line at the space before the
4521 % box from the multistrut, so the strut ends up on a line by itself.
4522 % For example:
4523 % @multitable @columnfractions .11 .89
4524 % @item @code{#}
4525 % @tab Legal holiday which is valid in major parts of the whole country.
4526 % Is automatically provided with highlighting sequences respectively
4527 % marking characters.
4528 \noindent\ignorespaces##\unskip\multistrut
4529 }\cr
4530 }
4531 \def\Emultitable{%
4532 \crcr
4533 \egroup % end the \halign
4534 \global\setpercentfalse
4535 }
4536
4537 \def\setmultitablespacing{%
4538 \def\multistrut{\strut}% just use the standard line spacing
4539 %
4540 % Compute \multitablelinespace (if not defined by user) for use in
4541 % \multitableparskip calculation. We used define \multistrut based on
4542 % this, but (ironically) that caused the spacing to be off.
4543 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4544 \ifdim\multitablelinespace=0pt
4545 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4546 \global\advance\multitablelinespace by-\ht0
4547 \fi
4548 % Test to see if parskip is larger than space between lines of
4549 % table. If not, do nothing.
4550 % If so, set to same dimension as multitablelinespace.
4551 \ifdim\multitableparskip>\multitablelinespace
4552 \global\multitableparskip=\multitablelinespace
4553 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4554 % than skip between lines in the table.
4555 \fi%
4556 \ifdim\multitableparskip=0pt
4557 \global\multitableparskip=\multitablelinespace
4558 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4559 % than skip between lines in the table.
4560 \fi}
4561
4562
4563 \message{conditionals,}
4564
4565 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4566 % @ifnotxml always succeed. They currently do nothing; we don't
4567 % attempt to check whether the conditionals are properly nested. But we
4568 % have to remember that they are conditionals, so that @end doesn't
4569 % attempt to close an environment group.
4570 %
4571 \def\makecond#1{%
4572 \expandafter\let\csname #1\endcsname = \relax
4573 \expandafter\let\csname iscond.#1\endcsname = 1
4574 }
4575 \makecond{iftex}
4576 \makecond{ifnotdocbook}
4577 \makecond{ifnothtml}
4578 \makecond{ifnotinfo}
4579 \makecond{ifnotplaintext}
4580 \makecond{ifnotxml}
4581
4582 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4583 %
4584 \def\direntry{\doignore{direntry}}
4585 \def\documentdescription{\doignore{documentdescription}}
4586 \def\docbook{\doignore{docbook}}
4587 \def\html{\doignore{html}}
4588 \def\ifdocbook{\doignore{ifdocbook}}
4589 \def\ifhtml{\doignore{ifhtml}}
4590 \def\ifinfo{\doignore{ifinfo}}
4591 \def\ifnottex{\doignore{ifnottex}}
4592 \def\ifplaintext{\doignore{ifplaintext}}
4593 \def\ifxml{\doignore{ifxml}}
4594 \def\ignore{\doignore{ignore}}
4595 \def\menu{\doignore{menu}}
4596 \def\xml{\doignore{xml}}
4597
4598 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4599 %
4600 % A count to remember the depth of nesting.
4601 \newcount\doignorecount
4602
4603 \def\doignore#1{\begingroup
4604 % Scan in ``verbatim'' mode:
4605 \obeylines
4606 \catcode`\@ = \other
4607 \catcode`\{ = \other
4608 \catcode`\} = \other
4609 %
4610 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4611 \spaceisspace
4612 %
4613 % Count number of #1's that we've seen.
4614 \doignorecount = 0
4615 %
4616 % Swallow text until we reach the matching `@end #1'.
4617 \dodoignore{#1}%
4618 }
4619
4620 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4621 \obeylines %
4622 %
4623 \gdef\dodoignore#1{%
4624 % #1 contains the command name as a string, e.g., `ifinfo'.
4625 %
4626 % Define a command to find the next `@end #1'.
4627 \long\def\doignoretext##1^^M@end #1{%
4628 \doignoretextyyy##1^^M@#1\_STOP_}%
4629 %
4630 % And this command to find another #1 command, at the beginning of a
4631 % line. (Otherwise, we would consider a line `@c @ifset', for
4632 % example, to count as an @ifset for nesting.)
4633 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4634 %
4635 % And now expand that command.
4636 \doignoretext ^^M%
4637 }%
4638 }
4639
4640 \def\doignoreyyy#1{%
4641 \def\temp{#1}%
4642 \ifx\temp\empty % Nothing found.
4643 \let\next\doignoretextzzz
4644 \else % Found a nested condition, ...
4645 \advance\doignorecount by 1
4646 \let\next\doignoretextyyy % ..., look for another.
4647 % If we're here, #1 ends with ^^M\ifinfo (for example).
4648 \fi
4649 \next #1% the token \_STOP_ is present just after this macro.
4650 }
4651
4652 % We have to swallow the remaining "\_STOP_".
4653 %
4654 \def\doignoretextzzz#1{%
4655 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4656 \let\next\enddoignore
4657 \else % Still inside a nested condition.
4658 \advance\doignorecount by -1
4659 \let\next\doignoretext % Look for the next @end.
4660 \fi
4661 \next
4662 }
4663
4664 % Finish off ignored text.
4665 { \obeylines%
4666 % Ignore anything after the last `@end #1'; this matters in verbatim
4667 % environments, where otherwise the newline after an ignored conditional
4668 % would result in a blank line in the output.
4669 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4670 }
4671
4672
4673 % @set VAR sets the variable VAR to an empty value.
4674 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4675 %
4676 % Since we want to separate VAR from REST-OF-LINE (which might be
4677 % empty), we can't just use \parsearg; we have to insert a space of our
4678 % own to delimit the rest of the line, and then take it out again if we
4679 % didn't need it.
4680 % We rely on the fact that \parsearg sets \catcode`\ =10.
4681 %
4682 \parseargdef\set{\setyyy#1 \endsetyyy}
4683 \def\setyyy#1 #2\endsetyyy{%
4684 {%
4685 \makevalueexpandable
4686 \def\temp{#2}%
4687 \edef\next{\gdef\makecsname{SET#1}}%
4688 \ifx\temp\empty
4689 \next{}%
4690 \else
4691 \setzzz#2\endsetzzz
4692 \fi
4693 }%
4694 }
4695 % Remove the trailing space \setxxx inserted.
4696 \def\setzzz#1 \endsetzzz{\next{#1}}
4697
4698 % @clear VAR clears (i.e., unsets) the variable VAR.
4699 %
4700 \parseargdef\clear{%
4701 {%
4702 \makevalueexpandable
4703 \global\expandafter\let\csname SET#1\endcsname=\relax
4704 }%
4705 }
4706
4707 % @value{foo} gets the text saved in variable foo.
4708 \def\value{\begingroup\makevalueexpandable\valuexxx}
4709 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4710 {
4711 \catcode`\-=\active \catcode`\_=\active
4712 %
4713 \gdef\makevalueexpandable{%
4714 \let\value = \expandablevalue
4715 % We don't want these characters active, ...
4716 \catcode`\-=\other \catcode`\_=\other
4717 % ..., but we might end up with active ones in the argument if
4718 % we're called from @code, as @code{@value{foo-bar_}}, though.
4719 % So \let them to their normal equivalents.
4720 \let-\normaldash \let_\normalunderscore
4721 }
4722 }
4723
4724 \def\expandablevalue#1{%
4725 \expandafter\ifx\csname SET#1\endcsname\relax
4726 {[No value for ``#1'']}%
4727 \message{Variable `#1', used in @value, is not set.}%
4728 \else
4729 \csname SET#1\endcsname
4730 \fi
4731 }
4732
4733 % Like \expandablevalue, but completely expandable (the \message in the
4734 % definition above operates at the execution level of TeX). Used when
4735 % writing to auxiliary files, due to the expansion that \write does.
4736 % If flag is undefined, pass through an unexpanded @value command: maybe it
4737 % will be set by the time it is read back in.
4738 %
4739 % NB flag names containing - or _ may not work here.
4740 \def\dummyvalue#1{%
4741 \expandafter\ifx\csname SET#1\endcsname\relax
4742 \string\value{#1}%
4743 \else
4744 \csname SET#1\endcsname
4745 \fi
4746 }
4747
4748 % Used for @value's in index entries to form the sort key: expand the @value
4749 % if possible, otherwise sort late.
4750 \def\indexnofontsvalue#1{%
4751 \expandafter\ifx\csname SET#1\endcsname\relax
4752 ZZZZZZZ%
4753 \else
4754 \csname SET#1\endcsname
4755 \fi
4756 }
4757
4758 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4759 % with @set.
4760 %
4761 % To get the special treatment we need for `@end ifset,' we call
4762 % \makecond and then redefine.
4763 %
4764 \makecond{ifset}
4765 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4766 \def\doifset#1#2{%
4767 {%
4768 \makevalueexpandable
4769 \let\next=\empty
4770 \expandafter\ifx\csname SET#2\endcsname\relax
4771 #1% If not set, redefine \next.
4772 \fi
4773 \expandafter
4774 }\next
4775 }
4776 \def\ifsetfail{\doignore{ifset}}
4777
4778 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4779 % defined with @set, or has been undefined with @clear.
4780 %
4781 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4782 % above code: if the variable is not set, do nothing, if it is set,
4783 % then redefine \next to \ifclearfail.
4784 %
4785 \makecond{ifclear}
4786 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4787 \def\ifclearfail{\doignore{ifclear}}
4788
4789 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4790 % without the @) is in fact defined. We can only feasibly check at the
4791 % TeX level, so something like `mathcode' is going to considered
4792 % defined even though it is not a Texinfo command.
4793 %
4794 \makecond{ifcommanddefined}
4795 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4796 %
4797 \def\doifcmddefined#1#2{{%
4798 \makevalueexpandable
4799 \let\next=\empty
4800 \expandafter\ifx\csname #2\endcsname\relax
4801 #1% If not defined, \let\next as above.
4802 \fi
4803 \expandafter
4804 }\next
4805 }
4806 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4807
4808 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4809 \makecond{ifcommandnotdefined}
4810 \def\ifcommandnotdefined{%
4811 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4812 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4813
4814 % Set the `txicommandconditionals' variable, so documents have a way to
4815 % test if the @ifcommand...defined conditionals are available.
4816 \set txicommandconditionals
4817
4818 % @dircategory CATEGORY -- specify a category of the dir file
4819 % which this file should belong to. Ignore this in TeX.
4820 \let\dircategory=\comment
4821
4822 % @defininfoenclose.
4823 \let\definfoenclose=\comment
4824
4825
4826 \message{indexing,}
4827 % Index generation facilities
4828
4829 % Define \newwrite to be identical to plain tex's \newwrite
4830 % except not \outer, so it can be used within macros and \if's.
4831 \edef\newwrite{\makecsname{ptexnewwrite}}
4832
4833 % \newindex {foo} defines an index named IX.
4834 % It automatically defines \IXindex such that
4835 % \IXindex ...rest of line... puts an entry in the index IX.
4836 % It also defines \IXindfile to be the number of the output channel for
4837 % the file that accumulates this index. The file's extension is IX.
4838 % The name of an index should be no more than 2 characters long
4839 % for the sake of vms.
4840 %
4841 \def\newindex#1{%
4842 \expandafter\chardef\csname#1indfile\endcsname=0
4843 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4844 \noexpand\doindex{#1}}
4845 }
4846
4847 % @defindex foo == \newindex{foo}
4848 %
4849 \def\defindex{\parsearg\newindex}
4850
4851 % Define @defcodeindex, like @defindex except put all entries in @code.
4852 %
4853 \def\defcodeindex{\parsearg\newcodeindex}
4854 %
4855 \def\newcodeindex#1{%
4856 \expandafter\chardef\csname#1indfile\endcsname=0
4857 \expandafter\xdef\csname#1index\endcsname{%
4858 \noexpand\docodeindex{#1}}%
4859 }
4860
4861 % The default indices:
4862 \newindex{cp}% concepts,
4863 \newcodeindex{fn}% functions,
4864 \newcodeindex{vr}% variables,
4865 \newcodeindex{tp}% types,
4866 \newcodeindex{ky}% keys
4867 \newcodeindex{pg}% and programs.
4868
4869
4870 % @synindex foo bar makes index foo feed into index bar.
4871 % Do this instead of @defindex foo if you don't want it as a separate index.
4872 %
4873 % @syncodeindex foo bar similar, but put all entries made for index foo
4874 % inside @code.
4875 %
4876 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4877 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4878
4879 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4880 % #3 the target index (bar).
4881 \def\dosynindex#1#2#3{%
4882 \requireopenindexfile{#3}%
4883 % redefine \fooindfile:
4884 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4885 \expandafter\let\csname#2indfile\endcsname=\temp
4886 % redefine \fooindex:
4887 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4888 }
4889
4890 % Define \doindex, the driver for all index macros.
4891 % Argument #1 is generated by the calling \fooindex macro,
4892 % and it is the two-letter name of the index.
4893
4894 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4895 \def\doindexxxx #1{\doind{\indexname}{#1}}
4896
4897 % like the previous two, but they put @code around the argument.
4898 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4899 \def\docodeindexxxx #1{\docind{\indexname}{#1}}
4900
4901
4902 % Used for the aux, toc and index files to prevent expansion of Texinfo
4903 % commands.
4904 %
4905 \def\atdummies{%
4906 \definedummyletter\@%
4907 \definedummyletter\ %
4908 \definedummyletter\{%
4909 \definedummyletter\}%
4910 \definedummyletter\&%
4911 %
4912 % Do the redefinitions.
4913 \definedummies
4914 \otherbackslash
4915 }
4916
4917 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4918 % preventing its expansion. This is used only for control words,
4919 % not control letters, because the \space would be incorrect for
4920 % control characters, but is needed to separate the control word
4921 % from whatever follows.
4922 %
4923 % These can be used both for control words that take an argument and
4924 % those that do not. If it is followed by {arg} in the input, then
4925 % that will dutifully get written to the index (or wherever).
4926 %
4927 % For control letters, we have \definedummyletter, which omits the
4928 % space.
4929 %
4930 \def\definedummyword #1{\def#1{\string#1\space}}%
4931 \def\definedummyletter#1{\def#1{\string#1}}%
4932 \let\definedummyaccent\definedummyletter
4933
4934 % Called from \atdummies to prevent the expansion of commands.
4935 %
4936 \def\definedummies{%
4937 %
4938 \let\commondummyword\definedummyword
4939 \let\commondummyletter\definedummyletter
4940 \let\commondummyaccent\definedummyaccent
4941 \commondummiesnofonts
4942 %
4943 \definedummyletter\_%
4944 \definedummyletter\-%
4945 %
4946 % Non-English letters.
4947 \definedummyword\AA
4948 \definedummyword\AE
4949 \definedummyword\DH
4950 \definedummyword\L
4951 \definedummyword\O
4952 \definedummyword\OE
4953 \definedummyword\TH
4954 \definedummyword\aa
4955 \definedummyword\ae
4956 \definedummyword\dh
4957 \definedummyword\exclamdown
4958 \definedummyword\l
4959 \definedummyword\o
4960 \definedummyword\oe
4961 \definedummyword\ordf
4962 \definedummyword\ordm
4963 \definedummyword\questiondown
4964 \definedummyword\ss
4965 \definedummyword\th
4966 %
4967 % Although these internal commands shouldn't show up, sometimes they do.
4968 \definedummyword\bf
4969 \definedummyword\gtr
4970 \definedummyword\hat
4971 \definedummyword\less
4972 \definedummyword\sf
4973 \definedummyword\sl
4974 \definedummyword\tclose
4975 \definedummyword\tt
4976 %
4977 \definedummyword\LaTeX
4978 \definedummyword\TeX
4979 %
4980 % Assorted special characters.
4981 \definedummyword\ampchar
4982 \definedummyword\atchar
4983 \definedummyword\arrow
4984 \definedummyword\backslashchar
4985 \definedummyword\bullet
4986 \definedummyword\comma
4987 \definedummyword\copyright
4988 \definedummyword\registeredsymbol
4989 \definedummyword\dots
4990 \definedummyword\enddots
4991 \definedummyword\entrybreak
4992 \definedummyword\equiv
4993 \definedummyword\error
4994 \definedummyword\euro
4995 \definedummyword\expansion
4996 \definedummyword\geq
4997 \definedummyword\guillemetleft
4998 \definedummyword\guillemetright
4999 \definedummyword\guilsinglleft
5000 \definedummyword\guilsinglright
5001 \definedummyword\lbracechar
5002 \definedummyword\leq
5003 \definedummyword\mathopsup
5004 \definedummyword\minus
5005 \definedummyword\ogonek
5006 \definedummyword\pounds
5007 \definedummyword\point
5008 \definedummyword\print
5009 \definedummyword\quotedblbase
5010 \definedummyword\quotedblleft
5011 \definedummyword\quotedblright
5012 \definedummyword\quoteleft
5013 \definedummyword\quoteright
5014 \definedummyword\quotesinglbase
5015 \definedummyword\rbracechar
5016 \definedummyword\result
5017 \definedummyword\sub
5018 \definedummyword\sup
5019 \definedummyword\textdegree
5020 %
5021 \definedummyword\subentry
5022 %
5023 % We want to disable all macros so that they are not expanded by \write.
5024 \macrolist
5025 \let\value\dummyvalue
5026 %
5027 \normalturnoffactive
5028 }
5029
5030 % \commondummiesnofonts: common to \definedummies and \indexnofonts.
5031 % Define \commondummyletter, \commondummyaccent and \commondummyword before
5032 % using. Used for accents, font commands, and various control letters.
5033 %
5034 \def\commondummiesnofonts{%
5035 % Control letters and accents.
5036 \commondummyletter\!%
5037 \commondummyaccent\"%
5038 \commondummyaccent\'%
5039 \commondummyletter\*%
5040 \commondummyaccent\,%
5041 \commondummyletter\.%
5042 \commondummyletter\/%
5043 \commondummyletter\:%
5044 \commondummyaccent\=%
5045 \commondummyletter\?%
5046 \commondummyaccent\^%
5047 \commondummyaccent\`%
5048 \commondummyaccent\~%
5049 \commondummyword\u
5050 \commondummyword\v
5051 \commondummyword\H
5052 \commondummyword\dotaccent
5053 \commondummyword\ogonek
5054 \commondummyword\ringaccent
5055 \commondummyword\tieaccent
5056 \commondummyword\ubaraccent
5057 \commondummyword\udotaccent
5058 \commondummyword\dotless
5059 %
5060 % Texinfo font commands.
5061 \commondummyword\b
5062 \commondummyword\i
5063 \commondummyword\r
5064 \commondummyword\sansserif
5065 \commondummyword\sc
5066 \commondummyword\slanted
5067 \commondummyword\t
5068 %
5069 % Commands that take arguments.
5070 \commondummyword\abbr
5071 \commondummyword\acronym
5072 \commondummyword\anchor
5073 \commondummyword\cite
5074 \commondummyword\code
5075 \commondummyword\command
5076 \commondummyword\dfn
5077 \commondummyword\dmn
5078 \commondummyword\email
5079 \commondummyword\emph
5080 \commondummyword\env
5081 \commondummyword\file
5082 \commondummyword\image
5083 \commondummyword\indicateurl
5084 \commondummyword\inforef
5085 \commondummyword\kbd
5086 \commondummyword\key
5087 \commondummyword\math
5088 \commondummyword\option
5089 \commondummyword\pxref
5090 \commondummyword\ref
5091 \commondummyword\samp
5092 \commondummyword\strong
5093 \commondummyword\tie
5094 \commondummyword\U
5095 \commondummyword\uref
5096 \commondummyword\url
5097 \commondummyword\var
5098 \commondummyword\verb
5099 \commondummyword\w
5100 \commondummyword\xref
5101 }
5102
5103 \let\indexlbrace\relax
5104 \let\indexrbrace\relax
5105 \let\indexatchar\relax
5106 \let\indexbackslash\relax
5107
5108 {\catcode`\@=0
5109 \catcode`\\=13
5110 @gdef@backslashdisappear{@def\{}}
5111 }
5112
5113 {
5114 \catcode`\<=13
5115 \catcode`\-=13
5116 \catcode`\`=13
5117 \gdef\indexnonalnumdisappear{%
5118 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
5119 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5120 % (Introduced for FSFS 2nd ed.)
5121 \let`=\empty
5122 \fi
5123 %
5124 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
5125 \backslashdisappear
5126 \fi
5127 %
5128 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
5129 \def-{}%
5130 \fi
5131 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
5132 \def<{}%
5133 \fi
5134 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
5135 \def\@{}%
5136 \fi
5137 }
5138
5139 \gdef\indexnonalnumreappear{%
5140 \let-\normaldash
5141 \let<\normalless
5142 }
5143 }
5144
5145
5146 % \indexnofonts is used when outputting the strings to sort the index
5147 % by, and when constructing control sequence names. It eliminates all
5148 % control sequences and just writes whatever the best ASCII sort string
5149 % would be for a given command (usually its argument).
5150 %
5151 \def\indexnofonts{%
5152 % Accent commands should become @asis.
5153 \def\commondummyaccent##1{\let##1\asis}%
5154 % We can just ignore other control letters.
5155 \def\commondummyletter##1{\let##1\empty}%
5156 % All control words become @asis by default; overrides below.
5157 \let\commondummyword\commondummyaccent
5158 \commondummiesnofonts
5159 %
5160 % Don't no-op \tt, since it isn't a user-level command
5161 % and is used in the definitions of the active chars like <, >, |, etc.
5162 % Likewise with the other plain tex font commands.
5163 %\let\tt=\asis
5164 %
5165 \def\ { }%
5166 \def\@{@}%
5167 \def\_{\normalunderscore}%
5168 \def\-{}% @- shouldn't affect sorting
5169 %
5170 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5171 \uccode`\1=`\} \uppercase{\def\}{1}}%
5172 \let\lbracechar\{%
5173 \let\rbracechar\}%
5174 %
5175 %
5176 \let\do\indexnofontsdef
5177 %
5178 % Non-English letters.
5179 \do\AA{AA}%
5180 \do\AE{AE}%
5181 \do\DH{DZZ}%
5182 \do\L{L}%
5183 \do\OE{OE}%
5184 \do\O{O}%
5185 \do\TH{TH}%
5186 \do\aa{aa}%
5187 \do\ae{ae}%
5188 \do\dh{dzz}%
5189 \do\exclamdown{!}%
5190 \do\l{l}%
5191 \do\oe{oe}%
5192 \do\ordf{a}%
5193 \do\ordm{o}%
5194 \do\o{o}%
5195 \do\questiondown{?}%
5196 \do\ss{ss}%
5197 \do\th{th}%
5198 %
5199 \do\LaTeX{LaTeX}%
5200 \do\TeX{TeX}%
5201 %
5202 % Assorted special characters.
5203 \do\atchar{@}%
5204 \do\arrow{->}%
5205 \do\bullet{bullet}%
5206 \do\comma{,}%
5207 \do\copyright{copyright}%
5208 \do\dots{...}%
5209 \do\enddots{...}%
5210 \do\equiv{==}%
5211 \do\error{error}%
5212 \do\euro{euro}%
5213 \do\expansion{==>}%
5214 \do\geq{>=}%
5215 \do\guillemetleft{<<}%
5216 \do\guillemetright{>>}%
5217 \do\guilsinglleft{<}%
5218 \do\guilsinglright{>}%
5219 \do\leq{<=}%
5220 \do\lbracechar{\{}%
5221 \do\minus{-}%
5222 \do\point{.}%
5223 \do\pounds{pounds}%
5224 \do\print{-|}%
5225 \do\quotedblbase{"}%
5226 \do\quotedblleft{"}%
5227 \do\quotedblright{"}%
5228 \do\quoteleft{`}%
5229 \do\quoteright{'}%
5230 \do\quotesinglbase{,}%
5231 \do\rbracechar{\}}%
5232 \do\registeredsymbol{R}%
5233 \do\result{=>}%
5234 \do\textdegree{o}%
5235 %
5236 % We need to get rid of all macros, leaving only the arguments (if present).
5237 % Of course this is not nearly correct, but it is the best we can do for now.
5238 % makeinfo does not expand macros in the argument to @deffn, which ends up
5239 % writing an index entry, and texindex isn't prepared for an index sort entry
5240 % that starts with \.
5241 %
5242 % Since macro invocations are followed by braces, we can just redefine them
5243 % to take a single TeX argument. The case of a macro invocation that
5244 % goes to end-of-line is not handled.
5245 %
5246 \macrolist
5247 \let\value\indexnofontsvalue
5248 }
5249
5250 % Give the control sequence a definition that removes the {} that follows
5251 % its use, e.g. @AA{} -> AA
5252 \def\indexnofontsdef#1#2{\def#1##1{#2}}%
5253
5254
5255
5256
5257 % #1 is the index name, #2 is the entry text.
5258 \def\doind#1#2{%
5259 \iflinks
5260 {%
5261 %
5262 \requireopenindexfile{#1}%
5263 \edef\writeto{\csname#1indfile\endcsname}%
5264 %
5265 \def\indextext{#2}%
5266 \safewhatsit\doindwrite
5267 }%
5268 \fi
5269 }
5270
5271 % Same as \doind, but for code indices
5272 \def\docind#1#2{%
5273 \iflinks
5274 {%
5275 %
5276 \requireopenindexfile{#1}%
5277 \edef\writeto{\csname#1indfile\endcsname}%
5278 %
5279 \def\indextext{#2}%
5280 \safewhatsit\docindwrite
5281 }%
5282 \fi
5283 }
5284
5285 % Check if an index file has been opened, and if not, open it.
5286 \def\requireopenindexfile#1{%
5287 \ifnum\csname #1indfile\endcsname=0
5288 \expandafter\newwrite \csname#1indfile\endcsname
5289 \edef\suffix{#1}%
5290 % A .fls suffix would conflict with the file extension for the output
5291 % of -recorder, so use .f1s instead.
5292 \ifx\suffix\indexisfl\def\suffix{f1}\fi
5293 % Open the file
5294 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5295 % Using \immediate above here prevents an object entering into the current
5296 % box, which could confound checks such as those in \safewhatsit for
5297 % preceding skips.
5298 \typeout{Writing index file \jobname.\suffix}%
5299 \fi}
5300 \def\indexisfl{fl}
5301
5302 % Definition for writing index entry sort key.
5303 {
5304 \catcode`\-=13
5305 \gdef\indexwritesortas{%
5306 \begingroup
5307 \indexnonalnumreappear
5308 \indexwritesortasxxx}
5309 \gdef\indexwritesortasxxx#1{%
5310 \xdef\indexsortkey{#1}\endgroup}
5311 }
5312
5313 \def\indexwriteseealso#1{
5314 \gdef\pagenumbertext{\string\seealso{#1}}%
5315 }
5316 \def\indexwriteseeentry#1{
5317 \gdef\pagenumbertext{\string\seeentry{#1}}%
5318 }
5319
5320 % The default definitions
5321 \def\sortas#1{}%
5322 \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
5323 \def\putwordSeeAlso{See also}
5324 \def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
5325
5326
5327 % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
5328 % * Set \bracedtext to "{aaa}{bbb}"
5329 % * Set \fullindexsortkey to "aaa @subentry ZZZ"
5330 % * If @seealso occurs, set \pagenumbertext
5331 %
5332 \def\splitindexentry#1{%
5333 \gdef\fullindexsortkey{}%
5334 \xdef\bracedtext{}%
5335 \def\sep{}%
5336 \def\seealso##1{}%
5337 \def\seeentry##1{}%
5338 \expandafter\doindexsegment#1\subentry\finish\subentry
5339 }
5340
5341 % append the results from the next segment
5342 \def\doindexsegment#1\subentry{%
5343 \def\segment{#1}%
5344 \ifx\segment\isfinish
5345 \else
5346 %
5347 % Fully expand the segment, throwing away any @sortas directives, and
5348 % trim spaces.
5349 \edef\trimmed{\segment}%
5350 \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5351 \ifincodeindex
5352 \edef\trimmed{\noexpand\code{\trimmed}}%
5353 \fi
5354 %
5355 \xdef\bracedtext{\bracedtext{\trimmed}}%
5356 %
5357 % Get the string to sort by. Process the segment with all
5358 % font commands turned off.
5359 \bgroup
5360 \let\sortas\indexwritesortas
5361 \let\seealso\indexwriteseealso
5362 \let\seeentry\indexwriteseeentry
5363 \indexnofonts
5364 % The braces around the commands are recognized by texindex.
5365 \def\lbracechar{{\string\indexlbrace}}%
5366 \def\rbracechar{{\string\indexrbrace}}%
5367 \let\{=\lbracechar
5368 \let\}=\rbracechar
5369 \def\@{{\string\indexatchar}}%
5370 \def\atchar##1{\@}%
5371 \def\backslashchar{{\string\indexbackslash}}%
5372 \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
5373 %
5374 \let\indexsortkey\empty
5375 \global\let\pagenumbertext\empty
5376 % Execute the segment and throw away the typeset output. This executes
5377 % any @sortas or @seealso commands in this segment.
5378 \setbox\dummybox = \hbox{\segment}%
5379 \ifx\indexsortkey\empty{%
5380 \indexnonalnumdisappear
5381 \xdef\trimmed{\segment}%
5382 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5383 \xdef\indexsortkey{\trimmed}%
5384 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
5385 }\fi
5386 %
5387 % Append to \fullindexsortkey.
5388 \edef\tmp{\gdef\noexpand\fullindexsortkey{%
5389 \fullindexsortkey\sep\indexsortkey}}%
5390 \tmp
5391 \egroup
5392 \def\sep{\subentry}%
5393 %
5394 \expandafter\doindexsegment
5395 \fi
5396 }
5397 \def\isfinish{\finish}%
5398 \newbox\dummybox % used above
5399
5400 \let\subentry\relax
5401
5402 % Use \ instead of @ in index files. To support old texi2dvi and texindex.
5403 % This works without changing the escape character used in the toc or aux
5404 % files because the index entries are fully expanded here, and \string uses
5405 % the current value of \escapechar.
5406 \def\escapeisbackslash{\escapechar=`\\}
5407
5408 % Use \ in index files by default. texi2dvi didn't support @ as the escape
5409 % character (as it checked for "\entry" in the files, and not "@entry"). When
5410 % the new version of texi2dvi has had a chance to become more prevalent, then
5411 % the escape character can change back to @ again. This should be an easy
5412 % change to make now because both @ and \ are only used as escape characters in
5413 % index files, never standing for themselves.
5414 %
5415 \set txiindexescapeisbackslash
5416
5417 % Write the entry in \indextext to the index file.
5418 %
5419
5420 \newif\ifincodeindex
5421 \def\doindwrite{\incodeindexfalse\doindwritex}
5422 \def\docindwrite{\incodeindextrue\doindwritex}
5423
5424 \def\doindwritex{%
5425 \maybemarginindex
5426 %
5427 \atdummies
5428 %
5429 \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else
5430 \escapeisbackslash
5431 \fi
5432 %
5433 % For texindex which always views { and } as separators.
5434 \def\{{\lbracechar{}}%
5435 \def\}{\rbracechar{}}%
5436 \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
5437 %
5438 % Split the entry into primary entry and any subentries, and get the index
5439 % sort key.
5440 \splitindexentry\indextext
5441 %
5442 % Set up the complete index entry, with both the sort key and
5443 % the original text, including any font commands. We write
5444 % three arguments to \entry to the .?? file (four in the
5445 % subentry case), texindex reduces to two when writing the .??s
5446 % sorted result.
5447 %
5448 \edef\temp{%
5449 \write\writeto{%
5450 \string\entry{\fullindexsortkey}%
5451 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
5452 \bracedtext}%
5453 }%
5454 \temp
5455 }
5456
5457 % Put the index entry in the margin if desired (undocumented).
5458 \def\maybemarginindex{%
5459 \ifx\SETmarginindex\relax\else
5460 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
5461 \fi
5462 }
5463 \let\SETmarginindex=\relax
5464
5465
5466 % Take care of unwanted page breaks/skips around a whatsit:
5467 %
5468 % If a skip is the last thing on the list now, preserve it
5469 % by backing up by \lastskip, doing the \write, then inserting
5470 % the skip again. Otherwise, the whatsit generated by the
5471 % \write or \pdfdest will make \lastskip zero. The result is that
5472 % sequences like this:
5473 % @end defun
5474 % @tindex whatever
5475 % @defun ...
5476 % will have extra space inserted, because the \medbreak in the
5477 % start of the @defun won't see the skip inserted by the @end of
5478 % the previous defun.
5479 %
5480 % But don't do any of this if we're not in vertical mode. We
5481 % don't want to do a \vskip and prematurely end a paragraph.
5482 %
5483 % Avoid page breaks due to these extra skips, too.
5484 %
5485 % But wait, there is a catch there:
5486 % We'll have to check whether \lastskip is zero skip. \ifdim is not
5487 % sufficient for this purpose, as it ignores stretch and shrink parts
5488 % of the skip. The only way seems to be to check the textual
5489 % representation of the skip.
5490 %
5491 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5492 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5493 %
5494 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5495 %
5496 \newskip\whatsitskip
5497 \newcount\whatsitpenalty
5498 %
5499 % ..., ready, GO:
5500 %
5501 \def\safewhatsit#1{\ifhmode
5502 #1%
5503 \else
5504 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5505 \whatsitskip = \lastskip
5506 \edef\lastskipmacro{\the\lastskip}%
5507 \whatsitpenalty = \lastpenalty
5508 %
5509 % If \lastskip is nonzero, that means the last item was a
5510 % skip. And since a skip is discardable, that means this
5511 % -\whatsitskip glue we're inserting is preceded by a
5512 % non-discardable item, therefore it is not a potential
5513 % breakpoint, therefore no \nobreak needed.
5514 \ifx\lastskipmacro\zeroskipmacro
5515 \else
5516 \vskip-\whatsitskip
5517 \fi
5518 %
5519 #1%
5520 %
5521 \ifx\lastskipmacro\zeroskipmacro
5522 % If \lastskip was zero, perhaps the last item was a penalty, and
5523 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5524 % to re-insert the same penalty (values >10000 are used for various
5525 % signals); since we just inserted a non-discardable item, any
5526 % following glue (such as a \parskip) would be a breakpoint. For example:
5527 % @deffn deffn-whatever
5528 % @vindex index-whatever
5529 % Description.
5530 % would allow a break between the index-whatever whatsit
5531 % and the "Description." paragraph.
5532 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5533 \else
5534 % On the other hand, if we had a nonzero \lastskip,
5535 % this make-up glue would be preceded by a non-discardable item
5536 % (the whatsit from the \write), so we must insert a \nobreak.
5537 \nobreak\vskip\whatsitskip
5538 \fi
5539 \fi}
5540
5541 % The index entry written in the file actually looks like
5542 % \entry {sortstring}{page}{topic}
5543 % or
5544 % \entry {sortstring}{page}{topic}{subtopic}
5545 % The texindex program reads in these files and writes files
5546 % containing these kinds of lines:
5547 % \initial {c}
5548 % before the first topic whose initial is c
5549 % \entry {topic}{pagelist}
5550 % for a topic that is used without subtopics
5551 % \primary {topic}
5552 % \entry {topic}{}
5553 % for the beginning of a topic that is used with subtopics
5554 % \secondary {subtopic}{pagelist}
5555 % for each subtopic.
5556 % \secondary {subtopic}{}
5557 % for a subtopic with sub-subtopics
5558 % \tertiary {subtopic}{subsubtopic}{pagelist}
5559 % for each sub-subtopic.
5560
5561 % Define the user-accessible indexing commands
5562 % @findex, @vindex, @kindex, @cindex.
5563
5564 \def\findex {\fnindex}
5565 \def\kindex {\kyindex}
5566 \def\cindex {\cpindex}
5567 \def\vindex {\vrindex}
5568 \def\tindex {\tpindex}
5569 \def\pindex {\pgindex}
5570
5571 % Define the macros used in formatting output of the sorted index material.
5572
5573 % @printindex causes a particular index (the ??s file) to get printed.
5574 % It does not print any chapter heading (usually an @unnumbered).
5575 %
5576 \parseargdef\printindex{\begingroup
5577 \dobreak \chapheadingskip{10000}%
5578 %
5579 \smallfonts \rm
5580 \tolerance = 9500
5581 \plainfrenchspacing
5582 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5583 %
5584 % See comment in \requireopenindexfile.
5585 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5586 %
5587 % See if the index file exists and is nonempty.
5588 \openin 1 \jobname.\indexname s
5589 \ifeof 1
5590 % \enddoublecolumns gets confused if there is no text in the index,
5591 % and it loses the chapter title and the aux file entries for the
5592 % index. The easiest way to prevent this problem is to make sure
5593 % there is some text.
5594 \putwordIndexNonexistent
5595 \typeout{No file \jobname.\indexname s.}%
5596 \else
5597 % If the index file exists but is empty, then \openin leaves \ifeof
5598 % false. We have to make TeX try to read something from the file, so
5599 % it can discover if there is anything in it.
5600 \read 1 to \thisline
5601 \ifeof 1
5602 \putwordIndexIsEmpty
5603 \else
5604 \expandafter\printindexzz\thisline\relax\relax\finish%
5605 \fi
5606 \fi
5607 \closein 1
5608 \endgroup}
5609
5610 % If the index file starts with a backslash, forgo reading the index
5611 % file altogether. If somebody upgrades texinfo.tex they may still have
5612 % old index files using \ as the escape character. Reading this would
5613 % at best lead to typesetting garbage, at worst a TeX syntax error.
5614 \def\printindexzz#1#2\finish{%
5615 \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax
5616 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
5617 \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax
5618 \errmessage{%
5619 ERROR: A sorted index file in an obsolete format was skipped.
5620 To fix this problem, please upgrade your version of 'texi2dvi'
5621 or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
5622 If you are using an old version of 'texindex' (part of the Texinfo
5623 distribution), you may also need to upgrade to a newer version (at least 6.0).
5624 You may be able to typeset the index if you run
5625 'texindex \jobname.\indexname' yourself.
5626 You could also try setting the 'txiindexescapeisbackslash' flag by
5627 running a command like
5628 'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do
5629 this, Texinfo will try to use index files in the old format.
5630 If you continue to have problems, deleting the index files and starting again
5631 might help (with 'rm \jobname.?? \jobname.??s')%
5632 }%
5633 \else
5634 (Skipped sorted index file in obsolete format)
5635 \fi
5636 \else
5637 \begindoublecolumns
5638 \input \jobname.\indexname s
5639 \enddoublecolumns
5640 \fi
5641 \else
5642 \begindoublecolumns
5643 \catcode`\\=0\relax
5644 %
5645 % Make @ an escape character to give macros a chance to work. This
5646 % should work because we (hopefully) don't otherwise use @ in index files.
5647 %\catcode`\@=12\relax
5648 \catcode`\@=0\relax
5649 \input \jobname.\indexname s
5650 \enddoublecolumns
5651 \fi
5652 }
5653
5654 % These macros are used by the sorted index file itself.
5655 % Change them to control the appearance of the index.
5656
5657 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5658 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5659 \catcode`\$=3
5660 \gdef\initialglyphs{%
5661 % special control sequences used in the index sort key
5662 \let\indexlbrace\{%
5663 \let\indexrbrace\}%
5664 \let\indexatchar\@%
5665 \def\indexbackslash{\math{\backslash}}%
5666 %
5667 % Some changes for non-alphabetic characters. Using the glyphs from the
5668 % math fonts looks more consistent than the typewriter font used elsewhere
5669 % for these characters.
5670 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
5671 %
5672 % In case @\ is used for backslash
5673 \uppercase{\let\\=~}
5674 % Can't get bold backslash so don't use bold forward slash
5675 \catcode`\/=13
5676 \def/{{\secrmnotbold \normalslash}}%
5677 \def-{{\normaldash\normaldash}}% en dash `--'
5678 \def^{{\chapbf \normalcaret}}%
5679 \def~{{\chapbf \normaltilde}}%
5680 \def\_{%
5681 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5682 \def|{$\vert$}%
5683 \def<{$\less$}%
5684 \def>{$\gtr$}%
5685 \def+{$\normalplus$}%
5686 }}
5687
5688 \def\initial{%
5689 \bgroup
5690 \initialglyphs
5691 \initialx
5692 }
5693
5694 \def\initialx#1{%
5695 % Remove any glue we may have, we'll be inserting our own.
5696 \removelastskip
5697 %
5698 % We like breaks before the index initials, so insert a bonus.
5699 % The glue before the bonus allows a little bit of space at the
5700 % bottom of a column to reduce an increase in inter-line spacing.
5701 \nobreak
5702 \vskip 0pt plus 5\baselineskip
5703 \penalty -300
5704 \vskip 0pt plus -5\baselineskip
5705 %
5706 % Typeset the initial. Making this add up to a whole number of
5707 % baselineskips increases the chance of the dots lining up from column
5708 % to column. It still won't often be perfect, because of the stretch
5709 % we need before each entry, but it's better.
5710 %
5711 % No shrink because it confuses \balancecolumns.
5712 \vskip 1.67\baselineskip plus 1\baselineskip
5713 \leftline{\secfonts \kern-0.05em \secbf #1}%
5714 % \secfonts is inside the argument of \leftline so that the change of
5715 % \baselineskip will not affect any glue inserted before the vbox that
5716 % \leftline creates.
5717 % Do our best not to break after the initial.
5718 \nobreak
5719 \vskip .33\baselineskip plus .1\baselineskip
5720 \egroup % \initialglyphs
5721 }
5722
5723 \newdimen\entryrightmargin
5724 \entryrightmargin=0pt
5725
5726 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5727 % then page number (#2) flushed to the right margin. It is used for index
5728 % and table of contents entries. The paragraph is indented by \leftskip.
5729 %
5730 \def\entry{%
5731 \begingroup
5732 %
5733 % Start a new paragraph if necessary, so our assignments below can't
5734 % affect previous text.
5735 \par
5736 %
5737 % No extra space above this paragraph.
5738 \parskip = 0in
5739 %
5740 % When reading the text of entry, convert explicit line breaks
5741 % from @* into spaces. The user might give these in long section
5742 % titles, for instance.
5743 \def\*{\unskip\space\ignorespaces}%
5744 \def\entrybreak{\hfil\break}% An undocumented command
5745 %
5746 % Swallow the left brace of the text (first parameter):
5747 \afterassignment\doentry
5748 \let\temp =
5749 }
5750 \def\entrybreak{\unskip\space\ignorespaces}%
5751 \def\doentry{%
5752 % Save the text of the entry
5753 \global\setbox\boxA=\hbox\bgroup
5754 \bgroup % Instead of the swallowed brace.
5755 \noindent
5756 \aftergroup\finishentry
5757 % And now comes the text of the entry.
5758 % Not absorbing as a macro argument reduces the chance of problems
5759 % with catcodes occurring.
5760 }
5761 {\catcode`\@=11
5762 \gdef\finishentry#1{%
5763 \egroup % end box A
5764 \dimen@ = \wd\boxA % Length of text of entry
5765 \global\setbox\boxA=\hbox\bgroup
5766 \unhbox\boxA
5767 % #1 is the page number.
5768 %
5769 % Get the width of the page numbers, and only use
5770 % leaders if they are present.
5771 \global\setbox\boxB = \hbox{#1}%
5772 \ifdim\wd\boxB = 0pt
5773 \null\nobreak\hfill\ %
5774 \else
5775 %
5776 \null\nobreak\indexdotfill % Have leaders before the page number.
5777 %
5778 \ifpdforxetex
5779 \pdfgettoks#1.%
5780 \hskip\skip\thinshrinkable\the\toksA
5781 \else
5782 \hskip\skip\thinshrinkable #1%
5783 \fi
5784 \fi
5785 \egroup % end \boxA
5786 \ifdim\wd\boxB = 0pt
5787 \noindent\unhbox\boxA\par
5788 \nobreak
5789 \else\bgroup
5790 % We want the text of the entries to be aligned to the left, and the
5791 % page numbers to be aligned to the right.
5792 %
5793 \parindent = 0pt
5794 \advance\leftskip by 0pt plus 1fil
5795 \advance\leftskip by 0pt plus -1fill
5796 \rightskip = 0pt plus -1fil
5797 \advance\rightskip by 0pt plus 1fill
5798 % Cause last line, which could consist of page numbers on their own
5799 % if the list of page numbers is long, to be aligned to the right.
5800 \parfillskip=0pt plus -1fill
5801 %
5802 \advance\rightskip by \entryrightmargin
5803 % Determine how far we can stretch into the margin.
5804 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5805 % fit on one line in @letterpaper format.
5806 \ifdim\entryrightmargin>2.1em
5807 \dimen@i=2.1em
5808 \else
5809 \dimen@i=0em
5810 \fi
5811 \advance \parfillskip by 0pt minus 1\dimen@i
5812 %
5813 \dimen@ii = \hsize
5814 \advance\dimen@ii by -1\leftskip
5815 \advance\dimen@ii by -1\entryrightmargin
5816 \advance\dimen@ii by 1\dimen@i
5817 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5818 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5819 % Try to split the text roughly evenly. \dimen@ will be the length of
5820 % the first line.
5821 \dimen@ = 0.7\dimen@
5822 \dimen@ii = \hsize
5823 \ifnum\dimen@>\dimen@ii
5824 % If the entry is too long (for example, if it needs more than
5825 % two lines), use all the space in the first line.
5826 \dimen@ = \dimen@ii
5827 \fi
5828 \advance\leftskip by 0pt plus 1fill % ragged right
5829 \advance \dimen@ by 1\rightskip
5830 \parshape = 2 0pt \dimen@ 0em \dimen@ii
5831 % Ideally we'd add a finite glue at the end of the first line only,
5832 % instead of using \parshape with explicit line lengths, but TeX
5833 % doesn't seem to provide a way to do such a thing.
5834 %
5835 % Indent all lines but the first one.
5836 \advance\leftskip by 1em
5837 \advance\parindent by -1em
5838 \fi\fi
5839 \indent % start paragraph
5840 \unhbox\boxA
5841 %
5842 % Do not prefer a separate line ending with a hyphen to fewer lines.
5843 \finalhyphendemerits = 0
5844 %
5845 % Word spacing - no stretch
5846 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5847 %
5848 \linepenalty=1000 % Discourage line breaks.
5849 \hyphenpenalty=5000 % Discourage hyphenation.
5850 %
5851 \par % format the paragraph
5852 \egroup % The \vbox
5853 \fi
5854 \endgroup
5855 }}
5856
5857 \newskip\thinshrinkable
5858 \skip\thinshrinkable=.15em minus .15em
5859
5860 % Like plain.tex's \dotfill, except uses up at least 1 em.
5861 % The filll stretch here overpowers both the fil and fill stretch to push
5862 % the page number to the right.
5863 \def\indexdotfill{\cleaders
5864 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5865
5866
5867 \def\primary #1{\line{#1\hfil}}
5868
5869 \def\secondary{\indententry{0.5cm}}
5870 \def\tertiary{\indententry{1cm}}
5871
5872 \def\indententry#1#2#3{%
5873 \bgroup
5874 \leftskip=#1
5875 \entry{#2}{#3}%
5876 \egroup
5877 }
5878
5879 % Define two-column mode, which we use to typeset indexes.
5880 % Adapted from the TeXbook, page 416, which is to say,
5881 % the manmac.tex format used to print the TeXbook itself.
5882 \catcode`\@=11 % private names
5883
5884 \newbox\partialpage
5885 \newdimen\doublecolumnhsize
5886
5887 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5888 % If not much space left on page, start a new page.
5889 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5890 %
5891 % Grab any single-column material above us.
5892 \output = {%
5893 \savetopmark
5894 %
5895 \global\setbox\partialpage = \vbox{%
5896 % Unvbox the main output page.
5897 \unvbox\PAGE
5898 \kern-\topskip \kern\baselineskip
5899 }%
5900 }%
5901 \eject % run that output routine to set \partialpage
5902 %
5903 % Use the double-column output routine for subsequent pages.
5904 \output = {\doublecolumnout}%
5905 %
5906 % Change the page size parameters. We could do this once outside this
5907 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5908 % format, but then we repeat the same computation. Repeating a couple
5909 % of assignments once per index is clearly meaningless for the
5910 % execution time, so we may as well do it in one place.
5911 %
5912 % First we halve the line length, less a little for the gutter between
5913 % the columns. We compute the gutter based on the line length, so it
5914 % changes automatically with the paper format. The magic constant
5915 % below is chosen so that the gutter has the same value (well, +-<1pt)
5916 % as it did when we hard-coded it.
5917 %
5918 % We put the result in a separate register, \doublecolumhsize, so we
5919 % can restore it in \pagesofar, after \hsize itself has (potentially)
5920 % been clobbered.
5921 %
5922 \doublecolumnhsize = \hsize
5923 \advance\doublecolumnhsize by -.04154\hsize
5924 \divide\doublecolumnhsize by 2
5925 \hsize = \doublecolumnhsize
5926 %
5927 % Get the available space for the double columns -- the normal
5928 % (undoubled) page height minus any material left over from the
5929 % previous page.
5930 \advance\vsize by -\ht\partialpage
5931 \vsize = 2\vsize
5932 %
5933 % For the benefit of balancing columns
5934 \advance\baselineskip by 0pt plus 0.5pt
5935 }
5936
5937 % The double-column output routine for all double-column pages except
5938 % the last, which is done by \balancecolumns.
5939 %
5940 \def\doublecolumnout{%
5941 %
5942 \savetopmark
5943 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5944 \dimen@ = \vsize
5945 \divide\dimen@ by 2
5946 %
5947 % box0 will be the left-hand column, box2 the right.
5948 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
5949 \global\advance\vsize by 2\ht\partialpage
5950 \onepageout\pagesofar % empty except for the first time we are called
5951 \unvbox\PAGE
5952 \penalty\outputpenalty
5953 }
5954 %
5955 % Re-output the contents of the output page -- any previous material,
5956 % followed by the two boxes we just split, in box0 and box2.
5957 \def\pagesofar{%
5958 \unvbox\partialpage
5959 %
5960 \hsize = \doublecolumnhsize
5961 \wd0=\hsize \wd2=\hsize
5962 \hbox to\txipagewidth{\box0\hfil\box2}%
5963 }
5964
5965
5966 % Finished with double columns.
5967 \def\enddoublecolumns{%
5968 % The following penalty ensures that the page builder is exercised
5969 % _before_ we change the output routine. This is necessary in the
5970 % following situation:
5971 %
5972 % The last section of the index consists only of a single entry.
5973 % Before this section, \pagetotal is less than \pagegoal, so no
5974 % break occurs before the last section starts. However, the last
5975 % section, consisting of \initial and the single \entry, does not
5976 % fit on the page and has to be broken off. Without the following
5977 % penalty the page builder will not be exercised until \eject
5978 % below, and by that time we'll already have changed the output
5979 % routine to the \balancecolumns version, so the next-to-last
5980 % double-column page will be processed with \balancecolumns, which
5981 % is wrong: The two columns will go to the main vertical list, with
5982 % the broken-off section in the recent contributions. As soon as
5983 % the output routine finishes, TeX starts reconsidering the page
5984 % break. The two columns and the broken-off section both fit on the
5985 % page, because the two columns now take up only half of the page
5986 % goal. When TeX sees \eject from below which follows the final
5987 % section, it invokes the new output routine that we've set after
5988 % \balancecolumns below; \onepageout will try to fit the two columns
5989 % and the final section into the vbox of \txipageheight (see
5990 % \pagebody), causing an overfull box.
5991 %
5992 % Note that glue won't work here, because glue does not exercise the
5993 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5994 \penalty0
5995 %
5996 \output = {%
5997 % Split the last of the double-column material.
5998 \savetopmark
5999 \balancecolumns
6000 }%
6001 \eject % call the \output just set
6002 \ifdim\pagetotal=0pt
6003 % Having called \balancecolumns once, we do not
6004 % want to call it again. Therefore, reset \output to its normal
6005 % definition right away.
6006 \global\output=\expandafter{\the\defaultoutput}
6007 %
6008 \endgroup % started in \begindoublecolumns
6009 % Leave the double-column material on the current page, no automatic
6010 % page break.
6011 \box\balancedcolumns
6012 %
6013 % \pagegoal was set to the doubled \vsize above, since we restarted
6014 % the current page. We're now back to normal single-column
6015 % typesetting, so reset \pagegoal to the normal \vsize.
6016 \global\vsize = \txipageheight %
6017 \pagegoal = \txipageheight %
6018 \else
6019 % We had some left-over material. This might happen when \doublecolumnout
6020 % is called in \balancecolumns. Try again.
6021 \expandafter\enddoublecolumns
6022 \fi
6023 }
6024 \newbox\balancedcolumns
6025 \setbox\balancedcolumns=\vbox{shouldnt see this}%
6026 %
6027 % Only called for the last of the double column material. \doublecolumnout
6028 % does the others.
6029 \def\balancecolumns{%
6030 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
6031 \dimen@ = \ht0
6032 \ifdim\dimen@<7\baselineskip
6033 % Don't split a short final column in two.
6034 \setbox2=\vbox{}%
6035 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
6036 \else
6037 % double the leading vertical space
6038 \advance\dimen@ by \topskip
6039 \advance\dimen@ by-\baselineskip
6040 \divide\dimen@ by 2 % target to split to
6041 \dimen@ii = \dimen@
6042 \splittopskip = \topskip
6043 % Loop until left column is at least as high as the right column.
6044 {%
6045 \vbadness = 10000
6046 \loop
6047 \global\setbox3 = \copy0
6048 \global\setbox1 = \vsplit3 to \dimen@
6049 \ifdim\ht1<\ht3
6050 \global\advance\dimen@ by 1pt
6051 \repeat
6052 }%
6053 % Now the left column is in box 1, and the right column in box 3.
6054 %
6055 % Check whether the left column has come out higher than the page itself.
6056 % (Note that we have doubled \vsize for the double columns, so
6057 % the actual height of the page is 0.5\vsize).
6058 \ifdim2\ht1>\vsize
6059 % It appears that we have been called upon to balance too much material.
6060 % Output some of it with \doublecolumnout, leaving the rest on the page.
6061 \setbox\PAGE=\box0
6062 \doublecolumnout
6063 \else
6064 % Compare the heights of the two columns.
6065 \ifdim4\ht1>5\ht3
6066 % Column heights are too different, so don't make their bottoms
6067 % flush with each other.
6068 \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
6069 \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
6070 \else
6071 % Make column bottoms flush with each other.
6072 \setbox2=\vbox to\ht1{\unvbox3\unskip}%
6073 \setbox0=\vbox to\ht1{\unvbox1\unskip}%
6074 \fi
6075 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
6076 \fi
6077 \fi
6078 %
6079 }
6080 \catcode`\@ = \other
6081
6082
6083 \message{sectioning,}
6084 % Chapters, sections, etc.
6085
6086 % Let's start with @part.
6087 \outer\parseargdef\part{\partzzz{#1}}
6088 \def\partzzz#1{%
6089 \chapoddpage
6090 \null
6091 \vskip.3\vsize % move it down on the page a bit
6092 \begingroup
6093 \noindent \titlefonts\rm #1\par % the text
6094 \let\lastnode=\empty % no node to associate with
6095 \writetocentry{part}{#1}{}% but put it in the toc
6096 \headingsoff % no headline or footline on the part page
6097 % This outputs a mark at the end of the page that clears \thischapter
6098 % and \thissection, as is done in \startcontents.
6099 \let\pchapsepmacro\relax
6100 \chapmacro{}{Yomitfromtoc}{}%
6101 \chapoddpage
6102 \endgroup
6103 }
6104
6105 % \unnumberedno is an oxymoron. But we count the unnumbered
6106 % sections so that we can refer to them unambiguously in the pdf
6107 % outlines by their "section number". We avoid collisions with chapter
6108 % numbers by starting them at 10000. (If a document ever has 10000
6109 % chapters, we're in trouble anyway, I'm sure.)
6110 \newcount\unnumberedno \unnumberedno = 10000
6111 \newcount\chapno
6112 \newcount\secno \secno=0
6113 \newcount\subsecno \subsecno=0
6114 \newcount\subsubsecno \subsubsecno=0
6115
6116 % This counter is funny since it counts through charcodes of letters A, B, ...
6117 \newcount\appendixno \appendixno = `\@
6118 %
6119 % \def\appendixletter{\char\the\appendixno}
6120 % We do the following ugly conditional instead of the above simple
6121 % construct for the sake of pdftex, which needs the actual
6122 % letter in the expansion, not just typeset.
6123 %
6124 \def\appendixletter{%
6125 \ifnum\appendixno=`A A%
6126 \else\ifnum\appendixno=`B B%
6127 \else\ifnum\appendixno=`C C%
6128 \else\ifnum\appendixno=`D D%
6129 \else\ifnum\appendixno=`E E%
6130 \else\ifnum\appendixno=`F F%
6131 \else\ifnum\appendixno=`G G%
6132 \else\ifnum\appendixno=`H H%
6133 \else\ifnum\appendixno=`I I%
6134 \else\ifnum\appendixno=`J J%
6135 \else\ifnum\appendixno=`K K%
6136 \else\ifnum\appendixno=`L L%
6137 \else\ifnum\appendixno=`M M%
6138 \else\ifnum\appendixno=`N N%
6139 \else\ifnum\appendixno=`O O%
6140 \else\ifnum\appendixno=`P P%
6141 \else\ifnum\appendixno=`Q Q%
6142 \else\ifnum\appendixno=`R R%
6143 \else\ifnum\appendixno=`S S%
6144 \else\ifnum\appendixno=`T T%
6145 \else\ifnum\appendixno=`U U%
6146 \else\ifnum\appendixno=`V V%
6147 \else\ifnum\appendixno=`W W%
6148 \else\ifnum\appendixno=`X X%
6149 \else\ifnum\appendixno=`Y Y%
6150 \else\ifnum\appendixno=`Z Z%
6151 % The \the is necessary, despite appearances, because \appendixletter is
6152 % expanded while writing the .toc file. \char\appendixno is not
6153 % expandable, thus it is written literally, thus all appendixes come out
6154 % with the same letter (or @) in the toc without it.
6155 \else\char\the\appendixno
6156 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6157 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6158
6159 % Each @chapter defines these (using marks) as the number+name, number
6160 % and name of the chapter. Page headings and footings can use
6161 % these. @section does likewise.
6162 \def\thischapter{}
6163 \def\thischapternum{}
6164 \def\thischaptername{}
6165 \def\thissection{}
6166 \def\thissectionnum{}
6167 \def\thissectionname{}
6168
6169 \newcount\absseclevel % used to calculate proper heading level
6170 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6171
6172 % @raisesections: treat @section as chapter, @subsection as section, etc.
6173 \def\raisesections{\global\advance\secbase by -1}
6174
6175 % @lowersections: treat @chapter as section, @section as subsection, etc.
6176 \def\lowersections{\global\advance\secbase by 1}
6177
6178 % we only have subsub.
6179 \chardef\maxseclevel = 3
6180 %
6181 % A numbered section within an unnumbered changes to unnumbered too.
6182 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
6183 \chardef\unnlevel = \maxseclevel
6184 %
6185 % Trace whether the current chapter is an appendix or not:
6186 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6187 \def\chapheadtype{N}
6188
6189 % Choose a heading macro
6190 % #1 is heading type
6191 % #2 is heading level
6192 % #3 is text for heading
6193 \def\genhead#1#2#3{%
6194 % Compute the abs. sec. level:
6195 \absseclevel=#2
6196 \advance\absseclevel by \secbase
6197 % Make sure \absseclevel doesn't fall outside the range:
6198 \ifnum \absseclevel < 0
6199 \absseclevel = 0
6200 \else
6201 \ifnum \absseclevel > 3
6202 \absseclevel = 3
6203 \fi
6204 \fi
6205 % The heading type:
6206 \def\headtype{#1}%
6207 \if \headtype U%
6208 \ifnum \absseclevel < \unnlevel
6209 \chardef\unnlevel = \absseclevel
6210 \fi
6211 \else
6212 % Check for appendix sections:
6213 \ifnum \absseclevel = 0
6214 \edef\chapheadtype{\headtype}%
6215 \else
6216 \if \headtype A\if \chapheadtype N%
6217 \errmessage{@appendix... within a non-appendix chapter}%
6218 \fi\fi
6219 \fi
6220 % Check for numbered within unnumbered:
6221 \ifnum \absseclevel > \unnlevel
6222 \def\headtype{U}%
6223 \else
6224 \chardef\unnlevel = 3
6225 \fi
6226 \fi
6227 % Now print the heading:
6228 \if \headtype U%
6229 \ifcase\absseclevel
6230 \unnumberedzzz{#3}%
6231 \or \unnumberedseczzz{#3}%
6232 \or \unnumberedsubseczzz{#3}%
6233 \or \unnumberedsubsubseczzz{#3}%
6234 \fi
6235 \else
6236 \if \headtype A%
6237 \ifcase\absseclevel
6238 \appendixzzz{#3}%
6239 \or \appendixsectionzzz{#3}%
6240 \or \appendixsubseczzz{#3}%
6241 \or \appendixsubsubseczzz{#3}%
6242 \fi
6243 \else
6244 \ifcase\absseclevel
6245 \chapterzzz{#3}%
6246 \or \seczzz{#3}%
6247 \or \numberedsubseczzz{#3}%
6248 \or \numberedsubsubseczzz{#3}%
6249 \fi
6250 \fi
6251 \fi
6252 \suppressfirstparagraphindent
6253 }
6254
6255 % an interface:
6256 \def\numhead{\genhead N}
6257 \def\apphead{\genhead A}
6258 \def\unnmhead{\genhead U}
6259
6260 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6261 % all lower-level sectioning counters to zero.
6262 %
6263 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
6264 % (e.g., figures), q.v. By default (before any chapter), that is empty.
6265 \let\chaplevelprefix = \empty
6266 %
6267 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6268 \def\chapterzzz#1{%
6269 % section resetting is \global in case the chapter is in a group, such
6270 % as an @include file.
6271 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6272 \global\advance\chapno by 1
6273 %
6274 % Used for \float.
6275 \gdef\chaplevelprefix{\the\chapno.}%
6276 \resetallfloatnos
6277 %
6278 % \putwordChapter can contain complex things in translations.
6279 \toks0=\expandafter{\putwordChapter}%
6280 \message{\the\toks0 \space \the\chapno}%
6281 %
6282 % Write the actual heading.
6283 \chapmacro{#1}{Ynumbered}{\the\chapno}%
6284 %
6285 % So @section and the like are numbered underneath this chapter.
6286 \global\let\section = \numberedsec
6287 \global\let\subsection = \numberedsubsec
6288 \global\let\subsubsection = \numberedsubsubsec
6289 }
6290
6291 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6292 %
6293 \def\appendixzzz#1{%
6294 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6295 \global\advance\appendixno by 1
6296 \gdef\chaplevelprefix{\appendixletter.}%
6297 \resetallfloatnos
6298 %
6299 % \putwordAppendix can contain complex things in translations.
6300 \toks0=\expandafter{\putwordAppendix}%
6301 \message{\the\toks0 \space \appendixletter}%
6302 %
6303 \chapmacro{#1}{Yappendix}{\appendixletter}%
6304 %
6305 \global\let\section = \appendixsec
6306 \global\let\subsection = \appendixsubsec
6307 \global\let\subsubsection = \appendixsubsubsec
6308 }
6309
6310 % normally unnmhead0 calls unnumberedzzz:
6311 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
6312 \def\unnumberedzzz#1{%
6313 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6314 \global\advance\unnumberedno by 1
6315 %
6316 % Since an unnumbered has no number, no prefix for figures.
6317 \global\let\chaplevelprefix = \empty
6318 \resetallfloatnos
6319 %
6320 % This used to be simply \message{#1}, but TeX fully expands the
6321 % argument to \message. Therefore, if #1 contained @-commands, TeX
6322 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6323 % expanded @cite (which turns out to cause errors because \cite is meant
6324 % to be executed, not expanded).
6325 %
6326 % Anyway, we don't want the fully-expanded definition of @cite to appear
6327 % as a result of the \message, we just want `@cite' itself. We use
6328 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6329 % simply yielding the contents of <toks register>. (We also do this for
6330 % the toc entries.)
6331 \toks0 = {#1}%
6332 \message{(\the\toks0)}%
6333 %
6334 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6335 %
6336 \global\let\section = \unnumberedsec
6337 \global\let\subsection = \unnumberedsubsec
6338 \global\let\subsubsection = \unnumberedsubsubsec
6339 }
6340
6341 % @centerchap is like @unnumbered, but the heading is centered.
6342 \outer\parseargdef\centerchap{%
6343 \let\centerparametersmaybe = \centerparameters
6344 \unnmhead0{#1}%
6345 \let\centerparametersmaybe = \relax
6346 }
6347
6348 % @top is like @unnumbered.
6349 \let\top\unnumbered
6350
6351 % Sections.
6352 %
6353 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6354 \def\seczzz#1{%
6355 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6356 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6357 }
6358
6359 % normally calls appendixsectionzzz:
6360 \outer\parseargdef\appendixsection{\apphead1{#1}}
6361 \def\appendixsectionzzz#1{%
6362 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6363 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6364 }
6365 \let\appendixsec\appendixsection
6366
6367 % normally calls unnumberedseczzz:
6368 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6369 \def\unnumberedseczzz#1{%
6370 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6371 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6372 }
6373
6374 % Subsections.
6375 %
6376 % normally calls numberedsubseczzz:
6377 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6378 \def\numberedsubseczzz#1{%
6379 \global\subsubsecno=0 \global\advance\subsecno by 1
6380 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6381 }
6382
6383 % normally calls appendixsubseczzz:
6384 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6385 \def\appendixsubseczzz#1{%
6386 \global\subsubsecno=0 \global\advance\subsecno by 1
6387 \sectionheading{#1}{subsec}{Yappendix}%
6388 {\appendixletter.\the\secno.\the\subsecno}%
6389 }
6390
6391 % normally calls unnumberedsubseczzz:
6392 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6393 \def\unnumberedsubseczzz#1{%
6394 \global\subsubsecno=0 \global\advance\subsecno by 1
6395 \sectionheading{#1}{subsec}{Ynothing}%
6396 {\the\unnumberedno.\the\secno.\the\subsecno}%
6397 }
6398
6399 % Subsubsections.
6400 %
6401 % normally numberedsubsubseczzz:
6402 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6403 \def\numberedsubsubseczzz#1{%
6404 \global\advance\subsubsecno by 1
6405 \sectionheading{#1}{subsubsec}{Ynumbered}%
6406 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6407 }
6408
6409 % normally appendixsubsubseczzz:
6410 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6411 \def\appendixsubsubseczzz#1{%
6412 \global\advance\subsubsecno by 1
6413 \sectionheading{#1}{subsubsec}{Yappendix}%
6414 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6415 }
6416
6417 % normally unnumberedsubsubseczzz:
6418 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6419 \def\unnumberedsubsubseczzz#1{%
6420 \global\advance\subsubsecno by 1
6421 \sectionheading{#1}{subsubsec}{Ynothing}%
6422 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6423 }
6424
6425 % These macros control what the section commands do, according
6426 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6427 % Define them by default for a numbered chapter.
6428 \let\section = \numberedsec
6429 \let\subsection = \numberedsubsec
6430 \let\subsubsection = \numberedsubsubsec
6431
6432 % Define @majorheading, @heading and @subheading
6433
6434 \def\majorheading{%
6435 {\advance\chapheadingskip by 10pt \chapbreak }%
6436 \parsearg\chapheadingzzz
6437 }
6438
6439 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6440 \def\chapheadingzzz#1{%
6441 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6442 \nobreak\bigskip \nobreak
6443 \suppressfirstparagraphindent
6444 }
6445
6446 % @heading, @subheading, @subsubheading.
6447 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6448 \suppressfirstparagraphindent}
6449 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6450 \suppressfirstparagraphindent}
6451 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6452 \suppressfirstparagraphindent}
6453
6454 % These macros generate a chapter, section, etc. heading only
6455 % (including whitespace, linebreaking, etc. around it),
6456 % given all the information in convenient, parsed form.
6457
6458 % Args are the skip and penalty (usually negative)
6459 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6460
6461 % Parameter controlling skip before chapter headings (if needed)
6462 \newskip\chapheadingskip
6463
6464 % Define plain chapter starts, and page on/off switching for it.
6465 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6466
6467 % Start a new page
6468 \def\chappager{\par\vfill\supereject}
6469
6470 % \chapoddpage - start on an odd page for a new chapter
6471 % Because \domark is called before \chapoddpage, the filler page will
6472 % get the headings for the next chapter, which is wrong. But we don't
6473 % care -- we just disable all headings on the filler page.
6474 \def\chapoddpage{%
6475 \chappager
6476 \ifodd\pageno \else
6477 \begingroup
6478 \headingsoff
6479 \null
6480 \chappager
6481 \endgroup
6482 \fi
6483 }
6484
6485 \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
6486
6487 \def\CHAPPAGoff{%
6488 \global\let\contentsalignmacro = \chappager
6489 \global\let\pchapsepmacro=\chapbreak
6490 \global\def\HEADINGSon{\HEADINGSsinglechapoff}}
6491
6492 \def\CHAPPAGon{%
6493 \global\let\contentsalignmacro = \chappager
6494 \global\let\pchapsepmacro=\chappager
6495 \global\def\HEADINGSon{\HEADINGSsingle}}
6496
6497 \def\CHAPPAGodd{%
6498 \global\let\contentsalignmacro = \chapoddpage
6499 \global\let\pchapsepmacro=\chapoddpage
6500 \global\def\HEADINGSon{\HEADINGSdouble}}
6501
6502 \CHAPPAGon
6503
6504 % \chapmacro - Chapter opening.
6505 %
6506 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6507 % Yappendix, Yomitfromtoc), #3 the chapter number.
6508 % Not used for @heading series.
6509 %
6510 % To test against our argument.
6511 \def\Ynothingkeyword{Ynothing}
6512 \def\Yappendixkeyword{Yappendix}
6513 \def\Yomitfromtockeyword{Yomitfromtoc}
6514 %
6515 \def\chapmacro#1#2#3{%
6516 \expandafter\ifx\thisenv\titlepage\else
6517 \checkenv{}% chapters, etc., should not start inside an environment.
6518 \fi
6519 % Insert the first mark before the heading break (see notes for \domark).
6520 \let\prevchapterdefs=\currentchapterdefs
6521 \let\prevsectiondefs=\currentsectiondefs
6522 \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6523 \gdef\thissection{}}%
6524 %
6525 \def\temptype{#2}%
6526 \ifx\temptype\Ynothingkeyword
6527 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6528 \gdef\thischapter{\thischaptername}}%
6529 \else\ifx\temptype\Yomitfromtockeyword
6530 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6531 \gdef\thischapter{}}%
6532 \else\ifx\temptype\Yappendixkeyword
6533 \toks0={#1}%
6534 \xdef\currentchapterdefs{%
6535 \gdef\noexpand\thischaptername{\the\toks0}%
6536 \gdef\noexpand\thischapternum{\appendixletter}%
6537 % \noexpand\putwordAppendix avoids expanding indigestible
6538 % commands in some of the translations.
6539 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6540 \noexpand\thischapternum:
6541 \noexpand\thischaptername}%
6542 }%
6543 \else
6544 \toks0={#1}%
6545 \xdef\currentchapterdefs{%
6546 \gdef\noexpand\thischaptername{\the\toks0}%
6547 \gdef\noexpand\thischapternum{\the\chapno}%
6548 % \noexpand\putwordChapter avoids expanding indigestible
6549 % commands in some of the translations.
6550 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6551 \noexpand\thischapternum:
6552 \noexpand\thischaptername}%
6553 }%
6554 \fi\fi\fi
6555 %
6556 % Output the mark. Pass it through \safewhatsit, to take care of
6557 % the preceding space.
6558 \safewhatsit\domark
6559 %
6560 % Insert the chapter heading break.
6561 \pchapsepmacro
6562 %
6563 % Now the second mark, after the heading break. No break points
6564 % between here and the heading.
6565 \let\prevchapterdefs=\currentchapterdefs
6566 \let\prevsectiondefs=\currentsectiondefs
6567 \domark
6568 %
6569 {%
6570 \chapfonts \rm
6571 \let\footnote=\errfootnoteheading % give better error message
6572 %
6573 % Have to define \currentsection before calling \donoderef, because the
6574 % xref code eventually uses it. On the other hand, it has to be called
6575 % after \pchapsepmacro, or the headline will change too soon.
6576 \gdef\currentsection{#1}%
6577 %
6578 % Only insert the separating space if we have a chapter/appendix
6579 % number, and don't print the unnumbered ``number''.
6580 \ifx\temptype\Ynothingkeyword
6581 \setbox0 = \hbox{}%
6582 \def\toctype{unnchap}%
6583 \else\ifx\temptype\Yomitfromtockeyword
6584 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6585 \def\toctype{omit}%
6586 \else\ifx\temptype\Yappendixkeyword
6587 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6588 \def\toctype{app}%
6589 \else
6590 \setbox0 = \hbox{#3\enspace}%
6591 \def\toctype{numchap}%
6592 \fi\fi\fi
6593 %
6594 % Write the toc entry for this chapter. Must come before the
6595 % \donoderef, because we include the current node name in the toc
6596 % entry, and \donoderef resets it to empty.
6597 \writetocentry{\toctype}{#1}{#3}%
6598 %
6599 % For pdftex, we have to write out the node definition (aka, make
6600 % the pdfdest) after any page break, but before the actual text has
6601 % been typeset. If the destination for the pdf outline is after the
6602 % text, then jumping from the outline may wind up with the text not
6603 % being visible, for instance under high magnification.
6604 \donoderef{#2}%
6605 %
6606 % Typeset the actual heading.
6607 \nobreak % Avoid page breaks at the interline glue.
6608 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6609 \unhbox0 #1\par}%
6610 }%
6611 \nobreak\bigskip % no page break after a chapter title
6612 \nobreak
6613 }
6614
6615 % @centerchap -- centered and unnumbered.
6616 \let\centerparametersmaybe = \relax
6617 \def\centerparameters{%
6618 \advance\rightskip by 3\rightskip
6619 \leftskip = \rightskip
6620 \parfillskip = 0pt
6621 }
6622
6623
6624 % Section titles. These macros combine the section number parts and
6625 % call the generic \sectionheading to do the printing.
6626 %
6627 \newskip\secheadingskip
6628 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6629
6630 % Subsection titles.
6631 \newskip\subsecheadingskip
6632 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6633
6634 % Subsubsection titles.
6635 \def\subsubsecheadingskip{\subsecheadingskip}
6636 \def\subsubsecheadingbreak{\subsecheadingbreak}
6637
6638
6639 % Print any size, any type, section title.
6640 %
6641 % #1 is the text of the title,
6642 % #2 is the section level (sec/subsec/subsubsec),
6643 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6644 % #4 is the section number.
6645 %
6646 \def\seckeyword{sec}
6647 %
6648 \def\sectionheading#1#2#3#4{%
6649 {%
6650 \def\sectionlevel{#2}%
6651 \def\temptype{#3}%
6652 %
6653 % It is ok for the @heading series commands to appear inside an
6654 % environment (it's been historically allowed, though the logic is
6655 % dubious), but not the others.
6656 \ifx\temptype\Yomitfromtockeyword\else
6657 \checkenv{}% non-@*heading should not be in an environment.
6658 \fi
6659 \let\footnote=\errfootnoteheading
6660 %
6661 % Switch to the right set of fonts.
6662 \csname #2fonts\endcsname \rm
6663 %
6664 % Insert first mark before the heading break (see notes for \domark).
6665 \let\prevsectiondefs=\currentsectiondefs
6666 \ifx\temptype\Ynothingkeyword
6667 \ifx\sectionlevel\seckeyword
6668 \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6669 \gdef\thissection{\thissectionname}}%
6670 \fi
6671 \else\ifx\temptype\Yomitfromtockeyword
6672 % Don't redefine \thissection.
6673 \else\ifx\temptype\Yappendixkeyword
6674 \ifx\sectionlevel\seckeyword
6675 \toks0={#1}%
6676 \xdef\currentsectiondefs{%
6677 \gdef\noexpand\thissectionname{\the\toks0}%
6678 \gdef\noexpand\thissectionnum{#4}%
6679 % \noexpand\putwordSection avoids expanding indigestible
6680 % commands in some of the translations.
6681 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6682 \noexpand\thissectionnum:
6683 \noexpand\thissectionname}%
6684 }%
6685 \fi
6686 \else
6687 \ifx\sectionlevel\seckeyword
6688 \toks0={#1}%
6689 \xdef\currentsectiondefs{%
6690 \gdef\noexpand\thissectionname{\the\toks0}%
6691 \gdef\noexpand\thissectionnum{#4}%
6692 % \noexpand\putwordSection avoids expanding indigestible
6693 % commands in some of the translations.
6694 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6695 \noexpand\thissectionnum:
6696 \noexpand\thissectionname}%
6697 }%
6698 \fi
6699 \fi\fi\fi
6700 %
6701 % Go into vertical mode. Usually we'll already be there, but we
6702 % don't want the following whatsit to end up in a preceding paragraph
6703 % if the document didn't happen to have a blank line.
6704 \par
6705 %
6706 % Output the mark. Pass it through \safewhatsit, to take care of
6707 % the preceding space.
6708 \safewhatsit\domark
6709 %
6710 % Insert space above the heading.
6711 \csname #2headingbreak\endcsname
6712 %
6713 % Now the second mark, after the heading break. No break points
6714 % between here and the heading.
6715 \global\let\prevsectiondefs=\currentsectiondefs
6716 \domark
6717 %
6718 % Only insert the space after the number if we have a section number.
6719 \ifx\temptype\Ynothingkeyword
6720 \setbox0 = \hbox{}%
6721 \def\toctype{unn}%
6722 \gdef\currentsection{#1}%
6723 \else\ifx\temptype\Yomitfromtockeyword
6724 % for @headings -- no section number, don't include in toc,
6725 % and don't redefine \currentsection.
6726 \setbox0 = \hbox{}%
6727 \def\toctype{omit}%
6728 \let\sectionlevel=\empty
6729 \else\ifx\temptype\Yappendixkeyword
6730 \setbox0 = \hbox{#4\enspace}%
6731 \def\toctype{app}%
6732 \gdef\currentsection{#1}%
6733 \else
6734 \setbox0 = \hbox{#4\enspace}%
6735 \def\toctype{num}%
6736 \gdef\currentsection{#1}%
6737 \fi\fi\fi
6738 %
6739 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6740 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6741 %
6742 % Write the node reference (= pdf destination for pdftex).
6743 % Again, see comments in \chapmacro.
6744 \donoderef{#3}%
6745 %
6746 % Interline glue will be inserted when the vbox is completed.
6747 % That glue will be a valid breakpoint for the page, since it'll be
6748 % preceded by a whatsit (usually from the \donoderef, or from the
6749 % \writetocentry if there was no node). We don't want to allow that
6750 % break, since then the whatsits could end up on page n while the
6751 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6752 \nobreak
6753 %
6754 % Output the actual section heading.
6755 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6756 \hangindent=\wd0 % zero if no section number
6757 \unhbox0 #1}%
6758 }%
6759 % Add extra space after the heading -- half of whatever came above it.
6760 % Don't allow stretch, though.
6761 \kern .5 \csname #2headingskip\endcsname
6762 %
6763 % Do not let the kern be a potential breakpoint, as it would be if it
6764 % was followed by glue.
6765 \nobreak
6766 %
6767 % We'll almost certainly start a paragraph next, so don't let that
6768 % glue accumulate. (Not a breakpoint because it's preceded by a
6769 % discardable item.) However, when a paragraph is not started next
6770 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6771 % or the negative glue will cause weirdly wrong output, typically
6772 % obscuring the section heading with something else.
6773 \vskip-\parskip
6774 %
6775 % This is so the last item on the main vertical list is a known
6776 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6777 % and do the needful.
6778 \penalty 10001
6779 }
6780
6781
6782 \message{toc,}
6783 % Table of contents.
6784 \newwrite\tocfile
6785
6786 % Write an entry to the toc file, opening it if necessary.
6787 % Called from @chapter, etc.
6788 %
6789 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6790 % We append the current node name (if any) and page number as additional
6791 % arguments for the \{chap,sec,...}entry macros which will eventually
6792 % read this. The node name is used in the pdf outlines as the
6793 % destination to jump to.
6794 %
6795 % We open the .toc file for writing here instead of at @setfilename (or
6796 % any other fixed time) so that @contents can be anywhere in the document.
6797 % But if #1 is `omit', then we don't do anything. This is used for the
6798 % table of contents chapter openings themselves.
6799 %
6800 \newif\iftocfileopened
6801 \def\omitkeyword{omit}%
6802 %
6803 \def\writetocentry#1#2#3{%
6804 \edef\writetoctype{#1}%
6805 \ifx\writetoctype\omitkeyword \else
6806 \iftocfileopened\else
6807 \immediate\openout\tocfile = \jobname.toc
6808 \global\tocfileopenedtrue
6809 \fi
6810 %
6811 \iflinks
6812 {\atdummies
6813 \edef\temp{%
6814 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6815 \temp
6816 }%
6817 \fi
6818 \fi
6819 %
6820 % Tell \shipout to create a pdf destination on each page, if we're
6821 % writing pdf. These are used in the table of contents. We can't
6822 % just write one on every page because the title pages are numbered
6823 % 1 and 2 (the page numbers aren't printed), and so are the first
6824 % two pages of the document. Thus, we'd have two destinations named
6825 % `1', and two named `2'.
6826 \ifpdforxetex
6827 \global\pdfmakepagedesttrue
6828 \fi
6829 }
6830
6831
6832 % These characters do not print properly in the Computer Modern roman
6833 % fonts, so we must take special care. This is more or less redundant
6834 % with the Texinfo input format setup at the end of this file.
6835 %
6836 \def\activecatcodes{%
6837 \catcode`\"=\active
6838 \catcode`\$=\active
6839 \catcode`\<=\active
6840 \catcode`\>=\active
6841 \catcode`\\=\active
6842 \catcode`\^=\active
6843 \catcode`\_=\active
6844 \catcode`\|=\active
6845 \catcode`\~=\active
6846 }
6847
6848
6849 % Read the toc file, which is essentially Texinfo input.
6850 \def\readtocfile{%
6851 \setupdatafile
6852 \activecatcodes
6853 \input \tocreadfilename
6854 }
6855
6856 \newskip\contentsrightmargin \contentsrightmargin=1in
6857 \newcount\savepageno
6858 \newcount\lastnegativepageno \lastnegativepageno = -1
6859
6860 % Prepare to read what we've written to \tocfile.
6861 %
6862 \def\startcontents#1{%
6863 % If @setchapternewpage on, and @headings double, the contents should
6864 % start on an odd page, unlike chapters.
6865 \contentsalignmacro
6866 \immediate\closeout\tocfile
6867 %
6868 % Don't need to put `Contents' or `Short Contents' in the headline.
6869 % It is abundantly clear what they are.
6870 \chapmacro{#1}{Yomitfromtoc}{}%
6871 %
6872 \savepageno = \pageno
6873 \begingroup % Set up to handle contents files properly.
6874 \raggedbottom % Worry more about breakpoints than the bottom.
6875 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6876 %
6877 % Roman numerals for page numbers.
6878 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6879 \def\thistitle{}% no title in double-sided headings
6880 % Record where the Roman numerals started.
6881 \ifnum\romancount=0 \global\romancount=\pagecount \fi
6882 }
6883
6884 % redefined for the two-volume lispref. We always output on
6885 % \jobname.toc even if this is redefined.
6886 %
6887 \def\tocreadfilename{\jobname.toc}
6888
6889 % Normal (long) toc.
6890 %
6891 \def\contents{%
6892 \startcontents{\putwordTOC}%
6893 \openin 1 \tocreadfilename\space
6894 \ifeof 1 \else
6895 \readtocfile
6896 \fi
6897 \vfill \eject
6898 \contentsalignmacro % in case @setchapternewpage odd is in effect
6899 \ifeof 1 \else
6900 \pdfmakeoutlines
6901 \fi
6902 \closein 1
6903 \endgroup
6904 \contentsendroman
6905 }
6906
6907 % And just the chapters.
6908 \def\summarycontents{%
6909 \startcontents{\putwordShortTOC}%
6910 %
6911 \let\partentry = \shortpartentry
6912 \let\numchapentry = \shortchapentry
6913 \let\appentry = \shortchapentry
6914 \let\unnchapentry = \shortunnchapentry
6915 % We want a true roman here for the page numbers.
6916 \secfonts
6917 \let\rm=\shortcontrm \let\bf=\shortcontbf
6918 \let\sl=\shortcontsl \let\tt=\shortconttt
6919 \rm
6920 \hyphenpenalty = 10000
6921 \advance\baselineskip by 1pt % Open it up a little.
6922 \def\numsecentry##1##2##3##4{}
6923 \let\appsecentry = \numsecentry
6924 \let\unnsecentry = \numsecentry
6925 \let\numsubsecentry = \numsecentry
6926 \let\appsubsecentry = \numsecentry
6927 \let\unnsubsecentry = \numsecentry
6928 \let\numsubsubsecentry = \numsecentry
6929 \let\appsubsubsecentry = \numsecentry
6930 \let\unnsubsubsecentry = \numsecentry
6931 \openin 1 \tocreadfilename\space
6932 \ifeof 1 \else
6933 \readtocfile
6934 \fi
6935 \closein 1
6936 \vfill \eject
6937 \contentsalignmacro % in case @setchapternewpage odd is in effect
6938 \endgroup
6939 \contentsendroman
6940 }
6941 \let\shortcontents = \summarycontents
6942
6943 % Get ready to use Arabic numerals again
6944 \def\contentsendroman{%
6945 \lastnegativepageno = \pageno
6946 \global\pageno = \savepageno
6947 %
6948 % If \romancount > \arabiccount, the contents are at the end of the
6949 % document. Otherwise, advance where the Arabic numerals start for
6950 % the page numbers.
6951 \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi
6952 }
6953
6954 % Typeset the label for a chapter or appendix for the short contents.
6955 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6956 %
6957 \def\shortchaplabel#1{%
6958 % This space should be enough, since a single number is .5em, and the
6959 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6960 % But use \hss just in case.
6961 % (This space doesn't include the extra space that gets added after
6962 % the label; that gets put in by \shortchapentry above.)
6963 %
6964 % We'd like to right-justify chapter numbers, but that looks strange
6965 % with appendix letters. And right-justifying numbers and
6966 % left-justifying letters looks strange when there is less than 10
6967 % chapters. Have to read the whole toc once to know how many chapters
6968 % there are before deciding ...
6969 \hbox to 1em{#1\hss}%
6970 }
6971
6972 % These macros generate individual entries in the table of contents.
6973 % The first argument is the chapter or section name.
6974 % The last argument is the page number.
6975 % The arguments in between are the chapter number, section number, ...
6976
6977 % Parts, in the main contents. Replace the part number, which doesn't
6978 % exist, with an empty box. Let's hope all the numbers have the same width.
6979 % Also ignore the page number, which is conventionally not printed.
6980 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6981 \def\partentry#1#2#3#4{%
6982 % Add stretch and a bonus for breaking the page before the part heading.
6983 % This reduces the chance of the page being broken immediately after the
6984 % part heading, before a following chapter heading.
6985 \vskip 0pt plus 5\baselineskip
6986 \penalty-300
6987 \vskip 0pt plus -5\baselineskip
6988 \dochapentry{\numeralbox\labelspace#1}{}%
6989 }
6990 %
6991 % Parts, in the short toc.
6992 \def\shortpartentry#1#2#3#4{%
6993 \penalty-300
6994 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6995 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6996 }
6997
6998 % Chapters, in the main contents.
6999 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
7000
7001 % Chapters, in the short toc.
7002 % See comments in \dochapentry re vbox and related settings.
7003 \def\shortchapentry#1#2#3#4{%
7004 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
7005 }
7006
7007 % Appendices, in the main contents.
7008 % Need the word Appendix, and a fixed-size box.
7009 %
7010 \def\appendixbox#1{%
7011 % We use M since it's probably the widest letter.
7012 \setbox0 = \hbox{\putwordAppendix{} M}%
7013 \hbox to \wd0{\putwordAppendix{} #1\hss}}
7014 %
7015 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
7016
7017 % Unnumbered chapters.
7018 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
7019 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
7020
7021 % Sections.
7022 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
7023 \let\appsecentry=\numsecentry
7024 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
7025
7026 % Subsections.
7027 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
7028 \let\appsubsecentry=\numsubsecentry
7029 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
7030
7031 % And subsubsections.
7032 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
7033 \let\appsubsubsecentry=\numsubsubsecentry
7034 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
7035
7036 % This parameter controls the indentation of the various levels.
7037 % Same as \defaultparindent.
7038 \newdimen\tocindent \tocindent = 15pt
7039
7040 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
7041 % page number.
7042 %
7043 % If the toc has to be broken over pages, we want it to be at chapters
7044 % if at all possible; hence the \penalty.
7045 \def\dochapentry#1#2{%
7046 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
7047 \begingroup
7048 % Move the page numbers slightly to the right
7049 \advance\entryrightmargin by -0.05em
7050 \chapentryfonts
7051 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7052 \endgroup
7053 \nobreak\vskip .25\baselineskip plus.1\baselineskip
7054 }
7055
7056 \def\dosecentry#1#2{\begingroup
7057 \secentryfonts \leftskip=\tocindent
7058 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7059 \endgroup}
7060
7061 \def\dosubsecentry#1#2{\begingroup
7062 \subsecentryfonts \leftskip=2\tocindent
7063 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7064 \endgroup}
7065
7066 \def\dosubsubsecentry#1#2{\begingroup
7067 \subsubsecentryfonts \leftskip=3\tocindent
7068 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7069 \endgroup}
7070
7071 % We use the same \entry macro as for the index entries.
7072 \let\tocentry = \entry
7073
7074 % Space between chapter (or whatever) number and the title.
7075 \def\labelspace{\hskip1em \relax}
7076
7077 \def\dopageno#1{{\rm #1}}
7078 \def\doshortpageno#1{{\rm #1}}
7079
7080 \def\chapentryfonts{\secfonts \rm}
7081 \def\secentryfonts{\textfonts}
7082 \def\subsecentryfonts{\textfonts}
7083 \def\subsubsecentryfonts{\textfonts}
7084
7085
7086 \message{environments,}
7087 % @foo ... @end foo.
7088
7089 % @tex ... @end tex escapes into raw TeX temporarily.
7090 % One exception: @ is still an escape character, so that @end tex works.
7091 % But \@ or @@ will get a plain @ character.
7092
7093 \envdef\tex{%
7094 \setregularquotes
7095 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
7096 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
7097 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
7098 \catcode `\%=14
7099 \catcode `\+=\other
7100 \catcode `\"=\other
7101 \catcode `\|=\other
7102 \catcode `\<=\other
7103 \catcode `\>=\other
7104 \catcode `\`=\other
7105 \catcode `\'=\other
7106 %
7107 % ' is active in math mode (mathcode"8000). So reset it, and all our
7108 % other math active characters (just in case), to plain's definitions.
7109 \mathactive
7110 %
7111 % Inverse of the list at the beginning of the file.
7112 \let\b=\ptexb
7113 \let\bullet=\ptexbullet
7114 \let\c=\ptexc
7115 \let\,=\ptexcomma
7116 \let\.=\ptexdot
7117 \let\dots=\ptexdots
7118 \let\equiv=\ptexequiv
7119 \let\!=\ptexexclam
7120 \let\i=\ptexi
7121 \let\indent=\ptexindent
7122 \let\noindent=\ptexnoindent
7123 \let\{=\ptexlbrace
7124 \let\+=\tabalign
7125 \let\}=\ptexrbrace
7126 \let\/=\ptexslash
7127 \let\sp=\ptexsp
7128 \let\*=\ptexstar
7129 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7130 \let\t=\ptext
7131 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7132 \let\frenchspacing=\plainfrenchspacing
7133 %
7134 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7135 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7136 \def\@{@}%
7137 }
7138 % There is no need to define \Etex.
7139
7140 % Define @lisp ... @end lisp.
7141 % @lisp environment forms a group so it can rebind things,
7142 % including the definition of @end lisp (which normally is erroneous).
7143
7144 % Amount to narrow the margins by for @lisp.
7145 \newskip\lispnarrowing \lispnarrowing=0.4in
7146
7147 % This is the definition that ^^M gets inside @lisp, @example, and other
7148 % such environments. \null is better than a space, since it doesn't
7149 % have any width.
7150 \def\lisppar{\null\endgraf}
7151
7152 % This space is always present above and below environments.
7153 \newskip\envskipamount \envskipamount = 0pt
7154
7155 % Make spacing and below environment symmetrical. We use \parskip here
7156 % to help in doing that, since in @example-like environments \parskip
7157 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7158 % start of the next paragraph will insert \parskip.
7159 %
7160 \def\aboveenvbreak{{%
7161 % =10000 instead of <10000 because of a special case in \itemzzz and
7162 % \sectionheading, q.v.
7163 \ifnum \lastpenalty=10000 \else
7164 \advance\envskipamount by \parskip
7165 \endgraf
7166 \ifdim\lastskip<\envskipamount
7167 \removelastskip
7168 \ifnum\lastpenalty<10000
7169 % Penalize breaking before the environment, because preceding text
7170 % often leads into it.
7171 \penalty100
7172 \fi
7173 \vskip\envskipamount
7174 \fi
7175 \fi
7176 }}
7177
7178 \def\afterenvbreak{{%
7179 % =10000 instead of <10000 because of a special case in \itemzzz and
7180 % \sectionheading, q.v.
7181 \ifnum \lastpenalty=10000 \else
7182 \advance\envskipamount by \parskip
7183 \endgraf
7184 \ifdim\lastskip<\envskipamount
7185 \removelastskip
7186 % it's not a good place to break if the last penalty was \nobreak
7187 % or better ...
7188 \ifnum\lastpenalty<10000 \penalty-50 \fi
7189 \vskip\envskipamount
7190 \fi
7191 \fi
7192 }}
7193
7194 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7195 % also clear it, so that its embedded environments do the narrowing again.
7196 \let\nonarrowing=\relax
7197
7198 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7199 % environment contents.
7200
7201 %
7202 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7203 \def\ctr{{\hskip 6pt\circle\char'010}}
7204 \def\cbl{{\circle\char'012\hskip -6pt}}
7205 \def\cbr{{\hskip 6pt\circle\char'011}}
7206 \def\carttop{\hbox to \cartouter{\hskip\lskip
7207 \ctl\leaders\hrule height\circthick\hfil\ctr
7208 \hskip\rskip}}
7209 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7210 \cbl\leaders\hrule height\circthick\hfil\cbr
7211 \hskip\rskip}}
7212 %
7213 \newskip\lskip\newskip\rskip
7214
7215 % only require the font if @cartouche is actually used
7216 \def\cartouchefontdefs{%
7217 \font\circle=lcircle10\relax
7218 \circthick=\fontdimen8\circle
7219 }
7220 \newdimen\circthick
7221 \newdimen\cartouter\newdimen\cartinner
7222 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7223
7224
7225 \envdef\cartouche{%
7226 \cartouchefontdefs
7227 \ifhmode\par\fi % can't be in the midst of a paragraph.
7228 \startsavinginserts
7229 \lskip=\leftskip \rskip=\rightskip
7230 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7231 \cartinner=\hsize \advance\cartinner by-\lskip
7232 \advance\cartinner by-\rskip
7233 \cartouter=\hsize
7234 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
7235 % side, and for 6pt waste from
7236 % each corner char, and rule thickness
7237 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7238 %
7239 % If this cartouche directly follows a sectioning command, we need the
7240 % \parskip glue (backspaced over by default) or the cartouche can
7241 % collide with the section heading.
7242 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7243 %
7244 \setbox\groupbox=\vbox\bgroup
7245 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7246 \carttop
7247 \hbox\bgroup
7248 \hskip\lskip
7249 \vrule\kern3pt
7250 \vbox\bgroup
7251 \kern3pt
7252 \hsize=\cartinner
7253 \baselineskip=\normbskip
7254 \lineskip=\normlskip
7255 \parskip=\normpskip
7256 \vskip -\parskip
7257 \comment % For explanation, see the end of def\group.
7258 }
7259 \def\Ecartouche{%
7260 \ifhmode\par\fi
7261 \kern3pt
7262 \egroup
7263 \kern3pt\vrule
7264 \hskip\rskip
7265 \egroup
7266 \cartbot
7267 \egroup
7268 \addgroupbox
7269 \checkinserts
7270 }
7271
7272
7273 % This macro is called at the beginning of all the @example variants,
7274 % inside a group.
7275 \newdimen\nonfillparindent
7276 \def\nonfillstart{%
7277 \aboveenvbreak
7278 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7279 \sepspaces % Make spaces be word-separators rather than space tokens.
7280 \let\par = \lisppar % don't ignore blank lines
7281 \obeylines % each line of input is a line of output
7282 \parskip = 0pt
7283 % Turn off paragraph indentation but redefine \indent to emulate
7284 % the normal \indent.
7285 \nonfillparindent=\parindent
7286 \parindent = 0pt
7287 \let\indent\nonfillindent
7288 %
7289 \emergencystretch = 0pt % don't try to avoid overfull boxes
7290 \ifx\nonarrowing\relax
7291 \advance \leftskip by \lispnarrowing
7292 \exdentamount=\lispnarrowing
7293 \else
7294 \let\nonarrowing = \relax
7295 \fi
7296 \let\exdent=\nofillexdent
7297 }
7298
7299 \begingroup
7300 \obeyspaces
7301 % We want to swallow spaces (but not other tokens) after the fake
7302 % @indent in our nonfill-environments, where spaces are normally
7303 % active and set to @tie, resulting in them not being ignored after
7304 % @indent.
7305 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7306 \gdef\nonfillindentcheck{%
7307 \ifx\temp %
7308 \expandafter\nonfillindentgobble%
7309 \else%
7310 \leavevmode\nonfillindentbox%
7311 \fi%
7312 }%
7313 \endgroup
7314 \def\nonfillindentgobble#1{\nonfillindent}
7315 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7316
7317 % If you want all examples etc. small: @set dispenvsize small.
7318 % If you want even small examples the full size: @set dispenvsize nosmall.
7319 % This affects the following displayed environments:
7320 % @example, @display, @format, @lisp, @verbatim
7321 %
7322 \def\smallword{small}
7323 \def\nosmallword{nosmall}
7324 \let\SETdispenvsize\relax
7325 \def\setnormaldispenv{%
7326 \ifx\SETdispenvsize\smallword
7327 % end paragraph for sake of leading, in case document has no blank
7328 % line. This is redundant with what happens in \aboveenvbreak, but
7329 % we need to do it before changing the fonts, and it's inconvenient
7330 % to change the fonts afterward.
7331 \ifnum \lastpenalty=10000 \else \endgraf \fi
7332 \smallexamplefonts \rm
7333 \fi
7334 }
7335 \def\setsmalldispenv{%
7336 \ifx\SETdispenvsize\nosmallword
7337 \else
7338 \ifnum \lastpenalty=10000 \else \endgraf \fi
7339 \smallexamplefonts \rm
7340 \fi
7341 }
7342
7343 % We often define two environments, @foo and @smallfoo.
7344 % Let's do it in one command. #1 is the env name, #2 the definition.
7345 \def\makedispenvdef#1#2{%
7346 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7347 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7348 \expandafter\let\csname E#1\endcsname \afterenvbreak
7349 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7350 }
7351
7352 % Define two environment synonyms (#1 and #2) for an environment.
7353 \def\maketwodispenvdef#1#2#3{%
7354 \makedispenvdef{#1}{#3}%
7355 \makedispenvdef{#2}{#3}%
7356 }
7357 %
7358 % @lisp: indented, narrowed, typewriter font;
7359 % @example: same as @lisp.
7360 %
7361 % @smallexample and @smalllisp: use smaller fonts.
7362 % Originally contributed by Pavel@xerox.
7363 %
7364 \maketwodispenvdef{lisp}{example}{%
7365 \nonfillstart
7366 \tt\setcodequotes
7367 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7368 \parsearg\gobble
7369 }
7370 % @display/@smalldisplay: same as @lisp except keep current font.
7371 %
7372 \makedispenvdef{display}{%
7373 \nonfillstart
7374 \gobble
7375 }
7376
7377 % @format/@smallformat: same as @display except don't narrow margins.
7378 %
7379 \makedispenvdef{format}{%
7380 \let\nonarrowing = t%
7381 \nonfillstart
7382 \gobble
7383 }
7384
7385 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7386 \envdef\flushleft{%
7387 \let\nonarrowing = t%
7388 \nonfillstart
7389 \gobble
7390 }
7391 \let\Eflushleft = \afterenvbreak
7392
7393 % @flushright.
7394 %
7395 \envdef\flushright{%
7396 \let\nonarrowing = t%
7397 \nonfillstart
7398 \advance\leftskip by 0pt plus 1fill\relax
7399 \gobble
7400 }
7401 \let\Eflushright = \afterenvbreak
7402
7403
7404 % @raggedright does more-or-less normal line breaking but no right
7405 % justification. From plain.tex.
7406 \envdef\raggedright{%
7407 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7408 }
7409 \let\Eraggedright\par
7410
7411 \envdef\raggedleft{%
7412 \parindent=0pt \leftskip0pt plus2em
7413 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7414 \hbadness=10000 % Last line will usually be underfull, so turn off
7415 % badness reporting.
7416 }
7417 \let\Eraggedleft\par
7418
7419 \envdef\raggedcenter{%
7420 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
7421 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7422 \hbadness=10000 % Last line will usually be underfull, so turn off
7423 % badness reporting.
7424 }
7425 \let\Eraggedcenter\par
7426
7427
7428 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7429 % and narrows the margins. We keep \parskip nonzero in general, since
7430 % we're doing normal filling. So, when using \aboveenvbreak and
7431 % \afterenvbreak, temporarily make \parskip 0.
7432 %
7433 \makedispenvdef{quotation}{\quotationstart}
7434 %
7435 \def\quotationstart{%
7436 \indentedblockstart % same as \indentedblock, but increase right margin too.
7437 \ifx\nonarrowing\relax
7438 \advance\rightskip by \lispnarrowing
7439 \fi
7440 \parsearg\quotationlabel
7441 }
7442
7443 % We have retained a nonzero parskip for the environment, since we're
7444 % doing normal filling.
7445 %
7446 \def\Equotation{%
7447 \par
7448 \ifx\quotationauthor\thisisundefined\else
7449 % indent a bit.
7450 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7451 \fi
7452 {\parskip=0pt \afterenvbreak}%
7453 }
7454 \def\Esmallquotation{\Equotation}
7455
7456 % If we're given an argument, typeset it in bold with a colon after.
7457 \def\quotationlabel#1{%
7458 \def\temp{#1}%
7459 \ifx\temp\empty \else
7460 {\bf #1: }%
7461 \fi
7462 }
7463
7464 % @indentedblock is like @quotation, but indents only on the left and
7465 % has no optional argument.
7466 %
7467 \makedispenvdef{indentedblock}{\indentedblockstart}
7468 %
7469 \def\indentedblockstart{%
7470 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7471 \parindent=0pt
7472 %
7473 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7474 \ifx\nonarrowing\relax
7475 \advance\leftskip by \lispnarrowing
7476 \exdentamount = \lispnarrowing
7477 \else
7478 \let\nonarrowing = \relax
7479 \fi
7480 }
7481
7482 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7483 %
7484 \def\Eindentedblock{%
7485 \par
7486 {\parskip=0pt \afterenvbreak}%
7487 }
7488 \def\Esmallindentedblock{\Eindentedblock}
7489
7490
7491 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7492 % If we want to allow any <char> as delimiter,
7493 % we need the curly braces so that makeinfo sees the @verb command, eg:
7494 % `@verbx...x' would look like the '@verbx' command. --janneke (a] gnu.org
7495 %
7496 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7497 %
7498 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7499 % active too. Otherwise, they get lost as the first character on a
7500 % verbatim line.
7501 \def\dospecials{%
7502 \do\ \do\\\do\{\do\}\do\$\do\&%
7503 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7504 \do\<\do\>\do\|\do\@\do+\do\"%
7505 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7506 % @set txicodequotebacktick will not have effect on @verb and
7507 % @verbatim, and ?` and !` ligatures won't get disabled.
7508 %\do\`\do\'%
7509 }
7510 %
7511 % [Knuth] p. 380
7512 \def\uncatcodespecials{%
7513 \def\do##1{\catcode`##1=\other}\dospecials}
7514 %
7515 % Setup for the @verb command.
7516 %
7517 % Eight spaces for a tab
7518 \begingroup
7519 \catcode`\^^I=\active
7520 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7521 \endgroup
7522 %
7523 \def\setupverb{%
7524 \tt % easiest (and conventionally used) font for verbatim
7525 \def\par{\leavevmode\endgraf}%
7526 \setcodequotes
7527 \tabeightspaces
7528 % Respect line breaks,
7529 % print special symbols as themselves, and
7530 % make each space count
7531 % must do in this order:
7532 \obeylines \uncatcodespecials \sepspaces
7533 }
7534
7535 % Setup for the @verbatim environment
7536 %
7537 % Real tab expansion.
7538 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7539 %
7540 % We typeset each line of the verbatim in an \hbox, so we can handle
7541 % tabs.
7542 \newbox\verbbox
7543 \def\starttabbox{\setbox\verbbox=\hbox\bgroup}
7544 %
7545 \begingroup
7546 \catcode`\^^I=\active
7547 \gdef\tabexpand{%
7548 \catcode`\^^I=\active
7549 \def^^I{\leavevmode\egroup
7550 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7551 \divide\dimen\verbbox by\tabw
7552 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7553 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7554 \wd\verbbox=\dimen\verbbox
7555 \leavevmode\box\verbbox \starttabbox
7556 }%
7557 }
7558 \endgroup
7559
7560 % start the verbatim environment.
7561 \def\setupverbatim{%
7562 \let\nonarrowing = t%
7563 \nonfillstart
7564 \tt % easiest (and conventionally used) font for verbatim
7565 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
7566 \tabexpand
7567 \setcodequotes
7568 % Respect line breaks,
7569 % print special symbols as themselves, and
7570 % make each space count.
7571 % Must do in this order:
7572 \obeylines \uncatcodespecials \sepspaces
7573 }
7574
7575 % Do the @verb magic: verbatim text is quoted by unique
7576 % delimiter characters. Before first delimiter expect a
7577 % right brace, after last delimiter expect closing brace:
7578 %
7579 % \def\doverb'{'<char>#1<char>'}'{#1}
7580 %
7581 % [Knuth] p. 382; only eat outer {}
7582 \begingroup
7583 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7584 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7585 \endgroup
7586 %
7587 \def\verb{\begingroup\setupverb\doverb}
7588 %
7589 %
7590 % Do the @verbatim magic: define the macro \doverbatim so that
7591 % the (first) argument ends when '@end verbatim' is reached, ie:
7592 %
7593 % \def\doverbatim#1@end verbatim{#1}
7594 %
7595 % For Texinfo it's a lot easier than for LaTeX,
7596 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7597 % we need not redefine '\', '{' and '}'.
7598 %
7599 % Inspired by LaTeX's verbatim command set [latex.ltx]
7600 %
7601 \begingroup
7602 \catcode`\ =\active
7603 \obeylines %
7604 % ignore everything up to the first ^^M, that's the newline at the end
7605 % of the @verbatim input line itself. Otherwise we get an extra blank
7606 % line in the output.
7607 \xdef\doverbatim#1^^M#2@end verbatim{%
7608 \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
7609 % We really want {...\end verbatim} in the body of the macro, but
7610 % without the active space; thus we have to use \xdef and \gobble.
7611 % The \egroup ends the \verbbox started at the end of the last line in
7612 % the block.
7613 \endgroup
7614 %
7615 \envdef\verbatim{%
7616 \setnormaldispenv\setupverbatim\doverbatim
7617 }
7618 \let\Everbatim = \afterenvbreak
7619
7620
7621 % @verbatiminclude FILE - insert text of file in verbatim environment.
7622 %
7623 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7624 %
7625 \def\doverbatiminclude#1{%
7626 {%
7627 \makevalueexpandable
7628 \setupverbatim
7629 {%
7630 \indexnofonts % Allow `@@' and other weird things in file names.
7631 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7632 \edef\tmp{\noexpand\input #1 }
7633 \expandafter
7634 }\expandafter\starttabbox\tmp\egroup
7635 \afterenvbreak
7636 }%
7637 }
7638
7639 % @copying ... @end copying.
7640 % Save the text away for @insertcopying later.
7641 %
7642 % We save the uninterpreted tokens, rather than creating a box.
7643 % Saving the text in a box would be much easier, but then all the
7644 % typesetting commands (@smallbook, font changes, etc.) have to be done
7645 % beforehand -- and a) we want @copying to be done first in the source
7646 % file; b) letting users define the frontmatter in as flexible order as
7647 % possible is desirable.
7648 %
7649 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7650 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7651 %
7652 \def\insertcopying{%
7653 \begingroup
7654 \parindent = 0pt % paragraph indentation looks wrong on title page
7655 \scanexp\copyingtext
7656 \endgroup
7657 }
7658
7659
7660 \message{defuns,}
7661 % @defun etc.
7662
7663 \newskip\defbodyindent \defbodyindent=.4in
7664 \newskip\defargsindent \defargsindent=50pt
7665 \newskip\deflastargmargin \deflastargmargin=18pt
7666 \newcount\defunpenalty
7667
7668 % Start the processing of @deffn:
7669 \def\startdefun{%
7670 \ifnum\lastpenalty<10000
7671 \medbreak
7672 \defunpenalty=10003 % Will keep this @deffn together with the
7673 % following @def command, see below.
7674 \else
7675 % If there are two @def commands in a row, we'll have a \nobreak,
7676 % which is there to keep the function description together with its
7677 % header. But if there's nothing but headers, we need to allow a
7678 % break somewhere. Check specifically for penalty 10002, inserted
7679 % by \printdefunline, instead of 10000, since the sectioning
7680 % commands also insert a nobreak penalty, and we don't want to allow
7681 % a break between a section heading and a defun.
7682 %
7683 % As a further refinement, we avoid "club" headers by signalling
7684 % with penalty of 10003 after the very first @deffn in the
7685 % sequence (see above), and penalty of 10002 after any following
7686 % @def command.
7687 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7688 %
7689 % Similarly, after a section heading, do not allow a break.
7690 % But do insert the glue.
7691 \medskip % preceded by discardable penalty, so not a breakpoint
7692 \fi
7693 %
7694 \parindent=0in
7695 \advance\leftskip by \defbodyindent
7696 \exdentamount=\defbodyindent
7697 }
7698
7699 \def\dodefunx#1{%
7700 % First, check whether we are in the right environment:
7701 \checkenv#1%
7702 %
7703 % As above, allow line break if we have multiple x headers in a row.
7704 % It's not a great place, though.
7705 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7706 %
7707 % And now, it's time to reuse the body of the original defun:
7708 \expandafter\gobbledefun#1%
7709 }
7710 \def\gobbledefun#1\startdefun{}
7711
7712 % \printdefunline \deffnheader{text}
7713 %
7714 \def\printdefunline#1#2{%
7715 \begingroup
7716 % call \deffnheader:
7717 #1#2 \endheader
7718 % common ending:
7719 \interlinepenalty = 10000
7720 \advance\rightskip by 0pt plus 1fil\relax
7721 \endgraf
7722 \nobreak\vskip -\parskip
7723 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7724 % Some of the @defun-type tags do not enable magic parentheses,
7725 % rendering the following check redundant. But we don't optimize.
7726 \checkparencounts
7727 \endgroup
7728 }
7729
7730 \def\Edefun{\endgraf\medbreak}
7731
7732 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7733 % the only thing remaining is to define \deffnheader.
7734 %
7735 \def\makedefun#1{%
7736 \expandafter\let\csname E#1\endcsname = \Edefun
7737 \edef\temp{\noexpand\domakedefun
7738 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7739 \temp
7740 }
7741
7742 % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7743 %
7744 % Define \deffn and \deffnx, without parameters.
7745 % \deffnheader has to be defined explicitly.
7746 %
7747 \def\domakedefun#1#2#3{%
7748 \envdef#1{%
7749 \startdefun
7750 \doingtypefnfalse % distinguish typed functions from all else
7751 \parseargusing\activeparens{\printdefunline#3}%
7752 }%
7753 \def#2{\dodefunx#1}%
7754 \def#3%
7755 }
7756
7757 \newif\ifdoingtypefn % doing typed function?
7758 \newif\ifrettypeownline % typeset return type on its own line?
7759
7760 % @deftypefnnewline on|off says whether the return type of typed functions
7761 % are printed on their own line. This affects @deftypefn, @deftypefun,
7762 % @deftypeop, and @deftypemethod.
7763 %
7764 \parseargdef\deftypefnnewline{%
7765 \def\temp{#1}%
7766 \ifx\temp\onword
7767 \expandafter\let\csname SETtxideftypefnnl\endcsname
7768 = \empty
7769 \else\ifx\temp\offword
7770 \expandafter\let\csname SETtxideftypefnnl\endcsname
7771 = \relax
7772 \else
7773 \errhelp = \EMsimple
7774 \errmessage{Unknown @txideftypefnnl value `\temp',
7775 must be on|off}%
7776 \fi\fi
7777 }
7778
7779 % \dosubind {index}{topic}{subtopic}
7780 %
7781 % If SUBTOPIC is present, precede it with a space, and call \doind.
7782 % (At some time during the 20th century, this made a two-level entry in an
7783 % index such as the operation index. Nobody seemed to notice the change in
7784 % behaviour though.)
7785 \def\dosubind#1#2#3{%
7786 \def\thirdarg{#3}%
7787 \ifx\thirdarg\empty
7788 \doind{#1}{#2}%
7789 \else
7790 \doind{#1}{#2\space#3}%
7791 \fi
7792 }
7793
7794 % Untyped functions:
7795
7796 % @deffn category name args
7797 \makedefun{deffn}{\deffngeneral{}}
7798
7799 % @deffn category class name args
7800 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7801
7802 % \defopon {category on}class name args
7803 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7804
7805 % \deffngeneral {subind}category name args
7806 %
7807 \def\deffngeneral#1#2 #3 #4\endheader{%
7808 \dosubind{fn}{\code{#3}}{#1}%
7809 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7810 }
7811
7812 % Typed functions:
7813
7814 % @deftypefn category type name args
7815 \makedefun{deftypefn}{\deftypefngeneral{}}
7816
7817 % @deftypeop category class type name args
7818 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7819
7820 % \deftypeopon {category on}class type name args
7821 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7822
7823 % \deftypefngeneral {subind}category type name args
7824 %
7825 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7826 \dosubind{fn}{\code{#4}}{#1}%
7827 \doingtypefntrue
7828 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7829 }
7830
7831 % Typed variables:
7832
7833 % @deftypevr category type var args
7834 \makedefun{deftypevr}{\deftypecvgeneral{}}
7835
7836 % @deftypecv category class type var args
7837 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7838
7839 % \deftypecvof {category of}class type var args
7840 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7841
7842 % \deftypecvgeneral {subind}category type var args
7843 %
7844 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7845 \dosubind{vr}{\code{#4}}{#1}%
7846 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7847 }
7848
7849 % Untyped variables:
7850
7851 % @defvr category var args
7852 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7853
7854 % @defcv category class var args
7855 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7856
7857 % \defcvof {category of}class var args
7858 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7859
7860 % Types:
7861
7862 % @deftp category name args
7863 \makedefun{deftp}#1 #2 #3\endheader{%
7864 \doind{tp}{\code{#2}}%
7865 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7866 }
7867
7868 % Remaining @defun-like shortcuts:
7869 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7870 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7871 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7872 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7873 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7874 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7875 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7876 \makedefun{defmethod}{\defopon\putwordMethodon}
7877 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7878 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7879 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7880
7881 % \defname, which formats the name of the @def (not the args).
7882 % #1 is the category, such as "Function".
7883 % #2 is the return type, if any.
7884 % #3 is the function name.
7885 %
7886 % We are followed by (but not passed) the arguments, if any.
7887 %
7888 \def\defname#1#2#3{%
7889 \par
7890 % Get the values of \leftskip and \rightskip as they were outside the @def...
7891 \advance\leftskip by -\defbodyindent
7892 %
7893 % Determine if we are typesetting the return type of a typed function
7894 % on a line by itself.
7895 \rettypeownlinefalse
7896 \ifdoingtypefn % doing a typed function specifically?
7897 % then check user option for putting return type on its own line:
7898 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7899 \rettypeownlinetrue
7900 \fi
7901 \fi
7902 %
7903 % How we'll format the category name. Putting it in brackets helps
7904 % distinguish it from the body text that may end up on the next line
7905 % just below it.
7906 \def\temp{#1}%
7907 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7908 %
7909 % Figure out line sizes for the paragraph shape. We'll always have at
7910 % least two.
7911 \tempnum = 2
7912 %
7913 % The first line needs space for \box0; but if \rightskip is nonzero,
7914 % we need only space for the part of \box0 which exceeds it:
7915 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7916 %
7917 % If doing a return type on its own line, we'll have another line.
7918 \ifrettypeownline
7919 \advance\tempnum by 1
7920 \def\maybeshapeline{0in \hsize}%
7921 \else
7922 \def\maybeshapeline{}%
7923 \fi
7924 %
7925 % The continuations:
7926 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7927 %
7928 % The final paragraph shape:
7929 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7930 %
7931 % Put the category name at the right margin.
7932 \noindent
7933 \hbox to 0pt{%
7934 \hfil\box0 \kern-\hsize
7935 % \hsize has to be shortened this way:
7936 \kern\leftskip
7937 % Intentionally do not respect \rightskip, since we need the space.
7938 }%
7939 %
7940 % Allow all lines to be underfull without complaint:
7941 \tolerance=10000 \hbadness=10000
7942 \exdentamount=\defbodyindent
7943 {%
7944 % defun fonts. We use typewriter by default (used to be bold) because:
7945 % . we're printing identifiers, they should be in tt in principle.
7946 % . in languages with many accents, such as Czech or French, it's
7947 % common to leave accents off identifiers. The result looks ok in
7948 % tt, but exceedingly strange in rm.
7949 % . we don't want -- and --- to be treated as ligatures.
7950 % . this still does not fix the ?` and !` ligatures, but so far no
7951 % one has made identifiers using them :).
7952 \df \tt
7953 \def\temp{#2}% text of the return type
7954 \ifx\temp\empty\else
7955 \tclose{\temp}% typeset the return type
7956 \ifrettypeownline
7957 % put return type on its own line; prohibit line break following:
7958 \hfil\vadjust{\nobreak}\break
7959 \else
7960 \space % type on same line, so just followed by a space
7961 \fi
7962 \fi % no return type
7963 #3% output function name
7964 }%
7965 {\rm\enskip}% hskip 0.5 em of \rmfont
7966 %
7967 \boldbrax
7968 % arguments will be output next, if any.
7969 }
7970
7971 % Print arguments in slanted roman (not ttsl), inconsistently with using
7972 % tt for the name. This is because literal text is sometimes needed in
7973 % the argument list (groff manual), and ttsl and tt are not very
7974 % distinguishable. Prevent hyphenation at `-' chars.
7975 %
7976 \def\defunargs#1{%
7977 % use sl by default (not ttsl),
7978 % tt for the names.
7979 \df \sl \hyphenchar\font=0
7980 %
7981 % On the other hand, if an argument has two dashes (for instance), we
7982 % want a way to get ttsl. We used to recommend @var for that, so
7983 % leave the code in, but it's strange for @var to lead to typewriter.
7984 % Nowadays we recommend @code, since the difference between a ttsl hyphen
7985 % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7986 \def\var##1{{\setregularquotes\ttslanted{##1}}}%
7987 #1%
7988 \sl\hyphenchar\font=45
7989 }
7990
7991 % We want ()&[] to print specially on the defun line.
7992 %
7993 \def\activeparens{%
7994 \catcode`\(=\active \catcode`\)=\active
7995 \catcode`\[=\active \catcode`\]=\active
7996 \catcode`\&=\active
7997 }
7998
7999 % Make control sequences which act like normal parenthesis chars.
8000 \let\lparen = ( \let\rparen = )
8001
8002 % Be sure that we always have a definition for `(', etc. For example,
8003 % if the fn name has parens in it, \boldbrax will not be in effect yet,
8004 % so TeX would otherwise complain about undefined control sequence.
8005 {
8006 \activeparens
8007 \global\let(=\lparen \global\let)=\rparen
8008 \global\let[=\lbrack \global\let]=\rbrack
8009 \global\let& = \&
8010
8011 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
8012 \gdef\magicamp{\let&=\amprm}
8013 }
8014 \let\ampchar\&
8015
8016 \newcount\parencount
8017
8018 % If we encounter &foo, then turn on ()-hacking afterwards
8019 \newif\ifampseen
8020 \def\amprm#1 {\ampseentrue{\bf\ }}
8021
8022 \def\parenfont{%
8023 \ifampseen
8024 % At the first level, print parens in roman,
8025 % otherwise use the default font.
8026 \ifnum \parencount=1 \rm \fi
8027 \else
8028 % The \sf parens (in \boldbrax) actually are a little bolder than
8029 % the contained text. This is especially needed for [ and ] .
8030 \sf
8031 \fi
8032 }
8033 \def\infirstlevel#1{%
8034 \ifampseen
8035 \ifnum\parencount=1
8036 #1%
8037 \fi
8038 \fi
8039 }
8040 \def\bfafterword#1 {#1 \bf}
8041
8042 \def\opnr{%
8043 \global\advance\parencount by 1
8044 {\parenfont(}%
8045 \infirstlevel \bfafterword
8046 }
8047 \def\clnr{%
8048 {\parenfont)}%
8049 \infirstlevel \sl
8050 \global\advance\parencount by -1
8051 }
8052
8053 \newcount\brackcount
8054 \def\lbrb{%
8055 \global\advance\brackcount by 1
8056 {\bf[}%
8057 }
8058 \def\rbrb{%
8059 {\bf]}%
8060 \global\advance\brackcount by -1
8061 }
8062
8063 \def\checkparencounts{%
8064 \ifnum\parencount=0 \else \badparencount \fi
8065 \ifnum\brackcount=0 \else \badbrackcount \fi
8066 }
8067 % these should not use \errmessage; the glibc manual, at least, actually
8068 % has such constructs (when documenting function pointers).
8069 \def\badparencount{%
8070 \message{Warning: unbalanced parentheses in @def...}%
8071 \global\parencount=0
8072 }
8073 \def\badbrackcount{%
8074 \message{Warning: unbalanced square brackets in @def...}%
8075 \global\brackcount=0
8076 }
8077
8078
8079 \message{macros,}
8080 % @macro.
8081
8082 % To do this right we need a feature of e-TeX, \scantokens,
8083 % which we arrange to emulate with a temporary file in ordinary TeX.
8084 \ifx\eTeXversion\thisisundefined
8085 \newwrite\macscribble
8086 \def\scantokens#1{%
8087 \toks0={#1}%
8088 \immediate\openout\macscribble=\jobname.tmp
8089 \immediate\write\macscribble{\the\toks0}%
8090 \immediate\closeout\macscribble
8091 \input \jobname.tmp
8092 }
8093 \fi
8094
8095 \let\E=\expandafter
8096
8097 % Used at the time of macro expansion.
8098 % Argument is macro body with arguments substituted
8099 \def\scanmacro#1{%
8100 \newlinechar`\^^M
8101 % expand the expansion of \eatleadingcr twice to maybe remove a leading
8102 % newline (and \else and \fi tokens), then call \eatspaces on the result.
8103 \def\xeatspaces##1{%
8104 \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
8105 }}%
8106 \def\xempty##1{}%
8107 %
8108 % Process the macro body under the current catcode regime.
8109 \scantokens{#1@comment}%
8110 %
8111 % The \comment is to remove the \newlinechar added by \scantokens, and
8112 % can be noticed by \parsearg. Note \c isn't used because this means cedilla
8113 % in math mode.
8114 }
8115
8116 % Used for copying and captions
8117 \def\scanexp#1{%
8118 \expandafter\scanmacro\expandafter{#1}%
8119 }
8120
8121 \newcount\paramno % Count of parameters
8122 \newtoks\macname % Macro name
8123 \newif\ifrecursive % Is it recursive?
8124
8125 % List of all defined macros in the form
8126 % \commondummyword\macro1\commondummyword\macro2...
8127 % Currently is also contains all @aliases; the list can be split
8128 % if there is a need.
8129 \def\macrolist{}
8130
8131 % Add the macro to \macrolist
8132 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
8133 \def\addtomacrolistxxx#1{%
8134 \toks0 = \expandafter{\macrolist\commondummyword#1}%
8135 \xdef\macrolist{\the\toks0}%
8136 }
8137
8138 % Utility routines.
8139 % This does \let #1 = #2, with \csnames; that is,
8140 % \let \csname#1\endcsname = \csname#2\endcsname
8141 % (except of course we have to play expansion games).
8142 %
8143 \def\cslet#1#2{%
8144 \expandafter\let
8145 \csname#1\expandafter\endcsname
8146 \csname#2\endcsname
8147 }
8148
8149 % Trim leading and trailing spaces off a string.
8150 % Concepts from aro-bend problem 15 (see CTAN).
8151 {\catcode`\@=11
8152 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
8153 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
8154 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
8155 \def\unbrace#1{#1}
8156 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
8157 }
8158
8159 {\catcode`\^^M=\other%
8160 \gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
8161 % Warning: this won't work for a delimited argument
8162 % or for an empty argument
8163
8164 % Trim a single trailing ^^M off a string.
8165 {\catcode`\^^M=\other \catcode`\Q=3%
8166 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8167 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8168 \gdef\eatcrb#1Q#2Q{#1}%
8169 }
8170
8171 % Macro bodies are absorbed as an argument in a context where
8172 % all characters are catcode 10, 11 or 12, except \ which is active
8173 % (as in normal texinfo). It is necessary to change the definition of \
8174 % to recognize macro arguments; this is the job of \mbodybackslash.
8175 %
8176 % Non-ASCII encodings make 8-bit characters active, so un-activate
8177 % them to avoid their expansion. Must do this non-globally, to
8178 % confine the change to the current group.
8179 %
8180 % It's necessary to have hard CRs when the macro is executed. This is
8181 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8182 % body, and then making it the \newlinechar in \scanmacro.
8183 %
8184 \def\scanctxt{% used as subroutine
8185 \catcode`\"=\other
8186 \catcode`\+=\other
8187 \catcode`\<=\other
8188 \catcode`\>=\other
8189 \catcode`\^=\other
8190 \catcode`\_=\other
8191 \catcode`\|=\other
8192 \catcode`\~=\other
8193 \passthroughcharstrue
8194 }
8195
8196 \def\scanargctxt{% used for copying and captions, not macros.
8197 \scanctxt
8198 \catcode`\@=\other
8199 \catcode`\\=\other
8200 \catcode`\^^M=\other
8201 }
8202
8203 \def\macrobodyctxt{% used for @macro definitions
8204 \scanctxt
8205 \catcode`\ =\other
8206 \catcode`\@=\other
8207 \catcode`\{=\other
8208 \catcode`\}=\other
8209 \catcode`\^^M=\other
8210 \usembodybackslash
8211 }
8212
8213 % Used when scanning braced macro arguments. Note, however, that catcode
8214 % changes here are ineffectual if the macro invocation was nested inside
8215 % an argument to another Texinfo command.
8216 \def\macroargctxt{%
8217 \scanctxt
8218 \catcode`\ =\active
8219 \catcode`\@=\other
8220 \catcode`\^^M=\other
8221 \catcode`\\=\active
8222 }
8223
8224 \def\macrolineargctxt{% used for whole-line arguments without braces
8225 \scanctxt
8226 \catcode`\@=\other
8227 \catcode`\{=\other
8228 \catcode`\}=\other
8229 }
8230
8231 % \mbodybackslash is the definition of \ in @macro bodies.
8232 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8233 % where N is the macro parameter number.
8234 % We define \csname macarg.\endcsname to be \realbackslash, so
8235 % \\ in macro replacement text gets you a backslash.
8236 %
8237 {\catcode`@=0 @catcode`@\=@active
8238 @gdef@usembodybackslash{@let\=@mbodybackslash}
8239 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8240 }
8241 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8242
8243 \def\margbackslash#1{\char`\#1 }
8244
8245 \def\macro{\recursivefalse\parsearg\macroxxx}
8246 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8247
8248 \def\macroxxx#1{%
8249 \getargs{#1}% now \macname is the macname and \argl the arglist
8250 \ifx\argl\empty % no arguments
8251 \paramno=0\relax
8252 \else
8253 \expandafter\parsemargdef \argl;%
8254 \if\paramno>256\relax
8255 \ifx\eTeXversion\thisisundefined
8256 \errhelp = \EMsimple
8257 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8258 \fi
8259 \fi
8260 \fi
8261 \if1\csname ismacro.\the\macname\endcsname
8262 \message{Warning: redefining \the\macname}%
8263 \else
8264 \expandafter\ifx\csname \the\macname\endcsname \relax
8265 \else \errmessage{Macro name \the\macname\space already defined}\fi
8266 \global\cslet{macsave.\the\macname}{\the\macname}%
8267 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8268 \addtomacrolist{\the\macname}%
8269 \fi
8270 \begingroup \macrobodyctxt
8271 \ifrecursive \expandafter\parsermacbody
8272 \else \expandafter\parsemacbody
8273 \fi}
8274
8275 \parseargdef\unmacro{%
8276 \if1\csname ismacro.#1\endcsname
8277 \global\cslet{#1}{macsave.#1}%
8278 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8279 % Remove the macro name from \macrolist:
8280 \begingroup
8281 \expandafter\let\csname#1\endcsname \relax
8282 \let\commondummyword\unmacrodo
8283 \xdef\macrolist{\macrolist}%
8284 \endgroup
8285 \else
8286 \errmessage{Macro #1 not defined}%
8287 \fi
8288 }
8289
8290 % Called by \do from \dounmacro on each macro. The idea is to omit any
8291 % macro definitions that have been changed to \relax.
8292 %
8293 \def\unmacrodo#1{%
8294 \ifx #1\relax
8295 % remove this
8296 \else
8297 \noexpand\commondummyword \noexpand#1%
8298 \fi
8299 }
8300
8301 % \getargs -- Parse the arguments to a @macro line. Set \macname to
8302 % the name of the macro, and \argl to the braced argument list.
8303 \def\getargs#1{\getargsxxx#1{}}
8304 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8305 \def\getmacname#1 #2\relax{\macname={#1}}
8306 \def\getmacargs#1{\def\argl{#1}}
8307 % This made use of the feature that if the last token of a
8308 % <parameter list> is #, then the preceding argument is delimited by
8309 % an opening brace, and that opening brace is not consumed.
8310
8311 % Parse the optional {params} list to @macro or @rmacro.
8312 % Set \paramno to the number of arguments,
8313 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8314 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
8315 % list to some hook where the argument is to be expanded. If there are
8316 % less than 10 arguments that hook is to be replaced by ##N where N
8317 % is the position in that list, that is to say the macro arguments are to be
8318 % defined `a la TeX in the macro body.
8319 %
8320 % That gets used by \mbodybackslash (above).
8321 %
8322 % If there are 10 or more arguments, a different technique is used: see
8323 % \parsemmanyargdef.
8324 %
8325 \def\parsemargdef#1;{%
8326 \paramno=0\def\paramlist{}%
8327 \let\hash\relax
8328 % \hash is redefined to `#' later to get it into definitions
8329 \let\xeatspaces\relax
8330 \let\xempty\relax
8331 \parsemargdefxxx#1,;,%
8332 \ifnum\paramno<10\relax\else
8333 \paramno0\relax
8334 \parsemmanyargdef@@#1,;,% 10 or more arguments
8335 \fi
8336 }
8337 \def\parsemargdefxxx#1,{%
8338 \if#1;\let\next=\relax
8339 \else \let\next=\parsemargdefxxx
8340 \advance\paramno by 1
8341 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8342 {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
8343 \edef\paramlist{\paramlist\hash\the\paramno,}%
8344 \fi\next}
8345 % the \xempty{} is to give \eatleadingcr an argument in the case of an
8346 % empty macro argument.
8347
8348 % \parsemacbody, \parsermacbody
8349 %
8350 % Read recursive and nonrecursive macro bodies. (They're different since
8351 % rec and nonrec macros end differently.)
8352 %
8353 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
8354 % body to be transformed.
8355 % Set \macrobody to the body of the macro, and call \defmacro.
8356 %
8357 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8358 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8359 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8360 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8361
8362 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8363 \edef\texiatcatcode{\the\catcode`\@}
8364 \catcode `@=11\relax
8365
8366 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8367
8368 % If there are 10 or more arguments, a different technique is used, where the
8369 % hook remains in the body, and when macro is to be expanded the body is
8370 % processed again to replace the arguments.
8371 %
8372 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8373 % argument N value and then \edef the body (nothing else will expand because of
8374 % the catcode regime under which the body was input).
8375 %
8376 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8377 % arguments, no macro can have more than 256 arguments (else error).
8378 %
8379 % In case that there are 10 or more arguments we parse again the arguments
8380 % list to set new definitions for the \macarg.BLAH macros corresponding to
8381 % each BLAH argument. It was anyhow needed to parse already once this list
8382 % in order to count the arguments, and as macros with at most 9 arguments
8383 % are by far more frequent than macro with 10 or more arguments, defining
8384 % twice the \macarg.BLAH macros does not cost too much processing power.
8385 \def\parsemmanyargdef@@#1,{%
8386 \if#1;\let\next=\relax
8387 \else
8388 \let\next=\parsemmanyargdef@@
8389 \edef\tempb{\eatspaces{#1}}%
8390 \expandafter\def\expandafter\tempa
8391 \expandafter{\csname macarg.\tempb\endcsname}%
8392 % Note that we need some extra \noexpand\noexpand, this is because we
8393 % don't want \the to be expanded in the \parsermacbody as it uses an
8394 % \xdef .
8395 \expandafter\edef\tempa
8396 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8397 \advance\paramno by 1\relax
8398 \fi\next}
8399
8400
8401 \let\endargs@\relax
8402 \let\nil@\relax
8403 \def\nilm@{\nil@}%
8404 \long\def\nillm@{\nil@}%
8405
8406 % This macro is expanded during the Texinfo macro expansion, not during its
8407 % definition. It gets all the arguments' values and assigns them to macros
8408 % macarg.ARGNAME
8409 %
8410 % #1 is the macro name
8411 % #2 is the list of argument names
8412 % #3 is the list of argument values
8413 \def\getargvals@#1#2#3{%
8414 \def\macargdeflist@{}%
8415 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8416 \def\paramlist{#2,\nil@}%
8417 \def\macroname{#1}%
8418 \begingroup
8419 \macroargctxt
8420 \def\argvaluelist{#3,\nil@}%
8421 \def\@tempa{#3}%
8422 \ifx\@tempa\empty
8423 \setemptyargvalues@
8424 \else
8425 \getargvals@@
8426 \fi
8427 }
8428 \def\getargvals@@{%
8429 \ifx\paramlist\nilm@
8430 % Some sanity check needed here that \argvaluelist is also empty.
8431 \ifx\argvaluelist\nillm@
8432 \else
8433 \errhelp = \EMsimple
8434 \errmessage{Too many arguments in macro `\macroname'!}%
8435 \fi
8436 \let\next\macargexpandinbody@
8437 \else
8438 \ifx\argvaluelist\nillm@
8439 % No more arguments values passed to macro. Set remaining named-arg
8440 % macros to empty.
8441 \let\next\setemptyargvalues@
8442 \else
8443 % pop current arg name into \@tempb
8444 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8445 \expandafter\@tempa\expandafter{\paramlist}%
8446 % pop current argument value into \@tempc
8447 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8448 \expandafter\@tempa\expandafter{\argvaluelist}%
8449 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8450 % First place the new argument macro definition into \@tempd
8451 \expandafter\macname\expandafter{\@tempc}%
8452 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8453 \expandafter\def\expandafter\@tempe\expandafter{%
8454 \csname macarg.\@tempb\endcsname}%
8455 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8456 \push@\@tempd\macargdeflist@
8457 \let\next\getargvals@@
8458 \fi
8459 \fi
8460 \next
8461 }
8462
8463 \def\push@#1#2{%
8464 \expandafter\expandafter\expandafter\def
8465 \expandafter\expandafter\expandafter#2%
8466 \expandafter\expandafter\expandafter{%
8467 \expandafter#1#2}%
8468 }
8469
8470 % Replace arguments by their values in the macro body, and place the result
8471 % in macro \@tempa.
8472 %
8473 \def\macvalstoargs@{%
8474 % To do this we use the property that token registers that are \the'ed
8475 % within an \edef expand only once. So we are going to place all argument
8476 % values into respective token registers.
8477 %
8478 % First we save the token context, and initialize argument numbering.
8479 \begingroup
8480 \paramno0\relax
8481 % Then, for each argument number #N, we place the corresponding argument
8482 % value into a new token list register \toks#N
8483 \expandafter\putargsintokens@\saveparamlist@,;,%
8484 % Then, we expand the body so that argument are replaced by their
8485 % values. The trick for values not to be expanded themselves is that they
8486 % are within tokens and that tokens expand only once in an \edef .
8487 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8488 % Now we restore the token stack pointer to free the token list registers
8489 % which we have used, but we make sure that expanded body is saved after
8490 % group.
8491 \expandafter
8492 \endgroup
8493 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8494 }
8495
8496 % Define the named-macro outside of this group and then close this group.
8497 %
8498 \def\macargexpandinbody@{%
8499 \expandafter
8500 \endgroup
8501 \macargdeflist@
8502 % First the replace in body the macro arguments by their values, the result
8503 % is in \@tempa .
8504 \macvalstoargs@
8505 % Then we point at the \norecurse or \gobble (for recursive) macro value
8506 % with \@tempb .
8507 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8508 % Depending on whether it is recursive or not, we need some tailing
8509 % \egroup .
8510 \ifx\@tempb\gobble
8511 \let\@tempc\relax
8512 \else
8513 \let\@tempc\egroup
8514 \fi
8515 % And now we do the real job:
8516 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8517 \@tempd
8518 }
8519
8520 \def\putargsintokens@#1,{%
8521 \if#1;\let\next\relax
8522 \else
8523 \let\next\putargsintokens@
8524 % First we allocate the new token list register, and give it a temporary
8525 % alias \@tempb .
8526 \toksdef\@tempb\the\paramno
8527 % Then we place the argument value into that token list register.
8528 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8529 \expandafter\@tempb\expandafter{\@tempa}%
8530 \advance\paramno by 1\relax
8531 \fi
8532 \next
8533 }
8534
8535 % Trailing missing arguments are set to empty.
8536 %
8537 \def\setemptyargvalues@{%
8538 \ifx\paramlist\nilm@
8539 \let\next\macargexpandinbody@
8540 \else
8541 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8542 \let\next\setemptyargvalues@
8543 \fi
8544 \next
8545 }
8546
8547 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8548 \expandafter\def\expandafter\@tempa\expandafter{%
8549 \expandafter\def\csname macarg.#1\endcsname{}}%
8550 \push@\@tempa\macargdeflist@
8551 \def\paramlist{#2}%
8552 }
8553
8554 % #1 is the element target macro
8555 % #2 is the list macro
8556 % #3,#4\endargs@ is the list value
8557 \def\pop@#1#2#3,#4\endargs@{%
8558 \def#1{#3}%
8559 \def#2{#4}%
8560 }
8561 \long\def\longpop@#1#2#3,#4\endargs@{%
8562 \long\def#1{#3}%
8563 \long\def#2{#4}%
8564 }
8565
8566
8567 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8568
8569
8570 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8571 % \macrobody has the body of the macro in it, with placeholders for
8572 % its parameters, looking like "\xeatspaces{\hash 1}".
8573 % \paramno is the number of parameters
8574 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8575 % There are four cases: macros of zero, one, up to nine, and many arguments.
8576 % \xdef is used so that macro definitions will survive the file
8577 % they're defined in: @include reads the file inside a group.
8578 %
8579 \def\defmacro{%
8580 \let\hash=##% convert placeholders to macro parameter chars
8581 \ifnum\paramno=1
8582 \def\xeatspaces##1{##1}%
8583 % This removes the pair of braces around the argument. We don't
8584 % use \eatspaces, because this can cause ends of lines to be lost
8585 % when the argument to \eatspaces is read, leading to line-based
8586 % commands like "@itemize" not being read correctly.
8587 \else
8588 \let\xeatspaces\relax % suppress expansion
8589 \fi
8590 \ifcase\paramno
8591 % 0
8592 \expandafter\xdef\csname\the\macname\endcsname{%
8593 \bgroup
8594 \noexpand\spaceisspace
8595 \noexpand\endlineisspace
8596 \noexpand\expandafter % skip any whitespace after the macro name.
8597 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8598 \expandafter\xdef\csname\the\macname @@@\endcsname{%
8599 \egroup
8600 \noexpand\scanmacro{\macrobody}}%
8601 \or % 1
8602 \expandafter\xdef\csname\the\macname\endcsname{%
8603 \bgroup
8604 \noexpand\braceorline
8605 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8606 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8607 \egroup
8608 \noexpand\scanmacro{\macrobody}%
8609 }%
8610 \else % at most 9
8611 \ifnum\paramno<10\relax
8612 % @MACNAME sets the context for reading the macro argument
8613 % @MACNAME@@ gets the argument, processes backslashes and appends a
8614 % comma.
8615 % @MACNAME@@@ removes braces surrounding the argument list.
8616 % @MACNAME@@@@ scans the macro body with arguments substituted.
8617 \expandafter\xdef\csname\the\macname\endcsname{%
8618 \bgroup
8619 \noexpand\expandafter % This \expandafter skip any spaces after the
8620 \noexpand\macroargctxt % macro before we change the catcode of space.
8621 \noexpand\expandafter
8622 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8623 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8624 \noexpand\passargtomacro
8625 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8626 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8627 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8628 \expandafter\expandafter
8629 \expandafter\xdef
8630 \expandafter\expandafter
8631 \csname\the\macname @@@@\endcsname\paramlist{%
8632 \egroup\noexpand\scanmacro{\macrobody}}%
8633 \else % 10 or more:
8634 \expandafter\xdef\csname\the\macname\endcsname{%
8635 \noexpand\getargvals@{\the\macname}{\argl}%
8636 }%
8637 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8638 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8639 \fi
8640 \fi}
8641
8642 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8643
8644 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8645
8646
8647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8648 %
8649 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8650 @catcode`@_=11 % private names
8651 @catcode`@!=11 % used as argument separator
8652
8653 % \passargtomacro#1#2 -
8654 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8655 % compressed to one.
8656 %
8657 % This implementation works by expansion, and not execution (so we cannot use
8658 % \def or similar). This reduces the risk of this failing in contexts where
8659 % complete expansion is done with no execution (for example, in writing out to
8660 % an auxiliary file for an index entry).
8661 %
8662 % State is kept in the input stream: the argument passed to
8663 % @look_ahead, @gobble_and_check_finish and @add_segment is
8664 %
8665 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8666 %
8667 % where:
8668 % THE_MACRO - name of the macro we want to call
8669 % ARG_RESULT - argument list we build to pass to that macro
8670 % PENDING_BS - either a backslash or nothing
8671 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8672
8673 @gdef@passargtomacro#1#2{%
8674 @add_segment #1!{}@relax#2\@_finish\%
8675 }
8676 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8677
8678 % #1 - THE_MACRO ARG_RESULT
8679 % #2 - PENDING_BS
8680 % #3 - NEXT_TOKEN
8681 % #4 used to look ahead
8682 %
8683 % If the next token is not a backslash, process the rest of the argument;
8684 % otherwise, remove the next token.
8685 @gdef@look_ahead#1!#2#3#4{%
8686 @ifx#4\%
8687 @expandafter@gobble_and_check_finish
8688 @else
8689 @expandafter@add_segment
8690 @fi#1!{#2}#4#4%
8691 }
8692
8693 % #1 - THE_MACRO ARG_RESULT
8694 % #2 - PENDING_BS
8695 % #3 - NEXT_TOKEN
8696 % #4 should be a backslash, which is gobbled.
8697 % #5 looks ahead
8698 %
8699 % Double backslash found. Add a single backslash, and look ahead.
8700 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8701 @add_segment#1\!{}#5#5%
8702 }
8703
8704 @gdef@is_fi{@fi}
8705
8706 % #1 - THE_MACRO ARG_RESULT
8707 % #2 - PENDING_BS
8708 % #3 - NEXT_TOKEN
8709 % #4 is input stream until next backslash
8710 %
8711 % Input stream is either at the start of the argument, or just after a
8712 % backslash sequence, either a lone backslash, or a doubled backslash.
8713 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8714 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8715 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8716 % a backslash just before the start of the input stream that has not been
8717 % added to ARG_RESULT.
8718 @gdef@add_segment#1!#2#3#4\{%
8719 @ifx#3@_finish
8720 @call_the_macro#1!%
8721 @else
8722 % append the pending backslash to the result, followed by the next segment
8723 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8724 % this @fi is discarded by @look_ahead.
8725 % we can't get rid of it with \expandafter because we don't know how
8726 % long #4 is.
8727 }
8728
8729 % #1 - THE_MACRO
8730 % #2 - ARG_RESULT
8731 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8732 % conditional.
8733 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8734
8735 }
8736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8737
8738 % \braceorline MAC is used for a one-argument macro MAC. It checks
8739 % whether the next non-whitespace character is a {. It sets the context
8740 % for reading the argument (slightly different in the two cases). Then,
8741 % to read the argument, in the whole-line case, it then calls the regular
8742 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8743 %
8744 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8745 \def\braceorlinexxx{%
8746 \ifx\nchar\bgroup
8747 \macroargctxt
8748 \expandafter\passargtomacro
8749 \else
8750 \macrolineargctxt\expandafter\parsearg
8751 \fi \macnamexxx}
8752
8753
8754 % @alias.
8755 % We need some trickery to remove the optional spaces around the equal
8756 % sign. Make them active and then expand them all to nothing.
8757 %
8758 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8759 \def\aliasxxx #1{\aliasyyy#1\relax}
8760 \def\aliasyyy #1=#2\relax{%
8761 {%
8762 \expandafter\let\obeyedspace=\empty
8763 \addtomacrolist{#1}%
8764 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8765 }%
8766 \next
8767 }
8768
8769
8770 \message{cross references,}
8771
8772 \newwrite\auxfile
8773 \newif\ifhavexrefs % True if xref values are known.
8774 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8775
8776 % @inforef is relatively simple.
8777 \def\inforef #1{\inforefzzz #1,,,,**}
8778 \def\inforefzzz #1,#2,#3,#4**{%
8779 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8780 node \samp{\ignorespaces#1{}}}
8781
8782 % @node's only job in TeX is to define \lastnode, which is used in
8783 % cross-references. The @node line might or might not have commas, and
8784 % might or might not have spaces before the first comma, like:
8785 % @node foo , bar , ...
8786 % We don't want such trailing spaces in the node name.
8787 %
8788 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8789 %
8790 % also remove a trailing comma, in case of something like this:
8791 % @node Help-Cross, , , Cross-refs
8792 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8793 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
8794
8795 % Used so that the @top node doesn't have to be wrapped in an @ifnottex
8796 % conditional.
8797 % \doignore goes to more effort to skip nested conditionals but we don't need
8798 % that here.
8799 \def\omittopnode{%
8800 \ifx\lastnode\wordTop
8801 \expandafter\ignorenode\fi
8802 }
8803 \def\wordTop{Top}
8804
8805 % Until the next @node or @bye command, divert output to a box that is not
8806 % output.
8807 \def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}%
8808 \ignorenodebye
8809 }
8810
8811 {\let\bye\relax
8812 \gdef\ignorenodebye{\let\bye\ignorenodebyedef}
8813 \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
8814 % The redefinition of \bye here is because it is declared \outer
8815
8816 \let\lastnode=\empty
8817
8818 % Write a cross-reference definition for the current node. #1 is the
8819 % type (Ynumbered, Yappendix, Ynothing).
8820 %
8821 \def\donoderef#1{%
8822 \ifx\lastnode\empty\else
8823 \setref{\lastnode}{#1}%
8824 \global\let\lastnode=\empty
8825 \fi
8826 }
8827
8828 % @anchor{NAME} -- define xref target at arbitrary point.
8829 %
8830 \newcount\savesfregister
8831 %
8832 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8833 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8834 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8835
8836 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8837 % anchor), which consists of three parts:
8838 % 1) NAME-title - the current sectioning name taken from \currentsection,
8839 % or the anchor name.
8840 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8841 % empty for anchors.
8842 % 3) NAME-pg - the page number.
8843 %
8844 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8845 % floats, there is an additional part, which is not written here:
8846 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8847 %
8848 \def\setref#1#2{%
8849 \pdfmkdest{#1}%
8850 \iflinks
8851 {%
8852 \requireauxfile
8853 \atdummies % preserve commands, but don't expand them
8854 % match definition in \xrdef, \refx, \xrefX.
8855 \def\value##1{##1}%
8856 \edef\writexrdef##1##2{%
8857 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8858 ##1}{##2}}% these are parameters of \writexrdef
8859 }%
8860 \toks0 = \expandafter{\currentsection}%
8861 \immediate \writexrdef{title}{\the\toks0 }%
8862 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8863 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8864 }%
8865 \fi
8866 }
8867
8868 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8869 % automatically in xrefs, if the third arg is not explicitly specified.
8870 % This was provided as a "secret" @set xref-automatic-section-title
8871 % variable, now it's official.
8872 %
8873 \parseargdef\xrefautomaticsectiontitle{%
8874 \def\temp{#1}%
8875 \ifx\temp\onword
8876 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8877 = \empty
8878 \else\ifx\temp\offword
8879 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8880 = \relax
8881 \else
8882 \errhelp = \EMsimple
8883 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8884 must be on|off}%
8885 \fi\fi
8886 }
8887
8888 %
8889 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8890 % the node name, #2 the name of the Info cross-reference, #3 the printed
8891 % node name, #4 the name of the Info file, #5 the name of the printed
8892 % manual. All but the node name can be omitted.
8893 %
8894 \def\pxref{\putwordsee{} \xrefXX}
8895 \def\xref{\putwordSee{} \xrefXX}
8896 \def\ref{\xrefXX}
8897
8898 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8899 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8900 %
8901 \newbox\toprefbox
8902 \newbox\printedrefnamebox
8903 \newbox\infofilenamebox
8904 \newbox\printedmanualbox
8905 %
8906 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8907 \unsepspaces
8908 %
8909 % Get args without leading/trailing spaces.
8910 \def\printedrefname{\ignorespaces #3}%
8911 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8912 %
8913 \def\infofilename{\ignorespaces #4}%
8914 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8915 %
8916 \def\printedmanual{\ignorespaces #5}%
8917 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8918 %
8919 % If the printed reference name (arg #3) was not explicitly given in
8920 % the @xref, figure out what we want to use.
8921 \ifdim \wd\printedrefnamebox = 0pt
8922 % No printed node name was explicitly given.
8923 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8924 % Not auto section-title: use node name inside the square brackets.
8925 \def\printedrefname{\ignorespaces #1}%
8926 \else
8927 % Auto section-title: use chapter/section title inside
8928 % the square brackets if we have it.
8929 \ifdim \wd\printedmanualbox > 0pt
8930 % It is in another manual, so we don't have it; use node name.
8931 \def\printedrefname{\ignorespaces #1}%
8932 \else
8933 \ifhavexrefs
8934 % We (should) know the real title if we have the xref values.
8935 \def\printedrefname{\refx{#1-title}}%
8936 \else
8937 % Otherwise just copy the Info node name.
8938 \def\printedrefname{\ignorespaces #1}%
8939 \fi%
8940 \fi
8941 \fi
8942 \fi
8943 %
8944 % Make link in pdf output.
8945 \ifpdf
8946 % For pdfTeX and LuaTeX
8947 {\indexnofonts
8948 \makevalueexpandable
8949 \turnoffactive
8950 % This expands tokens, so do it after making catcode changes, so _
8951 % etc. don't get their TeX definitions. This ignores all spaces in
8952 % #4, including (wrongly) those in the middle of the filename.
8953 \getfilename{#4}%
8954 %
8955 % This (wrongly) does not take account of leading or trailing
8956 % spaces in #1, which should be ignored.
8957 \setpdfdestname{#1}%
8958 %
8959 \ifx\pdfdestname\empty
8960 \def\pdfdestname{Top}% no empty targets
8961 \fi
8962 %
8963 \leavevmode
8964 \startlink attr{/Border [0 0 0]}%
8965 \ifnum\filenamelength>0
8966 goto file{\the\filename.pdf} name{\pdfdestname}%
8967 \else
8968 goto name{\pdfmkpgn{\pdfdestname}}%
8969 \fi
8970 }%
8971 \setcolor{\linkcolor}%
8972 \else
8973 \ifx\XeTeXrevision\thisisundefined
8974 \else
8975 % For XeTeX
8976 {\indexnofonts
8977 \makevalueexpandable
8978 \turnoffactive
8979 % This expands tokens, so do it after making catcode changes, so _
8980 % etc. don't get their TeX definitions. This ignores all spaces in
8981 % #4, including (wrongly) those in the middle of the filename.
8982 \getfilename{#4}%
8983 %
8984 % This (wrongly) does not take account of leading or trailing
8985 % spaces in #1, which should be ignored.
8986 \setpdfdestname{#1}%
8987 %
8988 \ifx\pdfdestname\empty
8989 \def\pdfdestname{Top}% no empty targets
8990 \fi
8991 %
8992 \leavevmode
8993 \ifnum\filenamelength>0
8994 % With default settings,
8995 % XeTeX (xdvipdfmx) replaces link destination names with integers.
8996 % In this case, the replaced destination names of
8997 % remote PDFs are no longer known. In order to avoid a replacement,
8998 % you can use xdvipdfmx's command line option `-C 0x0010'.
8999 % If you use XeTeX 0.99996+ (TeX Live 2016+),
9000 % this command line option is no longer necessary
9001 % because we can use the `dvipdfmx:config' special.
9002 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
9003 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
9004 \else
9005 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
9006 << /S /GoTo /D (\pdfdestname) >> >>}%
9007 \fi
9008 }%
9009 \setcolor{\linkcolor}%
9010 \fi
9011 \fi
9012 {%
9013 % Have to otherify everything special to allow the \csname to
9014 % include an _ in the xref name, etc.
9015 \indexnofonts
9016 \turnoffactive
9017 \def\value##1{##1}%
9018 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
9019 \csname XR#1-title\endcsname
9020 }%
9021 %
9022 % Float references are printed completely differently: "Figure 1.2"
9023 % instead of "[somenode], p.3". \iffloat distinguishes them by
9024 % \Xthisreftitle being set to a magic string.
9025 \iffloat\Xthisreftitle
9026 % If the user specified the print name (third arg) to the ref,
9027 % print it instead of our usual "Figure 1.2".
9028 \ifdim\wd\printedrefnamebox = 0pt
9029 \refx{#1-snt}%
9030 \else
9031 \printedrefname
9032 \fi
9033 %
9034 % If the user also gave the printed manual name (fifth arg), append
9035 % "in MANUALNAME".
9036 \ifdim \wd\printedmanualbox > 0pt
9037 \space \putwordin{} \cite{\printedmanual}%
9038 \fi
9039 \else
9040 % node/anchor (non-float) references.
9041 %
9042 % If we use \unhbox to print the node names, TeX does not insert
9043 % empty discretionaries after hyphens, which means that it will not
9044 % find a line break at a hyphen in a node names. Since some manuals
9045 % are best written with fairly long node names, containing hyphens,
9046 % this is a loss. Therefore, we give the text of the node name
9047 % again, so it is as if TeX is seeing it for the first time.
9048 %
9049 \ifdim \wd\printedmanualbox > 0pt
9050 % Cross-manual reference with a printed manual name.
9051 %
9052 \crossmanualxref{\cite{\printedmanual\unskip}}%
9053 %
9054 \else\ifdim \wd\infofilenamebox > 0pt
9055 % Cross-manual reference with only an info filename (arg 4), no
9056 % printed manual name (arg 5). This is essentially the same as
9057 % the case above; we output the filename, since we have nothing else.
9058 %
9059 \crossmanualxref{\code{\infofilename\unskip}}%
9060 %
9061 \else
9062 % Reference within this manual.
9063 %
9064 % Only output a following space if the -snt ref is nonempty, as the ref
9065 % will be empty for @unnumbered and @anchor.
9066 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
9067 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
9068 %
9069 % output the `[mynode]' via the macro below so it can be overridden.
9070 \xrefprintnodename\printedrefname
9071 %
9072 \expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax
9073 % But we always want a comma and a space:
9074 ,\space
9075 %
9076 % output the `page 3'.
9077 \turnoffactive \putwordpage\tie\refx{#1-pg}%
9078 % Add a , if xref followed by a space
9079 \if\space\noexpand\tokenafterxref ,%
9080 \else\ifx\ \tokenafterxref ,% @TAB
9081 \else\ifx\*\tokenafterxref ,% @*
9082 \else\ifx\ \tokenafterxref ,% @SPACE
9083 \else\ifx\
9084 \tokenafterxref ,% @NL
9085 \else\ifx\tie\tokenafterxref ,% @tie
9086 \fi\fi\fi\fi\fi\fi
9087 \fi
9088 \fi\fi
9089 \fi
9090 \endlink
9091 \endgroup}
9092
9093 % Output a cross-manual xref to #1. Used just above (twice).
9094 %
9095 % Only include the text "Section ``foo'' in" if the foo is neither
9096 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
9097 % "see The Foo Manual", the idea being to refer to the whole manual.
9098 %
9099 % But, this being TeX, we can't easily compare our node name against the
9100 % string "Top" while ignoring the possible spaces before and after in
9101 % the input. By adding the arbitrary 7sp below, we make it much less
9102 % likely that a real node name would have the same width as "Top" (e.g.,
9103 % in a monospaced font). Hopefully it will never happen in practice.
9104 %
9105 % For the same basic reason, we retypeset the "Top" at every
9106 % reference, since the current font is indeterminate.
9107 %
9108 \def\crossmanualxref#1{%
9109 \setbox\toprefbox = \hbox{Top\kern7sp}%
9110 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
9111 \ifdim \wd2 > 7sp % nonempty?
9112 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
9113 \putwordSection{} ``\printedrefname'' \putwordin{}\space
9114 \fi
9115 \fi
9116 #1%
9117 }
9118
9119 % This macro is called from \xrefX for the `[nodename]' part of xref
9120 % output. It's a separate macro only so it can be changed more easily,
9121 % since square brackets don't work well in some documents. Particularly
9122 % one that Bob is working on :).
9123 %
9124 \def\xrefprintnodename#1{[#1]}
9125
9126 % Things referred to by \setref.
9127 %
9128 \def\Ynothing{}
9129 \def\Yomitfromtoc{}
9130 \def\Ynumbered{%
9131 \ifnum\secno=0
9132 \putwordChapter@tie \the\chapno
9133 \else \ifnum\subsecno=0
9134 \putwordSection@tie \the\chapno.\the\secno
9135 \else \ifnum\subsubsecno=0
9136 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9137 \else
9138 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9139 \fi\fi\fi
9140 }
9141 \def\Yappendix{%
9142 \ifnum\secno=0
9143 \putwordAppendix@tie @char\the\appendixno{}%
9144 \else \ifnum\subsecno=0
9145 \putwordSection@tie @char\the\appendixno.\the\secno
9146 \else \ifnum\subsubsecno=0
9147 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9148 \else
9149 \putwordSection@tie
9150 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9151 \fi\fi\fi
9152 }
9153
9154 % \refx{NAME} - reference a cross-reference string named NAME.
9155 \def\refx#1{%
9156 \requireauxfile
9157 {%
9158 \indexnofonts
9159 \turnoffactive
9160 \def\value##1{##1}%
9161 \expandafter\global\expandafter\let\expandafter\thisrefX
9162 \csname XR#1\endcsname
9163 }%
9164 \ifx\thisrefX\relax
9165 % If not defined, say something at least.
9166 \angleleft un\-de\-fined\angleright
9167 \iflinks
9168 \ifhavexrefs
9169 {\toks0 = {#1}% avoid expansion of possibly-complex value
9170 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9171 \else
9172 \ifwarnedxrefs\else
9173 \global\warnedxrefstrue
9174 \message{Cross reference values unknown; you must run TeX again.}%
9175 \fi
9176 \fi
9177 \fi
9178 \else
9179 % It's defined, so just use it.
9180 \thisrefX
9181 \fi
9182 }
9183
9184 % This is the macro invoked by entries in the aux file. Define a control
9185 % sequence for a cross-reference target (we prepend XR to the control sequence
9186 % name to avoid collisions). The value is the page number. If this is a float
9187 % type, we have more work to do.
9188 %
9189 \def\xrdef#1#2{%
9190 {% Expand the node or anchor name to remove control sequences.
9191 % \turnoffactive stops 8-bit characters being changed to commands
9192 % like @'e. \refx does the same to retrieve the value in the definition.
9193 \indexnofonts
9194 \turnoffactive
9195 \def\value##1{##1}%
9196 \xdef\safexrefname{#1}%
9197 }%
9198 %
9199 \bgroup
9200 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
9201 \egroup
9202 % We put the \gdef inside a group to avoid the definitions building up on
9203 % TeX's save stack, which can cause it to run out of space for aux files with
9204 % thousands of lines. \gdef doesn't use the save stack, but \csname does
9205 % when it defines an unknown control sequence as \relax.
9206 %
9207 % Was that xref control sequence that we just defined for a float?
9208 \expandafter\iffloat\csname XR\safexrefname\endcsname
9209 % it was a float, and we have the (safe) float type in \iffloattype.
9210 \expandafter\let\expandafter\floatlist
9211 \csname floatlist\iffloattype\endcsname
9212 %
9213 % Is this the first time we've seen this float type?
9214 \expandafter\ifx\floatlist\relax
9215 \toks0 = {\do}% yes, so just \do
9216 \else
9217 % had it before, so preserve previous elements in list.
9218 \toks0 = \expandafter{\floatlist\do}%
9219 \fi
9220 %
9221 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9222 % for later use in \listoffloats.
9223 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9224 {\safexrefname}}%
9225 \fi
9226 }
9227
9228 % If working on a large document in chapters, it is convenient to
9229 % be able to disable indexing, cross-referencing, and contents, for test runs.
9230 % This is done with @novalidate at the beginning of the file.
9231 %
9232 \newif\iflinks \linkstrue % by default we want the aux files.
9233 \let\novalidate = \linksfalse
9234
9235 % Used when writing to the aux file, or when using data from it.
9236 \def\requireauxfile{%
9237 \iflinks
9238 \tryauxfile
9239 % Open the new aux file. TeX will close it automatically at exit.
9240 \immediate\openout\auxfile=\jobname.aux
9241 \fi
9242 \global\let\requireauxfile=\relax % Only do this once.
9243 }
9244
9245 % Read the last existing aux file, if any. No error if none exists.
9246 %
9247 \def\tryauxfile{%
9248 \openin 1 \jobname.aux
9249 \ifeof 1 \else
9250 \readdatafile{aux}%
9251 \global\havexrefstrue
9252 \fi
9253 \closein 1
9254 }
9255
9256 \def\setupdatafile{%
9257 \catcode`\^^@=\other
9258 \catcode`\^^A=\other
9259 \catcode`\^^B=\other
9260 \catcode`\^^C=\other
9261 \catcode`\^^D=\other
9262 \catcode`\^^E=\other
9263 \catcode`\^^F=\other
9264 \catcode`\^^G=\other
9265 \catcode`\^^H=\other
9266 \catcode`\^^K=\other
9267 \catcode`\^^L=\other
9268 \catcode`\^^N=\other
9269 \catcode`\^^P=\other
9270 \catcode`\^^Q=\other
9271 \catcode`\^^R=\other
9272 \catcode`\^^S=\other
9273 \catcode`\^^T=\other
9274 \catcode`\^^U=\other
9275 \catcode`\^^V=\other
9276 \catcode`\^^W=\other
9277 \catcode`\^^X=\other
9278 \catcode`\^^Z=\other
9279 \catcode`\^^[=\other
9280 \catcode`\^^\=\other
9281 \catcode`\^^]=\other
9282 \catcode`\^^^=\other
9283 \catcode`\^^_=\other
9284 \catcode`\^=\other
9285 %
9286 % Special characters. Should be turned off anyway, but...
9287 \catcode`\~=\other
9288 \catcode`\[=\other
9289 \catcode`\]=\other
9290 \catcode`\"=\other
9291 \catcode`\_=\active
9292 \catcode`\|=\active
9293 \catcode`\<=\active
9294 \catcode`\>=\active
9295 \catcode`\$=\other
9296 \catcode`\#=\other
9297 \catcode`\&=\other
9298 \catcode`\%=\other
9299 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9300 %
9301 \catcode`\\=\active
9302 %
9303 % @ is our escape character in .aux files, and we need braces.
9304 \catcode`\{=1
9305 \catcode`\}=2
9306 \catcode`\@=0
9307 }
9308
9309 \def\readdatafile#1{%
9310 \begingroup
9311 \setupdatafile
9312 \input\jobname.#1
9313 \endgroup}
9314
9315
9316 \message{insertions,}
9317 % including footnotes.
9318
9319 \newcount \footnoteno
9320
9321 % The trailing space in the following definition for supereject is
9322 % vital for proper filling; pages come out unaligned when you do a
9323 % pagealignmacro call if that space before the closing brace is
9324 % removed. (Generally, numeric constants should always be followed by a
9325 % space to prevent strange expansion errors.)
9326 \def\supereject{\par\penalty -20000\footnoteno =0 }
9327
9328 % @footnotestyle is meaningful for Info output only.
9329 \let\footnotestyle=\comment
9330
9331 {\catcode `\@=11
9332 %
9333 % Auto-number footnotes. Otherwise like plain.
9334 \gdef\footnote{%
9335 \global\advance\footnoteno by \@ne
9336 \edef\thisfootno{$^{\the\footnoteno}$}%
9337 %
9338 % In case the footnote comes at the end of a sentence, preserve the
9339 % extra spacing after we do the footnote number.
9340 \let\@sf\empty
9341 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9342 %
9343 % Remove inadvertent blank space before typesetting the footnote number.
9344 \unskip
9345 \thisfootno\@sf
9346 \dofootnote
9347 }%
9348
9349 % Don't bother with the trickery in plain.tex to not require the
9350 % footnote text as a parameter. Our footnotes don't need to be so general.
9351 %
9352 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9353 % \parseargline) fails inside footnotes because the tokens are fixed when
9354 % the footnote is read. --karl, 16nov96.
9355 %
9356 \gdef\dofootnote{%
9357 \insert\footins\bgroup
9358 %
9359 % Nested footnotes are not supported in TeX, that would take a lot
9360 % more work. (\startsavinginserts does not suffice.)
9361 \let\footnote=\errfootnotenest
9362 %
9363 % We want to typeset this text as a normal paragraph, even if the
9364 % footnote reference occurs in (for example) a display environment.
9365 % So reset some parameters.
9366 \hsize=\txipagewidth
9367 \interlinepenalty\interfootnotelinepenalty
9368 \splittopskip\ht\strutbox % top baseline for broken footnotes
9369 \splitmaxdepth\dp\strutbox
9370 \floatingpenalty\@MM
9371 \leftskip\z@skip
9372 \rightskip\z@skip
9373 \spaceskip\z@skip
9374 \xspaceskip\z@skip
9375 \parindent\defaultparindent
9376 %
9377 \smallfonts \rm
9378 %
9379 % Because we use hanging indentation in footnotes, a @noindent appears
9380 % to exdent this text, so make it be a no-op. makeinfo does not use
9381 % hanging indentation so @noindent can still be needed within footnote
9382 % text after an @example or the like (not that this is good style).
9383 \let\noindent = \relax
9384 %
9385 % Hang the footnote text off the number. Use \everypar in case the
9386 % footnote extends for more than one paragraph.
9387 \everypar = {\hang}%
9388 \textindent{\thisfootno}%
9389 %
9390 % Don't crash into the line above the footnote text. Since this
9391 % expands into a box, it must come within the paragraph, lest it
9392 % provide a place where TeX can split the footnote.
9393 \footstrut
9394 %
9395 % Invoke rest of plain TeX footnote routine.
9396 \futurelet\next\fo@t
9397 }
9398 }%end \catcode `\@=11
9399
9400 \def\errfootnotenest{%
9401 \errhelp=\EMsimple
9402 \errmessage{Nested footnotes not supported in texinfo.tex,
9403 even though they work in makeinfo; sorry}
9404 }
9405
9406 \def\errfootnoteheading{%
9407 \errhelp=\EMsimple
9408 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9409 }
9410
9411 % In case a @footnote appears in a vbox, save the footnote text and create
9412 % the real \insert just after the vbox finished. Otherwise, the insertion
9413 % would be lost.
9414 % Similarly, if a @footnote appears inside an alignment, save the footnote
9415 % text to a box and make the \insert when a row of the table is finished.
9416 % And the same can be done for other insert classes. --kasal, 16nov03.
9417 %
9418 % Replace the \insert primitive by a cheating macro.
9419 % Deeper inside, just make sure that the saved insertions are not spilled
9420 % out prematurely.
9421 %
9422 \def\startsavinginserts{%
9423 \ifx \insert\ptexinsert
9424 \let\insert\saveinsert
9425 \else
9426 \let\checkinserts\relax
9427 \fi
9428 }
9429
9430 % This \insert replacement works for both \insert\footins{foo} and
9431 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9432 %
9433 \def\saveinsert#1{%
9434 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9435 \afterassignment\next
9436 % swallow the left brace
9437 \let\temp =
9438 }
9439 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9440 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9441
9442 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9443
9444 \def\placesaveins#1{%
9445 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9446 {\box#1}%
9447 }
9448
9449 % eat @SAVE -- beware, all of them have catcode \other:
9450 {
9451 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9452 \gdef\gobblesave @SAVE{}
9453 }
9454
9455 % initialization:
9456 \def\newsaveins #1{%
9457 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9458 \next
9459 }
9460 \def\newsaveinsX #1{%
9461 \csname newbox\endcsname #1%
9462 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9463 \checksaveins #1}%
9464 }
9465
9466 % initialize:
9467 \let\checkinserts\empty
9468 \newsaveins\footins
9469 \newsaveins\margin
9470
9471
9472 % @image. We use the macros from epsf.tex to support this.
9473 % If epsf.tex is not installed and @image is used, we complain.
9474 %
9475 % Check for and read epsf.tex up front. If we read it only at @image
9476 % time, we might be inside a group, and then its definitions would get
9477 % undone and the next image would fail.
9478 \openin 1 = epsf.tex
9479 \ifeof 1 \else
9480 % Do not bother showing banner with epsf.tex v2.7k (available in
9481 % doc/epsf.tex and on ctan).
9482 \def\epsfannounce{\toks0 = }%
9483 \input epsf.tex
9484 \fi
9485 \closein 1
9486 %
9487 % We will only complain once about lack of epsf.tex.
9488 \newif\ifwarnednoepsf
9489 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9490 work. It is also included in the Texinfo distribution, or you can get
9491 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
9492 %
9493 \def\image#1{%
9494 \ifx\epsfbox\thisisundefined
9495 \ifwarnednoepsf \else
9496 \errhelp = \noepsfhelp
9497 \errmessage{epsf.tex not found, images will be ignored}%
9498 \global\warnednoepsftrue
9499 \fi
9500 \else
9501 \imagexxx #1,,,,,\finish
9502 \fi
9503 }
9504 %
9505 % Arguments to @image:
9506 % #1 is (mandatory) image filename; we tack on .eps extension.
9507 % #2 is (optional) width, #3 is (optional) height.
9508 % #4 is (ignored optional) html alt text.
9509 % #5 is (ignored optional) extension.
9510 % #6 is just the usual extra ignored arg for parsing stuff.
9511 \newif\ifimagevmode
9512 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9513 \catcode`\^^M = 5 % in case we're inside an example
9514 \normalturnoffactive % allow _ et al. in names
9515 \makevalueexpandable
9516 % If the image is by itself, center it.
9517 \ifvmode
9518 \imagevmodetrue
9519 \else \ifx\centersub\centerV
9520 % for @center @image, we need a vbox so we can have our vertical space
9521 \imagevmodetrue
9522 \vbox\bgroup % vbox has better behavior than vtop herev
9523 \fi\fi
9524 %
9525 \ifimagevmode
9526 \nobreak\medskip
9527 % Usually we'll have text after the image which will insert
9528 % \parskip glue, so insert it here too to equalize the space
9529 % above and below.
9530 \nobreak\vskip\parskip
9531 \nobreak
9532 \fi
9533 %
9534 % Leave vertical mode so that indentation from an enclosing
9535 % environment such as @quotation is respected.
9536 % However, if we're at the top level, we don't want the
9537 % normal paragraph indentation.
9538 % On the other hand, if we are in the case of @center @image, we don't
9539 % want to start a paragraph, which will create a hsize-width box and
9540 % eradicate the centering.
9541 \ifx\centersub\centerV\else \noindent \fi
9542 %
9543 % Output the image.
9544 \ifpdf
9545 % For pdfTeX and LuaTeX <= 0.80
9546 \dopdfimage{#1}{#2}{#3}%
9547 \else
9548 \ifx\XeTeXrevision\thisisundefined
9549 % For epsf.tex
9550 % \epsfbox itself resets \epsf?size at each figure.
9551 \setbox0 = \hbox{\ignorespaces #2}%
9552 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9553 \setbox0 = \hbox{\ignorespaces #3}%
9554 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9555 \epsfbox{#1.eps}%
9556 \else
9557 % For XeTeX
9558 \doxeteximage{#1}{#2}{#3}%
9559 \fi
9560 \fi
9561 %
9562 \ifimagevmode
9563 \medskip % space after a standalone image
9564 \fi
9565 \ifx\centersub\centerV \egroup \fi
9566 \endgroup}
9567
9568
9569 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9570 % etc. We don't actually implement floating yet, we always include the
9571 % float "here". But it seemed the best name for the future.
9572 %
9573 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9574
9575 % There may be a space before second and/or third parameter; delete it.
9576 \def\eatcommaspace#1, {#1,}
9577
9578 % #1 is the optional FLOATTYPE, the text label for this float, typically
9579 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9580 % this float will not be numbered and cannot be referred to.
9581 %
9582 % #2 is the optional xref label. Also must be present for the float to
9583 % be referable.
9584 %
9585 % #3 is the optional positioning argument; for now, it is ignored. It
9586 % will somehow specify the positions allowed to float to (here, top, bottom).
9587 %
9588 % We keep a separate counter for each FLOATTYPE, which we reset at each
9589 % chapter-level command.
9590 \let\resetallfloatnos=\empty
9591 %
9592 \def\dofloat#1,#2,#3,#4\finish{%
9593 \let\thiscaption=\empty
9594 \let\thisshortcaption=\empty
9595 %
9596 % don't lose footnotes inside @float.
9597 %
9598 % BEWARE: when the floats start float, we have to issue warning whenever an
9599 % insert appears inside a float which could possibly float. --kasal, 26may04
9600 %
9601 \startsavinginserts
9602 %
9603 % We can't be used inside a paragraph.
9604 \par
9605 %
9606 \vtop\bgroup
9607 \def\floattype{#1}%
9608 \def\floatlabel{#2}%
9609 \def\floatloc{#3}% we do nothing with this yet.
9610 %
9611 \ifx\floattype\empty
9612 \let\safefloattype=\empty
9613 \else
9614 {%
9615 % the floattype might have accents or other special characters,
9616 % but we need to use it in a control sequence name.
9617 \indexnofonts
9618 \turnoffactive
9619 \xdef\safefloattype{\floattype}%
9620 }%
9621 \fi
9622 %
9623 % If label is given but no type, we handle that as the empty type.
9624 \ifx\floatlabel\empty \else
9625 % We want each FLOATTYPE to be numbered separately (Figure 1,
9626 % Table 1, Figure 2, ...). (And if no label, no number.)
9627 %
9628 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9629 \global\advance\floatno by 1
9630 %
9631 {%
9632 % This magic value for \currentsection is output by \setref as the
9633 % XREFLABEL-title value. \xrefX uses it to distinguish float
9634 % labels (which have a completely different output format) from
9635 % node and anchor labels. And \xrdef uses it to construct the
9636 % lists of floats.
9637 %
9638 \edef\currentsection{\floatmagic=\safefloattype}%
9639 \setref{\floatlabel}{Yfloat}%
9640 }%
9641 \fi
9642 %
9643 % start with \parskip glue, I guess.
9644 \vskip\parskip
9645 %
9646 % Don't suppress indentation if a float happens to start a section.
9647 \restorefirstparagraphindent
9648 }
9649
9650 % we have these possibilities:
9651 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9652 % @float Foo,lbl & no caption: Foo 1.1
9653 % @float Foo & @caption{Cap}: Foo: Cap
9654 % @float Foo & no caption: Foo
9655 % @float ,lbl & Caption{Cap}: 1.1: Cap
9656 % @float ,lbl & no caption: 1.1
9657 % @float & @caption{Cap}: Cap
9658 % @float & no caption:
9659 %
9660 \def\Efloat{%
9661 \let\floatident = \empty
9662 %
9663 % In all cases, if we have a float type, it comes first.
9664 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9665 %
9666 % If we have an xref label, the number comes next.
9667 \ifx\floatlabel\empty \else
9668 \ifx\floattype\empty \else % if also had float type, need tie first.
9669 \appendtomacro\floatident{\tie}%
9670 \fi
9671 % the number.
9672 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9673 \fi
9674 %
9675 % Start the printed caption with what we've constructed in
9676 % \floatident, but keep it separate; we need \floatident again.
9677 \let\captionline = \floatident
9678 %
9679 \ifx\thiscaption\empty \else
9680 \ifx\floatident\empty \else
9681 \appendtomacro\captionline{: }% had ident, so need a colon between
9682 \fi
9683 %
9684 % caption text.
9685 \appendtomacro\captionline{\scanexp\thiscaption}%
9686 \fi
9687 %
9688 % If we have anything to print, print it, with space before.
9689 % Eventually this needs to become an \insert.
9690 \ifx\captionline\empty \else
9691 \vskip.5\parskip
9692 \captionline
9693 %
9694 % Space below caption.
9695 \vskip\parskip
9696 \fi
9697 %
9698 % If have an xref label, write the list of floats info. Do this
9699 % after the caption, to avoid chance of it being a breakpoint.
9700 \ifx\floatlabel\empty \else
9701 % Write the text that goes in the lof to the aux file as
9702 % \floatlabel-lof. Besides \floatident, we include the short
9703 % caption if specified, else the full caption if specified, else nothing.
9704 {%
9705 \requireauxfile
9706 \atdummies
9707 %
9708 \ifx\thisshortcaption\empty
9709 \def\gtemp{\thiscaption}%
9710 \else
9711 \def\gtemp{\thisshortcaption}%
9712 \fi
9713 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9714 \ifx\gtemp\empty \else : \gtemp \fi}}%
9715 }%
9716 \fi
9717 \egroup % end of \vtop
9718 %
9719 \checkinserts
9720 }
9721
9722 % Append the tokens #2 to the definition of macro #1, not expanding either.
9723 %
9724 \def\appendtomacro#1#2{%
9725 \expandafter\def\expandafter#1\expandafter{#1#2}%
9726 }
9727
9728 % @caption, @shortcaption
9729 %
9730 \def\caption{\docaption\thiscaption}
9731 \def\shortcaption{\docaption\thisshortcaption}
9732 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9733 \def\defcaption#1#2{\egroup \def#1{#2}}
9734
9735 % The parameter is the control sequence identifying the counter we are
9736 % going to use. Create it if it doesn't exist and assign it to \floatno.
9737 \def\getfloatno#1{%
9738 \ifx#1\relax
9739 % Haven't seen this figure type before.
9740 \csname newcount\endcsname #1%
9741 %
9742 % Remember to reset this floatno at the next chap.
9743 \expandafter\gdef\expandafter\resetallfloatnos
9744 \expandafter{\resetallfloatnos #1=0 }%
9745 \fi
9746 \let\floatno#1%
9747 }
9748
9749 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9750 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9751 % first read the @float command.
9752 %
9753 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9754
9755 % Magic string used for the XREFLABEL-title value, so \xrefX can
9756 % distinguish floats from other xref types.
9757 \def\floatmagic{!!float!!}
9758
9759 % #1 is the control sequence we are passed; we expand into a conditional
9760 % which is true if #1 represents a float ref. That is, the magic
9761 % \currentsection value which we \setref above.
9762 %
9763 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9764 %
9765 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9766 % (safe) float type for this float. We set \iffloattype to #2.
9767 %
9768 \def\doiffloat#1=#2=#3\finish{%
9769 \def\temp{#1}%
9770 \def\iffloattype{#2}%
9771 \ifx\temp\floatmagic
9772 }
9773
9774 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9775 %
9776 \parseargdef\listoffloats{%
9777 \def\floattype{#1}% floattype
9778 {%
9779 % the floattype might have accents or other special characters,
9780 % but we need to use it in a control sequence name.
9781 \indexnofonts
9782 \turnoffactive
9783 \xdef\safefloattype{\floattype}%
9784 }%
9785 %
9786 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9787 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9788 \ifhavexrefs
9789 % if the user said @listoffloats foo but never @float foo.
9790 \message{\linenumber No `\safefloattype' floats to list.}%
9791 \fi
9792 \else
9793 \begingroup
9794 \leftskip=\tocindent % indent these entries like a toc
9795 \let\do=\listoffloatsdo
9796 \csname floatlist\safefloattype\endcsname
9797 \endgroup
9798 \fi
9799 }
9800
9801 % This is called on each entry in a list of floats. We're passed the
9802 % xref label, in the form LABEL-title, which is how we save it in the
9803 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9804 % has the text we're supposed to typeset here.
9805 %
9806 % Figures without xref labels will not be included in the list (since
9807 % they won't appear in the aux file).
9808 %
9809 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9810 \def\listoffloatsdoentry#1-title\finish{{%
9811 % Can't fully expand XR#1-lof because it can contain anything. Just
9812 % pass the control sequence. On the other hand, XR#1-pg is just the
9813 % page number, and we want to fully expand that so we can get a link
9814 % in pdf output.
9815 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9816 %
9817 % use the same \entry macro we use to generate the TOC and index.
9818 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9819 \writeentry
9820 }}
9821
9822
9823 \message{localization,}
9824
9825 % For single-language documents, @documentlanguage is usually given very
9826 % early, just after @documentencoding. Single argument is the language
9827 % (de) or locale (de_DE) abbreviation.
9828 %
9829 {
9830 \catcode`\_ = \active
9831 \globaldefs=1
9832 \parseargdef\documentlanguage{%
9833 \tex % read txi-??.tex file in plain TeX.
9834 % Read the file by the name they passed if it exists.
9835 \let_ = \normalunderscore % normal _ character for filename test
9836 \openin 1 txi-#1.tex
9837 \ifeof 1
9838 \documentlanguagetrywithoutunderscore #1_\finish
9839 \else
9840 \globaldefs = 1 % everything in the txi-LL files needs to persist
9841 \input txi-#1.tex
9842 \fi
9843 \closein 1
9844 \endgroup % end raw TeX
9845 }
9846 %
9847 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9848 % try txi-de.tex.
9849 %
9850 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9851 \openin 1 txi-#1.tex
9852 \ifeof 1
9853 \errhelp = \nolanghelp
9854 \errmessage{Cannot read language file txi-#1.tex}%
9855 \else
9856 \globaldefs = 1 % everything in the txi-LL files needs to persist
9857 \input txi-#1.tex
9858 \fi
9859 \closein 1
9860 }
9861 }% end of special _ catcode
9862 %
9863 \newhelp\nolanghelp{The given language definition file cannot be found or
9864 is empty. Maybe you need to install it? Putting it in the current
9865 directory should work if nowhere else does.}
9866
9867 % This macro is called from txi-??.tex files; the first argument is the
9868 % \language name to set (without the "\lang@" prefix), the second and
9869 % third args are \{left,right}hyphenmin.
9870 %
9871 % The language names to pass are determined when the format is built.
9872 % See the etex.log file created at that time, e.g.,
9873 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9874 %
9875 % With TeX Live 2008, etex now includes hyphenation patterns for all
9876 % available languages. This means we can support hyphenation in
9877 % Texinfo, at least to some extent. (This still doesn't solve the
9878 % accented characters problem.)
9879 %
9880 \catcode`@=11
9881 \def\txisetlanguage#1#2#3{%
9882 % do not set the language if the name is undefined in the current TeX.
9883 \expandafter\ifx\csname lang@#1\endcsname \relax
9884 \message{no patterns for #1}%
9885 \else
9886 \global\language = \csname lang@#1\endcsname
9887 \fi
9888 % but there is no harm in adjusting the hyphenmin values regardless.
9889 \global\lefthyphenmin = #2\relax
9890 \global\righthyphenmin = #3\relax
9891 }
9892
9893 % XeTeX and LuaTeX can handle Unicode natively.
9894 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9895 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9896 %
9897 \newif\iftxinativeunicodecapable
9898 \newif\iftxiusebytewiseio
9899
9900 \ifx\XeTeXrevision\thisisundefined
9901 \ifx\luatexversion\thisisundefined
9902 \txinativeunicodecapablefalse
9903 \txiusebytewiseiotrue
9904 \else
9905 \txinativeunicodecapabletrue
9906 \txiusebytewiseiofalse
9907 \fi
9908 \else
9909 \txinativeunicodecapabletrue
9910 \txiusebytewiseiofalse
9911 \fi
9912
9913 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9914 % for non-UTF-8 (byte-wise) encodings.
9915 %
9916 \def\setbytewiseio{%
9917 \ifx\XeTeXrevision\thisisundefined
9918 \else
9919 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9920 \XeTeXinputencoding "bytes" % For document root file
9921 % Unfortunately, there seems to be no corresponding XeTeX command for
9922 % output encoding. This is a problem for auxiliary index and TOC files.
9923 % The only solution would be perhaps to write out @U{...} sequences in
9924 % place of non-ASCII characters.
9925 \fi
9926
9927 \ifx\luatexversion\thisisundefined
9928 \else
9929 \directlua{
9930 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9931 local function convert_char (char)
9932 return utf8_char(byte(char))
9933 end
9934
9935 local function convert_line (line)
9936 return gsub(line, ".", convert_char)
9937 end
9938
9939 callback.register("process_input_buffer", convert_line)
9940
9941 local function convert_line_out (line)
9942 local line_out = ""
9943 for c in string.utfvalues(line) do
9944 line_out = line_out .. string.char(c)
9945 end
9946 return line_out
9947 end
9948
9949 callback.register("process_output_buffer", convert_line_out)
9950 }
9951 \fi
9952
9953 \txiusebytewiseiotrue
9954 }
9955
9956
9957 % Helpers for encodings.
9958 % Set the catcode of characters 128 through 255 to the specified number.
9959 %
9960 \def\setnonasciicharscatcode#1{%
9961 \count255=128
9962 \loop\ifnum\count255<256
9963 \global\catcode\count255=#1\relax
9964 \advance\count255 by 1
9965 \repeat
9966 }
9967
9968 \def\setnonasciicharscatcodenonglobal#1{%
9969 \count255=128
9970 \loop\ifnum\count255<256
9971 \catcode\count255=#1\relax
9972 \advance\count255 by 1
9973 \repeat
9974 }
9975
9976 % @documentencoding sets the definition of non-ASCII characters
9977 % according to the specified encoding.
9978 %
9979 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9980 \def\documentencodingzzz#1{%
9981 %
9982 % Encoding being declared for the document.
9983 \def\declaredencoding{\csname #1.enc\endcsname}%
9984 %
9985 % Supported encodings: names converted to tokens in order to be able
9986 % to compare them with \ifx.
9987 \def\ascii{\csname US-ASCII.enc\endcsname}%
9988 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9989 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9990 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9991 \def\utfeight{\csname UTF-8.enc\endcsname}%
9992 %
9993 \ifx \declaredencoding \ascii
9994 \asciichardefs
9995 %
9996 \else \ifx \declaredencoding \lattwo
9997 \iftxinativeunicodecapable
9998 \setbytewiseio
9999 \fi
10000 \setnonasciicharscatcode\active
10001 \lattwochardefs
10002 %
10003 \else \ifx \declaredencoding \latone
10004 \iftxinativeunicodecapable
10005 \setbytewiseio
10006 \fi
10007 \setnonasciicharscatcode\active
10008 \latonechardefs
10009 %
10010 \else \ifx \declaredencoding \latnine
10011 \iftxinativeunicodecapable
10012 \setbytewiseio
10013 \fi
10014 \setnonasciicharscatcode\active
10015 \latninechardefs
10016 %
10017 \else \ifx \declaredencoding \utfeight
10018 \iftxinativeunicodecapable
10019 % For native Unicode handling (XeTeX and LuaTeX)
10020 \nativeunicodechardefs
10021 \else
10022 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
10023 \setnonasciicharscatcode\active
10024 % since we already invoked \utfeightchardefs at the top level
10025 % (below), do not re-invoke it, otherwise our check for duplicated
10026 % definitions gets triggered. Making non-ascii chars active is
10027 % sufficient.
10028 \fi
10029 %
10030 \else
10031 \message{Ignoring unknown document encoding: #1.}%
10032 %
10033 \fi % utfeight
10034 \fi % latnine
10035 \fi % latone
10036 \fi % lattwo
10037 \fi % ascii
10038 %
10039 \ifx\XeTeXrevision\thisisundefined
10040 \else
10041 \ifx \declaredencoding \utfeight
10042 \else
10043 \ifx \declaredencoding \ascii
10044 \else
10045 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
10046 non-ASCII characters in auxiliary files.}%
10047 \fi
10048 \fi
10049 \fi
10050 }
10051
10052 % emacs-page
10053 % A message to be logged when using a character that isn't available
10054 % the default font encoding (OT1).
10055 %
10056 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
10057
10058 % Take account of \c (plain) vs. \, (Texinfo) difference.
10059 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
10060
10061 % First, make active non-ASCII characters in order for them to be
10062 % correctly categorized when TeX reads the replacement text of
10063 % macros containing the character definitions.
10064 \setnonasciicharscatcode\active
10065 %
10066
10067 \def\gdefchar#1#2{%
10068 \gdef#1{%
10069 \ifpassthroughchars
10070 \string#1%
10071 \else
10072 #2%
10073 \fi
10074 }}
10075
10076 % Latin1 (ISO-8859-1) character definitions.
10077 \def\latonechardefs{%
10078 \gdefchar^^a0{\tie}
10079 \gdefchar^^a1{\exclamdown}
10080 \gdefchar^^a2{{\tcfont \char162}} % cent
10081 \gdefchar^^a3{\pounds{}}
10082 \gdefchar^^a4{{\tcfont \char164}} % currency
10083 \gdefchar^^a5{{\tcfont \char165}} % yen
10084 \gdefchar^^a6{{\tcfont \char166}} % broken bar
10085 \gdefchar^^a7{\S}
10086 \gdefchar^^a8{\"{}}
10087 \gdefchar^^a9{\copyright{}}
10088 \gdefchar^^aa{\ordf}
10089 \gdefchar^^ab{\guillemetleft{}}
10090 \gdefchar^^ac{\ensuremath\lnot}
10091 \gdefchar^^ad{\-}
10092 \gdefchar^^ae{\registeredsymbol{}}
10093 \gdefchar^^af{\={}}
10094 %
10095 \gdefchar^^b0{\textdegree}
10096 \gdefchar^^b1{$\pm$}
10097 \gdefchar^^b2{$^2$}
10098 \gdefchar^^b3{$^3$}
10099 \gdefchar^^b4{\'{}}
10100 \gdefchar^^b5{$\mu$}
10101 \gdefchar^^b6{\P}
10102 \gdefchar^^b7{\ensuremath\cdot}
10103 \gdefchar^^b8{\cedilla\ }
10104 \gdefchar^^b9{$^1$}
10105 \gdefchar^^ba{\ordm}
10106 \gdefchar^^bb{\guillemetright{}}
10107 \gdefchar^^bc{$1\over4$}
10108 \gdefchar^^bd{$1\over2$}
10109 \gdefchar^^be{$3\over4$}
10110 \gdefchar^^bf{\questiondown}
10111 %
10112 \gdefchar^^c0{\`A}
10113 \gdefchar^^c1{\'A}
10114 \gdefchar^^c2{\^A}
10115 \gdefchar^^c3{\~A}
10116 \gdefchar^^c4{\"A}
10117 \gdefchar^^c5{\ringaccent A}
10118 \gdefchar^^c6{\AE}
10119 \gdefchar^^c7{\cedilla C}
10120 \gdefchar^^c8{\`E}
10121 \gdefchar^^c9{\'E}
10122 \gdefchar^^ca{\^E}
10123 \gdefchar^^cb{\"E}
10124 \gdefchar^^cc{\`I}
10125 \gdefchar^^cd{\'I}
10126 \gdefchar^^ce{\^I}
10127 \gdefchar^^cf{\"I}
10128 %
10129 \gdefchar^^d0{\DH}
10130 \gdefchar^^d1{\~N}
10131 \gdefchar^^d2{\`O}
10132 \gdefchar^^d3{\'O}
10133 \gdefchar^^d4{\^O}
10134 \gdefchar^^d5{\~O}
10135 \gdefchar^^d6{\"O}
10136 \gdefchar^^d7{$\times$}
10137 \gdefchar^^d8{\O}
10138 \gdefchar^^d9{\`U}
10139 \gdefchar^^da{\'U}
10140 \gdefchar^^db{\^U}
10141 \gdefchar^^dc{\"U}
10142 \gdefchar^^dd{\'Y}
10143 \gdefchar^^de{\TH}
10144 \gdefchar^^df{\ss}
10145 %
10146 \gdefchar^^e0{\`a}
10147 \gdefchar^^e1{\'a}
10148 \gdefchar^^e2{\^a}
10149 \gdefchar^^e3{\~a}
10150 \gdefchar^^e4{\"a}
10151 \gdefchar^^e5{\ringaccent a}
10152 \gdefchar^^e6{\ae}
10153 \gdefchar^^e7{\cedilla c}
10154 \gdefchar^^e8{\`e}
10155 \gdefchar^^e9{\'e}
10156 \gdefchar^^ea{\^e}
10157 \gdefchar^^eb{\"e}
10158 \gdefchar^^ec{\`{\dotless i}}
10159 \gdefchar^^ed{\'{\dotless i}}
10160 \gdefchar^^ee{\^{\dotless i}}
10161 \gdefchar^^ef{\"{\dotless i}}
10162 %
10163 \gdefchar^^f0{\dh}
10164 \gdefchar^^f1{\~n}
10165 \gdefchar^^f2{\`o}
10166 \gdefchar^^f3{\'o}
10167 \gdefchar^^f4{\^o}
10168 \gdefchar^^f5{\~o}
10169 \gdefchar^^f6{\"o}
10170 \gdefchar^^f7{$\div$}
10171 \gdefchar^^f8{\o}
10172 \gdefchar^^f9{\`u}
10173 \gdefchar^^fa{\'u}
10174 \gdefchar^^fb{\^u}
10175 \gdefchar^^fc{\"u}
10176 \gdefchar^^fd{\'y}
10177 \gdefchar^^fe{\th}
10178 \gdefchar^^ff{\"y}
10179 }
10180
10181 % Latin9 (ISO-8859-15) encoding character definitions.
10182 \def\latninechardefs{%
10183 % Encoding is almost identical to Latin1.
10184 \latonechardefs
10185 %
10186 \gdefchar^^a4{\euro{}}
10187 \gdefchar^^a6{\v S}
10188 \gdefchar^^a8{\v s}
10189 \gdefchar^^b4{\v Z}
10190 \gdefchar^^b8{\v z}
10191 \gdefchar^^bc{\OE}
10192 \gdefchar^^bd{\oe}
10193 \gdefchar^^be{\"Y}
10194 }
10195
10196 % Latin2 (ISO-8859-2) character definitions.
10197 \def\lattwochardefs{%
10198 \gdefchar^^a0{\tie}
10199 \gdefchar^^a1{\ogonek{A}}
10200 \gdefchar^^a2{\u{}}
10201 \gdefchar^^a3{\L}
10202 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10203 \gdefchar^^a5{\v L}
10204 \gdefchar^^a6{\'S}
10205 \gdefchar^^a7{\S}
10206 \gdefchar^^a8{\"{}}
10207 \gdefchar^^a9{\v S}
10208 \gdefchar^^aa{\cedilla S}
10209 \gdefchar^^ab{\v T}
10210 \gdefchar^^ac{\'Z}
10211 \gdefchar^^ad{\-}
10212 \gdefchar^^ae{\v Z}
10213 \gdefchar^^af{\dotaccent Z}
10214 %
10215 \gdefchar^^b0{\textdegree{}}
10216 \gdefchar^^b1{\ogonek{a}}
10217 \gdefchar^^b2{\ogonek{ }}
10218 \gdefchar^^b3{\l}
10219 \gdefchar^^b4{\'{}}
10220 \gdefchar^^b5{\v l}
10221 \gdefchar^^b6{\'s}
10222 \gdefchar^^b7{\v{}}
10223 \gdefchar^^b8{\cedilla\ }
10224 \gdefchar^^b9{\v s}
10225 \gdefchar^^ba{\cedilla s}
10226 \gdefchar^^bb{\v t}
10227 \gdefchar^^bc{\'z}
10228 \gdefchar^^bd{\H{}}
10229 \gdefchar^^be{\v z}
10230 \gdefchar^^bf{\dotaccent z}
10231 %
10232 \gdefchar^^c0{\'R}
10233 \gdefchar^^c1{\'A}
10234 \gdefchar^^c2{\^A}
10235 \gdefchar^^c3{\u A}
10236 \gdefchar^^c4{\"A}
10237 \gdefchar^^c5{\'L}
10238 \gdefchar^^c6{\'C}
10239 \gdefchar^^c7{\cedilla C}
10240 \gdefchar^^c8{\v C}
10241 \gdefchar^^c9{\'E}
10242 \gdefchar^^ca{\ogonek{E}}
10243 \gdefchar^^cb{\"E}
10244 \gdefchar^^cc{\v E}
10245 \gdefchar^^cd{\'I}
10246 \gdefchar^^ce{\^I}
10247 \gdefchar^^cf{\v D}
10248 %
10249 \gdefchar^^d0{\DH}
10250 \gdefchar^^d1{\'N}
10251 \gdefchar^^d2{\v N}
10252 \gdefchar^^d3{\'O}
10253 \gdefchar^^d4{\^O}
10254 \gdefchar^^d5{\H O}
10255 \gdefchar^^d6{\"O}
10256 \gdefchar^^d7{$\times$}
10257 \gdefchar^^d8{\v R}
10258 \gdefchar^^d9{\ringaccent U}
10259 \gdefchar^^da{\'U}
10260 \gdefchar^^db{\H U}
10261 \gdefchar^^dc{\"U}
10262 \gdefchar^^dd{\'Y}
10263 \gdefchar^^de{\cedilla T}
10264 \gdefchar^^df{\ss}
10265 %
10266 \gdefchar^^e0{\'r}
10267 \gdefchar^^e1{\'a}
10268 \gdefchar^^e2{\^a}
10269 \gdefchar^^e3{\u a}
10270 \gdefchar^^e4{\"a}
10271 \gdefchar^^e5{\'l}
10272 \gdefchar^^e6{\'c}
10273 \gdefchar^^e7{\cedilla c}
10274 \gdefchar^^e8{\v c}
10275 \gdefchar^^e9{\'e}
10276 \gdefchar^^ea{\ogonek{e}}
10277 \gdefchar^^eb{\"e}
10278 \gdefchar^^ec{\v e}
10279 \gdefchar^^ed{\'{\dotless{i}}}
10280 \gdefchar^^ee{\^{\dotless{i}}}
10281 \gdefchar^^ef{\v d}
10282 %
10283 \gdefchar^^f0{\dh}
10284 \gdefchar^^f1{\'n}
10285 \gdefchar^^f2{\v n}
10286 \gdefchar^^f3{\'o}
10287 \gdefchar^^f4{\^o}
10288 \gdefchar^^f5{\H o}
10289 \gdefchar^^f6{\"o}
10290 \gdefchar^^f7{$\div$}
10291 \gdefchar^^f8{\v r}
10292 \gdefchar^^f9{\ringaccent u}
10293 \gdefchar^^fa{\'u}
10294 \gdefchar^^fb{\H u}
10295 \gdefchar^^fc{\"u}
10296 \gdefchar^^fd{\'y}
10297 \gdefchar^^fe{\cedilla t}
10298 \gdefchar^^ff{\dotaccent{}}
10299 }
10300
10301 % UTF-8 character definitions.
10302 %
10303 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10304 % changes for Texinfo conventions. It is included here under the GPL by
10305 % permission from Frank Mittelbach and the LaTeX team.
10306 %
10307 \newcount\countUTFx
10308 \newcount\countUTFy
10309 \newcount\countUTFz
10310
10311 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10312 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10313 %
10314 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10315 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10316 %
10317 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10318 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10319
10320 \gdef\UTFviiiDefined#1{%
10321 \ifx #1\relax
10322 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10323 \else
10324 \expandafter #1%
10325 \fi
10326 }
10327
10328 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10329 \begingroup
10330 \catcode`\~13
10331 \catcode`\$12
10332 \catcode`\"12
10333
10334 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10335 % substituting ~ and $ with a character token of that value.
10336 \def\UTFviiiLoop{%
10337 \global\catcode\countUTFx\active
10338 \uccode`\~\countUTFx
10339 \uccode`\$\countUTFx
10340 \uppercase\expandafter{\UTFviiiTmp}%
10341 \advance\countUTFx by 1
10342 \ifnum\countUTFx < \countUTFy
10343 \expandafter\UTFviiiLoop
10344 \fi}
10345
10346 % For bytes other than the first in a UTF-8 sequence. Not expected to
10347 % be expanded except when writing to auxiliary files.
10348 \countUTFx = "80
10349 \countUTFy = "C2
10350 \def\UTFviiiTmp{%
10351 \gdef~{%
10352 \ifpassthroughchars $\fi}}%
10353 \UTFviiiLoop
10354
10355 \countUTFx = "C2
10356 \countUTFy = "E0
10357 \def\UTFviiiTmp{%
10358 \gdef~{%
10359 \ifpassthroughchars $%
10360 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10361 \UTFviiiLoop
10362
10363 \countUTFx = "E0
10364 \countUTFy = "F0
10365 \def\UTFviiiTmp{%
10366 \gdef~{%
10367 \ifpassthroughchars $%
10368 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10369 \UTFviiiLoop
10370
10371 \countUTFx = "F0
10372 \countUTFy = "F4
10373 \def\UTFviiiTmp{%
10374 \gdef~{%
10375 \ifpassthroughchars $%
10376 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10377 }}%
10378 \UTFviiiLoop
10379 \endgroup
10380
10381 \def\globallet{\global\let} % save some \expandafter's below
10382
10383 % @U{xxxx} to produce U+xxxx, if we support it.
10384 \def\U#1{%
10385 \expandafter\ifx\csname uni:#1\endcsname \relax
10386 \iftxinativeunicodecapable
10387 % All Unicode characters can be used if native Unicode handling is
10388 % active. However, if the font does not have the glyph,
10389 % letters are missing.
10390 \begingroup
10391 \uccode`\.="#1\relax
10392 \uppercase{.}
10393 \endgroup
10394 \else
10395 \errhelp = \EMsimple
10396 \errmessage{Unicode character U+#1 not supported, sorry}%
10397 \fi
10398 \else
10399 \csname uni:#1\endcsname
10400 \fi
10401 }
10402
10403 % These macros are used here to construct the name of a control
10404 % sequence to be defined.
10405 \def\UTFviiiTwoOctetsName#1#2{%
10406 \csname u8:#1\string #2\endcsname}%
10407 \def\UTFviiiThreeOctetsName#1#2#3{%
10408 \csname u8:#1\string #2\string #3\endcsname}%
10409 \def\UTFviiiFourOctetsName#1#2#3#4{%
10410 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10411
10412 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10413 % provide a definition macro to replace a Unicode character;
10414 % this gets used by the @U command
10415 %
10416 \begingroup
10417 \catcode`\"=12
10418 \catcode`\<=12
10419 \catcode`\.=12
10420 \catcode`\,=12
10421 \catcode`\;=12
10422 \catcode`\!=12
10423 \catcode`\~=13
10424 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10425 \countUTFz = "#1\relax
10426 \begingroup
10427 \parseXMLCharref
10428
10429 % Give \u8:... its definition. The sequence of seven \expandafter's
10430 % expands after the \gdef three times, e.g.
10431 %
10432 % 1. \UTFviiTwoOctetsName B1 B2
10433 % 2. \csname u8:B1 \string B2 \endcsname
10434 % 3. \u8: B1 B2 (a single control sequence token)
10435 %
10436 \expandafter\expandafter
10437 \expandafter\expandafter
10438 \expandafter\expandafter
10439 \expandafter\gdef \UTFviiiTmp{#2}%
10440 %
10441 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10442 \message{Internal error, already defined: #1}%
10443 \fi
10444 %
10445 % define an additional control sequence for this code point.
10446 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10447 \endgroup}
10448 %
10449 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10450 % to the corresponding UTF-8 sequence.
10451 \gdef\parseXMLCharref{%
10452 \ifnum\countUTFz < "A0\relax
10453 \errhelp = \EMsimple
10454 \errmessage{Cannot define Unicode char value < 00A0}%
10455 \else\ifnum\countUTFz < "800\relax
10456 \parseUTFviiiA,%
10457 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10458 \else\ifnum\countUTFz < "10000\relax
10459 \parseUTFviiiA;%
10460 \parseUTFviiiA,%
10461 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10462 \else
10463 \parseUTFviiiA;%
10464 \parseUTFviiiA,%
10465 \parseUTFviiiA!%
10466 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10467 \fi\fi\fi
10468 }
10469
10470 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10471 % It must be a non-initial byte in the sequence.
10472 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10473 % of the bytes.
10474 \gdef\parseUTFviiiA#1{%
10475 \countUTFx = \countUTFz
10476 \divide\countUTFz by 64
10477 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10478 \multiply\countUTFz by 64
10479
10480 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10481 % in order to get the last five bits.
10482 \advance\countUTFx by -\countUTFz
10483
10484 % Convert this to the byte in the UTF-8 sequence.
10485 \advance\countUTFx by 128
10486 \uccode `#1\countUTFx
10487 \countUTFz = \countUTFy}
10488
10489 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10490 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10491 % sequence.
10492 % #2 is one of the \UTFviii*OctetsName macros.
10493 % #3 is always a full stop (.)
10494 % #4 is a template for the other bytes in the sequence. The values for these
10495 % bytes is substituted in here with \uppercase using the \uccode's.
10496 \gdef\parseUTFviiiB#1#2#3#4{%
10497 \advance\countUTFz by "#10\relax
10498 \uccode `#3\countUTFz
10499 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10500 \endgroup
10501
10502 % For native Unicode handling (XeTeX and LuaTeX),
10503 % provide a definition macro that sets a catcode to `other' non-globally
10504 %
10505 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10506 \catcode"#1=\other
10507 }
10508
10509 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10510 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10511 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10512 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10513 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10514 %
10515 % Many of our renditions are less than wonderful, and all the missing
10516 % characters are available somewhere. Loading the necessary fonts
10517 % awaits user request. We can't truly support Unicode without
10518 % reimplementing everything that's been done in LaTeX for many years,
10519 % plus probably using luatex or xetex, and who knows what else.
10520 % We won't be doing that here in this simple file. But we can try to at
10521 % least make most of the characters not bomb out.
10522 %
10523 \def\unicodechardefs{%
10524 \DeclareUnicodeCharacter{00A0}{\tie}%
10525 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10526 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10527 \DeclareUnicodeCharacter{00A3}{\pounds{}}%
10528 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10529 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10530 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10531 \DeclareUnicodeCharacter{00A7}{\S}%
10532 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10533 \DeclareUnicodeCharacter{00A9}{\copyright{}}%
10534 \DeclareUnicodeCharacter{00AA}{\ordf}%
10535 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
10536 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10537 \DeclareUnicodeCharacter{00AD}{\-}%
10538 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
10539 \DeclareUnicodeCharacter{00AF}{\={ }}%
10540 %
10541 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
10542 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10543 \DeclareUnicodeCharacter{00B2}{$^2$}%
10544 \DeclareUnicodeCharacter{00B3}{$^3$}%
10545 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10546 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10547 \DeclareUnicodeCharacter{00B6}{\P}%
10548 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10549 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10550 \DeclareUnicodeCharacter{00B9}{$^1$}%
10551 \DeclareUnicodeCharacter{00BA}{\ordm}%
10552 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
10553 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10554 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10555 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10556 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10557 %
10558 \DeclareUnicodeCharacter{00C0}{\`A}%
10559 \DeclareUnicodeCharacter{00C1}{\'A}%
10560 \DeclareUnicodeCharacter{00C2}{\^A}%
10561 \DeclareUnicodeCharacter{00C3}{\~A}%
10562 \DeclareUnicodeCharacter{00C4}{\"A}%
10563 \DeclareUnicodeCharacter{00C5}{\AA}%
10564 \DeclareUnicodeCharacter{00C6}{\AE}%
10565 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10566 \DeclareUnicodeCharacter{00C8}{\`E}%
10567 \DeclareUnicodeCharacter{00C9}{\'E}%
10568 \DeclareUnicodeCharacter{00CA}{\^E}%
10569 \DeclareUnicodeCharacter{00CB}{\"E}%
10570 \DeclareUnicodeCharacter{00CC}{\`I}%
10571 \DeclareUnicodeCharacter{00CD}{\'I}%
10572 \DeclareUnicodeCharacter{00CE}{\^I}%
10573 \DeclareUnicodeCharacter{00CF}{\"I}%
10574 %
10575 \DeclareUnicodeCharacter{00D0}{\DH}%
10576 \DeclareUnicodeCharacter{00D1}{\~N}%
10577 \DeclareUnicodeCharacter{00D2}{\`O}%
10578 \DeclareUnicodeCharacter{00D3}{\'O}%
10579 \DeclareUnicodeCharacter{00D4}{\^O}%
10580 \DeclareUnicodeCharacter{00D5}{\~O}%
10581 \DeclareUnicodeCharacter{00D6}{\"O}%
10582 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10583 \DeclareUnicodeCharacter{00D8}{\O}%
10584 \DeclareUnicodeCharacter{00D9}{\`U}%
10585 \DeclareUnicodeCharacter{00DA}{\'U}%
10586 \DeclareUnicodeCharacter{00DB}{\^U}%
10587 \DeclareUnicodeCharacter{00DC}{\"U}%
10588 \DeclareUnicodeCharacter{00DD}{\'Y}%
10589 \DeclareUnicodeCharacter{00DE}{\TH}%
10590 \DeclareUnicodeCharacter{00DF}{\ss}%
10591 %
10592 \DeclareUnicodeCharacter{00E0}{\`a}%
10593 \DeclareUnicodeCharacter{00E1}{\'a}%
10594 \DeclareUnicodeCharacter{00E2}{\^a}%
10595 \DeclareUnicodeCharacter{00E3}{\~a}%
10596 \DeclareUnicodeCharacter{00E4}{\"a}%
10597 \DeclareUnicodeCharacter{00E5}{\aa}%
10598 \DeclareUnicodeCharacter{00E6}{\ae}%
10599 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10600 \DeclareUnicodeCharacter{00E8}{\`e}%
10601 \DeclareUnicodeCharacter{00E9}{\'e}%
10602 \DeclareUnicodeCharacter{00EA}{\^e}%
10603 \DeclareUnicodeCharacter{00EB}{\"e}%
10604 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10605 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10606 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10607 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10608 %
10609 \DeclareUnicodeCharacter{00F0}{\dh}%
10610 \DeclareUnicodeCharacter{00F1}{\~n}%
10611 \DeclareUnicodeCharacter{00F2}{\`o}%
10612 \DeclareUnicodeCharacter{00F3}{\'o}%
10613 \DeclareUnicodeCharacter{00F4}{\^o}%
10614 \DeclareUnicodeCharacter{00F5}{\~o}%
10615 \DeclareUnicodeCharacter{00F6}{\"o}%
10616 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10617 \DeclareUnicodeCharacter{00F8}{\o}%
10618 \DeclareUnicodeCharacter{00F9}{\`u}%
10619 \DeclareUnicodeCharacter{00FA}{\'u}%
10620 \DeclareUnicodeCharacter{00FB}{\^u}%
10621 \DeclareUnicodeCharacter{00FC}{\"u}%
10622 \DeclareUnicodeCharacter{00FD}{\'y}%
10623 \DeclareUnicodeCharacter{00FE}{\th}%
10624 \DeclareUnicodeCharacter{00FF}{\"y}%
10625 %
10626 \DeclareUnicodeCharacter{0100}{\=A}%
10627 \DeclareUnicodeCharacter{0101}{\=a}%
10628 \DeclareUnicodeCharacter{0102}{\u{A}}%
10629 \DeclareUnicodeCharacter{0103}{\u{a}}%
10630 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10631 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10632 \DeclareUnicodeCharacter{0106}{\'C}%
10633 \DeclareUnicodeCharacter{0107}{\'c}%
10634 \DeclareUnicodeCharacter{0108}{\^C}%
10635 \DeclareUnicodeCharacter{0109}{\^c}%
10636 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10637 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10638 \DeclareUnicodeCharacter{010C}{\v{C}}%
10639 \DeclareUnicodeCharacter{010D}{\v{c}}%
10640 \DeclareUnicodeCharacter{010E}{\v{D}}%
10641 \DeclareUnicodeCharacter{010F}{d'}%
10642 %
10643 \DeclareUnicodeCharacter{0110}{\DH}%
10644 \DeclareUnicodeCharacter{0111}{\dh}%
10645 \DeclareUnicodeCharacter{0112}{\=E}%
10646 \DeclareUnicodeCharacter{0113}{\=e}%
10647 \DeclareUnicodeCharacter{0114}{\u{E}}%
10648 \DeclareUnicodeCharacter{0115}{\u{e}}%
10649 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10650 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10651 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10652 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10653 \DeclareUnicodeCharacter{011A}{\v{E}}%
10654 \DeclareUnicodeCharacter{011B}{\v{e}}%
10655 \DeclareUnicodeCharacter{011C}{\^G}%
10656 \DeclareUnicodeCharacter{011D}{\^g}%
10657 \DeclareUnicodeCharacter{011E}{\u{G}}%
10658 \DeclareUnicodeCharacter{011F}{\u{g}}%
10659 %
10660 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10661 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10662 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10663 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10664 \DeclareUnicodeCharacter{0124}{\^H}%
10665 \DeclareUnicodeCharacter{0125}{\^h}%
10666 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10667 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10668 \DeclareUnicodeCharacter{0128}{\~I}%
10669 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10670 \DeclareUnicodeCharacter{012A}{\=I}%
10671 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10672 \DeclareUnicodeCharacter{012C}{\u{I}}%
10673 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10674 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10675 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10676 %
10677 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10678 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10679 \DeclareUnicodeCharacter{0132}{IJ}%
10680 \DeclareUnicodeCharacter{0133}{ij}%
10681 \DeclareUnicodeCharacter{0134}{\^J}%
10682 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10683 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10684 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10685 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10686 \DeclareUnicodeCharacter{0139}{\'L}%
10687 \DeclareUnicodeCharacter{013A}{\'l}%
10688 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10689 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10690 \DeclareUnicodeCharacter{013D}{L'}% should kern
10691 \DeclareUnicodeCharacter{013E}{l'}% should kern
10692 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10693 %
10694 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10695 \DeclareUnicodeCharacter{0141}{\L}%
10696 \DeclareUnicodeCharacter{0142}{\l}%
10697 \DeclareUnicodeCharacter{0143}{\'N}%
10698 \DeclareUnicodeCharacter{0144}{\'n}%
10699 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10700 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10701 \DeclareUnicodeCharacter{0147}{\v{N}}%
10702 \DeclareUnicodeCharacter{0148}{\v{n}}%
10703 \DeclareUnicodeCharacter{0149}{'n}%
10704 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10705 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10706 \DeclareUnicodeCharacter{014C}{\=O}%
10707 \DeclareUnicodeCharacter{014D}{\=o}%
10708 \DeclareUnicodeCharacter{014E}{\u{O}}%
10709 \DeclareUnicodeCharacter{014F}{\u{o}}%
10710 %
10711 \DeclareUnicodeCharacter{0150}{\H{O}}%
10712 \DeclareUnicodeCharacter{0151}{\H{o}}%
10713 \DeclareUnicodeCharacter{0152}{\OE}%
10714 \DeclareUnicodeCharacter{0153}{\oe}%
10715 \DeclareUnicodeCharacter{0154}{\'R}%
10716 \DeclareUnicodeCharacter{0155}{\'r}%
10717 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10718 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10719 \DeclareUnicodeCharacter{0158}{\v{R}}%
10720 \DeclareUnicodeCharacter{0159}{\v{r}}%
10721 \DeclareUnicodeCharacter{015A}{\'S}%
10722 \DeclareUnicodeCharacter{015B}{\'s}%
10723 \DeclareUnicodeCharacter{015C}{\^S}%
10724 \DeclareUnicodeCharacter{015D}{\^s}%
10725 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10726 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10727 %
10728 \DeclareUnicodeCharacter{0160}{\v{S}}%
10729 \DeclareUnicodeCharacter{0161}{\v{s}}%
10730 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10731 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10732 \DeclareUnicodeCharacter{0164}{\v{T}}%
10733 \DeclareUnicodeCharacter{0165}{\v{t}}%
10734 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10735 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10736 \DeclareUnicodeCharacter{0168}{\~U}%
10737 \DeclareUnicodeCharacter{0169}{\~u}%
10738 \DeclareUnicodeCharacter{016A}{\=U}%
10739 \DeclareUnicodeCharacter{016B}{\=u}%
10740 \DeclareUnicodeCharacter{016C}{\u{U}}%
10741 \DeclareUnicodeCharacter{016D}{\u{u}}%
10742 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10743 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10744 %
10745 \DeclareUnicodeCharacter{0170}{\H{U}}%
10746 \DeclareUnicodeCharacter{0171}{\H{u}}%
10747 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10748 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10749 \DeclareUnicodeCharacter{0174}{\^W}%
10750 \DeclareUnicodeCharacter{0175}{\^w}%
10751 \DeclareUnicodeCharacter{0176}{\^Y}%
10752 \DeclareUnicodeCharacter{0177}{\^y}%
10753 \DeclareUnicodeCharacter{0178}{\"Y}%
10754 \DeclareUnicodeCharacter{0179}{\'Z}%
10755 \DeclareUnicodeCharacter{017A}{\'z}%
10756 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10757 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10758 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10759 \DeclareUnicodeCharacter{017E}{\v{z}}%
10760 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10761 %
10762 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10763 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10764 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10765 \DeclareUnicodeCharacter{01C7}{LJ}%
10766 \DeclareUnicodeCharacter{01C8}{Lj}%
10767 \DeclareUnicodeCharacter{01C9}{lj}%
10768 \DeclareUnicodeCharacter{01CA}{NJ}%
10769 \DeclareUnicodeCharacter{01CB}{Nj}%
10770 \DeclareUnicodeCharacter{01CC}{nj}%
10771 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10772 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10773 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10774 %
10775 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10776 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10777 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10778 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10779 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10780 %
10781 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10782 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10783 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10784 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10785 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10786 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10787 %
10788 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10789 \DeclareUnicodeCharacter{01F1}{DZ}%
10790 \DeclareUnicodeCharacter{01F2}{Dz}%
10791 \DeclareUnicodeCharacter{01F3}{dz}%
10792 \DeclareUnicodeCharacter{01F4}{\'G}%
10793 \DeclareUnicodeCharacter{01F5}{\'g}%
10794 \DeclareUnicodeCharacter{01F8}{\`N}%
10795 \DeclareUnicodeCharacter{01F9}{\`n}%
10796 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10797 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10798 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10799 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10800 %
10801 \DeclareUnicodeCharacter{021E}{\v{H}}%
10802 \DeclareUnicodeCharacter{021F}{\v{h}}%
10803 %
10804 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10805 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10806 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10807 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10808 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10809 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10810 %
10811 \DeclareUnicodeCharacter{0232}{\=Y}%
10812 \DeclareUnicodeCharacter{0233}{\=y}%
10813 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10814 %
10815 \DeclareUnicodeCharacter{02BC}{'}%
10816 %
10817 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10818 %
10819 % Greek letters upper case
10820 \DeclareUnicodeCharacter{0391}{{\it A}}%
10821 \DeclareUnicodeCharacter{0392}{{\it B}}%
10822 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10823 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10824 \DeclareUnicodeCharacter{0395}{{\it E}}%
10825 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10826 \DeclareUnicodeCharacter{0397}{{\it H}}%
10827 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10828 \DeclareUnicodeCharacter{0399}{{\it I}}%
10829 \DeclareUnicodeCharacter{039A}{{\it K}}%
10830 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10831 \DeclareUnicodeCharacter{039C}{{\it M}}%
10832 \DeclareUnicodeCharacter{039D}{{\it N}}%
10833 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10834 \DeclareUnicodeCharacter{039F}{{\it O}}%
10835 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10836 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10837 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10838 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10839 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10840 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10841 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10842 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10843 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10844 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10845 %
10846 % Vowels with accents
10847 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10848 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10849 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10850 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10851 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10852 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10853 %
10854 % Standalone accent
10855 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10856 %
10857 % Greek letters lower case
10858 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10859 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10860 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10861 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10862 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10863 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10864 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10865 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10866 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10867 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10868 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10869 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10870 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10871 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10872 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10873 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10874 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10875 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10876 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10877 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10878 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10879 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10880 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10881 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10882 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10883 %
10884 % More Greek vowels with accents
10885 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10886 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10887 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10888 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10889 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10890 %
10891 % Variant Greek letters
10892 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10893 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10894 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10895 %
10896 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10897 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10898 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10899 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10900 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10901 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10902 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10903 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10904 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10905 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10906 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10907 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10908 %
10909 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10910 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10911 %
10912 \DeclareUnicodeCharacter{1E20}{\=G}%
10913 \DeclareUnicodeCharacter{1E21}{\=g}%
10914 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10915 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10916 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10917 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10918 \DeclareUnicodeCharacter{1E26}{\"H}%
10919 \DeclareUnicodeCharacter{1E27}{\"h}%
10920 %
10921 \DeclareUnicodeCharacter{1E30}{\'K}%
10922 \DeclareUnicodeCharacter{1E31}{\'k}%
10923 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10924 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10925 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10926 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10927 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10928 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10929 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10930 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10931 \DeclareUnicodeCharacter{1E3E}{\'M}%
10932 \DeclareUnicodeCharacter{1E3F}{\'m}%
10933 %
10934 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10935 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10936 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10937 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10938 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10939 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10940 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10941 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10942 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10943 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10944 %
10945 \DeclareUnicodeCharacter{1E54}{\'P}%
10946 \DeclareUnicodeCharacter{1E55}{\'p}%
10947 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10948 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10949 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10950 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10951 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10952 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10953 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10954 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10955 %
10956 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10957 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10958 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10959 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10960 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10961 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10962 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10963 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10964 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10965 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10966 %
10967 \DeclareUnicodeCharacter{1E7C}{\~V}%
10968 \DeclareUnicodeCharacter{1E7D}{\~v}%
10969 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10970 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10971 %
10972 \DeclareUnicodeCharacter{1E80}{\`W}%
10973 \DeclareUnicodeCharacter{1E81}{\`w}%
10974 \DeclareUnicodeCharacter{1E82}{\'W}%
10975 \DeclareUnicodeCharacter{1E83}{\'w}%
10976 \DeclareUnicodeCharacter{1E84}{\"W}%
10977 \DeclareUnicodeCharacter{1E85}{\"w}%
10978 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10979 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10980 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10981 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10982 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10983 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10984 \DeclareUnicodeCharacter{1E8C}{\"X}%
10985 \DeclareUnicodeCharacter{1E8D}{\"x}%
10986 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10987 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10988 %
10989 \DeclareUnicodeCharacter{1E90}{\^Z}%
10990 \DeclareUnicodeCharacter{1E91}{\^z}%
10991 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10992 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10993 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10994 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
10995 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
10996 \DeclareUnicodeCharacter{1E97}{\"t}%
10997 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
10998 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
10999 %
11000 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
11001 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
11002 %
11003 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
11004 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
11005 \DeclareUnicodeCharacter{1EBC}{\~E}%
11006 \DeclareUnicodeCharacter{1EBD}{\~e}%
11007 %
11008 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
11009 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
11010 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
11011 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
11012 %
11013 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
11014 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
11015 %
11016 \DeclareUnicodeCharacter{1EF2}{\`Y}%
11017 \DeclareUnicodeCharacter{1EF3}{\`y}%
11018 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
11019 %
11020 \DeclareUnicodeCharacter{1EF8}{\~Y}%
11021 \DeclareUnicodeCharacter{1EF9}{\~y}%
11022 %
11023 % Punctuation
11024 \DeclareUnicodeCharacter{2013}{--}%
11025 \DeclareUnicodeCharacter{2014}{---}%
11026 \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
11027 \DeclareUnicodeCharacter{2019}{\quoteright{}}%
11028 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
11029 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
11030 \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
11031 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
11032 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
11033 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
11034 \DeclareUnicodeCharacter{2022}{\bullet{}}%
11035 \DeclareUnicodeCharacter{202F}{\thinspace}%
11036 \DeclareUnicodeCharacter{2026}{\dots{}}%
11037 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
11038 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
11039 %
11040 \DeclareUnicodeCharacter{20AC}{\euro{}}%
11041 %
11042 \DeclareUnicodeCharacter{2192}{\expansion{}}%
11043 \DeclareUnicodeCharacter{21D2}{\result{}}%
11044 %
11045 % Mathematical symbols
11046 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
11047 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
11048 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
11049 \DeclareUnicodeCharacter{2212}{\minus{}}%
11050 \DeclareUnicodeCharacter{2217}{\ast}%
11051 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
11052 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
11053 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
11054 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
11055 \DeclareUnicodeCharacter{2261}{\equiv{}}%
11056 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
11057 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
11058 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
11059 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
11060 %
11061 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
11062 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
11063 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
11064 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
11065 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
11066 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
11067 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
11068 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11069 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11070 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11071 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11072 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11073 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11074 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11075 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11076 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11077 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11078 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11079 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11080 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11081 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11082 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11083 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11084 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11085 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11086 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11087 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11088 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11089 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11090 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11091 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11092 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11093 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11094 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11095 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11096 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11097 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11098 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11099 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11100 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11101 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11102 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11103 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11104 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11105 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11106 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11107 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11108 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11109 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11110 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11111 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11112 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11113 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11114 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11115 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11116 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11117 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11118 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11119 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11120 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11121 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11122 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11123 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11124 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11125 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11126 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11127 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11128 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11129 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11130 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11131 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11132 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11133 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11134 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11135 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11136 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11137 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11138 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11139 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11140 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11141 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11142 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11143 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11144 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11145 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11146 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11147 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11148 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11149 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11150 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11151 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11152 %
11153 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11154 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11155 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11156 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11157 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
11158 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11159 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11160 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11161 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11162 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11163 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11164 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11165 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11166 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11167 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11168 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11169 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11170 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11171 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11172 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11173 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11174 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11175 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11176 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11177 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11178 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11179 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11180 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11181 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11182 %
11183 \global\mathchardef\checkmark="1370% actually the square root sign
11184 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11185 }% end of \unicodechardefs
11186
11187 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11188 % It makes the setting that replace UTF-8 byte sequence.
11189 \def\utfeightchardefs{%
11190 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11191 \unicodechardefs
11192 }
11193
11194 % Whether the active definitions of non-ASCII characters expand to
11195 % non-active tokens with the same character code. This is used to
11196 % write characters literally, instead of using active definitions for
11197 % printing the correct glyphs.
11198 \newif\ifpassthroughchars
11199 \passthroughcharsfalse
11200
11201 % For native Unicode handling (XeTeX and LuaTeX),
11202 % provide a definition macro to replace/pass-through a Unicode character
11203 %
11204 \def\DeclareUnicodeCharacterNative#1#2{%
11205 \catcode"#1=\active
11206 \def\dodeclareunicodecharacternative##1##2##3{%
11207 \begingroup
11208 \uccode`\~="##2\relax
11209 \uppercase{\gdef~}{%
11210 \ifpassthroughchars
11211 ##1%
11212 \else
11213 ##3%
11214 \fi
11215 }
11216 \endgroup
11217 }
11218 \begingroup
11219 \uccode`\.="#1\relax
11220 \uppercase{\def\UTFNativeTmp{.}}%
11221 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11222 \endgroup
11223 }
11224
11225 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11226 % It activates the setting that replaces Unicode characters.
11227 \def\nativeunicodechardefs{%
11228 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11229 \unicodechardefs
11230 }
11231
11232 % For native Unicode handling (XeTeX and LuaTeX),
11233 % make the character token expand
11234 % to the sequences given in \unicodechardefs for printing.
11235 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11236 \def\UTFAtUTmp{#2}
11237 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11238 }
11239
11240 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11241 \def\nativeunicodechardefsatu{%
11242 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11243 \unicodechardefs
11244 }
11245
11246 % US-ASCII character definitions.
11247 \def\asciichardefs{% nothing need be done
11248 \relax
11249 }
11250
11251 % Define all Unicode characters we know about. This makes UTF-8 the default
11252 % input encoding and allows @U to work.
11253 \iftxinativeunicodecapable
11254 \nativeunicodechardefsatu
11255 \else
11256 \utfeightchardefs
11257 \fi
11258
11259 \message{formatting,}
11260
11261 \newdimen\defaultparindent \defaultparindent = 15pt
11262
11263 \chapheadingskip = 15pt plus 4pt minus 2pt
11264 \secheadingskip = 12pt plus 3pt minus 2pt
11265 \subsecheadingskip = 9pt plus 2pt minus 2pt
11266
11267 % Prevent underfull vbox error messages.
11268 \vbadness = 10000
11269
11270 % Don't be very finicky about underfull hboxes, either.
11271 \hbadness = 6666
11272
11273 % Following George Bush, get rid of widows and orphans.
11274 \widowpenalty=10000
11275 \clubpenalty=10000
11276
11277 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11278 % using an old version of TeX, don't do anything. We want the amount of
11279 % stretch added to depend on the line length, hence the dependence on
11280 % \hsize. We call this whenever the paper size is set.
11281 %
11282 \def\setemergencystretch{%
11283 \ifx\emergencystretch\thisisundefined
11284 % Allow us to assign to \emergencystretch anyway.
11285 \def\emergencystretch{\dimen0}%
11286 \else
11287 \emergencystretch = .15\hsize
11288 \fi
11289 }
11290
11291 % Parameters in order: 1) textheight; 2) textwidth;
11292 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11293 % 7) physical page height; 8) physical page width.
11294 %
11295 % We also call \setleading{\textleading}, so the caller should define
11296 % \textleading. The caller should also set \parskip.
11297 %
11298 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11299 \voffset = #3\relax
11300 \topskip = #6\relax
11301 \splittopskip = \topskip
11302 %
11303 \vsize = #1\relax
11304 \advance\vsize by \topskip
11305 \outervsize = \vsize
11306 \advance\outervsize by 2\topandbottommargin
11307 \txipageheight = \vsize
11308 %
11309 \hsize = #2\relax
11310 \outerhsize = \hsize
11311 \advance\outerhsize by 0.5in
11312 \txipagewidth = \hsize
11313 %
11314 \normaloffset = #4\relax
11315 \bindingoffset = #5\relax
11316 %
11317 \ifpdf
11318 \pdfpageheight #7\relax
11319 \pdfpagewidth #8\relax
11320 % if we don't reset these, they will remain at "1 true in" of
11321 % whatever layout pdftex was dumped with.
11322 \pdfhorigin = 1 true in
11323 \pdfvorigin = 1 true in
11324 \else
11325 \ifx\XeTeXrevision\thisisundefined
11326 \special{papersize=#8,#7}%
11327 \else
11328 \pdfpageheight #7\relax
11329 \pdfpagewidth #8\relax
11330 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11331 \fi
11332 \fi
11333 %
11334 \setleading{\textleading}
11335 %
11336 \parindent = \defaultparindent
11337 \setemergencystretch
11338 }
11339
11340 % @letterpaper (the default).
11341 \def\letterpaper{{\globaldefs = 1
11342 \parskip = 3pt plus 2pt minus 1pt
11343 \textleading = 13.2pt
11344 %
11345 % If page is nothing but text, make it come out even.
11346 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11347 {\voffset}{.25in}%
11348 {\bindingoffset}{36pt}%
11349 {11in}{8.5in}%
11350 }}
11351
11352 % Use @smallbook to reset parameters for 7x9.25 trim size.
11353 \def\smallbook{{\globaldefs = 1
11354 \parskip = 2pt plus 1pt
11355 \textleading = 12pt
11356 %
11357 \internalpagesizes{7.5in}{5in}%
11358 {-.2in}{0in}%
11359 {\bindingoffset}{16pt}%
11360 {9.25in}{7in}%
11361 %
11362 \lispnarrowing = 0.3in
11363 \tolerance = 700
11364 \contentsrightmargin = 0pt
11365 \defbodyindent = .5cm
11366 }}
11367
11368 % Use @smallerbook to reset parameters for 6x9 trim size.
11369 % (Just testing, parameters still in flux.)
11370 \def\smallerbook{{\globaldefs = 1
11371 \parskip = 1.5pt plus 1pt
11372 \textleading = 12pt
11373 %
11374 \internalpagesizes{7.4in}{4.8in}%
11375 {-.2in}{-.4in}%
11376 {0pt}{14pt}%
11377 {9in}{6in}%
11378 %
11379 \lispnarrowing = 0.25in
11380 \tolerance = 700
11381 \contentsrightmargin = 0pt
11382 \defbodyindent = .4cm
11383 }}
11384
11385 % Use @afourpaper to print on European A4 paper.
11386 \def\afourpaper{{\globaldefs = 1
11387 \parskip = 3pt plus 2pt minus 1pt
11388 \textleading = 13.2pt
11389 %
11390 % Double-side printing via postscript on Laserjet 4050
11391 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11392 % To change the settings for a different printer or situation, adjust
11393 % \normaloffset until the front-side and back-side texts align. Then
11394 % do the same for \bindingoffset. You can set these for testing in
11395 % your texinfo source file like this:
11396 % @tex
11397 % \global\normaloffset = -6mm
11398 % \global\bindingoffset = 10mm
11399 % @end tex
11400 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11401 {\voffset}{\hoffset}%
11402 {\bindingoffset}{44pt}%
11403 {297mm}{210mm}%
11404 %
11405 \tolerance = 700
11406 \contentsrightmargin = 0pt
11407 \defbodyindent = 5mm
11408 }}
11409
11410 % Use @afivepaper to print on European A5 paper.
11411 % From romildo (a] urano.iceb.ufop.br, 2 July 2000.
11412 % He also recommends making @example and @lisp be small.
11413 \def\afivepaper{{\globaldefs = 1
11414 \parskip = 2pt plus 1pt minus 0.1pt
11415 \textleading = 12.5pt
11416 %
11417 \internalpagesizes{160mm}{120mm}%
11418 {\voffset}{\hoffset}%
11419 {\bindingoffset}{8pt}%
11420 {210mm}{148mm}%
11421 %
11422 \lispnarrowing = 0.2in
11423 \tolerance = 800
11424 \contentsrightmargin = 0pt
11425 \defbodyindent = 2mm
11426 \tableindent = 12mm
11427 }}
11428
11429 % A specific text layout, 24x15cm overall, intended for A4 paper.
11430 \def\afourlatex{{\globaldefs = 1
11431 \afourpaper
11432 \internalpagesizes{237mm}{150mm}%
11433 {\voffset}{4.6mm}%
11434 {\bindingoffset}{7mm}%
11435 {297mm}{210mm}%
11436 %
11437 % Must explicitly reset to 0 because we call \afourpaper.
11438 \globaldefs = 0
11439 }}
11440
11441 % Use @afourwide to print on A4 paper in landscape format.
11442 \def\afourwide{{\globaldefs = 1
11443 \afourpaper
11444 \internalpagesizes{241mm}{165mm}%
11445 {\voffset}{-2.95mm}%
11446 {\bindingoffset}{7mm}%
11447 {297mm}{210mm}%
11448 \globaldefs = 0
11449 }}
11450
11451 \def\bsixpaper{{\globaldefs = 1
11452 \afourpaper
11453 \internalpagesizes{140mm}{100mm}%
11454 {-6.35mm}{-12.7mm}%
11455 {\bindingoffset}{14pt}%
11456 {176mm}{125mm}%
11457 \let\SETdispenvsize=\smallword
11458 \lispnarrowing = 0.2in
11459 \globaldefs = 0
11460 }}
11461
11462
11463 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11464 % Perhaps we should allow setting the margins, \topskip, \parskip,
11465 % and/or leading, also. Or perhaps we should compute them somehow.
11466 %
11467 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11468 \def\pagesizesyyy#1,#2,#3\finish{{%
11469 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11470 \globaldefs = 1
11471 %
11472 \parskip = 3pt plus 2pt minus 1pt
11473 \setleading{\textleading}%
11474 %
11475 \dimen0 = #1\relax
11476 \advance\dimen0 by 2.5in % default 1in margin above heading line
11477 % and 1.5in to include heading, footing and
11478 % bottom margin
11479 %
11480 \dimen2 = \hsize
11481 \advance\dimen2 by 2in % default to 1 inch margin on each side
11482 %
11483 \internalpagesizes{#1}{\hsize}%
11484 {\voffset}{\normaloffset}%
11485 {\bindingoffset}{44pt}%
11486 {\dimen0}{\dimen2}%
11487 }}
11488
11489 % Set default to letter.
11490 %
11491 \letterpaper
11492
11493 % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
11494 \hfuzz = 1pt
11495
11496
11497 \message{and turning on texinfo input format.}
11498
11499 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11500
11501 % DEL is a comment character, in case @c does not suffice.
11502 \catcode`\^^? = 14
11503
11504 % Define macros to output various characters with catcode for normal text.
11505 \catcode`\"=\other \def\normaldoublequote{"}
11506 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11507 \catcode`\+=\other \def\normalplus{+}
11508 \catcode`\<=\other \def\normalless{<}
11509 \catcode`\>=\other \def\normalgreater{>}
11510 \catcode`\^=\other \def\normalcaret{^}
11511 \catcode`\_=\other \def\normalunderscore{_}
11512 \catcode`\|=\other \def\normalverticalbar{|}
11513 \catcode`\~=\other \def\normaltilde{~}
11514
11515 % This macro is used to make a character print one way in \tt
11516 % (where it can probably be output as-is), and another way in other fonts,
11517 % where something hairier probably needs to be done.
11518 %
11519 % #1 is what to print if we are indeed using \tt; #2 is what to print
11520 % otherwise. Since all the Computer Modern typewriter fonts have zero
11521 % interword stretch (and shrink), and it is reasonable to expect all
11522 % typewriter fonts to have this, we can check that font parameter.
11523 %
11524 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
11525
11526 % Same as above, but check for italic font. Actually this also catches
11527 % non-italic slanted fonts since it is impossible to distinguish them from
11528 % italic fonts. But since this is only used by $ and it uses \sl anyway
11529 % this is not a problem.
11530 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
11531
11532 % Set catcodes for Texinfo file
11533
11534 % Active characters for printing the wanted glyph.
11535 % Most of these we simply print from the \tt font, but for some, we can
11536 % use math or other variants that look better in normal text.
11537 %
11538 \catcode`\"=\active
11539 \def\activedoublequote{{\tt\char34}}
11540 \let"=\activedoublequote
11541 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11542 \chardef\hatchar=`\^
11543 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11544
11545 \catcode`\_=\active
11546 \def_{\ifusingtt\normalunderscore\_}
11547 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11548 \let\realunder=_
11549
11550 \catcode`\|=\active \def|{{\tt\char124}}
11551
11552 \chardef \less=`\<
11553 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11554 \chardef \gtr=`\>
11555 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11556 \catcode`\+=\active \def+{{\tt \char 43}}
11557 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11558 \catcode`\-=\active \let-=\normaldash
11559
11560
11561 % used for headline/footline in the output routine, in case the page
11562 % breaks in the middle of an @tex block.
11563 \def\texinfochars{%
11564 \let< = \activeless
11565 \let> = \activegtr
11566 \let~ = \activetilde
11567 \let^ = \activehat
11568 \setregularquotes
11569 \let\b = \strong
11570 \let\i = \smartitalic
11571 % in principle, all other definitions in \tex have to be undone too.
11572 }
11573
11574 % Used sometimes to turn off (effectively) the active characters even after
11575 % parsing them.
11576 \def\turnoffactive{%
11577 \normalturnoffactive
11578 \otherbackslash
11579 }
11580
11581 \catcode`\@=0
11582
11583 % \backslashcurfont outputs one backslash character in current font,
11584 % as in \char`\\.
11585 \global\chardef\backslashcurfont=`\\
11586
11587 % \realbackslash is an actual character `\' with catcode other.
11588 {\catcode`\\=\other @gdef@realbackslash{\}}
11589
11590 % In Texinfo, backslash is an active character; it prints the backslash
11591 % in fixed width font.
11592 \catcode`\\=\active % @ for escape char from now on.
11593
11594 % Print a typewriter backslash. For math mode, we can't simply use
11595 % \backslashcurfont: the story here is that in math mode, the \char
11596 % of \backslashcurfont ends up printing the roman \ from the math symbol
11597 % font (because \char in math mode uses the \mathcode, and plain.tex
11598 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11599 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11600 % ignored family value; char position "5C). We can't use " for the
11601 % usual hex value because it has already been made active.
11602
11603 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11604 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11605
11606 % \otherbackslash defines an active \ to be a literal `\' character with
11607 % catcode other.
11608 @gdef@otherbackslash{@let\=@realbackslash}
11609
11610 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11611 % the literal character `\'.
11612 %
11613 {@catcode`- = @active
11614 @gdef@normalturnoffactive{%
11615 @passthroughcharstrue
11616 @let-=@normaldash
11617 @let"=@normaldoublequote
11618 @let$=@normaldollar %$ font-lock fix
11619 @let+=@normalplus
11620 @let<=@normalless
11621 @let>=@normalgreater
11622 @let^=@normalcaret
11623 @let_=@normalunderscore
11624 @let|=@normalverticalbar
11625 @let~=@normaltilde
11626 @let\=@ttbackslash
11627 @setregularquotes
11628 @unsepspaces
11629 }
11630 }
11631
11632 % If a .fmt file is being used, characters that might appear in a file
11633 % name cannot be active until we have parsed the command line.
11634 % So turn them off again, and have @fixbackslash turn them back on.
11635 @catcode`+=@other @catcode`@_=@other
11636
11637 % \enablebackslashhack - allow file to begin `\input texinfo'
11638 %
11639 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11640 % That is what \eatinput is for; after that, the `\' should revert to printing
11641 % a backslash.
11642 % If the file did not have a `\input texinfo', then it is turned off after
11643 % the first line; otherwise the first `\' in the file would cause an error.
11644 % This is used on the very last line of this file, texinfo.tex.
11645 % We also use @c to call @fixbackslash, in case ends of lines are hidden.
11646 {
11647 @catcode`@^=7
11648 @catcode`@^^M=13@gdef@enablebackslashhack{%
11649 @global@let\ = @eatinput%
11650 @catcode`@^^M=13%
11651 @def@c{@fixbackslash@c}%
11652 % Definition for the newline at the end of this file.
11653 @def ^^M{@let^^M@secondlinenl}%
11654 % Definition for a newline in the main Texinfo file.
11655 @gdef @secondlinenl{@fixbackslash}%
11656 % In case the first line has a whole-line command on it
11657 @let@originalparsearg@parsearg
11658 @def@parsearg{@fixbackslash@originalparsearg}
11659 }}
11660
11661 {@catcode`@^=7 @catcode`@^^M=13%
11662 @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11663
11664 % Emergency active definition of newline, in case an active newline token
11665 % appears by mistake.
11666 {@catcode`@^=7 @catcode13=13%
11667 @gdef@enableemergencynewline{%
11668 @gdef^^M{%
11669 @par%
11670 %<warning: active newline>@par%
11671 }}}
11672
11673
11674 @gdef@fixbackslash{%
11675 @ifx\@eatinput @let\ = @ttbackslash @fi
11676 @catcode13=5 % regular end of line
11677 @enableemergencynewline
11678 @let@c=@comment
11679 @let@parsearg@originalparsearg
11680 % Also turn back on active characters that might appear in the input
11681 % file name, in case not using a pre-dumped format.
11682 @catcode`+=@active
11683 @catcode`@_=@active
11684 %
11685 % If texinfo.cnf is present on the system, read it.
11686 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11687 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11688 % directly in this file, texinfo.tex, makes it possible to make a format
11689 % file for Texinfo.
11690 %
11691 @openin 1 texinfo.cnf
11692 @ifeof 1 @else @input texinfo.cnf @fi
11693 @closein 1
11694 }
11695
11696
11697 % Say @foo, not \foo, in error messages.
11698 @escapechar = `@@
11699
11700 % These (along with & and #) are made active for url-breaking, so need
11701 % active definitions as the normal characters.
11702 @def@normaldot{.}
11703 @def@normalquest{?}
11704 @def@normalslash{/}
11705
11706 % These look ok in all fonts, so just make them not special.
11707 % @hashchar{} gets its own user-level command, because of #line.
11708 @catcode`@& = @other @def@normalamp{&}
11709 @catcode`@# = @other @def@normalhash{#}
11710 @catcode`@% = @other @def@normalpercent{%}
11711
11712 @let @hashchar = @normalhash
11713
11714 @c Finally, make ` and ' active, so that txicodequoteundirected and
11715 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11716 @c don't make ` and ' active, @code will not get them as active chars.
11717 @c Do this last of all since we use ` in the previous @catcode assignments.
11718 @catcode`@'=@active
11719 @catcode`@`=@active
11720 @setregularquotes
11721
11722 @c Local variables:
11723 @c eval: (add-hook 'before-save-hook 'time-stamp)
11724 @c page-delimiter: "^\\\\message\\|emacs-page"
11725 @c time-stamp-start: "def\\\\texinfoversion{"
11726 @c time-stamp-format: "%:y-%02m-%02d.%02H"
11727 @c time-stamp-end: "}"
11728 @c End:
11729
11730 @c vim:sw=2:
11731
11732 @enablebackslashhack
11733