]> code.delx.au - gnu-emacs/blob - doc/misc/texinfo.tex
Update copyright year to 2016
[gnu-emacs] / doc / misc / texinfo.tex
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{2015-12-20.12}
7 %
8 % Copyright 1985-1986, 1988, 1990-2016 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 <http://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 % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
31 % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
32 % http://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@gnu.org. Please include including 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 http://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 \chardef\other=12
68
69 % We never want plain's \outer definition of \+ in Texinfo.
70 % For @tex, we can use \tabalign.
71 \let\+ = \relax
72
73 % Save some plain tex macros whose names we will redefine.
74 \let\ptexb=\b
75 \let\ptexbullet=\bullet
76 \let\ptexc=\c
77 \let\ptexcomma=\,
78 \let\ptexdot=\.
79 \let\ptexdots=\dots
80 \let\ptexend=\end
81 \let\ptexequiv=\equiv
82 \let\ptexexclam=\!
83 \let\ptexfootnote=\footnote
84 \let\ptexgtr=>
85 \let\ptexhat=^
86 \let\ptexi=\i
87 \let\ptexindent=\indent
88 \let\ptexinsert=\insert
89 \let\ptexlbrace=\{
90 \let\ptexless=<
91 \let\ptexnewwrite\newwrite
92 \let\ptexnoindent=\noindent
93 \let\ptexplus=+
94 \let\ptexraggedright=\raggedright
95 \let\ptexrbrace=\}
96 \let\ptexslash=\/
97 \let\ptexsp=\sp
98 \let\ptexstar=\*
99 \let\ptexsup=\sup
100 \let\ptext=\t
101 \let\ptextop=\top
102 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
103
104 % If this character appears in an error message or help string, it
105 % starts a new line in the output.
106 \newlinechar = `^^J
107
108 % Use TeX 3.0's \inputlineno to get the line number, for better error
109 % messages, but if we're using an old version of TeX, don't do anything.
110 %
111 \ifx\inputlineno\thisisundefined
112 \let\linenumber = \empty % Pre-3.0.
113 \else
114 \def\linenumber{l.\the\inputlineno:\space}
115 \fi
116
117 % Set up fixed words for English if not already set.
118 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
119 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
120 \ifx\putworderror\undefined \gdef\putworderror{error}\fi
121 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
122 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
123 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
124 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
125 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
126 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
127 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
128 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
129 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
130 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
131 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
132 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
133 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
134 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
135 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
136 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
137 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
138 %
139 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
140 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
141 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
142 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
143 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
144 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
145 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
146 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
147 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
148 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
149 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
150 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
151 %
152 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
153 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
154 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
155 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
156 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
157
158 % Give the space character the catcode for a space.
159 \def\spaceisspace{\catcode`\ =10\relax}
160
161 \chardef\dashChar = `\-
162 \chardef\slashChar = `\/
163 \chardef\underChar = `\_
164
165 % Ignore a token.
166 %
167 \def\gobble#1{}
168
169 % The following is used inside several \edef's.
170 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
171
172 % Hyphenation fixes.
173 \hyphenation{
174 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
175 ap-pen-dix bit-map bit-maps
176 data-base data-bases eshell fall-ing half-way long-est man-u-script
177 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
178 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
179 spell-ing spell-ings
180 stand-alone strong-est time-stamp time-stamps which-ever white-space
181 wide-spread wrap-around
182 }
183
184 % Sometimes it is convenient to have everything in the transcript file
185 % and nothing on the terminal. We don't just call \tracingall here,
186 % since that produces some useless output on the terminal. We also make
187 % some effort to order the tracing commands to reduce output in the log
188 % file; cf. trace.sty in LaTeX.
189 %
190 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
191 \def\loggingall{%
192 \tracingstats2
193 \tracingpages1
194 \tracinglostchars2 % 2 gives us more in etex
195 \tracingparagraphs1
196 \tracingoutput1
197 \tracingmacros2
198 \tracingrestores1
199 \showboxbreadth\maxdimen \showboxdepth\maxdimen
200 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
201 \tracingscantokens1
202 \tracingifs1
203 \tracinggroups1
204 \tracingnesting2
205 \tracingassigns1
206 \fi
207 \tracingcommands3 % 3 gives us more in etex
208 \errorcontextlines16
209 }%
210
211 % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
212 % aren't perfect, it's not the end of the world, being an error message,
213 % after all.
214 %
215 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
216 \def\doerrormsg#1{\errmessage{#1}}
217
218 % add check for \lastpenalty to plain's definitions. If the last thing
219 % we did was a \nobreak, we don't want to insert more space.
220 %
221 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
222 \removelastskip\penalty-50\smallskip\fi\fi}
223 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
224 \removelastskip\penalty-100\medskip\fi\fi}
225 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
226 \removelastskip\penalty-200\bigskip\fi\fi}
227
228 %\f Output routine
229 %
230
231 % For a final copy, take out the rectangles
232 % that mark overfull boxes (in case you have decided
233 % that the text looks ok even though it passes the margin).
234 %
235 \def\finalout{\overfullrule=0pt }
236
237 % Do @cropmarks to get crop marks.
238 %
239 \newif\ifcropmarks
240 \let\cropmarks = \cropmarkstrue
241 %
242 % Dimensions to add cropmarks at corners.
243 % Added by P. A. MacKay, 12 Nov. 1986
244 %
245 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
246 \newdimen\cornerlong \cornerlong=1pc
247 \newdimen\cornerthick \cornerthick=.3pt
248 \newdimen\topandbottommargin \topandbottommargin=.75in
249
250 % Output a mark which sets \thischapter, \thissection and \thiscolor.
251 % We dump everything together because we only have one kind of mark.
252 % This works because we only use \botmark / \topmark, not \firstmark.
253 %
254 % A mark contains a subexpression of the \ifcase ... \fi construct.
255 % \get*marks macros below extract the needed part using \ifcase.
256 %
257 % Another complication is to let the user choose whether \thischapter
258 % (\thissection) refers to the chapter (section) in effect at the top
259 % of a page, or that at the bottom of a page.
260
261 % \domark is called twice inside \chapmacro, to add one
262 % mark before the section break, and one after.
263 % In the second call \prevchapterdefs is the same as \lastchapterdefs,
264 % and \prevsectiondefs is the same as \lastsectiondefs.
265 % Then if the page is not broken at the mark, some of the previous
266 % section appears on the page, and we can get the name of this section
267 % from \firstmark for @everyheadingmarks top.
268 % @everyheadingmarks bottom uses \botmark.
269 %
270 % See page 260 of The TeXbook.
271 \def\domark{%
272 \toks0=\expandafter{\lastchapterdefs}%
273 \toks2=\expandafter{\lastsectiondefs}%
274 \toks4=\expandafter{\prevchapterdefs}%
275 \toks6=\expandafter{\prevsectiondefs}%
276 \toks8=\expandafter{\lastcolordefs}%
277 \mark{%
278 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
279 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
280 \noexpand\else \the\toks8 % 2: color marks
281 }%
282 }
283
284 % \gettopheadingmarks, \getbottomheadingmarks,
285 % \getcolormarks - extract needed part of mark.
286 %
287 % \topmark doesn't work for the very first chapter (after the title
288 % page or the contents), so we use \firstmark there -- this gets us
289 % the mark with the chapter defs, unless the user sneaks in, e.g.,
290 % @setcolor (or @url, or @link, etc.) between @contents and the very
291 % first @chapter.
292 \def\gettopheadingmarks{%
293 \ifcase0\topmark\fi
294 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
295 }
296 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
297 \def\getcolormarks{\ifcase2\topmark\fi}
298
299 % Avoid "undefined control sequence" errors.
300 \def\lastchapterdefs{}
301 \def\lastsectiondefs{}
302 \def\lastsection{}
303 \def\prevchapterdefs{}
304 \def\prevsectiondefs{}
305 \def\lastcolordefs{}
306
307 % Margin to add to right of even pages, to left of odd pages.
308 \newdimen\bindingoffset
309 \newdimen\normaloffset
310 \newdimen\pagewidth \newdimen\pageheight
311
312 % Main output routine.
313 %
314 \chardef\PAGE = 255
315 \output = {\onepageout{\pagecontents\PAGE}}
316
317 \newbox\headlinebox
318 \newbox\footlinebox
319
320 % \onepageout takes a vbox as an argument.
321 % \shipout a vbox for a single page, adding an optional header, footer,
322 % cropmarks, and footnote. This also causes index entries for this page
323 % to be written to the auxiliary files.
324 %
325 \def\onepageout#1{%
326 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
327 %
328 \ifodd\pageno \advance\hoffset by \bindingoffset
329 \else \advance\hoffset by -\bindingoffset\fi
330 %
331 % Common context changes for both heading and footing.
332 % Do this outside of the \shipout so @code etc. will be expanded in
333 % the headline as they should be, not taken literally (outputting ''code).
334 \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars}
335 %
336 % Retrieve the information for the headings from the marks in the page,
337 % and call Plain TeX's \makeheadline and \makefootline, which use the
338 % values in \headline and \footline.
339 %
340 % This is used to check if we are on the first page of a chapter.
341 \ifcase1\topmark\fi
342 \let\prevchaptername\thischaptername
343 \ifcase0\firstmark\fi
344 \let\curchaptername\thischaptername
345 %
346 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
347 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
348 %
349 \ifx\curchaptername\prevchaptername
350 \let\thischapterheading\thischapter
351 \else
352 % \thischapterheading is the same as \thischapter except it is blank
353 % for the first page of a chapter. This is to prevent the chapter name
354 % being shown twice.
355 \def\thischapterheading{}%
356 \fi
357 %
358 \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
359 \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
360 %
361 {%
362 % Set context for writing to auxiliary files like index files.
363 % Have to do this stuff outside the \shipout because we want it to
364 % take effect in \write's, yet the group defined by the \vbox ends
365 % before the \shipout runs.
366 %
367 \indexdummies % don't expand commands in the output.
368 \normalturnoffactive % \ in index entries must not stay \, e.g., if
369 % the page break happens to be in the middle of an example.
370 % We don't want .vr (or whatever) entries like this:
371 % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
372 % "\acronym" won't work when it's read back in;
373 % it needs to be
374 % {\code {{\backslashcurfont }acronym}
375 \shipout\vbox{%
376 % Do this early so pdf references go to the beginning of the page.
377 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
378 %
379 \ifcropmarks \vbox to \outervsize\bgroup
380 \hsize = \outerhsize
381 \vskip-\topandbottommargin
382 \vtop to0pt{%
383 \line{\ewtop\hfil\ewtop}%
384 \nointerlineskip
385 \line{%
386 \vbox{\moveleft\cornerthick\nstop}%
387 \hfill
388 \vbox{\moveright\cornerthick\nstop}%
389 }%
390 \vss}%
391 \vskip\topandbottommargin
392 \line\bgroup
393 \hfil % center the page within the outer (page) hsize.
394 \ifodd\pageno\hskip\bindingoffset\fi
395 \vbox\bgroup
396 \fi
397 %
398 \unvbox\headlinebox
399 \pagebody{#1}%
400 \ifdim\ht\footlinebox > 0pt
401 % Only leave this space if the footline is nonempty.
402 % (We lessened \vsize for it in \oddfootingyyy.)
403 % The \baselineskip=24pt in plain's \makefootline has no effect.
404 \vskip 24pt
405 \unvbox\footlinebox
406 \fi
407 %
408 \ifcropmarks
409 \egroup % end of \vbox\bgroup
410 \hfil\egroup % end of (centering) \line\bgroup
411 \vskip\topandbottommargin plus1fill minus1fill
412 \boxmaxdepth = \cornerthick
413 \vbox to0pt{\vss
414 \line{%
415 \vbox{\moveleft\cornerthick\nsbot}%
416 \hfill
417 \vbox{\moveright\cornerthick\nsbot}%
418 }%
419 \nointerlineskip
420 \line{\ewbot\hfil\ewbot}%
421 }%
422 \egroup % \vbox from first cropmarks clause
423 \fi
424 }% end of \shipout\vbox
425 }% end of group with \indexdummies
426 \advancepageno
427 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
428 }
429
430 \newinsert\margin \dimen\margin=\maxdimen
431
432 % Main part of page, including any footnotes
433 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
434 {\catcode`\@ =11
435 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
436 % marginal hacks, juha@viisa.uucp (Juha Takala)
437 \ifvoid\margin\else % marginal info is present
438 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
439 \dimen@=\dp#1\relax \unvbox#1\relax
440 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
441 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
442 }
443
444 % Here are the rules for the cropmarks. Note that they are
445 % offset so that the space between them is truly \outerhsize or \outervsize
446 % (P. A. MacKay, 12 November, 1986)
447 %
448 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
449 \def\nstop{\vbox
450 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
451 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
452 \def\nsbot{\vbox
453 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
454
455
456 % Argument parsing
457
458 % Parse an argument, then pass it to #1. The argument is the rest of
459 % the input line (except we remove a trailing comment). #1 should be a
460 % macro which expects an ordinary undelimited TeX argument.
461 % For example, \def\foo{\parsearg\fooxxx}.
462 %
463 \def\parsearg{\parseargusing{}}
464 \def\parseargusing#1#2{%
465 \def\argtorun{#2}%
466 \begingroup
467 \obeylines
468 \spaceisspace
469 #1%
470 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
471 }
472
473 {\obeylines %
474 \gdef\parseargline#1^^M{%
475 \endgroup % End of the group started in \parsearg.
476 \argremovecomment #1\comment\ArgTerm%
477 }%
478 }
479
480 % First remove any @comment, then any @c comment. Also remove a @texinfoc
481 % comment (see \scanmacro for details). Pass the result on to \argcheckspaces.
482 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
483 \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
484 \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
485
486 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
487 %
488 % \argremovec might leave us with trailing space, e.g.,
489 % @end itemize @c foo
490 % This space token undergoes the same procedure and is eventually removed
491 % by \finishparsearg.
492 %
493 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
494 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
495 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
496 \def\temp{#3}%
497 \ifx\temp\empty
498 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
499 \let\temp\finishparsearg
500 \else
501 \let\temp\argcheckspaces
502 \fi
503 % Put the space token in:
504 \temp#1 #3\ArgTerm
505 }
506
507 % If a _delimited_ argument is enclosed in braces, they get stripped; so
508 % to get _exactly_ the rest of the line, we had to prevent such situation.
509 % We prepended an \empty token at the very beginning and we expand it now,
510 % just before passing the control to \argtorun.
511 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
512 % either the null string, or it ends with \^^M---thus there is no danger
513 % that a pair of braces would be stripped.
514 %
515 % But first, we have to remove the trailing space token.
516 %
517 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
518
519
520 % \parseargdef - define a command taking an argument on the line
521 %
522 % \parseargdef\foo{...}
523 % is roughly equivalent to
524 % \def\foo{\parsearg\Xfoo}
525 % \def\Xfoo#1{...}
526 \def\parseargdef#1{%
527 \expandafter \doparseargdef \csname\string#1\endcsname #1%
528 }
529 \def\doparseargdef#1#2{%
530 \def#2{\parsearg#1}%
531 \def#1##1%
532 }
533
534 % Several utility definitions with active space:
535 {
536 \obeyspaces
537 \gdef\obeyedspace{ }
538
539 % Make each space character in the input produce a normal interword
540 % space in the output. Don't allow a line break at this space, as this
541 % is used only in environments like @example, where each line of input
542 % should produce a line of output anyway.
543 %
544 \gdef\sepspaces{\obeyspaces\let =\tie}
545
546 % If an index command is used in an @example environment, any spaces
547 % therein should become regular spaces in the raw index file, not the
548 % expansion of \tie (\leavevmode \penalty \@M \ ).
549 \gdef\unsepspaces{\let =\space}
550 }
551
552
553 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
554
555 % Define the framework for environments in texinfo.tex. It's used like this:
556 %
557 % \envdef\foo{...}
558 % \def\Efoo{...}
559 %
560 % It's the responsibility of \envdef to insert \begingroup before the
561 % actual body; @end closes the group after calling \Efoo. \envdef also
562 % defines \thisenv, so the current environment is known; @end checks
563 % whether the environment name matches. The \checkenv macro can also be
564 % used to check whether the current environment is the one expected.
565 %
566 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
567 % are not treated as environments; they don't open a group. (The
568 % implementation of @end takes care not to call \endgroup in this
569 % special case.)
570
571
572 % At run-time, environments start with this:
573 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
574 % initialize
575 \let\thisenv\empty
576
577 % ... but they get defined via ``\envdef\foo{...}'':
578 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
579 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
580
581 % Check whether we're in the right environment:
582 \def\checkenv#1{%
583 \def\temp{#1}%
584 \ifx\thisenv\temp
585 \else
586 \badenverr
587 \fi
588 }
589
590 % Environment mismatch, #1 expected:
591 \def\badenverr{%
592 \errhelp = \EMsimple
593 \errmessage{This command can appear only \inenvironment\temp,
594 not \inenvironment\thisenv}%
595 }
596 \def\inenvironment#1{%
597 \ifx#1\empty
598 outside of any environment%
599 \else
600 in environment \expandafter\string#1%
601 \fi
602 }
603
604 % @end foo executes the definition of \Efoo.
605 % But first, it executes a specialized version of \checkenv
606 %
607 \parseargdef\end{%
608 \if 1\csname iscond.#1\endcsname
609 \else
610 % The general wording of \badenverr may not be ideal.
611 \expandafter\checkenv\csname#1\endcsname
612 \csname E#1\endcsname
613 \endgroup
614 \fi
615 }
616
617 \newhelp\EMsimple{Press RETURN to continue.}
618
619
620 % Be sure we're in horizontal mode when doing a tie, since we make space
621 % equivalent to this in @example-like environments. Otherwise, a space
622 % at the beginning of a line will start with \penalty -- and
623 % since \penalty is valid in vertical mode, we'd end up putting the
624 % penalty on the vertical list instead of in the new paragraph.
625 {\catcode`@ = 11
626 % Avoid using \@M directly, because that causes trouble
627 % if the definition is written into an index file.
628 \global\let\tiepenalty = \@M
629 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
630 }
631
632 % @: forces normal size whitespace following.
633 \def\:{\spacefactor=1000 }
634
635 % @* forces a line break.
636 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
637
638 % @/ allows a line break.
639 \let\/=\allowbreak
640
641 % @. is an end-of-sentence period.
642 \def\.{.\spacefactor=\endofsentencespacefactor\space}
643
644 % @! is an end-of-sentence bang.
645 \def\!{!\spacefactor=\endofsentencespacefactor\space}
646
647 % @? is an end-of-sentence query.
648 \def\?{?\spacefactor=\endofsentencespacefactor\space}
649
650 % @frenchspacing on|off says whether to put extra space after punctuation.
651 %
652 \def\onword{on}
653 \def\offword{off}
654 %
655 \parseargdef\frenchspacing{%
656 \def\temp{#1}%
657 \ifx\temp\onword \plainfrenchspacing
658 \else\ifx\temp\offword \plainnonfrenchspacing
659 \else
660 \errhelp = \EMsimple
661 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
662 \fi\fi
663 }
664
665 % @w prevents a word break. Without the \leavevmode, @w at the
666 % beginning of a paragraph, when TeX is still in vertical mode, would
667 % produce a whole line of output instead of starting the paragraph.
668 \def\w#1{\leavevmode\hbox{#1}}
669
670 % @group ... @end group forces ... to be all on one page, by enclosing
671 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
672 % to keep its height that of a normal line. According to the rules for
673 % \topskip (p.114 of the TeXbook), the glue inserted is
674 % max (\topskip - \ht (first item), 0). If that height is large,
675 % therefore, no glue is inserted, and the space between the headline and
676 % the text is small, which looks bad.
677 %
678 % Another complication is that the group might be very large. This can
679 % cause the glue on the previous page to be unduly stretched, because it
680 % does not have much material. In this case, it's better to add an
681 % explicit \vfill so that the extra space is at the bottom. The
682 % threshold for doing this is if the group is more than \vfilllimit
683 % percent of a page (\vfilllimit can be changed inside of @tex).
684 %
685 \newbox\groupbox
686 \def\vfilllimit{0.7}
687 %
688 \envdef\group{%
689 \ifnum\catcode`\^^M=\active \else
690 \errhelp = \groupinvalidhelp
691 \errmessage{@group invalid in context where filling is enabled}%
692 \fi
693 \startsavinginserts
694 %
695 \setbox\groupbox = \vtop\bgroup
696 % Do @comment since we are called inside an environment such as
697 % @example, where each end-of-line in the input causes an
698 % end-of-line in the output. We don't want the end-of-line after
699 % the `@group' to put extra space in the output. Since @group
700 % should appear on a line by itself (according to the Texinfo
701 % manual), we don't worry about eating any user text.
702 \comment
703 }
704 %
705 % The \vtop produces a box with normal height and large depth; thus, TeX puts
706 % \baselineskip glue before it, and (when the next line of text is done)
707 % \lineskip glue after it. Thus, space below is not quite equal to space
708 % above. But it's pretty close.
709 \def\Egroup{%
710 % To get correct interline space between the last line of the group
711 % and the first line afterwards, we have to propagate \prevdepth.
712 \endgraf % Not \par, as it may have been set to \lisppar.
713 \global\dimen1 = \prevdepth
714 \egroup % End the \vtop.
715 \addgroupbox
716 \prevdepth = \dimen1
717 \checkinserts
718 }
719
720 \def\addgroupbox{
721 % \dimen0 is the vertical size of the group's box.
722 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
723 % \dimen2 is how much space is left on the page (more or less).
724 \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
725 % if the group doesn't fit on the current page, and it's a big big
726 % group, force a page break.
727 \ifdim \dimen0 > \dimen2
728 \ifdim \pagetotal < \vfilllimit\pageheight
729 \page
730 \fi
731 \fi
732 \box\groupbox
733 }
734
735 %
736 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
737 % message, so this ends up printing `@group can only ...'.
738 %
739 \newhelp\groupinvalidhelp{%
740 group can only be used in environments such as @example,^^J%
741 where each line of input produces a line of output.}
742
743 % @need space-in-mils
744 % forces a page break if there is not space-in-mils remaining.
745
746 \newdimen\mil \mil=0.001in
747
748 \parseargdef\need{%
749 % Ensure vertical mode, so we don't make a big box in the middle of a
750 % paragraph.
751 \par
752 %
753 % If the @need value is less than one line space, it's useless.
754 \dimen0 = #1\mil
755 \dimen2 = \ht\strutbox
756 \advance\dimen2 by \dp\strutbox
757 \ifdim\dimen0 > \dimen2
758 %
759 % Do a \strut just to make the height of this box be normal, so the
760 % normal leading is inserted relative to the preceding line.
761 % And a page break here is fine.
762 \vtop to #1\mil{\strut\vfil}%
763 %
764 % TeX does not even consider page breaks if a penalty added to the
765 % main vertical list is 10000 or more. But in order to see if the
766 % empty box we just added fits on the page, we must make it consider
767 % page breaks. On the other hand, we don't want to actually break the
768 % page after the empty box. So we use a penalty of 9999.
769 %
770 % There is an extremely small chance that TeX will actually break the
771 % page at this \penalty, if there are no other feasible breakpoints in
772 % sight. (If the user is using lots of big @group commands, which
773 % almost-but-not-quite fill up a page, TeX will have a hard time doing
774 % good page breaking, for example.) However, I could not construct an
775 % example where a page broke at this \penalty; if it happens in a real
776 % document, then we can reconsider our strategy.
777 \penalty9999
778 %
779 % Back up by the size of the box, whether we did a page break or not.
780 \kern -#1\mil
781 %
782 % Do not allow a page break right after this kern.
783 \nobreak
784 \fi
785 }
786
787 % @br forces paragraph break (and is undocumented).
788
789 \let\br = \par
790
791 % @page forces the start of a new page.
792 %
793 \def\page{\par\vfill\supereject}
794
795 % @exdent text....
796 % outputs text on separate line in roman font, starting at standard page margin
797
798 % This records the amount of indent in the innermost environment.
799 % That's how much \exdent should take out.
800 \newskip\exdentamount
801
802 % This defn is used inside fill environments such as @defun.
803 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
804
805 % This defn is used inside nofill environments such as @example.
806 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
807 \leftline{\hskip\leftskip{\rm#1}}}}
808
809 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
810 % paragraph. For more general purposes, use the \margin insertion
811 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
812 %
813 \newskip\inmarginspacing \inmarginspacing=1cm
814 \def\strutdepth{\dp\strutbox}
815 %
816 \def\doinmargin#1#2{\strut\vadjust{%
817 \nobreak
818 \kern-\strutdepth
819 \vtop to \strutdepth{%
820 \baselineskip=\strutdepth
821 \vss
822 % if you have multiple lines of stuff to put here, you'll need to
823 % make the vbox yourself of the appropriate size.
824 \ifx#1l%
825 \llap{\ignorespaces #2\hskip\inmarginspacing}%
826 \else
827 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
828 \fi
829 \null
830 }%
831 }}
832 \def\inleftmargin{\doinmargin l}
833 \def\inrightmargin{\doinmargin r}
834 %
835 % @inmargin{TEXT [, RIGHT-TEXT]}
836 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
837 % else use TEXT for both).
838 %
839 \def\inmargin#1{\parseinmargin #1,,\finish}
840 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
841 \setbox0 = \hbox{\ignorespaces #2}%
842 \ifdim\wd0 > 0pt
843 \def\lefttext{#1}% have both texts
844 \def\righttext{#2}%
845 \else
846 \def\lefttext{#1}% have only one text
847 \def\righttext{#1}%
848 \fi
849 %
850 \ifodd\pageno
851 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
852 \else
853 \def\temp{\inleftmargin\lefttext}%
854 \fi
855 \temp
856 }
857
858 % @| inserts a changebar to the left of the current line. It should
859 % surround any changed text. This approach does *not* work if the
860 % change spans more than two lines of output. To handle that, we would
861 % have adopt a much more difficult approach (putting marks into the main
862 % vertical list for the beginning and end of each change). This command
863 % is not documented, not supported, and doesn't work.
864 %
865 \def\|{%
866 % \vadjust can only be used in horizontal mode.
867 \leavevmode
868 %
869 % Append this vertical mode material after the current line in the output.
870 \vadjust{%
871 % We want to insert a rule with the height and depth of the current
872 % leading; that is exactly what \strutbox is supposed to record.
873 \vskip-\baselineskip
874 %
875 % \vadjust-items are inserted at the left edge of the type. So
876 % the \llap here moves out into the left-hand margin.
877 \llap{%
878 %
879 % For a thicker or thinner bar, change the `1pt'.
880 \vrule height\baselineskip width1pt
881 %
882 % This is the space between the bar and the text.
883 \hskip 12pt
884 }%
885 }%
886 }
887
888 % @include FILE -- \input text of FILE.
889 %
890 \def\include{\parseargusing\filenamecatcodes\includezzz}
891 \def\includezzz#1{%
892 \pushthisfilestack
893 \def\thisfile{#1}%
894 {%
895 \makevalueexpandable % we want to expand any @value in FILE.
896 \turnoffactive % and allow special characters in the expansion
897 \indexnofonts % Allow `@@' and other weird things in file names.
898 \wlog{texinfo.tex: doing @include of #1^^J}%
899 \edef\temp{\noexpand\input #1 }%
900 %
901 % This trickery is to read FILE outside of a group, in case it makes
902 % definitions, etc.
903 \expandafter
904 }\temp
905 \popthisfilestack
906 }
907 \def\filenamecatcodes{%
908 \catcode`\\=\other
909 \catcode`~=\other
910 \catcode`^=\other
911 \catcode`_=\other
912 \catcode`|=\other
913 \catcode`<=\other
914 \catcode`>=\other
915 \catcode`+=\other
916 \catcode`-=\other
917 \catcode`\`=\other
918 \catcode`\'=\other
919 }
920
921 \def\pushthisfilestack{%
922 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
923 }
924 \def\pushthisfilestackX{%
925 \expandafter\pushthisfilestackY\thisfile\StackTerm
926 }
927 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
928 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
929 }
930
931 \def\popthisfilestack{\errthisfilestackempty}
932 \def\errthisfilestackempty{\errmessage{Internal error:
933 the stack of filenames is empty.}}
934 %
935 \def\thisfile{}
936
937 % @center line
938 % outputs that line, centered.
939 %
940 \parseargdef\center{%
941 \ifhmode
942 \let\centersub\centerH
943 \else
944 \let\centersub\centerV
945 \fi
946 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
947 \let\centersub\relax % don't let the definition persist, just in case
948 }
949 \def\centerH#1{{%
950 \hfil\break
951 \advance\hsize by -\leftskip
952 \advance\hsize by -\rightskip
953 \line{#1}%
954 \break
955 }}
956 %
957 \newcount\centerpenalty
958 \def\centerV#1{%
959 % The idea here is the same as in \startdefun, \cartouche, etc.: if
960 % @center is the first thing after a section heading, we need to wipe
961 % out the negative parskip inserted by \sectionheading, but still
962 % prevent a page break here.
963 \centerpenalty = \lastpenalty
964 \ifnum\centerpenalty>10000 \vskip\parskip \fi
965 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
966 \line{\kern\leftskip #1\kern\rightskip}%
967 }
968
969 % @sp n outputs n lines of vertical space
970 %
971 \parseargdef\sp{\vskip #1\baselineskip}
972
973 % @comment ...line which is ignored...
974 % @c is the same as @comment
975 % @ignore ... @end ignore is another way to write a comment
976 %
977 \def\comment{\begingroup \catcode`\^^M=\active%
978 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other\commentxxx}%
979
980 {\catcode`\^^M=\active%
981 \gdef\commentxxx#1^^M{\endgroup%
982 \futurelet\nexttoken\commentxxxx}%
983 \gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}%
984 }
985
986 \def\c{\begingroup \catcode`\^^M=\active%
987 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
988 \cxxx}
989 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
990 % See comment in \scanmacro about why the definitions of @c and @comment differ
991
992 % @paragraphindent NCHARS
993 % We'll use ems for NCHARS, close enough.
994 % NCHARS can also be the word `asis' or `none'.
995 % We cannot feasibly implement @paragraphindent asis, though.
996 %
997 \def\asisword{asis} % no translation, these are keywords
998 \def\noneword{none}
999 %
1000 \parseargdef\paragraphindent{%
1001 \def\temp{#1}%
1002 \ifx\temp\asisword
1003 \else
1004 \ifx\temp\noneword
1005 \defaultparindent = 0pt
1006 \else
1007 \defaultparindent = #1em
1008 \fi
1009 \fi
1010 \parindent = \defaultparindent
1011 }
1012
1013 % @exampleindent NCHARS
1014 % We'll use ems for NCHARS like @paragraphindent.
1015 % It seems @exampleindent asis isn't necessary, but
1016 % I preserve it to make it similar to @paragraphindent.
1017 \parseargdef\exampleindent{%
1018 \def\temp{#1}%
1019 \ifx\temp\asisword
1020 \else
1021 \ifx\temp\noneword
1022 \lispnarrowing = 0pt
1023 \else
1024 \lispnarrowing = #1em
1025 \fi
1026 \fi
1027 }
1028
1029 % @firstparagraphindent WORD
1030 % If WORD is `none', then suppress indentation of the first paragraph
1031 % after a section heading. If WORD is `insert', then do indent at such
1032 % paragraphs.
1033 %
1034 % The paragraph indentation is suppressed or not by calling
1035 % \suppressfirstparagraphindent, which the sectioning commands do.
1036 % We switch the definition of this back and forth according to WORD.
1037 % By default, we suppress indentation.
1038 %
1039 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
1040 \def\insertword{insert}
1041 %
1042 \parseargdef\firstparagraphindent{%
1043 \def\temp{#1}%
1044 \ifx\temp\noneword
1045 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
1046 \else\ifx\temp\insertword
1047 \let\suppressfirstparagraphindent = \relax
1048 \else
1049 \errhelp = \EMsimple
1050 \errmessage{Unknown @firstparagraphindent option `\temp'}%
1051 \fi\fi
1052 }
1053
1054 % Here is how we actually suppress indentation. Redefine \everypar to
1055 % \kern backwards by \parindent, and then reset itself to empty.
1056 %
1057 % We also make \indent itself not actually do anything until the next
1058 % paragraph.
1059 %
1060 \gdef\dosuppressfirstparagraphindent{%
1061 \gdef\indent {\restorefirstparagraphindent \indent}%
1062 \gdef\noindent{\restorefirstparagraphindent \noindent}%
1063 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
1064 }
1065 %
1066 \gdef\restorefirstparagraphindent{%
1067 \global\let\indent = \ptexindent
1068 \global\let\noindent = \ptexnoindent
1069 \global\everypar = {}%
1070 }
1071
1072
1073 % @refill is a no-op.
1074 \let\refill=\relax
1075
1076 % @setfilename INFO-FILENAME - ignored
1077 \let\setfilename=\comment
1078
1079 % @bye.
1080 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1081
1082
1083 \message{pdf,}
1084 % adobe `portable' document format
1085 \newcount\tempnum
1086 \newcount\lnkcount
1087 \newtoks\filename
1088 \newcount\filenamelength
1089 \newcount\pgn
1090 \newtoks\toksA
1091 \newtoks\toksB
1092 \newtoks\toksC
1093 \newtoks\toksD
1094 \newbox\boxA
1095 \newbox\boxB
1096 \newcount\countA
1097 \newif\ifpdf
1098 \newif\ifpdfmakepagedest
1099
1100 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1101 % can be set). So we test for \relax and 0 as well as being undefined.
1102 \ifx\pdfoutput\thisisundefined
1103 \else
1104 \ifx\pdfoutput\relax
1105 \else
1106 \ifcase\pdfoutput
1107 \else
1108 \pdftrue
1109 \fi
1110 \fi
1111 \fi
1112
1113 % PDF uses PostScript string constants for the names of xref targets,
1114 % for display in the outlines, and in other places. Thus, we have to
1115 % double any backslashes. Otherwise, a name like "\node" will be
1116 % interpreted as a newline (\n), followed by o, d, e. Not good.
1117 %
1118 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1119 % related messages. The final outcome is that it is up to the TeX user
1120 % to double the backslashes and otherwise make the string valid, so
1121 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1122 % do this reliably, so we use it.
1123
1124 % #1 is a control sequence in which to do the replacements,
1125 % which we \xdef.
1126 \def\txiescapepdf#1{%
1127 \ifx\pdfescapestring\thisisundefined
1128 % No primitive available; should we give a warning or log?
1129 % Many times it won't matter.
1130 \else
1131 % The expandable \pdfescapestring primitive escapes parentheses,
1132 % backslashes, and other special chars.
1133 \xdef#1{\pdfescapestring{#1}}%
1134 \fi
1135 }
1136
1137 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1138 with PDF output, and none of those formats could be found. (.eps cannot
1139 be supported due to the design of the PDF format; use regular TeX (DVI
1140 output) for that.)}
1141
1142 \ifpdf
1143 %
1144 % Color manipulation macros using ideas from pdfcolor.tex,
1145 % except using rgb instead of cmyk; the latter is said to render as a
1146 % very dark gray on-screen and a very dark halftone in print, instead
1147 % of actual black. The dark red here is dark enough to print on paper as
1148 % nearly black, but still distinguishable for online viewing. We use
1149 % black by default, though.
1150 \def\rgbDarkRed{0.50 0.09 0.12}
1151 \def\rgbBlack{0 0 0}
1152 %
1153 % rg sets the color for filling (usual text, etc.);
1154 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1155 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1156 %
1157 % Set color, and create a mark which defines \thiscolor accordingly,
1158 % so that \makeheadline knows which color to restore.
1159 \def\setcolor#1{%
1160 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1161 \domark
1162 \pdfsetcolor{#1}%
1163 }
1164 %
1165 \def\maincolor{\rgbBlack}
1166 \pdfsetcolor{\maincolor}
1167 \edef\thiscolor{\maincolor}
1168 \def\lastcolordefs{}
1169 %
1170 \def\makefootline{%
1171 \baselineskip24pt
1172 \line{\pdfsetcolor{\maincolor}\the\footline}%
1173 }
1174 %
1175 \def\makeheadline{%
1176 \vbox to 0pt{%
1177 \vskip-22.5pt
1178 \line{%
1179 \vbox to8.5pt{}%
1180 % Extract \thiscolor definition from the marks.
1181 \getcolormarks
1182 % Typeset the headline with \maincolor, then restore the color.
1183 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1184 }%
1185 \vss
1186 }%
1187 \nointerlineskip
1188 }
1189 %
1190 %
1191 \pdfcatalog{/PageMode /UseOutlines}
1192 %
1193 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1194 \def\dopdfimage#1#2#3{%
1195 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1196 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1197 %
1198 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1199 % others). Let's try in that order, PDF first since if
1200 % someone has a scalable image, presumably better to use that than a
1201 % bitmap.
1202 \let\pdfimgext=\empty
1203 \begingroup
1204 \openin 1 #1.pdf \ifeof 1
1205 \openin 1 #1.PDF \ifeof 1
1206 \openin 1 #1.png \ifeof 1
1207 \openin 1 #1.jpg \ifeof 1
1208 \openin 1 #1.jpeg \ifeof 1
1209 \openin 1 #1.JPG \ifeof 1
1210 \errhelp = \nopdfimagehelp
1211 \errmessage{Could not find image file #1 for pdf}%
1212 \else \gdef\pdfimgext{JPG}%
1213 \fi
1214 \else \gdef\pdfimgext{jpeg}%
1215 \fi
1216 \else \gdef\pdfimgext{jpg}%
1217 \fi
1218 \else \gdef\pdfimgext{png}%
1219 \fi
1220 \else \gdef\pdfimgext{PDF}%
1221 \fi
1222 \else \gdef\pdfimgext{pdf}%
1223 \fi
1224 \closein 1
1225 \endgroup
1226 %
1227 % without \immediate, ancient pdftex seg faults when the same image is
1228 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1229 \ifnum\pdftexversion < 14
1230 \immediate\pdfimage
1231 \else
1232 \immediate\pdfximage
1233 \fi
1234 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1235 \ifdim \wd2 >0pt height \pdfimageheight \fi
1236 \ifnum\pdftexversion<13
1237 #1.\pdfimgext
1238 \else
1239 {#1.\pdfimgext}%
1240 \fi
1241 \ifnum\pdftexversion < 14 \else
1242 \pdfrefximage \pdflastximage
1243 \fi}
1244 %
1245 \def\pdfmkdest#1{{%
1246 % We have to set dummies so commands such as @code, and characters
1247 % such as \, aren't expanded when present in a section title.
1248 \indexnofonts
1249 \turnoffactive
1250 \makevalueexpandable
1251 \def\pdfdestname{#1}%
1252 \txiescapepdf\pdfdestname
1253 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1254 }}
1255 %
1256 % used to mark target names; must be expandable.
1257 \def\pdfmkpgn#1{#1}
1258 %
1259 % by default, use black for everything.
1260 \def\urlcolor{\rgbBlack}
1261 \def\linkcolor{\rgbBlack}
1262 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1263 %
1264 % Adding outlines to PDF; macros for calculating structure of outlines
1265 % come from Petr Olsak
1266 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1267 \else \csname#1\endcsname \fi}
1268 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1269 \advance\tempnum by 1
1270 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1271 %
1272 % #1 is the section text, which is what will be displayed in the
1273 % outline by the pdf viewer. #2 is the pdf expression for the number
1274 % of subentries (or empty, for subsubsections). #3 is the node text,
1275 % which might be empty if this toc entry had no corresponding node.
1276 % #4 is the page number
1277 %
1278 \def\dopdfoutline#1#2#3#4{%
1279 % Generate a link to the node text if that exists; else, use the
1280 % page number. We could generate a destination for the section
1281 % text in the case where a section has no node, but it doesn't
1282 % seem worth the trouble, since most documents are normally structured.
1283 \edef\pdfoutlinedest{#3}%
1284 \ifx\pdfoutlinedest\empty
1285 \def\pdfoutlinedest{#4}%
1286 \else
1287 \txiescapepdf\pdfoutlinedest
1288 \fi
1289 %
1290 % Also escape PDF chars in the display string.
1291 \edef\pdfoutlinetext{#1}%
1292 \txiescapepdf\pdfoutlinetext
1293 %
1294 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1295 }
1296 %
1297 \def\pdfmakeoutlines{%
1298 \begingroup
1299 % Read toc silently, to get counts of subentries for \pdfoutline.
1300 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1301 \def\numchapentry##1##2##3##4{%
1302 \def\thischapnum{##2}%
1303 \def\thissecnum{0}%
1304 \def\thissubsecnum{0}%
1305 }%
1306 \def\numsecentry##1##2##3##4{%
1307 \advancenumber{chap\thischapnum}%
1308 \def\thissecnum{##2}%
1309 \def\thissubsecnum{0}%
1310 }%
1311 \def\numsubsecentry##1##2##3##4{%
1312 \advancenumber{sec\thissecnum}%
1313 \def\thissubsecnum{##2}%
1314 }%
1315 \def\numsubsubsecentry##1##2##3##4{%
1316 \advancenumber{subsec\thissubsecnum}%
1317 }%
1318 \def\thischapnum{0}%
1319 \def\thissecnum{0}%
1320 \def\thissubsecnum{0}%
1321 %
1322 % use \def rather than \let here because we redefine \chapentry et
1323 % al. a second time, below.
1324 \def\appentry{\numchapentry}%
1325 \def\appsecentry{\numsecentry}%
1326 \def\appsubsecentry{\numsubsecentry}%
1327 \def\appsubsubsecentry{\numsubsubsecentry}%
1328 \def\unnchapentry{\numchapentry}%
1329 \def\unnsecentry{\numsecentry}%
1330 \def\unnsubsecentry{\numsubsecentry}%
1331 \def\unnsubsubsecentry{\numsubsubsecentry}%
1332 \readdatafile{toc}%
1333 %
1334 % Read toc second time, this time actually producing the outlines.
1335 % The `-' means take the \expnumber as the absolute number of
1336 % subentries, which we calculated on our first read of the .toc above.
1337 %
1338 % We use the node names as the destinations.
1339 \def\numchapentry##1##2##3##4{%
1340 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1341 \def\numsecentry##1##2##3##4{%
1342 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1343 \def\numsubsecentry##1##2##3##4{%
1344 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1345 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1346 \dopdfoutline{##1}{}{##3}{##4}}%
1347 %
1348 % PDF outlines are displayed using system fonts, instead of
1349 % document fonts. Therefore we cannot use special characters,
1350 % since the encoding is unknown. For example, the eogonek from
1351 % Latin 2 (0xea) gets translated to a | character. Info from
1352 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1353 %
1354 % TODO this right, we have to translate 8-bit characters to
1355 % their "best" equivalent, based on the @documentencoding. Too
1356 % much work for too little return. Just use the ASCII equivalents
1357 % we use for the index sort strings.
1358 %
1359 \indexnofonts
1360 \setupdatafile
1361 % We can have normal brace characters in the PDF outlines, unlike
1362 % Texinfo index files. So set that up.
1363 \def\{{\lbracecharliteral}%
1364 \def\}{\rbracecharliteral}%
1365 \catcode`\\=\active \otherbackslash
1366 \input \tocreadfilename
1367 \endgroup
1368 }
1369 {\catcode`[=1 \catcode`]=2
1370 \catcode`{=\other \catcode`}=\other
1371 \gdef\lbracecharliteral[{]%
1372 \gdef\rbracecharliteral[}]%
1373 ]
1374 %
1375 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1376 \ifx\PP\D\let\nextsp\relax
1377 \else\let\nextsp\skipspaces
1378 \addtokens{\filename}{\PP}%
1379 \advance\filenamelength by 1
1380 \fi
1381 \nextsp}
1382 \def\getfilename#1{%
1383 \filenamelength=0
1384 % If we don't expand the argument now, \skipspaces will get
1385 % snagged on things like "@value{foo}".
1386 \edef\temp{#1}%
1387 \expandafter\skipspaces\temp|\relax
1388 }
1389 \ifnum\pdftexversion < 14
1390 \let \startlink \pdfannotlink
1391 \else
1392 \let \startlink \pdfstartlink
1393 \fi
1394 % make a live url in pdf output.
1395 \def\pdfurl#1{%
1396 \begingroup
1397 % it seems we really need yet another set of dummies; have not
1398 % tried to figure out what each command should do in the context
1399 % of @url. for now, just make @/ a no-op, that's the only one
1400 % people have actually reported a problem with.
1401 %
1402 \normalturnoffactive
1403 \def\@{@}%
1404 \let\/=\empty
1405 \makevalueexpandable
1406 % do we want to go so far as to use \indexnofonts instead of just
1407 % special-casing \var here?
1408 \def\var##1{##1}%
1409 %
1410 \leavevmode\setcolor{\urlcolor}%
1411 \startlink attr{/Border [0 0 0]}%
1412 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1413 \endgroup}
1414 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1415 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1416 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1417 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1418 \def\maketoks{%
1419 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1420 \ifx\first0\adn0
1421 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1422 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1423 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1424 \else
1425 \ifnum0=\countA\else\makelink\fi
1426 \ifx\first.\let\next=\done\else
1427 \let\next=\maketoks
1428 \addtokens{\toksB}{\the\toksD}
1429 \ifx\first,\addtokens{\toksB}{\space}\fi
1430 \fi
1431 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1432 \next}
1433 \def\makelink{\addtokens{\toksB}%
1434 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1435 \def\pdflink#1{%
1436 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1437 \setcolor{\linkcolor}#1\endlink}
1438 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1439 \else
1440 % non-pdf mode
1441 \let\pdfmkdest = \gobble
1442 \let\pdfurl = \gobble
1443 \let\endlink = \relax
1444 \let\setcolor = \gobble
1445 \let\pdfsetcolor = \gobble
1446 \let\pdfmakeoutlines = \relax
1447 \fi % \ifx\pdfoutput
1448
1449
1450 \message{fonts,}
1451
1452 % Change the current font style to #1, remembering it in \curfontstyle.
1453 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1454 % italics, not bold italics.
1455 %
1456 \def\setfontstyle#1{%
1457 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1458 \csname ten#1\endcsname % change the current font
1459 }
1460
1461 % Select #1 fonts with the current style.
1462 %
1463 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1464
1465 \def\rm{\fam=0 \setfontstyle{rm}}
1466 \def\it{\fam=\itfam \setfontstyle{it}}
1467 \def\sl{\fam=\slfam \setfontstyle{sl}}
1468 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1469 \def\tt{\fam=\ttfam \setfontstyle{tt}}
1470
1471 % Unfortunately, we have to override this for titles and the like, since
1472 % in those cases "rm" is bold. Sigh.
1473 \def\rmisbold{\rm\def\curfontstyle{bf}}
1474
1475 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1476 % So we set up a \sf.
1477 \newfam\sffam
1478 \def\sf{\fam=\sffam \setfontstyle{sf}}
1479 \let\li = \sf % Sometimes we call it \li, not \sf.
1480
1481 % We don't need math for this font style.
1482 \def\ttsl{\setfontstyle{ttsl}}
1483
1484
1485 % Set the baselineskip to #1, and the lineskip and strut size
1486 % correspondingly. There is no deep meaning behind these magic numbers
1487 % used as factors; they just match (closely enough) what Knuth defined.
1488 %
1489 \def\lineskipfactor{.08333}
1490 \def\strutheightpercent{.70833}
1491 \def\strutdepthpercent {.29167}
1492 %
1493 % can get a sort of poor man's double spacing by redefining this.
1494 \def\baselinefactor{1}
1495 %
1496 \newdimen\textleading
1497 \def\setleading#1{%
1498 \dimen0 = #1\relax
1499 \normalbaselineskip = \baselinefactor\dimen0
1500 \normallineskip = \lineskipfactor\normalbaselineskip
1501 \normalbaselines
1502 \setbox\strutbox =\hbox{%
1503 \vrule width0pt height\strutheightpercent\baselineskip
1504 depth \strutdepthpercent \baselineskip
1505 }%
1506 }
1507
1508 % PDF CMaps. See also LaTeX's t1.cmap.
1509 %
1510 % do nothing with this by default.
1511 \expandafter\let\csname cmapOT1\endcsname\gobble
1512 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1513 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1514
1515 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1516 % (\pdffontattr was introduced many years ago, but people still run
1517 % older pdftex's; it's easy to conditionalize, so we do.)
1518 \ifpdf \ifx\pdffontattr\thisisundefined \else
1519 \begingroup
1520 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1521 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1522 %%DocumentNeededResources: ProcSet (CIDInit)
1523 %%IncludeResource: ProcSet (CIDInit)
1524 %%BeginResource: CMap (TeX-OT1-0)
1525 %%Title: (TeX-OT1-0 TeX OT1 0)
1526 %%Version: 1.000
1527 %%EndComments
1528 /CIDInit /ProcSet findresource begin
1529 12 dict begin
1530 begincmap
1531 /CIDSystemInfo
1532 << /Registry (TeX)
1533 /Ordering (OT1)
1534 /Supplement 0
1535 >> def
1536 /CMapName /TeX-OT1-0 def
1537 /CMapType 2 def
1538 1 begincodespacerange
1539 <00> <7F>
1540 endcodespacerange
1541 8 beginbfrange
1542 <00> <01> <0393>
1543 <09> <0A> <03A8>
1544 <23> <26> <0023>
1545 <28> <3B> <0028>
1546 <3F> <5B> <003F>
1547 <5D> <5E> <005D>
1548 <61> <7A> <0061>
1549 <7B> <7C> <2013>
1550 endbfrange
1551 40 beginbfchar
1552 <02> <0398>
1553 <03> <039B>
1554 <04> <039E>
1555 <05> <03A0>
1556 <06> <03A3>
1557 <07> <03D2>
1558 <08> <03A6>
1559 <0B> <00660066>
1560 <0C> <00660069>
1561 <0D> <0066006C>
1562 <0E> <006600660069>
1563 <0F> <00660066006C>
1564 <10> <0131>
1565 <11> <0237>
1566 <12> <0060>
1567 <13> <00B4>
1568 <14> <02C7>
1569 <15> <02D8>
1570 <16> <00AF>
1571 <17> <02DA>
1572 <18> <00B8>
1573 <19> <00DF>
1574 <1A> <00E6>
1575 <1B> <0153>
1576 <1C> <00F8>
1577 <1D> <00C6>
1578 <1E> <0152>
1579 <1F> <00D8>
1580 <21> <0021>
1581 <22> <201D>
1582 <27> <2019>
1583 <3C> <00A1>
1584 <3D> <003D>
1585 <3E> <00BF>
1586 <5C> <201C>
1587 <5F> <02D9>
1588 <60> <2018>
1589 <7D> <02DD>
1590 <7E> <007E>
1591 <7F> <00A8>
1592 endbfchar
1593 endcmap
1594 CMapName currentdict /CMap defineresource pop
1595 end
1596 end
1597 %%EndResource
1598 %%EOF
1599 }\endgroup
1600 \expandafter\edef\csname cmapOT1\endcsname#1{%
1601 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1602 }%
1603 %
1604 % \cmapOT1IT
1605 \begingroup
1606 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1607 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1608 %%DocumentNeededResources: ProcSet (CIDInit)
1609 %%IncludeResource: ProcSet (CIDInit)
1610 %%BeginResource: CMap (TeX-OT1IT-0)
1611 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1612 %%Version: 1.000
1613 %%EndComments
1614 /CIDInit /ProcSet findresource begin
1615 12 dict begin
1616 begincmap
1617 /CIDSystemInfo
1618 << /Registry (TeX)
1619 /Ordering (OT1IT)
1620 /Supplement 0
1621 >> def
1622 /CMapName /TeX-OT1IT-0 def
1623 /CMapType 2 def
1624 1 begincodespacerange
1625 <00> <7F>
1626 endcodespacerange
1627 8 beginbfrange
1628 <00> <01> <0393>
1629 <09> <0A> <03A8>
1630 <25> <26> <0025>
1631 <28> <3B> <0028>
1632 <3F> <5B> <003F>
1633 <5D> <5E> <005D>
1634 <61> <7A> <0061>
1635 <7B> <7C> <2013>
1636 endbfrange
1637 42 beginbfchar
1638 <02> <0398>
1639 <03> <039B>
1640 <04> <039E>
1641 <05> <03A0>
1642 <06> <03A3>
1643 <07> <03D2>
1644 <08> <03A6>
1645 <0B> <00660066>
1646 <0C> <00660069>
1647 <0D> <0066006C>
1648 <0E> <006600660069>
1649 <0F> <00660066006C>
1650 <10> <0131>
1651 <11> <0237>
1652 <12> <0060>
1653 <13> <00B4>
1654 <14> <02C7>
1655 <15> <02D8>
1656 <16> <00AF>
1657 <17> <02DA>
1658 <18> <00B8>
1659 <19> <00DF>
1660 <1A> <00E6>
1661 <1B> <0153>
1662 <1C> <00F8>
1663 <1D> <00C6>
1664 <1E> <0152>
1665 <1F> <00D8>
1666 <21> <0021>
1667 <22> <201D>
1668 <23> <0023>
1669 <24> <00A3>
1670 <27> <2019>
1671 <3C> <00A1>
1672 <3D> <003D>
1673 <3E> <00BF>
1674 <5C> <201C>
1675 <5F> <02D9>
1676 <60> <2018>
1677 <7D> <02DD>
1678 <7E> <007E>
1679 <7F> <00A8>
1680 endbfchar
1681 endcmap
1682 CMapName currentdict /CMap defineresource pop
1683 end
1684 end
1685 %%EndResource
1686 %%EOF
1687 }\endgroup
1688 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1689 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1690 }%
1691 %
1692 % \cmapOT1TT
1693 \begingroup
1694 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1695 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1696 %%DocumentNeededResources: ProcSet (CIDInit)
1697 %%IncludeResource: ProcSet (CIDInit)
1698 %%BeginResource: CMap (TeX-OT1TT-0)
1699 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1700 %%Version: 1.000
1701 %%EndComments
1702 /CIDInit /ProcSet findresource begin
1703 12 dict begin
1704 begincmap
1705 /CIDSystemInfo
1706 << /Registry (TeX)
1707 /Ordering (OT1TT)
1708 /Supplement 0
1709 >> def
1710 /CMapName /TeX-OT1TT-0 def
1711 /CMapType 2 def
1712 1 begincodespacerange
1713 <00> <7F>
1714 endcodespacerange
1715 5 beginbfrange
1716 <00> <01> <0393>
1717 <09> <0A> <03A8>
1718 <21> <26> <0021>
1719 <28> <5F> <0028>
1720 <61> <7E> <0061>
1721 endbfrange
1722 32 beginbfchar
1723 <02> <0398>
1724 <03> <039B>
1725 <04> <039E>
1726 <05> <03A0>
1727 <06> <03A3>
1728 <07> <03D2>
1729 <08> <03A6>
1730 <0B> <2191>
1731 <0C> <2193>
1732 <0D> <0027>
1733 <0E> <00A1>
1734 <0F> <00BF>
1735 <10> <0131>
1736 <11> <0237>
1737 <12> <0060>
1738 <13> <00B4>
1739 <14> <02C7>
1740 <15> <02D8>
1741 <16> <00AF>
1742 <17> <02DA>
1743 <18> <00B8>
1744 <19> <00DF>
1745 <1A> <00E6>
1746 <1B> <0153>
1747 <1C> <00F8>
1748 <1D> <00C6>
1749 <1E> <0152>
1750 <1F> <00D8>
1751 <20> <2423>
1752 <27> <2019>
1753 <60> <2018>
1754 <7F> <00A8>
1755 endbfchar
1756 endcmap
1757 CMapName currentdict /CMap defineresource pop
1758 end
1759 end
1760 %%EndResource
1761 %%EOF
1762 }\endgroup
1763 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1764 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1765 }%
1766 \fi\fi
1767
1768
1769 % Set the font macro #1 to the font named \fontprefix#2.
1770 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1771 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
1772 % Example:
1773 % #1 = \textrm
1774 % #2 = \rmshape
1775 % #3 = 10
1776 % #4 = \mainmagstep
1777 % #5 = OT1
1778 %
1779 \def\setfont#1#2#3#4#5{%
1780 \font#1=\fontprefix#2#3 scaled #4
1781 \csname cmap#5\endcsname#1%
1782 }
1783 % This is what gets called when #5 of \setfont is empty.
1784 \let\cmap\gobble
1785 %
1786 % (end of cmaps)
1787
1788 % Use cm as the default font prefix.
1789 % To specify the font prefix, you must define \fontprefix
1790 % before you read in texinfo.tex.
1791 \ifx\fontprefix\thisisundefined
1792 \def\fontprefix{cm}
1793 \fi
1794 % Support font families that don't use the same naming scheme as CM.
1795 \def\rmshape{r}
1796 \def\rmbshape{bx} % where the normal face is bold
1797 \def\bfshape{b}
1798 \def\bxshape{bx}
1799 \def\ttshape{tt}
1800 \def\ttbshape{tt}
1801 \def\ttslshape{sltt}
1802 \def\itshape{ti}
1803 \def\itbshape{bxti}
1804 \def\slshape{sl}
1805 \def\slbshape{bxsl}
1806 \def\sfshape{ss}
1807 \def\sfbshape{ss}
1808 \def\scshape{csc}
1809 \def\scbshape{csc}
1810
1811 % Definitions for a main text size of 11pt. (The default in Texinfo.)
1812 %
1813 \def\definetextfontsizexi{%
1814 % Text fonts (11.2pt, magstep1).
1815 \def\textnominalsize{11pt}
1816 \edef\mainmagstep{\magstephalf}
1817 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1818 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1819 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1820 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1821 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1822 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1823 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1824 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1825 \font\texti=cmmi10 scaled \mainmagstep
1826 \font\textsy=cmsy10 scaled \mainmagstep
1827 \def\textecsize{1095}
1828
1829 % A few fonts for @defun names and args.
1830 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
1831 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1832 \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
1833 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1834 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
1835 \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
1836
1837 % Fonts for indices, footnotes, small examples (9pt).
1838 \def\smallnominalsize{9pt}
1839 \setfont\smallrm\rmshape{9}{1000}{OT1}
1840 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1841 \setfont\smallbf\bfshape{10}{900}{OT1}
1842 \setfont\smallit\itshape{9}{1000}{OT1IT}
1843 \setfont\smallsl\slshape{9}{1000}{OT1}
1844 \setfont\smallsf\sfshape{9}{1000}{OT1}
1845 \setfont\smallsc\scshape{10}{900}{OT1}
1846 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1847 \font\smalli=cmmi9
1848 \font\smallsy=cmsy9
1849 \def\smallecsize{0900}
1850
1851 % Fonts for small examples (8pt).
1852 \def\smallernominalsize{8pt}
1853 \setfont\smallerrm\rmshape{8}{1000}{OT1}
1854 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
1855 \setfont\smallerbf\bfshape{10}{800}{OT1}
1856 \setfont\smallerit\itshape{8}{1000}{OT1IT}
1857 \setfont\smallersl\slshape{8}{1000}{OT1}
1858 \setfont\smallersf\sfshape{8}{1000}{OT1}
1859 \setfont\smallersc\scshape{10}{800}{OT1}
1860 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1861 \font\smalleri=cmmi8
1862 \font\smallersy=cmsy8
1863 \def\smallerecsize{0800}
1864
1865 % Fonts for title page (20.4pt):
1866 \def\titlenominalsize{20pt}
1867 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1868 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1869 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1870 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1871 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1872 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1873 \let\titlebf=\titlerm
1874 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1875 \font\titlei=cmmi12 scaled \magstep3
1876 \font\titlesy=cmsy10 scaled \magstep4
1877 \def\titleecsize{2074}
1878
1879 % Chapter (and unnumbered) fonts (17.28pt).
1880 \def\chapnominalsize{17pt}
1881 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
1882 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
1883 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
1884 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
1885 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
1886 \setfont\chapsf\sfbshape{17}{1000}{OT1}
1887 \let\chapbf=\chaprm
1888 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
1889 \font\chapi=cmmi12 scaled \magstep2
1890 \font\chapsy=cmsy10 scaled \magstep3
1891 \def\chapecsize{1728}
1892
1893 % Section fonts (14.4pt).
1894 \def\secnominalsize{14pt}
1895 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
1896 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
1897 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
1898 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
1899 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
1900 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
1901 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
1902 \let\secbf\secrm
1903 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
1904 \font\seci=cmmi12 scaled \magstep1
1905 \font\secsy=cmsy10 scaled \magstep2
1906 \def\sececsize{1440}
1907
1908 % Subsection fonts (13.15pt).
1909 \def\ssecnominalsize{13pt}
1910 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
1911 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
1912 \setfont\ssecsl\slbshape{10}{1315}{OT1}
1913 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
1914 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
1915 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
1916 \let\ssecbf\ssecrm
1917 \setfont\ssecsc\scbshape{10}{1315}{OT1}
1918 \font\sseci=cmmi12 scaled \magstephalf
1919 \font\ssecsy=cmsy10 scaled 1315
1920 \def\ssececsize{1200}
1921
1922 % Reduced fonts for @acro in text (10pt).
1923 \def\reducednominalsize{10pt}
1924 \setfont\reducedrm\rmshape{10}{1000}{OT1}
1925 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
1926 \setfont\reducedbf\bfshape{10}{1000}{OT1}
1927 \setfont\reducedit\itshape{10}{1000}{OT1IT}
1928 \setfont\reducedsl\slshape{10}{1000}{OT1}
1929 \setfont\reducedsf\sfshape{10}{1000}{OT1}
1930 \setfont\reducedsc\scshape{10}{1000}{OT1}
1931 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
1932 \font\reducedi=cmmi10
1933 \font\reducedsy=cmsy10
1934 \def\reducedecsize{1000}
1935
1936 \textleading = 13.2pt % line spacing for 11pt CM
1937 \textfonts % reset the current fonts
1938 \rm
1939 } % end of 11pt text font size definitions, \definetextfontsizexi
1940
1941
1942 % Definitions to make the main text be 10pt Computer Modern, with
1943 % section, chapter, etc., sizes following suit. This is for the GNU
1944 % Press printing of the Emacs 22 manual. Maybe other manuals in the
1945 % future. Used with @smallbook, which sets the leading to 12pt.
1946 %
1947 \def\definetextfontsizex{%
1948 % Text fonts (10pt).
1949 \def\textnominalsize{10pt}
1950 \edef\mainmagstep{1000}
1951 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1952 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1953 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1954 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1955 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1956 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1957 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1958 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1959 \font\texti=cmmi10 scaled \mainmagstep
1960 \font\textsy=cmsy10 scaled \mainmagstep
1961 \def\textecsize{1000}
1962
1963 % A few fonts for @defun names and args.
1964 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
1965 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
1966 \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
1967 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
1968 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
1969 \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
1970
1971 % Fonts for indices, footnotes, small examples (9pt).
1972 \def\smallnominalsize{9pt}
1973 \setfont\smallrm\rmshape{9}{1000}{OT1}
1974 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1975 \setfont\smallbf\bfshape{10}{900}{OT1}
1976 \setfont\smallit\itshape{9}{1000}{OT1IT}
1977 \setfont\smallsl\slshape{9}{1000}{OT1}
1978 \setfont\smallsf\sfshape{9}{1000}{OT1}
1979 \setfont\smallsc\scshape{10}{900}{OT1}
1980 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1981 \font\smalli=cmmi9
1982 \font\smallsy=cmsy9
1983 \def\smallecsize{0900}
1984
1985 % Fonts for small examples (8pt).
1986 \def\smallernominalsize{8pt}
1987 \setfont\smallerrm\rmshape{8}{1000}{OT1}
1988 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
1989 \setfont\smallerbf\bfshape{10}{800}{OT1}
1990 \setfont\smallerit\itshape{8}{1000}{OT1IT}
1991 \setfont\smallersl\slshape{8}{1000}{OT1}
1992 \setfont\smallersf\sfshape{8}{1000}{OT1}
1993 \setfont\smallersc\scshape{10}{800}{OT1}
1994 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1995 \font\smalleri=cmmi8
1996 \font\smallersy=cmsy8
1997 \def\smallerecsize{0800}
1998
1999 % Fonts for title page (20.4pt):
2000 \def\titlenominalsize{20pt}
2001 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2002 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2003 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2004 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2005 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2006 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2007 \let\titlebf=\titlerm
2008 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2009 \font\titlei=cmmi12 scaled \magstep3
2010 \font\titlesy=cmsy10 scaled \magstep4
2011 \def\titleecsize{2074}
2012
2013 % Chapter fonts (14.4pt).
2014 \def\chapnominalsize{14pt}
2015 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2016 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2017 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2018 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2019 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2020 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2021 \let\chapbf\chaprm
2022 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2023 \font\chapi=cmmi12 scaled \magstep1
2024 \font\chapsy=cmsy10 scaled \magstep2
2025 \def\chapecsize{1440}
2026
2027 % Section fonts (12pt).
2028 \def\secnominalsize{12pt}
2029 \setfont\secrm\rmbshape{12}{1000}{OT1}
2030 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2031 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2032 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2033 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2034 \setfont\secsf\sfbshape{12}{1000}{OT1}
2035 \let\secbf\secrm
2036 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2037 \font\seci=cmmi12
2038 \font\secsy=cmsy10 scaled \magstep1
2039 \def\sececsize{1200}
2040
2041 % Subsection fonts (10pt).
2042 \def\ssecnominalsize{10pt}
2043 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2044 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2045 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2046 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2047 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2048 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2049 \let\ssecbf\ssecrm
2050 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2051 \font\sseci=cmmi10
2052 \font\ssecsy=cmsy10
2053 \def\ssececsize{1000}
2054
2055 % Reduced fonts for @acro in text (9pt).
2056 \def\reducednominalsize{9pt}
2057 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2058 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2059 \setfont\reducedbf\bfshape{10}{900}{OT1}
2060 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2061 \setfont\reducedsl\slshape{9}{1000}{OT1}
2062 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2063 \setfont\reducedsc\scshape{10}{900}{OT1}
2064 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2065 \font\reducedi=cmmi9
2066 \font\reducedsy=cmsy9
2067 \def\reducedecsize{0900}
2068
2069 \divide\parskip by 2 % reduce space between paragraphs
2070 \textleading = 12pt % line spacing for 10pt CM
2071 \textfonts % reset the current fonts
2072 \rm
2073 } % end of 10pt text font size definitions, \definetextfontsizex
2074
2075
2076 % We provide the user-level command
2077 % @fonttextsize 10
2078 % (or 11) to redefine the text font size. pt is assumed.
2079 %
2080 \def\xiword{11}
2081 \def\xword{10}
2082 \def\xwordpt{10pt}
2083 %
2084 \parseargdef\fonttextsize{%
2085 \def\textsizearg{#1}%
2086 %\wlog{doing @fonttextsize \textsizearg}%
2087 %
2088 % Set \globaldefs so that documents can use this inside @tex, since
2089 % makeinfo 4.8 does not support it, but we need it nonetheless.
2090 %
2091 \begingroup \globaldefs=1
2092 \ifx\textsizearg\xword \definetextfontsizex
2093 \else \ifx\textsizearg\xiword \definetextfontsizexi
2094 \else
2095 \errhelp=\EMsimple
2096 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2097 \fi\fi
2098 \endgroup
2099 }
2100
2101 % In order for the font changes to affect most math symbols and letters,
2102 % we have to define the \textfont of the standard families. We don't
2103 % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
2104 %
2105 \def\resetmathfonts{%
2106 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2107 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2108 \textfont\ttfam=\tentt \textfont\sffam=\tensf
2109 }
2110
2111 % The font-changing commands redefine the meanings of \tenSTYLE, instead
2112 % of just \STYLE. We do this because \STYLE needs to also set the
2113 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2114 % \tenSTYLE to set the current font.
2115 %
2116 % Each font-changing command also sets the names \lsize (one size lower)
2117 % and \lllsize (three sizes lower). These relative commands are used
2118 % in, e.g., the LaTeX logo and acronyms.
2119 %
2120 % This all needs generalizing, badly.
2121 %
2122 \def\textfonts{%
2123 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2124 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2125 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2126 \let\tenttsl=\textttsl
2127 \def\curfontsize{text}%
2128 \def\lsize{reduced}\def\lllsize{smaller}%
2129 \resetmathfonts \setleading{\textleading}}
2130 \def\titlefonts{%
2131 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2132 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2133 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2134 \let\tenttsl=\titlettsl
2135 \def\curfontsize{title}%
2136 \def\lsize{chap}\def\lllsize{subsec}%
2137 \resetmathfonts \setleading{27pt}}
2138 \def\titlefont#1{{\titlefonts\rmisbold #1}}
2139 \def\chapfonts{%
2140 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2141 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2142 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2143 \let\tenttsl=\chapttsl
2144 \def\curfontsize{chap}%
2145 \def\lsize{sec}\def\lllsize{text}%
2146 \resetmathfonts \setleading{19pt}}
2147 \def\secfonts{%
2148 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2149 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2150 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2151 \let\tenttsl=\secttsl
2152 \def\curfontsize{sec}%
2153 \def\lsize{subsec}\def\lllsize{reduced}%
2154 \resetmathfonts \setleading{17pt}}
2155 \def\subsecfonts{%
2156 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2157 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2158 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2159 \let\tenttsl=\ssecttsl
2160 \def\curfontsize{ssec}%
2161 \def\lsize{text}\def\lllsize{small}%
2162 \resetmathfonts \setleading{15pt}}
2163 \let\subsubsecfonts = \subsecfonts
2164 \def\reducedfonts{%
2165 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2166 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2167 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2168 \let\tenttsl=\reducedttsl
2169 \def\curfontsize{reduced}%
2170 \def\lsize{small}\def\lllsize{smaller}%
2171 \resetmathfonts \setleading{10.5pt}}
2172 \def\smallfonts{%
2173 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2174 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2175 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2176 \let\tenttsl=\smallttsl
2177 \def\curfontsize{small}%
2178 \def\lsize{smaller}\def\lllsize{smaller}%
2179 \resetmathfonts \setleading{10.5pt}}
2180 \def\smallerfonts{%
2181 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2182 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2183 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2184 \let\tenttsl=\smallerttsl
2185 \def\curfontsize{smaller}%
2186 \def\lsize{smaller}\def\lllsize{smaller}%
2187 \resetmathfonts \setleading{9.5pt}}
2188
2189 % Fonts for short table of contents.
2190 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2191 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2192 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2193 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2194
2195 % Define these just so they can be easily changed for other fonts.
2196 \def\angleleft{$\langle$}
2197 \def\angleright{$\rangle$}
2198
2199 % Set the fonts to use with the @small... environments.
2200 \let\smallexamplefonts = \smallfonts
2201
2202 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2203 % can fit this many characters:
2204 % 8.5x11=86 smallbook=72 a4=90 a5=69
2205 % If we use \scriptfonts (8pt), then we can fit this many characters:
2206 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2207 % For me, subjectively, the few extra characters that fit aren't worth
2208 % the additional smallness of 8pt. So I'm making the default 9pt.
2209 %
2210 % By the way, for comparison, here's what fits with @example (10pt):
2211 % 8.5x11=71 smallbook=60 a4=75 a5=58
2212 % --karl, 24jan03.
2213
2214 % Set up the default fonts, so we can use them for creating boxes.
2215 %
2216 \definetextfontsizexi
2217
2218
2219 \message{markup,}
2220
2221 % Check if we are currently using a typewriter font. Since all the
2222 % Computer Modern typewriter fonts have zero interword stretch (and
2223 % shrink), and it is reasonable to expect all typewriter fonts to have
2224 % this property, we can check that font parameter.
2225 %
2226 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2227
2228 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2229 % define and register \INITMACRO to be called on markup style changes.
2230 % \INITMACRO can check \currentmarkupstyle for the innermost
2231 % style and the set of \ifmarkupSTYLE switches for all styles
2232 % currently in effect.
2233 \newif\ifmarkupvar
2234 \newif\ifmarkupsamp
2235 \newif\ifmarkupkey
2236 %\newif\ifmarkupfile % @file == @samp.
2237 %\newif\ifmarkupoption % @option == @samp.
2238 \newif\ifmarkupcode
2239 \newif\ifmarkupkbd
2240 %\newif\ifmarkupenv % @env == @code.
2241 %\newif\ifmarkupcommand % @command == @code.
2242 \newif\ifmarkuptex % @tex (and part of @math, for now).
2243 \newif\ifmarkupexample
2244 \newif\ifmarkupverb
2245 \newif\ifmarkupverbatim
2246
2247 \let\currentmarkupstyle\empty
2248
2249 \def\setupmarkupstyle#1{%
2250 \csname markup#1true\endcsname
2251 \def\currentmarkupstyle{#1}%
2252 \markupstylesetup
2253 }
2254
2255 \let\markupstylesetup\empty
2256
2257 \def\defmarkupstylesetup#1{%
2258 \expandafter\def\expandafter\markupstylesetup
2259 \expandafter{\markupstylesetup #1}%
2260 \def#1%
2261 }
2262
2263 % Markup style setup for left and right quotes.
2264 \defmarkupstylesetup\markupsetuplq{%
2265 \expandafter\let\expandafter \temp
2266 \csname markupsetuplq\currentmarkupstyle\endcsname
2267 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2268 }
2269
2270 \defmarkupstylesetup\markupsetuprq{%
2271 \expandafter\let\expandafter \temp
2272 \csname markupsetuprq\currentmarkupstyle\endcsname
2273 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2274 }
2275
2276 {
2277 \catcode`\'=\active
2278 \catcode`\`=\active
2279
2280 \gdef\markupsetuplqdefault{\let`\lq}
2281 \gdef\markupsetuprqdefault{\let'\rq}
2282
2283 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2284 \gdef\markupsetcodequoteright{\let'\codequoteright}
2285 }
2286
2287 \let\markupsetuplqcode \markupsetcodequoteleft
2288 \let\markupsetuprqcode \markupsetcodequoteright
2289 %
2290 \let\markupsetuplqexample \markupsetcodequoteleft
2291 \let\markupsetuprqexample \markupsetcodequoteright
2292 %
2293 \let\markupsetuplqkbd \markupsetcodequoteleft
2294 \let\markupsetuprqkbd \markupsetcodequoteright
2295 %
2296 \let\markupsetuplqsamp \markupsetcodequoteleft
2297 \let\markupsetuprqsamp \markupsetcodequoteright
2298 %
2299 \let\markupsetuplqverb \markupsetcodequoteleft
2300 \let\markupsetuprqverb \markupsetcodequoteright
2301 %
2302 \let\markupsetuplqverbatim \markupsetcodequoteleft
2303 \let\markupsetuprqverbatim \markupsetcodequoteright
2304
2305 % Allow an option to not use regular directed right quote/apostrophe
2306 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2307 % The undirected quote is ugly, so don't make it the default, but it
2308 % works for pasting with more pdf viewers (at least evince), the
2309 % lilypond developers report. xpdf does work with the regular 0x27.
2310 %
2311 \def\codequoteright{%
2312 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2313 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2314 '%
2315 \else \char'15 \fi
2316 \else \char'15 \fi
2317 }
2318 %
2319 % and a similar option for the left quote char vs. a grave accent.
2320 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2321 % the code environments to do likewise.
2322 %
2323 \def\codequoteleft{%
2324 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2325 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2326 % [Knuth] pp. 380,381,391
2327 % \relax disables Spanish ligatures ?` and !` of \tt font.
2328 \relax`%
2329 \else \char'22 \fi
2330 \else \char'22 \fi
2331 }
2332
2333 % Commands to set the quote options.
2334 %
2335 \parseargdef\codequoteundirected{%
2336 \def\temp{#1}%
2337 \ifx\temp\onword
2338 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2339 = t%
2340 \else\ifx\temp\offword
2341 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2342 = \relax
2343 \else
2344 \errhelp = \EMsimple
2345 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2346 \fi\fi
2347 }
2348 %
2349 \parseargdef\codequotebacktick{%
2350 \def\temp{#1}%
2351 \ifx\temp\onword
2352 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2353 = t%
2354 \else\ifx\temp\offword
2355 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2356 = \relax
2357 \else
2358 \errhelp = \EMsimple
2359 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2360 \fi\fi
2361 }
2362
2363 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2364 \def\noligaturesquoteleft{\relax\lq}
2365
2366 % Count depth in font-changes, for error checks
2367 \newcount\fontdepth \fontdepth=0
2368
2369 % Font commands.
2370
2371 % #1 is the font command (\sl or \it), #2 is the text to slant.
2372 % If we are in a monospaced environment, however, 1) always use \ttsl,
2373 % and 2) do not add an italic correction.
2374 \def\dosmartslant#1#2{%
2375 \ifusingtt
2376 {{\ttsl #2}\let\next=\relax}%
2377 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2378 \next
2379 }
2380 \def\smartslanted{\dosmartslant\sl}
2381 \def\smartitalic{\dosmartslant\it}
2382
2383 % Output an italic correction unless \next (presumed to be the following
2384 % character) is such as not to need one.
2385 \def\smartitaliccorrection{%
2386 \ifx\next,%
2387 \else\ifx\next-%
2388 \else\ifx\next.%
2389 \else\ifx\next\.%
2390 \else\ifx\next\comma%
2391 \else\ptexslash
2392 \fi\fi\fi\fi\fi
2393 \aftersmartic
2394 }
2395
2396 % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2397 \def\ttslanted#1{{\ttsl #1}}
2398
2399 % @cite is like \smartslanted except unconditionally use \sl. We never want
2400 % ttsl for book titles, do we?
2401 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2402
2403 \def\aftersmartic{}
2404 \def\var#1{%
2405 \let\saveaftersmartic = \aftersmartic
2406 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2407 \smartslanted{#1}%
2408 }
2409
2410 \let\i=\smartitalic
2411 \let\slanted=\smartslanted
2412 \let\dfn=\smartslanted
2413 \let\emph=\smartitalic
2414
2415 % Explicit font changes: @r, @sc, undocumented @ii.
2416 \def\r#1{{\rm #1}} % roman font
2417 \def\sc#1{{\smallcaps#1}} % smallcaps font
2418 \def\ii#1{{\it #1}} % italic font
2419
2420 % @b, explicit bold. Also @strong.
2421 \def\b#1{{\bf #1}}
2422 \let\strong=\b
2423
2424 % @sansserif, explicit sans.
2425 \def\sansserif#1{{\sf #1}}
2426
2427 % We can't just use \exhyphenpenalty, because that only has effect at
2428 % the end of a paragraph. Restore normal hyphenation at the end of the
2429 % group within which \nohyphenation is presumably called.
2430 %
2431 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2432 \def\restorehyphenation{\hyphenchar\font = `- }
2433
2434 % Set sfcode to normal for the chars that usually have another value.
2435 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2436 % sometimes \x has an active definition that messes things up.
2437 %
2438 \catcode`@=11
2439 \def\plainfrenchspacing{%
2440 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2441 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2442 \def\endofsentencespacefactor{1000}% for @. and friends
2443 }
2444 \def\plainnonfrenchspacing{%
2445 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2446 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2447 \def\endofsentencespacefactor{3000}% for @. and friends
2448 }
2449 \catcode`@=\other
2450 \def\endofsentencespacefactor{3000}% default
2451
2452 % @t, explicit typewriter.
2453 \def\t#1{%
2454 {\tt \rawbackslash \plainfrenchspacing #1}%
2455 \null
2456 }
2457
2458 % @samp.
2459 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2460
2461 % @indicateurl is \samp, that is, with quotes.
2462 \let\indicateurl=\samp
2463
2464 % @code (and similar) prints in typewriter, but with spaces the same
2465 % size as normal in the surrounding text, without hyphenation, etc.
2466 % This is a subroutine for that.
2467 \def\tclose#1{%
2468 {%
2469 % Change normal interword space to be same as for the current font.
2470 \spaceskip = \fontdimen2\font
2471 %
2472 % Switch to typewriter.
2473 \tt
2474 %
2475 % But `\ ' produces the large typewriter interword space.
2476 \def\ {{\spaceskip = 0pt{} }}%
2477 %
2478 % Turn off hyphenation.
2479 \nohyphenation
2480 %
2481 \rawbackslash
2482 \plainfrenchspacing
2483 #1%
2484 }%
2485 \null % reset spacefactor to 1000
2486 }
2487
2488 % We *must* turn on hyphenation at `-' and `_' in @code.
2489 % (But see \codedashfinish below.)
2490 % Otherwise, it is too hard to avoid overfull hboxes
2491 % in the Emacs manual, the Library manual, etc.
2492 %
2493 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2494 % both hyphenation at - and hyphenation within words.
2495 % We must therefore turn them both off (\tclose does that)
2496 % and arrange explicitly to hyphenate at a dash. -- rms.
2497 {
2498 \catcode`\-=\active \catcode`\_=\active
2499 \catcode`\'=\active \catcode`\`=\active
2500 \global\let'=\rq \global\let`=\lq % default definitions
2501 %
2502 \global\def\code{\begingroup
2503 \setupmarkupstyle{code}%
2504 % The following should really be moved into \setupmarkupstyle handlers.
2505 \catcode\dashChar=\active \catcode\underChar=\active
2506 \ifallowcodebreaks
2507 \let-\codedash
2508 \let_\codeunder
2509 \else
2510 \let-\normaldash
2511 \let_\realunder
2512 \fi
2513 % Given -foo (with a single dash), we do not want to allow a break
2514 % after the hyphen.
2515 \global\let\codedashprev=\codedash
2516 %
2517 \codex
2518 }
2519 %
2520 \gdef\codedash{\futurelet\next\codedashfinish}
2521 \gdef\codedashfinish{%
2522 \normaldash % always output the dash character itself.
2523 %
2524 % Now, output a discretionary to allow a line break, unless
2525 % (a) the next character is a -, or
2526 % (b) the preceding character is a -.
2527 % E.g., given --posix, we do not want to allow a break after either -.
2528 % Given --foo-bar, we do want to allow a break between the - and the b.
2529 \ifx\next\codedash \else
2530 \ifx\codedashprev\codedash
2531 \else \discretionary{}{}{}\fi
2532 \fi
2533 % we need the space after the = for the case when \next itself is a
2534 % space token; it would get swallowed otherwise. As in @code{- a}.
2535 \global\let\codedashprev= \next
2536 }
2537 }
2538 \def\normaldash{-}
2539 %
2540 \def\codex #1{\tclose{#1}\endgroup}
2541
2542 \def\codeunder{%
2543 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2544 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2545 % will therefore expand the active definition of _, which is us
2546 % (inside @code that is), therefore an endless loop.
2547 \ifusingtt{\ifmmode
2548 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2549 \else\normalunderscore \fi
2550 \discretionary{}{}{}}%
2551 {\_}%
2552 }
2553
2554 % An additional complication: the above will allow breaks after, e.g.,
2555 % each of the four underscores in __typeof__. This is bad.
2556 % @allowcodebreaks provides a document-level way to turn breaking at -
2557 % and _ on and off.
2558 %
2559 \newif\ifallowcodebreaks \allowcodebreakstrue
2560
2561 \def\keywordtrue{true}
2562 \def\keywordfalse{false}
2563
2564 \parseargdef\allowcodebreaks{%
2565 \def\txiarg{#1}%
2566 \ifx\txiarg\keywordtrue
2567 \allowcodebreakstrue
2568 \else\ifx\txiarg\keywordfalse
2569 \allowcodebreaksfalse
2570 \else
2571 \errhelp = \EMsimple
2572 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2573 \fi\fi
2574 }
2575
2576 % For @command, @env, @file, @option quotes seem unnecessary,
2577 % so use \code rather than \samp.
2578 \let\command=\code
2579 \let\env=\code
2580 \let\file=\code
2581 \let\option=\code
2582
2583 % @uref (abbreviation for `urlref') aka @url takes an optional
2584 % (comma-separated) second argument specifying the text to display and
2585 % an optional third arg as text to display instead of (rather than in
2586 % addition to) the url itself. First (mandatory) arg is the url.
2587
2588 % TeX-only option to allow changing PDF output to show only the second
2589 % arg (if given), and not the url (which is then just the link target).
2590 \newif\ifurefurlonlylink
2591
2592 % The main macro is \urefbreak, which allows breaking at expected
2593 % places within the url. (There used to be another version, which
2594 % didn't support automatic breaking.)
2595 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2596 \let\uref=\urefbreak
2597 %
2598 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2599 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2600 \unsepspaces
2601 \pdfurl{#1}%
2602 \setbox0 = \hbox{\ignorespaces #3}%
2603 \ifdim\wd0 > 0pt
2604 \unhbox0 % third arg given, show only that
2605 \else
2606 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
2607 \ifdim\wd0 > 0pt
2608 \ifpdf
2609 \ifurefurlonlylink
2610 % PDF plus option to not display url, show just arg
2611 \unhbox0
2612 \else
2613 % PDF, normally display both arg and url for consistency,
2614 % visibility, if the pdf is eventually used to print, etc.
2615 \unhbox0\ (\urefcode{#1})%
2616 \fi
2617 \else
2618 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
2619 \fi
2620 \else
2621 \urefcode{#1}% only url given, so show it
2622 \fi
2623 \fi
2624 \endlink
2625 \endgroup}
2626
2627 % Allow line breaks around only a few characters (only).
2628 \def\urefcatcodes{%
2629 \catcode`\&=\active \catcode`\.=\active
2630 \catcode`\#=\active \catcode`\?=\active
2631 \catcode`\/=\active
2632 }
2633 {
2634 \urefcatcodes
2635 %
2636 \global\def\urefcode{\begingroup
2637 \setupmarkupstyle{code}%
2638 \urefcatcodes
2639 \let&\urefcodeamp
2640 \let.\urefcodedot
2641 \let#\urefcodehash
2642 \let?\urefcodequest
2643 \let/\urefcodeslash
2644 \codex
2645 }
2646 %
2647 % By default, they are just regular characters.
2648 \global\def&{\normalamp}
2649 \global\def.{\normaldot}
2650 \global\def#{\normalhash}
2651 \global\def?{\normalquest}
2652 \global\def/{\normalslash}
2653 }
2654
2655 % we put a little stretch before and after the breakable chars, to help
2656 % line breaking of long url's. The unequal skips make look better in
2657 % cmtt at least, especially for dots.
2658 \def\urefprestretchamount{.13em}
2659 \def\urefpoststretchamount{.1em}
2660 \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
2661 \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
2662 %
2663 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2664 \def\urefcodedot{\urefprestretch .\urefpoststretch}
2665 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
2666 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
2667 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2668 {
2669 \catcode`\/=\active
2670 \global\def\urefcodeslashfinish{%
2671 \urefprestretch \slashChar
2672 % Allow line break only after the final / in a sequence of
2673 % slashes, to avoid line break between the slashes in http://.
2674 \ifx\next/\else \urefpoststretch \fi
2675 }
2676 }
2677
2678 % One more complication: by default we'll break after the special
2679 % characters, but some people like to break before the special chars, so
2680 % allow that. Also allow no breaking at all, for manual control.
2681 %
2682 \parseargdef\urefbreakstyle{%
2683 \def\txiarg{#1}%
2684 \ifx\txiarg\wordnone
2685 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2686 \else\ifx\txiarg\wordbefore
2687 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2688 \else\ifx\txiarg\wordafter
2689 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2690 \else
2691 \errhelp = \EMsimple
2692 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2693 \fi\fi\fi
2694 }
2695 \def\wordafter{after}
2696 \def\wordbefore{before}
2697 \def\wordnone{none}
2698
2699 \urefbreakstyle after
2700
2701 % @url synonym for @uref, since that's how everyone uses it.
2702 %
2703 \let\url=\uref
2704
2705 % rms does not like angle brackets --karl, 17may97.
2706 % So now @email is just like @uref, unless we are pdf.
2707 %
2708 %\def\email#1{\angleleft{\tt #1}\angleright}
2709 \ifpdf
2710 \def\email#1{\doemail#1,,\finish}
2711 \def\doemail#1,#2,#3\finish{\begingroup
2712 \unsepspaces
2713 \pdfurl{mailto:#1}%
2714 \setbox0 = \hbox{\ignorespaces #2}%
2715 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2716 \endlink
2717 \endgroup}
2718 \else
2719 \let\email=\uref
2720 \fi
2721
2722 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2723 % `example' (@kbd uses ttsl only inside of @example and friends),
2724 % or `code' (@kbd uses normal tty font always).
2725 \parseargdef\kbdinputstyle{%
2726 \def\txiarg{#1}%
2727 \ifx\txiarg\worddistinct
2728 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2729 \else\ifx\txiarg\wordexample
2730 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2731 \else\ifx\txiarg\wordcode
2732 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2733 \else
2734 \errhelp = \EMsimple
2735 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2736 \fi\fi\fi
2737 }
2738 \def\worddistinct{distinct}
2739 \def\wordexample{example}
2740 \def\wordcode{code}
2741
2742 % Default is `distinct'.
2743 \kbdinputstyle distinct
2744
2745 % @kbd is like @code, except that if the argument is just one @key command,
2746 % then @kbd has no effect.
2747 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
2748
2749 \def\xkey{\key}
2750 \def\kbdsub#1#2#3\par{%
2751 \def\one{#1}\def\three{#3}\def\threex{??}%
2752 \ifx\one\xkey\ifx\threex\three \key{#2}%
2753 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2754 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2755 }
2756
2757 % definition of @key that produces a lozenge. Doesn't adjust to text size.
2758 %\setfont\keyrm\rmshape{8}{1000}{OT1}
2759 %\font\keysy=cmsy9
2760 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2761 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2762 % \vbox{\hrule\kern-0.4pt
2763 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2764 % \kern-0.4pt\hrule}%
2765 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2766
2767 % definition of @key with no lozenge. If the current font is already
2768 % monospace, don't change it; that way, we respect @kbdinputstyle. But
2769 % if it isn't monospace, then use \tt.
2770 %
2771 \def\key#1{{\setupmarkupstyle{key}%
2772 \nohyphenation
2773 \ifmonospace\else\tt\fi
2774 #1}\null}
2775
2776 % @clicksequence{File @click{} Open ...}
2777 \def\clicksequence#1{\begingroup #1\endgroup}
2778
2779 % @clickstyle @arrow (by default)
2780 \parseargdef\clickstyle{\def\click{#1}}
2781 \def\click{\arrow}
2782
2783 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2784 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2785 %
2786 \def\dmn#1{\thinspace #1}
2787
2788 % @acronym for "FBI", "NATO", and the like.
2789 % We print this one point size smaller, since it's intended for
2790 % all-uppercase.
2791 %
2792 \def\acronym#1{\doacronym #1,,\finish}
2793 \def\doacronym#1,#2,#3\finish{%
2794 {\selectfonts\lsize #1}%
2795 \def\temp{#2}%
2796 \ifx\temp\empty \else
2797 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2798 \fi
2799 \null % reset \spacefactor=1000
2800 }
2801
2802 % @abbr for "Comput. J." and the like.
2803 % No font change, but don't do end-of-sentence spacing.
2804 %
2805 \def\abbr#1{\doabbr #1,,\finish}
2806 \def\doabbr#1,#2,#3\finish{%
2807 {\plainfrenchspacing #1}%
2808 \def\temp{#2}%
2809 \ifx\temp\empty \else
2810 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2811 \fi
2812 \null % reset \spacefactor=1000
2813 }
2814
2815 % @asis just yields its argument. Used with @table, for example.
2816 %
2817 \def\asis#1{#1}
2818
2819 % @math outputs its argument in math mode.
2820 %
2821 % One complication: _ usually means subscripts, but it could also mean
2822 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
2823 % _ active, and distinguish by seeing if the current family is \slfam,
2824 % which is what @var uses.
2825 {
2826 \catcode`\_ = \active
2827 \gdef\mathunderscore{%
2828 \catcode`\_=\active
2829 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2830 }
2831 }
2832 % Another complication: we want \\ (and @\) to output a math (or tt) \.
2833 % FYI, plain.tex uses \\ as a temporary control sequence (for no
2834 % particular reason), but this is not advertised and we don't care.
2835 %
2836 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2837 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2838 %
2839 \def\math{%
2840 \ifmmode\else % only go into math if not in math mode already
2841 \tex
2842 \mathunderscore
2843 \let\\ = \mathbackslash
2844 \mathactive
2845 % make the texinfo accent commands work in math mode
2846 \let\"=\ddot
2847 \let\'=\acute
2848 \let\==\bar
2849 \let\^=\hat
2850 \let\`=\grave
2851 \let\u=\breve
2852 \let\v=\check
2853 \let\~=\tilde
2854 \let\dotaccent=\dot
2855 % have to provide another name for sup operator
2856 \let\mathopsup=\sup
2857 $\expandafter\finishmath\fi
2858 }
2859 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
2860
2861 % Some active characters (such as <) are spaced differently in math.
2862 % We have to reset their definitions in case the @math was an argument
2863 % to a command which sets the catcodes (such as @item or @section).
2864 %
2865 {
2866 \catcode`^ = \active
2867 \catcode`< = \active
2868 \catcode`> = \active
2869 \catcode`+ = \active
2870 \catcode`' = \active
2871 \gdef\mathactive{%
2872 \let^ = \ptexhat
2873 \let< = \ptexless
2874 \let> = \ptexgtr
2875 \let+ = \ptexplus
2876 \let' = \ptexquoteright
2877 }
2878 }
2879
2880 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
2881 % If in text, use math to place as sub/superscript, but switch
2882 % into text mode, with smaller fonts. This is a different font than the
2883 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
2884 % fix it (significant additions to font machinery) until someone notices.
2885 %
2886 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
2887 \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
2888 %
2889 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
2890 \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
2891
2892 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
2893 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
2894 % except specified as a normal braced arg, so no newlines to worry about.
2895 %
2896 \def\outfmtnametex{tex}
2897 %
2898 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
2899 \long\def\doinlinefmt#1,#2,\finish{%
2900 \def\inlinefmtname{#1}%
2901 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
2902 }
2903 %
2904 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
2905 % FMTNAME is tex, else ELSE-TEXT.
2906 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
2907 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
2908 \def\inlinefmtname{#1}%
2909 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
2910 }
2911 %
2912 % For raw, must switch into @tex before parsing the argument, to avoid
2913 % setting catcodes prematurely. Doing it this way means that, for
2914 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
2915 % ignored. But this isn't important because if people want a literal
2916 % *right* brace they would have to use a command anyway, so they may as
2917 % well use a command to get a left brace too. We could re-use the
2918 % delimiter character idea from \verb, but it seems like overkill.
2919 %
2920 \long\def\inlineraw{\tex \doinlineraw}
2921 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
2922 \def\doinlinerawtwo#1,#2,\finish{%
2923 \def\inlinerawname{#1}%
2924 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
2925 \endgroup % close group opened by \tex.
2926 }
2927
2928 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
2929 %
2930 \long\def\inlineifset#1{\doinlineifset #1,\finish}
2931 \long\def\doinlineifset#1,#2,\finish{%
2932 \def\inlinevarname{#1}%
2933 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
2934 \else\ignorespaces#2\fi
2935 }
2936
2937 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
2938 %
2939 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
2940 \long\def\doinlineifclear#1,#2,\finish{%
2941 \def\inlinevarname{#1}%
2942 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
2943 }
2944
2945
2946 \message{glyphs,}
2947 % and logos.
2948
2949 % @@ prints an @, as does @atchar{}.
2950 \def\@{\char64 }
2951 \let\atchar=\@
2952
2953 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
2954 % Unless we're in typewriter, use \ecfont because the CM text fonts do
2955 % not have braces, and we don't want to switch into math.
2956 \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
2957 \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
2958 \let\{=\mylbrace \let\lbracechar=\{
2959 \let\}=\myrbrace \let\rbracechar=\}
2960 \begingroup
2961 % Definitions to produce \{ and \} commands for indices,
2962 % and @{ and @} for the aux/toc files.
2963 \catcode`\{ = \other \catcode`\} = \other
2964 \catcode`\[ = 1 \catcode`\] = 2
2965 \catcode`\! = 0 \catcode`\\ = \other
2966 !gdef!lbracecmd[\{]%
2967 !gdef!rbracecmd[\}]%
2968 !gdef!lbraceatcmd[@{]%
2969 !gdef!rbraceatcmd[@}]%
2970 !endgroup
2971
2972 % @comma{} to avoid , parsing problems.
2973 \let\comma = ,
2974
2975 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
2976 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
2977 \let\, = \ptexc
2978 \let\dotaccent = \ptexdot
2979 \def\ringaccent#1{{\accent23 #1}}
2980 \let\tieaccent = \ptext
2981 \let\ubaraccent = \ptexb
2982 \let\udotaccent = \d
2983
2984 % Other special characters: @questiondown @exclamdown @ordf @ordm
2985 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
2986 \def\questiondown{?`}
2987 \def\exclamdown{!`}
2988 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
2989 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
2990
2991 % Dotless i and dotless j, used for accents.
2992 \def\imacro{i}
2993 \def\jmacro{j}
2994 \def\dotless#1{%
2995 \def\temp{#1}%
2996 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
2997 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
2998 \else \errmessage{@dotless can be used only with i or j}%
2999 \fi\fi
3000 }
3001
3002 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3003 % period following counts as ending a sentence. (Idea found in latex.)
3004 %
3005 \edef\TeX{\TeX \spacefactor=1000 }
3006
3007 % @LaTeX{} logo. Not quite the same results as the definition in
3008 % latex.ltx, since we use a different font for the raised A; it's most
3009 % convenient for us to use an explicitly smaller font, rather than using
3010 % the \scriptstyle font (since we don't reset \scriptstyle and
3011 % \scriptscriptstyle).
3012 %
3013 \def\LaTeX{%
3014 L\kern-.36em
3015 {\setbox0=\hbox{T}%
3016 \vbox to \ht0{\hbox{%
3017 \ifx\textnominalsize\xwordpt
3018 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
3019 % Revert to plain's \scriptsize, which is 7pt.
3020 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3021 \else
3022 % For 11pt, we can use our lllsize.
3023 \selectfonts\lllsize A%
3024 \fi
3025 }%
3026 \vss
3027 }}%
3028 \kern-.15em
3029 \TeX
3030 }
3031
3032 % Some math mode symbols. Define \ensuremath to switch into math mode
3033 % unless we are already there. Expansion tricks may not be needed here,
3034 % but safer, and can't hurt.
3035 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3036 \def\ensuredmath#1{$\relax#1$}
3037 %
3038 \def\bullet{\ensuremath\ptexbullet}
3039 \def\geq{\ensuremath\ge}
3040 \def\leq{\ensuremath\le}
3041 \def\minus{\ensuremath-}
3042
3043 % @dots{} outputs an ellipsis using the current font.
3044 % We do .5em per period so that it has the same spacing in the cm
3045 % typewriter fonts as three actual period characters; on the other hand,
3046 % in other typewriter fonts three periods are wider than 1.5em. So do
3047 % whichever is larger.
3048 %
3049 \def\dots{%
3050 \leavevmode
3051 \setbox0=\hbox{...}% get width of three periods
3052 \ifdim\wd0 > 1.5em
3053 \dimen0 = \wd0
3054 \else
3055 \dimen0 = 1.5em
3056 \fi
3057 \hbox to \dimen0{%
3058 \hskip 0pt plus.25fil
3059 .\hskip 0pt plus1fil
3060 .\hskip 0pt plus1fil
3061 .\hskip 0pt plus.5fil
3062 }%
3063 }
3064
3065 % @enddots{} is an end-of-sentence ellipsis.
3066 %
3067 \def\enddots{%
3068 \dots
3069 \spacefactor=\endofsentencespacefactor
3070 }
3071
3072 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3073 %
3074 % Since these characters are used in examples, they should be an even number of
3075 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3076 %
3077 \def\point{$\star$}
3078 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3079 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3080 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3081 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3082 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3083
3084 % The @error{} command.
3085 % Adapted from the TeXbook's \boxit.
3086 %
3087 \newbox\errorbox
3088 %
3089 {\tentt \global\dimen0 = 3em}% Width of the box.
3090 \dimen2 = .55pt % Thickness of rules
3091 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3092 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3093 %
3094 \setbox\errorbox=\hbox to \dimen0{\hfil
3095 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3096 \advance\hsize by -2\dimen2 % Rules.
3097 \vbox{%
3098 \hrule height\dimen2
3099 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3100 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3101 \kern3pt\vrule width\dimen2}% Space to right.
3102 \hrule height\dimen2}
3103 \hfil}
3104 %
3105 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3106
3107 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3108 %
3109 \def\pounds{{\it\$}}
3110
3111 % @euro{} comes from a separate font, depending on the current style.
3112 % We use the free feym* fonts from the eurosym package by Henrik
3113 % Theiling, which support regular, slanted, bold and bold slanted (and
3114 % "outlined" (blackboard board, sort of) versions, which we don't need).
3115 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3116 %
3117 % Although only regular is the truly official Euro symbol, we ignore
3118 % that. The Euro is designed to be slightly taller than the regular
3119 % font height.
3120 %
3121 % feymr - regular
3122 % feymo - slanted
3123 % feybr - bold
3124 % feybo - bold slanted
3125 %
3126 % There is no good (free) typewriter version, to my knowledge.
3127 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3128 % Hmm.
3129 %
3130 % Also doesn't work in math. Do we need to do math with euro symbols?
3131 % Hope not.
3132 %
3133 %
3134 \def\euro{{\eurofont e}}
3135 \def\eurofont{%
3136 % We set the font at each command, rather than predefining it in
3137 % \textfonts and the other font-switching commands, so that
3138 % installations which never need the symbol don't have to have the
3139 % font installed.
3140 %
3141 % There is only one designed size (nominal 10pt), so we always scale
3142 % that to the current nominal size.
3143 %
3144 % By the way, simply using "at 1em" works for cmr10 and the like, but
3145 % does not work for cmbx10 and other extended/shrunken fonts.
3146 %
3147 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3148 %
3149 \ifx\curfontstyle\bfstylename
3150 % bold:
3151 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3152 \else
3153 % regular:
3154 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3155 \fi
3156 \thiseurofont
3157 }
3158
3159 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3160 % sometimes we redefine the original macro, and the alias should reflect
3161 % the redefinition.
3162 %
3163 % Use LaTeX names for the Icelandic letters.
3164 \def\DH{{\ecfont \char"D0}} % Eth
3165 \def\dh{{\ecfont \char"F0}} % eth
3166 \def\TH{{\ecfont \char"DE}} % Thorn
3167 \def\th{{\ecfont \char"FE}} % thorn
3168 %
3169 \def\guillemetleft{{\ecfont \char"13}}
3170 \def\guillemotleft{\guillemetleft}
3171 \def\guillemetright{{\ecfont \char"14}}
3172 \def\guillemotright{\guillemetright}
3173 \def\guilsinglleft{{\ecfont \char"0E}}
3174 \def\guilsinglright{{\ecfont \char"0F}}
3175 \def\quotedblbase{{\ecfont \char"12}}
3176 \def\quotesinglbase{{\ecfont \char"0D}}
3177 %
3178 % This positioning is not perfect (see the ogonek LaTeX package), but
3179 % we have the precomposed glyphs for the most common cases. We put the
3180 % tests to use those glyphs in the single \ogonek macro so we have fewer
3181 % dummy definitions to worry about for index entries, etc.
3182 %
3183 % ogonek is also used with other letters in Lithuanian (IOU), but using
3184 % the precomposed glyphs for those is not so easy since they aren't in
3185 % the same EC font.
3186 \def\ogonek#1{{%
3187 \def\temp{#1}%
3188 \ifx\temp\macrocharA\Aogonek
3189 \else\ifx\temp\macrochara\aogonek
3190 \else\ifx\temp\macrocharE\Eogonek
3191 \else\ifx\temp\macrochare\eogonek
3192 \else
3193 \ecfont \setbox0=\hbox{#1}%
3194 \ifdim\ht0=1ex\accent"0C #1%
3195 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3196 \fi
3197 \fi\fi\fi\fi
3198 }%
3199 }
3200 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3201 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3202 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3203 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3204 %
3205 % Use the European Computer Modern fonts (cm-super in outline format)
3206 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3207 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3208 % package and follow the same conventions.
3209 %
3210 \def\ecfont{\etcfont{e}}
3211 \def\tcfont{\etcfont{t}}
3212 %
3213 \def\etcfont#1{%
3214 % We can't distinguish serif/sans and italic/slanted, but this
3215 % is used for crude hacks anyway (like adding French and German
3216 % quotes to documents typeset with CM, where we lose kerning), so
3217 % hopefully nobody will notice/care.
3218 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3219 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3220 \ifmonospace
3221 % typewriter:
3222 \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3223 \else
3224 \ifx\curfontstyle\bfstylename
3225 % bold:
3226 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3227 \else
3228 % regular:
3229 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3230 \fi
3231 \fi
3232 \thisecfont
3233 }
3234
3235 % @registeredsymbol - R in a circle. The font for the R should really
3236 % be smaller yet, but lllsize is the best we can do for now.
3237 % Adapted from the plain.tex definition of \copyright.
3238 %
3239 \def\registeredsymbol{%
3240 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3241 \hfil\crcr\Orb}}%
3242 }$%
3243 }
3244
3245 % @textdegree - the normal degrees sign.
3246 %
3247 \def\textdegree{$^\circ$}
3248
3249 % Laurent Siebenmann reports \Orb undefined with:
3250 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3251 % so we'll define it if necessary.
3252 %
3253 \ifx\Orb\thisisundefined
3254 \def\Orb{\mathhexbox20D}
3255 \fi
3256
3257 % Quotes.
3258 \chardef\quotedblleft="5C
3259 \chardef\quotedblright=`\"
3260 \chardef\quoteleft=`\`
3261 \chardef\quoteright=`\'
3262
3263
3264 \message{page headings,}
3265
3266 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3267 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3268
3269 % First the title page. Must do @settitle before @titlepage.
3270 \newif\ifseenauthor
3271 \newif\iffinishedtitlepage
3272
3273 % Do an implicit @contents or @shortcontents after @end titlepage if the
3274 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
3275 %
3276 \newif\ifsetcontentsaftertitlepage
3277 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3278 \newif\ifsetshortcontentsaftertitlepage
3279 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3280
3281 \parseargdef\shorttitlepage{%
3282 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3283 \endgroup\page\hbox{}\page}
3284
3285 \envdef\titlepage{%
3286 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3287 \begingroup
3288 \parindent=0pt \textfonts
3289 % Leave some space at the very top of the page.
3290 \vglue\titlepagetopglue
3291 % No rule at page bottom unless we print one at the top with @title.
3292 \finishedtitlepagetrue
3293 %
3294 % Most title ``pages'' are actually two pages long, with space
3295 % at the top of the second. We don't want the ragged left on the second.
3296 \let\oldpage = \page
3297 \def\page{%
3298 \iffinishedtitlepage\else
3299 \finishtitlepage
3300 \fi
3301 \let\page = \oldpage
3302 \page
3303 \null
3304 }%
3305 }
3306
3307 \def\Etitlepage{%
3308 \iffinishedtitlepage\else
3309 \finishtitlepage
3310 \fi
3311 % It is important to do the page break before ending the group,
3312 % because the headline and footline are only empty inside the group.
3313 % If we use the new definition of \page, we always get a blank page
3314 % after the title page, which we certainly don't want.
3315 \oldpage
3316 \endgroup
3317 %
3318 % Need this before the \...aftertitlepage checks so that if they are
3319 % in effect the toc pages will come out with page numbers.
3320 \HEADINGSon
3321 %
3322 % If they want short, they certainly want long too.
3323 \ifsetshortcontentsaftertitlepage
3324 \shortcontents
3325 \contents
3326 \global\let\shortcontents = \relax
3327 \global\let\contents = \relax
3328 \fi
3329 %
3330 \ifsetcontentsaftertitlepage
3331 \contents
3332 \global\let\contents = \relax
3333 \global\let\shortcontents = \relax
3334 \fi
3335 }
3336
3337 \def\finishtitlepage{%
3338 \vskip4pt \hrule height 2pt width \hsize
3339 \vskip\titlepagebottomglue
3340 \finishedtitlepagetrue
3341 }
3342
3343 % Settings used for typesetting titles: no hyphenation, no indentation,
3344 % don't worry much about spacing, ragged right. This should be used
3345 % inside a \vbox, and fonts need to be set appropriately first. Because
3346 % it is always used for titles, nothing else, we call \rmisbold. \par
3347 % should be specified before the end of the \vbox, since a vbox is a group.
3348 %
3349 \def\raggedtitlesettings{%
3350 \rmisbold
3351 \hyphenpenalty=10000
3352 \parindent=0pt
3353 \tolerance=5000
3354 \ptexraggedright
3355 }
3356
3357 % Macros to be used within @titlepage:
3358
3359 \let\subtitlerm=\tenrm
3360 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3361
3362 \parseargdef\title{%
3363 \checkenv\titlepage
3364 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3365 % print a rule at the page bottom also.
3366 \finishedtitlepagefalse
3367 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3368 }
3369
3370 \parseargdef\subtitle{%
3371 \checkenv\titlepage
3372 {\subtitlefont \rightline{#1}}%
3373 }
3374
3375 % @author should come last, but may come many times.
3376 % It can also be used inside @quotation.
3377 %
3378 \parseargdef\author{%
3379 \def\temp{\quotation}%
3380 \ifx\thisenv\temp
3381 \def\quotationauthor{#1}% printed in \Equotation.
3382 \else
3383 \checkenv\titlepage
3384 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3385 {\secfonts\rmisbold \leftline{#1}}%
3386 \fi
3387 }
3388
3389
3390 % Set up page headings and footings.
3391
3392 \let\thispage=\folio
3393
3394 \newtoks\evenheadline % headline on even pages
3395 \newtoks\oddheadline % headline on odd pages
3396 \newtoks\evenfootline % footline on even pages
3397 \newtoks\oddfootline % footline on odd pages
3398
3399 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3400 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3401 \else \the\evenheadline \fi}}
3402 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3403 \else \the\evenfootline \fi}\HEADINGShook}
3404 \let\HEADINGShook=\relax
3405
3406 % Commands to set those variables.
3407 % For example, this is what @headings on does
3408 % @evenheading @thistitle|@thispage|@thischapter
3409 % @oddheading @thischapter|@thispage|@thistitle
3410 % @evenfooting @thisfile||
3411 % @oddfooting ||@thisfile
3412
3413
3414 \def\evenheading{\parsearg\evenheadingxxx}
3415 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3416 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3417 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3418
3419 \def\oddheading{\parsearg\oddheadingxxx}
3420 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3421 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3422 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3423
3424 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3425
3426 \def\evenfooting{\parsearg\evenfootingxxx}
3427 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3428 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3429 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3430
3431 \def\oddfooting{\parsearg\oddfootingxxx}
3432 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3433 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3434 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3435 %
3436 % Leave some space for the footline. Hopefully ok to assume
3437 % @evenfooting will not be used by itself.
3438 \global\advance\pageheight by -12pt
3439 \global\advance\vsize by -12pt
3440 }
3441
3442 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3443
3444 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3445 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3446 %
3447 % The same set of arguments for:
3448 %
3449 % @oddheadingmarks
3450 % @evenfootingmarks
3451 % @oddfootingmarks
3452 % @everyheadingmarks
3453 % @everyfootingmarks
3454
3455 % These define \getoddheadingmarks, \getevenheadingmarks,
3456 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3457 % \gettopheadingmarks, \getbottomheadingmarks.
3458 %
3459 \def\evenheadingmarks{\headingmarks{even}{heading}}
3460 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3461 \def\evenfootingmarks{\headingmarks{even}{footing}}
3462 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3463 \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3464 \headingmarks{odd}{heading}{#1} }
3465 \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3466 \headingmarks{odd}{footing}{#1} }
3467 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3468 \def\headingmarks#1#2#3 {%
3469 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3470 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3471 }
3472
3473 \everyheadingmarks bottom
3474 \everyfootingmarks bottom
3475
3476 % @headings double turns headings on for double-sided printing.
3477 % @headings single turns headings on for single-sided printing.
3478 % @headings off turns them off.
3479 % @headings on same as @headings double, retained for compatibility.
3480 % @headings after turns on double-sided headings after this page.
3481 % @headings doubleafter turns on double-sided headings after this page.
3482 % @headings singleafter turns on single-sided headings after this page.
3483 % By default, they are off at the start of a document,
3484 % and turned `on' after @end titlepage.
3485
3486 \def\headings #1 {\csname HEADINGS#1\endcsname}
3487
3488 \def\headingsoff{% non-global headings elimination
3489 \evenheadline={\hfil}\evenfootline={\hfil}%
3490 \oddheadline={\hfil}\oddfootline={\hfil}%
3491 }
3492
3493 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3494 \HEADINGSoff % it's the default
3495
3496 % When we turn headings on, set the page number to 1.
3497 % For double-sided printing, put current file name in lower left corner,
3498 % chapter name on inside top of right hand pages, document
3499 % title on inside top of left hand pages, and page numbers on outside top
3500 % edge of all pages.
3501 \def\HEADINGSdouble{%
3502 \global\pageno=1
3503 \global\evenfootline={\hfil}
3504 \global\oddfootline={\hfil}
3505 \global\evenheadline={\line{\folio\hfil\thistitle}}
3506 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3507 \global\let\contentsalignmacro = \chapoddpage
3508 }
3509 \let\contentsalignmacro = \chappager
3510
3511 % For single-sided printing, chapter title goes across top left of page,
3512 % page number on top right.
3513 \def\HEADINGSsingle{%
3514 \global\pageno=1
3515 \global\evenfootline={\hfil}
3516 \global\oddfootline={\hfil}
3517 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3518 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3519 \global\let\contentsalignmacro = \chappager
3520 }
3521 \def\HEADINGSon{\HEADINGSdouble}
3522
3523 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3524 \let\HEADINGSdoubleafter=\HEADINGSafter
3525 \def\HEADINGSdoublex{%
3526 \global\evenfootline={\hfil}
3527 \global\oddfootline={\hfil}
3528 \global\evenheadline={\line{\folio\hfil\thistitle}}
3529 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3530 \global\let\contentsalignmacro = \chapoddpage
3531 }
3532
3533 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3534 \def\HEADINGSsinglex{%
3535 \global\evenfootline={\hfil}
3536 \global\oddfootline={\hfil}
3537 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3538 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3539 \global\let\contentsalignmacro = \chappager
3540 }
3541
3542 % Subroutines used in generating headings
3543 % This produces Day Month Year style of output.
3544 % Only define if not already defined, in case a txi-??.tex file has set
3545 % up a different format (e.g., txi-cs.tex does this).
3546 \ifx\today\thisisundefined
3547 \def\today{%
3548 \number\day\space
3549 \ifcase\month
3550 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3551 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3552 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3553 \fi
3554 \space\number\year}
3555 \fi
3556
3557 % @settitle line... specifies the title of the document, for headings.
3558 % It generates no output of its own.
3559 \def\thistitle{\putwordNoTitle}
3560 \def\settitle{\parsearg{\gdef\thistitle}}
3561
3562
3563 \message{tables,}
3564 % Tables -- @table, @ftable, @vtable, @item(x).
3565
3566 % default indentation of table text
3567 \newdimen\tableindent \tableindent=.8in
3568 % default indentation of @itemize and @enumerate text
3569 \newdimen\itemindent \itemindent=.3in
3570 % margin between end of table item and start of table text.
3571 \newdimen\itemmargin \itemmargin=.1in
3572
3573 % used internally for \itemindent minus \itemmargin
3574 \newdimen\itemmax
3575
3576 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3577 % these defs.
3578 % They also define \itemindex
3579 % to index the item name in whatever manner is desired (perhaps none).
3580
3581 \newif\ifitemxneedsnegativevskip
3582
3583 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3584
3585 \def\internalBitem{\smallbreak \parsearg\itemzzz}
3586 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
3587
3588 \def\itemzzz #1{\begingroup %
3589 \advance\hsize by -\rightskip
3590 \advance\hsize by -\tableindent
3591 \setbox0=\hbox{\itemindicate{#1}}%
3592 \itemindex{#1}%
3593 \nobreak % This prevents a break before @itemx.
3594 %
3595 % If the item text does not fit in the space we have, put it on a line
3596 % by itself, and do not allow a page break either before or after that
3597 % line. We do not start a paragraph here because then if the next
3598 % command is, e.g., @kindex, the whatsit would get put into the
3599 % horizontal list on a line by itself, resulting in extra blank space.
3600 \ifdim \wd0>\itemmax
3601 %
3602 % Make this a paragraph so we get the \parskip glue and wrapping,
3603 % but leave it ragged-right.
3604 \begingroup
3605 \advance\leftskip by-\tableindent
3606 \advance\hsize by\tableindent
3607 \advance\rightskip by0pt plus1fil\relax
3608 \leavevmode\unhbox0\par
3609 \endgroup
3610 %
3611 % We're going to be starting a paragraph, but we don't want the
3612 % \parskip glue -- logically it's part of the @item we just started.
3613 \nobreak \vskip-\parskip
3614 %
3615 % Stop a page break at the \parskip glue coming up. However, if
3616 % what follows is an environment such as @example, there will be no
3617 % \parskip glue; then the negative vskip we just inserted would
3618 % cause the example and the item to crash together. So we use this
3619 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3620 % \parskip glue after all. Section titles are handled this way also.
3621 %
3622 \penalty 10001
3623 \endgroup
3624 \itemxneedsnegativevskipfalse
3625 \else
3626 % The item text fits into the space. Start a paragraph, so that the
3627 % following text (if any) will end up on the same line.
3628 \noindent
3629 % Do this with kerns and \unhbox so that if there is a footnote in
3630 % the item text, it can migrate to the main vertical list and
3631 % eventually be printed.
3632 \nobreak\kern-\tableindent
3633 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3634 \unhbox0
3635 \nobreak\kern\dimen0
3636 \endgroup
3637 \itemxneedsnegativevskiptrue
3638 \fi
3639 }
3640
3641 \def\item{\errmessage{@item while not in a list environment}}
3642 \def\itemx{\errmessage{@itemx while not in a list environment}}
3643
3644 % @table, @ftable, @vtable.
3645 \envdef\table{%
3646 \let\itemindex\gobble
3647 \tablecheck{table}%
3648 }
3649 \envdef\ftable{%
3650 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3651 \tablecheck{ftable}%
3652 }
3653 \envdef\vtable{%
3654 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3655 \tablecheck{vtable}%
3656 }
3657 \def\tablecheck#1{%
3658 \ifnum \the\catcode`\^^M=\active
3659 \endgroup
3660 \errmessage{This command won't work in this context; perhaps the problem is
3661 that we are \inenvironment\thisenv}%
3662 \def\next{\doignore{#1}}%
3663 \else
3664 \let\next\tablex
3665 \fi
3666 \next
3667 }
3668 \def\tablex#1{%
3669 \def\itemindicate{#1}%
3670 \parsearg\tabley
3671 }
3672 \def\tabley#1{%
3673 {%
3674 \makevalueexpandable
3675 \edef\temp{\noexpand\tablez #1\space\space\space}%
3676 \expandafter
3677 }\temp \endtablez
3678 }
3679 \def\tablez #1 #2 #3 #4\endtablez{%
3680 \aboveenvbreak
3681 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3682 \ifnum 0#2>0 \tableindent=#2\mil \fi
3683 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3684 \itemmax=\tableindent
3685 \advance \itemmax by -\itemmargin
3686 \advance \leftskip by \tableindent
3687 \exdentamount=\tableindent
3688 \parindent = 0pt
3689 \parskip = \smallskipamount
3690 \ifdim \parskip=0pt \parskip=2pt \fi
3691 \let\item = \internalBitem
3692 \let\itemx = \internalBitemx
3693 }
3694 \def\Etable{\endgraf\afterenvbreak}
3695 \let\Eftable\Etable
3696 \let\Evtable\Etable
3697 \let\Eitemize\Etable
3698 \let\Eenumerate\Etable
3699
3700 % This is the counter used by @enumerate, which is really @itemize
3701
3702 \newcount \itemno
3703
3704 \envdef\itemize{\parsearg\doitemize}
3705
3706 \def\doitemize#1{%
3707 \aboveenvbreak
3708 \itemmax=\itemindent
3709 \advance\itemmax by -\itemmargin
3710 \advance\leftskip by \itemindent
3711 \exdentamount=\itemindent
3712 \parindent=0pt
3713 \parskip=\smallskipamount
3714 \ifdim\parskip=0pt \parskip=2pt \fi
3715 %
3716 % Try typesetting the item mark so that if the document erroneously says
3717 % something like @itemize @samp (intending @table), there's an error
3718 % right away at the @itemize. It's not the best error message in the
3719 % world, but it's better than leaving it to the @item. This means if
3720 % the user wants an empty mark, they have to say @w{} not just @w.
3721 \def\itemcontents{#1}%
3722 \setbox0 = \hbox{\itemcontents}%
3723 %
3724 % @itemize with no arg is equivalent to @itemize @bullet.
3725 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3726 %
3727 \let\item=\itemizeitem
3728 }
3729
3730 % Definition of @item while inside @itemize and @enumerate.
3731 %
3732 \def\itemizeitem{%
3733 \advance\itemno by 1 % for enumerations
3734 {\let\par=\endgraf \smallbreak}% reasonable place to break
3735 {%
3736 % If the document has an @itemize directly after a section title, a
3737 % \nobreak will be last on the list, and \sectionheading will have
3738 % done a \vskip-\parskip. In that case, we don't want to zero
3739 % parskip, or the item text will crash with the heading. On the
3740 % other hand, when there is normal text preceding the item (as there
3741 % usually is), we do want to zero parskip, or there would be too much
3742 % space. In that case, we won't have a \nobreak before. At least
3743 % that's the theory.
3744 \ifnum\lastpenalty<10000 \parskip=0in \fi
3745 \noindent
3746 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3747 %
3748 \ifinner\else
3749 \vadjust{\penalty 1200}% not good to break after first line of item.
3750 \fi
3751 % We can be in inner vertical mode in a footnote, although an
3752 % @itemize looks awful there.
3753 }%
3754 \flushcr
3755 }
3756
3757 % \splitoff TOKENS\endmark defines \first to be the first token in
3758 % TOKENS, and \rest to be the remainder.
3759 %
3760 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3761
3762 % Allow an optional argument of an uppercase letter, lowercase letter,
3763 % or number, to specify the first label in the enumerated list. No
3764 % argument is the same as `1'.
3765 %
3766 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
3767 \def\enumeratey #1 #2\endenumeratey{%
3768 % If we were given no argument, pretend we were given `1'.
3769 \def\thearg{#1}%
3770 \ifx\thearg\empty \def\thearg{1}\fi
3771 %
3772 % Detect if the argument is a single token. If so, it might be a
3773 % letter. Otherwise, the only valid thing it can be is a number.
3774 % (We will always have one token, because of the test we just made.
3775 % This is a good thing, since \splitoff doesn't work given nothing at
3776 % all -- the first parameter is undelimited.)
3777 \expandafter\splitoff\thearg\endmark
3778 \ifx\rest\empty
3779 % Only one token in the argument. It could still be anything.
3780 % A ``lowercase letter'' is one whose \lccode is nonzero.
3781 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3782 % not equal to itself.
3783 % Otherwise, we assume it's a number.
3784 %
3785 % We need the \relax at the end of the \ifnum lines to stop TeX from
3786 % continuing to look for a <number>.
3787 %
3788 \ifnum\lccode\expandafter`\thearg=0\relax
3789 \numericenumerate % a number (we hope)
3790 \else
3791 % It's a letter.
3792 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3793 \lowercaseenumerate % lowercase letter
3794 \else
3795 \uppercaseenumerate % uppercase letter
3796 \fi
3797 \fi
3798 \else
3799 % Multiple tokens in the argument. We hope it's a number.
3800 \numericenumerate
3801 \fi
3802 }
3803
3804 % An @enumerate whose labels are integers. The starting integer is
3805 % given in \thearg.
3806 %
3807 \def\numericenumerate{%
3808 \itemno = \thearg
3809 \startenumeration{\the\itemno}%
3810 }
3811
3812 % The starting (lowercase) letter is in \thearg.
3813 \def\lowercaseenumerate{%
3814 \itemno = \expandafter`\thearg
3815 \startenumeration{%
3816 % Be sure we're not beyond the end of the alphabet.
3817 \ifnum\itemno=0
3818 \errmessage{No more lowercase letters in @enumerate; get a bigger
3819 alphabet}%
3820 \fi
3821 \char\lccode\itemno
3822 }%
3823 }
3824
3825 % The starting (uppercase) letter is in \thearg.
3826 \def\uppercaseenumerate{%
3827 \itemno = \expandafter`\thearg
3828 \startenumeration{%
3829 % Be sure we're not beyond the end of the alphabet.
3830 \ifnum\itemno=0
3831 \errmessage{No more uppercase letters in @enumerate; get a bigger
3832 alphabet}
3833 \fi
3834 \char\uccode\itemno
3835 }%
3836 }
3837
3838 % Call \doitemize, adding a period to the first argument and supplying the
3839 % common last two arguments. Also subtract one from the initial value in
3840 % \itemno, since @item increments \itemno.
3841 %
3842 \def\startenumeration#1{%
3843 \advance\itemno by -1
3844 \doitemize{#1.}\flushcr
3845 }
3846
3847 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3848 % to @enumerate.
3849 %
3850 \def\alphaenumerate{\enumerate{a}}
3851 \def\capsenumerate{\enumerate{A}}
3852 \def\Ealphaenumerate{\Eenumerate}
3853 \def\Ecapsenumerate{\Eenumerate}
3854
3855
3856 % @multitable macros
3857 % Amy Hendrickson, 8/18/94, 3/6/96
3858 %
3859 % @multitable ... @end multitable will make as many columns as desired.
3860 % Contents of each column will wrap at width given in preamble. Width
3861 % can be specified either with sample text given in a template line,
3862 % or in percent of \hsize, the current width of text on page.
3863
3864 % Table can continue over pages but will only break between lines.
3865
3866 % To make preamble:
3867 %
3868 % Either define widths of columns in terms of percent of \hsize:
3869 % @multitable @columnfractions .25 .3 .45
3870 % @item ...
3871 %
3872 % Numbers following @columnfractions are the percent of the total
3873 % current hsize to be used for each column. You may use as many
3874 % columns as desired.
3875
3876
3877 % Or use a template:
3878 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3879 % @item ...
3880 % using the widest term desired in each column.
3881
3882 % Each new table line starts with @item, each subsequent new column
3883 % starts with @tab. Empty columns may be produced by supplying @tab's
3884 % with nothing between them for as many times as empty columns are needed,
3885 % ie, @tab@tab@tab will produce two empty columns.
3886
3887 % @item, @tab do not need to be on their own lines, but it will not hurt
3888 % if they are.
3889
3890 % Sample multitable:
3891
3892 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3893 % @item first col stuff @tab second col stuff @tab third col
3894 % @item
3895 % first col stuff
3896 % @tab
3897 % second col stuff
3898 % @tab
3899 % third col
3900 % @item first col stuff @tab second col stuff
3901 % @tab Many paragraphs of text may be used in any column.
3902 %
3903 % They will wrap at the width determined by the template.
3904 % @item@tab@tab This will be in third column.
3905 % @end multitable
3906
3907 % Default dimensions may be reset by user.
3908 % @multitableparskip is vertical space between paragraphs in table.
3909 % @multitableparindent is paragraph indent in table.
3910 % @multitablecolmargin is horizontal space to be left between columns.
3911 % @multitablelinespace is space to leave between table items, baseline
3912 % to baseline.
3913 % 0pt means it depends on current normal line spacing.
3914 %
3915 \newskip\multitableparskip
3916 \newskip\multitableparindent
3917 \newdimen\multitablecolspace
3918 \newskip\multitablelinespace
3919 \multitableparskip=0pt
3920 \multitableparindent=6pt
3921 \multitablecolspace=12pt
3922 \multitablelinespace=0pt
3923
3924 % Macros used to set up halign preamble:
3925 %
3926 \let\endsetuptable\relax
3927 \def\xendsetuptable{\endsetuptable}
3928 \let\columnfractions\relax
3929 \def\xcolumnfractions{\columnfractions}
3930 \newif\ifsetpercent
3931
3932 % #1 is the @columnfraction, usually a decimal number like .5, but might
3933 % be just 1. We just use it, whatever it is.
3934 %
3935 \def\pickupwholefraction#1 {%
3936 \global\advance\colcount by 1
3937 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3938 \setuptable
3939 }
3940
3941 \newcount\colcount
3942 \def\setuptable#1{%
3943 \def\firstarg{#1}%
3944 \ifx\firstarg\xendsetuptable
3945 \let\go = \relax
3946 \else
3947 \ifx\firstarg\xcolumnfractions
3948 \global\setpercenttrue
3949 \else
3950 \ifsetpercent
3951 \let\go\pickupwholefraction
3952 \else
3953 \global\advance\colcount by 1
3954 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3955 % separator; typically that is always in the input, anyway.
3956 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3957 \fi
3958 \fi
3959 \ifx\go\pickupwholefraction
3960 % Put the argument back for the \pickupwholefraction call, so
3961 % we'll always have a period there to be parsed.
3962 \def\go{\pickupwholefraction#1}%
3963 \else
3964 \let\go = \setuptable
3965 \fi%
3966 \fi
3967 \go
3968 }
3969
3970 % multitable-only commands.
3971 %
3972 % @headitem starts a heading row, which we typeset in bold. Assignments
3973 % have to be global since we are inside the implicit group of an
3974 % alignment entry. \everycr below resets \everytab so we don't have to
3975 % undo it ourselves.
3976 \def\headitemfont{\b}% for people to use in the template row; not changeable
3977 \def\headitem{%
3978 \checkenv\multitable
3979 \crcr
3980 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
3981 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
3982 \the\everytab % for the first item
3983 }%
3984 %
3985 % default for tables with no headings.
3986 \let\headitemcrhook=\relax
3987 %
3988 % A \tab used to include \hskip1sp. But then the space in a template
3989 % line is not enough. That is bad. So let's go back to just `&' until
3990 % we again encounter the problem the 1sp was intended to solve.
3991 % --karl, nathan@acm.org, 20apr99.
3992 \def\tab{\checkenv\multitable &\the\everytab}%
3993
3994 % @multitable ... @end multitable definitions:
3995 %
3996 \newtoks\everytab % insert after every tab.
3997 %
3998 \envdef\multitable{%
3999 \vskip\parskip
4000 \startsavinginserts
4001 %
4002 % @item within a multitable starts a normal row.
4003 % We use \def instead of \let so that if one of the multitable entries
4004 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4005 % \endtemplate) expanding \doitemize.
4006 \def\item{\crcr}%
4007 %
4008 \tolerance=9500
4009 \hbadness=9500
4010 \setmultitablespacing
4011 \parskip=\multitableparskip
4012 \parindent=\multitableparindent
4013 \overfullrule=0pt
4014 \global\colcount=0
4015 %
4016 \everycr = {%
4017 \noalign{%
4018 \global\everytab={}% Reset from possible headitem.
4019 \global\colcount=0 % Reset the column counter.
4020 %
4021 % Check for saved footnotes, etc.:
4022 \checkinserts
4023 %
4024 % Perhaps a \nobreak, then reset:
4025 \headitemcrhook
4026 \global\let\headitemcrhook=\relax
4027 }%
4028 }%
4029 %
4030 \parsearg\domultitable
4031 }
4032 \def\domultitable#1{%
4033 % To parse everything between @multitable and @item:
4034 \setuptable#1 \endsetuptable
4035 %
4036 % This preamble sets up a generic column definition, which will
4037 % be used as many times as user calls for columns.
4038 % \vtop will set a single line and will also let text wrap and
4039 % continue for many paragraphs if desired.
4040 \halign\bgroup &%
4041 \global\advance\colcount by 1
4042 \multistrut
4043 \vtop{%
4044 % Use the current \colcount to find the correct column width:
4045 \hsize=\expandafter\csname col\the\colcount\endcsname
4046 %
4047 % In order to keep entries from bumping into each other
4048 % we will add a \leftskip of \multitablecolspace to all columns after
4049 % the first one.
4050 %
4051 % If a template has been used, we will add \multitablecolspace
4052 % to the width of each template entry.
4053 %
4054 % If the user has set preamble in terms of percent of \hsize we will
4055 % use that dimension as the width of the column, and the \leftskip
4056 % will keep entries from bumping into each other. Table will start at
4057 % left margin and final column will justify at right margin.
4058 %
4059 % Make sure we don't inherit \rightskip from the outer environment.
4060 \rightskip=0pt
4061 \ifnum\colcount=1
4062 % The first column will be indented with the surrounding text.
4063 \advance\hsize by\leftskip
4064 \else
4065 \ifsetpercent \else
4066 % If user has not set preamble in terms of percent of \hsize
4067 % we will advance \hsize by \multitablecolspace.
4068 \advance\hsize by \multitablecolspace
4069 \fi
4070 % In either case we will make \leftskip=\multitablecolspace:
4071 \leftskip=\multitablecolspace
4072 \fi
4073 % Ignoring space at the beginning and end avoids an occasional spurious
4074 % blank line, when TeX decides to break the line at the space before the
4075 % box from the multistrut, so the strut ends up on a line by itself.
4076 % For example:
4077 % @multitable @columnfractions .11 .89
4078 % @item @code{#}
4079 % @tab Legal holiday which is valid in major parts of the whole country.
4080 % Is automatically provided with highlighting sequences respectively
4081 % marking characters.
4082 \noindent\ignorespaces##\unskip\multistrut
4083 }\cr
4084 }
4085 \def\Emultitable{%
4086 \crcr
4087 \egroup % end the \halign
4088 \global\setpercentfalse
4089 }
4090
4091 \def\setmultitablespacing{%
4092 \def\multistrut{\strut}% just use the standard line spacing
4093 %
4094 % Compute \multitablelinespace (if not defined by user) for use in
4095 % \multitableparskip calculation. We used define \multistrut based on
4096 % this, but (ironically) that caused the spacing to be off.
4097 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4098 \ifdim\multitablelinespace=0pt
4099 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4100 \global\advance\multitablelinespace by-\ht0
4101 \fi
4102 % Test to see if parskip is larger than space between lines of
4103 % table. If not, do nothing.
4104 % If so, set to same dimension as multitablelinespace.
4105 \ifdim\multitableparskip>\multitablelinespace
4106 \global\multitableparskip=\multitablelinespace
4107 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4108 % than skip between lines in the table.
4109 \fi%
4110 \ifdim\multitableparskip=0pt
4111 \global\multitableparskip=\multitablelinespace
4112 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4113 % than skip between lines in the table.
4114 \fi}
4115
4116
4117 \message{conditionals,}
4118
4119 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4120 % @ifnotxml always succeed. They currently do nothing; we don't
4121 % attempt to check whether the conditionals are properly nested. But we
4122 % have to remember that they are conditionals, so that @end doesn't
4123 % attempt to close an environment group.
4124 %
4125 \def\makecond#1{%
4126 \expandafter\let\csname #1\endcsname = \relax
4127 \expandafter\let\csname iscond.#1\endcsname = 1
4128 }
4129 \makecond{iftex}
4130 \makecond{ifnotdocbook}
4131 \makecond{ifnothtml}
4132 \makecond{ifnotinfo}
4133 \makecond{ifnotplaintext}
4134 \makecond{ifnotxml}
4135
4136 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4137 %
4138 \def\direntry{\doignore{direntry}}
4139 \def\documentdescription{\doignore{documentdescription}}
4140 \def\docbook{\doignore{docbook}}
4141 \def\html{\doignore{html}}
4142 \def\ifdocbook{\doignore{ifdocbook}}
4143 \def\ifhtml{\doignore{ifhtml}}
4144 \def\ifinfo{\doignore{ifinfo}}
4145 \def\ifnottex{\doignore{ifnottex}}
4146 \def\ifplaintext{\doignore{ifplaintext}}
4147 \def\ifxml{\doignore{ifxml}}
4148 \def\ignore{\doignore{ignore}}
4149 \def\menu{\doignore{menu}}
4150 \def\xml{\doignore{xml}}
4151
4152 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4153 %
4154 % A count to remember the depth of nesting.
4155 \newcount\doignorecount
4156
4157 \def\doignore#1{\begingroup
4158 % Scan in ``verbatim'' mode:
4159 \obeylines
4160 \catcode`\@ = \other
4161 \catcode`\{ = \other
4162 \catcode`\} = \other
4163 %
4164 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4165 \spaceisspace
4166 %
4167 % Count number of #1's that we've seen.
4168 \doignorecount = 0
4169 %
4170 % Swallow text until we reach the matching `@end #1'.
4171 \dodoignore{#1}%
4172 }
4173
4174 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4175 \obeylines %
4176 %
4177 \gdef\dodoignore#1{%
4178 % #1 contains the command name as a string, e.g., `ifinfo'.
4179 %
4180 % Define a command to find the next `@end #1'.
4181 \long\def\doignoretext##1^^M@end #1{%
4182 \doignoretextyyy##1^^M@#1\_STOP_}%
4183 %
4184 % And this command to find another #1 command, at the beginning of a
4185 % line. (Otherwise, we would consider a line `@c @ifset', for
4186 % example, to count as an @ifset for nesting.)
4187 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4188 %
4189 % And now expand that command.
4190 \doignoretext ^^M%
4191 }%
4192 }
4193
4194 \def\doignoreyyy#1{%
4195 \def\temp{#1}%
4196 \ifx\temp\empty % Nothing found.
4197 \let\next\doignoretextzzz
4198 \else % Found a nested condition, ...
4199 \advance\doignorecount by 1
4200 \let\next\doignoretextyyy % ..., look for another.
4201 % If we're here, #1 ends with ^^M\ifinfo (for example).
4202 \fi
4203 \next #1% the token \_STOP_ is present just after this macro.
4204 }
4205
4206 % We have to swallow the remaining "\_STOP_".
4207 %
4208 \def\doignoretextzzz#1{%
4209 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4210 \let\next\enddoignore
4211 \else % Still inside a nested condition.
4212 \advance\doignorecount by -1
4213 \let\next\doignoretext % Look for the next @end.
4214 \fi
4215 \next
4216 }
4217
4218 % Finish off ignored text.
4219 { \obeylines%
4220 % Ignore anything after the last `@end #1'; this matters in verbatim
4221 % environments, where otherwise the newline after an ignored conditional
4222 % would result in a blank line in the output.
4223 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4224 }
4225
4226
4227 % @set VAR sets the variable VAR to an empty value.
4228 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4229 %
4230 % Since we want to separate VAR from REST-OF-LINE (which might be
4231 % empty), we can't just use \parsearg; we have to insert a space of our
4232 % own to delimit the rest of the line, and then take it out again if we
4233 % didn't need it.
4234 % We rely on the fact that \parsearg sets \catcode`\ =10.
4235 %
4236 \parseargdef\set{\setyyy#1 \endsetyyy}
4237 \def\setyyy#1 #2\endsetyyy{%
4238 {%
4239 \makevalueexpandable
4240 \def\temp{#2}%
4241 \edef\next{\gdef\makecsname{SET#1}}%
4242 \ifx\temp\empty
4243 \next{}%
4244 \else
4245 \setzzz#2\endsetzzz
4246 \fi
4247 }%
4248 }
4249 % Remove the trailing space \setxxx inserted.
4250 \def\setzzz#1 \endsetzzz{\next{#1}}
4251
4252 % @clear VAR clears (i.e., unsets) the variable VAR.
4253 %
4254 \parseargdef\clear{%
4255 {%
4256 \makevalueexpandable
4257 \global\expandafter\let\csname SET#1\endcsname=\relax
4258 }%
4259 }
4260
4261 % @value{foo} gets the text saved in variable foo.
4262 \def\value{\begingroup\makevalueexpandable\valuexxx}
4263 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4264 {
4265 \catcode`\-=\active \catcode`\_=\active
4266 %
4267 \gdef\makevalueexpandable{%
4268 \let\value = \expandablevalue
4269 % We don't want these characters active, ...
4270 \catcode`\-=\other \catcode`\_=\other
4271 % ..., but we might end up with active ones in the argument if
4272 % we're called from @code, as @code{@value{foo-bar_}}, though.
4273 % So \let them to their normal equivalents.
4274 \let-\normaldash \let_\normalunderscore
4275 }
4276 }
4277
4278 % We have this subroutine so that we can handle at least some @value's
4279 % properly in indexes (we call \makevalueexpandable in \indexdummies).
4280 % The command has to be fully expandable (if the variable is set), since
4281 % the result winds up in the index file. This means that if the
4282 % variable's value contains other Texinfo commands, it's almost certain
4283 % it will fail (although perhaps we could fix that with sufficient work
4284 % to do a one-level expansion on the result, instead of complete).
4285 %
4286 % Unfortunately, this has the consequence that when _ is in the *value*
4287 % of an @set, it does not print properly in the roman fonts (get the cmr
4288 % dot accent at position 126 instead). No fix comes to mind, and it's
4289 % been this way since 2003 or earlier, so just ignore it.
4290 %
4291 \def\expandablevalue#1{%
4292 \expandafter\ifx\csname SET#1\endcsname\relax
4293 {[No value for ``#1'']}%
4294 \message{Variable `#1', used in @value, is not set.}%
4295 \else
4296 \csname SET#1\endcsname
4297 \fi
4298 }
4299
4300 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4301 % with @set.
4302 %
4303 % To get the special treatment we need for `@end ifset,' we call
4304 % \makecond and then redefine.
4305 %
4306 \makecond{ifset}
4307 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4308 \def\doifset#1#2{%
4309 {%
4310 \makevalueexpandable
4311 \let\next=\empty
4312 \expandafter\ifx\csname SET#2\endcsname\relax
4313 #1% If not set, redefine \next.
4314 \fi
4315 \expandafter
4316 }\next
4317 }
4318 \def\ifsetfail{\doignore{ifset}}
4319
4320 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4321 % defined with @set, or has been undefined with @clear.
4322 %
4323 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4324 % above code: if the variable is not set, do nothing, if it is set,
4325 % then redefine \next to \ifclearfail.
4326 %
4327 \makecond{ifclear}
4328 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4329 \def\ifclearfail{\doignore{ifclear}}
4330
4331 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4332 % without the @) is in fact defined. We can only feasibly check at the
4333 % TeX level, so something like `mathcode' is going to considered
4334 % defined even though it is not a Texinfo command.
4335 %
4336 \makecond{ifcommanddefined}
4337 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4338 %
4339 \def\doifcmddefined#1#2{{%
4340 \makevalueexpandable
4341 \let\next=\empty
4342 \expandafter\ifx\csname #2\endcsname\relax
4343 #1% If not defined, \let\next as above.
4344 \fi
4345 \expandafter
4346 }\next
4347 }
4348 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4349
4350 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4351 \makecond{ifcommandnotdefined}
4352 \def\ifcommandnotdefined{%
4353 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4354 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4355
4356 % Set the `txicommandconditionals' variable, so documents have a way to
4357 % test if the @ifcommand...defined conditionals are available.
4358 \set txicommandconditionals
4359
4360 % @dircategory CATEGORY -- specify a category of the dir file
4361 % which this file should belong to. Ignore this in TeX.
4362 \let\dircategory=\comment
4363
4364 % @defininfoenclose.
4365 \let\definfoenclose=\comment
4366
4367
4368 \message{indexing,}
4369 % Index generation facilities
4370
4371 % Define \newwrite to be identical to plain tex's \newwrite
4372 % except not \outer, so it can be used within macros and \if's.
4373 \edef\newwrite{\makecsname{ptexnewwrite}}
4374
4375 % \newindex {foo} defines an index named IX.
4376 % It automatically defines \IXindex such that
4377 % \IXindex ...rest of line... puts an entry in the index IX.
4378 % It also defines \IXindfile to be the number of the output channel for
4379 % the file that accumulates this index. The file's extension is IX.
4380 % The name of an index should be no more than 2 characters long
4381 % for the sake of vms.
4382 %
4383 \def\newindex#1{%
4384 \expandafter\chardef\csname#1indfile\endcsname=0
4385 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4386 \noexpand\doindex{#1}}
4387 }
4388
4389 % @defindex foo == \newindex{foo}
4390 %
4391 \def\defindex{\parsearg\newindex}
4392
4393 % Define @defcodeindex, like @defindex except put all entries in @code.
4394 %
4395 \def\defcodeindex{\parsearg\newcodeindex}
4396 %
4397 \def\newcodeindex#1{%
4398 \expandafter\chardef\csname#1indfile\endcsname=0
4399 \expandafter\xdef\csname#1index\endcsname{%
4400 \noexpand\docodeindex{#1}}%
4401 }
4402
4403 % The default indices:
4404 \newindex{cp}% concepts,
4405 \newcodeindex{fn}% functions,
4406 \newcodeindex{vr}% variables,
4407 \newcodeindex{tp}% types,
4408 \newcodeindex{ky}% keys
4409 \newcodeindex{pg}% and programs.
4410
4411
4412 % @synindex foo bar makes index foo feed into index bar.
4413 % Do this instead of @defindex foo if you don't want it as a separate index.
4414 %
4415 % @syncodeindex foo bar similar, but put all entries made for index foo
4416 % inside @code.
4417 %
4418 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4419 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4420
4421 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4422 % #3 the target index (bar).
4423 \def\dosynindex#1#2#3{%
4424 % Only do \closeout if we haven't already done it, else we'll end up
4425 % closing the target index.
4426 \expandafter \ifx\csname donesynindex#2\endcsname \relax
4427 % The \closeout helps reduce unnecessary open files; the limit on the
4428 % Acorn RISC OS is a mere 16 files.
4429 \expandafter\closeout\csname#2indfile\endcsname
4430 \expandafter\let\csname donesynindex#2\endcsname = 1
4431 \fi
4432 % redefine \fooindfile:
4433 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4434 \expandafter\let\csname#2indfile\endcsname=\temp
4435 % redefine \fooindex:
4436 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4437 }
4438
4439 % Define \doindex, the driver for all index macros.
4440 % Argument #1 is generated by the calling \fooindex macro,
4441 % and it the two-letter name of the index.
4442
4443 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4444 \def\doindexxxx #1{\doind{\indexname}{#1}}
4445
4446 % like the previous two, but they put @code around the argument.
4447 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4448 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
4449
4450 % Used when writing an index entry out to an index file, to prevent
4451 % expansion of Texinfo commands that can appear in an index entry.
4452 %
4453 \def\indexdummies{%
4454 \escapechar = `\\ % use backslash in output files.
4455 \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4456 \def\ {\realbackslash\space }%
4457 %
4458 % Need these unexpandable (because we define \tt as a dummy)
4459 % definitions when @{ or @} appear in index entry text. Also, more
4460 % complicated, when \tex is in effect and \{ is a \delimiter again.
4461 % We can't use \lbracecmd and \rbracecmd because texindex assumes
4462 % braces and backslashes are used only as delimiters. Perhaps we
4463 % should use @lbracechar and @rbracechar?
4464 \def\{{{\tt\char123}}%
4465 \def\}{{\tt\char125}}%
4466 %
4467 % Do the redefinitions.
4468 \commondummies
4469 }
4470
4471 % For the aux and toc files, @ is the escape character. So we want to
4472 % redefine everything using @ as the escape character (instead of
4473 % \realbackslash, still used for index files). When everything uses @,
4474 % this will be simpler.
4475 %
4476 \def\atdummies{%
4477 \def\@{@@}%
4478 \def\ {@ }%
4479 \let\{ = \lbraceatcmd
4480 \let\} = \rbraceatcmd
4481 %
4482 % Do the redefinitions.
4483 \commondummies
4484 \otherbackslash
4485 }
4486
4487 % Called from \indexdummies and \atdummies.
4488 %
4489 \def\commondummies{%
4490 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4491 % preventing its expansion. This is used only for control words,
4492 % not control letters, because the \space would be incorrect for
4493 % control characters, but is needed to separate the control word
4494 % from whatever follows.
4495 %
4496 % For control letters, we have \definedummyletter, which omits the
4497 % space.
4498 %
4499 % These can be used both for control words that take an argument and
4500 % those that do not. If it is followed by {arg} in the input, then
4501 % that will dutifully get written to the index (or wherever).
4502 %
4503 \def\definedummyword ##1{\def##1{\string##1\space}}%
4504 \def\definedummyletter##1{\def##1{\string##1}}%
4505 \let\definedummyaccent\definedummyletter
4506 %
4507 \commondummiesnofonts
4508 %
4509 \definedummyletter\_%
4510 \definedummyletter\-%
4511 %
4512 % Non-English letters.
4513 \definedummyword\AA
4514 \definedummyword\AE
4515 \definedummyword\DH
4516 \definedummyword\L
4517 \definedummyword\O
4518 \definedummyword\OE
4519 \definedummyword\TH
4520 \definedummyword\aa
4521 \definedummyword\ae
4522 \definedummyword\dh
4523 \definedummyword\exclamdown
4524 \definedummyword\l
4525 \definedummyword\o
4526 \definedummyword\oe
4527 \definedummyword\ordf
4528 \definedummyword\ordm
4529 \definedummyword\questiondown
4530 \definedummyword\ss
4531 \definedummyword\th
4532 %
4533 % Although these internal commands shouldn't show up, sometimes they do.
4534 \definedummyword\bf
4535 \definedummyword\gtr
4536 \definedummyword\hat
4537 \definedummyword\less
4538 \definedummyword\sf
4539 \definedummyword\sl
4540 \definedummyword\tclose
4541 \definedummyword\tt
4542 %
4543 \definedummyword\LaTeX
4544 \definedummyword\TeX
4545 %
4546 % Assorted special characters.
4547 \definedummyword\arrow
4548 \definedummyword\bullet
4549 \definedummyword\comma
4550 \definedummyword\copyright
4551 \definedummyword\registeredsymbol
4552 \definedummyword\dots
4553 \definedummyword\enddots
4554 \definedummyword\entrybreak
4555 \definedummyword\equiv
4556 \definedummyword\error
4557 \definedummyword\euro
4558 \definedummyword\expansion
4559 \definedummyword\geq
4560 \definedummyword\guillemetleft
4561 \definedummyword\guillemetright
4562 \definedummyword\guilsinglleft
4563 \definedummyword\guilsinglright
4564 \definedummyword\lbracechar
4565 \definedummyword\leq
4566 \definedummyword\mathopsup
4567 \definedummyword\minus
4568 \definedummyword\ogonek
4569 \definedummyword\pounds
4570 \definedummyword\point
4571 \definedummyword\print
4572 \definedummyword\quotedblbase
4573 \definedummyword\quotedblleft
4574 \definedummyword\quotedblright
4575 \definedummyword\quoteleft
4576 \definedummyword\quoteright
4577 \definedummyword\quotesinglbase
4578 \definedummyword\rbracechar
4579 \definedummyword\result
4580 \definedummyword\sub
4581 \definedummyword\sup
4582 \definedummyword\textdegree
4583 %
4584 % We want to disable all macros so that they are not expanded by \write.
4585 \macrolist
4586 %
4587 \normalturnoffactive
4588 %
4589 % Handle some cases of @value -- where it does not contain any
4590 % (non-fully-expandable) commands.
4591 \makevalueexpandable
4592 }
4593
4594 % \commondummiesnofonts: common to \commondummies and \indexnofonts.
4595 % Define \definedumyletter, \definedummyaccent and \definedummyword before
4596 % using.
4597 %
4598 \def\commondummiesnofonts{%
4599 % Control letters and accents.
4600 \definedummyletter\!%
4601 \definedummyaccent\"%
4602 \definedummyaccent\'%
4603 \definedummyletter\*%
4604 \definedummyaccent\,%
4605 \definedummyletter\.%
4606 \definedummyletter\/%
4607 \definedummyletter\:%
4608 \definedummyaccent\=%
4609 \definedummyletter\?%
4610 \definedummyaccent\^%
4611 \definedummyaccent\`%
4612 \definedummyaccent\~%
4613 \definedummyword\u
4614 \definedummyword\v
4615 \definedummyword\H
4616 \definedummyword\dotaccent
4617 \definedummyword\ogonek
4618 \definedummyword\ringaccent
4619 \definedummyword\tieaccent
4620 \definedummyword\ubaraccent
4621 \definedummyword\udotaccent
4622 \definedummyword\dotless
4623 %
4624 % Texinfo font commands.
4625 \definedummyword\b
4626 \definedummyword\i
4627 \definedummyword\r
4628 \definedummyword\sansserif
4629 \definedummyword\sc
4630 \definedummyword\slanted
4631 \definedummyword\t
4632 %
4633 % Commands that take arguments.
4634 \definedummyword\abbr
4635 \definedummyword\acronym
4636 \definedummyword\anchor
4637 \definedummyword\cite
4638 \definedummyword\code
4639 \definedummyword\command
4640 \definedummyword\dfn
4641 \definedummyword\dmn
4642 \definedummyword\email
4643 \definedummyword\emph
4644 \definedummyword\env
4645 \definedummyword\file
4646 \definedummyword\image
4647 \definedummyword\indicateurl
4648 \definedummyword\inforef
4649 \definedummyword\kbd
4650 \definedummyword\key
4651 \definedummyword\math
4652 \definedummyword\option
4653 \definedummyword\pxref
4654 \definedummyword\ref
4655 \definedummyword\samp
4656 \definedummyword\strong
4657 \definedummyword\tie
4658 \definedummyword\U
4659 \definedummyword\uref
4660 \definedummyword\url
4661 \definedummyword\var
4662 \definedummyword\verb
4663 \definedummyword\w
4664 \definedummyword\xref
4665 }
4666
4667 % For testing: output @{ and @} in index sort strings as \{ and \}.
4668 \newif\ifusebracesinindexes
4669
4670 \let\indexlbrace\relax
4671 \let\indexrbrace\relax
4672
4673 {\catcode`\@=0
4674 \catcode`\\=13
4675 @gdef@backslashdisappear{@def\{}}
4676 }
4677
4678 {
4679 \catcode`\<=13
4680 \catcode`\-=13
4681 \catcode`\`=13
4682 \gdef\indexnonalnumdisappear{%
4683 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
4684 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
4685 % (Introduced for FSFS 2nd ed.)
4686 \let`=\empty
4687 \fi
4688 %
4689 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
4690 \backslashdisappear
4691 \fi
4692 %
4693 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
4694 \def-{}%
4695 \fi
4696 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
4697 \def<{}%
4698 \fi
4699 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
4700 \def\@{}%
4701 \fi
4702 }
4703
4704 \gdef\indexnonalnumreappear{%
4705 \useindexbackslash
4706 \let-\normaldash
4707 \let<\normalless
4708 \def\@{@}%
4709 }
4710 }
4711
4712
4713 % \indexnofonts is used when outputting the strings to sort the index
4714 % by, and when constructing control sequence names. It eliminates all
4715 % control sequences and just writes whatever the best ASCII sort string
4716 % would be for a given command (usually its argument).
4717 %
4718 \def\indexnofonts{%
4719 % Accent commands should become @asis.
4720 \def\definedummyaccent##1{\let##1\asis}%
4721 % We can just ignore other control letters.
4722 \def\definedummyletter##1{\let##1\empty}%
4723 % All control words become @asis by default; overrides below.
4724 \let\definedummyword\definedummyaccent
4725 \commondummiesnofonts
4726 %
4727 % Don't no-op \tt, since it isn't a user-level command
4728 % and is used in the definitions of the active chars like <, >, |, etc.
4729 % Likewise with the other plain tex font commands.
4730 %\let\tt=\asis
4731 %
4732 \def\ { }%
4733 \def\@{@}%
4734 \def\_{\normalunderscore}%
4735 \def\-{}% @- shouldn't affect sorting
4736 %
4737 \def\lbracechar{{\indexlbrace}}%
4738 \def\rbracechar{{\indexrbrace}}%
4739 \let\{=\lbracechar
4740 \let\}=\rbracechar
4741 %
4742 %
4743 % Non-English letters.
4744 \def\AA{AA}%
4745 \def\AE{AE}%
4746 \def\DH{DZZ}%
4747 \def\L{L}%
4748 \def\OE{OE}%
4749 \def\O{O}%
4750 \def\TH{TH}%
4751 \def\aa{aa}%
4752 \def\ae{ae}%
4753 \def\dh{dzz}%
4754 \def\exclamdown{!}%
4755 \def\l{l}%
4756 \def\oe{oe}%
4757 \def\ordf{a}%
4758 \def\ordm{o}%
4759 \def\o{o}%
4760 \def\questiondown{?}%
4761 \def\ss{ss}%
4762 \def\th{th}%
4763 %
4764 \def\LaTeX{LaTeX}%
4765 \def\TeX{TeX}%
4766 %
4767 % Assorted special characters.
4768 % (The following {} will end up in the sort string, but that's ok.)
4769 \def\arrow{->}%
4770 \def\bullet{bullet}%
4771 \def\comma{,}%
4772 \def\copyright{copyright}%
4773 \def\dots{...}%
4774 \def\enddots{...}%
4775 \def\equiv{==}%
4776 \def\error{error}%
4777 \def\euro{euro}%
4778 \def\expansion{==>}%
4779 \def\geq{>=}%
4780 \def\guillemetleft{<<}%
4781 \def\guillemetright{>>}%
4782 \def\guilsinglleft{<}%
4783 \def\guilsinglright{>}%
4784 \def\leq{<=}%
4785 \def\minus{-}%
4786 \def\point{.}%
4787 \def\pounds{pounds}%
4788 \def\print{-|}%
4789 \def\quotedblbase{"}%
4790 \def\quotedblleft{"}%
4791 \def\quotedblright{"}%
4792 \def\quoteleft{`}%
4793 \def\quoteright{'}%
4794 \def\quotesinglbase{,}%
4795 \def\registeredsymbol{R}%
4796 \def\result{=>}%
4797 \def\textdegree{o}%
4798 %
4799 % We need to get rid of all macros, leaving only the arguments (if present).
4800 % Of course this is not nearly correct, but it is the best we can do for now.
4801 % makeinfo does not expand macros in the argument to @deffn, which ends up
4802 % writing an index entry, and texindex isn't prepared for an index sort entry
4803 % that starts with \.
4804 %
4805 % Since macro invocations are followed by braces, we can just redefine them
4806 % to take a single TeX argument. The case of a macro invocation that
4807 % goes to end-of-line is not handled.
4808 %
4809 \macrolist
4810 }
4811
4812
4813 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4814
4815 % Most index entries go through here, but \dosubind is the general case.
4816 % #1 is the index name, #2 is the entry text.
4817 \def\doind#1#2{\dosubind{#1}{#2}{}}
4818
4819 % There is also \dosubind {index}{topic}{subtopic}
4820 % which makes an entry in a two-level index such as the operation index.
4821 % TODO: Two-level index? Operation index?
4822
4823 % Workhorse for all indexes.
4824 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
4825 % empty if called from \doind, as we usually are (the main exception
4826 % is with most defuns, which call us directly).
4827 %
4828 \def\dosubind#1#2#3{%
4829 \iflinks
4830 {%
4831 \requireopenindexfile{#1}%
4832 % Store the main index entry text (including the third arg).
4833 \toks0 = {#2}%
4834 % If third arg is present, precede it with a space.
4835 \def\thirdarg{#3}%
4836 \ifx\thirdarg\empty \else
4837 \toks0 = \expandafter{\the\toks0 \space #3}%
4838 \fi
4839 %
4840 \edef\writeto{\csname#1indfile\endcsname}%
4841 %
4842 \safewhatsit\dosubindwrite
4843 }%
4844 \fi
4845 }
4846
4847 % Check if an index file has been opened, and if not, open it.
4848 \def\requireopenindexfile#1{%
4849 \ifnum\csname #1indfile\endcsname=0
4850 \expandafter\newwrite \csname#1indfile\endcsname
4851 \edef\suffix{#1}%
4852 % A .fls suffix would conflict with the file extension for the output
4853 % of -recorder, so use .f1s instead.
4854 \ifx\suffix\indexisfl\def\suffix{f1}\fi
4855 % Open the file
4856 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
4857 % Using \immediate here prevents an object entering into the current box,
4858 % which could confound checks such as those in \safewhatsit for preceding
4859 % skips.
4860 \fi}
4861 \def\indexisfl{fl}
4862
4863 % Output \ as {\indexbackslash}, because \ is an escape character in
4864 % the index files.
4865 \let\indexbackslash=\relax
4866 {\catcode`\@=0 \catcode`\\=\active
4867 @gdef@useindexbackslash{@def\{{@indexbackslash}}}
4868 }
4869
4870 % Definition for writing index entry text.
4871 \def\sortas#1{\ignorespaces}%
4872
4873 % Definition for writing index entry sort key. Should occur at the at
4874 % the beginning of the index entry, like
4875 % @cindex @sortas{september} \september
4876 % The \ignorespaces takes care of following space, but there's no way
4877 % to remove space before it.
4878 {
4879 \catcode`\-=13
4880 \gdef\indexwritesortas{%
4881 \begingroup
4882 \indexnonalnumreappear
4883 \indexwritesortasxxx}
4884 \gdef\indexwritesortasxxx#1{%
4885 \xdef\indexsortkey{#1}\endgroup}
4886 }
4887
4888
4889 % Write the entry in \toks0 to the index file.
4890 %
4891 \def\dosubindwrite{%
4892 % Put the index entry in the margin if desired.
4893 \ifx\SETmarginindex\relax\else
4894 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
4895 \fi
4896 %
4897 % Remember, we are within a group.
4898 \indexdummies % Must do this here, since \bf, etc expand at this stage
4899 \useindexbackslash % \indexbackslash isn't defined now so it will be output
4900 % as is; and it will print as backslash.
4901 % Get the string to sort by, by processing the index entry with all
4902 % font commands turned off.
4903 {\indexnofonts
4904 \indexnonalnumdisappear
4905 \xdef\indexsortkey{}%
4906 \let\sortas=\indexwritesortas
4907 \edef\temp{\the\toks0}%
4908 \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
4909 \ifx\indexsortkey\empty
4910 \xdef\indexsortkey{\temp}%
4911 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
4912 \fi
4913 }%
4914 %
4915 % Set up the complete index entry, with both the sort key and
4916 % the original text, including any font commands. We write
4917 % three arguments to \entry to the .?? file (four in the
4918 % subentry case), texindex reduces to two when writing the .??s
4919 % sorted result.
4920 \edef\temp{%
4921 \write\writeto{%
4922 \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
4923 }%
4924 \temp
4925 }
4926 \newbox\dummybox % used above
4927
4928 % Take care of unwanted page breaks/skips around a whatsit:
4929 %
4930 % If a skip is the last thing on the list now, preserve it
4931 % by backing up by \lastskip, doing the \write, then inserting
4932 % the skip again. Otherwise, the whatsit generated by the
4933 % \write or \pdfdest will make \lastskip zero. The result is that
4934 % sequences like this:
4935 % @end defun
4936 % @tindex whatever
4937 % @defun ...
4938 % will have extra space inserted, because the \medbreak in the
4939 % start of the @defun won't see the skip inserted by the @end of
4940 % the previous defun.
4941 %
4942 % But don't do any of this if we're not in vertical mode. We
4943 % don't want to do a \vskip and prematurely end a paragraph.
4944 %
4945 % Avoid page breaks due to these extra skips, too.
4946 %
4947 % But wait, there is a catch there:
4948 % We'll have to check whether \lastskip is zero skip. \ifdim is not
4949 % sufficient for this purpose, as it ignores stretch and shrink parts
4950 % of the skip. The only way seems to be to check the textual
4951 % representation of the skip.
4952 %
4953 % The following is almost like \def\zeroskipmacro{0.0pt} except that
4954 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
4955 %
4956 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
4957 %
4958 \newskip\whatsitskip
4959 \newcount\whatsitpenalty
4960 %
4961 % ..., ready, GO:
4962 %
4963 \def\safewhatsit#1{\ifhmode
4964 #1%
4965 \else
4966 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
4967 \whatsitskip = \lastskip
4968 \edef\lastskipmacro{\the\lastskip}%
4969 \whatsitpenalty = \lastpenalty
4970 %
4971 % If \lastskip is nonzero, that means the last item was a
4972 % skip. And since a skip is discardable, that means this
4973 % -\whatsitskip glue we're inserting is preceded by a
4974 % non-discardable item, therefore it is not a potential
4975 % breakpoint, therefore no \nobreak needed.
4976 \ifx\lastskipmacro\zeroskipmacro
4977 \else
4978 \vskip-\whatsitskip
4979 \fi
4980 %
4981 #1%
4982 %
4983 \ifx\lastskipmacro\zeroskipmacro
4984 % If \lastskip was zero, perhaps the last item was a penalty, and
4985 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
4986 % to re-insert the same penalty (values >10000 are used for various
4987 % signals); since we just inserted a non-discardable item, any
4988 % following glue (such as a \parskip) would be a breakpoint. For example:
4989 % @deffn deffn-whatever
4990 % @vindex index-whatever
4991 % Description.
4992 % would allow a break between the index-whatever whatsit
4993 % and the "Description." paragraph.
4994 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
4995 \else
4996 % On the other hand, if we had a nonzero \lastskip,
4997 % this make-up glue would be preceded by a non-discardable item
4998 % (the whatsit from the \write), so we must insert a \nobreak.
4999 \nobreak\vskip\whatsitskip
5000 \fi
5001 \fi}
5002
5003 % The index entry written in the file actually looks like
5004 % \entry {sortstring}{page}{topic}
5005 % or
5006 % \entry {sortstring}{page}{topic}{subtopic}
5007 % The texindex program reads in these files and writes files
5008 % containing these kinds of lines:
5009 % \initial {c}
5010 % before the first topic whose initial is c
5011 % \entry {topic}{pagelist}
5012 % for a topic that is used without subtopics
5013 % \primary {topic}
5014 % for the beginning of a topic that is used with subtopics
5015 % \secondary {subtopic}{pagelist}
5016 % for each subtopic.
5017
5018 % Define the user-accessible indexing commands
5019 % @findex, @vindex, @kindex, @cindex.
5020
5021 \def\findex {\fnindex}
5022 \def\kindex {\kyindex}
5023 \def\cindex {\cpindex}
5024 \def\vindex {\vrindex}
5025 \def\tindex {\tpindex}
5026 \def\pindex {\pgindex}
5027
5028 \def\cindexsub {\begingroup\obeylines\cindexsub}
5029 {\obeylines %
5030 \gdef\cindexsub "#1" #2^^M{\endgroup %
5031 \dosubind{cp}{#2}{#1}}}
5032
5033 % Define the macros used in formatting output of the sorted index material.
5034
5035 % @printindex causes a particular index (the ??s file) to get printed.
5036 % It does not print any chapter heading (usually an @unnumbered).
5037 %
5038 \parseargdef\printindex{\begingroup
5039 \dobreak \chapheadingskip{10000}%
5040 %
5041 \smallfonts \rm
5042 \tolerance = 9500
5043 \plainfrenchspacing
5044 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5045 %
5046 % See if the index file exists and is nonempty.
5047 % Change catcode of @ here so that if the index file contains
5048 % \initial {@}
5049 % as its first line, TeX doesn't complain about mismatched braces
5050 % (because it thinks @} is a control sequence).
5051 \catcode`\@ = 11
5052 % See comment in \requireopenindexfile.
5053 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5054 \openin 1 \jobname.\indexname s
5055 \ifeof 1
5056 % \enddoublecolumns gets confused if there is no text in the index,
5057 % and it loses the chapter title and the aux file entries for the
5058 % index. The easiest way to prevent this problem is to make sure
5059 % there is some text.
5060 \putwordIndexNonexistent
5061 \else
5062 \catcode`\\ = 0
5063 \escapechar = `\\
5064 %
5065 % If the index file exists but is empty, then \openin leaves \ifeof
5066 % false. We have to make TeX try to read something from the file, so
5067 % it can discover if there is anything in it.
5068 \read 1 to \thisline
5069 \ifeof 1
5070 \putwordIndexIsEmpty
5071 \else
5072 % Index files are almost Texinfo source, but we use \ as the escape
5073 % character. It would be better to use @, but that's too big a change
5074 % to make right now.
5075 \def\indexbackslash{\ttbackslash}%
5076 \let\indexlbrace\{ % Likewise, set these sequences for braces
5077 \let\indexrbrace\} % used in the sort key.
5078 \begindoublecolumns
5079 \let\entryorphanpenalty=\indexorphanpenalty
5080 %
5081 % Read input from the index file line by line.
5082 \loopdo
5083 \ifeof1
5084 \let\firsttoken\relax
5085 \else
5086 \read 1 to \nextline
5087 \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
5088 \act
5089 \fi
5090 \thisline
5091 %
5092 \ifeof1\else
5093 \let\thisline\nextline
5094 \repeat
5095 %%
5096 \enddoublecolumns
5097 \fi
5098 \fi
5099 \closein 1
5100 \endgroup}
5101
5102 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
5103 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
5104
5105 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
5106 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
5107
5108 % These macros are used by the sorted index file itself.
5109 % Change them to control the appearance of the index.
5110
5111 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5112 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5113 \catcode`\$=3
5114 \gdef\initialglyphs{%
5115 % Some changes for non-alphabetic characters. Using the glyphs from the
5116 % math fonts looks more consistent than the typewriter font used elsewhere
5117 % for these characters.
5118 \def\indexbackslash{\math{\backslash}}%
5119 \let\\=\indexbackslash
5120 %
5121 % Can't get bold backslash so don't use bold forward slash
5122 \catcode`\/=13
5123 \def/{{\secrmnotbold \normalslash}}%
5124 \def-{{\normaldash\normaldash}}% en dash `--'
5125 \def^{{\chapbf \normalcaret}}%
5126 \def~{{\chapbf \normaltilde}}%
5127 \def\_{%
5128 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5129 \def|{$\vert$}%
5130 \def<{$\less$}%
5131 \def>{$\gtr$}%
5132 \def+{$\normalplus$}%
5133 }}
5134
5135 \def\initial{%
5136 \bgroup
5137 \initialglyphs
5138 \initialx
5139 }
5140
5141 \def\initialx#1{%
5142 % Remove any glue we may have, we'll be inserting our own.
5143 \removelastskip
5144 %
5145 % We like breaks before the index initials, so insert a bonus.
5146 % The glue before the bonus allows a little bit of space at the
5147 % bottom of a column to reduce an increase in inter-line spacing.
5148 \nobreak
5149 \vskip 0pt plus 5\baselineskip
5150 \penalty -300
5151 \vskip 0pt plus -5\baselineskip
5152 %
5153 % Typeset the initial. Making this add up to a whole number of
5154 % baselineskips increases the chance of the dots lining up from column
5155 % to column. It still won't often be perfect, because of the stretch
5156 % we need before each entry, but it's better.
5157 %
5158 % No shrink because it confuses \balancecolumns.
5159 \vskip 1.67\baselineskip plus 1\baselineskip
5160 \leftline{\secfonts \kern-0.05em \secbf #1}%
5161 % \secfonts is inside the argument of \leftline so that the change of
5162 % \baselineskip will not affect any glue inserted before the vbox that
5163 % \leftline creates.
5164 % Do our best not to break after the initial.
5165 \nobreak
5166 \vskip .33\baselineskip plus .1\baselineskip
5167 \egroup % \initialglyphs
5168 }
5169
5170 \newdimen\entryrightmargin
5171 \entryrightmargin=0pt
5172
5173 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5174 % then page number (#2) flushed to the right margin. It is used for index
5175 % and table of contents entries. The paragraph is indented by \leftskip.
5176 %
5177 \def\entry{%
5178 \begingroup
5179 %
5180 % Start a new paragraph if necessary, so our assignments below can't
5181 % affect previous text.
5182 \par
5183 %
5184 % No extra space above this paragraph.
5185 \parskip = 0in
5186 %
5187 % When reading the text of entry, convert explicit line breaks
5188 % from @* into spaces. The user might give these in long section
5189 % titles, for instance.
5190 \def\*{\unskip\space\ignorespaces}%
5191 \def\entrybreak{\hfil\break}% An undocumented command
5192 %
5193 % A bit of stretch before each entry for the benefit of balancing
5194 % columns.
5195 \vskip 0pt plus0.5pt
5196 %
5197 % Swallow the left brace of the text (first parameter):
5198 \afterassignment\doentry
5199 \let\temp =
5200 }
5201 \def\entrybreak{\unskip\space\ignorespaces}%
5202 \def\doentry{%
5203 % Save the text of the entry
5204 \global\setbox\boxA=\hbox\bgroup
5205 \bgroup % Instead of the swallowed brace.
5206 \noindent
5207 \aftergroup\finishentry
5208 % And now comes the text of the entry.
5209 % Not absorbing as a macro argument reduces the chance of problems
5210 % with catcodes occurring.
5211 }
5212 {\catcode`\@=11
5213 \gdef\finishentry#1{%
5214 \egroup % end box A
5215 \dimen@ = \wd\boxA % Length of text of entry
5216 \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
5217 % #1 is the page number.
5218 %
5219 % Get the width of the page numbers, and only use
5220 % leaders if they are present.
5221 \global\setbox\boxB = \hbox{#1}%
5222 \ifdim\wd\boxB = 0pt
5223 \null\nobreak\hfill\ %
5224 \else
5225 %
5226 \null\nobreak\indexdotfill % Have leaders before the page number.
5227 %
5228 \ifpdf
5229 \pdfgettoks#1.%
5230 \bgroup\let\domark\relax
5231 \hskip\skip\thinshrinkable\the\toksA
5232 \egroup
5233 % The redefinion of \domark stops marks being added in \pdflink to
5234 % preserve coloured links across page boundaries. Otherwise the marks
5235 % would get in the way of \lastbox in \insertindexentrybox.
5236 \else
5237 \hskip\skip\thinshrinkable #1%
5238 \fi
5239 \fi
5240 \egroup % end \boxA
5241 \ifdim\wd\boxB = 0pt
5242 \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
5243 \else
5244 \global\setbox\entryindexbox=\vbox\bgroup
5245 \prevdepth=\entrylinedepth
5246 \noindent
5247 % We want the text of the entries to be aligned to the left, and the
5248 % page numbers to be aligned to the right.
5249 %
5250 \advance\leftskip by 0pt plus 1fil
5251 \advance\leftskip by 0pt plus -1fill
5252 \rightskip = 0pt plus -1fil
5253 \advance\rightskip by 0pt plus 1fill
5254 % Cause last line, which could consist of page numbers on their own
5255 % if the list of page numbers is long, to be aligned to the right.
5256 \parfillskip=0pt plus -1fill
5257 %
5258 \hangindent=1em
5259 %
5260 \advance\rightskip by \entryrightmargin
5261 % Determine how far we can stretch into the margin.
5262 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5263 % fit on one line in @letterpaper format.
5264 \ifdim\entryrightmargin>2.1em
5265 \dimen@i=2.1em
5266 \else
5267 \dimen@i=0em
5268 \fi
5269 \advance \parfillskip by 0pt minus 1\dimen@i
5270 %
5271 \dimen@ii = \hsize
5272 \advance\dimen@ii by -1\leftskip
5273 \advance\dimen@ii by -1\entryrightmargin
5274 \advance\dimen@ii by 1\dimen@i
5275 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5276 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5277 \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
5278 \dimen@ii = \hsize
5279 \advance \dimen@ii by -1em
5280 \ifnum\dimen@>\dimen@ii
5281 % If the entry is too long, use the whole line
5282 \dimen@ = \dimen@ii
5283 \fi
5284 \advance\leftskip by 0pt plus 1fill % ragged right
5285 \advance \dimen@ by 1\rightskip
5286 \parshape = 2 0pt \dimen@ 1em \dimen@ii
5287 % Ideally we'd add a finite glue at the end of the first line only, but
5288 % TeX doesn't seem to provide a way to do such a thing.
5289 \fi\fi
5290 \unhbox\boxA
5291 %
5292 % Do not prefer a separate line ending with a hyphen to fewer lines.
5293 \finalhyphendemerits = 0
5294 %
5295 % Word spacing - no stretch
5296 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5297 %
5298 \linepenalty=1000 % Discourage line breaks.
5299 \hyphenpenalty=5000 % Discourage hyphenation.
5300 %
5301 \par % format the paragraph
5302 \egroup % The \vbox
5303 \fi
5304 \endgroup
5305 % delay text of entry until after penalty
5306 \bgroup\aftergroup\insertindexentrybox
5307 \entryorphanpenalty
5308 }}
5309
5310 \newskip\thinshrinkable
5311 \skip\thinshrinkable=.15em minus .15em
5312
5313 \newbox\entryindexbox
5314 \def\insertindexentrybox{%
5315 \copy\entryindexbox
5316 % The following gets the depth of the last box. This is for even
5317 % line spacing when entries span several lines.
5318 \setbox\dummybox\vbox{%
5319 \unvbox\entryindexbox
5320 \nointerlineskip
5321 \lastbox
5322 \global\entrylinedepth=\prevdepth
5323 }%
5324 % Note that we couldn't simply \unvbox\entryindexbox followed by
5325 % \nointerlineskip\lastbox to remove the last box and then reinstate it,
5326 % because this resets how far the box has been \moveleft'ed to 0. \unvbox
5327 % doesn't affect \prevdepth either.
5328 }
5329 \newdimen\entrylinedepth
5330
5331 % Default is no penalty
5332 \let\entryorphanpenalty\egroup
5333
5334 % Used from \printindex. \firsttoken should be the first token
5335 % after the \entry. If it's not another \entry, we are at the last
5336 % line of a group of index entries, so insert a penalty to discourage
5337 % orphaned index entries.
5338 \long\def\indexorphanpenalty{%
5339 \def\isentry{\entry}%
5340 \ifx\firsttoken\isentry
5341 \else
5342 \unskip\penalty 9000
5343 % The \unskip here stops breaking before the glue. It relies on the
5344 % \vskip above being there, otherwise there is an error
5345 % "You can't use `\unskip' in vertical mode". There has to be glue
5346 % in the current vertical list that hasn't been added to the
5347 % "current page". See Chapter 24 of the TeXbook. This contradicts
5348 % Section 8.3.7 in "TeX by Topic," though.
5349 \fi
5350 \egroup % now comes the box added with \aftergroup
5351 }
5352
5353 % Like plain.tex's \dotfill, except uses up at least 1 em.
5354 % The filll stretch here overpowers both the fil and fill stretch to push
5355 % the page number to the right.
5356 \def\indexdotfill{\cleaders
5357 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5358
5359
5360 \def\primary #1{\line{#1\hfil}}
5361
5362 \newskip\secondaryindent \secondaryindent=0.5cm
5363 \def\secondary#1#2{{%
5364 \parfillskip=0in
5365 \parskip=0in
5366 \hangindent=1in
5367 \hangafter=1
5368 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5369 \ifpdf
5370 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5371 \else
5372 #2
5373 \fi
5374 \par
5375 }}
5376
5377 % Define two-column mode, which we use to typeset indexes.
5378 % Adapted from the TeXbook, page 416, which is to say,
5379 % the manmac.tex format used to print the TeXbook itself.
5380 \catcode`\@=11 % private names
5381
5382 \newbox\partialpage
5383 \newdimen\doublecolumnhsize
5384 \newdimen\doublecolumntopgap
5385 \doublecolumntopgap = 0pt
5386
5387 % Use inside an output routine to save \topmark and \firstmark
5388 \def\savemarks{%
5389 \global\savedtopmark=\expandafter{\topmark }%
5390 \global\savedfirstmark=\expandafter{\firstmark }%
5391 }
5392 \newtoks\savedtopmark
5393 \newtoks\savedfirstmark
5394
5395 % Set \topmark and \firstmark for next time \output runs.
5396 % Can't be run from withinside \output (because any material
5397 % added while an output routine is active, including
5398 % penalties, is saved for after it finishes). The page so far
5399 % should be empty, otherwise what's on it will be thrown away.
5400 \def\restoremarks{%
5401 \mark{\the\savedtopmark}%
5402 \bgroup\output = {%
5403 \setbox\dummybox=\box\PAGE
5404 }abc\eject\egroup
5405 % "abc" because output routine doesn't fire for a completely empty page.
5406 \mark{\the\savedfirstmark}%
5407 }
5408
5409 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5410 % If not much space left on page, start a new page.
5411 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5412 %
5413 % Grab any single-column material above us.
5414 \output = {%
5415 %
5416 % Here is a possibility not foreseen in manmac: if we accumulate a
5417 % whole lot of material, we might end up calling this \output
5418 % routine twice in a row (see the doublecol-lose test, which is
5419 % essentially a couple of indexes with @setchapternewpage off). In
5420 % that case we just ship out what is in \partialpage with the normal
5421 % output routine. Generally, \partialpage will be empty when this
5422 % runs and this will be a no-op. See the indexspread.tex test case.
5423 \ifvoid\partialpage \else
5424 \onepageout{\pagecontents\partialpage}%
5425 \fi
5426 %
5427 \global\setbox\partialpage = \vbox{%
5428 % Unvbox the main output page.
5429 \unvbox\PAGE
5430 \kern-\topskip \kern\baselineskip
5431 }%
5432 \savemarks
5433 }%
5434 \eject % run that output routine to set \partialpage
5435 \restoremarks
5436 %
5437 % We recover the two marks that the last output routine saved in order
5438 % to propagate the information in marks added around a chapter heading,
5439 % which could be otherwise be lost by the time the final page is output.
5440 %
5441 %
5442 % Use the double-column output routine for subsequent pages.
5443 \output = {\doublecolumnout}%
5444 %
5445 % Change the page size parameters. We could do this once outside this
5446 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5447 % format, but then we repeat the same computation. Repeating a couple
5448 % of assignments once per index is clearly meaningless for the
5449 % execution time, so we may as well do it in one place.
5450 %
5451 % First we halve the line length, less a little for the gutter between
5452 % the columns. We compute the gutter based on the line length, so it
5453 % changes automatically with the paper format. The magic constant
5454 % below is chosen so that the gutter has the same value (well, +-<1pt)
5455 % as it did when we hard-coded it.
5456 %
5457 % We put the result in a separate register, \doublecolumhsize, so we
5458 % can restore it in \pagesofar, after \hsize itself has (potentially)
5459 % been clobbered.
5460 %
5461 \doublecolumnhsize = \hsize
5462 \advance\doublecolumnhsize by -.04154\hsize
5463 \divide\doublecolumnhsize by 2
5464 \hsize = \doublecolumnhsize
5465 %
5466 % Double the \vsize as well. (We don't need a separate register here,
5467 % since nobody clobbers \vsize.)
5468 \global\doublecolumntopgap = \topskip
5469 \global\advance\doublecolumntopgap by -1\baselineskip
5470 \advance\vsize by -1\doublecolumntopgap
5471 \vsize = 2\vsize
5472 \topskip=0pt
5473 \global\entrylinedepth=0pt\relax
5474 }
5475
5476 % The double-column output routine for all double-column pages except
5477 % the last, which is done by \balancecolumns.
5478 %
5479 \def\doublecolumnout{%
5480 %
5481 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5482 % Get the available space for the double columns -- the normal
5483 % (undoubled) page height minus any material left over from the
5484 % previous page.
5485 \dimen@ = \vsize
5486 \divide\dimen@ by 2
5487 \advance\dimen@ by -\ht\partialpage
5488 %
5489 % box0 will be the left-hand column, box2 the right.
5490 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
5491 \onepageout\pagesofar
5492 \unvbox255
5493 \penalty\outputpenalty
5494 }
5495 %
5496 % Re-output the contents of the output page -- any previous material,
5497 % followed by the two boxes we just split, in box0 and box2.
5498 \def\pagesofar{%
5499 \unvbox\partialpage
5500 %
5501 \hsize = \doublecolumnhsize
5502 \wd0=\hsize \wd2=\hsize
5503 \vbox{%
5504 \vskip\doublecolumntopgap
5505 \hbox to\pagewidth{\box0\hfil\box2}}%
5506 }
5507
5508
5509 % Finished with with double columns.
5510 \def\enddoublecolumns{%
5511 % The following penalty ensures that the page builder is exercised
5512 % _before_ we change the output routine. This is necessary in the
5513 % following situation:
5514 %
5515 % The last section of the index consists only of a single entry.
5516 % Before this section, \pagetotal is less than \pagegoal, so no
5517 % break occurs before the last section starts. However, the last
5518 % section, consisting of \initial and the single \entry, does not
5519 % fit on the page and has to be broken off. Without the following
5520 % penalty the page builder will not be exercised until \eject
5521 % below, and by that time we'll already have changed the output
5522 % routine to the \balancecolumns version, so the next-to-last
5523 % double-column page will be processed with \balancecolumns, which
5524 % is wrong: The two columns will go to the main vertical list, with
5525 % the broken-off section in the recent contributions. As soon as
5526 % the output routine finishes, TeX starts reconsidering the page
5527 % break. The two columns and the broken-off section both fit on the
5528 % page, because the two columns now take up only half of the page
5529 % goal. When TeX sees \eject from below which follows the final
5530 % section, it invokes the new output routine that we've set after
5531 % \balancecolumns below; \onepageout will try to fit the two columns
5532 % and the final section into the vbox of \pageheight (see
5533 % \pagebody), causing an overfull box.
5534 %
5535 % Note that glue won't work here, because glue does not exercise the
5536 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5537 \penalty0
5538 %
5539 \output = {%
5540 % Split the last of the double-column material.
5541 \savemarks
5542 \balancecolumns
5543 %
5544 % Having called \balancecolumns once, we do not
5545 % want to call it again. Therefore, reset \output to its normal
5546 % definition right away.
5547 \global\output = {\onepageout{\pagecontents\PAGE}}%
5548 }%
5549 \eject
5550 \endgroup % started in \begindoublecolumns
5551 \restoremarks
5552 % Leave the double-column material on the current page, no automatic
5553 % page break.
5554 \box\balancedcolumns
5555 %
5556 % \pagegoal was set to the doubled \vsize above, since we restarted
5557 % the current page. We're now back to normal single-column
5558 % typesetting, so reset \pagegoal to the normal \vsize (after the
5559 % \endgroup where \vsize got restored).
5560 \pagegoal = \vsize
5561 }
5562 \newbox\balancedcolumns
5563 \setbox\balancedcolumns=\vbox{shouldnt see this}%
5564 %
5565 % Only called for the last of the double column material. \doublecolumnout
5566 % does the others.
5567 \def\balancecolumns{%
5568 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
5569 \dimen@ = \ht0
5570 \advance\dimen@ by \topskip
5571 \advance\dimen@ by-\baselineskip
5572 \ifdim\dimen@<14\baselineskip
5573 % Don't split a short final column in two.
5574 \setbox2=\vbox{}%
5575 \else
5576 \divide\dimen@ by 2 % target to split to
5577 \dimen@ii = \dimen@
5578 \splittopskip = \topskip
5579 % Loop until the second column is no higher than the first
5580 {%
5581 \vbadness = 10000
5582 \loop
5583 \global\setbox3 = \copy0
5584 \global\setbox1 = \vsplit3 to \dimen@
5585 % Remove glue from bottom of first column to
5586 % make sure it is higher than the second.
5587 \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}%
5588 \ifdim\ht3>\ht1
5589 \global\advance\dimen@ by 1pt
5590 \repeat
5591 }%
5592 \multiply\dimen@ii by 4
5593 \divide\dimen@ii by 5
5594 \ifdim\ht3<\dimen@ii
5595 % Column heights are too different, so don't make their bottoms
5596 % flush with each other. The glue at the end of the second column
5597 % allows a second column to stretch, reducing the difference in
5598 % height between the two.
5599 \setbox0=\vbox to\dimen@{\unvbox1\vfill}%
5600 \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}%
5601 \else
5602 \setbox0=\vbox to\dimen@{\unvbox1}%
5603 \setbox2=\vbox to\dimen@{\unvbox3}%
5604 \fi
5605 \fi
5606 %
5607 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5608 }
5609 \catcode`\@ = \other
5610
5611
5612 \message{sectioning,}
5613 % Chapters, sections, etc.
5614
5615 % Let's start with @part.
5616 \outer\parseargdef\part{\partzzz{#1}}
5617 \def\partzzz#1{%
5618 \chapoddpage
5619 \null
5620 \vskip.3\vsize % move it down on the page a bit
5621 \begingroup
5622 \noindent \titlefonts\rmisbold #1\par % the text
5623 \let\lastnode=\empty % no node to associate with
5624 \writetocentry{part}{#1}{}% but put it in the toc
5625 \headingsoff % no headline or footline on the part page
5626 % This outputs a mark at the end of the page that clears \thischapter
5627 % and \thissection, as is done in \startcontents.
5628 \let\pchapsepmacro\relax
5629 \chapmacro{}{Yomitfromtoc}{}%
5630 \chapoddpage
5631 \endgroup
5632 }
5633
5634 % \unnumberedno is an oxymoron. But we count the unnumbered
5635 % sections so that we can refer to them unambiguously in the pdf
5636 % outlines by their "section number". We avoid collisions with chapter
5637 % numbers by starting them at 10000. (If a document ever has 10000
5638 % chapters, we're in trouble anyway, I'm sure.)
5639 \newcount\unnumberedno \unnumberedno = 10000
5640 \newcount\chapno
5641 \newcount\secno \secno=0
5642 \newcount\subsecno \subsecno=0
5643 \newcount\subsubsecno \subsubsecno=0
5644
5645 % This counter is funny since it counts through charcodes of letters A, B, ...
5646 \newcount\appendixno \appendixno = `\@
5647 %
5648 % \def\appendixletter{\char\the\appendixno}
5649 % We do the following ugly conditional instead of the above simple
5650 % construct for the sake of pdftex, which needs the actual
5651 % letter in the expansion, not just typeset.
5652 %
5653 \def\appendixletter{%
5654 \ifnum\appendixno=`A A%
5655 \else\ifnum\appendixno=`B B%
5656 \else\ifnum\appendixno=`C C%
5657 \else\ifnum\appendixno=`D D%
5658 \else\ifnum\appendixno=`E E%
5659 \else\ifnum\appendixno=`F F%
5660 \else\ifnum\appendixno=`G G%
5661 \else\ifnum\appendixno=`H H%
5662 \else\ifnum\appendixno=`I I%
5663 \else\ifnum\appendixno=`J J%
5664 \else\ifnum\appendixno=`K K%
5665 \else\ifnum\appendixno=`L L%
5666 \else\ifnum\appendixno=`M M%
5667 \else\ifnum\appendixno=`N N%
5668 \else\ifnum\appendixno=`O O%
5669 \else\ifnum\appendixno=`P P%
5670 \else\ifnum\appendixno=`Q Q%
5671 \else\ifnum\appendixno=`R R%
5672 \else\ifnum\appendixno=`S S%
5673 \else\ifnum\appendixno=`T T%
5674 \else\ifnum\appendixno=`U U%
5675 \else\ifnum\appendixno=`V V%
5676 \else\ifnum\appendixno=`W W%
5677 \else\ifnum\appendixno=`X X%
5678 \else\ifnum\appendixno=`Y Y%
5679 \else\ifnum\appendixno=`Z Z%
5680 % The \the is necessary, despite appearances, because \appendixletter is
5681 % expanded while writing the .toc file. \char\appendixno is not
5682 % expandable, thus it is written literally, thus all appendixes come out
5683 % with the same letter (or @) in the toc without it.
5684 \else\char\the\appendixno
5685 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
5686 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
5687
5688 % Each @chapter defines these (using marks) as the number+name, number
5689 % and name of the chapter. Page headings and footings can use
5690 % these. @section does likewise.
5691 \def\thischapter{}
5692 \def\thischapternum{}
5693 \def\thischaptername{}
5694 \def\thissection{}
5695 \def\thissectionnum{}
5696 \def\thissectionname{}
5697
5698 \newcount\absseclevel % used to calculate proper heading level
5699 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
5700
5701 % @raisesections: treat @section as chapter, @subsection as section, etc.
5702 \def\raisesections{\global\advance\secbase by -1}
5703 \let\up=\raisesections % original BFox name
5704
5705 % @lowersections: treat @chapter as section, @section as subsection, etc.
5706 \def\lowersections{\global\advance\secbase by 1}
5707 \let\down=\lowersections % original BFox name
5708
5709 % we only have subsub.
5710 \chardef\maxseclevel = 3
5711 %
5712 % A numbered section within an unnumbered changes to unnumbered too.
5713 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
5714 \chardef\unnlevel = \maxseclevel
5715 %
5716 % Trace whether the current chapter is an appendix or not:
5717 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
5718 \def\chapheadtype{N}
5719
5720 % Choose a heading macro
5721 % #1 is heading type
5722 % #2 is heading level
5723 % #3 is text for heading
5724 \def\genhead#1#2#3{%
5725 % Compute the abs. sec. level:
5726 \absseclevel=#2
5727 \advance\absseclevel by \secbase
5728 % Make sure \absseclevel doesn't fall outside the range:
5729 \ifnum \absseclevel < 0
5730 \absseclevel = 0
5731 \else
5732 \ifnum \absseclevel > 3
5733 \absseclevel = 3
5734 \fi
5735 \fi
5736 % The heading type:
5737 \def\headtype{#1}%
5738 \if \headtype U%
5739 \ifnum \absseclevel < \unnlevel
5740 \chardef\unnlevel = \absseclevel
5741 \fi
5742 \else
5743 % Check for appendix sections:
5744 \ifnum \absseclevel = 0
5745 \edef\chapheadtype{\headtype}%
5746 \else
5747 \if \headtype A\if \chapheadtype N%
5748 \errmessage{@appendix... within a non-appendix chapter}%
5749 \fi\fi
5750 \fi
5751 % Check for numbered within unnumbered:
5752 \ifnum \absseclevel > \unnlevel
5753 \def\headtype{U}%
5754 \else
5755 \chardef\unnlevel = 3
5756 \fi
5757 \fi
5758 % Now print the heading:
5759 \if \headtype U%
5760 \ifcase\absseclevel
5761 \unnumberedzzz{#3}%
5762 \or \unnumberedseczzz{#3}%
5763 \or \unnumberedsubseczzz{#3}%
5764 \or \unnumberedsubsubseczzz{#3}%
5765 \fi
5766 \else
5767 \if \headtype A%
5768 \ifcase\absseclevel
5769 \appendixzzz{#3}%
5770 \or \appendixsectionzzz{#3}%
5771 \or \appendixsubseczzz{#3}%
5772 \or \appendixsubsubseczzz{#3}%
5773 \fi
5774 \else
5775 \ifcase\absseclevel
5776 \chapterzzz{#3}%
5777 \or \seczzz{#3}%
5778 \or \numberedsubseczzz{#3}%
5779 \or \numberedsubsubseczzz{#3}%
5780 \fi
5781 \fi
5782 \fi
5783 \suppressfirstparagraphindent
5784 }
5785
5786 % an interface:
5787 \def\numhead{\genhead N}
5788 \def\apphead{\genhead A}
5789 \def\unnmhead{\genhead U}
5790
5791 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
5792 % all lower-level sectioning counters to zero.
5793 %
5794 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
5795 % (e.g., figures), q.v. By default (before any chapter), that is empty.
5796 \let\chaplevelprefix = \empty
5797 %
5798 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
5799 \def\chapterzzz#1{%
5800 % section resetting is \global in case the chapter is in a group, such
5801 % as an @include file.
5802 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5803 \global\advance\chapno by 1
5804 %
5805 % Used for \float.
5806 \gdef\chaplevelprefix{\the\chapno.}%
5807 \resetallfloatnos
5808 %
5809 % \putwordChapter can contain complex things in translations.
5810 \toks0=\expandafter{\putwordChapter}%
5811 \message{\the\toks0 \space \the\chapno}%
5812 %
5813 % Write the actual heading.
5814 \chapmacro{#1}{Ynumbered}{\the\chapno}%
5815 %
5816 % So @section and the like are numbered underneath this chapter.
5817 \global\let\section = \numberedsec
5818 \global\let\subsection = \numberedsubsec
5819 \global\let\subsubsection = \numberedsubsubsec
5820 }
5821
5822 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
5823 %
5824 \def\appendixzzz#1{%
5825 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5826 \global\advance\appendixno by 1
5827 \gdef\chaplevelprefix{\appendixletter.}%
5828 \resetallfloatnos
5829 %
5830 % \putwordAppendix can contain complex things in translations.
5831 \toks0=\expandafter{\putwordAppendix}%
5832 \message{\the\toks0 \space \appendixletter}%
5833 %
5834 \chapmacro{#1}{Yappendix}{\appendixletter}%
5835 %
5836 \global\let\section = \appendixsec
5837 \global\let\subsection = \appendixsubsec
5838 \global\let\subsubsection = \appendixsubsubsec
5839 }
5840
5841 % normally unnmhead0 calls unnumberedzzz:
5842 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
5843 \def\unnumberedzzz#1{%
5844 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5845 \global\advance\unnumberedno by 1
5846 %
5847 % Since an unnumbered has no number, no prefix for figures.
5848 \global\let\chaplevelprefix = \empty
5849 \resetallfloatnos
5850 %
5851 % This used to be simply \message{#1}, but TeX fully expands the
5852 % argument to \message. Therefore, if #1 contained @-commands, TeX
5853 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
5854 % expanded @cite (which turns out to cause errors because \cite is meant
5855 % to be executed, not expanded).
5856 %
5857 % Anyway, we don't want the fully-expanded definition of @cite to appear
5858 % as a result of the \message, we just want `@cite' itself. We use
5859 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
5860 % simply yielding the contents of <toks register>. (We also do this for
5861 % the toc entries.)
5862 \toks0 = {#1}%
5863 \message{(\the\toks0)}%
5864 %
5865 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
5866 %
5867 \global\let\section = \unnumberedsec
5868 \global\let\subsection = \unnumberedsubsec
5869 \global\let\subsubsection = \unnumberedsubsubsec
5870 }
5871
5872 % @centerchap is like @unnumbered, but the heading is centered.
5873 \outer\parseargdef\centerchap{%
5874 \let\centerparametersmaybe = \centerparameters
5875 \unnmhead0{#1}%
5876 \let\centerparametersmaybe = \relax
5877 }
5878
5879 % @top is like @unnumbered.
5880 \let\top\unnumbered
5881
5882 % Sections.
5883 %
5884 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
5885 \def\seczzz#1{%
5886 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5887 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
5888 }
5889
5890 % normally calls appendixsectionzzz:
5891 \outer\parseargdef\appendixsection{\apphead1{#1}}
5892 \def\appendixsectionzzz#1{%
5893 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5894 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
5895 }
5896 \let\appendixsec\appendixsection
5897
5898 % normally calls unnumberedseczzz:
5899 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
5900 \def\unnumberedseczzz#1{%
5901 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5902 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
5903 }
5904
5905 % Subsections.
5906 %
5907 % normally calls numberedsubseczzz:
5908 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
5909 \def\numberedsubseczzz#1{%
5910 \global\subsubsecno=0 \global\advance\subsecno by 1
5911 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
5912 }
5913
5914 % normally calls appendixsubseczzz:
5915 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
5916 \def\appendixsubseczzz#1{%
5917 \global\subsubsecno=0 \global\advance\subsecno by 1
5918 \sectionheading{#1}{subsec}{Yappendix}%
5919 {\appendixletter.\the\secno.\the\subsecno}%
5920 }
5921
5922 % normally calls unnumberedsubseczzz:
5923 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
5924 \def\unnumberedsubseczzz#1{%
5925 \global\subsubsecno=0 \global\advance\subsecno by 1
5926 \sectionheading{#1}{subsec}{Ynothing}%
5927 {\the\unnumberedno.\the\secno.\the\subsecno}%
5928 }
5929
5930 % Subsubsections.
5931 %
5932 % normally numberedsubsubseczzz:
5933 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
5934 \def\numberedsubsubseczzz#1{%
5935 \global\advance\subsubsecno by 1
5936 \sectionheading{#1}{subsubsec}{Ynumbered}%
5937 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
5938 }
5939
5940 % normally appendixsubsubseczzz:
5941 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
5942 \def\appendixsubsubseczzz#1{%
5943 \global\advance\subsubsecno by 1
5944 \sectionheading{#1}{subsubsec}{Yappendix}%
5945 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
5946 }
5947
5948 % normally unnumberedsubsubseczzz:
5949 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
5950 \def\unnumberedsubsubseczzz#1{%
5951 \global\advance\subsubsecno by 1
5952 \sectionheading{#1}{subsubsec}{Ynothing}%
5953 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
5954 }
5955
5956 % These macros control what the section commands do, according
5957 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
5958 % Define them by default for a numbered chapter.
5959 \let\section = \numberedsec
5960 \let\subsection = \numberedsubsec
5961 \let\subsubsection = \numberedsubsubsec
5962
5963 % Define @majorheading, @heading and @subheading
5964
5965 \def\majorheading{%
5966 {\advance\chapheadingskip by 10pt \chapbreak }%
5967 \parsearg\chapheadingzzz
5968 }
5969
5970 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
5971 \def\chapheadingzzz#1{%
5972 \vbox{\chapfonts \raggedtitlesettings #1\par}%
5973 \nobreak\bigskip \nobreak
5974 \suppressfirstparagraphindent
5975 }
5976
5977 % @heading, @subheading, @subsubheading.
5978 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
5979 \suppressfirstparagraphindent}
5980 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
5981 \suppressfirstparagraphindent}
5982 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
5983 \suppressfirstparagraphindent}
5984
5985 % These macros generate a chapter, section, etc. heading only
5986 % (including whitespace, linebreaking, etc. around it),
5987 % given all the information in convenient, parsed form.
5988
5989 % Args are the skip and penalty (usually negative)
5990 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
5991
5992 % Parameter controlling skip before chapter headings (if needed)
5993 \newskip\chapheadingskip
5994
5995 % Define plain chapter starts, and page on/off switching for it.
5996 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
5997
5998 % Start a new page
5999 \def\chappager{\par\vfill\supereject}
6000
6001 % \chapoddpage - start on an odd page for a new chapter
6002 % Because \domark is called before \chapoddpage, the filler page will
6003 % get the headings for the next chapter, which is wrong. But we don't
6004 % care -- we just disable all headings on the filler page.
6005 \def\chapoddpage{%
6006 \chappager
6007 \ifodd\pageno \else
6008 \begingroup
6009 \headingsoff
6010 \null
6011 \chappager
6012 \endgroup
6013 \fi
6014 }
6015
6016 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
6017
6018 \def\CHAPPAGoff{%
6019 \global\let\contentsalignmacro = \chappager
6020 \global\let\pchapsepmacro=\chapbreak
6021 \global\let\pagealignmacro=\chappager}
6022
6023 \def\CHAPPAGon{%
6024 \global\let\contentsalignmacro = \chappager
6025 \global\let\pchapsepmacro=\chappager
6026 \global\let\pagealignmacro=\chappager
6027 \global\def\HEADINGSon{\HEADINGSsingle}}
6028
6029 \def\CHAPPAGodd{%
6030 \global\let\contentsalignmacro = \chapoddpage
6031 \global\let\pchapsepmacro=\chapoddpage
6032 \global\let\pagealignmacro=\chapoddpage
6033 \global\def\HEADINGSon{\HEADINGSdouble}}
6034
6035 \CHAPPAGon
6036
6037 % \chapmacro - Chapter opening.
6038 %
6039 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6040 % Yappendix, Yomitfromtoc), #3 the chapter number.
6041 % Not used for @heading series.
6042 %
6043 % To test against our argument.
6044 \def\Ynothingkeyword{Ynothing}
6045 \def\Yappendixkeyword{Yappendix}
6046 \def\Yomitfromtockeyword{Yomitfromtoc}
6047 %
6048 \def\chapmacro#1#2#3{%
6049 \checkenv{}% chapters, etc., should not start inside an environment.
6050 %
6051 % Insert the first mark before the heading break (see notes for \domark).
6052 \let\prevchapterdefs=\lastchapterdefs
6053 \let\prevsectiondefs=\lastsectiondefs
6054 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6055 \gdef\thissection{}}%
6056 %
6057 \def\temptype{#2}%
6058 \ifx\temptype\Ynothingkeyword
6059 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6060 \gdef\thischapter{\thischaptername}}%
6061 \else\ifx\temptype\Yomitfromtockeyword
6062 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6063 \gdef\thischapter{}}%
6064 \else\ifx\temptype\Yappendixkeyword
6065 \toks0={#1}%
6066 \xdef\lastchapterdefs{%
6067 \gdef\noexpand\thischaptername{\the\toks0}%
6068 \gdef\noexpand\thischapternum{\appendixletter}%
6069 % \noexpand\putwordAppendix avoids expanding indigestible
6070 % commands in some of the translations.
6071 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6072 \noexpand\thischapternum:
6073 \noexpand\thischaptername}%
6074 }%
6075 \else
6076 \toks0={#1}%
6077 \xdef\lastchapterdefs{%
6078 \gdef\noexpand\thischaptername{\the\toks0}%
6079 \gdef\noexpand\thischapternum{\the\chapno}%
6080 % \noexpand\putwordChapter avoids expanding indigestible
6081 % commands in some of the translations.
6082 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6083 \noexpand\thischapternum:
6084 \noexpand\thischaptername}%
6085 }%
6086 \fi\fi\fi
6087 %
6088 % Output the mark. Pass it through \safewhatsit, to take care of
6089 % the preceding space.
6090 \safewhatsit\domark
6091 %
6092 % Insert the chapter heading break.
6093 \pchapsepmacro
6094 %
6095 % Now the second mark, after the heading break. No break points
6096 % between here and the heading.
6097 \let\prevchapterdefs=\lastchapterdefs
6098 \let\prevsectiondefs=\lastsectiondefs
6099 \domark
6100 %
6101 {%
6102 \chapfonts \rmisbold
6103 \let\footnote=\errfootnoteheading % give better error message
6104 %
6105 % Have to define \lastsection before calling \donoderef, because the
6106 % xref code eventually uses it. On the other hand, it has to be called
6107 % after \pchapsepmacro, or the headline will change too soon.
6108 \gdef\lastsection{#1}%
6109 %
6110 % Only insert the separating space if we have a chapter/appendix
6111 % number, and don't print the unnumbered ``number''.
6112 \ifx\temptype\Ynothingkeyword
6113 \setbox0 = \hbox{}%
6114 \def\toctype{unnchap}%
6115 \else\ifx\temptype\Yomitfromtockeyword
6116 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6117 \def\toctype{omit}%
6118 \else\ifx\temptype\Yappendixkeyword
6119 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6120 \def\toctype{app}%
6121 \else
6122 \setbox0 = \hbox{#3\enspace}%
6123 \def\toctype{numchap}%
6124 \fi\fi\fi
6125 %
6126 % Write the toc entry for this chapter. Must come before the
6127 % \donoderef, because we include the current node name in the toc
6128 % entry, and \donoderef resets it to empty.
6129 \writetocentry{\toctype}{#1}{#3}%
6130 %
6131 % For pdftex, we have to write out the node definition (aka, make
6132 % the pdfdest) after any page break, but before the actual text has
6133 % been typeset. If the destination for the pdf outline is after the
6134 % text, then jumping from the outline may wind up with the text not
6135 % being visible, for instance under high magnification.
6136 \donoderef{#2}%
6137 %
6138 % Typeset the actual heading.
6139 \nobreak % Avoid page breaks at the interline glue.
6140 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6141 \unhbox0 #1\par}%
6142 }%
6143 \nobreak\bigskip % no page break after a chapter title
6144 \nobreak
6145 }
6146
6147 % @centerchap -- centered and unnumbered.
6148 \let\centerparametersmaybe = \relax
6149 \def\centerparameters{%
6150 \advance\rightskip by 3\rightskip
6151 \leftskip = \rightskip
6152 \parfillskip = 0pt
6153 }
6154
6155
6156 % I don't think this chapter style is supported any more, so I'm not
6157 % updating it with the new noderef stuff. We'll see. --karl, 11aug03.
6158 %
6159 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
6160 %
6161 \def\unnchfopen #1{%
6162 \chapoddpage
6163 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6164 \nobreak\bigskip\nobreak
6165 }
6166 \def\chfopen #1#2{\chapoddpage {\chapfonts
6167 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
6168 \par\penalty 5000 %
6169 }
6170 \def\centerchfopen #1{%
6171 \chapoddpage
6172 \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
6173 \nobreak\bigskip \nobreak
6174 }
6175 \def\CHAPFopen{%
6176 \global\let\chapmacro=\chfopen
6177 \global\let\centerchapmacro=\centerchfopen}
6178
6179
6180 % Section titles. These macros combine the section number parts and
6181 % call the generic \sectionheading to do the printing.
6182 %
6183 \newskip\secheadingskip
6184 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6185
6186 % Subsection titles.
6187 \newskip\subsecheadingskip
6188 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6189
6190 % Subsubsection titles.
6191 \def\subsubsecheadingskip{\subsecheadingskip}
6192 \def\subsubsecheadingbreak{\subsecheadingbreak}
6193
6194
6195 % Print any size, any type, section title.
6196 %
6197 % #1 is the text of the title,
6198 % #2 is the section level (sec/subsec/subsubsec),
6199 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6200 % #4 is the section number.
6201 %
6202 \def\seckeyword{sec}
6203 %
6204 \def\sectionheading#1#2#3#4{%
6205 {%
6206 \def\sectionlevel{#2}%
6207 \def\temptype{#3}%
6208 %
6209 % It is ok for the @heading series commands to appear inside an
6210 % environment (it's been historically allowed, though the logic is
6211 % dubious), but not the others.
6212 \ifx\temptype\Yomitfromtockeyword\else
6213 \checkenv{}% non-@*heading should not be in an environment.
6214 \fi
6215 \let\footnote=\errfootnoteheading
6216 %
6217 % Switch to the right set of fonts.
6218 \csname #2fonts\endcsname \rmisbold
6219 %
6220 % Insert first mark before the heading break (see notes for \domark).
6221 \let\prevsectiondefs=\lastsectiondefs
6222 \ifx\temptype\Ynothingkeyword
6223 \ifx\sectionlevel\seckeyword
6224 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6225 \gdef\thissection{\thissectionname}}%
6226 \fi
6227 \else\ifx\temptype\Yomitfromtockeyword
6228 % Don't redefine \thissection.
6229 \else\ifx\temptype\Yappendixkeyword
6230 \ifx\sectionlevel\seckeyword
6231 \toks0={#1}%
6232 \xdef\lastsectiondefs{%
6233 \gdef\noexpand\thissectionname{\the\toks0}%
6234 \gdef\noexpand\thissectionnum{#4}%
6235 % \noexpand\putwordSection avoids expanding indigestible
6236 % commands in some of the translations.
6237 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6238 \noexpand\thissectionnum:
6239 \noexpand\thissectionname}%
6240 }%
6241 \fi
6242 \else
6243 \ifx\sectionlevel\seckeyword
6244 \toks0={#1}%
6245 \xdef\lastsectiondefs{%
6246 \gdef\noexpand\thissectionname{\the\toks0}%
6247 \gdef\noexpand\thissectionnum{#4}%
6248 % \noexpand\putwordSection avoids expanding indigestible
6249 % commands in some of the translations.
6250 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6251 \noexpand\thissectionnum:
6252 \noexpand\thissectionname}%
6253 }%
6254 \fi
6255 \fi\fi\fi
6256 %
6257 % Go into vertical mode. Usually we'll already be there, but we
6258 % don't want the following whatsit to end up in a preceding paragraph
6259 % if the document didn't happen to have a blank line.
6260 \par
6261 %
6262 % Output the mark. Pass it through \safewhatsit, to take care of
6263 % the preceding space.
6264 \safewhatsit\domark
6265 %
6266 % Insert space above the heading.
6267 \csname #2headingbreak\endcsname
6268 %
6269 % Now the second mark, after the heading break. No break points
6270 % between here and the heading.
6271 \global\let\prevsectiondefs=\lastsectiondefs
6272 \domark
6273 %
6274 % Only insert the space after the number if we have a section number.
6275 \ifx\temptype\Ynothingkeyword
6276 \setbox0 = \hbox{}%
6277 \def\toctype{unn}%
6278 \gdef\lastsection{#1}%
6279 \else\ifx\temptype\Yomitfromtockeyword
6280 % for @headings -- no section number, don't include in toc,
6281 % and don't redefine \lastsection.
6282 \setbox0 = \hbox{}%
6283 \def\toctype{omit}%
6284 \let\sectionlevel=\empty
6285 \else\ifx\temptype\Yappendixkeyword
6286 \setbox0 = \hbox{#4\enspace}%
6287 \def\toctype{app}%
6288 \gdef\lastsection{#1}%
6289 \else
6290 \setbox0 = \hbox{#4\enspace}%
6291 \def\toctype{num}%
6292 \gdef\lastsection{#1}%
6293 \fi\fi\fi
6294 %
6295 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6296 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6297 %
6298 % Write the node reference (= pdf destination for pdftex).
6299 % Again, see comments in \chapmacro.
6300 \donoderef{#3}%
6301 %
6302 % Interline glue will be inserted when the vbox is completed.
6303 % That glue will be a valid breakpoint for the page, since it'll be
6304 % preceded by a whatsit (usually from the \donoderef, or from the
6305 % \writetocentry if there was no node). We don't want to allow that
6306 % break, since then the whatsits could end up on page n while the
6307 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6308 \nobreak
6309 %
6310 % Output the actual section heading.
6311 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6312 \hangindent=\wd0 % zero if no section number
6313 \unhbox0 #1}%
6314 }%
6315 % Add extra space after the heading -- half of whatever came above it.
6316 % Don't allow stretch, though.
6317 \kern .5 \csname #2headingskip\endcsname
6318 %
6319 % Do not let the kern be a potential breakpoint, as it would be if it
6320 % was followed by glue.
6321 \nobreak
6322 %
6323 % We'll almost certainly start a paragraph next, so don't let that
6324 % glue accumulate. (Not a breakpoint because it's preceded by a
6325 % discardable item.) However, when a paragraph is not started next
6326 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6327 % or the negative glue will cause weirdly wrong output, typically
6328 % obscuring the section heading with something else.
6329 \vskip-\parskip
6330 %
6331 % This is so the last item on the main vertical list is a known
6332 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6333 % and do the needful.
6334 \penalty 10001
6335 }
6336
6337
6338 \message{toc,}
6339 % Table of contents.
6340 \newwrite\tocfile
6341
6342 % Write an entry to the toc file, opening it if necessary.
6343 % Called from @chapter, etc.
6344 %
6345 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6346 % We append the current node name (if any) and page number as additional
6347 % arguments for the \{chap,sec,...}entry macros which will eventually
6348 % read this. The node name is used in the pdf outlines as the
6349 % destination to jump to.
6350 %
6351 % We open the .toc file for writing here instead of at @setfilename (or
6352 % any other fixed time) so that @contents can be anywhere in the document.
6353 % But if #1 is `omit', then we don't do anything. This is used for the
6354 % table of contents chapter openings themselves.
6355 %
6356 \newif\iftocfileopened
6357 \def\omitkeyword{omit}%
6358 %
6359 \def\writetocentry#1#2#3{%
6360 \edef\writetoctype{#1}%
6361 \ifx\writetoctype\omitkeyword \else
6362 \iftocfileopened\else
6363 \immediate\openout\tocfile = \jobname.toc
6364 \global\tocfileopenedtrue
6365 \fi
6366 %
6367 \iflinks
6368 {\atdummies
6369 \edef\temp{%
6370 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6371 \temp
6372 }%
6373 \fi
6374 \fi
6375 %
6376 % Tell \shipout to create a pdf destination on each page, if we're
6377 % writing pdf. These are used in the table of contents. We can't
6378 % just write one on every page because the title pages are numbered
6379 % 1 and 2 (the page numbers aren't printed), and so are the first
6380 % two pages of the document. Thus, we'd have two destinations named
6381 % `1', and two named `2'.
6382 \ifpdf \global\pdfmakepagedesttrue \fi
6383 }
6384
6385
6386 % These characters do not print properly in the Computer Modern roman
6387 % fonts, so we must take special care. This is more or less redundant
6388 % with the Texinfo input format setup at the end of this file.
6389 %
6390 \def\activecatcodes{%
6391 \catcode`\"=\active
6392 \catcode`\$=\active
6393 \catcode`\<=\active
6394 \catcode`\>=\active
6395 \catcode`\\=\active
6396 \catcode`\^=\active
6397 \catcode`\_=\active
6398 \catcode`\|=\active
6399 \catcode`\~=\active
6400 }
6401
6402
6403 % Read the toc file, which is essentially Texinfo input.
6404 \def\readtocfile{%
6405 \setupdatafile
6406 \activecatcodes
6407 \input \tocreadfilename
6408 }
6409
6410 \newskip\contentsrightmargin \contentsrightmargin=1in
6411 \newcount\savepageno
6412 \newcount\lastnegativepageno \lastnegativepageno = -1
6413
6414 % Prepare to read what we've written to \tocfile.
6415 %
6416 \def\startcontents#1{%
6417 % If @setchapternewpage on, and @headings double, the contents should
6418 % start on an odd page, unlike chapters. Thus, we maintain
6419 % \contentsalignmacro in parallel with \pagealignmacro.
6420 % From: Torbjorn Granlund <tege@matematik.su.se>
6421 \contentsalignmacro
6422 \immediate\closeout\tocfile
6423 %
6424 % Don't need to put `Contents' or `Short Contents' in the headline.
6425 % It is abundantly clear what they are.
6426 \chapmacro{#1}{Yomitfromtoc}{}%
6427 %
6428 \savepageno = \pageno
6429 \begingroup % Set up to handle contents files properly.
6430 \raggedbottom % Worry more about breakpoints than the bottom.
6431 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6432 %
6433 % Roman numerals for page numbers.
6434 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6435 }
6436
6437 % redefined for the two-volume lispref. We always output on
6438 % \jobname.toc even if this is redefined.
6439 %
6440 \def\tocreadfilename{\jobname.toc}
6441
6442 % Normal (long) toc.
6443 %
6444 \def\contents{%
6445 \startcontents{\putwordTOC}%
6446 \openin 1 \tocreadfilename\space
6447 \ifeof 1 \else
6448 \readtocfile
6449 \fi
6450 \vfill \eject
6451 \contentsalignmacro % in case @setchapternewpage odd is in effect
6452 \ifeof 1 \else
6453 \pdfmakeoutlines
6454 \fi
6455 \closein 1
6456 \endgroup
6457 \lastnegativepageno = \pageno
6458 \global\pageno = \savepageno
6459 }
6460
6461 % And just the chapters.
6462 \def\summarycontents{%
6463 \startcontents{\putwordShortTOC}%
6464 %
6465 \let\partentry = \shortpartentry
6466 \let\numchapentry = \shortchapentry
6467 \let\appentry = \shortchapentry
6468 \let\unnchapentry = \shortunnchapentry
6469 % We want a true roman here for the page numbers.
6470 \secfonts
6471 \let\rm=\shortcontrm \let\bf=\shortcontbf
6472 \let\sl=\shortcontsl \let\tt=\shortconttt
6473 \rm
6474 \hyphenpenalty = 10000
6475 \advance\baselineskip by 1pt % Open it up a little.
6476 \def\numsecentry##1##2##3##4{}
6477 \let\appsecentry = \numsecentry
6478 \let\unnsecentry = \numsecentry
6479 \let\numsubsecentry = \numsecentry
6480 \let\appsubsecentry = \numsecentry
6481 \let\unnsubsecentry = \numsecentry
6482 \let\numsubsubsecentry = \numsecentry
6483 \let\appsubsubsecentry = \numsecentry
6484 \let\unnsubsubsecentry = \numsecentry
6485 \openin 1 \tocreadfilename\space
6486 \ifeof 1 \else
6487 \readtocfile
6488 \fi
6489 \closein 1
6490 \vfill \eject
6491 \contentsalignmacro % in case @setchapternewpage odd is in effect
6492 \endgroup
6493 \lastnegativepageno = \pageno
6494 \global\pageno = \savepageno
6495 }
6496 \let\shortcontents = \summarycontents
6497
6498 % Typeset the label for a chapter or appendix for the short contents.
6499 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6500 %
6501 \def\shortchaplabel#1{%
6502 % This space should be enough, since a single number is .5em, and the
6503 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6504 % But use \hss just in case.
6505 % (This space doesn't include the extra space that gets added after
6506 % the label; that gets put in by \shortchapentry above.)
6507 %
6508 % We'd like to right-justify chapter numbers, but that looks strange
6509 % with appendix letters. And right-justifying numbers and
6510 % left-justifying letters looks strange when there is less than 10
6511 % chapters. Have to read the whole toc once to know how many chapters
6512 % there are before deciding ...
6513 \hbox to 1em{#1\hss}%
6514 }
6515
6516 % These macros generate individual entries in the table of contents.
6517 % The first argument is the chapter or section name.
6518 % The last argument is the page number.
6519 % The arguments in between are the chapter number, section number, ...
6520
6521 % Parts, in the main contents. Replace the part number, which doesn't
6522 % exist, with an empty box. Let's hope all the numbers have the same width.
6523 % Also ignore the page number, which is conventionally not printed.
6524 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6525 \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6526 %
6527 % Parts, in the short toc.
6528 \def\shortpartentry#1#2#3#4{%
6529 \penalty-300
6530 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6531 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6532 }
6533
6534 % Chapters, in the main contents.
6535 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6536
6537 % Chapters, in the short toc.
6538 % See comments in \dochapentry re vbox and related settings.
6539 \def\shortchapentry#1#2#3#4{%
6540 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6541 }
6542
6543 % Appendices, in the main contents.
6544 % Need the word Appendix, and a fixed-size box.
6545 %
6546 \def\appendixbox#1{%
6547 % We use M since it's probably the widest letter.
6548 \setbox0 = \hbox{\putwordAppendix{} M}%
6549 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6550 %
6551 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6552
6553 % Unnumbered chapters.
6554 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6555 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6556
6557 % Sections.
6558 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6559 \let\appsecentry=\numsecentry
6560 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6561
6562 % Subsections.
6563 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6564 \let\appsubsecentry=\numsubsecentry
6565 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6566
6567 % And subsubsections.
6568 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6569 \let\appsubsubsecentry=\numsubsubsecentry
6570 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6571
6572 % This parameter controls the indentation of the various levels.
6573 % Same as \defaultparindent.
6574 \newdimen\tocindent \tocindent = 15pt
6575
6576 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6577 % page number.
6578 %
6579 % If the toc has to be broken over pages, we want it to be at chapters
6580 % if at all possible; hence the \penalty.
6581 \def\dochapentry#1#2{%
6582 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6583 \begingroup
6584 % Move the page numbers slightly to the right
6585 \advance\entryrightmargin by -0.05em
6586 \chapentryfonts
6587 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6588 \endgroup
6589 \nobreak\vskip .25\baselineskip plus.1\baselineskip
6590 }
6591
6592 \def\dosecentry#1#2{\begingroup
6593 \secentryfonts \leftskip=\tocindent
6594 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6595 \endgroup}
6596
6597 \def\dosubsecentry#1#2{\begingroup
6598 \subsecentryfonts \leftskip=2\tocindent
6599 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6600 \endgroup}
6601
6602 \def\dosubsubsecentry#1#2{\begingroup
6603 \subsubsecentryfonts \leftskip=3\tocindent
6604 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6605 \endgroup}
6606
6607 % We use the same \entry macro as for the index entries.
6608 \let\tocentry = \entry
6609
6610 % Space between chapter (or whatever) number and the title.
6611 \def\labelspace{\hskip1em \relax}
6612
6613 \def\dopageno#1{{\rm #1}}
6614 \def\doshortpageno#1{{\rm #1}}
6615
6616 \def\chapentryfonts{\secfonts \rm}
6617 \def\secentryfonts{\textfonts}
6618 \def\subsecentryfonts{\textfonts}
6619 \def\subsubsecentryfonts{\textfonts}
6620
6621
6622 \message{environments,}
6623 % @foo ... @end foo.
6624
6625 % @tex ... @end tex escapes into raw TeX temporarily.
6626 % One exception: @ is still an escape character, so that @end tex works.
6627 % But \@ or @@ will get a plain @ character.
6628
6629 \envdef\tex{%
6630 \setupmarkupstyle{tex}%
6631 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6632 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6633 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6634 \catcode `\%=14
6635 \catcode `\+=\other
6636 \catcode `\"=\other
6637 \catcode `\|=\other
6638 \catcode `\<=\other
6639 \catcode `\>=\other
6640 \catcode `\`=\other
6641 \catcode `\'=\other
6642 \escapechar=`\\
6643 %
6644 % ' is active in math mode (mathcode"8000). So reset it, and all our
6645 % other math active characters (just in case), to plain's definitions.
6646 \mathactive
6647 %
6648 % Inverse of the list at the beginning of the file.
6649 \let\b=\ptexb
6650 \let\bullet=\ptexbullet
6651 \let\c=\ptexc
6652 \let\,=\ptexcomma
6653 \let\.=\ptexdot
6654 \let\dots=\ptexdots
6655 \let\equiv=\ptexequiv
6656 \let\!=\ptexexclam
6657 \let\i=\ptexi
6658 \let\indent=\ptexindent
6659 \let\noindent=\ptexnoindent
6660 \let\{=\ptexlbrace
6661 \let\+=\tabalign
6662 \let\}=\ptexrbrace
6663 \let\/=\ptexslash
6664 \let\sp=\ptexsp
6665 \let\*=\ptexstar
6666 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
6667 \let\t=\ptext
6668 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
6669 \let\frenchspacing=\plainfrenchspacing
6670 %
6671 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
6672 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
6673 \def\@{@}%
6674 }
6675 % There is no need to define \Etex.
6676
6677 % Define @lisp ... @end lisp.
6678 % @lisp environment forms a group so it can rebind things,
6679 % including the definition of @end lisp (which normally is erroneous).
6680
6681 % Amount to narrow the margins by for @lisp.
6682 \newskip\lispnarrowing \lispnarrowing=0.4in
6683
6684 % This is the definition that ^^M gets inside @lisp, @example, and other
6685 % such environments. \null is better than a space, since it doesn't
6686 % have any width.
6687 \def\lisppar{\null\endgraf}
6688
6689 % This space is always present above and below environments.
6690 \newskip\envskipamount \envskipamount = 0pt
6691
6692 % Make spacing and below environment symmetrical. We use \parskip here
6693 % to help in doing that, since in @example-like environments \parskip
6694 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
6695 % start of the next paragraph will insert \parskip.
6696 %
6697 \def\aboveenvbreak{{%
6698 % =10000 instead of <10000 because of a special case in \itemzzz and
6699 % \sectionheading, q.v.
6700 \ifnum \lastpenalty=10000 \else
6701 \advance\envskipamount by \parskip
6702 \endgraf
6703 \ifdim\lastskip<\envskipamount
6704 \removelastskip
6705 \ifnum\lastpenalty<10000
6706 % Penalize breaking before the environment, because preceding text
6707 % often leads into it.
6708 \penalty100
6709 \fi
6710 \vskip\envskipamount
6711 \fi
6712 \fi
6713 }}
6714
6715 \def\afterenvbreak{{%
6716 % =10000 instead of <10000 because of a special case in \itemzzz and
6717 % \sectionheading, q.v.
6718 \ifnum \lastpenalty=10000 \else
6719 \advance\envskipamount by \parskip
6720 \endgraf
6721 \ifdim\lastskip<\envskipamount
6722 \removelastskip
6723 % it's not a good place to break if the last penalty was \nobreak
6724 % or better ...
6725 \ifnum\lastpenalty<10000 \penalty-50 \fi
6726 \vskip\envskipamount
6727 \fi
6728 \fi
6729 }}
6730
6731 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
6732 % also clear it, so that its embedded environments do the narrowing again.
6733 \let\nonarrowing=\relax
6734
6735 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
6736 % environment contents.
6737 \font\circle=lcircle10
6738 \newdimen\circthick
6739 \newdimen\cartouter\newdimen\cartinner
6740 \newskip\normbskip\newskip\normpskip\newskip\normlskip
6741 \circthick=\fontdimen8\circle
6742 %
6743 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
6744 \def\ctr{{\hskip 6pt\circle\char'010}}
6745 \def\cbl{{\circle\char'012\hskip -6pt}}
6746 \def\cbr{{\hskip 6pt\circle\char'011}}
6747 \def\carttop{\hbox to \cartouter{\hskip\lskip
6748 \ctl\leaders\hrule height\circthick\hfil\ctr
6749 \hskip\rskip}}
6750 \def\cartbot{\hbox to \cartouter{\hskip\lskip
6751 \cbl\leaders\hrule height\circthick\hfil\cbr
6752 \hskip\rskip}}
6753 %
6754 \newskip\lskip\newskip\rskip
6755
6756 \envdef\cartouche{%
6757 \ifhmode\par\fi % can't be in the midst of a paragraph.
6758 \startsavinginserts
6759 \lskip=\leftskip \rskip=\rightskip
6760 \leftskip=0pt\rightskip=0pt % we want these *outside*.
6761 \cartinner=\hsize \advance\cartinner by-\lskip
6762 \advance\cartinner by-\rskip
6763 \cartouter=\hsize
6764 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
6765 % side, and for 6pt waste from
6766 % each corner char, and rule thickness
6767 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
6768 %
6769 % If this cartouche directly follows a sectioning command, we need the
6770 % \parskip glue (backspaced over by default) or the cartouche can
6771 % collide with the section heading.
6772 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
6773 %
6774 \setbox\groupbox=\vbox\bgroup
6775 \baselineskip=0pt\parskip=0pt\lineskip=0pt
6776 \carttop
6777 \hbox\bgroup
6778 \hskip\lskip
6779 \vrule\kern3pt
6780 \vbox\bgroup
6781 \kern3pt
6782 \hsize=\cartinner
6783 \baselineskip=\normbskip
6784 \lineskip=\normlskip
6785 \parskip=\normpskip
6786 \vskip -\parskip
6787 \comment % For explanation, see the end of def\group.
6788 }
6789 \def\Ecartouche{%
6790 \ifhmode\par\fi
6791 \kern3pt
6792 \egroup
6793 \kern3pt\vrule
6794 \hskip\rskip
6795 \egroup
6796 \cartbot
6797 \egroup
6798 \addgroupbox
6799 \checkinserts
6800 }
6801
6802
6803 % This macro is called at the beginning of all the @example variants,
6804 % inside a group.
6805 \newdimen\nonfillparindent
6806 \def\nonfillstart{%
6807 \aboveenvbreak
6808 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
6809 \sepspaces % Make spaces be word-separators rather than space tokens.
6810 \let\par = \lisppar % don't ignore blank lines
6811 \obeylines % each line of input is a line of output
6812 \parskip = 0pt
6813 % Turn off paragraph indentation but redefine \indent to emulate
6814 % the normal \indent.
6815 \nonfillparindent=\parindent
6816 \parindent = 0pt
6817 \let\indent\nonfillindent
6818 %
6819 \emergencystretch = 0pt % don't try to avoid overfull boxes
6820 \ifx\nonarrowing\relax
6821 \advance \leftskip by \lispnarrowing
6822 \exdentamount=\lispnarrowing
6823 \else
6824 \let\nonarrowing = \relax
6825 \fi
6826 \let\exdent=\nofillexdent
6827 }
6828
6829 \begingroup
6830 \obeyspaces
6831 % We want to swallow spaces (but not other tokens) after the fake
6832 % @indent in our nonfill-environments, where spaces are normally
6833 % active and set to @tie, resulting in them not being ignored after
6834 % @indent.
6835 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
6836 \gdef\nonfillindentcheck{%
6837 \ifx\temp %
6838 \expandafter\nonfillindentgobble%
6839 \else%
6840 \leavevmode\nonfillindentbox%
6841 \fi%
6842 }%
6843 \endgroup
6844 \def\nonfillindentgobble#1{\nonfillindent}
6845 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
6846
6847 % If you want all examples etc. small: @set dispenvsize small.
6848 % If you want even small examples the full size: @set dispenvsize nosmall.
6849 % This affects the following displayed environments:
6850 % @example, @display, @format, @lisp
6851 %
6852 \def\smallword{small}
6853 \def\nosmallword{nosmall}
6854 \let\SETdispenvsize\relax
6855 \def\setnormaldispenv{%
6856 \ifx\SETdispenvsize\smallword
6857 % end paragraph for sake of leading, in case document has no blank
6858 % line. This is redundant with what happens in \aboveenvbreak, but
6859 % we need to do it before changing the fonts, and it's inconvenient
6860 % to change the fonts afterward.
6861 \ifnum \lastpenalty=10000 \else \endgraf \fi
6862 \smallexamplefonts \rm
6863 \fi
6864 }
6865 \def\setsmalldispenv{%
6866 \ifx\SETdispenvsize\nosmallword
6867 \else
6868 \ifnum \lastpenalty=10000 \else \endgraf \fi
6869 \smallexamplefonts \rm
6870 \fi
6871 }
6872
6873 % We often define two environments, @foo and @smallfoo.
6874 % Let's do it in one command. #1 is the env name, #2 the definition.
6875 \def\makedispenvdef#1#2{%
6876 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
6877 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
6878 \expandafter\let\csname E#1\endcsname \afterenvbreak
6879 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
6880 }
6881
6882 % Define two environment synonyms (#1 and #2) for an environment.
6883 \def\maketwodispenvdef#1#2#3{%
6884 \makedispenvdef{#1}{#3}%
6885 \makedispenvdef{#2}{#3}%
6886 }
6887 %
6888 % @lisp: indented, narrowed, typewriter font;
6889 % @example: same as @lisp.
6890 %
6891 % @smallexample and @smalllisp: use smaller fonts.
6892 % Originally contributed by Pavel@xerox.
6893 %
6894 \maketwodispenvdef{lisp}{example}{%
6895 \nonfillstart
6896 \tt\setupmarkupstyle{example}%
6897 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
6898 \gobble % eat return
6899 }
6900 % @display/@smalldisplay: same as @lisp except keep current font.
6901 %
6902 \makedispenvdef{display}{%
6903 \nonfillstart
6904 \gobble
6905 }
6906
6907 % @format/@smallformat: same as @display except don't narrow margins.
6908 %
6909 \makedispenvdef{format}{%
6910 \let\nonarrowing = t%
6911 \nonfillstart
6912 \gobble
6913 }
6914
6915 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
6916 \envdef\flushleft{%
6917 \let\nonarrowing = t%
6918 \nonfillstart
6919 \gobble
6920 }
6921 \let\Eflushleft = \afterenvbreak
6922
6923 % @flushright.
6924 %
6925 \envdef\flushright{%
6926 \let\nonarrowing = t%
6927 \nonfillstart
6928 \advance\leftskip by 0pt plus 1fill\relax
6929 \gobble
6930 }
6931 \let\Eflushright = \afterenvbreak
6932
6933
6934 % @raggedright does more-or-less normal line breaking but no right
6935 % justification. From plain.tex. Don't stretch around special
6936 % characters in urls in this environment, since the stretch at the right
6937 % should be enough.
6938 \envdef\raggedright{%
6939 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
6940 \def\urefprestretchamount{0pt}%
6941 \def\urefpoststretchamount{0pt}%
6942 }
6943 \let\Eraggedright\par
6944
6945 \envdef\raggedleft{%
6946 \parindent=0pt \leftskip0pt plus2em
6947 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6948 \hbadness=10000 % Last line will usually be underfull, so turn off
6949 % badness reporting.
6950 }
6951 \let\Eraggedleft\par
6952
6953 \envdef\raggedcenter{%
6954 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
6955 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6956 \hbadness=10000 % Last line will usually be underfull, so turn off
6957 % badness reporting.
6958 }
6959 \let\Eraggedcenter\par
6960
6961
6962 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
6963 % and narrows the margins. We keep \parskip nonzero in general, since
6964 % we're doing normal filling. So, when using \aboveenvbreak and
6965 % \afterenvbreak, temporarily make \parskip 0.
6966 %
6967 \makedispenvdef{quotation}{\quotationstart}
6968 %
6969 \def\quotationstart{%
6970 \indentedblockstart % same as \indentedblock, but increase right margin too.
6971 \ifx\nonarrowing\relax
6972 \advance\rightskip by \lispnarrowing
6973 \fi
6974 \parsearg\quotationlabel
6975 }
6976
6977 % We have retained a nonzero parskip for the environment, since we're
6978 % doing normal filling.
6979 %
6980 \def\Equotation{%
6981 \par
6982 \ifx\quotationauthor\thisisundefined\else
6983 % indent a bit.
6984 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
6985 \fi
6986 {\parskip=0pt \afterenvbreak}%
6987 }
6988 \def\Esmallquotation{\Equotation}
6989
6990 % If we're given an argument, typeset it in bold with a colon after.
6991 \def\quotationlabel#1{%
6992 \def\temp{#1}%
6993 \ifx\temp\empty \else
6994 {\bf #1: }%
6995 \fi
6996 }
6997
6998 % @indentedblock is like @quotation, but indents only on the left and
6999 % has no optional argument.
7000 %
7001 \makedispenvdef{indentedblock}{\indentedblockstart}
7002 %
7003 \def\indentedblockstart{%
7004 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7005 \parindent=0pt
7006 %
7007 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7008 \ifx\nonarrowing\relax
7009 \advance\leftskip by \lispnarrowing
7010 \exdentamount = \lispnarrowing
7011 \else
7012 \let\nonarrowing = \relax
7013 \fi
7014 }
7015
7016 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7017 %
7018 \def\Eindentedblock{%
7019 \par
7020 {\parskip=0pt \afterenvbreak}%
7021 }
7022 \def\Esmallindentedblock{\Eindentedblock}
7023
7024
7025 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7026 % If we want to allow any <char> as delimiter,
7027 % we need the curly braces so that makeinfo sees the @verb command, eg:
7028 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7029 %
7030 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7031 %
7032 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7033 % active too. Otherwise, they get lost as the first character on a
7034 % verbatim line.
7035 \def\dospecials{%
7036 \do\ \do\\\do\{\do\}\do\$\do\&%
7037 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7038 \do\<\do\>\do\|\do\@\do+\do\"%
7039 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7040 % @set txicodequotebacktick will not have effect on @verb and
7041 % @verbatim, and ?` and !` ligatures won't get disabled.
7042 %\do\`\do\'%
7043 }
7044 %
7045 % [Knuth] p. 380
7046 \def\uncatcodespecials{%
7047 \def\do##1{\catcode`##1=\other}\dospecials}
7048 %
7049 % Setup for the @verb command.
7050 %
7051 % Eight spaces for a tab
7052 \begingroup
7053 \catcode`\^^I=\active
7054 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7055 \endgroup
7056 %
7057 \def\setupverb{%
7058 \tt % easiest (and conventionally used) font for verbatim
7059 \def\par{\leavevmode\endgraf}%
7060 \setupmarkupstyle{verb}%
7061 \tabeightspaces
7062 % Respect line breaks,
7063 % print special symbols as themselves, and
7064 % make each space count
7065 % must do in this order:
7066 \obeylines \uncatcodespecials \sepspaces
7067 }
7068
7069 % Setup for the @verbatim environment
7070 %
7071 % Real tab expansion.
7072 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7073 %
7074 % We typeset each line of the verbatim in an \hbox, so we can handle
7075 % tabs. The \global is in case the verbatim line starts with an accent,
7076 % or some other command that starts with a begin-group. Otherwise, the
7077 % entire \verbbox would disappear at the corresponding end-group, before
7078 % it is typeset. Meanwhile, we can't have nested verbatim commands
7079 % (can we?), so the \global won't be overwriting itself.
7080 \newbox\verbbox
7081 \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
7082 %
7083 \begingroup
7084 \catcode`\^^I=\active
7085 \gdef\tabexpand{%
7086 \catcode`\^^I=\active
7087 \def^^I{\leavevmode\egroup
7088 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7089 \divide\dimen\verbbox by\tabw
7090 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7091 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7092 \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
7093 }%
7094 }
7095 \endgroup
7096
7097 % start the verbatim environment.
7098 \def\setupverbatim{%
7099 \let\nonarrowing = t%
7100 \nonfillstart
7101 \tt % easiest (and conventionally used) font for verbatim
7102 % The \leavevmode here is for blank lines. Otherwise, we would
7103 % never \starttabox and the \egroup would end verbatim mode.
7104 \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
7105 \tabexpand
7106 \setupmarkupstyle{verbatim}%
7107 % Respect line breaks,
7108 % print special symbols as themselves, and
7109 % make each space count.
7110 % Must do in this order:
7111 \obeylines \uncatcodespecials \sepspaces
7112 \everypar{\starttabbox}%
7113 }
7114
7115 % Do the @verb magic: verbatim text is quoted by unique
7116 % delimiter characters. Before first delimiter expect a
7117 % right brace, after last delimiter expect closing brace:
7118 %
7119 % \def\doverb'{'<char>#1<char>'}'{#1}
7120 %
7121 % [Knuth] p. 382; only eat outer {}
7122 \begingroup
7123 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7124 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7125 \endgroup
7126 %
7127 \def\verb{\begingroup\setupverb\doverb}
7128 %
7129 %
7130 % Do the @verbatim magic: define the macro \doverbatim so that
7131 % the (first) argument ends when '@end verbatim' is reached, ie:
7132 %
7133 % \def\doverbatim#1@end verbatim{#1}
7134 %
7135 % For Texinfo it's a lot easier than for LaTeX,
7136 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7137 % we need not redefine '\', '{' and '}'.
7138 %
7139 % Inspired by LaTeX's verbatim command set [latex.ltx]
7140 %
7141 \begingroup
7142 \catcode`\ =\active
7143 \obeylines %
7144 % ignore everything up to the first ^^M, that's the newline at the end
7145 % of the @verbatim input line itself. Otherwise we get an extra blank
7146 % line in the output.
7147 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
7148 % We really want {...\end verbatim} in the body of the macro, but
7149 % without the active space; thus we have to use \xdef and \gobble.
7150 \endgroup
7151 %
7152 \envdef\verbatim{%
7153 \setupverbatim\doverbatim
7154 }
7155 \let\Everbatim = \afterenvbreak
7156
7157
7158 % @verbatiminclude FILE - insert text of file in verbatim environment.
7159 %
7160 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7161 %
7162 \def\doverbatiminclude#1{%
7163 {%
7164 \makevalueexpandable
7165 \setupverbatim
7166 \indexnofonts % Allow `@@' and other weird things in file names.
7167 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7168 \input #1
7169 \afterenvbreak
7170 }%
7171 }
7172
7173 % @copying ... @end copying.
7174 % Save the text away for @insertcopying later.
7175 %
7176 % We save the uninterpreted tokens, rather than creating a box.
7177 % Saving the text in a box would be much easier, but then all the
7178 % typesetting commands (@smallbook, font changes, etc.) have to be done
7179 % beforehand -- and a) we want @copying to be done first in the source
7180 % file; b) letting users define the frontmatter in as flexible order as
7181 % possible is desirable.
7182 %
7183 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7184 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7185 %
7186 \def\insertcopying{%
7187 \begingroup
7188 \parindent = 0pt % paragraph indentation looks wrong on title page
7189 \scanexp\copyingtext
7190 \endgroup
7191 }
7192
7193
7194 \message{defuns,}
7195 % @defun etc.
7196
7197 \newskip\defbodyindent \defbodyindent=.4in
7198 \newskip\defargsindent \defargsindent=50pt
7199 \newskip\deflastargmargin \deflastargmargin=18pt
7200 \newcount\defunpenalty
7201
7202 % Start the processing of @deffn:
7203 \def\startdefun{%
7204 \ifnum\lastpenalty<10000
7205 \medbreak
7206 \defunpenalty=10003 % Will keep this @deffn together with the
7207 % following @def command, see below.
7208 \else
7209 % If there are two @def commands in a row, we'll have a \nobreak,
7210 % which is there to keep the function description together with its
7211 % header. But if there's nothing but headers, we need to allow a
7212 % break somewhere. Check specifically for penalty 10002, inserted
7213 % by \printdefunline, instead of 10000, since the sectioning
7214 % commands also insert a nobreak penalty, and we don't want to allow
7215 % a break between a section heading and a defun.
7216 %
7217 % As a further refinement, we avoid "club" headers by signalling
7218 % with penalty of 10003 after the very first @deffn in the
7219 % sequence (see above), and penalty of 10002 after any following
7220 % @def command.
7221 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7222 %
7223 % Similarly, after a section heading, do not allow a break.
7224 % But do insert the glue.
7225 \medskip % preceded by discardable penalty, so not a breakpoint
7226 \fi
7227 %
7228 \parindent=0in
7229 \advance\leftskip by \defbodyindent
7230 \exdentamount=\defbodyindent
7231 }
7232
7233 \def\dodefunx#1{%
7234 % First, check whether we are in the right environment:
7235 \checkenv#1%
7236 %
7237 % As above, allow line break if we have multiple x headers in a row.
7238 % It's not a great place, though.
7239 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7240 %
7241 % And now, it's time to reuse the body of the original defun:
7242 \expandafter\gobbledefun#1%
7243 }
7244 \def\gobbledefun#1\startdefun{}
7245
7246 % \printdefunline \deffnheader{text}
7247 %
7248 \def\printdefunline#1#2{%
7249 \begingroup
7250 % call \deffnheader:
7251 #1#2 \endheader
7252 % common ending:
7253 \interlinepenalty = 10000
7254 \advance\rightskip by 0pt plus 1fil\relax
7255 \endgraf
7256 \nobreak\vskip -\parskip
7257 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7258 % Some of the @defun-type tags do not enable magic parentheses,
7259 % rendering the following check redundant. But we don't optimize.
7260 \checkparencounts
7261 \endgroup
7262 }
7263
7264 \def\Edefun{\endgraf\medbreak}
7265
7266 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7267 % the only thing remaining is to define \deffnheader.
7268 %
7269 \def\makedefun#1{%
7270 \expandafter\let\csname E#1\endcsname = \Edefun
7271 \edef\temp{\noexpand\domakedefun
7272 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7273 \temp
7274 }
7275
7276 % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7277 %
7278 % Define \deffn and \deffnx, without parameters.
7279 % \deffnheader has to be defined explicitly.
7280 %
7281 \def\domakedefun#1#2#3{%
7282 \envdef#1{%
7283 \startdefun
7284 \doingtypefnfalse % distinguish typed functions from all else
7285 \parseargusing\activeparens{\printdefunline#3}%
7286 }%
7287 \def#2{\dodefunx#1}%
7288 \def#3%
7289 }
7290
7291 \newif\ifdoingtypefn % doing typed function?
7292 \newif\ifrettypeownline % typeset return type on its own line?
7293
7294 % @deftypefnnewline on|off says whether the return type of typed functions
7295 % are printed on their own line. This affects @deftypefn, @deftypefun,
7296 % @deftypeop, and @deftypemethod.
7297 %
7298 \parseargdef\deftypefnnewline{%
7299 \def\temp{#1}%
7300 \ifx\temp\onword
7301 \expandafter\let\csname SETtxideftypefnnl\endcsname
7302 = \empty
7303 \else\ifx\temp\offword
7304 \expandafter\let\csname SETtxideftypefnnl\endcsname
7305 = \relax
7306 \else
7307 \errhelp = \EMsimple
7308 \errmessage{Unknown @txideftypefnnl value `\temp',
7309 must be on|off}%
7310 \fi\fi
7311 }
7312
7313 % Untyped functions:
7314
7315 % @deffn category name args
7316 \makedefun{deffn}{\deffngeneral{}}
7317
7318 % @deffn category class name args
7319 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7320
7321 % \defopon {category on}class name args
7322 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7323
7324 % \deffngeneral {subind}category name args
7325 %
7326 \def\deffngeneral#1#2 #3 #4\endheader{%
7327 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
7328 \dosubind{fn}{\code{#3}}{#1}%
7329 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7330 }
7331
7332 % Typed functions:
7333
7334 % @deftypefn category type name args
7335 \makedefun{deftypefn}{\deftypefngeneral{}}
7336
7337 % @deftypeop category class type name args
7338 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7339
7340 % \deftypeopon {category on}class type name args
7341 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7342
7343 % \deftypefngeneral {subind}category type name args
7344 %
7345 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7346 \dosubind{fn}{\code{#4}}{#1}%
7347 \doingtypefntrue
7348 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7349 }
7350
7351 % Typed variables:
7352
7353 % @deftypevr category type var args
7354 \makedefun{deftypevr}{\deftypecvgeneral{}}
7355
7356 % @deftypecv category class type var args
7357 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7358
7359 % \deftypecvof {category of}class type var args
7360 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7361
7362 % \deftypecvgeneral {subind}category type var args
7363 %
7364 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7365 \dosubind{vr}{\code{#4}}{#1}%
7366 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7367 }
7368
7369 % Untyped variables:
7370
7371 % @defvr category var args
7372 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7373
7374 % @defcv category class var args
7375 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7376
7377 % \defcvof {category of}class var args
7378 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7379
7380 % Types:
7381
7382 % @deftp category name args
7383 \makedefun{deftp}#1 #2 #3\endheader{%
7384 \doind{tp}{\code{#2}}%
7385 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7386 }
7387
7388 % Remaining @defun-like shortcuts:
7389 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7390 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7391 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7392 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7393 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7394 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7395 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7396 \makedefun{defmethod}{\defopon\putwordMethodon}
7397 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7398 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7399 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7400
7401 % \defname, which formats the name of the @def (not the args).
7402 % #1 is the category, such as "Function".
7403 % #2 is the return type, if any.
7404 % #3 is the function name.
7405 %
7406 % We are followed by (but not passed) the arguments, if any.
7407 %
7408 \def\defname#1#2#3{%
7409 \par
7410 % Get the values of \leftskip and \rightskip as they were outside the @def...
7411 \advance\leftskip by -\defbodyindent
7412 %
7413 % Determine if we are typesetting the return type of a typed function
7414 % on a line by itself.
7415 \rettypeownlinefalse
7416 \ifdoingtypefn % doing a typed function specifically?
7417 % then check user option for putting return type on its own line:
7418 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7419 \rettypeownlinetrue
7420 \fi
7421 \fi
7422 %
7423 % How we'll format the category name. Putting it in brackets helps
7424 % distinguish it from the body text that may end up on the next line
7425 % just below it.
7426 \def\temp{#1}%
7427 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7428 %
7429 % Figure out line sizes for the paragraph shape. We'll always have at
7430 % least two.
7431 \tempnum = 2
7432 %
7433 % The first line needs space for \box0; but if \rightskip is nonzero,
7434 % we need only space for the part of \box0 which exceeds it:
7435 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7436 %
7437 % If doing a return type on its own line, we'll have another line.
7438 \ifrettypeownline
7439 \advance\tempnum by 1
7440 \def\maybeshapeline{0in \hsize}%
7441 \else
7442 \def\maybeshapeline{}%
7443 \fi
7444 %
7445 % The continuations:
7446 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7447 %
7448 % The final paragraph shape:
7449 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7450 %
7451 % Put the category name at the right margin.
7452 \noindent
7453 \hbox to 0pt{%
7454 \hfil\box0 \kern-\hsize
7455 % \hsize has to be shortened this way:
7456 \kern\leftskip
7457 % Intentionally do not respect \rightskip, since we need the space.
7458 }%
7459 %
7460 % Allow all lines to be underfull without complaint:
7461 \tolerance=10000 \hbadness=10000
7462 \exdentamount=\defbodyindent
7463 {%
7464 % defun fonts. We use typewriter by default (used to be bold) because:
7465 % . we're printing identifiers, they should be in tt in principle.
7466 % . in languages with many accents, such as Czech or French, it's
7467 % common to leave accents off identifiers. The result looks ok in
7468 % tt, but exceedingly strange in rm.
7469 % . we don't want -- and --- to be treated as ligatures.
7470 % . this still does not fix the ?` and !` ligatures, but so far no
7471 % one has made identifiers using them :).
7472 \df \tt
7473 \def\temp{#2}% text of the return type
7474 \ifx\temp\empty\else
7475 \tclose{\temp}% typeset the return type
7476 \ifrettypeownline
7477 % put return type on its own line; prohibit line break following:
7478 \hfil\vadjust{\nobreak}\break
7479 \else
7480 \space % type on same line, so just followed by a space
7481 \fi
7482 \fi % no return type
7483 #3% output function name
7484 }%
7485 {\rm\enskip}% hskip 0.5 em of \tenrm
7486 %
7487 \boldbrax
7488 % arguments will be output next, if any.
7489 }
7490
7491 % Print arguments in slanted roman (not ttsl), inconsistently with using
7492 % tt for the name. This is because literal text is sometimes needed in
7493 % the argument list (groff manual), and ttsl and tt are not very
7494 % distinguishable. Prevent hyphenation at `-' chars.
7495 %
7496 \def\defunargs#1{%
7497 % use sl by default (not ttsl),
7498 % tt for the names.
7499 \df \sl \hyphenchar\font=0
7500 %
7501 % On the other hand, if an argument has two dashes (for instance), we
7502 % want a way to get ttsl. We used to recommend @var for that, so
7503 % leave the code in, but it's strange for @var to lead to typewriter.
7504 % Nowadays we recommend @code, since the difference between a ttsl hyphen
7505 % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7506 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7507 #1%
7508 \sl\hyphenchar\font=45
7509 }
7510
7511 % We want ()&[] to print specially on the defun line.
7512 %
7513 \def\activeparens{%
7514 \catcode`\(=\active \catcode`\)=\active
7515 \catcode`\[=\active \catcode`\]=\active
7516 \catcode`\&=\active
7517 }
7518
7519 % Make control sequences which act like normal parenthesis chars.
7520 \let\lparen = ( \let\rparen = )
7521
7522 % Be sure that we always have a definition for `(', etc. For example,
7523 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7524 % so TeX would otherwise complain about undefined control sequence.
7525 {
7526 \activeparens
7527 \global\let(=\lparen \global\let)=\rparen
7528 \global\let[=\lbrack \global\let]=\rbrack
7529 \global\let& = \&
7530
7531 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7532 \gdef\magicamp{\let&=\amprm}
7533 }
7534
7535 \newcount\parencount
7536
7537 % If we encounter &foo, then turn on ()-hacking afterwards
7538 \newif\ifampseen
7539 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
7540
7541 \def\parenfont{%
7542 \ifampseen
7543 % At the first level, print parens in roman,
7544 % otherwise use the default font.
7545 \ifnum \parencount=1 \rm \fi
7546 \else
7547 % The \sf parens (in \boldbrax) actually are a little bolder than
7548 % the contained text. This is especially needed for [ and ] .
7549 \sf
7550 \fi
7551 }
7552 \def\infirstlevel#1{%
7553 \ifampseen
7554 \ifnum\parencount=1
7555 #1%
7556 \fi
7557 \fi
7558 }
7559 \def\bfafterword#1 {#1 \bf}
7560
7561 \def\opnr{%
7562 \global\advance\parencount by 1
7563 {\parenfont(}%
7564 \infirstlevel \bfafterword
7565 }
7566 \def\clnr{%
7567 {\parenfont)}%
7568 \infirstlevel \sl
7569 \global\advance\parencount by -1
7570 }
7571
7572 \newcount\brackcount
7573 \def\lbrb{%
7574 \global\advance\brackcount by 1
7575 {\bf[}%
7576 }
7577 \def\rbrb{%
7578 {\bf]}%
7579 \global\advance\brackcount by -1
7580 }
7581
7582 \def\checkparencounts{%
7583 \ifnum\parencount=0 \else \badparencount \fi
7584 \ifnum\brackcount=0 \else \badbrackcount \fi
7585 }
7586 % these should not use \errmessage; the glibc manual, at least, actually
7587 % has such constructs (when documenting function pointers).
7588 \def\badparencount{%
7589 \message{Warning: unbalanced parentheses in @def...}%
7590 \global\parencount=0
7591 }
7592 \def\badbrackcount{%
7593 \message{Warning: unbalanced square brackets in @def...}%
7594 \global\brackcount=0
7595 }
7596
7597
7598 \message{macros,}
7599 % @macro.
7600
7601 % To do this right we need a feature of e-TeX, \scantokens,
7602 % which we arrange to emulate with a temporary file in ordinary TeX.
7603 \ifx\eTeXversion\thisisundefined
7604 \newwrite\macscribble
7605 \def\scantokens#1{%
7606 \toks0={#1}%
7607 \immediate\openout\macscribble=\jobname.tmp
7608 \immediate\write\macscribble{\the\toks0}%
7609 \immediate\closeout\macscribble
7610 \input \jobname.tmp
7611 }
7612 \fi
7613
7614 \let\aftermacroxxx\relax
7615 \def\aftermacro{\aftermacroxxx}
7616
7617 % alias because \c means cedilla in @tex or @math
7618 \let\texinfoc=\c
7619
7620 % Used at the time of macro expansion.
7621 % Argument is macro body with arguments substituted
7622 \def\scanmacro#1{%
7623 \newlinechar`\^^M
7624 \def\xprocessmacroarg{\eatspaces}%
7625 %
7626 % Process the macro body under the current catcode regime.
7627 \scantokens{#1\texinfoc}\aftermacro%
7628 %
7629 % The \c is to remove the \newlinechar added by \scantokens, and
7630 % can be noticed by \parsearg.
7631 % The \aftermacro allows a \comment at the end of the macro definition
7632 % to duplicate itself past the final \newlinechar added by \scantokens:
7633 % this is used in the definition of \group to comment out a newline. We
7634 % don't do the same for \c to support Texinfo files with macros that ended
7635 % with a @c, which should no longer be necessary.
7636 % We avoid surrounding the call to \scantokens with \bgroup and \egroup
7637 % to allow macros to open or close groups themselves.
7638 }
7639
7640 % Used for copying and captions
7641 \def\scanexp#1{%
7642 \bgroup
7643 % Undo catcode changes of \startcontents and \printindex
7644 % When called from @insertcopying or (short)caption, we need active
7645 % backslash to get it printed correctly.
7646 % FIXME: This may not be needed.
7647 %\catcode`\@=0 \catcode`\\=\active \escapechar=`\@
7648 \edef\temp{\noexpand\scanmacro{#1}}%
7649 \temp
7650 \egroup
7651 }
7652
7653 \newcount\paramno % Count of parameters
7654 \newtoks\macname % Macro name
7655 \newif\ifrecursive % Is it recursive?
7656
7657 % List of all defined macros in the form
7658 % \definedummyword\macro1\definedummyword\macro2...
7659 % Currently is also contains all @aliases; the list can be split
7660 % if there is a need.
7661 \def\macrolist{}
7662
7663 % Add the macro to \macrolist
7664 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7665 \def\addtomacrolistxxx#1{%
7666 \toks0 = \expandafter{\macrolist\definedummyword#1}%
7667 \xdef\macrolist{\the\toks0}%
7668 }
7669
7670 % Utility routines.
7671 % This does \let #1 = #2, with \csnames; that is,
7672 % \let \csname#1\endcsname = \csname#2\endcsname
7673 % (except of course we have to play expansion games).
7674 %
7675 \def\cslet#1#2{%
7676 \expandafter\let
7677 \csname#1\expandafter\endcsname
7678 \csname#2\endcsname
7679 }
7680
7681 % Trim leading and trailing spaces off a string.
7682 % Concepts from aro-bend problem 15 (see CTAN).
7683 {\catcode`\@=11
7684 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7685 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7686 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7687 \def\unbrace#1{#1}
7688 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
7689 }
7690
7691 % Trim a single trailing ^^M off a string.
7692 {\catcode`\^^M=\other \catcode`\Q=3%
7693 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
7694 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
7695 \gdef\eatcrb#1Q#2Q{#1}%
7696 }
7697
7698 % Macro bodies are absorbed as an argument in a context where
7699 % all characters are catcode 10, 11 or 12, except \ which is active
7700 % (as in normal texinfo). It is necessary to change the definition of \
7701 % to recognize macro arguments; this is the job of \mbodybackslash.
7702 %
7703 % Non-ASCII encodings make 8-bit characters active, so un-activate
7704 % them to avoid their expansion. Must do this non-globally, to
7705 % confine the change to the current group.
7706 %
7707 % It's necessary to have hard CRs when the macro is executed. This is
7708 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
7709 % body, and then making it the \newlinechar in \scanmacro.
7710 %
7711 \def\scanctxt{% used as subroutine
7712 \catcode`\"=\other
7713 \catcode`\+=\other
7714 \catcode`\<=\other
7715 \catcode`\>=\other
7716 \catcode`\^=\other
7717 \catcode`\_=\other
7718 \catcode`\|=\other
7719 \catcode`\~=\other
7720 \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
7721 }
7722
7723 \def\scanargctxt{% used for copying and captions, not macros.
7724 \scanctxt
7725 \catcode`\@=\other
7726 \catcode`\\=\other
7727 \catcode`\^^M=\other
7728 }
7729
7730 \def\macrobodyctxt{% used for @macro definitions
7731 \scanctxt
7732 \catcode`\ =\other
7733 \catcode`\@=\other
7734 \catcode`\{=\other
7735 \catcode`\}=\other
7736 \catcode`\^^M=\other
7737 \usembodybackslash
7738 }
7739
7740 % Used when scanning braced macro arguments. Note, however, that catcode
7741 % changes here are ineffectual if the macro invocation was nested inside
7742 % an argument to another Texinfo command.
7743 \def\macroargctxt{%
7744 \scanctxt
7745 \catcode`\ =\active
7746 \catcode`\^^M=\other
7747 \catcode`\\=\active
7748 }
7749
7750 \def\macrolineargctxt{% used for whole-line arguments without braces
7751 \scanctxt
7752 \catcode`\{=\other
7753 \catcode`\}=\other
7754 }
7755
7756 % \mbodybackslash is the definition of \ in @macro bodies.
7757 % It maps \foo\ => \csname macarg.foo\endcsname => #N
7758 % where N is the macro parameter number.
7759 % We define \csname macarg.\endcsname to be \realbackslash, so
7760 % \\ in macro replacement text gets you a backslash.
7761 %
7762 {\catcode`@=0 @catcode`@\=@active
7763 @gdef@usembodybackslash{@let\=@mbodybackslash}
7764 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
7765 }
7766 \expandafter\def\csname macarg.\endcsname{\realbackslash}
7767
7768 \def\margbackslash#1{\char`\#1 }
7769
7770 \def\macro{\recursivefalse\parsearg\macroxxx}
7771 \def\rmacro{\recursivetrue\parsearg\macroxxx}
7772
7773 \def\macroxxx#1{%
7774 \getargs{#1}% now \macname is the macname and \argl the arglist
7775 \ifx\argl\empty % no arguments
7776 \paramno=0\relax
7777 \else
7778 \expandafter\parsemargdef \argl;%
7779 \if\paramno>256\relax
7780 \ifx\eTeXversion\thisisundefined
7781 \errhelp = \EMsimple
7782 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
7783 \fi
7784 \fi
7785 \fi
7786 \if1\csname ismacro.\the\macname\endcsname
7787 \message{Warning: redefining \the\macname}%
7788 \else
7789 \expandafter\ifx\csname \the\macname\endcsname \relax
7790 \else \errmessage{Macro name \the\macname\space already defined}\fi
7791 \global\cslet{macsave.\the\macname}{\the\macname}%
7792 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
7793 \addtomacrolist{\the\macname}%
7794 \fi
7795 \begingroup \macrobodyctxt
7796 \ifrecursive \expandafter\parsermacbody
7797 \else \expandafter\parsemacbody
7798 \fi}
7799
7800 \parseargdef\unmacro{%
7801 \if1\csname ismacro.#1\endcsname
7802 \global\cslet{#1}{macsave.#1}%
7803 \global\expandafter\let \csname ismacro.#1\endcsname=0%
7804 % Remove the macro name from \macrolist:
7805 \begingroup
7806 \expandafter\let\csname#1\endcsname \relax
7807 \let\definedummyword\unmacrodo
7808 \xdef\macrolist{\macrolist}%
7809 \endgroup
7810 \else
7811 \errmessage{Macro #1 not defined}%
7812 \fi
7813 }
7814
7815 % Called by \do from \dounmacro on each macro. The idea is to omit any
7816 % macro definitions that have been changed to \relax.
7817 %
7818 \def\unmacrodo#1{%
7819 \ifx #1\relax
7820 % remove this
7821 \else
7822 \noexpand\definedummyword \noexpand#1%
7823 \fi
7824 }
7825
7826 % \getargs -- Parse the arguments to a @macro line. Set \macname to
7827 % the name of the macro, and \argl to the braced argument list.
7828 \def\getargs#1{\getargsxxx#1{}}
7829 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
7830 \def\getmacname#1 #2\relax{\macname={#1}}
7831 \def\getmacargs#1{\def\argl{#1}}
7832 % This made use of the feature that if the last token of a
7833 % <parameter list> is #, then the preceding argument is delimited by
7834 % an opening brace, and that opening brace is not consumed.
7835
7836 % Parse the optional {params} list to @macro or @rmacro.
7837 % Set \paramno to the number of arguments,
7838 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
7839 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
7840 % list to some hook where the argument is to be expanded. If there are
7841 % less than 10 arguments that hook is to be replaced by ##N where N
7842 % is the position in that list, that is to say the macro arguments are to be
7843 % defined `a la TeX in the macro body.
7844 %
7845 % That gets used by \mbodybackslash (above).
7846 %
7847 % If there are 10 or more arguments, a different technique is used: see
7848 % \parsemmanyargdef.
7849 %
7850 \def\parsemargdef#1;{%
7851 \paramno=0\def\paramlist{}%
7852 \let\hash\relax
7853 % \hash is redefined to `#' later to get it into definitions
7854 \let\processmacroarg\relax
7855 \parsemargdefxxx#1,;,%
7856 \ifnum\paramno<10\relax\else
7857 \paramno0\relax
7858 \parsemmanyargdef@@#1,;,% 10 or more arguments
7859 \fi
7860 }
7861 \def\parsemargdefxxx#1,{%
7862 \if#1;\let\next=\relax
7863 \else \let\next=\parsemargdefxxx
7864 \advance\paramno by 1
7865 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
7866 {\processmacroarg{\hash\the\paramno}}%
7867 \edef\paramlist{\paramlist\hash\the\paramno,}%
7868 \fi\next}
7869
7870 % \parsemacbody, \parsermacbody
7871 %
7872 % Read recursive and nonrecursive macro bodies. (They're different since
7873 % rec and nonrec macros end differently.)
7874 %
7875 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
7876 % body to be transformed.
7877 % Set \macrobody to the body of the macro, and call \defmacro.
7878 %
7879 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
7880 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
7881 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
7882 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
7883
7884 % Make @ a letter, so that we can make private-to-Texinfo macro names.
7885 \edef\texiatcatcode{\the\catcode`\@}
7886 \catcode `@=11\relax
7887
7888 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
7889
7890 % If there are 10 or more arguments, a different technique is used, where the
7891 % hook remains in the body, and when macro is to be expanded the body is
7892 % processed again to replace the arguments.
7893 %
7894 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
7895 % argument N value and then \edef the body (nothing else will expand because of
7896 % the catcode regime under which the body was input).
7897 %
7898 % If you compile with TeX (not eTeX), and you have macros with 10 or more
7899 % arguments, no macro can have more than 256 arguments (else error).
7900 %
7901 % In case that there are 10 or more arguments we parse again the arguments
7902 % list to set new definitions for the \macarg.BLAH macros corresponding to
7903 % each BLAH argument. It was anyhow needed to parse already once this list
7904 % in order to count the arguments, and as macros with at most 9 arguments
7905 % are by far more frequent than macro with 10 or more arguments, defining
7906 % twice the \macarg.BLAH macros does not cost too much processing power.
7907 \def\parsemmanyargdef@@#1,{%
7908 \if#1;\let\next=\relax
7909 \else
7910 \let\next=\parsemmanyargdef@@
7911 \edef\tempb{\eatspaces{#1}}%
7912 \expandafter\def\expandafter\tempa
7913 \expandafter{\csname macarg.\tempb\endcsname}%
7914 % Note that we need some extra \noexpand\noexpand, this is because we
7915 % don't want \the to be expanded in the \parsermacbody as it uses an
7916 % \xdef .
7917 \expandafter\edef\tempa
7918 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
7919 \advance\paramno by 1\relax
7920 \fi\next}
7921
7922
7923 \let\endargs@\relax
7924 \let\nil@\relax
7925 \def\nilm@{\nil@}%
7926 \long\def\nillm@{\nil@}%
7927
7928 % This macro is expanded during the Texinfo macro expansion, not during its
7929 % definition. It gets all the arguments' values and assigns them to macros
7930 % macarg.ARGNAME
7931 %
7932 % #1 is the macro name
7933 % #2 is the list of argument names
7934 % #3 is the list of argument values
7935 \def\getargvals@#1#2#3{%
7936 \def\macargdeflist@{}%
7937 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
7938 \def\paramlist{#2,\nil@}%
7939 \def\macroname{#1}%
7940 \begingroup
7941 \macroargctxt
7942 \def\argvaluelist{#3,\nil@}%
7943 \def\@tempa{#3}%
7944 \ifx\@tempa\empty
7945 \setemptyargvalues@
7946 \else
7947 \getargvals@@
7948 \fi
7949 }
7950 \def\getargvals@@{%
7951 \ifx\paramlist\nilm@
7952 % Some sanity check needed here that \argvaluelist is also empty.
7953 \ifx\argvaluelist\nillm@
7954 \else
7955 \errhelp = \EMsimple
7956 \errmessage{Too many arguments in macro `\macroname'!}%
7957 \fi
7958 \let\next\macargexpandinbody@
7959 \else
7960 \ifx\argvaluelist\nillm@
7961 % No more arguments values passed to macro. Set remaining named-arg
7962 % macros to empty.
7963 \let\next\setemptyargvalues@
7964 \else
7965 % pop current arg name into \@tempb
7966 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
7967 \expandafter\@tempa\expandafter{\paramlist}%
7968 % pop current argument value into \@tempc
7969 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
7970 \expandafter\@tempa\expandafter{\argvaluelist}%
7971 % Here \@tempb is the current arg name and \@tempc is the current arg value.
7972 % First place the new argument macro definition into \@tempd
7973 \expandafter\macname\expandafter{\@tempc}%
7974 \expandafter\let\csname macarg.\@tempb\endcsname\relax
7975 \expandafter\def\expandafter\@tempe\expandafter{%
7976 \csname macarg.\@tempb\endcsname}%
7977 \edef\@tempd{\long\def\@tempe{\the\macname}}%
7978 \push@\@tempd\macargdeflist@
7979 \let\next\getargvals@@
7980 \fi
7981 \fi
7982 \next
7983 }
7984
7985 \def\push@#1#2{%
7986 \expandafter\expandafter\expandafter\def
7987 \expandafter\expandafter\expandafter#2%
7988 \expandafter\expandafter\expandafter{%
7989 \expandafter#1#2}%
7990 }
7991
7992 % Replace arguments by their values in the macro body, and place the result
7993 % in macro \@tempa.
7994 %
7995 \def\macvalstoargs@{%
7996 % To do this we use the property that token registers that are \the'ed
7997 % within an \edef expand only once. So we are going to place all argument
7998 % values into respective token registers.
7999 %
8000 % First we save the token context, and initialize argument numbering.
8001 \begingroup
8002 \paramno0\relax
8003 % Then, for each argument number #N, we place the corresponding argument
8004 % value into a new token list register \toks#N
8005 \expandafter\putargsintokens@\saveparamlist@,;,%
8006 % Then, we expand the body so that argument are replaced by their
8007 % values. The trick for values not to be expanded themselves is that they
8008 % are within tokens and that tokens expand only once in an \edef .
8009 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8010 % Now we restore the token stack pointer to free the token list registers
8011 % which we have used, but we make sure that expanded body is saved after
8012 % group.
8013 \expandafter
8014 \endgroup
8015 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8016 }
8017
8018 % Define the named-macro outside of this group and then close this group.
8019 %
8020 \def\macargexpandinbody@{%
8021 \expandafter
8022 \endgroup
8023 \macargdeflist@
8024 % First the replace in body the macro arguments by their values, the result
8025 % is in \@tempa .
8026 \macvalstoargs@
8027 % Then we point at the \norecurse or \gobble (for recursive) macro value
8028 % with \@tempb .
8029 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8030 % Depending on whether it is recursive or not, we need some tailing
8031 % \egroup .
8032 \ifx\@tempb\gobble
8033 \let\@tempc\relax
8034 \else
8035 \let\@tempc\egroup
8036 \fi
8037 % And now we do the real job:
8038 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8039 \@tempd
8040 }
8041
8042 \def\putargsintokens@#1,{%
8043 \if#1;\let\next\relax
8044 \else
8045 \let\next\putargsintokens@
8046 % First we allocate the new token list register, and give it a temporary
8047 % alias \@tempb .
8048 \toksdef\@tempb\the\paramno
8049 % Then we place the argument value into that token list register.
8050 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8051 \expandafter\@tempb\expandafter{\@tempa}%
8052 \advance\paramno by 1\relax
8053 \fi
8054 \next
8055 }
8056
8057 % Trailing missing arguments are set to empty.
8058 %
8059 \def\setemptyargvalues@{%
8060 \ifx\paramlist\nilm@
8061 \let\next\macargexpandinbody@
8062 \else
8063 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8064 \let\next\setemptyargvalues@
8065 \fi
8066 \next
8067 }
8068
8069 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8070 \expandafter\def\expandafter\@tempa\expandafter{%
8071 \expandafter\def\csname macarg.#1\endcsname{}}%
8072 \push@\@tempa\macargdeflist@
8073 \def\paramlist{#2}%
8074 }
8075
8076 % #1 is the element target macro
8077 % #2 is the list macro
8078 % #3,#4\endargs@ is the list value
8079 \def\pop@#1#2#3,#4\endargs@{%
8080 \def#1{#3}%
8081 \def#2{#4}%
8082 }
8083 \long\def\longpop@#1#2#3,#4\endargs@{%
8084 \long\def#1{#3}%
8085 \long\def#2{#4}%
8086 }
8087
8088
8089 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8090
8091
8092
8093 % Remove following spaces at the expansion stage.
8094 % This works because spaces are discarded before each argument when TeX is
8095 % getting the arguments for a macro.
8096 % This must not be immediately followed by a }.
8097 \long\def\gobblespaces#1{#1}
8098
8099 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8100 % \macrobody has the body of the macro in it, with placeholders for
8101 % its parameters, looking like "\processmacroarg{\hash 1}".
8102 % \paramno is the number of parameters
8103 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8104 % There are eight cases: recursive and nonrecursive macros of zero, one,
8105 % up to nine, and many arguments.
8106 % \xdef is used so that macro definitions will survive the file
8107 % they're defined in: @include reads the file inside a group.
8108 %
8109 \def\defmacro{%
8110 \let\hash=##% convert placeholders to macro parameter chars
8111 \ifnum\paramno=1
8112 \def\processmacroarg{\gobblespaces}%
8113 % This removes the pair of braces around the argument. We don't
8114 % use \eatspaces, because this can cause ends of lines to be lost
8115 % when the argument to \eatspaces is read, leading to line-based
8116 % commands like "@itemize" not being read correctly.
8117 \else
8118 \def\processmacroarg{\xprocessmacroarg}%
8119 \let\xprocessmacroarg\relax
8120 \fi
8121 \ifrecursive %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8122 \ifcase\paramno
8123 % 0
8124 \expandafter\xdef\csname\the\macname\endcsname{%
8125 \noexpand\scanmacro{\macrobody}}%
8126 \or % 1
8127 \expandafter\xdef\csname\the\macname\endcsname{%
8128 \bgroup
8129 \noexpand\braceorline
8130 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8131 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8132 \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
8133 \noexpand\gobblespaces##1\empty}%
8134 % The \empty is for \gobblespaces in case #1 is empty
8135 }%
8136 \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
8137 \egroup\noexpand\scanmacro{\macrobody}}%
8138 \else
8139 \ifnum\paramno<10\relax % at most 9
8140 % See non-recursive section below for comments
8141 \expandafter\xdef\csname\the\macname\endcsname{%
8142 \bgroup
8143 \noexpand\expandafter
8144 \noexpand\macroargctxt
8145 \noexpand\expandafter
8146 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8147 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8148 \noexpand\passargtomacro
8149 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8150 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8151 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8152 \expandafter\expandafter
8153 \expandafter\xdef
8154 \expandafter\expandafter
8155 \csname\the\macname @@@@\endcsname\paramlist{%
8156 \egroup\noexpand\scanmacro{\macrobody}}%
8157 \else % 10 or more
8158 \expandafter\xdef\csname\the\macname\endcsname{%
8159 \noexpand\getargvals@{\the\macname}{\argl}%
8160 }%
8161 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8162 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8163 \fi
8164 \fi
8165 \else %%%%%%%%%%%%%%%%%%%%%% Non-recursive %%%%%%%%%%%%%%%%%%%%%%%%%%
8166 \ifcase\paramno
8167 % 0
8168 \expandafter\xdef\csname\the\macname\endcsname{%
8169 \noexpand\scanmacro{\macrobody}}%
8170 \or % 1
8171 \expandafter\xdef\csname\the\macname\endcsname{%
8172 \bgroup
8173 \noexpand\braceorline
8174 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8175 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8176 \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
8177 \noexpand\gobblespaces##1\empty}%
8178 % The \empty is for \gobblespaces in case #1 is empty
8179 }%
8180 \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
8181 \egroup
8182 \noexpand\scanmacro{\macrobody}%
8183 }%
8184 \else % at most 9
8185 \ifnum\paramno<10\relax
8186 % @MACNAME sets the context for reading the macro argument
8187 % @MACNAME@@ gets the argument, processes backslashes and appends a
8188 % comma.
8189 % @MACNAME@@@ removes braces surrounding the argument list.
8190 % @MACNAME@@@@ scans the macro body with arguments substituted.
8191 \expandafter\xdef\csname\the\macname\endcsname{%
8192 \bgroup
8193 \noexpand\expandafter % This \expandafter skip any spaces after the
8194 \noexpand\macroargctxt % macro before we change the catcode of space.
8195 \noexpand\expandafter
8196 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8197 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8198 \noexpand\passargtomacro
8199 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8200 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8201 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8202 \expandafter\expandafter
8203 \expandafter\xdef
8204 \expandafter\expandafter
8205 \csname\the\macname @@@@\endcsname\paramlist{%
8206 \egroup\noexpand\scanmacro{\macrobody}}%
8207 \else % 10 or more:
8208 \expandafter\xdef\csname\the\macname\endcsname{%
8209 \noexpand\getargvals@{\the\macname}{\argl}%
8210 }%
8211 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8212 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
8213 \fi
8214 \fi
8215 \fi}
8216
8217 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8218
8219 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8220
8221
8222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8223 %
8224 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8225 @catcode`@_=11 % private names
8226 @catcode`@!=11 % used as argument separator
8227
8228 % \passargtomacro#1#2 -
8229 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8230 % compressed to one.
8231 %
8232 % This implementation works by expansion, and not execution (so we cannot use
8233 % \def or similar). This reduces the risk of this failing in contexts where
8234 % complete expansion is done with no execution (for example, in writing out to
8235 % an auxiliary file for an index entry).
8236 %
8237 % State is kept in the input stream: the argument passed to
8238 % @look_ahead, @gobble_and_check_finish and @add_segment is
8239 %
8240 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8241 %
8242 % where:
8243 % THE_MACRO - name of the macro we want to call
8244 % ARG_RESULT - argument list we build to pass to that macro
8245 % PENDING_BS - either a backslash or nothing
8246 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8247
8248 @gdef@passargtomacro#1#2{%
8249 @add_segment #1!{}@relax#2\@_finish\%
8250 }
8251 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8252
8253 % #1 - THE_MACRO ARG_RESULT
8254 % #2 - PENDING_BS
8255 % #3 - NEXT_TOKEN
8256 % #4 used to look ahead
8257 %
8258 % If the next token is not a backslash, process the rest of the argument;
8259 % otherwise, remove the next token.
8260 @gdef@look_ahead#1!#2#3#4{%
8261 @ifx#4\%
8262 @expandafter@gobble_and_check_finish
8263 @else
8264 @expandafter@add_segment
8265 @fi#1!{#2}#4#4%
8266 }
8267
8268 % #1 - THE_MACRO ARG_RESULT
8269 % #2 - PENDING_BS
8270 % #3 - NEXT_TOKEN
8271 % #4 should be a backslash, which is gobbled.
8272 % #5 looks ahead
8273 %
8274 % Double backslash found. Add a single backslash, and look ahead.
8275 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8276 @add_segment#1\!{}#5#5%
8277 }
8278
8279 @gdef@is_fi{@fi}
8280
8281 % #1 - THE_MACRO ARG_RESULT
8282 % #2 - PENDING_BS
8283 % #3 - NEXT_TOKEN
8284 % #4 is input stream until next backslash
8285 %
8286 % Input stream is either at the start of the argument, or just after a
8287 % backslash sequence, either a lone backslash, or a doubled backslash.
8288 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8289 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8290 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8291 % a backslash just before the start of the input stream that has not been
8292 % added to ARG_RESULT.
8293 @gdef@add_segment#1!#2#3#4\{%
8294 @ifx#3@_finish
8295 @call_the_macro#1!%
8296 @else
8297 % append the pending backslash to the result, followed by the next segment
8298 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8299 % this @fi is discarded by @look_ahead.
8300 % we can't get rid of it with \expandafter because we don't know how
8301 % long #4 is.
8302 }
8303
8304 % #1 - THE_MACRO
8305 % #2 - ARG_RESULT
8306 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8307 % conditional.
8308 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8309
8310 }
8311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8312
8313 % \braceorline MAC is used for a one-argument macro MAC. It checks
8314 % whether the next non-whitespace character is a {. It sets the context
8315 % for reading the argument (slightly different in the two cases). Then,
8316 % to read the argument, in the whole-line case, it then calls the regular
8317 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8318 %
8319 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8320 \def\braceorlinexxx{%
8321 \ifx\nchar\bgroup
8322 \macroargctxt
8323 \expandafter\passargtomacro
8324 \else
8325 \macrolineargctxt\expandafter\parsearg
8326 \fi \macnamexxx}
8327
8328
8329 % @alias.
8330 % We need some trickery to remove the optional spaces around the equal
8331 % sign. Make them active and then expand them all to nothing.
8332 %
8333 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8334 \def\aliasxxx #1{\aliasyyy#1\relax}
8335 \def\aliasyyy #1=#2\relax{%
8336 {%
8337 \expandafter\let\obeyedspace=\empty
8338 \addtomacrolist{#1}%
8339 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8340 }%
8341 \next
8342 }
8343
8344
8345 \message{cross references,}
8346
8347 \newwrite\auxfile
8348 \newif\ifhavexrefs % True if xref values are known.
8349 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8350
8351 % @inforef is relatively simple.
8352 \def\inforef #1{\inforefzzz #1,,,,**}
8353 \def\inforefzzz #1,#2,#3,#4**{%
8354 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8355 node \samp{\ignorespaces#1{}}}
8356
8357 % @node's only job in TeX is to define \lastnode, which is used in
8358 % cross-references. The @node line might or might not have commas, and
8359 % might or might not have spaces before the first comma, like:
8360 % @node foo , bar , ...
8361 % We don't want such trailing spaces in the node name.
8362 %
8363 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8364 %
8365 % also remove a trailing comma, in case of something like this:
8366 % @node Help-Cross, , , Cross-refs
8367 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8368 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
8369
8370 \let\nwnode=\node
8371 \let\lastnode=\empty
8372
8373 % Write a cross-reference definition for the current node. #1 is the
8374 % type (Ynumbered, Yappendix, Ynothing).
8375 %
8376 \def\donoderef#1{%
8377 \ifx\lastnode\empty\else
8378 \setref{\lastnode}{#1}%
8379 \global\let\lastnode=\empty
8380 \fi
8381 }
8382
8383 % @anchor{NAME} -- define xref target at arbitrary point.
8384 %
8385 \newcount\savesfregister
8386 %
8387 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8388 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8389 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8390
8391 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8392 % anchor), which consists of three parts:
8393 % 1) NAME-title - the current sectioning name taken from \lastsection,
8394 % or the anchor name.
8395 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8396 % empty for anchors.
8397 % 3) NAME-pg - the page number.
8398 %
8399 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8400 % floats, there is an additional part, which is not written here:
8401 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8402 %
8403 \def\setref#1#2{%
8404 \pdfmkdest{#1}%
8405 \iflinks
8406 {%
8407 \requireauxfile
8408 \atdummies % preserve commands, but don't expand them
8409 \edef\writexrdef##1##2{%
8410 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8411 ##1}{##2}}% these are parameters of \writexrdef
8412 }%
8413 \toks0 = \expandafter{\lastsection}%
8414 \immediate \writexrdef{title}{\the\toks0 }%
8415 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8416 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8417 }%
8418 \fi
8419 }
8420
8421 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8422 % automatically in xrefs, if the third arg is not explicitly specified.
8423 % This was provided as a "secret" @set xref-automatic-section-title
8424 % variable, now it's official.
8425 %
8426 \parseargdef\xrefautomaticsectiontitle{%
8427 \def\temp{#1}%
8428 \ifx\temp\onword
8429 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8430 = \empty
8431 \else\ifx\temp\offword
8432 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8433 = \relax
8434 \else
8435 \errhelp = \EMsimple
8436 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8437 must be on|off}%
8438 \fi\fi
8439 }
8440
8441 % \f
8442 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8443 % the node name, #2 the name of the Info cross-reference, #3 the printed
8444 % node name, #4 the name of the Info file, #5 the name of the printed
8445 % manual. All but the node name can be omitted.
8446 %
8447 \def\pxref{\putwordsee{} \xrefXX}
8448 \def\xref{\putwordSee{} \xrefXX}
8449 \def\ref{\xrefXX}
8450
8451 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8452 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8453 %
8454 \newbox\toprefbox
8455 \newbox\printedrefnamebox
8456 \newbox\infofilenamebox
8457 \newbox\printedmanualbox
8458 %
8459 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8460 \unsepspaces
8461 %
8462 % Get args without leading/trailing spaces.
8463 \def\printedrefname{\ignorespaces #3}%
8464 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8465 %
8466 \def\infofilename{\ignorespaces #4}%
8467 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8468 %
8469 \def\printedmanual{\ignorespaces #5}%
8470 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8471 %
8472 % If the printed reference name (arg #3) was not explicitly given in
8473 % the @xref, figure out what we want to use.
8474 \ifdim \wd\printedrefnamebox = 0pt
8475 % No printed node name was explicitly given.
8476 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8477 % Not auto section-title: use node name inside the square brackets.
8478 \def\printedrefname{\ignorespaces #1}%
8479 \else
8480 % Auto section-title: use chapter/section title inside
8481 % the square brackets if we have it.
8482 \ifdim \wd\printedmanualbox > 0pt
8483 % It is in another manual, so we don't have it; use node name.
8484 \def\printedrefname{\ignorespaces #1}%
8485 \else
8486 \ifhavexrefs
8487 % We (should) know the real title if we have the xref values.
8488 \def\printedrefname{\refx{#1-title}{}}%
8489 \else
8490 % Otherwise just copy the Info node name.
8491 \def\printedrefname{\ignorespaces #1}%
8492 \fi%
8493 \fi
8494 \fi
8495 \fi
8496 %
8497 % Make link in pdf output.
8498 \ifpdf
8499 {\indexnofonts
8500 \turnoffactive
8501 \makevalueexpandable
8502 % This expands tokens, so do it after making catcode changes, so _
8503 % etc. don't get their TeX definitions. This ignores all spaces in
8504 % #4, including (wrongly) those in the middle of the filename.
8505 \getfilename{#4}%
8506 %
8507 % This (wrongly) does not take account of leading or trailing
8508 % spaces in #1, which should be ignored.
8509 \edef\pdfxrefdest{#1}%
8510 \ifx\pdfxrefdest\empty
8511 \def\pdfxrefdest{Top}% no empty targets
8512 \else
8513 \txiescapepdf\pdfxrefdest % escape PDF special chars
8514 \fi
8515 %
8516 \leavevmode
8517 \startlink attr{/Border [0 0 0]}%
8518 \ifnum\filenamelength>0
8519 goto file{\the\filename.pdf} name{\pdfxrefdest}%
8520 \else
8521 goto name{\pdfmkpgn{\pdfxrefdest}}%
8522 \fi
8523 }%
8524 \setcolor{\linkcolor}%
8525 \fi
8526 %
8527 % Float references are printed completely differently: "Figure 1.2"
8528 % instead of "[somenode], p.3". We distinguish them by the
8529 % LABEL-title being set to a magic string.
8530 {%
8531 % Have to otherify everything special to allow the \csname to
8532 % include an _ in the xref name, etc.
8533 \indexnofonts
8534 \turnoffactive
8535 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8536 \csname XR#1-title\endcsname
8537 }%
8538 \iffloat\Xthisreftitle
8539 % If the user specified the print name (third arg) to the ref,
8540 % print it instead of our usual "Figure 1.2".
8541 \ifdim\wd\printedrefnamebox = 0pt
8542 \refx{#1-snt}{}%
8543 \else
8544 \printedrefname
8545 \fi
8546 %
8547 % If the user also gave the printed manual name (fifth arg), append
8548 % "in MANUALNAME".
8549 \ifdim \wd\printedmanualbox > 0pt
8550 \space \putwordin{} \cite{\printedmanual}%
8551 \fi
8552 \else
8553 % node/anchor (non-float) references.
8554 %
8555 % If we use \unhbox to print the node names, TeX does not insert
8556 % empty discretionaries after hyphens, which means that it will not
8557 % find a line break at a hyphen in a node names. Since some manuals
8558 % are best written with fairly long node names, containing hyphens,
8559 % this is a loss. Therefore, we give the text of the node name
8560 % again, so it is as if TeX is seeing it for the first time.
8561 %
8562 \ifdim \wd\printedmanualbox > 0pt
8563 % Cross-manual reference with a printed manual name.
8564 %
8565 \crossmanualxref{\cite{\printedmanual\unskip}}%
8566 %
8567 \else\ifdim \wd\infofilenamebox > 0pt
8568 % Cross-manual reference with only an info filename (arg 4), no
8569 % printed manual name (arg 5). This is essentially the same as
8570 % the case above; we output the filename, since we have nothing else.
8571 %
8572 \crossmanualxref{\code{\infofilename\unskip}}%
8573 %
8574 \else
8575 % Reference within this manual.
8576 %
8577 % _ (for example) has to be the character _ for the purposes of the
8578 % control sequence corresponding to the node, but it has to expand
8579 % into the usual \leavevmode...\vrule stuff for purposes of
8580 % printing. So we \turnoffactive for the \refx-snt, back on for the
8581 % printing, back off for the \refx-pg.
8582 {\turnoffactive
8583 % Only output a following space if the -snt ref is nonempty; for
8584 % @unnumbered and @anchor, it won't be.
8585 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
8586 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8587 }%
8588 % output the `[mynode]' via the macro below so it can be overridden.
8589 \xrefprintnodename\printedrefname
8590 %
8591 % But we always want a comma and a space:
8592 ,\space
8593 %
8594 % output the `page 3'.
8595 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
8596 \ifx,\tokenafterxref
8597 \else\ifx.\tokenafterxref
8598 \else\ifx;\tokenafterxref
8599 \else\ifx)\tokenafterxref
8600 \else,% add a , if xref not followed by punctuation
8601 \fi\fi\fi\fi
8602 \fi\fi
8603 \fi
8604 \endlink
8605 \endgroup}
8606
8607 % Output a cross-manual xref to #1. Used just above (twice).
8608 %
8609 % Only include the text "Section ``foo'' in" if the foo is neither
8610 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
8611 % "see The Foo Manual", the idea being to refer to the whole manual.
8612 %
8613 % But, this being TeX, we can't easily compare our node name against the
8614 % string "Top" while ignoring the possible spaces before and after in
8615 % the input. By adding the arbitrary 7sp below, we make it much less
8616 % likely that a real node name would have the same width as "Top" (e.g.,
8617 % in a monospaced font). Hopefully it will never happen in practice.
8618 %
8619 % For the same basic reason, we retypeset the "Top" at every
8620 % reference, since the current font is indeterminate.
8621 %
8622 \def\crossmanualxref#1{%
8623 \setbox\toprefbox = \hbox{Top\kern7sp}%
8624 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
8625 \ifdim \wd2 > 7sp % nonempty?
8626 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
8627 \putwordSection{} ``\printedrefname'' \putwordin{}\space
8628 \fi
8629 \fi
8630 #1%
8631 }
8632
8633 % This macro is called from \xrefX for the `[nodename]' part of xref
8634 % output. It's a separate macro only so it can be changed more easily,
8635 % since square brackets don't work well in some documents. Particularly
8636 % one that Bob is working on :).
8637 %
8638 \def\xrefprintnodename#1{[#1]}
8639
8640 % Things referred to by \setref.
8641 %
8642 \def\Ynothing{}
8643 \def\Yomitfromtoc{}
8644 \def\Ynumbered{%
8645 \ifnum\secno=0
8646 \putwordChapter@tie \the\chapno
8647 \else \ifnum\subsecno=0
8648 \putwordSection@tie \the\chapno.\the\secno
8649 \else \ifnum\subsubsecno=0
8650 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
8651 \else
8652 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
8653 \fi\fi\fi
8654 }
8655 \def\Yappendix{%
8656 \ifnum\secno=0
8657 \putwordAppendix@tie @char\the\appendixno{}%
8658 \else \ifnum\subsecno=0
8659 \putwordSection@tie @char\the\appendixno.\the\secno
8660 \else \ifnum\subsubsecno=0
8661 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
8662 \else
8663 \putwordSection@tie
8664 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
8665 \fi\fi\fi
8666 }
8667
8668 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
8669 % If its value is nonempty, SUFFIX is output afterward.
8670 %
8671 \def\refx#1#2{%
8672 \requireauxfile
8673 {%
8674 \indexnofonts
8675 \otherbackslash
8676 \expandafter\global\expandafter\let\expandafter\thisrefX
8677 \csname XR#1\endcsname
8678 }%
8679 \ifx\thisrefX\relax
8680 % If not defined, say something at least.
8681 \angleleft un\-de\-fined\angleright
8682 \iflinks
8683 \ifhavexrefs
8684 {\toks0 = {#1}% avoid expansion of possibly-complex value
8685 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
8686 \else
8687 \ifwarnedxrefs\else
8688 \global\warnedxrefstrue
8689 \message{Cross reference values unknown; you must run TeX again.}%
8690 \fi
8691 \fi
8692 \fi
8693 \else
8694 % It's defined, so just use it.
8695 \thisrefX
8696 \fi
8697 #2% Output the suffix in any case.
8698 }
8699
8700 % This is the macro invoked by entries in the aux file. Usually it's
8701 % just a \def (we prepend XR to the control sequence name to avoid
8702 % collisions). But if this is a float type, we have more work to do.
8703 %
8704 \def\xrdef#1#2{%
8705 {% The node name might contain 8-bit characters, which in our current
8706 % implementation are changed to commands like @'e. Don't let these
8707 % mess up the control sequence name.
8708 \indexnofonts
8709 \turnoffactive
8710 \xdef\safexrefname{#1}%
8711 }%
8712 %
8713 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
8714 %
8715 % Was that xref control sequence that we just defined for a float?
8716 \expandafter\iffloat\csname XR\safexrefname\endcsname
8717 % it was a float, and we have the (safe) float type in \iffloattype.
8718 \expandafter\let\expandafter\floatlist
8719 \csname floatlist\iffloattype\endcsname
8720 %
8721 % Is this the first time we've seen this float type?
8722 \expandafter\ifx\floatlist\relax
8723 \toks0 = {\do}% yes, so just \do
8724 \else
8725 % had it before, so preserve previous elements in list.
8726 \toks0 = \expandafter{\floatlist\do}%
8727 \fi
8728 %
8729 % Remember this xref in the control sequence \floatlistFLOATTYPE,
8730 % for later use in \listoffloats.
8731 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
8732 {\safexrefname}}%
8733 \fi
8734 }
8735
8736 % If working on a large document in chapters, it is convenient to
8737 % be able to disable indexing, cross-referencing, and contents, for test runs.
8738 % This is done with @novalidate at the beginning of the file.
8739 %
8740 \newif\iflinks \linkstrue % by default we want the aux files.
8741 \let\novalidate = \linksfalse
8742
8743 % Used when writing to the aux file, or when using data from it.
8744 \def\requireauxfile{%
8745 \iflinks
8746 \tryauxfile
8747 % Open the new aux file. TeX will close it automatically at exit.
8748 \immediate\openout\auxfile=\jobname.aux
8749 \fi
8750 \global\let\requireauxfile=\relax % Only do this once.
8751 }
8752
8753 % Read the last existing aux file, if any. No error if none exists.
8754 %
8755 \def\tryauxfile{%
8756 \openin 1 \jobname.aux
8757 \ifeof 1 \else
8758 \readdatafile{aux}%
8759 \global\havexrefstrue
8760 \fi
8761 \closein 1
8762 }
8763
8764 \def\setupdatafile{%
8765 \catcode`\^^@=\other
8766 \catcode`\^^A=\other
8767 \catcode`\^^B=\other
8768 \catcode`\^^C=\other
8769 \catcode`\^^D=\other
8770 \catcode`\^^E=\other
8771 \catcode`\^^F=\other
8772 \catcode`\^^G=\other
8773 \catcode`\^^H=\other
8774 \catcode`\^^K=\other
8775 \catcode`\^^L=\other
8776 \catcode`\^^N=\other
8777 \catcode`\^^P=\other
8778 \catcode`\^^Q=\other
8779 \catcode`\^^R=\other
8780 \catcode`\^^S=\other
8781 \catcode`\^^T=\other
8782 \catcode`\^^U=\other
8783 \catcode`\^^V=\other
8784 \catcode`\^^W=\other
8785 \catcode`\^^X=\other
8786 \catcode`\^^Z=\other
8787 \catcode`\^^[=\other
8788 \catcode`\^^\=\other
8789 \catcode`\^^]=\other
8790 \catcode`\^^^=\other
8791 \catcode`\^^_=\other
8792 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
8793 % in xref tags, i.e., node names. But since ^^e4 notation isn't
8794 % supported in the main text, it doesn't seem desirable. Furthermore,
8795 % that is not enough: for node names that actually contain a ^
8796 % character, we would end up writing a line like this: 'xrdef {'hat
8797 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
8798 % argument, and \hat is not an expandable control sequence. It could
8799 % all be worked out, but why? Either we support ^^ or we don't.
8800 %
8801 % The other change necessary for this was to define \auxhat:
8802 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
8803 % and then to call \auxhat in \setq.
8804 %
8805 \catcode`\^=\other
8806 %
8807 % Special characters. Should be turned off anyway, but...
8808 \catcode`\~=\other
8809 \catcode`\[=\other
8810 \catcode`\]=\other
8811 \catcode`\"=\other
8812 \catcode`\_=\other
8813 \catcode`\|=\other
8814 \catcode`\<=\other
8815 \catcode`\>=\other
8816 \catcode`\$=\other
8817 \catcode`\#=\other
8818 \catcode`\&=\other
8819 \catcode`\%=\other
8820 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
8821 %
8822 % This is to support \ in node names and titles, since the \
8823 % characters end up in a \csname. It's easier than
8824 % leaving it active and making its active definition an actual \
8825 % character. What I don't understand is why it works in the *value*
8826 % of the xrdef. Seems like it should be a catcode12 \, and that
8827 % should not typeset properly. But it works, so I'm moving on for
8828 % now. --karl, 15jan04.
8829 \catcode`\\=\other
8830 %
8831 % Make the characters 128-255 be printing characters.
8832 {\setnonasciicharscatcodenonglobal\other}%
8833 %
8834 % @ is our escape character in .aux files, and we need braces.
8835 \catcode`\{=1
8836 \catcode`\}=2
8837 \catcode`\@=0
8838 }
8839
8840 \def\readdatafile#1{%
8841 \begingroup
8842 \setupdatafile
8843 \input\jobname.#1
8844 \endgroup}
8845
8846
8847 \message{insertions,}
8848 % including footnotes.
8849
8850 \newcount \footnoteno
8851
8852 % The trailing space in the following definition for supereject is
8853 % vital for proper filling; pages come out unaligned when you do a
8854 % pagealignmacro call if that space before the closing brace is
8855 % removed. (Generally, numeric constants should always be followed by a
8856 % space to prevent strange expansion errors.)
8857 \def\supereject{\par\penalty -20000\footnoteno =0 }
8858
8859 % @footnotestyle is meaningful for Info output only.
8860 \let\footnotestyle=\comment
8861
8862 {\catcode `\@=11
8863 %
8864 % Auto-number footnotes. Otherwise like plain.
8865 \gdef\footnote{%
8866 \global\advance\footnoteno by \@ne
8867 \edef\thisfootno{$^{\the\footnoteno}$}%
8868 %
8869 % In case the footnote comes at the end of a sentence, preserve the
8870 % extra spacing after we do the footnote number.
8871 \let\@sf\empty
8872 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
8873 %
8874 % Remove inadvertent blank space before typesetting the footnote number.
8875 \unskip
8876 \thisfootno\@sf
8877 \dofootnote
8878 }%
8879
8880 % Don't bother with the trickery in plain.tex to not require the
8881 % footnote text as a parameter. Our footnotes don't need to be so general.
8882 %
8883 % Oh yes, they do; otherwise, @ifset (and anything else that uses
8884 % \parseargline) fails inside footnotes because the tokens are fixed when
8885 % the footnote is read. --karl, 16nov96.
8886 %
8887 \gdef\dofootnote{%
8888 \insert\footins\bgroup
8889 %
8890 % Nested footnotes are not supported in TeX, that would take a lot
8891 % more work. (\startsavinginserts does not suffice.)
8892 \let\footnote=\errfootnotenest
8893 %
8894 % We want to typeset this text as a normal paragraph, even if the
8895 % footnote reference occurs in (for example) a display environment.
8896 % So reset some parameters.
8897 \hsize=\pagewidth
8898 \interlinepenalty\interfootnotelinepenalty
8899 \splittopskip\ht\strutbox % top baseline for broken footnotes
8900 \splitmaxdepth\dp\strutbox
8901 \floatingpenalty\@MM
8902 \leftskip\z@skip
8903 \rightskip\z@skip
8904 \spaceskip\z@skip
8905 \xspaceskip\z@skip
8906 \parindent\defaultparindent
8907 %
8908 \smallfonts \rm
8909 %
8910 % Because we use hanging indentation in footnotes, a @noindent appears
8911 % to exdent this text, so make it be a no-op. makeinfo does not use
8912 % hanging indentation so @noindent can still be needed within footnote
8913 % text after an @example or the like (not that this is good style).
8914 \let\noindent = \relax
8915 %
8916 % Hang the footnote text off the number. Use \everypar in case the
8917 % footnote extends for more than one paragraph.
8918 \everypar = {\hang}%
8919 \textindent{\thisfootno}%
8920 %
8921 % Don't crash into the line above the footnote text. Since this
8922 % expands into a box, it must come within the paragraph, lest it
8923 % provide a place where TeX can split the footnote.
8924 \footstrut
8925 %
8926 % Invoke rest of plain TeX footnote routine.
8927 \futurelet\next\fo@t
8928 }
8929 }%end \catcode `\@=11
8930
8931 \def\errfootnotenest{%
8932 \errhelp=\EMsimple
8933 \errmessage{Nested footnotes not supported in texinfo.tex,
8934 even though they work in makeinfo; sorry}
8935 }
8936
8937 \def\errfootnoteheading{%
8938 \errhelp=\EMsimple
8939 \errmessage{Footnotes in chapters, sections, etc., are not supported}
8940 }
8941
8942 % In case a @footnote appears in a vbox, save the footnote text and create
8943 % the real \insert just after the vbox finished. Otherwise, the insertion
8944 % would be lost.
8945 % Similarly, if a @footnote appears inside an alignment, save the footnote
8946 % text to a box and make the \insert when a row of the table is finished.
8947 % And the same can be done for other insert classes. --kasal, 16nov03.
8948 %
8949 % Replace the \insert primitive by a cheating macro.
8950 % Deeper inside, just make sure that the saved insertions are not spilled
8951 % out prematurely.
8952 %
8953 \def\startsavinginserts{%
8954 \ifx \insert\ptexinsert
8955 \let\insert\saveinsert
8956 \else
8957 \let\checkinserts\relax
8958 \fi
8959 }
8960
8961 % This \insert replacement works for both \insert\footins{foo} and
8962 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
8963 %
8964 \def\saveinsert#1{%
8965 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
8966 \afterassignment\next
8967 % swallow the left brace
8968 \let\temp =
8969 }
8970 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
8971 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
8972
8973 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
8974
8975 \def\placesaveins#1{%
8976 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
8977 {\box#1}%
8978 }
8979
8980 % eat @SAVE -- beware, all of them have catcode \other:
8981 {
8982 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
8983 \gdef\gobblesave @SAVE{}
8984 }
8985
8986 % initialization:
8987 \def\newsaveins #1{%
8988 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
8989 \next
8990 }
8991 \def\newsaveinsX #1{%
8992 \csname newbox\endcsname #1%
8993 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
8994 \checksaveins #1}%
8995 }
8996
8997 % initialize:
8998 \let\checkinserts\empty
8999 \newsaveins\footins
9000 \newsaveins\margin
9001
9002
9003 % @image. We use the macros from epsf.tex to support this.
9004 % If epsf.tex is not installed and @image is used, we complain.
9005 %
9006 % Check for and read epsf.tex up front. If we read it only at @image
9007 % time, we might be inside a group, and then its definitions would get
9008 % undone and the next image would fail.
9009 \openin 1 = epsf.tex
9010 \ifeof 1 \else
9011 % Do not bother showing banner with epsf.tex v2.7k (available in
9012 % doc/epsf.tex and on ctan).
9013 \def\epsfannounce{\toks0 = }%
9014 \input epsf.tex
9015 \fi
9016 \closein 1
9017 %
9018 % We will only complain once about lack of epsf.tex.
9019 \newif\ifwarnednoepsf
9020 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9021 work. It is also included in the Texinfo distribution, or you can get
9022 it from ftp://tug.org/tex/epsf.tex.}
9023 %
9024 \def\image#1{%
9025 \ifx\epsfbox\thisisundefined
9026 \ifwarnednoepsf \else
9027 \errhelp = \noepsfhelp
9028 \errmessage{epsf.tex not found, images will be ignored}%
9029 \global\warnednoepsftrue
9030 \fi
9031 \else
9032 \imagexxx #1,,,,,\finish
9033 \fi
9034 }
9035 %
9036 % Arguments to @image:
9037 % #1 is (mandatory) image filename; we tack on .eps extension.
9038 % #2 is (optional) width, #3 is (optional) height.
9039 % #4 is (ignored optional) html alt text.
9040 % #5 is (ignored optional) extension.
9041 % #6 is just the usual extra ignored arg for parsing stuff.
9042 \newif\ifimagevmode
9043 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9044 \catcode`\^^M = 5 % in case we're inside an example
9045 \normalturnoffactive % allow _ et al. in names
9046 \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
9047 % If the image is by itself, center it.
9048 \ifvmode
9049 \imagevmodetrue
9050 \else \ifx\centersub\centerV
9051 % for @center @image, we need a vbox so we can have our vertical space
9052 \imagevmodetrue
9053 \vbox\bgroup % vbox has better behavior than vtop herev
9054 \fi\fi
9055 %
9056 \ifimagevmode
9057 \nobreak\medskip
9058 % Usually we'll have text after the image which will insert
9059 % \parskip glue, so insert it here too to equalize the space
9060 % above and below.
9061 \nobreak\vskip\parskip
9062 \nobreak
9063 \fi
9064 %
9065 % Leave vertical mode so that indentation from an enclosing
9066 % environment such as @quotation is respected.
9067 % However, if we're at the top level, we don't want the
9068 % normal paragraph indentation.
9069 % On the other hand, if we are in the case of @center @image, we don't
9070 % want to start a paragraph, which will create a hsize-width box and
9071 % eradicate the centering.
9072 \ifx\centersub\centerV\else \noindent \fi
9073 %
9074 % Output the image.
9075 \ifpdf
9076 \dopdfimage{#1}{#2}{#3}%
9077 \else
9078 % \epsfbox itself resets \epsf?size at each figure.
9079 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9080 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9081 \epsfbox{#1.eps}%
9082 \fi
9083 %
9084 \ifimagevmode
9085 \medskip % space after a standalone image
9086 \fi
9087 \ifx\centersub\centerV \egroup \fi
9088 \endgroup}
9089
9090
9091 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9092 % etc. We don't actually implement floating yet, we always include the
9093 % float "here". But it seemed the best name for the future.
9094 %
9095 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9096
9097 % There may be a space before second and/or third parameter; delete it.
9098 \def\eatcommaspace#1, {#1,}
9099
9100 % #1 is the optional FLOATTYPE, the text label for this float, typically
9101 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9102 % this float will not be numbered and cannot be referred to.
9103 %
9104 % #2 is the optional xref label. Also must be present for the float to
9105 % be referable.
9106 %
9107 % #3 is the optional positioning argument; for now, it is ignored. It
9108 % will somehow specify the positions allowed to float to (here, top, bottom).
9109 %
9110 % We keep a separate counter for each FLOATTYPE, which we reset at each
9111 % chapter-level command.
9112 \let\resetallfloatnos=\empty
9113 %
9114 \def\dofloat#1,#2,#3,#4\finish{%
9115 \let\thiscaption=\empty
9116 \let\thisshortcaption=\empty
9117 %
9118 % don't lose footnotes inside @float.
9119 %
9120 % BEWARE: when the floats start float, we have to issue warning whenever an
9121 % insert appears inside a float which could possibly float. --kasal, 26may04
9122 %
9123 \startsavinginserts
9124 %
9125 % We can't be used inside a paragraph.
9126 \par
9127 %
9128 \vtop\bgroup
9129 \def\floattype{#1}%
9130 \def\floatlabel{#2}%
9131 \def\floatloc{#3}% we do nothing with this yet.
9132 %
9133 \ifx\floattype\empty
9134 \let\safefloattype=\empty
9135 \else
9136 {%
9137 % the floattype might have accents or other special characters,
9138 % but we need to use it in a control sequence name.
9139 \indexnofonts
9140 \turnoffactive
9141 \xdef\safefloattype{\floattype}%
9142 }%
9143 \fi
9144 %
9145 % If label is given but no type, we handle that as the empty type.
9146 \ifx\floatlabel\empty \else
9147 % We want each FLOATTYPE to be numbered separately (Figure 1,
9148 % Table 1, Figure 2, ...). (And if no label, no number.)
9149 %
9150 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9151 \global\advance\floatno by 1
9152 %
9153 {%
9154 % This magic value for \lastsection is output by \setref as the
9155 % XREFLABEL-title value. \xrefX uses it to distinguish float
9156 % labels (which have a completely different output format) from
9157 % node and anchor labels. And \xrdef uses it to construct the
9158 % lists of floats.
9159 %
9160 \edef\lastsection{\floatmagic=\safefloattype}%
9161 \setref{\floatlabel}{Yfloat}%
9162 }%
9163 \fi
9164 %
9165 % start with \parskip glue, I guess.
9166 \vskip\parskip
9167 %
9168 % Don't suppress indentation if a float happens to start a section.
9169 \restorefirstparagraphindent
9170 }
9171
9172 % we have these possibilities:
9173 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9174 % @float Foo,lbl & no caption: Foo 1.1
9175 % @float Foo & @caption{Cap}: Foo: Cap
9176 % @float Foo & no caption: Foo
9177 % @float ,lbl & Caption{Cap}: 1.1: Cap
9178 % @float ,lbl & no caption: 1.1
9179 % @float & @caption{Cap}: Cap
9180 % @float & no caption:
9181 %
9182 \def\Efloat{%
9183 \let\floatident = \empty
9184 %
9185 % In all cases, if we have a float type, it comes first.
9186 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9187 %
9188 % If we have an xref label, the number comes next.
9189 \ifx\floatlabel\empty \else
9190 \ifx\floattype\empty \else % if also had float type, need tie first.
9191 \appendtomacro\floatident{\tie}%
9192 \fi
9193 % the number.
9194 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9195 \fi
9196 %
9197 % Start the printed caption with what we've constructed in
9198 % \floatident, but keep it separate; we need \floatident again.
9199 \let\captionline = \floatident
9200 %
9201 \ifx\thiscaption\empty \else
9202 \ifx\floatident\empty \else
9203 \appendtomacro\captionline{: }% had ident, so need a colon between
9204 \fi
9205 %
9206 % caption text.
9207 \appendtomacro\captionline{\scanexp\thiscaption}%
9208 \fi
9209 %
9210 % If we have anything to print, print it, with space before.
9211 % Eventually this needs to become an \insert.
9212 \ifx\captionline\empty \else
9213 \vskip.5\parskip
9214 \captionline
9215 %
9216 % Space below caption.
9217 \vskip\parskip
9218 \fi
9219 %
9220 % If have an xref label, write the list of floats info. Do this
9221 % after the caption, to avoid chance of it being a breakpoint.
9222 \ifx\floatlabel\empty \else
9223 % Write the text that goes in the lof to the aux file as
9224 % \floatlabel-lof. Besides \floatident, we include the short
9225 % caption if specified, else the full caption if specified, else nothing.
9226 {%
9227 \requireauxfile
9228 \atdummies
9229 %
9230 % since we read the caption text in the macro world, where ^^M
9231 % is turned into a normal character, we have to scan it back, so
9232 % we don't write the literal three characters "^^M" into the aux file.
9233 \scanexp{%
9234 \xdef\noexpand\gtemp{%
9235 \ifx\thisshortcaption\empty
9236 \thiscaption
9237 \else
9238 \thisshortcaption
9239 \fi
9240 }%
9241 }%
9242 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9243 \ifx\gtemp\empty \else : \gtemp \fi}}%
9244 }%
9245 \fi
9246 \egroup % end of \vtop
9247 %
9248 % place the captured inserts
9249 %
9250 % BEWARE: when the floats start floating, we have to issue warning
9251 % whenever an insert appears inside a float which could possibly
9252 % float. --kasal, 26may04
9253 %
9254 \checkinserts
9255 }
9256
9257 % Append the tokens #2 to the definition of macro #1, not expanding either.
9258 %
9259 \def\appendtomacro#1#2{%
9260 \expandafter\def\expandafter#1\expandafter{#1#2}%
9261 }
9262
9263 % @caption, @shortcaption
9264 %
9265 \def\caption{\docaption\thiscaption}
9266 \def\shortcaption{\docaption\thisshortcaption}
9267 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9268 \def\defcaption#1#2{\egroup \def#1{#2}}
9269
9270 % The parameter is the control sequence identifying the counter we are
9271 % going to use. Create it if it doesn't exist and assign it to \floatno.
9272 \def\getfloatno#1{%
9273 \ifx#1\relax
9274 % Haven't seen this figure type before.
9275 \csname newcount\endcsname #1%
9276 %
9277 % Remember to reset this floatno at the next chap.
9278 \expandafter\gdef\expandafter\resetallfloatnos
9279 \expandafter{\resetallfloatnos #1=0 }%
9280 \fi
9281 \let\floatno#1%
9282 }
9283
9284 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9285 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9286 % first read the @float command.
9287 %
9288 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9289
9290 % Magic string used for the XREFLABEL-title value, so \xrefX can
9291 % distinguish floats from other xref types.
9292 \def\floatmagic{!!float!!}
9293
9294 % #1 is the control sequence we are passed; we expand into a conditional
9295 % which is true if #1 represents a float ref. That is, the magic
9296 % \lastsection value which we \setref above.
9297 %
9298 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9299 %
9300 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9301 % (safe) float type for this float. We set \iffloattype to #2.
9302 %
9303 \def\doiffloat#1=#2=#3\finish{%
9304 \def\temp{#1}%
9305 \def\iffloattype{#2}%
9306 \ifx\temp\floatmagic
9307 }
9308
9309 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9310 %
9311 \parseargdef\listoffloats{%
9312 \def\floattype{#1}% floattype
9313 {%
9314 % the floattype might have accents or other special characters,
9315 % but we need to use it in a control sequence name.
9316 \indexnofonts
9317 \turnoffactive
9318 \xdef\safefloattype{\floattype}%
9319 }%
9320 %
9321 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9322 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9323 \ifhavexrefs
9324 % if the user said @listoffloats foo but never @float foo.
9325 \message{\linenumber No `\safefloattype' floats to list.}%
9326 \fi
9327 \else
9328 \begingroup
9329 \leftskip=\tocindent % indent these entries like a toc
9330 \let\do=\listoffloatsdo
9331 \csname floatlist\safefloattype\endcsname
9332 \endgroup
9333 \fi
9334 }
9335
9336 % This is called on each entry in a list of floats. We're passed the
9337 % xref label, in the form LABEL-title, which is how we save it in the
9338 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9339 % has the text we're supposed to typeset here.
9340 %
9341 % Figures without xref labels will not be included in the list (since
9342 % they won't appear in the aux file).
9343 %
9344 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9345 \def\listoffloatsdoentry#1-title\finish{{%
9346 % Can't fully expand XR#1-lof because it can contain anything. Just
9347 % pass the control sequence. On the other hand, XR#1-pg is just the
9348 % page number, and we want to fully expand that so we can get a link
9349 % in pdf output.
9350 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9351 %
9352 % use the same \entry macro we use to generate the TOC and index.
9353 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9354 \writeentry
9355 }}
9356
9357
9358 \message{localization,}
9359
9360 % For single-language documents, @documentlanguage is usually given very
9361 % early, just after @documentencoding. Single argument is the language
9362 % (de) or locale (de_DE) abbreviation.
9363 %
9364 {
9365 \catcode`\_ = \active
9366 \globaldefs=1
9367 \parseargdef\documentlanguage{%
9368 \tex % read txi-??.tex file in plain TeX.
9369 % Read the file by the name they passed if it exists.
9370 \let_ = \normalunderscore % normal _ character for filename test
9371 \openin 1 txi-#1.tex
9372 \ifeof 1
9373 \documentlanguagetrywithoutunderscore #1_\finish
9374 \else
9375 \globaldefs = 1 % everything in the txi-LL files needs to persist
9376 \input txi-#1.tex
9377 \fi
9378 \closein 1
9379 \endgroup % end raw TeX
9380 }
9381 %
9382 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9383 % try txi-de.tex.
9384 %
9385 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9386 \openin 1 txi-#1.tex
9387 \ifeof 1
9388 \errhelp = \nolanghelp
9389 \errmessage{Cannot read language file txi-#1.tex}%
9390 \else
9391 \globaldefs = 1 % everything in the txi-LL files needs to persist
9392 \input txi-#1.tex
9393 \fi
9394 \closein 1
9395 }
9396 }% end of special _ catcode
9397 %
9398 \newhelp\nolanghelp{The given language definition file cannot be found or
9399 is empty. Maybe you need to install it? Putting it in the current
9400 directory should work if nowhere else does.}
9401
9402 % This macro is called from txi-??.tex files; the first argument is the
9403 % \language name to set (without the "\lang@" prefix), the second and
9404 % third args are \{left,right}hyphenmin.
9405 %
9406 % The language names to pass are determined when the format is built.
9407 % See the etex.log file created at that time, e.g.,
9408 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9409 %
9410 % With TeX Live 2008, etex now includes hyphenation patterns for all
9411 % available languages. This means we can support hyphenation in
9412 % Texinfo, at least to some extent. (This still doesn't solve the
9413 % accented characters problem.)
9414 %
9415 \catcode`@=11
9416 \def\txisetlanguage#1#2#3{%
9417 % do not set the language if the name is undefined in the current TeX.
9418 \expandafter\ifx\csname lang@#1\endcsname \relax
9419 \message{no patterns for #1}%
9420 \else
9421 \global\language = \csname lang@#1\endcsname
9422 \fi
9423 % but there is no harm in adjusting the hyphenmin values regardless.
9424 \global\lefthyphenmin = #2\relax
9425 \global\righthyphenmin = #3\relax
9426 }
9427
9428 % Helpers for encodings.
9429 % Set the catcode of characters 128 through 255 to the specified number.
9430 %
9431 \def\setnonasciicharscatcode#1{%
9432 \count255=128
9433 \loop\ifnum\count255<256
9434 \global\catcode\count255=#1\relax
9435 \advance\count255 by 1
9436 \repeat
9437 }
9438
9439 \def\setnonasciicharscatcodenonglobal#1{%
9440 \count255=128
9441 \loop\ifnum\count255<256
9442 \catcode\count255=#1\relax
9443 \advance\count255 by 1
9444 \repeat
9445 }
9446
9447 % @documentencoding sets the definition of non-ASCII characters
9448 % according to the specified encoding.
9449 %
9450 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9451 \def\documentencodingzzz#1{%
9452 % Encoding being declared for the document.
9453 \def\declaredencoding{\csname #1.enc\endcsname}%
9454 %
9455 % Supported encodings: names converted to tokens in order to be able
9456 % to compare them with \ifx.
9457 \def\ascii{\csname US-ASCII.enc\endcsname}%
9458 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9459 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9460 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9461 \def\utfeight{\csname UTF-8.enc\endcsname}%
9462 %
9463 \ifx \declaredencoding \ascii
9464 \asciichardefs
9465 %
9466 \else \ifx \declaredencoding \lattwo
9467 \setnonasciicharscatcode\active
9468 \lattwochardefs
9469 %
9470 \else \ifx \declaredencoding \latone
9471 \setnonasciicharscatcode\active
9472 \latonechardefs
9473 %
9474 \else \ifx \declaredencoding \latnine
9475 \setnonasciicharscatcode\active
9476 \latninechardefs
9477 %
9478 \else \ifx \declaredencoding \utfeight
9479 \setnonasciicharscatcode\active
9480 % since we already invoked \utfeightchardefs at the top level
9481 % (below), do not re-invoke it, then our check for duplicated
9482 % definitions triggers. Making non-ascii chars active is enough.
9483 %
9484 \else
9485 \message{Ignoring unknown document encoding: #1.}%
9486 %
9487 \fi % utfeight
9488 \fi % latnine
9489 \fi % latone
9490 \fi % lattwo
9491 \fi % ascii
9492 }
9493
9494 % emacs-page
9495 % A message to be logged when using a character that isn't available
9496 % the default font encoding (OT1).
9497 %
9498 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9499
9500 % Take account of \c (plain) vs. \, (Texinfo) difference.
9501 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9502
9503 % First, make active non-ASCII characters in order for them to be
9504 % correctly categorized when TeX reads the replacement text of
9505 % macros containing the character definitions.
9506 \setnonasciicharscatcode\active
9507 %
9508 % Latin1 (ISO-8859-1) character definitions.
9509 \def\latonechardefs{%
9510 \gdef^^a0{\tie}
9511 \gdef^^a1{\exclamdown}
9512 \gdef^^a2{{\tcfont \char162}} % cent
9513 \gdef^^a3{\pounds}
9514 \gdef^^a4{{\tcfont \char164}} % currency
9515 \gdef^^a5{{\tcfont \char165}} % yen
9516 \gdef^^a6{{\tcfont \char166}} % broken bar
9517 \gdef^^a7{\S}
9518 \gdef^^a8{\"{}}
9519 \gdef^^a9{\copyright}
9520 \gdef^^aa{\ordf}
9521 \gdef^^ab{\guillemetleft}
9522 \gdef^^ac{\ensuremath\lnot}
9523 \gdef^^ad{\-}
9524 \gdef^^ae{\registeredsymbol}
9525 \gdef^^af{\={}}
9526 %
9527 \gdef^^b0{\textdegree}
9528 \gdef^^b1{$\pm$}
9529 \gdef^^b2{$^2$}
9530 \gdef^^b3{$^3$}
9531 \gdef^^b4{\'{}}
9532 \gdef^^b5{$\mu$}
9533 \gdef^^b6{\P}
9534 \gdef^^b7{\ensuremath\cdot}
9535 \gdef^^b8{\cedilla\ }
9536 \gdef^^b9{$^1$}
9537 \gdef^^ba{\ordm}
9538 \gdef^^bb{\guillemetright}
9539 \gdef^^bc{$1\over4$}
9540 \gdef^^bd{$1\over2$}
9541 \gdef^^be{$3\over4$}
9542 \gdef^^bf{\questiondown}
9543 %
9544 \gdef^^c0{\`A}
9545 \gdef^^c1{\'A}
9546 \gdef^^c2{\^A}
9547 \gdef^^c3{\~A}
9548 \gdef^^c4{\"A}
9549 \gdef^^c5{\ringaccent A}
9550 \gdef^^c6{\AE}
9551 \gdef^^c7{\cedilla C}
9552 \gdef^^c8{\`E}
9553 \gdef^^c9{\'E}
9554 \gdef^^ca{\^E}
9555 \gdef^^cb{\"E}
9556 \gdef^^cc{\`I}
9557 \gdef^^cd{\'I}
9558 \gdef^^ce{\^I}
9559 \gdef^^cf{\"I}
9560 %
9561 \gdef^^d0{\DH}
9562 \gdef^^d1{\~N}
9563 \gdef^^d2{\`O}
9564 \gdef^^d3{\'O}
9565 \gdef^^d4{\^O}
9566 \gdef^^d5{\~O}
9567 \gdef^^d6{\"O}
9568 \gdef^^d7{$\times$}
9569 \gdef^^d8{\O}
9570 \gdef^^d9{\`U}
9571 \gdef^^da{\'U}
9572 \gdef^^db{\^U}
9573 \gdef^^dc{\"U}
9574 \gdef^^dd{\'Y}
9575 \gdef^^de{\TH}
9576 \gdef^^df{\ss}
9577 %
9578 \gdef^^e0{\`a}
9579 \gdef^^e1{\'a}
9580 \gdef^^e2{\^a}
9581 \gdef^^e3{\~a}
9582 \gdef^^e4{\"a}
9583 \gdef^^e5{\ringaccent a}
9584 \gdef^^e6{\ae}
9585 \gdef^^e7{\cedilla c}
9586 \gdef^^e8{\`e}
9587 \gdef^^e9{\'e}
9588 \gdef^^ea{\^e}
9589 \gdef^^eb{\"e}
9590 \gdef^^ec{\`{\dotless i}}
9591 \gdef^^ed{\'{\dotless i}}
9592 \gdef^^ee{\^{\dotless i}}
9593 \gdef^^ef{\"{\dotless i}}
9594 %
9595 \gdef^^f0{\dh}
9596 \gdef^^f1{\~n}
9597 \gdef^^f2{\`o}
9598 \gdef^^f3{\'o}
9599 \gdef^^f4{\^o}
9600 \gdef^^f5{\~o}
9601 \gdef^^f6{\"o}
9602 \gdef^^f7{$\div$}
9603 \gdef^^f8{\o}
9604 \gdef^^f9{\`u}
9605 \gdef^^fa{\'u}
9606 \gdef^^fb{\^u}
9607 \gdef^^fc{\"u}
9608 \gdef^^fd{\'y}
9609 \gdef^^fe{\th}
9610 \gdef^^ff{\"y}
9611 }
9612
9613 % Latin9 (ISO-8859-15) encoding character definitions.
9614 \def\latninechardefs{%
9615 % Encoding is almost identical to Latin1.
9616 \latonechardefs
9617 %
9618 \gdef^^a4{\euro}
9619 \gdef^^a6{\v S}
9620 \gdef^^a8{\v s}
9621 \gdef^^b4{\v Z}
9622 \gdef^^b8{\v z}
9623 \gdef^^bc{\OE}
9624 \gdef^^bd{\oe}
9625 \gdef^^be{\"Y}
9626 }
9627
9628 % Latin2 (ISO-8859-2) character definitions.
9629 \def\lattwochardefs{%
9630 \gdef^^a0{\tie}
9631 \gdef^^a1{\ogonek{A}}
9632 \gdef^^a2{\u{}}
9633 \gdef^^a3{\L}
9634 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
9635 \gdef^^a5{\v L}
9636 \gdef^^a6{\'S}
9637 \gdef^^a7{\S}
9638 \gdef^^a8{\"{}}
9639 \gdef^^a9{\v S}
9640 \gdef^^aa{\cedilla S}
9641 \gdef^^ab{\v T}
9642 \gdef^^ac{\'Z}
9643 \gdef^^ad{\-}
9644 \gdef^^ae{\v Z}
9645 \gdef^^af{\dotaccent Z}
9646 %
9647 \gdef^^b0{\textdegree}
9648 \gdef^^b1{\ogonek{a}}
9649 \gdef^^b2{\ogonek{ }}
9650 \gdef^^b3{\l}
9651 \gdef^^b4{\'{}}
9652 \gdef^^b5{\v l}
9653 \gdef^^b6{\'s}
9654 \gdef^^b7{\v{}}
9655 \gdef^^b8{\cedilla\ }
9656 \gdef^^b9{\v s}
9657 \gdef^^ba{\cedilla s}
9658 \gdef^^bb{\v t}
9659 \gdef^^bc{\'z}
9660 \gdef^^bd{\H{}}
9661 \gdef^^be{\v z}
9662 \gdef^^bf{\dotaccent z}
9663 %
9664 \gdef^^c0{\'R}
9665 \gdef^^c1{\'A}
9666 \gdef^^c2{\^A}
9667 \gdef^^c3{\u A}
9668 \gdef^^c4{\"A}
9669 \gdef^^c5{\'L}
9670 \gdef^^c6{\'C}
9671 \gdef^^c7{\cedilla C}
9672 \gdef^^c8{\v C}
9673 \gdef^^c9{\'E}
9674 \gdef^^ca{\ogonek{E}}
9675 \gdef^^cb{\"E}
9676 \gdef^^cc{\v E}
9677 \gdef^^cd{\'I}
9678 \gdef^^ce{\^I}
9679 \gdef^^cf{\v D}
9680 %
9681 \gdef^^d0{\DH}
9682 \gdef^^d1{\'N}
9683 \gdef^^d2{\v N}
9684 \gdef^^d3{\'O}
9685 \gdef^^d4{\^O}
9686 \gdef^^d5{\H O}
9687 \gdef^^d6{\"O}
9688 \gdef^^d7{$\times$}
9689 \gdef^^d8{\v R}
9690 \gdef^^d9{\ringaccent U}
9691 \gdef^^da{\'U}
9692 \gdef^^db{\H U}
9693 \gdef^^dc{\"U}
9694 \gdef^^dd{\'Y}
9695 \gdef^^de{\cedilla T}
9696 \gdef^^df{\ss}
9697 %
9698 \gdef^^e0{\'r}
9699 \gdef^^e1{\'a}
9700 \gdef^^e2{\^a}
9701 \gdef^^e3{\u a}
9702 \gdef^^e4{\"a}
9703 \gdef^^e5{\'l}
9704 \gdef^^e6{\'c}
9705 \gdef^^e7{\cedilla c}
9706 \gdef^^e8{\v c}
9707 \gdef^^e9{\'e}
9708 \gdef^^ea{\ogonek{e}}
9709 \gdef^^eb{\"e}
9710 \gdef^^ec{\v e}
9711 \gdef^^ed{\'{\dotless{i}}}
9712 \gdef^^ee{\^{\dotless{i}}}
9713 \gdef^^ef{\v d}
9714 %
9715 \gdef^^f0{\dh}
9716 \gdef^^f1{\'n}
9717 \gdef^^f2{\v n}
9718 \gdef^^f3{\'o}
9719 \gdef^^f4{\^o}
9720 \gdef^^f5{\H o}
9721 \gdef^^f6{\"o}
9722 \gdef^^f7{$\div$}
9723 \gdef^^f8{\v r}
9724 \gdef^^f9{\ringaccent u}
9725 \gdef^^fa{\'u}
9726 \gdef^^fb{\H u}
9727 \gdef^^fc{\"u}
9728 \gdef^^fd{\'y}
9729 \gdef^^fe{\cedilla t}
9730 \gdef^^ff{\dotaccent{}}
9731 }
9732
9733 % UTF-8 character definitions.
9734 %
9735 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
9736 % changes for Texinfo conventions. It is included here under the GPL by
9737 % permission from Frank Mittelbach and the LaTeX team.
9738 %
9739 \newcount\countUTFx
9740 \newcount\countUTFy
9741 \newcount\countUTFz
9742
9743 \gdef\UTFviiiTwoOctets#1#2{\expandafter
9744 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
9745 %
9746 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
9747 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
9748 %
9749 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
9750 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
9751
9752 \gdef\UTFviiiDefined#1{%
9753 \ifx #1\relax
9754 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
9755 \else
9756 \expandafter #1%
9757 \fi
9758 }
9759
9760 \begingroup
9761 \catcode`\~13
9762 \catcode`\"12
9763
9764 \def\UTFviiiLoop{%
9765 \global\catcode\countUTFx\active
9766 \uccode`\~\countUTFx
9767 \uppercase\expandafter{\UTFviiiTmp}%
9768 \advance\countUTFx by 1
9769 \ifnum\countUTFx < \countUTFy
9770 \expandafter\UTFviiiLoop
9771 \fi}
9772
9773 \countUTFx = "C2
9774 \countUTFy = "E0
9775 \def\UTFviiiTmp{%
9776 \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
9777 \UTFviiiLoop
9778
9779 \countUTFx = "E0
9780 \countUTFy = "F0
9781 \def\UTFviiiTmp{%
9782 \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
9783 \UTFviiiLoop
9784
9785 \countUTFx = "F0
9786 \countUTFy = "F4
9787 \def\UTFviiiTmp{%
9788 \xdef~{\noexpand\UTFviiiFourOctets\string~}}
9789 \UTFviiiLoop
9790 \endgroup
9791
9792 \def\globallet{\global\let} % save some \expandafter's below
9793
9794 % @U{xxxx} to produce U+xxxx, if we support it.
9795 \def\U#1{%
9796 \expandafter\ifx\csname uni:#1\endcsname \relax
9797 \errhelp = \EMsimple
9798 \errmessage{Unicode character U+#1 not supported, sorry}%
9799 \else
9800 \csname uni:#1\endcsname
9801 \fi
9802 }
9803
9804 \begingroup
9805 \catcode`\"=12
9806 \catcode`\<=12
9807 \catcode`\.=12
9808 \catcode`\,=12
9809 \catcode`\;=12
9810 \catcode`\!=12
9811 \catcode`\~=13
9812 \gdef\DeclareUnicodeCharacter#1#2{%
9813 \countUTFz = "#1\relax
9814 %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
9815 \begingroup
9816 \parseXMLCharref
9817 \def\UTFviiiTwoOctets##1##2{%
9818 \csname u8:##1\string ##2\endcsname}%
9819 \def\UTFviiiThreeOctets##1##2##3{%
9820 \csname u8:##1\string ##2\string ##3\endcsname}%
9821 \def\UTFviiiFourOctets##1##2##3##4{%
9822 \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
9823 \expandafter\expandafter\expandafter\expandafter
9824 \expandafter\expandafter\expandafter
9825 \gdef\UTFviiiTmp{#2}%
9826 %
9827 \expandafter\ifx\csname uni:#1\endcsname \relax \else
9828 \message{Internal error, already defined: #1}%
9829 \fi
9830 %
9831 % define an additional control sequence for this code point.
9832 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
9833 \endgroup}
9834
9835 \gdef\parseXMLCharref{%
9836 \ifnum\countUTFz < "A0\relax
9837 \errhelp = \EMsimple
9838 \errmessage{Cannot define Unicode char value < 00A0}%
9839 \else\ifnum\countUTFz < "800\relax
9840 \parseUTFviiiA,%
9841 \parseUTFviiiB C\UTFviiiTwoOctets.,%
9842 \else\ifnum\countUTFz < "10000\relax
9843 \parseUTFviiiA;%
9844 \parseUTFviiiA,%
9845 \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
9846 \else
9847 \parseUTFviiiA;%
9848 \parseUTFviiiA,%
9849 \parseUTFviiiA!%
9850 \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
9851 \fi\fi\fi
9852 }
9853
9854 \gdef\parseUTFviiiA#1{%
9855 \countUTFx = \countUTFz
9856 \divide\countUTFz by 64
9857 \countUTFy = \countUTFz
9858 \multiply\countUTFz by 64
9859 \advance\countUTFx by -\countUTFz
9860 \advance\countUTFx by 128
9861 \uccode `#1\countUTFx
9862 \countUTFz = \countUTFy}
9863
9864 \gdef\parseUTFviiiB#1#2#3#4{%
9865 \advance\countUTFz by "#10\relax
9866 \uccode `#3\countUTFz
9867 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
9868 \endgroup
9869
9870 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
9871 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
9872 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
9873 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
9874 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
9875 %
9876 % Many of our renditions are less than wonderful, and all the missing
9877 % characters are available somewhere. Loading the necessary fonts
9878 % awaits user request. We can't truly support Unicode without
9879 % reimplementing everything that's been done in LaTeX for many years,
9880 % plus probably using luatex or xetex, and who knows what else.
9881 % We won't be doing that here in this simple file. But we can try to at
9882 % least make most of the characters not bomb out.
9883 %
9884 \def\utfeightchardefs{%
9885 \DeclareUnicodeCharacter{00A0}{\tie}
9886 \DeclareUnicodeCharacter{00A1}{\exclamdown}
9887 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
9888 \DeclareUnicodeCharacter{00A3}{\pounds}
9889 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
9890 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
9891 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
9892 \DeclareUnicodeCharacter{00A7}{\S}
9893 \DeclareUnicodeCharacter{00A8}{\"{ }}
9894 \DeclareUnicodeCharacter{00A9}{\copyright}
9895 \DeclareUnicodeCharacter{00AA}{\ordf}
9896 \DeclareUnicodeCharacter{00AB}{\guillemetleft}
9897 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}
9898 \DeclareUnicodeCharacter{00AD}{\-}
9899 \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
9900 \DeclareUnicodeCharacter{00AF}{\={ }}
9901
9902 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
9903 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}
9904 \DeclareUnicodeCharacter{00B2}{$^2$}
9905 \DeclareUnicodeCharacter{00B3}{$^3$}
9906 \DeclareUnicodeCharacter{00B4}{\'{ }}
9907 \DeclareUnicodeCharacter{00B5}{$\mu$}
9908 \DeclareUnicodeCharacter{00B6}{\P}
9909 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}
9910 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
9911 \DeclareUnicodeCharacter{00B9}{$^1$}
9912 \DeclareUnicodeCharacter{00BA}{\ordm}
9913 \DeclareUnicodeCharacter{00BB}{\guillemetright}
9914 \DeclareUnicodeCharacter{00BC}{$1\over4$}
9915 \DeclareUnicodeCharacter{00BD}{$1\over2$}
9916 \DeclareUnicodeCharacter{00BE}{$3\over4$}
9917 \DeclareUnicodeCharacter{00BF}{\questiondown}
9918
9919 \DeclareUnicodeCharacter{00C0}{\`A}
9920 \DeclareUnicodeCharacter{00C1}{\'A}
9921 \DeclareUnicodeCharacter{00C2}{\^A}
9922 \DeclareUnicodeCharacter{00C3}{\~A}
9923 \DeclareUnicodeCharacter{00C4}{\"A}
9924 \DeclareUnicodeCharacter{00C5}{\AA}
9925 \DeclareUnicodeCharacter{00C6}{\AE}
9926 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
9927 \DeclareUnicodeCharacter{00C8}{\`E}
9928 \DeclareUnicodeCharacter{00C9}{\'E}
9929 \DeclareUnicodeCharacter{00CA}{\^E}
9930 \DeclareUnicodeCharacter{00CB}{\"E}
9931 \DeclareUnicodeCharacter{00CC}{\`I}
9932 \DeclareUnicodeCharacter{00CD}{\'I}
9933 \DeclareUnicodeCharacter{00CE}{\^I}
9934 \DeclareUnicodeCharacter{00CF}{\"I}
9935
9936 \DeclareUnicodeCharacter{00D0}{\DH}
9937 \DeclareUnicodeCharacter{00D1}{\~N}
9938 \DeclareUnicodeCharacter{00D2}{\`O}
9939 \DeclareUnicodeCharacter{00D3}{\'O}
9940 \DeclareUnicodeCharacter{00D4}{\^O}
9941 \DeclareUnicodeCharacter{00D5}{\~O}
9942 \DeclareUnicodeCharacter{00D6}{\"O}
9943 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}
9944 \DeclareUnicodeCharacter{00D8}{\O}
9945 \DeclareUnicodeCharacter{00D9}{\`U}
9946 \DeclareUnicodeCharacter{00DA}{\'U}
9947 \DeclareUnicodeCharacter{00DB}{\^U}
9948 \DeclareUnicodeCharacter{00DC}{\"U}
9949 \DeclareUnicodeCharacter{00DD}{\'Y}
9950 \DeclareUnicodeCharacter{00DE}{\TH}
9951 \DeclareUnicodeCharacter{00DF}{\ss}
9952
9953 \DeclareUnicodeCharacter{00E0}{\`a}
9954 \DeclareUnicodeCharacter{00E1}{\'a}
9955 \DeclareUnicodeCharacter{00E2}{\^a}
9956 \DeclareUnicodeCharacter{00E3}{\~a}
9957 \DeclareUnicodeCharacter{00E4}{\"a}
9958 \DeclareUnicodeCharacter{00E5}{\aa}
9959 \DeclareUnicodeCharacter{00E6}{\ae}
9960 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
9961 \DeclareUnicodeCharacter{00E8}{\`e}
9962 \DeclareUnicodeCharacter{00E9}{\'e}
9963 \DeclareUnicodeCharacter{00EA}{\^e}
9964 \DeclareUnicodeCharacter{00EB}{\"e}
9965 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
9966 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
9967 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
9968 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
9969
9970 \DeclareUnicodeCharacter{00F0}{\dh}
9971 \DeclareUnicodeCharacter{00F1}{\~n}
9972 \DeclareUnicodeCharacter{00F2}{\`o}
9973 \DeclareUnicodeCharacter{00F3}{\'o}
9974 \DeclareUnicodeCharacter{00F4}{\^o}
9975 \DeclareUnicodeCharacter{00F5}{\~o}
9976 \DeclareUnicodeCharacter{00F6}{\"o}
9977 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}
9978 \DeclareUnicodeCharacter{00F8}{\o}
9979 \DeclareUnicodeCharacter{00F9}{\`u}
9980 \DeclareUnicodeCharacter{00FA}{\'u}
9981 \DeclareUnicodeCharacter{00FB}{\^u}
9982 \DeclareUnicodeCharacter{00FC}{\"u}
9983 \DeclareUnicodeCharacter{00FD}{\'y}
9984 \DeclareUnicodeCharacter{00FE}{\th}
9985 \DeclareUnicodeCharacter{00FF}{\"y}
9986
9987 \DeclareUnicodeCharacter{0100}{\=A}
9988 \DeclareUnicodeCharacter{0101}{\=a}
9989 \DeclareUnicodeCharacter{0102}{\u{A}}
9990 \DeclareUnicodeCharacter{0103}{\u{a}}
9991 \DeclareUnicodeCharacter{0104}{\ogonek{A}}
9992 \DeclareUnicodeCharacter{0105}{\ogonek{a}}
9993 \DeclareUnicodeCharacter{0106}{\'C}
9994 \DeclareUnicodeCharacter{0107}{\'c}
9995 \DeclareUnicodeCharacter{0108}{\^C}
9996 \DeclareUnicodeCharacter{0109}{\^c}
9997 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
9998 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
9999 \DeclareUnicodeCharacter{010C}{\v{C}}
10000 \DeclareUnicodeCharacter{010D}{\v{c}}
10001 \DeclareUnicodeCharacter{010E}{\v{D}}
10002 \DeclareUnicodeCharacter{010F}{d'}
10003
10004 \DeclareUnicodeCharacter{0110}{\DH}
10005 \DeclareUnicodeCharacter{0111}{\dh}
10006 \DeclareUnicodeCharacter{0112}{\=E}
10007 \DeclareUnicodeCharacter{0113}{\=e}
10008 \DeclareUnicodeCharacter{0114}{\u{E}}
10009 \DeclareUnicodeCharacter{0115}{\u{e}}
10010 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
10011 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
10012 \DeclareUnicodeCharacter{0118}{\ogonek{E}}
10013 \DeclareUnicodeCharacter{0119}{\ogonek{e}}
10014 \DeclareUnicodeCharacter{011A}{\v{E}}
10015 \DeclareUnicodeCharacter{011B}{\v{e}}
10016 \DeclareUnicodeCharacter{011C}{\^G}
10017 \DeclareUnicodeCharacter{011D}{\^g}
10018 \DeclareUnicodeCharacter{011E}{\u{G}}
10019 \DeclareUnicodeCharacter{011F}{\u{g}}
10020
10021 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
10022 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
10023 \DeclareUnicodeCharacter{0122}{\cedilla{G}}
10024 \DeclareUnicodeCharacter{0123}{\cedilla{g}}
10025 \DeclareUnicodeCharacter{0124}{\^H}
10026 \DeclareUnicodeCharacter{0125}{\^h}
10027 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}
10028 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}
10029 \DeclareUnicodeCharacter{0128}{\~I}
10030 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
10031 \DeclareUnicodeCharacter{012A}{\=I}
10032 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
10033 \DeclareUnicodeCharacter{012C}{\u{I}}
10034 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
10035 \DeclareUnicodeCharacter{012E}{\ogonek{I}}
10036 \DeclareUnicodeCharacter{012F}{\ogonek{i}}
10037
10038 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
10039 \DeclareUnicodeCharacter{0131}{\dotless{i}}
10040 \DeclareUnicodeCharacter{0132}{IJ}
10041 \DeclareUnicodeCharacter{0133}{ij}
10042 \DeclareUnicodeCharacter{0134}{\^J}
10043 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
10044 \DeclareUnicodeCharacter{0136}{\cedilla{K}}
10045 \DeclareUnicodeCharacter{0137}{\cedilla{k}}
10046 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}
10047 \DeclareUnicodeCharacter{0139}{\'L}
10048 \DeclareUnicodeCharacter{013A}{\'l}
10049 \DeclareUnicodeCharacter{013B}{\cedilla{L}}
10050 \DeclareUnicodeCharacter{013C}{\cedilla{l}}
10051 \DeclareUnicodeCharacter{013D}{L'}% should kern
10052 \DeclareUnicodeCharacter{013E}{l'}% should kern
10053 \DeclareUnicodeCharacter{013F}{L\U{00B7}}
10054
10055 \DeclareUnicodeCharacter{0140}{l\U{00B7}}
10056 \DeclareUnicodeCharacter{0141}{\L}
10057 \DeclareUnicodeCharacter{0142}{\l}
10058 \DeclareUnicodeCharacter{0143}{\'N}
10059 \DeclareUnicodeCharacter{0144}{\'n}
10060 \DeclareUnicodeCharacter{0145}{\cedilla{N}}
10061 \DeclareUnicodeCharacter{0146}{\cedilla{n}}
10062 \DeclareUnicodeCharacter{0147}{\v{N}}
10063 \DeclareUnicodeCharacter{0148}{\v{n}}
10064 \DeclareUnicodeCharacter{0149}{'n}
10065 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}
10066 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}
10067 \DeclareUnicodeCharacter{014C}{\=O}
10068 \DeclareUnicodeCharacter{014D}{\=o}
10069 \DeclareUnicodeCharacter{014E}{\u{O}}
10070 \DeclareUnicodeCharacter{014F}{\u{o}}
10071
10072 \DeclareUnicodeCharacter{0150}{\H{O}}
10073 \DeclareUnicodeCharacter{0151}{\H{o}}
10074 \DeclareUnicodeCharacter{0152}{\OE}
10075 \DeclareUnicodeCharacter{0153}{\oe}
10076 \DeclareUnicodeCharacter{0154}{\'R}
10077 \DeclareUnicodeCharacter{0155}{\'r}
10078 \DeclareUnicodeCharacter{0156}{\cedilla{R}}
10079 \DeclareUnicodeCharacter{0157}{\cedilla{r}}
10080 \DeclareUnicodeCharacter{0158}{\v{R}}
10081 \DeclareUnicodeCharacter{0159}{\v{r}}
10082 \DeclareUnicodeCharacter{015A}{\'S}
10083 \DeclareUnicodeCharacter{015B}{\'s}
10084 \DeclareUnicodeCharacter{015C}{\^S}
10085 \DeclareUnicodeCharacter{015D}{\^s}
10086 \DeclareUnicodeCharacter{015E}{\cedilla{S}}
10087 \DeclareUnicodeCharacter{015F}{\cedilla{s}}
10088
10089 \DeclareUnicodeCharacter{0160}{\v{S}}
10090 \DeclareUnicodeCharacter{0161}{\v{s}}
10091 \DeclareUnicodeCharacter{0162}{\cedilla{T}}
10092 \DeclareUnicodeCharacter{0163}{\cedilla{t}}
10093 \DeclareUnicodeCharacter{0164}{\v{T}}
10094 \DeclareUnicodeCharacter{0165}{\v{t}}
10095 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}
10096 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}
10097 \DeclareUnicodeCharacter{0168}{\~U}
10098 \DeclareUnicodeCharacter{0169}{\~u}
10099 \DeclareUnicodeCharacter{016A}{\=U}
10100 \DeclareUnicodeCharacter{016B}{\=u}
10101 \DeclareUnicodeCharacter{016C}{\u{U}}
10102 \DeclareUnicodeCharacter{016D}{\u{u}}
10103 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
10104 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
10105
10106 \DeclareUnicodeCharacter{0170}{\H{U}}
10107 \DeclareUnicodeCharacter{0171}{\H{u}}
10108 \DeclareUnicodeCharacter{0172}{\ogonek{U}}
10109 \DeclareUnicodeCharacter{0173}{\ogonek{u}}
10110 \DeclareUnicodeCharacter{0174}{\^W}
10111 \DeclareUnicodeCharacter{0175}{\^w}
10112 \DeclareUnicodeCharacter{0176}{\^Y}
10113 \DeclareUnicodeCharacter{0177}{\^y}
10114 \DeclareUnicodeCharacter{0178}{\"Y}
10115 \DeclareUnicodeCharacter{0179}{\'Z}
10116 \DeclareUnicodeCharacter{017A}{\'z}
10117 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
10118 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
10119 \DeclareUnicodeCharacter{017D}{\v{Z}}
10120 \DeclareUnicodeCharacter{017E}{\v{z}}
10121 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}
10122
10123 \DeclareUnicodeCharacter{01C4}{D\v{Z}}
10124 \DeclareUnicodeCharacter{01C5}{D\v{z}}
10125 \DeclareUnicodeCharacter{01C6}{d\v{z}}
10126 \DeclareUnicodeCharacter{01C7}{LJ}
10127 \DeclareUnicodeCharacter{01C8}{Lj}
10128 \DeclareUnicodeCharacter{01C9}{lj}
10129 \DeclareUnicodeCharacter{01CA}{NJ}
10130 \DeclareUnicodeCharacter{01CB}{Nj}
10131 \DeclareUnicodeCharacter{01CC}{nj}
10132 \DeclareUnicodeCharacter{01CD}{\v{A}}
10133 \DeclareUnicodeCharacter{01CE}{\v{a}}
10134 \DeclareUnicodeCharacter{01CF}{\v{I}}
10135
10136 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
10137 \DeclareUnicodeCharacter{01D1}{\v{O}}
10138 \DeclareUnicodeCharacter{01D2}{\v{o}}
10139 \DeclareUnicodeCharacter{01D3}{\v{U}}
10140 \DeclareUnicodeCharacter{01D4}{\v{u}}
10141
10142 \DeclareUnicodeCharacter{01E2}{\={\AE}}
10143 \DeclareUnicodeCharacter{01E3}{\={\ae}}
10144 \DeclareUnicodeCharacter{01E6}{\v{G}}
10145 \DeclareUnicodeCharacter{01E7}{\v{g}}
10146 \DeclareUnicodeCharacter{01E8}{\v{K}}
10147 \DeclareUnicodeCharacter{01E9}{\v{k}}
10148
10149 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
10150 \DeclareUnicodeCharacter{01F1}{DZ}
10151 \DeclareUnicodeCharacter{01F2}{Dz}
10152 \DeclareUnicodeCharacter{01F3}{dz}
10153 \DeclareUnicodeCharacter{01F4}{\'G}
10154 \DeclareUnicodeCharacter{01F5}{\'g}
10155 \DeclareUnicodeCharacter{01F8}{\`N}
10156 \DeclareUnicodeCharacter{01F9}{\`n}
10157 \DeclareUnicodeCharacter{01FC}{\'{\AE}}
10158 \DeclareUnicodeCharacter{01FD}{\'{\ae}}
10159 \DeclareUnicodeCharacter{01FE}{\'{\O}}
10160 \DeclareUnicodeCharacter{01FF}{\'{\o}}
10161
10162 \DeclareUnicodeCharacter{021E}{\v{H}}
10163 \DeclareUnicodeCharacter{021F}{\v{h}}
10164
10165 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
10166 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
10167 \DeclareUnicodeCharacter{0228}{\cedilla{E}}
10168 \DeclareUnicodeCharacter{0229}{\cedilla{e}}
10169 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
10170 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
10171
10172 \DeclareUnicodeCharacter{0232}{\=Y}
10173 \DeclareUnicodeCharacter{0233}{\=y}
10174 \DeclareUnicodeCharacter{0237}{\dotless{j}}
10175
10176 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
10177
10178 % Greek letters upper case
10179 \DeclareUnicodeCharacter{0391}{{\it A}}
10180 \DeclareUnicodeCharacter{0392}{{\it B}}
10181 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}
10182 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}
10183 \DeclareUnicodeCharacter{0395}{{\it E}}
10184 \DeclareUnicodeCharacter{0396}{{\it Z}}
10185 \DeclareUnicodeCharacter{0397}{{\it H}}
10186 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}
10187 \DeclareUnicodeCharacter{0399}{{\it I}}
10188 \DeclareUnicodeCharacter{039A}{{\it K}}
10189 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}
10190 \DeclareUnicodeCharacter{039C}{{\it M}}
10191 \DeclareUnicodeCharacter{039D}{{\it N}}
10192 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}
10193 \DeclareUnicodeCharacter{039F}{{\it O}}
10194 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}
10195 \DeclareUnicodeCharacter{03A1}{{\it P}}
10196 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10197 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}
10198 \DeclareUnicodeCharacter{03A4}{{\it T}}
10199 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}
10200 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}
10201 \DeclareUnicodeCharacter{03A7}{{\it X}}
10202 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}
10203 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}
10204
10205 % Vowels with accents
10206 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}
10207 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}
10208 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}
10209 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}
10210 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}
10211 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}
10212
10213 % Standalone accent
10214 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}
10215
10216 % Greek letters lower case
10217 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}
10218 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}
10219 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}
10220 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}
10221 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}
10222 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}
10223 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}
10224 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}
10225 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}
10226 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}
10227 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}
10228 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}
10229 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}
10230 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}
10231 \DeclareUnicodeCharacter{03BF}{{\it o}} % omicron
10232 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}
10233 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}
10234 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}
10235 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}
10236 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}
10237 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}
10238 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}
10239 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}
10240 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}
10241 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}
10242
10243 % More Greek vowels with accents
10244 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}
10245 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}
10246 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}
10247 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}
10248 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}
10249
10250 % Variant Greek letters
10251 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}
10252 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}
10253 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}
10254
10255 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
10256 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
10257 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
10258 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
10259 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
10260 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
10261 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
10262 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
10263 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
10264 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
10265 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
10266 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
10267
10268 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
10269 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
10270
10271 \DeclareUnicodeCharacter{1E20}{\=G}
10272 \DeclareUnicodeCharacter{1E21}{\=g}
10273 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
10274 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
10275 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
10276 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
10277 \DeclareUnicodeCharacter{1E26}{\"H}
10278 \DeclareUnicodeCharacter{1E27}{\"h}
10279
10280 \DeclareUnicodeCharacter{1E30}{\'K}
10281 \DeclareUnicodeCharacter{1E31}{\'k}
10282 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
10283 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
10284 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
10285 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
10286 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
10287 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
10288 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
10289 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
10290 \DeclareUnicodeCharacter{1E3E}{\'M}
10291 \DeclareUnicodeCharacter{1E3F}{\'m}
10292
10293 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
10294 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
10295 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
10296 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
10297 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
10298 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
10299 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
10300 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
10301 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
10302 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
10303
10304 \DeclareUnicodeCharacter{1E54}{\'P}
10305 \DeclareUnicodeCharacter{1E55}{\'p}
10306 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
10307 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
10308 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
10309 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
10310 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
10311 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
10312 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
10313 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
10314
10315 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
10316 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
10317 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
10318 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
10319 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
10320 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
10321 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
10322 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
10323 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
10324 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
10325
10326 \DeclareUnicodeCharacter{1E7C}{\~V}
10327 \DeclareUnicodeCharacter{1E7D}{\~v}
10328 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
10329 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
10330
10331 \DeclareUnicodeCharacter{1E80}{\`W}
10332 \DeclareUnicodeCharacter{1E81}{\`w}
10333 \DeclareUnicodeCharacter{1E82}{\'W}
10334 \DeclareUnicodeCharacter{1E83}{\'w}
10335 \DeclareUnicodeCharacter{1E84}{\"W}
10336 \DeclareUnicodeCharacter{1E85}{\"w}
10337 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
10338 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
10339 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
10340 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
10341 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
10342 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
10343 \DeclareUnicodeCharacter{1E8C}{\"X}
10344 \DeclareUnicodeCharacter{1E8D}{\"x}
10345 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
10346 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
10347
10348 \DeclareUnicodeCharacter{1E90}{\^Z}
10349 \DeclareUnicodeCharacter{1E91}{\^z}
10350 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
10351 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
10352 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
10353 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
10354 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
10355 \DeclareUnicodeCharacter{1E97}{\"t}
10356 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
10357 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
10358
10359 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
10360 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
10361
10362 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
10363 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
10364 \DeclareUnicodeCharacter{1EBC}{\~E}
10365 \DeclareUnicodeCharacter{1EBD}{\~e}
10366
10367 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
10368 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
10369 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
10370 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
10371
10372 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
10373 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
10374
10375 \DeclareUnicodeCharacter{1EF2}{\`Y}
10376 \DeclareUnicodeCharacter{1EF3}{\`y}
10377 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
10378
10379 \DeclareUnicodeCharacter{1EF8}{\~Y}
10380 \DeclareUnicodeCharacter{1EF9}{\~y}
10381
10382 % Punctuation
10383 \DeclareUnicodeCharacter{2013}{--}
10384 \DeclareUnicodeCharacter{2014}{---}
10385 \DeclareUnicodeCharacter{2018}{\quoteleft}
10386 \DeclareUnicodeCharacter{2019}{\quoteright}
10387 \DeclareUnicodeCharacter{201A}{\quotesinglbase}
10388 \DeclareUnicodeCharacter{201C}{\quotedblleft}
10389 \DeclareUnicodeCharacter{201D}{\quotedblright}
10390 \DeclareUnicodeCharacter{201E}{\quotedblbase}
10391 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}
10392 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}
10393 \DeclareUnicodeCharacter{2022}{\bullet}
10394 \DeclareUnicodeCharacter{202F}{\thinspace}
10395 \DeclareUnicodeCharacter{2026}{\dots}
10396 \DeclareUnicodeCharacter{2039}{\guilsinglleft}
10397 \DeclareUnicodeCharacter{203A}{\guilsinglright}
10398
10399 \DeclareUnicodeCharacter{20AC}{\euro}
10400
10401 \DeclareUnicodeCharacter{2192}{\expansion}
10402 \DeclareUnicodeCharacter{21D2}{\result}
10403
10404 % Mathematical symbols
10405 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}
10406 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}
10407 \DeclareUnicodeCharacter{2208}{\ensuremath\in}
10408 \DeclareUnicodeCharacter{2212}{\minus}
10409 \DeclareUnicodeCharacter{2217}{\ast}
10410 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}
10411 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}
10412 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}
10413 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}
10414 \DeclareUnicodeCharacter{2261}{\equiv}
10415 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}
10416 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}
10417 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}
10418 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}
10419
10420 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}
10421 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}
10422 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}
10423 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}
10424 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}
10425 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}
10426 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}
10427 \DeclareUnicodeCharacter{2127}{\ensuremath\mho}
10428 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}
10429 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}
10430 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}
10431 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}
10432 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}
10433 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}
10434 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}
10435 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}
10436 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}
10437 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}
10438 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}
10439 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}
10440 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}
10441 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}
10442 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}
10443 \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}
10444 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}
10445 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}
10446 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}
10447 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}
10448 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}
10449 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}
10450 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}
10451 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}
10452 \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}
10453 \DeclareUnicodeCharacter{2201}{\ensuremath\complement}
10454 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}
10455 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}
10456 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}
10457 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}
10458 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}
10459 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}
10460 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}
10461 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}
10462 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}
10463 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}
10464 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}
10465 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}
10466 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}
10467 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}
10468 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}
10469 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}
10470 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}
10471 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}
10472 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}
10473 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}
10474 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}
10475 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}
10476 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}
10477 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}
10478 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}
10479 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}
10480 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}
10481 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}
10482 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}
10483 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}
10484 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}
10485 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}
10486 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}
10487 \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}
10488 \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}
10489 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}
10490 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}
10491 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}
10492 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}
10493 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}
10494 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}
10495 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}
10496 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}
10497 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}
10498 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}
10499 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}
10500 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}
10501 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}
10502 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}
10503 \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}
10504 \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}
10505 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}
10506 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}
10507 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}
10508 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}
10509 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}
10510 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}
10511 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}
10512 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}
10513 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}
10514 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}
10515 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}
10516 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}
10517 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}
10518 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}
10519
10520 \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}
10521 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}
10522 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}
10523 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}
10524 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}
10525 \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}
10526 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}
10527 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}
10528 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}
10529 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}
10530 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}
10531 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}
10532 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}
10533 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}
10534 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}
10535 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}
10536 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}
10537 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}
10538 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}
10539 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}
10540 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}
10541 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}
10542 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}
10543 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}
10544 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}
10545 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}
10546 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}
10547 \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}
10548 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}
10549 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}
10550 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}
10551
10552 \global\mathchardef\checkmark="1370 % actually the square root sign
10553 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}
10554 }% end of \utfeightchardefs
10555
10556 % US-ASCII character definitions.
10557 \def\asciichardefs{% nothing need be done
10558 \relax
10559 }
10560
10561 % Latin1 (ISO-8859-1) character definitions.
10562 \def\nonasciistringdefs{%
10563 \setnonasciicharscatcode\active
10564 \def\defstringchar##1{\def##1{\string##1}}%
10565 %
10566 \defstringchar^^80\defstringchar^^81\defstringchar^^82\defstringchar^^83%
10567 \defstringchar^^84\defstringchar^^85\defstringchar^^86\defstringchar^^87%
10568 \defstringchar^^88\defstringchar^^89\defstringchar^^8a\defstringchar^^8b%
10569 \defstringchar^^8c\defstringchar^^8d\defstringchar^^8e\defstringchar^^8f%
10570 %
10571 \defstringchar^^90\defstringchar^^91\defstringchar^^92\defstringchar^^93%
10572 \defstringchar^^94\defstringchar^^95\defstringchar^^96\defstringchar^^97%
10573 \defstringchar^^98\defstringchar^^99\defstringchar^^9a\defstringchar^^9b%
10574 \defstringchar^^9c\defstringchar^^9d\defstringchar^^9e\defstringchar^^9f%
10575 %
10576 \defstringchar^^a0\defstringchar^^a1\defstringchar^^a2\defstringchar^^a3%
10577 \defstringchar^^a4\defstringchar^^a5\defstringchar^^a6\defstringchar^^a7%
10578 \defstringchar^^a8\defstringchar^^a9\defstringchar^^aa\defstringchar^^ab%
10579 \defstringchar^^ac\defstringchar^^ad\defstringchar^^ae\defstringchar^^af%
10580 %
10581 \defstringchar^^b0\defstringchar^^b1\defstringchar^^b2\defstringchar^^b3%
10582 \defstringchar^^b4\defstringchar^^b5\defstringchar^^b6\defstringchar^^b7%
10583 \defstringchar^^b8\defstringchar^^b9\defstringchar^^ba\defstringchar^^bb%
10584 \defstringchar^^bc\defstringchar^^bd\defstringchar^^be\defstringchar^^bf%
10585 %
10586 \defstringchar^^c0\defstringchar^^c1\defstringchar^^c2\defstringchar^^c3%
10587 \defstringchar^^c4\defstringchar^^c5\defstringchar^^c6\defstringchar^^c7%
10588 \defstringchar^^c8\defstringchar^^c9\defstringchar^^ca\defstringchar^^cb%
10589 \defstringchar^^cc\defstringchar^^cd\defstringchar^^ce\defstringchar^^cf%
10590 %
10591 \defstringchar^^d0\defstringchar^^d1\defstringchar^^d2\defstringchar^^d3%
10592 \defstringchar^^d4\defstringchar^^d5\defstringchar^^d6\defstringchar^^d7%
10593 \defstringchar^^d8\defstringchar^^d9\defstringchar^^da\defstringchar^^db%
10594 \defstringchar^^dc\defstringchar^^dd\defstringchar^^de\defstringchar^^df%
10595 %
10596 \defstringchar^^e0\defstringchar^^e1\defstringchar^^e2\defstringchar^^e3%
10597 \defstringchar^^e4\defstringchar^^e5\defstringchar^^e6\defstringchar^^e7%
10598 \defstringchar^^e8\defstringchar^^e9\defstringchar^^ea\defstringchar^^eb%
10599 \defstringchar^^ec\defstringchar^^ed\defstringchar^^ee\defstringchar^^ef%
10600 %
10601 \defstringchar^^f0\defstringchar^^f1\defstringchar^^f2\defstringchar^^f3%
10602 \defstringchar^^f4\defstringchar^^f5\defstringchar^^f6\defstringchar^^f7%
10603 \defstringchar^^f8\defstringchar^^f9\defstringchar^^fa\defstringchar^^fb%
10604 \defstringchar^^fc\defstringchar^^fd\defstringchar^^fe\defstringchar^^ff%
10605 }
10606
10607
10608 % define all the unicode characters we know about, for the sake of @U.
10609 \utfeightchardefs
10610
10611
10612 % Make non-ASCII characters printable again for compatibility with
10613 % existing Texinfo documents that may use them, even without declaring a
10614 % document encoding.
10615 %
10616 \setnonasciicharscatcode \other
10617
10618
10619 \message{formatting,}
10620
10621 \newdimen\defaultparindent \defaultparindent = 15pt
10622
10623 \chapheadingskip = 15pt plus 4pt minus 2pt
10624 \secheadingskip = 12pt plus 3pt minus 2pt
10625 \subsecheadingskip = 9pt plus 2pt minus 2pt
10626
10627 % Prevent underfull vbox error messages.
10628 \vbadness = 10000
10629
10630 % Don't be very finicky about underfull hboxes, either.
10631 \hbadness = 6666
10632
10633 % Following George Bush, get rid of widows and orphans.
10634 \widowpenalty=10000
10635 \clubpenalty=10000
10636
10637 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
10638 % using an old version of TeX, don't do anything. We want the amount of
10639 % stretch added to depend on the line length, hence the dependence on
10640 % \hsize. We call this whenever the paper size is set.
10641 %
10642 \def\setemergencystretch{%
10643 \ifx\emergencystretch\thisisundefined
10644 % Allow us to assign to \emergencystretch anyway.
10645 \def\emergencystretch{\dimen0}%
10646 \else
10647 \emergencystretch = .15\hsize
10648 \fi
10649 }
10650
10651 % Parameters in order: 1) textheight; 2) textwidth;
10652 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
10653 % 7) physical page height; 8) physical page width.
10654 %
10655 % We also call \setleading{\textleading}, so the caller should define
10656 % \textleading. The caller should also set \parskip.
10657 %
10658 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
10659 \voffset = #3\relax
10660 \topskip = #6\relax
10661 \splittopskip = \topskip
10662 %
10663 \vsize = #1\relax
10664 \advance\vsize by \topskip
10665 \outervsize = \vsize
10666 \advance\outervsize by 2\topandbottommargin
10667 \pageheight = \vsize
10668 %
10669 \hsize = #2\relax
10670 \outerhsize = \hsize
10671 \advance\outerhsize by 0.5in
10672 \pagewidth = \hsize
10673 %
10674 \normaloffset = #4\relax
10675 \bindingoffset = #5\relax
10676 %
10677 \ifpdf
10678 \pdfpageheight #7\relax
10679 \pdfpagewidth #8\relax
10680 % if we don't reset these, they will remain at "1 true in" of
10681 % whatever layout pdftex was dumped with.
10682 \pdfhorigin = 1 true in
10683 \pdfvorigin = 1 true in
10684 \fi
10685 %
10686 \setleading{\textleading}
10687 %
10688 \parindent = \defaultparindent
10689 \setemergencystretch
10690 }
10691
10692 % @letterpaper (the default).
10693 \def\letterpaper{{\globaldefs = 1
10694 \parskip = 3pt plus 2pt minus 1pt
10695 \textleading = 13.2pt
10696 %
10697 % If page is nothing but text, make it come out even.
10698 \internalpagesizes{607.2pt}{6in}% that's 46 lines
10699 {\voffset}{.25in}%
10700 {\bindingoffset}{36pt}%
10701 {11in}{8.5in}%
10702 }}
10703
10704 % Use @smallbook to reset parameters for 7x9.25 trim size.
10705 \def\smallbook{{\globaldefs = 1
10706 \parskip = 2pt plus 1pt
10707 \textleading = 12pt
10708 %
10709 \internalpagesizes{7.5in}{5in}%
10710 {-.2in}{0in}%
10711 {\bindingoffset}{16pt}%
10712 {9.25in}{7in}%
10713 %
10714 \lispnarrowing = 0.3in
10715 \tolerance = 700
10716 \hfuzz = 1pt
10717 \contentsrightmargin = 0pt
10718 \defbodyindent = .5cm
10719 }}
10720
10721 % Use @smallerbook to reset parameters for 6x9 trim size.
10722 % (Just testing, parameters still in flux.)
10723 \def\smallerbook{{\globaldefs = 1
10724 \parskip = 1.5pt plus 1pt
10725 \textleading = 12pt
10726 %
10727 \internalpagesizes{7.4in}{4.8in}%
10728 {-.2in}{-.4in}%
10729 {0pt}{14pt}%
10730 {9in}{6in}%
10731 %
10732 \lispnarrowing = 0.25in
10733 \tolerance = 700
10734 \hfuzz = 1pt
10735 \contentsrightmargin = 0pt
10736 \defbodyindent = .4cm
10737 }}
10738
10739 % Use @afourpaper to print on European A4 paper.
10740 \def\afourpaper{{\globaldefs = 1
10741 \parskip = 3pt plus 2pt minus 1pt
10742 \textleading = 13.2pt
10743 %
10744 % Double-side printing via postscript on Laserjet 4050
10745 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
10746 % To change the settings for a different printer or situation, adjust
10747 % \normaloffset until the front-side and back-side texts align. Then
10748 % do the same for \bindingoffset. You can set these for testing in
10749 % your texinfo source file like this:
10750 % @tex
10751 % \global\normaloffset = -6mm
10752 % \global\bindingoffset = 10mm
10753 % @end tex
10754 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
10755 {\voffset}{\hoffset}%
10756 {\bindingoffset}{44pt}%
10757 {297mm}{210mm}%
10758 %
10759 \tolerance = 700
10760 \hfuzz = 1pt
10761 \contentsrightmargin = 0pt
10762 \defbodyindent = 5mm
10763 }}
10764
10765 % Use @afivepaper to print on European A5 paper.
10766 % From romildo@urano.iceb.ufop.br, 2 July 2000.
10767 % He also recommends making @example and @lisp be small.
10768 \def\afivepaper{{\globaldefs = 1
10769 \parskip = 2pt plus 1pt minus 0.1pt
10770 \textleading = 12.5pt
10771 %
10772 \internalpagesizes{160mm}{120mm}%
10773 {\voffset}{\hoffset}%
10774 {\bindingoffset}{8pt}%
10775 {210mm}{148mm}%
10776 %
10777 \lispnarrowing = 0.2in
10778 \tolerance = 800
10779 \hfuzz = 1.2pt
10780 \contentsrightmargin = 0pt
10781 \defbodyindent = 2mm
10782 \tableindent = 12mm
10783 }}
10784
10785 % A specific text layout, 24x15cm overall, intended for A4 paper.
10786 \def\afourlatex{{\globaldefs = 1
10787 \afourpaper
10788 \internalpagesizes{237mm}{150mm}%
10789 {\voffset}{4.6mm}%
10790 {\bindingoffset}{7mm}%
10791 {297mm}{210mm}%
10792 %
10793 % Must explicitly reset to 0 because we call \afourpaper.
10794 \globaldefs = 0
10795 }}
10796
10797 % Use @afourwide to print on A4 paper in landscape format.
10798 \def\afourwide{{\globaldefs = 1
10799 \afourpaper
10800 \internalpagesizes{241mm}{165mm}%
10801 {\voffset}{-2.95mm}%
10802 {\bindingoffset}{7mm}%
10803 {297mm}{210mm}%
10804 \globaldefs = 0
10805 }}
10806
10807 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
10808 % Perhaps we should allow setting the margins, \topskip, \parskip,
10809 % and/or leading, also. Or perhaps we should compute them somehow.
10810 %
10811 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
10812 \def\pagesizesyyy#1,#2,#3\finish{{%
10813 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
10814 \globaldefs = 1
10815 %
10816 \parskip = 3pt plus 2pt minus 1pt
10817 \setleading{\textleading}%
10818 %
10819 \dimen0 = #1\relax
10820 \advance\dimen0 by \voffset
10821 %
10822 \dimen2 = \hsize
10823 \advance\dimen2 by \normaloffset
10824 %
10825 \internalpagesizes{#1}{\hsize}%
10826 {\voffset}{\normaloffset}%
10827 {\bindingoffset}{44pt}%
10828 {\dimen0}{\dimen2}%
10829 }}
10830
10831 % Set default to letter.
10832 %
10833 \letterpaper
10834
10835
10836 \message{and turning on texinfo input format.}
10837
10838 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
10839
10840 % DEL is a comment character, in case @c does not suffice.
10841 \catcode`\^^? = 14
10842
10843 % Define macros to output various characters with catcode for normal text.
10844 \catcode`\"=\other \def\normaldoublequote{"}
10845 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
10846 \catcode`\+=\other \def\normalplus{+}
10847 \catcode`\<=\other \def\normalless{<}
10848 \catcode`\>=\other \def\normalgreater{>}
10849 \catcode`\^=\other \def\normalcaret{^}
10850 \catcode`\_=\other \def\normalunderscore{_}
10851 \catcode`\|=\other \def\normalverticalbar{|}
10852 \catcode`\~=\other \def\normaltilde{~}
10853
10854 % This macro is used to make a character print one way in \tt
10855 % (where it can probably be output as-is), and another way in other fonts,
10856 % where something hairier probably needs to be done.
10857 %
10858 % #1 is what to print if we are indeed using \tt; #2 is what to print
10859 % otherwise. Since all the Computer Modern typewriter fonts have zero
10860 % interword stretch (and shrink), and it is reasonable to expect all
10861 % typewriter fonts to have this, we can check that font parameter.
10862 %
10863 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
10864
10865 % Same as above, but check for italic font. Actually this also catches
10866 % non-italic slanted fonts since it is impossible to distinguish them from
10867 % italic fonts. But since this is only used by $ and it uses \sl anyway
10868 % this is not a problem.
10869 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
10870
10871 % Set catcodes for Texinfo file
10872
10873 % Active characters for printing the wanted glyph.
10874 % Most of these we simply print from the \tt font, but for some, we can
10875 % use math or other variants that look better in normal text.
10876 %
10877 \catcode`\"=\active
10878 \def\activedoublequote{{\tt\char34}}
10879 \let"=\activedoublequote
10880 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
10881 \chardef\hatchar=`\^
10882 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
10883
10884 \catcode`\_=\active
10885 \def_{\ifusingtt\normalunderscore\_}
10886 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
10887 \let\realunder=_
10888
10889 \catcode`\|=\active \def|{{\tt\char124}}
10890
10891 \chardef \less=`\<
10892 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
10893 \chardef \gtr=`\>
10894 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
10895 \catcode`\+=\active \def+{{\tt \char 43}}
10896 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
10897 \catcode`\-=\active \let-=\normaldash
10898
10899
10900 % used for headline/footline in the output routine, in case the page
10901 % breaks in the middle of an @tex block.
10902 \def\texinfochars{%
10903 \let< = \activeless
10904 \let> = \activegtr
10905 \let~ = \activetilde
10906 \let^ = \activehat
10907 \markupsetuplqdefault \markupsetuprqdefault
10908 \let\b = \strong
10909 \let\i = \smartitalic
10910 % in principle, all other definitions in \tex have to be undone too.
10911 }
10912
10913 % Used sometimes to turn off (effectively) the active characters even after
10914 % parsing them.
10915 \def\turnoffactive{%
10916 \normalturnoffactive
10917 \otherbackslash
10918 }
10919
10920 \catcode`\@=0
10921
10922 % \backslashcurfont outputs one backslash character in current font,
10923 % as in \char`\\.
10924 \global\chardef\backslashcurfont=`\\
10925 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
10926
10927 % \realbackslash is an actual character `\' with catcode other, and
10928 % \doublebackslash is two of them (for the pdf outlines).
10929 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
10930
10931 % In Texinfo, backslash is an active character; it prints the backslash
10932 % in fixed width font.
10933 \catcode`\\=\active % @ for escape char from now on.
10934
10935 % Print a typewriter backslash. For math mode, we can't simply use
10936 % \backslashcurfont: the story here is that in math mode, the \char
10937 % of \backslashcurfont ends up printing the roman \ from the math symbol
10938 % font (because \char in math mode uses the \mathcode, and plain.tex
10939 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
10940 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
10941 % ignored family value; char position "5C). We can't use " for the
10942 % usual hex value because it has already been made active.
10943
10944 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
10945 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
10946
10947 % \rawbackslash defines an active \ to do \backslashcurfont.
10948 % \otherbackslash defines an active \ to be a literal `\' character with
10949 % catcode other. We switch back and forth between these.
10950 @gdef@rawbackslash{@let\=@backslashcurfont}
10951 @gdef@otherbackslash{@let\=@realbackslash}
10952
10953 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
10954 % the literal character `\'.
10955 %
10956 {@catcode`- = @active
10957 @gdef@normalturnoffactive{%
10958 @nonasciistringdefs
10959 @let-=@normaldash
10960 @let"=@normaldoublequote
10961 @let$=@normaldollar %$ font-lock fix
10962 @let+=@normalplus
10963 @let<=@normalless
10964 @let>=@normalgreater
10965 @let^=@normalcaret
10966 @let_=@normalunderscore
10967 @let|=@normalverticalbar
10968 @let~=@normaltilde
10969 @let\=@ttbackslash
10970 @markupsetuplqdefault
10971 @markupsetuprqdefault
10972 @unsepspaces
10973 }
10974 }
10975
10976 % If a .fmt file is being used, characters that might appear in a file
10977 % name cannot be active until we have parsed the command line.
10978 % So turn them off again, and have @fixbackslash turn them back on.
10979 @catcode`+=@other @catcode`@_=@other
10980
10981 % \enablebackslashhack - allow file to begin `\input texinfo'
10982 %
10983 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
10984 % That is what \eatinput is for; after that, the `\' should revert to printing
10985 % a backslash.
10986 % If the file did not have a `\input texinfo', then it is turned off after
10987 % the first line; otherwise the first `\' in the file would cause an error.
10988 % This is used on the very last line of this file, texinfo.tex.
10989 % We also use @c to call @fixbackslash, in case ends of lines are hidden.
10990 {
10991 @catcode`@^=7
10992 @catcode`@^^M=13@gdef@enablebackslashhack{%
10993 @global@let\ = @eatinput%
10994 @catcode`@^^M=13%
10995 @def@c{@fixbackslash@c}%
10996 @def ^^M{@let^^M@secondlinenl}%
10997 @gdef @secondlinenl{@let^^M@thirdlinenl}%
10998 @gdef @thirdlinenl{@fixbackslash}%
10999 }}
11000
11001 {@catcode`@^=7 @catcode`@^^M=13%
11002 @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11003
11004 @gdef@fixbackslash{%
11005 @ifx\@eatinput @let\ = @ttbackslash @fi
11006 @catcode13=5 % regular end of line
11007 @let@c=@texinfoc
11008 % Also turn back on active characters that might appear in the input
11009 % file name, in case not using a pre-dumped format.
11010 @catcode`+=@active
11011 @catcode`@_=@active
11012 %
11013 % If texinfo.cnf is present on the system, read it.
11014 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11015 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11016 % directly in this file, texinfo.tex, makes it possible to make a format
11017 % file for Texinfo.
11018 %
11019 @openin 1 texinfo.cnf
11020 @ifeof 1 @else @input texinfo.cnf @fi
11021 @closein 1
11022 }
11023
11024
11025 % Say @foo, not \foo, in error messages.
11026 @escapechar = `@@
11027
11028 % These (along with & and #) are made active for url-breaking, so need
11029 % active definitions as the normal characters.
11030 @def@normaldot{.}
11031 @def@normalquest{?}
11032 @def@normalslash{/}
11033
11034 % These look ok in all fonts, so just make them not special.
11035 % @hashchar{} gets its own user-level command, because of #line.
11036 @catcode`@& = @other @def@normalamp{&}
11037 @catcode`@# = @other @def@normalhash{#}
11038 @catcode`@% = @other @def@normalpercent{%}
11039
11040 @let @hashchar = @normalhash
11041
11042 @c Finally, make ` and ' active, so that txicodequoteundirected and
11043 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11044 @c don't make ` and ' active, @code will not get them as active chars.
11045 @c Do this last of all since we use ` in the previous @catcode assignments.
11046 @catcode`@'=@active
11047 @catcode`@`=@active
11048 @markupsetuplqdefault
11049 @markupsetuprqdefault
11050
11051 @c Local variables:
11052 @c eval: (add-hook 'write-file-hooks 'time-stamp)
11053 @c page-delimiter: "^\\\\message\\|emacs-page"
11054 @c time-stamp-start: "def\\\\texinfoversion{"
11055 @c time-stamp-format: "%:y-%02m-%02d.%02H"
11056 @c time-stamp-end: "}"
11057 @c End:
11058
11059 @c vim:sw=2:
11060
11061 @ignore
11062 arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
11063 @end ignore
11064 @enablebackslashhack