]> code.delx.au - gnu-emacs/blob - doc/misc/texinfo.tex
Sync with gnulib
[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{2016-02-09.12}
7 %
8 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10 % 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
11 % Free Software Foundation, Inc.
12 %
13 % This texinfo.tex file is free software: you can redistribute it and/or
14 % modify it under the terms of the GNU General Public License as
15 % published by the Free Software Foundation, either version 3 of the
16 % License, or (at your option) any later version.
17 %
18 % This texinfo.tex file is distributed in the hope that it will be
19 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 % General Public License for more details.
22 %
23 % You should have received a copy of the GNU General Public License
24 % along with this program. If not, see <http://www.gnu.org/licenses/>.
25 %
26 % As a special exception, when this file is read by TeX when processing
27 % a Texinfo source document, you may use the result without
28 % restriction. This Exception is an additional permission under section 7
29 % of the GNU General Public License, version 3 ("GPLv3").
30 %
31 % Please try the latest version of texinfo.tex before submitting bug
32 % reports; you can get the latest version from:
33 % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
34 % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
35 % http://www.gnu.org/software/texinfo/ (the Texinfo home page)
36 % The texinfo.tex in any given distribution could well be out
37 % of date, so if that's what you're using, please check.
38 %
39 % Send bug reports to bug-texinfo@gnu.org. Please include including a
40 % complete document in each bug report with which we can reproduce the
41 % problem. Patches are, of course, greatly appreciated.
42 %
43 % To process a Texinfo manual with TeX, it's most reliable to use the
44 % texi2dvi shell script that comes with the distribution. For a simple
45 % manual foo.texi, however, you can get away with this:
46 % tex foo.texi
47 % texindex foo.??
48 % tex foo.texi
49 % tex foo.texi
50 % dvips foo.dvi -o # or whatever; this makes foo.ps.
51 % The extra TeX runs get the cross-reference information correct.
52 % Sometimes one run after texindex suffices, and sometimes you need more
53 % than two; texi2dvi does it as many times as necessary.
54 %
55 % It is possible to adapt texinfo.tex for other languages, to some
56 % extent. You can get the existing language-specific files from the
57 % full Texinfo distribution.
58 %
59 % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
60
61
62 \message{Loading texinfo [version \texinfoversion]:}
63
64 % If in a .fmt file, print the version number
65 % and turn on active characters that we couldn't do earlier because
66 % they might have appeared in the input file name.
67 \everyjob{\message{[Texinfo version \texinfoversion]}%
68 \catcode`+=\active \catcode`\_=\active}
69
70 \chardef\other=12
71
72 % We never want plain's \outer definition of \+ in Texinfo.
73 % For @tex, we can use \tabalign.
74 \let\+ = \relax
75
76 % Save some plain tex macros whose names we will redefine.
77 \let\ptexb=\b
78 \let\ptexbullet=\bullet
79 \let\ptexc=\c
80 \let\ptexcomma=\,
81 \let\ptexdot=\.
82 \let\ptexdots=\dots
83 \let\ptexend=\end
84 \let\ptexequiv=\equiv
85 \let\ptexexclam=\!
86 \let\ptexfootnote=\footnote
87 \let\ptexgtr=>
88 \let\ptexhat=^
89 \let\ptexi=\i
90 \let\ptexindent=\indent
91 \let\ptexinsert=\insert
92 \let\ptexlbrace=\{
93 \let\ptexless=<
94 \let\ptexnewwrite\newwrite
95 \let\ptexnoindent=\noindent
96 \let\ptexplus=+
97 \let\ptexraggedright=\raggedright
98 \let\ptexrbrace=\}
99 \let\ptexslash=\/
100 \let\ptexsp=\sp
101 \let\ptexstar=\*
102 \let\ptexsup=\sup
103 \let\ptext=\t
104 \let\ptextop=\top
105 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
106
107 % If this character appears in an error message or help string, it
108 % starts a new line in the output.
109 \newlinechar = `^^J
110
111 % Use TeX 3.0's \inputlineno to get the line number, for better error
112 % messages, but if we're using an old version of TeX, don't do anything.
113 %
114 \ifx\inputlineno\thisisundefined
115 \let\linenumber = \empty % Pre-3.0.
116 \else
117 \def\linenumber{l.\the\inputlineno:\space}
118 \fi
119
120 % Set up fixed words for English if not already set.
121 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
122 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
123 \ifx\putworderror\undefined \gdef\putworderror{error}\fi
124 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
125 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
126 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
127 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
128 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
129 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
130 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
131 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
132 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
133 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
134 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
135 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
136 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
137 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
138 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
139 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
140 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
141 %
142 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
143 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
144 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
145 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
146 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
147 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
148 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
149 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
150 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
151 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
152 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
153 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
154 %
155 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
156 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
157 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
158 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
159 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
160
161 % Give the space character the catcode for a space.
162 \def\spaceisspace{\catcode`\ =10\relax}
163
164 \chardef\dashChar = `\-
165 \chardef\slashChar = `\/
166 \chardef\underChar = `\_
167
168 % Ignore a token.
169 %
170 \def\gobble#1{}
171
172 % The following is used inside several \edef's.
173 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
174
175 % Hyphenation fixes.
176 \hyphenation{
177 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
178 ap-pen-dix bit-map bit-maps
179 data-base data-bases eshell fall-ing half-way long-est man-u-script
180 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
181 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
182 spell-ing spell-ings
183 stand-alone strong-est time-stamp time-stamps which-ever white-space
184 wide-spread wrap-around
185 }
186
187 % Sometimes it is convenient to have everything in the transcript file
188 % and nothing on the terminal. We don't just call \tracingall here,
189 % since that produces some useless output on the terminal. We also make
190 % some effort to order the tracing commands to reduce output in the log
191 % file; cf. trace.sty in LaTeX.
192 %
193 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
194 \def\loggingall{%
195 \tracingstats2
196 \tracingpages1
197 \tracinglostchars2 % 2 gives us more in etex
198 \tracingparagraphs1
199 \tracingoutput1
200 \tracingmacros2
201 \tracingrestores1
202 \showboxbreadth\maxdimen \showboxdepth\maxdimen
203 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
204 \tracingscantokens1
205 \tracingifs1
206 \tracinggroups1
207 \tracingnesting2
208 \tracingassigns1
209 \fi
210 \tracingcommands3 % 3 gives us more in etex
211 \errorcontextlines16
212 }%
213
214 % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
215 % aren't perfect, it's not the end of the world, being an error message,
216 % after all.
217 %
218 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
219 \def\doerrormsg#1{\errmessage{#1}}
220
221 % add check for \lastpenalty to plain's definitions. If the last thing
222 % we did was a \nobreak, we don't want to insert more space.
223 %
224 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
225 \removelastskip\penalty-50\smallskip\fi\fi}
226 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
227 \removelastskip\penalty-100\medskip\fi\fi}
228 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
229 \removelastskip\penalty-200\bigskip\fi\fi}
230
231 %\f Output routine
232 %
233
234 % For a final copy, take out the rectangles
235 % that mark overfull boxes (in case you have decided
236 % that the text looks ok even though it passes the margin).
237 %
238 \def\finalout{\overfullrule=0pt }
239
240 % Do @cropmarks to get crop marks.
241 %
242 \newif\ifcropmarks
243 \let\cropmarks = \cropmarkstrue
244 %
245 % Dimensions to add cropmarks at corners.
246 % Added by P. A. MacKay, 12 Nov. 1986
247 %
248 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
249 \newdimen\cornerlong \cornerlong=1pc
250 \newdimen\cornerthick \cornerthick=.3pt
251 \newdimen\topandbottommargin \topandbottommargin=.75in
252
253 % Output a mark which sets \thischapter, \thissection and \thiscolor.
254 % We dump everything together because we only have one kind of mark.
255 % This works because we only use \botmark / \topmark, not \firstmark.
256 %
257 % A mark contains a subexpression of the \ifcase ... \fi construct.
258 % \get*marks macros below extract the needed part using \ifcase.
259 %
260 % Another complication is to let the user choose whether \thischapter
261 % (\thissection) refers to the chapter (section) in effect at the top
262 % of a page, or that at the bottom of a page.
263
264 % \domark is called twice inside \chapmacro, to add one
265 % mark before the section break, and one after.
266 % In the second call \prevchapterdefs is the same as \lastchapterdefs,
267 % and \prevsectiondefs is the same as \lastsectiondefs.
268 % Then if the page is not broken at the mark, some of the previous
269 % section appears on the page, and we can get the name of this section
270 % from \firstmark for @everyheadingmarks top.
271 % @everyheadingmarks bottom uses \botmark.
272 %
273 % See page 260 of The TeXbook.
274 \def\domark{%
275 \toks0=\expandafter{\lastchapterdefs}%
276 \toks2=\expandafter{\lastsectiondefs}%
277 \toks4=\expandafter{\prevchapterdefs}%
278 \toks6=\expandafter{\prevsectiondefs}%
279 \toks8=\expandafter{\lastcolordefs}%
280 \mark{%
281 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
282 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
283 \noexpand\else \the\toks8 % 2: color marks
284 }%
285 }
286
287 % \gettopheadingmarks, \getbottomheadingmarks,
288 % \getcolormarks - extract needed part of mark.
289 %
290 % \topmark doesn't work for the very first chapter (after the title
291 % page or the contents), so we use \firstmark there -- this gets us
292 % the mark with the chapter defs, unless the user sneaks in, e.g.,
293 % @setcolor (or @url, or @link, etc.) between @contents and the very
294 % first @chapter.
295 \def\gettopheadingmarks{%
296 \ifcase0\topmark\fi
297 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
298 }
299 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
300 \def\getcolormarks{\ifcase2\topmark\fi}
301
302 % Avoid "undefined control sequence" errors.
303 \def\lastchapterdefs{}
304 \def\lastsectiondefs{}
305 \def\lastsection{}
306 \def\prevchapterdefs{}
307 \def\prevsectiondefs{}
308 \def\lastcolordefs{}
309
310 % Margin to add to right of even pages, to left of odd pages.
311 \newdimen\bindingoffset
312 \newdimen\normaloffset
313 \newdimen\pagewidth \newdimen\pageheight
314
315 % Main output routine.
316 %
317 \chardef\PAGE = 255
318 \output = {\onepageout{\pagecontents\PAGE}}
319
320 \newbox\headlinebox
321 \newbox\footlinebox
322
323 % \onepageout takes a vbox as an argument.
324 % \shipout a vbox for a single page, adding an optional header, footer,
325 % cropmarks, and footnote. This also causes index entries for this page
326 % to be written to the auxiliary files.
327 %
328 \def\onepageout#1{%
329 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
330 %
331 \ifodd\pageno \advance\hoffset by \bindingoffset
332 \else \advance\hoffset by -\bindingoffset\fi
333 %
334 % Common context changes for both heading and footing.
335 % Do this outside of the \shipout so @code etc. will be expanded in
336 % the headline as they should be, not taken literally (outputting ''code).
337 \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars}
338 %
339 % Retrieve the information for the headings from the marks in the page,
340 % and call Plain TeX's \makeheadline and \makefootline, which use the
341 % values in \headline and \footline.
342 %
343 % This is used to check if we are on the first page of a chapter.
344 \ifcase1\topmark\fi
345 \let\prevchaptername\thischaptername
346 \ifcase0\firstmark\fi
347 \let\curchaptername\thischaptername
348 %
349 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
350 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
351 %
352 \ifx\curchaptername\prevchaptername
353 \let\thischapterheading\thischapter
354 \else
355 % \thischapterheading is the same as \thischapter except it is blank
356 % for the first page of a chapter. This is to prevent the chapter name
357 % being shown twice.
358 \def\thischapterheading{}%
359 \fi
360 %
361 \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
362 \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
363 %
364 {%
365 % Set context for writing to auxiliary files like index files.
366 % Have to do this stuff outside the \shipout because we want it to
367 % take effect in \write's, yet the group defined by the \vbox ends
368 % before the \shipout runs.
369 %
370 \indexdummies % don't expand commands in the output.
371 \normalturnoffactive % \ in index entries must not stay \, e.g., if
372 % the page break happens to be in the middle of an example.
373 % We don't want .vr (or whatever) entries like this:
374 % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
375 % "\acronym" won't work when it's read back in;
376 % it needs to be
377 % {\code {{\backslashcurfont }acronym}
378 \shipout\vbox{%
379 % Do this early so pdf references go to the beginning of the page.
380 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
381 %
382 \ifcropmarks \vbox to \outervsize\bgroup
383 \hsize = \outerhsize
384 \vskip-\topandbottommargin
385 \vtop to0pt{%
386 \line{\ewtop\hfil\ewtop}%
387 \nointerlineskip
388 \line{%
389 \vbox{\moveleft\cornerthick\nstop}%
390 \hfill
391 \vbox{\moveright\cornerthick\nstop}%
392 }%
393 \vss}%
394 \vskip\topandbottommargin
395 \line\bgroup
396 \hfil % center the page within the outer (page) hsize.
397 \ifodd\pageno\hskip\bindingoffset\fi
398 \vbox\bgroup
399 \fi
400 %
401 \unvbox\headlinebox
402 \pagebody{#1}%
403 \ifdim\ht\footlinebox > 0pt
404 % Only leave this space if the footline is nonempty.
405 % (We lessened \vsize for it in \oddfootingyyy.)
406 % The \baselineskip=24pt in plain's \makefootline has no effect.
407 \vskip 24pt
408 \unvbox\footlinebox
409 \fi
410 %
411 \ifcropmarks
412 \egroup % end of \vbox\bgroup
413 \hfil\egroup % end of (centering) \line\bgroup
414 \vskip\topandbottommargin plus1fill minus1fill
415 \boxmaxdepth = \cornerthick
416 \vbox to0pt{\vss
417 \line{%
418 \vbox{\moveleft\cornerthick\nsbot}%
419 \hfill
420 \vbox{\moveright\cornerthick\nsbot}%
421 }%
422 \nointerlineskip
423 \line{\ewbot\hfil\ewbot}%
424 }%
425 \egroup % \vbox from first cropmarks clause
426 \fi
427 }% end of \shipout\vbox
428 }% end of group with \indexdummies
429 \advancepageno
430 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
431 }
432
433 \newinsert\margin \dimen\margin=\maxdimen
434
435 % Main part of page, including any footnotes
436 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
437 {\catcode`\@ =11
438 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
439 % marginal hacks, juha@viisa.uucp (Juha Takala)
440 \ifvoid\margin\else % marginal info is present
441 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
442 \dimen@=\dp#1\relax \unvbox#1\relax
443 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
444 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
445 }
446
447 % Here are the rules for the cropmarks. Note that they are
448 % offset so that the space between them is truly \outerhsize or \outervsize
449 % (P. A. MacKay, 12 November, 1986)
450 %
451 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
452 \def\nstop{\vbox
453 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
454 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
455 \def\nsbot{\vbox
456 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
457
458
459 % Argument parsing
460
461 % Parse an argument, then pass it to #1. The argument is the rest of
462 % the input line (except we remove a trailing comment). #1 should be a
463 % macro which expects an ordinary undelimited TeX argument.
464 % For example, \def\foo{\parsearg\fooxxx}.
465 %
466 \def\parsearg{\parseargusing{}}
467 \def\parseargusing#1#2{%
468 \def\argtorun{#2}%
469 \begingroup
470 \obeylines
471 \spaceisspace
472 #1%
473 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
474 }
475
476 {\obeylines %
477 \gdef\parseargline#1^^M{%
478 \endgroup % End of the group started in \parsearg.
479 \argremovecomment #1\comment\ArgTerm%
480 }%
481 }
482
483 % First remove any @comment, then any @c comment. Also remove a @texinfoc
484 % comment (see \scanmacro for details). Pass the result on to \argcheckspaces.
485 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
486 \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
487 \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
488
489 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
490 %
491 % \argremovec might leave us with trailing space, e.g.,
492 % @end itemize @c foo
493 % This space token undergoes the same procedure and is eventually removed
494 % by \finishparsearg.
495 %
496 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
497 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
498 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
499 \def\temp{#3}%
500 \ifx\temp\empty
501 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
502 \let\temp\finishparsearg
503 \else
504 \let\temp\argcheckspaces
505 \fi
506 % Put the space token in:
507 \temp#1 #3\ArgTerm
508 }
509
510 % If a _delimited_ argument is enclosed in braces, they get stripped; so
511 % to get _exactly_ the rest of the line, we had to prevent such situation.
512 % We prepended an \empty token at the very beginning and we expand it now,
513 % just before passing the control to \argtorun.
514 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
515 % either the null string, or it ends with \^^M---thus there is no danger
516 % that a pair of braces would be stripped.
517 %
518 % But first, we have to remove the trailing space token.
519 %
520 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
521
522
523 % \parseargdef - define a command taking an argument on the line
524 %
525 % \parseargdef\foo{...}
526 % is roughly equivalent to
527 % \def\foo{\parsearg\Xfoo}
528 % \def\Xfoo#1{...}
529 \def\parseargdef#1{%
530 \expandafter \doparseargdef \csname\string#1\endcsname #1%
531 }
532 \def\doparseargdef#1#2{%
533 \def#2{\parsearg#1}%
534 \def#1##1%
535 }
536
537 % Several utility definitions with active space:
538 {
539 \obeyspaces
540 \gdef\obeyedspace{ }
541
542 % Make each space character in the input produce a normal interword
543 % space in the output. Don't allow a line break at this space, as this
544 % is used only in environments like @example, where each line of input
545 % should produce a line of output anyway.
546 %
547 \gdef\sepspaces{\obeyspaces\let =\tie}
548
549 % If an index command is used in an @example environment, any spaces
550 % therein should become regular spaces in the raw index file, not the
551 % expansion of \tie (\leavevmode \penalty \@M \ ).
552 \gdef\unsepspaces{\let =\space}
553 }
554
555
556 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
557
558 % Define the framework for environments in texinfo.tex. It's used like this:
559 %
560 % \envdef\foo{...}
561 % \def\Efoo{...}
562 %
563 % It's the responsibility of \envdef to insert \begingroup before the
564 % actual body; @end closes the group after calling \Efoo. \envdef also
565 % defines \thisenv, so the current environment is known; @end checks
566 % whether the environment name matches. The \checkenv macro can also be
567 % used to check whether the current environment is the one expected.
568 %
569 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
570 % are not treated as environments; they don't open a group. (The
571 % implementation of @end takes care not to call \endgroup in this
572 % special case.)
573
574
575 % At run-time, environments start with this:
576 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
577 % initialize
578 \let\thisenv\empty
579
580 % ... but they get defined via ``\envdef\foo{...}'':
581 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
582 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
583
584 % Check whether we're in the right environment:
585 \def\checkenv#1{%
586 \def\temp{#1}%
587 \ifx\thisenv\temp
588 \else
589 \badenverr
590 \fi
591 }
592
593 % Environment mismatch, #1 expected:
594 \def\badenverr{%
595 \errhelp = \EMsimple
596 \errmessage{This command can appear only \inenvironment\temp,
597 not \inenvironment\thisenv}%
598 }
599 \def\inenvironment#1{%
600 \ifx#1\empty
601 outside of any environment%
602 \else
603 in environment \expandafter\string#1%
604 \fi
605 }
606
607 % @end foo executes the definition of \Efoo.
608 % But first, it executes a specialized version of \checkenv
609 %
610 \parseargdef\end{%
611 \if 1\csname iscond.#1\endcsname
612 \else
613 % The general wording of \badenverr may not be ideal.
614 \expandafter\checkenv\csname#1\endcsname
615 \csname E#1\endcsname
616 \endgroup
617 \fi
618 }
619
620 \newhelp\EMsimple{Press RETURN to continue.}
621
622
623 % Be sure we're in horizontal mode when doing a tie, since we make space
624 % equivalent to this in @example-like environments. Otherwise, a space
625 % at the beginning of a line will start with \penalty -- and
626 % since \penalty is valid in vertical mode, we'd end up putting the
627 % penalty on the vertical list instead of in the new paragraph.
628 {\catcode`@ = 11
629 % Avoid using \@M directly, because that causes trouble
630 % if the definition is written into an index file.
631 \global\let\tiepenalty = \@M
632 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
633 }
634
635 % @: forces normal size whitespace following.
636 \def\:{\spacefactor=1000 }
637
638 % @* forces a line break.
639 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
640
641 % @/ allows a line break.
642 \let\/=\allowbreak
643
644 % @. is an end-of-sentence period.
645 \def\.{.\spacefactor=\endofsentencespacefactor\space}
646
647 % @! is an end-of-sentence bang.
648 \def\!{!\spacefactor=\endofsentencespacefactor\space}
649
650 % @? is an end-of-sentence query.
651 \def\?{?\spacefactor=\endofsentencespacefactor\space}
652
653 % @frenchspacing on|off says whether to put extra space after punctuation.
654 %
655 \def\onword{on}
656 \def\offword{off}
657 %
658 \parseargdef\frenchspacing{%
659 \def\temp{#1}%
660 \ifx\temp\onword \plainfrenchspacing
661 \else\ifx\temp\offword \plainnonfrenchspacing
662 \else
663 \errhelp = \EMsimple
664 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
665 \fi\fi
666 }
667
668 % @w prevents a word break. Without the \leavevmode, @w at the
669 % beginning of a paragraph, when TeX is still in vertical mode, would
670 % produce a whole line of output instead of starting the paragraph.
671 \def\w#1{\leavevmode\hbox{#1}}
672
673 % @group ... @end group forces ... to be all on one page, by enclosing
674 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
675 % to keep its height that of a normal line. According to the rules for
676 % \topskip (p.114 of the TeXbook), the glue inserted is
677 % max (\topskip - \ht (first item), 0). If that height is large,
678 % therefore, no glue is inserted, and the space between the headline and
679 % the text is small, which looks bad.
680 %
681 % Another complication is that the group might be very large. This can
682 % cause the glue on the previous page to be unduly stretched, because it
683 % does not have much material. In this case, it's better to add an
684 % explicit \vfill so that the extra space is at the bottom. The
685 % threshold for doing this is if the group is more than \vfilllimit
686 % percent of a page (\vfilllimit can be changed inside of @tex).
687 %
688 \newbox\groupbox
689 \def\vfilllimit{0.7}
690 %
691 \envdef\group{%
692 \ifnum\catcode`\^^M=\active \else
693 \errhelp = \groupinvalidhelp
694 \errmessage{@group invalid in context where filling is enabled}%
695 \fi
696 \startsavinginserts
697 %
698 \setbox\groupbox = \vtop\bgroup
699 % Do @comment since we are called inside an environment such as
700 % @example, where each end-of-line in the input causes an
701 % end-of-line in the output. We don't want the end-of-line after
702 % the `@group' to put extra space in the output. Since @group
703 % should appear on a line by itself (according to the Texinfo
704 % manual), we don't worry about eating any user text.
705 \comment
706 }
707 %
708 % The \vtop produces a box with normal height and large depth; thus, TeX puts
709 % \baselineskip glue before it, and (when the next line of text is done)
710 % \lineskip glue after it. Thus, space below is not quite equal to space
711 % above. But it's pretty close.
712 \def\Egroup{%
713 % To get correct interline space between the last line of the group
714 % and the first line afterwards, we have to propagate \prevdepth.
715 \endgraf % Not \par, as it may have been set to \lisppar.
716 \global\dimen1 = \prevdepth
717 \egroup % End the \vtop.
718 \addgroupbox
719 \prevdepth = \dimen1
720 \checkinserts
721 }
722
723 \def\addgroupbox{
724 % \dimen0 is the vertical size of the group's box.
725 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
726 % \dimen2 is how much space is left on the page (more or less).
727 \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
728 % if the group doesn't fit on the current page, and it's a big big
729 % group, force a page break.
730 \ifdim \dimen0 > \dimen2
731 \ifdim \pagetotal < \vfilllimit\pageheight
732 \page
733 \fi
734 \fi
735 \box\groupbox
736 }
737
738 %
739 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
740 % message, so this ends up printing `@group can only ...'.
741 %
742 \newhelp\groupinvalidhelp{%
743 group can only be used in environments such as @example,^^J%
744 where each line of input produces a line of output.}
745
746 % @need space-in-mils
747 % forces a page break if there is not space-in-mils remaining.
748
749 \newdimen\mil \mil=0.001in
750
751 \parseargdef\need{%
752 % Ensure vertical mode, so we don't make a big box in the middle of a
753 % paragraph.
754 \par
755 %
756 % If the @need value is less than one line space, it's useless.
757 \dimen0 = #1\mil
758 \dimen2 = \ht\strutbox
759 \advance\dimen2 by \dp\strutbox
760 \ifdim\dimen0 > \dimen2
761 %
762 % Do a \strut just to make the height of this box be normal, so the
763 % normal leading is inserted relative to the preceding line.
764 % And a page break here is fine.
765 \vtop to #1\mil{\strut\vfil}%
766 %
767 % TeX does not even consider page breaks if a penalty added to the
768 % main vertical list is 10000 or more. But in order to see if the
769 % empty box we just added fits on the page, we must make it consider
770 % page breaks. On the other hand, we don't want to actually break the
771 % page after the empty box. So we use a penalty of 9999.
772 %
773 % There is an extremely small chance that TeX will actually break the
774 % page at this \penalty, if there are no other feasible breakpoints in
775 % sight. (If the user is using lots of big @group commands, which
776 % almost-but-not-quite fill up a page, TeX will have a hard time doing
777 % good page breaking, for example.) However, I could not construct an
778 % example where a page broke at this \penalty; if it happens in a real
779 % document, then we can reconsider our strategy.
780 \penalty9999
781 %
782 % Back up by the size of the box, whether we did a page break or not.
783 \kern -#1\mil
784 %
785 % Do not allow a page break right after this kern.
786 \nobreak
787 \fi
788 }
789
790 % @br forces paragraph break (and is undocumented).
791
792 \let\br = \par
793
794 % @page forces the start of a new page.
795 %
796 \def\page{\par\vfill\supereject}
797
798 % @exdent text....
799 % outputs text on separate line in roman font, starting at standard page margin
800
801 % This records the amount of indent in the innermost environment.
802 % That's how much \exdent should take out.
803 \newskip\exdentamount
804
805 % This defn is used inside fill environments such as @defun.
806 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
807
808 % This defn is used inside nofill environments such as @example.
809 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
810 \leftline{\hskip\leftskip{\rm#1}}}}
811
812 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
813 % paragraph. For more general purposes, use the \margin insertion
814 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
815 %
816 \newskip\inmarginspacing \inmarginspacing=1cm
817 \def\strutdepth{\dp\strutbox}
818 %
819 \def\doinmargin#1#2{\strut\vadjust{%
820 \nobreak
821 \kern-\strutdepth
822 \vtop to \strutdepth{%
823 \baselineskip=\strutdepth
824 \vss
825 % if you have multiple lines of stuff to put here, you'll need to
826 % make the vbox yourself of the appropriate size.
827 \ifx#1l%
828 \llap{\ignorespaces #2\hskip\inmarginspacing}%
829 \else
830 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
831 \fi
832 \null
833 }%
834 }}
835 \def\inleftmargin{\doinmargin l}
836 \def\inrightmargin{\doinmargin r}
837 %
838 % @inmargin{TEXT [, RIGHT-TEXT]}
839 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
840 % else use TEXT for both).
841 %
842 \def\inmargin#1{\parseinmargin #1,,\finish}
843 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
844 \setbox0 = \hbox{\ignorespaces #2}%
845 \ifdim\wd0 > 0pt
846 \def\lefttext{#1}% have both texts
847 \def\righttext{#2}%
848 \else
849 \def\lefttext{#1}% have only one text
850 \def\righttext{#1}%
851 \fi
852 %
853 \ifodd\pageno
854 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
855 \else
856 \def\temp{\inleftmargin\lefttext}%
857 \fi
858 \temp
859 }
860
861 % @| inserts a changebar to the left of the current line. It should
862 % surround any changed text. This approach does *not* work if the
863 % change spans more than two lines of output. To handle that, we would
864 % have adopt a much more difficult approach (putting marks into the main
865 % vertical list for the beginning and end of each change). This command
866 % is not documented, not supported, and doesn't work.
867 %
868 \def\|{%
869 % \vadjust can only be used in horizontal mode.
870 \leavevmode
871 %
872 % Append this vertical mode material after the current line in the output.
873 \vadjust{%
874 % We want to insert a rule with the height and depth of the current
875 % leading; that is exactly what \strutbox is supposed to record.
876 \vskip-\baselineskip
877 %
878 % \vadjust-items are inserted at the left edge of the type. So
879 % the \llap here moves out into the left-hand margin.
880 \llap{%
881 %
882 % For a thicker or thinner bar, change the `1pt'.
883 \vrule height\baselineskip width1pt
884 %
885 % This is the space between the bar and the text.
886 \hskip 12pt
887 }%
888 }%
889 }
890
891 % @include FILE -- \input text of FILE.
892 %
893 \def\include{\parseargusing\filenamecatcodes\includezzz}
894 \def\includezzz#1{%
895 \pushthisfilestack
896 \def\thisfile{#1}%
897 {%
898 \makevalueexpandable % we want to expand any @value in FILE.
899 \turnoffactive % and allow special characters in the expansion
900 \indexnofonts % Allow `@@' and other weird things in file names.
901 \wlog{texinfo.tex: doing @include of #1^^J}%
902 \edef\temp{\noexpand\input #1 }%
903 %
904 % This trickery is to read FILE outside of a group, in case it makes
905 % definitions, etc.
906 \expandafter
907 }\temp
908 \popthisfilestack
909 }
910 \def\filenamecatcodes{%
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 \catcode`-=\other
920 \catcode`\`=\other
921 \catcode`\'=\other
922 }
923
924 \def\pushthisfilestack{%
925 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
926 }
927 \def\pushthisfilestackX{%
928 \expandafter\pushthisfilestackY\thisfile\StackTerm
929 }
930 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
931 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
932 }
933
934 \def\popthisfilestack{\errthisfilestackempty}
935 \def\errthisfilestackempty{\errmessage{Internal error:
936 the stack of filenames is empty.}}
937 %
938 \def\thisfile{}
939
940 % @center line
941 % outputs that line, centered.
942 %
943 \parseargdef\center{%
944 \ifhmode
945 \let\centersub\centerH
946 \else
947 \let\centersub\centerV
948 \fi
949 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
950 \let\centersub\relax % don't let the definition persist, just in case
951 }
952 \def\centerH#1{{%
953 \hfil\break
954 \advance\hsize by -\leftskip
955 \advance\hsize by -\rightskip
956 \line{#1}%
957 \break
958 }}
959 %
960 \newcount\centerpenalty
961 \def\centerV#1{%
962 % The idea here is the same as in \startdefun, \cartouche, etc.: if
963 % @center is the first thing after a section heading, we need to wipe
964 % out the negative parskip inserted by \sectionheading, but still
965 % prevent a page break here.
966 \centerpenalty = \lastpenalty
967 \ifnum\centerpenalty>10000 \vskip\parskip \fi
968 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
969 \line{\kern\leftskip #1\kern\rightskip}%
970 }
971
972 % @sp n outputs n lines of vertical space
973 %
974 \parseargdef\sp{\vskip #1\baselineskip}
975
976 % @comment ...line which is ignored...
977 % @c is the same as @comment
978 % @ignore ... @end ignore is another way to write a comment
979 %
980 \def\comment{\begingroup \catcode`\^^M=\active%
981 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other\commentxxx}%
982
983 {\catcode`\^^M=\active%
984 \gdef\commentxxx#1^^M{\endgroup%
985 \futurelet\nexttoken\commentxxxx}%
986 \gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}%
987 }
988
989 \def\c{\begingroup \catcode`\^^M=\active%
990 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
991 \cxxx}
992 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
993 % See comment in \scanmacro about why the definitions of @c and @comment differ
994
995 % @paragraphindent NCHARS
996 % We'll use ems for NCHARS, close enough.
997 % NCHARS can also be the word `asis' or `none'.
998 % We cannot feasibly implement @paragraphindent asis, though.
999 %
1000 \def\asisword{asis} % no translation, these are keywords
1001 \def\noneword{none}
1002 %
1003 \parseargdef\paragraphindent{%
1004 \def\temp{#1}%
1005 \ifx\temp\asisword
1006 \else
1007 \ifx\temp\noneword
1008 \defaultparindent = 0pt
1009 \else
1010 \defaultparindent = #1em
1011 \fi
1012 \fi
1013 \parindent = \defaultparindent
1014 }
1015
1016 % @exampleindent NCHARS
1017 % We'll use ems for NCHARS like @paragraphindent.
1018 % It seems @exampleindent asis isn't necessary, but
1019 % I preserve it to make it similar to @paragraphindent.
1020 \parseargdef\exampleindent{%
1021 \def\temp{#1}%
1022 \ifx\temp\asisword
1023 \else
1024 \ifx\temp\noneword
1025 \lispnarrowing = 0pt
1026 \else
1027 \lispnarrowing = #1em
1028 \fi
1029 \fi
1030 }
1031
1032 % @firstparagraphindent WORD
1033 % If WORD is `none', then suppress indentation of the first paragraph
1034 % after a section heading. If WORD is `insert', then do indent at such
1035 % paragraphs.
1036 %
1037 % The paragraph indentation is suppressed or not by calling
1038 % \suppressfirstparagraphindent, which the sectioning commands do.
1039 % We switch the definition of this back and forth according to WORD.
1040 % By default, we suppress indentation.
1041 %
1042 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
1043 \def\insertword{insert}
1044 %
1045 \parseargdef\firstparagraphindent{%
1046 \def\temp{#1}%
1047 \ifx\temp\noneword
1048 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
1049 \else\ifx\temp\insertword
1050 \let\suppressfirstparagraphindent = \relax
1051 \else
1052 \errhelp = \EMsimple
1053 \errmessage{Unknown @firstparagraphindent option `\temp'}%
1054 \fi\fi
1055 }
1056
1057 % Here is how we actually suppress indentation. Redefine \everypar to
1058 % \kern backwards by \parindent, and then reset itself to empty.
1059 %
1060 % We also make \indent itself not actually do anything until the next
1061 % paragraph.
1062 %
1063 \gdef\dosuppressfirstparagraphindent{%
1064 \gdef\indent {\restorefirstparagraphindent \indent}%
1065 \gdef\noindent{\restorefirstparagraphindent \noindent}%
1066 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
1067 }
1068 %
1069 \gdef\restorefirstparagraphindent{%
1070 \global\let\indent = \ptexindent
1071 \global\let\noindent = \ptexnoindent
1072 \global\everypar = {}%
1073 }
1074
1075
1076 % @refill is a no-op.
1077 \let\refill=\relax
1078
1079 % @setfilename INFO-FILENAME - ignored
1080 \let\setfilename=\comment
1081
1082 % @bye.
1083 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1084
1085
1086 \message{pdf,}
1087 % adobe `portable' document format
1088 \newcount\tempnum
1089 \newcount\lnkcount
1090 \newtoks\filename
1091 \newcount\filenamelength
1092 \newcount\pgn
1093 \newtoks\toksA
1094 \newtoks\toksB
1095 \newtoks\toksC
1096 \newtoks\toksD
1097 \newbox\boxA
1098 \newbox\boxB
1099 \newcount\countA
1100 \newif\ifpdf
1101 \newif\ifpdfmakepagedest
1102
1103 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1104 % can be set). So we test for \relax and 0 as well as being undefined.
1105 \ifx\pdfoutput\thisisundefined
1106 \else
1107 \ifx\pdfoutput\relax
1108 \else
1109 \ifcase\pdfoutput
1110 \else
1111 \pdftrue
1112 \fi
1113 \fi
1114 \fi
1115
1116 % PDF uses PostScript string constants for the names of xref targets,
1117 % for display in the outlines, and in other places. Thus, we have to
1118 % double any backslashes. Otherwise, a name like "\node" will be
1119 % interpreted as a newline (\n), followed by o, d, e. Not good.
1120 %
1121 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1122 % related messages. The final outcome is that it is up to the TeX user
1123 % to double the backslashes and otherwise make the string valid, so
1124 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1125 % do this reliably, so we use it.
1126
1127 % #1 is a control sequence in which to do the replacements,
1128 % which we \xdef.
1129 \def\txiescapepdf#1{%
1130 \ifx\pdfescapestring\thisisundefined
1131 % No primitive available; should we give a warning or log?
1132 % Many times it won't matter.
1133 \else
1134 % The expandable \pdfescapestring primitive escapes parentheses,
1135 % backslashes, and other special chars.
1136 \xdef#1{\pdfescapestring{#1}}%
1137 \fi
1138 }
1139
1140 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1141 with PDF output, and none of those formats could be found. (.eps cannot
1142 be supported due to the design of the PDF format; use regular TeX (DVI
1143 output) for that.)}
1144
1145 \ifpdf
1146 %
1147 % Color manipulation macros using ideas from pdfcolor.tex,
1148 % except using rgb instead of cmyk; the latter is said to render as a
1149 % very dark gray on-screen and a very dark halftone in print, instead
1150 % of actual black. The dark red here is dark enough to print on paper as
1151 % nearly black, but still distinguishable for online viewing. We use
1152 % black by default, though.
1153 \def\rgbDarkRed{0.50 0.09 0.12}
1154 \def\rgbBlack{0 0 0}
1155 %
1156 % rg sets the color for filling (usual text, etc.);
1157 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1158 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1159 %
1160 % Set color, and create a mark which defines \thiscolor accordingly,
1161 % so that \makeheadline knows which color to restore.
1162 \def\setcolor#1{%
1163 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1164 \domark
1165 \pdfsetcolor{#1}%
1166 }
1167 %
1168 \def\maincolor{\rgbBlack}
1169 \pdfsetcolor{\maincolor}
1170 \edef\thiscolor{\maincolor}
1171 \def\lastcolordefs{}
1172 %
1173 \def\makefootline{%
1174 \baselineskip24pt
1175 \line{\pdfsetcolor{\maincolor}\the\footline}%
1176 }
1177 %
1178 \def\makeheadline{%
1179 \vbox to 0pt{%
1180 \vskip-22.5pt
1181 \line{%
1182 \vbox to8.5pt{}%
1183 % Extract \thiscolor definition from the marks.
1184 \getcolormarks
1185 % Typeset the headline with \maincolor, then restore the color.
1186 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1187 }%
1188 \vss
1189 }%
1190 \nointerlineskip
1191 }
1192 %
1193 %
1194 \pdfcatalog{/PageMode /UseOutlines}
1195 %
1196 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1197 \def\dopdfimage#1#2#3{%
1198 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1199 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1200 %
1201 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1202 % others). Let's try in that order, PDF first since if
1203 % someone has a scalable image, presumably better to use that than a
1204 % bitmap.
1205 \let\pdfimgext=\empty
1206 \begingroup
1207 \openin 1 #1.pdf \ifeof 1
1208 \openin 1 #1.PDF \ifeof 1
1209 \openin 1 #1.png \ifeof 1
1210 \openin 1 #1.jpg \ifeof 1
1211 \openin 1 #1.jpeg \ifeof 1
1212 \openin 1 #1.JPG \ifeof 1
1213 \errhelp = \nopdfimagehelp
1214 \errmessage{Could not find image file #1 for pdf}%
1215 \else \gdef\pdfimgext{JPG}%
1216 \fi
1217 \else \gdef\pdfimgext{jpeg}%
1218 \fi
1219 \else \gdef\pdfimgext{jpg}%
1220 \fi
1221 \else \gdef\pdfimgext{png}%
1222 \fi
1223 \else \gdef\pdfimgext{PDF}%
1224 \fi
1225 \else \gdef\pdfimgext{pdf}%
1226 \fi
1227 \closein 1
1228 \endgroup
1229 %
1230 % without \immediate, ancient pdftex seg faults when the same image is
1231 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1232 \ifnum\pdftexversion < 14
1233 \immediate\pdfimage
1234 \else
1235 \immediate\pdfximage
1236 \fi
1237 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1238 \ifdim \wd2 >0pt height \pdfimageheight \fi
1239 \ifnum\pdftexversion<13
1240 #1.\pdfimgext
1241 \else
1242 {#1.\pdfimgext}%
1243 \fi
1244 \ifnum\pdftexversion < 14 \else
1245 \pdfrefximage \pdflastximage
1246 \fi}
1247 %
1248 \def\pdfmkdest#1{{%
1249 % We have to set dummies so commands such as @code, and characters
1250 % such as \, aren't expanded when present in a section title.
1251 \indexnofonts
1252 \turnoffactive
1253 \makevalueexpandable
1254 \def\pdfdestname{#1}%
1255 \txiescapepdf\pdfdestname
1256 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1257 }}
1258 %
1259 % used to mark target names; must be expandable.
1260 \def\pdfmkpgn#1{#1}
1261 %
1262 % by default, use black for everything.
1263 \def\urlcolor{\rgbBlack}
1264 \def\linkcolor{\rgbBlack}
1265 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1266 %
1267 % Adding outlines to PDF; macros for calculating structure of outlines
1268 % come from Petr Olsak
1269 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1270 \else \csname#1\endcsname \fi}
1271 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1272 \advance\tempnum by 1
1273 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1274 %
1275 % #1 is the section text, which is what will be displayed in the
1276 % outline by the pdf viewer. #2 is the pdf expression for the number
1277 % of subentries (or empty, for subsubsections). #3 is the node text,
1278 % which might be empty if this toc entry had no corresponding node.
1279 % #4 is the page number
1280 %
1281 \def\dopdfoutline#1#2#3#4{%
1282 % Generate a link to the node text if that exists; else, use the
1283 % page number. We could generate a destination for the section
1284 % text in the case where a section has no node, but it doesn't
1285 % seem worth the trouble, since most documents are normally structured.
1286 \edef\pdfoutlinedest{#3}%
1287 \ifx\pdfoutlinedest\empty
1288 \def\pdfoutlinedest{#4}%
1289 \else
1290 \txiescapepdf\pdfoutlinedest
1291 \fi
1292 %
1293 % Also escape PDF chars in the display string.
1294 \edef\pdfoutlinetext{#1}%
1295 \txiescapepdf\pdfoutlinetext
1296 %
1297 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1298 }
1299 %
1300 \def\pdfmakeoutlines{%
1301 \begingroup
1302 % Read toc silently, to get counts of subentries for \pdfoutline.
1303 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1304 \def\numchapentry##1##2##3##4{%
1305 \def\thischapnum{##2}%
1306 \def\thissecnum{0}%
1307 \def\thissubsecnum{0}%
1308 }%
1309 \def\numsecentry##1##2##3##4{%
1310 \advancenumber{chap\thischapnum}%
1311 \def\thissecnum{##2}%
1312 \def\thissubsecnum{0}%
1313 }%
1314 \def\numsubsecentry##1##2##3##4{%
1315 \advancenumber{sec\thissecnum}%
1316 \def\thissubsecnum{##2}%
1317 }%
1318 \def\numsubsubsecentry##1##2##3##4{%
1319 \advancenumber{subsec\thissubsecnum}%
1320 }%
1321 \def\thischapnum{0}%
1322 \def\thissecnum{0}%
1323 \def\thissubsecnum{0}%
1324 %
1325 % use \def rather than \let here because we redefine \chapentry et
1326 % al. a second time, below.
1327 \def\appentry{\numchapentry}%
1328 \def\appsecentry{\numsecentry}%
1329 \def\appsubsecentry{\numsubsecentry}%
1330 \def\appsubsubsecentry{\numsubsubsecentry}%
1331 \def\unnchapentry{\numchapentry}%
1332 \def\unnsecentry{\numsecentry}%
1333 \def\unnsubsecentry{\numsubsecentry}%
1334 \def\unnsubsubsecentry{\numsubsubsecentry}%
1335 \readdatafile{toc}%
1336 %
1337 % Read toc second time, this time actually producing the outlines.
1338 % The `-' means take the \expnumber as the absolute number of
1339 % subentries, which we calculated on our first read of the .toc above.
1340 %
1341 % We use the node names as the destinations.
1342 \def\numchapentry##1##2##3##4{%
1343 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1344 \def\numsecentry##1##2##3##4{%
1345 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1346 \def\numsubsecentry##1##2##3##4{%
1347 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1348 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1349 \dopdfoutline{##1}{}{##3}{##4}}%
1350 %
1351 % PDF outlines are displayed using system fonts, instead of
1352 % document fonts. Therefore we cannot use special characters,
1353 % since the encoding is unknown. For example, the eogonek from
1354 % Latin 2 (0xea) gets translated to a | character. Info from
1355 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1356 %
1357 % TODO this right, we have to translate 8-bit characters to
1358 % their "best" equivalent, based on the @documentencoding. Too
1359 % much work for too little return. Just use the ASCII equivalents
1360 % we use for the index sort strings.
1361 %
1362 \indexnofonts
1363 \setupdatafile
1364 % We can have normal brace characters in the PDF outlines, unlike
1365 % Texinfo index files. So set that up.
1366 \def\{{\lbracecharliteral}%
1367 \def\}{\rbracecharliteral}%
1368 \catcode`\\=\active \otherbackslash
1369 \input \tocreadfilename
1370 \endgroup
1371 }
1372 {\catcode`[=1 \catcode`]=2
1373 \catcode`{=\other \catcode`}=\other
1374 \gdef\lbracecharliteral[{]%
1375 \gdef\rbracecharliteral[}]%
1376 ]
1377 %
1378 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1379 \ifx\PP\D\let\nextsp\relax
1380 \else\let\nextsp\skipspaces
1381 \addtokens{\filename}{\PP}%
1382 \advance\filenamelength by 1
1383 \fi
1384 \nextsp}
1385 \def\getfilename#1{%
1386 \filenamelength=0
1387 % If we don't expand the argument now, \skipspaces will get
1388 % snagged on things like "@value{foo}".
1389 \edef\temp{#1}%
1390 \expandafter\skipspaces\temp|\relax
1391 }
1392 \ifnum\pdftexversion < 14
1393 \let \startlink \pdfannotlink
1394 \else
1395 \let \startlink \pdfstartlink
1396 \fi
1397 % make a live url in pdf output.
1398 \def\pdfurl#1{%
1399 \begingroup
1400 % it seems we really need yet another set of dummies; have not
1401 % tried to figure out what each command should do in the context
1402 % of @url. for now, just make @/ a no-op, that's the only one
1403 % people have actually reported a problem with.
1404 %
1405 \normalturnoffactive
1406 \def\@{@}%
1407 \let\/=\empty
1408 \makevalueexpandable
1409 % do we want to go so far as to use \indexnofonts instead of just
1410 % special-casing \var here?
1411 \def\var##1{##1}%
1412 %
1413 \leavevmode\setcolor{\urlcolor}%
1414 \startlink attr{/Border [0 0 0]}%
1415 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1416 \endgroup}
1417 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1418 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1419 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1420 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1421 \def\maketoks{%
1422 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1423 \ifx\first0\adn0
1424 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1425 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1426 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1427 \else
1428 \ifnum0=\countA\else\makelink\fi
1429 \ifx\first.\let\next=\done\else
1430 \let\next=\maketoks
1431 \addtokens{\toksB}{\the\toksD}
1432 \ifx\first,\addtokens{\toksB}{\space}\fi
1433 \fi
1434 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1435 \next}
1436 \def\makelink{\addtokens{\toksB}%
1437 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1438 \def\pdflink#1{%
1439 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1440 \setcolor{\linkcolor}#1\endlink}
1441 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1442 \else
1443 % non-pdf mode
1444 \let\pdfmkdest = \gobble
1445 \let\pdfurl = \gobble
1446 \let\endlink = \relax
1447 \let\setcolor = \gobble
1448 \let\pdfsetcolor = \gobble
1449 \let\pdfmakeoutlines = \relax
1450 \fi % \ifx\pdfoutput
1451
1452 %
1453 % PDF outline support for XeTeX
1454 %
1455 \ifx\XeTeXrevision\thisisundefined
1456 \else
1457 \pdfmakepagedesttrue \relax
1458 % Emulate the primitive of pdfTeX
1459 \def\pdfdest name#1 xyz{%
1460 \special{pdf:dest (name#1) [@thispage /XYZ @xpos @ypos]}%
1461 }
1462 \def\pdfmkdest#1{{%
1463 % We have to set dummies so commands such as @code, and characters
1464 % such as \, aren't expanded when present in a section title.
1465 \indexnofonts
1466 \makevalueexpandable
1467 % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
1468 % Therefore \txiescapepdf is not necessary.
1469 \safewhatsit{\pdfdest name{#1} xyz}%
1470 }}
1471 %
1472 \def\dopdfoutline#1#2#3#4{%
1473 \edef\pdfoutlinedest{#3}%
1474 \ifx\pdfoutlinedest\empty
1475 \def\pdfoutlinedest{#4}%
1476 \fi
1477 {
1478 \turnoffactive
1479 % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
1480 % Therefore \txiescapepdf is not necessary.
1481 \special{pdf:out [-] #2 << /Title (#1) /A << /S /GoTo /D (name\pdfoutlinedest) >> >> }%
1482 }
1483 }
1484 %
1485 \def\pdfmakeoutlines{%
1486 \begingroup
1487 %
1488 % In the case of XeTeX, counts of subentries is not necesary.
1489 % Therefore, read toc only once.
1490 %
1491 % We use the node names as the destinations.
1492 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1493 \def\numchapentry##1##2##3##4{%
1494 \dopdfoutline{##1}{1}{##3}{##4}}%
1495 \def\numsecentry##1##2##3##4{%
1496 \dopdfoutline{##1}{2}{##3}{##4}}%
1497 \def\numsubsecentry##1##2##3##4{%
1498 \dopdfoutline{##1}{3}{##3}{##4}}%
1499 \def\numsubsubsecentry##1##2##3##4{%
1500 \dopdfoutline{##1}{4}{##3}{##4}}%
1501 %
1502 \let\appentry\numchapentry%
1503 \let\appsecentry\numsecentry%
1504 \let\appsubsecentry\numsubsecentry%
1505 \let\appsubsubsecentry\numsubsubsecentry%
1506 \let\unnchapentry\numchapentry%
1507 \let\unnsecentry\numsecentry%
1508 \let\unnsubsecentry\numsubsecentry%
1509 \let\unnsubsubsecentry\numsubsubsecentry%
1510 %
1511 % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
1512 % Therefore, the encoding and the language may not be considered.
1513 %
1514 \indexnofonts
1515 \setupdatafile
1516 % We can have normal brace characters in the PDF outlines, unlike
1517 % Texinfo index files. So set that up.
1518 \def\{{\lbracecharliteral}%
1519 \def\}{\rbracecharliteral}%
1520 \catcode`\\=\active \otherbackslash
1521 \input \tocreadfilename
1522 \endgroup
1523 }
1524 {\catcode`[=1 \catcode`]=2
1525 \catcode`{=\other \catcode`}=\other
1526 \gdef\lbracecharliteral[{]%
1527 \gdef\rbracecharliteral[}]%
1528 ]
1529
1530 \special{pdf:docview << /PageMode /UseOutlines >> }
1531 \special{pdf:tounicode UTF8-UTF16 }
1532 \fi
1533
1534 %
1535 % @image support for XeTeX
1536 %
1537 \newif\ifxeteximgpdf
1538 \ifx\XeTeXrevision\thisisundefined
1539 \else
1540 %
1541 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1542 \def\doxeteximage#1#2#3{%
1543 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1544 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1545 %
1546 % XeTeX (and the PDF format) support .pdf, .png, .jpg (among
1547 % others). Let's try in that order, PDF first since if
1548 % someone has a scalable image, presumably better to use that than a
1549 % bitmap.
1550 \let\xeteximgext=\empty
1551 \xeteximgpdffalse
1552 \begingroup
1553 \openin 1 #1.pdf \ifeof 1
1554 \openin 1 #1.PDF \ifeof 1
1555 \openin 1 #1.png \ifeof 1
1556 \openin 1 #1.jpg \ifeof 1
1557 \openin 1 #1.jpeg \ifeof 1
1558 \openin 1 #1.JPG \ifeof 1
1559 \errmessage{Could not find image file #1 for XeTeX}%
1560 \else \gdef\xeteximgext{JPG}%
1561 \fi
1562 \else \gdef\xeteximgext{jpeg}%
1563 \fi
1564 \else \gdef\xeteximgext{jpg}%
1565 \fi
1566 \else \gdef\xeteximgext{png}%
1567 \fi
1568 \else \gdef\xeteximgext{PDF} \global\xeteximgpdftrue%
1569 \fi
1570 \else \gdef\xeteximgext{pdf} \global\xeteximgpdftrue%
1571 \fi
1572 \closein 1
1573 \endgroup
1574 %
1575 \ifxeteximgpdf
1576 \XeTeXpdffile "#1".\xeteximgext ""
1577 \else
1578 \XeTeXpicfile "#1".\xeteximgext ""
1579 \fi
1580 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1581 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1582 }
1583 \fi
1584
1585 \message{fonts,}
1586
1587 % Change the current font style to #1, remembering it in \curfontstyle.
1588 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1589 % italics, not bold italics.
1590 %
1591 \def\setfontstyle#1{%
1592 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1593 \csname ten#1\endcsname % change the current font
1594 }
1595
1596 % Select #1 fonts with the current style.
1597 %
1598 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1599
1600 \def\rm{\fam=0 \setfontstyle{rm}}
1601 \def\it{\fam=\itfam \setfontstyle{it}}
1602 \def\sl{\fam=\slfam \setfontstyle{sl}}
1603 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1604 \def\tt{\fam=\ttfam \setfontstyle{tt}}
1605
1606 % Unfortunately, we have to override this for titles and the like, since
1607 % in those cases "rm" is bold. Sigh.
1608 \def\rmisbold{\rm\def\curfontstyle{bf}}
1609
1610 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1611 % So we set up a \sf.
1612 \newfam\sffam
1613 \def\sf{\fam=\sffam \setfontstyle{sf}}
1614 \let\li = \sf % Sometimes we call it \li, not \sf.
1615
1616 % We don't need math for this font style.
1617 \def\ttsl{\setfontstyle{ttsl}}
1618
1619
1620 % Set the baselineskip to #1, and the lineskip and strut size
1621 % correspondingly. There is no deep meaning behind these magic numbers
1622 % used as factors; they just match (closely enough) what Knuth defined.
1623 %
1624 \def\lineskipfactor{.08333}
1625 \def\strutheightpercent{.70833}
1626 \def\strutdepthpercent {.29167}
1627 %
1628 % can get a sort of poor man's double spacing by redefining this.
1629 \def\baselinefactor{1}
1630 %
1631 \newdimen\textleading
1632 \def\setleading#1{%
1633 \dimen0 = #1\relax
1634 \normalbaselineskip = \baselinefactor\dimen0
1635 \normallineskip = \lineskipfactor\normalbaselineskip
1636 \normalbaselines
1637 \setbox\strutbox =\hbox{%
1638 \vrule width0pt height\strutheightpercent\baselineskip
1639 depth \strutdepthpercent \baselineskip
1640 }%
1641 }
1642
1643 % PDF CMaps. See also LaTeX's t1.cmap.
1644 %
1645 % do nothing with this by default.
1646 \expandafter\let\csname cmapOT1\endcsname\gobble
1647 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1648 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1649
1650 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1651 % (\pdffontattr was introduced many years ago, but people still run
1652 % older pdftex's; it's easy to conditionalize, so we do.)
1653 \ifpdf \ifx\pdffontattr\thisisundefined \else
1654 \begingroup
1655 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1656 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1657 %%DocumentNeededResources: ProcSet (CIDInit)
1658 %%IncludeResource: ProcSet (CIDInit)
1659 %%BeginResource: CMap (TeX-OT1-0)
1660 %%Title: (TeX-OT1-0 TeX OT1 0)
1661 %%Version: 1.000
1662 %%EndComments
1663 /CIDInit /ProcSet findresource begin
1664 12 dict begin
1665 begincmap
1666 /CIDSystemInfo
1667 << /Registry (TeX)
1668 /Ordering (OT1)
1669 /Supplement 0
1670 >> def
1671 /CMapName /TeX-OT1-0 def
1672 /CMapType 2 def
1673 1 begincodespacerange
1674 <00> <7F>
1675 endcodespacerange
1676 8 beginbfrange
1677 <00> <01> <0393>
1678 <09> <0A> <03A8>
1679 <23> <26> <0023>
1680 <28> <3B> <0028>
1681 <3F> <5B> <003F>
1682 <5D> <5E> <005D>
1683 <61> <7A> <0061>
1684 <7B> <7C> <2013>
1685 endbfrange
1686 40 beginbfchar
1687 <02> <0398>
1688 <03> <039B>
1689 <04> <039E>
1690 <05> <03A0>
1691 <06> <03A3>
1692 <07> <03D2>
1693 <08> <03A6>
1694 <0B> <00660066>
1695 <0C> <00660069>
1696 <0D> <0066006C>
1697 <0E> <006600660069>
1698 <0F> <00660066006C>
1699 <10> <0131>
1700 <11> <0237>
1701 <12> <0060>
1702 <13> <00B4>
1703 <14> <02C7>
1704 <15> <02D8>
1705 <16> <00AF>
1706 <17> <02DA>
1707 <18> <00B8>
1708 <19> <00DF>
1709 <1A> <00E6>
1710 <1B> <0153>
1711 <1C> <00F8>
1712 <1D> <00C6>
1713 <1E> <0152>
1714 <1F> <00D8>
1715 <21> <0021>
1716 <22> <201D>
1717 <27> <2019>
1718 <3C> <00A1>
1719 <3D> <003D>
1720 <3E> <00BF>
1721 <5C> <201C>
1722 <5F> <02D9>
1723 <60> <2018>
1724 <7D> <02DD>
1725 <7E> <007E>
1726 <7F> <00A8>
1727 endbfchar
1728 endcmap
1729 CMapName currentdict /CMap defineresource pop
1730 end
1731 end
1732 %%EndResource
1733 %%EOF
1734 }\endgroup
1735 \expandafter\edef\csname cmapOT1\endcsname#1{%
1736 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1737 }%
1738 %
1739 % \cmapOT1IT
1740 \begingroup
1741 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1742 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1743 %%DocumentNeededResources: ProcSet (CIDInit)
1744 %%IncludeResource: ProcSet (CIDInit)
1745 %%BeginResource: CMap (TeX-OT1IT-0)
1746 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1747 %%Version: 1.000
1748 %%EndComments
1749 /CIDInit /ProcSet findresource begin
1750 12 dict begin
1751 begincmap
1752 /CIDSystemInfo
1753 << /Registry (TeX)
1754 /Ordering (OT1IT)
1755 /Supplement 0
1756 >> def
1757 /CMapName /TeX-OT1IT-0 def
1758 /CMapType 2 def
1759 1 begincodespacerange
1760 <00> <7F>
1761 endcodespacerange
1762 8 beginbfrange
1763 <00> <01> <0393>
1764 <09> <0A> <03A8>
1765 <25> <26> <0025>
1766 <28> <3B> <0028>
1767 <3F> <5B> <003F>
1768 <5D> <5E> <005D>
1769 <61> <7A> <0061>
1770 <7B> <7C> <2013>
1771 endbfrange
1772 42 beginbfchar
1773 <02> <0398>
1774 <03> <039B>
1775 <04> <039E>
1776 <05> <03A0>
1777 <06> <03A3>
1778 <07> <03D2>
1779 <08> <03A6>
1780 <0B> <00660066>
1781 <0C> <00660069>
1782 <0D> <0066006C>
1783 <0E> <006600660069>
1784 <0F> <00660066006C>
1785 <10> <0131>
1786 <11> <0237>
1787 <12> <0060>
1788 <13> <00B4>
1789 <14> <02C7>
1790 <15> <02D8>
1791 <16> <00AF>
1792 <17> <02DA>
1793 <18> <00B8>
1794 <19> <00DF>
1795 <1A> <00E6>
1796 <1B> <0153>
1797 <1C> <00F8>
1798 <1D> <00C6>
1799 <1E> <0152>
1800 <1F> <00D8>
1801 <21> <0021>
1802 <22> <201D>
1803 <23> <0023>
1804 <24> <00A3>
1805 <27> <2019>
1806 <3C> <00A1>
1807 <3D> <003D>
1808 <3E> <00BF>
1809 <5C> <201C>
1810 <5F> <02D9>
1811 <60> <2018>
1812 <7D> <02DD>
1813 <7E> <007E>
1814 <7F> <00A8>
1815 endbfchar
1816 endcmap
1817 CMapName currentdict /CMap defineresource pop
1818 end
1819 end
1820 %%EndResource
1821 %%EOF
1822 }\endgroup
1823 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1824 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1825 }%
1826 %
1827 % \cmapOT1TT
1828 \begingroup
1829 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1830 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1831 %%DocumentNeededResources: ProcSet (CIDInit)
1832 %%IncludeResource: ProcSet (CIDInit)
1833 %%BeginResource: CMap (TeX-OT1TT-0)
1834 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1835 %%Version: 1.000
1836 %%EndComments
1837 /CIDInit /ProcSet findresource begin
1838 12 dict begin
1839 begincmap
1840 /CIDSystemInfo
1841 << /Registry (TeX)
1842 /Ordering (OT1TT)
1843 /Supplement 0
1844 >> def
1845 /CMapName /TeX-OT1TT-0 def
1846 /CMapType 2 def
1847 1 begincodespacerange
1848 <00> <7F>
1849 endcodespacerange
1850 5 beginbfrange
1851 <00> <01> <0393>
1852 <09> <0A> <03A8>
1853 <21> <26> <0021>
1854 <28> <5F> <0028>
1855 <61> <7E> <0061>
1856 endbfrange
1857 32 beginbfchar
1858 <02> <0398>
1859 <03> <039B>
1860 <04> <039E>
1861 <05> <03A0>
1862 <06> <03A3>
1863 <07> <03D2>
1864 <08> <03A6>
1865 <0B> <2191>
1866 <0C> <2193>
1867 <0D> <0027>
1868 <0E> <00A1>
1869 <0F> <00BF>
1870 <10> <0131>
1871 <11> <0237>
1872 <12> <0060>
1873 <13> <00B4>
1874 <14> <02C7>
1875 <15> <02D8>
1876 <16> <00AF>
1877 <17> <02DA>
1878 <18> <00B8>
1879 <19> <00DF>
1880 <1A> <00E6>
1881 <1B> <0153>
1882 <1C> <00F8>
1883 <1D> <00C6>
1884 <1E> <0152>
1885 <1F> <00D8>
1886 <20> <2423>
1887 <27> <2019>
1888 <60> <2018>
1889 <7F> <00A8>
1890 endbfchar
1891 endcmap
1892 CMapName currentdict /CMap defineresource pop
1893 end
1894 end
1895 %%EndResource
1896 %%EOF
1897 }\endgroup
1898 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1899 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1900 }%
1901 \fi\fi
1902
1903
1904 % Set the font macro #1 to the font named \fontprefix#2.
1905 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1906 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
1907 % Example:
1908 % #1 = \textrm
1909 % #2 = \rmshape
1910 % #3 = 10
1911 % #4 = \mainmagstep
1912 % #5 = OT1
1913 %
1914 \def\setfont#1#2#3#4#5{%
1915 \font#1=\fontprefix#2#3 scaled #4
1916 \csname cmap#5\endcsname#1%
1917 }
1918 % This is what gets called when #5 of \setfont is empty.
1919 \let\cmap\gobble
1920 %
1921 % (end of cmaps)
1922
1923 % Use cm as the default font prefix.
1924 % To specify the font prefix, you must define \fontprefix
1925 % before you read in texinfo.tex.
1926 \ifx\fontprefix\thisisundefined
1927 \def\fontprefix{cm}
1928 \fi
1929 % Support font families that don't use the same naming scheme as CM.
1930 \def\rmshape{r}
1931 \def\rmbshape{bx} % where the normal face is bold
1932 \def\bfshape{b}
1933 \def\bxshape{bx}
1934 \def\ttshape{tt}
1935 \def\ttbshape{tt}
1936 \def\ttslshape{sltt}
1937 \def\itshape{ti}
1938 \def\itbshape{bxti}
1939 \def\slshape{sl}
1940 \def\slbshape{bxsl}
1941 \def\sfshape{ss}
1942 \def\sfbshape{ss}
1943 \def\scshape{csc}
1944 \def\scbshape{csc}
1945
1946 % Definitions for a main text size of 11pt. (The default in Texinfo.)
1947 %
1948 \def\definetextfontsizexi{%
1949 % Text fonts (11.2pt, magstep1).
1950 \def\textnominalsize{11pt}
1951 \edef\mainmagstep{\magstephalf}
1952 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1953 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1954 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1955 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1956 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1957 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1958 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1959 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1960 \font\texti=cmmi10 scaled \mainmagstep
1961 \font\textsy=cmsy10 scaled \mainmagstep
1962 \def\textecsize{1095}
1963
1964 % A few fonts for @defun names and args.
1965 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
1966 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1967 \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
1968 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1969 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
1970 \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
1971
1972 % Fonts for indices, footnotes, small examples (9pt).
1973 \def\smallnominalsize{9pt}
1974 \setfont\smallrm\rmshape{9}{1000}{OT1}
1975 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1976 \setfont\smallbf\bfshape{10}{900}{OT1}
1977 \setfont\smallit\itshape{9}{1000}{OT1IT}
1978 \setfont\smallsl\slshape{9}{1000}{OT1}
1979 \setfont\smallsf\sfshape{9}{1000}{OT1}
1980 \setfont\smallsc\scshape{10}{900}{OT1}
1981 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1982 \font\smalli=cmmi9
1983 \font\smallsy=cmsy9
1984 \def\smallecsize{0900}
1985
1986 % Fonts for small examples (8pt).
1987 \def\smallernominalsize{8pt}
1988 \setfont\smallerrm\rmshape{8}{1000}{OT1}
1989 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
1990 \setfont\smallerbf\bfshape{10}{800}{OT1}
1991 \setfont\smallerit\itshape{8}{1000}{OT1IT}
1992 \setfont\smallersl\slshape{8}{1000}{OT1}
1993 \setfont\smallersf\sfshape{8}{1000}{OT1}
1994 \setfont\smallersc\scshape{10}{800}{OT1}
1995 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1996 \font\smalleri=cmmi8
1997 \font\smallersy=cmsy8
1998 \def\smallerecsize{0800}
1999
2000 % Fonts for title page (20.4pt):
2001 \def\titlenominalsize{20pt}
2002 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2003 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2004 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2005 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2006 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2007 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2008 \let\titlebf=\titlerm
2009 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2010 \font\titlei=cmmi12 scaled \magstep3
2011 \font\titlesy=cmsy10 scaled \magstep4
2012 \def\titleecsize{2074}
2013
2014 % Chapter (and unnumbered) fonts (17.28pt).
2015 \def\chapnominalsize{17pt}
2016 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2017 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2018 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2019 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2020 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2021 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2022 \let\chapbf=\chaprm
2023 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2024 \font\chapi=cmmi12 scaled \magstep2
2025 \font\chapsy=cmsy10 scaled \magstep3
2026 \def\chapecsize{1728}
2027
2028 % Section fonts (14.4pt).
2029 \def\secnominalsize{14pt}
2030 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2031 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2032 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2033 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2034 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2035 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2036 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2037 \let\secbf\secrm
2038 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2039 \font\seci=cmmi12 scaled \magstep1
2040 \font\secsy=cmsy10 scaled \magstep2
2041 \def\sececsize{1440}
2042
2043 % Subsection fonts (13.15pt).
2044 \def\ssecnominalsize{13pt}
2045 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2046 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2047 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2048 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2049 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2050 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2051 \let\ssecbf\ssecrm
2052 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2053 \font\sseci=cmmi12 scaled \magstephalf
2054 \font\ssecsy=cmsy10 scaled 1315
2055 \def\ssececsize{1200}
2056
2057 % Reduced fonts for @acro in text (10pt).
2058 \def\reducednominalsize{10pt}
2059 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2060 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2061 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2062 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2063 \setfont\reducedsl\slshape{10}{1000}{OT1}
2064 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2065 \setfont\reducedsc\scshape{10}{1000}{OT1}
2066 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2067 \font\reducedi=cmmi10
2068 \font\reducedsy=cmsy10
2069 \def\reducedecsize{1000}
2070
2071 \textleading = 13.2pt % line spacing for 11pt CM
2072 \textfonts % reset the current fonts
2073 \rm
2074 } % end of 11pt text font size definitions, \definetextfontsizexi
2075
2076
2077 % Definitions to make the main text be 10pt Computer Modern, with
2078 % section, chapter, etc., sizes following suit. This is for the GNU
2079 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2080 % future. Used with @smallbook, which sets the leading to 12pt.
2081 %
2082 \def\definetextfontsizex{%
2083 % Text fonts (10pt).
2084 \def\textnominalsize{10pt}
2085 \edef\mainmagstep{1000}
2086 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2087 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2088 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2089 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2090 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2091 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2092 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2093 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2094 \font\texti=cmmi10 scaled \mainmagstep
2095 \font\textsy=cmsy10 scaled \mainmagstep
2096 \def\textecsize{1000}
2097
2098 % A few fonts for @defun names and args.
2099 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2100 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2101 \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
2102 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2103 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
2104 \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
2105
2106 % Fonts for indices, footnotes, small examples (9pt).
2107 \def\smallnominalsize{9pt}
2108 \setfont\smallrm\rmshape{9}{1000}{OT1}
2109 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2110 \setfont\smallbf\bfshape{10}{900}{OT1}
2111 \setfont\smallit\itshape{9}{1000}{OT1IT}
2112 \setfont\smallsl\slshape{9}{1000}{OT1}
2113 \setfont\smallsf\sfshape{9}{1000}{OT1}
2114 \setfont\smallsc\scshape{10}{900}{OT1}
2115 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2116 \font\smalli=cmmi9
2117 \font\smallsy=cmsy9
2118 \def\smallecsize{0900}
2119
2120 % Fonts for small examples (8pt).
2121 \def\smallernominalsize{8pt}
2122 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2123 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2124 \setfont\smallerbf\bfshape{10}{800}{OT1}
2125 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2126 \setfont\smallersl\slshape{8}{1000}{OT1}
2127 \setfont\smallersf\sfshape{8}{1000}{OT1}
2128 \setfont\smallersc\scshape{10}{800}{OT1}
2129 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2130 \font\smalleri=cmmi8
2131 \font\smallersy=cmsy8
2132 \def\smallerecsize{0800}
2133
2134 % Fonts for title page (20.4pt):
2135 \def\titlenominalsize{20pt}
2136 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2137 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2138 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2139 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2140 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2141 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2142 \let\titlebf=\titlerm
2143 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2144 \font\titlei=cmmi12 scaled \magstep3
2145 \font\titlesy=cmsy10 scaled \magstep4
2146 \def\titleecsize{2074}
2147
2148 % Chapter fonts (14.4pt).
2149 \def\chapnominalsize{14pt}
2150 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2151 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2152 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2153 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2154 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2155 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2156 \let\chapbf\chaprm
2157 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2158 \font\chapi=cmmi12 scaled \magstep1
2159 \font\chapsy=cmsy10 scaled \magstep2
2160 \def\chapecsize{1440}
2161
2162 % Section fonts (12pt).
2163 \def\secnominalsize{12pt}
2164 \setfont\secrm\rmbshape{12}{1000}{OT1}
2165 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2166 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2167 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2168 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2169 \setfont\secsf\sfbshape{12}{1000}{OT1}
2170 \let\secbf\secrm
2171 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2172 \font\seci=cmmi12
2173 \font\secsy=cmsy10 scaled \magstep1
2174 \def\sececsize{1200}
2175
2176 % Subsection fonts (10pt).
2177 \def\ssecnominalsize{10pt}
2178 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2179 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2180 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2181 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2182 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2183 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2184 \let\ssecbf\ssecrm
2185 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2186 \font\sseci=cmmi10
2187 \font\ssecsy=cmsy10
2188 \def\ssececsize{1000}
2189
2190 % Reduced fonts for @acro in text (9pt).
2191 \def\reducednominalsize{9pt}
2192 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2193 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2194 \setfont\reducedbf\bfshape{10}{900}{OT1}
2195 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2196 \setfont\reducedsl\slshape{9}{1000}{OT1}
2197 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2198 \setfont\reducedsc\scshape{10}{900}{OT1}
2199 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2200 \font\reducedi=cmmi9
2201 \font\reducedsy=cmsy9
2202 \def\reducedecsize{0900}
2203
2204 \divide\parskip by 2 % reduce space between paragraphs
2205 \textleading = 12pt % line spacing for 10pt CM
2206 \textfonts % reset the current fonts
2207 \rm
2208 } % end of 10pt text font size definitions, \definetextfontsizex
2209
2210
2211 % We provide the user-level command
2212 % @fonttextsize 10
2213 % (or 11) to redefine the text font size. pt is assumed.
2214 %
2215 \def\xiword{11}
2216 \def\xword{10}
2217 \def\xwordpt{10pt}
2218 %
2219 \parseargdef\fonttextsize{%
2220 \def\textsizearg{#1}%
2221 %\wlog{doing @fonttextsize \textsizearg}%
2222 %
2223 % Set \globaldefs so that documents can use this inside @tex, since
2224 % makeinfo 4.8 does not support it, but we need it nonetheless.
2225 %
2226 \begingroup \globaldefs=1
2227 \ifx\textsizearg\xword \definetextfontsizex
2228 \else \ifx\textsizearg\xiword \definetextfontsizexi
2229 \else
2230 \errhelp=\EMsimple
2231 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2232 \fi\fi
2233 \endgroup
2234 }
2235
2236 % In order for the font changes to affect most math symbols and letters,
2237 % we have to define the \textfont of the standard families. We don't
2238 % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
2239 %
2240 \def\resetmathfonts{%
2241 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2242 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2243 \textfont\ttfam=\tentt \textfont\sffam=\tensf
2244 }
2245
2246 % The font-changing commands redefine the meanings of \tenSTYLE, instead
2247 % of just \STYLE. We do this because \STYLE needs to also set the
2248 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2249 % \tenSTYLE to set the current font.
2250 %
2251 % Each font-changing command also sets the names \lsize (one size lower)
2252 % and \lllsize (three sizes lower). These relative commands are used
2253 % in, e.g., the LaTeX logo and acronyms.
2254 %
2255 % This all needs generalizing, badly.
2256 %
2257 \def\textfonts{%
2258 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2259 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2260 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2261 \let\tenttsl=\textttsl
2262 \def\curfontsize{text}%
2263 \def\lsize{reduced}\def\lllsize{smaller}%
2264 \resetmathfonts \setleading{\textleading}}
2265 \def\titlefonts{%
2266 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2267 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2268 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2269 \let\tenttsl=\titlettsl
2270 \def\curfontsize{title}%
2271 \def\lsize{chap}\def\lllsize{subsec}%
2272 \resetmathfonts \setleading{27pt}}
2273 \def\titlefont#1{{\titlefonts\rmisbold #1}}
2274 \def\chapfonts{%
2275 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2276 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2277 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2278 \let\tenttsl=\chapttsl
2279 \def\curfontsize{chap}%
2280 \def\lsize{sec}\def\lllsize{text}%
2281 \resetmathfonts \setleading{19pt}}
2282 \def\secfonts{%
2283 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2284 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2285 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2286 \let\tenttsl=\secttsl
2287 \def\curfontsize{sec}%
2288 \def\lsize{subsec}\def\lllsize{reduced}%
2289 \resetmathfonts \setleading{17pt}}
2290 \def\subsecfonts{%
2291 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2292 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2293 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2294 \let\tenttsl=\ssecttsl
2295 \def\curfontsize{ssec}%
2296 \def\lsize{text}\def\lllsize{small}%
2297 \resetmathfonts \setleading{15pt}}
2298 \let\subsubsecfonts = \subsecfonts
2299 \def\reducedfonts{%
2300 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2301 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2302 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2303 \let\tenttsl=\reducedttsl
2304 \def\curfontsize{reduced}%
2305 \def\lsize{small}\def\lllsize{smaller}%
2306 \resetmathfonts \setleading{10.5pt}}
2307 \def\smallfonts{%
2308 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2309 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2310 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2311 \let\tenttsl=\smallttsl
2312 \def\curfontsize{small}%
2313 \def\lsize{smaller}\def\lllsize{smaller}%
2314 \resetmathfonts \setleading{10.5pt}}
2315 \def\smallerfonts{%
2316 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2317 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2318 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2319 \let\tenttsl=\smallerttsl
2320 \def\curfontsize{smaller}%
2321 \def\lsize{smaller}\def\lllsize{smaller}%
2322 \resetmathfonts \setleading{9.5pt}}
2323
2324 % Fonts for short table of contents.
2325 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2326 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2327 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2328 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2329
2330 % Define these just so they can be easily changed for other fonts.
2331 \def\angleleft{$\langle$}
2332 \def\angleright{$\rangle$}
2333
2334 % Set the fonts to use with the @small... environments.
2335 \let\smallexamplefonts = \smallfonts
2336
2337 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2338 % can fit this many characters:
2339 % 8.5x11=86 smallbook=72 a4=90 a5=69
2340 % If we use \scriptfonts (8pt), then we can fit this many characters:
2341 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2342 % For me, subjectively, the few extra characters that fit aren't worth
2343 % the additional smallness of 8pt. So I'm making the default 9pt.
2344 %
2345 % By the way, for comparison, here's what fits with @example (10pt):
2346 % 8.5x11=71 smallbook=60 a4=75 a5=58
2347 % --karl, 24jan03.
2348
2349 % Set up the default fonts, so we can use them for creating boxes.
2350 %
2351 \definetextfontsizexi
2352
2353
2354 \message{markup,}
2355
2356 % Check if we are currently using a typewriter font. Since all the
2357 % Computer Modern typewriter fonts have zero interword stretch (and
2358 % shrink), and it is reasonable to expect all typewriter fonts to have
2359 % this property, we can check that font parameter.
2360 %
2361 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2362
2363 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2364 % define and register \INITMACRO to be called on markup style changes.
2365 % \INITMACRO can check \currentmarkupstyle for the innermost
2366 % style and the set of \ifmarkupSTYLE switches for all styles
2367 % currently in effect.
2368 \newif\ifmarkupvar
2369 \newif\ifmarkupsamp
2370 \newif\ifmarkupkey
2371 %\newif\ifmarkupfile % @file == @samp.
2372 %\newif\ifmarkupoption % @option == @samp.
2373 \newif\ifmarkupcode
2374 \newif\ifmarkupkbd
2375 %\newif\ifmarkupenv % @env == @code.
2376 %\newif\ifmarkupcommand % @command == @code.
2377 \newif\ifmarkuptex % @tex (and part of @math, for now).
2378 \newif\ifmarkupexample
2379 \newif\ifmarkupverb
2380 \newif\ifmarkupverbatim
2381
2382 \let\currentmarkupstyle\empty
2383
2384 \def\setupmarkupstyle#1{%
2385 \csname markup#1true\endcsname
2386 \def\currentmarkupstyle{#1}%
2387 \markupstylesetup
2388 }
2389
2390 \let\markupstylesetup\empty
2391
2392 \def\defmarkupstylesetup#1{%
2393 \expandafter\def\expandafter\markupstylesetup
2394 \expandafter{\markupstylesetup #1}%
2395 \def#1%
2396 }
2397
2398 % Markup style setup for left and right quotes.
2399 \defmarkupstylesetup\markupsetuplq{%
2400 \expandafter\let\expandafter \temp
2401 \csname markupsetuplq\currentmarkupstyle\endcsname
2402 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2403 }
2404
2405 \defmarkupstylesetup\markupsetuprq{%
2406 \expandafter\let\expandafter \temp
2407 \csname markupsetuprq\currentmarkupstyle\endcsname
2408 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2409 }
2410
2411 {
2412 \catcode`\'=\active
2413 \catcode`\`=\active
2414
2415 \gdef\markupsetuplqdefault{\let`\lq}
2416 \gdef\markupsetuprqdefault{\let'\rq}
2417
2418 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2419 \gdef\markupsetcodequoteright{\let'\codequoteright}
2420 }
2421
2422 \let\markupsetuplqcode \markupsetcodequoteleft
2423 \let\markupsetuprqcode \markupsetcodequoteright
2424 %
2425 \let\markupsetuplqexample \markupsetcodequoteleft
2426 \let\markupsetuprqexample \markupsetcodequoteright
2427 %
2428 \let\markupsetuplqkbd \markupsetcodequoteleft
2429 \let\markupsetuprqkbd \markupsetcodequoteright
2430 %
2431 \let\markupsetuplqsamp \markupsetcodequoteleft
2432 \let\markupsetuprqsamp \markupsetcodequoteright
2433 %
2434 \let\markupsetuplqverb \markupsetcodequoteleft
2435 \let\markupsetuprqverb \markupsetcodequoteright
2436 %
2437 \let\markupsetuplqverbatim \markupsetcodequoteleft
2438 \let\markupsetuprqverbatim \markupsetcodequoteright
2439
2440 % Allow an option to not use regular directed right quote/apostrophe
2441 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2442 % The undirected quote is ugly, so don't make it the default, but it
2443 % works for pasting with more pdf viewers (at least evince), the
2444 % lilypond developers report. xpdf does work with the regular 0x27.
2445 %
2446 \def\codequoteright{%
2447 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2448 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2449 '%
2450 \else \char'15 \fi
2451 \else \char'15 \fi
2452 }
2453 %
2454 % and a similar option for the left quote char vs. a grave accent.
2455 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2456 % the code environments to do likewise.
2457 %
2458 \def\codequoteleft{%
2459 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2460 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2461 % [Knuth] pp. 380,381,391
2462 % \relax disables Spanish ligatures ?` and !` of \tt font.
2463 \relax`%
2464 \else \char'22 \fi
2465 \else \char'22 \fi
2466 }
2467
2468 % Commands to set the quote options.
2469 %
2470 \parseargdef\codequoteundirected{%
2471 \def\temp{#1}%
2472 \ifx\temp\onword
2473 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2474 = t%
2475 \else\ifx\temp\offword
2476 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2477 = \relax
2478 \else
2479 \errhelp = \EMsimple
2480 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2481 \fi\fi
2482 }
2483 %
2484 \parseargdef\codequotebacktick{%
2485 \def\temp{#1}%
2486 \ifx\temp\onword
2487 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2488 = t%
2489 \else\ifx\temp\offword
2490 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2491 = \relax
2492 \else
2493 \errhelp = \EMsimple
2494 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2495 \fi\fi
2496 }
2497
2498 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2499 \def\noligaturesquoteleft{\relax\lq}
2500
2501 % Count depth in font-changes, for error checks
2502 \newcount\fontdepth \fontdepth=0
2503
2504 % Font commands.
2505
2506 % #1 is the font command (\sl or \it), #2 is the text to slant.
2507 % If we are in a monospaced environment, however, 1) always use \ttsl,
2508 % and 2) do not add an italic correction.
2509 \def\dosmartslant#1#2{%
2510 \ifusingtt
2511 {{\ttsl #2}\let\next=\relax}%
2512 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2513 \next
2514 }
2515 \def\smartslanted{\dosmartslant\sl}
2516 \def\smartitalic{\dosmartslant\it}
2517
2518 % Output an italic correction unless \next (presumed to be the following
2519 % character) is such as not to need one.
2520 \def\smartitaliccorrection{%
2521 \ifx\next,%
2522 \else\ifx\next-%
2523 \else\ifx\next.%
2524 \else\ifx\next\.%
2525 \else\ifx\next\comma%
2526 \else\ptexslash
2527 \fi\fi\fi\fi\fi
2528 \aftersmartic
2529 }
2530
2531 % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2532 \def\ttslanted#1{{\ttsl #1}}
2533
2534 % @cite is like \smartslanted except unconditionally use \sl. We never want
2535 % ttsl for book titles, do we?
2536 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2537
2538 \def\aftersmartic{}
2539 \def\var#1{%
2540 \let\saveaftersmartic = \aftersmartic
2541 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2542 \smartslanted{#1}%
2543 }
2544
2545 \let\i=\smartitalic
2546 \let\slanted=\smartslanted
2547 \let\dfn=\smartslanted
2548 \let\emph=\smartitalic
2549
2550 % Explicit font changes: @r, @sc, undocumented @ii.
2551 \def\r#1{{\rm #1}} % roman font
2552 \def\sc#1{{\smallcaps#1}} % smallcaps font
2553 \def\ii#1{{\it #1}} % italic font
2554
2555 % @b, explicit bold. Also @strong.
2556 \def\b#1{{\bf #1}}
2557 \let\strong=\b
2558
2559 % @sansserif, explicit sans.
2560 \def\sansserif#1{{\sf #1}}
2561
2562 % We can't just use \exhyphenpenalty, because that only has effect at
2563 % the end of a paragraph. Restore normal hyphenation at the end of the
2564 % group within which \nohyphenation is presumably called.
2565 %
2566 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2567 \def\restorehyphenation{\hyphenchar\font = `- }
2568
2569 % Set sfcode to normal for the chars that usually have another value.
2570 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2571 % sometimes \x has an active definition that messes things up.
2572 %
2573 \catcode`@=11
2574 \def\plainfrenchspacing{%
2575 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2576 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2577 \def\endofsentencespacefactor{1000}% for @. and friends
2578 }
2579 \def\plainnonfrenchspacing{%
2580 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2581 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2582 \def\endofsentencespacefactor{3000}% for @. and friends
2583 }
2584 \catcode`@=\other
2585 \def\endofsentencespacefactor{3000}% default
2586
2587 % @t, explicit typewriter.
2588 \def\t#1{%
2589 {\tt \rawbackslash \plainfrenchspacing #1}%
2590 \null
2591 }
2592
2593 % @samp.
2594 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2595
2596 % @indicateurl is \samp, that is, with quotes.
2597 \let\indicateurl=\samp
2598
2599 % @code (and similar) prints in typewriter, but with spaces the same
2600 % size as normal in the surrounding text, without hyphenation, etc.
2601 % This is a subroutine for that.
2602 \def\tclose#1{%
2603 {%
2604 % Change normal interword space to be same as for the current font.
2605 \spaceskip = \fontdimen2\font
2606 %
2607 % Switch to typewriter.
2608 \tt
2609 %
2610 % But `\ ' produces the large typewriter interword space.
2611 \def\ {{\spaceskip = 0pt{} }}%
2612 %
2613 % Turn off hyphenation.
2614 \nohyphenation
2615 %
2616 \rawbackslash
2617 \plainfrenchspacing
2618 #1%
2619 }%
2620 \null % reset spacefactor to 1000
2621 }
2622
2623 % We *must* turn on hyphenation at `-' and `_' in @code.
2624 % (But see \codedashfinish below.)
2625 % Otherwise, it is too hard to avoid overfull hboxes
2626 % in the Emacs manual, the Library manual, etc.
2627 %
2628 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2629 % both hyphenation at - and hyphenation within words.
2630 % We must therefore turn them both off (\tclose does that)
2631 % and arrange explicitly to hyphenate at a dash. -- rms.
2632 {
2633 \catcode`\-=\active \catcode`\_=\active
2634 \catcode`\'=\active \catcode`\`=\active
2635 \global\let'=\rq \global\let`=\lq % default definitions
2636 %
2637 \global\def\code{\begingroup
2638 \setupmarkupstyle{code}%
2639 % The following should really be moved into \setupmarkupstyle handlers.
2640 \catcode\dashChar=\active \catcode\underChar=\active
2641 \ifallowcodebreaks
2642 \let-\codedash
2643 \let_\codeunder
2644 \else
2645 \let-\normaldash
2646 \let_\realunder
2647 \fi
2648 % Given -foo (with a single dash), we do not want to allow a break
2649 % after the hyphen.
2650 \global\let\codedashprev=\codedash
2651 %
2652 \codex
2653 }
2654 %
2655 \gdef\codedash{\futurelet\next\codedashfinish}
2656 \gdef\codedashfinish{%
2657 \normaldash % always output the dash character itself.
2658 %
2659 % Now, output a discretionary to allow a line break, unless
2660 % (a) the next character is a -, or
2661 % (b) the preceding character is a -.
2662 % E.g., given --posix, we do not want to allow a break after either -.
2663 % Given --foo-bar, we do want to allow a break between the - and the b.
2664 \ifx\next\codedash \else
2665 \ifx\codedashprev\codedash
2666 \else \discretionary{}{}{}\fi
2667 \fi
2668 % we need the space after the = for the case when \next itself is a
2669 % space token; it would get swallowed otherwise. As in @code{- a}.
2670 \global\let\codedashprev= \next
2671 }
2672 }
2673 \def\normaldash{-}
2674 %
2675 \def\codex #1{\tclose{#1}\endgroup}
2676
2677 \def\codeunder{%
2678 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2679 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2680 % will therefore expand the active definition of _, which is us
2681 % (inside @code that is), therefore an endless loop.
2682 \ifusingtt{\ifmmode
2683 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2684 \else\normalunderscore \fi
2685 \discretionary{}{}{}}%
2686 {\_}%
2687 }
2688
2689 % An additional complication: the above will allow breaks after, e.g.,
2690 % each of the four underscores in __typeof__. This is bad.
2691 % @allowcodebreaks provides a document-level way to turn breaking at -
2692 % and _ on and off.
2693 %
2694 \newif\ifallowcodebreaks \allowcodebreakstrue
2695
2696 \def\keywordtrue{true}
2697 \def\keywordfalse{false}
2698
2699 \parseargdef\allowcodebreaks{%
2700 \def\txiarg{#1}%
2701 \ifx\txiarg\keywordtrue
2702 \allowcodebreakstrue
2703 \else\ifx\txiarg\keywordfalse
2704 \allowcodebreaksfalse
2705 \else
2706 \errhelp = \EMsimple
2707 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2708 \fi\fi
2709 }
2710
2711 % For @command, @env, @file, @option quotes seem unnecessary,
2712 % so use \code rather than \samp.
2713 \let\command=\code
2714 \let\env=\code
2715 \let\file=\code
2716 \let\option=\code
2717
2718 % @uref (abbreviation for `urlref') aka @url takes an optional
2719 % (comma-separated) second argument specifying the text to display and
2720 % an optional third arg as text to display instead of (rather than in
2721 % addition to) the url itself. First (mandatory) arg is the url.
2722
2723 % TeX-only option to allow changing PDF output to show only the second
2724 % arg (if given), and not the url (which is then just the link target).
2725 \newif\ifurefurlonlylink
2726
2727 % The main macro is \urefbreak, which allows breaking at expected
2728 % places within the url. (There used to be another version, which
2729 % didn't support automatic breaking.)
2730 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2731 \let\uref=\urefbreak
2732 %
2733 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2734 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2735 \unsepspaces
2736 \pdfurl{#1}%
2737 \setbox0 = \hbox{\ignorespaces #3}%
2738 \ifdim\wd0 > 0pt
2739 \unhbox0 % third arg given, show only that
2740 \else
2741 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
2742 \ifdim\wd0 > 0pt
2743 \ifpdf
2744 \ifurefurlonlylink
2745 % PDF plus option to not display url, show just arg
2746 \unhbox0
2747 \else
2748 % PDF, normally display both arg and url for consistency,
2749 % visibility, if the pdf is eventually used to print, etc.
2750 \unhbox0\ (\urefcode{#1})%
2751 \fi
2752 \else
2753 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
2754 \fi
2755 \else
2756 \urefcode{#1}% only url given, so show it
2757 \fi
2758 \fi
2759 \endlink
2760 \endgroup}
2761
2762 % Allow line breaks around only a few characters (only).
2763 \def\urefcatcodes{%
2764 \catcode`\&=\active \catcode`\.=\active
2765 \catcode`\#=\active \catcode`\?=\active
2766 \catcode`\/=\active
2767 }
2768 {
2769 \urefcatcodes
2770 %
2771 \global\def\urefcode{\begingroup
2772 \setupmarkupstyle{code}%
2773 \urefcatcodes
2774 \let&\urefcodeamp
2775 \let.\urefcodedot
2776 \let#\urefcodehash
2777 \let?\urefcodequest
2778 \let/\urefcodeslash
2779 \codex
2780 }
2781 %
2782 % By default, they are just regular characters.
2783 \global\def&{\normalamp}
2784 \global\def.{\normaldot}
2785 \global\def#{\normalhash}
2786 \global\def?{\normalquest}
2787 \global\def/{\normalslash}
2788 }
2789
2790 % we put a little stretch before and after the breakable chars, to help
2791 % line breaking of long url's. The unequal skips make look better in
2792 % cmtt at least, especially for dots.
2793 \def\urefprestretchamount{.13em}
2794 \def\urefpoststretchamount{.1em}
2795 \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
2796 \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
2797 %
2798 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2799 \def\urefcodedot{\urefprestretch .\urefpoststretch}
2800 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
2801 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
2802 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2803 {
2804 \catcode`\/=\active
2805 \global\def\urefcodeslashfinish{%
2806 \urefprestretch \slashChar
2807 % Allow line break only after the final / in a sequence of
2808 % slashes, to avoid line break between the slashes in http://.
2809 \ifx\next/\else \urefpoststretch \fi
2810 }
2811 }
2812
2813 % One more complication: by default we'll break after the special
2814 % characters, but some people like to break before the special chars, so
2815 % allow that. Also allow no breaking at all, for manual control.
2816 %
2817 \parseargdef\urefbreakstyle{%
2818 \def\txiarg{#1}%
2819 \ifx\txiarg\wordnone
2820 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2821 \else\ifx\txiarg\wordbefore
2822 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2823 \else\ifx\txiarg\wordafter
2824 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2825 \else
2826 \errhelp = \EMsimple
2827 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2828 \fi\fi\fi
2829 }
2830 \def\wordafter{after}
2831 \def\wordbefore{before}
2832 \def\wordnone{none}
2833
2834 \urefbreakstyle after
2835
2836 % @url synonym for @uref, since that's how everyone uses it.
2837 %
2838 \let\url=\uref
2839
2840 % rms does not like angle brackets --karl, 17may97.
2841 % So now @email is just like @uref, unless we are pdf.
2842 %
2843 %\def\email#1{\angleleft{\tt #1}\angleright}
2844 \ifpdf
2845 \def\email#1{\doemail#1,,\finish}
2846 \def\doemail#1,#2,#3\finish{\begingroup
2847 \unsepspaces
2848 \pdfurl{mailto:#1}%
2849 \setbox0 = \hbox{\ignorespaces #2}%
2850 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2851 \endlink
2852 \endgroup}
2853 \else
2854 \let\email=\uref
2855 \fi
2856
2857 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2858 % `example' (@kbd uses ttsl only inside of @example and friends),
2859 % or `code' (@kbd uses normal tty font always).
2860 \parseargdef\kbdinputstyle{%
2861 \def\txiarg{#1}%
2862 \ifx\txiarg\worddistinct
2863 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2864 \else\ifx\txiarg\wordexample
2865 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2866 \else\ifx\txiarg\wordcode
2867 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2868 \else
2869 \errhelp = \EMsimple
2870 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2871 \fi\fi\fi
2872 }
2873 \def\worddistinct{distinct}
2874 \def\wordexample{example}
2875 \def\wordcode{code}
2876
2877 % Default is `distinct'.
2878 \kbdinputstyle distinct
2879
2880 % @kbd is like @code, except that if the argument is just one @key command,
2881 % then @kbd has no effect.
2882 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
2883
2884 \def\xkey{\key}
2885 \def\kbdsub#1#2#3\par{%
2886 \def\one{#1}\def\three{#3}\def\threex{??}%
2887 \ifx\one\xkey\ifx\threex\three \key{#2}%
2888 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2889 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2890 }
2891
2892 % definition of @key that produces a lozenge. Doesn't adjust to text size.
2893 %\setfont\keyrm\rmshape{8}{1000}{OT1}
2894 %\font\keysy=cmsy9
2895 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2896 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2897 % \vbox{\hrule\kern-0.4pt
2898 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2899 % \kern-0.4pt\hrule}%
2900 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2901
2902 % definition of @key with no lozenge. If the current font is already
2903 % monospace, don't change it; that way, we respect @kbdinputstyle. But
2904 % if it isn't monospace, then use \tt.
2905 %
2906 \def\key#1{{\setupmarkupstyle{key}%
2907 \nohyphenation
2908 \ifmonospace\else\tt\fi
2909 #1}\null}
2910
2911 % @clicksequence{File @click{} Open ...}
2912 \def\clicksequence#1{\begingroup #1\endgroup}
2913
2914 % @clickstyle @arrow (by default)
2915 \parseargdef\clickstyle{\def\click{#1}}
2916 \def\click{\arrow}
2917
2918 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2919 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2920 %
2921 \def\dmn#1{\thinspace #1}
2922
2923 % @acronym for "FBI", "NATO", and the like.
2924 % We print this one point size smaller, since it's intended for
2925 % all-uppercase.
2926 %
2927 \def\acronym#1{\doacronym #1,,\finish}
2928 \def\doacronym#1,#2,#3\finish{%
2929 {\selectfonts\lsize #1}%
2930 \def\temp{#2}%
2931 \ifx\temp\empty \else
2932 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2933 \fi
2934 \null % reset \spacefactor=1000
2935 }
2936
2937 % @abbr for "Comput. J." and the like.
2938 % No font change, but don't do end-of-sentence spacing.
2939 %
2940 \def\abbr#1{\doabbr #1,,\finish}
2941 \def\doabbr#1,#2,#3\finish{%
2942 {\plainfrenchspacing #1}%
2943 \def\temp{#2}%
2944 \ifx\temp\empty \else
2945 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2946 \fi
2947 \null % reset \spacefactor=1000
2948 }
2949
2950 % @asis just yields its argument. Used with @table, for example.
2951 %
2952 \def\asis#1{#1}
2953
2954 % @math outputs its argument in math mode.
2955 %
2956 % One complication: _ usually means subscripts, but it could also mean
2957 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
2958 % _ active, and distinguish by seeing if the current family is \slfam,
2959 % which is what @var uses.
2960 {
2961 \catcode`\_ = \active
2962 \gdef\mathunderscore{%
2963 \catcode`\_=\active
2964 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2965 }
2966 }
2967 % Another complication: we want \\ (and @\) to output a math (or tt) \.
2968 % FYI, plain.tex uses \\ as a temporary control sequence (for no
2969 % particular reason), but this is not advertised and we don't care.
2970 %
2971 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2972 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2973 %
2974 \def\math{%
2975 \ifmmode\else % only go into math if not in math mode already
2976 \tex
2977 \mathunderscore
2978 \let\\ = \mathbackslash
2979 \mathactive
2980 % make the texinfo accent commands work in math mode
2981 \let\"=\ddot
2982 \let\'=\acute
2983 \let\==\bar
2984 \let\^=\hat
2985 \let\`=\grave
2986 \let\u=\breve
2987 \let\v=\check
2988 \let\~=\tilde
2989 \let\dotaccent=\dot
2990 % have to provide another name for sup operator
2991 \let\mathopsup=\sup
2992 $\expandafter\finishmath\fi
2993 }
2994 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
2995
2996 % Some active characters (such as <) are spaced differently in math.
2997 % We have to reset their definitions in case the @math was an argument
2998 % to a command which sets the catcodes (such as @item or @section).
2999 %
3000 {
3001 \catcode`^ = \active
3002 \catcode`< = \active
3003 \catcode`> = \active
3004 \catcode`+ = \active
3005 \catcode`' = \active
3006 \gdef\mathactive{%
3007 \let^ = \ptexhat
3008 \let< = \ptexless
3009 \let> = \ptexgtr
3010 \let+ = \ptexplus
3011 \let' = \ptexquoteright
3012 }
3013 }
3014
3015 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3016 % If in text, use math to place as sub/superscript, but switch
3017 % into text mode, with smaller fonts. This is a different font than the
3018 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3019 % fix it (significant additions to font machinery) until someone notices.
3020 %
3021 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3022 \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
3023 %
3024 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3025 \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
3026
3027 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3028 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3029 % except specified as a normal braced arg, so no newlines to worry about.
3030 %
3031 \def\outfmtnametex{tex}
3032 %
3033 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3034 \long\def\doinlinefmt#1,#2,\finish{%
3035 \def\inlinefmtname{#1}%
3036 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3037 }
3038 %
3039 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3040 % FMTNAME is tex, else ELSE-TEXT.
3041 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3042 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3043 \def\inlinefmtname{#1}%
3044 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3045 }
3046 %
3047 % For raw, must switch into @tex before parsing the argument, to avoid
3048 % setting catcodes prematurely. Doing it this way means that, for
3049 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3050 % ignored. But this isn't important because if people want a literal
3051 % *right* brace they would have to use a command anyway, so they may as
3052 % well use a command to get a left brace too. We could re-use the
3053 % delimiter character idea from \verb, but it seems like overkill.
3054 %
3055 \long\def\inlineraw{\tex \doinlineraw}
3056 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3057 \def\doinlinerawtwo#1,#2,\finish{%
3058 \def\inlinerawname{#1}%
3059 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3060 \endgroup % close group opened by \tex.
3061 }
3062
3063 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3064 %
3065 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3066 \long\def\doinlineifset#1,#2,\finish{%
3067 \def\inlinevarname{#1}%
3068 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3069 \else\ignorespaces#2\fi
3070 }
3071
3072 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3073 %
3074 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3075 \long\def\doinlineifclear#1,#2,\finish{%
3076 \def\inlinevarname{#1}%
3077 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3078 }
3079
3080
3081 \message{glyphs,}
3082 % and logos.
3083
3084 % @@ prints an @, as does @atchar{}.
3085 \def\@{\char64 }
3086 \let\atchar=\@
3087
3088 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3089 % Unless we're in typewriter, use \ecfont because the CM text fonts do
3090 % not have braces, and we don't want to switch into math.
3091 \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
3092 \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
3093 \let\{=\mylbrace \let\lbracechar=\{
3094 \let\}=\myrbrace \let\rbracechar=\}
3095 \begingroup
3096 % Definitions to produce \{ and \} commands for indices,
3097 % and @{ and @} for the aux/toc files.
3098 \catcode`\{ = \other \catcode`\} = \other
3099 \catcode`\[ = 1 \catcode`\] = 2
3100 \catcode`\! = 0 \catcode`\\ = \other
3101 !gdef!lbracecmd[\{]%
3102 !gdef!rbracecmd[\}]%
3103 !gdef!lbraceatcmd[@{]%
3104 !gdef!rbraceatcmd[@}]%
3105 !endgroup
3106
3107 % @comma{} to avoid , parsing problems.
3108 \let\comma = ,
3109
3110 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3111 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3112 \let\, = \ptexc
3113 \let\dotaccent = \ptexdot
3114 \def\ringaccent#1{{\accent23 #1}}
3115 \let\tieaccent = \ptext
3116 \let\ubaraccent = \ptexb
3117 \let\udotaccent = \d
3118
3119 % Other special characters: @questiondown @exclamdown @ordf @ordm
3120 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3121 \def\questiondown{?`}
3122 \def\exclamdown{!`}
3123 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
3124 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
3125
3126 % Dotless i and dotless j, used for accents.
3127 \def\imacro{i}
3128 \def\jmacro{j}
3129 \def\dotless#1{%
3130 \def\temp{#1}%
3131 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3132 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3133 \else \errmessage{@dotless can be used only with i or j}%
3134 \fi\fi
3135 }
3136
3137 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3138 % period following counts as ending a sentence. (Idea found in latex.)
3139 %
3140 \edef\TeX{\TeX \spacefactor=1000 }
3141
3142 % @LaTeX{} logo. Not quite the same results as the definition in
3143 % latex.ltx, since we use a different font for the raised A; it's most
3144 % convenient for us to use an explicitly smaller font, rather than using
3145 % the \scriptstyle font (since we don't reset \scriptstyle and
3146 % \scriptscriptstyle).
3147 %
3148 \def\LaTeX{%
3149 L\kern-.36em
3150 {\setbox0=\hbox{T}%
3151 \vbox to \ht0{\hbox{%
3152 \ifx\textnominalsize\xwordpt
3153 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
3154 % Revert to plain's \scriptsize, which is 7pt.
3155 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3156 \else
3157 % For 11pt, we can use our lllsize.
3158 \selectfonts\lllsize A%
3159 \fi
3160 }%
3161 \vss
3162 }}%
3163 \kern-.15em
3164 \TeX
3165 }
3166
3167 % Some math mode symbols. Define \ensuremath to switch into math mode
3168 % unless we are already there. Expansion tricks may not be needed here,
3169 % but safer, and can't hurt.
3170 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3171 \def\ensuredmath#1{$\relax#1$}
3172 %
3173 \def\bullet{\ensuremath\ptexbullet}
3174 \def\geq{\ensuremath\ge}
3175 \def\leq{\ensuremath\le}
3176 \def\minus{\ensuremath-}
3177
3178 % @dots{} outputs an ellipsis using the current font.
3179 % We do .5em per period so that it has the same spacing in the cm
3180 % typewriter fonts as three actual period characters; on the other hand,
3181 % in other typewriter fonts three periods are wider than 1.5em. So do
3182 % whichever is larger.
3183 %
3184 \def\dots{%
3185 \leavevmode
3186 \setbox0=\hbox{...}% get width of three periods
3187 \ifdim\wd0 > 1.5em
3188 \dimen0 = \wd0
3189 \else
3190 \dimen0 = 1.5em
3191 \fi
3192 \hbox to \dimen0{%
3193 \hskip 0pt plus.25fil
3194 .\hskip 0pt plus1fil
3195 .\hskip 0pt plus1fil
3196 .\hskip 0pt plus.5fil
3197 }%
3198 }
3199
3200 % @enddots{} is an end-of-sentence ellipsis.
3201 %
3202 \def\enddots{%
3203 \dots
3204 \spacefactor=\endofsentencespacefactor
3205 }
3206
3207 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3208 %
3209 % Since these characters are used in examples, they should be an even number of
3210 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3211 %
3212 \def\point{$\star$}
3213 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3214 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3215 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3216 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3217 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3218
3219 % The @error{} command.
3220 % Adapted from the TeXbook's \boxit.
3221 %
3222 \newbox\errorbox
3223 %
3224 {\tentt \global\dimen0 = 3em}% Width of the box.
3225 \dimen2 = .55pt % Thickness of rules
3226 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3227 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3228 %
3229 \setbox\errorbox=\hbox to \dimen0{\hfil
3230 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3231 \advance\hsize by -2\dimen2 % Rules.
3232 \vbox{%
3233 \hrule height\dimen2
3234 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3235 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3236 \kern3pt\vrule width\dimen2}% Space to right.
3237 \hrule height\dimen2}
3238 \hfil}
3239 %
3240 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3241
3242 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3243 %
3244 \def\pounds{{\it\$}}
3245
3246 % @euro{} comes from a separate font, depending on the current style.
3247 % We use the free feym* fonts from the eurosym package by Henrik
3248 % Theiling, which support regular, slanted, bold and bold slanted (and
3249 % "outlined" (blackboard board, sort of) versions, which we don't need).
3250 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3251 %
3252 % Although only regular is the truly official Euro symbol, we ignore
3253 % that. The Euro is designed to be slightly taller than the regular
3254 % font height.
3255 %
3256 % feymr - regular
3257 % feymo - slanted
3258 % feybr - bold
3259 % feybo - bold slanted
3260 %
3261 % There is no good (free) typewriter version, to my knowledge.
3262 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3263 % Hmm.
3264 %
3265 % Also doesn't work in math. Do we need to do math with euro symbols?
3266 % Hope not.
3267 %
3268 %
3269 \def\euro{{\eurofont e}}
3270 \def\eurofont{%
3271 % We set the font at each command, rather than predefining it in
3272 % \textfonts and the other font-switching commands, so that
3273 % installations which never need the symbol don't have to have the
3274 % font installed.
3275 %
3276 % There is only one designed size (nominal 10pt), so we always scale
3277 % that to the current nominal size.
3278 %
3279 % By the way, simply using "at 1em" works for cmr10 and the like, but
3280 % does not work for cmbx10 and other extended/shrunken fonts.
3281 %
3282 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3283 %
3284 \ifx\curfontstyle\bfstylename
3285 % bold:
3286 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3287 \else
3288 % regular:
3289 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3290 \fi
3291 \thiseurofont
3292 }
3293
3294 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3295 % sometimes we redefine the original macro, and the alias should reflect
3296 % the redefinition.
3297 %
3298 % Use LaTeX names for the Icelandic letters.
3299 \def\DH{{\ecfont \char"D0}} % Eth
3300 \def\dh{{\ecfont \char"F0}} % eth
3301 \def\TH{{\ecfont \char"DE}} % Thorn
3302 \def\th{{\ecfont \char"FE}} % thorn
3303 %
3304 \def\guillemetleft{{\ecfont \char"13}}
3305 \def\guillemotleft{\guillemetleft}
3306 \def\guillemetright{{\ecfont \char"14}}
3307 \def\guillemotright{\guillemetright}
3308 \def\guilsinglleft{{\ecfont \char"0E}}
3309 \def\guilsinglright{{\ecfont \char"0F}}
3310 \def\quotedblbase{{\ecfont \char"12}}
3311 \def\quotesinglbase{{\ecfont \char"0D}}
3312 %
3313 % This positioning is not perfect (see the ogonek LaTeX package), but
3314 % we have the precomposed glyphs for the most common cases. We put the
3315 % tests to use those glyphs in the single \ogonek macro so we have fewer
3316 % dummy definitions to worry about for index entries, etc.
3317 %
3318 % ogonek is also used with other letters in Lithuanian (IOU), but using
3319 % the precomposed glyphs for those is not so easy since they aren't in
3320 % the same EC font.
3321 \def\ogonek#1{{%
3322 \def\temp{#1}%
3323 \ifx\temp\macrocharA\Aogonek
3324 \else\ifx\temp\macrochara\aogonek
3325 \else\ifx\temp\macrocharE\Eogonek
3326 \else\ifx\temp\macrochare\eogonek
3327 \else
3328 \ecfont \setbox0=\hbox{#1}%
3329 \ifdim\ht0=1ex\accent"0C #1%
3330 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3331 \fi
3332 \fi\fi\fi\fi
3333 }%
3334 }
3335 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3336 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3337 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3338 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3339 %
3340 % Use the European Computer Modern fonts (cm-super in outline format)
3341 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3342 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3343 % package and follow the same conventions.
3344 %
3345 \def\ecfont{\etcfont{e}}
3346 \def\tcfont{\etcfont{t}}
3347 %
3348 \def\etcfont#1{%
3349 % We can't distinguish serif/sans and italic/slanted, but this
3350 % is used for crude hacks anyway (like adding French and German
3351 % quotes to documents typeset with CM, where we lose kerning), so
3352 % hopefully nobody will notice/care.
3353 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3354 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3355 \ifmonospace
3356 % typewriter:
3357 \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3358 \else
3359 \ifx\curfontstyle\bfstylename
3360 % bold:
3361 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3362 \else
3363 % regular:
3364 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3365 \fi
3366 \fi
3367 \thisecfont
3368 }
3369
3370 % @registeredsymbol - R in a circle. The font for the R should really
3371 % be smaller yet, but lllsize is the best we can do for now.
3372 % Adapted from the plain.tex definition of \copyright.
3373 %
3374 \def\registeredsymbol{%
3375 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3376 \hfil\crcr\Orb}}%
3377 }$%
3378 }
3379
3380 % @textdegree - the normal degrees sign.
3381 %
3382 \def\textdegree{$^\circ$}
3383
3384 % Laurent Siebenmann reports \Orb undefined with:
3385 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3386 % so we'll define it if necessary.
3387 %
3388 \ifx\Orb\thisisundefined
3389 \def\Orb{\mathhexbox20D}
3390 \fi
3391
3392 % Quotes.
3393 \chardef\quotedblleft="5C
3394 \chardef\quotedblright=`\"
3395 \chardef\quoteleft=`\`
3396 \chardef\quoteright=`\'
3397
3398
3399 \message{page headings,}
3400
3401 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3402 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3403
3404 % First the title page. Must do @settitle before @titlepage.
3405 \newif\ifseenauthor
3406 \newif\iffinishedtitlepage
3407
3408 % Do an implicit @contents or @shortcontents after @end titlepage if the
3409 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
3410 %
3411 \newif\ifsetcontentsaftertitlepage
3412 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3413 \newif\ifsetshortcontentsaftertitlepage
3414 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3415
3416 \parseargdef\shorttitlepage{%
3417 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3418 \endgroup\page\hbox{}\page}
3419
3420 \envdef\titlepage{%
3421 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3422 \begingroup
3423 \parindent=0pt \textfonts
3424 % Leave some space at the very top of the page.
3425 \vglue\titlepagetopglue
3426 % No rule at page bottom unless we print one at the top with @title.
3427 \finishedtitlepagetrue
3428 %
3429 % Most title ``pages'' are actually two pages long, with space
3430 % at the top of the second. We don't want the ragged left on the second.
3431 \let\oldpage = \page
3432 \def\page{%
3433 \iffinishedtitlepage\else
3434 \finishtitlepage
3435 \fi
3436 \let\page = \oldpage
3437 \page
3438 \null
3439 }%
3440 }
3441
3442 \def\Etitlepage{%
3443 \iffinishedtitlepage\else
3444 \finishtitlepage
3445 \fi
3446 % It is important to do the page break before ending the group,
3447 % because the headline and footline are only empty inside the group.
3448 % If we use the new definition of \page, we always get a blank page
3449 % after the title page, which we certainly don't want.
3450 \oldpage
3451 \endgroup
3452 %
3453 % Need this before the \...aftertitlepage checks so that if they are
3454 % in effect the toc pages will come out with page numbers.
3455 \HEADINGSon
3456 %
3457 % If they want short, they certainly want long too.
3458 \ifsetshortcontentsaftertitlepage
3459 \shortcontents
3460 \contents
3461 \global\let\shortcontents = \relax
3462 \global\let\contents = \relax
3463 \fi
3464 %
3465 \ifsetcontentsaftertitlepage
3466 \contents
3467 \global\let\contents = \relax
3468 \global\let\shortcontents = \relax
3469 \fi
3470 }
3471
3472 \def\finishtitlepage{%
3473 \vskip4pt \hrule height 2pt width \hsize
3474 \vskip\titlepagebottomglue
3475 \finishedtitlepagetrue
3476 }
3477
3478 % Settings used for typesetting titles: no hyphenation, no indentation,
3479 % don't worry much about spacing, ragged right. This should be used
3480 % inside a \vbox, and fonts need to be set appropriately first. Because
3481 % it is always used for titles, nothing else, we call \rmisbold. \par
3482 % should be specified before the end of the \vbox, since a vbox is a group.
3483 %
3484 \def\raggedtitlesettings{%
3485 \rmisbold
3486 \hyphenpenalty=10000
3487 \parindent=0pt
3488 \tolerance=5000
3489 \ptexraggedright
3490 }
3491
3492 % Macros to be used within @titlepage:
3493
3494 \let\subtitlerm=\tenrm
3495 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3496
3497 \parseargdef\title{%
3498 \checkenv\titlepage
3499 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3500 % print a rule at the page bottom also.
3501 \finishedtitlepagefalse
3502 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3503 }
3504
3505 \parseargdef\subtitle{%
3506 \checkenv\titlepage
3507 {\subtitlefont \rightline{#1}}%
3508 }
3509
3510 % @author should come last, but may come many times.
3511 % It can also be used inside @quotation.
3512 %
3513 \parseargdef\author{%
3514 \def\temp{\quotation}%
3515 \ifx\thisenv\temp
3516 \def\quotationauthor{#1}% printed in \Equotation.
3517 \else
3518 \checkenv\titlepage
3519 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3520 {\secfonts\rmisbold \leftline{#1}}%
3521 \fi
3522 }
3523
3524
3525 % Set up page headings and footings.
3526
3527 \let\thispage=\folio
3528
3529 \newtoks\evenheadline % headline on even pages
3530 \newtoks\oddheadline % headline on odd pages
3531 \newtoks\evenfootline % footline on even pages
3532 \newtoks\oddfootline % footline on odd pages
3533
3534 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3535 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3536 \else \the\evenheadline \fi}}
3537 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3538 \else \the\evenfootline \fi}\HEADINGShook}
3539 \let\HEADINGShook=\relax
3540
3541 % Commands to set those variables.
3542 % For example, this is what @headings on does
3543 % @evenheading @thistitle|@thispage|@thischapter
3544 % @oddheading @thischapter|@thispage|@thistitle
3545 % @evenfooting @thisfile||
3546 % @oddfooting ||@thisfile
3547
3548
3549 \def\evenheading{\parsearg\evenheadingxxx}
3550 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3551 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3552 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3553
3554 \def\oddheading{\parsearg\oddheadingxxx}
3555 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3556 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3557 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3558
3559 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3560
3561 \def\evenfooting{\parsearg\evenfootingxxx}
3562 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3563 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3564 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3565
3566 \def\oddfooting{\parsearg\oddfootingxxx}
3567 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3568 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3569 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3570 %
3571 % Leave some space for the footline. Hopefully ok to assume
3572 % @evenfooting will not be used by itself.
3573 \global\advance\pageheight by -12pt
3574 \global\advance\vsize by -12pt
3575 }
3576
3577 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3578
3579 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3580 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3581 %
3582 % The same set of arguments for:
3583 %
3584 % @oddheadingmarks
3585 % @evenfootingmarks
3586 % @oddfootingmarks
3587 % @everyheadingmarks
3588 % @everyfootingmarks
3589
3590 % These define \getoddheadingmarks, \getevenheadingmarks,
3591 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3592 % \gettopheadingmarks, \getbottomheadingmarks.
3593 %
3594 \def\evenheadingmarks{\headingmarks{even}{heading}}
3595 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3596 \def\evenfootingmarks{\headingmarks{even}{footing}}
3597 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3598 \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3599 \headingmarks{odd}{heading}{#1} }
3600 \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3601 \headingmarks{odd}{footing}{#1} }
3602 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3603 \def\headingmarks#1#2#3 {%
3604 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3605 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3606 }
3607
3608 \everyheadingmarks bottom
3609 \everyfootingmarks bottom
3610
3611 % @headings double turns headings on for double-sided printing.
3612 % @headings single turns headings on for single-sided printing.
3613 % @headings off turns them off.
3614 % @headings on same as @headings double, retained for compatibility.
3615 % @headings after turns on double-sided headings after this page.
3616 % @headings doubleafter turns on double-sided headings after this page.
3617 % @headings singleafter turns on single-sided headings after this page.
3618 % By default, they are off at the start of a document,
3619 % and turned `on' after @end titlepage.
3620
3621 \def\headings #1 {\csname HEADINGS#1\endcsname}
3622
3623 \def\headingsoff{% non-global headings elimination
3624 \evenheadline={\hfil}\evenfootline={\hfil}%
3625 \oddheadline={\hfil}\oddfootline={\hfil}%
3626 }
3627
3628 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3629 \HEADINGSoff % it's the default
3630
3631 % When we turn headings on, set the page number to 1.
3632 % For double-sided printing, put current file name in lower left corner,
3633 % chapter name on inside top of right hand pages, document
3634 % title on inside top of left hand pages, and page numbers on outside top
3635 % edge of all pages.
3636 \def\HEADINGSdouble{%
3637 \global\pageno=1
3638 \global\evenfootline={\hfil}
3639 \global\oddfootline={\hfil}
3640 \global\evenheadline={\line{\folio\hfil\thistitle}}
3641 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3642 \global\let\contentsalignmacro = \chapoddpage
3643 }
3644 \let\contentsalignmacro = \chappager
3645
3646 % For single-sided printing, chapter title goes across top left of page,
3647 % page number on top right.
3648 \def\HEADINGSsingle{%
3649 \global\pageno=1
3650 \global\evenfootline={\hfil}
3651 \global\oddfootline={\hfil}
3652 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3653 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3654 \global\let\contentsalignmacro = \chappager
3655 }
3656 \def\HEADINGSon{\HEADINGSdouble}
3657
3658 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3659 \let\HEADINGSdoubleafter=\HEADINGSafter
3660 \def\HEADINGSdoublex{%
3661 \global\evenfootline={\hfil}
3662 \global\oddfootline={\hfil}
3663 \global\evenheadline={\line{\folio\hfil\thistitle}}
3664 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3665 \global\let\contentsalignmacro = \chapoddpage
3666 }
3667
3668 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3669 \def\HEADINGSsinglex{%
3670 \global\evenfootline={\hfil}
3671 \global\oddfootline={\hfil}
3672 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3673 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3674 \global\let\contentsalignmacro = \chappager
3675 }
3676
3677 % Subroutines used in generating headings
3678 % This produces Day Month Year style of output.
3679 % Only define if not already defined, in case a txi-??.tex file has set
3680 % up a different format (e.g., txi-cs.tex does this).
3681 \ifx\today\thisisundefined
3682 \def\today{%
3683 \number\day\space
3684 \ifcase\month
3685 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3686 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3687 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3688 \fi
3689 \space\number\year}
3690 \fi
3691
3692 % @settitle line... specifies the title of the document, for headings.
3693 % It generates no output of its own.
3694 \def\thistitle{\putwordNoTitle}
3695 \def\settitle{\parsearg{\gdef\thistitle}}
3696
3697
3698 \message{tables,}
3699 % Tables -- @table, @ftable, @vtable, @item(x).
3700
3701 % default indentation of table text
3702 \newdimen\tableindent \tableindent=.8in
3703 % default indentation of @itemize and @enumerate text
3704 \newdimen\itemindent \itemindent=.3in
3705 % margin between end of table item and start of table text.
3706 \newdimen\itemmargin \itemmargin=.1in
3707
3708 % used internally for \itemindent minus \itemmargin
3709 \newdimen\itemmax
3710
3711 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3712 % these defs.
3713 % They also define \itemindex
3714 % to index the item name in whatever manner is desired (perhaps none).
3715
3716 \newif\ifitemxneedsnegativevskip
3717
3718 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3719
3720 \def\internalBitem{\smallbreak \parsearg\itemzzz}
3721 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
3722
3723 \def\itemzzz #1{\begingroup %
3724 \advance\hsize by -\rightskip
3725 \advance\hsize by -\tableindent
3726 \setbox0=\hbox{\itemindicate{#1}}%
3727 \itemindex{#1}%
3728 \nobreak % This prevents a break before @itemx.
3729 %
3730 % If the item text does not fit in the space we have, put it on a line
3731 % by itself, and do not allow a page break either before or after that
3732 % line. We do not start a paragraph here because then if the next
3733 % command is, e.g., @kindex, the whatsit would get put into the
3734 % horizontal list on a line by itself, resulting in extra blank space.
3735 \ifdim \wd0>\itemmax
3736 %
3737 % Make this a paragraph so we get the \parskip glue and wrapping,
3738 % but leave it ragged-right.
3739 \begingroup
3740 \advance\leftskip by-\tableindent
3741 \advance\hsize by\tableindent
3742 \advance\rightskip by0pt plus1fil\relax
3743 \leavevmode\unhbox0\par
3744 \endgroup
3745 %
3746 % We're going to be starting a paragraph, but we don't want the
3747 % \parskip glue -- logically it's part of the @item we just started.
3748 \nobreak \vskip-\parskip
3749 %
3750 % Stop a page break at the \parskip glue coming up. However, if
3751 % what follows is an environment such as @example, there will be no
3752 % \parskip glue; then the negative vskip we just inserted would
3753 % cause the example and the item to crash together. So we use this
3754 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3755 % \parskip glue after all. Section titles are handled this way also.
3756 %
3757 \penalty 10001
3758 \endgroup
3759 \itemxneedsnegativevskipfalse
3760 \else
3761 % The item text fits into the space. Start a paragraph, so that the
3762 % following text (if any) will end up on the same line.
3763 \noindent
3764 % Do this with kerns and \unhbox so that if there is a footnote in
3765 % the item text, it can migrate to the main vertical list and
3766 % eventually be printed.
3767 \nobreak\kern-\tableindent
3768 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3769 \unhbox0
3770 \nobreak\kern\dimen0
3771 \endgroup
3772 \itemxneedsnegativevskiptrue
3773 \fi
3774 }
3775
3776 \def\item{\errmessage{@item while not in a list environment}}
3777 \def\itemx{\errmessage{@itemx while not in a list environment}}
3778
3779 % @table, @ftable, @vtable.
3780 \envdef\table{%
3781 \let\itemindex\gobble
3782 \tablecheck{table}%
3783 }
3784 \envdef\ftable{%
3785 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3786 \tablecheck{ftable}%
3787 }
3788 \envdef\vtable{%
3789 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3790 \tablecheck{vtable}%
3791 }
3792 \def\tablecheck#1{%
3793 \ifnum \the\catcode`\^^M=\active
3794 \endgroup
3795 \errmessage{This command won't work in this context; perhaps the problem is
3796 that we are \inenvironment\thisenv}%
3797 \def\next{\doignore{#1}}%
3798 \else
3799 \let\next\tablex
3800 \fi
3801 \next
3802 }
3803 \def\tablex#1{%
3804 \def\itemindicate{#1}%
3805 \parsearg\tabley
3806 }
3807 \def\tabley#1{%
3808 {%
3809 \makevalueexpandable
3810 \edef\temp{\noexpand\tablez #1\space\space\space}%
3811 \expandafter
3812 }\temp \endtablez
3813 }
3814 \def\tablez #1 #2 #3 #4\endtablez{%
3815 \aboveenvbreak
3816 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3817 \ifnum 0#2>0 \tableindent=#2\mil \fi
3818 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3819 \itemmax=\tableindent
3820 \advance \itemmax by -\itemmargin
3821 \advance \leftskip by \tableindent
3822 \exdentamount=\tableindent
3823 \parindent = 0pt
3824 \parskip = \smallskipamount
3825 \ifdim \parskip=0pt \parskip=2pt \fi
3826 \let\item = \internalBitem
3827 \let\itemx = \internalBitemx
3828 }
3829 \def\Etable{\endgraf\afterenvbreak}
3830 \let\Eftable\Etable
3831 \let\Evtable\Etable
3832 \let\Eitemize\Etable
3833 \let\Eenumerate\Etable
3834
3835 % This is the counter used by @enumerate, which is really @itemize
3836
3837 \newcount \itemno
3838
3839 \envdef\itemize{\parsearg\doitemize}
3840
3841 \def\doitemize#1{%
3842 \aboveenvbreak
3843 \itemmax=\itemindent
3844 \advance\itemmax by -\itemmargin
3845 \advance\leftskip by \itemindent
3846 \exdentamount=\itemindent
3847 \parindent=0pt
3848 \parskip=\smallskipamount
3849 \ifdim\parskip=0pt \parskip=2pt \fi
3850 %
3851 % Try typesetting the item mark so that if the document erroneously says
3852 % something like @itemize @samp (intending @table), there's an error
3853 % right away at the @itemize. It's not the best error message in the
3854 % world, but it's better than leaving it to the @item. This means if
3855 % the user wants an empty mark, they have to say @w{} not just @w.
3856 \def\itemcontents{#1}%
3857 \setbox0 = \hbox{\itemcontents}%
3858 %
3859 % @itemize with no arg is equivalent to @itemize @bullet.
3860 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3861 %
3862 \let\item=\itemizeitem
3863 }
3864
3865 % Definition of @item while inside @itemize and @enumerate.
3866 %
3867 \def\itemizeitem{%
3868 \advance\itemno by 1 % for enumerations
3869 {\let\par=\endgraf \smallbreak}% reasonable place to break
3870 {%
3871 % If the document has an @itemize directly after a section title, a
3872 % \nobreak will be last on the list, and \sectionheading will have
3873 % done a \vskip-\parskip. In that case, we don't want to zero
3874 % parskip, or the item text will crash with the heading. On the
3875 % other hand, when there is normal text preceding the item (as there
3876 % usually is), we do want to zero parskip, or there would be too much
3877 % space. In that case, we won't have a \nobreak before. At least
3878 % that's the theory.
3879 \ifnum\lastpenalty<10000 \parskip=0in \fi
3880 \noindent
3881 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3882 %
3883 \ifinner\else
3884 \vadjust{\penalty 1200}% not good to break after first line of item.
3885 \fi
3886 % We can be in inner vertical mode in a footnote, although an
3887 % @itemize looks awful there.
3888 }%
3889 \flushcr
3890 }
3891
3892 % \splitoff TOKENS\endmark defines \first to be the first token in
3893 % TOKENS, and \rest to be the remainder.
3894 %
3895 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3896
3897 % Allow an optional argument of an uppercase letter, lowercase letter,
3898 % or number, to specify the first label in the enumerated list. No
3899 % argument is the same as `1'.
3900 %
3901 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
3902 \def\enumeratey #1 #2\endenumeratey{%
3903 % If we were given no argument, pretend we were given `1'.
3904 \def\thearg{#1}%
3905 \ifx\thearg\empty \def\thearg{1}\fi
3906 %
3907 % Detect if the argument is a single token. If so, it might be a
3908 % letter. Otherwise, the only valid thing it can be is a number.
3909 % (We will always have one token, because of the test we just made.
3910 % This is a good thing, since \splitoff doesn't work given nothing at
3911 % all -- the first parameter is undelimited.)
3912 \expandafter\splitoff\thearg\endmark
3913 \ifx\rest\empty
3914 % Only one token in the argument. It could still be anything.
3915 % A ``lowercase letter'' is one whose \lccode is nonzero.
3916 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3917 % not equal to itself.
3918 % Otherwise, we assume it's a number.
3919 %
3920 % We need the \relax at the end of the \ifnum lines to stop TeX from
3921 % continuing to look for a <number>.
3922 %
3923 \ifnum\lccode\expandafter`\thearg=0\relax
3924 \numericenumerate % a number (we hope)
3925 \else
3926 % It's a letter.
3927 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3928 \lowercaseenumerate % lowercase letter
3929 \else
3930 \uppercaseenumerate % uppercase letter
3931 \fi
3932 \fi
3933 \else
3934 % Multiple tokens in the argument. We hope it's a number.
3935 \numericenumerate
3936 \fi
3937 }
3938
3939 % An @enumerate whose labels are integers. The starting integer is
3940 % given in \thearg.
3941 %
3942 \def\numericenumerate{%
3943 \itemno = \thearg
3944 \startenumeration{\the\itemno}%
3945 }
3946
3947 % The starting (lowercase) letter is in \thearg.
3948 \def\lowercaseenumerate{%
3949 \itemno = \expandafter`\thearg
3950 \startenumeration{%
3951 % Be sure we're not beyond the end of the alphabet.
3952 \ifnum\itemno=0
3953 \errmessage{No more lowercase letters in @enumerate; get a bigger
3954 alphabet}%
3955 \fi
3956 \char\lccode\itemno
3957 }%
3958 }
3959
3960 % The starting (uppercase) letter is in \thearg.
3961 \def\uppercaseenumerate{%
3962 \itemno = \expandafter`\thearg
3963 \startenumeration{%
3964 % Be sure we're not beyond the end of the alphabet.
3965 \ifnum\itemno=0
3966 \errmessage{No more uppercase letters in @enumerate; get a bigger
3967 alphabet}
3968 \fi
3969 \char\uccode\itemno
3970 }%
3971 }
3972
3973 % Call \doitemize, adding a period to the first argument and supplying the
3974 % common last two arguments. Also subtract one from the initial value in
3975 % \itemno, since @item increments \itemno.
3976 %
3977 \def\startenumeration#1{%
3978 \advance\itemno by -1
3979 \doitemize{#1.}\flushcr
3980 }
3981
3982 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3983 % to @enumerate.
3984 %
3985 \def\alphaenumerate{\enumerate{a}}
3986 \def\capsenumerate{\enumerate{A}}
3987 \def\Ealphaenumerate{\Eenumerate}
3988 \def\Ecapsenumerate{\Eenumerate}
3989
3990
3991 % @multitable macros
3992 % Amy Hendrickson, 8/18/94, 3/6/96
3993 %
3994 % @multitable ... @end multitable will make as many columns as desired.
3995 % Contents of each column will wrap at width given in preamble. Width
3996 % can be specified either with sample text given in a template line,
3997 % or in percent of \hsize, the current width of text on page.
3998
3999 % Table can continue over pages but will only break between lines.
4000
4001 % To make preamble:
4002 %
4003 % Either define widths of columns in terms of percent of \hsize:
4004 % @multitable @columnfractions .25 .3 .45
4005 % @item ...
4006 %
4007 % Numbers following @columnfractions are the percent of the total
4008 % current hsize to be used for each column. You may use as many
4009 % columns as desired.
4010
4011
4012 % Or use a template:
4013 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4014 % @item ...
4015 % using the widest term desired in each column.
4016
4017 % Each new table line starts with @item, each subsequent new column
4018 % starts with @tab. Empty columns may be produced by supplying @tab's
4019 % with nothing between them for as many times as empty columns are needed,
4020 % ie, @tab@tab@tab will produce two empty columns.
4021
4022 % @item, @tab do not need to be on their own lines, but it will not hurt
4023 % if they are.
4024
4025 % Sample multitable:
4026
4027 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4028 % @item first col stuff @tab second col stuff @tab third col
4029 % @item
4030 % first col stuff
4031 % @tab
4032 % second col stuff
4033 % @tab
4034 % third col
4035 % @item first col stuff @tab second col stuff
4036 % @tab Many paragraphs of text may be used in any column.
4037 %
4038 % They will wrap at the width determined by the template.
4039 % @item@tab@tab This will be in third column.
4040 % @end multitable
4041
4042 % Default dimensions may be reset by user.
4043 % @multitableparskip is vertical space between paragraphs in table.
4044 % @multitableparindent is paragraph indent in table.
4045 % @multitablecolmargin is horizontal space to be left between columns.
4046 % @multitablelinespace is space to leave between table items, baseline
4047 % to baseline.
4048 % 0pt means it depends on current normal line spacing.
4049 %
4050 \newskip\multitableparskip
4051 \newskip\multitableparindent
4052 \newdimen\multitablecolspace
4053 \newskip\multitablelinespace
4054 \multitableparskip=0pt
4055 \multitableparindent=6pt
4056 \multitablecolspace=12pt
4057 \multitablelinespace=0pt
4058
4059 % Macros used to set up halign preamble:
4060 %
4061 \let\endsetuptable\relax
4062 \def\xendsetuptable{\endsetuptable}
4063 \let\columnfractions\relax
4064 \def\xcolumnfractions{\columnfractions}
4065 \newif\ifsetpercent
4066
4067 % #1 is the @columnfraction, usually a decimal number like .5, but might
4068 % be just 1. We just use it, whatever it is.
4069 %
4070 \def\pickupwholefraction#1 {%
4071 \global\advance\colcount by 1
4072 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4073 \setuptable
4074 }
4075
4076 \newcount\colcount
4077 \def\setuptable#1{%
4078 \def\firstarg{#1}%
4079 \ifx\firstarg\xendsetuptable
4080 \let\go = \relax
4081 \else
4082 \ifx\firstarg\xcolumnfractions
4083 \global\setpercenttrue
4084 \else
4085 \ifsetpercent
4086 \let\go\pickupwholefraction
4087 \else
4088 \global\advance\colcount by 1
4089 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4090 % separator; typically that is always in the input, anyway.
4091 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4092 \fi
4093 \fi
4094 \ifx\go\pickupwholefraction
4095 % Put the argument back for the \pickupwholefraction call, so
4096 % we'll always have a period there to be parsed.
4097 \def\go{\pickupwholefraction#1}%
4098 \else
4099 \let\go = \setuptable
4100 \fi%
4101 \fi
4102 \go
4103 }
4104
4105 % multitable-only commands.
4106 %
4107 % @headitem starts a heading row, which we typeset in bold. Assignments
4108 % have to be global since we are inside the implicit group of an
4109 % alignment entry. \everycr below resets \everytab so we don't have to
4110 % undo it ourselves.
4111 \def\headitemfont{\b}% for people to use in the template row; not changeable
4112 \def\headitem{%
4113 \checkenv\multitable
4114 \crcr
4115 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4116 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4117 \the\everytab % for the first item
4118 }%
4119 %
4120 % default for tables with no headings.
4121 \let\headitemcrhook=\relax
4122 %
4123 % A \tab used to include \hskip1sp. But then the space in a template
4124 % line is not enough. That is bad. So let's go back to just `&' until
4125 % we again encounter the problem the 1sp was intended to solve.
4126 % --karl, nathan@acm.org, 20apr99.
4127 \def\tab{\checkenv\multitable &\the\everytab}%
4128
4129 % @multitable ... @end multitable definitions:
4130 %
4131 \newtoks\everytab % insert after every tab.
4132 %
4133 \envdef\multitable{%
4134 \vskip\parskip
4135 \startsavinginserts
4136 %
4137 % @item within a multitable starts a normal row.
4138 % We use \def instead of \let so that if one of the multitable entries
4139 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4140 % \endtemplate) expanding \doitemize.
4141 \def\item{\crcr}%
4142 %
4143 \tolerance=9500
4144 \hbadness=9500
4145 \setmultitablespacing
4146 \parskip=\multitableparskip
4147 \parindent=\multitableparindent
4148 \overfullrule=0pt
4149 \global\colcount=0
4150 %
4151 \everycr = {%
4152 \noalign{%
4153 \global\everytab={}% Reset from possible headitem.
4154 \global\colcount=0 % Reset the column counter.
4155 %
4156 % Check for saved footnotes, etc.:
4157 \checkinserts
4158 %
4159 % Perhaps a \nobreak, then reset:
4160 \headitemcrhook
4161 \global\let\headitemcrhook=\relax
4162 }%
4163 }%
4164 %
4165 \parsearg\domultitable
4166 }
4167 \def\domultitable#1{%
4168 % To parse everything between @multitable and @item:
4169 \setuptable#1 \endsetuptable
4170 %
4171 % This preamble sets up a generic column definition, which will
4172 % be used as many times as user calls for columns.
4173 % \vtop will set a single line and will also let text wrap and
4174 % continue for many paragraphs if desired.
4175 \halign\bgroup &%
4176 \global\advance\colcount by 1
4177 \multistrut
4178 \vtop{%
4179 % Use the current \colcount to find the correct column width:
4180 \hsize=\expandafter\csname col\the\colcount\endcsname
4181 %
4182 % In order to keep entries from bumping into each other
4183 % we will add a \leftskip of \multitablecolspace to all columns after
4184 % the first one.
4185 %
4186 % If a template has been used, we will add \multitablecolspace
4187 % to the width of each template entry.
4188 %
4189 % If the user has set preamble in terms of percent of \hsize we will
4190 % use that dimension as the width of the column, and the \leftskip
4191 % will keep entries from bumping into each other. Table will start at
4192 % left margin and final column will justify at right margin.
4193 %
4194 % Make sure we don't inherit \rightskip from the outer environment.
4195 \rightskip=0pt
4196 \ifnum\colcount=1
4197 % The first column will be indented with the surrounding text.
4198 \advance\hsize by\leftskip
4199 \else
4200 \ifsetpercent \else
4201 % If user has not set preamble in terms of percent of \hsize
4202 % we will advance \hsize by \multitablecolspace.
4203 \advance\hsize by \multitablecolspace
4204 \fi
4205 % In either case we will make \leftskip=\multitablecolspace:
4206 \leftskip=\multitablecolspace
4207 \fi
4208 % Ignoring space at the beginning and end avoids an occasional spurious
4209 % blank line, when TeX decides to break the line at the space before the
4210 % box from the multistrut, so the strut ends up on a line by itself.
4211 % For example:
4212 % @multitable @columnfractions .11 .89
4213 % @item @code{#}
4214 % @tab Legal holiday which is valid in major parts of the whole country.
4215 % Is automatically provided with highlighting sequences respectively
4216 % marking characters.
4217 \noindent\ignorespaces##\unskip\multistrut
4218 }\cr
4219 }
4220 \def\Emultitable{%
4221 \crcr
4222 \egroup % end the \halign
4223 \global\setpercentfalse
4224 }
4225
4226 \def\setmultitablespacing{%
4227 \def\multistrut{\strut}% just use the standard line spacing
4228 %
4229 % Compute \multitablelinespace (if not defined by user) for use in
4230 % \multitableparskip calculation. We used define \multistrut based on
4231 % this, but (ironically) that caused the spacing to be off.
4232 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4233 \ifdim\multitablelinespace=0pt
4234 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4235 \global\advance\multitablelinespace by-\ht0
4236 \fi
4237 % Test to see if parskip is larger than space between lines of
4238 % table. If not, do nothing.
4239 % If so, set to same dimension as multitablelinespace.
4240 \ifdim\multitableparskip>\multitablelinespace
4241 \global\multitableparskip=\multitablelinespace
4242 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4243 % than skip between lines in the table.
4244 \fi%
4245 \ifdim\multitableparskip=0pt
4246 \global\multitableparskip=\multitablelinespace
4247 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4248 % than skip between lines in the table.
4249 \fi}
4250
4251
4252 \message{conditionals,}
4253
4254 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4255 % @ifnotxml always succeed. They currently do nothing; we don't
4256 % attempt to check whether the conditionals are properly nested. But we
4257 % have to remember that they are conditionals, so that @end doesn't
4258 % attempt to close an environment group.
4259 %
4260 \def\makecond#1{%
4261 \expandafter\let\csname #1\endcsname = \relax
4262 \expandafter\let\csname iscond.#1\endcsname = 1
4263 }
4264 \makecond{iftex}
4265 \makecond{ifnotdocbook}
4266 \makecond{ifnothtml}
4267 \makecond{ifnotinfo}
4268 \makecond{ifnotplaintext}
4269 \makecond{ifnotxml}
4270
4271 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4272 %
4273 \def\direntry{\doignore{direntry}}
4274 \def\documentdescription{\doignore{documentdescription}}
4275 \def\docbook{\doignore{docbook}}
4276 \def\html{\doignore{html}}
4277 \def\ifdocbook{\doignore{ifdocbook}}
4278 \def\ifhtml{\doignore{ifhtml}}
4279 \def\ifinfo{\doignore{ifinfo}}
4280 \def\ifnottex{\doignore{ifnottex}}
4281 \def\ifplaintext{\doignore{ifplaintext}}
4282 \def\ifxml{\doignore{ifxml}}
4283 \def\ignore{\doignore{ignore}}
4284 \def\menu{\doignore{menu}}
4285 \def\xml{\doignore{xml}}
4286
4287 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4288 %
4289 % A count to remember the depth of nesting.
4290 \newcount\doignorecount
4291
4292 \def\doignore#1{\begingroup
4293 % Scan in ``verbatim'' mode:
4294 \obeylines
4295 \catcode`\@ = \other
4296 \catcode`\{ = \other
4297 \catcode`\} = \other
4298 %
4299 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4300 \spaceisspace
4301 %
4302 % Count number of #1's that we've seen.
4303 \doignorecount = 0
4304 %
4305 % Swallow text until we reach the matching `@end #1'.
4306 \dodoignore{#1}%
4307 }
4308
4309 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4310 \obeylines %
4311 %
4312 \gdef\dodoignore#1{%
4313 % #1 contains the command name as a string, e.g., `ifinfo'.
4314 %
4315 % Define a command to find the next `@end #1'.
4316 \long\def\doignoretext##1^^M@end #1{%
4317 \doignoretextyyy##1^^M@#1\_STOP_}%
4318 %
4319 % And this command to find another #1 command, at the beginning of a
4320 % line. (Otherwise, we would consider a line `@c @ifset', for
4321 % example, to count as an @ifset for nesting.)
4322 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4323 %
4324 % And now expand that command.
4325 \doignoretext ^^M%
4326 }%
4327 }
4328
4329 \def\doignoreyyy#1{%
4330 \def\temp{#1}%
4331 \ifx\temp\empty % Nothing found.
4332 \let\next\doignoretextzzz
4333 \else % Found a nested condition, ...
4334 \advance\doignorecount by 1
4335 \let\next\doignoretextyyy % ..., look for another.
4336 % If we're here, #1 ends with ^^M\ifinfo (for example).
4337 \fi
4338 \next #1% the token \_STOP_ is present just after this macro.
4339 }
4340
4341 % We have to swallow the remaining "\_STOP_".
4342 %
4343 \def\doignoretextzzz#1{%
4344 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4345 \let\next\enddoignore
4346 \else % Still inside a nested condition.
4347 \advance\doignorecount by -1
4348 \let\next\doignoretext % Look for the next @end.
4349 \fi
4350 \next
4351 }
4352
4353 % Finish off ignored text.
4354 { \obeylines%
4355 % Ignore anything after the last `@end #1'; this matters in verbatim
4356 % environments, where otherwise the newline after an ignored conditional
4357 % would result in a blank line in the output.
4358 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4359 }
4360
4361
4362 % @set VAR sets the variable VAR to an empty value.
4363 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4364 %
4365 % Since we want to separate VAR from REST-OF-LINE (which might be
4366 % empty), we can't just use \parsearg; we have to insert a space of our
4367 % own to delimit the rest of the line, and then take it out again if we
4368 % didn't need it.
4369 % We rely on the fact that \parsearg sets \catcode`\ =10.
4370 %
4371 \parseargdef\set{\setyyy#1 \endsetyyy}
4372 \def\setyyy#1 #2\endsetyyy{%
4373 {%
4374 \makevalueexpandable
4375 \def\temp{#2}%
4376 \edef\next{\gdef\makecsname{SET#1}}%
4377 \ifx\temp\empty
4378 \next{}%
4379 \else
4380 \setzzz#2\endsetzzz
4381 \fi
4382 }%
4383 }
4384 % Remove the trailing space \setxxx inserted.
4385 \def\setzzz#1 \endsetzzz{\next{#1}}
4386
4387 % @clear VAR clears (i.e., unsets) the variable VAR.
4388 %
4389 \parseargdef\clear{%
4390 {%
4391 \makevalueexpandable
4392 \global\expandafter\let\csname SET#1\endcsname=\relax
4393 }%
4394 }
4395
4396 % @value{foo} gets the text saved in variable foo.
4397 \def\value{\begingroup\makevalueexpandable\valuexxx}
4398 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4399 {
4400 \catcode`\-=\active \catcode`\_=\active
4401 %
4402 \gdef\makevalueexpandable{%
4403 \let\value = \expandablevalue
4404 % We don't want these characters active, ...
4405 \catcode`\-=\other \catcode`\_=\other
4406 % ..., but we might end up with active ones in the argument if
4407 % we're called from @code, as @code{@value{foo-bar_}}, though.
4408 % So \let them to their normal equivalents.
4409 \let-\normaldash \let_\normalunderscore
4410 }
4411 }
4412
4413 % We have this subroutine so that we can handle at least some @value's
4414 % properly in indexes (we call \makevalueexpandable in \indexdummies).
4415 % The command has to be fully expandable (if the variable is set), since
4416 % the result winds up in the index file. This means that if the
4417 % variable's value contains other Texinfo commands, it's almost certain
4418 % it will fail (although perhaps we could fix that with sufficient work
4419 % to do a one-level expansion on the result, instead of complete).
4420 %
4421 % Unfortunately, this has the consequence that when _ is in the *value*
4422 % of an @set, it does not print properly in the roman fonts (get the cmr
4423 % dot accent at position 126 instead). No fix comes to mind, and it's
4424 % been this way since 2003 or earlier, so just ignore it.
4425 %
4426 \def\expandablevalue#1{%
4427 \expandafter\ifx\csname SET#1\endcsname\relax
4428 {[No value for ``#1'']}%
4429 \message{Variable `#1', used in @value, is not set.}%
4430 \else
4431 \csname SET#1\endcsname
4432 \fi
4433 }
4434
4435 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4436 % with @set.
4437 %
4438 % To get the special treatment we need for `@end ifset,' we call
4439 % \makecond and then redefine.
4440 %
4441 \makecond{ifset}
4442 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4443 \def\doifset#1#2{%
4444 {%
4445 \makevalueexpandable
4446 \let\next=\empty
4447 \expandafter\ifx\csname SET#2\endcsname\relax
4448 #1% If not set, redefine \next.
4449 \fi
4450 \expandafter
4451 }\next
4452 }
4453 \def\ifsetfail{\doignore{ifset}}
4454
4455 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4456 % defined with @set, or has been undefined with @clear.
4457 %
4458 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4459 % above code: if the variable is not set, do nothing, if it is set,
4460 % then redefine \next to \ifclearfail.
4461 %
4462 \makecond{ifclear}
4463 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4464 \def\ifclearfail{\doignore{ifclear}}
4465
4466 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4467 % without the @) is in fact defined. We can only feasibly check at the
4468 % TeX level, so something like `mathcode' is going to considered
4469 % defined even though it is not a Texinfo command.
4470 %
4471 \makecond{ifcommanddefined}
4472 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4473 %
4474 \def\doifcmddefined#1#2{{%
4475 \makevalueexpandable
4476 \let\next=\empty
4477 \expandafter\ifx\csname #2\endcsname\relax
4478 #1% If not defined, \let\next as above.
4479 \fi
4480 \expandafter
4481 }\next
4482 }
4483 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4484
4485 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4486 \makecond{ifcommandnotdefined}
4487 \def\ifcommandnotdefined{%
4488 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4489 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4490
4491 % Set the `txicommandconditionals' variable, so documents have a way to
4492 % test if the @ifcommand...defined conditionals are available.
4493 \set txicommandconditionals
4494
4495 % @dircategory CATEGORY -- specify a category of the dir file
4496 % which this file should belong to. Ignore this in TeX.
4497 \let\dircategory=\comment
4498
4499 % @defininfoenclose.
4500 \let\definfoenclose=\comment
4501
4502
4503 \message{indexing,}
4504 % Index generation facilities
4505
4506 % Define \newwrite to be identical to plain tex's \newwrite
4507 % except not \outer, so it can be used within macros and \if's.
4508 \edef\newwrite{\makecsname{ptexnewwrite}}
4509
4510 % \newindex {foo} defines an index named IX.
4511 % It automatically defines \IXindex such that
4512 % \IXindex ...rest of line... puts an entry in the index IX.
4513 % It also defines \IXindfile to be the number of the output channel for
4514 % the file that accumulates this index. The file's extension is IX.
4515 % The name of an index should be no more than 2 characters long
4516 % for the sake of vms.
4517 %
4518 \def\newindex#1{%
4519 \expandafter\chardef\csname#1indfile\endcsname=0
4520 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4521 \noexpand\doindex{#1}}
4522 }
4523
4524 % @defindex foo == \newindex{foo}
4525 %
4526 \def\defindex{\parsearg\newindex}
4527
4528 % Define @defcodeindex, like @defindex except put all entries in @code.
4529 %
4530 \def\defcodeindex{\parsearg\newcodeindex}
4531 %
4532 \def\newcodeindex#1{%
4533 \expandafter\chardef\csname#1indfile\endcsname=0
4534 \expandafter\xdef\csname#1index\endcsname{%
4535 \noexpand\docodeindex{#1}}%
4536 }
4537
4538 % The default indices:
4539 \newindex{cp}% concepts,
4540 \newcodeindex{fn}% functions,
4541 \newcodeindex{vr}% variables,
4542 \newcodeindex{tp}% types,
4543 \newcodeindex{ky}% keys
4544 \newcodeindex{pg}% and programs.
4545
4546
4547 % @synindex foo bar makes index foo feed into index bar.
4548 % Do this instead of @defindex foo if you don't want it as a separate index.
4549 %
4550 % @syncodeindex foo bar similar, but put all entries made for index foo
4551 % inside @code.
4552 %
4553 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4554 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4555
4556 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4557 % #3 the target index (bar).
4558 \def\dosynindex#1#2#3{%
4559 % Only do \closeout if we haven't already done it, else we'll end up
4560 % closing the target index.
4561 \expandafter \ifx\csname donesynindex#2\endcsname \relax
4562 % The \closeout helps reduce unnecessary open files; the limit on the
4563 % Acorn RISC OS is a mere 16 files.
4564 \expandafter\closeout\csname#2indfile\endcsname
4565 \expandafter\let\csname donesynindex#2\endcsname = 1
4566 \fi
4567 % redefine \fooindfile:
4568 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4569 \expandafter\let\csname#2indfile\endcsname=\temp
4570 % redefine \fooindex:
4571 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4572 }
4573
4574 % Define \doindex, the driver for all index macros.
4575 % Argument #1 is generated by the calling \fooindex macro,
4576 % and it the two-letter name of the index.
4577
4578 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4579 \def\doindexxxx #1{\doind{\indexname}{#1}}
4580
4581 % like the previous two, but they put @code around the argument.
4582 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4583 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
4584
4585 % Used when writing an index entry out to an index file, to prevent
4586 % expansion of Texinfo commands that can appear in an index entry.
4587 %
4588 \def\indexdummies{%
4589 \escapechar = `\\ % use backslash in output files.
4590 \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4591 \def\ {\realbackslash\space }%
4592 %
4593 % Need these unexpandable (because we define \tt as a dummy)
4594 % definitions when @{ or @} appear in index entry text. Also, more
4595 % complicated, when \tex is in effect and \{ is a \delimiter again.
4596 % We can't use \lbracecmd and \rbracecmd because texindex assumes
4597 % braces and backslashes are used only as delimiters. Perhaps we
4598 % should use @lbracechar and @rbracechar?
4599 \def\{{{\tt\char123}}%
4600 \def\}{{\tt\char125}}%
4601 %
4602 % Do the redefinitions.
4603 \commondummies
4604 }
4605
4606 % For the aux and toc files, @ is the escape character. So we want to
4607 % redefine everything using @ as the escape character (instead of
4608 % \realbackslash, still used for index files). When everything uses @,
4609 % this will be simpler.
4610 %
4611 \def\atdummies{%
4612 \def\@{@@}%
4613 \def\ {@ }%
4614 \let\{ = \lbraceatcmd
4615 \let\} = \rbraceatcmd
4616 %
4617 % Do the redefinitions.
4618 \commondummies
4619 \otherbackslash
4620 }
4621
4622 % Called from \indexdummies and \atdummies.
4623 %
4624 \def\commondummies{%
4625 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4626 % preventing its expansion. This is used only for control words,
4627 % not control letters, because the \space would be incorrect for
4628 % control characters, but is needed to separate the control word
4629 % from whatever follows.
4630 %
4631 % For control letters, we have \definedummyletter, which omits the
4632 % space.
4633 %
4634 % These can be used both for control words that take an argument and
4635 % those that do not. If it is followed by {arg} in the input, then
4636 % that will dutifully get written to the index (or wherever).
4637 %
4638 \def\definedummyword ##1{\def##1{\string##1\space}}%
4639 \def\definedummyletter##1{\def##1{\string##1}}%
4640 \let\definedummyaccent\definedummyletter
4641 %
4642 \commondummiesnofonts
4643 %
4644 \definedummyletter\_%
4645 \definedummyletter\-%
4646 %
4647 % Non-English letters.
4648 \definedummyword\AA
4649 \definedummyword\AE
4650 \definedummyword\DH
4651 \definedummyword\L
4652 \definedummyword\O
4653 \definedummyword\OE
4654 \definedummyword\TH
4655 \definedummyword\aa
4656 \definedummyword\ae
4657 \definedummyword\dh
4658 \definedummyword\exclamdown
4659 \definedummyword\l
4660 \definedummyword\o
4661 \definedummyword\oe
4662 \definedummyword\ordf
4663 \definedummyword\ordm
4664 \definedummyword\questiondown
4665 \definedummyword\ss
4666 \definedummyword\th
4667 %
4668 % Although these internal commands shouldn't show up, sometimes they do.
4669 \definedummyword\bf
4670 \definedummyword\gtr
4671 \definedummyword\hat
4672 \definedummyword\less
4673 \definedummyword\sf
4674 \definedummyword\sl
4675 \definedummyword\tclose
4676 \definedummyword\tt
4677 %
4678 \definedummyword\LaTeX
4679 \definedummyword\TeX
4680 %
4681 % Assorted special characters.
4682 \definedummyword\arrow
4683 \definedummyword\bullet
4684 \definedummyword\comma
4685 \definedummyword\copyright
4686 \definedummyword\registeredsymbol
4687 \definedummyword\dots
4688 \definedummyword\enddots
4689 \definedummyword\entrybreak
4690 \definedummyword\equiv
4691 \definedummyword\error
4692 \definedummyword\euro
4693 \definedummyword\expansion
4694 \definedummyword\geq
4695 \definedummyword\guillemetleft
4696 \definedummyword\guillemetright
4697 \definedummyword\guilsinglleft
4698 \definedummyword\guilsinglright
4699 \definedummyword\lbracechar
4700 \definedummyword\leq
4701 \definedummyword\mathopsup
4702 \definedummyword\minus
4703 \definedummyword\ogonek
4704 \definedummyword\pounds
4705 \definedummyword\point
4706 \definedummyword\print
4707 \definedummyword\quotedblbase
4708 \definedummyword\quotedblleft
4709 \definedummyword\quotedblright
4710 \definedummyword\quoteleft
4711 \definedummyword\quoteright
4712 \definedummyword\quotesinglbase
4713 \definedummyword\rbracechar
4714 \definedummyword\result
4715 \definedummyword\sub
4716 \definedummyword\sup
4717 \definedummyword\textdegree
4718 %
4719 % We want to disable all macros so that they are not expanded by \write.
4720 \macrolist
4721 %
4722 \normalturnoffactive
4723 %
4724 % Handle some cases of @value -- where it does not contain any
4725 % (non-fully-expandable) commands.
4726 \makevalueexpandable
4727 }
4728
4729 % \commondummiesnofonts: common to \commondummies and \indexnofonts.
4730 % Define \definedumyletter, \definedummyaccent and \definedummyword before
4731 % using.
4732 %
4733 \def\commondummiesnofonts{%
4734 % Control letters and accents.
4735 \definedummyletter\!%
4736 \definedummyaccent\"%
4737 \definedummyaccent\'%
4738 \definedummyletter\*%
4739 \definedummyaccent\,%
4740 \definedummyletter\.%
4741 \definedummyletter\/%
4742 \definedummyletter\:%
4743 \definedummyaccent\=%
4744 \definedummyletter\?%
4745 \definedummyaccent\^%
4746 \definedummyaccent\`%
4747 \definedummyaccent\~%
4748 \definedummyword\u
4749 \definedummyword\v
4750 \definedummyword\H
4751 \definedummyword\dotaccent
4752 \definedummyword\ogonek
4753 \definedummyword\ringaccent
4754 \definedummyword\tieaccent
4755 \definedummyword\ubaraccent
4756 \definedummyword\udotaccent
4757 \definedummyword\dotless
4758 %
4759 % Texinfo font commands.
4760 \definedummyword\b
4761 \definedummyword\i
4762 \definedummyword\r
4763 \definedummyword\sansserif
4764 \definedummyword\sc
4765 \definedummyword\slanted
4766 \definedummyword\t
4767 %
4768 % Commands that take arguments.
4769 \definedummyword\abbr
4770 \definedummyword\acronym
4771 \definedummyword\anchor
4772 \definedummyword\cite
4773 \definedummyword\code
4774 \definedummyword\command
4775 \definedummyword\dfn
4776 \definedummyword\dmn
4777 \definedummyword\email
4778 \definedummyword\emph
4779 \definedummyword\env
4780 \definedummyword\file
4781 \definedummyword\image
4782 \definedummyword\indicateurl
4783 \definedummyword\inforef
4784 \definedummyword\kbd
4785 \definedummyword\key
4786 \definedummyword\math
4787 \definedummyword\option
4788 \definedummyword\pxref
4789 \definedummyword\ref
4790 \definedummyword\samp
4791 \definedummyword\strong
4792 \definedummyword\tie
4793 \definedummyword\U
4794 \definedummyword\uref
4795 \definedummyword\url
4796 \definedummyword\var
4797 \definedummyword\verb
4798 \definedummyword\w
4799 \definedummyword\xref
4800 }
4801
4802 % For testing: output @{ and @} in index sort strings as \{ and \}.
4803 \newif\ifusebracesinindexes
4804
4805 \let\indexlbrace\relax
4806 \let\indexrbrace\relax
4807
4808 {\catcode`\@=0
4809 \catcode`\\=13
4810 @gdef@backslashdisappear{@def\{}}
4811 }
4812
4813 {
4814 \catcode`\<=13
4815 \catcode`\-=13
4816 \catcode`\`=13
4817 \gdef\indexnonalnumdisappear{%
4818 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
4819 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
4820 % (Introduced for FSFS 2nd ed.)
4821 \let`=\empty
4822 \fi
4823 %
4824 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
4825 \backslashdisappear
4826 \fi
4827 %
4828 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
4829 \def-{}%
4830 \fi
4831 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
4832 \def<{}%
4833 \fi
4834 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
4835 \def\@{}%
4836 \fi
4837 }
4838
4839 \gdef\indexnonalnumreappear{%
4840 \useindexbackslash
4841 \let-\normaldash
4842 \let<\normalless
4843 \def\@{@}%
4844 }
4845 }
4846
4847
4848 % \indexnofonts is used when outputting the strings to sort the index
4849 % by, and when constructing control sequence names. It eliminates all
4850 % control sequences and just writes whatever the best ASCII sort string
4851 % would be for a given command (usually its argument).
4852 %
4853 \def\indexnofonts{%
4854 % Accent commands should become @asis.
4855 \def\definedummyaccent##1{\let##1\asis}%
4856 % We can just ignore other control letters.
4857 \def\definedummyletter##1{\let##1\empty}%
4858 % All control words become @asis by default; overrides below.
4859 \let\definedummyword\definedummyaccent
4860 \commondummiesnofonts
4861 %
4862 % Don't no-op \tt, since it isn't a user-level command
4863 % and is used in the definitions of the active chars like <, >, |, etc.
4864 % Likewise with the other plain tex font commands.
4865 %\let\tt=\asis
4866 %
4867 \def\ { }%
4868 \def\@{@}%
4869 \def\_{\normalunderscore}%
4870 \def\-{}% @- shouldn't affect sorting
4871 %
4872 \uccode`\1=`\{ \uppercase{\def\{{1}}%
4873 \uccode`\1=`\} \uppercase{\def\}{1}}%
4874 \let\lbracechar\{%
4875 \let\rbracechar\}%
4876 %
4877 % Non-English letters.
4878 \def\AA{AA}%
4879 \def\AE{AE}%
4880 \def\DH{DZZ}%
4881 \def\L{L}%
4882 \def\OE{OE}%
4883 \def\O{O}%
4884 \def\TH{TH}%
4885 \def\aa{aa}%
4886 \def\ae{ae}%
4887 \def\dh{dzz}%
4888 \def\exclamdown{!}%
4889 \def\l{l}%
4890 \def\oe{oe}%
4891 \def\ordf{a}%
4892 \def\ordm{o}%
4893 \def\o{o}%
4894 \def\questiondown{?}%
4895 \def\ss{ss}%
4896 \def\th{th}%
4897 %
4898 \def\LaTeX{LaTeX}%
4899 \def\TeX{TeX}%
4900 %
4901 % Assorted special characters.
4902 % (The following {} will end up in the sort string, but that's ok.)
4903 \def\arrow{->}%
4904 \def\bullet{bullet}%
4905 \def\comma{,}%
4906 \def\copyright{copyright}%
4907 \def\dots{...}%
4908 \def\enddots{...}%
4909 \def\equiv{==}%
4910 \def\error{error}%
4911 \def\euro{euro}%
4912 \def\expansion{==>}%
4913 \def\geq{>=}%
4914 \def\guillemetleft{<<}%
4915 \def\guillemetright{>>}%
4916 \def\guilsinglleft{<}%
4917 \def\guilsinglright{>}%
4918 \def\leq{<=}%
4919 \def\minus{-}%
4920 \def\point{.}%
4921 \def\pounds{pounds}%
4922 \def\print{-|}%
4923 \def\quotedblbase{"}%
4924 \def\quotedblleft{"}%
4925 \def\quotedblright{"}%
4926 \def\quoteleft{`}%
4927 \def\quoteright{'}%
4928 \def\quotesinglbase{,}%
4929 \def\registeredsymbol{R}%
4930 \def\result{=>}%
4931 \def\textdegree{o}%
4932 %
4933 % We need to get rid of all macros, leaving only the arguments (if present).
4934 % Of course this is not nearly correct, but it is the best we can do for now.
4935 % makeinfo does not expand macros in the argument to @deffn, which ends up
4936 % writing an index entry, and texindex isn't prepared for an index sort entry
4937 % that starts with \.
4938 %
4939 % Since macro invocations are followed by braces, we can just redefine them
4940 % to take a single TeX argument. The case of a macro invocation that
4941 % goes to end-of-line is not handled.
4942 %
4943 \macrolist
4944 }
4945
4946
4947 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4948
4949 % Most index entries go through here, but \dosubind is the general case.
4950 % #1 is the index name, #2 is the entry text.
4951 \def\doind#1#2{\dosubind{#1}{#2}{}}
4952
4953 % There is also \dosubind {index}{topic}{subtopic}
4954 % which makes an entry in a two-level index such as the operation index.
4955 % TODO: Two-level index? Operation index?
4956
4957 % Workhorse for all indexes.
4958 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
4959 % empty if called from \doind, as we usually are (the main exception
4960 % is with most defuns, which call us directly).
4961 %
4962 \def\dosubind#1#2#3{%
4963 \iflinks
4964 {%
4965 \requireopenindexfile{#1}%
4966 % Store the main index entry text (including the third arg).
4967 \toks0 = {#2}%
4968 % If third arg is present, precede it with a space.
4969 \def\thirdarg{#3}%
4970 \ifx\thirdarg\empty \else
4971 \toks0 = \expandafter{\the\toks0 \space #3}%
4972 \fi
4973 %
4974 \edef\writeto{\csname#1indfile\endcsname}%
4975 %
4976 \safewhatsit\dosubindwrite
4977 }%
4978 \fi
4979 }
4980
4981 % Check if an index file has been opened, and if not, open it.
4982 \def\requireopenindexfile#1{%
4983 \ifnum\csname #1indfile\endcsname=0
4984 \expandafter\newwrite \csname#1indfile\endcsname
4985 \edef\suffix{#1}%
4986 % A .fls suffix would conflict with the file extension for the output
4987 % of -recorder, so use .f1s instead.
4988 \ifx\suffix\indexisfl\def\suffix{f1}\fi
4989 % Open the file
4990 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
4991 % Using \immediate here prevents an object entering into the current box,
4992 % which could confound checks such as those in \safewhatsit for preceding
4993 % skips.
4994 \fi}
4995 \def\indexisfl{fl}
4996
4997 % Output \ as {\indexbackslash}, because \ is an escape character in
4998 % the index files.
4999 \let\indexbackslash=\relax
5000 {\catcode`\@=0 \catcode`\\=\active
5001 @gdef@useindexbackslash{@def\{{@indexbackslash}}}
5002 }
5003
5004 % Definition for writing index entry text.
5005 \def\sortas#1{\ignorespaces}%
5006
5007 % Definition for writing index entry sort key. Should occur at the at
5008 % the beginning of the index entry, like
5009 % @cindex @sortas{september} \september
5010 % The \ignorespaces takes care of following space, but there's no way
5011 % to remove space before it.
5012 {
5013 \catcode`\-=13
5014 \gdef\indexwritesortas{%
5015 \begingroup
5016 \indexnonalnumreappear
5017 \indexwritesortasxxx}
5018 \gdef\indexwritesortasxxx#1{%
5019 \xdef\indexsortkey{#1}\endgroup}
5020 }
5021
5022
5023 % Write the entry in \toks0 to the index file.
5024 %
5025 \def\dosubindwrite{%
5026 % Put the index entry in the margin if desired.
5027 \ifx\SETmarginindex\relax\else
5028 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
5029 \fi
5030 %
5031 % Remember, we are within a group.
5032 \indexdummies % Must do this here, since \bf, etc expand at this stage
5033 \useindexbackslash % \indexbackslash isn't defined now so it will be output
5034 % as is; and it will print as backslash.
5035 % The braces around \indexbrace are recognized by texindex.
5036 %
5037 % Get the string to sort by, by processing the index entry with all
5038 % font commands turned off.
5039 {\indexnofonts
5040 \def\lbracechar{{\indexlbrace}}%
5041 \def\rbracechar{{\indexrbrace}}%
5042 \let\{=\lbracechar
5043 \let\}=\rbracechar
5044 \indexnonalnumdisappear
5045 \xdef\indexsortkey{}%
5046 \let\sortas=\indexwritesortas
5047 \edef\temp{\the\toks0}%
5048 \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
5049 \ifx\indexsortkey\empty
5050 \xdef\indexsortkey{\temp}%
5051 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
5052 \fi
5053 }%
5054 %
5055 % Set up the complete index entry, with both the sort key and
5056 % the original text, including any font commands. We write
5057 % three arguments to \entry to the .?? file (four in the
5058 % subentry case), texindex reduces to two when writing the .??s
5059 % sorted result.
5060 \edef\temp{%
5061 \write\writeto{%
5062 \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
5063 }%
5064 \temp
5065 }
5066 \newbox\dummybox % used above
5067
5068 % Take care of unwanted page breaks/skips around a whatsit:
5069 %
5070 % If a skip is the last thing on the list now, preserve it
5071 % by backing up by \lastskip, doing the \write, then inserting
5072 % the skip again. Otherwise, the whatsit generated by the
5073 % \write or \pdfdest will make \lastskip zero. The result is that
5074 % sequences like this:
5075 % @end defun
5076 % @tindex whatever
5077 % @defun ...
5078 % will have extra space inserted, because the \medbreak in the
5079 % start of the @defun won't see the skip inserted by the @end of
5080 % the previous defun.
5081 %
5082 % But don't do any of this if we're not in vertical mode. We
5083 % don't want to do a \vskip and prematurely end a paragraph.
5084 %
5085 % Avoid page breaks due to these extra skips, too.
5086 %
5087 % But wait, there is a catch there:
5088 % We'll have to check whether \lastskip is zero skip. \ifdim is not
5089 % sufficient for this purpose, as it ignores stretch and shrink parts
5090 % of the skip. The only way seems to be to check the textual
5091 % representation of the skip.
5092 %
5093 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5094 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5095 %
5096 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5097 %
5098 \newskip\whatsitskip
5099 \newcount\whatsitpenalty
5100 %
5101 % ..., ready, GO:
5102 %
5103 \def\safewhatsit#1{\ifhmode
5104 #1%
5105 \else
5106 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5107 \whatsitskip = \lastskip
5108 \edef\lastskipmacro{\the\lastskip}%
5109 \whatsitpenalty = \lastpenalty
5110 %
5111 % If \lastskip is nonzero, that means the last item was a
5112 % skip. And since a skip is discardable, that means this
5113 % -\whatsitskip glue we're inserting is preceded by a
5114 % non-discardable item, therefore it is not a potential
5115 % breakpoint, therefore no \nobreak needed.
5116 \ifx\lastskipmacro\zeroskipmacro
5117 \else
5118 \vskip-\whatsitskip
5119 \fi
5120 %
5121 #1%
5122 %
5123 \ifx\lastskipmacro\zeroskipmacro
5124 % If \lastskip was zero, perhaps the last item was a penalty, and
5125 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5126 % to re-insert the same penalty (values >10000 are used for various
5127 % signals); since we just inserted a non-discardable item, any
5128 % following glue (such as a \parskip) would be a breakpoint. For example:
5129 % @deffn deffn-whatever
5130 % @vindex index-whatever
5131 % Description.
5132 % would allow a break between the index-whatever whatsit
5133 % and the "Description." paragraph.
5134 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5135 \else
5136 % On the other hand, if we had a nonzero \lastskip,
5137 % this make-up glue would be preceded by a non-discardable item
5138 % (the whatsit from the \write), so we must insert a \nobreak.
5139 \nobreak\vskip\whatsitskip
5140 \fi
5141 \fi}
5142
5143 % The index entry written in the file actually looks like
5144 % \entry {sortstring}{page}{topic}
5145 % or
5146 % \entry {sortstring}{page}{topic}{subtopic}
5147 % The texindex program reads in these files and writes files
5148 % containing these kinds of lines:
5149 % \initial {c}
5150 % before the first topic whose initial is c
5151 % \entry {topic}{pagelist}
5152 % for a topic that is used without subtopics
5153 % \primary {topic}
5154 % for the beginning of a topic that is used with subtopics
5155 % \secondary {subtopic}{pagelist}
5156 % for each subtopic.
5157
5158 % Define the user-accessible indexing commands
5159 % @findex, @vindex, @kindex, @cindex.
5160
5161 \def\findex {\fnindex}
5162 \def\kindex {\kyindex}
5163 \def\cindex {\cpindex}
5164 \def\vindex {\vrindex}
5165 \def\tindex {\tpindex}
5166 \def\pindex {\pgindex}
5167
5168 \def\cindexsub {\begingroup\obeylines\cindexsub}
5169 {\obeylines %
5170 \gdef\cindexsub "#1" #2^^M{\endgroup %
5171 \dosubind{cp}{#2}{#1}}}
5172
5173 % Define the macros used in formatting output of the sorted index material.
5174
5175 % @printindex causes a particular index (the ??s file) to get printed.
5176 % It does not print any chapter heading (usually an @unnumbered).
5177 %
5178 \parseargdef\printindex{\begingroup
5179 \dobreak \chapheadingskip{10000}%
5180 %
5181 \smallfonts \rm
5182 \tolerance = 9500
5183 \plainfrenchspacing
5184 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5185 %
5186 % See if the index file exists and is nonempty.
5187 % Change catcode of @ here so that if the index file contains
5188 % \initial {@}
5189 % as its first line, TeX doesn't complain about mismatched braces
5190 % (because it thinks @} is a control sequence).
5191 \catcode`\@ = 11
5192 % See comment in \requireopenindexfile.
5193 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5194 \openin 1 \jobname.\indexname s
5195 \ifeof 1
5196 % \enddoublecolumns gets confused if there is no text in the index,
5197 % and it loses the chapter title and the aux file entries for the
5198 % index. The easiest way to prevent this problem is to make sure
5199 % there is some text.
5200 \putwordIndexNonexistent
5201 \else
5202 \catcode`\\ = 0
5203 \escapechar = `\\
5204 %
5205 % If the index file exists but is empty, then \openin leaves \ifeof
5206 % false. We have to make TeX try to read something from the file, so
5207 % it can discover if there is anything in it.
5208 \read 1 to \thisline
5209 \ifeof 1
5210 \putwordIndexIsEmpty
5211 \else
5212 % Index files are almost Texinfo source, but we use \ as the escape
5213 % character. It would be better to use @, but that's too big a change
5214 % to make right now.
5215 \def\indexbackslash{\ttbackslash}%
5216 \let\indexlbrace\{ % Likewise, set these sequences for braces
5217 \let\indexrbrace\} % used in the sort key.
5218 \begindoublecolumns
5219 \let\entryorphanpenalty=\indexorphanpenalty
5220 %
5221 % Read input from the index file line by line.
5222 \loopdo
5223 \ifeof1
5224 \let\firsttoken\relax
5225 \else
5226 \read 1 to \nextline
5227 \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
5228 \act
5229 \fi
5230 \thisline
5231 %
5232 \ifeof1\else
5233 \let\thisline\nextline
5234 \repeat
5235 %%
5236 \enddoublecolumns
5237 \fi
5238 \fi
5239 \closein 1
5240 \endgroup}
5241
5242 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
5243 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
5244
5245 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
5246 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
5247
5248 % These macros are used by the sorted index file itself.
5249 % Change them to control the appearance of the index.
5250
5251 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5252 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5253 \catcode`\$=3
5254 \gdef\initialglyphs{%
5255 % Some changes for non-alphabetic characters. Using the glyphs from the
5256 % math fonts looks more consistent than the typewriter font used elsewhere
5257 % for these characters.
5258 \def\indexbackslash{\math{\backslash}}%
5259 \let\\=\indexbackslash
5260 %
5261 % Can't get bold backslash so don't use bold forward slash
5262 \catcode`\/=13
5263 \def/{{\secrmnotbold \normalslash}}%
5264 \def-{{\normaldash\normaldash}}% en dash `--'
5265 \def^{{\chapbf \normalcaret}}%
5266 \def~{{\chapbf \normaltilde}}%
5267 \def\_{%
5268 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5269 \def|{$\vert$}%
5270 \def<{$\less$}%
5271 \def>{$\gtr$}%
5272 \def+{$\normalplus$}%
5273 }}
5274
5275 \def\initial{%
5276 \bgroup
5277 \initialglyphs
5278 \initialx
5279 }
5280
5281 \def\initialx#1{%
5282 % Remove any glue we may have, we'll be inserting our own.
5283 \removelastskip
5284 %
5285 % We like breaks before the index initials, so insert a bonus.
5286 % The glue before the bonus allows a little bit of space at the
5287 % bottom of a column to reduce an increase in inter-line spacing.
5288 \nobreak
5289 \vskip 0pt plus 5\baselineskip
5290 \penalty -300
5291 \vskip 0pt plus -5\baselineskip
5292 %
5293 % Typeset the initial. Making this add up to a whole number of
5294 % baselineskips increases the chance of the dots lining up from column
5295 % to column. It still won't often be perfect, because of the stretch
5296 % we need before each entry, but it's better.
5297 %
5298 % No shrink because it confuses \balancecolumns.
5299 \vskip 1.67\baselineskip plus 1\baselineskip
5300 \leftline{\secfonts \kern-0.05em \secbf #1}%
5301 % \secfonts is inside the argument of \leftline so that the change of
5302 % \baselineskip will not affect any glue inserted before the vbox that
5303 % \leftline creates.
5304 % Do our best not to break after the initial.
5305 \nobreak
5306 \vskip .33\baselineskip plus .1\baselineskip
5307 \egroup % \initialglyphs
5308 }
5309
5310 \newdimen\entryrightmargin
5311 \entryrightmargin=0pt
5312
5313 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5314 % then page number (#2) flushed to the right margin. It is used for index
5315 % and table of contents entries. The paragraph is indented by \leftskip.
5316 %
5317 \def\entry{%
5318 \begingroup
5319 %
5320 % Start a new paragraph if necessary, so our assignments below can't
5321 % affect previous text.
5322 \par
5323 %
5324 % No extra space above this paragraph.
5325 \parskip = 0in
5326 %
5327 % When reading the text of entry, convert explicit line breaks
5328 % from @* into spaces. The user might give these in long section
5329 % titles, for instance.
5330 \def\*{\unskip\space\ignorespaces}%
5331 \def\entrybreak{\hfil\break}% An undocumented command
5332 %
5333 % A bit of stretch before each entry for the benefit of balancing
5334 % columns.
5335 \vskip 0pt plus0.5pt
5336 %
5337 % Swallow the left brace of the text (first parameter):
5338 \afterassignment\doentry
5339 \let\temp =
5340 }
5341 \def\entrybreak{\unskip\space\ignorespaces}%
5342 \def\doentry{%
5343 % Save the text of the entry
5344 \global\setbox\boxA=\hbox\bgroup
5345 \bgroup % Instead of the swallowed brace.
5346 \noindent
5347 \aftergroup\finishentry
5348 % And now comes the text of the entry.
5349 % Not absorbing as a macro argument reduces the chance of problems
5350 % with catcodes occurring.
5351 }
5352 {\catcode`\@=11
5353 \gdef\finishentry#1{%
5354 \egroup % end box A
5355 \dimen@ = \wd\boxA % Length of text of entry
5356 \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
5357 % #1 is the page number.
5358 %
5359 % Get the width of the page numbers, and only use
5360 % leaders if they are present.
5361 \global\setbox\boxB = \hbox{#1}%
5362 \ifdim\wd\boxB = 0pt
5363 \null\nobreak\hfill\ %
5364 \else
5365 %
5366 \null\nobreak\indexdotfill % Have leaders before the page number.
5367 %
5368 \ifpdf
5369 \pdfgettoks#1.%
5370 \bgroup\let\domark\relax
5371 \hskip\skip\thinshrinkable\the\toksA
5372 \egroup
5373 % The redefinion of \domark stops marks being added in \pdflink to
5374 % preserve coloured links across page boundaries. Otherwise the marks
5375 % would get in the way of \lastbox in \insertindexentrybox.
5376 \else
5377 \hskip\skip\thinshrinkable #1%
5378 \fi
5379 \fi
5380 \egroup % end \boxA
5381 \ifdim\wd\boxB = 0pt
5382 \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
5383 \else
5384 \global\setbox\entryindexbox=\vbox\bgroup
5385 \prevdepth=\entrylinedepth
5386 \noindent
5387 % We want the text of the entries to be aligned to the left, and the
5388 % page numbers to be aligned to the right.
5389 %
5390 \advance\leftskip by 0pt plus 1fil
5391 \advance\leftskip by 0pt plus -1fill
5392 \rightskip = 0pt plus -1fil
5393 \advance\rightskip by 0pt plus 1fill
5394 % Cause last line, which could consist of page numbers on their own
5395 % if the list of page numbers is long, to be aligned to the right.
5396 \parfillskip=0pt plus -1fill
5397 %
5398 \hangindent=1em
5399 %
5400 \advance\rightskip by \entryrightmargin
5401 % Determine how far we can stretch into the margin.
5402 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5403 % fit on one line in @letterpaper format.
5404 \ifdim\entryrightmargin>2.1em
5405 \dimen@i=2.1em
5406 \else
5407 \dimen@i=0em
5408 \fi
5409 \advance \parfillskip by 0pt minus 1\dimen@i
5410 %
5411 \dimen@ii = \hsize
5412 \advance\dimen@ii by -1\leftskip
5413 \advance\dimen@ii by -1\entryrightmargin
5414 \advance\dimen@ii by 1\dimen@i
5415 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5416 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5417 \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
5418 \dimen@ii = \hsize
5419 \advance \dimen@ii by -1em
5420 \ifnum\dimen@>\dimen@ii
5421 % If the entry is too long, use the whole line
5422 \dimen@ = \dimen@ii
5423 \fi
5424 \advance\leftskip by 0pt plus 1fill % ragged right
5425 \advance \dimen@ by 1\rightskip
5426 \parshape = 2 0pt \dimen@ 1em \dimen@ii
5427 % Ideally we'd add a finite glue at the end of the first line only, but
5428 % TeX doesn't seem to provide a way to do such a thing.
5429 \fi\fi
5430 \unhbox\boxA
5431 %
5432 % Do not prefer a separate line ending with a hyphen to fewer lines.
5433 \finalhyphendemerits = 0
5434 %
5435 % Word spacing - no stretch
5436 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5437 %
5438 \linepenalty=1000 % Discourage line breaks.
5439 \hyphenpenalty=5000 % Discourage hyphenation.
5440 %
5441 \par % format the paragraph
5442 \egroup % The \vbox
5443 \fi
5444 \endgroup
5445 % delay text of entry until after penalty
5446 \bgroup\aftergroup\insertindexentrybox
5447 \entryorphanpenalty
5448 }}
5449
5450 \newskip\thinshrinkable
5451 \skip\thinshrinkable=.15em minus .15em
5452
5453 \newbox\entryindexbox
5454 \def\insertindexentrybox{%
5455 \copy\entryindexbox
5456 % The following gets the depth of the last box. This is for even
5457 % line spacing when entries span several lines.
5458 \setbox\dummybox\vbox{%
5459 \unvbox\entryindexbox
5460 \nointerlineskip
5461 \lastbox
5462 \global\entrylinedepth=\prevdepth
5463 }%
5464 % Note that we couldn't simply \unvbox\entryindexbox followed by
5465 % \nointerlineskip\lastbox to remove the last box and then reinstate it,
5466 % because this resets how far the box has been \moveleft'ed to 0. \unvbox
5467 % doesn't affect \prevdepth either.
5468 }
5469 \newdimen\entrylinedepth
5470
5471 % Default is no penalty
5472 \let\entryorphanpenalty\egroup
5473
5474 % Used from \printindex. \firsttoken should be the first token
5475 % after the \entry. If it's not another \entry, we are at the last
5476 % line of a group of index entries, so insert a penalty to discourage
5477 % orphaned index entries.
5478 \long\def\indexorphanpenalty{%
5479 \def\isentry{\entry}%
5480 \ifx\firsttoken\isentry
5481 \else
5482 \unskip\penalty 9000
5483 % The \unskip here stops breaking before the glue. It relies on the
5484 % \vskip above being there, otherwise there is an error
5485 % "You can't use `\unskip' in vertical mode". There has to be glue
5486 % in the current vertical list that hasn't been added to the
5487 % "current page". See Chapter 24 of the TeXbook. This contradicts
5488 % Section 8.3.7 in "TeX by Topic," though.
5489 \fi
5490 \egroup % now comes the box added with \aftergroup
5491 }
5492
5493 % Like plain.tex's \dotfill, except uses up at least 1 em.
5494 % The filll stretch here overpowers both the fil and fill stretch to push
5495 % the page number to the right.
5496 \def\indexdotfill{\cleaders
5497 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5498
5499
5500 \def\primary #1{\line{#1\hfil}}
5501
5502 \newskip\secondaryindent \secondaryindent=0.5cm
5503 \def\secondary#1#2{{%
5504 \parfillskip=0in
5505 \parskip=0in
5506 \hangindent=1in
5507 \hangafter=1
5508 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5509 \ifpdf
5510 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5511 \else
5512 #2
5513 \fi
5514 \par
5515 }}
5516
5517 % Define two-column mode, which we use to typeset indexes.
5518 % Adapted from the TeXbook, page 416, which is to say,
5519 % the manmac.tex format used to print the TeXbook itself.
5520 \catcode`\@=11 % private names
5521
5522 \newbox\partialpage
5523 \newdimen\doublecolumnhsize
5524 \newdimen\doublecolumntopgap
5525 \doublecolumntopgap = 0pt
5526
5527 % Use inside an output routine to save \topmark and \firstmark
5528 \def\savemarks{%
5529 \global\savedtopmark=\expandafter{\topmark }%
5530 \global\savedfirstmark=\expandafter{\firstmark }%
5531 }
5532 \newtoks\savedtopmark
5533 \newtoks\savedfirstmark
5534
5535 % Set \topmark and \firstmark for next time \output runs.
5536 % Can't be run from withinside \output (because any material
5537 % added while an output routine is active, including
5538 % penalties, is saved for after it finishes). The page so far
5539 % should be empty, otherwise what's on it will be thrown away.
5540 \def\restoremarks{%
5541 \mark{\the\savedtopmark}%
5542 \bgroup\output = {%
5543 \setbox\dummybox=\box\PAGE
5544 }abc\eject\egroup
5545 % "abc" because output routine doesn't fire for a completely empty page.
5546 \mark{\the\savedfirstmark}%
5547 }
5548
5549 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5550 % If not much space left on page, start a new page.
5551 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5552 %
5553 % Grab any single-column material above us.
5554 \output = {%
5555 %
5556 % Here is a possibility not foreseen in manmac: if we accumulate a
5557 % whole lot of material, we might end up calling this \output
5558 % routine twice in a row (see the doublecol-lose test, which is
5559 % essentially a couple of indexes with @setchapternewpage off). In
5560 % that case we just ship out what is in \partialpage with the normal
5561 % output routine. Generally, \partialpage will be empty when this
5562 % runs and this will be a no-op. See the indexspread.tex test case.
5563 \ifvoid\partialpage \else
5564 \onepageout{\pagecontents\partialpage}%
5565 \fi
5566 %
5567 \global\setbox\partialpage = \vbox{%
5568 % Unvbox the main output page.
5569 \unvbox\PAGE
5570 \kern-\topskip \kern\baselineskip
5571 }%
5572 \savemarks
5573 }%
5574 \eject % run that output routine to set \partialpage
5575 \restoremarks
5576 %
5577 % We recover the two marks that the last output routine saved in order
5578 % to propagate the information in marks added around a chapter heading,
5579 % which could be otherwise be lost by the time the final page is output.
5580 %
5581 %
5582 % Use the double-column output routine for subsequent pages.
5583 \output = {\doublecolumnout}%
5584 %
5585 % Change the page size parameters. We could do this once outside this
5586 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5587 % format, but then we repeat the same computation. Repeating a couple
5588 % of assignments once per index is clearly meaningless for the
5589 % execution time, so we may as well do it in one place.
5590 %
5591 % First we halve the line length, less a little for the gutter between
5592 % the columns. We compute the gutter based on the line length, so it
5593 % changes automatically with the paper format. The magic constant
5594 % below is chosen so that the gutter has the same value (well, +-<1pt)
5595 % as it did when we hard-coded it.
5596 %
5597 % We put the result in a separate register, \doublecolumhsize, so we
5598 % can restore it in \pagesofar, after \hsize itself has (potentially)
5599 % been clobbered.
5600 %
5601 \doublecolumnhsize = \hsize
5602 \advance\doublecolumnhsize by -.04154\hsize
5603 \divide\doublecolumnhsize by 2
5604 \hsize = \doublecolumnhsize
5605 %
5606 % Double the \vsize as well. (We don't need a separate register here,
5607 % since nobody clobbers \vsize.)
5608 \global\doublecolumntopgap = \topskip
5609 \global\advance\doublecolumntopgap by -1\baselineskip
5610 \advance\vsize by -1\doublecolumntopgap
5611 \vsize = 2\vsize
5612 \topskip=0pt
5613 \global\entrylinedepth=0pt\relax
5614 }
5615
5616 % The double-column output routine for all double-column pages except
5617 % the last, which is done by \balancecolumns.
5618 %
5619 \def\doublecolumnout{%
5620 %
5621 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5622 % Get the available space for the double columns -- the normal
5623 % (undoubled) page height minus any material left over from the
5624 % previous page.
5625 \dimen@ = \vsize
5626 \divide\dimen@ by 2
5627 \advance\dimen@ by -\ht\partialpage
5628 %
5629 % box0 will be the left-hand column, box2 the right.
5630 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
5631 \onepageout\pagesofar
5632 \unvbox255
5633 \penalty\outputpenalty
5634 }
5635 %
5636 % Re-output the contents of the output page -- any previous material,
5637 % followed by the two boxes we just split, in box0 and box2.
5638 \def\pagesofar{%
5639 \unvbox\partialpage
5640 %
5641 \hsize = \doublecolumnhsize
5642 \wd0=\hsize \wd2=\hsize
5643 \vbox{%
5644 \vskip\doublecolumntopgap
5645 \hbox to\pagewidth{\box0\hfil\box2}}%
5646 }
5647
5648
5649 % Finished with with double columns.
5650 \def\enddoublecolumns{%
5651 % The following penalty ensures that the page builder is exercised
5652 % _before_ we change the output routine. This is necessary in the
5653 % following situation:
5654 %
5655 % The last section of the index consists only of a single entry.
5656 % Before this section, \pagetotal is less than \pagegoal, so no
5657 % break occurs before the last section starts. However, the last
5658 % section, consisting of \initial and the single \entry, does not
5659 % fit on the page and has to be broken off. Without the following
5660 % penalty the page builder will not be exercised until \eject
5661 % below, and by that time we'll already have changed the output
5662 % routine to the \balancecolumns version, so the next-to-last
5663 % double-column page will be processed with \balancecolumns, which
5664 % is wrong: The two columns will go to the main vertical list, with
5665 % the broken-off section in the recent contributions. As soon as
5666 % the output routine finishes, TeX starts reconsidering the page
5667 % break. The two columns and the broken-off section both fit on the
5668 % page, because the two columns now take up only half of the page
5669 % goal. When TeX sees \eject from below which follows the final
5670 % section, it invokes the new output routine that we've set after
5671 % \balancecolumns below; \onepageout will try to fit the two columns
5672 % and the final section into the vbox of \pageheight (see
5673 % \pagebody), causing an overfull box.
5674 %
5675 % Note that glue won't work here, because glue does not exercise the
5676 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5677 \penalty0
5678 %
5679 \output = {%
5680 % Split the last of the double-column material.
5681 \savemarks
5682 \balancecolumns
5683 %
5684 % Having called \balancecolumns once, we do not
5685 % want to call it again. Therefore, reset \output to its normal
5686 % definition right away.
5687 \global\output = {\onepageout{\pagecontents\PAGE}}%
5688 }%
5689 \eject
5690 \endgroup % started in \begindoublecolumns
5691 \restoremarks
5692 % Leave the double-column material on the current page, no automatic
5693 % page break.
5694 \box\balancedcolumns
5695 %
5696 % \pagegoal was set to the doubled \vsize above, since we restarted
5697 % the current page. We're now back to normal single-column
5698 % typesetting, so reset \pagegoal to the normal \vsize (after the
5699 % \endgroup where \vsize got restored).
5700 \pagegoal = \vsize
5701 }
5702 \newbox\balancedcolumns
5703 \setbox\balancedcolumns=\vbox{shouldnt see this}%
5704 %
5705 % Only called for the last of the double column material. \doublecolumnout
5706 % does the others.
5707 \def\balancecolumns{%
5708 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
5709 \dimen@ = \ht0
5710 \advance\dimen@ by \topskip
5711 \advance\dimen@ by-\baselineskip
5712 \ifdim\dimen@<14\baselineskip
5713 % Don't split a short final column in two.
5714 \setbox2=\vbox{}%
5715 \else
5716 \divide\dimen@ by 2 % target to split to
5717 \dimen@ii = \dimen@
5718 \splittopskip = \topskip
5719 % Loop until the second column is no higher than the first
5720 {%
5721 \vbadness = 10000
5722 \loop
5723 \global\setbox3 = \copy0
5724 \global\setbox1 = \vsplit3 to \dimen@
5725 % Remove glue from bottom of first column to
5726 % make sure it is higher than the second.
5727 \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}%
5728 \ifdim\ht3>\ht1
5729 \global\advance\dimen@ by 1pt
5730 \repeat
5731 }%
5732 \multiply\dimen@ii by 4
5733 \divide\dimen@ii by 5
5734 \ifdim\ht3<\dimen@ii
5735 % Column heights are too different, so don't make their bottoms
5736 % flush with each other. The glue at the end of the second column
5737 % allows a second column to stretch, reducing the difference in
5738 % height between the two.
5739 \setbox0=\vbox to\dimen@{\unvbox1\vfill}%
5740 \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}%
5741 \else
5742 \setbox0=\vbox to\dimen@{\unvbox1}%
5743 \setbox2=\vbox to\dimen@{\unvbox3}%
5744 \fi
5745 \fi
5746 %
5747 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5748 }
5749 \catcode`\@ = \other
5750
5751
5752 \message{sectioning,}
5753 % Chapters, sections, etc.
5754
5755 % Let's start with @part.
5756 \outer\parseargdef\part{\partzzz{#1}}
5757 \def\partzzz#1{%
5758 \chapoddpage
5759 \null
5760 \vskip.3\vsize % move it down on the page a bit
5761 \begingroup
5762 \noindent \titlefonts\rmisbold #1\par % the text
5763 \let\lastnode=\empty % no node to associate with
5764 \writetocentry{part}{#1}{}% but put it in the toc
5765 \headingsoff % no headline or footline on the part page
5766 % This outputs a mark at the end of the page that clears \thischapter
5767 % and \thissection, as is done in \startcontents.
5768 \let\pchapsepmacro\relax
5769 \chapmacro{}{Yomitfromtoc}{}%
5770 \chapoddpage
5771 \endgroup
5772 }
5773
5774 % \unnumberedno is an oxymoron. But we count the unnumbered
5775 % sections so that we can refer to them unambiguously in the pdf
5776 % outlines by their "section number". We avoid collisions with chapter
5777 % numbers by starting them at 10000. (If a document ever has 10000
5778 % chapters, we're in trouble anyway, I'm sure.)
5779 \newcount\unnumberedno \unnumberedno = 10000
5780 \newcount\chapno
5781 \newcount\secno \secno=0
5782 \newcount\subsecno \subsecno=0
5783 \newcount\subsubsecno \subsubsecno=0
5784
5785 % This counter is funny since it counts through charcodes of letters A, B, ...
5786 \newcount\appendixno \appendixno = `\@
5787 %
5788 % \def\appendixletter{\char\the\appendixno}
5789 % We do the following ugly conditional instead of the above simple
5790 % construct for the sake of pdftex, which needs the actual
5791 % letter in the expansion, not just typeset.
5792 %
5793 \def\appendixletter{%
5794 \ifnum\appendixno=`A A%
5795 \else\ifnum\appendixno=`B B%
5796 \else\ifnum\appendixno=`C C%
5797 \else\ifnum\appendixno=`D D%
5798 \else\ifnum\appendixno=`E E%
5799 \else\ifnum\appendixno=`F F%
5800 \else\ifnum\appendixno=`G G%
5801 \else\ifnum\appendixno=`H H%
5802 \else\ifnum\appendixno=`I I%
5803 \else\ifnum\appendixno=`J J%
5804 \else\ifnum\appendixno=`K K%
5805 \else\ifnum\appendixno=`L L%
5806 \else\ifnum\appendixno=`M M%
5807 \else\ifnum\appendixno=`N N%
5808 \else\ifnum\appendixno=`O O%
5809 \else\ifnum\appendixno=`P P%
5810 \else\ifnum\appendixno=`Q Q%
5811 \else\ifnum\appendixno=`R R%
5812 \else\ifnum\appendixno=`S S%
5813 \else\ifnum\appendixno=`T T%
5814 \else\ifnum\appendixno=`U U%
5815 \else\ifnum\appendixno=`V V%
5816 \else\ifnum\appendixno=`W W%
5817 \else\ifnum\appendixno=`X X%
5818 \else\ifnum\appendixno=`Y Y%
5819 \else\ifnum\appendixno=`Z Z%
5820 % The \the is necessary, despite appearances, because \appendixletter is
5821 % expanded while writing the .toc file. \char\appendixno is not
5822 % expandable, thus it is written literally, thus all appendixes come out
5823 % with the same letter (or @) in the toc without it.
5824 \else\char\the\appendixno
5825 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
5826 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
5827
5828 % Each @chapter defines these (using marks) as the number+name, number
5829 % and name of the chapter. Page headings and footings can use
5830 % these. @section does likewise.
5831 \def\thischapter{}
5832 \def\thischapternum{}
5833 \def\thischaptername{}
5834 \def\thissection{}
5835 \def\thissectionnum{}
5836 \def\thissectionname{}
5837
5838 \newcount\absseclevel % used to calculate proper heading level
5839 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
5840
5841 % @raisesections: treat @section as chapter, @subsection as section, etc.
5842 \def\raisesections{\global\advance\secbase by -1}
5843 \let\up=\raisesections % original BFox name
5844
5845 % @lowersections: treat @chapter as section, @section as subsection, etc.
5846 \def\lowersections{\global\advance\secbase by 1}
5847 \let\down=\lowersections % original BFox name
5848
5849 % we only have subsub.
5850 \chardef\maxseclevel = 3
5851 %
5852 % A numbered section within an unnumbered changes to unnumbered too.
5853 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
5854 \chardef\unnlevel = \maxseclevel
5855 %
5856 % Trace whether the current chapter is an appendix or not:
5857 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
5858 \def\chapheadtype{N}
5859
5860 % Choose a heading macro
5861 % #1 is heading type
5862 % #2 is heading level
5863 % #3 is text for heading
5864 \def\genhead#1#2#3{%
5865 % Compute the abs. sec. level:
5866 \absseclevel=#2
5867 \advance\absseclevel by \secbase
5868 % Make sure \absseclevel doesn't fall outside the range:
5869 \ifnum \absseclevel < 0
5870 \absseclevel = 0
5871 \else
5872 \ifnum \absseclevel > 3
5873 \absseclevel = 3
5874 \fi
5875 \fi
5876 % The heading type:
5877 \def\headtype{#1}%
5878 \if \headtype U%
5879 \ifnum \absseclevel < \unnlevel
5880 \chardef\unnlevel = \absseclevel
5881 \fi
5882 \else
5883 % Check for appendix sections:
5884 \ifnum \absseclevel = 0
5885 \edef\chapheadtype{\headtype}%
5886 \else
5887 \if \headtype A\if \chapheadtype N%
5888 \errmessage{@appendix... within a non-appendix chapter}%
5889 \fi\fi
5890 \fi
5891 % Check for numbered within unnumbered:
5892 \ifnum \absseclevel > \unnlevel
5893 \def\headtype{U}%
5894 \else
5895 \chardef\unnlevel = 3
5896 \fi
5897 \fi
5898 % Now print the heading:
5899 \if \headtype U%
5900 \ifcase\absseclevel
5901 \unnumberedzzz{#3}%
5902 \or \unnumberedseczzz{#3}%
5903 \or \unnumberedsubseczzz{#3}%
5904 \or \unnumberedsubsubseczzz{#3}%
5905 \fi
5906 \else
5907 \if \headtype A%
5908 \ifcase\absseclevel
5909 \appendixzzz{#3}%
5910 \or \appendixsectionzzz{#3}%
5911 \or \appendixsubseczzz{#3}%
5912 \or \appendixsubsubseczzz{#3}%
5913 \fi
5914 \else
5915 \ifcase\absseclevel
5916 \chapterzzz{#3}%
5917 \or \seczzz{#3}%
5918 \or \numberedsubseczzz{#3}%
5919 \or \numberedsubsubseczzz{#3}%
5920 \fi
5921 \fi
5922 \fi
5923 \suppressfirstparagraphindent
5924 }
5925
5926 % an interface:
5927 \def\numhead{\genhead N}
5928 \def\apphead{\genhead A}
5929 \def\unnmhead{\genhead U}
5930
5931 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
5932 % all lower-level sectioning counters to zero.
5933 %
5934 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
5935 % (e.g., figures), q.v. By default (before any chapter), that is empty.
5936 \let\chaplevelprefix = \empty
5937 %
5938 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
5939 \def\chapterzzz#1{%
5940 % section resetting is \global in case the chapter is in a group, such
5941 % as an @include file.
5942 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5943 \global\advance\chapno by 1
5944 %
5945 % Used for \float.
5946 \gdef\chaplevelprefix{\the\chapno.}%
5947 \resetallfloatnos
5948 %
5949 % \putwordChapter can contain complex things in translations.
5950 \toks0=\expandafter{\putwordChapter}%
5951 \message{\the\toks0 \space \the\chapno}%
5952 %
5953 % Write the actual heading.
5954 \chapmacro{#1}{Ynumbered}{\the\chapno}%
5955 %
5956 % So @section and the like are numbered underneath this chapter.
5957 \global\let\section = \numberedsec
5958 \global\let\subsection = \numberedsubsec
5959 \global\let\subsubsection = \numberedsubsubsec
5960 }
5961
5962 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
5963 %
5964 \def\appendixzzz#1{%
5965 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5966 \global\advance\appendixno by 1
5967 \gdef\chaplevelprefix{\appendixletter.}%
5968 \resetallfloatnos
5969 %
5970 % \putwordAppendix can contain complex things in translations.
5971 \toks0=\expandafter{\putwordAppendix}%
5972 \message{\the\toks0 \space \appendixletter}%
5973 %
5974 \chapmacro{#1}{Yappendix}{\appendixletter}%
5975 %
5976 \global\let\section = \appendixsec
5977 \global\let\subsection = \appendixsubsec
5978 \global\let\subsubsection = \appendixsubsubsec
5979 }
5980
5981 % normally unnmhead0 calls unnumberedzzz:
5982 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
5983 \def\unnumberedzzz#1{%
5984 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5985 \global\advance\unnumberedno by 1
5986 %
5987 % Since an unnumbered has no number, no prefix for figures.
5988 \global\let\chaplevelprefix = \empty
5989 \resetallfloatnos
5990 %
5991 % This used to be simply \message{#1}, but TeX fully expands the
5992 % argument to \message. Therefore, if #1 contained @-commands, TeX
5993 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
5994 % expanded @cite (which turns out to cause errors because \cite is meant
5995 % to be executed, not expanded).
5996 %
5997 % Anyway, we don't want the fully-expanded definition of @cite to appear
5998 % as a result of the \message, we just want `@cite' itself. We use
5999 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6000 % simply yielding the contents of <toks register>. (We also do this for
6001 % the toc entries.)
6002 \toks0 = {#1}%
6003 \message{(\the\toks0)}%
6004 %
6005 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6006 %
6007 \global\let\section = \unnumberedsec
6008 \global\let\subsection = \unnumberedsubsec
6009 \global\let\subsubsection = \unnumberedsubsubsec
6010 }
6011
6012 % @centerchap is like @unnumbered, but the heading is centered.
6013 \outer\parseargdef\centerchap{%
6014 \let\centerparametersmaybe = \centerparameters
6015 \unnmhead0{#1}%
6016 \let\centerparametersmaybe = \relax
6017 }
6018
6019 % @top is like @unnumbered.
6020 \let\top\unnumbered
6021
6022 % Sections.
6023 %
6024 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6025 \def\seczzz#1{%
6026 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6027 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6028 }
6029
6030 % normally calls appendixsectionzzz:
6031 \outer\parseargdef\appendixsection{\apphead1{#1}}
6032 \def\appendixsectionzzz#1{%
6033 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6034 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6035 }
6036 \let\appendixsec\appendixsection
6037
6038 % normally calls unnumberedseczzz:
6039 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6040 \def\unnumberedseczzz#1{%
6041 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6042 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6043 }
6044
6045 % Subsections.
6046 %
6047 % normally calls numberedsubseczzz:
6048 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6049 \def\numberedsubseczzz#1{%
6050 \global\subsubsecno=0 \global\advance\subsecno by 1
6051 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6052 }
6053
6054 % normally calls appendixsubseczzz:
6055 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6056 \def\appendixsubseczzz#1{%
6057 \global\subsubsecno=0 \global\advance\subsecno by 1
6058 \sectionheading{#1}{subsec}{Yappendix}%
6059 {\appendixletter.\the\secno.\the\subsecno}%
6060 }
6061
6062 % normally calls unnumberedsubseczzz:
6063 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6064 \def\unnumberedsubseczzz#1{%
6065 \global\subsubsecno=0 \global\advance\subsecno by 1
6066 \sectionheading{#1}{subsec}{Ynothing}%
6067 {\the\unnumberedno.\the\secno.\the\subsecno}%
6068 }
6069
6070 % Subsubsections.
6071 %
6072 % normally numberedsubsubseczzz:
6073 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6074 \def\numberedsubsubseczzz#1{%
6075 \global\advance\subsubsecno by 1
6076 \sectionheading{#1}{subsubsec}{Ynumbered}%
6077 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6078 }
6079
6080 % normally appendixsubsubseczzz:
6081 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6082 \def\appendixsubsubseczzz#1{%
6083 \global\advance\subsubsecno by 1
6084 \sectionheading{#1}{subsubsec}{Yappendix}%
6085 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6086 }
6087
6088 % normally unnumberedsubsubseczzz:
6089 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6090 \def\unnumberedsubsubseczzz#1{%
6091 \global\advance\subsubsecno by 1
6092 \sectionheading{#1}{subsubsec}{Ynothing}%
6093 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6094 }
6095
6096 % These macros control what the section commands do, according
6097 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6098 % Define them by default for a numbered chapter.
6099 \let\section = \numberedsec
6100 \let\subsection = \numberedsubsec
6101 \let\subsubsection = \numberedsubsubsec
6102
6103 % Define @majorheading, @heading and @subheading
6104
6105 \def\majorheading{%
6106 {\advance\chapheadingskip by 10pt \chapbreak }%
6107 \parsearg\chapheadingzzz
6108 }
6109
6110 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6111 \def\chapheadingzzz#1{%
6112 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6113 \nobreak\bigskip \nobreak
6114 \suppressfirstparagraphindent
6115 }
6116
6117 % @heading, @subheading, @subsubheading.
6118 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6119 \suppressfirstparagraphindent}
6120 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6121 \suppressfirstparagraphindent}
6122 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6123 \suppressfirstparagraphindent}
6124
6125 % These macros generate a chapter, section, etc. heading only
6126 % (including whitespace, linebreaking, etc. around it),
6127 % given all the information in convenient, parsed form.
6128
6129 % Args are the skip and penalty (usually negative)
6130 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6131
6132 % Parameter controlling skip before chapter headings (if needed)
6133 \newskip\chapheadingskip
6134
6135 % Define plain chapter starts, and page on/off switching for it.
6136 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6137
6138 % Start a new page
6139 \def\chappager{\par\vfill\supereject}
6140
6141 % \chapoddpage - start on an odd page for a new chapter
6142 % Because \domark is called before \chapoddpage, the filler page will
6143 % get the headings for the next chapter, which is wrong. But we don't
6144 % care -- we just disable all headings on the filler page.
6145 \def\chapoddpage{%
6146 \chappager
6147 \ifodd\pageno \else
6148 \begingroup
6149 \headingsoff
6150 \null
6151 \chappager
6152 \endgroup
6153 \fi
6154 }
6155
6156 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
6157
6158 \def\CHAPPAGoff{%
6159 \global\let\contentsalignmacro = \chappager
6160 \global\let\pchapsepmacro=\chapbreak
6161 \global\let\pagealignmacro=\chappager}
6162
6163 \def\CHAPPAGon{%
6164 \global\let\contentsalignmacro = \chappager
6165 \global\let\pchapsepmacro=\chappager
6166 \global\let\pagealignmacro=\chappager
6167 \global\def\HEADINGSon{\HEADINGSsingle}}
6168
6169 \def\CHAPPAGodd{%
6170 \global\let\contentsalignmacro = \chapoddpage
6171 \global\let\pchapsepmacro=\chapoddpage
6172 \global\let\pagealignmacro=\chapoddpage
6173 \global\def\HEADINGSon{\HEADINGSdouble}}
6174
6175 \CHAPPAGon
6176
6177 % \chapmacro - Chapter opening.
6178 %
6179 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6180 % Yappendix, Yomitfromtoc), #3 the chapter number.
6181 % Not used for @heading series.
6182 %
6183 % To test against our argument.
6184 \def\Ynothingkeyword{Ynothing}
6185 \def\Yappendixkeyword{Yappendix}
6186 \def\Yomitfromtockeyword{Yomitfromtoc}
6187 %
6188 \def\chapmacro#1#2#3{%
6189 \expandafter\ifx\thisenv\titlepage\else
6190 \checkenv{}% chapters, etc., should not start inside an environment.
6191 \fi
6192 % FIXME: \chapmacro is currently called from inside \titlepage when
6193 % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
6194 % this should probably be done by \sectionheading with an option to print
6195 % in chapter size.
6196 %
6197 % Insert the first mark before the heading break (see notes for \domark).
6198 \let\prevchapterdefs=\lastchapterdefs
6199 \let\prevsectiondefs=\lastsectiondefs
6200 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6201 \gdef\thissection{}}%
6202 %
6203 \def\temptype{#2}%
6204 \ifx\temptype\Ynothingkeyword
6205 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6206 \gdef\thischapter{\thischaptername}}%
6207 \else\ifx\temptype\Yomitfromtockeyword
6208 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6209 \gdef\thischapter{}}%
6210 \else\ifx\temptype\Yappendixkeyword
6211 \toks0={#1}%
6212 \xdef\lastchapterdefs{%
6213 \gdef\noexpand\thischaptername{\the\toks0}%
6214 \gdef\noexpand\thischapternum{\appendixletter}%
6215 % \noexpand\putwordAppendix avoids expanding indigestible
6216 % commands in some of the translations.
6217 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6218 \noexpand\thischapternum:
6219 \noexpand\thischaptername}%
6220 }%
6221 \else
6222 \toks0={#1}%
6223 \xdef\lastchapterdefs{%
6224 \gdef\noexpand\thischaptername{\the\toks0}%
6225 \gdef\noexpand\thischapternum{\the\chapno}%
6226 % \noexpand\putwordChapter avoids expanding indigestible
6227 % commands in some of the translations.
6228 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6229 \noexpand\thischapternum:
6230 \noexpand\thischaptername}%
6231 }%
6232 \fi\fi\fi
6233 %
6234 % Output the mark. Pass it through \safewhatsit, to take care of
6235 % the preceding space.
6236 \safewhatsit\domark
6237 %
6238 % Insert the chapter heading break.
6239 \pchapsepmacro
6240 %
6241 % Now the second mark, after the heading break. No break points
6242 % between here and the heading.
6243 \let\prevchapterdefs=\lastchapterdefs
6244 \let\prevsectiondefs=\lastsectiondefs
6245 \domark
6246 %
6247 {%
6248 \chapfonts \rmisbold
6249 \let\footnote=\errfootnoteheading % give better error message
6250 %
6251 % Have to define \lastsection before calling \donoderef, because the
6252 % xref code eventually uses it. On the other hand, it has to be called
6253 % after \pchapsepmacro, or the headline will change too soon.
6254 \gdef\lastsection{#1}%
6255 %
6256 % Only insert the separating space if we have a chapter/appendix
6257 % number, and don't print the unnumbered ``number''.
6258 \ifx\temptype\Ynothingkeyword
6259 \setbox0 = \hbox{}%
6260 \def\toctype{unnchap}%
6261 \else\ifx\temptype\Yomitfromtockeyword
6262 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6263 \def\toctype{omit}%
6264 \else\ifx\temptype\Yappendixkeyword
6265 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6266 \def\toctype{app}%
6267 \else
6268 \setbox0 = \hbox{#3\enspace}%
6269 \def\toctype{numchap}%
6270 \fi\fi\fi
6271 %
6272 % Write the toc entry for this chapter. Must come before the
6273 % \donoderef, because we include the current node name in the toc
6274 % entry, and \donoderef resets it to empty.
6275 \writetocentry{\toctype}{#1}{#3}%
6276 %
6277 % For pdftex, we have to write out the node definition (aka, make
6278 % the pdfdest) after any page break, but before the actual text has
6279 % been typeset. If the destination for the pdf outline is after the
6280 % text, then jumping from the outline may wind up with the text not
6281 % being visible, for instance under high magnification.
6282 \donoderef{#2}%
6283 %
6284 % Typeset the actual heading.
6285 \nobreak % Avoid page breaks at the interline glue.
6286 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6287 \unhbox0 #1\par}%
6288 }%
6289 \nobreak\bigskip % no page break after a chapter title
6290 \nobreak
6291 }
6292
6293 % @centerchap -- centered and unnumbered.
6294 \let\centerparametersmaybe = \relax
6295 \def\centerparameters{%
6296 \advance\rightskip by 3\rightskip
6297 \leftskip = \rightskip
6298 \parfillskip = 0pt
6299 }
6300
6301
6302 % I don't think this chapter style is supported any more, so I'm not
6303 % updating it with the new noderef stuff. We'll see. --karl, 11aug03.
6304 %
6305 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
6306 %
6307 \def\unnchfopen #1{%
6308 \chapoddpage
6309 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6310 \nobreak\bigskip\nobreak
6311 }
6312 \def\chfopen #1#2{\chapoddpage {\chapfonts
6313 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
6314 \par\penalty 5000 %
6315 }
6316 \def\centerchfopen #1{%
6317 \chapoddpage
6318 \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
6319 \nobreak\bigskip \nobreak
6320 }
6321 \def\CHAPFopen{%
6322 \global\let\chapmacro=\chfopen
6323 \global\let\centerchapmacro=\centerchfopen}
6324
6325
6326 % Section titles. These macros combine the section number parts and
6327 % call the generic \sectionheading to do the printing.
6328 %
6329 \newskip\secheadingskip
6330 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6331
6332 % Subsection titles.
6333 \newskip\subsecheadingskip
6334 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6335
6336 % Subsubsection titles.
6337 \def\subsubsecheadingskip{\subsecheadingskip}
6338 \def\subsubsecheadingbreak{\subsecheadingbreak}
6339
6340
6341 % Print any size, any type, section title.
6342 %
6343 % #1 is the text of the title,
6344 % #2 is the section level (sec/subsec/subsubsec),
6345 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6346 % #4 is the section number.
6347 %
6348 \def\seckeyword{sec}
6349 %
6350 \def\sectionheading#1#2#3#4{%
6351 {%
6352 \def\sectionlevel{#2}%
6353 \def\temptype{#3}%
6354 %
6355 % It is ok for the @heading series commands to appear inside an
6356 % environment (it's been historically allowed, though the logic is
6357 % dubious), but not the others.
6358 \ifx\temptype\Yomitfromtockeyword\else
6359 \checkenv{}% non-@*heading should not be in an environment.
6360 \fi
6361 \let\footnote=\errfootnoteheading
6362 %
6363 % Switch to the right set of fonts.
6364 \csname #2fonts\endcsname \rmisbold
6365 %
6366 % Insert first mark before the heading break (see notes for \domark).
6367 \let\prevsectiondefs=\lastsectiondefs
6368 \ifx\temptype\Ynothingkeyword
6369 \ifx\sectionlevel\seckeyword
6370 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6371 \gdef\thissection{\thissectionname}}%
6372 \fi
6373 \else\ifx\temptype\Yomitfromtockeyword
6374 % Don't redefine \thissection.
6375 \else\ifx\temptype\Yappendixkeyword
6376 \ifx\sectionlevel\seckeyword
6377 \toks0={#1}%
6378 \xdef\lastsectiondefs{%
6379 \gdef\noexpand\thissectionname{\the\toks0}%
6380 \gdef\noexpand\thissectionnum{#4}%
6381 % \noexpand\putwordSection avoids expanding indigestible
6382 % commands in some of the translations.
6383 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6384 \noexpand\thissectionnum:
6385 \noexpand\thissectionname}%
6386 }%
6387 \fi
6388 \else
6389 \ifx\sectionlevel\seckeyword
6390 \toks0={#1}%
6391 \xdef\lastsectiondefs{%
6392 \gdef\noexpand\thissectionname{\the\toks0}%
6393 \gdef\noexpand\thissectionnum{#4}%
6394 % \noexpand\putwordSection avoids expanding indigestible
6395 % commands in some of the translations.
6396 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6397 \noexpand\thissectionnum:
6398 \noexpand\thissectionname}%
6399 }%
6400 \fi
6401 \fi\fi\fi
6402 %
6403 % Go into vertical mode. Usually we'll already be there, but we
6404 % don't want the following whatsit to end up in a preceding paragraph
6405 % if the document didn't happen to have a blank line.
6406 \par
6407 %
6408 % Output the mark. Pass it through \safewhatsit, to take care of
6409 % the preceding space.
6410 \safewhatsit\domark
6411 %
6412 % Insert space above the heading.
6413 \csname #2headingbreak\endcsname
6414 %
6415 % Now the second mark, after the heading break. No break points
6416 % between here and the heading.
6417 \global\let\prevsectiondefs=\lastsectiondefs
6418 \domark
6419 %
6420 % Only insert the space after the number if we have a section number.
6421 \ifx\temptype\Ynothingkeyword
6422 \setbox0 = \hbox{}%
6423 \def\toctype{unn}%
6424 \gdef\lastsection{#1}%
6425 \else\ifx\temptype\Yomitfromtockeyword
6426 % for @headings -- no section number, don't include in toc,
6427 % and don't redefine \lastsection.
6428 \setbox0 = \hbox{}%
6429 \def\toctype{omit}%
6430 \let\sectionlevel=\empty
6431 \else\ifx\temptype\Yappendixkeyword
6432 \setbox0 = \hbox{#4\enspace}%
6433 \def\toctype{app}%
6434 \gdef\lastsection{#1}%
6435 \else
6436 \setbox0 = \hbox{#4\enspace}%
6437 \def\toctype{num}%
6438 \gdef\lastsection{#1}%
6439 \fi\fi\fi
6440 %
6441 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6442 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6443 %
6444 % Write the node reference (= pdf destination for pdftex).
6445 % Again, see comments in \chapmacro.
6446 \donoderef{#3}%
6447 %
6448 % Interline glue will be inserted when the vbox is completed.
6449 % That glue will be a valid breakpoint for the page, since it'll be
6450 % preceded by a whatsit (usually from the \donoderef, or from the
6451 % \writetocentry if there was no node). We don't want to allow that
6452 % break, since then the whatsits could end up on page n while the
6453 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6454 \nobreak
6455 %
6456 % Output the actual section heading.
6457 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6458 \hangindent=\wd0 % zero if no section number
6459 \unhbox0 #1}%
6460 }%
6461 % Add extra space after the heading -- half of whatever came above it.
6462 % Don't allow stretch, though.
6463 \kern .5 \csname #2headingskip\endcsname
6464 %
6465 % Do not let the kern be a potential breakpoint, as it would be if it
6466 % was followed by glue.
6467 \nobreak
6468 %
6469 % We'll almost certainly start a paragraph next, so don't let that
6470 % glue accumulate. (Not a breakpoint because it's preceded by a
6471 % discardable item.) However, when a paragraph is not started next
6472 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6473 % or the negative glue will cause weirdly wrong output, typically
6474 % obscuring the section heading with something else.
6475 \vskip-\parskip
6476 %
6477 % This is so the last item on the main vertical list is a known
6478 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6479 % and do the needful.
6480 \penalty 10001
6481 }
6482
6483
6484 \message{toc,}
6485 % Table of contents.
6486 \newwrite\tocfile
6487
6488 % Write an entry to the toc file, opening it if necessary.
6489 % Called from @chapter, etc.
6490 %
6491 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6492 % We append the current node name (if any) and page number as additional
6493 % arguments for the \{chap,sec,...}entry macros which will eventually
6494 % read this. The node name is used in the pdf outlines as the
6495 % destination to jump to.
6496 %
6497 % We open the .toc file for writing here instead of at @setfilename (or
6498 % any other fixed time) so that @contents can be anywhere in the document.
6499 % But if #1 is `omit', then we don't do anything. This is used for the
6500 % table of contents chapter openings themselves.
6501 %
6502 \newif\iftocfileopened
6503 \def\omitkeyword{omit}%
6504 %
6505 \def\writetocentry#1#2#3{%
6506 \edef\writetoctype{#1}%
6507 \ifx\writetoctype\omitkeyword \else
6508 \iftocfileopened\else
6509 \immediate\openout\tocfile = \jobname.toc
6510 \global\tocfileopenedtrue
6511 \fi
6512 %
6513 \iflinks
6514 {\atdummies
6515 \edef\temp{%
6516 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6517 \temp
6518 }%
6519 \fi
6520 \fi
6521 %
6522 % Tell \shipout to create a pdf destination on each page, if we're
6523 % writing pdf. These are used in the table of contents. We can't
6524 % just write one on every page because the title pages are numbered
6525 % 1 and 2 (the page numbers aren't printed), and so are the first
6526 % two pages of the document. Thus, we'd have two destinations named
6527 % `1', and two named `2'.
6528 \ifpdf \global\pdfmakepagedesttrue \fi
6529 }
6530
6531
6532 % These characters do not print properly in the Computer Modern roman
6533 % fonts, so we must take special care. This is more or less redundant
6534 % with the Texinfo input format setup at the end of this file.
6535 %
6536 \def\activecatcodes{%
6537 \catcode`\"=\active
6538 \catcode`\$=\active
6539 \catcode`\<=\active
6540 \catcode`\>=\active
6541 \catcode`\\=\active
6542 \catcode`\^=\active
6543 \catcode`\_=\active
6544 \catcode`\|=\active
6545 \catcode`\~=\active
6546 }
6547
6548
6549 % Read the toc file, which is essentially Texinfo input.
6550 \def\readtocfile{%
6551 \setupdatafile
6552 \activecatcodes
6553 \input \tocreadfilename
6554 }
6555
6556 \newskip\contentsrightmargin \contentsrightmargin=1in
6557 \newcount\savepageno
6558 \newcount\lastnegativepageno \lastnegativepageno = -1
6559
6560 % Prepare to read what we've written to \tocfile.
6561 %
6562 \def\startcontents#1{%
6563 % If @setchapternewpage on, and @headings double, the contents should
6564 % start on an odd page, unlike chapters. Thus, we maintain
6565 % \contentsalignmacro in parallel with \pagealignmacro.
6566 % From: Torbjorn Granlund <tege@matematik.su.se>
6567 \contentsalignmacro
6568 \immediate\closeout\tocfile
6569 %
6570 % Don't need to put `Contents' or `Short Contents' in the headline.
6571 % It is abundantly clear what they are.
6572 \chapmacro{#1}{Yomitfromtoc}{}%
6573 %
6574 \savepageno = \pageno
6575 \begingroup % Set up to handle contents files properly.
6576 \raggedbottom % Worry more about breakpoints than the bottom.
6577 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6578 %
6579 % Roman numerals for page numbers.
6580 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6581 }
6582
6583 % redefined for the two-volume lispref. We always output on
6584 % \jobname.toc even if this is redefined.
6585 %
6586 \def\tocreadfilename{\jobname.toc}
6587
6588 % Normal (long) toc.
6589 %
6590 \def\contents{%
6591 \startcontents{\putwordTOC}%
6592 \openin 1 \tocreadfilename\space
6593 \ifeof 1 \else
6594 \readtocfile
6595 \fi
6596 \vfill \eject
6597 \contentsalignmacro % in case @setchapternewpage odd is in effect
6598 \ifeof 1 \else
6599 \pdfmakeoutlines
6600 \fi
6601 \closein 1
6602 \endgroup
6603 \lastnegativepageno = \pageno
6604 \global\pageno = \savepageno
6605 }
6606
6607 % And just the chapters.
6608 \def\summarycontents{%
6609 \startcontents{\putwordShortTOC}%
6610 %
6611 \let\partentry = \shortpartentry
6612 \let\numchapentry = \shortchapentry
6613 \let\appentry = \shortchapentry
6614 \let\unnchapentry = \shortunnchapentry
6615 % We want a true roman here for the page numbers.
6616 \secfonts
6617 \let\rm=\shortcontrm \let\bf=\shortcontbf
6618 \let\sl=\shortcontsl \let\tt=\shortconttt
6619 \rm
6620 \hyphenpenalty = 10000
6621 \advance\baselineskip by 1pt % Open it up a little.
6622 \def\numsecentry##1##2##3##4{}
6623 \let\appsecentry = \numsecentry
6624 \let\unnsecentry = \numsecentry
6625 \let\numsubsecentry = \numsecentry
6626 \let\appsubsecentry = \numsecentry
6627 \let\unnsubsecentry = \numsecentry
6628 \let\numsubsubsecentry = \numsecentry
6629 \let\appsubsubsecentry = \numsecentry
6630 \let\unnsubsubsecentry = \numsecentry
6631 \openin 1 \tocreadfilename\space
6632 \ifeof 1 \else
6633 \readtocfile
6634 \fi
6635 \closein 1
6636 \vfill \eject
6637 \contentsalignmacro % in case @setchapternewpage odd is in effect
6638 \endgroup
6639 \lastnegativepageno = \pageno
6640 \global\pageno = \savepageno
6641 }
6642 \let\shortcontents = \summarycontents
6643
6644 % Typeset the label for a chapter or appendix for the short contents.
6645 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6646 %
6647 \def\shortchaplabel#1{%
6648 % This space should be enough, since a single number is .5em, and the
6649 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6650 % But use \hss just in case.
6651 % (This space doesn't include the extra space that gets added after
6652 % the label; that gets put in by \shortchapentry above.)
6653 %
6654 % We'd like to right-justify chapter numbers, but that looks strange
6655 % with appendix letters. And right-justifying numbers and
6656 % left-justifying letters looks strange when there is less than 10
6657 % chapters. Have to read the whole toc once to know how many chapters
6658 % there are before deciding ...
6659 \hbox to 1em{#1\hss}%
6660 }
6661
6662 % These macros generate individual entries in the table of contents.
6663 % The first argument is the chapter or section name.
6664 % The last argument is the page number.
6665 % The arguments in between are the chapter number, section number, ...
6666
6667 % Parts, in the main contents. Replace the part number, which doesn't
6668 % exist, with an empty box. Let's hope all the numbers have the same width.
6669 % Also ignore the page number, which is conventionally not printed.
6670 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6671 \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6672 %
6673 % Parts, in the short toc.
6674 \def\shortpartentry#1#2#3#4{%
6675 \penalty-300
6676 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6677 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6678 }
6679
6680 % Chapters, in the main contents.
6681 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6682
6683 % Chapters, in the short toc.
6684 % See comments in \dochapentry re vbox and related settings.
6685 \def\shortchapentry#1#2#3#4{%
6686 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6687 }
6688
6689 % Appendices, in the main contents.
6690 % Need the word Appendix, and a fixed-size box.
6691 %
6692 \def\appendixbox#1{%
6693 % We use M since it's probably the widest letter.
6694 \setbox0 = \hbox{\putwordAppendix{} M}%
6695 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6696 %
6697 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6698
6699 % Unnumbered chapters.
6700 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6701 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6702
6703 % Sections.
6704 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6705 \let\appsecentry=\numsecentry
6706 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6707
6708 % Subsections.
6709 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6710 \let\appsubsecentry=\numsubsecentry
6711 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6712
6713 % And subsubsections.
6714 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6715 \let\appsubsubsecentry=\numsubsubsecentry
6716 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6717
6718 % This parameter controls the indentation of the various levels.
6719 % Same as \defaultparindent.
6720 \newdimen\tocindent \tocindent = 15pt
6721
6722 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6723 % page number.
6724 %
6725 % If the toc has to be broken over pages, we want it to be at chapters
6726 % if at all possible; hence the \penalty.
6727 \def\dochapentry#1#2{%
6728 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6729 \begingroup
6730 % Move the page numbers slightly to the right
6731 \advance\entryrightmargin by -0.05em
6732 \chapentryfonts
6733 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6734 \endgroup
6735 \nobreak\vskip .25\baselineskip plus.1\baselineskip
6736 }
6737
6738 \def\dosecentry#1#2{\begingroup
6739 \secentryfonts \leftskip=\tocindent
6740 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6741 \endgroup}
6742
6743 \def\dosubsecentry#1#2{\begingroup
6744 \subsecentryfonts \leftskip=2\tocindent
6745 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6746 \endgroup}
6747
6748 \def\dosubsubsecentry#1#2{\begingroup
6749 \subsubsecentryfonts \leftskip=3\tocindent
6750 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6751 \endgroup}
6752
6753 % We use the same \entry macro as for the index entries.
6754 \let\tocentry = \entry
6755
6756 % Space between chapter (or whatever) number and the title.
6757 \def\labelspace{\hskip1em \relax}
6758
6759 \def\dopageno#1{{\rm #1}}
6760 \def\doshortpageno#1{{\rm #1}}
6761
6762 \def\chapentryfonts{\secfonts \rm}
6763 \def\secentryfonts{\textfonts}
6764 \def\subsecentryfonts{\textfonts}
6765 \def\subsubsecentryfonts{\textfonts}
6766
6767
6768 \message{environments,}
6769 % @foo ... @end foo.
6770
6771 % @tex ... @end tex escapes into raw TeX temporarily.
6772 % One exception: @ is still an escape character, so that @end tex works.
6773 % But \@ or @@ will get a plain @ character.
6774
6775 \envdef\tex{%
6776 \setupmarkupstyle{tex}%
6777 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6778 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6779 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6780 \catcode `\%=14
6781 \catcode `\+=\other
6782 \catcode `\"=\other
6783 \catcode `\|=\other
6784 \catcode `\<=\other
6785 \catcode `\>=\other
6786 \catcode `\`=\other
6787 \catcode `\'=\other
6788 \escapechar=`\\
6789 %
6790 % ' is active in math mode (mathcode"8000). So reset it, and all our
6791 % other math active characters (just in case), to plain's definitions.
6792 \mathactive
6793 %
6794 % Inverse of the list at the beginning of the file.
6795 \let\b=\ptexb
6796 \let\bullet=\ptexbullet
6797 \let\c=\ptexc
6798 \let\,=\ptexcomma
6799 \let\.=\ptexdot
6800 \let\dots=\ptexdots
6801 \let\equiv=\ptexequiv
6802 \let\!=\ptexexclam
6803 \let\i=\ptexi
6804 \let\indent=\ptexindent
6805 \let\noindent=\ptexnoindent
6806 \let\{=\ptexlbrace
6807 \let\+=\tabalign
6808 \let\}=\ptexrbrace
6809 \let\/=\ptexslash
6810 \let\sp=\ptexsp
6811 \let\*=\ptexstar
6812 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
6813 \let\t=\ptext
6814 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
6815 \let\frenchspacing=\plainfrenchspacing
6816 %
6817 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
6818 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
6819 \def\@{@}%
6820 }
6821 % There is no need to define \Etex.
6822
6823 % Define @lisp ... @end lisp.
6824 % @lisp environment forms a group so it can rebind things,
6825 % including the definition of @end lisp (which normally is erroneous).
6826
6827 % Amount to narrow the margins by for @lisp.
6828 \newskip\lispnarrowing \lispnarrowing=0.4in
6829
6830 % This is the definition that ^^M gets inside @lisp, @example, and other
6831 % such environments. \null is better than a space, since it doesn't
6832 % have any width.
6833 \def\lisppar{\null\endgraf}
6834
6835 % This space is always present above and below environments.
6836 \newskip\envskipamount \envskipamount = 0pt
6837
6838 % Make spacing and below environment symmetrical. We use \parskip here
6839 % to help in doing that, since in @example-like environments \parskip
6840 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
6841 % start of the next paragraph will insert \parskip.
6842 %
6843 \def\aboveenvbreak{{%
6844 % =10000 instead of <10000 because of a special case in \itemzzz and
6845 % \sectionheading, q.v.
6846 \ifnum \lastpenalty=10000 \else
6847 \advance\envskipamount by \parskip
6848 \endgraf
6849 \ifdim\lastskip<\envskipamount
6850 \removelastskip
6851 \ifnum\lastpenalty<10000
6852 % Penalize breaking before the environment, because preceding text
6853 % often leads into it.
6854 \penalty100
6855 \fi
6856 \vskip\envskipamount
6857 \fi
6858 \fi
6859 }}
6860
6861 \def\afterenvbreak{{%
6862 % =10000 instead of <10000 because of a special case in \itemzzz and
6863 % \sectionheading, q.v.
6864 \ifnum \lastpenalty=10000 \else
6865 \advance\envskipamount by \parskip
6866 \endgraf
6867 \ifdim\lastskip<\envskipamount
6868 \removelastskip
6869 % it's not a good place to break if the last penalty was \nobreak
6870 % or better ...
6871 \ifnum\lastpenalty<10000 \penalty-50 \fi
6872 \vskip\envskipamount
6873 \fi
6874 \fi
6875 }}
6876
6877 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
6878 % also clear it, so that its embedded environments do the narrowing again.
6879 \let\nonarrowing=\relax
6880
6881 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
6882 % environment contents.
6883 \font\circle=lcircle10
6884 \newdimen\circthick
6885 \newdimen\cartouter\newdimen\cartinner
6886 \newskip\normbskip\newskip\normpskip\newskip\normlskip
6887 \circthick=\fontdimen8\circle
6888 %
6889 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
6890 \def\ctr{{\hskip 6pt\circle\char'010}}
6891 \def\cbl{{\circle\char'012\hskip -6pt}}
6892 \def\cbr{{\hskip 6pt\circle\char'011}}
6893 \def\carttop{\hbox to \cartouter{\hskip\lskip
6894 \ctl\leaders\hrule height\circthick\hfil\ctr
6895 \hskip\rskip}}
6896 \def\cartbot{\hbox to \cartouter{\hskip\lskip
6897 \cbl\leaders\hrule height\circthick\hfil\cbr
6898 \hskip\rskip}}
6899 %
6900 \newskip\lskip\newskip\rskip
6901
6902 \envdef\cartouche{%
6903 \ifhmode\par\fi % can't be in the midst of a paragraph.
6904 \startsavinginserts
6905 \lskip=\leftskip \rskip=\rightskip
6906 \leftskip=0pt\rightskip=0pt % we want these *outside*.
6907 \cartinner=\hsize \advance\cartinner by-\lskip
6908 \advance\cartinner by-\rskip
6909 \cartouter=\hsize
6910 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
6911 % side, and for 6pt waste from
6912 % each corner char, and rule thickness
6913 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
6914 %
6915 % If this cartouche directly follows a sectioning command, we need the
6916 % \parskip glue (backspaced over by default) or the cartouche can
6917 % collide with the section heading.
6918 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
6919 %
6920 \setbox\groupbox=\vbox\bgroup
6921 \baselineskip=0pt\parskip=0pt\lineskip=0pt
6922 \carttop
6923 \hbox\bgroup
6924 \hskip\lskip
6925 \vrule\kern3pt
6926 \vbox\bgroup
6927 \kern3pt
6928 \hsize=\cartinner
6929 \baselineskip=\normbskip
6930 \lineskip=\normlskip
6931 \parskip=\normpskip
6932 \vskip -\parskip
6933 \comment % For explanation, see the end of def\group.
6934 }
6935 \def\Ecartouche{%
6936 \ifhmode\par\fi
6937 \kern3pt
6938 \egroup
6939 \kern3pt\vrule
6940 \hskip\rskip
6941 \egroup
6942 \cartbot
6943 \egroup
6944 \addgroupbox
6945 \checkinserts
6946 }
6947
6948
6949 % This macro is called at the beginning of all the @example variants,
6950 % inside a group.
6951 \newdimen\nonfillparindent
6952 \def\nonfillstart{%
6953 \aboveenvbreak
6954 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
6955 \sepspaces % Make spaces be word-separators rather than space tokens.
6956 \let\par = \lisppar % don't ignore blank lines
6957 \obeylines % each line of input is a line of output
6958 \parskip = 0pt
6959 % Turn off paragraph indentation but redefine \indent to emulate
6960 % the normal \indent.
6961 \nonfillparindent=\parindent
6962 \parindent = 0pt
6963 \let\indent\nonfillindent
6964 %
6965 \emergencystretch = 0pt % don't try to avoid overfull boxes
6966 \ifx\nonarrowing\relax
6967 \advance \leftskip by \lispnarrowing
6968 \exdentamount=\lispnarrowing
6969 \else
6970 \let\nonarrowing = \relax
6971 \fi
6972 \let\exdent=\nofillexdent
6973 }
6974
6975 \begingroup
6976 \obeyspaces
6977 % We want to swallow spaces (but not other tokens) after the fake
6978 % @indent in our nonfill-environments, where spaces are normally
6979 % active and set to @tie, resulting in them not being ignored after
6980 % @indent.
6981 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
6982 \gdef\nonfillindentcheck{%
6983 \ifx\temp %
6984 \expandafter\nonfillindentgobble%
6985 \else%
6986 \leavevmode\nonfillindentbox%
6987 \fi%
6988 }%
6989 \endgroup
6990 \def\nonfillindentgobble#1{\nonfillindent}
6991 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
6992
6993 % If you want all examples etc. small: @set dispenvsize small.
6994 % If you want even small examples the full size: @set dispenvsize nosmall.
6995 % This affects the following displayed environments:
6996 % @example, @display, @format, @lisp
6997 %
6998 \def\smallword{small}
6999 \def\nosmallword{nosmall}
7000 \let\SETdispenvsize\relax
7001 \def\setnormaldispenv{%
7002 \ifx\SETdispenvsize\smallword
7003 % end paragraph for sake of leading, in case document has no blank
7004 % line. This is redundant with what happens in \aboveenvbreak, but
7005 % we need to do it before changing the fonts, and it's inconvenient
7006 % to change the fonts afterward.
7007 \ifnum \lastpenalty=10000 \else \endgraf \fi
7008 \smallexamplefonts \rm
7009 \fi
7010 }
7011 \def\setsmalldispenv{%
7012 \ifx\SETdispenvsize\nosmallword
7013 \else
7014 \ifnum \lastpenalty=10000 \else \endgraf \fi
7015 \smallexamplefonts \rm
7016 \fi
7017 }
7018
7019 % We often define two environments, @foo and @smallfoo.
7020 % Let's do it in one command. #1 is the env name, #2 the definition.
7021 \def\makedispenvdef#1#2{%
7022 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7023 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7024 \expandafter\let\csname E#1\endcsname \afterenvbreak
7025 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7026 }
7027
7028 % Define two environment synonyms (#1 and #2) for an environment.
7029 \def\maketwodispenvdef#1#2#3{%
7030 \makedispenvdef{#1}{#3}%
7031 \makedispenvdef{#2}{#3}%
7032 }
7033 %
7034 % @lisp: indented, narrowed, typewriter font;
7035 % @example: same as @lisp.
7036 %
7037 % @smallexample and @smalllisp: use smaller fonts.
7038 % Originally contributed by Pavel@xerox.
7039 %
7040 \maketwodispenvdef{lisp}{example}{%
7041 \nonfillstart
7042 \tt\setupmarkupstyle{example}%
7043 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7044 \gobble % eat return
7045 }
7046 % @display/@smalldisplay: same as @lisp except keep current font.
7047 %
7048 \makedispenvdef{display}{%
7049 \nonfillstart
7050 \gobble
7051 }
7052
7053 % @format/@smallformat: same as @display except don't narrow margins.
7054 %
7055 \makedispenvdef{format}{%
7056 \let\nonarrowing = t%
7057 \nonfillstart
7058 \gobble
7059 }
7060
7061 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7062 \envdef\flushleft{%
7063 \let\nonarrowing = t%
7064 \nonfillstart
7065 \gobble
7066 }
7067 \let\Eflushleft = \afterenvbreak
7068
7069 % @flushright.
7070 %
7071 \envdef\flushright{%
7072 \let\nonarrowing = t%
7073 \nonfillstart
7074 \advance\leftskip by 0pt plus 1fill\relax
7075 \gobble
7076 }
7077 \let\Eflushright = \afterenvbreak
7078
7079
7080 % @raggedright does more-or-less normal line breaking but no right
7081 % justification. From plain.tex. Don't stretch around special
7082 % characters in urls in this environment, since the stretch at the right
7083 % should be enough.
7084 \envdef\raggedright{%
7085 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7086 \def\urefprestretchamount{0pt}%
7087 \def\urefpoststretchamount{0pt}%
7088 }
7089 \let\Eraggedright\par
7090
7091 \envdef\raggedleft{%
7092 \parindent=0pt \leftskip0pt plus2em
7093 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7094 \hbadness=10000 % Last line will usually be underfull, so turn off
7095 % badness reporting.
7096 }
7097 \let\Eraggedleft\par
7098
7099 \envdef\raggedcenter{%
7100 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
7101 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7102 \hbadness=10000 % Last line will usually be underfull, so turn off
7103 % badness reporting.
7104 }
7105 \let\Eraggedcenter\par
7106
7107
7108 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7109 % and narrows the margins. We keep \parskip nonzero in general, since
7110 % we're doing normal filling. So, when using \aboveenvbreak and
7111 % \afterenvbreak, temporarily make \parskip 0.
7112 %
7113 \makedispenvdef{quotation}{\quotationstart}
7114 %
7115 \def\quotationstart{%
7116 \indentedblockstart % same as \indentedblock, but increase right margin too.
7117 \ifx\nonarrowing\relax
7118 \advance\rightskip by \lispnarrowing
7119 \fi
7120 \parsearg\quotationlabel
7121 }
7122
7123 % We have retained a nonzero parskip for the environment, since we're
7124 % doing normal filling.
7125 %
7126 \def\Equotation{%
7127 \par
7128 \ifx\quotationauthor\thisisundefined\else
7129 % indent a bit.
7130 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7131 \fi
7132 {\parskip=0pt \afterenvbreak}%
7133 }
7134 \def\Esmallquotation{\Equotation}
7135
7136 % If we're given an argument, typeset it in bold with a colon after.
7137 \def\quotationlabel#1{%
7138 \def\temp{#1}%
7139 \ifx\temp\empty \else
7140 {\bf #1: }%
7141 \fi
7142 }
7143
7144 % @indentedblock is like @quotation, but indents only on the left and
7145 % has no optional argument.
7146 %
7147 \makedispenvdef{indentedblock}{\indentedblockstart}
7148 %
7149 \def\indentedblockstart{%
7150 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7151 \parindent=0pt
7152 %
7153 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7154 \ifx\nonarrowing\relax
7155 \advance\leftskip by \lispnarrowing
7156 \exdentamount = \lispnarrowing
7157 \else
7158 \let\nonarrowing = \relax
7159 \fi
7160 }
7161
7162 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7163 %
7164 \def\Eindentedblock{%
7165 \par
7166 {\parskip=0pt \afterenvbreak}%
7167 }
7168 \def\Esmallindentedblock{\Eindentedblock}
7169
7170
7171 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7172 % If we want to allow any <char> as delimiter,
7173 % we need the curly braces so that makeinfo sees the @verb command, eg:
7174 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7175 %
7176 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7177 %
7178 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7179 % active too. Otherwise, they get lost as the first character on a
7180 % verbatim line.
7181 \def\dospecials{%
7182 \do\ \do\\\do\{\do\}\do\$\do\&%
7183 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7184 \do\<\do\>\do\|\do\@\do+\do\"%
7185 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7186 % @set txicodequotebacktick will not have effect on @verb and
7187 % @verbatim, and ?` and !` ligatures won't get disabled.
7188 %\do\`\do\'%
7189 }
7190 %
7191 % [Knuth] p. 380
7192 \def\uncatcodespecials{%
7193 \def\do##1{\catcode`##1=\other}\dospecials}
7194 %
7195 % Setup for the @verb command.
7196 %
7197 % Eight spaces for a tab
7198 \begingroup
7199 \catcode`\^^I=\active
7200 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7201 \endgroup
7202 %
7203 \def\setupverb{%
7204 \tt % easiest (and conventionally used) font for verbatim
7205 \def\par{\leavevmode\endgraf}%
7206 \setupmarkupstyle{verb}%
7207 \tabeightspaces
7208 % Respect line breaks,
7209 % print special symbols as themselves, and
7210 % make each space count
7211 % must do in this order:
7212 \obeylines \uncatcodespecials \sepspaces
7213 }
7214
7215 % Setup for the @verbatim environment
7216 %
7217 % Real tab expansion.
7218 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7219 %
7220 % We typeset each line of the verbatim in an \hbox, so we can handle
7221 % tabs. The \global is in case the verbatim line starts with an accent,
7222 % or some other command that starts with a begin-group. Otherwise, the
7223 % entire \verbbox would disappear at the corresponding end-group, before
7224 % it is typeset. Meanwhile, we can't have nested verbatim commands
7225 % (can we?), so the \global won't be overwriting itself.
7226 \newbox\verbbox
7227 \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
7228 %
7229 \begingroup
7230 \catcode`\^^I=\active
7231 \gdef\tabexpand{%
7232 \catcode`\^^I=\active
7233 \def^^I{\leavevmode\egroup
7234 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7235 \divide\dimen\verbbox by\tabw
7236 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7237 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7238 \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
7239 }%
7240 }
7241 \endgroup
7242
7243 % start the verbatim environment.
7244 \def\setupverbatim{%
7245 \let\nonarrowing = t%
7246 \nonfillstart
7247 \tt % easiest (and conventionally used) font for verbatim
7248 % The \leavevmode here is for blank lines. Otherwise, we would
7249 % never \starttabox and the \egroup would end verbatim mode.
7250 \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
7251 \tabexpand
7252 \setupmarkupstyle{verbatim}%
7253 % Respect line breaks,
7254 % print special symbols as themselves, and
7255 % make each space count.
7256 % Must do in this order:
7257 \obeylines \uncatcodespecials \sepspaces
7258 \everypar{\starttabbox}%
7259 }
7260
7261 % Do the @verb magic: verbatim text is quoted by unique
7262 % delimiter characters. Before first delimiter expect a
7263 % right brace, after last delimiter expect closing brace:
7264 %
7265 % \def\doverb'{'<char>#1<char>'}'{#1}
7266 %
7267 % [Knuth] p. 382; only eat outer {}
7268 \begingroup
7269 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7270 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7271 \endgroup
7272 %
7273 \def\verb{\begingroup\setupverb\doverb}
7274 %
7275 %
7276 % Do the @verbatim magic: define the macro \doverbatim so that
7277 % the (first) argument ends when '@end verbatim' is reached, ie:
7278 %
7279 % \def\doverbatim#1@end verbatim{#1}
7280 %
7281 % For Texinfo it's a lot easier than for LaTeX,
7282 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7283 % we need not redefine '\', '{' and '}'.
7284 %
7285 % Inspired by LaTeX's verbatim command set [latex.ltx]
7286 %
7287 \begingroup
7288 \catcode`\ =\active
7289 \obeylines %
7290 % ignore everything up to the first ^^M, that's the newline at the end
7291 % of the @verbatim input line itself. Otherwise we get an extra blank
7292 % line in the output.
7293 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
7294 % We really want {...\end verbatim} in the body of the macro, but
7295 % without the active space; thus we have to use \xdef and \gobble.
7296 \endgroup
7297 %
7298 \envdef\verbatim{%
7299 \setupverbatim\doverbatim
7300 }
7301 \let\Everbatim = \afterenvbreak
7302
7303
7304 % @verbatiminclude FILE - insert text of file in verbatim environment.
7305 %
7306 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7307 %
7308 \def\doverbatiminclude#1{%
7309 {%
7310 \makevalueexpandable
7311 \setupverbatim
7312 \indexnofonts % Allow `@@' and other weird things in file names.
7313 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7314 \input #1
7315 \afterenvbreak
7316 }%
7317 }
7318
7319 % @copying ... @end copying.
7320 % Save the text away for @insertcopying later.
7321 %
7322 % We save the uninterpreted tokens, rather than creating a box.
7323 % Saving the text in a box would be much easier, but then all the
7324 % typesetting commands (@smallbook, font changes, etc.) have to be done
7325 % beforehand -- and a) we want @copying to be done first in the source
7326 % file; b) letting users define the frontmatter in as flexible order as
7327 % possible is desirable.
7328 %
7329 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7330 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7331 %
7332 \def\insertcopying{%
7333 \begingroup
7334 \parindent = 0pt % paragraph indentation looks wrong on title page
7335 \scanexp\copyingtext
7336 \endgroup
7337 }
7338
7339
7340 \message{defuns,}
7341 % @defun etc.
7342
7343 \newskip\defbodyindent \defbodyindent=.4in
7344 \newskip\defargsindent \defargsindent=50pt
7345 \newskip\deflastargmargin \deflastargmargin=18pt
7346 \newcount\defunpenalty
7347
7348 % Start the processing of @deffn:
7349 \def\startdefun{%
7350 \ifnum\lastpenalty<10000
7351 \medbreak
7352 \defunpenalty=10003 % Will keep this @deffn together with the
7353 % following @def command, see below.
7354 \else
7355 % If there are two @def commands in a row, we'll have a \nobreak,
7356 % which is there to keep the function description together with its
7357 % header. But if there's nothing but headers, we need to allow a
7358 % break somewhere. Check specifically for penalty 10002, inserted
7359 % by \printdefunline, instead of 10000, since the sectioning
7360 % commands also insert a nobreak penalty, and we don't want to allow
7361 % a break between a section heading and a defun.
7362 %
7363 % As a further refinement, we avoid "club" headers by signalling
7364 % with penalty of 10003 after the very first @deffn in the
7365 % sequence (see above), and penalty of 10002 after any following
7366 % @def command.
7367 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7368 %
7369 % Similarly, after a section heading, do not allow a break.
7370 % But do insert the glue.
7371 \medskip % preceded by discardable penalty, so not a breakpoint
7372 \fi
7373 %
7374 \parindent=0in
7375 \advance\leftskip by \defbodyindent
7376 \exdentamount=\defbodyindent
7377 }
7378
7379 \def\dodefunx#1{%
7380 % First, check whether we are in the right environment:
7381 \checkenv#1%
7382 %
7383 % As above, allow line break if we have multiple x headers in a row.
7384 % It's not a great place, though.
7385 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7386 %
7387 % And now, it's time to reuse the body of the original defun:
7388 \expandafter\gobbledefun#1%
7389 }
7390 \def\gobbledefun#1\startdefun{}
7391
7392 % \printdefunline \deffnheader{text}
7393 %
7394 \def\printdefunline#1#2{%
7395 \begingroup
7396 % call \deffnheader:
7397 #1#2 \endheader
7398 % common ending:
7399 \interlinepenalty = 10000
7400 \advance\rightskip by 0pt plus 1fil\relax
7401 \endgraf
7402 \nobreak\vskip -\parskip
7403 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7404 % Some of the @defun-type tags do not enable magic parentheses,
7405 % rendering the following check redundant. But we don't optimize.
7406 \checkparencounts
7407 \endgroup
7408 }
7409
7410 \def\Edefun{\endgraf\medbreak}
7411
7412 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7413 % the only thing remaining is to define \deffnheader.
7414 %
7415 \def\makedefun#1{%
7416 \expandafter\let\csname E#1\endcsname = \Edefun
7417 \edef\temp{\noexpand\domakedefun
7418 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7419 \temp
7420 }
7421
7422 % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7423 %
7424 % Define \deffn and \deffnx, without parameters.
7425 % \deffnheader has to be defined explicitly.
7426 %
7427 \def\domakedefun#1#2#3{%
7428 \envdef#1{%
7429 \startdefun
7430 \doingtypefnfalse % distinguish typed functions from all else
7431 \parseargusing\activeparens{\printdefunline#3}%
7432 }%
7433 \def#2{\dodefunx#1}%
7434 \def#3%
7435 }
7436
7437 \newif\ifdoingtypefn % doing typed function?
7438 \newif\ifrettypeownline % typeset return type on its own line?
7439
7440 % @deftypefnnewline on|off says whether the return type of typed functions
7441 % are printed on their own line. This affects @deftypefn, @deftypefun,
7442 % @deftypeop, and @deftypemethod.
7443 %
7444 \parseargdef\deftypefnnewline{%
7445 \def\temp{#1}%
7446 \ifx\temp\onword
7447 \expandafter\let\csname SETtxideftypefnnl\endcsname
7448 = \empty
7449 \else\ifx\temp\offword
7450 \expandafter\let\csname SETtxideftypefnnl\endcsname
7451 = \relax
7452 \else
7453 \errhelp = \EMsimple
7454 \errmessage{Unknown @txideftypefnnl value `\temp',
7455 must be on|off}%
7456 \fi\fi
7457 }
7458
7459 % Untyped functions:
7460
7461 % @deffn category name args
7462 \makedefun{deffn}{\deffngeneral{}}
7463
7464 % @deffn category class name args
7465 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7466
7467 % \defopon {category on}class name args
7468 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7469
7470 % \deffngeneral {subind}category name args
7471 %
7472 \def\deffngeneral#1#2 #3 #4\endheader{%
7473 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
7474 \dosubind{fn}{\code{#3}}{#1}%
7475 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7476 }
7477
7478 % Typed functions:
7479
7480 % @deftypefn category type name args
7481 \makedefun{deftypefn}{\deftypefngeneral{}}
7482
7483 % @deftypeop category class type name args
7484 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7485
7486 % \deftypeopon {category on}class type name args
7487 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7488
7489 % \deftypefngeneral {subind}category type name args
7490 %
7491 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7492 \dosubind{fn}{\code{#4}}{#1}%
7493 \doingtypefntrue
7494 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7495 }
7496
7497 % Typed variables:
7498
7499 % @deftypevr category type var args
7500 \makedefun{deftypevr}{\deftypecvgeneral{}}
7501
7502 % @deftypecv category class type var args
7503 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7504
7505 % \deftypecvof {category of}class type var args
7506 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7507
7508 % \deftypecvgeneral {subind}category type var args
7509 %
7510 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7511 \dosubind{vr}{\code{#4}}{#1}%
7512 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7513 }
7514
7515 % Untyped variables:
7516
7517 % @defvr category var args
7518 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7519
7520 % @defcv category class var args
7521 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7522
7523 % \defcvof {category of}class var args
7524 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7525
7526 % Types:
7527
7528 % @deftp category name args
7529 \makedefun{deftp}#1 #2 #3\endheader{%
7530 \doind{tp}{\code{#2}}%
7531 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7532 }
7533
7534 % Remaining @defun-like shortcuts:
7535 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7536 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7537 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7538 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7539 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7540 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7541 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7542 \makedefun{defmethod}{\defopon\putwordMethodon}
7543 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7544 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7545 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7546
7547 % \defname, which formats the name of the @def (not the args).
7548 % #1 is the category, such as "Function".
7549 % #2 is the return type, if any.
7550 % #3 is the function name.
7551 %
7552 % We are followed by (but not passed) the arguments, if any.
7553 %
7554 \def\defname#1#2#3{%
7555 \par
7556 % Get the values of \leftskip and \rightskip as they were outside the @def...
7557 \advance\leftskip by -\defbodyindent
7558 %
7559 % Determine if we are typesetting the return type of a typed function
7560 % on a line by itself.
7561 \rettypeownlinefalse
7562 \ifdoingtypefn % doing a typed function specifically?
7563 % then check user option for putting return type on its own line:
7564 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7565 \rettypeownlinetrue
7566 \fi
7567 \fi
7568 %
7569 % How we'll format the category name. Putting it in brackets helps
7570 % distinguish it from the body text that may end up on the next line
7571 % just below it.
7572 \def\temp{#1}%
7573 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7574 %
7575 % Figure out line sizes for the paragraph shape. We'll always have at
7576 % least two.
7577 \tempnum = 2
7578 %
7579 % The first line needs space for \box0; but if \rightskip is nonzero,
7580 % we need only space for the part of \box0 which exceeds it:
7581 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7582 %
7583 % If doing a return type on its own line, we'll have another line.
7584 \ifrettypeownline
7585 \advance\tempnum by 1
7586 \def\maybeshapeline{0in \hsize}%
7587 \else
7588 \def\maybeshapeline{}%
7589 \fi
7590 %
7591 % The continuations:
7592 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7593 %
7594 % The final paragraph shape:
7595 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7596 %
7597 % Put the category name at the right margin.
7598 \noindent
7599 \hbox to 0pt{%
7600 \hfil\box0 \kern-\hsize
7601 % \hsize has to be shortened this way:
7602 \kern\leftskip
7603 % Intentionally do not respect \rightskip, since we need the space.
7604 }%
7605 %
7606 % Allow all lines to be underfull without complaint:
7607 \tolerance=10000 \hbadness=10000
7608 \exdentamount=\defbodyindent
7609 {%
7610 % defun fonts. We use typewriter by default (used to be bold) because:
7611 % . we're printing identifiers, they should be in tt in principle.
7612 % . in languages with many accents, such as Czech or French, it's
7613 % common to leave accents off identifiers. The result looks ok in
7614 % tt, but exceedingly strange in rm.
7615 % . we don't want -- and --- to be treated as ligatures.
7616 % . this still does not fix the ?` and !` ligatures, but so far no
7617 % one has made identifiers using them :).
7618 \df \tt
7619 \def\temp{#2}% text of the return type
7620 \ifx\temp\empty\else
7621 \tclose{\temp}% typeset the return type
7622 \ifrettypeownline
7623 % put return type on its own line; prohibit line break following:
7624 \hfil\vadjust{\nobreak}\break
7625 \else
7626 \space % type on same line, so just followed by a space
7627 \fi
7628 \fi % no return type
7629 #3% output function name
7630 }%
7631 {\rm\enskip}% hskip 0.5 em of \tenrm
7632 %
7633 \boldbrax
7634 % arguments will be output next, if any.
7635 }
7636
7637 % Print arguments in slanted roman (not ttsl), inconsistently with using
7638 % tt for the name. This is because literal text is sometimes needed in
7639 % the argument list (groff manual), and ttsl and tt are not very
7640 % distinguishable. Prevent hyphenation at `-' chars.
7641 %
7642 \def\defunargs#1{%
7643 % use sl by default (not ttsl),
7644 % tt for the names.
7645 \df \sl \hyphenchar\font=0
7646 %
7647 % On the other hand, if an argument has two dashes (for instance), we
7648 % want a way to get ttsl. We used to recommend @var for that, so
7649 % leave the code in, but it's strange for @var to lead to typewriter.
7650 % Nowadays we recommend @code, since the difference between a ttsl hyphen
7651 % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7652 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7653 #1%
7654 \sl\hyphenchar\font=45
7655 }
7656
7657 % We want ()&[] to print specially on the defun line.
7658 %
7659 \def\activeparens{%
7660 \catcode`\(=\active \catcode`\)=\active
7661 \catcode`\[=\active \catcode`\]=\active
7662 \catcode`\&=\active
7663 }
7664
7665 % Make control sequences which act like normal parenthesis chars.
7666 \let\lparen = ( \let\rparen = )
7667
7668 % Be sure that we always have a definition for `(', etc. For example,
7669 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7670 % so TeX would otherwise complain about undefined control sequence.
7671 {
7672 \activeparens
7673 \global\let(=\lparen \global\let)=\rparen
7674 \global\let[=\lbrack \global\let]=\rbrack
7675 \global\let& = \&
7676
7677 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7678 \gdef\magicamp{\let&=\amprm}
7679 }
7680
7681 \newcount\parencount
7682
7683 % If we encounter &foo, then turn on ()-hacking afterwards
7684 \newif\ifampseen
7685 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
7686
7687 \def\parenfont{%
7688 \ifampseen
7689 % At the first level, print parens in roman,
7690 % otherwise use the default font.
7691 \ifnum \parencount=1 \rm \fi
7692 \else
7693 % The \sf parens (in \boldbrax) actually are a little bolder than
7694 % the contained text. This is especially needed for [ and ] .
7695 \sf
7696 \fi
7697 }
7698 \def\infirstlevel#1{%
7699 \ifampseen
7700 \ifnum\parencount=1
7701 #1%
7702 \fi
7703 \fi
7704 }
7705 \def\bfafterword#1 {#1 \bf}
7706
7707 \def\opnr{%
7708 \global\advance\parencount by 1
7709 {\parenfont(}%
7710 \infirstlevel \bfafterword
7711 }
7712 \def\clnr{%
7713 {\parenfont)}%
7714 \infirstlevel \sl
7715 \global\advance\parencount by -1
7716 }
7717
7718 \newcount\brackcount
7719 \def\lbrb{%
7720 \global\advance\brackcount by 1
7721 {\bf[}%
7722 }
7723 \def\rbrb{%
7724 {\bf]}%
7725 \global\advance\brackcount by -1
7726 }
7727
7728 \def\checkparencounts{%
7729 \ifnum\parencount=0 \else \badparencount \fi
7730 \ifnum\brackcount=0 \else \badbrackcount \fi
7731 }
7732 % these should not use \errmessage; the glibc manual, at least, actually
7733 % has such constructs (when documenting function pointers).
7734 \def\badparencount{%
7735 \message{Warning: unbalanced parentheses in @def...}%
7736 \global\parencount=0
7737 }
7738 \def\badbrackcount{%
7739 \message{Warning: unbalanced square brackets in @def...}%
7740 \global\brackcount=0
7741 }
7742
7743
7744 \message{macros,}
7745 % @macro.
7746
7747 % To do this right we need a feature of e-TeX, \scantokens,
7748 % which we arrange to emulate with a temporary file in ordinary TeX.
7749 \ifx\eTeXversion\thisisundefined
7750 \newwrite\macscribble
7751 \def\scantokens#1{%
7752 \toks0={#1}%
7753 \immediate\openout\macscribble=\jobname.tmp
7754 \immediate\write\macscribble{\the\toks0}%
7755 \immediate\closeout\macscribble
7756 \input \jobname.tmp
7757 }
7758 \fi
7759
7760 \let\aftermacroxxx\relax
7761 \def\aftermacro{\aftermacroxxx}
7762
7763 % alias because \c means cedilla in @tex or @math
7764 \let\texinfoc=\c
7765
7766 % Used at the time of macro expansion.
7767 % Argument is macro body with arguments substituted
7768 \def\scanmacro#1{%
7769 \newlinechar`\^^M
7770 \def\xprocessmacroarg{\eatspaces}%
7771 %
7772 % Process the macro body under the current catcode regime.
7773 \scantokens{#1\texinfoc}\aftermacro%
7774 %
7775 % The \c is to remove the \newlinechar added by \scantokens, and
7776 % can be noticed by \parsearg.
7777 % The \aftermacro allows a \comment at the end of the macro definition
7778 % to duplicate itself past the final \newlinechar added by \scantokens:
7779 % this is used in the definition of \group to comment out a newline. We
7780 % don't do the same for \c to support Texinfo files with macros that ended
7781 % with a @c, which should no longer be necessary.
7782 % We avoid surrounding the call to \scantokens with \bgroup and \egroup
7783 % to allow macros to open or close groups themselves.
7784 }
7785
7786 % Used for copying and captions
7787 \def\scanexp#1{%
7788 \bgroup
7789 % Undo catcode changes of \startcontents and \printindex
7790 % When called from @insertcopying or (short)caption, we need active
7791 % backslash to get it printed correctly.
7792 % FIXME: This may not be needed.
7793 %\catcode`\@=0 \catcode`\\=\active \escapechar=`\@
7794 \edef\temp{\noexpand\scanmacro{#1}}%
7795 \temp
7796 \egroup
7797 }
7798
7799 \newcount\paramno % Count of parameters
7800 \newtoks\macname % Macro name
7801 \newif\ifrecursive % Is it recursive?
7802
7803 % List of all defined macros in the form
7804 % \definedummyword\macro1\definedummyword\macro2...
7805 % Currently is also contains all @aliases; the list can be split
7806 % if there is a need.
7807 \def\macrolist{}
7808
7809 % Add the macro to \macrolist
7810 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7811 \def\addtomacrolistxxx#1{%
7812 \toks0 = \expandafter{\macrolist\definedummyword#1}%
7813 \xdef\macrolist{\the\toks0}%
7814 }
7815
7816 % Utility routines.
7817 % This does \let #1 = #2, with \csnames; that is,
7818 % \let \csname#1\endcsname = \csname#2\endcsname
7819 % (except of course we have to play expansion games).
7820 %
7821 \def\cslet#1#2{%
7822 \expandafter\let
7823 \csname#1\expandafter\endcsname
7824 \csname#2\endcsname
7825 }
7826
7827 % Trim leading and trailing spaces off a string.
7828 % Concepts from aro-bend problem 15 (see CTAN).
7829 {\catcode`\@=11
7830 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7831 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7832 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7833 \def\unbrace#1{#1}
7834 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
7835 }
7836
7837 % Trim a single trailing ^^M off a string.
7838 {\catcode`\^^M=\other \catcode`\Q=3%
7839 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
7840 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
7841 \gdef\eatcrb#1Q#2Q{#1}%
7842 }
7843
7844 % Macro bodies are absorbed as an argument in a context where
7845 % all characters are catcode 10, 11 or 12, except \ which is active
7846 % (as in normal texinfo). It is necessary to change the definition of \
7847 % to recognize macro arguments; this is the job of \mbodybackslash.
7848 %
7849 % Non-ASCII encodings make 8-bit characters active, so un-activate
7850 % them to avoid their expansion. Must do this non-globally, to
7851 % confine the change to the current group.
7852 %
7853 % It's necessary to have hard CRs when the macro is executed. This is
7854 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
7855 % body, and then making it the \newlinechar in \scanmacro.
7856 %
7857 \def\scanctxt{% used as subroutine
7858 \catcode`\"=\other
7859 \catcode`\+=\other
7860 \catcode`\<=\other
7861 \catcode`\>=\other
7862 \catcode`\^=\other
7863 \catcode`\_=\other
7864 \catcode`\|=\other
7865 \catcode`\~=\other
7866 \ifx\declaredencoding\ascii \else \setcharscatcodeothernonglobal \fi
7867 }
7868
7869 \def\scanargctxt{% used for copying and captions, not macros.
7870 \scanctxt
7871 \catcode`\@=\other
7872 \catcode`\\=\other
7873 \catcode`\^^M=\other
7874 }
7875
7876 \def\macrobodyctxt{% used for @macro definitions
7877 \scanctxt
7878 \catcode`\ =\other
7879 \catcode`\@=\other
7880 \catcode`\{=\other
7881 \catcode`\}=\other
7882 \catcode`\^^M=\other
7883 \usembodybackslash
7884 }
7885
7886 % Used when scanning braced macro arguments. Note, however, that catcode
7887 % changes here are ineffectual if the macro invocation was nested inside
7888 % an argument to another Texinfo command.
7889 \def\macroargctxt{%
7890 \scanctxt
7891 \catcode`\ =\active
7892 \catcode`\^^M=\other
7893 \catcode`\\=\active
7894 }
7895
7896 \def\macrolineargctxt{% used for whole-line arguments without braces
7897 \scanctxt
7898 \catcode`\{=\other
7899 \catcode`\}=\other
7900 }
7901
7902 % \mbodybackslash is the definition of \ in @macro bodies.
7903 % It maps \foo\ => \csname macarg.foo\endcsname => #N
7904 % where N is the macro parameter number.
7905 % We define \csname macarg.\endcsname to be \realbackslash, so
7906 % \\ in macro replacement text gets you a backslash.
7907 %
7908 {\catcode`@=0 @catcode`@\=@active
7909 @gdef@usembodybackslash{@let\=@mbodybackslash}
7910 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
7911 }
7912 \expandafter\def\csname macarg.\endcsname{\realbackslash}
7913
7914 \def\margbackslash#1{\char`\#1 }
7915
7916 \def\macro{\recursivefalse\parsearg\macroxxx}
7917 \def\rmacro{\recursivetrue\parsearg\macroxxx}
7918
7919 \def\macroxxx#1{%
7920 \getargs{#1}% now \macname is the macname and \argl the arglist
7921 \ifx\argl\empty % no arguments
7922 \paramno=0\relax
7923 \else
7924 \expandafter\parsemargdef \argl;%
7925 \if\paramno>256\relax
7926 \ifx\eTeXversion\thisisundefined
7927 \errhelp = \EMsimple
7928 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
7929 \fi
7930 \fi
7931 \fi
7932 \if1\csname ismacro.\the\macname\endcsname
7933 \message{Warning: redefining \the\macname}%
7934 \else
7935 \expandafter\ifx\csname \the\macname\endcsname \relax
7936 \else \errmessage{Macro name \the\macname\space already defined}\fi
7937 \global\cslet{macsave.\the\macname}{\the\macname}%
7938 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
7939 \addtomacrolist{\the\macname}%
7940 \fi
7941 \begingroup \macrobodyctxt
7942 \ifrecursive \expandafter\parsermacbody
7943 \else \expandafter\parsemacbody
7944 \fi}
7945
7946 \parseargdef\unmacro{%
7947 \if1\csname ismacro.#1\endcsname
7948 \global\cslet{#1}{macsave.#1}%
7949 \global\expandafter\let \csname ismacro.#1\endcsname=0%
7950 % Remove the macro name from \macrolist:
7951 \begingroup
7952 \expandafter\let\csname#1\endcsname \relax
7953 \let\definedummyword\unmacrodo
7954 \xdef\macrolist{\macrolist}%
7955 \endgroup
7956 \else
7957 \errmessage{Macro #1 not defined}%
7958 \fi
7959 }
7960
7961 % Called by \do from \dounmacro on each macro. The idea is to omit any
7962 % macro definitions that have been changed to \relax.
7963 %
7964 \def\unmacrodo#1{%
7965 \ifx #1\relax
7966 % remove this
7967 \else
7968 \noexpand\definedummyword \noexpand#1%
7969 \fi
7970 }
7971
7972 % \getargs -- Parse the arguments to a @macro line. Set \macname to
7973 % the name of the macro, and \argl to the braced argument list.
7974 \def\getargs#1{\getargsxxx#1{}}
7975 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
7976 \def\getmacname#1 #2\relax{\macname={#1}}
7977 \def\getmacargs#1{\def\argl{#1}}
7978 % This made use of the feature that if the last token of a
7979 % <parameter list> is #, then the preceding argument is delimited by
7980 % an opening brace, and that opening brace is not consumed.
7981
7982 % Parse the optional {params} list to @macro or @rmacro.
7983 % Set \paramno to the number of arguments,
7984 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
7985 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
7986 % list to some hook where the argument is to be expanded. If there are
7987 % less than 10 arguments that hook is to be replaced by ##N where N
7988 % is the position in that list, that is to say the macro arguments are to be
7989 % defined `a la TeX in the macro body.
7990 %
7991 % That gets used by \mbodybackslash (above).
7992 %
7993 % If there are 10 or more arguments, a different technique is used: see
7994 % \parsemmanyargdef.
7995 %
7996 \def\parsemargdef#1;{%
7997 \paramno=0\def\paramlist{}%
7998 \let\hash\relax
7999 % \hash is redefined to `#' later to get it into definitions
8000 \let\processmacroarg\relax
8001 \parsemargdefxxx#1,;,%
8002 \ifnum\paramno<10\relax\else
8003 \paramno0\relax
8004 \parsemmanyargdef@@#1,;,% 10 or more arguments
8005 \fi
8006 }
8007 \def\parsemargdefxxx#1,{%
8008 \if#1;\let\next=\relax
8009 \else \let\next=\parsemargdefxxx
8010 \advance\paramno by 1
8011 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8012 {\processmacroarg{\hash\the\paramno}}%
8013 \edef\paramlist{\paramlist\hash\the\paramno,}%
8014 \fi\next}
8015
8016 % \parsemacbody, \parsermacbody
8017 %
8018 % Read recursive and nonrecursive macro bodies. (They're different since
8019 % rec and nonrec macros end differently.)
8020 %
8021 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
8022 % body to be transformed.
8023 % Set \macrobody to the body of the macro, and call \defmacro.
8024 %
8025 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8026 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8027 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8028 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8029
8030 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8031 \edef\texiatcatcode{\the\catcode`\@}
8032 \catcode `@=11\relax
8033
8034 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8035
8036 % If there are 10 or more arguments, a different technique is used, where the
8037 % hook remains in the body, and when macro is to be expanded the body is
8038 % processed again to replace the arguments.
8039 %
8040 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8041 % argument N value and then \edef the body (nothing else will expand because of
8042 % the catcode regime under which the body was input).
8043 %
8044 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8045 % arguments, no macro can have more than 256 arguments (else error).
8046 %
8047 % In case that there are 10 or more arguments we parse again the arguments
8048 % list to set new definitions for the \macarg.BLAH macros corresponding to
8049 % each BLAH argument. It was anyhow needed to parse already once this list
8050 % in order to count the arguments, and as macros with at most 9 arguments
8051 % are by far more frequent than macro with 10 or more arguments, defining
8052 % twice the \macarg.BLAH macros does not cost too much processing power.
8053 \def\parsemmanyargdef@@#1,{%
8054 \if#1;\let\next=\relax
8055 \else
8056 \let\next=\parsemmanyargdef@@
8057 \edef\tempb{\eatspaces{#1}}%
8058 \expandafter\def\expandafter\tempa
8059 \expandafter{\csname macarg.\tempb\endcsname}%
8060 % Note that we need some extra \noexpand\noexpand, this is because we
8061 % don't want \the to be expanded in the \parsermacbody as it uses an
8062 % \xdef .
8063 \expandafter\edef\tempa
8064 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8065 \advance\paramno by 1\relax
8066 \fi\next}
8067
8068
8069 \let\endargs@\relax
8070 \let\nil@\relax
8071 \def\nilm@{\nil@}%
8072 \long\def\nillm@{\nil@}%
8073
8074 % This macro is expanded during the Texinfo macro expansion, not during its
8075 % definition. It gets all the arguments' values and assigns them to macros
8076 % macarg.ARGNAME
8077 %
8078 % #1 is the macro name
8079 % #2 is the list of argument names
8080 % #3 is the list of argument values
8081 \def\getargvals@#1#2#3{%
8082 \def\macargdeflist@{}%
8083 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8084 \def\paramlist{#2,\nil@}%
8085 \def\macroname{#1}%
8086 \begingroup
8087 \macroargctxt
8088 \def\argvaluelist{#3,\nil@}%
8089 \def\@tempa{#3}%
8090 \ifx\@tempa\empty
8091 \setemptyargvalues@
8092 \else
8093 \getargvals@@
8094 \fi
8095 }
8096 \def\getargvals@@{%
8097 \ifx\paramlist\nilm@
8098 % Some sanity check needed here that \argvaluelist is also empty.
8099 \ifx\argvaluelist\nillm@
8100 \else
8101 \errhelp = \EMsimple
8102 \errmessage{Too many arguments in macro `\macroname'!}%
8103 \fi
8104 \let\next\macargexpandinbody@
8105 \else
8106 \ifx\argvaluelist\nillm@
8107 % No more arguments values passed to macro. Set remaining named-arg
8108 % macros to empty.
8109 \let\next\setemptyargvalues@
8110 \else
8111 % pop current arg name into \@tempb
8112 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8113 \expandafter\@tempa\expandafter{\paramlist}%
8114 % pop current argument value into \@tempc
8115 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8116 \expandafter\@tempa\expandafter{\argvaluelist}%
8117 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8118 % First place the new argument macro definition into \@tempd
8119 \expandafter\macname\expandafter{\@tempc}%
8120 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8121 \expandafter\def\expandafter\@tempe\expandafter{%
8122 \csname macarg.\@tempb\endcsname}%
8123 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8124 \push@\@tempd\macargdeflist@
8125 \let\next\getargvals@@
8126 \fi
8127 \fi
8128 \next
8129 }
8130
8131 \def\push@#1#2{%
8132 \expandafter\expandafter\expandafter\def
8133 \expandafter\expandafter\expandafter#2%
8134 \expandafter\expandafter\expandafter{%
8135 \expandafter#1#2}%
8136 }
8137
8138 % Replace arguments by their values in the macro body, and place the result
8139 % in macro \@tempa.
8140 %
8141 \def\macvalstoargs@{%
8142 % To do this we use the property that token registers that are \the'ed
8143 % within an \edef expand only once. So we are going to place all argument
8144 % values into respective token registers.
8145 %
8146 % First we save the token context, and initialize argument numbering.
8147 \begingroup
8148 \paramno0\relax
8149 % Then, for each argument number #N, we place the corresponding argument
8150 % value into a new token list register \toks#N
8151 \expandafter\putargsintokens@\saveparamlist@,;,%
8152 % Then, we expand the body so that argument are replaced by their
8153 % values. The trick for values not to be expanded themselves is that they
8154 % are within tokens and that tokens expand only once in an \edef .
8155 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8156 % Now we restore the token stack pointer to free the token list registers
8157 % which we have used, but we make sure that expanded body is saved after
8158 % group.
8159 \expandafter
8160 \endgroup
8161 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8162 }
8163
8164 % Define the named-macro outside of this group and then close this group.
8165 %
8166 \def\macargexpandinbody@{%
8167 \expandafter
8168 \endgroup
8169 \macargdeflist@
8170 % First the replace in body the macro arguments by their values, the result
8171 % is in \@tempa .
8172 \macvalstoargs@
8173 % Then we point at the \norecurse or \gobble (for recursive) macro value
8174 % with \@tempb .
8175 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8176 % Depending on whether it is recursive or not, we need some tailing
8177 % \egroup .
8178 \ifx\@tempb\gobble
8179 \let\@tempc\relax
8180 \else
8181 \let\@tempc\egroup
8182 \fi
8183 % And now we do the real job:
8184 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8185 \@tempd
8186 }
8187
8188 \def\putargsintokens@#1,{%
8189 \if#1;\let\next\relax
8190 \else
8191 \let\next\putargsintokens@
8192 % First we allocate the new token list register, and give it a temporary
8193 % alias \@tempb .
8194 \toksdef\@tempb\the\paramno
8195 % Then we place the argument value into that token list register.
8196 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8197 \expandafter\@tempb\expandafter{\@tempa}%
8198 \advance\paramno by 1\relax
8199 \fi
8200 \next
8201 }
8202
8203 % Trailing missing arguments are set to empty.
8204 %
8205 \def\setemptyargvalues@{%
8206 \ifx\paramlist\nilm@
8207 \let\next\macargexpandinbody@
8208 \else
8209 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8210 \let\next\setemptyargvalues@
8211 \fi
8212 \next
8213 }
8214
8215 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8216 \expandafter\def\expandafter\@tempa\expandafter{%
8217 \expandafter\def\csname macarg.#1\endcsname{}}%
8218 \push@\@tempa\macargdeflist@
8219 \def\paramlist{#2}%
8220 }
8221
8222 % #1 is the element target macro
8223 % #2 is the list macro
8224 % #3,#4\endargs@ is the list value
8225 \def\pop@#1#2#3,#4\endargs@{%
8226 \def#1{#3}%
8227 \def#2{#4}%
8228 }
8229 \long\def\longpop@#1#2#3,#4\endargs@{%
8230 \long\def#1{#3}%
8231 \long\def#2{#4}%
8232 }
8233
8234
8235 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8236
8237
8238
8239 % Remove following spaces at the expansion stage.
8240 % This works because spaces are discarded before each argument when TeX is
8241 % getting the arguments for a macro.
8242 % This must not be immediately followed by a }.
8243 \long\def\gobblespaces#1{#1}
8244
8245 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8246 % \macrobody has the body of the macro in it, with placeholders for
8247 % its parameters, looking like "\processmacroarg{\hash 1}".
8248 % \paramno is the number of parameters
8249 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8250 % There are eight cases: recursive and nonrecursive macros of zero, one,
8251 % up to nine, and many arguments.
8252 % \xdef is used so that macro definitions will survive the file
8253 % they're defined in: @include reads the file inside a group.
8254 %
8255 \def\defmacro{%
8256 \let\hash=##% convert placeholders to macro parameter chars
8257 \ifnum\paramno=1
8258 \def\processmacroarg{\gobblespaces}%
8259 % This removes the pair of braces around the argument. We don't
8260 % use \eatspaces, because this can cause ends of lines to be lost
8261 % when the argument to \eatspaces is read, leading to line-based
8262 % commands like "@itemize" not being read correctly.
8263 \else
8264 \def\processmacroarg{\xprocessmacroarg}%
8265 \let\xprocessmacroarg\relax
8266 \fi
8267 \ifrecursive %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8268 \ifcase\paramno
8269 % 0
8270 \expandafter\xdef\csname\the\macname\endcsname{%
8271 \noexpand\scanmacro{\macrobody}}%
8272 \or % 1
8273 \expandafter\xdef\csname\the\macname\endcsname{%
8274 \bgroup
8275 \noexpand\braceorline
8276 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8277 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8278 \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
8279 \noexpand\gobblespaces##1\empty}%
8280 % The \empty is for \gobblespaces in case #1 is empty
8281 }%
8282 \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
8283 \egroup\noexpand\scanmacro{\macrobody}}%
8284 \else
8285 \ifnum\paramno<10\relax % at most 9
8286 % See non-recursive section below for comments
8287 \expandafter\xdef\csname\the\macname\endcsname{%
8288 \bgroup
8289 \noexpand\expandafter
8290 \noexpand\macroargctxt
8291 \noexpand\expandafter
8292 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8293 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8294 \noexpand\passargtomacro
8295 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8296 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8297 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8298 \expandafter\expandafter
8299 \expandafter\xdef
8300 \expandafter\expandafter
8301 \csname\the\macname @@@@\endcsname\paramlist{%
8302 \egroup\noexpand\scanmacro{\macrobody}}%
8303 \else % 10 or more
8304 \expandafter\xdef\csname\the\macname\endcsname{%
8305 \noexpand\getargvals@{\the\macname}{\argl}%
8306 }%
8307 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8308 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8309 \fi
8310 \fi
8311 \else %%%%%%%%%%%%%%%%%%%%%% Non-recursive %%%%%%%%%%%%%%%%%%%%%%%%%%
8312 \ifcase\paramno
8313 % 0
8314 \expandafter\xdef\csname\the\macname\endcsname{%
8315 \noexpand\scanmacro{\macrobody}}%
8316 \or % 1
8317 \expandafter\xdef\csname\the\macname\endcsname{%
8318 \bgroup
8319 \noexpand\braceorline
8320 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8321 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8322 \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
8323 \noexpand\gobblespaces##1\empty}%
8324 % The \empty is for \gobblespaces in case #1 is empty
8325 }%
8326 \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
8327 \egroup
8328 \noexpand\scanmacro{\macrobody}%
8329 }%
8330 \else % at most 9
8331 \ifnum\paramno<10\relax
8332 % @MACNAME sets the context for reading the macro argument
8333 % @MACNAME@@ gets the argument, processes backslashes and appends a
8334 % comma.
8335 % @MACNAME@@@ removes braces surrounding the argument list.
8336 % @MACNAME@@@@ scans the macro body with arguments substituted.
8337 \expandafter\xdef\csname\the\macname\endcsname{%
8338 \bgroup
8339 \noexpand\expandafter % This \expandafter skip any spaces after the
8340 \noexpand\macroargctxt % macro before we change the catcode of space.
8341 \noexpand\expandafter
8342 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8343 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8344 \noexpand\passargtomacro
8345 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8346 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8347 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8348 \expandafter\expandafter
8349 \expandafter\xdef
8350 \expandafter\expandafter
8351 \csname\the\macname @@@@\endcsname\paramlist{%
8352 \egroup\noexpand\scanmacro{\macrobody}}%
8353 \else % 10 or more:
8354 \expandafter\xdef\csname\the\macname\endcsname{%
8355 \noexpand\getargvals@{\the\macname}{\argl}%
8356 }%
8357 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8358 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
8359 \fi
8360 \fi
8361 \fi}
8362
8363 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8364
8365 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8366
8367
8368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8369 %
8370 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8371 @catcode`@_=11 % private names
8372 @catcode`@!=11 % used as argument separator
8373
8374 % \passargtomacro#1#2 -
8375 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8376 % compressed to one.
8377 %
8378 % This implementation works by expansion, and not execution (so we cannot use
8379 % \def or similar). This reduces the risk of this failing in contexts where
8380 % complete expansion is done with no execution (for example, in writing out to
8381 % an auxiliary file for an index entry).
8382 %
8383 % State is kept in the input stream: the argument passed to
8384 % @look_ahead, @gobble_and_check_finish and @add_segment is
8385 %
8386 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8387 %
8388 % where:
8389 % THE_MACRO - name of the macro we want to call
8390 % ARG_RESULT - argument list we build to pass to that macro
8391 % PENDING_BS - either a backslash or nothing
8392 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8393
8394 @gdef@passargtomacro#1#2{%
8395 @add_segment #1!{}@relax#2\@_finish\%
8396 }
8397 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8398
8399 % #1 - THE_MACRO ARG_RESULT
8400 % #2 - PENDING_BS
8401 % #3 - NEXT_TOKEN
8402 % #4 used to look ahead
8403 %
8404 % If the next token is not a backslash, process the rest of the argument;
8405 % otherwise, remove the next token.
8406 @gdef@look_ahead#1!#2#3#4{%
8407 @ifx#4\%
8408 @expandafter@gobble_and_check_finish
8409 @else
8410 @expandafter@add_segment
8411 @fi#1!{#2}#4#4%
8412 }
8413
8414 % #1 - THE_MACRO ARG_RESULT
8415 % #2 - PENDING_BS
8416 % #3 - NEXT_TOKEN
8417 % #4 should be a backslash, which is gobbled.
8418 % #5 looks ahead
8419 %
8420 % Double backslash found. Add a single backslash, and look ahead.
8421 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8422 @add_segment#1\!{}#5#5%
8423 }
8424
8425 @gdef@is_fi{@fi}
8426
8427 % #1 - THE_MACRO ARG_RESULT
8428 % #2 - PENDING_BS
8429 % #3 - NEXT_TOKEN
8430 % #4 is input stream until next backslash
8431 %
8432 % Input stream is either at the start of the argument, or just after a
8433 % backslash sequence, either a lone backslash, or a doubled backslash.
8434 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8435 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8436 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8437 % a backslash just before the start of the input stream that has not been
8438 % added to ARG_RESULT.
8439 @gdef@add_segment#1!#2#3#4\{%
8440 @ifx#3@_finish
8441 @call_the_macro#1!%
8442 @else
8443 % append the pending backslash to the result, followed by the next segment
8444 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8445 % this @fi is discarded by @look_ahead.
8446 % we can't get rid of it with \expandafter because we don't know how
8447 % long #4 is.
8448 }
8449
8450 % #1 - THE_MACRO
8451 % #2 - ARG_RESULT
8452 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8453 % conditional.
8454 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8455
8456 }
8457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8458
8459 % \braceorline MAC is used for a one-argument macro MAC. It checks
8460 % whether the next non-whitespace character is a {. It sets the context
8461 % for reading the argument (slightly different in the two cases). Then,
8462 % to read the argument, in the whole-line case, it then calls the regular
8463 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8464 %
8465 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8466 \def\braceorlinexxx{%
8467 \ifx\nchar\bgroup
8468 \macroargctxt
8469 \expandafter\passargtomacro
8470 \else
8471 \macrolineargctxt\expandafter\parsearg
8472 \fi \macnamexxx}
8473
8474
8475 % @alias.
8476 % We need some trickery to remove the optional spaces around the equal
8477 % sign. Make them active and then expand them all to nothing.
8478 %
8479 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8480 \def\aliasxxx #1{\aliasyyy#1\relax}
8481 \def\aliasyyy #1=#2\relax{%
8482 {%
8483 \expandafter\let\obeyedspace=\empty
8484 \addtomacrolist{#1}%
8485 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8486 }%
8487 \next
8488 }
8489
8490
8491 \message{cross references,}
8492
8493 \newwrite\auxfile
8494 \newif\ifhavexrefs % True if xref values are known.
8495 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8496
8497 % @inforef is relatively simple.
8498 \def\inforef #1{\inforefzzz #1,,,,**}
8499 \def\inforefzzz #1,#2,#3,#4**{%
8500 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8501 node \samp{\ignorespaces#1{}}}
8502
8503 % @node's only job in TeX is to define \lastnode, which is used in
8504 % cross-references. The @node line might or might not have commas, and
8505 % might or might not have spaces before the first comma, like:
8506 % @node foo , bar , ...
8507 % We don't want such trailing spaces in the node name.
8508 %
8509 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8510 %
8511 % also remove a trailing comma, in case of something like this:
8512 % @node Help-Cross, , , Cross-refs
8513 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8514 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
8515
8516 \let\nwnode=\node
8517 \let\lastnode=\empty
8518
8519 % Write a cross-reference definition for the current node. #1 is the
8520 % type (Ynumbered, Yappendix, Ynothing).
8521 %
8522 \def\donoderef#1{%
8523 \ifx\lastnode\empty\else
8524 \setref{\lastnode}{#1}%
8525 \global\let\lastnode=\empty
8526 \fi
8527 }
8528
8529 % @anchor{NAME} -- define xref target at arbitrary point.
8530 %
8531 \newcount\savesfregister
8532 %
8533 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8534 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8535 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8536
8537 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8538 % anchor), which consists of three parts:
8539 % 1) NAME-title - the current sectioning name taken from \lastsection,
8540 % or the anchor name.
8541 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8542 % empty for anchors.
8543 % 3) NAME-pg - the page number.
8544 %
8545 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8546 % floats, there is an additional part, which is not written here:
8547 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8548 %
8549 \def\setref#1#2{%
8550 \pdfmkdest{#1}%
8551 \iflinks
8552 {%
8553 \requireauxfile
8554 \atdummies % preserve commands, but don't expand them
8555 \edef\writexrdef##1##2{%
8556 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8557 ##1}{##2}}% these are parameters of \writexrdef
8558 }%
8559 \toks0 = \expandafter{\lastsection}%
8560 \immediate \writexrdef{title}{\the\toks0 }%
8561 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8562 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8563 }%
8564 \fi
8565 }
8566
8567 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8568 % automatically in xrefs, if the third arg is not explicitly specified.
8569 % This was provided as a "secret" @set xref-automatic-section-title
8570 % variable, now it's official.
8571 %
8572 \parseargdef\xrefautomaticsectiontitle{%
8573 \def\temp{#1}%
8574 \ifx\temp\onword
8575 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8576 = \empty
8577 \else\ifx\temp\offword
8578 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8579 = \relax
8580 \else
8581 \errhelp = \EMsimple
8582 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8583 must be on|off}%
8584 \fi\fi
8585 }
8586
8587 % \f
8588 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8589 % the node name, #2 the name of the Info cross-reference, #3 the printed
8590 % node name, #4 the name of the Info file, #5 the name of the printed
8591 % manual. All but the node name can be omitted.
8592 %
8593 \def\pxref{\putwordsee{} \xrefXX}
8594 \def\xref{\putwordSee{} \xrefXX}
8595 \def\ref{\xrefXX}
8596
8597 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8598 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8599 %
8600 \newbox\toprefbox
8601 \newbox\printedrefnamebox
8602 \newbox\infofilenamebox
8603 \newbox\printedmanualbox
8604 %
8605 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8606 \unsepspaces
8607 %
8608 % Get args without leading/trailing spaces.
8609 \def\printedrefname{\ignorespaces #3}%
8610 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8611 %
8612 \def\infofilename{\ignorespaces #4}%
8613 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8614 %
8615 \def\printedmanual{\ignorespaces #5}%
8616 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8617 %
8618 % If the printed reference name (arg #3) was not explicitly given in
8619 % the @xref, figure out what we want to use.
8620 \ifdim \wd\printedrefnamebox = 0pt
8621 % No printed node name was explicitly given.
8622 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8623 % Not auto section-title: use node name inside the square brackets.
8624 \def\printedrefname{\ignorespaces #1}%
8625 \else
8626 % Auto section-title: use chapter/section title inside
8627 % the square brackets if we have it.
8628 \ifdim \wd\printedmanualbox > 0pt
8629 % It is in another manual, so we don't have it; use node name.
8630 \def\printedrefname{\ignorespaces #1}%
8631 \else
8632 \ifhavexrefs
8633 % We (should) know the real title if we have the xref values.
8634 \def\printedrefname{\refx{#1-title}{}}%
8635 \else
8636 % Otherwise just copy the Info node name.
8637 \def\printedrefname{\ignorespaces #1}%
8638 \fi%
8639 \fi
8640 \fi
8641 \fi
8642 %
8643 % Make link in pdf output.
8644 \ifpdf
8645 {\indexnofonts
8646 \turnoffactive
8647 \makevalueexpandable
8648 % This expands tokens, so do it after making catcode changes, so _
8649 % etc. don't get their TeX definitions. This ignores all spaces in
8650 % #4, including (wrongly) those in the middle of the filename.
8651 \getfilename{#4}%
8652 %
8653 % This (wrongly) does not take account of leading or trailing
8654 % spaces in #1, which should be ignored.
8655 \edef\pdfxrefdest{#1}%
8656 \ifx\pdfxrefdest\empty
8657 \def\pdfxrefdest{Top}% no empty targets
8658 \else
8659 \txiescapepdf\pdfxrefdest % escape PDF special chars
8660 \fi
8661 %
8662 \leavevmode
8663 \startlink attr{/Border [0 0 0]}%
8664 \ifnum\filenamelength>0
8665 goto file{\the\filename.pdf} name{\pdfxrefdest}%
8666 \else
8667 goto name{\pdfmkpgn{\pdfxrefdest}}%
8668 \fi
8669 }%
8670 \setcolor{\linkcolor}%
8671 \fi
8672 {%
8673 % Have to otherify everything special to allow the \csname to
8674 % include an _ in the xref name, etc.
8675 \indexnofonts
8676 \turnoffactive
8677 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8678 \csname XR#1-title\endcsname
8679 }%
8680 %
8681 % Float references are printed completely differently: "Figure 1.2"
8682 % instead of "[somenode], p.3". \iffloat distinguishes them by
8683 % \Xthisreftitle being set to a magic string.
8684 \iffloat\Xthisreftitle
8685 % If the user specified the print name (third arg) to the ref,
8686 % print it instead of our usual "Figure 1.2".
8687 \ifdim\wd\printedrefnamebox = 0pt
8688 \refx{#1-snt}{}%
8689 \else
8690 \printedrefname
8691 \fi
8692 %
8693 % If the user also gave the printed manual name (fifth arg), append
8694 % "in MANUALNAME".
8695 \ifdim \wd\printedmanualbox > 0pt
8696 \space \putwordin{} \cite{\printedmanual}%
8697 \fi
8698 \else
8699 % node/anchor (non-float) references.
8700 %
8701 % If we use \unhbox to print the node names, TeX does not insert
8702 % empty discretionaries after hyphens, which means that it will not
8703 % find a line break at a hyphen in a node names. Since some manuals
8704 % are best written with fairly long node names, containing hyphens,
8705 % this is a loss. Therefore, we give the text of the node name
8706 % again, so it is as if TeX is seeing it for the first time.
8707 %
8708 \ifdim \wd\printedmanualbox > 0pt
8709 % Cross-manual reference with a printed manual name.
8710 %
8711 \crossmanualxref{\cite{\printedmanual\unskip}}%
8712 %
8713 \else\ifdim \wd\infofilenamebox > 0pt
8714 % Cross-manual reference with only an info filename (arg 4), no
8715 % printed manual name (arg 5). This is essentially the same as
8716 % the case above; we output the filename, since we have nothing else.
8717 %
8718 \crossmanualxref{\code{\infofilename\unskip}}%
8719 %
8720 \else
8721 % Reference within this manual.
8722 %
8723 % _ (for example) has to be the character _ for the purposes of the
8724 % control sequence corresponding to the node, but it has to expand
8725 % into the usual \leavevmode...\vrule stuff for purposes of
8726 % printing. So we \turnoffactive for the \refx-snt, back on for the
8727 % printing, back off for the \refx-pg.
8728 {\turnoffactive
8729 % Only output a following space if the -snt ref is nonempty; for
8730 % @unnumbered and @anchor, it won't be.
8731 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
8732 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8733 }%
8734 % output the `[mynode]' via the macro below so it can be overridden.
8735 \xrefprintnodename\printedrefname
8736 %
8737 % But we always want a comma and a space:
8738 ,\space
8739 %
8740 % output the `page 3'.
8741 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
8742 % Add a , if xref followed by a space
8743 \if\space\noexpand\tokenafterxref ,%
8744 \else\ifx\ \tokenafterxref ,% @TAB
8745 \else\ifx\*\tokenafterxref ,% @*
8746 \else\ifx\ \tokenafterxref ,% @SPACE
8747 \else\ifx\
8748 \tokenafterxref ,% @NL
8749 \else\ifx\tie\tokenafterxref ,% @tie
8750 \fi\fi\fi\fi\fi\fi
8751 \fi\fi
8752 \fi
8753 \endlink
8754 \endgroup}
8755
8756 % Output a cross-manual xref to #1. Used just above (twice).
8757 %
8758 % Only include the text "Section ``foo'' in" if the foo is neither
8759 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
8760 % "see The Foo Manual", the idea being to refer to the whole manual.
8761 %
8762 % But, this being TeX, we can't easily compare our node name against the
8763 % string "Top" while ignoring the possible spaces before and after in
8764 % the input. By adding the arbitrary 7sp below, we make it much less
8765 % likely that a real node name would have the same width as "Top" (e.g.,
8766 % in a monospaced font). Hopefully it will never happen in practice.
8767 %
8768 % For the same basic reason, we retypeset the "Top" at every
8769 % reference, since the current font is indeterminate.
8770 %
8771 \def\crossmanualxref#1{%
8772 \setbox\toprefbox = \hbox{Top\kern7sp}%
8773 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
8774 \ifdim \wd2 > 7sp % nonempty?
8775 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
8776 \putwordSection{} ``\printedrefname'' \putwordin{}\space
8777 \fi
8778 \fi
8779 #1%
8780 }
8781
8782 % This macro is called from \xrefX for the `[nodename]' part of xref
8783 % output. It's a separate macro only so it can be changed more easily,
8784 % since square brackets don't work well in some documents. Particularly
8785 % one that Bob is working on :).
8786 %
8787 \def\xrefprintnodename#1{[#1]}
8788
8789 % Things referred to by \setref.
8790 %
8791 \def\Ynothing{}
8792 \def\Yomitfromtoc{}
8793 \def\Ynumbered{%
8794 \ifnum\secno=0
8795 \putwordChapter@tie \the\chapno
8796 \else \ifnum\subsecno=0
8797 \putwordSection@tie \the\chapno.\the\secno
8798 \else \ifnum\subsubsecno=0
8799 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
8800 \else
8801 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
8802 \fi\fi\fi
8803 }
8804 \def\Yappendix{%
8805 \ifnum\secno=0
8806 \putwordAppendix@tie @char\the\appendixno{}%
8807 \else \ifnum\subsecno=0
8808 \putwordSection@tie @char\the\appendixno.\the\secno
8809 \else \ifnum\subsubsecno=0
8810 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
8811 \else
8812 \putwordSection@tie
8813 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
8814 \fi\fi\fi
8815 }
8816
8817 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
8818 % If its value is nonempty, SUFFIX is output afterward.
8819 %
8820 \def\refx#1#2{%
8821 \requireauxfile
8822 {%
8823 \indexnofonts
8824 \otherbackslash
8825 \expandafter\global\expandafter\let\expandafter\thisrefX
8826 \csname XR#1\endcsname
8827 }%
8828 \ifx\thisrefX\relax
8829 % If not defined, say something at least.
8830 \angleleft un\-de\-fined\angleright
8831 \iflinks
8832 \ifhavexrefs
8833 {\toks0 = {#1}% avoid expansion of possibly-complex value
8834 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
8835 \else
8836 \ifwarnedxrefs\else
8837 \global\warnedxrefstrue
8838 \message{Cross reference values unknown; you must run TeX again.}%
8839 \fi
8840 \fi
8841 \fi
8842 \else
8843 % It's defined, so just use it.
8844 \thisrefX
8845 \fi
8846 #2% Output the suffix in any case.
8847 }
8848
8849 % This is the macro invoked by entries in the aux file. Usually it's
8850 % just a \def (we prepend XR to the control sequence name to avoid
8851 % collisions). But if this is a float type, we have more work to do.
8852 %
8853 \def\xrdef#1#2{%
8854 {% The node name might contain 8-bit characters, which in our current
8855 % implementation are changed to commands like @'e. Don't let these
8856 % mess up the control sequence name.
8857 \indexnofonts
8858 \turnoffactive
8859 \xdef\safexrefname{#1}%
8860 }%
8861 %
8862 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
8863 %
8864 % Was that xref control sequence that we just defined for a float?
8865 \expandafter\iffloat\csname XR\safexrefname\endcsname
8866 % it was a float, and we have the (safe) float type in \iffloattype.
8867 \expandafter\let\expandafter\floatlist
8868 \csname floatlist\iffloattype\endcsname
8869 %
8870 % Is this the first time we've seen this float type?
8871 \expandafter\ifx\floatlist\relax
8872 \toks0 = {\do}% yes, so just \do
8873 \else
8874 % had it before, so preserve previous elements in list.
8875 \toks0 = \expandafter{\floatlist\do}%
8876 \fi
8877 %
8878 % Remember this xref in the control sequence \floatlistFLOATTYPE,
8879 % for later use in \listoffloats.
8880 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
8881 {\safexrefname}}%
8882 \fi
8883 }
8884
8885 % If working on a large document in chapters, it is convenient to
8886 % be able to disable indexing, cross-referencing, and contents, for test runs.
8887 % This is done with @novalidate at the beginning of the file.
8888 %
8889 \newif\iflinks \linkstrue % by default we want the aux files.
8890 \let\novalidate = \linksfalse
8891
8892 % Used when writing to the aux file, or when using data from it.
8893 \def\requireauxfile{%
8894 \iflinks
8895 \tryauxfile
8896 % Open the new aux file. TeX will close it automatically at exit.
8897 \immediate\openout\auxfile=\jobname.aux
8898 \fi
8899 \global\let\requireauxfile=\relax % Only do this once.
8900 }
8901
8902 % Read the last existing aux file, if any. No error if none exists.
8903 %
8904 \def\tryauxfile{%
8905 \openin 1 \jobname.aux
8906 \ifeof 1 \else
8907 \readdatafile{aux}%
8908 \global\havexrefstrue
8909 \fi
8910 \closein 1
8911 }
8912
8913 \def\setupdatafile{%
8914 \catcode`\^^@=\other
8915 \catcode`\^^A=\other
8916 \catcode`\^^B=\other
8917 \catcode`\^^C=\other
8918 \catcode`\^^D=\other
8919 \catcode`\^^E=\other
8920 \catcode`\^^F=\other
8921 \catcode`\^^G=\other
8922 \catcode`\^^H=\other
8923 \catcode`\^^K=\other
8924 \catcode`\^^L=\other
8925 \catcode`\^^N=\other
8926 \catcode`\^^P=\other
8927 \catcode`\^^Q=\other
8928 \catcode`\^^R=\other
8929 \catcode`\^^S=\other
8930 \catcode`\^^T=\other
8931 \catcode`\^^U=\other
8932 \catcode`\^^V=\other
8933 \catcode`\^^W=\other
8934 \catcode`\^^X=\other
8935 \catcode`\^^Z=\other
8936 \catcode`\^^[=\other
8937 \catcode`\^^\=\other
8938 \catcode`\^^]=\other
8939 \catcode`\^^^=\other
8940 \catcode`\^^_=\other
8941 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
8942 % in xref tags, i.e., node names. But since ^^e4 notation isn't
8943 % supported in the main text, it doesn't seem desirable. Furthermore,
8944 % that is not enough: for node names that actually contain a ^
8945 % character, we would end up writing a line like this: 'xrdef {'hat
8946 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
8947 % argument, and \hat is not an expandable control sequence. It could
8948 % all be worked out, but why? Either we support ^^ or we don't.
8949 %
8950 % The other change necessary for this was to define \auxhat:
8951 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
8952 % and then to call \auxhat in \setq.
8953 %
8954 \catcode`\^=\other
8955 %
8956 % Special characters. Should be turned off anyway, but...
8957 \catcode`\~=\other
8958 \catcode`\[=\other
8959 \catcode`\]=\other
8960 \catcode`\"=\other
8961 \catcode`\_=\other
8962 \catcode`\|=\other
8963 \catcode`\<=\other
8964 \catcode`\>=\other
8965 \catcode`\$=\other
8966 \catcode`\#=\other
8967 \catcode`\&=\other
8968 \catcode`\%=\other
8969 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
8970 %
8971 % This is to support \ in node names and titles, since the \
8972 % characters end up in a \csname. It's easier than
8973 % leaving it active and making its active definition an actual \
8974 % character. What I don't understand is why it works in the *value*
8975 % of the xrdef. Seems like it should be a catcode12 \, and that
8976 % should not typeset properly. But it works, so I'm moving on for
8977 % now. --karl, 15jan04.
8978 \catcode`\\=\other
8979 %
8980 % Make the characters 128-255 be printing characters.
8981 {\setcharscatcodeothernonglobal}%
8982 %
8983 % @ is our escape character in .aux files, and we need braces.
8984 \catcode`\{=1
8985 \catcode`\}=2
8986 \catcode`\@=0
8987 }
8988
8989 \def\readdatafile#1{%
8990 \begingroup
8991 \setupdatafile
8992 \input\jobname.#1
8993 \endgroup}
8994
8995
8996 \message{insertions,}
8997 % including footnotes.
8998
8999 \newcount \footnoteno
9000
9001 % The trailing space in the following definition for supereject is
9002 % vital for proper filling; pages come out unaligned when you do a
9003 % pagealignmacro call if that space before the closing brace is
9004 % removed. (Generally, numeric constants should always be followed by a
9005 % space to prevent strange expansion errors.)
9006 \def\supereject{\par\penalty -20000\footnoteno =0 }
9007
9008 % @footnotestyle is meaningful for Info output only.
9009 \let\footnotestyle=\comment
9010
9011 {\catcode `\@=11
9012 %
9013 % Auto-number footnotes. Otherwise like plain.
9014 \gdef\footnote{%
9015 \global\advance\footnoteno by \@ne
9016 \edef\thisfootno{$^{\the\footnoteno}$}%
9017 %
9018 % In case the footnote comes at the end of a sentence, preserve the
9019 % extra spacing after we do the footnote number.
9020 \let\@sf\empty
9021 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9022 %
9023 % Remove inadvertent blank space before typesetting the footnote number.
9024 \unskip
9025 \thisfootno\@sf
9026 \dofootnote
9027 }%
9028
9029 % Don't bother with the trickery in plain.tex to not require the
9030 % footnote text as a parameter. Our footnotes don't need to be so general.
9031 %
9032 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9033 % \parseargline) fails inside footnotes because the tokens are fixed when
9034 % the footnote is read. --karl, 16nov96.
9035 %
9036 \gdef\dofootnote{%
9037 \insert\footins\bgroup
9038 %
9039 % Nested footnotes are not supported in TeX, that would take a lot
9040 % more work. (\startsavinginserts does not suffice.)
9041 \let\footnote=\errfootnotenest
9042 %
9043 % We want to typeset this text as a normal paragraph, even if the
9044 % footnote reference occurs in (for example) a display environment.
9045 % So reset some parameters.
9046 \hsize=\pagewidth
9047 \interlinepenalty\interfootnotelinepenalty
9048 \splittopskip\ht\strutbox % top baseline for broken footnotes
9049 \splitmaxdepth\dp\strutbox
9050 \floatingpenalty\@MM
9051 \leftskip\z@skip
9052 \rightskip\z@skip
9053 \spaceskip\z@skip
9054 \xspaceskip\z@skip
9055 \parindent\defaultparindent
9056 %
9057 \smallfonts \rm
9058 %
9059 % Because we use hanging indentation in footnotes, a @noindent appears
9060 % to exdent this text, so make it be a no-op. makeinfo does not use
9061 % hanging indentation so @noindent can still be needed within footnote
9062 % text after an @example or the like (not that this is good style).
9063 \let\noindent = \relax
9064 %
9065 % Hang the footnote text off the number. Use \everypar in case the
9066 % footnote extends for more than one paragraph.
9067 \everypar = {\hang}%
9068 \textindent{\thisfootno}%
9069 %
9070 % Don't crash into the line above the footnote text. Since this
9071 % expands into a box, it must come within the paragraph, lest it
9072 % provide a place where TeX can split the footnote.
9073 \footstrut
9074 %
9075 % Invoke rest of plain TeX footnote routine.
9076 \futurelet\next\fo@t
9077 }
9078 }%end \catcode `\@=11
9079
9080 \def\errfootnotenest{%
9081 \errhelp=\EMsimple
9082 \errmessage{Nested footnotes not supported in texinfo.tex,
9083 even though they work in makeinfo; sorry}
9084 }
9085
9086 \def\errfootnoteheading{%
9087 \errhelp=\EMsimple
9088 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9089 }
9090
9091 % In case a @footnote appears in a vbox, save the footnote text and create
9092 % the real \insert just after the vbox finished. Otherwise, the insertion
9093 % would be lost.
9094 % Similarly, if a @footnote appears inside an alignment, save the footnote
9095 % text to a box and make the \insert when a row of the table is finished.
9096 % And the same can be done for other insert classes. --kasal, 16nov03.
9097 %
9098 % Replace the \insert primitive by a cheating macro.
9099 % Deeper inside, just make sure that the saved insertions are not spilled
9100 % out prematurely.
9101 %
9102 \def\startsavinginserts{%
9103 \ifx \insert\ptexinsert
9104 \let\insert\saveinsert
9105 \else
9106 \let\checkinserts\relax
9107 \fi
9108 }
9109
9110 % This \insert replacement works for both \insert\footins{foo} and
9111 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9112 %
9113 \def\saveinsert#1{%
9114 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9115 \afterassignment\next
9116 % swallow the left brace
9117 \let\temp =
9118 }
9119 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9120 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9121
9122 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9123
9124 \def\placesaveins#1{%
9125 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9126 {\box#1}%
9127 }
9128
9129 % eat @SAVE -- beware, all of them have catcode \other:
9130 {
9131 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9132 \gdef\gobblesave @SAVE{}
9133 }
9134
9135 % initialization:
9136 \def\newsaveins #1{%
9137 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9138 \next
9139 }
9140 \def\newsaveinsX #1{%
9141 \csname newbox\endcsname #1%
9142 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9143 \checksaveins #1}%
9144 }
9145
9146 % initialize:
9147 \let\checkinserts\empty
9148 \newsaveins\footins
9149 \newsaveins\margin
9150
9151
9152 % @image. We use the macros from epsf.tex to support this.
9153 % If epsf.tex is not installed and @image is used, we complain.
9154 %
9155 % Check for and read epsf.tex up front. If we read it only at @image
9156 % time, we might be inside a group, and then its definitions would get
9157 % undone and the next image would fail.
9158 \openin 1 = epsf.tex
9159 \ifeof 1 \else
9160 % Do not bother showing banner with epsf.tex v2.7k (available in
9161 % doc/epsf.tex and on ctan).
9162 \def\epsfannounce{\toks0 = }%
9163 \input epsf.tex
9164 \fi
9165 \closein 1
9166 %
9167 % We will only complain once about lack of epsf.tex.
9168 \newif\ifwarnednoepsf
9169 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9170 work. It is also included in the Texinfo distribution, or you can get
9171 it from ftp://tug.org/tex/epsf.tex.}
9172 %
9173 \def\image#1{%
9174 \ifx\epsfbox\thisisundefined
9175 \ifwarnednoepsf \else
9176 \errhelp = \noepsfhelp
9177 \errmessage{epsf.tex not found, images will be ignored}%
9178 \global\warnednoepsftrue
9179 \fi
9180 \else
9181 \imagexxx #1,,,,,\finish
9182 \fi
9183 }
9184 %
9185 % Arguments to @image:
9186 % #1 is (mandatory) image filename; we tack on .eps extension.
9187 % #2 is (optional) width, #3 is (optional) height.
9188 % #4 is (ignored optional) html alt text.
9189 % #5 is (ignored optional) extension.
9190 % #6 is just the usual extra ignored arg for parsing stuff.
9191 \newif\ifimagevmode
9192 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9193 \catcode`\^^M = 5 % in case we're inside an example
9194 \normalturnoffactive % allow _ et al. in names
9195 \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
9196 % If the image is by itself, center it.
9197 \ifvmode
9198 \imagevmodetrue
9199 \else \ifx\centersub\centerV
9200 % for @center @image, we need a vbox so we can have our vertical space
9201 \imagevmodetrue
9202 \vbox\bgroup % vbox has better behavior than vtop herev
9203 \fi\fi
9204 %
9205 \ifimagevmode
9206 \nobreak\medskip
9207 % Usually we'll have text after the image which will insert
9208 % \parskip glue, so insert it here too to equalize the space
9209 % above and below.
9210 \nobreak\vskip\parskip
9211 \nobreak
9212 \fi
9213 %
9214 % Leave vertical mode so that indentation from an enclosing
9215 % environment such as @quotation is respected.
9216 % However, if we're at the top level, we don't want the
9217 % normal paragraph indentation.
9218 % On the other hand, if we are in the case of @center @image, we don't
9219 % want to start a paragraph, which will create a hsize-width box and
9220 % eradicate the centering.
9221 \ifx\centersub\centerV\else \noindent \fi
9222 %
9223 % Output the image.
9224 \ifpdf
9225 % For pdfTeX and LuaTeX <= 0.80
9226 \dopdfimage{#1}{#2}{#3}%
9227 \else
9228 \ifx\XeTeXrevision\thisisundefined
9229 % For epsf.tex
9230 % \epsfbox itself resets \epsf?size at each figure.
9231 \setbox0 = \hbox{\ignorespaces #2}%
9232 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9233 \setbox0 = \hbox{\ignorespaces #3}%
9234 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9235 \epsfbox{#1.eps}%
9236 \else
9237 % For XeTeX
9238 \doxeteximage{#1}{#2}{#3}%
9239 \fi
9240 \fi
9241 %
9242 \ifimagevmode
9243 \medskip % space after a standalone image
9244 \fi
9245 \ifx\centersub\centerV \egroup \fi
9246 \endgroup}
9247
9248
9249 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9250 % etc. We don't actually implement floating yet, we always include the
9251 % float "here". But it seemed the best name for the future.
9252 %
9253 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9254
9255 % There may be a space before second and/or third parameter; delete it.
9256 \def\eatcommaspace#1, {#1,}
9257
9258 % #1 is the optional FLOATTYPE, the text label for this float, typically
9259 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9260 % this float will not be numbered and cannot be referred to.
9261 %
9262 % #2 is the optional xref label. Also must be present for the float to
9263 % be referable.
9264 %
9265 % #3 is the optional positioning argument; for now, it is ignored. It
9266 % will somehow specify the positions allowed to float to (here, top, bottom).
9267 %
9268 % We keep a separate counter for each FLOATTYPE, which we reset at each
9269 % chapter-level command.
9270 \let\resetallfloatnos=\empty
9271 %
9272 \def\dofloat#1,#2,#3,#4\finish{%
9273 \let\thiscaption=\empty
9274 \let\thisshortcaption=\empty
9275 %
9276 % don't lose footnotes inside @float.
9277 %
9278 % BEWARE: when the floats start float, we have to issue warning whenever an
9279 % insert appears inside a float which could possibly float. --kasal, 26may04
9280 %
9281 \startsavinginserts
9282 %
9283 % We can't be used inside a paragraph.
9284 \par
9285 %
9286 \vtop\bgroup
9287 \def\floattype{#1}%
9288 \def\floatlabel{#2}%
9289 \def\floatloc{#3}% we do nothing with this yet.
9290 %
9291 \ifx\floattype\empty
9292 \let\safefloattype=\empty
9293 \else
9294 {%
9295 % the floattype might have accents or other special characters,
9296 % but we need to use it in a control sequence name.
9297 \indexnofonts
9298 \turnoffactive
9299 \xdef\safefloattype{\floattype}%
9300 }%
9301 \fi
9302 %
9303 % If label is given but no type, we handle that as the empty type.
9304 \ifx\floatlabel\empty \else
9305 % We want each FLOATTYPE to be numbered separately (Figure 1,
9306 % Table 1, Figure 2, ...). (And if no label, no number.)
9307 %
9308 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9309 \global\advance\floatno by 1
9310 %
9311 {%
9312 % This magic value for \lastsection is output by \setref as the
9313 % XREFLABEL-title value. \xrefX uses it to distinguish float
9314 % labels (which have a completely different output format) from
9315 % node and anchor labels. And \xrdef uses it to construct the
9316 % lists of floats.
9317 %
9318 \edef\lastsection{\floatmagic=\safefloattype}%
9319 \setref{\floatlabel}{Yfloat}%
9320 }%
9321 \fi
9322 %
9323 % start with \parskip glue, I guess.
9324 \vskip\parskip
9325 %
9326 % Don't suppress indentation if a float happens to start a section.
9327 \restorefirstparagraphindent
9328 }
9329
9330 % we have these possibilities:
9331 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9332 % @float Foo,lbl & no caption: Foo 1.1
9333 % @float Foo & @caption{Cap}: Foo: Cap
9334 % @float Foo & no caption: Foo
9335 % @float ,lbl & Caption{Cap}: 1.1: Cap
9336 % @float ,lbl & no caption: 1.1
9337 % @float & @caption{Cap}: Cap
9338 % @float & no caption:
9339 %
9340 \def\Efloat{%
9341 \let\floatident = \empty
9342 %
9343 % In all cases, if we have a float type, it comes first.
9344 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9345 %
9346 % If we have an xref label, the number comes next.
9347 \ifx\floatlabel\empty \else
9348 \ifx\floattype\empty \else % if also had float type, need tie first.
9349 \appendtomacro\floatident{\tie}%
9350 \fi
9351 % the number.
9352 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9353 \fi
9354 %
9355 % Start the printed caption with what we've constructed in
9356 % \floatident, but keep it separate; we need \floatident again.
9357 \let\captionline = \floatident
9358 %
9359 \ifx\thiscaption\empty \else
9360 \ifx\floatident\empty \else
9361 \appendtomacro\captionline{: }% had ident, so need a colon between
9362 \fi
9363 %
9364 % caption text.
9365 \appendtomacro\captionline{\scanexp\thiscaption}%
9366 \fi
9367 %
9368 % If we have anything to print, print it, with space before.
9369 % Eventually this needs to become an \insert.
9370 \ifx\captionline\empty \else
9371 \vskip.5\parskip
9372 \captionline
9373 %
9374 % Space below caption.
9375 \vskip\parskip
9376 \fi
9377 %
9378 % If have an xref label, write the list of floats info. Do this
9379 % after the caption, to avoid chance of it being a breakpoint.
9380 \ifx\floatlabel\empty \else
9381 % Write the text that goes in the lof to the aux file as
9382 % \floatlabel-lof. Besides \floatident, we include the short
9383 % caption if specified, else the full caption if specified, else nothing.
9384 {%
9385 \requireauxfile
9386 \atdummies
9387 %
9388 % since we read the caption text in the macro world, where ^^M
9389 % is turned into a normal character, we have to scan it back, so
9390 % we don't write the literal three characters "^^M" into the aux file.
9391 \scanexp{%
9392 \xdef\noexpand\gtemp{%
9393 \ifx\thisshortcaption\empty
9394 \thiscaption
9395 \else
9396 \thisshortcaption
9397 \fi
9398 }%
9399 }%
9400 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9401 \ifx\gtemp\empty \else : \gtemp \fi}}%
9402 }%
9403 \fi
9404 \egroup % end of \vtop
9405 %
9406 % place the captured inserts
9407 %
9408 % BEWARE: when the floats start floating, we have to issue warning
9409 % whenever an insert appears inside a float which could possibly
9410 % float. --kasal, 26may04
9411 %
9412 \checkinserts
9413 }
9414
9415 % Append the tokens #2 to the definition of macro #1, not expanding either.
9416 %
9417 \def\appendtomacro#1#2{%
9418 \expandafter\def\expandafter#1\expandafter{#1#2}%
9419 }
9420
9421 % @caption, @shortcaption
9422 %
9423 \def\caption{\docaption\thiscaption}
9424 \def\shortcaption{\docaption\thisshortcaption}
9425 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9426 \def\defcaption#1#2{\egroup \def#1{#2}}
9427
9428 % The parameter is the control sequence identifying the counter we are
9429 % going to use. Create it if it doesn't exist and assign it to \floatno.
9430 \def\getfloatno#1{%
9431 \ifx#1\relax
9432 % Haven't seen this figure type before.
9433 \csname newcount\endcsname #1%
9434 %
9435 % Remember to reset this floatno at the next chap.
9436 \expandafter\gdef\expandafter\resetallfloatnos
9437 \expandafter{\resetallfloatnos #1=0 }%
9438 \fi
9439 \let\floatno#1%
9440 }
9441
9442 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9443 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9444 % first read the @float command.
9445 %
9446 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9447
9448 % Magic string used for the XREFLABEL-title value, so \xrefX can
9449 % distinguish floats from other xref types.
9450 \def\floatmagic{!!float!!}
9451
9452 % #1 is the control sequence we are passed; we expand into a conditional
9453 % which is true if #1 represents a float ref. That is, the magic
9454 % \lastsection value which we \setref above.
9455 %
9456 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9457 %
9458 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9459 % (safe) float type for this float. We set \iffloattype to #2.
9460 %
9461 \def\doiffloat#1=#2=#3\finish{%
9462 \def\temp{#1}%
9463 \def\iffloattype{#2}%
9464 \ifx\temp\floatmagic
9465 }
9466
9467 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9468 %
9469 \parseargdef\listoffloats{%
9470 \def\floattype{#1}% floattype
9471 {%
9472 % the floattype might have accents or other special characters,
9473 % but we need to use it in a control sequence name.
9474 \indexnofonts
9475 \turnoffactive
9476 \xdef\safefloattype{\floattype}%
9477 }%
9478 %
9479 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9480 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9481 \ifhavexrefs
9482 % if the user said @listoffloats foo but never @float foo.
9483 \message{\linenumber No `\safefloattype' floats to list.}%
9484 \fi
9485 \else
9486 \begingroup
9487 \leftskip=\tocindent % indent these entries like a toc
9488 \let\do=\listoffloatsdo
9489 \csname floatlist\safefloattype\endcsname
9490 \endgroup
9491 \fi
9492 }
9493
9494 % This is called on each entry in a list of floats. We're passed the
9495 % xref label, in the form LABEL-title, which is how we save it in the
9496 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9497 % has the text we're supposed to typeset here.
9498 %
9499 % Figures without xref labels will not be included in the list (since
9500 % they won't appear in the aux file).
9501 %
9502 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9503 \def\listoffloatsdoentry#1-title\finish{{%
9504 % Can't fully expand XR#1-lof because it can contain anything. Just
9505 % pass the control sequence. On the other hand, XR#1-pg is just the
9506 % page number, and we want to fully expand that so we can get a link
9507 % in pdf output.
9508 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9509 %
9510 % use the same \entry macro we use to generate the TOC and index.
9511 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9512 \writeentry
9513 }}
9514
9515
9516 \message{localization,}
9517
9518 % For single-language documents, @documentlanguage is usually given very
9519 % early, just after @documentencoding. Single argument is the language
9520 % (de) or locale (de_DE) abbreviation.
9521 %
9522 {
9523 \catcode`\_ = \active
9524 \globaldefs=1
9525 \parseargdef\documentlanguage{%
9526 \tex % read txi-??.tex file in plain TeX.
9527 % Read the file by the name they passed if it exists.
9528 \let_ = \normalunderscore % normal _ character for filename test
9529 \openin 1 txi-#1.tex
9530 \ifeof 1
9531 \documentlanguagetrywithoutunderscore #1_\finish
9532 \else
9533 \globaldefs = 1 % everything in the txi-LL files needs to persist
9534 \input txi-#1.tex
9535 \fi
9536 \closein 1
9537 \endgroup % end raw TeX
9538 }
9539 %
9540 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9541 % try txi-de.tex.
9542 %
9543 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9544 \openin 1 txi-#1.tex
9545 \ifeof 1
9546 \errhelp = \nolanghelp
9547 \errmessage{Cannot read language file txi-#1.tex}%
9548 \else
9549 \globaldefs = 1 % everything in the txi-LL files needs to persist
9550 \input txi-#1.tex
9551 \fi
9552 \closein 1
9553 }
9554 }% end of special _ catcode
9555 %
9556 \newhelp\nolanghelp{The given language definition file cannot be found or
9557 is empty. Maybe you need to install it? Putting it in the current
9558 directory should work if nowhere else does.}
9559
9560 % This macro is called from txi-??.tex files; the first argument is the
9561 % \language name to set (without the "\lang@" prefix), the second and
9562 % third args are \{left,right}hyphenmin.
9563 %
9564 % The language names to pass are determined when the format is built.
9565 % See the etex.log file created at that time, e.g.,
9566 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9567 %
9568 % With TeX Live 2008, etex now includes hyphenation patterns for all
9569 % available languages. This means we can support hyphenation in
9570 % Texinfo, at least to some extent. (This still doesn't solve the
9571 % accented characters problem.)
9572 %
9573 \catcode`@=11
9574 \def\txisetlanguage#1#2#3{%
9575 % do not set the language if the name is undefined in the current TeX.
9576 \expandafter\ifx\csname lang@#1\endcsname \relax
9577 \message{no patterns for #1}%
9578 \else
9579 \global\language = \csname lang@#1\endcsname
9580 \fi
9581 % but there is no harm in adjusting the hyphenmin values regardless.
9582 \global\lefthyphenmin = #2\relax
9583 \global\righthyphenmin = #3\relax
9584 }
9585
9586 % XeTeX and LuaTeX can handle native Unicode.
9587 % Their default I/O is UTF-8 sequence instead of byte-wise.
9588 % Other TeX engine (pdfTeX etc.) I/O is byte-wise.
9589 %
9590 \newif\iftxinativeunicodecapable
9591 \newif\iftxiusebytewiseio
9592
9593 \ifx\XeTeXrevision\thisisundefined
9594 \ifx\luatexversion\thisisundefined
9595 \txinativeunicodecapablefalse
9596 \txiusebytewiseiotrue
9597 \else
9598 \txinativeunicodecapabletrue
9599 \txiusebytewiseiofalse
9600 \fi
9601 \else
9602 \txinativeunicodecapabletrue
9603 \txiusebytewiseiofalse
9604 \fi
9605
9606 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9607 % for non-UTF-8 (byte-wise) encodings.
9608 %
9609 \def\setbytewiseio{%
9610 \ifx\XeTeXrevision\thisisundefined
9611 \else
9612 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9613 \XeTeXinputencoding "bytes" % For document root file
9614 % Unfortunately, there seems to be no corresponding XeTeX command for
9615 % output encoding. This is a problem for auxiliary index and TOC files.
9616 % The only solution would be perhaps to write out @U{...} sequences in
9617 % place of non-ASCII characters.
9618 \fi
9619
9620 \ifx\luatexversion\thisisundefined
9621 \else
9622 \directlua{
9623 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9624 local function convert_char (char)
9625 return utf8_char(byte(char))
9626 end
9627
9628 local function convert_line (line)
9629 return gsub(line, ".", convert_char)
9630 end
9631
9632 callback.register("process_input_buffer", convert_line)
9633
9634 local function convert_line_out (line)
9635 local line_out = ""
9636 for c in string.utfvalues(line) do
9637 line_out = line_out .. string.char(c)
9638 end
9639 return line_out
9640 end
9641
9642 callback.register("process_output_buffer", convert_line_out)
9643 }
9644 \fi
9645
9646 \txiusebytewiseiotrue
9647 }
9648
9649
9650 % Helpers for encodings.
9651 % Set the catcode of characters 128 through 255 to the specified number.
9652 %
9653 \def\setnonasciicharscatcode#1{%
9654 \count255=128
9655 \loop\ifnum\count255<256
9656 \global\catcode\count255=#1\relax
9657 \advance\count255 by 1
9658 \repeat
9659 }
9660
9661 \def\setnonasciicharscatcodenonglobal#1{%
9662 \count255=128
9663 \loop\ifnum\count255<256
9664 \catcode\count255=#1\relax
9665 \advance\count255 by 1
9666 \repeat
9667 }
9668
9669 % @documentencoding sets the definition of non-ASCII characters
9670 % according to the specified encoding.
9671 %
9672 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9673 \def\documentencodingzzz#1{%
9674 %
9675 % Encoding being declared for the document.
9676 \def\declaredencoding{\csname #1.enc\endcsname}%
9677 %
9678 % Supported encodings: names converted to tokens in order to be able
9679 % to compare them with \ifx.
9680 \def\ascii{\csname US-ASCII.enc\endcsname}%
9681 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9682 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9683 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9684 \def\utfeight{\csname UTF-8.enc\endcsname}%
9685 %
9686 \ifx \declaredencoding \ascii
9687 \asciichardefs
9688 %
9689 \else \ifx \declaredencoding \lattwo
9690 \iftxinativeunicodecapable
9691 \setbytewiseio
9692 \fi
9693 \setnonasciicharscatcode\active
9694 \lattwochardefs
9695 %
9696 \else \ifx \declaredencoding \latone
9697 \iftxinativeunicodecapable
9698 \setbytewiseio
9699 \fi
9700 \setnonasciicharscatcode\active
9701 \latonechardefs
9702 %
9703 \else \ifx \declaredencoding \latnine
9704 \iftxinativeunicodecapable
9705 \setbytewiseio
9706 \fi
9707 \setnonasciicharscatcode\active
9708 \latninechardefs
9709 %
9710 \else \ifx \declaredencoding \utfeight
9711 \iftxinativeunicodecapable
9712 % For native Unicode (XeTeX and LuaTeX)
9713 \nativeunicodechardefs
9714 \else
9715 % For UTF-8 byte sequence (TeX, eTeX and pdfTeX)
9716 \setnonasciicharscatcode\active
9717 % since we already invoked \utfeightchardefs at the top level
9718 % (below), do not re-invoke it, then our check for duplicated
9719 % definitions triggers. Making non-ascii chars active is enough.
9720 \fi
9721 %
9722 \else
9723 \message{Ignoring unknown document encoding: #1.}%
9724 %
9725 \fi % utfeight
9726 \fi % latnine
9727 \fi % latone
9728 \fi % lattwo
9729 \fi % ascii
9730 }
9731
9732 % emacs-page
9733 % A message to be logged when using a character that isn't available
9734 % the default font encoding (OT1).
9735 %
9736 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9737
9738 % Take account of \c (plain) vs. \, (Texinfo) difference.
9739 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9740
9741 % First, make active non-ASCII characters in order for them to be
9742 % correctly categorized when TeX reads the replacement text of
9743 % macros containing the character definitions.
9744 \setnonasciicharscatcode\active
9745 %
9746 % Latin1 (ISO-8859-1) character definitions.
9747 \def\latonechardefs{%
9748 \gdef^^a0{\tie}
9749 \gdef^^a1{\exclamdown}
9750 \gdef^^a2{{\tcfont \char162}} % cent
9751 \gdef^^a3{\pounds}
9752 \gdef^^a4{{\tcfont \char164}} % currency
9753 \gdef^^a5{{\tcfont \char165}} % yen
9754 \gdef^^a6{{\tcfont \char166}} % broken bar
9755 \gdef^^a7{\S}
9756 \gdef^^a8{\"{}}
9757 \gdef^^a9{\copyright}
9758 \gdef^^aa{\ordf}
9759 \gdef^^ab{\guillemetleft}
9760 \gdef^^ac{\ensuremath\lnot}
9761 \gdef^^ad{\-}
9762 \gdef^^ae{\registeredsymbol}
9763 \gdef^^af{\={}}
9764 %
9765 \gdef^^b0{\textdegree}
9766 \gdef^^b1{$\pm$}
9767 \gdef^^b2{$^2$}
9768 \gdef^^b3{$^3$}
9769 \gdef^^b4{\'{}}
9770 \gdef^^b5{$\mu$}
9771 \gdef^^b6{\P}
9772 \gdef^^b7{\ensuremath\cdot}
9773 \gdef^^b8{\cedilla\ }
9774 \gdef^^b9{$^1$}
9775 \gdef^^ba{\ordm}
9776 \gdef^^bb{\guillemetright}
9777 \gdef^^bc{$1\over4$}
9778 \gdef^^bd{$1\over2$}
9779 \gdef^^be{$3\over4$}
9780 \gdef^^bf{\questiondown}
9781 %
9782 \gdef^^c0{\`A}
9783 \gdef^^c1{\'A}
9784 \gdef^^c2{\^A}
9785 \gdef^^c3{\~A}
9786 \gdef^^c4{\"A}
9787 \gdef^^c5{\ringaccent A}
9788 \gdef^^c6{\AE}
9789 \gdef^^c7{\cedilla C}
9790 \gdef^^c8{\`E}
9791 \gdef^^c9{\'E}
9792 \gdef^^ca{\^E}
9793 \gdef^^cb{\"E}
9794 \gdef^^cc{\`I}
9795 \gdef^^cd{\'I}
9796 \gdef^^ce{\^I}
9797 \gdef^^cf{\"I}
9798 %
9799 \gdef^^d0{\DH}
9800 \gdef^^d1{\~N}
9801 \gdef^^d2{\`O}
9802 \gdef^^d3{\'O}
9803 \gdef^^d4{\^O}
9804 \gdef^^d5{\~O}
9805 \gdef^^d6{\"O}
9806 \gdef^^d7{$\times$}
9807 \gdef^^d8{\O}
9808 \gdef^^d9{\`U}
9809 \gdef^^da{\'U}
9810 \gdef^^db{\^U}
9811 \gdef^^dc{\"U}
9812 \gdef^^dd{\'Y}
9813 \gdef^^de{\TH}
9814 \gdef^^df{\ss}
9815 %
9816 \gdef^^e0{\`a}
9817 \gdef^^e1{\'a}
9818 \gdef^^e2{\^a}
9819 \gdef^^e3{\~a}
9820 \gdef^^e4{\"a}
9821 \gdef^^e5{\ringaccent a}
9822 \gdef^^e6{\ae}
9823 \gdef^^e7{\cedilla c}
9824 \gdef^^e8{\`e}
9825 \gdef^^e9{\'e}
9826 \gdef^^ea{\^e}
9827 \gdef^^eb{\"e}
9828 \gdef^^ec{\`{\dotless i}}
9829 \gdef^^ed{\'{\dotless i}}
9830 \gdef^^ee{\^{\dotless i}}
9831 \gdef^^ef{\"{\dotless i}}
9832 %
9833 \gdef^^f0{\dh}
9834 \gdef^^f1{\~n}
9835 \gdef^^f2{\`o}
9836 \gdef^^f3{\'o}
9837 \gdef^^f4{\^o}
9838 \gdef^^f5{\~o}
9839 \gdef^^f6{\"o}
9840 \gdef^^f7{$\div$}
9841 \gdef^^f8{\o}
9842 \gdef^^f9{\`u}
9843 \gdef^^fa{\'u}
9844 \gdef^^fb{\^u}
9845 \gdef^^fc{\"u}
9846 \gdef^^fd{\'y}
9847 \gdef^^fe{\th}
9848 \gdef^^ff{\"y}
9849 }
9850
9851 % Latin9 (ISO-8859-15) encoding character definitions.
9852 \def\latninechardefs{%
9853 % Encoding is almost identical to Latin1.
9854 \latonechardefs
9855 %
9856 \gdef^^a4{\euro}
9857 \gdef^^a6{\v S}
9858 \gdef^^a8{\v s}
9859 \gdef^^b4{\v Z}
9860 \gdef^^b8{\v z}
9861 \gdef^^bc{\OE}
9862 \gdef^^bd{\oe}
9863 \gdef^^be{\"Y}
9864 }
9865
9866 % Latin2 (ISO-8859-2) character definitions.
9867 \def\lattwochardefs{%
9868 \gdef^^a0{\tie}
9869 \gdef^^a1{\ogonek{A}}
9870 \gdef^^a2{\u{}}
9871 \gdef^^a3{\L}
9872 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
9873 \gdef^^a5{\v L}
9874 \gdef^^a6{\'S}
9875 \gdef^^a7{\S}
9876 \gdef^^a8{\"{}}
9877 \gdef^^a9{\v S}
9878 \gdef^^aa{\cedilla S}
9879 \gdef^^ab{\v T}
9880 \gdef^^ac{\'Z}
9881 \gdef^^ad{\-}
9882 \gdef^^ae{\v Z}
9883 \gdef^^af{\dotaccent Z}
9884 %
9885 \gdef^^b0{\textdegree}
9886 \gdef^^b1{\ogonek{a}}
9887 \gdef^^b2{\ogonek{ }}
9888 \gdef^^b3{\l}
9889 \gdef^^b4{\'{}}
9890 \gdef^^b5{\v l}
9891 \gdef^^b6{\'s}
9892 \gdef^^b7{\v{}}
9893 \gdef^^b8{\cedilla\ }
9894 \gdef^^b9{\v s}
9895 \gdef^^ba{\cedilla s}
9896 \gdef^^bb{\v t}
9897 \gdef^^bc{\'z}
9898 \gdef^^bd{\H{}}
9899 \gdef^^be{\v z}
9900 \gdef^^bf{\dotaccent z}
9901 %
9902 \gdef^^c0{\'R}
9903 \gdef^^c1{\'A}
9904 \gdef^^c2{\^A}
9905 \gdef^^c3{\u A}
9906 \gdef^^c4{\"A}
9907 \gdef^^c5{\'L}
9908 \gdef^^c6{\'C}
9909 \gdef^^c7{\cedilla C}
9910 \gdef^^c8{\v C}
9911 \gdef^^c9{\'E}
9912 \gdef^^ca{\ogonek{E}}
9913 \gdef^^cb{\"E}
9914 \gdef^^cc{\v E}
9915 \gdef^^cd{\'I}
9916 \gdef^^ce{\^I}
9917 \gdef^^cf{\v D}
9918 %
9919 \gdef^^d0{\DH}
9920 \gdef^^d1{\'N}
9921 \gdef^^d2{\v N}
9922 \gdef^^d3{\'O}
9923 \gdef^^d4{\^O}
9924 \gdef^^d5{\H O}
9925 \gdef^^d6{\"O}
9926 \gdef^^d7{$\times$}
9927 \gdef^^d8{\v R}
9928 \gdef^^d9{\ringaccent U}
9929 \gdef^^da{\'U}
9930 \gdef^^db{\H U}
9931 \gdef^^dc{\"U}
9932 \gdef^^dd{\'Y}
9933 \gdef^^de{\cedilla T}
9934 \gdef^^df{\ss}
9935 %
9936 \gdef^^e0{\'r}
9937 \gdef^^e1{\'a}
9938 \gdef^^e2{\^a}
9939 \gdef^^e3{\u a}
9940 \gdef^^e4{\"a}
9941 \gdef^^e5{\'l}
9942 \gdef^^e6{\'c}
9943 \gdef^^e7{\cedilla c}
9944 \gdef^^e8{\v c}
9945 \gdef^^e9{\'e}
9946 \gdef^^ea{\ogonek{e}}
9947 \gdef^^eb{\"e}
9948 \gdef^^ec{\v e}
9949 \gdef^^ed{\'{\dotless{i}}}
9950 \gdef^^ee{\^{\dotless{i}}}
9951 \gdef^^ef{\v d}
9952 %
9953 \gdef^^f0{\dh}
9954 \gdef^^f1{\'n}
9955 \gdef^^f2{\v n}
9956 \gdef^^f3{\'o}
9957 \gdef^^f4{\^o}
9958 \gdef^^f5{\H o}
9959 \gdef^^f6{\"o}
9960 \gdef^^f7{$\div$}
9961 \gdef^^f8{\v r}
9962 \gdef^^f9{\ringaccent u}
9963 \gdef^^fa{\'u}
9964 \gdef^^fb{\H u}
9965 \gdef^^fc{\"u}
9966 \gdef^^fd{\'y}
9967 \gdef^^fe{\cedilla t}
9968 \gdef^^ff{\dotaccent{}}
9969 }
9970
9971 % UTF-8 character definitions.
9972 %
9973 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
9974 % changes for Texinfo conventions. It is included here under the GPL by
9975 % permission from Frank Mittelbach and the LaTeX team.
9976 %
9977 \newcount\countUTFx
9978 \newcount\countUTFy
9979 \newcount\countUTFz
9980
9981 \gdef\UTFviiiTwoOctets#1#2{\expandafter
9982 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
9983 %
9984 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
9985 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
9986 %
9987 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
9988 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
9989
9990 \gdef\UTFviiiDefined#1{%
9991 \ifx #1\relax
9992 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
9993 \else
9994 \expandafter #1%
9995 \fi
9996 }
9997
9998 \begingroup
9999 \catcode`\~13
10000 \catcode`\"12
10001
10002 \def\UTFviiiLoop{%
10003 \global\catcode\countUTFx\active
10004 \uccode`\~\countUTFx
10005 \uppercase\expandafter{\UTFviiiTmp}%
10006 \advance\countUTFx by 1
10007 \ifnum\countUTFx < \countUTFy
10008 \expandafter\UTFviiiLoop
10009 \fi}
10010
10011 \countUTFx = "C2
10012 \countUTFy = "E0
10013 \def\UTFviiiTmp{%
10014 \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
10015 \UTFviiiLoop
10016
10017 \countUTFx = "E0
10018 \countUTFy = "F0
10019 \def\UTFviiiTmp{%
10020 \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
10021 \UTFviiiLoop
10022
10023 \countUTFx = "F0
10024 \countUTFy = "F4
10025 \def\UTFviiiTmp{%
10026 \xdef~{\noexpand\UTFviiiFourOctets\string~}}
10027 \UTFviiiLoop
10028 \endgroup
10029
10030 \def\globallet{\global\let} % save some \expandafter's below
10031
10032 % @U{xxxx} to produce U+xxxx, if we support it.
10033 \def\U#1{%
10034 \expandafter\ifx\csname uni:#1\endcsname \relax
10035 \iftxinativeunicodecapable
10036 % Any Unicode characters can be used by native Unicode.
10037 % However, if the font does not have the glyph, the letter will miss.
10038 \begingroup
10039 \uccode`\.="#1\relax
10040 \uppercase{.}
10041 \endgroup
10042 \else
10043 \errhelp = \EMsimple
10044 \errmessage{Unicode character U+#1 not supported, sorry}%
10045 \fi
10046 \else
10047 \csname uni:#1\endcsname
10048 \fi
10049 }
10050
10051 % For UTF-8 byte sequence (TeX, e-TeX and pdfTeX)
10052 % Definition macro to replace the Unicode character
10053 % Definition macro that is used by @U command
10054 %
10055 \begingroup
10056 \catcode`\"=12
10057 \catcode`\<=12
10058 \catcode`\.=12
10059 \catcode`\,=12
10060 \catcode`\;=12
10061 \catcode`\!=12
10062 \catcode`\~=13
10063 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10064 \countUTFz = "#1\relax
10065 %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
10066 \begingroup
10067 \parseXMLCharref
10068 \def\UTFviiiTwoOctets##1##2{%
10069 \csname u8:##1\string ##2\endcsname}%
10070 \def\UTFviiiThreeOctets##1##2##3{%
10071 \csname u8:##1\string ##2\string ##3\endcsname}%
10072 \def\UTFviiiFourOctets##1##2##3##4{%
10073 \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
10074 \expandafter\expandafter\expandafter\expandafter
10075 \expandafter\expandafter\expandafter
10076 \gdef\UTFviiiTmp{#2}%
10077 %
10078 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10079 \message{Internal error, already defined: #1}%
10080 \fi
10081 %
10082 % define an additional control sequence for this code point.
10083 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10084 \endgroup}
10085
10086 \gdef\parseXMLCharref{%
10087 \ifnum\countUTFz < "A0\relax
10088 \errhelp = \EMsimple
10089 \errmessage{Cannot define Unicode char value < 00A0}%
10090 \else\ifnum\countUTFz < "800\relax
10091 \parseUTFviiiA,%
10092 \parseUTFviiiB C\UTFviiiTwoOctets.,%
10093 \else\ifnum\countUTFz < "10000\relax
10094 \parseUTFviiiA;%
10095 \parseUTFviiiA,%
10096 \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
10097 \else
10098 \parseUTFviiiA;%
10099 \parseUTFviiiA,%
10100 \parseUTFviiiA!%
10101 \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
10102 \fi\fi\fi
10103 }
10104
10105 \gdef\parseUTFviiiA#1{%
10106 \countUTFx = \countUTFz
10107 \divide\countUTFz by 64
10108 \countUTFy = \countUTFz
10109 \multiply\countUTFz by 64
10110 \advance\countUTFx by -\countUTFz
10111 \advance\countUTFx by 128
10112 \uccode `#1\countUTFx
10113 \countUTFz = \countUTFy}
10114
10115 \gdef\parseUTFviiiB#1#2#3#4{%
10116 \advance\countUTFz by "#10\relax
10117 \uccode `#3\countUTFz
10118 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10119 \endgroup
10120
10121 % For native Unicode (XeTeX and LuaTeX)
10122 % Definition macro that is set catcode other non global
10123 %
10124 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10125 \catcode"#1=\other
10126 }
10127
10128 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10129 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10130 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10131 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10132 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10133 %
10134 % Many of our renditions are less than wonderful, and all the missing
10135 % characters are available somewhere. Loading the necessary fonts
10136 % awaits user request. We can't truly support Unicode without
10137 % reimplementing everything that's been done in LaTeX for many years,
10138 % plus probably using luatex or xetex, and who knows what else.
10139 % We won't be doing that here in this simple file. But we can try to at
10140 % least make most of the characters not bomb out.
10141 %
10142 \def\unicodechardefs{%
10143 \DeclareUnicodeCharacter{00A0}{\tie}%
10144 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10145 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10146 \DeclareUnicodeCharacter{00A3}{\pounds}%
10147 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10148 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10149 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10150 \DeclareUnicodeCharacter{00A7}{\S}%
10151 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10152 \DeclareUnicodeCharacter{00A9}{\copyright}%
10153 \DeclareUnicodeCharacter{00AA}{\ordf}%
10154 \DeclareUnicodeCharacter{00AB}{\guillemetleft}%
10155 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10156 \DeclareUnicodeCharacter{00AD}{\-}%
10157 \DeclareUnicodeCharacter{00AE}{\registeredsymbol}%
10158 \DeclareUnicodeCharacter{00AF}{\={ }}%
10159 %
10160 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
10161 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10162 \DeclareUnicodeCharacter{00B2}{$^2$}%
10163 \DeclareUnicodeCharacter{00B3}{$^3$}%
10164 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10165 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10166 \DeclareUnicodeCharacter{00B6}{\P}%
10167 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10168 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10169 \DeclareUnicodeCharacter{00B9}{$^1$}%
10170 \DeclareUnicodeCharacter{00BA}{\ordm}%
10171 \DeclareUnicodeCharacter{00BB}{\guillemetright}%
10172 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10173 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10174 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10175 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10176 %
10177 \DeclareUnicodeCharacter{00C0}{\`A}%
10178 \DeclareUnicodeCharacter{00C1}{\'A}%
10179 \DeclareUnicodeCharacter{00C2}{\^A}%
10180 \DeclareUnicodeCharacter{00C3}{\~A}%
10181 \DeclareUnicodeCharacter{00C4}{\"A}%
10182 \DeclareUnicodeCharacter{00C5}{\AA}%
10183 \DeclareUnicodeCharacter{00C6}{\AE}%
10184 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10185 \DeclareUnicodeCharacter{00C8}{\`E}%
10186 \DeclareUnicodeCharacter{00C9}{\'E}%
10187 \DeclareUnicodeCharacter{00CA}{\^E}%
10188 \DeclareUnicodeCharacter{00CB}{\"E}%
10189 \DeclareUnicodeCharacter{00CC}{\`I}%
10190 \DeclareUnicodeCharacter{00CD}{\'I}%
10191 \DeclareUnicodeCharacter{00CE}{\^I}%
10192 \DeclareUnicodeCharacter{00CF}{\"I}%
10193 %
10194 \DeclareUnicodeCharacter{00D0}{\DH}%
10195 \DeclareUnicodeCharacter{00D1}{\~N}%
10196 \DeclareUnicodeCharacter{00D2}{\`O}%
10197 \DeclareUnicodeCharacter{00D3}{\'O}%
10198 \DeclareUnicodeCharacter{00D4}{\^O}%
10199 \DeclareUnicodeCharacter{00D5}{\~O}%
10200 \DeclareUnicodeCharacter{00D6}{\"O}%
10201 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10202 \DeclareUnicodeCharacter{00D8}{\O}%
10203 \DeclareUnicodeCharacter{00D9}{\`U}%
10204 \DeclareUnicodeCharacter{00DA}{\'U}%
10205 \DeclareUnicodeCharacter{00DB}{\^U}%
10206 \DeclareUnicodeCharacter{00DC}{\"U}%
10207 \DeclareUnicodeCharacter{00DD}{\'Y}%
10208 \DeclareUnicodeCharacter{00DE}{\TH}%
10209 \DeclareUnicodeCharacter{00DF}{\ss}%
10210 %
10211 \DeclareUnicodeCharacter{00E0}{\`a}%
10212 \DeclareUnicodeCharacter{00E1}{\'a}%
10213 \DeclareUnicodeCharacter{00E2}{\^a}%
10214 \DeclareUnicodeCharacter{00E3}{\~a}%
10215 \DeclareUnicodeCharacter{00E4}{\"a}%
10216 \DeclareUnicodeCharacter{00E5}{\aa}%
10217 \DeclareUnicodeCharacter{00E6}{\ae}%
10218 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10219 \DeclareUnicodeCharacter{00E8}{\`e}%
10220 \DeclareUnicodeCharacter{00E9}{\'e}%
10221 \DeclareUnicodeCharacter{00EA}{\^e}%
10222 \DeclareUnicodeCharacter{00EB}{\"e}%
10223 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10224 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10225 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10226 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10227 %
10228 \DeclareUnicodeCharacter{00F0}{\dh}%
10229 \DeclareUnicodeCharacter{00F1}{\~n}%
10230 \DeclareUnicodeCharacter{00F2}{\`o}%
10231 \DeclareUnicodeCharacter{00F3}{\'o}%
10232 \DeclareUnicodeCharacter{00F4}{\^o}%
10233 \DeclareUnicodeCharacter{00F5}{\~o}%
10234 \DeclareUnicodeCharacter{00F6}{\"o}%
10235 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10236 \DeclareUnicodeCharacter{00F8}{\o}%
10237 \DeclareUnicodeCharacter{00F9}{\`u}%
10238 \DeclareUnicodeCharacter{00FA}{\'u}%
10239 \DeclareUnicodeCharacter{00FB}{\^u}%
10240 \DeclareUnicodeCharacter{00FC}{\"u}%
10241 \DeclareUnicodeCharacter{00FD}{\'y}%
10242 \DeclareUnicodeCharacter{00FE}{\th}%
10243 \DeclareUnicodeCharacter{00FF}{\"y}%
10244 %
10245 \DeclareUnicodeCharacter{0100}{\=A}%
10246 \DeclareUnicodeCharacter{0101}{\=a}%
10247 \DeclareUnicodeCharacter{0102}{\u{A}}%
10248 \DeclareUnicodeCharacter{0103}{\u{a}}%
10249 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10250 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10251 \DeclareUnicodeCharacter{0106}{\'C}%
10252 \DeclareUnicodeCharacter{0107}{\'c}%
10253 \DeclareUnicodeCharacter{0108}{\^C}%
10254 \DeclareUnicodeCharacter{0109}{\^c}%
10255 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10256 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10257 \DeclareUnicodeCharacter{010C}{\v{C}}%
10258 \DeclareUnicodeCharacter{010D}{\v{c}}%
10259 \DeclareUnicodeCharacter{010E}{\v{D}}%
10260 \DeclareUnicodeCharacter{010F}{d'}%
10261 %
10262 \DeclareUnicodeCharacter{0110}{\DH}%
10263 \DeclareUnicodeCharacter{0111}{\dh}%
10264 \DeclareUnicodeCharacter{0112}{\=E}%
10265 \DeclareUnicodeCharacter{0113}{\=e}%
10266 \DeclareUnicodeCharacter{0114}{\u{E}}%
10267 \DeclareUnicodeCharacter{0115}{\u{e}}%
10268 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10269 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10270 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10271 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10272 \DeclareUnicodeCharacter{011A}{\v{E}}%
10273 \DeclareUnicodeCharacter{011B}{\v{e}}%
10274 \DeclareUnicodeCharacter{011C}{\^G}%
10275 \DeclareUnicodeCharacter{011D}{\^g}%
10276 \DeclareUnicodeCharacter{011E}{\u{G}}%
10277 \DeclareUnicodeCharacter{011F}{\u{g}}%
10278 %
10279 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10280 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10281 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10282 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10283 \DeclareUnicodeCharacter{0124}{\^H}%
10284 \DeclareUnicodeCharacter{0125}{\^h}%
10285 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10286 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10287 \DeclareUnicodeCharacter{0128}{\~I}%
10288 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10289 \DeclareUnicodeCharacter{012A}{\=I}%
10290 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10291 \DeclareUnicodeCharacter{012C}{\u{I}}%
10292 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10293 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10294 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10295 %
10296 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10297 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10298 \DeclareUnicodeCharacter{0132}{IJ}%
10299 \DeclareUnicodeCharacter{0133}{ij}%
10300 \DeclareUnicodeCharacter{0134}{\^J}%
10301 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10302 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10303 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10304 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10305 \DeclareUnicodeCharacter{0139}{\'L}%
10306 \DeclareUnicodeCharacter{013A}{\'l}%
10307 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10308 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10309 \DeclareUnicodeCharacter{013D}{L'}% should kern
10310 \DeclareUnicodeCharacter{013E}{l'}% should kern
10311 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10312 %
10313 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10314 \DeclareUnicodeCharacter{0141}{\L}%
10315 \DeclareUnicodeCharacter{0142}{\l}%
10316 \DeclareUnicodeCharacter{0143}{\'N}%
10317 \DeclareUnicodeCharacter{0144}{\'n}%
10318 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10319 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10320 \DeclareUnicodeCharacter{0147}{\v{N}}%
10321 \DeclareUnicodeCharacter{0148}{\v{n}}%
10322 \DeclareUnicodeCharacter{0149}{'n}%
10323 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10324 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10325 \DeclareUnicodeCharacter{014C}{\=O}%
10326 \DeclareUnicodeCharacter{014D}{\=o}%
10327 \DeclareUnicodeCharacter{014E}{\u{O}}%
10328 \DeclareUnicodeCharacter{014F}{\u{o}}%
10329 %
10330 \DeclareUnicodeCharacter{0150}{\H{O}}%
10331 \DeclareUnicodeCharacter{0151}{\H{o}}%
10332 \DeclareUnicodeCharacter{0152}{\OE}%
10333 \DeclareUnicodeCharacter{0153}{\oe}%
10334 \DeclareUnicodeCharacter{0154}{\'R}%
10335 \DeclareUnicodeCharacter{0155}{\'r}%
10336 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10337 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10338 \DeclareUnicodeCharacter{0158}{\v{R}}%
10339 \DeclareUnicodeCharacter{0159}{\v{r}}%
10340 \DeclareUnicodeCharacter{015A}{\'S}%
10341 \DeclareUnicodeCharacter{015B}{\'s}%
10342 \DeclareUnicodeCharacter{015C}{\^S}%
10343 \DeclareUnicodeCharacter{015D}{\^s}%
10344 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10345 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10346 %
10347 \DeclareUnicodeCharacter{0160}{\v{S}}%
10348 \DeclareUnicodeCharacter{0161}{\v{s}}%
10349 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10350 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10351 \DeclareUnicodeCharacter{0164}{\v{T}}%
10352 \DeclareUnicodeCharacter{0165}{\v{t}}%
10353 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10354 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10355 \DeclareUnicodeCharacter{0168}{\~U}%
10356 \DeclareUnicodeCharacter{0169}{\~u}%
10357 \DeclareUnicodeCharacter{016A}{\=U}%
10358 \DeclareUnicodeCharacter{016B}{\=u}%
10359 \DeclareUnicodeCharacter{016C}{\u{U}}%
10360 \DeclareUnicodeCharacter{016D}{\u{u}}%
10361 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10362 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10363 %
10364 \DeclareUnicodeCharacter{0170}{\H{U}}%
10365 \DeclareUnicodeCharacter{0171}{\H{u}}%
10366 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10367 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10368 \DeclareUnicodeCharacter{0174}{\^W}%
10369 \DeclareUnicodeCharacter{0175}{\^w}%
10370 \DeclareUnicodeCharacter{0176}{\^Y}%
10371 \DeclareUnicodeCharacter{0177}{\^y}%
10372 \DeclareUnicodeCharacter{0178}{\"Y}%
10373 \DeclareUnicodeCharacter{0179}{\'Z}%
10374 \DeclareUnicodeCharacter{017A}{\'z}%
10375 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10376 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10377 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10378 \DeclareUnicodeCharacter{017E}{\v{z}}%
10379 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10380 %
10381 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10382 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10383 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10384 \DeclareUnicodeCharacter{01C7}{LJ}%
10385 \DeclareUnicodeCharacter{01C8}{Lj}%
10386 \DeclareUnicodeCharacter{01C9}{lj}%
10387 \DeclareUnicodeCharacter{01CA}{NJ}%
10388 \DeclareUnicodeCharacter{01CB}{Nj}%
10389 \DeclareUnicodeCharacter{01CC}{nj}%
10390 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10391 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10392 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10393 %
10394 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10395 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10396 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10397 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10398 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10399 %
10400 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10401 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10402 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10403 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10404 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10405 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10406 %
10407 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10408 \DeclareUnicodeCharacter{01F1}{DZ}%
10409 \DeclareUnicodeCharacter{01F2}{Dz}%
10410 \DeclareUnicodeCharacter{01F3}{dz}%
10411 \DeclareUnicodeCharacter{01F4}{\'G}%
10412 \DeclareUnicodeCharacter{01F5}{\'g}%
10413 \DeclareUnicodeCharacter{01F8}{\`N}%
10414 \DeclareUnicodeCharacter{01F9}{\`n}%
10415 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10416 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10417 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10418 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10419 %
10420 \DeclareUnicodeCharacter{021E}{\v{H}}%
10421 \DeclareUnicodeCharacter{021F}{\v{h}}%
10422 %
10423 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10424 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10425 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10426 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10427 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10428 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10429 %
10430 \DeclareUnicodeCharacter{0232}{\=Y}%
10431 \DeclareUnicodeCharacter{0233}{\=y}%
10432 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10433 %
10434 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10435 %
10436 % Greek letters upper case
10437 \DeclareUnicodeCharacter{0391}{{\it A}}%
10438 \DeclareUnicodeCharacter{0392}{{\it B}}%
10439 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10440 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10441 \DeclareUnicodeCharacter{0395}{{\it E}}%
10442 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10443 \DeclareUnicodeCharacter{0397}{{\it H}}%
10444 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10445 \DeclareUnicodeCharacter{0399}{{\it I}}%
10446 \DeclareUnicodeCharacter{039A}{{\it K}}%
10447 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10448 \DeclareUnicodeCharacter{039C}{{\it M}}%
10449 \DeclareUnicodeCharacter{039D}{{\it N}}%
10450 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10451 \DeclareUnicodeCharacter{039F}{{\it O}}%
10452 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10453 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10454 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10455 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10456 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10457 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10458 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10459 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10460 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10461 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10462 %
10463 % Vowels with accents
10464 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10465 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10466 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10467 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10468 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10469 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10470 %
10471 % Standalone accent
10472 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10473 %
10474 % Greek letters lower case
10475 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10476 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10477 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10478 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10479 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10480 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10481 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10482 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10483 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10484 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10485 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10486 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10487 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10488 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10489 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10490 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10491 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10492 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10493 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10494 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10495 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10496 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10497 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10498 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10499 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10500 %
10501 % More Greek vowels with accents
10502 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10503 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10504 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10505 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10506 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10507 %
10508 % Variant Greek letters
10509 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10510 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10511 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10512 %
10513 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10514 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10515 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10516 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10517 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10518 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10519 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10520 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10521 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10522 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10523 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10524 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10525 %
10526 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10527 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10528 %
10529 \DeclareUnicodeCharacter{1E20}{\=G}%
10530 \DeclareUnicodeCharacter{1E21}{\=g}%
10531 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10532 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10533 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10534 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10535 \DeclareUnicodeCharacter{1E26}{\"H}%
10536 \DeclareUnicodeCharacter{1E27}{\"h}%
10537 %
10538 \DeclareUnicodeCharacter{1E30}{\'K}%
10539 \DeclareUnicodeCharacter{1E31}{\'k}%
10540 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10541 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10542 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10543 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10544 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10545 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10546 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10547 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10548 \DeclareUnicodeCharacter{1E3E}{\'M}%
10549 \DeclareUnicodeCharacter{1E3F}{\'m}%
10550 %
10551 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10552 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10553 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10554 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10555 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10556 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10557 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10558 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10559 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10560 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10561 %
10562 \DeclareUnicodeCharacter{1E54}{\'P}%
10563 \DeclareUnicodeCharacter{1E55}{\'p}%
10564 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10565 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10566 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10567 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10568 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10569 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10570 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10571 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10572 %
10573 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10574 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10575 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10576 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10577 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10578 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10579 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10580 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10581 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10582 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10583 %
10584 \DeclareUnicodeCharacter{1E7C}{\~V}%
10585 \DeclareUnicodeCharacter{1E7D}{\~v}%
10586 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10587 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10588 %
10589 \DeclareUnicodeCharacter{1E80}{\`W}%
10590 \DeclareUnicodeCharacter{1E81}{\`w}%
10591 \DeclareUnicodeCharacter{1E82}{\'W}%
10592 \DeclareUnicodeCharacter{1E83}{\'w}%
10593 \DeclareUnicodeCharacter{1E84}{\"W}%
10594 \DeclareUnicodeCharacter{1E85}{\"w}%
10595 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10596 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10597 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10598 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10599 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10600 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10601 \DeclareUnicodeCharacter{1E8C}{\"X}%
10602 \DeclareUnicodeCharacter{1E8D}{\"x}%
10603 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10604 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10605 %
10606 \DeclareUnicodeCharacter{1E90}{\^Z}%
10607 \DeclareUnicodeCharacter{1E91}{\^z}%
10608 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10609 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10610 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10611 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
10612 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
10613 \DeclareUnicodeCharacter{1E97}{\"t}%
10614 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
10615 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
10616 %
10617 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
10618 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
10619 %
10620 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
10621 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
10622 \DeclareUnicodeCharacter{1EBC}{\~E}%
10623 \DeclareUnicodeCharacter{1EBD}{\~e}%
10624 %
10625 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
10626 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
10627 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
10628 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
10629 %
10630 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
10631 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
10632 %
10633 \DeclareUnicodeCharacter{1EF2}{\`Y}%
10634 \DeclareUnicodeCharacter{1EF3}{\`y}%
10635 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
10636 %
10637 \DeclareUnicodeCharacter{1EF8}{\~Y}%
10638 \DeclareUnicodeCharacter{1EF9}{\~y}%
10639 %
10640 % Punctuation
10641 \DeclareUnicodeCharacter{2013}{--}%
10642 \DeclareUnicodeCharacter{2014}{---}%
10643 \DeclareUnicodeCharacter{2018}{\quoteleft}%
10644 \DeclareUnicodeCharacter{2019}{\quoteright}%
10645 \DeclareUnicodeCharacter{201A}{\quotesinglbase}%
10646 \DeclareUnicodeCharacter{201C}{\quotedblleft}%
10647 \DeclareUnicodeCharacter{201D}{\quotedblright}%
10648 \DeclareUnicodeCharacter{201E}{\quotedblbase}%
10649 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
10650 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
10651 \DeclareUnicodeCharacter{2022}{\bullet}%
10652 \DeclareUnicodeCharacter{202F}{\thinspace}%
10653 \DeclareUnicodeCharacter{2026}{\dots}%
10654 \DeclareUnicodeCharacter{2039}{\guilsinglleft}%
10655 \DeclareUnicodeCharacter{203A}{\guilsinglright}%
10656 %
10657 \DeclareUnicodeCharacter{20AC}{\euro}%
10658 %
10659 \DeclareUnicodeCharacter{2192}{\expansion}%
10660 \DeclareUnicodeCharacter{21D2}{\result}%
10661 %
10662 % Mathematical symbols
10663 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
10664 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
10665 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
10666 \DeclareUnicodeCharacter{2212}{\minus}%
10667 \DeclareUnicodeCharacter{2217}{\ast}%
10668 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
10669 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
10670 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
10671 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
10672 \DeclareUnicodeCharacter{2261}{\equiv}%
10673 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
10674 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
10675 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
10676 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
10677 %
10678 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
10679 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
10680 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
10681 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
10682 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
10683 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
10684 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
10685 \DeclareUnicodeCharacter{2127}{\ensuremath\mho}%
10686 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
10687 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
10688 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
10689 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
10690 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
10691 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
10692 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
10693 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
10694 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
10695 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
10696 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
10697 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
10698 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
10699 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
10700 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
10701 \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}%
10702 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
10703 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
10704 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
10705 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
10706 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
10707 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
10708 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
10709 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
10710 \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}%
10711 \DeclareUnicodeCharacter{2201}{\ensuremath\complement}%
10712 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
10713 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
10714 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
10715 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
10716 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
10717 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
10718 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
10719 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
10720 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
10721 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
10722 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
10723 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
10724 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
10725 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
10726 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
10727 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
10728 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
10729 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
10730 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
10731 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
10732 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
10733 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
10734 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
10735 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
10736 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
10737 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
10738 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
10739 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
10740 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
10741 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
10742 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
10743 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
10744 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
10745 \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}%
10746 \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}%
10747 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
10748 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
10749 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
10750 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
10751 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
10752 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
10753 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
10754 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
10755 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
10756 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
10757 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
10758 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
10759 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
10760 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
10761 \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}%
10762 \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}%
10763 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
10764 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
10765 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
10766 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
10767 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
10768 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
10769 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
10770 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
10771 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
10772 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
10773 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
10774 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
10775 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
10776 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
10777 %
10778 \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}%
10779 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
10780 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
10781 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
10782 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
10783 \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}%
10784 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
10785 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
10786 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
10787 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
10788 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
10789 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
10790 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
10791 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
10792 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
10793 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
10794 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
10795 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
10796 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
10797 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
10798 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
10799 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
10800 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
10801 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
10802 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
10803 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
10804 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
10805 \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}%
10806 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
10807 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
10808 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
10809 %
10810 \global\mathchardef\checkmark="1370% actually the square root sign
10811 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
10812 }% end of \unicodechardefs
10813
10814 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
10815 % It makes the setting that replace UTF-8 byte sequence.
10816 \def\utfeightchardefs{%
10817 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
10818 \unicodechardefs
10819 }
10820
10821 \newif\ifpassthroughchars
10822 \passthroughcharsfalse
10823
10824 % For native Unicode (XeTeX and LuaTeX)
10825 % Definition macro to replace / pass-through the Unicode character
10826 %
10827 \def\DeclareUnicodeCharacterNative#1#2{%
10828 \catcode"#1=\active
10829 \def\dodeclareunicodecharacternative##1##2##3{%
10830 \begingroup
10831 \uccode`\~="##2\relax
10832 \uppercase{\gdef~}{%
10833 \ifpassthroughchars
10834 ##1%
10835 \else
10836 ##3%
10837 \fi
10838 }
10839 \endgroup
10840 }
10841 \begingroup
10842 \uccode`\.="#1\relax
10843 \uppercase{\def\UTFNativeTmp{.}}%
10844 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
10845 \endgroup
10846 }
10847
10848 % Native Unicode (XeTeX and LuaTeX) character replacing definitions
10849 % It makes the setting that replace the Unicode characters.
10850 \def\nativeunicodechardefs{%
10851 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
10852 \unicodechardefs
10853 }
10854
10855 % For native Unicode (XeTeX and LuaTeX). Make the character token expand
10856 % to the sequences given in \unicodechardefs for printing.
10857 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
10858 \def\UTFAtUTmp{#2}
10859 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
10860 }
10861
10862 % Native Unicode (XeTeX and LuaTeX) @U command definitions
10863 \def\nativeunicodechardefsatu{%
10864 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
10865 \unicodechardefs
10866 }
10867
10868 % Native Unicode (XeTeX and LuaTeX) catcode other non global definitions
10869 \def\nativeunicodecharscatcodeothernonglobal{%
10870 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeOther
10871 \unicodechardefs
10872 }
10873
10874 % Catcode (non-ASCII or native Unicode) are set to \other (non-global
10875 % assignments).
10876 \def\setcharscatcodeothernonglobal{%
10877 \iftxiusebytewiseio
10878 \setnonasciicharscatcodenonglobal\other
10879 \else
10880 \nativeunicodecharscatcodeothernonglobal
10881 \fi
10882 }
10883
10884 % US-ASCII character definitions.
10885 \def\asciichardefs{% nothing need be done
10886 \relax
10887 }
10888
10889 % Redefine the active definitions of non-ASCII characters to expand to
10890 % non-active tokens with the same character code.
10891 \def\nonasciistringdefs{%
10892 \setnonasciicharscatcode\active
10893 \def\defstringchar##1{\def##1{\string##1}}%
10894 %
10895 \defstringchar^^80\defstringchar^^81\defstringchar^^82\defstringchar^^83%
10896 \defstringchar^^84\defstringchar^^85\defstringchar^^86\defstringchar^^87%
10897 \defstringchar^^88\defstringchar^^89\defstringchar^^8a\defstringchar^^8b%
10898 \defstringchar^^8c\defstringchar^^8d\defstringchar^^8e\defstringchar^^8f%
10899 %
10900 \defstringchar^^90\defstringchar^^91\defstringchar^^92\defstringchar^^93%
10901 \defstringchar^^94\defstringchar^^95\defstringchar^^96\defstringchar^^97%
10902 \defstringchar^^98\defstringchar^^99\defstringchar^^9a\defstringchar^^9b%
10903 \defstringchar^^9c\defstringchar^^9d\defstringchar^^9e\defstringchar^^9f%
10904 %
10905 \defstringchar^^a0\defstringchar^^a1\defstringchar^^a2\defstringchar^^a3%
10906 \defstringchar^^a4\defstringchar^^a5\defstringchar^^a6\defstringchar^^a7%
10907 \defstringchar^^a8\defstringchar^^a9\defstringchar^^aa\defstringchar^^ab%
10908 \defstringchar^^ac\defstringchar^^ad\defstringchar^^ae\defstringchar^^af%
10909 %
10910 \defstringchar^^b0\defstringchar^^b1\defstringchar^^b2\defstringchar^^b3%
10911 \defstringchar^^b4\defstringchar^^b5\defstringchar^^b6\defstringchar^^b7%
10912 \defstringchar^^b8\defstringchar^^b9\defstringchar^^ba\defstringchar^^bb%
10913 \defstringchar^^bc\defstringchar^^bd\defstringchar^^be\defstringchar^^bf%
10914 %
10915 \defstringchar^^c0\defstringchar^^c1\defstringchar^^c2\defstringchar^^c3%
10916 \defstringchar^^c4\defstringchar^^c5\defstringchar^^c6\defstringchar^^c7%
10917 \defstringchar^^c8\defstringchar^^c9\defstringchar^^ca\defstringchar^^cb%
10918 \defstringchar^^cc\defstringchar^^cd\defstringchar^^ce\defstringchar^^cf%
10919 %
10920 \defstringchar^^d0\defstringchar^^d1\defstringchar^^d2\defstringchar^^d3%
10921 \defstringchar^^d4\defstringchar^^d5\defstringchar^^d6\defstringchar^^d7%
10922 \defstringchar^^d8\defstringchar^^d9\defstringchar^^da\defstringchar^^db%
10923 \defstringchar^^dc\defstringchar^^dd\defstringchar^^de\defstringchar^^df%
10924 %
10925 \defstringchar^^e0\defstringchar^^e1\defstringchar^^e2\defstringchar^^e3%
10926 \defstringchar^^e4\defstringchar^^e5\defstringchar^^e6\defstringchar^^e7%
10927 \defstringchar^^e8\defstringchar^^e9\defstringchar^^ea\defstringchar^^eb%
10928 \defstringchar^^ec\defstringchar^^ed\defstringchar^^ee\defstringchar^^ef%
10929 %
10930 \defstringchar^^f0\defstringchar^^f1\defstringchar^^f2\defstringchar^^f3%
10931 \defstringchar^^f4\defstringchar^^f5\defstringchar^^f6\defstringchar^^f7%
10932 \defstringchar^^f8\defstringchar^^f9\defstringchar^^fa\defstringchar^^fb%
10933 \defstringchar^^fc\defstringchar^^fd\defstringchar^^fe\defstringchar^^ff%
10934 }
10935
10936 % Write characters literally, instead of using active definitions for
10937 % printing the correct glyphs.
10938 \def\passthroughcharacters{%
10939 \iftxiusebytewiseio
10940 \nonasciistringdefs
10941 \else
10942 \passthroughcharstrue
10943 \fi
10944 }
10945
10946
10947 % define all the unicode characters we know about, for the sake of @U.
10948 \iftxinativeunicodecapable
10949 \nativeunicodechardefsatu
10950 \else
10951 \utfeightchardefs
10952 \fi
10953
10954
10955 % Make non-ASCII characters printable again for compatibility with
10956 % existing Texinfo documents that may use them, even without declaring a
10957 % document encoding.
10958 %
10959 \setnonasciicharscatcode \other
10960
10961
10962 \message{formatting,}
10963
10964 \newdimen\defaultparindent \defaultparindent = 15pt
10965
10966 \chapheadingskip = 15pt plus 4pt minus 2pt
10967 \secheadingskip = 12pt plus 3pt minus 2pt
10968 \subsecheadingskip = 9pt plus 2pt minus 2pt
10969
10970 % Prevent underfull vbox error messages.
10971 \vbadness = 10000
10972
10973 % Don't be very finicky about underfull hboxes, either.
10974 \hbadness = 6666
10975
10976 % Following George Bush, get rid of widows and orphans.
10977 \widowpenalty=10000
10978 \clubpenalty=10000
10979
10980 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
10981 % using an old version of TeX, don't do anything. We want the amount of
10982 % stretch added to depend on the line length, hence the dependence on
10983 % \hsize. We call this whenever the paper size is set.
10984 %
10985 \def\setemergencystretch{%
10986 \ifx\emergencystretch\thisisundefined
10987 % Allow us to assign to \emergencystretch anyway.
10988 \def\emergencystretch{\dimen0}%
10989 \else
10990 \emergencystretch = .15\hsize
10991 \fi
10992 }
10993
10994 % Parameters in order: 1) textheight; 2) textwidth;
10995 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
10996 % 7) physical page height; 8) physical page width.
10997 %
10998 % We also call \setleading{\textleading}, so the caller should define
10999 % \textleading. The caller should also set \parskip.
11000 %
11001 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11002 \voffset = #3\relax
11003 \topskip = #6\relax
11004 \splittopskip = \topskip
11005 %
11006 \vsize = #1\relax
11007 \advance\vsize by \topskip
11008 \outervsize = \vsize
11009 \advance\outervsize by 2\topandbottommargin
11010 \pageheight = \vsize
11011 %
11012 \hsize = #2\relax
11013 \outerhsize = \hsize
11014 \advance\outerhsize by 0.5in
11015 \pagewidth = \hsize
11016 %
11017 \normaloffset = #4\relax
11018 \bindingoffset = #5\relax
11019 %
11020 \ifpdf
11021 \pdfpageheight #7\relax
11022 \pdfpagewidth #8\relax
11023 % if we don't reset these, they will remain at "1 true in" of
11024 % whatever layout pdftex was dumped with.
11025 \pdfhorigin = 1 true in
11026 \pdfvorigin = 1 true in
11027 \fi
11028 %
11029 \setleading{\textleading}
11030 %
11031 \parindent = \defaultparindent
11032 \setemergencystretch
11033 }
11034
11035 % @letterpaper (the default).
11036 \def\letterpaper{{\globaldefs = 1
11037 \parskip = 3pt plus 2pt minus 1pt
11038 \textleading = 13.2pt
11039 %
11040 % If page is nothing but text, make it come out even.
11041 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11042 {\voffset}{.25in}%
11043 {\bindingoffset}{36pt}%
11044 {11in}{8.5in}%
11045 }}
11046
11047 % Use @smallbook to reset parameters for 7x9.25 trim size.
11048 \def\smallbook{{\globaldefs = 1
11049 \parskip = 2pt plus 1pt
11050 \textleading = 12pt
11051 %
11052 \internalpagesizes{7.5in}{5in}%
11053 {-.2in}{0in}%
11054 {\bindingoffset}{16pt}%
11055 {9.25in}{7in}%
11056 %
11057 \lispnarrowing = 0.3in
11058 \tolerance = 700
11059 \hfuzz = 1pt
11060 \contentsrightmargin = 0pt
11061 \defbodyindent = .5cm
11062 }}
11063
11064 % Use @smallerbook to reset parameters for 6x9 trim size.
11065 % (Just testing, parameters still in flux.)
11066 \def\smallerbook{{\globaldefs = 1
11067 \parskip = 1.5pt plus 1pt
11068 \textleading = 12pt
11069 %
11070 \internalpagesizes{7.4in}{4.8in}%
11071 {-.2in}{-.4in}%
11072 {0pt}{14pt}%
11073 {9in}{6in}%
11074 %
11075 \lispnarrowing = 0.25in
11076 \tolerance = 700
11077 \hfuzz = 1pt
11078 \contentsrightmargin = 0pt
11079 \defbodyindent = .4cm
11080 }}
11081
11082 % Use @afourpaper to print on European A4 paper.
11083 \def\afourpaper{{\globaldefs = 1
11084 \parskip = 3pt plus 2pt minus 1pt
11085 \textleading = 13.2pt
11086 %
11087 % Double-side printing via postscript on Laserjet 4050
11088 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11089 % To change the settings for a different printer or situation, adjust
11090 % \normaloffset until the front-side and back-side texts align. Then
11091 % do the same for \bindingoffset. You can set these for testing in
11092 % your texinfo source file like this:
11093 % @tex
11094 % \global\normaloffset = -6mm
11095 % \global\bindingoffset = 10mm
11096 % @end tex
11097 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11098 {\voffset}{\hoffset}%
11099 {\bindingoffset}{44pt}%
11100 {297mm}{210mm}%
11101 %
11102 \tolerance = 700
11103 \hfuzz = 1pt
11104 \contentsrightmargin = 0pt
11105 \defbodyindent = 5mm
11106 }}
11107
11108 % Use @afivepaper to print on European A5 paper.
11109 % From romildo@urano.iceb.ufop.br, 2 July 2000.
11110 % He also recommends making @example and @lisp be small.
11111 \def\afivepaper{{\globaldefs = 1
11112 \parskip = 2pt plus 1pt minus 0.1pt
11113 \textleading = 12.5pt
11114 %
11115 \internalpagesizes{160mm}{120mm}%
11116 {\voffset}{\hoffset}%
11117 {\bindingoffset}{8pt}%
11118 {210mm}{148mm}%
11119 %
11120 \lispnarrowing = 0.2in
11121 \tolerance = 800
11122 \hfuzz = 1.2pt
11123 \contentsrightmargin = 0pt
11124 \defbodyindent = 2mm
11125 \tableindent = 12mm
11126 }}
11127
11128 % A specific text layout, 24x15cm overall, intended for A4 paper.
11129 \def\afourlatex{{\globaldefs = 1
11130 \afourpaper
11131 \internalpagesizes{237mm}{150mm}%
11132 {\voffset}{4.6mm}%
11133 {\bindingoffset}{7mm}%
11134 {297mm}{210mm}%
11135 %
11136 % Must explicitly reset to 0 because we call \afourpaper.
11137 \globaldefs = 0
11138 }}
11139
11140 % Use @afourwide to print on A4 paper in landscape format.
11141 \def\afourwide{{\globaldefs = 1
11142 \afourpaper
11143 \internalpagesizes{241mm}{165mm}%
11144 {\voffset}{-2.95mm}%
11145 {\bindingoffset}{7mm}%
11146 {297mm}{210mm}%
11147 \globaldefs = 0
11148 }}
11149
11150 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11151 % Perhaps we should allow setting the margins, \topskip, \parskip,
11152 % and/or leading, also. Or perhaps we should compute them somehow.
11153 %
11154 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11155 \def\pagesizesyyy#1,#2,#3\finish{{%
11156 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11157 \globaldefs = 1
11158 %
11159 \parskip = 3pt plus 2pt minus 1pt
11160 \setleading{\textleading}%
11161 %
11162 \dimen0 = #1\relax
11163 \advance\dimen0 by \voffset
11164 %
11165 \dimen2 = \hsize
11166 \advance\dimen2 by \normaloffset
11167 %
11168 \internalpagesizes{#1}{\hsize}%
11169 {\voffset}{\normaloffset}%
11170 {\bindingoffset}{44pt}%
11171 {\dimen0}{\dimen2}%
11172 }}
11173
11174 % Set default to letter.
11175 %
11176 \letterpaper
11177
11178
11179 \message{and turning on texinfo input format.}
11180
11181 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11182
11183 % DEL is a comment character, in case @c does not suffice.
11184 \catcode`\^^? = 14
11185
11186 % Define macros to output various characters with catcode for normal text.
11187 \catcode`\"=\other \def\normaldoublequote{"}
11188 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11189 \catcode`\+=\other \def\normalplus{+}
11190 \catcode`\<=\other \def\normalless{<}
11191 \catcode`\>=\other \def\normalgreater{>}
11192 \catcode`\^=\other \def\normalcaret{^}
11193 \catcode`\_=\other \def\normalunderscore{_}
11194 \catcode`\|=\other \def\normalverticalbar{|}
11195 \catcode`\~=\other \def\normaltilde{~}
11196
11197 % This macro is used to make a character print one way in \tt
11198 % (where it can probably be output as-is), and another way in other fonts,
11199 % where something hairier probably needs to be done.
11200 %
11201 % #1 is what to print if we are indeed using \tt; #2 is what to print
11202 % otherwise. Since all the Computer Modern typewriter fonts have zero
11203 % interword stretch (and shrink), and it is reasonable to expect all
11204 % typewriter fonts to have this, we can check that font parameter.
11205 %
11206 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
11207
11208 % Same as above, but check for italic font. Actually this also catches
11209 % non-italic slanted fonts since it is impossible to distinguish them from
11210 % italic fonts. But since this is only used by $ and it uses \sl anyway
11211 % this is not a problem.
11212 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
11213
11214 % Set catcodes for Texinfo file
11215
11216 % Active characters for printing the wanted glyph.
11217 % Most of these we simply print from the \tt font, but for some, we can
11218 % use math or other variants that look better in normal text.
11219 %
11220 \catcode`\"=\active
11221 \def\activedoublequote{{\tt\char34}}
11222 \let"=\activedoublequote
11223 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11224 \chardef\hatchar=`\^
11225 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11226
11227 \catcode`\_=\active
11228 \def_{\ifusingtt\normalunderscore\_}
11229 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11230 \let\realunder=_
11231
11232 \catcode`\|=\active \def|{{\tt\char124}}
11233
11234 \chardef \less=`\<
11235 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11236 \chardef \gtr=`\>
11237 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11238 \catcode`\+=\active \def+{{\tt \char 43}}
11239 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11240 \catcode`\-=\active \let-=\normaldash
11241
11242
11243 % used for headline/footline in the output routine, in case the page
11244 % breaks in the middle of an @tex block.
11245 \def\texinfochars{%
11246 \let< = \activeless
11247 \let> = \activegtr
11248 \let~ = \activetilde
11249 \let^ = \activehat
11250 \markupsetuplqdefault \markupsetuprqdefault
11251 \let\b = \strong
11252 \let\i = \smartitalic
11253 % in principle, all other definitions in \tex have to be undone too.
11254 }
11255
11256 % Used sometimes to turn off (effectively) the active characters even after
11257 % parsing them.
11258 \def\turnoffactive{%
11259 \normalturnoffactive
11260 \otherbackslash
11261 }
11262
11263 \catcode`\@=0
11264
11265 % \backslashcurfont outputs one backslash character in current font,
11266 % as in \char`\\.
11267 \global\chardef\backslashcurfont=`\\
11268 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
11269
11270 % \realbackslash is an actual character `\' with catcode other, and
11271 % \doublebackslash is two of them (for the pdf outlines).
11272 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
11273
11274 % In Texinfo, backslash is an active character; it prints the backslash
11275 % in fixed width font.
11276 \catcode`\\=\active % @ for escape char from now on.
11277
11278 % Print a typewriter backslash. For math mode, we can't simply use
11279 % \backslashcurfont: the story here is that in math mode, the \char
11280 % of \backslashcurfont ends up printing the roman \ from the math symbol
11281 % font (because \char in math mode uses the \mathcode, and plain.tex
11282 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11283 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11284 % ignored family value; char position "5C). We can't use " for the
11285 % usual hex value because it has already been made active.
11286
11287 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11288 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11289
11290 % \rawbackslash defines an active \ to do \backslashcurfont.
11291 % \otherbackslash defines an active \ to be a literal `\' character with
11292 % catcode other. We switch back and forth between these.
11293 @gdef@rawbackslash{@let\=@backslashcurfont}
11294 @gdef@otherbackslash{@let\=@realbackslash}
11295
11296 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11297 % the literal character `\'.
11298 %
11299 {@catcode`- = @active
11300 @gdef@normalturnoffactive{%
11301 @passthroughcharacters
11302 @let-=@normaldash
11303 @let"=@normaldoublequote
11304 @let$=@normaldollar %$ font-lock fix
11305 @let+=@normalplus
11306 @let<=@normalless
11307 @let>=@normalgreater
11308 @let^=@normalcaret
11309 @let_=@normalunderscore
11310 @let|=@normalverticalbar
11311 @let~=@normaltilde
11312 @let\=@ttbackslash
11313 @markupsetuplqdefault
11314 @markupsetuprqdefault
11315 @unsepspaces
11316 }
11317 }
11318
11319 % If a .fmt file is being used, characters that might appear in a file
11320 % name cannot be active until we have parsed the command line.
11321 % So turn them off again, and have @fixbackslash turn them back on.
11322 @catcode`+=@other @catcode`@_=@other
11323
11324 % \enablebackslashhack - allow file to begin `\input texinfo'
11325 %
11326 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11327 % That is what \eatinput is for; after that, the `\' should revert to printing
11328 % a backslash.
11329 % If the file did not have a `\input texinfo', then it is turned off after
11330 % the first line; otherwise the first `\' in the file would cause an error.
11331 % This is used on the very last line of this file, texinfo.tex.
11332 % We also use @c to call @fixbackslash, in case ends of lines are hidden.
11333 {
11334 @catcode`@^=7
11335 @catcode`@^^M=13@gdef@enablebackslashhack{%
11336 @global@let\ = @eatinput%
11337 @catcode`@^^M=13%
11338 @def@c{@fixbackslash@c}%
11339 @def ^^M{@let^^M@secondlinenl}%
11340 @gdef @secondlinenl{@let^^M@thirdlinenl}%
11341 @gdef @thirdlinenl{@fixbackslash}%
11342 }}
11343
11344 {@catcode`@^=7 @catcode`@^^M=13%
11345 @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11346
11347 % Emergency active definition of newline, in case an active newline token
11348 % appears by mistake.
11349 {@catcode`@^=7 @catcode13=13%
11350 @gdef@enableemergencynewline{%
11351 @gdef^^M{%
11352 @par%
11353 %<warning: active newline>@par%
11354 }}}
11355
11356
11357 @gdef@fixbackslash{%
11358 @ifx\@eatinput @let\ = @ttbackslash @fi
11359 @catcode13=5 % regular end of line
11360 @enableemergencynewline
11361 @let@c=@texinfoc
11362 % Also turn back on active characters that might appear in the input
11363 % file name, in case not using a pre-dumped format.
11364 @catcode`+=@active
11365 @catcode`@_=@active
11366 %
11367 % If texinfo.cnf is present on the system, read it.
11368 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11369 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11370 % directly in this file, texinfo.tex, makes it possible to make a format
11371 % file for Texinfo.
11372 %
11373 @openin 1 texinfo.cnf
11374 @ifeof 1 @else @input texinfo.cnf @fi
11375 @closein 1
11376 }
11377
11378
11379 % Say @foo, not \foo, in error messages.
11380 @escapechar = `@@
11381
11382 % These (along with & and #) are made active for url-breaking, so need
11383 % active definitions as the normal characters.
11384 @def@normaldot{.}
11385 @def@normalquest{?}
11386 @def@normalslash{/}
11387
11388 % These look ok in all fonts, so just make them not special.
11389 % @hashchar{} gets its own user-level command, because of #line.
11390 @catcode`@& = @other @def@normalamp{&}
11391 @catcode`@# = @other @def@normalhash{#}
11392 @catcode`@% = @other @def@normalpercent{%}
11393
11394 @let @hashchar = @normalhash
11395
11396 @c Finally, make ` and ' active, so that txicodequoteundirected and
11397 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11398 @c don't make ` and ' active, @code will not get them as active chars.
11399 @c Do this last of all since we use ` in the previous @catcode assignments.
11400 @catcode`@'=@active
11401 @catcode`@`=@active
11402 @markupsetuplqdefault
11403 @markupsetuprqdefault
11404
11405 @c Local variables:
11406 @c eval: (add-hook 'write-file-hooks 'time-stamp)
11407 @c page-delimiter: "^\\\\message\\|emacs-page"
11408 @c time-stamp-start: "def\\\\texinfoversion{"
11409 @c time-stamp-format: "%:y-%02m-%02d.%02H"
11410 @c time-stamp-end: "}"
11411 @c End:
11412
11413 @c vim:sw=2:
11414
11415 @ignore
11416 arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
11417 @end ignore
11418 @enablebackslashhack