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