]> code.delx.au - gnu-emacs/blob - doc/misc/texinfo.tex
Merge from 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-01-20.20}
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 \message{fonts,}
1454
1455 % Change the current font style to #1, remembering it in \curfontstyle.
1456 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1457 % italics, not bold italics.
1458 %
1459 \def\setfontstyle#1{%
1460 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1461 \csname ten#1\endcsname % change the current font
1462 }
1463
1464 % Select #1 fonts with the current style.
1465 %
1466 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1467
1468 \def\rm{\fam=0 \setfontstyle{rm}}
1469 \def\it{\fam=\itfam \setfontstyle{it}}
1470 \def\sl{\fam=\slfam \setfontstyle{sl}}
1471 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1472 \def\tt{\fam=\ttfam \setfontstyle{tt}}
1473
1474 % Unfortunately, we have to override this for titles and the like, since
1475 % in those cases "rm" is bold. Sigh.
1476 \def\rmisbold{\rm\def\curfontstyle{bf}}
1477
1478 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1479 % So we set up a \sf.
1480 \newfam\sffam
1481 \def\sf{\fam=\sffam \setfontstyle{sf}}
1482 \let\li = \sf % Sometimes we call it \li, not \sf.
1483
1484 % We don't need math for this font style.
1485 \def\ttsl{\setfontstyle{ttsl}}
1486
1487
1488 % Set the baselineskip to #1, and the lineskip and strut size
1489 % correspondingly. There is no deep meaning behind these magic numbers
1490 % used as factors; they just match (closely enough) what Knuth defined.
1491 %
1492 \def\lineskipfactor{.08333}
1493 \def\strutheightpercent{.70833}
1494 \def\strutdepthpercent {.29167}
1495 %
1496 % can get a sort of poor man's double spacing by redefining this.
1497 \def\baselinefactor{1}
1498 %
1499 \newdimen\textleading
1500 \def\setleading#1{%
1501 \dimen0 = #1\relax
1502 \normalbaselineskip = \baselinefactor\dimen0
1503 \normallineskip = \lineskipfactor\normalbaselineskip
1504 \normalbaselines
1505 \setbox\strutbox =\hbox{%
1506 \vrule width0pt height\strutheightpercent\baselineskip
1507 depth \strutdepthpercent \baselineskip
1508 }%
1509 }
1510
1511 % PDF CMaps. See also LaTeX's t1.cmap.
1512 %
1513 % do nothing with this by default.
1514 \expandafter\let\csname cmapOT1\endcsname\gobble
1515 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1516 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1517
1518 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1519 % (\pdffontattr was introduced many years ago, but people still run
1520 % older pdftex's; it's easy to conditionalize, so we do.)
1521 \ifpdf \ifx\pdffontattr\thisisundefined \else
1522 \begingroup
1523 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1524 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1525 %%DocumentNeededResources: ProcSet (CIDInit)
1526 %%IncludeResource: ProcSet (CIDInit)
1527 %%BeginResource: CMap (TeX-OT1-0)
1528 %%Title: (TeX-OT1-0 TeX OT1 0)
1529 %%Version: 1.000
1530 %%EndComments
1531 /CIDInit /ProcSet findresource begin
1532 12 dict begin
1533 begincmap
1534 /CIDSystemInfo
1535 << /Registry (TeX)
1536 /Ordering (OT1)
1537 /Supplement 0
1538 >> def
1539 /CMapName /TeX-OT1-0 def
1540 /CMapType 2 def
1541 1 begincodespacerange
1542 <00> <7F>
1543 endcodespacerange
1544 8 beginbfrange
1545 <00> <01> <0393>
1546 <09> <0A> <03A8>
1547 <23> <26> <0023>
1548 <28> <3B> <0028>
1549 <3F> <5B> <003F>
1550 <5D> <5E> <005D>
1551 <61> <7A> <0061>
1552 <7B> <7C> <2013>
1553 endbfrange
1554 40 beginbfchar
1555 <02> <0398>
1556 <03> <039B>
1557 <04> <039E>
1558 <05> <03A0>
1559 <06> <03A3>
1560 <07> <03D2>
1561 <08> <03A6>
1562 <0B> <00660066>
1563 <0C> <00660069>
1564 <0D> <0066006C>
1565 <0E> <006600660069>
1566 <0F> <00660066006C>
1567 <10> <0131>
1568 <11> <0237>
1569 <12> <0060>
1570 <13> <00B4>
1571 <14> <02C7>
1572 <15> <02D8>
1573 <16> <00AF>
1574 <17> <02DA>
1575 <18> <00B8>
1576 <19> <00DF>
1577 <1A> <00E6>
1578 <1B> <0153>
1579 <1C> <00F8>
1580 <1D> <00C6>
1581 <1E> <0152>
1582 <1F> <00D8>
1583 <21> <0021>
1584 <22> <201D>
1585 <27> <2019>
1586 <3C> <00A1>
1587 <3D> <003D>
1588 <3E> <00BF>
1589 <5C> <201C>
1590 <5F> <02D9>
1591 <60> <2018>
1592 <7D> <02DD>
1593 <7E> <007E>
1594 <7F> <00A8>
1595 endbfchar
1596 endcmap
1597 CMapName currentdict /CMap defineresource pop
1598 end
1599 end
1600 %%EndResource
1601 %%EOF
1602 }\endgroup
1603 \expandafter\edef\csname cmapOT1\endcsname#1{%
1604 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1605 }%
1606 %
1607 % \cmapOT1IT
1608 \begingroup
1609 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1610 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1611 %%DocumentNeededResources: ProcSet (CIDInit)
1612 %%IncludeResource: ProcSet (CIDInit)
1613 %%BeginResource: CMap (TeX-OT1IT-0)
1614 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1615 %%Version: 1.000
1616 %%EndComments
1617 /CIDInit /ProcSet findresource begin
1618 12 dict begin
1619 begincmap
1620 /CIDSystemInfo
1621 << /Registry (TeX)
1622 /Ordering (OT1IT)
1623 /Supplement 0
1624 >> def
1625 /CMapName /TeX-OT1IT-0 def
1626 /CMapType 2 def
1627 1 begincodespacerange
1628 <00> <7F>
1629 endcodespacerange
1630 8 beginbfrange
1631 <00> <01> <0393>
1632 <09> <0A> <03A8>
1633 <25> <26> <0025>
1634 <28> <3B> <0028>
1635 <3F> <5B> <003F>
1636 <5D> <5E> <005D>
1637 <61> <7A> <0061>
1638 <7B> <7C> <2013>
1639 endbfrange
1640 42 beginbfchar
1641 <02> <0398>
1642 <03> <039B>
1643 <04> <039E>
1644 <05> <03A0>
1645 <06> <03A3>
1646 <07> <03D2>
1647 <08> <03A6>
1648 <0B> <00660066>
1649 <0C> <00660069>
1650 <0D> <0066006C>
1651 <0E> <006600660069>
1652 <0F> <00660066006C>
1653 <10> <0131>
1654 <11> <0237>
1655 <12> <0060>
1656 <13> <00B4>
1657 <14> <02C7>
1658 <15> <02D8>
1659 <16> <00AF>
1660 <17> <02DA>
1661 <18> <00B8>
1662 <19> <00DF>
1663 <1A> <00E6>
1664 <1B> <0153>
1665 <1C> <00F8>
1666 <1D> <00C6>
1667 <1E> <0152>
1668 <1F> <00D8>
1669 <21> <0021>
1670 <22> <201D>
1671 <23> <0023>
1672 <24> <00A3>
1673 <27> <2019>
1674 <3C> <00A1>
1675 <3D> <003D>
1676 <3E> <00BF>
1677 <5C> <201C>
1678 <5F> <02D9>
1679 <60> <2018>
1680 <7D> <02DD>
1681 <7E> <007E>
1682 <7F> <00A8>
1683 endbfchar
1684 endcmap
1685 CMapName currentdict /CMap defineresource pop
1686 end
1687 end
1688 %%EndResource
1689 %%EOF
1690 }\endgroup
1691 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1692 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1693 }%
1694 %
1695 % \cmapOT1TT
1696 \begingroup
1697 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1698 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1699 %%DocumentNeededResources: ProcSet (CIDInit)
1700 %%IncludeResource: ProcSet (CIDInit)
1701 %%BeginResource: CMap (TeX-OT1TT-0)
1702 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1703 %%Version: 1.000
1704 %%EndComments
1705 /CIDInit /ProcSet findresource begin
1706 12 dict begin
1707 begincmap
1708 /CIDSystemInfo
1709 << /Registry (TeX)
1710 /Ordering (OT1TT)
1711 /Supplement 0
1712 >> def
1713 /CMapName /TeX-OT1TT-0 def
1714 /CMapType 2 def
1715 1 begincodespacerange
1716 <00> <7F>
1717 endcodespacerange
1718 5 beginbfrange
1719 <00> <01> <0393>
1720 <09> <0A> <03A8>
1721 <21> <26> <0021>
1722 <28> <5F> <0028>
1723 <61> <7E> <0061>
1724 endbfrange
1725 32 beginbfchar
1726 <02> <0398>
1727 <03> <039B>
1728 <04> <039E>
1729 <05> <03A0>
1730 <06> <03A3>
1731 <07> <03D2>
1732 <08> <03A6>
1733 <0B> <2191>
1734 <0C> <2193>
1735 <0D> <0027>
1736 <0E> <00A1>
1737 <0F> <00BF>
1738 <10> <0131>
1739 <11> <0237>
1740 <12> <0060>
1741 <13> <00B4>
1742 <14> <02C7>
1743 <15> <02D8>
1744 <16> <00AF>
1745 <17> <02DA>
1746 <18> <00B8>
1747 <19> <00DF>
1748 <1A> <00E6>
1749 <1B> <0153>
1750 <1C> <00F8>
1751 <1D> <00C6>
1752 <1E> <0152>
1753 <1F> <00D8>
1754 <20> <2423>
1755 <27> <2019>
1756 <60> <2018>
1757 <7F> <00A8>
1758 endbfchar
1759 endcmap
1760 CMapName currentdict /CMap defineresource pop
1761 end
1762 end
1763 %%EndResource
1764 %%EOF
1765 }\endgroup
1766 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1767 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1768 }%
1769 \fi\fi
1770
1771
1772 % Set the font macro #1 to the font named \fontprefix#2.
1773 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1774 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
1775 % Example:
1776 % #1 = \textrm
1777 % #2 = \rmshape
1778 % #3 = 10
1779 % #4 = \mainmagstep
1780 % #5 = OT1
1781 %
1782 \def\setfont#1#2#3#4#5{%
1783 \font#1=\fontprefix#2#3 scaled #4
1784 \csname cmap#5\endcsname#1%
1785 }
1786 % This is what gets called when #5 of \setfont is empty.
1787 \let\cmap\gobble
1788 %
1789 % (end of cmaps)
1790
1791 % Use cm as the default font prefix.
1792 % To specify the font prefix, you must define \fontprefix
1793 % before you read in texinfo.tex.
1794 \ifx\fontprefix\thisisundefined
1795 \def\fontprefix{cm}
1796 \fi
1797 % Support font families that don't use the same naming scheme as CM.
1798 \def\rmshape{r}
1799 \def\rmbshape{bx} % where the normal face is bold
1800 \def\bfshape{b}
1801 \def\bxshape{bx}
1802 \def\ttshape{tt}
1803 \def\ttbshape{tt}
1804 \def\ttslshape{sltt}
1805 \def\itshape{ti}
1806 \def\itbshape{bxti}
1807 \def\slshape{sl}
1808 \def\slbshape{bxsl}
1809 \def\sfshape{ss}
1810 \def\sfbshape{ss}
1811 \def\scshape{csc}
1812 \def\scbshape{csc}
1813
1814 % Definitions for a main text size of 11pt. (The default in Texinfo.)
1815 %
1816 \def\definetextfontsizexi{%
1817 % Text fonts (11.2pt, magstep1).
1818 \def\textnominalsize{11pt}
1819 \edef\mainmagstep{\magstephalf}
1820 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1821 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1822 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1823 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1824 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1825 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1826 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1827 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1828 \font\texti=cmmi10 scaled \mainmagstep
1829 \font\textsy=cmsy10 scaled \mainmagstep
1830 \def\textecsize{1095}
1831
1832 % A few fonts for @defun names and args.
1833 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
1834 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1835 \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
1836 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1837 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
1838 \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
1839
1840 % Fonts for indices, footnotes, small examples (9pt).
1841 \def\smallnominalsize{9pt}
1842 \setfont\smallrm\rmshape{9}{1000}{OT1}
1843 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1844 \setfont\smallbf\bfshape{10}{900}{OT1}
1845 \setfont\smallit\itshape{9}{1000}{OT1IT}
1846 \setfont\smallsl\slshape{9}{1000}{OT1}
1847 \setfont\smallsf\sfshape{9}{1000}{OT1}
1848 \setfont\smallsc\scshape{10}{900}{OT1}
1849 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1850 \font\smalli=cmmi9
1851 \font\smallsy=cmsy9
1852 \def\smallecsize{0900}
1853
1854 % Fonts for small examples (8pt).
1855 \def\smallernominalsize{8pt}
1856 \setfont\smallerrm\rmshape{8}{1000}{OT1}
1857 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
1858 \setfont\smallerbf\bfshape{10}{800}{OT1}
1859 \setfont\smallerit\itshape{8}{1000}{OT1IT}
1860 \setfont\smallersl\slshape{8}{1000}{OT1}
1861 \setfont\smallersf\sfshape{8}{1000}{OT1}
1862 \setfont\smallersc\scshape{10}{800}{OT1}
1863 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1864 \font\smalleri=cmmi8
1865 \font\smallersy=cmsy8
1866 \def\smallerecsize{0800}
1867
1868 % Fonts for title page (20.4pt):
1869 \def\titlenominalsize{20pt}
1870 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1871 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1872 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1873 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1874 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1875 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1876 \let\titlebf=\titlerm
1877 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1878 \font\titlei=cmmi12 scaled \magstep3
1879 \font\titlesy=cmsy10 scaled \magstep4
1880 \def\titleecsize{2074}
1881
1882 % Chapter (and unnumbered) fonts (17.28pt).
1883 \def\chapnominalsize{17pt}
1884 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
1885 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
1886 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
1887 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
1888 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
1889 \setfont\chapsf\sfbshape{17}{1000}{OT1}
1890 \let\chapbf=\chaprm
1891 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
1892 \font\chapi=cmmi12 scaled \magstep2
1893 \font\chapsy=cmsy10 scaled \magstep3
1894 \def\chapecsize{1728}
1895
1896 % Section fonts (14.4pt).
1897 \def\secnominalsize{14pt}
1898 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
1899 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
1900 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
1901 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
1902 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
1903 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
1904 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
1905 \let\secbf\secrm
1906 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
1907 \font\seci=cmmi12 scaled \magstep1
1908 \font\secsy=cmsy10 scaled \magstep2
1909 \def\sececsize{1440}
1910
1911 % Subsection fonts (13.15pt).
1912 \def\ssecnominalsize{13pt}
1913 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
1914 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
1915 \setfont\ssecsl\slbshape{10}{1315}{OT1}
1916 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
1917 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
1918 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
1919 \let\ssecbf\ssecrm
1920 \setfont\ssecsc\scbshape{10}{1315}{OT1}
1921 \font\sseci=cmmi12 scaled \magstephalf
1922 \font\ssecsy=cmsy10 scaled 1315
1923 \def\ssececsize{1200}
1924
1925 % Reduced fonts for @acro in text (10pt).
1926 \def\reducednominalsize{10pt}
1927 \setfont\reducedrm\rmshape{10}{1000}{OT1}
1928 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
1929 \setfont\reducedbf\bfshape{10}{1000}{OT1}
1930 \setfont\reducedit\itshape{10}{1000}{OT1IT}
1931 \setfont\reducedsl\slshape{10}{1000}{OT1}
1932 \setfont\reducedsf\sfshape{10}{1000}{OT1}
1933 \setfont\reducedsc\scshape{10}{1000}{OT1}
1934 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
1935 \font\reducedi=cmmi10
1936 \font\reducedsy=cmsy10
1937 \def\reducedecsize{1000}
1938
1939 \textleading = 13.2pt % line spacing for 11pt CM
1940 \textfonts % reset the current fonts
1941 \rm
1942 } % end of 11pt text font size definitions, \definetextfontsizexi
1943
1944
1945 % Definitions to make the main text be 10pt Computer Modern, with
1946 % section, chapter, etc., sizes following suit. This is for the GNU
1947 % Press printing of the Emacs 22 manual. Maybe other manuals in the
1948 % future. Used with @smallbook, which sets the leading to 12pt.
1949 %
1950 \def\definetextfontsizex{%
1951 % Text fonts (10pt).
1952 \def\textnominalsize{10pt}
1953 \edef\mainmagstep{1000}
1954 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1955 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1956 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1957 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1958 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1959 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1960 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1961 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1962 \font\texti=cmmi10 scaled \mainmagstep
1963 \font\textsy=cmsy10 scaled \mainmagstep
1964 \def\textecsize{1000}
1965
1966 % A few fonts for @defun names and args.
1967 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
1968 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
1969 \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
1970 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
1971 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
1972 \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
1973
1974 % Fonts for indices, footnotes, small examples (9pt).
1975 \def\smallnominalsize{9pt}
1976 \setfont\smallrm\rmshape{9}{1000}{OT1}
1977 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1978 \setfont\smallbf\bfshape{10}{900}{OT1}
1979 \setfont\smallit\itshape{9}{1000}{OT1IT}
1980 \setfont\smallsl\slshape{9}{1000}{OT1}
1981 \setfont\smallsf\sfshape{9}{1000}{OT1}
1982 \setfont\smallsc\scshape{10}{900}{OT1}
1983 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1984 \font\smalli=cmmi9
1985 \font\smallsy=cmsy9
1986 \def\smallecsize{0900}
1987
1988 % Fonts for small examples (8pt).
1989 \def\smallernominalsize{8pt}
1990 \setfont\smallerrm\rmshape{8}{1000}{OT1}
1991 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
1992 \setfont\smallerbf\bfshape{10}{800}{OT1}
1993 \setfont\smallerit\itshape{8}{1000}{OT1IT}
1994 \setfont\smallersl\slshape{8}{1000}{OT1}
1995 \setfont\smallersf\sfshape{8}{1000}{OT1}
1996 \setfont\smallersc\scshape{10}{800}{OT1}
1997 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1998 \font\smalleri=cmmi8
1999 \font\smallersy=cmsy8
2000 \def\smallerecsize{0800}
2001
2002 % Fonts for title page (20.4pt):
2003 \def\titlenominalsize{20pt}
2004 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2005 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2006 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2007 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2008 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2009 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2010 \let\titlebf=\titlerm
2011 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2012 \font\titlei=cmmi12 scaled \magstep3
2013 \font\titlesy=cmsy10 scaled \magstep4
2014 \def\titleecsize{2074}
2015
2016 % Chapter fonts (14.4pt).
2017 \def\chapnominalsize{14pt}
2018 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2019 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2020 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2021 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2022 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2023 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2024 \let\chapbf\chaprm
2025 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2026 \font\chapi=cmmi12 scaled \magstep1
2027 \font\chapsy=cmsy10 scaled \magstep2
2028 \def\chapecsize{1440}
2029
2030 % Section fonts (12pt).
2031 \def\secnominalsize{12pt}
2032 \setfont\secrm\rmbshape{12}{1000}{OT1}
2033 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2034 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2035 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2036 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2037 \setfont\secsf\sfbshape{12}{1000}{OT1}
2038 \let\secbf\secrm
2039 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2040 \font\seci=cmmi12
2041 \font\secsy=cmsy10 scaled \magstep1
2042 \def\sececsize{1200}
2043
2044 % Subsection fonts (10pt).
2045 \def\ssecnominalsize{10pt}
2046 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2047 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2048 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2049 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2050 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2051 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2052 \let\ssecbf\ssecrm
2053 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2054 \font\sseci=cmmi10
2055 \font\ssecsy=cmsy10
2056 \def\ssececsize{1000}
2057
2058 % Reduced fonts for @acro in text (9pt).
2059 \def\reducednominalsize{9pt}
2060 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2061 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2062 \setfont\reducedbf\bfshape{10}{900}{OT1}
2063 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2064 \setfont\reducedsl\slshape{9}{1000}{OT1}
2065 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2066 \setfont\reducedsc\scshape{10}{900}{OT1}
2067 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2068 \font\reducedi=cmmi9
2069 \font\reducedsy=cmsy9
2070 \def\reducedecsize{0900}
2071
2072 \divide\parskip by 2 % reduce space between paragraphs
2073 \textleading = 12pt % line spacing for 10pt CM
2074 \textfonts % reset the current fonts
2075 \rm
2076 } % end of 10pt text font size definitions, \definetextfontsizex
2077
2078
2079 % We provide the user-level command
2080 % @fonttextsize 10
2081 % (or 11) to redefine the text font size. pt is assumed.
2082 %
2083 \def\xiword{11}
2084 \def\xword{10}
2085 \def\xwordpt{10pt}
2086 %
2087 \parseargdef\fonttextsize{%
2088 \def\textsizearg{#1}%
2089 %\wlog{doing @fonttextsize \textsizearg}%
2090 %
2091 % Set \globaldefs so that documents can use this inside @tex, since
2092 % makeinfo 4.8 does not support it, but we need it nonetheless.
2093 %
2094 \begingroup \globaldefs=1
2095 \ifx\textsizearg\xword \definetextfontsizex
2096 \else \ifx\textsizearg\xiword \definetextfontsizexi
2097 \else
2098 \errhelp=\EMsimple
2099 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2100 \fi\fi
2101 \endgroup
2102 }
2103
2104 % In order for the font changes to affect most math symbols and letters,
2105 % we have to define the \textfont of the standard families. We don't
2106 % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
2107 %
2108 \def\resetmathfonts{%
2109 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2110 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2111 \textfont\ttfam=\tentt \textfont\sffam=\tensf
2112 }
2113
2114 % The font-changing commands redefine the meanings of \tenSTYLE, instead
2115 % of just \STYLE. We do this because \STYLE needs to also set the
2116 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2117 % \tenSTYLE to set the current font.
2118 %
2119 % Each font-changing command also sets the names \lsize (one size lower)
2120 % and \lllsize (three sizes lower). These relative commands are used
2121 % in, e.g., the LaTeX logo and acronyms.
2122 %
2123 % This all needs generalizing, badly.
2124 %
2125 \def\textfonts{%
2126 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2127 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2128 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2129 \let\tenttsl=\textttsl
2130 \def\curfontsize{text}%
2131 \def\lsize{reduced}\def\lllsize{smaller}%
2132 \resetmathfonts \setleading{\textleading}}
2133 \def\titlefonts{%
2134 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2135 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2136 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2137 \let\tenttsl=\titlettsl
2138 \def\curfontsize{title}%
2139 \def\lsize{chap}\def\lllsize{subsec}%
2140 \resetmathfonts \setleading{27pt}}
2141 \def\titlefont#1{{\titlefonts\rmisbold #1}}
2142 \def\chapfonts{%
2143 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2144 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2145 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2146 \let\tenttsl=\chapttsl
2147 \def\curfontsize{chap}%
2148 \def\lsize{sec}\def\lllsize{text}%
2149 \resetmathfonts \setleading{19pt}}
2150 \def\secfonts{%
2151 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2152 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2153 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2154 \let\tenttsl=\secttsl
2155 \def\curfontsize{sec}%
2156 \def\lsize{subsec}\def\lllsize{reduced}%
2157 \resetmathfonts \setleading{17pt}}
2158 \def\subsecfonts{%
2159 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2160 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2161 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2162 \let\tenttsl=\ssecttsl
2163 \def\curfontsize{ssec}%
2164 \def\lsize{text}\def\lllsize{small}%
2165 \resetmathfonts \setleading{15pt}}
2166 \let\subsubsecfonts = \subsecfonts
2167 \def\reducedfonts{%
2168 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2169 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2170 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2171 \let\tenttsl=\reducedttsl
2172 \def\curfontsize{reduced}%
2173 \def\lsize{small}\def\lllsize{smaller}%
2174 \resetmathfonts \setleading{10.5pt}}
2175 \def\smallfonts{%
2176 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2177 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2178 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2179 \let\tenttsl=\smallttsl
2180 \def\curfontsize{small}%
2181 \def\lsize{smaller}\def\lllsize{smaller}%
2182 \resetmathfonts \setleading{10.5pt}}
2183 \def\smallerfonts{%
2184 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2185 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2186 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2187 \let\tenttsl=\smallerttsl
2188 \def\curfontsize{smaller}%
2189 \def\lsize{smaller}\def\lllsize{smaller}%
2190 \resetmathfonts \setleading{9.5pt}}
2191
2192 % Fonts for short table of contents.
2193 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2194 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2195 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2196 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2197
2198 % Define these just so they can be easily changed for other fonts.
2199 \def\angleleft{$\langle$}
2200 \def\angleright{$\rangle$}
2201
2202 % Set the fonts to use with the @small... environments.
2203 \let\smallexamplefonts = \smallfonts
2204
2205 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2206 % can fit this many characters:
2207 % 8.5x11=86 smallbook=72 a4=90 a5=69
2208 % If we use \scriptfonts (8pt), then we can fit this many characters:
2209 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2210 % For me, subjectively, the few extra characters that fit aren't worth
2211 % the additional smallness of 8pt. So I'm making the default 9pt.
2212 %
2213 % By the way, for comparison, here's what fits with @example (10pt):
2214 % 8.5x11=71 smallbook=60 a4=75 a5=58
2215 % --karl, 24jan03.
2216
2217 % Set up the default fonts, so we can use them for creating boxes.
2218 %
2219 \definetextfontsizexi
2220
2221
2222 \message{markup,}
2223
2224 % Check if we are currently using a typewriter font. Since all the
2225 % Computer Modern typewriter fonts have zero interword stretch (and
2226 % shrink), and it is reasonable to expect all typewriter fonts to have
2227 % this property, we can check that font parameter.
2228 %
2229 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2230
2231 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2232 % define and register \INITMACRO to be called on markup style changes.
2233 % \INITMACRO can check \currentmarkupstyle for the innermost
2234 % style and the set of \ifmarkupSTYLE switches for all styles
2235 % currently in effect.
2236 \newif\ifmarkupvar
2237 \newif\ifmarkupsamp
2238 \newif\ifmarkupkey
2239 %\newif\ifmarkupfile % @file == @samp.
2240 %\newif\ifmarkupoption % @option == @samp.
2241 \newif\ifmarkupcode
2242 \newif\ifmarkupkbd
2243 %\newif\ifmarkupenv % @env == @code.
2244 %\newif\ifmarkupcommand % @command == @code.
2245 \newif\ifmarkuptex % @tex (and part of @math, for now).
2246 \newif\ifmarkupexample
2247 \newif\ifmarkupverb
2248 \newif\ifmarkupverbatim
2249
2250 \let\currentmarkupstyle\empty
2251
2252 \def\setupmarkupstyle#1{%
2253 \csname markup#1true\endcsname
2254 \def\currentmarkupstyle{#1}%
2255 \markupstylesetup
2256 }
2257
2258 \let\markupstylesetup\empty
2259
2260 \def\defmarkupstylesetup#1{%
2261 \expandafter\def\expandafter\markupstylesetup
2262 \expandafter{\markupstylesetup #1}%
2263 \def#1%
2264 }
2265
2266 % Markup style setup for left and right quotes.
2267 \defmarkupstylesetup\markupsetuplq{%
2268 \expandafter\let\expandafter \temp
2269 \csname markupsetuplq\currentmarkupstyle\endcsname
2270 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2271 }
2272
2273 \defmarkupstylesetup\markupsetuprq{%
2274 \expandafter\let\expandafter \temp
2275 \csname markupsetuprq\currentmarkupstyle\endcsname
2276 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2277 }
2278
2279 {
2280 \catcode`\'=\active
2281 \catcode`\`=\active
2282
2283 \gdef\markupsetuplqdefault{\let`\lq}
2284 \gdef\markupsetuprqdefault{\let'\rq}
2285
2286 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2287 \gdef\markupsetcodequoteright{\let'\codequoteright}
2288 }
2289
2290 \let\markupsetuplqcode \markupsetcodequoteleft
2291 \let\markupsetuprqcode \markupsetcodequoteright
2292 %
2293 \let\markupsetuplqexample \markupsetcodequoteleft
2294 \let\markupsetuprqexample \markupsetcodequoteright
2295 %
2296 \let\markupsetuplqkbd \markupsetcodequoteleft
2297 \let\markupsetuprqkbd \markupsetcodequoteright
2298 %
2299 \let\markupsetuplqsamp \markupsetcodequoteleft
2300 \let\markupsetuprqsamp \markupsetcodequoteright
2301 %
2302 \let\markupsetuplqverb \markupsetcodequoteleft
2303 \let\markupsetuprqverb \markupsetcodequoteright
2304 %
2305 \let\markupsetuplqverbatim \markupsetcodequoteleft
2306 \let\markupsetuprqverbatim \markupsetcodequoteright
2307
2308 % Allow an option to not use regular directed right quote/apostrophe
2309 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2310 % The undirected quote is ugly, so don't make it the default, but it
2311 % works for pasting with more pdf viewers (at least evince), the
2312 % lilypond developers report. xpdf does work with the regular 0x27.
2313 %
2314 \def\codequoteright{%
2315 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2316 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2317 '%
2318 \else \char'15 \fi
2319 \else \char'15 \fi
2320 }
2321 %
2322 % and a similar option for the left quote char vs. a grave accent.
2323 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2324 % the code environments to do likewise.
2325 %
2326 \def\codequoteleft{%
2327 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2328 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2329 % [Knuth] pp. 380,381,391
2330 % \relax disables Spanish ligatures ?` and !` of \tt font.
2331 \relax`%
2332 \else \char'22 \fi
2333 \else \char'22 \fi
2334 }
2335
2336 % Commands to set the quote options.
2337 %
2338 \parseargdef\codequoteundirected{%
2339 \def\temp{#1}%
2340 \ifx\temp\onword
2341 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2342 = t%
2343 \else\ifx\temp\offword
2344 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2345 = \relax
2346 \else
2347 \errhelp = \EMsimple
2348 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2349 \fi\fi
2350 }
2351 %
2352 \parseargdef\codequotebacktick{%
2353 \def\temp{#1}%
2354 \ifx\temp\onword
2355 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2356 = t%
2357 \else\ifx\temp\offword
2358 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2359 = \relax
2360 \else
2361 \errhelp = \EMsimple
2362 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2363 \fi\fi
2364 }
2365
2366 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2367 \def\noligaturesquoteleft{\relax\lq}
2368
2369 % Count depth in font-changes, for error checks
2370 \newcount\fontdepth \fontdepth=0
2371
2372 % Font commands.
2373
2374 % #1 is the font command (\sl or \it), #2 is the text to slant.
2375 % If we are in a monospaced environment, however, 1) always use \ttsl,
2376 % and 2) do not add an italic correction.
2377 \def\dosmartslant#1#2{%
2378 \ifusingtt
2379 {{\ttsl #2}\let\next=\relax}%
2380 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2381 \next
2382 }
2383 \def\smartslanted{\dosmartslant\sl}
2384 \def\smartitalic{\dosmartslant\it}
2385
2386 % Output an italic correction unless \next (presumed to be the following
2387 % character) is such as not to need one.
2388 \def\smartitaliccorrection{%
2389 \ifx\next,%
2390 \else\ifx\next-%
2391 \else\ifx\next.%
2392 \else\ifx\next\.%
2393 \else\ifx\next\comma%
2394 \else\ptexslash
2395 \fi\fi\fi\fi\fi
2396 \aftersmartic
2397 }
2398
2399 % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2400 \def\ttslanted#1{{\ttsl #1}}
2401
2402 % @cite is like \smartslanted except unconditionally use \sl. We never want
2403 % ttsl for book titles, do we?
2404 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2405
2406 \def\aftersmartic{}
2407 \def\var#1{%
2408 \let\saveaftersmartic = \aftersmartic
2409 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2410 \smartslanted{#1}%
2411 }
2412
2413 \let\i=\smartitalic
2414 \let\slanted=\smartslanted
2415 \let\dfn=\smartslanted
2416 \let\emph=\smartitalic
2417
2418 % Explicit font changes: @r, @sc, undocumented @ii.
2419 \def\r#1{{\rm #1}} % roman font
2420 \def\sc#1{{\smallcaps#1}} % smallcaps font
2421 \def\ii#1{{\it #1}} % italic font
2422
2423 % @b, explicit bold. Also @strong.
2424 \def\b#1{{\bf #1}}
2425 \let\strong=\b
2426
2427 % @sansserif, explicit sans.
2428 \def\sansserif#1{{\sf #1}}
2429
2430 % We can't just use \exhyphenpenalty, because that only has effect at
2431 % the end of a paragraph. Restore normal hyphenation at the end of the
2432 % group within which \nohyphenation is presumably called.
2433 %
2434 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2435 \def\restorehyphenation{\hyphenchar\font = `- }
2436
2437 % Set sfcode to normal for the chars that usually have another value.
2438 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2439 % sometimes \x has an active definition that messes things up.
2440 %
2441 \catcode`@=11
2442 \def\plainfrenchspacing{%
2443 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2444 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2445 \def\endofsentencespacefactor{1000}% for @. and friends
2446 }
2447 \def\plainnonfrenchspacing{%
2448 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2449 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2450 \def\endofsentencespacefactor{3000}% for @. and friends
2451 }
2452 \catcode`@=\other
2453 \def\endofsentencespacefactor{3000}% default
2454
2455 % @t, explicit typewriter.
2456 \def\t#1{%
2457 {\tt \rawbackslash \plainfrenchspacing #1}%
2458 \null
2459 }
2460
2461 % @samp.
2462 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2463
2464 % @indicateurl is \samp, that is, with quotes.
2465 \let\indicateurl=\samp
2466
2467 % @code (and similar) prints in typewriter, but with spaces the same
2468 % size as normal in the surrounding text, without hyphenation, etc.
2469 % This is a subroutine for that.
2470 \def\tclose#1{%
2471 {%
2472 % Change normal interword space to be same as for the current font.
2473 \spaceskip = \fontdimen2\font
2474 %
2475 % Switch to typewriter.
2476 \tt
2477 %
2478 % But `\ ' produces the large typewriter interword space.
2479 \def\ {{\spaceskip = 0pt{} }}%
2480 %
2481 % Turn off hyphenation.
2482 \nohyphenation
2483 %
2484 \rawbackslash
2485 \plainfrenchspacing
2486 #1%
2487 }%
2488 \null % reset spacefactor to 1000
2489 }
2490
2491 % We *must* turn on hyphenation at `-' and `_' in @code.
2492 % (But see \codedashfinish below.)
2493 % Otherwise, it is too hard to avoid overfull hboxes
2494 % in the Emacs manual, the Library manual, etc.
2495 %
2496 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2497 % both hyphenation at - and hyphenation within words.
2498 % We must therefore turn them both off (\tclose does that)
2499 % and arrange explicitly to hyphenate at a dash. -- rms.
2500 {
2501 \catcode`\-=\active \catcode`\_=\active
2502 \catcode`\'=\active \catcode`\`=\active
2503 \global\let'=\rq \global\let`=\lq % default definitions
2504 %
2505 \global\def\code{\begingroup
2506 \setupmarkupstyle{code}%
2507 % The following should really be moved into \setupmarkupstyle handlers.
2508 \catcode\dashChar=\active \catcode\underChar=\active
2509 \ifallowcodebreaks
2510 \let-\codedash
2511 \let_\codeunder
2512 \else
2513 \let-\normaldash
2514 \let_\realunder
2515 \fi
2516 % Given -foo (with a single dash), we do not want to allow a break
2517 % after the hyphen.
2518 \global\let\codedashprev=\codedash
2519 %
2520 \codex
2521 }
2522 %
2523 \gdef\codedash{\futurelet\next\codedashfinish}
2524 \gdef\codedashfinish{%
2525 \normaldash % always output the dash character itself.
2526 %
2527 % Now, output a discretionary to allow a line break, unless
2528 % (a) the next character is a -, or
2529 % (b) the preceding character is a -.
2530 % E.g., given --posix, we do not want to allow a break after either -.
2531 % Given --foo-bar, we do want to allow a break between the - and the b.
2532 \ifx\next\codedash \else
2533 \ifx\codedashprev\codedash
2534 \else \discretionary{}{}{}\fi
2535 \fi
2536 % we need the space after the = for the case when \next itself is a
2537 % space token; it would get swallowed otherwise. As in @code{- a}.
2538 \global\let\codedashprev= \next
2539 }
2540 }
2541 \def\normaldash{-}
2542 %
2543 \def\codex #1{\tclose{#1}\endgroup}
2544
2545 \def\codeunder{%
2546 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2547 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2548 % will therefore expand the active definition of _, which is us
2549 % (inside @code that is), therefore an endless loop.
2550 \ifusingtt{\ifmmode
2551 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2552 \else\normalunderscore \fi
2553 \discretionary{}{}{}}%
2554 {\_}%
2555 }
2556
2557 % An additional complication: the above will allow breaks after, e.g.,
2558 % each of the four underscores in __typeof__. This is bad.
2559 % @allowcodebreaks provides a document-level way to turn breaking at -
2560 % and _ on and off.
2561 %
2562 \newif\ifallowcodebreaks \allowcodebreakstrue
2563
2564 \def\keywordtrue{true}
2565 \def\keywordfalse{false}
2566
2567 \parseargdef\allowcodebreaks{%
2568 \def\txiarg{#1}%
2569 \ifx\txiarg\keywordtrue
2570 \allowcodebreakstrue
2571 \else\ifx\txiarg\keywordfalse
2572 \allowcodebreaksfalse
2573 \else
2574 \errhelp = \EMsimple
2575 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2576 \fi\fi
2577 }
2578
2579 % For @command, @env, @file, @option quotes seem unnecessary,
2580 % so use \code rather than \samp.
2581 \let\command=\code
2582 \let\env=\code
2583 \let\file=\code
2584 \let\option=\code
2585
2586 % @uref (abbreviation for `urlref') aka @url takes an optional
2587 % (comma-separated) second argument specifying the text to display and
2588 % an optional third arg as text to display instead of (rather than in
2589 % addition to) the url itself. First (mandatory) arg is the url.
2590
2591 % TeX-only option to allow changing PDF output to show only the second
2592 % arg (if given), and not the url (which is then just the link target).
2593 \newif\ifurefurlonlylink
2594
2595 % The main macro is \urefbreak, which allows breaking at expected
2596 % places within the url. (There used to be another version, which
2597 % didn't support automatic breaking.)
2598 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2599 \let\uref=\urefbreak
2600 %
2601 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2602 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2603 \unsepspaces
2604 \pdfurl{#1}%
2605 \setbox0 = \hbox{\ignorespaces #3}%
2606 \ifdim\wd0 > 0pt
2607 \unhbox0 % third arg given, show only that
2608 \else
2609 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
2610 \ifdim\wd0 > 0pt
2611 \ifpdf
2612 \ifurefurlonlylink
2613 % PDF plus option to not display url, show just arg
2614 \unhbox0
2615 \else
2616 % PDF, normally display both arg and url for consistency,
2617 % visibility, if the pdf is eventually used to print, etc.
2618 \unhbox0\ (\urefcode{#1})%
2619 \fi
2620 \else
2621 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
2622 \fi
2623 \else
2624 \urefcode{#1}% only url given, so show it
2625 \fi
2626 \fi
2627 \endlink
2628 \endgroup}
2629
2630 % Allow line breaks around only a few characters (only).
2631 \def\urefcatcodes{%
2632 \catcode`\&=\active \catcode`\.=\active
2633 \catcode`\#=\active \catcode`\?=\active
2634 \catcode`\/=\active
2635 }
2636 {
2637 \urefcatcodes
2638 %
2639 \global\def\urefcode{\begingroup
2640 \setupmarkupstyle{code}%
2641 \urefcatcodes
2642 \let&\urefcodeamp
2643 \let.\urefcodedot
2644 \let#\urefcodehash
2645 \let?\urefcodequest
2646 \let/\urefcodeslash
2647 \codex
2648 }
2649 %
2650 % By default, they are just regular characters.
2651 \global\def&{\normalamp}
2652 \global\def.{\normaldot}
2653 \global\def#{\normalhash}
2654 \global\def?{\normalquest}
2655 \global\def/{\normalslash}
2656 }
2657
2658 % we put a little stretch before and after the breakable chars, to help
2659 % line breaking of long url's. The unequal skips make look better in
2660 % cmtt at least, especially for dots.
2661 \def\urefprestretchamount{.13em}
2662 \def\urefpoststretchamount{.1em}
2663 \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
2664 \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
2665 %
2666 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2667 \def\urefcodedot{\urefprestretch .\urefpoststretch}
2668 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
2669 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
2670 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2671 {
2672 \catcode`\/=\active
2673 \global\def\urefcodeslashfinish{%
2674 \urefprestretch \slashChar
2675 % Allow line break only after the final / in a sequence of
2676 % slashes, to avoid line break between the slashes in http://.
2677 \ifx\next/\else \urefpoststretch \fi
2678 }
2679 }
2680
2681 % One more complication: by default we'll break after the special
2682 % characters, but some people like to break before the special chars, so
2683 % allow that. Also allow no breaking at all, for manual control.
2684 %
2685 \parseargdef\urefbreakstyle{%
2686 \def\txiarg{#1}%
2687 \ifx\txiarg\wordnone
2688 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2689 \else\ifx\txiarg\wordbefore
2690 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2691 \else\ifx\txiarg\wordafter
2692 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2693 \else
2694 \errhelp = \EMsimple
2695 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2696 \fi\fi\fi
2697 }
2698 \def\wordafter{after}
2699 \def\wordbefore{before}
2700 \def\wordnone{none}
2701
2702 \urefbreakstyle after
2703
2704 % @url synonym for @uref, since that's how everyone uses it.
2705 %
2706 \let\url=\uref
2707
2708 % rms does not like angle brackets --karl, 17may97.
2709 % So now @email is just like @uref, unless we are pdf.
2710 %
2711 %\def\email#1{\angleleft{\tt #1}\angleright}
2712 \ifpdf
2713 \def\email#1{\doemail#1,,\finish}
2714 \def\doemail#1,#2,#3\finish{\begingroup
2715 \unsepspaces
2716 \pdfurl{mailto:#1}%
2717 \setbox0 = \hbox{\ignorespaces #2}%
2718 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2719 \endlink
2720 \endgroup}
2721 \else
2722 \let\email=\uref
2723 \fi
2724
2725 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2726 % `example' (@kbd uses ttsl only inside of @example and friends),
2727 % or `code' (@kbd uses normal tty font always).
2728 \parseargdef\kbdinputstyle{%
2729 \def\txiarg{#1}%
2730 \ifx\txiarg\worddistinct
2731 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2732 \else\ifx\txiarg\wordexample
2733 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2734 \else\ifx\txiarg\wordcode
2735 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2736 \else
2737 \errhelp = \EMsimple
2738 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2739 \fi\fi\fi
2740 }
2741 \def\worddistinct{distinct}
2742 \def\wordexample{example}
2743 \def\wordcode{code}
2744
2745 % Default is `distinct'.
2746 \kbdinputstyle distinct
2747
2748 % @kbd is like @code, except that if the argument is just one @key command,
2749 % then @kbd has no effect.
2750 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
2751
2752 \def\xkey{\key}
2753 \def\kbdsub#1#2#3\par{%
2754 \def\one{#1}\def\three{#3}\def\threex{??}%
2755 \ifx\one\xkey\ifx\threex\three \key{#2}%
2756 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2757 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2758 }
2759
2760 % definition of @key that produces a lozenge. Doesn't adjust to text size.
2761 %\setfont\keyrm\rmshape{8}{1000}{OT1}
2762 %\font\keysy=cmsy9
2763 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2764 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2765 % \vbox{\hrule\kern-0.4pt
2766 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2767 % \kern-0.4pt\hrule}%
2768 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2769
2770 % definition of @key with no lozenge. If the current font is already
2771 % monospace, don't change it; that way, we respect @kbdinputstyle. But
2772 % if it isn't monospace, then use \tt.
2773 %
2774 \def\key#1{{\setupmarkupstyle{key}%
2775 \nohyphenation
2776 \ifmonospace\else\tt\fi
2777 #1}\null}
2778
2779 % @clicksequence{File @click{} Open ...}
2780 \def\clicksequence#1{\begingroup #1\endgroup}
2781
2782 % @clickstyle @arrow (by default)
2783 \parseargdef\clickstyle{\def\click{#1}}
2784 \def\click{\arrow}
2785
2786 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2787 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2788 %
2789 \def\dmn#1{\thinspace #1}
2790
2791 % @acronym for "FBI", "NATO", and the like.
2792 % We print this one point size smaller, since it's intended for
2793 % all-uppercase.
2794 %
2795 \def\acronym#1{\doacronym #1,,\finish}
2796 \def\doacronym#1,#2,#3\finish{%
2797 {\selectfonts\lsize #1}%
2798 \def\temp{#2}%
2799 \ifx\temp\empty \else
2800 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2801 \fi
2802 \null % reset \spacefactor=1000
2803 }
2804
2805 % @abbr for "Comput. J." and the like.
2806 % No font change, but don't do end-of-sentence spacing.
2807 %
2808 \def\abbr#1{\doabbr #1,,\finish}
2809 \def\doabbr#1,#2,#3\finish{%
2810 {\plainfrenchspacing #1}%
2811 \def\temp{#2}%
2812 \ifx\temp\empty \else
2813 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2814 \fi
2815 \null % reset \spacefactor=1000
2816 }
2817
2818 % @asis just yields its argument. Used with @table, for example.
2819 %
2820 \def\asis#1{#1}
2821
2822 % @math outputs its argument in math mode.
2823 %
2824 % One complication: _ usually means subscripts, but it could also mean
2825 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
2826 % _ active, and distinguish by seeing if the current family is \slfam,
2827 % which is what @var uses.
2828 {
2829 \catcode`\_ = \active
2830 \gdef\mathunderscore{%
2831 \catcode`\_=\active
2832 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2833 }
2834 }
2835 % Another complication: we want \\ (and @\) to output a math (or tt) \.
2836 % FYI, plain.tex uses \\ as a temporary control sequence (for no
2837 % particular reason), but this is not advertised and we don't care.
2838 %
2839 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2840 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2841 %
2842 \def\math{%
2843 \ifmmode\else % only go into math if not in math mode already
2844 \tex
2845 \mathunderscore
2846 \let\\ = \mathbackslash
2847 \mathactive
2848 % make the texinfo accent commands work in math mode
2849 \let\"=\ddot
2850 \let\'=\acute
2851 \let\==\bar
2852 \let\^=\hat
2853 \let\`=\grave
2854 \let\u=\breve
2855 \let\v=\check
2856 \let\~=\tilde
2857 \let\dotaccent=\dot
2858 % have to provide another name for sup operator
2859 \let\mathopsup=\sup
2860 $\expandafter\finishmath\fi
2861 }
2862 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
2863
2864 % Some active characters (such as <) are spaced differently in math.
2865 % We have to reset their definitions in case the @math was an argument
2866 % to a command which sets the catcodes (such as @item or @section).
2867 %
2868 {
2869 \catcode`^ = \active
2870 \catcode`< = \active
2871 \catcode`> = \active
2872 \catcode`+ = \active
2873 \catcode`' = \active
2874 \gdef\mathactive{%
2875 \let^ = \ptexhat
2876 \let< = \ptexless
2877 \let> = \ptexgtr
2878 \let+ = \ptexplus
2879 \let' = \ptexquoteright
2880 }
2881 }
2882
2883 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
2884 % If in text, use math to place as sub/superscript, but switch
2885 % into text mode, with smaller fonts. This is a different font than the
2886 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
2887 % fix it (significant additions to font machinery) until someone notices.
2888 %
2889 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
2890 \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
2891 %
2892 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
2893 \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
2894
2895 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
2896 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
2897 % except specified as a normal braced arg, so no newlines to worry about.
2898 %
2899 \def\outfmtnametex{tex}
2900 %
2901 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
2902 \long\def\doinlinefmt#1,#2,\finish{%
2903 \def\inlinefmtname{#1}%
2904 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
2905 }
2906 %
2907 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
2908 % FMTNAME is tex, else ELSE-TEXT.
2909 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
2910 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
2911 \def\inlinefmtname{#1}%
2912 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
2913 }
2914 %
2915 % For raw, must switch into @tex before parsing the argument, to avoid
2916 % setting catcodes prematurely. Doing it this way means that, for
2917 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
2918 % ignored. But this isn't important because if people want a literal
2919 % *right* brace they would have to use a command anyway, so they may as
2920 % well use a command to get a left brace too. We could re-use the
2921 % delimiter character idea from \verb, but it seems like overkill.
2922 %
2923 \long\def\inlineraw{\tex \doinlineraw}
2924 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
2925 \def\doinlinerawtwo#1,#2,\finish{%
2926 \def\inlinerawname{#1}%
2927 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
2928 \endgroup % close group opened by \tex.
2929 }
2930
2931 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
2932 %
2933 \long\def\inlineifset#1{\doinlineifset #1,\finish}
2934 \long\def\doinlineifset#1,#2,\finish{%
2935 \def\inlinevarname{#1}%
2936 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
2937 \else\ignorespaces#2\fi
2938 }
2939
2940 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
2941 %
2942 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
2943 \long\def\doinlineifclear#1,#2,\finish{%
2944 \def\inlinevarname{#1}%
2945 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
2946 }
2947
2948
2949 \message{glyphs,}
2950 % and logos.
2951
2952 % @@ prints an @, as does @atchar{}.
2953 \def\@{\char64 }
2954 \let\atchar=\@
2955
2956 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
2957 % Unless we're in typewriter, use \ecfont because the CM text fonts do
2958 % not have braces, and we don't want to switch into math.
2959 \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
2960 \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
2961 \let\{=\mylbrace \let\lbracechar=\{
2962 \let\}=\myrbrace \let\rbracechar=\}
2963 \begingroup
2964 % Definitions to produce \{ and \} commands for indices,
2965 % and @{ and @} for the aux/toc files.
2966 \catcode`\{ = \other \catcode`\} = \other
2967 \catcode`\[ = 1 \catcode`\] = 2
2968 \catcode`\! = 0 \catcode`\\ = \other
2969 !gdef!lbracecmd[\{]%
2970 !gdef!rbracecmd[\}]%
2971 !gdef!lbraceatcmd[@{]%
2972 !gdef!rbraceatcmd[@}]%
2973 !endgroup
2974
2975 % @comma{} to avoid , parsing problems.
2976 \let\comma = ,
2977
2978 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
2979 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
2980 \let\, = \ptexc
2981 \let\dotaccent = \ptexdot
2982 \def\ringaccent#1{{\accent23 #1}}
2983 \let\tieaccent = \ptext
2984 \let\ubaraccent = \ptexb
2985 \let\udotaccent = \d
2986
2987 % Other special characters: @questiondown @exclamdown @ordf @ordm
2988 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
2989 \def\questiondown{?`}
2990 \def\exclamdown{!`}
2991 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
2992 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
2993
2994 % Dotless i and dotless j, used for accents.
2995 \def\imacro{i}
2996 \def\jmacro{j}
2997 \def\dotless#1{%
2998 \def\temp{#1}%
2999 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3000 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3001 \else \errmessage{@dotless can be used only with i or j}%
3002 \fi\fi
3003 }
3004
3005 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3006 % period following counts as ending a sentence. (Idea found in latex.)
3007 %
3008 \edef\TeX{\TeX \spacefactor=1000 }
3009
3010 % @LaTeX{} logo. Not quite the same results as the definition in
3011 % latex.ltx, since we use a different font for the raised A; it's most
3012 % convenient for us to use an explicitly smaller font, rather than using
3013 % the \scriptstyle font (since we don't reset \scriptstyle and
3014 % \scriptscriptstyle).
3015 %
3016 \def\LaTeX{%
3017 L\kern-.36em
3018 {\setbox0=\hbox{T}%
3019 \vbox to \ht0{\hbox{%
3020 \ifx\textnominalsize\xwordpt
3021 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
3022 % Revert to plain's \scriptsize, which is 7pt.
3023 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3024 \else
3025 % For 11pt, we can use our lllsize.
3026 \selectfonts\lllsize A%
3027 \fi
3028 }%
3029 \vss
3030 }}%
3031 \kern-.15em
3032 \TeX
3033 }
3034
3035 % Some math mode symbols. Define \ensuremath to switch into math mode
3036 % unless we are already there. Expansion tricks may not be needed here,
3037 % but safer, and can't hurt.
3038 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3039 \def\ensuredmath#1{$\relax#1$}
3040 %
3041 \def\bullet{\ensuremath\ptexbullet}
3042 \def\geq{\ensuremath\ge}
3043 \def\leq{\ensuremath\le}
3044 \def\minus{\ensuremath-}
3045
3046 % @dots{} outputs an ellipsis using the current font.
3047 % We do .5em per period so that it has the same spacing in the cm
3048 % typewriter fonts as three actual period characters; on the other hand,
3049 % in other typewriter fonts three periods are wider than 1.5em. So do
3050 % whichever is larger.
3051 %
3052 \def\dots{%
3053 \leavevmode
3054 \setbox0=\hbox{...}% get width of three periods
3055 \ifdim\wd0 > 1.5em
3056 \dimen0 = \wd0
3057 \else
3058 \dimen0 = 1.5em
3059 \fi
3060 \hbox to \dimen0{%
3061 \hskip 0pt plus.25fil
3062 .\hskip 0pt plus1fil
3063 .\hskip 0pt plus1fil
3064 .\hskip 0pt plus.5fil
3065 }%
3066 }
3067
3068 % @enddots{} is an end-of-sentence ellipsis.
3069 %
3070 \def\enddots{%
3071 \dots
3072 \spacefactor=\endofsentencespacefactor
3073 }
3074
3075 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3076 %
3077 % Since these characters are used in examples, they should be an even number of
3078 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3079 %
3080 \def\point{$\star$}
3081 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3082 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3083 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3084 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3085 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3086
3087 % The @error{} command.
3088 % Adapted from the TeXbook's \boxit.
3089 %
3090 \newbox\errorbox
3091 %
3092 {\tentt \global\dimen0 = 3em}% Width of the box.
3093 \dimen2 = .55pt % Thickness of rules
3094 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3095 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3096 %
3097 \setbox\errorbox=\hbox to \dimen0{\hfil
3098 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3099 \advance\hsize by -2\dimen2 % Rules.
3100 \vbox{%
3101 \hrule height\dimen2
3102 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3103 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3104 \kern3pt\vrule width\dimen2}% Space to right.
3105 \hrule height\dimen2}
3106 \hfil}
3107 %
3108 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3109
3110 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3111 %
3112 \def\pounds{{\it\$}}
3113
3114 % @euro{} comes from a separate font, depending on the current style.
3115 % We use the free feym* fonts from the eurosym package by Henrik
3116 % Theiling, which support regular, slanted, bold and bold slanted (and
3117 % "outlined" (blackboard board, sort of) versions, which we don't need).
3118 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3119 %
3120 % Although only regular is the truly official Euro symbol, we ignore
3121 % that. The Euro is designed to be slightly taller than the regular
3122 % font height.
3123 %
3124 % feymr - regular
3125 % feymo - slanted
3126 % feybr - bold
3127 % feybo - bold slanted
3128 %
3129 % There is no good (free) typewriter version, to my knowledge.
3130 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3131 % Hmm.
3132 %
3133 % Also doesn't work in math. Do we need to do math with euro symbols?
3134 % Hope not.
3135 %
3136 %
3137 \def\euro{{\eurofont e}}
3138 \def\eurofont{%
3139 % We set the font at each command, rather than predefining it in
3140 % \textfonts and the other font-switching commands, so that
3141 % installations which never need the symbol don't have to have the
3142 % font installed.
3143 %
3144 % There is only one designed size (nominal 10pt), so we always scale
3145 % that to the current nominal size.
3146 %
3147 % By the way, simply using "at 1em" works for cmr10 and the like, but
3148 % does not work for cmbx10 and other extended/shrunken fonts.
3149 %
3150 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3151 %
3152 \ifx\curfontstyle\bfstylename
3153 % bold:
3154 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3155 \else
3156 % regular:
3157 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3158 \fi
3159 \thiseurofont
3160 }
3161
3162 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3163 % sometimes we redefine the original macro, and the alias should reflect
3164 % the redefinition.
3165 %
3166 % Use LaTeX names for the Icelandic letters.
3167 \def\DH{{\ecfont \char"D0}} % Eth
3168 \def\dh{{\ecfont \char"F0}} % eth
3169 \def\TH{{\ecfont \char"DE}} % Thorn
3170 \def\th{{\ecfont \char"FE}} % thorn
3171 %
3172 \def\guillemetleft{{\ecfont \char"13}}
3173 \def\guillemotleft{\guillemetleft}
3174 \def\guillemetright{{\ecfont \char"14}}
3175 \def\guillemotright{\guillemetright}
3176 \def\guilsinglleft{{\ecfont \char"0E}}
3177 \def\guilsinglright{{\ecfont \char"0F}}
3178 \def\quotedblbase{{\ecfont \char"12}}
3179 \def\quotesinglbase{{\ecfont \char"0D}}
3180 %
3181 % This positioning is not perfect (see the ogonek LaTeX package), but
3182 % we have the precomposed glyphs for the most common cases. We put the
3183 % tests to use those glyphs in the single \ogonek macro so we have fewer
3184 % dummy definitions to worry about for index entries, etc.
3185 %
3186 % ogonek is also used with other letters in Lithuanian (IOU), but using
3187 % the precomposed glyphs for those is not so easy since they aren't in
3188 % the same EC font.
3189 \def\ogonek#1{{%
3190 \def\temp{#1}%
3191 \ifx\temp\macrocharA\Aogonek
3192 \else\ifx\temp\macrochara\aogonek
3193 \else\ifx\temp\macrocharE\Eogonek
3194 \else\ifx\temp\macrochare\eogonek
3195 \else
3196 \ecfont \setbox0=\hbox{#1}%
3197 \ifdim\ht0=1ex\accent"0C #1%
3198 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3199 \fi
3200 \fi\fi\fi\fi
3201 }%
3202 }
3203 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3204 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3205 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3206 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3207 %
3208 % Use the European Computer Modern fonts (cm-super in outline format)
3209 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3210 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3211 % package and follow the same conventions.
3212 %
3213 \def\ecfont{\etcfont{e}}
3214 \def\tcfont{\etcfont{t}}
3215 %
3216 \def\etcfont#1{%
3217 % We can't distinguish serif/sans and italic/slanted, but this
3218 % is used for crude hacks anyway (like adding French and German
3219 % quotes to documents typeset with CM, where we lose kerning), so
3220 % hopefully nobody will notice/care.
3221 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3222 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3223 \ifmonospace
3224 % typewriter:
3225 \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3226 \else
3227 \ifx\curfontstyle\bfstylename
3228 % bold:
3229 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3230 \else
3231 % regular:
3232 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3233 \fi
3234 \fi
3235 \thisecfont
3236 }
3237
3238 % @registeredsymbol - R in a circle. The font for the R should really
3239 % be smaller yet, but lllsize is the best we can do for now.
3240 % Adapted from the plain.tex definition of \copyright.
3241 %
3242 \def\registeredsymbol{%
3243 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3244 \hfil\crcr\Orb}}%
3245 }$%
3246 }
3247
3248 % @textdegree - the normal degrees sign.
3249 %
3250 \def\textdegree{$^\circ$}
3251
3252 % Laurent Siebenmann reports \Orb undefined with:
3253 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3254 % so we'll define it if necessary.
3255 %
3256 \ifx\Orb\thisisundefined
3257 \def\Orb{\mathhexbox20D}
3258 \fi
3259
3260 % Quotes.
3261 \chardef\quotedblleft="5C
3262 \chardef\quotedblright=`\"
3263 \chardef\quoteleft=`\`
3264 \chardef\quoteright=`\'
3265
3266
3267 \message{page headings,}
3268
3269 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3270 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3271
3272 % First the title page. Must do @settitle before @titlepage.
3273 \newif\ifseenauthor
3274 \newif\iffinishedtitlepage
3275
3276 % Do an implicit @contents or @shortcontents after @end titlepage if the
3277 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
3278 %
3279 \newif\ifsetcontentsaftertitlepage
3280 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3281 \newif\ifsetshortcontentsaftertitlepage
3282 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3283
3284 \parseargdef\shorttitlepage{%
3285 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3286 \endgroup\page\hbox{}\page}
3287
3288 \envdef\titlepage{%
3289 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3290 \begingroup
3291 \parindent=0pt \textfonts
3292 % Leave some space at the very top of the page.
3293 \vglue\titlepagetopglue
3294 % No rule at page bottom unless we print one at the top with @title.
3295 \finishedtitlepagetrue
3296 %
3297 % Most title ``pages'' are actually two pages long, with space
3298 % at the top of the second. We don't want the ragged left on the second.
3299 \let\oldpage = \page
3300 \def\page{%
3301 \iffinishedtitlepage\else
3302 \finishtitlepage
3303 \fi
3304 \let\page = \oldpage
3305 \page
3306 \null
3307 }%
3308 }
3309
3310 \def\Etitlepage{%
3311 \iffinishedtitlepage\else
3312 \finishtitlepage
3313 \fi
3314 % It is important to do the page break before ending the group,
3315 % because the headline and footline are only empty inside the group.
3316 % If we use the new definition of \page, we always get a blank page
3317 % after the title page, which we certainly don't want.
3318 \oldpage
3319 \endgroup
3320 %
3321 % Need this before the \...aftertitlepage checks so that if they are
3322 % in effect the toc pages will come out with page numbers.
3323 \HEADINGSon
3324 %
3325 % If they want short, they certainly want long too.
3326 \ifsetshortcontentsaftertitlepage
3327 \shortcontents
3328 \contents
3329 \global\let\shortcontents = \relax
3330 \global\let\contents = \relax
3331 \fi
3332 %
3333 \ifsetcontentsaftertitlepage
3334 \contents
3335 \global\let\contents = \relax
3336 \global\let\shortcontents = \relax
3337 \fi
3338 }
3339
3340 \def\finishtitlepage{%
3341 \vskip4pt \hrule height 2pt width \hsize
3342 \vskip\titlepagebottomglue
3343 \finishedtitlepagetrue
3344 }
3345
3346 % Settings used for typesetting titles: no hyphenation, no indentation,
3347 % don't worry much about spacing, ragged right. This should be used
3348 % inside a \vbox, and fonts need to be set appropriately first. Because
3349 % it is always used for titles, nothing else, we call \rmisbold. \par
3350 % should be specified before the end of the \vbox, since a vbox is a group.
3351 %
3352 \def\raggedtitlesettings{%
3353 \rmisbold
3354 \hyphenpenalty=10000
3355 \parindent=0pt
3356 \tolerance=5000
3357 \ptexraggedright
3358 }
3359
3360 % Macros to be used within @titlepage:
3361
3362 \let\subtitlerm=\tenrm
3363 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3364
3365 \parseargdef\title{%
3366 \checkenv\titlepage
3367 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3368 % print a rule at the page bottom also.
3369 \finishedtitlepagefalse
3370 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3371 }
3372
3373 \parseargdef\subtitle{%
3374 \checkenv\titlepage
3375 {\subtitlefont \rightline{#1}}%
3376 }
3377
3378 % @author should come last, but may come many times.
3379 % It can also be used inside @quotation.
3380 %
3381 \parseargdef\author{%
3382 \def\temp{\quotation}%
3383 \ifx\thisenv\temp
3384 \def\quotationauthor{#1}% printed in \Equotation.
3385 \else
3386 \checkenv\titlepage
3387 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3388 {\secfonts\rmisbold \leftline{#1}}%
3389 \fi
3390 }
3391
3392
3393 % Set up page headings and footings.
3394
3395 \let\thispage=\folio
3396
3397 \newtoks\evenheadline % headline on even pages
3398 \newtoks\oddheadline % headline on odd pages
3399 \newtoks\evenfootline % footline on even pages
3400 \newtoks\oddfootline % footline on odd pages
3401
3402 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3403 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3404 \else \the\evenheadline \fi}}
3405 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3406 \else \the\evenfootline \fi}\HEADINGShook}
3407 \let\HEADINGShook=\relax
3408
3409 % Commands to set those variables.
3410 % For example, this is what @headings on does
3411 % @evenheading @thistitle|@thispage|@thischapter
3412 % @oddheading @thischapter|@thispage|@thistitle
3413 % @evenfooting @thisfile||
3414 % @oddfooting ||@thisfile
3415
3416
3417 \def\evenheading{\parsearg\evenheadingxxx}
3418 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3419 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3420 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3421
3422 \def\oddheading{\parsearg\oddheadingxxx}
3423 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3424 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3425 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3426
3427 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3428
3429 \def\evenfooting{\parsearg\evenfootingxxx}
3430 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3431 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3432 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3433
3434 \def\oddfooting{\parsearg\oddfootingxxx}
3435 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3436 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3437 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3438 %
3439 % Leave some space for the footline. Hopefully ok to assume
3440 % @evenfooting will not be used by itself.
3441 \global\advance\pageheight by -12pt
3442 \global\advance\vsize by -12pt
3443 }
3444
3445 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3446
3447 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3448 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3449 %
3450 % The same set of arguments for:
3451 %
3452 % @oddheadingmarks
3453 % @evenfootingmarks
3454 % @oddfootingmarks
3455 % @everyheadingmarks
3456 % @everyfootingmarks
3457
3458 % These define \getoddheadingmarks, \getevenheadingmarks,
3459 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3460 % \gettopheadingmarks, \getbottomheadingmarks.
3461 %
3462 \def\evenheadingmarks{\headingmarks{even}{heading}}
3463 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3464 \def\evenfootingmarks{\headingmarks{even}{footing}}
3465 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3466 \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3467 \headingmarks{odd}{heading}{#1} }
3468 \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3469 \headingmarks{odd}{footing}{#1} }
3470 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3471 \def\headingmarks#1#2#3 {%
3472 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3473 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3474 }
3475
3476 \everyheadingmarks bottom
3477 \everyfootingmarks bottom
3478
3479 % @headings double turns headings on for double-sided printing.
3480 % @headings single turns headings on for single-sided printing.
3481 % @headings off turns them off.
3482 % @headings on same as @headings double, retained for compatibility.
3483 % @headings after turns on double-sided headings after this page.
3484 % @headings doubleafter turns on double-sided headings after this page.
3485 % @headings singleafter turns on single-sided headings after this page.
3486 % By default, they are off at the start of a document,
3487 % and turned `on' after @end titlepage.
3488
3489 \def\headings #1 {\csname HEADINGS#1\endcsname}
3490
3491 \def\headingsoff{% non-global headings elimination
3492 \evenheadline={\hfil}\evenfootline={\hfil}%
3493 \oddheadline={\hfil}\oddfootline={\hfil}%
3494 }
3495
3496 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3497 \HEADINGSoff % it's the default
3498
3499 % When we turn headings on, set the page number to 1.
3500 % For double-sided printing, put current file name in lower left corner,
3501 % chapter name on inside top of right hand pages, document
3502 % title on inside top of left hand pages, and page numbers on outside top
3503 % edge of all pages.
3504 \def\HEADINGSdouble{%
3505 \global\pageno=1
3506 \global\evenfootline={\hfil}
3507 \global\oddfootline={\hfil}
3508 \global\evenheadline={\line{\folio\hfil\thistitle}}
3509 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3510 \global\let\contentsalignmacro = \chapoddpage
3511 }
3512 \let\contentsalignmacro = \chappager
3513
3514 % For single-sided printing, chapter title goes across top left of page,
3515 % page number on top right.
3516 \def\HEADINGSsingle{%
3517 \global\pageno=1
3518 \global\evenfootline={\hfil}
3519 \global\oddfootline={\hfil}
3520 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3521 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3522 \global\let\contentsalignmacro = \chappager
3523 }
3524 \def\HEADINGSon{\HEADINGSdouble}
3525
3526 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3527 \let\HEADINGSdoubleafter=\HEADINGSafter
3528 \def\HEADINGSdoublex{%
3529 \global\evenfootline={\hfil}
3530 \global\oddfootline={\hfil}
3531 \global\evenheadline={\line{\folio\hfil\thistitle}}
3532 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3533 \global\let\contentsalignmacro = \chapoddpage
3534 }
3535
3536 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3537 \def\HEADINGSsinglex{%
3538 \global\evenfootline={\hfil}
3539 \global\oddfootline={\hfil}
3540 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3541 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3542 \global\let\contentsalignmacro = \chappager
3543 }
3544
3545 % Subroutines used in generating headings
3546 % This produces Day Month Year style of output.
3547 % Only define if not already defined, in case a txi-??.tex file has set
3548 % up a different format (e.g., txi-cs.tex does this).
3549 \ifx\today\thisisundefined
3550 \def\today{%
3551 \number\day\space
3552 \ifcase\month
3553 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3554 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3555 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3556 \fi
3557 \space\number\year}
3558 \fi
3559
3560 % @settitle line... specifies the title of the document, for headings.
3561 % It generates no output of its own.
3562 \def\thistitle{\putwordNoTitle}
3563 \def\settitle{\parsearg{\gdef\thistitle}}
3564
3565
3566 \message{tables,}
3567 % Tables -- @table, @ftable, @vtable, @item(x).
3568
3569 % default indentation of table text
3570 \newdimen\tableindent \tableindent=.8in
3571 % default indentation of @itemize and @enumerate text
3572 \newdimen\itemindent \itemindent=.3in
3573 % margin between end of table item and start of table text.
3574 \newdimen\itemmargin \itemmargin=.1in
3575
3576 % used internally for \itemindent minus \itemmargin
3577 \newdimen\itemmax
3578
3579 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3580 % these defs.
3581 % They also define \itemindex
3582 % to index the item name in whatever manner is desired (perhaps none).
3583
3584 \newif\ifitemxneedsnegativevskip
3585
3586 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3587
3588 \def\internalBitem{\smallbreak \parsearg\itemzzz}
3589 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
3590
3591 \def\itemzzz #1{\begingroup %
3592 \advance\hsize by -\rightskip
3593 \advance\hsize by -\tableindent
3594 \setbox0=\hbox{\itemindicate{#1}}%
3595 \itemindex{#1}%
3596 \nobreak % This prevents a break before @itemx.
3597 %
3598 % If the item text does not fit in the space we have, put it on a line
3599 % by itself, and do not allow a page break either before or after that
3600 % line. We do not start a paragraph here because then if the next
3601 % command is, e.g., @kindex, the whatsit would get put into the
3602 % horizontal list on a line by itself, resulting in extra blank space.
3603 \ifdim \wd0>\itemmax
3604 %
3605 % Make this a paragraph so we get the \parskip glue and wrapping,
3606 % but leave it ragged-right.
3607 \begingroup
3608 \advance\leftskip by-\tableindent
3609 \advance\hsize by\tableindent
3610 \advance\rightskip by0pt plus1fil\relax
3611 \leavevmode\unhbox0\par
3612 \endgroup
3613 %
3614 % We're going to be starting a paragraph, but we don't want the
3615 % \parskip glue -- logically it's part of the @item we just started.
3616 \nobreak \vskip-\parskip
3617 %
3618 % Stop a page break at the \parskip glue coming up. However, if
3619 % what follows is an environment such as @example, there will be no
3620 % \parskip glue; then the negative vskip we just inserted would
3621 % cause the example and the item to crash together. So we use this
3622 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3623 % \parskip glue after all. Section titles are handled this way also.
3624 %
3625 \penalty 10001
3626 \endgroup
3627 \itemxneedsnegativevskipfalse
3628 \else
3629 % The item text fits into the space. Start a paragraph, so that the
3630 % following text (if any) will end up on the same line.
3631 \noindent
3632 % Do this with kerns and \unhbox so that if there is a footnote in
3633 % the item text, it can migrate to the main vertical list and
3634 % eventually be printed.
3635 \nobreak\kern-\tableindent
3636 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3637 \unhbox0
3638 \nobreak\kern\dimen0
3639 \endgroup
3640 \itemxneedsnegativevskiptrue
3641 \fi
3642 }
3643
3644 \def\item{\errmessage{@item while not in a list environment}}
3645 \def\itemx{\errmessage{@itemx while not in a list environment}}
3646
3647 % @table, @ftable, @vtable.
3648 \envdef\table{%
3649 \let\itemindex\gobble
3650 \tablecheck{table}%
3651 }
3652 \envdef\ftable{%
3653 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3654 \tablecheck{ftable}%
3655 }
3656 \envdef\vtable{%
3657 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3658 \tablecheck{vtable}%
3659 }
3660 \def\tablecheck#1{%
3661 \ifnum \the\catcode`\^^M=\active
3662 \endgroup
3663 \errmessage{This command won't work in this context; perhaps the problem is
3664 that we are \inenvironment\thisenv}%
3665 \def\next{\doignore{#1}}%
3666 \else
3667 \let\next\tablex
3668 \fi
3669 \next
3670 }
3671 \def\tablex#1{%
3672 \def\itemindicate{#1}%
3673 \parsearg\tabley
3674 }
3675 \def\tabley#1{%
3676 {%
3677 \makevalueexpandable
3678 \edef\temp{\noexpand\tablez #1\space\space\space}%
3679 \expandafter
3680 }\temp \endtablez
3681 }
3682 \def\tablez #1 #2 #3 #4\endtablez{%
3683 \aboveenvbreak
3684 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3685 \ifnum 0#2>0 \tableindent=#2\mil \fi
3686 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3687 \itemmax=\tableindent
3688 \advance \itemmax by -\itemmargin
3689 \advance \leftskip by \tableindent
3690 \exdentamount=\tableindent
3691 \parindent = 0pt
3692 \parskip = \smallskipamount
3693 \ifdim \parskip=0pt \parskip=2pt \fi
3694 \let\item = \internalBitem
3695 \let\itemx = \internalBitemx
3696 }
3697 \def\Etable{\endgraf\afterenvbreak}
3698 \let\Eftable\Etable
3699 \let\Evtable\Etable
3700 \let\Eitemize\Etable
3701 \let\Eenumerate\Etable
3702
3703 % This is the counter used by @enumerate, which is really @itemize
3704
3705 \newcount \itemno
3706
3707 \envdef\itemize{\parsearg\doitemize}
3708
3709 \def\doitemize#1{%
3710 \aboveenvbreak
3711 \itemmax=\itemindent
3712 \advance\itemmax by -\itemmargin
3713 \advance\leftskip by \itemindent
3714 \exdentamount=\itemindent
3715 \parindent=0pt
3716 \parskip=\smallskipamount
3717 \ifdim\parskip=0pt \parskip=2pt \fi
3718 %
3719 % Try typesetting the item mark so that if the document erroneously says
3720 % something like @itemize @samp (intending @table), there's an error
3721 % right away at the @itemize. It's not the best error message in the
3722 % world, but it's better than leaving it to the @item. This means if
3723 % the user wants an empty mark, they have to say @w{} not just @w.
3724 \def\itemcontents{#1}%
3725 \setbox0 = \hbox{\itemcontents}%
3726 %
3727 % @itemize with no arg is equivalent to @itemize @bullet.
3728 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3729 %
3730 \let\item=\itemizeitem
3731 }
3732
3733 % Definition of @item while inside @itemize and @enumerate.
3734 %
3735 \def\itemizeitem{%
3736 \advance\itemno by 1 % for enumerations
3737 {\let\par=\endgraf \smallbreak}% reasonable place to break
3738 {%
3739 % If the document has an @itemize directly after a section title, a
3740 % \nobreak will be last on the list, and \sectionheading will have
3741 % done a \vskip-\parskip. In that case, we don't want to zero
3742 % parskip, or the item text will crash with the heading. On the
3743 % other hand, when there is normal text preceding the item (as there
3744 % usually is), we do want to zero parskip, or there would be too much
3745 % space. In that case, we won't have a \nobreak before. At least
3746 % that's the theory.
3747 \ifnum\lastpenalty<10000 \parskip=0in \fi
3748 \noindent
3749 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3750 %
3751 \ifinner\else
3752 \vadjust{\penalty 1200}% not good to break after first line of item.
3753 \fi
3754 % We can be in inner vertical mode in a footnote, although an
3755 % @itemize looks awful there.
3756 }%
3757 \flushcr
3758 }
3759
3760 % \splitoff TOKENS\endmark defines \first to be the first token in
3761 % TOKENS, and \rest to be the remainder.
3762 %
3763 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3764
3765 % Allow an optional argument of an uppercase letter, lowercase letter,
3766 % or number, to specify the first label in the enumerated list. No
3767 % argument is the same as `1'.
3768 %
3769 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
3770 \def\enumeratey #1 #2\endenumeratey{%
3771 % If we were given no argument, pretend we were given `1'.
3772 \def\thearg{#1}%
3773 \ifx\thearg\empty \def\thearg{1}\fi
3774 %
3775 % Detect if the argument is a single token. If so, it might be a
3776 % letter. Otherwise, the only valid thing it can be is a number.
3777 % (We will always have one token, because of the test we just made.
3778 % This is a good thing, since \splitoff doesn't work given nothing at
3779 % all -- the first parameter is undelimited.)
3780 \expandafter\splitoff\thearg\endmark
3781 \ifx\rest\empty
3782 % Only one token in the argument. It could still be anything.
3783 % A ``lowercase letter'' is one whose \lccode is nonzero.
3784 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3785 % not equal to itself.
3786 % Otherwise, we assume it's a number.
3787 %
3788 % We need the \relax at the end of the \ifnum lines to stop TeX from
3789 % continuing to look for a <number>.
3790 %
3791 \ifnum\lccode\expandafter`\thearg=0\relax
3792 \numericenumerate % a number (we hope)
3793 \else
3794 % It's a letter.
3795 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3796 \lowercaseenumerate % lowercase letter
3797 \else
3798 \uppercaseenumerate % uppercase letter
3799 \fi
3800 \fi
3801 \else
3802 % Multiple tokens in the argument. We hope it's a number.
3803 \numericenumerate
3804 \fi
3805 }
3806
3807 % An @enumerate whose labels are integers. The starting integer is
3808 % given in \thearg.
3809 %
3810 \def\numericenumerate{%
3811 \itemno = \thearg
3812 \startenumeration{\the\itemno}%
3813 }
3814
3815 % The starting (lowercase) letter is in \thearg.
3816 \def\lowercaseenumerate{%
3817 \itemno = \expandafter`\thearg
3818 \startenumeration{%
3819 % Be sure we're not beyond the end of the alphabet.
3820 \ifnum\itemno=0
3821 \errmessage{No more lowercase letters in @enumerate; get a bigger
3822 alphabet}%
3823 \fi
3824 \char\lccode\itemno
3825 }%
3826 }
3827
3828 % The starting (uppercase) letter is in \thearg.
3829 \def\uppercaseenumerate{%
3830 \itemno = \expandafter`\thearg
3831 \startenumeration{%
3832 % Be sure we're not beyond the end of the alphabet.
3833 \ifnum\itemno=0
3834 \errmessage{No more uppercase letters in @enumerate; get a bigger
3835 alphabet}
3836 \fi
3837 \char\uccode\itemno
3838 }%
3839 }
3840
3841 % Call \doitemize, adding a period to the first argument and supplying the
3842 % common last two arguments. Also subtract one from the initial value in
3843 % \itemno, since @item increments \itemno.
3844 %
3845 \def\startenumeration#1{%
3846 \advance\itemno by -1
3847 \doitemize{#1.}\flushcr
3848 }
3849
3850 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3851 % to @enumerate.
3852 %
3853 \def\alphaenumerate{\enumerate{a}}
3854 \def\capsenumerate{\enumerate{A}}
3855 \def\Ealphaenumerate{\Eenumerate}
3856 \def\Ecapsenumerate{\Eenumerate}
3857
3858
3859 % @multitable macros
3860 % Amy Hendrickson, 8/18/94, 3/6/96
3861 %
3862 % @multitable ... @end multitable will make as many columns as desired.
3863 % Contents of each column will wrap at width given in preamble. Width
3864 % can be specified either with sample text given in a template line,
3865 % or in percent of \hsize, the current width of text on page.
3866
3867 % Table can continue over pages but will only break between lines.
3868
3869 % To make preamble:
3870 %
3871 % Either define widths of columns in terms of percent of \hsize:
3872 % @multitable @columnfractions .25 .3 .45
3873 % @item ...
3874 %
3875 % Numbers following @columnfractions are the percent of the total
3876 % current hsize to be used for each column. You may use as many
3877 % columns as desired.
3878
3879
3880 % Or use a template:
3881 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3882 % @item ...
3883 % using the widest term desired in each column.
3884
3885 % Each new table line starts with @item, each subsequent new column
3886 % starts with @tab. Empty columns may be produced by supplying @tab's
3887 % with nothing between them for as many times as empty columns are needed,
3888 % ie, @tab@tab@tab will produce two empty columns.
3889
3890 % @item, @tab do not need to be on their own lines, but it will not hurt
3891 % if they are.
3892
3893 % Sample multitable:
3894
3895 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3896 % @item first col stuff @tab second col stuff @tab third col
3897 % @item
3898 % first col stuff
3899 % @tab
3900 % second col stuff
3901 % @tab
3902 % third col
3903 % @item first col stuff @tab second col stuff
3904 % @tab Many paragraphs of text may be used in any column.
3905 %
3906 % They will wrap at the width determined by the template.
3907 % @item@tab@tab This will be in third column.
3908 % @end multitable
3909
3910 % Default dimensions may be reset by user.
3911 % @multitableparskip is vertical space between paragraphs in table.
3912 % @multitableparindent is paragraph indent in table.
3913 % @multitablecolmargin is horizontal space to be left between columns.
3914 % @multitablelinespace is space to leave between table items, baseline
3915 % to baseline.
3916 % 0pt means it depends on current normal line spacing.
3917 %
3918 \newskip\multitableparskip
3919 \newskip\multitableparindent
3920 \newdimen\multitablecolspace
3921 \newskip\multitablelinespace
3922 \multitableparskip=0pt
3923 \multitableparindent=6pt
3924 \multitablecolspace=12pt
3925 \multitablelinespace=0pt
3926
3927 % Macros used to set up halign preamble:
3928 %
3929 \let\endsetuptable\relax
3930 \def\xendsetuptable{\endsetuptable}
3931 \let\columnfractions\relax
3932 \def\xcolumnfractions{\columnfractions}
3933 \newif\ifsetpercent
3934
3935 % #1 is the @columnfraction, usually a decimal number like .5, but might
3936 % be just 1. We just use it, whatever it is.
3937 %
3938 \def\pickupwholefraction#1 {%
3939 \global\advance\colcount by 1
3940 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3941 \setuptable
3942 }
3943
3944 \newcount\colcount
3945 \def\setuptable#1{%
3946 \def\firstarg{#1}%
3947 \ifx\firstarg\xendsetuptable
3948 \let\go = \relax
3949 \else
3950 \ifx\firstarg\xcolumnfractions
3951 \global\setpercenttrue
3952 \else
3953 \ifsetpercent
3954 \let\go\pickupwholefraction
3955 \else
3956 \global\advance\colcount by 1
3957 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3958 % separator; typically that is always in the input, anyway.
3959 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3960 \fi
3961 \fi
3962 \ifx\go\pickupwholefraction
3963 % Put the argument back for the \pickupwholefraction call, so
3964 % we'll always have a period there to be parsed.
3965 \def\go{\pickupwholefraction#1}%
3966 \else
3967 \let\go = \setuptable
3968 \fi%
3969 \fi
3970 \go
3971 }
3972
3973 % multitable-only commands.
3974 %
3975 % @headitem starts a heading row, which we typeset in bold. Assignments
3976 % have to be global since we are inside the implicit group of an
3977 % alignment entry. \everycr below resets \everytab so we don't have to
3978 % undo it ourselves.
3979 \def\headitemfont{\b}% for people to use in the template row; not changeable
3980 \def\headitem{%
3981 \checkenv\multitable
3982 \crcr
3983 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
3984 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
3985 \the\everytab % for the first item
3986 }%
3987 %
3988 % default for tables with no headings.
3989 \let\headitemcrhook=\relax
3990 %
3991 % A \tab used to include \hskip1sp. But then the space in a template
3992 % line is not enough. That is bad. So let's go back to just `&' until
3993 % we again encounter the problem the 1sp was intended to solve.
3994 % --karl, nathan@acm.org, 20apr99.
3995 \def\tab{\checkenv\multitable &\the\everytab}%
3996
3997 % @multitable ... @end multitable definitions:
3998 %
3999 \newtoks\everytab % insert after every tab.
4000 %
4001 \envdef\multitable{%
4002 \vskip\parskip
4003 \startsavinginserts
4004 %
4005 % @item within a multitable starts a normal row.
4006 % We use \def instead of \let so that if one of the multitable entries
4007 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4008 % \endtemplate) expanding \doitemize.
4009 \def\item{\crcr}%
4010 %
4011 \tolerance=9500
4012 \hbadness=9500
4013 \setmultitablespacing
4014 \parskip=\multitableparskip
4015 \parindent=\multitableparindent
4016 \overfullrule=0pt
4017 \global\colcount=0
4018 %
4019 \everycr = {%
4020 \noalign{%
4021 \global\everytab={}% Reset from possible headitem.
4022 \global\colcount=0 % Reset the column counter.
4023 %
4024 % Check for saved footnotes, etc.:
4025 \checkinserts
4026 %
4027 % Perhaps a \nobreak, then reset:
4028 \headitemcrhook
4029 \global\let\headitemcrhook=\relax
4030 }%
4031 }%
4032 %
4033 \parsearg\domultitable
4034 }
4035 \def\domultitable#1{%
4036 % To parse everything between @multitable and @item:
4037 \setuptable#1 \endsetuptable
4038 %
4039 % This preamble sets up a generic column definition, which will
4040 % be used as many times as user calls for columns.
4041 % \vtop will set a single line and will also let text wrap and
4042 % continue for many paragraphs if desired.
4043 \halign\bgroup &%
4044 \global\advance\colcount by 1
4045 \multistrut
4046 \vtop{%
4047 % Use the current \colcount to find the correct column width:
4048 \hsize=\expandafter\csname col\the\colcount\endcsname
4049 %
4050 % In order to keep entries from bumping into each other
4051 % we will add a \leftskip of \multitablecolspace to all columns after
4052 % the first one.
4053 %
4054 % If a template has been used, we will add \multitablecolspace
4055 % to the width of each template entry.
4056 %
4057 % If the user has set preamble in terms of percent of \hsize we will
4058 % use that dimension as the width of the column, and the \leftskip
4059 % will keep entries from bumping into each other. Table will start at
4060 % left margin and final column will justify at right margin.
4061 %
4062 % Make sure we don't inherit \rightskip from the outer environment.
4063 \rightskip=0pt
4064 \ifnum\colcount=1
4065 % The first column will be indented with the surrounding text.
4066 \advance\hsize by\leftskip
4067 \else
4068 \ifsetpercent \else
4069 % If user has not set preamble in terms of percent of \hsize
4070 % we will advance \hsize by \multitablecolspace.
4071 \advance\hsize by \multitablecolspace
4072 \fi
4073 % In either case we will make \leftskip=\multitablecolspace:
4074 \leftskip=\multitablecolspace
4075 \fi
4076 % Ignoring space at the beginning and end avoids an occasional spurious
4077 % blank line, when TeX decides to break the line at the space before the
4078 % box from the multistrut, so the strut ends up on a line by itself.
4079 % For example:
4080 % @multitable @columnfractions .11 .89
4081 % @item @code{#}
4082 % @tab Legal holiday which is valid in major parts of the whole country.
4083 % Is automatically provided with highlighting sequences respectively
4084 % marking characters.
4085 \noindent\ignorespaces##\unskip\multistrut
4086 }\cr
4087 }
4088 \def\Emultitable{%
4089 \crcr
4090 \egroup % end the \halign
4091 \global\setpercentfalse
4092 }
4093
4094 \def\setmultitablespacing{%
4095 \def\multistrut{\strut}% just use the standard line spacing
4096 %
4097 % Compute \multitablelinespace (if not defined by user) for use in
4098 % \multitableparskip calculation. We used define \multistrut based on
4099 % this, but (ironically) that caused the spacing to be off.
4100 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4101 \ifdim\multitablelinespace=0pt
4102 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4103 \global\advance\multitablelinespace by-\ht0
4104 \fi
4105 % Test to see if parskip is larger than space between lines of
4106 % table. If not, do nothing.
4107 % If so, set to same dimension as multitablelinespace.
4108 \ifdim\multitableparskip>\multitablelinespace
4109 \global\multitableparskip=\multitablelinespace
4110 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4111 % than skip between lines in the table.
4112 \fi%
4113 \ifdim\multitableparskip=0pt
4114 \global\multitableparskip=\multitablelinespace
4115 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4116 % than skip between lines in the table.
4117 \fi}
4118
4119
4120 \message{conditionals,}
4121
4122 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4123 % @ifnotxml always succeed. They currently do nothing; we don't
4124 % attempt to check whether the conditionals are properly nested. But we
4125 % have to remember that they are conditionals, so that @end doesn't
4126 % attempt to close an environment group.
4127 %
4128 \def\makecond#1{%
4129 \expandafter\let\csname #1\endcsname = \relax
4130 \expandafter\let\csname iscond.#1\endcsname = 1
4131 }
4132 \makecond{iftex}
4133 \makecond{ifnotdocbook}
4134 \makecond{ifnothtml}
4135 \makecond{ifnotinfo}
4136 \makecond{ifnotplaintext}
4137 \makecond{ifnotxml}
4138
4139 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4140 %
4141 \def\direntry{\doignore{direntry}}
4142 \def\documentdescription{\doignore{documentdescription}}
4143 \def\docbook{\doignore{docbook}}
4144 \def\html{\doignore{html}}
4145 \def\ifdocbook{\doignore{ifdocbook}}
4146 \def\ifhtml{\doignore{ifhtml}}
4147 \def\ifinfo{\doignore{ifinfo}}
4148 \def\ifnottex{\doignore{ifnottex}}
4149 \def\ifplaintext{\doignore{ifplaintext}}
4150 \def\ifxml{\doignore{ifxml}}
4151 \def\ignore{\doignore{ignore}}
4152 \def\menu{\doignore{menu}}
4153 \def\xml{\doignore{xml}}
4154
4155 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4156 %
4157 % A count to remember the depth of nesting.
4158 \newcount\doignorecount
4159
4160 \def\doignore#1{\begingroup
4161 % Scan in ``verbatim'' mode:
4162 \obeylines
4163 \catcode`\@ = \other
4164 \catcode`\{ = \other
4165 \catcode`\} = \other
4166 %
4167 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4168 \spaceisspace
4169 %
4170 % Count number of #1's that we've seen.
4171 \doignorecount = 0
4172 %
4173 % Swallow text until we reach the matching `@end #1'.
4174 \dodoignore{#1}%
4175 }
4176
4177 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4178 \obeylines %
4179 %
4180 \gdef\dodoignore#1{%
4181 % #1 contains the command name as a string, e.g., `ifinfo'.
4182 %
4183 % Define a command to find the next `@end #1'.
4184 \long\def\doignoretext##1^^M@end #1{%
4185 \doignoretextyyy##1^^M@#1\_STOP_}%
4186 %
4187 % And this command to find another #1 command, at the beginning of a
4188 % line. (Otherwise, we would consider a line `@c @ifset', for
4189 % example, to count as an @ifset for nesting.)
4190 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4191 %
4192 % And now expand that command.
4193 \doignoretext ^^M%
4194 }%
4195 }
4196
4197 \def\doignoreyyy#1{%
4198 \def\temp{#1}%
4199 \ifx\temp\empty % Nothing found.
4200 \let\next\doignoretextzzz
4201 \else % Found a nested condition, ...
4202 \advance\doignorecount by 1
4203 \let\next\doignoretextyyy % ..., look for another.
4204 % If we're here, #1 ends with ^^M\ifinfo (for example).
4205 \fi
4206 \next #1% the token \_STOP_ is present just after this macro.
4207 }
4208
4209 % We have to swallow the remaining "\_STOP_".
4210 %
4211 \def\doignoretextzzz#1{%
4212 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4213 \let\next\enddoignore
4214 \else % Still inside a nested condition.
4215 \advance\doignorecount by -1
4216 \let\next\doignoretext % Look for the next @end.
4217 \fi
4218 \next
4219 }
4220
4221 % Finish off ignored text.
4222 { \obeylines%
4223 % Ignore anything after the last `@end #1'; this matters in verbatim
4224 % environments, where otherwise the newline after an ignored conditional
4225 % would result in a blank line in the output.
4226 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4227 }
4228
4229
4230 % @set VAR sets the variable VAR to an empty value.
4231 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4232 %
4233 % Since we want to separate VAR from REST-OF-LINE (which might be
4234 % empty), we can't just use \parsearg; we have to insert a space of our
4235 % own to delimit the rest of the line, and then take it out again if we
4236 % didn't need it.
4237 % We rely on the fact that \parsearg sets \catcode`\ =10.
4238 %
4239 \parseargdef\set{\setyyy#1 \endsetyyy}
4240 \def\setyyy#1 #2\endsetyyy{%
4241 {%
4242 \makevalueexpandable
4243 \def\temp{#2}%
4244 \edef\next{\gdef\makecsname{SET#1}}%
4245 \ifx\temp\empty
4246 \next{}%
4247 \else
4248 \setzzz#2\endsetzzz
4249 \fi
4250 }%
4251 }
4252 % Remove the trailing space \setxxx inserted.
4253 \def\setzzz#1 \endsetzzz{\next{#1}}
4254
4255 % @clear VAR clears (i.e., unsets) the variable VAR.
4256 %
4257 \parseargdef\clear{%
4258 {%
4259 \makevalueexpandable
4260 \global\expandafter\let\csname SET#1\endcsname=\relax
4261 }%
4262 }
4263
4264 % @value{foo} gets the text saved in variable foo.
4265 \def\value{\begingroup\makevalueexpandable\valuexxx}
4266 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4267 {
4268 \catcode`\-=\active \catcode`\_=\active
4269 %
4270 \gdef\makevalueexpandable{%
4271 \let\value = \expandablevalue
4272 % We don't want these characters active, ...
4273 \catcode`\-=\other \catcode`\_=\other
4274 % ..., but we might end up with active ones in the argument if
4275 % we're called from @code, as @code{@value{foo-bar_}}, though.
4276 % So \let them to their normal equivalents.
4277 \let-\normaldash \let_\normalunderscore
4278 }
4279 }
4280
4281 % We have this subroutine so that we can handle at least some @value's
4282 % properly in indexes (we call \makevalueexpandable in \indexdummies).
4283 % The command has to be fully expandable (if the variable is set), since
4284 % the result winds up in the index file. This means that if the
4285 % variable's value contains other Texinfo commands, it's almost certain
4286 % it will fail (although perhaps we could fix that with sufficient work
4287 % to do a one-level expansion on the result, instead of complete).
4288 %
4289 % Unfortunately, this has the consequence that when _ is in the *value*
4290 % of an @set, it does not print properly in the roman fonts (get the cmr
4291 % dot accent at position 126 instead). No fix comes to mind, and it's
4292 % been this way since 2003 or earlier, so just ignore it.
4293 %
4294 \def\expandablevalue#1{%
4295 \expandafter\ifx\csname SET#1\endcsname\relax
4296 {[No value for ``#1'']}%
4297 \message{Variable `#1', used in @value, is not set.}%
4298 \else
4299 \csname SET#1\endcsname
4300 \fi
4301 }
4302
4303 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4304 % with @set.
4305 %
4306 % To get the special treatment we need for `@end ifset,' we call
4307 % \makecond and then redefine.
4308 %
4309 \makecond{ifset}
4310 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4311 \def\doifset#1#2{%
4312 {%
4313 \makevalueexpandable
4314 \let\next=\empty
4315 \expandafter\ifx\csname SET#2\endcsname\relax
4316 #1% If not set, redefine \next.
4317 \fi
4318 \expandafter
4319 }\next
4320 }
4321 \def\ifsetfail{\doignore{ifset}}
4322
4323 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4324 % defined with @set, or has been undefined with @clear.
4325 %
4326 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4327 % above code: if the variable is not set, do nothing, if it is set,
4328 % then redefine \next to \ifclearfail.
4329 %
4330 \makecond{ifclear}
4331 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4332 \def\ifclearfail{\doignore{ifclear}}
4333
4334 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4335 % without the @) is in fact defined. We can only feasibly check at the
4336 % TeX level, so something like `mathcode' is going to considered
4337 % defined even though it is not a Texinfo command.
4338 %
4339 \makecond{ifcommanddefined}
4340 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4341 %
4342 \def\doifcmddefined#1#2{{%
4343 \makevalueexpandable
4344 \let\next=\empty
4345 \expandafter\ifx\csname #2\endcsname\relax
4346 #1% If not defined, \let\next as above.
4347 \fi
4348 \expandafter
4349 }\next
4350 }
4351 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4352
4353 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4354 \makecond{ifcommandnotdefined}
4355 \def\ifcommandnotdefined{%
4356 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4357 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4358
4359 % Set the `txicommandconditionals' variable, so documents have a way to
4360 % test if the @ifcommand...defined conditionals are available.
4361 \set txicommandconditionals
4362
4363 % @dircategory CATEGORY -- specify a category of the dir file
4364 % which this file should belong to. Ignore this in TeX.
4365 \let\dircategory=\comment
4366
4367 % @defininfoenclose.
4368 \let\definfoenclose=\comment
4369
4370
4371 \message{indexing,}
4372 % Index generation facilities
4373
4374 % Define \newwrite to be identical to plain tex's \newwrite
4375 % except not \outer, so it can be used within macros and \if's.
4376 \edef\newwrite{\makecsname{ptexnewwrite}}
4377
4378 % \newindex {foo} defines an index named IX.
4379 % It automatically defines \IXindex such that
4380 % \IXindex ...rest of line... puts an entry in the index IX.
4381 % It also defines \IXindfile to be the number of the output channel for
4382 % the file that accumulates this index. The file's extension is IX.
4383 % The name of an index should be no more than 2 characters long
4384 % for the sake of vms.
4385 %
4386 \def\newindex#1{%
4387 \expandafter\chardef\csname#1indfile\endcsname=0
4388 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4389 \noexpand\doindex{#1}}
4390 }
4391
4392 % @defindex foo == \newindex{foo}
4393 %
4394 \def\defindex{\parsearg\newindex}
4395
4396 % Define @defcodeindex, like @defindex except put all entries in @code.
4397 %
4398 \def\defcodeindex{\parsearg\newcodeindex}
4399 %
4400 \def\newcodeindex#1{%
4401 \expandafter\chardef\csname#1indfile\endcsname=0
4402 \expandafter\xdef\csname#1index\endcsname{%
4403 \noexpand\docodeindex{#1}}%
4404 }
4405
4406 % The default indices:
4407 \newindex{cp}% concepts,
4408 \newcodeindex{fn}% functions,
4409 \newcodeindex{vr}% variables,
4410 \newcodeindex{tp}% types,
4411 \newcodeindex{ky}% keys
4412 \newcodeindex{pg}% and programs.
4413
4414
4415 % @synindex foo bar makes index foo feed into index bar.
4416 % Do this instead of @defindex foo if you don't want it as a separate index.
4417 %
4418 % @syncodeindex foo bar similar, but put all entries made for index foo
4419 % inside @code.
4420 %
4421 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4422 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4423
4424 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4425 % #3 the target index (bar).
4426 \def\dosynindex#1#2#3{%
4427 % Only do \closeout if we haven't already done it, else we'll end up
4428 % closing the target index.
4429 \expandafter \ifx\csname donesynindex#2\endcsname \relax
4430 % The \closeout helps reduce unnecessary open files; the limit on the
4431 % Acorn RISC OS is a mere 16 files.
4432 \expandafter\closeout\csname#2indfile\endcsname
4433 \expandafter\let\csname donesynindex#2\endcsname = 1
4434 \fi
4435 % redefine \fooindfile:
4436 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4437 \expandafter\let\csname#2indfile\endcsname=\temp
4438 % redefine \fooindex:
4439 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4440 }
4441
4442 % Define \doindex, the driver for all index macros.
4443 % Argument #1 is generated by the calling \fooindex macro,
4444 % and it the two-letter name of the index.
4445
4446 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4447 \def\doindexxxx #1{\doind{\indexname}{#1}}
4448
4449 % like the previous two, but they put @code around the argument.
4450 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4451 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
4452
4453 % Used when writing an index entry out to an index file, to prevent
4454 % expansion of Texinfo commands that can appear in an index entry.
4455 %
4456 \def\indexdummies{%
4457 \escapechar = `\\ % use backslash in output files.
4458 \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4459 \def\ {\realbackslash\space }%
4460 %
4461 % Need these unexpandable (because we define \tt as a dummy)
4462 % definitions when @{ or @} appear in index entry text. Also, more
4463 % complicated, when \tex is in effect and \{ is a \delimiter again.
4464 % We can't use \lbracecmd and \rbracecmd because texindex assumes
4465 % braces and backslashes are used only as delimiters. Perhaps we
4466 % should use @lbracechar and @rbracechar?
4467 \def\{{{\tt\char123}}%
4468 \def\}{{\tt\char125}}%
4469 %
4470 % Do the redefinitions.
4471 \commondummies
4472 }
4473
4474 % For the aux and toc files, @ is the escape character. So we want to
4475 % redefine everything using @ as the escape character (instead of
4476 % \realbackslash, still used for index files). When everything uses @,
4477 % this will be simpler.
4478 %
4479 \def\atdummies{%
4480 \def\@{@@}%
4481 \def\ {@ }%
4482 \let\{ = \lbraceatcmd
4483 \let\} = \rbraceatcmd
4484 %
4485 % Do the redefinitions.
4486 \commondummies
4487 \otherbackslash
4488 }
4489
4490 % Called from \indexdummies and \atdummies.
4491 %
4492 \def\commondummies{%
4493 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4494 % preventing its expansion. This is used only for control words,
4495 % not control letters, because the \space would be incorrect for
4496 % control characters, but is needed to separate the control word
4497 % from whatever follows.
4498 %
4499 % For control letters, we have \definedummyletter, which omits the
4500 % space.
4501 %
4502 % These can be used both for control words that take an argument and
4503 % those that do not. If it is followed by {arg} in the input, then
4504 % that will dutifully get written to the index (or wherever).
4505 %
4506 \def\definedummyword ##1{\def##1{\string##1\space}}%
4507 \def\definedummyletter##1{\def##1{\string##1}}%
4508 \let\definedummyaccent\definedummyletter
4509 %
4510 \commondummiesnofonts
4511 %
4512 \definedummyletter\_%
4513 \definedummyletter\-%
4514 %
4515 % Non-English letters.
4516 \definedummyword\AA
4517 \definedummyword\AE
4518 \definedummyword\DH
4519 \definedummyword\L
4520 \definedummyword\O
4521 \definedummyword\OE
4522 \definedummyword\TH
4523 \definedummyword\aa
4524 \definedummyword\ae
4525 \definedummyword\dh
4526 \definedummyword\exclamdown
4527 \definedummyword\l
4528 \definedummyword\o
4529 \definedummyword\oe
4530 \definedummyword\ordf
4531 \definedummyword\ordm
4532 \definedummyword\questiondown
4533 \definedummyword\ss
4534 \definedummyword\th
4535 %
4536 % Although these internal commands shouldn't show up, sometimes they do.
4537 \definedummyword\bf
4538 \definedummyword\gtr
4539 \definedummyword\hat
4540 \definedummyword\less
4541 \definedummyword\sf
4542 \definedummyword\sl
4543 \definedummyword\tclose
4544 \definedummyword\tt
4545 %
4546 \definedummyword\LaTeX
4547 \definedummyword\TeX
4548 %
4549 % Assorted special characters.
4550 \definedummyword\arrow
4551 \definedummyword\bullet
4552 \definedummyword\comma
4553 \definedummyword\copyright
4554 \definedummyword\registeredsymbol
4555 \definedummyword\dots
4556 \definedummyword\enddots
4557 \definedummyword\entrybreak
4558 \definedummyword\equiv
4559 \definedummyword\error
4560 \definedummyword\euro
4561 \definedummyword\expansion
4562 \definedummyword\geq
4563 \definedummyword\guillemetleft
4564 \definedummyword\guillemetright
4565 \definedummyword\guilsinglleft
4566 \definedummyword\guilsinglright
4567 \definedummyword\lbracechar
4568 \definedummyword\leq
4569 \definedummyword\mathopsup
4570 \definedummyword\minus
4571 \definedummyword\ogonek
4572 \definedummyword\pounds
4573 \definedummyword\point
4574 \definedummyword\print
4575 \definedummyword\quotedblbase
4576 \definedummyword\quotedblleft
4577 \definedummyword\quotedblright
4578 \definedummyword\quoteleft
4579 \definedummyword\quoteright
4580 \definedummyword\quotesinglbase
4581 \definedummyword\rbracechar
4582 \definedummyword\result
4583 \definedummyword\sub
4584 \definedummyword\sup
4585 \definedummyword\textdegree
4586 %
4587 % We want to disable all macros so that they are not expanded by \write.
4588 \macrolist
4589 %
4590 \normalturnoffactive
4591 %
4592 % Handle some cases of @value -- where it does not contain any
4593 % (non-fully-expandable) commands.
4594 \makevalueexpandable
4595 }
4596
4597 % \commondummiesnofonts: common to \commondummies and \indexnofonts.
4598 % Define \definedumyletter, \definedummyaccent and \definedummyword before
4599 % using.
4600 %
4601 \def\commondummiesnofonts{%
4602 % Control letters and accents.
4603 \definedummyletter\!%
4604 \definedummyaccent\"%
4605 \definedummyaccent\'%
4606 \definedummyletter\*%
4607 \definedummyaccent\,%
4608 \definedummyletter\.%
4609 \definedummyletter\/%
4610 \definedummyletter\:%
4611 \definedummyaccent\=%
4612 \definedummyletter\?%
4613 \definedummyaccent\^%
4614 \definedummyaccent\`%
4615 \definedummyaccent\~%
4616 \definedummyword\u
4617 \definedummyword\v
4618 \definedummyword\H
4619 \definedummyword\dotaccent
4620 \definedummyword\ogonek
4621 \definedummyword\ringaccent
4622 \definedummyword\tieaccent
4623 \definedummyword\ubaraccent
4624 \definedummyword\udotaccent
4625 \definedummyword\dotless
4626 %
4627 % Texinfo font commands.
4628 \definedummyword\b
4629 \definedummyword\i
4630 \definedummyword\r
4631 \definedummyword\sansserif
4632 \definedummyword\sc
4633 \definedummyword\slanted
4634 \definedummyword\t
4635 %
4636 % Commands that take arguments.
4637 \definedummyword\abbr
4638 \definedummyword\acronym
4639 \definedummyword\anchor
4640 \definedummyword\cite
4641 \definedummyword\code
4642 \definedummyword\command
4643 \definedummyword\dfn
4644 \definedummyword\dmn
4645 \definedummyword\email
4646 \definedummyword\emph
4647 \definedummyword\env
4648 \definedummyword\file
4649 \definedummyword\image
4650 \definedummyword\indicateurl
4651 \definedummyword\inforef
4652 \definedummyword\kbd
4653 \definedummyword\key
4654 \definedummyword\math
4655 \definedummyword\option
4656 \definedummyword\pxref
4657 \definedummyword\ref
4658 \definedummyword\samp
4659 \definedummyword\strong
4660 \definedummyword\tie
4661 \definedummyword\U
4662 \definedummyword\uref
4663 \definedummyword\url
4664 \definedummyword\var
4665 \definedummyword\verb
4666 \definedummyword\w
4667 \definedummyword\xref
4668 }
4669
4670 % For testing: output @{ and @} in index sort strings as \{ and \}.
4671 \newif\ifusebracesinindexes
4672
4673 \let\indexlbrace\relax
4674 \let\indexrbrace\relax
4675
4676 {\catcode`\@=0
4677 \catcode`\\=13
4678 @gdef@backslashdisappear{@def\{}}
4679 }
4680
4681 {
4682 \catcode`\<=13
4683 \catcode`\-=13
4684 \catcode`\`=13
4685 \gdef\indexnonalnumdisappear{%
4686 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
4687 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
4688 % (Introduced for FSFS 2nd ed.)
4689 \let`=\empty
4690 \fi
4691 %
4692 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
4693 \backslashdisappear
4694 \fi
4695 %
4696 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
4697 \def-{}%
4698 \fi
4699 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
4700 \def<{}%
4701 \fi
4702 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
4703 \def\@{}%
4704 \fi
4705 }
4706
4707 \gdef\indexnonalnumreappear{%
4708 \useindexbackslash
4709 \let-\normaldash
4710 \let<\normalless
4711 \def\@{@}%
4712 }
4713 }
4714
4715
4716 % \indexnofonts is used when outputting the strings to sort the index
4717 % by, and when constructing control sequence names. It eliminates all
4718 % control sequences and just writes whatever the best ASCII sort string
4719 % would be for a given command (usually its argument).
4720 %
4721 \def\indexnofonts{%
4722 % Accent commands should become @asis.
4723 \def\definedummyaccent##1{\let##1\asis}%
4724 % We can just ignore other control letters.
4725 \def\definedummyletter##1{\let##1\empty}%
4726 % All control words become @asis by default; overrides below.
4727 \let\definedummyword\definedummyaccent
4728 \commondummiesnofonts
4729 %
4730 % Don't no-op \tt, since it isn't a user-level command
4731 % and is used in the definitions of the active chars like <, >, |, etc.
4732 % Likewise with the other plain tex font commands.
4733 %\let\tt=\asis
4734 %
4735 \def\ { }%
4736 \def\@{@}%
4737 \def\_{\normalunderscore}%
4738 \def\-{}% @- shouldn't affect sorting
4739 %
4740 \uccode`\1=`\{ \uppercase{\def\{{1}}%
4741 \uccode`\1=`\} \uppercase{\def\}{1}}%
4742 \let\lbracechar\{
4743 \let\rbracechar\}
4744 %
4745 % Non-English letters.
4746 \def\AA{AA}%
4747 \def\AE{AE}%
4748 \def\DH{DZZ}%
4749 \def\L{L}%
4750 \def\OE{OE}%
4751 \def\O{O}%
4752 \def\TH{TH}%
4753 \def\aa{aa}%
4754 \def\ae{ae}%
4755 \def\dh{dzz}%
4756 \def\exclamdown{!}%
4757 \def\l{l}%
4758 \def\oe{oe}%
4759 \def\ordf{a}%
4760 \def\ordm{o}%
4761 \def\o{o}%
4762 \def\questiondown{?}%
4763 \def\ss{ss}%
4764 \def\th{th}%
4765 %
4766 \def\LaTeX{LaTeX}%
4767 \def\TeX{TeX}%
4768 %
4769 % Assorted special characters.
4770 % (The following {} will end up in the sort string, but that's ok.)
4771 \def\arrow{->}%
4772 \def\bullet{bullet}%
4773 \def\comma{,}%
4774 \def\copyright{copyright}%
4775 \def\dots{...}%
4776 \def\enddots{...}%
4777 \def\equiv{==}%
4778 \def\error{error}%
4779 \def\euro{euro}%
4780 \def\expansion{==>}%
4781 \def\geq{>=}%
4782 \def\guillemetleft{<<}%
4783 \def\guillemetright{>>}%
4784 \def\guilsinglleft{<}%
4785 \def\guilsinglright{>}%
4786 \def\leq{<=}%
4787 \def\minus{-}%
4788 \def\point{.}%
4789 \def\pounds{pounds}%
4790 \def\print{-|}%
4791 \def\quotedblbase{"}%
4792 \def\quotedblleft{"}%
4793 \def\quotedblright{"}%
4794 \def\quoteleft{`}%
4795 \def\quoteright{'}%
4796 \def\quotesinglbase{,}%
4797 \def\registeredsymbol{R}%
4798 \def\result{=>}%
4799 \def\textdegree{o}%
4800 %
4801 % We need to get rid of all macros, leaving only the arguments (if present).
4802 % Of course this is not nearly correct, but it is the best we can do for now.
4803 % makeinfo does not expand macros in the argument to @deffn, which ends up
4804 % writing an index entry, and texindex isn't prepared for an index sort entry
4805 % that starts with \.
4806 %
4807 % Since macro invocations are followed by braces, we can just redefine them
4808 % to take a single TeX argument. The case of a macro invocation that
4809 % goes to end-of-line is not handled.
4810 %
4811 \macrolist
4812 }
4813
4814
4815 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4816
4817 % Most index entries go through here, but \dosubind is the general case.
4818 % #1 is the index name, #2 is the entry text.
4819 \def\doind#1#2{\dosubind{#1}{#2}{}}
4820
4821 % There is also \dosubind {index}{topic}{subtopic}
4822 % which makes an entry in a two-level index such as the operation index.
4823 % TODO: Two-level index? Operation index?
4824
4825 % Workhorse for all indexes.
4826 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
4827 % empty if called from \doind, as we usually are (the main exception
4828 % is with most defuns, which call us directly).
4829 %
4830 \def\dosubind#1#2#3{%
4831 \iflinks
4832 {%
4833 \requireopenindexfile{#1}%
4834 % Store the main index entry text (including the third arg).
4835 \toks0 = {#2}%
4836 % If third arg is present, precede it with a space.
4837 \def\thirdarg{#3}%
4838 \ifx\thirdarg\empty \else
4839 \toks0 = \expandafter{\the\toks0 \space #3}%
4840 \fi
4841 %
4842 \edef\writeto{\csname#1indfile\endcsname}%
4843 %
4844 \safewhatsit\dosubindwrite
4845 }%
4846 \fi
4847 }
4848
4849 % Check if an index file has been opened, and if not, open it.
4850 \def\requireopenindexfile#1{%
4851 \ifnum\csname #1indfile\endcsname=0
4852 \expandafter\newwrite \csname#1indfile\endcsname
4853 \edef\suffix{#1}%
4854 % A .fls suffix would conflict with the file extension for the output
4855 % of -recorder, so use .f1s instead.
4856 \ifx\suffix\indexisfl\def\suffix{f1}\fi
4857 % Open the file
4858 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
4859 % Using \immediate here prevents an object entering into the current box,
4860 % which could confound checks such as those in \safewhatsit for preceding
4861 % skips.
4862 \fi}
4863 \def\indexisfl{fl}
4864
4865 % Output \ as {\indexbackslash}, because \ is an escape character in
4866 % the index files.
4867 \let\indexbackslash=\relax
4868 {\catcode`\@=0 \catcode`\\=\active
4869 @gdef@useindexbackslash{@def\{{@indexbackslash}}}
4870 }
4871
4872 % Definition for writing index entry text.
4873 \def\sortas#1{\ignorespaces}%
4874
4875 % Definition for writing index entry sort key. Should occur at the at
4876 % the beginning of the index entry, like
4877 % @cindex @sortas{september} \september
4878 % The \ignorespaces takes care of following space, but there's no way
4879 % to remove space before it.
4880 {
4881 \catcode`\-=13
4882 \gdef\indexwritesortas{%
4883 \begingroup
4884 \indexnonalnumreappear
4885 \indexwritesortasxxx}
4886 \gdef\indexwritesortasxxx#1{%
4887 \xdef\indexsortkey{#1}\endgroup}
4888 }
4889
4890
4891 % Write the entry in \toks0 to the index file.
4892 %
4893 \def\dosubindwrite{%
4894 % Put the index entry in the margin if desired.
4895 \ifx\SETmarginindex\relax\else
4896 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
4897 \fi
4898 %
4899 % Remember, we are within a group.
4900 \indexdummies % Must do this here, since \bf, etc expand at this stage
4901 \useindexbackslash % \indexbackslash isn't defined now so it will be output
4902 % as is; and it will print as backslash.
4903 % The braces around \indexbrace are recognized by texindex.
4904 %
4905 % Get the string to sort by, by processing the index entry with all
4906 % font commands turned off.
4907 {\indexnofonts
4908 \def\lbracechar{{\indexlbrace}}%
4909 \def\rbracechar{{\indexrbrace}}%
4910 \let\{=\lbracechar
4911 \let\}=\rbracechar
4912 \indexnonalnumdisappear
4913 \xdef\indexsortkey{}%
4914 \let\sortas=\indexwritesortas
4915 \edef\temp{\the\toks0}%
4916 \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
4917 \ifx\indexsortkey\empty
4918 \xdef\indexsortkey{\temp}%
4919 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
4920 \fi
4921 }%
4922 %
4923 % Set up the complete index entry, with both the sort key and
4924 % the original text, including any font commands. We write
4925 % three arguments to \entry to the .?? file (four in the
4926 % subentry case), texindex reduces to two when writing the .??s
4927 % sorted result.
4928 \edef\temp{%
4929 \write\writeto{%
4930 \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
4931 }%
4932 \temp
4933 }
4934 \newbox\dummybox % used above
4935
4936 % Take care of unwanted page breaks/skips around a whatsit:
4937 %
4938 % If a skip is the last thing on the list now, preserve it
4939 % by backing up by \lastskip, doing the \write, then inserting
4940 % the skip again. Otherwise, the whatsit generated by the
4941 % \write or \pdfdest will make \lastskip zero. The result is that
4942 % sequences like this:
4943 % @end defun
4944 % @tindex whatever
4945 % @defun ...
4946 % will have extra space inserted, because the \medbreak in the
4947 % start of the @defun won't see the skip inserted by the @end of
4948 % the previous defun.
4949 %
4950 % But don't do any of this if we're not in vertical mode. We
4951 % don't want to do a \vskip and prematurely end a paragraph.
4952 %
4953 % Avoid page breaks due to these extra skips, too.
4954 %
4955 % But wait, there is a catch there:
4956 % We'll have to check whether \lastskip is zero skip. \ifdim is not
4957 % sufficient for this purpose, as it ignores stretch and shrink parts
4958 % of the skip. The only way seems to be to check the textual
4959 % representation of the skip.
4960 %
4961 % The following is almost like \def\zeroskipmacro{0.0pt} except that
4962 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
4963 %
4964 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
4965 %
4966 \newskip\whatsitskip
4967 \newcount\whatsitpenalty
4968 %
4969 % ..., ready, GO:
4970 %
4971 \def\safewhatsit#1{\ifhmode
4972 #1%
4973 \else
4974 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
4975 \whatsitskip = \lastskip
4976 \edef\lastskipmacro{\the\lastskip}%
4977 \whatsitpenalty = \lastpenalty
4978 %
4979 % If \lastskip is nonzero, that means the last item was a
4980 % skip. And since a skip is discardable, that means this
4981 % -\whatsitskip glue we're inserting is preceded by a
4982 % non-discardable item, therefore it is not a potential
4983 % breakpoint, therefore no \nobreak needed.
4984 \ifx\lastskipmacro\zeroskipmacro
4985 \else
4986 \vskip-\whatsitskip
4987 \fi
4988 %
4989 #1%
4990 %
4991 \ifx\lastskipmacro\zeroskipmacro
4992 % If \lastskip was zero, perhaps the last item was a penalty, and
4993 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
4994 % to re-insert the same penalty (values >10000 are used for various
4995 % signals); since we just inserted a non-discardable item, any
4996 % following glue (such as a \parskip) would be a breakpoint. For example:
4997 % @deffn deffn-whatever
4998 % @vindex index-whatever
4999 % Description.
5000 % would allow a break between the index-whatever whatsit
5001 % and the "Description." paragraph.
5002 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5003 \else
5004 % On the other hand, if we had a nonzero \lastskip,
5005 % this make-up glue would be preceded by a non-discardable item
5006 % (the whatsit from the \write), so we must insert a \nobreak.
5007 \nobreak\vskip\whatsitskip
5008 \fi
5009 \fi}
5010
5011 % The index entry written in the file actually looks like
5012 % \entry {sortstring}{page}{topic}
5013 % or
5014 % \entry {sortstring}{page}{topic}{subtopic}
5015 % The texindex program reads in these files and writes files
5016 % containing these kinds of lines:
5017 % \initial {c}
5018 % before the first topic whose initial is c
5019 % \entry {topic}{pagelist}
5020 % for a topic that is used without subtopics
5021 % \primary {topic}
5022 % for the beginning of a topic that is used with subtopics
5023 % \secondary {subtopic}{pagelist}
5024 % for each subtopic.
5025
5026 % Define the user-accessible indexing commands
5027 % @findex, @vindex, @kindex, @cindex.
5028
5029 \def\findex {\fnindex}
5030 \def\kindex {\kyindex}
5031 \def\cindex {\cpindex}
5032 \def\vindex {\vrindex}
5033 \def\tindex {\tpindex}
5034 \def\pindex {\pgindex}
5035
5036 \def\cindexsub {\begingroup\obeylines\cindexsub}
5037 {\obeylines %
5038 \gdef\cindexsub "#1" #2^^M{\endgroup %
5039 \dosubind{cp}{#2}{#1}}}
5040
5041 % Define the macros used in formatting output of the sorted index material.
5042
5043 % @printindex causes a particular index (the ??s file) to get printed.
5044 % It does not print any chapter heading (usually an @unnumbered).
5045 %
5046 \parseargdef\printindex{\begingroup
5047 \dobreak \chapheadingskip{10000}%
5048 %
5049 \smallfonts \rm
5050 \tolerance = 9500
5051 \plainfrenchspacing
5052 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5053 %
5054 % See if the index file exists and is nonempty.
5055 % Change catcode of @ here so that if the index file contains
5056 % \initial {@}
5057 % as its first line, TeX doesn't complain about mismatched braces
5058 % (because it thinks @} is a control sequence).
5059 \catcode`\@ = 11
5060 % See comment in \requireopenindexfile.
5061 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5062 \openin 1 \jobname.\indexname s
5063 \ifeof 1
5064 % \enddoublecolumns gets confused if there is no text in the index,
5065 % and it loses the chapter title and the aux file entries for the
5066 % index. The easiest way to prevent this problem is to make sure
5067 % there is some text.
5068 \putwordIndexNonexistent
5069 \else
5070 \catcode`\\ = 0
5071 \escapechar = `\\
5072 %
5073 % If the index file exists but is empty, then \openin leaves \ifeof
5074 % false. We have to make TeX try to read something from the file, so
5075 % it can discover if there is anything in it.
5076 \read 1 to \thisline
5077 \ifeof 1
5078 \putwordIndexIsEmpty
5079 \else
5080 % Index files are almost Texinfo source, but we use \ as the escape
5081 % character. It would be better to use @, but that's too big a change
5082 % to make right now.
5083 \def\indexbackslash{\ttbackslash}%
5084 \let\indexlbrace\{ % Likewise, set these sequences for braces
5085 \let\indexrbrace\} % used in the sort key.
5086 \begindoublecolumns
5087 \let\entryorphanpenalty=\indexorphanpenalty
5088 %
5089 % Read input from the index file line by line.
5090 \loopdo
5091 \ifeof1
5092 \let\firsttoken\relax
5093 \else
5094 \read 1 to \nextline
5095 \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
5096 \act
5097 \fi
5098 \thisline
5099 %
5100 \ifeof1\else
5101 \let\thisline\nextline
5102 \repeat
5103 %%
5104 \enddoublecolumns
5105 \fi
5106 \fi
5107 \closein 1
5108 \endgroup}
5109
5110 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
5111 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
5112
5113 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
5114 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
5115
5116 % These macros are used by the sorted index file itself.
5117 % Change them to control the appearance of the index.
5118
5119 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5120 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5121 \catcode`\$=3
5122 \gdef\initialglyphs{%
5123 % Some changes for non-alphabetic characters. Using the glyphs from the
5124 % math fonts looks more consistent than the typewriter font used elsewhere
5125 % for these characters.
5126 \def\indexbackslash{\math{\backslash}}%
5127 \let\\=\indexbackslash
5128 %
5129 % Can't get bold backslash so don't use bold forward slash
5130 \catcode`\/=13
5131 \def/{{\secrmnotbold \normalslash}}%
5132 \def-{{\normaldash\normaldash}}% en dash `--'
5133 \def^{{\chapbf \normalcaret}}%
5134 \def~{{\chapbf \normaltilde}}%
5135 \def\_{%
5136 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5137 \def|{$\vert$}%
5138 \def<{$\less$}%
5139 \def>{$\gtr$}%
5140 \def+{$\normalplus$}%
5141 }}
5142
5143 \def\initial{%
5144 \bgroup
5145 \initialglyphs
5146 \initialx
5147 }
5148
5149 \def\initialx#1{%
5150 % Remove any glue we may have, we'll be inserting our own.
5151 \removelastskip
5152 %
5153 % We like breaks before the index initials, so insert a bonus.
5154 % The glue before the bonus allows a little bit of space at the
5155 % bottom of a column to reduce an increase in inter-line spacing.
5156 \nobreak
5157 \vskip 0pt plus 5\baselineskip
5158 \penalty -300
5159 \vskip 0pt plus -5\baselineskip
5160 %
5161 % Typeset the initial. Making this add up to a whole number of
5162 % baselineskips increases the chance of the dots lining up from column
5163 % to column. It still won't often be perfect, because of the stretch
5164 % we need before each entry, but it's better.
5165 %
5166 % No shrink because it confuses \balancecolumns.
5167 \vskip 1.67\baselineskip plus 1\baselineskip
5168 \leftline{\secfonts \kern-0.05em \secbf #1}%
5169 % \secfonts is inside the argument of \leftline so that the change of
5170 % \baselineskip will not affect any glue inserted before the vbox that
5171 % \leftline creates.
5172 % Do our best not to break after the initial.
5173 \nobreak
5174 \vskip .33\baselineskip plus .1\baselineskip
5175 \egroup % \initialglyphs
5176 }
5177
5178 \newdimen\entryrightmargin
5179 \entryrightmargin=0pt
5180
5181 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5182 % then page number (#2) flushed to the right margin. It is used for index
5183 % and table of contents entries. The paragraph is indented by \leftskip.
5184 %
5185 \def\entry{%
5186 \begingroup
5187 %
5188 % Start a new paragraph if necessary, so our assignments below can't
5189 % affect previous text.
5190 \par
5191 %
5192 % No extra space above this paragraph.
5193 \parskip = 0in
5194 %
5195 % When reading the text of entry, convert explicit line breaks
5196 % from @* into spaces. The user might give these in long section
5197 % titles, for instance.
5198 \def\*{\unskip\space\ignorespaces}%
5199 \def\entrybreak{\hfil\break}% An undocumented command
5200 %
5201 % A bit of stretch before each entry for the benefit of balancing
5202 % columns.
5203 \vskip 0pt plus0.5pt
5204 %
5205 % Swallow the left brace of the text (first parameter):
5206 \afterassignment\doentry
5207 \let\temp =
5208 }
5209 \def\entrybreak{\unskip\space\ignorespaces}%
5210 \def\doentry{%
5211 % Save the text of the entry
5212 \global\setbox\boxA=\hbox\bgroup
5213 \bgroup % Instead of the swallowed brace.
5214 \noindent
5215 \aftergroup\finishentry
5216 % And now comes the text of the entry.
5217 % Not absorbing as a macro argument reduces the chance of problems
5218 % with catcodes occurring.
5219 }
5220 {\catcode`\@=11
5221 \gdef\finishentry#1{%
5222 \egroup % end box A
5223 \dimen@ = \wd\boxA % Length of text of entry
5224 \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
5225 % #1 is the page number.
5226 %
5227 % Get the width of the page numbers, and only use
5228 % leaders if they are present.
5229 \global\setbox\boxB = \hbox{#1}%
5230 \ifdim\wd\boxB = 0pt
5231 \null\nobreak\hfill\ %
5232 \else
5233 %
5234 \null\nobreak\indexdotfill % Have leaders before the page number.
5235 %
5236 \ifpdf
5237 \pdfgettoks#1.%
5238 \bgroup\let\domark\relax
5239 \hskip\skip\thinshrinkable\the\toksA
5240 \egroup
5241 % The redefinion of \domark stops marks being added in \pdflink to
5242 % preserve coloured links across page boundaries. Otherwise the marks
5243 % would get in the way of \lastbox in \insertindexentrybox.
5244 \else
5245 \hskip\skip\thinshrinkable #1%
5246 \fi
5247 \fi
5248 \egroup % end \boxA
5249 \ifdim\wd\boxB = 0pt
5250 \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
5251 \else
5252 \global\setbox\entryindexbox=\vbox\bgroup
5253 \prevdepth=\entrylinedepth
5254 \noindent
5255 % We want the text of the entries to be aligned to the left, and the
5256 % page numbers to be aligned to the right.
5257 %
5258 \advance\leftskip by 0pt plus 1fil
5259 \advance\leftskip by 0pt plus -1fill
5260 \rightskip = 0pt plus -1fil
5261 \advance\rightskip by 0pt plus 1fill
5262 % Cause last line, which could consist of page numbers on their own
5263 % if the list of page numbers is long, to be aligned to the right.
5264 \parfillskip=0pt plus -1fill
5265 %
5266 \hangindent=1em
5267 %
5268 \advance\rightskip by \entryrightmargin
5269 % Determine how far we can stretch into the margin.
5270 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5271 % fit on one line in @letterpaper format.
5272 \ifdim\entryrightmargin>2.1em
5273 \dimen@i=2.1em
5274 \else
5275 \dimen@i=0em
5276 \fi
5277 \advance \parfillskip by 0pt minus 1\dimen@i
5278 %
5279 \dimen@ii = \hsize
5280 \advance\dimen@ii by -1\leftskip
5281 \advance\dimen@ii by -1\entryrightmargin
5282 \advance\dimen@ii by 1\dimen@i
5283 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5284 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5285 \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
5286 \dimen@ii = \hsize
5287 \advance \dimen@ii by -1em
5288 \ifnum\dimen@>\dimen@ii
5289 % If the entry is too long, use the whole line
5290 \dimen@ = \dimen@ii
5291 \fi
5292 \advance\leftskip by 0pt plus 1fill % ragged right
5293 \advance \dimen@ by 1\rightskip
5294 \parshape = 2 0pt \dimen@ 1em \dimen@ii
5295 % Ideally we'd add a finite glue at the end of the first line only, but
5296 % TeX doesn't seem to provide a way to do such a thing.
5297 \fi\fi
5298 \unhbox\boxA
5299 %
5300 % Do not prefer a separate line ending with a hyphen to fewer lines.
5301 \finalhyphendemerits = 0
5302 %
5303 % Word spacing - no stretch
5304 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5305 %
5306 \linepenalty=1000 % Discourage line breaks.
5307 \hyphenpenalty=5000 % Discourage hyphenation.
5308 %
5309 \par % format the paragraph
5310 \egroup % The \vbox
5311 \fi
5312 \endgroup
5313 % delay text of entry until after penalty
5314 \bgroup\aftergroup\insertindexentrybox
5315 \entryorphanpenalty
5316 }}
5317
5318 \newskip\thinshrinkable
5319 \skip\thinshrinkable=.15em minus .15em
5320
5321 \newbox\entryindexbox
5322 \def\insertindexentrybox{%
5323 \copy\entryindexbox
5324 % The following gets the depth of the last box. This is for even
5325 % line spacing when entries span several lines.
5326 \setbox\dummybox\vbox{%
5327 \unvbox\entryindexbox
5328 \nointerlineskip
5329 \lastbox
5330 \global\entrylinedepth=\prevdepth
5331 }%
5332 % Note that we couldn't simply \unvbox\entryindexbox followed by
5333 % \nointerlineskip\lastbox to remove the last box and then reinstate it,
5334 % because this resets how far the box has been \moveleft'ed to 0. \unvbox
5335 % doesn't affect \prevdepth either.
5336 }
5337 \newdimen\entrylinedepth
5338
5339 % Default is no penalty
5340 \let\entryorphanpenalty\egroup
5341
5342 % Used from \printindex. \firsttoken should be the first token
5343 % after the \entry. If it's not another \entry, we are at the last
5344 % line of a group of index entries, so insert a penalty to discourage
5345 % orphaned index entries.
5346 \long\def\indexorphanpenalty{%
5347 \def\isentry{\entry}%
5348 \ifx\firsttoken\isentry
5349 \else
5350 \unskip\penalty 9000
5351 % The \unskip here stops breaking before the glue. It relies on the
5352 % \vskip above being there, otherwise there is an error
5353 % "You can't use `\unskip' in vertical mode". There has to be glue
5354 % in the current vertical list that hasn't been added to the
5355 % "current page". See Chapter 24 of the TeXbook. This contradicts
5356 % Section 8.3.7 in "TeX by Topic," though.
5357 \fi
5358 \egroup % now comes the box added with \aftergroup
5359 }
5360
5361 % Like plain.tex's \dotfill, except uses up at least 1 em.
5362 % The filll stretch here overpowers both the fil and fill stretch to push
5363 % the page number to the right.
5364 \def\indexdotfill{\cleaders
5365 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5366
5367
5368 \def\primary #1{\line{#1\hfil}}
5369
5370 \newskip\secondaryindent \secondaryindent=0.5cm
5371 \def\secondary#1#2{{%
5372 \parfillskip=0in
5373 \parskip=0in
5374 \hangindent=1in
5375 \hangafter=1
5376 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5377 \ifpdf
5378 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5379 \else
5380 #2
5381 \fi
5382 \par
5383 }}
5384
5385 % Define two-column mode, which we use to typeset indexes.
5386 % Adapted from the TeXbook, page 416, which is to say,
5387 % the manmac.tex format used to print the TeXbook itself.
5388 \catcode`\@=11 % private names
5389
5390 \newbox\partialpage
5391 \newdimen\doublecolumnhsize
5392 \newdimen\doublecolumntopgap
5393 \doublecolumntopgap = 0pt
5394
5395 % Use inside an output routine to save \topmark and \firstmark
5396 \def\savemarks{%
5397 \global\savedtopmark=\expandafter{\topmark }%
5398 \global\savedfirstmark=\expandafter{\firstmark }%
5399 }
5400 \newtoks\savedtopmark
5401 \newtoks\savedfirstmark
5402
5403 % Set \topmark and \firstmark for next time \output runs.
5404 % Can't be run from withinside \output (because any material
5405 % added while an output routine is active, including
5406 % penalties, is saved for after it finishes). The page so far
5407 % should be empty, otherwise what's on it will be thrown away.
5408 \def\restoremarks{%
5409 \mark{\the\savedtopmark}%
5410 \bgroup\output = {%
5411 \setbox\dummybox=\box\PAGE
5412 }abc\eject\egroup
5413 % "abc" because output routine doesn't fire for a completely empty page.
5414 \mark{\the\savedfirstmark}%
5415 }
5416
5417 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5418 % If not much space left on page, start a new page.
5419 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5420 %
5421 % Grab any single-column material above us.
5422 \output = {%
5423 %
5424 % Here is a possibility not foreseen in manmac: if we accumulate a
5425 % whole lot of material, we might end up calling this \output
5426 % routine twice in a row (see the doublecol-lose test, which is
5427 % essentially a couple of indexes with @setchapternewpage off). In
5428 % that case we just ship out what is in \partialpage with the normal
5429 % output routine. Generally, \partialpage will be empty when this
5430 % runs and this will be a no-op. See the indexspread.tex test case.
5431 \ifvoid\partialpage \else
5432 \onepageout{\pagecontents\partialpage}%
5433 \fi
5434 %
5435 \global\setbox\partialpage = \vbox{%
5436 % Unvbox the main output page.
5437 \unvbox\PAGE
5438 \kern-\topskip \kern\baselineskip
5439 }%
5440 \savemarks
5441 }%
5442 \eject % run that output routine to set \partialpage
5443 \restoremarks
5444 %
5445 % We recover the two marks that the last output routine saved in order
5446 % to propagate the information in marks added around a chapter heading,
5447 % which could be otherwise be lost by the time the final page is output.
5448 %
5449 %
5450 % Use the double-column output routine for subsequent pages.
5451 \output = {\doublecolumnout}%
5452 %
5453 % Change the page size parameters. We could do this once outside this
5454 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5455 % format, but then we repeat the same computation. Repeating a couple
5456 % of assignments once per index is clearly meaningless for the
5457 % execution time, so we may as well do it in one place.
5458 %
5459 % First we halve the line length, less a little for the gutter between
5460 % the columns. We compute the gutter based on the line length, so it
5461 % changes automatically with the paper format. The magic constant
5462 % below is chosen so that the gutter has the same value (well, +-<1pt)
5463 % as it did when we hard-coded it.
5464 %
5465 % We put the result in a separate register, \doublecolumhsize, so we
5466 % can restore it in \pagesofar, after \hsize itself has (potentially)
5467 % been clobbered.
5468 %
5469 \doublecolumnhsize = \hsize
5470 \advance\doublecolumnhsize by -.04154\hsize
5471 \divide\doublecolumnhsize by 2
5472 \hsize = \doublecolumnhsize
5473 %
5474 % Double the \vsize as well. (We don't need a separate register here,
5475 % since nobody clobbers \vsize.)
5476 \global\doublecolumntopgap = \topskip
5477 \global\advance\doublecolumntopgap by -1\baselineskip
5478 \advance\vsize by -1\doublecolumntopgap
5479 \vsize = 2\vsize
5480 \topskip=0pt
5481 \global\entrylinedepth=0pt\relax
5482 }
5483
5484 % The double-column output routine for all double-column pages except
5485 % the last, which is done by \balancecolumns.
5486 %
5487 \def\doublecolumnout{%
5488 %
5489 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5490 % Get the available space for the double columns -- the normal
5491 % (undoubled) page height minus any material left over from the
5492 % previous page.
5493 \dimen@ = \vsize
5494 \divide\dimen@ by 2
5495 \advance\dimen@ by -\ht\partialpage
5496 %
5497 % box0 will be the left-hand column, box2 the right.
5498 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
5499 \onepageout\pagesofar
5500 \unvbox255
5501 \penalty\outputpenalty
5502 }
5503 %
5504 % Re-output the contents of the output page -- any previous material,
5505 % followed by the two boxes we just split, in box0 and box2.
5506 \def\pagesofar{%
5507 \unvbox\partialpage
5508 %
5509 \hsize = \doublecolumnhsize
5510 \wd0=\hsize \wd2=\hsize
5511 \vbox{%
5512 \vskip\doublecolumntopgap
5513 \hbox to\pagewidth{\box0\hfil\box2}}%
5514 }
5515
5516
5517 % Finished with with double columns.
5518 \def\enddoublecolumns{%
5519 % The following penalty ensures that the page builder is exercised
5520 % _before_ we change the output routine. This is necessary in the
5521 % following situation:
5522 %
5523 % The last section of the index consists only of a single entry.
5524 % Before this section, \pagetotal is less than \pagegoal, so no
5525 % break occurs before the last section starts. However, the last
5526 % section, consisting of \initial and the single \entry, does not
5527 % fit on the page and has to be broken off. Without the following
5528 % penalty the page builder will not be exercised until \eject
5529 % below, and by that time we'll already have changed the output
5530 % routine to the \balancecolumns version, so the next-to-last
5531 % double-column page will be processed with \balancecolumns, which
5532 % is wrong: The two columns will go to the main vertical list, with
5533 % the broken-off section in the recent contributions. As soon as
5534 % the output routine finishes, TeX starts reconsidering the page
5535 % break. The two columns and the broken-off section both fit on the
5536 % page, because the two columns now take up only half of the page
5537 % goal. When TeX sees \eject from below which follows the final
5538 % section, it invokes the new output routine that we've set after
5539 % \balancecolumns below; \onepageout will try to fit the two columns
5540 % and the final section into the vbox of \pageheight (see
5541 % \pagebody), causing an overfull box.
5542 %
5543 % Note that glue won't work here, because glue does not exercise the
5544 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5545 \penalty0
5546 %
5547 \output = {%
5548 % Split the last of the double-column material.
5549 \savemarks
5550 \balancecolumns
5551 %
5552 % Having called \balancecolumns once, we do not
5553 % want to call it again. Therefore, reset \output to its normal
5554 % definition right away.
5555 \global\output = {\onepageout{\pagecontents\PAGE}}%
5556 }%
5557 \eject
5558 \endgroup % started in \begindoublecolumns
5559 \restoremarks
5560 % Leave the double-column material on the current page, no automatic
5561 % page break.
5562 \box\balancedcolumns
5563 %
5564 % \pagegoal was set to the doubled \vsize above, since we restarted
5565 % the current page. We're now back to normal single-column
5566 % typesetting, so reset \pagegoal to the normal \vsize (after the
5567 % \endgroup where \vsize got restored).
5568 \pagegoal = \vsize
5569 }
5570 \newbox\balancedcolumns
5571 \setbox\balancedcolumns=\vbox{shouldnt see this}%
5572 %
5573 % Only called for the last of the double column material. \doublecolumnout
5574 % does the others.
5575 \def\balancecolumns{%
5576 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
5577 \dimen@ = \ht0
5578 \advance\dimen@ by \topskip
5579 \advance\dimen@ by-\baselineskip
5580 \ifdim\dimen@<14\baselineskip
5581 % Don't split a short final column in two.
5582 \setbox2=\vbox{}%
5583 \else
5584 \divide\dimen@ by 2 % target to split to
5585 \dimen@ii = \dimen@
5586 \splittopskip = \topskip
5587 % Loop until the second column is no higher than the first
5588 {%
5589 \vbadness = 10000
5590 \loop
5591 \global\setbox3 = \copy0
5592 \global\setbox1 = \vsplit3 to \dimen@
5593 % Remove glue from bottom of first column to
5594 % make sure it is higher than the second.
5595 \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}%
5596 \ifdim\ht3>\ht1
5597 \global\advance\dimen@ by 1pt
5598 \repeat
5599 }%
5600 \multiply\dimen@ii by 4
5601 \divide\dimen@ii by 5
5602 \ifdim\ht3<\dimen@ii
5603 % Column heights are too different, so don't make their bottoms
5604 % flush with each other. The glue at the end of the second column
5605 % allows a second column to stretch, reducing the difference in
5606 % height between the two.
5607 \setbox0=\vbox to\dimen@{\unvbox1\vfill}%
5608 \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}%
5609 \else
5610 \setbox0=\vbox to\dimen@{\unvbox1}%
5611 \setbox2=\vbox to\dimen@{\unvbox3}%
5612 \fi
5613 \fi
5614 %
5615 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5616 }
5617 \catcode`\@ = \other
5618
5619
5620 \message{sectioning,}
5621 % Chapters, sections, etc.
5622
5623 % Let's start with @part.
5624 \outer\parseargdef\part{\partzzz{#1}}
5625 \def\partzzz#1{%
5626 \chapoddpage
5627 \null
5628 \vskip.3\vsize % move it down on the page a bit
5629 \begingroup
5630 \noindent \titlefonts\rmisbold #1\par % the text
5631 \let\lastnode=\empty % no node to associate with
5632 \writetocentry{part}{#1}{}% but put it in the toc
5633 \headingsoff % no headline or footline on the part page
5634 % This outputs a mark at the end of the page that clears \thischapter
5635 % and \thissection, as is done in \startcontents.
5636 \let\pchapsepmacro\relax
5637 \chapmacro{}{Yomitfromtoc}{}%
5638 \chapoddpage
5639 \endgroup
5640 }
5641
5642 % \unnumberedno is an oxymoron. But we count the unnumbered
5643 % sections so that we can refer to them unambiguously in the pdf
5644 % outlines by their "section number". We avoid collisions with chapter
5645 % numbers by starting them at 10000. (If a document ever has 10000
5646 % chapters, we're in trouble anyway, I'm sure.)
5647 \newcount\unnumberedno \unnumberedno = 10000
5648 \newcount\chapno
5649 \newcount\secno \secno=0
5650 \newcount\subsecno \subsecno=0
5651 \newcount\subsubsecno \subsubsecno=0
5652
5653 % This counter is funny since it counts through charcodes of letters A, B, ...
5654 \newcount\appendixno \appendixno = `\@
5655 %
5656 % \def\appendixletter{\char\the\appendixno}
5657 % We do the following ugly conditional instead of the above simple
5658 % construct for the sake of pdftex, which needs the actual
5659 % letter in the expansion, not just typeset.
5660 %
5661 \def\appendixletter{%
5662 \ifnum\appendixno=`A A%
5663 \else\ifnum\appendixno=`B B%
5664 \else\ifnum\appendixno=`C C%
5665 \else\ifnum\appendixno=`D D%
5666 \else\ifnum\appendixno=`E E%
5667 \else\ifnum\appendixno=`F F%
5668 \else\ifnum\appendixno=`G G%
5669 \else\ifnum\appendixno=`H H%
5670 \else\ifnum\appendixno=`I I%
5671 \else\ifnum\appendixno=`J J%
5672 \else\ifnum\appendixno=`K K%
5673 \else\ifnum\appendixno=`L L%
5674 \else\ifnum\appendixno=`M M%
5675 \else\ifnum\appendixno=`N N%
5676 \else\ifnum\appendixno=`O O%
5677 \else\ifnum\appendixno=`P P%
5678 \else\ifnum\appendixno=`Q Q%
5679 \else\ifnum\appendixno=`R R%
5680 \else\ifnum\appendixno=`S S%
5681 \else\ifnum\appendixno=`T T%
5682 \else\ifnum\appendixno=`U U%
5683 \else\ifnum\appendixno=`V V%
5684 \else\ifnum\appendixno=`W W%
5685 \else\ifnum\appendixno=`X X%
5686 \else\ifnum\appendixno=`Y Y%
5687 \else\ifnum\appendixno=`Z Z%
5688 % The \the is necessary, despite appearances, because \appendixletter is
5689 % expanded while writing the .toc file. \char\appendixno is not
5690 % expandable, thus it is written literally, thus all appendixes come out
5691 % with the same letter (or @) in the toc without it.
5692 \else\char\the\appendixno
5693 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
5694 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
5695
5696 % Each @chapter defines these (using marks) as the number+name, number
5697 % and name of the chapter. Page headings and footings can use
5698 % these. @section does likewise.
5699 \def\thischapter{}
5700 \def\thischapternum{}
5701 \def\thischaptername{}
5702 \def\thissection{}
5703 \def\thissectionnum{}
5704 \def\thissectionname{}
5705
5706 \newcount\absseclevel % used to calculate proper heading level
5707 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
5708
5709 % @raisesections: treat @section as chapter, @subsection as section, etc.
5710 \def\raisesections{\global\advance\secbase by -1}
5711 \let\up=\raisesections % original BFox name
5712
5713 % @lowersections: treat @chapter as section, @section as subsection, etc.
5714 \def\lowersections{\global\advance\secbase by 1}
5715 \let\down=\lowersections % original BFox name
5716
5717 % we only have subsub.
5718 \chardef\maxseclevel = 3
5719 %
5720 % A numbered section within an unnumbered changes to unnumbered too.
5721 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
5722 \chardef\unnlevel = \maxseclevel
5723 %
5724 % Trace whether the current chapter is an appendix or not:
5725 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
5726 \def\chapheadtype{N}
5727
5728 % Choose a heading macro
5729 % #1 is heading type
5730 % #2 is heading level
5731 % #3 is text for heading
5732 \def\genhead#1#2#3{%
5733 % Compute the abs. sec. level:
5734 \absseclevel=#2
5735 \advance\absseclevel by \secbase
5736 % Make sure \absseclevel doesn't fall outside the range:
5737 \ifnum \absseclevel < 0
5738 \absseclevel = 0
5739 \else
5740 \ifnum \absseclevel > 3
5741 \absseclevel = 3
5742 \fi
5743 \fi
5744 % The heading type:
5745 \def\headtype{#1}%
5746 \if \headtype U%
5747 \ifnum \absseclevel < \unnlevel
5748 \chardef\unnlevel = \absseclevel
5749 \fi
5750 \else
5751 % Check for appendix sections:
5752 \ifnum \absseclevel = 0
5753 \edef\chapheadtype{\headtype}%
5754 \else
5755 \if \headtype A\if \chapheadtype N%
5756 \errmessage{@appendix... within a non-appendix chapter}%
5757 \fi\fi
5758 \fi
5759 % Check for numbered within unnumbered:
5760 \ifnum \absseclevel > \unnlevel
5761 \def\headtype{U}%
5762 \else
5763 \chardef\unnlevel = 3
5764 \fi
5765 \fi
5766 % Now print the heading:
5767 \if \headtype U%
5768 \ifcase\absseclevel
5769 \unnumberedzzz{#3}%
5770 \or \unnumberedseczzz{#3}%
5771 \or \unnumberedsubseczzz{#3}%
5772 \or \unnumberedsubsubseczzz{#3}%
5773 \fi
5774 \else
5775 \if \headtype A%
5776 \ifcase\absseclevel
5777 \appendixzzz{#3}%
5778 \or \appendixsectionzzz{#3}%
5779 \or \appendixsubseczzz{#3}%
5780 \or \appendixsubsubseczzz{#3}%
5781 \fi
5782 \else
5783 \ifcase\absseclevel
5784 \chapterzzz{#3}%
5785 \or \seczzz{#3}%
5786 \or \numberedsubseczzz{#3}%
5787 \or \numberedsubsubseczzz{#3}%
5788 \fi
5789 \fi
5790 \fi
5791 \suppressfirstparagraphindent
5792 }
5793
5794 % an interface:
5795 \def\numhead{\genhead N}
5796 \def\apphead{\genhead A}
5797 \def\unnmhead{\genhead U}
5798
5799 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
5800 % all lower-level sectioning counters to zero.
5801 %
5802 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
5803 % (e.g., figures), q.v. By default (before any chapter), that is empty.
5804 \let\chaplevelprefix = \empty
5805 %
5806 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
5807 \def\chapterzzz#1{%
5808 % section resetting is \global in case the chapter is in a group, such
5809 % as an @include file.
5810 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5811 \global\advance\chapno by 1
5812 %
5813 % Used for \float.
5814 \gdef\chaplevelprefix{\the\chapno.}%
5815 \resetallfloatnos
5816 %
5817 % \putwordChapter can contain complex things in translations.
5818 \toks0=\expandafter{\putwordChapter}%
5819 \message{\the\toks0 \space \the\chapno}%
5820 %
5821 % Write the actual heading.
5822 \chapmacro{#1}{Ynumbered}{\the\chapno}%
5823 %
5824 % So @section and the like are numbered underneath this chapter.
5825 \global\let\section = \numberedsec
5826 \global\let\subsection = \numberedsubsec
5827 \global\let\subsubsection = \numberedsubsubsec
5828 }
5829
5830 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
5831 %
5832 \def\appendixzzz#1{%
5833 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5834 \global\advance\appendixno by 1
5835 \gdef\chaplevelprefix{\appendixletter.}%
5836 \resetallfloatnos
5837 %
5838 % \putwordAppendix can contain complex things in translations.
5839 \toks0=\expandafter{\putwordAppendix}%
5840 \message{\the\toks0 \space \appendixletter}%
5841 %
5842 \chapmacro{#1}{Yappendix}{\appendixletter}%
5843 %
5844 \global\let\section = \appendixsec
5845 \global\let\subsection = \appendixsubsec
5846 \global\let\subsubsection = \appendixsubsubsec
5847 }
5848
5849 % normally unnmhead0 calls unnumberedzzz:
5850 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
5851 \def\unnumberedzzz#1{%
5852 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5853 \global\advance\unnumberedno by 1
5854 %
5855 % Since an unnumbered has no number, no prefix for figures.
5856 \global\let\chaplevelprefix = \empty
5857 \resetallfloatnos
5858 %
5859 % This used to be simply \message{#1}, but TeX fully expands the
5860 % argument to \message. Therefore, if #1 contained @-commands, TeX
5861 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
5862 % expanded @cite (which turns out to cause errors because \cite is meant
5863 % to be executed, not expanded).
5864 %
5865 % Anyway, we don't want the fully-expanded definition of @cite to appear
5866 % as a result of the \message, we just want `@cite' itself. We use
5867 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
5868 % simply yielding the contents of <toks register>. (We also do this for
5869 % the toc entries.)
5870 \toks0 = {#1}%
5871 \message{(\the\toks0)}%
5872 %
5873 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
5874 %
5875 \global\let\section = \unnumberedsec
5876 \global\let\subsection = \unnumberedsubsec
5877 \global\let\subsubsection = \unnumberedsubsubsec
5878 }
5879
5880 % @centerchap is like @unnumbered, but the heading is centered.
5881 \outer\parseargdef\centerchap{%
5882 \let\centerparametersmaybe = \centerparameters
5883 \unnmhead0{#1}%
5884 \let\centerparametersmaybe = \relax
5885 }
5886
5887 % @top is like @unnumbered.
5888 \let\top\unnumbered
5889
5890 % Sections.
5891 %
5892 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
5893 \def\seczzz#1{%
5894 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5895 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
5896 }
5897
5898 % normally calls appendixsectionzzz:
5899 \outer\parseargdef\appendixsection{\apphead1{#1}}
5900 \def\appendixsectionzzz#1{%
5901 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5902 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
5903 }
5904 \let\appendixsec\appendixsection
5905
5906 % normally calls unnumberedseczzz:
5907 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
5908 \def\unnumberedseczzz#1{%
5909 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5910 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
5911 }
5912
5913 % Subsections.
5914 %
5915 % normally calls numberedsubseczzz:
5916 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
5917 \def\numberedsubseczzz#1{%
5918 \global\subsubsecno=0 \global\advance\subsecno by 1
5919 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
5920 }
5921
5922 % normally calls appendixsubseczzz:
5923 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
5924 \def\appendixsubseczzz#1{%
5925 \global\subsubsecno=0 \global\advance\subsecno by 1
5926 \sectionheading{#1}{subsec}{Yappendix}%
5927 {\appendixletter.\the\secno.\the\subsecno}%
5928 }
5929
5930 % normally calls unnumberedsubseczzz:
5931 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
5932 \def\unnumberedsubseczzz#1{%
5933 \global\subsubsecno=0 \global\advance\subsecno by 1
5934 \sectionheading{#1}{subsec}{Ynothing}%
5935 {\the\unnumberedno.\the\secno.\the\subsecno}%
5936 }
5937
5938 % Subsubsections.
5939 %
5940 % normally numberedsubsubseczzz:
5941 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
5942 \def\numberedsubsubseczzz#1{%
5943 \global\advance\subsubsecno by 1
5944 \sectionheading{#1}{subsubsec}{Ynumbered}%
5945 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
5946 }
5947
5948 % normally appendixsubsubseczzz:
5949 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
5950 \def\appendixsubsubseczzz#1{%
5951 \global\advance\subsubsecno by 1
5952 \sectionheading{#1}{subsubsec}{Yappendix}%
5953 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
5954 }
5955
5956 % normally unnumberedsubsubseczzz:
5957 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
5958 \def\unnumberedsubsubseczzz#1{%
5959 \global\advance\subsubsecno by 1
5960 \sectionheading{#1}{subsubsec}{Ynothing}%
5961 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
5962 }
5963
5964 % These macros control what the section commands do, according
5965 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
5966 % Define them by default for a numbered chapter.
5967 \let\section = \numberedsec
5968 \let\subsection = \numberedsubsec
5969 \let\subsubsection = \numberedsubsubsec
5970
5971 % Define @majorheading, @heading and @subheading
5972
5973 \def\majorheading{%
5974 {\advance\chapheadingskip by 10pt \chapbreak }%
5975 \parsearg\chapheadingzzz
5976 }
5977
5978 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
5979 \def\chapheadingzzz#1{%
5980 \vbox{\chapfonts \raggedtitlesettings #1\par}%
5981 \nobreak\bigskip \nobreak
5982 \suppressfirstparagraphindent
5983 }
5984
5985 % @heading, @subheading, @subsubheading.
5986 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
5987 \suppressfirstparagraphindent}
5988 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
5989 \suppressfirstparagraphindent}
5990 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
5991 \suppressfirstparagraphindent}
5992
5993 % These macros generate a chapter, section, etc. heading only
5994 % (including whitespace, linebreaking, etc. around it),
5995 % given all the information in convenient, parsed form.
5996
5997 % Args are the skip and penalty (usually negative)
5998 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
5999
6000 % Parameter controlling skip before chapter headings (if needed)
6001 \newskip\chapheadingskip
6002
6003 % Define plain chapter starts, and page on/off switching for it.
6004 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6005
6006 % Start a new page
6007 \def\chappager{\par\vfill\supereject}
6008
6009 % \chapoddpage - start on an odd page for a new chapter
6010 % Because \domark is called before \chapoddpage, the filler page will
6011 % get the headings for the next chapter, which is wrong. But we don't
6012 % care -- we just disable all headings on the filler page.
6013 \def\chapoddpage{%
6014 \chappager
6015 \ifodd\pageno \else
6016 \begingroup
6017 \headingsoff
6018 \null
6019 \chappager
6020 \endgroup
6021 \fi
6022 }
6023
6024 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
6025
6026 \def\CHAPPAGoff{%
6027 \global\let\contentsalignmacro = \chappager
6028 \global\let\pchapsepmacro=\chapbreak
6029 \global\let\pagealignmacro=\chappager}
6030
6031 \def\CHAPPAGon{%
6032 \global\let\contentsalignmacro = \chappager
6033 \global\let\pchapsepmacro=\chappager
6034 \global\let\pagealignmacro=\chappager
6035 \global\def\HEADINGSon{\HEADINGSsingle}}
6036
6037 \def\CHAPPAGodd{%
6038 \global\let\contentsalignmacro = \chapoddpage
6039 \global\let\pchapsepmacro=\chapoddpage
6040 \global\let\pagealignmacro=\chapoddpage
6041 \global\def\HEADINGSon{\HEADINGSdouble}}
6042
6043 \CHAPPAGon
6044
6045 % \chapmacro - Chapter opening.
6046 %
6047 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6048 % Yappendix, Yomitfromtoc), #3 the chapter number.
6049 % Not used for @heading series.
6050 %
6051 % To test against our argument.
6052 \def\Ynothingkeyword{Ynothing}
6053 \def\Yappendixkeyword{Yappendix}
6054 \def\Yomitfromtockeyword{Yomitfromtoc}
6055 %
6056 \def\chapmacro#1#2#3{%
6057 \checkenv{}% chapters, etc., should not start inside an environment.
6058 %
6059 % Insert the first mark before the heading break (see notes for \domark).
6060 \let\prevchapterdefs=\lastchapterdefs
6061 \let\prevsectiondefs=\lastsectiondefs
6062 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6063 \gdef\thissection{}}%
6064 %
6065 \def\temptype{#2}%
6066 \ifx\temptype\Ynothingkeyword
6067 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6068 \gdef\thischapter{\thischaptername}}%
6069 \else\ifx\temptype\Yomitfromtockeyword
6070 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6071 \gdef\thischapter{}}%
6072 \else\ifx\temptype\Yappendixkeyword
6073 \toks0={#1}%
6074 \xdef\lastchapterdefs{%
6075 \gdef\noexpand\thischaptername{\the\toks0}%
6076 \gdef\noexpand\thischapternum{\appendixletter}%
6077 % \noexpand\putwordAppendix avoids expanding indigestible
6078 % commands in some of the translations.
6079 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6080 \noexpand\thischapternum:
6081 \noexpand\thischaptername}%
6082 }%
6083 \else
6084 \toks0={#1}%
6085 \xdef\lastchapterdefs{%
6086 \gdef\noexpand\thischaptername{\the\toks0}%
6087 \gdef\noexpand\thischapternum{\the\chapno}%
6088 % \noexpand\putwordChapter avoids expanding indigestible
6089 % commands in some of the translations.
6090 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6091 \noexpand\thischapternum:
6092 \noexpand\thischaptername}%
6093 }%
6094 \fi\fi\fi
6095 %
6096 % Output the mark. Pass it through \safewhatsit, to take care of
6097 % the preceding space.
6098 \safewhatsit\domark
6099 %
6100 % Insert the chapter heading break.
6101 \pchapsepmacro
6102 %
6103 % Now the second mark, after the heading break. No break points
6104 % between here and the heading.
6105 \let\prevchapterdefs=\lastchapterdefs
6106 \let\prevsectiondefs=\lastsectiondefs
6107 \domark
6108 %
6109 {%
6110 \chapfonts \rmisbold
6111 \let\footnote=\errfootnoteheading % give better error message
6112 %
6113 % Have to define \lastsection before calling \donoderef, because the
6114 % xref code eventually uses it. On the other hand, it has to be called
6115 % after \pchapsepmacro, or the headline will change too soon.
6116 \gdef\lastsection{#1}%
6117 %
6118 % Only insert the separating space if we have a chapter/appendix
6119 % number, and don't print the unnumbered ``number''.
6120 \ifx\temptype\Ynothingkeyword
6121 \setbox0 = \hbox{}%
6122 \def\toctype{unnchap}%
6123 \else\ifx\temptype\Yomitfromtockeyword
6124 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6125 \def\toctype{omit}%
6126 \else\ifx\temptype\Yappendixkeyword
6127 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6128 \def\toctype{app}%
6129 \else
6130 \setbox0 = \hbox{#3\enspace}%
6131 \def\toctype{numchap}%
6132 \fi\fi\fi
6133 %
6134 % Write the toc entry for this chapter. Must come before the
6135 % \donoderef, because we include the current node name in the toc
6136 % entry, and \donoderef resets it to empty.
6137 \writetocentry{\toctype}{#1}{#3}%
6138 %
6139 % For pdftex, we have to write out the node definition (aka, make
6140 % the pdfdest) after any page break, but before the actual text has
6141 % been typeset. If the destination for the pdf outline is after the
6142 % text, then jumping from the outline may wind up with the text not
6143 % being visible, for instance under high magnification.
6144 \donoderef{#2}%
6145 %
6146 % Typeset the actual heading.
6147 \nobreak % Avoid page breaks at the interline glue.
6148 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6149 \unhbox0 #1\par}%
6150 }%
6151 \nobreak\bigskip % no page break after a chapter title
6152 \nobreak
6153 }
6154
6155 % @centerchap -- centered and unnumbered.
6156 \let\centerparametersmaybe = \relax
6157 \def\centerparameters{%
6158 \advance\rightskip by 3\rightskip
6159 \leftskip = \rightskip
6160 \parfillskip = 0pt
6161 }
6162
6163
6164 % I don't think this chapter style is supported any more, so I'm not
6165 % updating it with the new noderef stuff. We'll see. --karl, 11aug03.
6166 %
6167 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
6168 %
6169 \def\unnchfopen #1{%
6170 \chapoddpage
6171 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6172 \nobreak\bigskip\nobreak
6173 }
6174 \def\chfopen #1#2{\chapoddpage {\chapfonts
6175 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
6176 \par\penalty 5000 %
6177 }
6178 \def\centerchfopen #1{%
6179 \chapoddpage
6180 \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
6181 \nobreak\bigskip \nobreak
6182 }
6183 \def\CHAPFopen{%
6184 \global\let\chapmacro=\chfopen
6185 \global\let\centerchapmacro=\centerchfopen}
6186
6187
6188 % Section titles. These macros combine the section number parts and
6189 % call the generic \sectionheading to do the printing.
6190 %
6191 \newskip\secheadingskip
6192 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6193
6194 % Subsection titles.
6195 \newskip\subsecheadingskip
6196 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6197
6198 % Subsubsection titles.
6199 \def\subsubsecheadingskip{\subsecheadingskip}
6200 \def\subsubsecheadingbreak{\subsecheadingbreak}
6201
6202
6203 % Print any size, any type, section title.
6204 %
6205 % #1 is the text of the title,
6206 % #2 is the section level (sec/subsec/subsubsec),
6207 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6208 % #4 is the section number.
6209 %
6210 \def\seckeyword{sec}
6211 %
6212 \def\sectionheading#1#2#3#4{%
6213 {%
6214 \def\sectionlevel{#2}%
6215 \def\temptype{#3}%
6216 %
6217 % It is ok for the @heading series commands to appear inside an
6218 % environment (it's been historically allowed, though the logic is
6219 % dubious), but not the others.
6220 \ifx\temptype\Yomitfromtockeyword\else
6221 \checkenv{}% non-@*heading should not be in an environment.
6222 \fi
6223 \let\footnote=\errfootnoteheading
6224 %
6225 % Switch to the right set of fonts.
6226 \csname #2fonts\endcsname \rmisbold
6227 %
6228 % Insert first mark before the heading break (see notes for \domark).
6229 \let\prevsectiondefs=\lastsectiondefs
6230 \ifx\temptype\Ynothingkeyword
6231 \ifx\sectionlevel\seckeyword
6232 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6233 \gdef\thissection{\thissectionname}}%
6234 \fi
6235 \else\ifx\temptype\Yomitfromtockeyword
6236 % Don't redefine \thissection.
6237 \else\ifx\temptype\Yappendixkeyword
6238 \ifx\sectionlevel\seckeyword
6239 \toks0={#1}%
6240 \xdef\lastsectiondefs{%
6241 \gdef\noexpand\thissectionname{\the\toks0}%
6242 \gdef\noexpand\thissectionnum{#4}%
6243 % \noexpand\putwordSection avoids expanding indigestible
6244 % commands in some of the translations.
6245 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6246 \noexpand\thissectionnum:
6247 \noexpand\thissectionname}%
6248 }%
6249 \fi
6250 \else
6251 \ifx\sectionlevel\seckeyword
6252 \toks0={#1}%
6253 \xdef\lastsectiondefs{%
6254 \gdef\noexpand\thissectionname{\the\toks0}%
6255 \gdef\noexpand\thissectionnum{#4}%
6256 % \noexpand\putwordSection avoids expanding indigestible
6257 % commands in some of the translations.
6258 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6259 \noexpand\thissectionnum:
6260 \noexpand\thissectionname}%
6261 }%
6262 \fi
6263 \fi\fi\fi
6264 %
6265 % Go into vertical mode. Usually we'll already be there, but we
6266 % don't want the following whatsit to end up in a preceding paragraph
6267 % if the document didn't happen to have a blank line.
6268 \par
6269 %
6270 % Output the mark. Pass it through \safewhatsit, to take care of
6271 % the preceding space.
6272 \safewhatsit\domark
6273 %
6274 % Insert space above the heading.
6275 \csname #2headingbreak\endcsname
6276 %
6277 % Now the second mark, after the heading break. No break points
6278 % between here and the heading.
6279 \global\let\prevsectiondefs=\lastsectiondefs
6280 \domark
6281 %
6282 % Only insert the space after the number if we have a section number.
6283 \ifx\temptype\Ynothingkeyword
6284 \setbox0 = \hbox{}%
6285 \def\toctype{unn}%
6286 \gdef\lastsection{#1}%
6287 \else\ifx\temptype\Yomitfromtockeyword
6288 % for @headings -- no section number, don't include in toc,
6289 % and don't redefine \lastsection.
6290 \setbox0 = \hbox{}%
6291 \def\toctype{omit}%
6292 \let\sectionlevel=\empty
6293 \else\ifx\temptype\Yappendixkeyword
6294 \setbox0 = \hbox{#4\enspace}%
6295 \def\toctype{app}%
6296 \gdef\lastsection{#1}%
6297 \else
6298 \setbox0 = \hbox{#4\enspace}%
6299 \def\toctype{num}%
6300 \gdef\lastsection{#1}%
6301 \fi\fi\fi
6302 %
6303 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6304 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6305 %
6306 % Write the node reference (= pdf destination for pdftex).
6307 % Again, see comments in \chapmacro.
6308 \donoderef{#3}%
6309 %
6310 % Interline glue will be inserted when the vbox is completed.
6311 % That glue will be a valid breakpoint for the page, since it'll be
6312 % preceded by a whatsit (usually from the \donoderef, or from the
6313 % \writetocentry if there was no node). We don't want to allow that
6314 % break, since then the whatsits could end up on page n while the
6315 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6316 \nobreak
6317 %
6318 % Output the actual section heading.
6319 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6320 \hangindent=\wd0 % zero if no section number
6321 \unhbox0 #1}%
6322 }%
6323 % Add extra space after the heading -- half of whatever came above it.
6324 % Don't allow stretch, though.
6325 \kern .5 \csname #2headingskip\endcsname
6326 %
6327 % Do not let the kern be a potential breakpoint, as it would be if it
6328 % was followed by glue.
6329 \nobreak
6330 %
6331 % We'll almost certainly start a paragraph next, so don't let that
6332 % glue accumulate. (Not a breakpoint because it's preceded by a
6333 % discardable item.) However, when a paragraph is not started next
6334 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6335 % or the negative glue will cause weirdly wrong output, typically
6336 % obscuring the section heading with something else.
6337 \vskip-\parskip
6338 %
6339 % This is so the last item on the main vertical list is a known
6340 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6341 % and do the needful.
6342 \penalty 10001
6343 }
6344
6345
6346 \message{toc,}
6347 % Table of contents.
6348 \newwrite\tocfile
6349
6350 % Write an entry to the toc file, opening it if necessary.
6351 % Called from @chapter, etc.
6352 %
6353 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6354 % We append the current node name (if any) and page number as additional
6355 % arguments for the \{chap,sec,...}entry macros which will eventually
6356 % read this. The node name is used in the pdf outlines as the
6357 % destination to jump to.
6358 %
6359 % We open the .toc file for writing here instead of at @setfilename (or
6360 % any other fixed time) so that @contents can be anywhere in the document.
6361 % But if #1 is `omit', then we don't do anything. This is used for the
6362 % table of contents chapter openings themselves.
6363 %
6364 \newif\iftocfileopened
6365 \def\omitkeyword{omit}%
6366 %
6367 \def\writetocentry#1#2#3{%
6368 \edef\writetoctype{#1}%
6369 \ifx\writetoctype\omitkeyword \else
6370 \iftocfileopened\else
6371 \immediate\openout\tocfile = \jobname.toc
6372 \global\tocfileopenedtrue
6373 \fi
6374 %
6375 \iflinks
6376 {\atdummies
6377 \edef\temp{%
6378 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6379 \temp
6380 }%
6381 \fi
6382 \fi
6383 %
6384 % Tell \shipout to create a pdf destination on each page, if we're
6385 % writing pdf. These are used in the table of contents. We can't
6386 % just write one on every page because the title pages are numbered
6387 % 1 and 2 (the page numbers aren't printed), and so are the first
6388 % two pages of the document. Thus, we'd have two destinations named
6389 % `1', and two named `2'.
6390 \ifpdf \global\pdfmakepagedesttrue \fi
6391 }
6392
6393
6394 % These characters do not print properly in the Computer Modern roman
6395 % fonts, so we must take special care. This is more or less redundant
6396 % with the Texinfo input format setup at the end of this file.
6397 %
6398 \def\activecatcodes{%
6399 \catcode`\"=\active
6400 \catcode`\$=\active
6401 \catcode`\<=\active
6402 \catcode`\>=\active
6403 \catcode`\\=\active
6404 \catcode`\^=\active
6405 \catcode`\_=\active
6406 \catcode`\|=\active
6407 \catcode`\~=\active
6408 }
6409
6410
6411 % Read the toc file, which is essentially Texinfo input.
6412 \def\readtocfile{%
6413 \setupdatafile
6414 \activecatcodes
6415 \input \tocreadfilename
6416 }
6417
6418 \newskip\contentsrightmargin \contentsrightmargin=1in
6419 \newcount\savepageno
6420 \newcount\lastnegativepageno \lastnegativepageno = -1
6421
6422 % Prepare to read what we've written to \tocfile.
6423 %
6424 \def\startcontents#1{%
6425 % If @setchapternewpage on, and @headings double, the contents should
6426 % start on an odd page, unlike chapters. Thus, we maintain
6427 % \contentsalignmacro in parallel with \pagealignmacro.
6428 % From: Torbjorn Granlund <tege@matematik.su.se>
6429 \contentsalignmacro
6430 \immediate\closeout\tocfile
6431 %
6432 % Don't need to put `Contents' or `Short Contents' in the headline.
6433 % It is abundantly clear what they are.
6434 \chapmacro{#1}{Yomitfromtoc}{}%
6435 %
6436 \savepageno = \pageno
6437 \begingroup % Set up to handle contents files properly.
6438 \raggedbottom % Worry more about breakpoints than the bottom.
6439 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6440 %
6441 % Roman numerals for page numbers.
6442 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6443 }
6444
6445 % redefined for the two-volume lispref. We always output on
6446 % \jobname.toc even if this is redefined.
6447 %
6448 \def\tocreadfilename{\jobname.toc}
6449
6450 % Normal (long) toc.
6451 %
6452 \def\contents{%
6453 \startcontents{\putwordTOC}%
6454 \openin 1 \tocreadfilename\space
6455 \ifeof 1 \else
6456 \readtocfile
6457 \fi
6458 \vfill \eject
6459 \contentsalignmacro % in case @setchapternewpage odd is in effect
6460 \ifeof 1 \else
6461 \pdfmakeoutlines
6462 \fi
6463 \closein 1
6464 \endgroup
6465 \lastnegativepageno = \pageno
6466 \global\pageno = \savepageno
6467 }
6468
6469 % And just the chapters.
6470 \def\summarycontents{%
6471 \startcontents{\putwordShortTOC}%
6472 %
6473 \let\partentry = \shortpartentry
6474 \let\numchapentry = \shortchapentry
6475 \let\appentry = \shortchapentry
6476 \let\unnchapentry = \shortunnchapentry
6477 % We want a true roman here for the page numbers.
6478 \secfonts
6479 \let\rm=\shortcontrm \let\bf=\shortcontbf
6480 \let\sl=\shortcontsl \let\tt=\shortconttt
6481 \rm
6482 \hyphenpenalty = 10000
6483 \advance\baselineskip by 1pt % Open it up a little.
6484 \def\numsecentry##1##2##3##4{}
6485 \let\appsecentry = \numsecentry
6486 \let\unnsecentry = \numsecentry
6487 \let\numsubsecentry = \numsecentry
6488 \let\appsubsecentry = \numsecentry
6489 \let\unnsubsecentry = \numsecentry
6490 \let\numsubsubsecentry = \numsecentry
6491 \let\appsubsubsecentry = \numsecentry
6492 \let\unnsubsubsecentry = \numsecentry
6493 \openin 1 \tocreadfilename\space
6494 \ifeof 1 \else
6495 \readtocfile
6496 \fi
6497 \closein 1
6498 \vfill \eject
6499 \contentsalignmacro % in case @setchapternewpage odd is in effect
6500 \endgroup
6501 \lastnegativepageno = \pageno
6502 \global\pageno = \savepageno
6503 }
6504 \let\shortcontents = \summarycontents
6505
6506 % Typeset the label for a chapter or appendix for the short contents.
6507 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6508 %
6509 \def\shortchaplabel#1{%
6510 % This space should be enough, since a single number is .5em, and the
6511 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6512 % But use \hss just in case.
6513 % (This space doesn't include the extra space that gets added after
6514 % the label; that gets put in by \shortchapentry above.)
6515 %
6516 % We'd like to right-justify chapter numbers, but that looks strange
6517 % with appendix letters. And right-justifying numbers and
6518 % left-justifying letters looks strange when there is less than 10
6519 % chapters. Have to read the whole toc once to know how many chapters
6520 % there are before deciding ...
6521 \hbox to 1em{#1\hss}%
6522 }
6523
6524 % These macros generate individual entries in the table of contents.
6525 % The first argument is the chapter or section name.
6526 % The last argument is the page number.
6527 % The arguments in between are the chapter number, section number, ...
6528
6529 % Parts, in the main contents. Replace the part number, which doesn't
6530 % exist, with an empty box. Let's hope all the numbers have the same width.
6531 % Also ignore the page number, which is conventionally not printed.
6532 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6533 \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6534 %
6535 % Parts, in the short toc.
6536 \def\shortpartentry#1#2#3#4{%
6537 \penalty-300
6538 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6539 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6540 }
6541
6542 % Chapters, in the main contents.
6543 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6544
6545 % Chapters, in the short toc.
6546 % See comments in \dochapentry re vbox and related settings.
6547 \def\shortchapentry#1#2#3#4{%
6548 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6549 }
6550
6551 % Appendices, in the main contents.
6552 % Need the word Appendix, and a fixed-size box.
6553 %
6554 \def\appendixbox#1{%
6555 % We use M since it's probably the widest letter.
6556 \setbox0 = \hbox{\putwordAppendix{} M}%
6557 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6558 %
6559 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6560
6561 % Unnumbered chapters.
6562 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6563 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6564
6565 % Sections.
6566 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6567 \let\appsecentry=\numsecentry
6568 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6569
6570 % Subsections.
6571 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6572 \let\appsubsecentry=\numsubsecentry
6573 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6574
6575 % And subsubsections.
6576 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6577 \let\appsubsubsecentry=\numsubsubsecentry
6578 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6579
6580 % This parameter controls the indentation of the various levels.
6581 % Same as \defaultparindent.
6582 \newdimen\tocindent \tocindent = 15pt
6583
6584 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6585 % page number.
6586 %
6587 % If the toc has to be broken over pages, we want it to be at chapters
6588 % if at all possible; hence the \penalty.
6589 \def\dochapentry#1#2{%
6590 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6591 \begingroup
6592 % Move the page numbers slightly to the right
6593 \advance\entryrightmargin by -0.05em
6594 \chapentryfonts
6595 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6596 \endgroup
6597 \nobreak\vskip .25\baselineskip plus.1\baselineskip
6598 }
6599
6600 \def\dosecentry#1#2{\begingroup
6601 \secentryfonts \leftskip=\tocindent
6602 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6603 \endgroup}
6604
6605 \def\dosubsecentry#1#2{\begingroup
6606 \subsecentryfonts \leftskip=2\tocindent
6607 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6608 \endgroup}
6609
6610 \def\dosubsubsecentry#1#2{\begingroup
6611 \subsubsecentryfonts \leftskip=3\tocindent
6612 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6613 \endgroup}
6614
6615 % We use the same \entry macro as for the index entries.
6616 \let\tocentry = \entry
6617
6618 % Space between chapter (or whatever) number and the title.
6619 \def\labelspace{\hskip1em \relax}
6620
6621 \def\dopageno#1{{\rm #1}}
6622 \def\doshortpageno#1{{\rm #1}}
6623
6624 \def\chapentryfonts{\secfonts \rm}
6625 \def\secentryfonts{\textfonts}
6626 \def\subsecentryfonts{\textfonts}
6627 \def\subsubsecentryfonts{\textfonts}
6628
6629
6630 \message{environments,}
6631 % @foo ... @end foo.
6632
6633 % @tex ... @end tex escapes into raw TeX temporarily.
6634 % One exception: @ is still an escape character, so that @end tex works.
6635 % But \@ or @@ will get a plain @ character.
6636
6637 \envdef\tex{%
6638 \setupmarkupstyle{tex}%
6639 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6640 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6641 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6642 \catcode `\%=14
6643 \catcode `\+=\other
6644 \catcode `\"=\other
6645 \catcode `\|=\other
6646 \catcode `\<=\other
6647 \catcode `\>=\other
6648 \catcode `\`=\other
6649 \catcode `\'=\other
6650 \escapechar=`\\
6651 %
6652 % ' is active in math mode (mathcode"8000). So reset it, and all our
6653 % other math active characters (just in case), to plain's definitions.
6654 \mathactive
6655 %
6656 % Inverse of the list at the beginning of the file.
6657 \let\b=\ptexb
6658 \let\bullet=\ptexbullet
6659 \let\c=\ptexc
6660 \let\,=\ptexcomma
6661 \let\.=\ptexdot
6662 \let\dots=\ptexdots
6663 \let\equiv=\ptexequiv
6664 \let\!=\ptexexclam
6665 \let\i=\ptexi
6666 \let\indent=\ptexindent
6667 \let\noindent=\ptexnoindent
6668 \let\{=\ptexlbrace
6669 \let\+=\tabalign
6670 \let\}=\ptexrbrace
6671 \let\/=\ptexslash
6672 \let\sp=\ptexsp
6673 \let\*=\ptexstar
6674 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
6675 \let\t=\ptext
6676 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
6677 \let\frenchspacing=\plainfrenchspacing
6678 %
6679 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
6680 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
6681 \def\@{@}%
6682 }
6683 % There is no need to define \Etex.
6684
6685 % Define @lisp ... @end lisp.
6686 % @lisp environment forms a group so it can rebind things,
6687 % including the definition of @end lisp (which normally is erroneous).
6688
6689 % Amount to narrow the margins by for @lisp.
6690 \newskip\lispnarrowing \lispnarrowing=0.4in
6691
6692 % This is the definition that ^^M gets inside @lisp, @example, and other
6693 % such environments. \null is better than a space, since it doesn't
6694 % have any width.
6695 \def\lisppar{\null\endgraf}
6696
6697 % This space is always present above and below environments.
6698 \newskip\envskipamount \envskipamount = 0pt
6699
6700 % Make spacing and below environment symmetrical. We use \parskip here
6701 % to help in doing that, since in @example-like environments \parskip
6702 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
6703 % start of the next paragraph will insert \parskip.
6704 %
6705 \def\aboveenvbreak{{%
6706 % =10000 instead of <10000 because of a special case in \itemzzz and
6707 % \sectionheading, q.v.
6708 \ifnum \lastpenalty=10000 \else
6709 \advance\envskipamount by \parskip
6710 \endgraf
6711 \ifdim\lastskip<\envskipamount
6712 \removelastskip
6713 \ifnum\lastpenalty<10000
6714 % Penalize breaking before the environment, because preceding text
6715 % often leads into it.
6716 \penalty100
6717 \fi
6718 \vskip\envskipamount
6719 \fi
6720 \fi
6721 }}
6722
6723 \def\afterenvbreak{{%
6724 % =10000 instead of <10000 because of a special case in \itemzzz and
6725 % \sectionheading, q.v.
6726 \ifnum \lastpenalty=10000 \else
6727 \advance\envskipamount by \parskip
6728 \endgraf
6729 \ifdim\lastskip<\envskipamount
6730 \removelastskip
6731 % it's not a good place to break if the last penalty was \nobreak
6732 % or better ...
6733 \ifnum\lastpenalty<10000 \penalty-50 \fi
6734 \vskip\envskipamount
6735 \fi
6736 \fi
6737 }}
6738
6739 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
6740 % also clear it, so that its embedded environments do the narrowing again.
6741 \let\nonarrowing=\relax
6742
6743 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
6744 % environment contents.
6745 \font\circle=lcircle10
6746 \newdimen\circthick
6747 \newdimen\cartouter\newdimen\cartinner
6748 \newskip\normbskip\newskip\normpskip\newskip\normlskip
6749 \circthick=\fontdimen8\circle
6750 %
6751 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
6752 \def\ctr{{\hskip 6pt\circle\char'010}}
6753 \def\cbl{{\circle\char'012\hskip -6pt}}
6754 \def\cbr{{\hskip 6pt\circle\char'011}}
6755 \def\carttop{\hbox to \cartouter{\hskip\lskip
6756 \ctl\leaders\hrule height\circthick\hfil\ctr
6757 \hskip\rskip}}
6758 \def\cartbot{\hbox to \cartouter{\hskip\lskip
6759 \cbl\leaders\hrule height\circthick\hfil\cbr
6760 \hskip\rskip}}
6761 %
6762 \newskip\lskip\newskip\rskip
6763
6764 \envdef\cartouche{%
6765 \ifhmode\par\fi % can't be in the midst of a paragraph.
6766 \startsavinginserts
6767 \lskip=\leftskip \rskip=\rightskip
6768 \leftskip=0pt\rightskip=0pt % we want these *outside*.
6769 \cartinner=\hsize \advance\cartinner by-\lskip
6770 \advance\cartinner by-\rskip
6771 \cartouter=\hsize
6772 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
6773 % side, and for 6pt waste from
6774 % each corner char, and rule thickness
6775 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
6776 %
6777 % If this cartouche directly follows a sectioning command, we need the
6778 % \parskip glue (backspaced over by default) or the cartouche can
6779 % collide with the section heading.
6780 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
6781 %
6782 \setbox\groupbox=\vbox\bgroup
6783 \baselineskip=0pt\parskip=0pt\lineskip=0pt
6784 \carttop
6785 \hbox\bgroup
6786 \hskip\lskip
6787 \vrule\kern3pt
6788 \vbox\bgroup
6789 \kern3pt
6790 \hsize=\cartinner
6791 \baselineskip=\normbskip
6792 \lineskip=\normlskip
6793 \parskip=\normpskip
6794 \vskip -\parskip
6795 \comment % For explanation, see the end of def\group.
6796 }
6797 \def\Ecartouche{%
6798 \ifhmode\par\fi
6799 \kern3pt
6800 \egroup
6801 \kern3pt\vrule
6802 \hskip\rskip
6803 \egroup
6804 \cartbot
6805 \egroup
6806 \addgroupbox
6807 \checkinserts
6808 }
6809
6810
6811 % This macro is called at the beginning of all the @example variants,
6812 % inside a group.
6813 \newdimen\nonfillparindent
6814 \def\nonfillstart{%
6815 \aboveenvbreak
6816 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
6817 \sepspaces % Make spaces be word-separators rather than space tokens.
6818 \let\par = \lisppar % don't ignore blank lines
6819 \obeylines % each line of input is a line of output
6820 \parskip = 0pt
6821 % Turn off paragraph indentation but redefine \indent to emulate
6822 % the normal \indent.
6823 \nonfillparindent=\parindent
6824 \parindent = 0pt
6825 \let\indent\nonfillindent
6826 %
6827 \emergencystretch = 0pt % don't try to avoid overfull boxes
6828 \ifx\nonarrowing\relax
6829 \advance \leftskip by \lispnarrowing
6830 \exdentamount=\lispnarrowing
6831 \else
6832 \let\nonarrowing = \relax
6833 \fi
6834 \let\exdent=\nofillexdent
6835 }
6836
6837 \begingroup
6838 \obeyspaces
6839 % We want to swallow spaces (but not other tokens) after the fake
6840 % @indent in our nonfill-environments, where spaces are normally
6841 % active and set to @tie, resulting in them not being ignored after
6842 % @indent.
6843 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
6844 \gdef\nonfillindentcheck{%
6845 \ifx\temp %
6846 \expandafter\nonfillindentgobble%
6847 \else%
6848 \leavevmode\nonfillindentbox%
6849 \fi%
6850 }%
6851 \endgroup
6852 \def\nonfillindentgobble#1{\nonfillindent}
6853 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
6854
6855 % If you want all examples etc. small: @set dispenvsize small.
6856 % If you want even small examples the full size: @set dispenvsize nosmall.
6857 % This affects the following displayed environments:
6858 % @example, @display, @format, @lisp
6859 %
6860 \def\smallword{small}
6861 \def\nosmallword{nosmall}
6862 \let\SETdispenvsize\relax
6863 \def\setnormaldispenv{%
6864 \ifx\SETdispenvsize\smallword
6865 % end paragraph for sake of leading, in case document has no blank
6866 % line. This is redundant with what happens in \aboveenvbreak, but
6867 % we need to do it before changing the fonts, and it's inconvenient
6868 % to change the fonts afterward.
6869 \ifnum \lastpenalty=10000 \else \endgraf \fi
6870 \smallexamplefonts \rm
6871 \fi
6872 }
6873 \def\setsmalldispenv{%
6874 \ifx\SETdispenvsize\nosmallword
6875 \else
6876 \ifnum \lastpenalty=10000 \else \endgraf \fi
6877 \smallexamplefonts \rm
6878 \fi
6879 }
6880
6881 % We often define two environments, @foo and @smallfoo.
6882 % Let's do it in one command. #1 is the env name, #2 the definition.
6883 \def\makedispenvdef#1#2{%
6884 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
6885 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
6886 \expandafter\let\csname E#1\endcsname \afterenvbreak
6887 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
6888 }
6889
6890 % Define two environment synonyms (#1 and #2) for an environment.
6891 \def\maketwodispenvdef#1#2#3{%
6892 \makedispenvdef{#1}{#3}%
6893 \makedispenvdef{#2}{#3}%
6894 }
6895 %
6896 % @lisp: indented, narrowed, typewriter font;
6897 % @example: same as @lisp.
6898 %
6899 % @smallexample and @smalllisp: use smaller fonts.
6900 % Originally contributed by Pavel@xerox.
6901 %
6902 \maketwodispenvdef{lisp}{example}{%
6903 \nonfillstart
6904 \tt\setupmarkupstyle{example}%
6905 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
6906 \gobble % eat return
6907 }
6908 % @display/@smalldisplay: same as @lisp except keep current font.
6909 %
6910 \makedispenvdef{display}{%
6911 \nonfillstart
6912 \gobble
6913 }
6914
6915 % @format/@smallformat: same as @display except don't narrow margins.
6916 %
6917 \makedispenvdef{format}{%
6918 \let\nonarrowing = t%
6919 \nonfillstart
6920 \gobble
6921 }
6922
6923 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
6924 \envdef\flushleft{%
6925 \let\nonarrowing = t%
6926 \nonfillstart
6927 \gobble
6928 }
6929 \let\Eflushleft = \afterenvbreak
6930
6931 % @flushright.
6932 %
6933 \envdef\flushright{%
6934 \let\nonarrowing = t%
6935 \nonfillstart
6936 \advance\leftskip by 0pt plus 1fill\relax
6937 \gobble
6938 }
6939 \let\Eflushright = \afterenvbreak
6940
6941
6942 % @raggedright does more-or-less normal line breaking but no right
6943 % justification. From plain.tex. Don't stretch around special
6944 % characters in urls in this environment, since the stretch at the right
6945 % should be enough.
6946 \envdef\raggedright{%
6947 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
6948 \def\urefprestretchamount{0pt}%
6949 \def\urefpoststretchamount{0pt}%
6950 }
6951 \let\Eraggedright\par
6952
6953 \envdef\raggedleft{%
6954 \parindent=0pt \leftskip0pt plus2em
6955 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6956 \hbadness=10000 % Last line will usually be underfull, so turn off
6957 % badness reporting.
6958 }
6959 \let\Eraggedleft\par
6960
6961 \envdef\raggedcenter{%
6962 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
6963 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6964 \hbadness=10000 % Last line will usually be underfull, so turn off
6965 % badness reporting.
6966 }
6967 \let\Eraggedcenter\par
6968
6969
6970 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
6971 % and narrows the margins. We keep \parskip nonzero in general, since
6972 % we're doing normal filling. So, when using \aboveenvbreak and
6973 % \afterenvbreak, temporarily make \parskip 0.
6974 %
6975 \makedispenvdef{quotation}{\quotationstart}
6976 %
6977 \def\quotationstart{%
6978 \indentedblockstart % same as \indentedblock, but increase right margin too.
6979 \ifx\nonarrowing\relax
6980 \advance\rightskip by \lispnarrowing
6981 \fi
6982 \parsearg\quotationlabel
6983 }
6984
6985 % We have retained a nonzero parskip for the environment, since we're
6986 % doing normal filling.
6987 %
6988 \def\Equotation{%
6989 \par
6990 \ifx\quotationauthor\thisisundefined\else
6991 % indent a bit.
6992 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
6993 \fi
6994 {\parskip=0pt \afterenvbreak}%
6995 }
6996 \def\Esmallquotation{\Equotation}
6997
6998 % If we're given an argument, typeset it in bold with a colon after.
6999 \def\quotationlabel#1{%
7000 \def\temp{#1}%
7001 \ifx\temp\empty \else
7002 {\bf #1: }%
7003 \fi
7004 }
7005
7006 % @indentedblock is like @quotation, but indents only on the left and
7007 % has no optional argument.
7008 %
7009 \makedispenvdef{indentedblock}{\indentedblockstart}
7010 %
7011 \def\indentedblockstart{%
7012 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7013 \parindent=0pt
7014 %
7015 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7016 \ifx\nonarrowing\relax
7017 \advance\leftskip by \lispnarrowing
7018 \exdentamount = \lispnarrowing
7019 \else
7020 \let\nonarrowing = \relax
7021 \fi
7022 }
7023
7024 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7025 %
7026 \def\Eindentedblock{%
7027 \par
7028 {\parskip=0pt \afterenvbreak}%
7029 }
7030 \def\Esmallindentedblock{\Eindentedblock}
7031
7032
7033 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7034 % If we want to allow any <char> as delimiter,
7035 % we need the curly braces so that makeinfo sees the @verb command, eg:
7036 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7037 %
7038 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7039 %
7040 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7041 % active too. Otherwise, they get lost as the first character on a
7042 % verbatim line.
7043 \def\dospecials{%
7044 \do\ \do\\\do\{\do\}\do\$\do\&%
7045 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7046 \do\<\do\>\do\|\do\@\do+\do\"%
7047 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7048 % @set txicodequotebacktick will not have effect on @verb and
7049 % @verbatim, and ?` and !` ligatures won't get disabled.
7050 %\do\`\do\'%
7051 }
7052 %
7053 % [Knuth] p. 380
7054 \def\uncatcodespecials{%
7055 \def\do##1{\catcode`##1=\other}\dospecials}
7056 %
7057 % Setup for the @verb command.
7058 %
7059 % Eight spaces for a tab
7060 \begingroup
7061 \catcode`\^^I=\active
7062 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7063 \endgroup
7064 %
7065 \def\setupverb{%
7066 \tt % easiest (and conventionally used) font for verbatim
7067 \def\par{\leavevmode\endgraf}%
7068 \setupmarkupstyle{verb}%
7069 \tabeightspaces
7070 % Respect line breaks,
7071 % print special symbols as themselves, and
7072 % make each space count
7073 % must do in this order:
7074 \obeylines \uncatcodespecials \sepspaces
7075 }
7076
7077 % Setup for the @verbatim environment
7078 %
7079 % Real tab expansion.
7080 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7081 %
7082 % We typeset each line of the verbatim in an \hbox, so we can handle
7083 % tabs. The \global is in case the verbatim line starts with an accent,
7084 % or some other command that starts with a begin-group. Otherwise, the
7085 % entire \verbbox would disappear at the corresponding end-group, before
7086 % it is typeset. Meanwhile, we can't have nested verbatim commands
7087 % (can we?), so the \global won't be overwriting itself.
7088 \newbox\verbbox
7089 \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
7090 %
7091 \begingroup
7092 \catcode`\^^I=\active
7093 \gdef\tabexpand{%
7094 \catcode`\^^I=\active
7095 \def^^I{\leavevmode\egroup
7096 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7097 \divide\dimen\verbbox by\tabw
7098 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7099 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7100 \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
7101 }%
7102 }
7103 \endgroup
7104
7105 % start the verbatim environment.
7106 \def\setupverbatim{%
7107 \let\nonarrowing = t%
7108 \nonfillstart
7109 \tt % easiest (and conventionally used) font for verbatim
7110 % The \leavevmode here is for blank lines. Otherwise, we would
7111 % never \starttabox and the \egroup would end verbatim mode.
7112 \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
7113 \tabexpand
7114 \setupmarkupstyle{verbatim}%
7115 % Respect line breaks,
7116 % print special symbols as themselves, and
7117 % make each space count.
7118 % Must do in this order:
7119 \obeylines \uncatcodespecials \sepspaces
7120 \everypar{\starttabbox}%
7121 }
7122
7123 % Do the @verb magic: verbatim text is quoted by unique
7124 % delimiter characters. Before first delimiter expect a
7125 % right brace, after last delimiter expect closing brace:
7126 %
7127 % \def\doverb'{'<char>#1<char>'}'{#1}
7128 %
7129 % [Knuth] p. 382; only eat outer {}
7130 \begingroup
7131 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7132 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7133 \endgroup
7134 %
7135 \def\verb{\begingroup\setupverb\doverb}
7136 %
7137 %
7138 % Do the @verbatim magic: define the macro \doverbatim so that
7139 % the (first) argument ends when '@end verbatim' is reached, ie:
7140 %
7141 % \def\doverbatim#1@end verbatim{#1}
7142 %
7143 % For Texinfo it's a lot easier than for LaTeX,
7144 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7145 % we need not redefine '\', '{' and '}'.
7146 %
7147 % Inspired by LaTeX's verbatim command set [latex.ltx]
7148 %
7149 \begingroup
7150 \catcode`\ =\active
7151 \obeylines %
7152 % ignore everything up to the first ^^M, that's the newline at the end
7153 % of the @verbatim input line itself. Otherwise we get an extra blank
7154 % line in the output.
7155 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
7156 % We really want {...\end verbatim} in the body of the macro, but
7157 % without the active space; thus we have to use \xdef and \gobble.
7158 \endgroup
7159 %
7160 \envdef\verbatim{%
7161 \setupverbatim\doverbatim
7162 }
7163 \let\Everbatim = \afterenvbreak
7164
7165
7166 % @verbatiminclude FILE - insert text of file in verbatim environment.
7167 %
7168 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7169 %
7170 \def\doverbatiminclude#1{%
7171 {%
7172 \makevalueexpandable
7173 \setupverbatim
7174 \indexnofonts % Allow `@@' and other weird things in file names.
7175 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7176 \input #1
7177 \afterenvbreak
7178 }%
7179 }
7180
7181 % @copying ... @end copying.
7182 % Save the text away for @insertcopying later.
7183 %
7184 % We save the uninterpreted tokens, rather than creating a box.
7185 % Saving the text in a box would be much easier, but then all the
7186 % typesetting commands (@smallbook, font changes, etc.) have to be done
7187 % beforehand -- and a) we want @copying to be done first in the source
7188 % file; b) letting users define the frontmatter in as flexible order as
7189 % possible is desirable.
7190 %
7191 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7192 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7193 %
7194 \def\insertcopying{%
7195 \begingroup
7196 \parindent = 0pt % paragraph indentation looks wrong on title page
7197 \scanexp\copyingtext
7198 \endgroup
7199 }
7200
7201
7202 \message{defuns,}
7203 % @defun etc.
7204
7205 \newskip\defbodyindent \defbodyindent=.4in
7206 \newskip\defargsindent \defargsindent=50pt
7207 \newskip\deflastargmargin \deflastargmargin=18pt
7208 \newcount\defunpenalty
7209
7210 % Start the processing of @deffn:
7211 \def\startdefun{%
7212 \ifnum\lastpenalty<10000
7213 \medbreak
7214 \defunpenalty=10003 % Will keep this @deffn together with the
7215 % following @def command, see below.
7216 \else
7217 % If there are two @def commands in a row, we'll have a \nobreak,
7218 % which is there to keep the function description together with its
7219 % header. But if there's nothing but headers, we need to allow a
7220 % break somewhere. Check specifically for penalty 10002, inserted
7221 % by \printdefunline, instead of 10000, since the sectioning
7222 % commands also insert a nobreak penalty, and we don't want to allow
7223 % a break between a section heading and a defun.
7224 %
7225 % As a further refinement, we avoid "club" headers by signalling
7226 % with penalty of 10003 after the very first @deffn in the
7227 % sequence (see above), and penalty of 10002 after any following
7228 % @def command.
7229 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7230 %
7231 % Similarly, after a section heading, do not allow a break.
7232 % But do insert the glue.
7233 \medskip % preceded by discardable penalty, so not a breakpoint
7234 \fi
7235 %
7236 \parindent=0in
7237 \advance\leftskip by \defbodyindent
7238 \exdentamount=\defbodyindent
7239 }
7240
7241 \def\dodefunx#1{%
7242 % First, check whether we are in the right environment:
7243 \checkenv#1%
7244 %
7245 % As above, allow line break if we have multiple x headers in a row.
7246 % It's not a great place, though.
7247 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7248 %
7249 % And now, it's time to reuse the body of the original defun:
7250 \expandafter\gobbledefun#1%
7251 }
7252 \def\gobbledefun#1\startdefun{}
7253
7254 % \printdefunline \deffnheader{text}
7255 %
7256 \def\printdefunline#1#2{%
7257 \begingroup
7258 % call \deffnheader:
7259 #1#2 \endheader
7260 % common ending:
7261 \interlinepenalty = 10000
7262 \advance\rightskip by 0pt plus 1fil\relax
7263 \endgraf
7264 \nobreak\vskip -\parskip
7265 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7266 % Some of the @defun-type tags do not enable magic parentheses,
7267 % rendering the following check redundant. But we don't optimize.
7268 \checkparencounts
7269 \endgroup
7270 }
7271
7272 \def\Edefun{\endgraf\medbreak}
7273
7274 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7275 % the only thing remaining is to define \deffnheader.
7276 %
7277 \def\makedefun#1{%
7278 \expandafter\let\csname E#1\endcsname = \Edefun
7279 \edef\temp{\noexpand\domakedefun
7280 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7281 \temp
7282 }
7283
7284 % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7285 %
7286 % Define \deffn and \deffnx, without parameters.
7287 % \deffnheader has to be defined explicitly.
7288 %
7289 \def\domakedefun#1#2#3{%
7290 \envdef#1{%
7291 \startdefun
7292 \doingtypefnfalse % distinguish typed functions from all else
7293 \parseargusing\activeparens{\printdefunline#3}%
7294 }%
7295 \def#2{\dodefunx#1}%
7296 \def#3%
7297 }
7298
7299 \newif\ifdoingtypefn % doing typed function?
7300 \newif\ifrettypeownline % typeset return type on its own line?
7301
7302 % @deftypefnnewline on|off says whether the return type of typed functions
7303 % are printed on their own line. This affects @deftypefn, @deftypefun,
7304 % @deftypeop, and @deftypemethod.
7305 %
7306 \parseargdef\deftypefnnewline{%
7307 \def\temp{#1}%
7308 \ifx\temp\onword
7309 \expandafter\let\csname SETtxideftypefnnl\endcsname
7310 = \empty
7311 \else\ifx\temp\offword
7312 \expandafter\let\csname SETtxideftypefnnl\endcsname
7313 = \relax
7314 \else
7315 \errhelp = \EMsimple
7316 \errmessage{Unknown @txideftypefnnl value `\temp',
7317 must be on|off}%
7318 \fi\fi
7319 }
7320
7321 % Untyped functions:
7322
7323 % @deffn category name args
7324 \makedefun{deffn}{\deffngeneral{}}
7325
7326 % @deffn category class name args
7327 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7328
7329 % \defopon {category on}class name args
7330 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7331
7332 % \deffngeneral {subind}category name args
7333 %
7334 \def\deffngeneral#1#2 #3 #4\endheader{%
7335 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
7336 \dosubind{fn}{\code{#3}}{#1}%
7337 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7338 }
7339
7340 % Typed functions:
7341
7342 % @deftypefn category type name args
7343 \makedefun{deftypefn}{\deftypefngeneral{}}
7344
7345 % @deftypeop category class type name args
7346 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7347
7348 % \deftypeopon {category on}class type name args
7349 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7350
7351 % \deftypefngeneral {subind}category type name args
7352 %
7353 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7354 \dosubind{fn}{\code{#4}}{#1}%
7355 \doingtypefntrue
7356 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7357 }
7358
7359 % Typed variables:
7360
7361 % @deftypevr category type var args
7362 \makedefun{deftypevr}{\deftypecvgeneral{}}
7363
7364 % @deftypecv category class type var args
7365 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7366
7367 % \deftypecvof {category of}class type var args
7368 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7369
7370 % \deftypecvgeneral {subind}category type var args
7371 %
7372 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7373 \dosubind{vr}{\code{#4}}{#1}%
7374 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7375 }
7376
7377 % Untyped variables:
7378
7379 % @defvr category var args
7380 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7381
7382 % @defcv category class var args
7383 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7384
7385 % \defcvof {category of}class var args
7386 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7387
7388 % Types:
7389
7390 % @deftp category name args
7391 \makedefun{deftp}#1 #2 #3\endheader{%
7392 \doind{tp}{\code{#2}}%
7393 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7394 }
7395
7396 % Remaining @defun-like shortcuts:
7397 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7398 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7399 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7400 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7401 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7402 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7403 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7404 \makedefun{defmethod}{\defopon\putwordMethodon}
7405 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7406 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7407 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7408
7409 % \defname, which formats the name of the @def (not the args).
7410 % #1 is the category, such as "Function".
7411 % #2 is the return type, if any.
7412 % #3 is the function name.
7413 %
7414 % We are followed by (but not passed) the arguments, if any.
7415 %
7416 \def\defname#1#2#3{%
7417 \par
7418 % Get the values of \leftskip and \rightskip as they were outside the @def...
7419 \advance\leftskip by -\defbodyindent
7420 %
7421 % Determine if we are typesetting the return type of a typed function
7422 % on a line by itself.
7423 \rettypeownlinefalse
7424 \ifdoingtypefn % doing a typed function specifically?
7425 % then check user option for putting return type on its own line:
7426 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7427 \rettypeownlinetrue
7428 \fi
7429 \fi
7430 %
7431 % How we'll format the category name. Putting it in brackets helps
7432 % distinguish it from the body text that may end up on the next line
7433 % just below it.
7434 \def\temp{#1}%
7435 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7436 %
7437 % Figure out line sizes for the paragraph shape. We'll always have at
7438 % least two.
7439 \tempnum = 2
7440 %
7441 % The first line needs space for \box0; but if \rightskip is nonzero,
7442 % we need only space for the part of \box0 which exceeds it:
7443 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7444 %
7445 % If doing a return type on its own line, we'll have another line.
7446 \ifrettypeownline
7447 \advance\tempnum by 1
7448 \def\maybeshapeline{0in \hsize}%
7449 \else
7450 \def\maybeshapeline{}%
7451 \fi
7452 %
7453 % The continuations:
7454 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7455 %
7456 % The final paragraph shape:
7457 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7458 %
7459 % Put the category name at the right margin.
7460 \noindent
7461 \hbox to 0pt{%
7462 \hfil\box0 \kern-\hsize
7463 % \hsize has to be shortened this way:
7464 \kern\leftskip
7465 % Intentionally do not respect \rightskip, since we need the space.
7466 }%
7467 %
7468 % Allow all lines to be underfull without complaint:
7469 \tolerance=10000 \hbadness=10000
7470 \exdentamount=\defbodyindent
7471 {%
7472 % defun fonts. We use typewriter by default (used to be bold) because:
7473 % . we're printing identifiers, they should be in tt in principle.
7474 % . in languages with many accents, such as Czech or French, it's
7475 % common to leave accents off identifiers. The result looks ok in
7476 % tt, but exceedingly strange in rm.
7477 % . we don't want -- and --- to be treated as ligatures.
7478 % . this still does not fix the ?` and !` ligatures, but so far no
7479 % one has made identifiers using them :).
7480 \df \tt
7481 \def\temp{#2}% text of the return type
7482 \ifx\temp\empty\else
7483 \tclose{\temp}% typeset the return type
7484 \ifrettypeownline
7485 % put return type on its own line; prohibit line break following:
7486 \hfil\vadjust{\nobreak}\break
7487 \else
7488 \space % type on same line, so just followed by a space
7489 \fi
7490 \fi % no return type
7491 #3% output function name
7492 }%
7493 {\rm\enskip}% hskip 0.5 em of \tenrm
7494 %
7495 \boldbrax
7496 % arguments will be output next, if any.
7497 }
7498
7499 % Print arguments in slanted roman (not ttsl), inconsistently with using
7500 % tt for the name. This is because literal text is sometimes needed in
7501 % the argument list (groff manual), and ttsl and tt are not very
7502 % distinguishable. Prevent hyphenation at `-' chars.
7503 %
7504 \def\defunargs#1{%
7505 % use sl by default (not ttsl),
7506 % tt for the names.
7507 \df \sl \hyphenchar\font=0
7508 %
7509 % On the other hand, if an argument has two dashes (for instance), we
7510 % want a way to get ttsl. We used to recommend @var for that, so
7511 % leave the code in, but it's strange for @var to lead to typewriter.
7512 % Nowadays we recommend @code, since the difference between a ttsl hyphen
7513 % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7514 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7515 #1%
7516 \sl\hyphenchar\font=45
7517 }
7518
7519 % We want ()&[] to print specially on the defun line.
7520 %
7521 \def\activeparens{%
7522 \catcode`\(=\active \catcode`\)=\active
7523 \catcode`\[=\active \catcode`\]=\active
7524 \catcode`\&=\active
7525 }
7526
7527 % Make control sequences which act like normal parenthesis chars.
7528 \let\lparen = ( \let\rparen = )
7529
7530 % Be sure that we always have a definition for `(', etc. For example,
7531 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7532 % so TeX would otherwise complain about undefined control sequence.
7533 {
7534 \activeparens
7535 \global\let(=\lparen \global\let)=\rparen
7536 \global\let[=\lbrack \global\let]=\rbrack
7537 \global\let& = \&
7538
7539 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7540 \gdef\magicamp{\let&=\amprm}
7541 }
7542
7543 \newcount\parencount
7544
7545 % If we encounter &foo, then turn on ()-hacking afterwards
7546 \newif\ifampseen
7547 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
7548
7549 \def\parenfont{%
7550 \ifampseen
7551 % At the first level, print parens in roman,
7552 % otherwise use the default font.
7553 \ifnum \parencount=1 \rm \fi
7554 \else
7555 % The \sf parens (in \boldbrax) actually are a little bolder than
7556 % the contained text. This is especially needed for [ and ] .
7557 \sf
7558 \fi
7559 }
7560 \def\infirstlevel#1{%
7561 \ifampseen
7562 \ifnum\parencount=1
7563 #1%
7564 \fi
7565 \fi
7566 }
7567 \def\bfafterword#1 {#1 \bf}
7568
7569 \def\opnr{%
7570 \global\advance\parencount by 1
7571 {\parenfont(}%
7572 \infirstlevel \bfafterword
7573 }
7574 \def\clnr{%
7575 {\parenfont)}%
7576 \infirstlevel \sl
7577 \global\advance\parencount by -1
7578 }
7579
7580 \newcount\brackcount
7581 \def\lbrb{%
7582 \global\advance\brackcount by 1
7583 {\bf[}%
7584 }
7585 \def\rbrb{%
7586 {\bf]}%
7587 \global\advance\brackcount by -1
7588 }
7589
7590 \def\checkparencounts{%
7591 \ifnum\parencount=0 \else \badparencount \fi
7592 \ifnum\brackcount=0 \else \badbrackcount \fi
7593 }
7594 % these should not use \errmessage; the glibc manual, at least, actually
7595 % has such constructs (when documenting function pointers).
7596 \def\badparencount{%
7597 \message{Warning: unbalanced parentheses in @def...}%
7598 \global\parencount=0
7599 }
7600 \def\badbrackcount{%
7601 \message{Warning: unbalanced square brackets in @def...}%
7602 \global\brackcount=0
7603 }
7604
7605
7606 \message{macros,}
7607 % @macro.
7608
7609 % To do this right we need a feature of e-TeX, \scantokens,
7610 % which we arrange to emulate with a temporary file in ordinary TeX.
7611 \ifx\eTeXversion\thisisundefined
7612 \newwrite\macscribble
7613 \def\scantokens#1{%
7614 \toks0={#1}%
7615 \immediate\openout\macscribble=\jobname.tmp
7616 \immediate\write\macscribble{\the\toks0}%
7617 \immediate\closeout\macscribble
7618 \input \jobname.tmp
7619 }
7620 \fi
7621
7622 \let\aftermacroxxx\relax
7623 \def\aftermacro{\aftermacroxxx}
7624
7625 % alias because \c means cedilla in @tex or @math
7626 \let\texinfoc=\c
7627
7628 % Used at the time of macro expansion.
7629 % Argument is macro body with arguments substituted
7630 \def\scanmacro#1{%
7631 \newlinechar`\^^M
7632 \def\xprocessmacroarg{\eatspaces}%
7633 %
7634 % Process the macro body under the current catcode regime.
7635 \scantokens{#1\texinfoc}\aftermacro%
7636 %
7637 % The \c is to remove the \newlinechar added by \scantokens, and
7638 % can be noticed by \parsearg.
7639 % The \aftermacro allows a \comment at the end of the macro definition
7640 % to duplicate itself past the final \newlinechar added by \scantokens:
7641 % this is used in the definition of \group to comment out a newline. We
7642 % don't do the same for \c to support Texinfo files with macros that ended
7643 % with a @c, which should no longer be necessary.
7644 % We avoid surrounding the call to \scantokens with \bgroup and \egroup
7645 % to allow macros to open or close groups themselves.
7646 }
7647
7648 % Used for copying and captions
7649 \def\scanexp#1{%
7650 \bgroup
7651 % Undo catcode changes of \startcontents and \printindex
7652 % When called from @insertcopying or (short)caption, we need active
7653 % backslash to get it printed correctly.
7654 % FIXME: This may not be needed.
7655 %\catcode`\@=0 \catcode`\\=\active \escapechar=`\@
7656 \edef\temp{\noexpand\scanmacro{#1}}%
7657 \temp
7658 \egroup
7659 }
7660
7661 \newcount\paramno % Count of parameters
7662 \newtoks\macname % Macro name
7663 \newif\ifrecursive % Is it recursive?
7664
7665 % List of all defined macros in the form
7666 % \definedummyword\macro1\definedummyword\macro2...
7667 % Currently is also contains all @aliases; the list can be split
7668 % if there is a need.
7669 \def\macrolist{}
7670
7671 % Add the macro to \macrolist
7672 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7673 \def\addtomacrolistxxx#1{%
7674 \toks0 = \expandafter{\macrolist\definedummyword#1}%
7675 \xdef\macrolist{\the\toks0}%
7676 }
7677
7678 % Utility routines.
7679 % This does \let #1 = #2, with \csnames; that is,
7680 % \let \csname#1\endcsname = \csname#2\endcsname
7681 % (except of course we have to play expansion games).
7682 %
7683 \def\cslet#1#2{%
7684 \expandafter\let
7685 \csname#1\expandafter\endcsname
7686 \csname#2\endcsname
7687 }
7688
7689 % Trim leading and trailing spaces off a string.
7690 % Concepts from aro-bend problem 15 (see CTAN).
7691 {\catcode`\@=11
7692 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7693 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7694 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7695 \def\unbrace#1{#1}
7696 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
7697 }
7698
7699 % Trim a single trailing ^^M off a string.
7700 {\catcode`\^^M=\other \catcode`\Q=3%
7701 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
7702 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
7703 \gdef\eatcrb#1Q#2Q{#1}%
7704 }
7705
7706 % Macro bodies are absorbed as an argument in a context where
7707 % all characters are catcode 10, 11 or 12, except \ which is active
7708 % (as in normal texinfo). It is necessary to change the definition of \
7709 % to recognize macro arguments; this is the job of \mbodybackslash.
7710 %
7711 % Non-ASCII encodings make 8-bit characters active, so un-activate
7712 % them to avoid their expansion. Must do this non-globally, to
7713 % confine the change to the current group.
7714 %
7715 % It's necessary to have hard CRs when the macro is executed. This is
7716 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
7717 % body, and then making it the \newlinechar in \scanmacro.
7718 %
7719 \def\scanctxt{% used as subroutine
7720 \catcode`\"=\other
7721 \catcode`\+=\other
7722 \catcode`\<=\other
7723 \catcode`\>=\other
7724 \catcode`\^=\other
7725 \catcode`\_=\other
7726 \catcode`\|=\other
7727 \catcode`\~=\other
7728 \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
7729 }
7730
7731 \def\scanargctxt{% used for copying and captions, not macros.
7732 \scanctxt
7733 \catcode`\@=\other
7734 \catcode`\\=\other
7735 \catcode`\^^M=\other
7736 }
7737
7738 \def\macrobodyctxt{% used for @macro definitions
7739 \scanctxt
7740 \catcode`\ =\other
7741 \catcode`\@=\other
7742 \catcode`\{=\other
7743 \catcode`\}=\other
7744 \catcode`\^^M=\other
7745 \usembodybackslash
7746 }
7747
7748 % Used when scanning braced macro arguments. Note, however, that catcode
7749 % changes here are ineffectual if the macro invocation was nested inside
7750 % an argument to another Texinfo command.
7751 \def\macroargctxt{%
7752 \scanctxt
7753 \catcode`\ =\active
7754 \catcode`\^^M=\other
7755 \catcode`\\=\active
7756 }
7757
7758 \def\macrolineargctxt{% used for whole-line arguments without braces
7759 \scanctxt
7760 \catcode`\{=\other
7761 \catcode`\}=\other
7762 }
7763
7764 % \mbodybackslash is the definition of \ in @macro bodies.
7765 % It maps \foo\ => \csname macarg.foo\endcsname => #N
7766 % where N is the macro parameter number.
7767 % We define \csname macarg.\endcsname to be \realbackslash, so
7768 % \\ in macro replacement text gets you a backslash.
7769 %
7770 {\catcode`@=0 @catcode`@\=@active
7771 @gdef@usembodybackslash{@let\=@mbodybackslash}
7772 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
7773 }
7774 \expandafter\def\csname macarg.\endcsname{\realbackslash}
7775
7776 \def\margbackslash#1{\char`\#1 }
7777
7778 \def\macro{\recursivefalse\parsearg\macroxxx}
7779 \def\rmacro{\recursivetrue\parsearg\macroxxx}
7780
7781 \def\macroxxx#1{%
7782 \getargs{#1}% now \macname is the macname and \argl the arglist
7783 \ifx\argl\empty % no arguments
7784 \paramno=0\relax
7785 \else
7786 \expandafter\parsemargdef \argl;%
7787 \if\paramno>256\relax
7788 \ifx\eTeXversion\thisisundefined
7789 \errhelp = \EMsimple
7790 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
7791 \fi
7792 \fi
7793 \fi
7794 \if1\csname ismacro.\the\macname\endcsname
7795 \message{Warning: redefining \the\macname}%
7796 \else
7797 \expandafter\ifx\csname \the\macname\endcsname \relax
7798 \else \errmessage{Macro name \the\macname\space already defined}\fi
7799 \global\cslet{macsave.\the\macname}{\the\macname}%
7800 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
7801 \addtomacrolist{\the\macname}%
7802 \fi
7803 \begingroup \macrobodyctxt
7804 \ifrecursive \expandafter\parsermacbody
7805 \else \expandafter\parsemacbody
7806 \fi}
7807
7808 \parseargdef\unmacro{%
7809 \if1\csname ismacro.#1\endcsname
7810 \global\cslet{#1}{macsave.#1}%
7811 \global\expandafter\let \csname ismacro.#1\endcsname=0%
7812 % Remove the macro name from \macrolist:
7813 \begingroup
7814 \expandafter\let\csname#1\endcsname \relax
7815 \let\definedummyword\unmacrodo
7816 \xdef\macrolist{\macrolist}%
7817 \endgroup
7818 \else
7819 \errmessage{Macro #1 not defined}%
7820 \fi
7821 }
7822
7823 % Called by \do from \dounmacro on each macro. The idea is to omit any
7824 % macro definitions that have been changed to \relax.
7825 %
7826 \def\unmacrodo#1{%
7827 \ifx #1\relax
7828 % remove this
7829 \else
7830 \noexpand\definedummyword \noexpand#1%
7831 \fi
7832 }
7833
7834 % \getargs -- Parse the arguments to a @macro line. Set \macname to
7835 % the name of the macro, and \argl to the braced argument list.
7836 \def\getargs#1{\getargsxxx#1{}}
7837 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
7838 \def\getmacname#1 #2\relax{\macname={#1}}
7839 \def\getmacargs#1{\def\argl{#1}}
7840 % This made use of the feature that if the last token of a
7841 % <parameter list> is #, then the preceding argument is delimited by
7842 % an opening brace, and that opening brace is not consumed.
7843
7844 % Parse the optional {params} list to @macro or @rmacro.
7845 % Set \paramno to the number of arguments,
7846 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
7847 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
7848 % list to some hook where the argument is to be expanded. If there are
7849 % less than 10 arguments that hook is to be replaced by ##N where N
7850 % is the position in that list, that is to say the macro arguments are to be
7851 % defined `a la TeX in the macro body.
7852 %
7853 % That gets used by \mbodybackslash (above).
7854 %
7855 % If there are 10 or more arguments, a different technique is used: see
7856 % \parsemmanyargdef.
7857 %
7858 \def\parsemargdef#1;{%
7859 \paramno=0\def\paramlist{}%
7860 \let\hash\relax
7861 % \hash is redefined to `#' later to get it into definitions
7862 \let\processmacroarg\relax
7863 \parsemargdefxxx#1,;,%
7864 \ifnum\paramno<10\relax\else
7865 \paramno0\relax
7866 \parsemmanyargdef@@#1,;,% 10 or more arguments
7867 \fi
7868 }
7869 \def\parsemargdefxxx#1,{%
7870 \if#1;\let\next=\relax
7871 \else \let\next=\parsemargdefxxx
7872 \advance\paramno by 1
7873 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
7874 {\processmacroarg{\hash\the\paramno}}%
7875 \edef\paramlist{\paramlist\hash\the\paramno,}%
7876 \fi\next}
7877
7878 % \parsemacbody, \parsermacbody
7879 %
7880 % Read recursive and nonrecursive macro bodies. (They're different since
7881 % rec and nonrec macros end differently.)
7882 %
7883 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
7884 % body to be transformed.
7885 % Set \macrobody to the body of the macro, and call \defmacro.
7886 %
7887 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
7888 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
7889 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
7890 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
7891
7892 % Make @ a letter, so that we can make private-to-Texinfo macro names.
7893 \edef\texiatcatcode{\the\catcode`\@}
7894 \catcode `@=11\relax
7895
7896 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
7897
7898 % If there are 10 or more arguments, a different technique is used, where the
7899 % hook remains in the body, and when macro is to be expanded the body is
7900 % processed again to replace the arguments.
7901 %
7902 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
7903 % argument N value and then \edef the body (nothing else will expand because of
7904 % the catcode regime under which the body was input).
7905 %
7906 % If you compile with TeX (not eTeX), and you have macros with 10 or more
7907 % arguments, no macro can have more than 256 arguments (else error).
7908 %
7909 % In case that there are 10 or more arguments we parse again the arguments
7910 % list to set new definitions for the \macarg.BLAH macros corresponding to
7911 % each BLAH argument. It was anyhow needed to parse already once this list
7912 % in order to count the arguments, and as macros with at most 9 arguments
7913 % are by far more frequent than macro with 10 or more arguments, defining
7914 % twice the \macarg.BLAH macros does not cost too much processing power.
7915 \def\parsemmanyargdef@@#1,{%
7916 \if#1;\let\next=\relax
7917 \else
7918 \let\next=\parsemmanyargdef@@
7919 \edef\tempb{\eatspaces{#1}}%
7920 \expandafter\def\expandafter\tempa
7921 \expandafter{\csname macarg.\tempb\endcsname}%
7922 % Note that we need some extra \noexpand\noexpand, this is because we
7923 % don't want \the to be expanded in the \parsermacbody as it uses an
7924 % \xdef .
7925 \expandafter\edef\tempa
7926 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
7927 \advance\paramno by 1\relax
7928 \fi\next}
7929
7930
7931 \let\endargs@\relax
7932 \let\nil@\relax
7933 \def\nilm@{\nil@}%
7934 \long\def\nillm@{\nil@}%
7935
7936 % This macro is expanded during the Texinfo macro expansion, not during its
7937 % definition. It gets all the arguments' values and assigns them to macros
7938 % macarg.ARGNAME
7939 %
7940 % #1 is the macro name
7941 % #2 is the list of argument names
7942 % #3 is the list of argument values
7943 \def\getargvals@#1#2#3{%
7944 \def\macargdeflist@{}%
7945 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
7946 \def\paramlist{#2,\nil@}%
7947 \def\macroname{#1}%
7948 \begingroup
7949 \macroargctxt
7950 \def\argvaluelist{#3,\nil@}%
7951 \def\@tempa{#3}%
7952 \ifx\@tempa\empty
7953 \setemptyargvalues@
7954 \else
7955 \getargvals@@
7956 \fi
7957 }
7958 \def\getargvals@@{%
7959 \ifx\paramlist\nilm@
7960 % Some sanity check needed here that \argvaluelist is also empty.
7961 \ifx\argvaluelist\nillm@
7962 \else
7963 \errhelp = \EMsimple
7964 \errmessage{Too many arguments in macro `\macroname'!}%
7965 \fi
7966 \let\next\macargexpandinbody@
7967 \else
7968 \ifx\argvaluelist\nillm@
7969 % No more arguments values passed to macro. Set remaining named-arg
7970 % macros to empty.
7971 \let\next\setemptyargvalues@
7972 \else
7973 % pop current arg name into \@tempb
7974 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
7975 \expandafter\@tempa\expandafter{\paramlist}%
7976 % pop current argument value into \@tempc
7977 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
7978 \expandafter\@tempa\expandafter{\argvaluelist}%
7979 % Here \@tempb is the current arg name and \@tempc is the current arg value.
7980 % First place the new argument macro definition into \@tempd
7981 \expandafter\macname\expandafter{\@tempc}%
7982 \expandafter\let\csname macarg.\@tempb\endcsname\relax
7983 \expandafter\def\expandafter\@tempe\expandafter{%
7984 \csname macarg.\@tempb\endcsname}%
7985 \edef\@tempd{\long\def\@tempe{\the\macname}}%
7986 \push@\@tempd\macargdeflist@
7987 \let\next\getargvals@@
7988 \fi
7989 \fi
7990 \next
7991 }
7992
7993 \def\push@#1#2{%
7994 \expandafter\expandafter\expandafter\def
7995 \expandafter\expandafter\expandafter#2%
7996 \expandafter\expandafter\expandafter{%
7997 \expandafter#1#2}%
7998 }
7999
8000 % Replace arguments by their values in the macro body, and place the result
8001 % in macro \@tempa.
8002 %
8003 \def\macvalstoargs@{%
8004 % To do this we use the property that token registers that are \the'ed
8005 % within an \edef expand only once. So we are going to place all argument
8006 % values into respective token registers.
8007 %
8008 % First we save the token context, and initialize argument numbering.
8009 \begingroup
8010 \paramno0\relax
8011 % Then, for each argument number #N, we place the corresponding argument
8012 % value into a new token list register \toks#N
8013 \expandafter\putargsintokens@\saveparamlist@,;,%
8014 % Then, we expand the body so that argument are replaced by their
8015 % values. The trick for values not to be expanded themselves is that they
8016 % are within tokens and that tokens expand only once in an \edef .
8017 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8018 % Now we restore the token stack pointer to free the token list registers
8019 % which we have used, but we make sure that expanded body is saved after
8020 % group.
8021 \expandafter
8022 \endgroup
8023 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8024 }
8025
8026 % Define the named-macro outside of this group and then close this group.
8027 %
8028 \def\macargexpandinbody@{%
8029 \expandafter
8030 \endgroup
8031 \macargdeflist@
8032 % First the replace in body the macro arguments by their values, the result
8033 % is in \@tempa .
8034 \macvalstoargs@
8035 % Then we point at the \norecurse or \gobble (for recursive) macro value
8036 % with \@tempb .
8037 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8038 % Depending on whether it is recursive or not, we need some tailing
8039 % \egroup .
8040 \ifx\@tempb\gobble
8041 \let\@tempc\relax
8042 \else
8043 \let\@tempc\egroup
8044 \fi
8045 % And now we do the real job:
8046 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8047 \@tempd
8048 }
8049
8050 \def\putargsintokens@#1,{%
8051 \if#1;\let\next\relax
8052 \else
8053 \let\next\putargsintokens@
8054 % First we allocate the new token list register, and give it a temporary
8055 % alias \@tempb .
8056 \toksdef\@tempb\the\paramno
8057 % Then we place the argument value into that token list register.
8058 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8059 \expandafter\@tempb\expandafter{\@tempa}%
8060 \advance\paramno by 1\relax
8061 \fi
8062 \next
8063 }
8064
8065 % Trailing missing arguments are set to empty.
8066 %
8067 \def\setemptyargvalues@{%
8068 \ifx\paramlist\nilm@
8069 \let\next\macargexpandinbody@
8070 \else
8071 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8072 \let\next\setemptyargvalues@
8073 \fi
8074 \next
8075 }
8076
8077 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8078 \expandafter\def\expandafter\@tempa\expandafter{%
8079 \expandafter\def\csname macarg.#1\endcsname{}}%
8080 \push@\@tempa\macargdeflist@
8081 \def\paramlist{#2}%
8082 }
8083
8084 % #1 is the element target macro
8085 % #2 is the list macro
8086 % #3,#4\endargs@ is the list value
8087 \def\pop@#1#2#3,#4\endargs@{%
8088 \def#1{#3}%
8089 \def#2{#4}%
8090 }
8091 \long\def\longpop@#1#2#3,#4\endargs@{%
8092 \long\def#1{#3}%
8093 \long\def#2{#4}%
8094 }
8095
8096
8097 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8098
8099
8100
8101 % Remove following spaces at the expansion stage.
8102 % This works because spaces are discarded before each argument when TeX is
8103 % getting the arguments for a macro.
8104 % This must not be immediately followed by a }.
8105 \long\def\gobblespaces#1{#1}
8106
8107 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8108 % \macrobody has the body of the macro in it, with placeholders for
8109 % its parameters, looking like "\processmacroarg{\hash 1}".
8110 % \paramno is the number of parameters
8111 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8112 % There are eight cases: recursive and nonrecursive macros of zero, one,
8113 % up to nine, and many arguments.
8114 % \xdef is used so that macro definitions will survive the file
8115 % they're defined in: @include reads the file inside a group.
8116 %
8117 \def\defmacro{%
8118 \let\hash=##% convert placeholders to macro parameter chars
8119 \ifnum\paramno=1
8120 \def\processmacroarg{\gobblespaces}%
8121 % This removes the pair of braces around the argument. We don't
8122 % use \eatspaces, because this can cause ends of lines to be lost
8123 % when the argument to \eatspaces is read, leading to line-based
8124 % commands like "@itemize" not being read correctly.
8125 \else
8126 \def\processmacroarg{\xprocessmacroarg}%
8127 \let\xprocessmacroarg\relax
8128 \fi
8129 \ifrecursive %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8130 \ifcase\paramno
8131 % 0
8132 \expandafter\xdef\csname\the\macname\endcsname{%
8133 \noexpand\scanmacro{\macrobody}}%
8134 \or % 1
8135 \expandafter\xdef\csname\the\macname\endcsname{%
8136 \bgroup
8137 \noexpand\braceorline
8138 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8139 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8140 \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
8141 \noexpand\gobblespaces##1\empty}%
8142 % The \empty is for \gobblespaces in case #1 is empty
8143 }%
8144 \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
8145 \egroup\noexpand\scanmacro{\macrobody}}%
8146 \else
8147 \ifnum\paramno<10\relax % at most 9
8148 % See non-recursive section below for comments
8149 \expandafter\xdef\csname\the\macname\endcsname{%
8150 \bgroup
8151 \noexpand\expandafter
8152 \noexpand\macroargctxt
8153 \noexpand\expandafter
8154 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8155 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8156 \noexpand\passargtomacro
8157 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8158 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8159 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8160 \expandafter\expandafter
8161 \expandafter\xdef
8162 \expandafter\expandafter
8163 \csname\the\macname @@@@\endcsname\paramlist{%
8164 \egroup\noexpand\scanmacro{\macrobody}}%
8165 \else % 10 or more
8166 \expandafter\xdef\csname\the\macname\endcsname{%
8167 \noexpand\getargvals@{\the\macname}{\argl}%
8168 }%
8169 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8170 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8171 \fi
8172 \fi
8173 \else %%%%%%%%%%%%%%%%%%%%%% Non-recursive %%%%%%%%%%%%%%%%%%%%%%%%%%
8174 \ifcase\paramno
8175 % 0
8176 \expandafter\xdef\csname\the\macname\endcsname{%
8177 \noexpand\scanmacro{\macrobody}}%
8178 \or % 1
8179 \expandafter\xdef\csname\the\macname\endcsname{%
8180 \bgroup
8181 \noexpand\braceorline
8182 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8183 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8184 \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
8185 \noexpand\gobblespaces##1\empty}%
8186 % The \empty is for \gobblespaces in case #1 is empty
8187 }%
8188 \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
8189 \egroup
8190 \noexpand\scanmacro{\macrobody}%
8191 }%
8192 \else % at most 9
8193 \ifnum\paramno<10\relax
8194 % @MACNAME sets the context for reading the macro argument
8195 % @MACNAME@@ gets the argument, processes backslashes and appends a
8196 % comma.
8197 % @MACNAME@@@ removes braces surrounding the argument list.
8198 % @MACNAME@@@@ scans the macro body with arguments substituted.
8199 \expandafter\xdef\csname\the\macname\endcsname{%
8200 \bgroup
8201 \noexpand\expandafter % This \expandafter skip any spaces after the
8202 \noexpand\macroargctxt % macro before we change the catcode of space.
8203 \noexpand\expandafter
8204 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8205 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8206 \noexpand\passargtomacro
8207 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8208 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8209 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8210 \expandafter\expandafter
8211 \expandafter\xdef
8212 \expandafter\expandafter
8213 \csname\the\macname @@@@\endcsname\paramlist{%
8214 \egroup\noexpand\scanmacro{\macrobody}}%
8215 \else % 10 or more:
8216 \expandafter\xdef\csname\the\macname\endcsname{%
8217 \noexpand\getargvals@{\the\macname}{\argl}%
8218 }%
8219 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8220 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
8221 \fi
8222 \fi
8223 \fi}
8224
8225 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8226
8227 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8228
8229
8230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8231 %
8232 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8233 @catcode`@_=11 % private names
8234 @catcode`@!=11 % used as argument separator
8235
8236 % \passargtomacro#1#2 -
8237 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8238 % compressed to one.
8239 %
8240 % This implementation works by expansion, and not execution (so we cannot use
8241 % \def or similar). This reduces the risk of this failing in contexts where
8242 % complete expansion is done with no execution (for example, in writing out to
8243 % an auxiliary file for an index entry).
8244 %
8245 % State is kept in the input stream: the argument passed to
8246 % @look_ahead, @gobble_and_check_finish and @add_segment is
8247 %
8248 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8249 %
8250 % where:
8251 % THE_MACRO - name of the macro we want to call
8252 % ARG_RESULT - argument list we build to pass to that macro
8253 % PENDING_BS - either a backslash or nothing
8254 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8255
8256 @gdef@passargtomacro#1#2{%
8257 @add_segment #1!{}@relax#2\@_finish\%
8258 }
8259 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8260
8261 % #1 - THE_MACRO ARG_RESULT
8262 % #2 - PENDING_BS
8263 % #3 - NEXT_TOKEN
8264 % #4 used to look ahead
8265 %
8266 % If the next token is not a backslash, process the rest of the argument;
8267 % otherwise, remove the next token.
8268 @gdef@look_ahead#1!#2#3#4{%
8269 @ifx#4\%
8270 @expandafter@gobble_and_check_finish
8271 @else
8272 @expandafter@add_segment
8273 @fi#1!{#2}#4#4%
8274 }
8275
8276 % #1 - THE_MACRO ARG_RESULT
8277 % #2 - PENDING_BS
8278 % #3 - NEXT_TOKEN
8279 % #4 should be a backslash, which is gobbled.
8280 % #5 looks ahead
8281 %
8282 % Double backslash found. Add a single backslash, and look ahead.
8283 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8284 @add_segment#1\!{}#5#5%
8285 }
8286
8287 @gdef@is_fi{@fi}
8288
8289 % #1 - THE_MACRO ARG_RESULT
8290 % #2 - PENDING_BS
8291 % #3 - NEXT_TOKEN
8292 % #4 is input stream until next backslash
8293 %
8294 % Input stream is either at the start of the argument, or just after a
8295 % backslash sequence, either a lone backslash, or a doubled backslash.
8296 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8297 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8298 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8299 % a backslash just before the start of the input stream that has not been
8300 % added to ARG_RESULT.
8301 @gdef@add_segment#1!#2#3#4\{%
8302 @ifx#3@_finish
8303 @call_the_macro#1!%
8304 @else
8305 % append the pending backslash to the result, followed by the next segment
8306 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8307 % this @fi is discarded by @look_ahead.
8308 % we can't get rid of it with \expandafter because we don't know how
8309 % long #4 is.
8310 }
8311
8312 % #1 - THE_MACRO
8313 % #2 - ARG_RESULT
8314 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8315 % conditional.
8316 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8317
8318 }
8319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8320
8321 % \braceorline MAC is used for a one-argument macro MAC. It checks
8322 % whether the next non-whitespace character is a {. It sets the context
8323 % for reading the argument (slightly different in the two cases). Then,
8324 % to read the argument, in the whole-line case, it then calls the regular
8325 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8326 %
8327 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8328 \def\braceorlinexxx{%
8329 \ifx\nchar\bgroup
8330 \macroargctxt
8331 \expandafter\passargtomacro
8332 \else
8333 \macrolineargctxt\expandafter\parsearg
8334 \fi \macnamexxx}
8335
8336
8337 % @alias.
8338 % We need some trickery to remove the optional spaces around the equal
8339 % sign. Make them active and then expand them all to nothing.
8340 %
8341 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8342 \def\aliasxxx #1{\aliasyyy#1\relax}
8343 \def\aliasyyy #1=#2\relax{%
8344 {%
8345 \expandafter\let\obeyedspace=\empty
8346 \addtomacrolist{#1}%
8347 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8348 }%
8349 \next
8350 }
8351
8352
8353 \message{cross references,}
8354
8355 \newwrite\auxfile
8356 \newif\ifhavexrefs % True if xref values are known.
8357 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8358
8359 % @inforef is relatively simple.
8360 \def\inforef #1{\inforefzzz #1,,,,**}
8361 \def\inforefzzz #1,#2,#3,#4**{%
8362 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8363 node \samp{\ignorespaces#1{}}}
8364
8365 % @node's only job in TeX is to define \lastnode, which is used in
8366 % cross-references. The @node line might or might not have commas, and
8367 % might or might not have spaces before the first comma, like:
8368 % @node foo , bar , ...
8369 % We don't want such trailing spaces in the node name.
8370 %
8371 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8372 %
8373 % also remove a trailing comma, in case of something like this:
8374 % @node Help-Cross, , , Cross-refs
8375 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8376 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
8377
8378 \let\nwnode=\node
8379 \let\lastnode=\empty
8380
8381 % Write a cross-reference definition for the current node. #1 is the
8382 % type (Ynumbered, Yappendix, Ynothing).
8383 %
8384 \def\donoderef#1{%
8385 \ifx\lastnode\empty\else
8386 \setref{\lastnode}{#1}%
8387 \global\let\lastnode=\empty
8388 \fi
8389 }
8390
8391 % @anchor{NAME} -- define xref target at arbitrary point.
8392 %
8393 \newcount\savesfregister
8394 %
8395 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8396 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8397 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8398
8399 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8400 % anchor), which consists of three parts:
8401 % 1) NAME-title - the current sectioning name taken from \lastsection,
8402 % or the anchor name.
8403 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8404 % empty for anchors.
8405 % 3) NAME-pg - the page number.
8406 %
8407 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8408 % floats, there is an additional part, which is not written here:
8409 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8410 %
8411 \def\setref#1#2{%
8412 \pdfmkdest{#1}%
8413 \iflinks
8414 {%
8415 \requireauxfile
8416 \atdummies % preserve commands, but don't expand them
8417 \edef\writexrdef##1##2{%
8418 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8419 ##1}{##2}}% these are parameters of \writexrdef
8420 }%
8421 \toks0 = \expandafter{\lastsection}%
8422 \immediate \writexrdef{title}{\the\toks0 }%
8423 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8424 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8425 }%
8426 \fi
8427 }
8428
8429 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8430 % automatically in xrefs, if the third arg is not explicitly specified.
8431 % This was provided as a "secret" @set xref-automatic-section-title
8432 % variable, now it's official.
8433 %
8434 \parseargdef\xrefautomaticsectiontitle{%
8435 \def\temp{#1}%
8436 \ifx\temp\onword
8437 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8438 = \empty
8439 \else\ifx\temp\offword
8440 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8441 = \relax
8442 \else
8443 \errhelp = \EMsimple
8444 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8445 must be on|off}%
8446 \fi\fi
8447 }
8448
8449 % \f
8450 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8451 % the node name, #2 the name of the Info cross-reference, #3 the printed
8452 % node name, #4 the name of the Info file, #5 the name of the printed
8453 % manual. All but the node name can be omitted.
8454 %
8455 \def\pxref{\putwordsee{} \xrefXX}
8456 \def\xref{\putwordSee{} \xrefXX}
8457 \def\ref{\xrefXX}
8458
8459 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8460 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8461 %
8462 \newbox\toprefbox
8463 \newbox\printedrefnamebox
8464 \newbox\infofilenamebox
8465 \newbox\printedmanualbox
8466 %
8467 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8468 \unsepspaces
8469 %
8470 % Get args without leading/trailing spaces.
8471 \def\printedrefname{\ignorespaces #3}%
8472 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8473 %
8474 \def\infofilename{\ignorespaces #4}%
8475 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8476 %
8477 \def\printedmanual{\ignorespaces #5}%
8478 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8479 %
8480 % If the printed reference name (arg #3) was not explicitly given in
8481 % the @xref, figure out what we want to use.
8482 \ifdim \wd\printedrefnamebox = 0pt
8483 % No printed node name was explicitly given.
8484 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8485 % Not auto section-title: use node name inside the square brackets.
8486 \def\printedrefname{\ignorespaces #1}%
8487 \else
8488 % Auto section-title: use chapter/section title inside
8489 % the square brackets if we have it.
8490 \ifdim \wd\printedmanualbox > 0pt
8491 % It is in another manual, so we don't have it; use node name.
8492 \def\printedrefname{\ignorespaces #1}%
8493 \else
8494 \ifhavexrefs
8495 % We (should) know the real title if we have the xref values.
8496 \def\printedrefname{\refx{#1-title}{}}%
8497 \else
8498 % Otherwise just copy the Info node name.
8499 \def\printedrefname{\ignorespaces #1}%
8500 \fi%
8501 \fi
8502 \fi
8503 \fi
8504 %
8505 % Make link in pdf output.
8506 \ifpdf
8507 {\indexnofonts
8508 \turnoffactive
8509 \makevalueexpandable
8510 % This expands tokens, so do it after making catcode changes, so _
8511 % etc. don't get their TeX definitions. This ignores all spaces in
8512 % #4, including (wrongly) those in the middle of the filename.
8513 \getfilename{#4}%
8514 %
8515 % This (wrongly) does not take account of leading or trailing
8516 % spaces in #1, which should be ignored.
8517 \edef\pdfxrefdest{#1}%
8518 \ifx\pdfxrefdest\empty
8519 \def\pdfxrefdest{Top}% no empty targets
8520 \else
8521 \txiescapepdf\pdfxrefdest % escape PDF special chars
8522 \fi
8523 %
8524 \leavevmode
8525 \startlink attr{/Border [0 0 0]}%
8526 \ifnum\filenamelength>0
8527 goto file{\the\filename.pdf} name{\pdfxrefdest}%
8528 \else
8529 goto name{\pdfmkpgn{\pdfxrefdest}}%
8530 \fi
8531 }%
8532 \setcolor{\linkcolor}%
8533 \fi
8534 {%
8535 % Have to otherify everything special to allow the \csname to
8536 % include an _ in the xref name, etc.
8537 \indexnofonts
8538 \turnoffactive
8539 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8540 \csname XR#1-title\endcsname
8541 }%
8542 %
8543 % Float references are printed completely differently: "Figure 1.2"
8544 % instead of "[somenode], p.3". \iffloat distinguishes them by
8545 % \Xthisreftitle being set to a magic string.
8546 \iffloat\Xthisreftitle
8547 % If the user specified the print name (third arg) to the ref,
8548 % print it instead of our usual "Figure 1.2".
8549 \ifdim\wd\printedrefnamebox = 0pt
8550 \refx{#1-snt}{}%
8551 \else
8552 \printedrefname
8553 \fi
8554 %
8555 % If the user also gave the printed manual name (fifth arg), append
8556 % "in MANUALNAME".
8557 \ifdim \wd\printedmanualbox > 0pt
8558 \space \putwordin{} \cite{\printedmanual}%
8559 \fi
8560 \else
8561 % node/anchor (non-float) references.
8562 %
8563 % If we use \unhbox to print the node names, TeX does not insert
8564 % empty discretionaries after hyphens, which means that it will not
8565 % find a line break at a hyphen in a node names. Since some manuals
8566 % are best written with fairly long node names, containing hyphens,
8567 % this is a loss. Therefore, we give the text of the node name
8568 % again, so it is as if TeX is seeing it for the first time.
8569 %
8570 \ifdim \wd\printedmanualbox > 0pt
8571 % Cross-manual reference with a printed manual name.
8572 %
8573 \crossmanualxref{\cite{\printedmanual\unskip}}%
8574 %
8575 \else\ifdim \wd\infofilenamebox > 0pt
8576 % Cross-manual reference with only an info filename (arg 4), no
8577 % printed manual name (arg 5). This is essentially the same as
8578 % the case above; we output the filename, since we have nothing else.
8579 %
8580 \crossmanualxref{\code{\infofilename\unskip}}%
8581 %
8582 \else
8583 % Reference within this manual.
8584 %
8585 % _ (for example) has to be the character _ for the purposes of the
8586 % control sequence corresponding to the node, but it has to expand
8587 % into the usual \leavevmode...\vrule stuff for purposes of
8588 % printing. So we \turnoffactive for the \refx-snt, back on for the
8589 % printing, back off for the \refx-pg.
8590 {\turnoffactive
8591 % Only output a following space if the -snt ref is nonempty; for
8592 % @unnumbered and @anchor, it won't be.
8593 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
8594 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8595 }%
8596 % output the `[mynode]' via the macro below so it can be overridden.
8597 \xrefprintnodename\printedrefname
8598 %
8599 % But we always want a comma and a space:
8600 ,\space
8601 %
8602 % output the `page 3'.
8603 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
8604 \ifx,\tokenafterxref
8605 \else\ifx.\tokenafterxref
8606 \else\ifx;\tokenafterxref
8607 \else\ifx)\tokenafterxref
8608 \else,% add a , if xref not followed by punctuation
8609 \fi\fi\fi\fi
8610 \fi\fi
8611 \fi
8612 \endlink
8613 \endgroup}
8614
8615 % Output a cross-manual xref to #1. Used just above (twice).
8616 %
8617 % Only include the text "Section ``foo'' in" if the foo is neither
8618 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
8619 % "see The Foo Manual", the idea being to refer to the whole manual.
8620 %
8621 % But, this being TeX, we can't easily compare our node name against the
8622 % string "Top" while ignoring the possible spaces before and after in
8623 % the input. By adding the arbitrary 7sp below, we make it much less
8624 % likely that a real node name would have the same width as "Top" (e.g.,
8625 % in a monospaced font). Hopefully it will never happen in practice.
8626 %
8627 % For the same basic reason, we retypeset the "Top" at every
8628 % reference, since the current font is indeterminate.
8629 %
8630 \def\crossmanualxref#1{%
8631 \setbox\toprefbox = \hbox{Top\kern7sp}%
8632 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
8633 \ifdim \wd2 > 7sp % nonempty?
8634 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
8635 \putwordSection{} ``\printedrefname'' \putwordin{}\space
8636 \fi
8637 \fi
8638 #1%
8639 }
8640
8641 % This macro is called from \xrefX for the `[nodename]' part of xref
8642 % output. It's a separate macro only so it can be changed more easily,
8643 % since square brackets don't work well in some documents. Particularly
8644 % one that Bob is working on :).
8645 %
8646 \def\xrefprintnodename#1{[#1]}
8647
8648 % Things referred to by \setref.
8649 %
8650 \def\Ynothing{}
8651 \def\Yomitfromtoc{}
8652 \def\Ynumbered{%
8653 \ifnum\secno=0
8654 \putwordChapter@tie \the\chapno
8655 \else \ifnum\subsecno=0
8656 \putwordSection@tie \the\chapno.\the\secno
8657 \else \ifnum\subsubsecno=0
8658 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
8659 \else
8660 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
8661 \fi\fi\fi
8662 }
8663 \def\Yappendix{%
8664 \ifnum\secno=0
8665 \putwordAppendix@tie @char\the\appendixno{}%
8666 \else \ifnum\subsecno=0
8667 \putwordSection@tie @char\the\appendixno.\the\secno
8668 \else \ifnum\subsubsecno=0
8669 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
8670 \else
8671 \putwordSection@tie
8672 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
8673 \fi\fi\fi
8674 }
8675
8676 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
8677 % If its value is nonempty, SUFFIX is output afterward.
8678 %
8679 \def\refx#1#2{%
8680 \requireauxfile
8681 {%
8682 \indexnofonts
8683 \otherbackslash
8684 \expandafter\global\expandafter\let\expandafter\thisrefX
8685 \csname XR#1\endcsname
8686 }%
8687 \ifx\thisrefX\relax
8688 % If not defined, say something at least.
8689 \angleleft un\-de\-fined\angleright
8690 \iflinks
8691 \ifhavexrefs
8692 {\toks0 = {#1}% avoid expansion of possibly-complex value
8693 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
8694 \else
8695 \ifwarnedxrefs\else
8696 \global\warnedxrefstrue
8697 \message{Cross reference values unknown; you must run TeX again.}%
8698 \fi
8699 \fi
8700 \fi
8701 \else
8702 % It's defined, so just use it.
8703 \thisrefX
8704 \fi
8705 #2% Output the suffix in any case.
8706 }
8707
8708 % This is the macro invoked by entries in the aux file. Usually it's
8709 % just a \def (we prepend XR to the control sequence name to avoid
8710 % collisions). But if this is a float type, we have more work to do.
8711 %
8712 \def\xrdef#1#2{%
8713 {% The node name might contain 8-bit characters, which in our current
8714 % implementation are changed to commands like @'e. Don't let these
8715 % mess up the control sequence name.
8716 \indexnofonts
8717 \turnoffactive
8718 \xdef\safexrefname{#1}%
8719 }%
8720 %
8721 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
8722 %
8723 % Was that xref control sequence that we just defined for a float?
8724 \expandafter\iffloat\csname XR\safexrefname\endcsname
8725 % it was a float, and we have the (safe) float type in \iffloattype.
8726 \expandafter\let\expandafter\floatlist
8727 \csname floatlist\iffloattype\endcsname
8728 %
8729 % Is this the first time we've seen this float type?
8730 \expandafter\ifx\floatlist\relax
8731 \toks0 = {\do}% yes, so just \do
8732 \else
8733 % had it before, so preserve previous elements in list.
8734 \toks0 = \expandafter{\floatlist\do}%
8735 \fi
8736 %
8737 % Remember this xref in the control sequence \floatlistFLOATTYPE,
8738 % for later use in \listoffloats.
8739 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
8740 {\safexrefname}}%
8741 \fi
8742 }
8743
8744 % If working on a large document in chapters, it is convenient to
8745 % be able to disable indexing, cross-referencing, and contents, for test runs.
8746 % This is done with @novalidate at the beginning of the file.
8747 %
8748 \newif\iflinks \linkstrue % by default we want the aux files.
8749 \let\novalidate = \linksfalse
8750
8751 % Used when writing to the aux file, or when using data from it.
8752 \def\requireauxfile{%
8753 \iflinks
8754 \tryauxfile
8755 % Open the new aux file. TeX will close it automatically at exit.
8756 \immediate\openout\auxfile=\jobname.aux
8757 \fi
8758 \global\let\requireauxfile=\relax % Only do this once.
8759 }
8760
8761 % Read the last existing aux file, if any. No error if none exists.
8762 %
8763 \def\tryauxfile{%
8764 \openin 1 \jobname.aux
8765 \ifeof 1 \else
8766 \readdatafile{aux}%
8767 \global\havexrefstrue
8768 \fi
8769 \closein 1
8770 }
8771
8772 \def\setupdatafile{%
8773 \catcode`\^^@=\other
8774 \catcode`\^^A=\other
8775 \catcode`\^^B=\other
8776 \catcode`\^^C=\other
8777 \catcode`\^^D=\other
8778 \catcode`\^^E=\other
8779 \catcode`\^^F=\other
8780 \catcode`\^^G=\other
8781 \catcode`\^^H=\other
8782 \catcode`\^^K=\other
8783 \catcode`\^^L=\other
8784 \catcode`\^^N=\other
8785 \catcode`\^^P=\other
8786 \catcode`\^^Q=\other
8787 \catcode`\^^R=\other
8788 \catcode`\^^S=\other
8789 \catcode`\^^T=\other
8790 \catcode`\^^U=\other
8791 \catcode`\^^V=\other
8792 \catcode`\^^W=\other
8793 \catcode`\^^X=\other
8794 \catcode`\^^Z=\other
8795 \catcode`\^^[=\other
8796 \catcode`\^^\=\other
8797 \catcode`\^^]=\other
8798 \catcode`\^^^=\other
8799 \catcode`\^^_=\other
8800 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
8801 % in xref tags, i.e., node names. But since ^^e4 notation isn't
8802 % supported in the main text, it doesn't seem desirable. Furthermore,
8803 % that is not enough: for node names that actually contain a ^
8804 % character, we would end up writing a line like this: 'xrdef {'hat
8805 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
8806 % argument, and \hat is not an expandable control sequence. It could
8807 % all be worked out, but why? Either we support ^^ or we don't.
8808 %
8809 % The other change necessary for this was to define \auxhat:
8810 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
8811 % and then to call \auxhat in \setq.
8812 %
8813 \catcode`\^=\other
8814 %
8815 % Special characters. Should be turned off anyway, but...
8816 \catcode`\~=\other
8817 \catcode`\[=\other
8818 \catcode`\]=\other
8819 \catcode`\"=\other
8820 \catcode`\_=\other
8821 \catcode`\|=\other
8822 \catcode`\<=\other
8823 \catcode`\>=\other
8824 \catcode`\$=\other
8825 \catcode`\#=\other
8826 \catcode`\&=\other
8827 \catcode`\%=\other
8828 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
8829 %
8830 % This is to support \ in node names and titles, since the \
8831 % characters end up in a \csname. It's easier than
8832 % leaving it active and making its active definition an actual \
8833 % character. What I don't understand is why it works in the *value*
8834 % of the xrdef. Seems like it should be a catcode12 \, and that
8835 % should not typeset properly. But it works, so I'm moving on for
8836 % now. --karl, 15jan04.
8837 \catcode`\\=\other
8838 %
8839 % Make the characters 128-255 be printing characters.
8840 {\setnonasciicharscatcodenonglobal\other}%
8841 %
8842 % @ is our escape character in .aux files, and we need braces.
8843 \catcode`\{=1
8844 \catcode`\}=2
8845 \catcode`\@=0
8846 }
8847
8848 \def\readdatafile#1{%
8849 \begingroup
8850 \setupdatafile
8851 \input\jobname.#1
8852 \endgroup}
8853
8854
8855 \message{insertions,}
8856 % including footnotes.
8857
8858 \newcount \footnoteno
8859
8860 % The trailing space in the following definition for supereject is
8861 % vital for proper filling; pages come out unaligned when you do a
8862 % pagealignmacro call if that space before the closing brace is
8863 % removed. (Generally, numeric constants should always be followed by a
8864 % space to prevent strange expansion errors.)
8865 \def\supereject{\par\penalty -20000\footnoteno =0 }
8866
8867 % @footnotestyle is meaningful for Info output only.
8868 \let\footnotestyle=\comment
8869
8870 {\catcode `\@=11
8871 %
8872 % Auto-number footnotes. Otherwise like plain.
8873 \gdef\footnote{%
8874 \global\advance\footnoteno by \@ne
8875 \edef\thisfootno{$^{\the\footnoteno}$}%
8876 %
8877 % In case the footnote comes at the end of a sentence, preserve the
8878 % extra spacing after we do the footnote number.
8879 \let\@sf\empty
8880 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
8881 %
8882 % Remove inadvertent blank space before typesetting the footnote number.
8883 \unskip
8884 \thisfootno\@sf
8885 \dofootnote
8886 }%
8887
8888 % Don't bother with the trickery in plain.tex to not require the
8889 % footnote text as a parameter. Our footnotes don't need to be so general.
8890 %
8891 % Oh yes, they do; otherwise, @ifset (and anything else that uses
8892 % \parseargline) fails inside footnotes because the tokens are fixed when
8893 % the footnote is read. --karl, 16nov96.
8894 %
8895 \gdef\dofootnote{%
8896 \insert\footins\bgroup
8897 %
8898 % Nested footnotes are not supported in TeX, that would take a lot
8899 % more work. (\startsavinginserts does not suffice.)
8900 \let\footnote=\errfootnotenest
8901 %
8902 % We want to typeset this text as a normal paragraph, even if the
8903 % footnote reference occurs in (for example) a display environment.
8904 % So reset some parameters.
8905 \hsize=\pagewidth
8906 \interlinepenalty\interfootnotelinepenalty
8907 \splittopskip\ht\strutbox % top baseline for broken footnotes
8908 \splitmaxdepth\dp\strutbox
8909 \floatingpenalty\@MM
8910 \leftskip\z@skip
8911 \rightskip\z@skip
8912 \spaceskip\z@skip
8913 \xspaceskip\z@skip
8914 \parindent\defaultparindent
8915 %
8916 \smallfonts \rm
8917 %
8918 % Because we use hanging indentation in footnotes, a @noindent appears
8919 % to exdent this text, so make it be a no-op. makeinfo does not use
8920 % hanging indentation so @noindent can still be needed within footnote
8921 % text after an @example or the like (not that this is good style).
8922 \let\noindent = \relax
8923 %
8924 % Hang the footnote text off the number. Use \everypar in case the
8925 % footnote extends for more than one paragraph.
8926 \everypar = {\hang}%
8927 \textindent{\thisfootno}%
8928 %
8929 % Don't crash into the line above the footnote text. Since this
8930 % expands into a box, it must come within the paragraph, lest it
8931 % provide a place where TeX can split the footnote.
8932 \footstrut
8933 %
8934 % Invoke rest of plain TeX footnote routine.
8935 \futurelet\next\fo@t
8936 }
8937 }%end \catcode `\@=11
8938
8939 \def\errfootnotenest{%
8940 \errhelp=\EMsimple
8941 \errmessage{Nested footnotes not supported in texinfo.tex,
8942 even though they work in makeinfo; sorry}
8943 }
8944
8945 \def\errfootnoteheading{%
8946 \errhelp=\EMsimple
8947 \errmessage{Footnotes in chapters, sections, etc., are not supported}
8948 }
8949
8950 % In case a @footnote appears in a vbox, save the footnote text and create
8951 % the real \insert just after the vbox finished. Otherwise, the insertion
8952 % would be lost.
8953 % Similarly, if a @footnote appears inside an alignment, save the footnote
8954 % text to a box and make the \insert when a row of the table is finished.
8955 % And the same can be done for other insert classes. --kasal, 16nov03.
8956 %
8957 % Replace the \insert primitive by a cheating macro.
8958 % Deeper inside, just make sure that the saved insertions are not spilled
8959 % out prematurely.
8960 %
8961 \def\startsavinginserts{%
8962 \ifx \insert\ptexinsert
8963 \let\insert\saveinsert
8964 \else
8965 \let\checkinserts\relax
8966 \fi
8967 }
8968
8969 % This \insert replacement works for both \insert\footins{foo} and
8970 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
8971 %
8972 \def\saveinsert#1{%
8973 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
8974 \afterassignment\next
8975 % swallow the left brace
8976 \let\temp =
8977 }
8978 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
8979 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
8980
8981 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
8982
8983 \def\placesaveins#1{%
8984 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
8985 {\box#1}%
8986 }
8987
8988 % eat @SAVE -- beware, all of them have catcode \other:
8989 {
8990 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
8991 \gdef\gobblesave @SAVE{}
8992 }
8993
8994 % initialization:
8995 \def\newsaveins #1{%
8996 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
8997 \next
8998 }
8999 \def\newsaveinsX #1{%
9000 \csname newbox\endcsname #1%
9001 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9002 \checksaveins #1}%
9003 }
9004
9005 % initialize:
9006 \let\checkinserts\empty
9007 \newsaveins\footins
9008 \newsaveins\margin
9009
9010
9011 % @image. We use the macros from epsf.tex to support this.
9012 % If epsf.tex is not installed and @image is used, we complain.
9013 %
9014 % Check for and read epsf.tex up front. If we read it only at @image
9015 % time, we might be inside a group, and then its definitions would get
9016 % undone and the next image would fail.
9017 \openin 1 = epsf.tex
9018 \ifeof 1 \else
9019 % Do not bother showing banner with epsf.tex v2.7k (available in
9020 % doc/epsf.tex and on ctan).
9021 \def\epsfannounce{\toks0 = }%
9022 \input epsf.tex
9023 \fi
9024 \closein 1
9025 %
9026 % We will only complain once about lack of epsf.tex.
9027 \newif\ifwarnednoepsf
9028 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9029 work. It is also included in the Texinfo distribution, or you can get
9030 it from ftp://tug.org/tex/epsf.tex.}
9031 %
9032 \def\image#1{%
9033 \ifx\epsfbox\thisisundefined
9034 \ifwarnednoepsf \else
9035 \errhelp = \noepsfhelp
9036 \errmessage{epsf.tex not found, images will be ignored}%
9037 \global\warnednoepsftrue
9038 \fi
9039 \else
9040 \imagexxx #1,,,,,\finish
9041 \fi
9042 }
9043 %
9044 % Arguments to @image:
9045 % #1 is (mandatory) image filename; we tack on .eps extension.
9046 % #2 is (optional) width, #3 is (optional) height.
9047 % #4 is (ignored optional) html alt text.
9048 % #5 is (ignored optional) extension.
9049 % #6 is just the usual extra ignored arg for parsing stuff.
9050 \newif\ifimagevmode
9051 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9052 \catcode`\^^M = 5 % in case we're inside an example
9053 \normalturnoffactive % allow _ et al. in names
9054 \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
9055 % If the image is by itself, center it.
9056 \ifvmode
9057 \imagevmodetrue
9058 \else \ifx\centersub\centerV
9059 % for @center @image, we need a vbox so we can have our vertical space
9060 \imagevmodetrue
9061 \vbox\bgroup % vbox has better behavior than vtop herev
9062 \fi\fi
9063 %
9064 \ifimagevmode
9065 \nobreak\medskip
9066 % Usually we'll have text after the image which will insert
9067 % \parskip glue, so insert it here too to equalize the space
9068 % above and below.
9069 \nobreak\vskip\parskip
9070 \nobreak
9071 \fi
9072 %
9073 % Leave vertical mode so that indentation from an enclosing
9074 % environment such as @quotation is respected.
9075 % However, if we're at the top level, we don't want the
9076 % normal paragraph indentation.
9077 % On the other hand, if we are in the case of @center @image, we don't
9078 % want to start a paragraph, which will create a hsize-width box and
9079 % eradicate the centering.
9080 \ifx\centersub\centerV\else \noindent \fi
9081 %
9082 % Output the image.
9083 \ifpdf
9084 \dopdfimage{#1}{#2}{#3}%
9085 \else
9086 % \epsfbox itself resets \epsf?size at each figure.
9087 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9088 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9089 \epsfbox{#1.eps}%
9090 \fi
9091 %
9092 \ifimagevmode
9093 \medskip % space after a standalone image
9094 \fi
9095 \ifx\centersub\centerV \egroup \fi
9096 \endgroup}
9097
9098
9099 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9100 % etc. We don't actually implement floating yet, we always include the
9101 % float "here". But it seemed the best name for the future.
9102 %
9103 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9104
9105 % There may be a space before second and/or third parameter; delete it.
9106 \def\eatcommaspace#1, {#1,}
9107
9108 % #1 is the optional FLOATTYPE, the text label for this float, typically
9109 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9110 % this float will not be numbered and cannot be referred to.
9111 %
9112 % #2 is the optional xref label. Also must be present for the float to
9113 % be referable.
9114 %
9115 % #3 is the optional positioning argument; for now, it is ignored. It
9116 % will somehow specify the positions allowed to float to (here, top, bottom).
9117 %
9118 % We keep a separate counter for each FLOATTYPE, which we reset at each
9119 % chapter-level command.
9120 \let\resetallfloatnos=\empty
9121 %
9122 \def\dofloat#1,#2,#3,#4\finish{%
9123 \let\thiscaption=\empty
9124 \let\thisshortcaption=\empty
9125 %
9126 % don't lose footnotes inside @float.
9127 %
9128 % BEWARE: when the floats start float, we have to issue warning whenever an
9129 % insert appears inside a float which could possibly float. --kasal, 26may04
9130 %
9131 \startsavinginserts
9132 %
9133 % We can't be used inside a paragraph.
9134 \par
9135 %
9136 \vtop\bgroup
9137 \def\floattype{#1}%
9138 \def\floatlabel{#2}%
9139 \def\floatloc{#3}% we do nothing with this yet.
9140 %
9141 \ifx\floattype\empty
9142 \let\safefloattype=\empty
9143 \else
9144 {%
9145 % the floattype might have accents or other special characters,
9146 % but we need to use it in a control sequence name.
9147 \indexnofonts
9148 \turnoffactive
9149 \xdef\safefloattype{\floattype}%
9150 }%
9151 \fi
9152 %
9153 % If label is given but no type, we handle that as the empty type.
9154 \ifx\floatlabel\empty \else
9155 % We want each FLOATTYPE to be numbered separately (Figure 1,
9156 % Table 1, Figure 2, ...). (And if no label, no number.)
9157 %
9158 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9159 \global\advance\floatno by 1
9160 %
9161 {%
9162 % This magic value for \lastsection is output by \setref as the
9163 % XREFLABEL-title value. \xrefX uses it to distinguish float
9164 % labels (which have a completely different output format) from
9165 % node and anchor labels. And \xrdef uses it to construct the
9166 % lists of floats.
9167 %
9168 \edef\lastsection{\floatmagic=\safefloattype}%
9169 \setref{\floatlabel}{Yfloat}%
9170 }%
9171 \fi
9172 %
9173 % start with \parskip glue, I guess.
9174 \vskip\parskip
9175 %
9176 % Don't suppress indentation if a float happens to start a section.
9177 \restorefirstparagraphindent
9178 }
9179
9180 % we have these possibilities:
9181 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9182 % @float Foo,lbl & no caption: Foo 1.1
9183 % @float Foo & @caption{Cap}: Foo: Cap
9184 % @float Foo & no caption: Foo
9185 % @float ,lbl & Caption{Cap}: 1.1: Cap
9186 % @float ,lbl & no caption: 1.1
9187 % @float & @caption{Cap}: Cap
9188 % @float & no caption:
9189 %
9190 \def\Efloat{%
9191 \let\floatident = \empty
9192 %
9193 % In all cases, if we have a float type, it comes first.
9194 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9195 %
9196 % If we have an xref label, the number comes next.
9197 \ifx\floatlabel\empty \else
9198 \ifx\floattype\empty \else % if also had float type, need tie first.
9199 \appendtomacro\floatident{\tie}%
9200 \fi
9201 % the number.
9202 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9203 \fi
9204 %
9205 % Start the printed caption with what we've constructed in
9206 % \floatident, but keep it separate; we need \floatident again.
9207 \let\captionline = \floatident
9208 %
9209 \ifx\thiscaption\empty \else
9210 \ifx\floatident\empty \else
9211 \appendtomacro\captionline{: }% had ident, so need a colon between
9212 \fi
9213 %
9214 % caption text.
9215 \appendtomacro\captionline{\scanexp\thiscaption}%
9216 \fi
9217 %
9218 % If we have anything to print, print it, with space before.
9219 % Eventually this needs to become an \insert.
9220 \ifx\captionline\empty \else
9221 \vskip.5\parskip
9222 \captionline
9223 %
9224 % Space below caption.
9225 \vskip\parskip
9226 \fi
9227 %
9228 % If have an xref label, write the list of floats info. Do this
9229 % after the caption, to avoid chance of it being a breakpoint.
9230 \ifx\floatlabel\empty \else
9231 % Write the text that goes in the lof to the aux file as
9232 % \floatlabel-lof. Besides \floatident, we include the short
9233 % caption if specified, else the full caption if specified, else nothing.
9234 {%
9235 \requireauxfile
9236 \atdummies
9237 %
9238 % since we read the caption text in the macro world, where ^^M
9239 % is turned into a normal character, we have to scan it back, so
9240 % we don't write the literal three characters "^^M" into the aux file.
9241 \scanexp{%
9242 \xdef\noexpand\gtemp{%
9243 \ifx\thisshortcaption\empty
9244 \thiscaption
9245 \else
9246 \thisshortcaption
9247 \fi
9248 }%
9249 }%
9250 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9251 \ifx\gtemp\empty \else : \gtemp \fi}}%
9252 }%
9253 \fi
9254 \egroup % end of \vtop
9255 %
9256 % place the captured inserts
9257 %
9258 % BEWARE: when the floats start floating, we have to issue warning
9259 % whenever an insert appears inside a float which could possibly
9260 % float. --kasal, 26may04
9261 %
9262 \checkinserts
9263 }
9264
9265 % Append the tokens #2 to the definition of macro #1, not expanding either.
9266 %
9267 \def\appendtomacro#1#2{%
9268 \expandafter\def\expandafter#1\expandafter{#1#2}%
9269 }
9270
9271 % @caption, @shortcaption
9272 %
9273 \def\caption{\docaption\thiscaption}
9274 \def\shortcaption{\docaption\thisshortcaption}
9275 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9276 \def\defcaption#1#2{\egroup \def#1{#2}}
9277
9278 % The parameter is the control sequence identifying the counter we are
9279 % going to use. Create it if it doesn't exist and assign it to \floatno.
9280 \def\getfloatno#1{%
9281 \ifx#1\relax
9282 % Haven't seen this figure type before.
9283 \csname newcount\endcsname #1%
9284 %
9285 % Remember to reset this floatno at the next chap.
9286 \expandafter\gdef\expandafter\resetallfloatnos
9287 \expandafter{\resetallfloatnos #1=0 }%
9288 \fi
9289 \let\floatno#1%
9290 }
9291
9292 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9293 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9294 % first read the @float command.
9295 %
9296 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9297
9298 % Magic string used for the XREFLABEL-title value, so \xrefX can
9299 % distinguish floats from other xref types.
9300 \def\floatmagic{!!float!!}
9301
9302 % #1 is the control sequence we are passed; we expand into a conditional
9303 % which is true if #1 represents a float ref. That is, the magic
9304 % \lastsection value which we \setref above.
9305 %
9306 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9307 %
9308 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9309 % (safe) float type for this float. We set \iffloattype to #2.
9310 %
9311 \def\doiffloat#1=#2=#3\finish{%
9312 \def\temp{#1}%
9313 \def\iffloattype{#2}%
9314 \ifx\temp\floatmagic
9315 }
9316
9317 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9318 %
9319 \parseargdef\listoffloats{%
9320 \def\floattype{#1}% floattype
9321 {%
9322 % the floattype might have accents or other special characters,
9323 % but we need to use it in a control sequence name.
9324 \indexnofonts
9325 \turnoffactive
9326 \xdef\safefloattype{\floattype}%
9327 }%
9328 %
9329 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9330 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9331 \ifhavexrefs
9332 % if the user said @listoffloats foo but never @float foo.
9333 \message{\linenumber No `\safefloattype' floats to list.}%
9334 \fi
9335 \else
9336 \begingroup
9337 \leftskip=\tocindent % indent these entries like a toc
9338 \let\do=\listoffloatsdo
9339 \csname floatlist\safefloattype\endcsname
9340 \endgroup
9341 \fi
9342 }
9343
9344 % This is called on each entry in a list of floats. We're passed the
9345 % xref label, in the form LABEL-title, which is how we save it in the
9346 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9347 % has the text we're supposed to typeset here.
9348 %
9349 % Figures without xref labels will not be included in the list (since
9350 % they won't appear in the aux file).
9351 %
9352 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9353 \def\listoffloatsdoentry#1-title\finish{{%
9354 % Can't fully expand XR#1-lof because it can contain anything. Just
9355 % pass the control sequence. On the other hand, XR#1-pg is just the
9356 % page number, and we want to fully expand that so we can get a link
9357 % in pdf output.
9358 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9359 %
9360 % use the same \entry macro we use to generate the TOC and index.
9361 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9362 \writeentry
9363 }}
9364
9365
9366 \message{localization,}
9367
9368 % For single-language documents, @documentlanguage is usually given very
9369 % early, just after @documentencoding. Single argument is the language
9370 % (de) or locale (de_DE) abbreviation.
9371 %
9372 {
9373 \catcode`\_ = \active
9374 \globaldefs=1
9375 \parseargdef\documentlanguage{%
9376 \tex % read txi-??.tex file in plain TeX.
9377 % Read the file by the name they passed if it exists.
9378 \let_ = \normalunderscore % normal _ character for filename test
9379 \openin 1 txi-#1.tex
9380 \ifeof 1
9381 \documentlanguagetrywithoutunderscore #1_\finish
9382 \else
9383 \globaldefs = 1 % everything in the txi-LL files needs to persist
9384 \input txi-#1.tex
9385 \fi
9386 \closein 1
9387 \endgroup % end raw TeX
9388 }
9389 %
9390 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9391 % try txi-de.tex.
9392 %
9393 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9394 \openin 1 txi-#1.tex
9395 \ifeof 1
9396 \errhelp = \nolanghelp
9397 \errmessage{Cannot read language file txi-#1.tex}%
9398 \else
9399 \globaldefs = 1 % everything in the txi-LL files needs to persist
9400 \input txi-#1.tex
9401 \fi
9402 \closein 1
9403 }
9404 }% end of special _ catcode
9405 %
9406 \newhelp\nolanghelp{The given language definition file cannot be found or
9407 is empty. Maybe you need to install it? Putting it in the current
9408 directory should work if nowhere else does.}
9409
9410 % This macro is called from txi-??.tex files; the first argument is the
9411 % \language name to set (without the "\lang@" prefix), the second and
9412 % third args are \{left,right}hyphenmin.
9413 %
9414 % The language names to pass are determined when the format is built.
9415 % See the etex.log file created at that time, e.g.,
9416 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9417 %
9418 % With TeX Live 2008, etex now includes hyphenation patterns for all
9419 % available languages. This means we can support hyphenation in
9420 % Texinfo, at least to some extent. (This still doesn't solve the
9421 % accented characters problem.)
9422 %
9423 \catcode`@=11
9424 \def\txisetlanguage#1#2#3{%
9425 % do not set the language if the name is undefined in the current TeX.
9426 \expandafter\ifx\csname lang@#1\endcsname \relax
9427 \message{no patterns for #1}%
9428 \else
9429 \global\language = \csname lang@#1\endcsname
9430 \fi
9431 % but there is no harm in adjusting the hyphenmin values regardless.
9432 \global\lefthyphenmin = #2\relax
9433 \global\righthyphenmin = #3\relax
9434 }
9435
9436 % Get input by bytes instead of by UTF-8 codepoints for XeTeX and LuaTeX,
9437 % otherwise the encoding support is completely broken.
9438 \ifx\XeTeXrevision\thisisundefined
9439 \else
9440 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9441 \XeTeXinputencoding "bytes" % Effective in texinfo.tex only
9442 % Unfortunately, there seems to be no corresponding XeTeX command for
9443 % output encoding. This is a problem for auxiliary index and TOC files.
9444 % The only solution would be perhaps to write out @U{...} sequences in
9445 % place of UTF-8 characters.
9446 \fi
9447
9448 \ifx\luatexversion\thisisundefined
9449 \else
9450 \directlua{
9451 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9452 local function convert_char (char)
9453 return utf8_char(byte(char))
9454 end
9455
9456 local function convert_line (line)
9457 return gsub(line, ".", convert_char)
9458 end
9459
9460 callback.register("process_input_buffer", convert_line)
9461
9462 local function convert_line_out (line)
9463 local line_out = ""
9464 for c in string.utfvalues(line) do
9465 line_out = line_out .. string.char(c)
9466 end
9467 return line_out
9468 end
9469
9470 callback.register("process_output_buffer", convert_line_out)
9471 }
9472 \fi
9473
9474
9475 % Helpers for encodings.
9476 % Set the catcode of characters 128 through 255 to the specified number.
9477 %
9478 \def\setnonasciicharscatcode#1{%
9479 \count255=128
9480 \loop\ifnum\count255<256
9481 \global\catcode\count255=#1\relax
9482 \advance\count255 by 1
9483 \repeat
9484 }
9485
9486 \def\setnonasciicharscatcodenonglobal#1{%
9487 \count255=128
9488 \loop\ifnum\count255<256
9489 \catcode\count255=#1\relax
9490 \advance\count255 by 1
9491 \repeat
9492 }
9493
9494 % @documentencoding sets the definition of non-ASCII characters
9495 % according to the specified encoding.
9496 %
9497 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9498 \def\documentencodingzzz#1{%
9499 % Get input by bytes instead of by UTF-8 codepoints for XeTeX,
9500 % otherwise the encoding support is completely broken.
9501 % This settings is for the document root file.
9502 \ifx\XeTeXrevision\thisisundefined
9503 \else
9504 \XeTeXinputencoding "bytes"
9505 \fi
9506 %
9507 % Encoding being declared for the document.
9508 \def\declaredencoding{\csname #1.enc\endcsname}%
9509 %
9510 % Supported encodings: names converted to tokens in order to be able
9511 % to compare them with \ifx.
9512 \def\ascii{\csname US-ASCII.enc\endcsname}%
9513 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9514 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9515 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9516 \def\utfeight{\csname UTF-8.enc\endcsname}%
9517 %
9518 \ifx \declaredencoding \ascii
9519 \asciichardefs
9520 %
9521 \else \ifx \declaredencoding \lattwo
9522 \setnonasciicharscatcode\active
9523 \lattwochardefs
9524 %
9525 \else \ifx \declaredencoding \latone
9526 \setnonasciicharscatcode\active
9527 \latonechardefs
9528 %
9529 \else \ifx \declaredencoding \latnine
9530 \setnonasciicharscatcode\active
9531 \latninechardefs
9532 %
9533 \else \ifx \declaredencoding \utfeight
9534 \setnonasciicharscatcode\active
9535 % since we already invoked \utfeightchardefs at the top level
9536 % (below), do not re-invoke it, then our check for duplicated
9537 % definitions triggers. Making non-ascii chars active is enough.
9538 %
9539 \else
9540 \message{Ignoring unknown document encoding: #1.}%
9541 %
9542 \fi % utfeight
9543 \fi % latnine
9544 \fi % latone
9545 \fi % lattwo
9546 \fi % ascii
9547 }
9548
9549 % emacs-page
9550 % A message to be logged when using a character that isn't available
9551 % the default font encoding (OT1).
9552 %
9553 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9554
9555 % Take account of \c (plain) vs. \, (Texinfo) difference.
9556 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9557
9558 % First, make active non-ASCII characters in order for them to be
9559 % correctly categorized when TeX reads the replacement text of
9560 % macros containing the character definitions.
9561 \setnonasciicharscatcode\active
9562 %
9563 % Latin1 (ISO-8859-1) character definitions.
9564 \def\latonechardefs{%
9565 \gdef^^a0{\tie}
9566 \gdef^^a1{\exclamdown}
9567 \gdef^^a2{{\tcfont \char162}} % cent
9568 \gdef^^a3{\pounds}
9569 \gdef^^a4{{\tcfont \char164}} % currency
9570 \gdef^^a5{{\tcfont \char165}} % yen
9571 \gdef^^a6{{\tcfont \char166}} % broken bar
9572 \gdef^^a7{\S}
9573 \gdef^^a8{\"{}}
9574 \gdef^^a9{\copyright}
9575 \gdef^^aa{\ordf}
9576 \gdef^^ab{\guillemetleft}
9577 \gdef^^ac{\ensuremath\lnot}
9578 \gdef^^ad{\-}
9579 \gdef^^ae{\registeredsymbol}
9580 \gdef^^af{\={}}
9581 %
9582 \gdef^^b0{\textdegree}
9583 \gdef^^b1{$\pm$}
9584 \gdef^^b2{$^2$}
9585 \gdef^^b3{$^3$}
9586 \gdef^^b4{\'{}}
9587 \gdef^^b5{$\mu$}
9588 \gdef^^b6{\P}
9589 \gdef^^b7{\ensuremath\cdot}
9590 \gdef^^b8{\cedilla\ }
9591 \gdef^^b9{$^1$}
9592 \gdef^^ba{\ordm}
9593 \gdef^^bb{\guillemetright}
9594 \gdef^^bc{$1\over4$}
9595 \gdef^^bd{$1\over2$}
9596 \gdef^^be{$3\over4$}
9597 \gdef^^bf{\questiondown}
9598 %
9599 \gdef^^c0{\`A}
9600 \gdef^^c1{\'A}
9601 \gdef^^c2{\^A}
9602 \gdef^^c3{\~A}
9603 \gdef^^c4{\"A}
9604 \gdef^^c5{\ringaccent A}
9605 \gdef^^c6{\AE}
9606 \gdef^^c7{\cedilla C}
9607 \gdef^^c8{\`E}
9608 \gdef^^c9{\'E}
9609 \gdef^^ca{\^E}
9610 \gdef^^cb{\"E}
9611 \gdef^^cc{\`I}
9612 \gdef^^cd{\'I}
9613 \gdef^^ce{\^I}
9614 \gdef^^cf{\"I}
9615 %
9616 \gdef^^d0{\DH}
9617 \gdef^^d1{\~N}
9618 \gdef^^d2{\`O}
9619 \gdef^^d3{\'O}
9620 \gdef^^d4{\^O}
9621 \gdef^^d5{\~O}
9622 \gdef^^d6{\"O}
9623 \gdef^^d7{$\times$}
9624 \gdef^^d8{\O}
9625 \gdef^^d9{\`U}
9626 \gdef^^da{\'U}
9627 \gdef^^db{\^U}
9628 \gdef^^dc{\"U}
9629 \gdef^^dd{\'Y}
9630 \gdef^^de{\TH}
9631 \gdef^^df{\ss}
9632 %
9633 \gdef^^e0{\`a}
9634 \gdef^^e1{\'a}
9635 \gdef^^e2{\^a}
9636 \gdef^^e3{\~a}
9637 \gdef^^e4{\"a}
9638 \gdef^^e5{\ringaccent a}
9639 \gdef^^e6{\ae}
9640 \gdef^^e7{\cedilla c}
9641 \gdef^^e8{\`e}
9642 \gdef^^e9{\'e}
9643 \gdef^^ea{\^e}
9644 \gdef^^eb{\"e}
9645 \gdef^^ec{\`{\dotless i}}
9646 \gdef^^ed{\'{\dotless i}}
9647 \gdef^^ee{\^{\dotless i}}
9648 \gdef^^ef{\"{\dotless i}}
9649 %
9650 \gdef^^f0{\dh}
9651 \gdef^^f1{\~n}
9652 \gdef^^f2{\`o}
9653 \gdef^^f3{\'o}
9654 \gdef^^f4{\^o}
9655 \gdef^^f5{\~o}
9656 \gdef^^f6{\"o}
9657 \gdef^^f7{$\div$}
9658 \gdef^^f8{\o}
9659 \gdef^^f9{\`u}
9660 \gdef^^fa{\'u}
9661 \gdef^^fb{\^u}
9662 \gdef^^fc{\"u}
9663 \gdef^^fd{\'y}
9664 \gdef^^fe{\th}
9665 \gdef^^ff{\"y}
9666 }
9667
9668 % Latin9 (ISO-8859-15) encoding character definitions.
9669 \def\latninechardefs{%
9670 % Encoding is almost identical to Latin1.
9671 \latonechardefs
9672 %
9673 \gdef^^a4{\euro}
9674 \gdef^^a6{\v S}
9675 \gdef^^a8{\v s}
9676 \gdef^^b4{\v Z}
9677 \gdef^^b8{\v z}
9678 \gdef^^bc{\OE}
9679 \gdef^^bd{\oe}
9680 \gdef^^be{\"Y}
9681 }
9682
9683 % Latin2 (ISO-8859-2) character definitions.
9684 \def\lattwochardefs{%
9685 \gdef^^a0{\tie}
9686 \gdef^^a1{\ogonek{A}}
9687 \gdef^^a2{\u{}}
9688 \gdef^^a3{\L}
9689 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
9690 \gdef^^a5{\v L}
9691 \gdef^^a6{\'S}
9692 \gdef^^a7{\S}
9693 \gdef^^a8{\"{}}
9694 \gdef^^a9{\v S}
9695 \gdef^^aa{\cedilla S}
9696 \gdef^^ab{\v T}
9697 \gdef^^ac{\'Z}
9698 \gdef^^ad{\-}
9699 \gdef^^ae{\v Z}
9700 \gdef^^af{\dotaccent Z}
9701 %
9702 \gdef^^b0{\textdegree}
9703 \gdef^^b1{\ogonek{a}}
9704 \gdef^^b2{\ogonek{ }}
9705 \gdef^^b3{\l}
9706 \gdef^^b4{\'{}}
9707 \gdef^^b5{\v l}
9708 \gdef^^b6{\'s}
9709 \gdef^^b7{\v{}}
9710 \gdef^^b8{\cedilla\ }
9711 \gdef^^b9{\v s}
9712 \gdef^^ba{\cedilla s}
9713 \gdef^^bb{\v t}
9714 \gdef^^bc{\'z}
9715 \gdef^^bd{\H{}}
9716 \gdef^^be{\v z}
9717 \gdef^^bf{\dotaccent z}
9718 %
9719 \gdef^^c0{\'R}
9720 \gdef^^c1{\'A}
9721 \gdef^^c2{\^A}
9722 \gdef^^c3{\u A}
9723 \gdef^^c4{\"A}
9724 \gdef^^c5{\'L}
9725 \gdef^^c6{\'C}
9726 \gdef^^c7{\cedilla C}
9727 \gdef^^c8{\v C}
9728 \gdef^^c9{\'E}
9729 \gdef^^ca{\ogonek{E}}
9730 \gdef^^cb{\"E}
9731 \gdef^^cc{\v E}
9732 \gdef^^cd{\'I}
9733 \gdef^^ce{\^I}
9734 \gdef^^cf{\v D}
9735 %
9736 \gdef^^d0{\DH}
9737 \gdef^^d1{\'N}
9738 \gdef^^d2{\v N}
9739 \gdef^^d3{\'O}
9740 \gdef^^d4{\^O}
9741 \gdef^^d5{\H O}
9742 \gdef^^d6{\"O}
9743 \gdef^^d7{$\times$}
9744 \gdef^^d8{\v R}
9745 \gdef^^d9{\ringaccent U}
9746 \gdef^^da{\'U}
9747 \gdef^^db{\H U}
9748 \gdef^^dc{\"U}
9749 \gdef^^dd{\'Y}
9750 \gdef^^de{\cedilla T}
9751 \gdef^^df{\ss}
9752 %
9753 \gdef^^e0{\'r}
9754 \gdef^^e1{\'a}
9755 \gdef^^e2{\^a}
9756 \gdef^^e3{\u a}
9757 \gdef^^e4{\"a}
9758 \gdef^^e5{\'l}
9759 \gdef^^e6{\'c}
9760 \gdef^^e7{\cedilla c}
9761 \gdef^^e8{\v c}
9762 \gdef^^e9{\'e}
9763 \gdef^^ea{\ogonek{e}}
9764 \gdef^^eb{\"e}
9765 \gdef^^ec{\v e}
9766 \gdef^^ed{\'{\dotless{i}}}
9767 \gdef^^ee{\^{\dotless{i}}}
9768 \gdef^^ef{\v d}
9769 %
9770 \gdef^^f0{\dh}
9771 \gdef^^f1{\'n}
9772 \gdef^^f2{\v n}
9773 \gdef^^f3{\'o}
9774 \gdef^^f4{\^o}
9775 \gdef^^f5{\H o}
9776 \gdef^^f6{\"o}
9777 \gdef^^f7{$\div$}
9778 \gdef^^f8{\v r}
9779 \gdef^^f9{\ringaccent u}
9780 \gdef^^fa{\'u}
9781 \gdef^^fb{\H u}
9782 \gdef^^fc{\"u}
9783 \gdef^^fd{\'y}
9784 \gdef^^fe{\cedilla t}
9785 \gdef^^ff{\dotaccent{}}
9786 }
9787
9788 % UTF-8 character definitions.
9789 %
9790 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
9791 % changes for Texinfo conventions. It is included here under the GPL by
9792 % permission from Frank Mittelbach and the LaTeX team.
9793 %
9794 \newcount\countUTFx
9795 \newcount\countUTFy
9796 \newcount\countUTFz
9797
9798 \gdef\UTFviiiTwoOctets#1#2{\expandafter
9799 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
9800 %
9801 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
9802 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
9803 %
9804 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
9805 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
9806
9807 \gdef\UTFviiiDefined#1{%
9808 \ifx #1\relax
9809 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
9810 \else
9811 \expandafter #1%
9812 \fi
9813 }
9814
9815 \begingroup
9816 \catcode`\~13
9817 \catcode`\"12
9818
9819 \def\UTFviiiLoop{%
9820 \global\catcode\countUTFx\active
9821 \uccode`\~\countUTFx
9822 \uppercase\expandafter{\UTFviiiTmp}%
9823 \advance\countUTFx by 1
9824 \ifnum\countUTFx < \countUTFy
9825 \expandafter\UTFviiiLoop
9826 \fi}
9827
9828 \countUTFx = "C2
9829 \countUTFy = "E0
9830 \def\UTFviiiTmp{%
9831 \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
9832 \UTFviiiLoop
9833
9834 \countUTFx = "E0
9835 \countUTFy = "F0
9836 \def\UTFviiiTmp{%
9837 \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
9838 \UTFviiiLoop
9839
9840 \countUTFx = "F0
9841 \countUTFy = "F4
9842 \def\UTFviiiTmp{%
9843 \xdef~{\noexpand\UTFviiiFourOctets\string~}}
9844 \UTFviiiLoop
9845 \endgroup
9846
9847 \def\globallet{\global\let} % save some \expandafter's below
9848
9849 % @U{xxxx} to produce U+xxxx, if we support it.
9850 \def\U#1{%
9851 \expandafter\ifx\csname uni:#1\endcsname \relax
9852 \errhelp = \EMsimple
9853 \errmessage{Unicode character U+#1 not supported, sorry}%
9854 \else
9855 \csname uni:#1\endcsname
9856 \fi
9857 }
9858
9859 \begingroup
9860 \catcode`\"=12
9861 \catcode`\<=12
9862 \catcode`\.=12
9863 \catcode`\,=12
9864 \catcode`\;=12
9865 \catcode`\!=12
9866 \catcode`\~=13
9867 \gdef\DeclareUnicodeCharacter#1#2{%
9868 \countUTFz = "#1\relax
9869 %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
9870 \begingroup
9871 \parseXMLCharref
9872 \def\UTFviiiTwoOctets##1##2{%
9873 \csname u8:##1\string ##2\endcsname}%
9874 \def\UTFviiiThreeOctets##1##2##3{%
9875 \csname u8:##1\string ##2\string ##3\endcsname}%
9876 \def\UTFviiiFourOctets##1##2##3##4{%
9877 \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
9878 \expandafter\expandafter\expandafter\expandafter
9879 \expandafter\expandafter\expandafter
9880 \gdef\UTFviiiTmp{#2}%
9881 %
9882 \expandafter\ifx\csname uni:#1\endcsname \relax \else
9883 \message{Internal error, already defined: #1}%
9884 \fi
9885 %
9886 % define an additional control sequence for this code point.
9887 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
9888 \endgroup}
9889
9890 \gdef\parseXMLCharref{%
9891 \ifnum\countUTFz < "A0\relax
9892 \errhelp = \EMsimple
9893 \errmessage{Cannot define Unicode char value < 00A0}%
9894 \else\ifnum\countUTFz < "800\relax
9895 \parseUTFviiiA,%
9896 \parseUTFviiiB C\UTFviiiTwoOctets.,%
9897 \else\ifnum\countUTFz < "10000\relax
9898 \parseUTFviiiA;%
9899 \parseUTFviiiA,%
9900 \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
9901 \else
9902 \parseUTFviiiA;%
9903 \parseUTFviiiA,%
9904 \parseUTFviiiA!%
9905 \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
9906 \fi\fi\fi
9907 }
9908
9909 \gdef\parseUTFviiiA#1{%
9910 \countUTFx = \countUTFz
9911 \divide\countUTFz by 64
9912 \countUTFy = \countUTFz
9913 \multiply\countUTFz by 64
9914 \advance\countUTFx by -\countUTFz
9915 \advance\countUTFx by 128
9916 \uccode `#1\countUTFx
9917 \countUTFz = \countUTFy}
9918
9919 \gdef\parseUTFviiiB#1#2#3#4{%
9920 \advance\countUTFz by "#10\relax
9921 \uccode `#3\countUTFz
9922 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
9923 \endgroup
9924
9925 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
9926 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
9927 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
9928 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
9929 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
9930 %
9931 % Many of our renditions are less than wonderful, and all the missing
9932 % characters are available somewhere. Loading the necessary fonts
9933 % awaits user request. We can't truly support Unicode without
9934 % reimplementing everything that's been done in LaTeX for many years,
9935 % plus probably using luatex or xetex, and who knows what else.
9936 % We won't be doing that here in this simple file. But we can try to at
9937 % least make most of the characters not bomb out.
9938 %
9939 \def\utfeightchardefs{%
9940 \DeclareUnicodeCharacter{00A0}{\tie}
9941 \DeclareUnicodeCharacter{00A1}{\exclamdown}
9942 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
9943 \DeclareUnicodeCharacter{00A3}{\pounds}
9944 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
9945 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
9946 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
9947 \DeclareUnicodeCharacter{00A7}{\S}
9948 \DeclareUnicodeCharacter{00A8}{\"{ }}
9949 \DeclareUnicodeCharacter{00A9}{\copyright}
9950 \DeclareUnicodeCharacter{00AA}{\ordf}
9951 \DeclareUnicodeCharacter{00AB}{\guillemetleft}
9952 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}
9953 \DeclareUnicodeCharacter{00AD}{\-}
9954 \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
9955 \DeclareUnicodeCharacter{00AF}{\={ }}
9956
9957 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
9958 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}
9959 \DeclareUnicodeCharacter{00B2}{$^2$}
9960 \DeclareUnicodeCharacter{00B3}{$^3$}
9961 \DeclareUnicodeCharacter{00B4}{\'{ }}
9962 \DeclareUnicodeCharacter{00B5}{$\mu$}
9963 \DeclareUnicodeCharacter{00B6}{\P}
9964 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}
9965 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
9966 \DeclareUnicodeCharacter{00B9}{$^1$}
9967 \DeclareUnicodeCharacter{00BA}{\ordm}
9968 \DeclareUnicodeCharacter{00BB}{\guillemetright}
9969 \DeclareUnicodeCharacter{00BC}{$1\over4$}
9970 \DeclareUnicodeCharacter{00BD}{$1\over2$}
9971 \DeclareUnicodeCharacter{00BE}{$3\over4$}
9972 \DeclareUnicodeCharacter{00BF}{\questiondown}
9973
9974 \DeclareUnicodeCharacter{00C0}{\`A}
9975 \DeclareUnicodeCharacter{00C1}{\'A}
9976 \DeclareUnicodeCharacter{00C2}{\^A}
9977 \DeclareUnicodeCharacter{00C3}{\~A}
9978 \DeclareUnicodeCharacter{00C4}{\"A}
9979 \DeclareUnicodeCharacter{00C5}{\AA}
9980 \DeclareUnicodeCharacter{00C6}{\AE}
9981 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
9982 \DeclareUnicodeCharacter{00C8}{\`E}
9983 \DeclareUnicodeCharacter{00C9}{\'E}
9984 \DeclareUnicodeCharacter{00CA}{\^E}
9985 \DeclareUnicodeCharacter{00CB}{\"E}
9986 \DeclareUnicodeCharacter{00CC}{\`I}
9987 \DeclareUnicodeCharacter{00CD}{\'I}
9988 \DeclareUnicodeCharacter{00CE}{\^I}
9989 \DeclareUnicodeCharacter{00CF}{\"I}
9990
9991 \DeclareUnicodeCharacter{00D0}{\DH}
9992 \DeclareUnicodeCharacter{00D1}{\~N}
9993 \DeclareUnicodeCharacter{00D2}{\`O}
9994 \DeclareUnicodeCharacter{00D3}{\'O}
9995 \DeclareUnicodeCharacter{00D4}{\^O}
9996 \DeclareUnicodeCharacter{00D5}{\~O}
9997 \DeclareUnicodeCharacter{00D6}{\"O}
9998 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}
9999 \DeclareUnicodeCharacter{00D8}{\O}
10000 \DeclareUnicodeCharacter{00D9}{\`U}
10001 \DeclareUnicodeCharacter{00DA}{\'U}
10002 \DeclareUnicodeCharacter{00DB}{\^U}
10003 \DeclareUnicodeCharacter{00DC}{\"U}
10004 \DeclareUnicodeCharacter{00DD}{\'Y}
10005 \DeclareUnicodeCharacter{00DE}{\TH}
10006 \DeclareUnicodeCharacter{00DF}{\ss}
10007
10008 \DeclareUnicodeCharacter{00E0}{\`a}
10009 \DeclareUnicodeCharacter{00E1}{\'a}
10010 \DeclareUnicodeCharacter{00E2}{\^a}
10011 \DeclareUnicodeCharacter{00E3}{\~a}
10012 \DeclareUnicodeCharacter{00E4}{\"a}
10013 \DeclareUnicodeCharacter{00E5}{\aa}
10014 \DeclareUnicodeCharacter{00E6}{\ae}
10015 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
10016 \DeclareUnicodeCharacter{00E8}{\`e}
10017 \DeclareUnicodeCharacter{00E9}{\'e}
10018 \DeclareUnicodeCharacter{00EA}{\^e}
10019 \DeclareUnicodeCharacter{00EB}{\"e}
10020 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
10021 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
10022 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
10023 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
10024
10025 \DeclareUnicodeCharacter{00F0}{\dh}
10026 \DeclareUnicodeCharacter{00F1}{\~n}
10027 \DeclareUnicodeCharacter{00F2}{\`o}
10028 \DeclareUnicodeCharacter{00F3}{\'o}
10029 \DeclareUnicodeCharacter{00F4}{\^o}
10030 \DeclareUnicodeCharacter{00F5}{\~o}
10031 \DeclareUnicodeCharacter{00F6}{\"o}
10032 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}
10033 \DeclareUnicodeCharacter{00F8}{\o}
10034 \DeclareUnicodeCharacter{00F9}{\`u}
10035 \DeclareUnicodeCharacter{00FA}{\'u}
10036 \DeclareUnicodeCharacter{00FB}{\^u}
10037 \DeclareUnicodeCharacter{00FC}{\"u}
10038 \DeclareUnicodeCharacter{00FD}{\'y}
10039 \DeclareUnicodeCharacter{00FE}{\th}
10040 \DeclareUnicodeCharacter{00FF}{\"y}
10041
10042 \DeclareUnicodeCharacter{0100}{\=A}
10043 \DeclareUnicodeCharacter{0101}{\=a}
10044 \DeclareUnicodeCharacter{0102}{\u{A}}
10045 \DeclareUnicodeCharacter{0103}{\u{a}}
10046 \DeclareUnicodeCharacter{0104}{\ogonek{A}}
10047 \DeclareUnicodeCharacter{0105}{\ogonek{a}}
10048 \DeclareUnicodeCharacter{0106}{\'C}
10049 \DeclareUnicodeCharacter{0107}{\'c}
10050 \DeclareUnicodeCharacter{0108}{\^C}
10051 \DeclareUnicodeCharacter{0109}{\^c}
10052 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
10053 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
10054 \DeclareUnicodeCharacter{010C}{\v{C}}
10055 \DeclareUnicodeCharacter{010D}{\v{c}}
10056 \DeclareUnicodeCharacter{010E}{\v{D}}
10057 \DeclareUnicodeCharacter{010F}{d'}
10058
10059 \DeclareUnicodeCharacter{0110}{\DH}
10060 \DeclareUnicodeCharacter{0111}{\dh}
10061 \DeclareUnicodeCharacter{0112}{\=E}
10062 \DeclareUnicodeCharacter{0113}{\=e}
10063 \DeclareUnicodeCharacter{0114}{\u{E}}
10064 \DeclareUnicodeCharacter{0115}{\u{e}}
10065 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
10066 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
10067 \DeclareUnicodeCharacter{0118}{\ogonek{E}}
10068 \DeclareUnicodeCharacter{0119}{\ogonek{e}}
10069 \DeclareUnicodeCharacter{011A}{\v{E}}
10070 \DeclareUnicodeCharacter{011B}{\v{e}}
10071 \DeclareUnicodeCharacter{011C}{\^G}
10072 \DeclareUnicodeCharacter{011D}{\^g}
10073 \DeclareUnicodeCharacter{011E}{\u{G}}
10074 \DeclareUnicodeCharacter{011F}{\u{g}}
10075
10076 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
10077 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
10078 \DeclareUnicodeCharacter{0122}{\cedilla{G}}
10079 \DeclareUnicodeCharacter{0123}{\cedilla{g}}
10080 \DeclareUnicodeCharacter{0124}{\^H}
10081 \DeclareUnicodeCharacter{0125}{\^h}
10082 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}
10083 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}
10084 \DeclareUnicodeCharacter{0128}{\~I}
10085 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
10086 \DeclareUnicodeCharacter{012A}{\=I}
10087 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
10088 \DeclareUnicodeCharacter{012C}{\u{I}}
10089 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
10090 \DeclareUnicodeCharacter{012E}{\ogonek{I}}
10091 \DeclareUnicodeCharacter{012F}{\ogonek{i}}
10092
10093 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
10094 \DeclareUnicodeCharacter{0131}{\dotless{i}}
10095 \DeclareUnicodeCharacter{0132}{IJ}
10096 \DeclareUnicodeCharacter{0133}{ij}
10097 \DeclareUnicodeCharacter{0134}{\^J}
10098 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
10099 \DeclareUnicodeCharacter{0136}{\cedilla{K}}
10100 \DeclareUnicodeCharacter{0137}{\cedilla{k}}
10101 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}
10102 \DeclareUnicodeCharacter{0139}{\'L}
10103 \DeclareUnicodeCharacter{013A}{\'l}
10104 \DeclareUnicodeCharacter{013B}{\cedilla{L}}
10105 \DeclareUnicodeCharacter{013C}{\cedilla{l}}
10106 \DeclareUnicodeCharacter{013D}{L'}% should kern
10107 \DeclareUnicodeCharacter{013E}{l'}% should kern
10108 \DeclareUnicodeCharacter{013F}{L\U{00B7}}
10109
10110 \DeclareUnicodeCharacter{0140}{l\U{00B7}}
10111 \DeclareUnicodeCharacter{0141}{\L}
10112 \DeclareUnicodeCharacter{0142}{\l}
10113 \DeclareUnicodeCharacter{0143}{\'N}
10114 \DeclareUnicodeCharacter{0144}{\'n}
10115 \DeclareUnicodeCharacter{0145}{\cedilla{N}}
10116 \DeclareUnicodeCharacter{0146}{\cedilla{n}}
10117 \DeclareUnicodeCharacter{0147}{\v{N}}
10118 \DeclareUnicodeCharacter{0148}{\v{n}}
10119 \DeclareUnicodeCharacter{0149}{'n}
10120 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}
10121 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}
10122 \DeclareUnicodeCharacter{014C}{\=O}
10123 \DeclareUnicodeCharacter{014D}{\=o}
10124 \DeclareUnicodeCharacter{014E}{\u{O}}
10125 \DeclareUnicodeCharacter{014F}{\u{o}}
10126
10127 \DeclareUnicodeCharacter{0150}{\H{O}}
10128 \DeclareUnicodeCharacter{0151}{\H{o}}
10129 \DeclareUnicodeCharacter{0152}{\OE}
10130 \DeclareUnicodeCharacter{0153}{\oe}
10131 \DeclareUnicodeCharacter{0154}{\'R}
10132 \DeclareUnicodeCharacter{0155}{\'r}
10133 \DeclareUnicodeCharacter{0156}{\cedilla{R}}
10134 \DeclareUnicodeCharacter{0157}{\cedilla{r}}
10135 \DeclareUnicodeCharacter{0158}{\v{R}}
10136 \DeclareUnicodeCharacter{0159}{\v{r}}
10137 \DeclareUnicodeCharacter{015A}{\'S}
10138 \DeclareUnicodeCharacter{015B}{\'s}
10139 \DeclareUnicodeCharacter{015C}{\^S}
10140 \DeclareUnicodeCharacter{015D}{\^s}
10141 \DeclareUnicodeCharacter{015E}{\cedilla{S}}
10142 \DeclareUnicodeCharacter{015F}{\cedilla{s}}
10143
10144 \DeclareUnicodeCharacter{0160}{\v{S}}
10145 \DeclareUnicodeCharacter{0161}{\v{s}}
10146 \DeclareUnicodeCharacter{0162}{\cedilla{T}}
10147 \DeclareUnicodeCharacter{0163}{\cedilla{t}}
10148 \DeclareUnicodeCharacter{0164}{\v{T}}
10149 \DeclareUnicodeCharacter{0165}{\v{t}}
10150 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}
10151 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}
10152 \DeclareUnicodeCharacter{0168}{\~U}
10153 \DeclareUnicodeCharacter{0169}{\~u}
10154 \DeclareUnicodeCharacter{016A}{\=U}
10155 \DeclareUnicodeCharacter{016B}{\=u}
10156 \DeclareUnicodeCharacter{016C}{\u{U}}
10157 \DeclareUnicodeCharacter{016D}{\u{u}}
10158 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
10159 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
10160
10161 \DeclareUnicodeCharacter{0170}{\H{U}}
10162 \DeclareUnicodeCharacter{0171}{\H{u}}
10163 \DeclareUnicodeCharacter{0172}{\ogonek{U}}
10164 \DeclareUnicodeCharacter{0173}{\ogonek{u}}
10165 \DeclareUnicodeCharacter{0174}{\^W}
10166 \DeclareUnicodeCharacter{0175}{\^w}
10167 \DeclareUnicodeCharacter{0176}{\^Y}
10168 \DeclareUnicodeCharacter{0177}{\^y}
10169 \DeclareUnicodeCharacter{0178}{\"Y}
10170 \DeclareUnicodeCharacter{0179}{\'Z}
10171 \DeclareUnicodeCharacter{017A}{\'z}
10172 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
10173 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
10174 \DeclareUnicodeCharacter{017D}{\v{Z}}
10175 \DeclareUnicodeCharacter{017E}{\v{z}}
10176 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}
10177
10178 \DeclareUnicodeCharacter{01C4}{D\v{Z}}
10179 \DeclareUnicodeCharacter{01C5}{D\v{z}}
10180 \DeclareUnicodeCharacter{01C6}{d\v{z}}
10181 \DeclareUnicodeCharacter{01C7}{LJ}
10182 \DeclareUnicodeCharacter{01C8}{Lj}
10183 \DeclareUnicodeCharacter{01C9}{lj}
10184 \DeclareUnicodeCharacter{01CA}{NJ}
10185 \DeclareUnicodeCharacter{01CB}{Nj}
10186 \DeclareUnicodeCharacter{01CC}{nj}
10187 \DeclareUnicodeCharacter{01CD}{\v{A}}
10188 \DeclareUnicodeCharacter{01CE}{\v{a}}
10189 \DeclareUnicodeCharacter{01CF}{\v{I}}
10190
10191 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
10192 \DeclareUnicodeCharacter{01D1}{\v{O}}
10193 \DeclareUnicodeCharacter{01D2}{\v{o}}
10194 \DeclareUnicodeCharacter{01D3}{\v{U}}
10195 \DeclareUnicodeCharacter{01D4}{\v{u}}
10196
10197 \DeclareUnicodeCharacter{01E2}{\={\AE}}
10198 \DeclareUnicodeCharacter{01E3}{\={\ae}}
10199 \DeclareUnicodeCharacter{01E6}{\v{G}}
10200 \DeclareUnicodeCharacter{01E7}{\v{g}}
10201 \DeclareUnicodeCharacter{01E8}{\v{K}}
10202 \DeclareUnicodeCharacter{01E9}{\v{k}}
10203
10204 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
10205 \DeclareUnicodeCharacter{01F1}{DZ}
10206 \DeclareUnicodeCharacter{01F2}{Dz}
10207 \DeclareUnicodeCharacter{01F3}{dz}
10208 \DeclareUnicodeCharacter{01F4}{\'G}
10209 \DeclareUnicodeCharacter{01F5}{\'g}
10210 \DeclareUnicodeCharacter{01F8}{\`N}
10211 \DeclareUnicodeCharacter{01F9}{\`n}
10212 \DeclareUnicodeCharacter{01FC}{\'{\AE}}
10213 \DeclareUnicodeCharacter{01FD}{\'{\ae}}
10214 \DeclareUnicodeCharacter{01FE}{\'{\O}}
10215 \DeclareUnicodeCharacter{01FF}{\'{\o}}
10216
10217 \DeclareUnicodeCharacter{021E}{\v{H}}
10218 \DeclareUnicodeCharacter{021F}{\v{h}}
10219
10220 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
10221 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
10222 \DeclareUnicodeCharacter{0228}{\cedilla{E}}
10223 \DeclareUnicodeCharacter{0229}{\cedilla{e}}
10224 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
10225 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
10226
10227 \DeclareUnicodeCharacter{0232}{\=Y}
10228 \DeclareUnicodeCharacter{0233}{\=y}
10229 \DeclareUnicodeCharacter{0237}{\dotless{j}}
10230
10231 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
10232
10233 % Greek letters upper case
10234 \DeclareUnicodeCharacter{0391}{{\it A}}
10235 \DeclareUnicodeCharacter{0392}{{\it B}}
10236 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}
10237 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}
10238 \DeclareUnicodeCharacter{0395}{{\it E}}
10239 \DeclareUnicodeCharacter{0396}{{\it Z}}
10240 \DeclareUnicodeCharacter{0397}{{\it H}}
10241 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}
10242 \DeclareUnicodeCharacter{0399}{{\it I}}
10243 \DeclareUnicodeCharacter{039A}{{\it K}}
10244 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}
10245 \DeclareUnicodeCharacter{039C}{{\it M}}
10246 \DeclareUnicodeCharacter{039D}{{\it N}}
10247 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}
10248 \DeclareUnicodeCharacter{039F}{{\it O}}
10249 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}
10250 \DeclareUnicodeCharacter{03A1}{{\it P}}
10251 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10252 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}
10253 \DeclareUnicodeCharacter{03A4}{{\it T}}
10254 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}
10255 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}
10256 \DeclareUnicodeCharacter{03A7}{{\it X}}
10257 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}
10258 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}
10259
10260 % Vowels with accents
10261 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}
10262 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}
10263 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}
10264 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}
10265 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}
10266 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}
10267
10268 % Standalone accent
10269 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}
10270
10271 % Greek letters lower case
10272 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}
10273 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}
10274 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}
10275 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}
10276 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}
10277 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}
10278 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}
10279 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}
10280 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}
10281 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}
10282 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}
10283 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}
10284 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}
10285 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}
10286 \DeclareUnicodeCharacter{03BF}{{\it o}} % omicron
10287 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}
10288 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}
10289 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}
10290 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}
10291 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}
10292 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}
10293 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}
10294 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}
10295 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}
10296 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}
10297
10298 % More Greek vowels with accents
10299 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}
10300 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}
10301 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}
10302 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}
10303 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}
10304
10305 % Variant Greek letters
10306 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}
10307 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}
10308 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}
10309
10310 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
10311 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
10312 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
10313 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
10314 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
10315 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
10316 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
10317 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
10318 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
10319 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
10320 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
10321 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
10322
10323 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
10324 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
10325
10326 \DeclareUnicodeCharacter{1E20}{\=G}
10327 \DeclareUnicodeCharacter{1E21}{\=g}
10328 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
10329 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
10330 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
10331 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
10332 \DeclareUnicodeCharacter{1E26}{\"H}
10333 \DeclareUnicodeCharacter{1E27}{\"h}
10334
10335 \DeclareUnicodeCharacter{1E30}{\'K}
10336 \DeclareUnicodeCharacter{1E31}{\'k}
10337 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
10338 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
10339 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
10340 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
10341 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
10342 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
10343 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
10344 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
10345 \DeclareUnicodeCharacter{1E3E}{\'M}
10346 \DeclareUnicodeCharacter{1E3F}{\'m}
10347
10348 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
10349 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
10350 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
10351 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
10352 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
10353 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
10354 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
10355 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
10356 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
10357 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
10358
10359 \DeclareUnicodeCharacter{1E54}{\'P}
10360 \DeclareUnicodeCharacter{1E55}{\'p}
10361 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
10362 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
10363 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
10364 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
10365 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
10366 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
10367 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
10368 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
10369
10370 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
10371 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
10372 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
10373 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
10374 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
10375 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
10376 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
10377 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
10378 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
10379 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
10380
10381 \DeclareUnicodeCharacter{1E7C}{\~V}
10382 \DeclareUnicodeCharacter{1E7D}{\~v}
10383 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
10384 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
10385
10386 \DeclareUnicodeCharacter{1E80}{\`W}
10387 \DeclareUnicodeCharacter{1E81}{\`w}
10388 \DeclareUnicodeCharacter{1E82}{\'W}
10389 \DeclareUnicodeCharacter{1E83}{\'w}
10390 \DeclareUnicodeCharacter{1E84}{\"W}
10391 \DeclareUnicodeCharacter{1E85}{\"w}
10392 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
10393 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
10394 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
10395 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
10396 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
10397 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
10398 \DeclareUnicodeCharacter{1E8C}{\"X}
10399 \DeclareUnicodeCharacter{1E8D}{\"x}
10400 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
10401 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
10402
10403 \DeclareUnicodeCharacter{1E90}{\^Z}
10404 \DeclareUnicodeCharacter{1E91}{\^z}
10405 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
10406 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
10407 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
10408 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
10409 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
10410 \DeclareUnicodeCharacter{1E97}{\"t}
10411 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
10412 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
10413
10414 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
10415 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
10416
10417 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
10418 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
10419 \DeclareUnicodeCharacter{1EBC}{\~E}
10420 \DeclareUnicodeCharacter{1EBD}{\~e}
10421
10422 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
10423 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
10424 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
10425 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
10426
10427 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
10428 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
10429
10430 \DeclareUnicodeCharacter{1EF2}{\`Y}
10431 \DeclareUnicodeCharacter{1EF3}{\`y}
10432 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
10433
10434 \DeclareUnicodeCharacter{1EF8}{\~Y}
10435 \DeclareUnicodeCharacter{1EF9}{\~y}
10436
10437 % Punctuation
10438 \DeclareUnicodeCharacter{2013}{--}
10439 \DeclareUnicodeCharacter{2014}{---}
10440 \DeclareUnicodeCharacter{2018}{\quoteleft}
10441 \DeclareUnicodeCharacter{2019}{\quoteright}
10442 \DeclareUnicodeCharacter{201A}{\quotesinglbase}
10443 \DeclareUnicodeCharacter{201C}{\quotedblleft}
10444 \DeclareUnicodeCharacter{201D}{\quotedblright}
10445 \DeclareUnicodeCharacter{201E}{\quotedblbase}
10446 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}
10447 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}
10448 \DeclareUnicodeCharacter{2022}{\bullet}
10449 \DeclareUnicodeCharacter{202F}{\thinspace}
10450 \DeclareUnicodeCharacter{2026}{\dots}
10451 \DeclareUnicodeCharacter{2039}{\guilsinglleft}
10452 \DeclareUnicodeCharacter{203A}{\guilsinglright}
10453
10454 \DeclareUnicodeCharacter{20AC}{\euro}
10455
10456 \DeclareUnicodeCharacter{2192}{\expansion}
10457 \DeclareUnicodeCharacter{21D2}{\result}
10458
10459 % Mathematical symbols
10460 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}
10461 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}
10462 \DeclareUnicodeCharacter{2208}{\ensuremath\in}
10463 \DeclareUnicodeCharacter{2212}{\minus}
10464 \DeclareUnicodeCharacter{2217}{\ast}
10465 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}
10466 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}
10467 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}
10468 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}
10469 \DeclareUnicodeCharacter{2261}{\equiv}
10470 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}
10471 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}
10472 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}
10473 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}
10474
10475 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}
10476 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}
10477 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}
10478 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}
10479 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}
10480 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}
10481 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}
10482 \DeclareUnicodeCharacter{2127}{\ensuremath\mho}
10483 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}
10484 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}
10485 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}
10486 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}
10487 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}
10488 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}
10489 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}
10490 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}
10491 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}
10492 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}
10493 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}
10494 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}
10495 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}
10496 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}
10497 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}
10498 \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}
10499 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}
10500 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}
10501 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}
10502 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}
10503 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}
10504 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}
10505 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}
10506 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}
10507 \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}
10508 \DeclareUnicodeCharacter{2201}{\ensuremath\complement}
10509 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}
10510 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}
10511 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}
10512 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}
10513 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}
10514 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}
10515 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}
10516 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}
10517 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}
10518 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}
10519 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}
10520 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}
10521 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}
10522 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}
10523 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}
10524 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}
10525 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}
10526 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}
10527 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}
10528 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}
10529 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}
10530 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}
10531 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}
10532 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}
10533 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}
10534 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}
10535 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}
10536 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}
10537 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}
10538 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}
10539 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}
10540 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}
10541 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}
10542 \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}
10543 \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}
10544 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}
10545 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}
10546 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}
10547 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}
10548 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}
10549 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}
10550 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}
10551 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}
10552 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}
10553 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}
10554 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}
10555 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}
10556 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}
10557 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}
10558 \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}
10559 \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}
10560 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}
10561 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}
10562 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}
10563 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}
10564 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}
10565 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}
10566 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}
10567 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}
10568 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}
10569 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}
10570 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}
10571 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}
10572 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}
10573 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}
10574
10575 \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}
10576 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}
10577 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}
10578 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}
10579 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}
10580 \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}
10581 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}
10582 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}
10583 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}
10584 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}
10585 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}
10586 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}
10587 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}
10588 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}
10589 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}
10590 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}
10591 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}
10592 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}
10593 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}
10594 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}
10595 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}
10596 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}
10597 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}
10598 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}
10599 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}
10600 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}
10601 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}
10602 \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}
10603 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}
10604 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}
10605 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}
10606
10607 \global\mathchardef\checkmark="1370 % actually the square root sign
10608 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}
10609 }% end of \utfeightchardefs
10610
10611 % US-ASCII character definitions.
10612 \def\asciichardefs{% nothing need be done
10613 \relax
10614 }
10615
10616 % Latin1 (ISO-8859-1) character definitions.
10617 \def\nonasciistringdefs{%
10618 \setnonasciicharscatcode\active
10619 \def\defstringchar##1{\def##1{\string##1}}%
10620 %
10621 \defstringchar^^80\defstringchar^^81\defstringchar^^82\defstringchar^^83%
10622 \defstringchar^^84\defstringchar^^85\defstringchar^^86\defstringchar^^87%
10623 \defstringchar^^88\defstringchar^^89\defstringchar^^8a\defstringchar^^8b%
10624 \defstringchar^^8c\defstringchar^^8d\defstringchar^^8e\defstringchar^^8f%
10625 %
10626 \defstringchar^^90\defstringchar^^91\defstringchar^^92\defstringchar^^93%
10627 \defstringchar^^94\defstringchar^^95\defstringchar^^96\defstringchar^^97%
10628 \defstringchar^^98\defstringchar^^99\defstringchar^^9a\defstringchar^^9b%
10629 \defstringchar^^9c\defstringchar^^9d\defstringchar^^9e\defstringchar^^9f%
10630 %
10631 \defstringchar^^a0\defstringchar^^a1\defstringchar^^a2\defstringchar^^a3%
10632 \defstringchar^^a4\defstringchar^^a5\defstringchar^^a6\defstringchar^^a7%
10633 \defstringchar^^a8\defstringchar^^a9\defstringchar^^aa\defstringchar^^ab%
10634 \defstringchar^^ac\defstringchar^^ad\defstringchar^^ae\defstringchar^^af%
10635 %
10636 \defstringchar^^b0\defstringchar^^b1\defstringchar^^b2\defstringchar^^b3%
10637 \defstringchar^^b4\defstringchar^^b5\defstringchar^^b6\defstringchar^^b7%
10638 \defstringchar^^b8\defstringchar^^b9\defstringchar^^ba\defstringchar^^bb%
10639 \defstringchar^^bc\defstringchar^^bd\defstringchar^^be\defstringchar^^bf%
10640 %
10641 \defstringchar^^c0\defstringchar^^c1\defstringchar^^c2\defstringchar^^c3%
10642 \defstringchar^^c4\defstringchar^^c5\defstringchar^^c6\defstringchar^^c7%
10643 \defstringchar^^c8\defstringchar^^c9\defstringchar^^ca\defstringchar^^cb%
10644 \defstringchar^^cc\defstringchar^^cd\defstringchar^^ce\defstringchar^^cf%
10645 %
10646 \defstringchar^^d0\defstringchar^^d1\defstringchar^^d2\defstringchar^^d3%
10647 \defstringchar^^d4\defstringchar^^d5\defstringchar^^d6\defstringchar^^d7%
10648 \defstringchar^^d8\defstringchar^^d9\defstringchar^^da\defstringchar^^db%
10649 \defstringchar^^dc\defstringchar^^dd\defstringchar^^de\defstringchar^^df%
10650 %
10651 \defstringchar^^e0\defstringchar^^e1\defstringchar^^e2\defstringchar^^e3%
10652 \defstringchar^^e4\defstringchar^^e5\defstringchar^^e6\defstringchar^^e7%
10653 \defstringchar^^e8\defstringchar^^e9\defstringchar^^ea\defstringchar^^eb%
10654 \defstringchar^^ec\defstringchar^^ed\defstringchar^^ee\defstringchar^^ef%
10655 %
10656 \defstringchar^^f0\defstringchar^^f1\defstringchar^^f2\defstringchar^^f3%
10657 \defstringchar^^f4\defstringchar^^f5\defstringchar^^f6\defstringchar^^f7%
10658 \defstringchar^^f8\defstringchar^^f9\defstringchar^^fa\defstringchar^^fb%
10659 \defstringchar^^fc\defstringchar^^fd\defstringchar^^fe\defstringchar^^ff%
10660 }
10661
10662
10663 % define all the unicode characters we know about, for the sake of @U.
10664 \utfeightchardefs
10665
10666
10667 % Make non-ASCII characters printable again for compatibility with
10668 % existing Texinfo documents that may use them, even without declaring a
10669 % document encoding.
10670 %
10671 \setnonasciicharscatcode \other
10672
10673
10674 \message{formatting,}
10675
10676 \newdimen\defaultparindent \defaultparindent = 15pt
10677
10678 \chapheadingskip = 15pt plus 4pt minus 2pt
10679 \secheadingskip = 12pt plus 3pt minus 2pt
10680 \subsecheadingskip = 9pt plus 2pt minus 2pt
10681
10682 % Prevent underfull vbox error messages.
10683 \vbadness = 10000
10684
10685 % Don't be very finicky about underfull hboxes, either.
10686 \hbadness = 6666
10687
10688 % Following George Bush, get rid of widows and orphans.
10689 \widowpenalty=10000
10690 \clubpenalty=10000
10691
10692 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
10693 % using an old version of TeX, don't do anything. We want the amount of
10694 % stretch added to depend on the line length, hence the dependence on
10695 % \hsize. We call this whenever the paper size is set.
10696 %
10697 \def\setemergencystretch{%
10698 \ifx\emergencystretch\thisisundefined
10699 % Allow us to assign to \emergencystretch anyway.
10700 \def\emergencystretch{\dimen0}%
10701 \else
10702 \emergencystretch = .15\hsize
10703 \fi
10704 }
10705
10706 % Parameters in order: 1) textheight; 2) textwidth;
10707 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
10708 % 7) physical page height; 8) physical page width.
10709 %
10710 % We also call \setleading{\textleading}, so the caller should define
10711 % \textleading. The caller should also set \parskip.
10712 %
10713 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
10714 \voffset = #3\relax
10715 \topskip = #6\relax
10716 \splittopskip = \topskip
10717 %
10718 \vsize = #1\relax
10719 \advance\vsize by \topskip
10720 \outervsize = \vsize
10721 \advance\outervsize by 2\topandbottommargin
10722 \pageheight = \vsize
10723 %
10724 \hsize = #2\relax
10725 \outerhsize = \hsize
10726 \advance\outerhsize by 0.5in
10727 \pagewidth = \hsize
10728 %
10729 \normaloffset = #4\relax
10730 \bindingoffset = #5\relax
10731 %
10732 \ifpdf
10733 \pdfpageheight #7\relax
10734 \pdfpagewidth #8\relax
10735 % if we don't reset these, they will remain at "1 true in" of
10736 % whatever layout pdftex was dumped with.
10737 \pdfhorigin = 1 true in
10738 \pdfvorigin = 1 true in
10739 \fi
10740 %
10741 \setleading{\textleading}
10742 %
10743 \parindent = \defaultparindent
10744 \setemergencystretch
10745 }
10746
10747 % @letterpaper (the default).
10748 \def\letterpaper{{\globaldefs = 1
10749 \parskip = 3pt plus 2pt minus 1pt
10750 \textleading = 13.2pt
10751 %
10752 % If page is nothing but text, make it come out even.
10753 \internalpagesizes{607.2pt}{6in}% that's 46 lines
10754 {\voffset}{.25in}%
10755 {\bindingoffset}{36pt}%
10756 {11in}{8.5in}%
10757 }}
10758
10759 % Use @smallbook to reset parameters for 7x9.25 trim size.
10760 \def\smallbook{{\globaldefs = 1
10761 \parskip = 2pt plus 1pt
10762 \textleading = 12pt
10763 %
10764 \internalpagesizes{7.5in}{5in}%
10765 {-.2in}{0in}%
10766 {\bindingoffset}{16pt}%
10767 {9.25in}{7in}%
10768 %
10769 \lispnarrowing = 0.3in
10770 \tolerance = 700
10771 \hfuzz = 1pt
10772 \contentsrightmargin = 0pt
10773 \defbodyindent = .5cm
10774 }}
10775
10776 % Use @smallerbook to reset parameters for 6x9 trim size.
10777 % (Just testing, parameters still in flux.)
10778 \def\smallerbook{{\globaldefs = 1
10779 \parskip = 1.5pt plus 1pt
10780 \textleading = 12pt
10781 %
10782 \internalpagesizes{7.4in}{4.8in}%
10783 {-.2in}{-.4in}%
10784 {0pt}{14pt}%
10785 {9in}{6in}%
10786 %
10787 \lispnarrowing = 0.25in
10788 \tolerance = 700
10789 \hfuzz = 1pt
10790 \contentsrightmargin = 0pt
10791 \defbodyindent = .4cm
10792 }}
10793
10794 % Use @afourpaper to print on European A4 paper.
10795 \def\afourpaper{{\globaldefs = 1
10796 \parskip = 3pt plus 2pt minus 1pt
10797 \textleading = 13.2pt
10798 %
10799 % Double-side printing via postscript on Laserjet 4050
10800 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
10801 % To change the settings for a different printer or situation, adjust
10802 % \normaloffset until the front-side and back-side texts align. Then
10803 % do the same for \bindingoffset. You can set these for testing in
10804 % your texinfo source file like this:
10805 % @tex
10806 % \global\normaloffset = -6mm
10807 % \global\bindingoffset = 10mm
10808 % @end tex
10809 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
10810 {\voffset}{\hoffset}%
10811 {\bindingoffset}{44pt}%
10812 {297mm}{210mm}%
10813 %
10814 \tolerance = 700
10815 \hfuzz = 1pt
10816 \contentsrightmargin = 0pt
10817 \defbodyindent = 5mm
10818 }}
10819
10820 % Use @afivepaper to print on European A5 paper.
10821 % From romildo@urano.iceb.ufop.br, 2 July 2000.
10822 % He also recommends making @example and @lisp be small.
10823 \def\afivepaper{{\globaldefs = 1
10824 \parskip = 2pt plus 1pt minus 0.1pt
10825 \textleading = 12.5pt
10826 %
10827 \internalpagesizes{160mm}{120mm}%
10828 {\voffset}{\hoffset}%
10829 {\bindingoffset}{8pt}%
10830 {210mm}{148mm}%
10831 %
10832 \lispnarrowing = 0.2in
10833 \tolerance = 800
10834 \hfuzz = 1.2pt
10835 \contentsrightmargin = 0pt
10836 \defbodyindent = 2mm
10837 \tableindent = 12mm
10838 }}
10839
10840 % A specific text layout, 24x15cm overall, intended for A4 paper.
10841 \def\afourlatex{{\globaldefs = 1
10842 \afourpaper
10843 \internalpagesizes{237mm}{150mm}%
10844 {\voffset}{4.6mm}%
10845 {\bindingoffset}{7mm}%
10846 {297mm}{210mm}%
10847 %
10848 % Must explicitly reset to 0 because we call \afourpaper.
10849 \globaldefs = 0
10850 }}
10851
10852 % Use @afourwide to print on A4 paper in landscape format.
10853 \def\afourwide{{\globaldefs = 1
10854 \afourpaper
10855 \internalpagesizes{241mm}{165mm}%
10856 {\voffset}{-2.95mm}%
10857 {\bindingoffset}{7mm}%
10858 {297mm}{210mm}%
10859 \globaldefs = 0
10860 }}
10861
10862 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
10863 % Perhaps we should allow setting the margins, \topskip, \parskip,
10864 % and/or leading, also. Or perhaps we should compute them somehow.
10865 %
10866 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
10867 \def\pagesizesyyy#1,#2,#3\finish{{%
10868 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
10869 \globaldefs = 1
10870 %
10871 \parskip = 3pt plus 2pt minus 1pt
10872 \setleading{\textleading}%
10873 %
10874 \dimen0 = #1\relax
10875 \advance\dimen0 by \voffset
10876 %
10877 \dimen2 = \hsize
10878 \advance\dimen2 by \normaloffset
10879 %
10880 \internalpagesizes{#1}{\hsize}%
10881 {\voffset}{\normaloffset}%
10882 {\bindingoffset}{44pt}%
10883 {\dimen0}{\dimen2}%
10884 }}
10885
10886 % Set default to letter.
10887 %
10888 \letterpaper
10889
10890
10891 \message{and turning on texinfo input format.}
10892
10893 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
10894
10895 % DEL is a comment character, in case @c does not suffice.
10896 \catcode`\^^? = 14
10897
10898 % Define macros to output various characters with catcode for normal text.
10899 \catcode`\"=\other \def\normaldoublequote{"}
10900 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
10901 \catcode`\+=\other \def\normalplus{+}
10902 \catcode`\<=\other \def\normalless{<}
10903 \catcode`\>=\other \def\normalgreater{>}
10904 \catcode`\^=\other \def\normalcaret{^}
10905 \catcode`\_=\other \def\normalunderscore{_}
10906 \catcode`\|=\other \def\normalverticalbar{|}
10907 \catcode`\~=\other \def\normaltilde{~}
10908
10909 % This macro is used to make a character print one way in \tt
10910 % (where it can probably be output as-is), and another way in other fonts,
10911 % where something hairier probably needs to be done.
10912 %
10913 % #1 is what to print if we are indeed using \tt; #2 is what to print
10914 % otherwise. Since all the Computer Modern typewriter fonts have zero
10915 % interword stretch (and shrink), and it is reasonable to expect all
10916 % typewriter fonts to have this, we can check that font parameter.
10917 %
10918 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
10919
10920 % Same as above, but check for italic font. Actually this also catches
10921 % non-italic slanted fonts since it is impossible to distinguish them from
10922 % italic fonts. But since this is only used by $ and it uses \sl anyway
10923 % this is not a problem.
10924 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
10925
10926 % Set catcodes for Texinfo file
10927
10928 % Active characters for printing the wanted glyph.
10929 % Most of these we simply print from the \tt font, but for some, we can
10930 % use math or other variants that look better in normal text.
10931 %
10932 \catcode`\"=\active
10933 \def\activedoublequote{{\tt\char34}}
10934 \let"=\activedoublequote
10935 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
10936 \chardef\hatchar=`\^
10937 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
10938
10939 \catcode`\_=\active
10940 \def_{\ifusingtt\normalunderscore\_}
10941 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
10942 \let\realunder=_
10943
10944 \catcode`\|=\active \def|{{\tt\char124}}
10945
10946 \chardef \less=`\<
10947 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
10948 \chardef \gtr=`\>
10949 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
10950 \catcode`\+=\active \def+{{\tt \char 43}}
10951 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
10952 \catcode`\-=\active \let-=\normaldash
10953
10954
10955 % used for headline/footline in the output routine, in case the page
10956 % breaks in the middle of an @tex block.
10957 \def\texinfochars{%
10958 \let< = \activeless
10959 \let> = \activegtr
10960 \let~ = \activetilde
10961 \let^ = \activehat
10962 \markupsetuplqdefault \markupsetuprqdefault
10963 \let\b = \strong
10964 \let\i = \smartitalic
10965 % in principle, all other definitions in \tex have to be undone too.
10966 }
10967
10968 % Used sometimes to turn off (effectively) the active characters even after
10969 % parsing them.
10970 \def\turnoffactive{%
10971 \normalturnoffactive
10972 \otherbackslash
10973 }
10974
10975 \catcode`\@=0
10976
10977 % \backslashcurfont outputs one backslash character in current font,
10978 % as in \char`\\.
10979 \global\chardef\backslashcurfont=`\\
10980 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
10981
10982 % \realbackslash is an actual character `\' with catcode other, and
10983 % \doublebackslash is two of them (for the pdf outlines).
10984 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
10985
10986 % In Texinfo, backslash is an active character; it prints the backslash
10987 % in fixed width font.
10988 \catcode`\\=\active % @ for escape char from now on.
10989
10990 % Print a typewriter backslash. For math mode, we can't simply use
10991 % \backslashcurfont: the story here is that in math mode, the \char
10992 % of \backslashcurfont ends up printing the roman \ from the math symbol
10993 % font (because \char in math mode uses the \mathcode, and plain.tex
10994 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
10995 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
10996 % ignored family value; char position "5C). We can't use " for the
10997 % usual hex value because it has already been made active.
10998
10999 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11000 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11001
11002 % \rawbackslash defines an active \ to do \backslashcurfont.
11003 % \otherbackslash defines an active \ to be a literal `\' character with
11004 % catcode other. We switch back and forth between these.
11005 @gdef@rawbackslash{@let\=@backslashcurfont}
11006 @gdef@otherbackslash{@let\=@realbackslash}
11007
11008 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11009 % the literal character `\'.
11010 %
11011 {@catcode`- = @active
11012 @gdef@normalturnoffactive{%
11013 @nonasciistringdefs
11014 @let-=@normaldash
11015 @let"=@normaldoublequote
11016 @let$=@normaldollar %$ font-lock fix
11017 @let+=@normalplus
11018 @let<=@normalless
11019 @let>=@normalgreater
11020 @let^=@normalcaret
11021 @let_=@normalunderscore
11022 @let|=@normalverticalbar
11023 @let~=@normaltilde
11024 @let\=@ttbackslash
11025 @markupsetuplqdefault
11026 @markupsetuprqdefault
11027 @unsepspaces
11028 }
11029 }
11030
11031 % If a .fmt file is being used, characters that might appear in a file
11032 % name cannot be active until we have parsed the command line.
11033 % So turn them off again, and have @fixbackslash turn them back on.
11034 @catcode`+=@other @catcode`@_=@other
11035
11036 % \enablebackslashhack - allow file to begin `\input texinfo'
11037 %
11038 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11039 % That is what \eatinput is for; after that, the `\' should revert to printing
11040 % a backslash.
11041 % If the file did not have a `\input texinfo', then it is turned off after
11042 % the first line; otherwise the first `\' in the file would cause an error.
11043 % This is used on the very last line of this file, texinfo.tex.
11044 % We also use @c to call @fixbackslash, in case ends of lines are hidden.
11045 {
11046 @catcode`@^=7
11047 @catcode`@^^M=13@gdef@enablebackslashhack{%
11048 @global@let\ = @eatinput%
11049 @catcode`@^^M=13%
11050 @def@c{@fixbackslash@c}%
11051 @def ^^M{@let^^M@secondlinenl}%
11052 @gdef @secondlinenl{@let^^M@thirdlinenl}%
11053 @gdef @thirdlinenl{@fixbackslash}%
11054 }}
11055
11056 {@catcode`@^=7 @catcode`@^^M=13%
11057 @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11058
11059 % Emergency active definition of newline, in case an active newline token
11060 % appears by mistake.
11061 {@catcode`@^=7 @catcode13=13%
11062 @gdef@enableemergencynewline{%
11063 @gdef^^M{%
11064 @par%
11065 %<warning: active newline>@par%
11066 }}}
11067
11068
11069 @gdef@fixbackslash{%
11070 @ifx\@eatinput @let\ = @ttbackslash @fi
11071 @catcode13=5 % regular end of line
11072 @enableemergencynewline
11073 @let@c=@texinfoc
11074 % Also turn back on active characters that might appear in the input
11075 % file name, in case not using a pre-dumped format.
11076 @catcode`+=@active
11077 @catcode`@_=@active
11078 %
11079 % If texinfo.cnf is present on the system, read it.
11080 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11081 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11082 % directly in this file, texinfo.tex, makes it possible to make a format
11083 % file for Texinfo.
11084 %
11085 @openin 1 texinfo.cnf
11086 @ifeof 1 @else @input texinfo.cnf @fi
11087 @closein 1
11088 }
11089
11090
11091 % Say @foo, not \foo, in error messages.
11092 @escapechar = `@@
11093
11094 % These (along with & and #) are made active for url-breaking, so need
11095 % active definitions as the normal characters.
11096 @def@normaldot{.}
11097 @def@normalquest{?}
11098 @def@normalslash{/}
11099
11100 % These look ok in all fonts, so just make them not special.
11101 % @hashchar{} gets its own user-level command, because of #line.
11102 @catcode`@& = @other @def@normalamp{&}
11103 @catcode`@# = @other @def@normalhash{#}
11104 @catcode`@% = @other @def@normalpercent{%}
11105
11106 @let @hashchar = @normalhash
11107
11108 @c Finally, make ` and ' active, so that txicodequoteundirected and
11109 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11110 @c don't make ` and ' active, @code will not get them as active chars.
11111 @c Do this last of all since we use ` in the previous @catcode assignments.
11112 @catcode`@'=@active
11113 @catcode`@`=@active
11114 @markupsetuplqdefault
11115 @markupsetuprqdefault
11116
11117 @c Local variables:
11118 @c eval: (add-hook 'write-file-hooks 'time-stamp)
11119 @c page-delimiter: "^\\\\message\\|emacs-page"
11120 @c time-stamp-start: "def\\\\texinfoversion{"
11121 @c time-stamp-format: "%:y-%02m-%02d.%02H"
11122 @c time-stamp-end: "}"
11123 @c End:
11124
11125 @c vim:sw=2:
11126
11127 @ignore
11128 arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
11129 @end ignore
11130 @enablebackslashhack