Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: bison/src/bison/2.4.1/bison-2.4.1-src/build-aux/texinfo.tex

Issue 10807020: Add native Windows binary for bison. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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{2008-12-03.17}
7 %
8 % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10 % 2007, 2008 Free Software Foundation, Inc.
11 %
12 % This texinfo.tex file is free software: you can redistribute it and/or
13 % modify it under the terms of the GNU General Public License as
14 % published by the Free Software Foundation, either version 3 of the
15 % License, or (at your option) any later version.
16 %
17 % This texinfo.tex file is distributed in the hope that it will be
18 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 % General Public License for more details.
21 %
22 % You should have received a copy of the GNU General Public License
23 % along with this program. If not, see <http://www.gnu.org/licenses/>.
24 %
25 % As a special exception, when this file is read by TeX when processing
26 % a Texinfo source document, you may use the result without
27 % restriction. (This has been our intent since Texinfo was invented.)
28 %
29 % Please try the latest version of texinfo.tex before submitting bug
30 % reports; you can get the latest version from:
31 % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
32 % ftp://tug.org/tex/texinfo.tex
33 % (and all CTAN mirrors, see http://www.ctan.org).
34 % The texinfo.tex in any given distribution could well be out
35 % of date, so if that's what you're using, please check.
36 %
37 % Send bug reports to bug-texinfo@gnu.org. Please include including a
38 % complete document in each bug report with which we can reproduce the
39 % problem. Patches are, of course, greatly appreciated.
40 %
41 % To process a Texinfo manual with TeX, it's most reliable to use the
42 % texi2dvi shell script that comes with the distribution. For a simple
43 % manual foo.texi, however, you can get away with this:
44 % tex foo.texi
45 % texindex foo.??
46 % tex foo.texi
47 % tex foo.texi
48 % dvips foo.dvi -o # or whatever; this makes foo.ps.
49 % The extra TeX runs get the cross-reference information correct.
50 % Sometimes one run after texindex suffices, and sometimes you need more
51 % than two; texi2dvi does it as many times as necessary.
52 %
53 % It is possible to adapt texinfo.tex for other languages, to some
54 % extent. You can get the existing language-specific files from the
55 % full Texinfo distribution.
56 %
57 % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
58
59
60 \message{Loading texinfo [version \texinfoversion]:}
61
62 % If in a .fmt file, print the version number
63 % and turn on active characters that we couldn't do earlier because
64 % they might have appeared in the input file name.
65 \everyjob{\message{[Texinfo version \texinfoversion]}%
66 \catcode`+=\active \catcode`\_=\active}
67
68
69 \chardef\other=12
70
71 % We never want plain's \outer definition of \+ in Texinfo.
72 % For @tex, we can use \tabalign.
73 \let\+ = \relax
74
75 % Save some plain tex macros whose names we will redefine.
76 \let\ptexb=\b
77 \let\ptexbullet=\bullet
78 \let\ptexc=\c
79 \let\ptexcomma=\,
80 \let\ptexdot=\.
81 \let\ptexdots=\dots
82 \let\ptexend=\end
83 \let\ptexequiv=\equiv
84 \let\ptexexclam=\!
85 \let\ptexfootnote=\footnote
86 \let\ptexgtr=>
87 \let\ptexhat=^
88 \let\ptexi=\i
89 \let\ptexindent=\indent
90 \let\ptexinsert=\insert
91 \let\ptexlbrace=\{
92 \let\ptexless=<
93 \let\ptexnewwrite\newwrite
94 \let\ptexnoindent=\noindent
95 \let\ptexplus=+
96 \let\ptexrbrace=\}
97 \let\ptexslash=\/
98 \let\ptexstar=\*
99 \let\ptext=\t
100 \let\ptextop=\top
101 {\catcode`\'=\active
102 \global\let\ptexquoteright'}% Math-mode def from plain.tex.
103
104 % If this character appears in an error message or help string, it
105 % starts a new line in the output.
106 \newlinechar = `^^J
107
108 % Use TeX 3.0's \inputlineno to get the line number, for better error
109 % messages, but if we're using an old version of TeX, don't do anything.
110 %
111 \ifx\inputlineno\thisisundefined
112 \let\linenumber = \empty % Pre-3.0.
113 \else
114 \def\linenumber{l.\the\inputlineno:\space}
115 \fi
116
117 % Set up fixed words for English if not already set.
118 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
119 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
120 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
121 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
122 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty )}\fi
123 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is n onexistent)}\fi
124 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
125 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instanc e Variable of}\fi
126 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
127 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
128 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
129 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
130 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
131 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
132 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
133 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
134 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
135 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
136 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
137 %
138 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
139 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
140 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
141 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
142 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
143 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
144 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
145 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
146 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
147 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
148 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
149 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
150 %
151 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
152 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
153 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
154 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
155 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
156
157 % Since the category of space is not known, we have to be careful.
158 \chardef\spacecat = 10
159 \def\spaceisspace{\catcode`\ =\spacecat}
160
161 % sometimes characters are active, so we need control sequences.
162 \chardef\colonChar = `\:
163 \chardef\commaChar = `\,
164 \chardef\dashChar = `\-
165 \chardef\dotChar = `\.
166 \chardef\exclamChar= `\!
167 \chardef\lquoteChar= `\`
168 \chardef\questChar = `\?
169 \chardef\rquoteChar= `\'
170 \chardef\semiChar = `\;
171 \chardef\underChar = `\_
172
173 % Ignore a token.
174 %
175 \def\gobble#1{}
176
177 % The following is used inside several \edef's.
178 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
179
180 % Hyphenation fixes.
181 \hyphenation{
182 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
183 ap-pen-dix bit-map bit-maps
184 data-base data-bases eshell fall-ing half-way long-est man-u-script
185 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
186 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
187 spell-ing spell-ings
188 stand-alone strong-est time-stamp time-stamps which-ever white-space
189 wide-spread wrap-around
190 }
191
192 % Margin to add to right of even pages, to left of odd pages.
193 \newdimen\bindingoffset
194 \newdimen\normaloffset
195 \newdimen\pagewidth \newdimen\pageheight
196
197 % For a final copy, take out the rectangles
198 % that mark overfull boxes (in case you have decided
199 % that the text looks ok even though it passes the margin).
200 %
201 \def\finalout{\overfullrule=0pt}
202
203 % @| inserts a changebar to the left of the current line. It should
204 % surround any changed text. This approach does *not* work if the
205 % change spans more than two lines of output. To handle that, we would
206 % have adopt a much more difficult approach (putting marks into the main
207 % vertical list for the beginning and end of each change).
208 %
209 \def\|{%
210 % \vadjust can only be used in horizontal mode.
211 \leavevmode
212 %
213 % Append this vertical mode material after the current line in the output.
214 \vadjust{%
215 % We want to insert a rule with the height and depth of the current
216 % leading; that is exactly what \strutbox is supposed to record.
217 \vskip-\baselineskip
218 %
219 % \vadjust-items are inserted at the left edge of the type. So
220 % the \llap here moves out into the left-hand margin.
221 \llap{%
222 %
223 % For a thicker or thinner bar, change the `1pt'.
224 \vrule height\baselineskip width1pt
225 %
226 % This is the space between the bar and the text.
227 \hskip 12pt
228 }%
229 }%
230 }
231
232 % Sometimes it is convenient to have everything in the transcript file
233 % and nothing on the terminal. We don't just call \tracingall here,
234 % since that produces some useless output on the terminal. We also make
235 % some effort to order the tracing commands to reduce output in the log
236 % file; cf. trace.sty in LaTeX.
237 %
238 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
239 \def\loggingall{%
240 \tracingstats2
241 \tracingpages1
242 \tracinglostchars2 % 2 gives us more in etex
243 \tracingparagraphs1
244 \tracingoutput1
245 \tracingmacros2
246 \tracingrestores1
247 \showboxbreadth\maxdimen \showboxdepth\maxdimen
248 \ifx\eTeXversion\undefined\else % etex gives us more logging
249 \tracingscantokens1
250 \tracingifs1
251 \tracinggroups1
252 \tracingnesting2
253 \tracingassigns1
254 \fi
255 \tracingcommands3 % 3 gives us more in etex
256 \errorcontextlines16
257 }%
258
259 % add check for \lastpenalty to plain's definitions. If the last thing
260 % we did was a \nobreak, we don't want to insert more space.
261 %
262 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
263 \removelastskip\penalty-50\smallskip\fi\fi}
264 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
265 \removelastskip\penalty-100\medskip\fi\fi}
266 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
267 \removelastskip\penalty-200\bigskip\fi\fi}
268
269 % For @cropmarks command.
270 % Do @cropmarks to get crop marks.
271 %
272 \newif\ifcropmarks
273 \let\cropmarks = \cropmarkstrue
274 %
275 % Dimensions to add cropmarks at corners.
276 % Added by P. A. MacKay, 12 Nov. 1986
277 %
278 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
279 \newdimen\cornerlong \cornerlong=1pc
280 \newdimen\cornerthick \cornerthick=.3pt
281 \newdimen\topandbottommargin \topandbottommargin=.75in
282
283 % Output a mark which sets \thischapter, \thissection and \thiscolor.
284 % We dump everything together because we only have one kind of mark.
285 % This works because we only use \botmark / \topmark, not \firstmark.
286 %
287 % A mark contains a subexpression of the \ifcase ... \fi construct.
288 % \get*marks macros below extract the needed part using \ifcase.
289 %
290 % Another complication is to let the user choose whether \thischapter
291 % (\thissection) refers to the chapter (section) in effect at the top
292 % of a page, or that at the bottom of a page. The solution is
293 % described on page 260 of The TeXbook. It involves outputting two
294 % marks for the sectioning macros, one before the section break, and
295 % one after. I won't pretend I can describe this better than DEK...
296 \def\domark{%
297 \toks0=\expandafter{\lastchapterdefs}%
298 \toks2=\expandafter{\lastsectiondefs}%
299 \toks4=\expandafter{\prevchapterdefs}%
300 \toks6=\expandafter{\prevsectiondefs}%
301 \toks8=\expandafter{\lastcolordefs}%
302 \mark{%
303 \the\toks0 \the\toks2
304 \noexpand\or \the\toks4 \the\toks6
305 \noexpand\else \the\toks8
306 }%
307 }
308 % \topmark doesn't work for the very first chapter (after the title
309 % page or the contents), so we use \firstmark there -- this gets us
310 % the mark with the chapter defs, unless the user sneaks in, e.g.,
311 % @setcolor (or @url, or @link, etc.) between @contents and the very
312 % first @chapter.
313 \def\gettopheadingmarks{%
314 \ifcase0\topmark\fi
315 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
316 }
317 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
318 \def\getcolormarks{\ifcase2\topmark\fi}
319
320 % Avoid "undefined control sequence" errors.
321 \def\lastchapterdefs{}
322 \def\lastsectiondefs{}
323 \def\prevchapterdefs{}
324 \def\prevsectiondefs{}
325 \def\lastcolordefs{}
326
327 % Main output routine.
328 \chardef\PAGE = 255
329 \output = {\onepageout{\pagecontents\PAGE}}
330
331 \newbox\headlinebox
332 \newbox\footlinebox
333
334 % \onepageout takes a vbox as an argument. Note that \pagecontents
335 % does insertions, but you have to call it yourself.
336 \def\onepageout#1{%
337 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
338 %
339 \ifodd\pageno \advance\hoffset by \bindingoffset
340 \else \advance\hoffset by -\bindingoffset\fi
341 %
342 % Do this outside of the \shipout so @code etc. will be expanded in
343 % the headline as they should be, not taken literally (outputting ''code).
344 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
345 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
346 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
347 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
348 %
349 {%
350 % Have to do this stuff outside the \shipout because we want it to
351 % take effect in \write's, yet the group defined by the \vbox ends
352 % before the \shipout runs.
353 %
354 \indexdummies % don't expand commands in the output.
355 \normalturnoffactive % \ in index entries must not stay \, e.g., if
356 % the page break happens to be in the middle of an example.
357 % We don't want .vr (or whatever) entries like this:
358 % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
359 % "\acronym" won't work when it's read back in;
360 % it needs to be
361 % {\code {{\tt \backslashcurfont }acronym}
362 \shipout\vbox{%
363 % Do this early so pdf references go to the beginning of the page.
364 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
365 %
366 \ifcropmarks \vbox to \outervsize\bgroup
367 \hsize = \outerhsize
368 \vskip-\topandbottommargin
369 \vtop to0pt{%
370 \line{\ewtop\hfil\ewtop}%
371 \nointerlineskip
372 \line{%
373 \vbox{\moveleft\cornerthick\nstop}%
374 \hfill
375 \vbox{\moveright\cornerthick\nstop}%
376 }%
377 \vss}%
378 \vskip\topandbottommargin
379 \line\bgroup
380 \hfil % center the page within the outer (page) hsize.
381 \ifodd\pageno\hskip\bindingoffset\fi
382 \vbox\bgroup
383 \fi
384 %
385 \unvbox\headlinebox
386 \pagebody{#1}%
387 \ifdim\ht\footlinebox > 0pt
388 % Only leave this space if the footline is nonempty.
389 % (We lessened \vsize for it in \oddfootingyyy.)
390 % The \baselineskip=24pt in plain's \makefootline has no effect.
391 \vskip 24pt
392 \unvbox\footlinebox
393 \fi
394 %
395 \ifcropmarks
396 \egroup % end of \vbox\bgroup
397 \hfil\egroup % end of (centering) \line\bgroup
398 \vskip\topandbottommargin plus1fill minus1fill
399 \boxmaxdepth = \cornerthick
400 \vbox to0pt{\vss
401 \line{%
402 \vbox{\moveleft\cornerthick\nsbot}%
403 \hfill
404 \vbox{\moveright\cornerthick\nsbot}%
405 }%
406 \nointerlineskip
407 \line{\ewbot\hfil\ewbot}%
408 }%
409 \egroup % \vbox from first cropmarks clause
410 \fi
411 }% end of \shipout\vbox
412 }% end of group with \indexdummies
413 \advancepageno
414 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
415 }
416
417 \newinsert\margin \dimen\margin=\maxdimen
418
419 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
420 {\catcode`\@ =11
421 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
422 % marginal hacks, juha@viisa.uucp (Juha Takala)
423 \ifvoid\margin\else % marginal info is present
424 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
425 \dimen@=\dp#1\relax \unvbox#1\relax
426 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
427 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
428 }
429
430 % Here are the rules for the cropmarks. Note that they are
431 % offset so that the space between them is truly \outerhsize or \outervsize
432 % (P. A. MacKay, 12 November, 1986)
433 %
434 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
435 \def\nstop{\vbox
436 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
437 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
438 \def\nsbot{\vbox
439 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
440
441 % Parse an argument, then pass it to #1. The argument is the rest of
442 % the input line (except we remove a trailing comment). #1 should be a
443 % macro which expects an ordinary undelimited TeX argument.
444 %
445 \def\parsearg{\parseargusing{}}
446 \def\parseargusing#1#2{%
447 \def\argtorun{#2}%
448 \begingroup
449 \obeylines
450 \spaceisspace
451 #1%
452 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
453 }
454
455 {\obeylines %
456 \gdef\parseargline#1^^M{%
457 \endgroup % End of the group started in \parsearg.
458 \argremovecomment #1\comment\ArgTerm%
459 }%
460 }
461
462 % First remove any @comment, then any @c comment.
463 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
464 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
465
466 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
467 %
468 % \argremovec might leave us with trailing space, e.g.,
469 % @end itemize @c foo
470 % This space token undergoes the same procedure and is eventually removed
471 % by \finishparsearg.
472 %
473 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
474 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
475 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
476 \def\temp{#3}%
477 \ifx\temp\empty
478 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
479 \let\temp\finishparsearg
480 \else
481 \let\temp\argcheckspaces
482 \fi
483 % Put the space token in:
484 \temp#1 #3\ArgTerm
485 }
486
487 % If a _delimited_ argument is enclosed in braces, they get stripped; so
488 % to get _exactly_ the rest of the line, we had to prevent such situation.
489 % We prepended an \empty token at the very beginning and we expand it now,
490 % just before passing the control to \argtorun.
491 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
492 % either the null string, or it ends with \^^M---thus there is no danger
493 % that a pair of braces would be stripped.
494 %
495 % But first, we have to remove the trailing space token.
496 %
497 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
498
499 % \parseargdef\foo{...}
500 % is roughly equivalent to
501 % \def\foo{\parsearg\Xfoo}
502 % \def\Xfoo#1{...}
503 %
504 % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
505 % favourite TeX trick. --kasal, 16nov03
506
507 \def\parseargdef#1{%
508 \expandafter \doparseargdef \csname\string#1\endcsname #1%
509 }
510 \def\doparseargdef#1#2{%
511 \def#2{\parsearg#1}%
512 \def#1##1%
513 }
514
515 % Several utility definitions with active space:
516 {
517 \obeyspaces
518 \gdef\obeyedspace{ }
519
520 % Make each space character in the input produce a normal interword
521 % space in the output. Don't allow a line break at this space, as this
522 % is used only in environments like @example, where each line of input
523 % should produce a line of output anyway.
524 %
525 \gdef\sepspaces{\obeyspaces\let =\tie}
526
527 % If an index command is used in an @example environment, any spaces
528 % therein should become regular spaces in the raw index file, not the
529 % expansion of \tie (\leavevmode \penalty \@M \ ).
530 \gdef\unsepspaces{\let =\space}
531 }
532
533
534 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
535
536 % Define the framework for environments in texinfo.tex. It's used like this:
537 %
538 % \envdef\foo{...}
539 % \def\Efoo{...}
540 %
541 % It's the responsibility of \envdef to insert \begingroup before the
542 % actual body; @end closes the group after calling \Efoo. \envdef also
543 % defines \thisenv, so the current environment is known; @end checks
544 % whether the environment name matches. The \checkenv macro can also be
545 % used to check whether the current environment is the one expected.
546 %
547 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
548 % are not treated as environments; they don't open a group. (The
549 % implementation of @end takes care not to call \endgroup in this
550 % special case.)
551
552
553 % At run-time, environments start with this:
554 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
555 % initialize
556 \let\thisenv\empty
557
558 % ... but they get defined via ``\envdef\foo{...}'':
559 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
560 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
561
562 % Check whether we're in the right environment:
563 \def\checkenv#1{%
564 \def\temp{#1}%
565 \ifx\thisenv\temp
566 \else
567 \badenverr
568 \fi
569 }
570
571 % Environment mismatch, #1 expected:
572 \def\badenverr{%
573 \errhelp = \EMsimple
574 \errmessage{This command can appear only \inenvironment\temp,
575 not \inenvironment\thisenv}%
576 }
577 \def\inenvironment#1{%
578 \ifx#1\empty
579 out of any environment%
580 \else
581 in environment \expandafter\string#1%
582 \fi
583 }
584
585 % @end foo executes the definition of \Efoo.
586 % But first, it executes a specialized version of \checkenv
587 %
588 \parseargdef\end{%
589 \if 1\csname iscond.#1\endcsname
590 \else
591 % The general wording of \badenverr may not be ideal, but... --kasal, 06nov0 3
592 \expandafter\checkenv\csname#1\endcsname
593 \csname E#1\endcsname
594 \endgroup
595 \fi
596 }
597
598 \newhelp\EMsimple{Press RETURN to continue.}
599
600
601 %% Simple single-character @ commands
602
603 % @@ prints an @
604 % Kludge this until the fonts are right (grr).
605 \def\@{{\tt\char64}}
606
607 % This is turned off because it was never documented
608 % and you can use @w{...} around a quote to suppress ligatures.
609 %% Define @` and @' to be the same as ` and '
610 %% but suppressing ligatures.
611 %\def\`{{`}}
612 %\def\'{{'}}
613
614 % Used to generate quoted braces.
615 \def\mylbrace {{\tt\char123}}
616 \def\myrbrace {{\tt\char125}}
617 \let\{=\mylbrace
618 \let\}=\myrbrace
619 \begingroup
620 % Definitions to produce \{ and \} commands for indices,
621 % and @{ and @} for the aux/toc files.
622 \catcode`\{ = \other \catcode`\} = \other
623 \catcode`\[ = 1 \catcode`\] = 2
624 \catcode`\! = 0 \catcode`\\ = \other
625 !gdef!lbracecmd[\{]%
626 !gdef!rbracecmd[\}]%
627 !gdef!lbraceatcmd[@{]%
628 !gdef!rbraceatcmd[@}]%
629 !endgroup
630
631 % @comma{} to avoid , parsing problems.
632 \let\comma = ,
633
634 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
635 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
636 \let\, = \c
637 \let\dotaccent = \.
638 \def\ringaccent#1{{\accent23 #1}}
639 \let\tieaccent = \t
640 \let\ubaraccent = \b
641 \let\udotaccent = \d
642
643 % Other special characters: @questiondown @exclamdown @ordf @ordm
644 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
645 \def\questiondown{?`}
646 \def\exclamdown{!`}
647 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
648 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
649
650 % Dotless i and dotless j, used for accents.
651 \def\imacro{i}
652 \def\jmacro{j}
653 \def\dotless#1{%
654 \def\temp{#1}%
655 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
656 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
657 \else \errmessage{@dotless can be used only with i or j}%
658 \fi\fi
659 }
660
661 % The \TeX{} logo, as in plain, but resetting the spacing so that a
662 % period following counts as ending a sentence. (Idea found in latex.)
663 %
664 \edef\TeX{\TeX \spacefactor=1000 }
665
666 % @LaTeX{} logo. Not quite the same results as the definition in
667 % latex.ltx, since we use a different font for the raised A; it's most
668 % convenient for us to use an explicitly smaller font, rather than using
669 % the \scriptstyle font (since we don't reset \scriptstyle and
670 % \scriptscriptstyle).
671 %
672 \def\LaTeX{%
673 L\kern-.36em
674 {\setbox0=\hbox{T}%
675 \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
676 \kern-.15em
677 \TeX
678 }
679
680 % Be sure we're in horizontal mode when doing a tie, since we make space
681 % equivalent to this in @example-like environments. Otherwise, a space
682 % at the beginning of a line will start with \penalty -- and
683 % since \penalty is valid in vertical mode, we'd end up putting the
684 % penalty on the vertical list instead of in the new paragraph.
685 {\catcode`@ = 11
686 % Avoid using \@M directly, because that causes trouble
687 % if the definition is written into an index file.
688 \global\let\tiepenalty = \@M
689 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
690 }
691
692 % @: forces normal size whitespace following.
693 \def\:{\spacefactor=1000 }
694
695 % @* forces a line break.
696 \def\*{\hfil\break\hbox{}\ignorespaces}
697
698 % @/ allows a line break.
699 \let\/=\allowbreak
700
701 % @. is an end-of-sentence period.
702 \def\.{.\spacefactor=\endofsentencespacefactor\space}
703
704 % @! is an end-of-sentence bang.
705 \def\!{!\spacefactor=\endofsentencespacefactor\space}
706
707 % @? is an end-of-sentence query.
708 \def\?{?\spacefactor=\endofsentencespacefactor\space}
709
710 % @frenchspacing on|off says whether to put extra space after punctuation.
711 %
712 \def\onword{on}
713 \def\offword{off}
714 %
715 \parseargdef\frenchspacing{%
716 \def\temp{#1}%
717 \ifx\temp\onword \plainfrenchspacing
718 \else\ifx\temp\offword \plainnonfrenchspacing
719 \else
720 \errhelp = \EMsimple
721 \errmessage{Unknown @frenchspacing option `\temp', must be on/off}%
722 \fi\fi
723 }
724
725 % @w prevents a word break. Without the \leavevmode, @w at the
726 % beginning of a paragraph, when TeX is still in vertical mode, would
727 % produce a whole line of output instead of starting the paragraph.
728 \def\w#1{\leavevmode\hbox{#1}}
729
730 % @group ... @end group forces ... to be all on one page, by enclosing
731 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
732 % to keep its height that of a normal line. According to the rules for
733 % \topskip (p.114 of the TeXbook), the glue inserted is
734 % max (\topskip - \ht (first item), 0). If that height is large,
735 % therefore, no glue is inserted, and the space between the headline and
736 % the text is small, which looks bad.
737 %
738 % Another complication is that the group might be very large. This can
739 % cause the glue on the previous page to be unduly stretched, because it
740 % does not have much material. In this case, it's better to add an
741 % explicit \vfill so that the extra space is at the bottom. The
742 % threshold for doing this is if the group is more than \vfilllimit
743 % percent of a page (\vfilllimit can be changed inside of @tex).
744 %
745 \newbox\groupbox
746 \def\vfilllimit{0.7}
747 %
748 \envdef\group{%
749 \ifnum\catcode`\^^M=\active \else
750 \errhelp = \groupinvalidhelp
751 \errmessage{@group invalid in context where filling is enabled}%
752 \fi
753 \startsavinginserts
754 %
755 \setbox\groupbox = \vtop\bgroup
756 % Do @comment since we are called inside an environment such as
757 % @example, where each end-of-line in the input causes an
758 % end-of-line in the output. We don't want the end-of-line after
759 % the `@group' to put extra space in the output. Since @group
760 % should appear on a line by itself (according to the Texinfo
761 % manual), we don't worry about eating any user text.
762 \comment
763 }
764 %
765 % The \vtop produces a box with normal height and large depth; thus, TeX puts
766 % \baselineskip glue before it, and (when the next line of text is done)
767 % \lineskip glue after it. Thus, space below is not quite equal to space
768 % above. But it's pretty close.
769 \def\Egroup{%
770 % To get correct interline space between the last line of the group
771 % and the first line afterwards, we have to propagate \prevdepth.
772 \endgraf % Not \par, as it may have been set to \lisppar.
773 \global\dimen1 = \prevdepth
774 \egroup % End the \vtop.
775 % \dimen0 is the vertical size of the group's box.
776 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
777 % \dimen2 is how much space is left on the page (more or less).
778 \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
779 % if the group doesn't fit on the current page, and it's a big big
780 % group, force a page break.
781 \ifdim \dimen0 > \dimen2
782 \ifdim \pagetotal < \vfilllimit\pageheight
783 \page
784 \fi
785 \fi
786 \box\groupbox
787 \prevdepth = \dimen1
788 \checkinserts
789 }
790 %
791 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
792 % message, so this ends up printing `@group can only ...'.
793 %
794 \newhelp\groupinvalidhelp{%
795 group can only be used in environments such as @example,^^J%
796 where each line of input produces a line of output.}
797
798 % @need space-in-mils
799 % forces a page break if there is not space-in-mils remaining.
800
801 \newdimen\mil \mil=0.001in
802
803 % Old definition--didn't work.
804 %\parseargdef\need{\par %
805 %% This method tries to make TeX break the page naturally
806 %% if the depth of the box does not fit.
807 %{\baselineskip=0pt%
808 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
809 %\prevdepth=-1000pt
810 %}}
811
812 \parseargdef\need{%
813 % Ensure vertical mode, so we don't make a big box in the middle of a
814 % paragraph.
815 \par
816 %
817 % If the @need value is less than one line space, it's useless.
818 \dimen0 = #1\mil
819 \dimen2 = \ht\strutbox
820 \advance\dimen2 by \dp\strutbox
821 \ifdim\dimen0 > \dimen2
822 %
823 % Do a \strut just to make the height of this box be normal, so the
824 % normal leading is inserted relative to the preceding line.
825 % And a page break here is fine.
826 \vtop to #1\mil{\strut\vfil}%
827 %
828 % TeX does not even consider page breaks if a penalty added to the
829 % main vertical list is 10000 or more. But in order to see if the
830 % empty box we just added fits on the page, we must make it consider
831 % page breaks. On the other hand, we don't want to actually break the
832 % page after the empty box. So we use a penalty of 9999.
833 %
834 % There is an extremely small chance that TeX will actually break the
835 % page at this \penalty, if there are no other feasible breakpoints in
836 % sight. (If the user is using lots of big @group commands, which
837 % almost-but-not-quite fill up a page, TeX will have a hard time doing
838 % good page breaking, for example.) However, I could not construct an
839 % example where a page broke at this \penalty; if it happens in a real
840 % document, then we can reconsider our strategy.
841 \penalty9999
842 %
843 % Back up by the size of the box, whether we did a page break or not.
844 \kern -#1\mil
845 %
846 % Do not allow a page break right after this kern.
847 \nobreak
848 \fi
849 }
850
851 % @br forces paragraph break (and is undocumented).
852
853 \let\br = \par
854
855 % @page forces the start of a new page.
856 %
857 \def\page{\par\vfill\supereject}
858
859 % @exdent text....
860 % outputs text on separate line in roman font, starting at standard page margin
861
862 % This records the amount of indent in the innermost environment.
863 % That's how much \exdent should take out.
864 \newskip\exdentamount
865
866 % This defn is used inside fill environments such as @defun.
867 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
868
869 % This defn is used inside nofill environments such as @example.
870 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
871 \leftline{\hskip\leftskip{\rm#1}}}}
872
873 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
874 % paragraph. For more general purposes, use the \margin insertion
875 % class. WHICH is `l' or `r'.
876 %
877 \newskip\inmarginspacing \inmarginspacing=1cm
878 \def\strutdepth{\dp\strutbox}
879 %
880 \def\doinmargin#1#2{\strut\vadjust{%
881 \nobreak
882 \kern-\strutdepth
883 \vtop to \strutdepth{%
884 \baselineskip=\strutdepth
885 \vss
886 % if you have multiple lines of stuff to put here, you'll need to
887 % make the vbox yourself of the appropriate size.
888 \ifx#1l%
889 \llap{\ignorespaces #2\hskip\inmarginspacing}%
890 \else
891 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
892 \fi
893 \null
894 }%
895 }}
896 \def\inleftmargin{\doinmargin l}
897 \def\inrightmargin{\doinmargin r}
898 %
899 % @inmargin{TEXT [, RIGHT-TEXT]}
900 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
901 % else use TEXT for both).
902 %
903 \def\inmargin#1{\parseinmargin #1,,\finish}
904 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
905 \setbox0 = \hbox{\ignorespaces #2}%
906 \ifdim\wd0 > 0pt
907 \def\lefttext{#1}% have both texts
908 \def\righttext{#2}%
909 \else
910 \def\lefttext{#1}% have only one text
911 \def\righttext{#1}%
912 \fi
913 %
914 \ifodd\pageno
915 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
916 \else
917 \def\temp{\inleftmargin\lefttext}%
918 \fi
919 \temp
920 }
921
922 % @include FILE -- \input text of FILE.
923 %
924 \def\include{\parseargusing\filenamecatcodes\includezzz}
925 \def\includezzz#1{%
926 \pushthisfilestack
927 \def\thisfile{#1}%
928 {%
929 \makevalueexpandable % we want to expand any @value in FILE.
930 \turnoffactive % and allow special characters in the expansion
931 \indexnofonts % Allow `@@' and other weird things in file names.
932 \edef\temp{\noexpand\input #1 }%
933 %
934 % This trickery is to read FILE outside of a group, in case it makes
935 % definitions, etc.
936 \expandafter
937 }\temp
938 \popthisfilestack
939 }
940 \def\filenamecatcodes{%
941 \catcode`\\=\other
942 \catcode`~=\other
943 \catcode`^=\other
944 \catcode`_=\other
945 \catcode`|=\other
946 \catcode`<=\other
947 \catcode`>=\other
948 \catcode`+=\other
949 \catcode`-=\other
950 \catcode`\`=\other
951 \catcode`\'=\other
952 }
953
954 \def\pushthisfilestack{%
955 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
956 }
957 \def\pushthisfilestackX{%
958 \expandafter\pushthisfilestackY\thisfile\StackTerm
959 }
960 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
961 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
962 }
963
964 \def\popthisfilestack{\errthisfilestackempty}
965 \def\errthisfilestackempty{\errmessage{Internal error:
966 the stack of filenames is empty.}}
967
968 \def\thisfile{}
969
970 % @center line
971 % outputs that line, centered.
972 %
973 \parseargdef\center{%
974 \ifhmode
975 \let\next\centerH
976 \else
977 \let\next\centerV
978 \fi
979 \next{\hfil \ignorespaces#1\unskip \hfil}%
980 }
981 \def\centerH#1{%
982 {%
983 \hfil\break
984 \advance\hsize by -\leftskip
985 \advance\hsize by -\rightskip
986 \line{#1}%
987 \break
988 }%
989 }
990 \def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
991
992 % @sp n outputs n lines of vertical space
993
994 \parseargdef\sp{\vskip #1\baselineskip}
995
996 % @comment ...line which is ignored...
997 % @c is the same as @comment
998 % @ignore ... @end ignore is another way to write a comment
999
1000 \def\comment{\begingroup \catcode`\^^M=\other%
1001 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
1002 \commentxxx}
1003 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
1004
1005 \let\c=\comment
1006
1007 % @paragraphindent NCHARS
1008 % We'll use ems for NCHARS, close enough.
1009 % NCHARS can also be the word `asis' or `none'.
1010 % We cannot feasibly implement @paragraphindent asis, though.
1011 %
1012 \def\asisword{asis} % no translation, these are keywords
1013 \def\noneword{none}
1014 %
1015 \parseargdef\paragraphindent{%
1016 \def\temp{#1}%
1017 \ifx\temp\asisword
1018 \else
1019 \ifx\temp\noneword
1020 \defaultparindent = 0pt
1021 \else
1022 \defaultparindent = #1em
1023 \fi
1024 \fi
1025 \parindent = \defaultparindent
1026 }
1027
1028 % @exampleindent NCHARS
1029 % We'll use ems for NCHARS like @paragraphindent.
1030 % It seems @exampleindent asis isn't necessary, but
1031 % I preserve it to make it similar to @paragraphindent.
1032 \parseargdef\exampleindent{%
1033 \def\temp{#1}%
1034 \ifx\temp\asisword
1035 \else
1036 \ifx\temp\noneword
1037 \lispnarrowing = 0pt
1038 \else
1039 \lispnarrowing = #1em
1040 \fi
1041 \fi
1042 }
1043
1044 % @firstparagraphindent WORD
1045 % If WORD is `none', then suppress indentation of the first paragraph
1046 % after a section heading. If WORD is `insert', then do indent at such
1047 % paragraphs.
1048 %
1049 % The paragraph indentation is suppressed or not by calling
1050 % \suppressfirstparagraphindent, which the sectioning commands do.
1051 % We switch the definition of this back and forth according to WORD.
1052 % By default, we suppress indentation.
1053 %
1054 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
1055 \def\insertword{insert}
1056 %
1057 \parseargdef\firstparagraphindent{%
1058 \def\temp{#1}%
1059 \ifx\temp\noneword
1060 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
1061 \else\ifx\temp\insertword
1062 \let\suppressfirstparagraphindent = \relax
1063 \else
1064 \errhelp = \EMsimple
1065 \errmessage{Unknown @firstparagraphindent option `\temp'}%
1066 \fi\fi
1067 }
1068
1069 % Here is how we actually suppress indentation. Redefine \everypar to
1070 % \kern backwards by \parindent, and then reset itself to empty.
1071 %
1072 % We also make \indent itself not actually do anything until the next
1073 % paragraph.
1074 %
1075 \gdef\dosuppressfirstparagraphindent{%
1076 \gdef\indent{%
1077 \restorefirstparagraphindent
1078 \indent
1079 }%
1080 \gdef\noindent{%
1081 \restorefirstparagraphindent
1082 \noindent
1083 }%
1084 \global\everypar = {%
1085 \kern -\parindent
1086 \restorefirstparagraphindent
1087 }%
1088 }
1089
1090 \gdef\restorefirstparagraphindent{%
1091 \global \let \indent = \ptexindent
1092 \global \let \noindent = \ptexnoindent
1093 \global \everypar = {}%
1094 }
1095
1096
1097 % @asis just yields its argument. Used with @table, for example.
1098 %
1099 \def\asis#1{#1}
1100
1101 % @math outputs its argument in math mode.
1102 %
1103 % One complication: _ usually means subscripts, but it could also mean
1104 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
1105 % _ active, and distinguish by seeing if the current family is \slfam,
1106 % which is what @var uses.
1107 {
1108 \catcode`\_ = \active
1109 \gdef\mathunderscore{%
1110 \catcode`\_=\active
1111 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
1112 }
1113 }
1114 % Another complication: we want \\ (and @\) to output a \ character.
1115 % FYI, plain.tex uses \\ as a temporary control sequence (why?), but
1116 % this is not advertised and we don't care. Texinfo does not
1117 % otherwise define @\.
1118 %
1119 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
1120 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
1121 %
1122 \def\math{%
1123 \tex
1124 \mathunderscore
1125 \let\\ = \mathbackslash
1126 \mathactive
1127 % make the texinfo accent commands work in math mode
1128 \let\"=\ddot
1129 \let\'=\acute
1130 \let\==\bar
1131 \let\^=\hat
1132 \let\`=\grave
1133 \let\u=\breve
1134 \let\v=\check
1135 \let\~=\tilde
1136 \let\dotaccent=\dot
1137 $\finishmath
1138 }
1139 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
1140
1141 % Some active characters (such as <) are spaced differently in math.
1142 % We have to reset their definitions in case the @math was an argument
1143 % to a command which sets the catcodes (such as @item or @section).
1144 %
1145 {
1146 \catcode`^ = \active
1147 \catcode`< = \active
1148 \catcode`> = \active
1149 \catcode`+ = \active
1150 \catcode`' = \active
1151 \gdef\mathactive{%
1152 \let^ = \ptexhat
1153 \let< = \ptexless
1154 \let> = \ptexgtr
1155 \let+ = \ptexplus
1156 \let' = \ptexquoteright
1157 }
1158 }
1159
1160 % Some math mode symbols.
1161 \def\bullet{$\ptexbullet$}
1162 \def\geq{\ifmmode \ge\else $\ge$\fi}
1163 \def\leq{\ifmmode \le\else $\le$\fi}
1164 \def\minus{\ifmmode -\else $-$\fi}
1165
1166 % @dots{} outputs an ellipsis using the current font.
1167 % We do .5em per period so that it has the same spacing in the cm
1168 % typewriter fonts as three actual period characters; on the other hand,
1169 % in other typewriter fonts three periods are wider than 1.5em. So do
1170 % whichever is larger.
1171 %
1172 \def\dots{%
1173 \leavevmode
1174 \setbox0=\hbox{...}% get width of three periods
1175 \ifdim\wd0 > 1.5em
1176 \dimen0 = \wd0
1177 \else
1178 \dimen0 = 1.5em
1179 \fi
1180 \hbox to \dimen0{%
1181 \hskip 0pt plus.25fil
1182 .\hskip 0pt plus1fil
1183 .\hskip 0pt plus1fil
1184 .\hskip 0pt plus.5fil
1185 }%
1186 }
1187
1188 % @enddots{} is an end-of-sentence ellipsis.
1189 %
1190 \def\enddots{%
1191 \dots
1192 \spacefactor=\endofsentencespacefactor
1193 }
1194
1195 % @comma{} is so commas can be inserted into text without messing up
1196 % Texinfo's parsing.
1197 %
1198 \let\comma = ,
1199
1200 % @refill is a no-op.
1201 \let\refill=\relax
1202
1203 % If working on a large document in chapters, it is convenient to
1204 % be able to disable indexing, cross-referencing, and contents, for test runs.
1205 % This is done with @novalidate (before @setfilename).
1206 %
1207 \newif\iflinks \linkstrue % by default we want the aux files.
1208 \let\novalidate = \linksfalse
1209
1210 % @setfilename is done at the beginning of every texinfo file.
1211 % So open here the files we need to have open while reading the input.
1212 % This makes it possible to make a .fmt file for texinfo.
1213 \def\setfilename{%
1214 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1215 \iflinks
1216 \tryauxfile
1217 % Open the new aux file. TeX will close it automatically at exit.
1218 \immediate\openout\auxfile=\jobname.aux
1219 \fi % \openindices needs to do some work in any case.
1220 \openindices
1221 \let\setfilename=\comment % Ignore extra @setfilename cmds.
1222 %
1223 % If texinfo.cnf is present on the system, read it.
1224 % Useful for site-wide @afourpaper, etc.
1225 \openin 1 texinfo.cnf
1226 \ifeof 1 \else \input texinfo.cnf \fi
1227 \closein 1
1228 %
1229 \comment % Ignore the actual filename.
1230 }
1231
1232 % Called from \setfilename.
1233 %
1234 \def\openindices{%
1235 \newindex{cp}%
1236 \newcodeindex{fn}%
1237 \newcodeindex{vr}%
1238 \newcodeindex{tp}%
1239 \newcodeindex{ky}%
1240 \newcodeindex{pg}%
1241 }
1242
1243 % @bye.
1244 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1245
1246
1247 \message{pdf,}
1248 % adobe `portable' document format
1249 \newcount\tempnum
1250 \newcount\lnkcount
1251 \newtoks\filename
1252 \newcount\filenamelength
1253 \newcount\pgn
1254 \newtoks\toksA
1255 \newtoks\toksB
1256 \newtoks\toksC
1257 \newtoks\toksD
1258 \newbox\boxA
1259 \newcount\countA
1260 \newif\ifpdf
1261 \newif\ifpdfmakepagedest
1262
1263 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1264 % can be set). So we test for \relax and 0 as well as \undefined,
1265 % borrowed from ifpdf.sty.
1266 \ifx\pdfoutput\undefined
1267 \else
1268 \ifx\pdfoutput\relax
1269 \else
1270 \ifcase\pdfoutput
1271 \else
1272 \pdftrue
1273 \fi
1274 \fi
1275 \fi
1276
1277 % PDF uses PostScript string constants for the names of xref targets,
1278 % for display in the outlines, and in other places. Thus, we have to
1279 % double any backslashes. Otherwise, a name like "\node" will be
1280 % interpreted as a newline (\n), followed by o, d, e. Not good.
1281 % http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
1282 % (and related messages, the final outcome is that it is up to the TeX
1283 % user to double the backslashes and otherwise make the string valid, so
1284 % that's what we do).
1285
1286 % double active backslashes.
1287 %
1288 {\catcode`\@=0 \catcode`\\=\active
1289 @gdef@activebackslashdouble{%
1290 @catcode`@\=@active
1291 @let\=@doublebackslash}
1292 }
1293
1294 % To handle parens, we must adopt a different approach, since parens are
1295 % not active characters. hyperref.dtx (which has the same problem as
1296 % us) handles it with this amazing macro to replace tokens, with minor
1297 % changes for Texinfo. It is included here under the GPL by permission
1298 % from the author, Heiko Oberdiek.
1299 %
1300 % #1 is the tokens to replace.
1301 % #2 is the replacement.
1302 % #3 is the control sequence with the string.
1303 %
1304 \def\HyPsdSubst#1#2#3{%
1305 \def\HyPsdReplace##1#1##2\END{%
1306 ##1%
1307 \ifx\\##2\\%
1308 \else
1309 #2%
1310 \HyReturnAfterFi{%
1311 \HyPsdReplace##2\END
1312 }%
1313 \fi
1314 }%
1315 \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
1316 }
1317 \long\def\HyReturnAfterFi#1\fi{\fi#1}
1318
1319 % #1 is a control sequence in which to do the replacements.
1320 \def\backslashparens#1{%
1321 \xdef#1{#1}% redefine it as its expansion; the definition is simply
1322 % \lastnode when called from \setref -> \pdfmkdest.
1323 \HyPsdSubst{(}{\realbackslash(}{#1}%
1324 \HyPsdSubst{)}{\realbackslash)}{#1}%
1325 }
1326
1327 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1328 with PDF output, and none of those formats could be found. (.eps cannot
1329 be supported due to the design of the PDF format; use regular TeX (DVI
1330 output) for that.)}
1331
1332 \ifpdf
1333 %
1334 % Color manipulation macros based on pdfcolor.tex.
1335 \def\cmykDarkRed{0.28 1 1 0.35}
1336 \def\cmykBlack{0 0 0 1}
1337 %
1338 \def\pdfsetcolor#1{\pdfliteral{#1 k}}
1339 % Set color, and create a mark which defines \thiscolor accordingly,
1340 % so that \makeheadline knows which color to restore.
1341 \def\setcolor#1{%
1342 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1343 \domark
1344 \pdfsetcolor{#1}%
1345 }
1346 %
1347 \def\maincolor{\cmykBlack}
1348 \pdfsetcolor{\maincolor}
1349 \edef\thiscolor{\maincolor}
1350 \def\lastcolordefs{}
1351 %
1352 \def\makefootline{%
1353 \baselineskip24pt
1354 \line{\pdfsetcolor{\maincolor}\the\footline}%
1355 }
1356 %
1357 \def\makeheadline{%
1358 \vbox to 0pt{%
1359 \vskip-22.5pt
1360 \line{%
1361 \vbox to8.5pt{}%
1362 % Extract \thiscolor definition from the marks.
1363 \getcolormarks
1364 % Typeset the headline with \maincolor, then restore the color.
1365 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1366 }%
1367 \vss
1368 }%
1369 \nointerlineskip
1370 }
1371 %
1372 %
1373 \pdfcatalog{/PageMode /UseOutlines}
1374 %
1375 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1376 \def\dopdfimage#1#2#3{%
1377 \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1378 \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1379 %
1380 % pdftex (and the PDF format) support .png, .jpg, .pdf (among
1381 % others). Let's try in that order.
1382 \let\pdfimgext=\empty
1383 \begingroup
1384 \openin 1 #1.png \ifeof 1
1385 \openin 1 #1.jpg \ifeof 1
1386 \openin 1 #1.jpeg \ifeof 1
1387 \openin 1 #1.JPG \ifeof 1
1388 \openin 1 #1.pdf \ifeof 1
1389 \openin 1 #1.PDF \ifeof 1
1390 \errhelp = \nopdfimagehelp
1391 \errmessage{Could not find image file #1 for pdf}%
1392 \else \gdef\pdfimgext{PDF}%
1393 \fi
1394 \else \gdef\pdfimgext{pdf}%
1395 \fi
1396 \else \gdef\pdfimgext{JPG}%
1397 \fi
1398 \else \gdef\pdfimgext{jpeg}%
1399 \fi
1400 \else \gdef\pdfimgext{jpg}%
1401 \fi
1402 \else \gdef\pdfimgext{png}%
1403 \fi
1404 \closein 1
1405 \endgroup
1406 %
1407 % without \immediate, ancient pdftex seg faults when the same image is
1408 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1409 \ifnum\pdftexversion < 14
1410 \immediate\pdfimage
1411 \else
1412 \immediate\pdfximage
1413 \fi
1414 \ifdim \wd0 >0pt width \imagewidth \fi
1415 \ifdim \wd2 >0pt height \imageheight \fi
1416 \ifnum\pdftexversion<13
1417 #1.\pdfimgext
1418 \else
1419 {#1.\pdfimgext}%
1420 \fi
1421 \ifnum\pdftexversion < 14 \else
1422 \pdfrefximage \pdflastximage
1423 \fi}
1424 %
1425 \def\pdfmkdest#1{{%
1426 % We have to set dummies so commands such as @code, and characters
1427 % such as \, aren't expanded when present in a section title.
1428 \indexnofonts
1429 \turnoffactive
1430 \activebackslashdouble
1431 \makevalueexpandable
1432 \def\pdfdestname{#1}%
1433 \backslashparens\pdfdestname
1434 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1435 }}
1436 %
1437 % used to mark target names; must be expandable.
1438 \def\pdfmkpgn#1{#1}
1439 %
1440 % by default, use a color that is dark enough to print on paper as
1441 % nearly black, but still distinguishable for online viewing.
1442 \def\urlcolor{\cmykDarkRed}
1443 \def\linkcolor{\cmykDarkRed}
1444 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1445 %
1446 % Adding outlines to PDF; macros for calculating structure of outlines
1447 % come from Petr Olsak
1448 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1449 \else \csname#1\endcsname \fi}
1450 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1451 \advance\tempnum by 1
1452 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1453 %
1454 % #1 is the section text, which is what will be displayed in the
1455 % outline by the pdf viewer. #2 is the pdf expression for the number
1456 % of subentries (or empty, for subsubsections). #3 is the node text,
1457 % which might be empty if this toc entry had no corresponding node.
1458 % #4 is the page number
1459 %
1460 \def\dopdfoutline#1#2#3#4{%
1461 % Generate a link to the node text if that exists; else, use the
1462 % page number. We could generate a destination for the section
1463 % text in the case where a section has no node, but it doesn't
1464 % seem worth the trouble, since most documents are normally structured.
1465 \def\pdfoutlinedest{#3}%
1466 \ifx\pdfoutlinedest\empty
1467 \def\pdfoutlinedest{#4}%
1468 \else
1469 % Doubled backslashes in the name.
1470 {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
1471 \backslashparens\pdfoutlinedest}%
1472 \fi
1473 %
1474 % Also double the backslashes in the display string.
1475 {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
1476 \backslashparens\pdfoutlinetext}%
1477 %
1478 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1479 }
1480 %
1481 \def\pdfmakeoutlines{%
1482 \begingroup
1483 % Thanh's hack / proper braces in bookmarks
1484 \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
1485 \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
1486 %
1487 % Read toc silently, to get counts of subentries for \pdfoutline.
1488 \def\numchapentry##1##2##3##4{%
1489 \def\thischapnum{##2}%
1490 \def\thissecnum{0}%
1491 \def\thissubsecnum{0}%
1492 }%
1493 \def\numsecentry##1##2##3##4{%
1494 \advancenumber{chap\thischapnum}%
1495 \def\thissecnum{##2}%
1496 \def\thissubsecnum{0}%
1497 }%
1498 \def\numsubsecentry##1##2##3##4{%
1499 \advancenumber{sec\thissecnum}%
1500 \def\thissubsecnum{##2}%
1501 }%
1502 \def\numsubsubsecentry##1##2##3##4{%
1503 \advancenumber{subsec\thissubsecnum}%
1504 }%
1505 \def\thischapnum{0}%
1506 \def\thissecnum{0}%
1507 \def\thissubsecnum{0}%
1508 %
1509 % use \def rather than \let here because we redefine \chapentry et
1510 % al. a second time, below.
1511 \def\appentry{\numchapentry}%
1512 \def\appsecentry{\numsecentry}%
1513 \def\appsubsecentry{\numsubsecentry}%
1514 \def\appsubsubsecentry{\numsubsubsecentry}%
1515 \def\unnchapentry{\numchapentry}%
1516 \def\unnsecentry{\numsecentry}%
1517 \def\unnsubsecentry{\numsubsecentry}%
1518 \def\unnsubsubsecentry{\numsubsubsecentry}%
1519 \readdatafile{toc}%
1520 %
1521 % Read toc second time, this time actually producing the outlines.
1522 % The `-' means take the \expnumber as the absolute number of
1523 % subentries, which we calculated on our first read of the .toc above.
1524 %
1525 % We use the node names as the destinations.
1526 \def\numchapentry##1##2##3##4{%
1527 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1528 \def\numsecentry##1##2##3##4{%
1529 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1530 \def\numsubsecentry##1##2##3##4{%
1531 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1532 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1533 \dopdfoutline{##1}{}{##3}{##4}}%
1534 %
1535 % PDF outlines are displayed using system fonts, instead of
1536 % document fonts. Therefore we cannot use special characters,
1537 % since the encoding is unknown. For example, the eogonek from
1538 % Latin 2 (0xea) gets translated to a | character. Info from
1539 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1540 %
1541 % xx to do this right, we have to translate 8-bit characters to
1542 % their "best" equivalent, based on the @documentencoding. Right
1543 % now, I guess we'll just let the pdf reader have its way.
1544 \indexnofonts
1545 \setupdatafile
1546 \catcode`\\=\active \otherbackslash
1547 \input \tocreadfilename
1548 \endgroup
1549 }
1550 %
1551 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1552 \ifx\PP\D\let\nextsp\relax
1553 \else\let\nextsp\skipspaces
1554 \ifx\p\space\else\addtokens{\filename}{\PP}%
1555 \advance\filenamelength by 1
1556 \fi
1557 \fi
1558 \nextsp}
1559 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1560 \ifnum\pdftexversion < 14
1561 \let \startlink \pdfannotlink
1562 \else
1563 \let \startlink \pdfstartlink
1564 \fi
1565 % make a live url in pdf output.
1566 \def\pdfurl#1{%
1567 \begingroup
1568 % it seems we really need yet another set of dummies; have not
1569 % tried to figure out what each command should do in the context
1570 % of @url. for now, just make @/ a no-op, that's the only one
1571 % people have actually reported a problem with.
1572 %
1573 \normalturnoffactive
1574 \def\@{@}%
1575 \let\/=\empty
1576 \makevalueexpandable
1577 \leavevmode\setcolor{\urlcolor}%
1578 \startlink attr{/Border [0 0 0]}%
1579 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1580 \endgroup}
1581 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1582 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1583 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1584 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1585 \def\maketoks{%
1586 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1587 \ifx\first0\adn0
1588 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1589 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1590 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1591 \else
1592 \ifnum0=\countA\else\makelink\fi
1593 \ifx\first.\let\next=\done\else
1594 \let\next=\maketoks
1595 \addtokens{\toksB}{\the\toksD}
1596 \ifx\first,\addtokens{\toksB}{\space}\fi
1597 \fi
1598 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1599 \next}
1600 \def\makelink{\addtokens{\toksB}%
1601 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1602 \def\pdflink#1{%
1603 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1604 \setcolor{\linkcolor}#1\endlink}
1605 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1606 \else
1607 % non-pdf mode
1608 \let\pdfmkdest = \gobble
1609 \let\pdfurl = \gobble
1610 \let\endlink = \relax
1611 \let\setcolor = \gobble
1612 \let\pdfsetcolor = \gobble
1613 \let\pdfmakeoutlines = \relax
1614 \fi % \ifx\pdfoutput
1615
1616
1617 \message{fonts,}
1618
1619 % Change the current font style to #1, remembering it in \curfontstyle.
1620 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1621 % italics, not bold italics.
1622 %
1623 \def\setfontstyle#1{%
1624 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1625 \csname ten#1\endcsname % change the current font
1626 }
1627
1628 % Select #1 fonts with the current style.
1629 %
1630 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1631
1632 \def\rm{\fam=0 \setfontstyle{rm}}
1633 \def\it{\fam=\itfam \setfontstyle{it}}
1634 \def\sl{\fam=\slfam \setfontstyle{sl}}
1635 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1636 \def\tt{\fam=\ttfam \setfontstyle{tt}}
1637
1638 % Unfortunately, we have to override this for titles and the like, since
1639 % in those cases "rm" is bold. Sigh.
1640 \def\rmisbold{\rm\def\curfontstyle{bf}}
1641
1642 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1643 % So we set up a \sf.
1644 \newfam\sffam
1645 \def\sf{\fam=\sffam \setfontstyle{sf}}
1646 \let\li = \sf % Sometimes we call it \li, not \sf.
1647
1648 % We don't need math for this font style.
1649 \def\ttsl{\setfontstyle{ttsl}}
1650
1651
1652 % Default leading.
1653 \newdimen\textleading \textleading = 13.2pt
1654
1655 % Set the baselineskip to #1, and the lineskip and strut size
1656 % correspondingly. There is no deep meaning behind these magic numbers
1657 % used as factors; they just match (closely enough) what Knuth defined.
1658 %
1659 \def\lineskipfactor{.08333}
1660 \def\strutheightpercent{.70833}
1661 \def\strutdepthpercent {.29167}
1662 %
1663 % can get a sort of poor man's double spacing by redefining this.
1664 \def\baselinefactor{1}
1665 %
1666 \def\setleading#1{%
1667 \dimen0 = #1\relax
1668 \normalbaselineskip = \baselinefactor\dimen0
1669 \normallineskip = \lineskipfactor\normalbaselineskip
1670 \normalbaselines
1671 \setbox\strutbox =\hbox{%
1672 \vrule width0pt height\strutheightpercent\baselineskip
1673 depth \strutdepthpercent \baselineskip
1674 }%
1675 }
1676
1677 % PDF CMaps. See also LaTeX's t1.cmap.
1678 %
1679 % do nothing with this by default.
1680 \expandafter\let\csname cmapOT1\endcsname\gobble
1681 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1682 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1683
1684 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1685 % (\pdffontattr was introduced many years ago, but people still run
1686 % older pdftex's; it's easy to conditionalize, so we do.)
1687 \ifpdf \ifx\pdffontattr\undefined \else
1688 \begingroup
1689 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1690 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1691 %%DocumentNeededResources: ProcSet (CIDInit)
1692 %%IncludeResource: ProcSet (CIDInit)
1693 %%BeginResource: CMap (TeX-OT1-0)
1694 %%Title: (TeX-OT1-0 TeX OT1 0)
1695 %%Version: 1.000
1696 %%EndComments
1697 /CIDInit /ProcSet findresource begin
1698 12 dict begin
1699 begincmap
1700 /CIDSystemInfo
1701 << /Registry (TeX)
1702 /Ordering (OT1)
1703 /Supplement 0
1704 >> def
1705 /CMapName /TeX-OT1-0 def
1706 /CMapType 2 def
1707 1 begincodespacerange
1708 <00> <7F>
1709 endcodespacerange
1710 8 beginbfrange
1711 <00> <01> <0393>
1712 <09> <0A> <03A8>
1713 <23> <26> <0023>
1714 <28> <3B> <0028>
1715 <3F> <5B> <003F>
1716 <5D> <5E> <005D>
1717 <61> <7A> <0061>
1718 <7B> <7C> <2013>
1719 endbfrange
1720 40 beginbfchar
1721 <02> <0398>
1722 <03> <039B>
1723 <04> <039E>
1724 <05> <03A0>
1725 <06> <03A3>
1726 <07> <03D2>
1727 <08> <03A6>
1728 <0B> <00660066>
1729 <0C> <00660069>
1730 <0D> <0066006C>
1731 <0E> <006600660069>
1732 <0F> <00660066006C>
1733 <10> <0131>
1734 <11> <0237>
1735 <12> <0060>
1736 <13> <00B4>
1737 <14> <02C7>
1738 <15> <02D8>
1739 <16> <00AF>
1740 <17> <02DA>
1741 <18> <00B8>
1742 <19> <00DF>
1743 <1A> <00E6>
1744 <1B> <0153>
1745 <1C> <00F8>
1746 <1D> <00C6>
1747 <1E> <0152>
1748 <1F> <00D8>
1749 <21> <0021>
1750 <22> <201D>
1751 <27> <2019>
1752 <3C> <00A1>
1753 <3D> <003D>
1754 <3E> <00BF>
1755 <5C> <201C>
1756 <5F> <02D9>
1757 <60> <2018>
1758 <7D> <02DD>
1759 <7E> <007E>
1760 <7F> <00A8>
1761 endbfchar
1762 endcmap
1763 CMapName currentdict /CMap defineresource pop
1764 end
1765 end
1766 %%EndResource
1767 %%EOF
1768 }\endgroup
1769 \expandafter\edef\csname cmapOT1\endcsname#1{%
1770 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1771 }%
1772 %
1773 % \cmapOT1IT
1774 \begingroup
1775 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1776 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1777 %%DocumentNeededResources: ProcSet (CIDInit)
1778 %%IncludeResource: ProcSet (CIDInit)
1779 %%BeginResource: CMap (TeX-OT1IT-0)
1780 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1781 %%Version: 1.000
1782 %%EndComments
1783 /CIDInit /ProcSet findresource begin
1784 12 dict begin
1785 begincmap
1786 /CIDSystemInfo
1787 << /Registry (TeX)
1788 /Ordering (OT1IT)
1789 /Supplement 0
1790 >> def
1791 /CMapName /TeX-OT1IT-0 def
1792 /CMapType 2 def
1793 1 begincodespacerange
1794 <00> <7F>
1795 endcodespacerange
1796 8 beginbfrange
1797 <00> <01> <0393>
1798 <09> <0A> <03A8>
1799 <25> <26> <0025>
1800 <28> <3B> <0028>
1801 <3F> <5B> <003F>
1802 <5D> <5E> <005D>
1803 <61> <7A> <0061>
1804 <7B> <7C> <2013>
1805 endbfrange
1806 42 beginbfchar
1807 <02> <0398>
1808 <03> <039B>
1809 <04> <039E>
1810 <05> <03A0>
1811 <06> <03A3>
1812 <07> <03D2>
1813 <08> <03A6>
1814 <0B> <00660066>
1815 <0C> <00660069>
1816 <0D> <0066006C>
1817 <0E> <006600660069>
1818 <0F> <00660066006C>
1819 <10> <0131>
1820 <11> <0237>
1821 <12> <0060>
1822 <13> <00B4>
1823 <14> <02C7>
1824 <15> <02D8>
1825 <16> <00AF>
1826 <17> <02DA>
1827 <18> <00B8>
1828 <19> <00DF>
1829 <1A> <00E6>
1830 <1B> <0153>
1831 <1C> <00F8>
1832 <1D> <00C6>
1833 <1E> <0152>
1834 <1F> <00D8>
1835 <21> <0021>
1836 <22> <201D>
1837 <23> <0023>
1838 <24> <00A3>
1839 <27> <2019>
1840 <3C> <00A1>
1841 <3D> <003D>
1842 <3E> <00BF>
1843 <5C> <201C>
1844 <5F> <02D9>
1845 <60> <2018>
1846 <7D> <02DD>
1847 <7E> <007E>
1848 <7F> <00A8>
1849 endbfchar
1850 endcmap
1851 CMapName currentdict /CMap defineresource pop
1852 end
1853 end
1854 %%EndResource
1855 %%EOF
1856 }\endgroup
1857 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1858 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1859 }%
1860 %
1861 % \cmapOT1TT
1862 \begingroup
1863 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1864 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1865 %%DocumentNeededResources: ProcSet (CIDInit)
1866 %%IncludeResource: ProcSet (CIDInit)
1867 %%BeginResource: CMap (TeX-OT1TT-0)
1868 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1869 %%Version: 1.000
1870 %%EndComments
1871 /CIDInit /ProcSet findresource begin
1872 12 dict begin
1873 begincmap
1874 /CIDSystemInfo
1875 << /Registry (TeX)
1876 /Ordering (OT1TT)
1877 /Supplement 0
1878 >> def
1879 /CMapName /TeX-OT1TT-0 def
1880 /CMapType 2 def
1881 1 begincodespacerange
1882 <00> <7F>
1883 endcodespacerange
1884 5 beginbfrange
1885 <00> <01> <0393>
1886 <09> <0A> <03A8>
1887 <21> <26> <0021>
1888 <28> <5F> <0028>
1889 <61> <7E> <0061>
1890 endbfrange
1891 32 beginbfchar
1892 <02> <0398>
1893 <03> <039B>
1894 <04> <039E>
1895 <05> <03A0>
1896 <06> <03A3>
1897 <07> <03D2>
1898 <08> <03A6>
1899 <0B> <2191>
1900 <0C> <2193>
1901 <0D> <0027>
1902 <0E> <00A1>
1903 <0F> <00BF>
1904 <10> <0131>
1905 <11> <0237>
1906 <12> <0060>
1907 <13> <00B4>
1908 <14> <02C7>
1909 <15> <02D8>
1910 <16> <00AF>
1911 <17> <02DA>
1912 <18> <00B8>
1913 <19> <00DF>
1914 <1A> <00E6>
1915 <1B> <0153>
1916 <1C> <00F8>
1917 <1D> <00C6>
1918 <1E> <0152>
1919 <1F> <00D8>
1920 <20> <2423>
1921 <27> <2019>
1922 <60> <2018>
1923 <7F> <00A8>
1924 endbfchar
1925 endcmap
1926 CMapName currentdict /CMap defineresource pop
1927 end
1928 end
1929 %%EndResource
1930 %%EOF
1931 }\endgroup
1932 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1933 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1934 }%
1935 \fi\fi
1936
1937
1938 % Set the font macro #1 to the font named #2, adding on the
1939 % specified font prefix (normally `cm').
1940 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1941 % encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
1942 % empty to omit).
1943 \def\setfont#1#2#3#4#5{%
1944 \font#1=\fontprefix#2#3 scaled #4
1945 \csname cmap#5\endcsname#1%
1946 }
1947 % This is what gets called when #5 of \setfont is empty.
1948 \let\cmap\gobble
1949 % emacs-page end of cmaps
1950
1951 % Use cm as the default font prefix.
1952 % To specify the font prefix, you must define \fontprefix
1953 % before you read in texinfo.tex.
1954 \ifx\fontprefix\undefined
1955 \def\fontprefix{cm}
1956 \fi
1957 % Support font families that don't use the same naming scheme as CM.
1958 \def\rmshape{r}
1959 \def\rmbshape{bx} %where the normal face is bold
1960 \def\bfshape{b}
1961 \def\bxshape{bx}
1962 \def\ttshape{tt}
1963 \def\ttbshape{tt}
1964 \def\ttslshape{sltt}
1965 \def\itshape{ti}
1966 \def\itbshape{bxti}
1967 \def\slshape{sl}
1968 \def\slbshape{bxsl}
1969 \def\sfshape{ss}
1970 \def\sfbshape{ss}
1971 \def\scshape{csc}
1972 \def\scbshape{csc}
1973
1974 % Definitions for a main text size of 11pt. This is the default in
1975 % Texinfo.
1976 %
1977 \def\definetextfontsizexi{%
1978 % Text fonts (11.2pt, magstep1).
1979 \def\textnominalsize{11pt}
1980 \edef\mainmagstep{\magstephalf}
1981 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1982 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1983 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1984 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1985 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1986 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1987 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1988 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1989 \font\texti=cmmi10 scaled \mainmagstep
1990 \font\textsy=cmsy10 scaled \mainmagstep
1991 \def\textecsize{1095}
1992
1993 % A few fonts for @defun names and args.
1994 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
1995 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1996 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1997 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1998
1999 % Fonts for indices, footnotes, small examples (9pt).
2000 \def\smallnominalsize{9pt}
2001 \setfont\smallrm\rmshape{9}{1000}{OT1}
2002 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2003 \setfont\smallbf\bfshape{10}{900}{OT1}
2004 \setfont\smallit\itshape{9}{1000}{OT1IT}
2005 \setfont\smallsl\slshape{9}{1000}{OT1}
2006 \setfont\smallsf\sfshape{9}{1000}{OT1}
2007 \setfont\smallsc\scshape{10}{900}{OT1}
2008 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2009 \font\smalli=cmmi9
2010 \font\smallsy=cmsy9
2011 \def\smallecsize{0900}
2012
2013 % Fonts for small examples (8pt).
2014 \def\smallernominalsize{8pt}
2015 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2016 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2017 \setfont\smallerbf\bfshape{10}{800}{OT1}
2018 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2019 \setfont\smallersl\slshape{8}{1000}{OT1}
2020 \setfont\smallersf\sfshape{8}{1000}{OT1}
2021 \setfont\smallersc\scshape{10}{800}{OT1}
2022 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2023 \font\smalleri=cmmi8
2024 \font\smallersy=cmsy8
2025 \def\smallerecsize{0800}
2026
2027 % Fonts for title page (20.4pt):
2028 \def\titlenominalsize{20pt}
2029 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2030 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2031 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2032 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2033 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2034 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2035 \let\titlebf=\titlerm
2036 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2037 \font\titlei=cmmi12 scaled \magstep3
2038 \font\titlesy=cmsy10 scaled \magstep4
2039 \def\titleecsize{2074}
2040
2041 % Chapter (and unnumbered) fonts (17.28pt).
2042 \def\chapnominalsize{17pt}
2043 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2044 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2045 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2046 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2047 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2048 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2049 \let\chapbf=\chaprm
2050 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2051 \font\chapi=cmmi12 scaled \magstep2
2052 \font\chapsy=cmsy10 scaled \magstep3
2053 \def\chapecsize{1728}
2054
2055 % Section fonts (14.4pt).
2056 \def\secnominalsize{14pt}
2057 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2058 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2059 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2060 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2061 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2062 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2063 \let\secbf\secrm
2064 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2065 \font\seci=cmmi12 scaled \magstep1
2066 \font\secsy=cmsy10 scaled \magstep2
2067 \def\sececsize{1440}
2068
2069 % Subsection fonts (13.15pt).
2070 \def\ssecnominalsize{13pt}
2071 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2072 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2073 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2074 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2075 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2076 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2077 \let\ssecbf\ssecrm
2078 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2079 \font\sseci=cmmi12 scaled \magstephalf
2080 \font\ssecsy=cmsy10 scaled 1315
2081 \def\ssececsize{1200}
2082
2083 % Reduced fonts for @acro in text (10pt).
2084 \def\reducednominalsize{10pt}
2085 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2086 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2087 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2088 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2089 \setfont\reducedsl\slshape{10}{1000}{OT1}
2090 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2091 \setfont\reducedsc\scshape{10}{1000}{OT1}
2092 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2093 \font\reducedi=cmmi10
2094 \font\reducedsy=cmsy10
2095 \def\reducedecsize{1000}
2096
2097 % reset the current fonts
2098 \textfonts
2099 \rm
2100 } % end of 11pt text font size definitions
2101
2102
2103 % Definitions to make the main text be 10pt Computer Modern, with
2104 % section, chapter, etc., sizes following suit. This is for the GNU
2105 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2106 % future. Used with @smallbook, which sets the leading to 12pt.
2107 %
2108 \def\definetextfontsizex{%
2109 % Text fonts (10pt).
2110 \def\textnominalsize{10pt}
2111 \edef\mainmagstep{1000}
2112 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2113 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2114 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2115 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2116 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2117 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2118 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2119 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2120 \font\texti=cmmi10 scaled \mainmagstep
2121 \font\textsy=cmsy10 scaled \mainmagstep
2122 \def\textecsize{1000}
2123
2124 % A few fonts for @defun names and args.
2125 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2126 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2127 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2128 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
2129
2130 % Fonts for indices, footnotes, small examples (9pt).
2131 \def\smallnominalsize{9pt}
2132 \setfont\smallrm\rmshape{9}{1000}{OT1}
2133 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2134 \setfont\smallbf\bfshape{10}{900}{OT1}
2135 \setfont\smallit\itshape{9}{1000}{OT1IT}
2136 \setfont\smallsl\slshape{9}{1000}{OT1}
2137 \setfont\smallsf\sfshape{9}{1000}{OT1}
2138 \setfont\smallsc\scshape{10}{900}{OT1}
2139 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2140 \font\smalli=cmmi9
2141 \font\smallsy=cmsy9
2142 \def\smallecsize{0900}
2143
2144 % Fonts for small examples (8pt).
2145 \def\smallernominalsize{8pt}
2146 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2147 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2148 \setfont\smallerbf\bfshape{10}{800}{OT1}
2149 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2150 \setfont\smallersl\slshape{8}{1000}{OT1}
2151 \setfont\smallersf\sfshape{8}{1000}{OT1}
2152 \setfont\smallersc\scshape{10}{800}{OT1}
2153 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2154 \font\smalleri=cmmi8
2155 \font\smallersy=cmsy8
2156 \def\smallerecsize{0800}
2157
2158 % Fonts for title page (20.4pt):
2159 \def\titlenominalsize{20pt}
2160 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2161 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2162 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2163 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2164 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2165 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2166 \let\titlebf=\titlerm
2167 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2168 \font\titlei=cmmi12 scaled \magstep3
2169 \font\titlesy=cmsy10 scaled \magstep4
2170 \def\titleecsize{2074}
2171
2172 % Chapter fonts (14.4pt).
2173 \def\chapnominalsize{14pt}
2174 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2175 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2176 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2177 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2178 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2179 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2180 \let\chapbf\chaprm
2181 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2182 \font\chapi=cmmi12 scaled \magstep1
2183 \font\chapsy=cmsy10 scaled \magstep2
2184 \def\chapecsize{1440}
2185
2186 % Section fonts (12pt).
2187 \def\secnominalsize{12pt}
2188 \setfont\secrm\rmbshape{12}{1000}{OT1}
2189 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2190 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2191 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2192 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2193 \setfont\secsf\sfbshape{12}{1000}{OT1}
2194 \let\secbf\secrm
2195 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2196 \font\seci=cmmi12
2197 \font\secsy=cmsy10 scaled \magstep1
2198 \def\sececsize{1200}
2199
2200 % Subsection fonts (10pt).
2201 \def\ssecnominalsize{10pt}
2202 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2203 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2204 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2205 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2206 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2207 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2208 \let\ssecbf\ssecrm
2209 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2210 \font\sseci=cmmi10
2211 \font\ssecsy=cmsy10
2212 \def\ssececsize{1000}
2213
2214 % Reduced fonts for @acro in text (9pt).
2215 \def\reducednominalsize{9pt}
2216 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2217 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2218 \setfont\reducedbf\bfshape{10}{900}{OT1}
2219 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2220 \setfont\reducedsl\slshape{9}{1000}{OT1}
2221 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2222 \setfont\reducedsc\scshape{10}{900}{OT1}
2223 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2224 \font\reducedi=cmmi9
2225 \font\reducedsy=cmsy9
2226 \def\reducedecsize{0900}
2227
2228 % reduce space between paragraphs
2229 \divide\parskip by 2
2230
2231 % reset the current fonts
2232 \textfonts
2233 \rm
2234 } % end of 10pt text font size definitions
2235
2236
2237 % We provide the user-level command
2238 % @fonttextsize 10
2239 % (or 11) to redefine the text font size. pt is assumed.
2240 %
2241 \def\xword{10}
2242 \def\xiword{11}
2243 %
2244 \parseargdef\fonttextsize{%
2245 \def\textsizearg{#1}%
2246 \wlog{doing @fonttextsize \textsizearg}%
2247 %
2248 % Set \globaldefs so that documents can use this inside @tex, since
2249 % makeinfo 4.8 does not support it, but we need it nonetheless.
2250 %
2251 \begingroup \globaldefs=1
2252 \ifx\textsizearg\xword \definetextfontsizex
2253 \else \ifx\textsizearg\xiword \definetextfontsizexi
2254 \else
2255 \errhelp=\EMsimple
2256 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2257 \fi\fi
2258 \endgroup
2259 }
2260
2261
2262 % In order for the font changes to affect most math symbols and letters,
2263 % we have to define the \textfont of the standard families. Since
2264 % texinfo doesn't allow for producing subscripts and superscripts except
2265 % in the main text, we don't bother to reset \scriptfont and
2266 % \scriptscriptfont (which would also require loading a lot more fonts).
2267 %
2268 \def\resetmathfonts{%
2269 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2270 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2271 \textfont\ttfam=\tentt \textfont\sffam=\tensf
2272 }
2273
2274 % The font-changing commands redefine the meanings of \tenSTYLE, instead
2275 % of just \STYLE. We do this because \STYLE needs to also set the
2276 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2277 % \tenSTYLE to set the current font.
2278 %
2279 % Each font-changing command also sets the names \lsize (one size lower)
2280 % and \lllsize (three sizes lower). These relative commands are used in
2281 % the LaTeX logo and acronyms.
2282 %
2283 % This all needs generalizing, badly.
2284 %
2285 \def\textfonts{%
2286 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2287 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2288 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2289 \let\tenttsl=\textttsl
2290 \def\curfontsize{text}%
2291 \def\lsize{reduced}\def\lllsize{smaller}%
2292 \resetmathfonts \setleading{\textleading}}
2293 \def\titlefonts{%
2294 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2295 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2296 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2297 \let\tenttsl=\titlettsl
2298 \def\curfontsize{title}%
2299 \def\lsize{chap}\def\lllsize{subsec}%
2300 \resetmathfonts \setleading{25pt}}
2301 \def\titlefont#1{{\titlefonts\rmisbold #1}}
2302 \def\chapfonts{%
2303 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2304 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2305 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2306 \let\tenttsl=\chapttsl
2307 \def\curfontsize{chap}%
2308 \def\lsize{sec}\def\lllsize{text}%
2309 \resetmathfonts \setleading{19pt}}
2310 \def\secfonts{%
2311 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2312 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2313 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2314 \let\tenttsl=\secttsl
2315 \def\curfontsize{sec}%
2316 \def\lsize{subsec}\def\lllsize{reduced}%
2317 \resetmathfonts \setleading{16pt}}
2318 \def\subsecfonts{%
2319 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2320 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2321 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2322 \let\tenttsl=\ssecttsl
2323 \def\curfontsize{ssec}%
2324 \def\lsize{text}\def\lllsize{small}%
2325 \resetmathfonts \setleading{15pt}}
2326 \let\subsubsecfonts = \subsecfonts
2327 \def\reducedfonts{%
2328 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2329 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2330 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2331 \let\tenttsl=\reducedttsl
2332 \def\curfontsize{reduced}%
2333 \def\lsize{small}\def\lllsize{smaller}%
2334 \resetmathfonts \setleading{10.5pt}}
2335 \def\smallfonts{%
2336 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2337 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2338 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2339 \let\tenttsl=\smallttsl
2340 \def\curfontsize{small}%
2341 \def\lsize{smaller}\def\lllsize{smaller}%
2342 \resetmathfonts \setleading{10.5pt}}
2343 \def\smallerfonts{%
2344 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2345 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2346 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2347 \let\tenttsl=\smallerttsl
2348 \def\curfontsize{smaller}%
2349 \def\lsize{smaller}\def\lllsize{smaller}%
2350 \resetmathfonts \setleading{9.5pt}}
2351
2352 % Fonts for short table of contents.
2353 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2354 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2355 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2356 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2357
2358 % Define these just so they can be easily changed for other fonts.
2359 \def\angleleft{$\langle$}
2360 \def\angleright{$\rangle$}
2361
2362 % Set the fonts to use with the @small... environments.
2363 \let\smallexamplefonts = \smallfonts
2364
2365 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2366 % can fit this many characters:
2367 % 8.5x11=86 smallbook=72 a4=90 a5=69
2368 % If we use \scriptfonts (8pt), then we can fit this many characters:
2369 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2370 % For me, subjectively, the few extra characters that fit aren't worth
2371 % the additional smallness of 8pt. So I'm making the default 9pt.
2372 %
2373 % By the way, for comparison, here's what fits with @example (10pt):
2374 % 8.5x11=71 smallbook=60 a4=75 a5=58
2375 % --karl, 24jan03.
2376
2377 % Set up the default fonts, so we can use them for creating boxes.
2378 %
2379 \definetextfontsizexi
2380
2381
2382 \message{markup,}
2383
2384 % Check if we are currently using a typewriter font. Since all the
2385 % Computer Modern typewriter fonts have zero interword stretch (and
2386 % shrink), and it is reasonable to expect all typewriter fonts to have
2387 % this property, we can check that font parameter.
2388 %
2389 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2390
2391 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2392 % define and register \INITMACRO to be called on markup style changes.
2393 % \INITMACRO can check \currentmarkupstyle for the innermost
2394 % style and the set of \ifmarkupSTYLE switches for all styles
2395 % currently in effect.
2396 \newif\ifmarkupvar
2397 \newif\ifmarkupsamp
2398 \newif\ifmarkupkey
2399 %\newif\ifmarkupfile % @file == @samp.
2400 %\newif\ifmarkupoption % @option == @samp.
2401 \newif\ifmarkupcode
2402 \newif\ifmarkupkbd
2403 %\newif\ifmarkupenv % @env == @code.
2404 %\newif\ifmarkupcommand % @command == @code.
2405 \newif\ifmarkuptex % @tex (and part of @math, for now).
2406 \newif\ifmarkupexample
2407 \newif\ifmarkupverb
2408 \newif\ifmarkupverbatim
2409
2410 \let\currentmarkupstyle\empty
2411
2412 \def\setupmarkupstyle#1{%
2413 \csname markup#1true\endcsname
2414 \def\currentmarkupstyle{#1}%
2415 \markupstylesetup
2416 }
2417
2418 \let\markupstylesetup\empty
2419
2420 \def\defmarkupstylesetup#1{%
2421 \expandafter\def\expandafter\markupstylesetup
2422 \expandafter{\markupstylesetup #1}%
2423 \def#1%
2424 }
2425
2426 % Markup style setup for left and right quotes.
2427 \defmarkupstylesetup\markupsetuplq{%
2428 \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\en dcsname
2429 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2430 }
2431
2432 \defmarkupstylesetup\markupsetuprq{%
2433 \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\en dcsname
2434 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2435 }
2436
2437 {
2438 \catcode`\'=\active
2439 \catcode`\`=\active
2440
2441 \gdef\markupsetuplqdefault{\let`\lq}
2442 \gdef\markupsetuprqdefault{\let'\rq}
2443
2444 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2445 \gdef\markupsetcodequoteright{\let'\codequoteright}
2446
2447 \gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
2448 }
2449
2450 \let\markupsetuplqcode \markupsetcodequoteleft
2451 \let\markupsetuprqcode \markupsetcodequoteright
2452 \let\markupsetuplqexample \markupsetcodequoteleft
2453 \let\markupsetuprqexample \markupsetcodequoteright
2454 \let\markupsetuplqverb \markupsetcodequoteleft
2455 \let\markupsetuprqverb \markupsetcodequoteright
2456 \let\markupsetuplqverbatim \markupsetcodequoteleft
2457 \let\markupsetuprqverbatim \markupsetcodequoteright
2458
2459 \let\markupsetuplqsamp \markupsetnoligaturesquoteleft
2460 \let\markupsetuplqkbd \markupsetnoligaturesquoteleft
2461
2462 % Allow an option to not replace quotes with a regular directed right
2463 % quote/apostrophe (char 0x27), but instead use the undirected quote
2464 % from cmtt (char 0x0d). The undirected quote is ugly, so don't make it
2465 % the default, but it works for pasting with more pdf viewers (at least
2466 % evince), the lilypond developers report. xpdf does work with the
2467 % regular 0x27.
2468 %
2469 \def\codequoteright{%
2470 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2471 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2472 '%
2473 \else \char'15 \fi
2474 \else \char'15 \fi
2475 }
2476 %
2477 % and a similar option for the left quote char vs. a grave accent.
2478 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2479 % the code environments to do likewise.
2480 %
2481 \def\codequoteleft{%
2482 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2483 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2484 % [Knuth] pp. 380,381,391
2485 % \relax disables Spanish ligatures ?` and !` of \tt font.
2486 \relax`%
2487 \else \char'22 \fi
2488 \else \char'22 \fi
2489 }
2490
2491 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2492 \def\noligaturesquoteleft{\relax\lq}
2493
2494 % Count depth in font-changes, for error checks
2495 \newcount\fontdepth \fontdepth=0
2496
2497 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
2498 %% serif) and @ii for TeX italic
2499
2500 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
2501 % unless the following character is such as not to need one.
2502 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
2503 \ptexslash\fi\fi\fi}
2504 \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
2505 \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
2506
2507 % like \smartslanted except unconditionally uses \ttsl.
2508 % @var is set to this for defun arguments.
2509 \def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx}
2510
2511 % @cite is like \smartslanted except unconditionally use \sl. We never want
2512 % ttsl for book titles, do we?
2513 \def\cite#1{{\sl #1}\futurelet\next\smartitalicx}
2514
2515 \let\i=\smartitalic
2516 \let\slanted=\smartslanted
2517 \def\var#1{{\setupmarkupstyle{var}\smartslanted{#1}}}
2518 \let\dfn=\smartslanted
2519 \let\emph=\smartitalic
2520
2521 % Explicit font changes: @r, @sc, undocumented @ii.
2522 \def\r#1{{\rm #1}} % roman font
2523 \def\sc#1{{\smallcaps#1}} % smallcaps font
2524 \def\ii#1{{\it #1}} % italic font
2525
2526 % @b, explicit bold. Also @strong.
2527 \def\b#1{{\bf #1}}
2528 \let\strong=\b
2529
2530 % @sansserif, explicit sans.
2531 \def\sansserif#1{{\sf #1}}
2532
2533 % We can't just use \exhyphenpenalty, because that only has effect at
2534 % the end of a paragraph. Restore normal hyphenation at the end of the
2535 % group within which \nohyphenation is presumably called.
2536 %
2537 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2538 \def\restorehyphenation{\hyphenchar\font = `- }
2539
2540 % Set sfcode to normal for the chars that usually have another value.
2541 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2542 % sometimes \x has an active definition that messes things up.
2543 %
2544 \catcode`@=11
2545 \def\plainfrenchspacing{%
2546 \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
2547 \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
2548 \def\endofsentencespacefactor{1000}% for @. and friends
2549 }
2550 \def\plainnonfrenchspacing{%
2551 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2552 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2553 \def\endofsentencespacefactor{3000}% for @. and friends
2554 }
2555 \catcode`@=\other
2556 \def\endofsentencespacefactor{3000}% default
2557
2558 % @t, explicit typewriter.
2559 \def\t#1{%
2560 {\tt \rawbackslash \plainfrenchspacing #1}%
2561 \null
2562 }
2563
2564 % @samp.
2565 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2566
2567 % definition of @key that produces a lozenge. Doesn't adjust to text size.
2568 %\setfont\keyrm\rmshape{8}{1000}{OT1}
2569 %\font\keysy=cmsy9
2570 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2571 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2572 % \vbox{\hrule\kern-0.4pt
2573 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2574 % \kern-0.4pt\hrule}%
2575 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2576
2577 % definition of @key with no lozenge. If the current font is already
2578 % monospace, don't change it; that way, we respect @kbdinputstyle. But
2579 % if it isn't monospace, then use \tt.
2580 %
2581 \def\key#1{{\setupmarkupstyle{key}
2582 \nohyphenation
2583 \ifmonospace\else\tt\fi
2584 #1}\null}
2585
2586 % ctrl is no longer a Texinfo command.
2587 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
2588
2589 % @file, @option are the same as @samp.
2590 \let\file=\samp
2591 \let\option=\samp
2592
2593 % @code is a modification of @t,
2594 % which makes spaces the same size as normal in the surrounding text.
2595 \def\tclose#1{%
2596 {%
2597 % Change normal interword space to be same as for the current font.
2598 \spaceskip = \fontdimen2\font
2599 %
2600 % Switch to typewriter.
2601 \tt
2602 %
2603 % But `\ ' produces the large typewriter interword space.
2604 \def\ {{\spaceskip = 0pt{} }}%
2605 %
2606 % Turn off hyphenation.
2607 \nohyphenation
2608 %
2609 \rawbackslash
2610 \plainfrenchspacing
2611 #1%
2612 }%
2613 \null
2614 }
2615
2616 % We *must* turn on hyphenation at `-' and `_' in @code.
2617 % Otherwise, it is too hard to avoid overfull hboxes
2618 % in the Emacs manual, the Library manual, etc.
2619
2620 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2621 % both hyphenation at - and hyphenation within words.
2622 % We must therefore turn them both off (\tclose does that)
2623 % and arrange explicitly to hyphenate at a dash.
2624 % -- rms.
2625 {
2626 \catcode`\-=\active \catcode`\_=\active
2627 \catcode`\'=\active \catcode`\`=\active
2628 \global\let'=\rq \global\let`=\lq % default definitions
2629 %
2630 \global\def\code{\begingroup
2631 \setupmarkupstyle{code}%
2632 % The following should really be moved into \setupmarkupstyle handlers.
2633 \catcode\dashChar=\active \catcode\underChar=\active
2634 \ifallowcodebreaks
2635 \let-\codedash
2636 \let_\codeunder
2637 \else
2638 \let-\realdash
2639 \let_\realunder
2640 \fi
2641 \codex
2642 }
2643 }
2644
2645 \def\realdash{-}
2646 \def\codedash{-\discretionary{}{}{}}
2647 \def\codeunder{%
2648 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2649 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2650 % will therefore expand the active definition of _, which is us
2651 % (inside @code that is), therefore an endless loop.
2652 \ifusingtt{\ifmmode
2653 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2654 \else\normalunderscore \fi
2655 \discretionary{}{}{}}%
2656 {\_}%
2657 }
2658 \def\codex #1{\tclose{#1}\endgroup}
2659
2660 % An additional complication: the above will allow breaks after, e.g.,
2661 % each of the four underscores in __typeof__. This is undesirable in
2662 % some manuals, especially if they don't have long identifiers in
2663 % general. @allowcodebreaks provides a way to control this.
2664 %
2665 \newif\ifallowcodebreaks \allowcodebreakstrue
2666
2667 \def\keywordtrue{true}
2668 \def\keywordfalse{false}
2669
2670 \parseargdef\allowcodebreaks{%
2671 \def\txiarg{#1}%
2672 \ifx\txiarg\keywordtrue
2673 \allowcodebreakstrue
2674 \else\ifx\txiarg\keywordfalse
2675 \allowcodebreaksfalse
2676 \else
2677 \errhelp = \EMsimple
2678 \errmessage{Unknown @allowcodebreaks option `\txiarg'}%
2679 \fi\fi
2680 }
2681
2682 % @kbd is like @code, except that if the argument is just one @key command,
2683 % then @kbd has no effect.
2684 \def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
2685
2686 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2687 % `example' (@kbd uses ttsl only inside of @example and friends),
2688 % or `code' (@kbd uses normal tty font always).
2689 \parseargdef\kbdinputstyle{%
2690 \def\txiarg{#1}%
2691 \ifx\txiarg\worddistinct
2692 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2693 \else\ifx\txiarg\wordexample
2694 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2695 \else\ifx\txiarg\wordcode
2696 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2697 \else
2698 \errhelp = \EMsimple
2699 \errmessage{Unknown @kbdinputstyle option `\txiarg'}%
2700 \fi\fi\fi
2701 }
2702 \def\worddistinct{distinct}
2703 \def\wordexample{example}
2704 \def\wordcode{code}
2705
2706 % Default is `distinct'.
2707 \kbdinputstyle distinct
2708
2709 \def\xkey{\key}
2710 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2711 \ifx\one\xkey\ifx\threex\three \key{#2}%
2712 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2713 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
2714
2715 % For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2716 \let\indicateurl=\code
2717 \let\env=\code
2718 \let\command=\code
2719
2720 % @clicksequence{File @click{} Open ...}
2721 \def\clicksequence#1{\begingroup #1\endgroup}
2722
2723 % @clickstyle @arrow (by default)
2724 \parseargdef\clickstyle{\def\click{#1}}
2725 \def\click{\arrow}
2726
2727 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
2728 % second argument specifying the text to display and an optional third
2729 % arg as text to display instead of (rather than in addition to) the url
2730 % itself. First (mandatory) arg is the url. Perhaps eventually put in
2731 % a hypertex \special here.
2732 %
2733 \def\uref#1{\douref #1,,,\finish}
2734 \def\douref#1,#2,#3,#4\finish{\begingroup
2735 \unsepspaces
2736 \pdfurl{#1}%
2737 \setbox0 = \hbox{\ignorespaces #3}%
2738 \ifdim\wd0 > 0pt
2739 \unhbox0 % third arg given, show only that
2740 \else
2741 \setbox0 = \hbox{\ignorespaces #2}%
2742 \ifdim\wd0 > 0pt
2743 \ifpdf
2744 \unhbox0 % PDF: 2nd arg given, show only it
2745 \else
2746 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
2747 \fi
2748 \else
2749 \code{#1}% only url given, so show it
2750 \fi
2751 \fi
2752 \endlink
2753 \endgroup}
2754
2755 % @url synonym for @uref, since that's how everyone uses it.
2756 %
2757 \let\url=\uref
2758
2759 % rms does not like angle brackets --karl, 17may97.
2760 % So now @email is just like @uref, unless we are pdf.
2761 %
2762 %\def\email#1{\angleleft{\tt #1}\angleright}
2763 \ifpdf
2764 \def\email#1{\doemail#1,,\finish}
2765 \def\doemail#1,#2,#3\finish{\begingroup
2766 \unsepspaces
2767 \pdfurl{mailto:#1}%
2768 \setbox0 = \hbox{\ignorespaces #2}%
2769 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2770 \endlink
2771 \endgroup}
2772 \else
2773 \let\email=\uref
2774 \fi
2775
2776 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2777 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2778 %
2779 \def\dmn#1{\thinspace #1}
2780
2781 % @l was never documented to mean ``switch to the Lisp font'',
2782 % and it is not used as such in any manual I can find. We need it for
2783 % Polish suppressed-l. --karl, 22sep96.
2784 %\def\l#1{{\li #1}\null}
2785
2786 % @acronym for "FBI", "NATO", and the like.
2787 % We print this one point size smaller, since it's intended for
2788 % all-uppercase.
2789 %
2790 \def\acronym#1{\doacronym #1,,\finish}
2791 \def\doacronym#1,#2,#3\finish{%
2792 {\selectfonts\lsize #1}%
2793 \def\temp{#2}%
2794 \ifx\temp\empty \else
2795 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2796 \fi
2797 }
2798
2799 % @abbr for "Comput. J." and the like.
2800 % No font change, but don't do end-of-sentence spacing.
2801 %
2802 \def\abbr#1{\doabbr #1,,\finish}
2803 \def\doabbr#1,#2,#3\finish{%
2804 {\plainfrenchspacing #1}%
2805 \def\temp{#2}%
2806 \ifx\temp\empty \else
2807 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2808 \fi
2809 }
2810
2811
2812 \message{glyphs,}
2813
2814 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
2815 %
2816 % Since these characters are used in examples, they should be an even number of
2817 % \tt widths. Each \tt character is 1en, so two makes it 1em.
2818 %
2819 \def\point{$\star$}
2820 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
2821 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
2822 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
2823 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
2824 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
2825
2826 % The @error{} command.
2827 % Adapted from the TeXbook's \boxit.
2828 %
2829 \newbox\errorbox
2830 %
2831 {\tentt \global\dimen0 = 3em}% Width of the box.
2832 \dimen2 = .55pt % Thickness of rules
2833 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
2834 \setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
2835 %
2836 \setbox\errorbox=\hbox to \dimen0{\hfil
2837 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
2838 \advance\hsize by -2\dimen2 % Rules.
2839 \vbox{%
2840 \hrule height\dimen2
2841 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
2842 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
2843 \kern3pt\vrule width\dimen2}% Space to right.
2844 \hrule height\dimen2}
2845 \hfil}
2846 %
2847 \def\error{\leavevmode\lower.7ex\copy\errorbox}
2848
2849 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
2850 %
2851 \def\pounds{{\it\$}}
2852
2853 % @euro{} comes from a separate font, depending on the current style.
2854 % We use the free feym* fonts from the eurosym package by Henrik
2855 % Theiling, which support regular, slanted, bold and bold slanted (and
2856 % "outlined" (blackboard board, sort of) versions, which we don't need).
2857 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
2858 %
2859 % Although only regular is the truly official Euro symbol, we ignore
2860 % that. The Euro is designed to be slightly taller than the regular
2861 % font height.
2862 %
2863 % feymr - regular
2864 % feymo - slanted
2865 % feybr - bold
2866 % feybo - bold slanted
2867 %
2868 % There is no good (free) typewriter version, to my knowledge.
2869 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
2870 % Hmm.
2871 %
2872 % Also doesn't work in math. Do we need to do math with euro symbols?
2873 % Hope not.
2874 %
2875 %
2876 \def\euro{{\eurofont e}}
2877 \def\eurofont{%
2878 % We set the font at each command, rather than predefining it in
2879 % \textfonts and the other font-switching commands, so that
2880 % installations which never need the symbol don't have to have the
2881 % font installed.
2882 %
2883 % There is only one designed size (nominal 10pt), so we always scale
2884 % that to the current nominal size.
2885 %
2886 % By the way, simply using "at 1em" works for cmr10 and the like, but
2887 % does not work for cmbx10 and other extended/shrunken fonts.
2888 %
2889 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
2890 %
2891 \ifx\curfontstyle\bfstylename
2892 % bold:
2893 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
2894 \else
2895 % regular:
2896 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
2897 \fi
2898 \thiseurofont
2899 }
2900
2901 % Hacks for glyphs from the EC fonts similar to \euro. We don't
2902 % use \let for the aliases, because sometimes we redefine the original
2903 % macro, and the alias should reflect the redefinition.
2904 \def\guillemetleft{{\ecfont \char"13}}
2905 \def\guillemotleft{\guillemetleft}
2906 \def\guillemetright{{\ecfont \char"14}}
2907 \def\guillemotright{\guillemetright}
2908 \def\guilsinglleft{{\ecfont \char"0E}}
2909 \def\guilsinglright{{\ecfont \char"0F}}
2910 \def\quotedblbase{{\ecfont \char"12}}
2911 \def\quotesinglbase{{\ecfont \char"0D}}
2912 %
2913 % This positioning is not perfect (see the ogonek LaTeX package), but
2914 % we have the precomposed glyphs for the most common cases. We put the
2915 % tests to use those glyphs in the single \ogonek macro so we have fewer
2916 % dummy definitions to worry about for index entries, etc.
2917 %
2918 % ogonek is also used with other letters in Lithuanian (IOU), but using
2919 % the precomposed glyphs for those is not so easy since they aren't in
2920 % the same EC font.
2921 \def\ogonek#1{{%
2922 \def\temp{#1}%
2923 \ifx\temp\macrocharA\Aogonek
2924 \else\ifx\temp\macrochara\aogonek
2925 \else\ifx\temp\macrocharE\Eogonek
2926 \else\ifx\temp\macrochare\eogonek
2927 \else
2928 \ecfont \setbox0=\hbox{#1}%
2929 \ifdim\ht0=1ex\accent"0C #1%
2930 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
2931 \fi
2932 \fi\fi\fi\fi
2933 }%
2934 }
2935 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
2936 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
2937 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
2938 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
2939 %
2940 \def\ecfont{%
2941 % We can't distinguish serif/sans and italic/slanted, but this
2942 % is used for crude hacks anyway (like adding French and German
2943 % quotes to documents typeset with CM, where we lose kerning), so
2944 % hopefully nobody will notice/care.
2945 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
2946 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
2947 \ifx\curfontstyle\bfstylename
2948 % bold:
2949 \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
2950 \else
2951 % regular:
2952 \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
2953 \fi
2954 \thisecfont
2955 }
2956
2957 % @registeredsymbol - R in a circle. The font for the R should really
2958 % be smaller yet, but lllsize is the best we can do for now.
2959 % Adapted from the plain.tex definition of \copyright.
2960 %
2961 \def\registeredsymbol{%
2962 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
2963 \hfil\crcr\Orb}}%
2964 }$%
2965 }
2966
2967 % @textdegree - the normal degrees sign.
2968 %
2969 \def\textdegree{$^\circ$}
2970
2971 % Laurent Siebenmann reports \Orb undefined with:
2972 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
2973 % so we'll define it if necessary.
2974 %
2975 \ifx\Orb\undefined
2976 \def\Orb{\mathhexbox20D}
2977 \fi
2978
2979 % Quotes.
2980 \chardef\quotedblleft="5C
2981 \chardef\quotedblright=`\"
2982 \chardef\quoteleft=`\`
2983 \chardef\quoteright=`\'
2984
2985
2986 \message{page headings,}
2987
2988 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
2989 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
2990
2991 % First the title page. Must do @settitle before @titlepage.
2992 \newif\ifseenauthor
2993 \newif\iffinishedtitlepage
2994
2995 % Do an implicit @contents or @shortcontents after @end titlepage if the
2996 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
2997 %
2998 \newif\ifsetcontentsaftertitlepage
2999 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3000 \newif\ifsetshortcontentsaftertitlepage
3001 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3002
3003 \parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{# 1}%
3004 \endgroup\page\hbox{}\page}
3005
3006 \envdef\titlepage{%
3007 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3008 \begingroup
3009 \parindent=0pt \textfonts
3010 % Leave some space at the very top of the page.
3011 \vglue\titlepagetopglue
3012 % No rule at page bottom unless we print one at the top with @title.
3013 \finishedtitlepagetrue
3014 %
3015 % Most title ``pages'' are actually two pages long, with space
3016 % at the top of the second. We don't want the ragged left on the second.
3017 \let\oldpage = \page
3018 \def\page{%
3019 \iffinishedtitlepage\else
3020 \finishtitlepage
3021 \fi
3022 \let\page = \oldpage
3023 \page
3024 \null
3025 }%
3026 }
3027
3028 \def\Etitlepage{%
3029 \iffinishedtitlepage\else
3030 \finishtitlepage
3031 \fi
3032 % It is important to do the page break before ending the group,
3033 % because the headline and footline are only empty inside the group.
3034 % If we use the new definition of \page, we always get a blank page
3035 % after the title page, which we certainly don't want.
3036 \oldpage
3037 \endgroup
3038 %
3039 % Need this before the \...aftertitlepage checks so that if they are
3040 % in effect the toc pages will come out with page numbers.
3041 \HEADINGSon
3042 %
3043 % If they want short, they certainly want long too.
3044 \ifsetshortcontentsaftertitlepage
3045 \shortcontents
3046 \contents
3047 \global\let\shortcontents = \relax
3048 \global\let\contents = \relax
3049 \fi
3050 %
3051 \ifsetcontentsaftertitlepage
3052 \contents
3053 \global\let\contents = \relax
3054 \global\let\shortcontents = \relax
3055 \fi
3056 }
3057
3058 \def\finishtitlepage{%
3059 \vskip4pt \hrule height 2pt width \hsize
3060 \vskip\titlepagebottomglue
3061 \finishedtitlepagetrue
3062 }
3063
3064 %%% Macros to be used within @titlepage:
3065
3066 \let\subtitlerm=\tenrm
3067 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3068
3069 \parseargdef\title{%
3070 \checkenv\titlepage
3071 \leftline{\titlefonts\rmisbold #1}
3072 % print a rule at the page bottom also.
3073 \finishedtitlepagefalse
3074 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3075 }
3076
3077 \parseargdef\subtitle{%
3078 \checkenv\titlepage
3079 {\subtitlefont \rightline{#1}}%
3080 }
3081
3082 % @author should come last, but may come many times.
3083 % It can also be used inside @quotation.
3084 %
3085 \parseargdef\author{%
3086 \def\temp{\quotation}%
3087 \ifx\thisenv\temp
3088 \def\quotationauthor{#1}% printed in \Equotation.
3089 \else
3090 \checkenv\titlepage
3091 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3092 {\secfonts\rmisbold \leftline{#1}}%
3093 \fi
3094 }
3095
3096
3097 %%% Set up page headings and footings.
3098
3099 \let\thispage=\folio
3100
3101 \newtoks\evenheadline % headline on even pages
3102 \newtoks\oddheadline % headline on odd pages
3103 \newtoks\evenfootline % footline on even pages
3104 \newtoks\oddfootline % footline on odd pages
3105
3106 % Now make TeX use those variables
3107 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3108 \else \the\evenheadline \fi}}
3109 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3110 \else \the\evenfootline \fi}\HEADINGShook}
3111 \let\HEADINGShook=\relax
3112
3113 % Commands to set those variables.
3114 % For example, this is what @headings on does
3115 % @evenheading @thistitle|@thispage|@thischapter
3116 % @oddheading @thischapter|@thispage|@thistitle
3117 % @evenfooting @thisfile||
3118 % @oddfooting ||@thisfile
3119
3120
3121 \def\evenheading{\parsearg\evenheadingxxx}
3122 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3123 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3124 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3125
3126 \def\oddheading{\parsearg\oddheadingxxx}
3127 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3128 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3129 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3130
3131 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3132
3133 \def\evenfooting{\parsearg\evenfootingxxx}
3134 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3135 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3136 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3137
3138 \def\oddfooting{\parsearg\oddfootingxxx}
3139 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3140 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3141 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3142 %
3143 % Leave some space for the footline. Hopefully ok to assume
3144 % @evenfooting will not be used by itself.
3145 \global\advance\pageheight by -12pt
3146 \global\advance\vsize by -12pt
3147 }
3148
3149 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3150
3151 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3152 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3153 %
3154 % The same set of arguments for:
3155 %
3156 % @oddheadingmarks
3157 % @evenfootingmarks
3158 % @oddfootingmarks
3159 % @everyheadingmarks
3160 % @everyfootingmarks
3161
3162 \def\evenheadingmarks{\headingmarks{even}{heading}}
3163 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3164 \def\evenfootingmarks{\headingmarks{even}{footing}}
3165 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3166 \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3167 \headingmarks{odd}{heading}{#1} }
3168 \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3169 \headingmarks{odd}{footing}{#1} }
3170 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3171 \def\headingmarks#1#2#3 {%
3172 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3173 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3174 }
3175
3176 \everyheadingmarks bottom
3177 \everyfootingmarks bottom
3178
3179 % @headings double turns headings on for double-sided printing.
3180 % @headings single turns headings on for single-sided printing.
3181 % @headings off turns them off.
3182 % @headings on same as @headings double, retained for compatibility.
3183 % @headings after turns on double-sided headings after this page.
3184 % @headings doubleafter turns on double-sided headings after this page.
3185 % @headings singleafter turns on single-sided headings after this page.
3186 % By default, they are off at the start of a document,
3187 % and turned `on' after @end titlepage.
3188
3189 \def\headings #1 {\csname HEADINGS#1\endcsname}
3190
3191 \def\HEADINGSoff{%
3192 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
3193 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
3194 \HEADINGSoff
3195 % When we turn headings on, set the page number to 1.
3196 % For double-sided printing, put current file name in lower left corner,
3197 % chapter name on inside top of right hand pages, document
3198 % title on inside top of left hand pages, and page numbers on outside top
3199 % edge of all pages.
3200 \def\HEADINGSdouble{%
3201 \global\pageno=1
3202 \global\evenfootline={\hfil}
3203 \global\oddfootline={\hfil}
3204 \global\evenheadline={\line{\folio\hfil\thistitle}}
3205 \global\oddheadline={\line{\thischapter\hfil\folio}}
3206 \global\let\contentsalignmacro = \chapoddpage
3207 }
3208 \let\contentsalignmacro = \chappager
3209
3210 % For single-sided printing, chapter title goes across top left of page,
3211 % page number on top right.
3212 \def\HEADINGSsingle{%
3213 \global\pageno=1
3214 \global\evenfootline={\hfil}
3215 \global\oddfootline={\hfil}
3216 \global\evenheadline={\line{\thischapter\hfil\folio}}
3217 \global\oddheadline={\line{\thischapter\hfil\folio}}
3218 \global\let\contentsalignmacro = \chappager
3219 }
3220 \def\HEADINGSon{\HEADINGSdouble}
3221
3222 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3223 \let\HEADINGSdoubleafter=\HEADINGSafter
3224 \def\HEADINGSdoublex{%
3225 \global\evenfootline={\hfil}
3226 \global\oddfootline={\hfil}
3227 \global\evenheadline={\line{\folio\hfil\thistitle}}
3228 \global\oddheadline={\line{\thischapter\hfil\folio}}
3229 \global\let\contentsalignmacro = \chapoddpage
3230 }
3231
3232 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3233 \def\HEADINGSsinglex{%
3234 \global\evenfootline={\hfil}
3235 \global\oddfootline={\hfil}
3236 \global\evenheadline={\line{\thischapter\hfil\folio}}
3237 \global\oddheadline={\line{\thischapter\hfil\folio}}
3238 \global\let\contentsalignmacro = \chappager
3239 }
3240
3241 % Subroutines used in generating headings
3242 % This produces Day Month Year style of output.
3243 % Only define if not already defined, in case a txi-??.tex file has set
3244 % up a different format (e.g., txi-cs.tex does this).
3245 \ifx\today\undefined
3246 \def\today{%
3247 \number\day\space
3248 \ifcase\month
3249 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3250 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3251 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3252 \fi
3253 \space\number\year}
3254 \fi
3255
3256 % @settitle line... specifies the title of the document, for headings.
3257 % It generates no output of its own.
3258 \def\thistitle{\putwordNoTitle}
3259 \def\settitle{\parsearg{\gdef\thistitle}}
3260
3261
3262 \message{tables,}
3263 % Tables -- @table, @ftable, @vtable, @item(x).
3264
3265 % default indentation of table text
3266 \newdimen\tableindent \tableindent=.8in
3267 % default indentation of @itemize and @enumerate text
3268 \newdimen\itemindent \itemindent=.3in
3269 % margin between end of table item and start of table text.
3270 \newdimen\itemmargin \itemmargin=.1in
3271
3272 % used internally for \itemindent minus \itemmargin
3273 \newdimen\itemmax
3274
3275 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3276 % these defs.
3277 % They also define \itemindex
3278 % to index the item name in whatever manner is desired (perhaps none).
3279
3280 \newif\ifitemxneedsnegativevskip
3281
3282 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3283
3284 \def\internalBitem{\smallbreak \parsearg\itemzzz}
3285 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
3286
3287 \def\itemzzz #1{\begingroup %
3288 \advance\hsize by -\rightskip
3289 \advance\hsize by -\tableindent
3290 \setbox0=\hbox{\itemindicate{#1}}%
3291 \itemindex{#1}%
3292 \nobreak % This prevents a break before @itemx.
3293 %
3294 % If the item text does not fit in the space we have, put it on a line
3295 % by itself, and do not allow a page break either before or after that
3296 % line. We do not start a paragraph here because then if the next
3297 % command is, e.g., @kindex, the whatsit would get put into the
3298 % horizontal list on a line by itself, resulting in extra blank space.
3299 \ifdim \wd0>\itemmax
3300 %
3301 % Make this a paragraph so we get the \parskip glue and wrapping,
3302 % but leave it ragged-right.
3303 \begingroup
3304 \advance\leftskip by-\tableindent
3305 \advance\hsize by\tableindent
3306 \advance\rightskip by0pt plus1fil
3307 \leavevmode\unhbox0\par
3308 \endgroup
3309 %
3310 % We're going to be starting a paragraph, but we don't want the
3311 % \parskip glue -- logically it's part of the @item we just started.
3312 \nobreak \vskip-\parskip
3313 %
3314 % Stop a page break at the \parskip glue coming up. However, if
3315 % what follows is an environment such as @example, there will be no
3316 % \parskip glue; then the negative vskip we just inserted would
3317 % cause the example and the item to crash together. So we use this
3318 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3319 % \parskip glue after all. Section titles are handled this way also.
3320 %
3321 \penalty 10001
3322 \endgroup
3323 \itemxneedsnegativevskipfalse
3324 \else
3325 % The item text fits into the space. Start a paragraph, so that the
3326 % following text (if any) will end up on the same line.
3327 \noindent
3328 % Do this with kerns and \unhbox so that if there is a footnote in
3329 % the item text, it can migrate to the main vertical list and
3330 % eventually be printed.
3331 \nobreak\kern-\tableindent
3332 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3333 \unhbox0
3334 \nobreak\kern\dimen0
3335 \endgroup
3336 \itemxneedsnegativevskiptrue
3337 \fi
3338 }
3339
3340 \def\item{\errmessage{@item while not in a list environment}}
3341 \def\itemx{\errmessage{@itemx while not in a list environment}}
3342
3343 % @table, @ftable, @vtable.
3344 \envdef\table{%
3345 \let\itemindex\gobble
3346 \tablecheck{table}%
3347 }
3348 \envdef\ftable{%
3349 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3350 \tablecheck{ftable}%
3351 }
3352 \envdef\vtable{%
3353 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3354 \tablecheck{vtable}%
3355 }
3356 \def\tablecheck#1{%
3357 \ifnum \the\catcode`\^^M=\active
3358 \endgroup
3359 \errmessage{This command won't work in this context; perhaps the problem is
3360 that we are \inenvironment\thisenv}%
3361 \def\next{\doignore{#1}}%
3362 \else
3363 \let\next\tablex
3364 \fi
3365 \next
3366 }
3367 \def\tablex#1{%
3368 \def\itemindicate{#1}%
3369 \parsearg\tabley
3370 }
3371 \def\tabley#1{%
3372 {%
3373 \makevalueexpandable
3374 \edef\temp{\noexpand\tablez #1\space\space\space}%
3375 \expandafter
3376 }\temp \endtablez
3377 }
3378 \def\tablez #1 #2 #3 #4\endtablez{%
3379 \aboveenvbreak
3380 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3381 \ifnum 0#2>0 \tableindent=#2\mil \fi
3382 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3383 \itemmax=\tableindent
3384 \advance \itemmax by -\itemmargin
3385 \advance \leftskip by \tableindent
3386 \exdentamount=\tableindent
3387 \parindent = 0pt
3388 \parskip = \smallskipamount
3389 \ifdim \parskip=0pt \parskip=2pt \fi
3390 \let\item = \internalBitem
3391 \let\itemx = \internalBitemx
3392 }
3393 \def\Etable{\endgraf\afterenvbreak}
3394 \let\Eftable\Etable
3395 \let\Evtable\Etable
3396 \let\Eitemize\Etable
3397 \let\Eenumerate\Etable
3398
3399 % This is the counter used by @enumerate, which is really @itemize
3400
3401 \newcount \itemno
3402
3403 \envdef\itemize{\parsearg\doitemize}
3404
3405 \def\doitemize#1{%
3406 \aboveenvbreak
3407 \itemmax=\itemindent
3408 \advance\itemmax by -\itemmargin
3409 \advance\leftskip by \itemindent
3410 \exdentamount=\itemindent
3411 \parindent=0pt
3412 \parskip=\smallskipamount
3413 \ifdim\parskip=0pt \parskip=2pt \fi
3414 \def\itemcontents{#1}%
3415 % @itemize with no arg is equivalent to @itemize @bullet.
3416 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3417 \let\item=\itemizeitem
3418 }
3419
3420 % Definition of @item while inside @itemize and @enumerate.
3421 %
3422 \def\itemizeitem{%
3423 \advance\itemno by 1 % for enumerations
3424 {\let\par=\endgraf \smallbreak}% reasonable place to break
3425 {%
3426 % If the document has an @itemize directly after a section title, a
3427 % \nobreak will be last on the list, and \sectionheading will have
3428 % done a \vskip-\parskip. In that case, we don't want to zero
3429 % parskip, or the item text will crash with the heading. On the
3430 % other hand, when there is normal text preceding the item (as there
3431 % usually is), we do want to zero parskip, or there would be too much
3432 % space. In that case, we won't have a \nobreak before. At least
3433 % that's the theory.
3434 \ifnum\lastpenalty<10000 \parskip=0in \fi
3435 \noindent
3436 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3437 \vadjust{\penalty 1200}}% not good to break after first line of item.
3438 \flushcr
3439 }
3440
3441 % \splitoff TOKENS\endmark defines \first to be the first token in
3442 % TOKENS, and \rest to be the remainder.
3443 %
3444 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3445
3446 % Allow an optional argument of an uppercase letter, lowercase letter,
3447 % or number, to specify the first label in the enumerated list. No
3448 % argument is the same as `1'.
3449 %
3450 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
3451 \def\enumeratey #1 #2\endenumeratey{%
3452 % If we were given no argument, pretend we were given `1'.
3453 \def\thearg{#1}%
3454 \ifx\thearg\empty \def\thearg{1}\fi
3455 %
3456 % Detect if the argument is a single token. If so, it might be a
3457 % letter. Otherwise, the only valid thing it can be is a number.
3458 % (We will always have one token, because of the test we just made.
3459 % This is a good thing, since \splitoff doesn't work given nothing at
3460 % all -- the first parameter is undelimited.)
3461 \expandafter\splitoff\thearg\endmark
3462 \ifx\rest\empty
3463 % Only one token in the argument. It could still be anything.
3464 % A ``lowercase letter'' is one whose \lccode is nonzero.
3465 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3466 % not equal to itself.
3467 % Otherwise, we assume it's a number.
3468 %
3469 % We need the \relax at the end of the \ifnum lines to stop TeX from
3470 % continuing to look for a <number>.
3471 %
3472 \ifnum\lccode\expandafter`\thearg=0\relax
3473 \numericenumerate % a number (we hope)
3474 \else
3475 % It's a letter.
3476 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3477 \lowercaseenumerate % lowercase letter
3478 \else
3479 \uppercaseenumerate % uppercase letter
3480 \fi
3481 \fi
3482 \else
3483 % Multiple tokens in the argument. We hope it's a number.
3484 \numericenumerate
3485 \fi
3486 }
3487
3488 % An @enumerate whose labels are integers. The starting integer is
3489 % given in \thearg.
3490 %
3491 \def\numericenumerate{%
3492 \itemno = \thearg
3493 \startenumeration{\the\itemno}%
3494 }
3495
3496 % The starting (lowercase) letter is in \thearg.
3497 \def\lowercaseenumerate{%
3498 \itemno = \expandafter`\thearg
3499 \startenumeration{%
3500 % Be sure we're not beyond the end of the alphabet.
3501 \ifnum\itemno=0
3502 \errmessage{No more lowercase letters in @enumerate; get a bigger
3503 alphabet}%
3504 \fi
3505 \char\lccode\itemno
3506 }%
3507 }
3508
3509 % The starting (uppercase) letter is in \thearg.
3510 \def\uppercaseenumerate{%
3511 \itemno = \expandafter`\thearg
3512 \startenumeration{%
3513 % Be sure we're not beyond the end of the alphabet.
3514 \ifnum\itemno=0
3515 \errmessage{No more uppercase letters in @enumerate; get a bigger
3516 alphabet}
3517 \fi
3518 \char\uccode\itemno
3519 }%
3520 }
3521
3522 % Call \doitemize, adding a period to the first argument and supplying the
3523 % common last two arguments. Also subtract one from the initial value in
3524 % \itemno, since @item increments \itemno.
3525 %
3526 \def\startenumeration#1{%
3527 \advance\itemno by -1
3528 \doitemize{#1.}\flushcr
3529 }
3530
3531 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3532 % to @enumerate.
3533 %
3534 \def\alphaenumerate{\enumerate{a}}
3535 \def\capsenumerate{\enumerate{A}}
3536 \def\Ealphaenumerate{\Eenumerate}
3537 \def\Ecapsenumerate{\Eenumerate}
3538
3539
3540 % @multitable macros
3541 % Amy Hendrickson, 8/18/94, 3/6/96
3542 %
3543 % @multitable ... @end multitable will make as many columns as desired.
3544 % Contents of each column will wrap at width given in preamble. Width
3545 % can be specified either with sample text given in a template line,
3546 % or in percent of \hsize, the current width of text on page.
3547
3548 % Table can continue over pages but will only break between lines.
3549
3550 % To make preamble:
3551 %
3552 % Either define widths of columns in terms of percent of \hsize:
3553 % @multitable @columnfractions .25 .3 .45
3554 % @item ...
3555 %
3556 % Numbers following @columnfractions are the percent of the total
3557 % current hsize to be used for each column. You may use as many
3558 % columns as desired.
3559
3560
3561 % Or use a template:
3562 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3563 % @item ...
3564 % using the widest term desired in each column.
3565
3566 % Each new table line starts with @item, each subsequent new column
3567 % starts with @tab. Empty columns may be produced by supplying @tab's
3568 % with nothing between them for as many times as empty columns are needed,
3569 % ie, @tab@tab@tab will produce two empty columns.
3570
3571 % @item, @tab do not need to be on their own lines, but it will not hurt
3572 % if they are.
3573
3574 % Sample multitable:
3575
3576 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3577 % @item first col stuff @tab second col stuff @tab third col
3578 % @item
3579 % first col stuff
3580 % @tab
3581 % second col stuff
3582 % @tab
3583 % third col
3584 % @item first col stuff @tab second col stuff
3585 % @tab Many paragraphs of text may be used in any column.
3586 %
3587 % They will wrap at the width determined by the template.
3588 % @item@tab@tab This will be in third column.
3589 % @end multitable
3590
3591 % Default dimensions may be reset by user.
3592 % @multitableparskip is vertical space between paragraphs in table.
3593 % @multitableparindent is paragraph indent in table.
3594 % @multitablecolmargin is horizontal space to be left between columns.
3595 % @multitablelinespace is space to leave between table items, baseline
3596 % to baseline.
3597 % 0pt means it depends on current normal line spacing.
3598 %
3599 \newskip\multitableparskip
3600 \newskip\multitableparindent
3601 \newdimen\multitablecolspace
3602 \newskip\multitablelinespace
3603 \multitableparskip=0pt
3604 \multitableparindent=6pt
3605 \multitablecolspace=12pt
3606 \multitablelinespace=0pt
3607
3608 % Macros used to set up halign preamble:
3609 %
3610 \let\endsetuptable\relax
3611 \def\xendsetuptable{\endsetuptable}
3612 \let\columnfractions\relax
3613 \def\xcolumnfractions{\columnfractions}
3614 \newif\ifsetpercent
3615
3616 % #1 is the @columnfraction, usually a decimal number like .5, but might
3617 % be just 1. We just use it, whatever it is.
3618 %
3619 \def\pickupwholefraction#1 {%
3620 \global\advance\colcount by 1
3621 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3622 \setuptable
3623 }
3624
3625 \newcount\colcount
3626 \def\setuptable#1{%
3627 \def\firstarg{#1}%
3628 \ifx\firstarg\xendsetuptable
3629 \let\go = \relax
3630 \else
3631 \ifx\firstarg\xcolumnfractions
3632 \global\setpercenttrue
3633 \else
3634 \ifsetpercent
3635 \let\go\pickupwholefraction
3636 \else
3637 \global\advance\colcount by 1
3638 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3639 % separator; typically that is always in the input, anyway.
3640 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3641 \fi
3642 \fi
3643 \ifx\go\pickupwholefraction
3644 % Put the argument back for the \pickupwholefraction call, so
3645 % we'll always have a period there to be parsed.
3646 \def\go{\pickupwholefraction#1}%
3647 \else
3648 \let\go = \setuptable
3649 \fi%
3650 \fi
3651 \go
3652 }
3653
3654 % multitable-only commands.
3655 %
3656 % @headitem starts a heading row, which we typeset in bold.
3657 % Assignments have to be global since we are inside the implicit group
3658 % of an alignment entry. Note that \everycr resets \everytab.
3659 \def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}%
3660 %
3661 % A \tab used to include \hskip1sp. But then the space in a template
3662 % line is not enough. That is bad. So let's go back to just `&' until
3663 % we encounter the problem it was intended to solve again.
3664 % --karl, nathan@acm.org, 20apr99.
3665 \def\tab{\checkenv\multitable &\the\everytab}%
3666
3667 % @multitable ... @end multitable definitions:
3668 %
3669 \newtoks\everytab % insert after every tab.
3670 %
3671 \envdef\multitable{%
3672 \vskip\parskip
3673 \startsavinginserts
3674 %
3675 % @item within a multitable starts a normal row.
3676 % We use \def instead of \let so that if one of the multitable entries
3677 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
3678 % \endtemplate) expanding \doitemize.
3679 \def\item{\crcr}%
3680 %
3681 \tolerance=9500
3682 \hbadness=9500
3683 \setmultitablespacing
3684 \parskip=\multitableparskip
3685 \parindent=\multitableparindent
3686 \overfullrule=0pt
3687 \global\colcount=0
3688 %
3689 \everycr = {%
3690 \noalign{%
3691 \global\everytab={}%
3692 \global\colcount=0 % Reset the column counter.
3693 % Check for saved footnotes, etc.
3694 \checkinserts
3695 % Keeps underfull box messages off when table breaks over pages.
3696 %\filbreak
3697 % Maybe so, but it also creates really weird page breaks when the
3698 % table breaks over pages. Wouldn't \vfil be better? Wait until the
3699 % problem manifests itself, so it can be fixed for real --karl.
3700 }%
3701 }%
3702 %
3703 \parsearg\domultitable
3704 }
3705 \def\domultitable#1{%
3706 % To parse everything between @multitable and @item:
3707 \setuptable#1 \endsetuptable
3708 %
3709 % This preamble sets up a generic column definition, which will
3710 % be used as many times as user calls for columns.
3711 % \vtop will set a single line and will also let text wrap and
3712 % continue for many paragraphs if desired.
3713 \halign\bgroup &%
3714 \global\advance\colcount by 1
3715 \multistrut
3716 \vtop{%
3717 % Use the current \colcount to find the correct column width:
3718 \hsize=\expandafter\csname col\the\colcount\endcsname
3719 %
3720 % In order to keep entries from bumping into each other
3721 % we will add a \leftskip of \multitablecolspace to all columns after
3722 % the first one.
3723 %
3724 % If a template has been used, we will add \multitablecolspace
3725 % to the width of each template entry.
3726 %
3727 % If the user has set preamble in terms of percent of \hsize we will
3728 % use that dimension as the width of the column, and the \leftskip
3729 % will keep entries from bumping into each other. Table will start at
3730 % left margin and final column will justify at right margin.
3731 %
3732 % Make sure we don't inherit \rightskip from the outer environment.
3733 \rightskip=0pt
3734 \ifnum\colcount=1
3735 % The first column will be indented with the surrounding text.
3736 \advance\hsize by\leftskip
3737 \else
3738 \ifsetpercent \else
3739 % If user has not set preamble in terms of percent of \hsize
3740 % we will advance \hsize by \multitablecolspace.
3741 \advance\hsize by \multitablecolspace
3742 \fi
3743 % In either case we will make \leftskip=\multitablecolspace:
3744 \leftskip=\multitablecolspace
3745 \fi
3746 % Ignoring space at the beginning and end avoids an occasional spurious
3747 % blank line, when TeX decides to break the line at the space before the
3748 % box from the multistrut, so the strut ends up on a line by itself.
3749 % For example:
3750 % @multitable @columnfractions .11 .89
3751 % @item @code{#}
3752 % @tab Legal holiday which is valid in major parts of the whole country.
3753 % Is automatically provided with highlighting sequences respectively
3754 % marking characters.
3755 \noindent\ignorespaces##\unskip\multistrut
3756 }\cr
3757 }
3758 \def\Emultitable{%
3759 \crcr
3760 \egroup % end the \halign
3761 \global\setpercentfalse
3762 }
3763
3764 \def\setmultitablespacing{%
3765 \def\multistrut{\strut}% just use the standard line spacing
3766 %
3767 % Compute \multitablelinespace (if not defined by user) for use in
3768 % \multitableparskip calculation. We used define \multistrut based on
3769 % this, but (ironically) that caused the spacing to be off.
3770 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
3771 \ifdim\multitablelinespace=0pt
3772 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
3773 \global\advance\multitablelinespace by-\ht0
3774 \fi
3775 %% Test to see if parskip is larger than space between lines of
3776 %% table. If not, do nothing.
3777 %% If so, set to same dimension as multitablelinespace.
3778 \ifdim\multitableparskip>\multitablelinespace
3779 \global\multitableparskip=\multitablelinespace
3780 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
3781 %% than skip between lines in the table.
3782 \fi%
3783 \ifdim\multitableparskip=0pt
3784 \global\multitableparskip=\multitablelinespace
3785 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
3786 %% than skip between lines in the table.
3787 \fi}
3788
3789
3790 \message{conditionals,}
3791
3792 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
3793 % @ifnotxml always succeed. They currently do nothing; we don't
3794 % attempt to check whether the conditionals are properly nested. But we
3795 % have to remember that they are conditionals, so that @end doesn't
3796 % attempt to close an environment group.
3797 %
3798 \def\makecond#1{%
3799 \expandafter\let\csname #1\endcsname = \relax
3800 \expandafter\let\csname iscond.#1\endcsname = 1
3801 }
3802 \makecond{iftex}
3803 \makecond{ifnotdocbook}
3804 \makecond{ifnothtml}
3805 \makecond{ifnotinfo}
3806 \makecond{ifnotplaintext}
3807 \makecond{ifnotxml}
3808
3809 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
3810 %
3811 \def\direntry{\doignore{direntry}}
3812 \def\documentdescription{\doignore{documentdescription}}
3813 \def\docbook{\doignore{docbook}}
3814 \def\html{\doignore{html}}
3815 \def\ifdocbook{\doignore{ifdocbook}}
3816 \def\ifhtml{\doignore{ifhtml}}
3817 \def\ifinfo{\doignore{ifinfo}}
3818 \def\ifnottex{\doignore{ifnottex}}
3819 \def\ifplaintext{\doignore{ifplaintext}}
3820 \def\ifxml{\doignore{ifxml}}
3821 \def\ignore{\doignore{ignore}}
3822 \def\menu{\doignore{menu}}
3823 \def\xml{\doignore{xml}}
3824
3825 % Ignore text until a line `@end #1', keeping track of nested conditionals.
3826 %
3827 % A count to remember the depth of nesting.
3828 \newcount\doignorecount
3829
3830 \def\doignore#1{\begingroup
3831 % Scan in ``verbatim'' mode:
3832 \obeylines
3833 \catcode`\@ = \other
3834 \catcode`\{ = \other
3835 \catcode`\} = \other
3836 %
3837 % Make sure that spaces turn into tokens that match what \doignoretext wants.
3838 \spaceisspace
3839 %
3840 % Count number of #1's that we've seen.
3841 \doignorecount = 0
3842 %
3843 % Swallow text until we reach the matching `@end #1'.
3844 \dodoignore{#1}%
3845 }
3846
3847 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
3848 \obeylines %
3849 %
3850 \gdef\dodoignore#1{%
3851 % #1 contains the command name as a string, e.g., `ifinfo'.
3852 %
3853 % Define a command to find the next `@end #1'.
3854 \long\def\doignoretext##1^^M@end #1{%
3855 \doignoretextyyy##1^^M@#1\_STOP_}%
3856 %
3857 % And this command to find another #1 command, at the beginning of a
3858 % line. (Otherwise, we would consider a line `@c @ifset', for
3859 % example, to count as an @ifset for nesting.)
3860 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
3861 %
3862 % And now expand that command.
3863 \doignoretext ^^M%
3864 }%
3865 }
3866
3867 \def\doignoreyyy#1{%
3868 \def\temp{#1}%
3869 \ifx\temp\empty % Nothing found.
3870 \let\next\doignoretextzzz
3871 \else % Found a nested condition, ...
3872 \advance\doignorecount by 1
3873 \let\next\doignoretextyyy % ..., look for another.
3874 % If we're here, #1 ends with ^^M\ifinfo (for example).
3875 \fi
3876 \next #1% the token \_STOP_ is present just after this macro.
3877 }
3878
3879 % We have to swallow the remaining "\_STOP_".
3880 %
3881 \def\doignoretextzzz#1{%
3882 \ifnum\doignorecount = 0 % We have just found the outermost @end.
3883 \let\next\enddoignore
3884 \else % Still inside a nested condition.
3885 \advance\doignorecount by -1
3886 \let\next\doignoretext % Look for the next @end.
3887 \fi
3888 \next
3889 }
3890
3891 % Finish off ignored text.
3892 { \obeylines%
3893 % Ignore anything after the last `@end #1'; this matters in verbatim
3894 % environments, where otherwise the newline after an ignored conditional
3895 % would result in a blank line in the output.
3896 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
3897 }
3898
3899
3900 % @set VAR sets the variable VAR to an empty value.
3901 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
3902 %
3903 % Since we want to separate VAR from REST-OF-LINE (which might be
3904 % empty), we can't just use \parsearg; we have to insert a space of our
3905 % own to delimit the rest of the line, and then take it out again if we
3906 % didn't need it.
3907 % We rely on the fact that \parsearg sets \catcode`\ =10.
3908 %
3909 \parseargdef\set{\setyyy#1 \endsetyyy}
3910 \def\setyyy#1 #2\endsetyyy{%
3911 {%
3912 \makevalueexpandable
3913 \def\temp{#2}%
3914 \edef\next{\gdef\makecsname{SET#1}}%
3915 \ifx\temp\empty
3916 \next{}%
3917 \else
3918 \setzzz#2\endsetzzz
3919 \fi
3920 }%
3921 }
3922 % Remove the trailing space \setxxx inserted.
3923 \def\setzzz#1 \endsetzzz{\next{#1}}
3924
3925 % @clear VAR clears (i.e., unsets) the variable VAR.
3926 %
3927 \parseargdef\clear{%
3928 {%
3929 \makevalueexpandable
3930 \global\expandafter\let\csname SET#1\endcsname=\relax
3931 }%
3932 }
3933
3934 % @value{foo} gets the text saved in variable foo.
3935 \def\value{\begingroup\makevalueexpandable\valuexxx}
3936 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
3937 {
3938 \catcode`\- = \active \catcode`\_ = \active
3939 %
3940 \gdef\makevalueexpandable{%
3941 \let\value = \expandablevalue
3942 % We don't want these characters active, ...
3943 \catcode`\-=\other \catcode`\_=\other
3944 % ..., but we might end up with active ones in the argument if
3945 % we're called from @code, as @code{@value{foo-bar_}}, though.
3946 % So \let them to their normal equivalents.
3947 \let-\realdash \let_\normalunderscore
3948 }
3949 }
3950
3951 % We have this subroutine so that we can handle at least some @value's
3952 % properly in indexes (we call \makevalueexpandable in \indexdummies).
3953 % The command has to be fully expandable (if the variable is set), since
3954 % the result winds up in the index file. This means that if the
3955 % variable's value contains other Texinfo commands, it's almost certain
3956 % it will fail (although perhaps we could fix that with sufficient work
3957 % to do a one-level expansion on the result, instead of complete).
3958 %
3959 \def\expandablevalue#1{%
3960 \expandafter\ifx\csname SET#1\endcsname\relax
3961 {[No value for ``#1'']}%
3962 \message{Variable `#1', used in @value, is not set.}%
3963 \else
3964 \csname SET#1\endcsname
3965 \fi
3966 }
3967
3968 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
3969 % with @set.
3970 %
3971 % To get special treatment of `@end ifset,' call \makeond and the redefine.
3972 %
3973 \makecond{ifset}
3974 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
3975 \def\doifset#1#2{%
3976 {%
3977 \makevalueexpandable
3978 \let\next=\empty
3979 \expandafter\ifx\csname SET#2\endcsname\relax
3980 #1% If not set, redefine \next.
3981 \fi
3982 \expandafter
3983 }\next
3984 }
3985 \def\ifsetfail{\doignore{ifset}}
3986
3987 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
3988 % defined with @set, or has been undefined with @clear.
3989 %
3990 % The `\else' inside the `\doifset' parameter is a trick to reuse the
3991 % above code: if the variable is not set, do nothing, if it is set,
3992 % then redefine \next to \ifclearfail.
3993 %
3994 \makecond{ifclear}
3995 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
3996 \def\ifclearfail{\doignore{ifclear}}
3997
3998 % @dircategory CATEGORY -- specify a category of the dir file
3999 % which this file should belong to. Ignore this in TeX.
4000 \let\dircategory=\comment
4001
4002 % @defininfoenclose.
4003 \let\definfoenclose=\comment
4004
4005
4006 \message{indexing,}
4007 % Index generation facilities
4008
4009 % Define \newwrite to be identical to plain tex's \newwrite
4010 % except not \outer, so it can be used within macros and \if's.
4011 \edef\newwrite{\makecsname{ptexnewwrite}}
4012
4013 % \newindex {foo} defines an index named foo.
4014 % It automatically defines \fooindex such that
4015 % \fooindex ...rest of line... puts an entry in the index foo.
4016 % It also defines \fooindfile to be the number of the output channel for
4017 % the file that accumulates this index. The file's extension is foo.
4018 % The name of an index should be no more than 2 characters long
4019 % for the sake of vms.
4020 %
4021 \def\newindex#1{%
4022 \iflinks
4023 \expandafter\newwrite \csname#1indfile\endcsname
4024 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
4025 \fi
4026 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4027 \noexpand\doindex{#1}}
4028 }
4029
4030 % @defindex foo == \newindex{foo}
4031 %
4032 \def\defindex{\parsearg\newindex}
4033
4034 % Define @defcodeindex, like @defindex except put all entries in @code.
4035 %
4036 \def\defcodeindex{\parsearg\newcodeindex}
4037 %
4038 \def\newcodeindex#1{%
4039 \iflinks
4040 \expandafter\newwrite \csname#1indfile\endcsname
4041 \openout \csname#1indfile\endcsname \jobname.#1
4042 \fi
4043 \expandafter\xdef\csname#1index\endcsname{%
4044 \noexpand\docodeindex{#1}}%
4045 }
4046
4047
4048 % @synindex foo bar makes index foo feed into index bar.
4049 % Do this instead of @defindex foo if you don't want it as a separate index.
4050 %
4051 % @syncodeindex foo bar similar, but put all entries made for index foo
4052 % inside @code.
4053 %
4054 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4055 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4056
4057 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4058 % #3 the target index (bar).
4059 \def\dosynindex#1#2#3{%
4060 % Only do \closeout if we haven't already done it, else we'll end up
4061 % closing the target index.
4062 \expandafter \ifx\csname donesynindex#2\endcsname \relax
4063 % The \closeout helps reduce unnecessary open files; the limit on the
4064 % Acorn RISC OS is a mere 16 files.
4065 \expandafter\closeout\csname#2indfile\endcsname
4066 \expandafter\let\csname donesynindex#2\endcsname = 1
4067 \fi
4068 % redefine \fooindfile:
4069 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4070 \expandafter\let\csname#2indfile\endcsname=\temp
4071 % redefine \fooindex:
4072 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4073 }
4074
4075 % Define \doindex, the driver for all \fooindex macros.
4076 % Argument #1 is generated by the calling \fooindex macro,
4077 % and it is "foo", the name of the index.
4078
4079 % \doindex just uses \parsearg; it calls \doind for the actual work.
4080 % This is because \doind is more useful to call from other macros.
4081
4082 % There is also \dosubind {index}{topic}{subtopic}
4083 % which makes an entry in a two-level index such as the operation index.
4084
4085 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
4086 \def\singleindexer #1{\doind{\indexname}{#1}}
4087
4088 % like the previous two, but they put @code around the argument.
4089 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
4090 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
4091
4092 % Take care of Texinfo commands that can appear in an index entry.
4093 % Since there are some commands we want to expand, and others we don't,
4094 % we have to laboriously prevent expansion for those that we don't.
4095 %
4096 \def\indexdummies{%
4097 \escapechar = `\\ % use backslash in output files.
4098 \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4099 \def\ {\realbackslash\space }%
4100 %
4101 % Need these in case \tex is in effect and \{ is a \delimiter again.
4102 % But can't use \lbracecmd and \rbracecmd because texindex assumes
4103 % braces and backslashes are used only as delimiters.
4104 \let\{ = \mylbrace
4105 \let\} = \myrbrace
4106 %
4107 % I don't entirely understand this, but when an index entry is
4108 % generated from a macro call, the \endinput which \scanmacro inserts
4109 % causes processing to be prematurely terminated. This is,
4110 % apparently, because \indexsorttmp is fully expanded, and \endinput
4111 % is an expandable command. The redefinition below makes \endinput
4112 % disappear altogether for that purpose -- although logging shows that
4113 % processing continues to some further point. On the other hand, it
4114 % seems \endinput does not hurt in the printed index arg, since that
4115 % is still getting written without apparent harm.
4116 %
4117 % Sample source (mac-idx3.tex, reported by Graham Percival to
4118 % help-texinfo, 22may06):
4119 % @macro funindex {WORD}
4120 % @findex xyz
4121 % @end macro
4122 % ...
4123 % @funindex commtest
4124 %
4125 % The above is not enough to reproduce the bug, but it gives the flavor.
4126 %
4127 % Sample whatsit resulting:
4128 % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
4129 %
4130 % So:
4131 \let\endinput = \empty
4132 %
4133 % Do the redefinitions.
4134 \commondummies
4135 }
4136
4137 % For the aux and toc files, @ is the escape character. So we want to
4138 % redefine everything using @ as the escape character (instead of
4139 % \realbackslash, still used for index files). When everything uses @,
4140 % this will be simpler.
4141 %
4142 \def\atdummies{%
4143 \def\@{@@}%
4144 \def\ {@ }%
4145 \let\{ = \lbraceatcmd
4146 \let\} = \rbraceatcmd
4147 %
4148 % Do the redefinitions.
4149 \commondummies
4150 \otherbackslash
4151 }
4152
4153 % Called from \indexdummies and \atdummies.
4154 %
4155 \def\commondummies{%
4156 %
4157 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4158 % preventing its expansion. This is used only for control% words,
4159 % not control letters, because the \space would be incorrect for
4160 % control characters, but is needed to separate the control word
4161 % from whatever follows.
4162 %
4163 % For control letters, we have \definedummyletter, which omits the
4164 % space.
4165 %
4166 % These can be used both for control words that take an argument and
4167 % those that do not. If it is followed by {arg} in the input, then
4168 % that will dutifully get written to the index (or wherever).
4169 %
4170 \def\definedummyword ##1{\def##1{\string##1\space}}%
4171 \def\definedummyletter##1{\def##1{\string##1}}%
4172 \let\definedummyaccent\definedummyletter
4173 %
4174 \commondummiesnofonts
4175 %
4176 \definedummyletter\_%
4177 %
4178 % Non-English letters.
4179 \definedummyword\AA
4180 \definedummyword\AE
4181 \definedummyword\L
4182 \definedummyword\OE
4183 \definedummyword\O
4184 \definedummyword\aa
4185 \definedummyword\ae
4186 \definedummyword\l
4187 \definedummyword\oe
4188 \definedummyword\o
4189 \definedummyword\ss
4190 \definedummyword\exclamdown
4191 \definedummyword\questiondown
4192 \definedummyword\ordf
4193 \definedummyword\ordm
4194 %
4195 % Although these internal commands shouldn't show up, sometimes they do.
4196 \definedummyword\bf
4197 \definedummyword\gtr
4198 \definedummyword\hat
4199 \definedummyword\less
4200 \definedummyword\sf
4201 \definedummyword\sl
4202 \definedummyword\tclose
4203 \definedummyword\tt
4204 %
4205 \definedummyword\LaTeX
4206 \definedummyword\TeX
4207 %
4208 % Assorted special characters.
4209 \definedummyword\bullet
4210 \definedummyword\comma
4211 \definedummyword\copyright
4212 \definedummyword\registeredsymbol
4213 \definedummyword\dots
4214 \definedummyword\enddots
4215 \definedummyword\equiv
4216 \definedummyword\error
4217 \definedummyword\euro
4218 \definedummyword\guillemetleft
4219 \definedummyword\guillemetright
4220 \definedummyword\guilsinglleft
4221 \definedummyword\guilsinglright
4222 \definedummyword\expansion
4223 \definedummyword\minus
4224 \definedummyword\ogonek
4225 \definedummyword\pounds
4226 \definedummyword\point
4227 \definedummyword\print
4228 \definedummyword\quotedblbase
4229 \definedummyword\quotedblleft
4230 \definedummyword\quotedblright
4231 \definedummyword\quoteleft
4232 \definedummyword\quoteright
4233 \definedummyword\quotesinglbase
4234 \definedummyword\result
4235 \definedummyword\textdegree
4236 %
4237 % We want to disable all macros so that they are not expanded by \write.
4238 \macrolist
4239 %
4240 \normalturnoffactive
4241 %
4242 % Handle some cases of @value -- where it does not contain any
4243 % (non-fully-expandable) commands.
4244 \makevalueexpandable
4245 }
4246
4247 % \commondummiesnofonts: common to \commondummies and \indexnofonts.
4248 %
4249 \def\commondummiesnofonts{%
4250 % Control letters and accents.
4251 \definedummyletter\!%
4252 \definedummyaccent\"%
4253 \definedummyaccent\'%
4254 \definedummyletter\*%
4255 \definedummyaccent\,%
4256 \definedummyletter\.%
4257 \definedummyletter\/%
4258 \definedummyletter\:%
4259 \definedummyaccent\=%
4260 \definedummyletter\?%
4261 \definedummyaccent\^%
4262 \definedummyaccent\`%
4263 \definedummyaccent\~%
4264 \definedummyword\u
4265 \definedummyword\v
4266 \definedummyword\H
4267 \definedummyword\dotaccent
4268 \definedummyword\ogonek
4269 \definedummyword\ringaccent
4270 \definedummyword\tieaccent
4271 \definedummyword\ubaraccent
4272 \definedummyword\udotaccent
4273 \definedummyword\dotless
4274 %
4275 % Texinfo font commands.
4276 \definedummyword\b
4277 \definedummyword\i
4278 \definedummyword\r
4279 \definedummyword\sc
4280 \definedummyword\t
4281 %
4282 % Commands that take arguments.
4283 \definedummyword\acronym
4284 \definedummyword\cite
4285 \definedummyword\code
4286 \definedummyword\command
4287 \definedummyword\dfn
4288 \definedummyword\emph
4289 \definedummyword\env
4290 \definedummyword\file
4291 \definedummyword\kbd
4292 \definedummyword\key
4293 \definedummyword\math
4294 \definedummyword\option
4295 \definedummyword\pxref
4296 \definedummyword\ref
4297 \definedummyword\samp
4298 \definedummyword\strong
4299 \definedummyword\tie
4300 \definedummyword\uref
4301 \definedummyword\url
4302 \definedummyword\var
4303 \definedummyword\verb
4304 \definedummyword\w
4305 \definedummyword\xref
4306 }
4307
4308 % \indexnofonts is used when outputting the strings to sort the index
4309 % by, and when constructing control sequence names. It eliminates all
4310 % control sequences and just writes whatever the best ASCII sort string
4311 % would be for a given command (usually its argument).
4312 %
4313 \def\indexnofonts{%
4314 % Accent commands should become @asis.
4315 \def\definedummyaccent##1{\let##1\asis}%
4316 % We can just ignore other control letters.
4317 \def\definedummyletter##1{\let##1\empty}%
4318 % Hopefully, all control words can become @asis.
4319 \let\definedummyword\definedummyaccent
4320 %
4321 \commondummiesnofonts
4322 %
4323 % Don't no-op \tt, since it isn't a user-level command
4324 % and is used in the definitions of the active chars like <, >, |, etc.
4325 % Likewise with the other plain tex font commands.
4326 %\let\tt=\asis
4327 %
4328 \def\ { }%
4329 \def\@{@}%
4330 % how to handle braces?
4331 \def\_{\normalunderscore}%
4332 %
4333 % Non-English letters.
4334 \def\AA{AA}%
4335 \def\AE{AE}%
4336 \def\L{L}%
4337 \def\OE{OE}%
4338 \def\O{O}%
4339 \def\aa{aa}%
4340 \def\ae{ae}%
4341 \def\l{l}%
4342 \def\oe{oe}%
4343 \def\o{o}%
4344 \def\ss{ss}%
4345 \def\exclamdown{!}%
4346 \def\questiondown{?}%
4347 \def\ordf{a}%
4348 \def\ordm{o}%
4349 %
4350 \def\LaTeX{LaTeX}%
4351 \def\TeX{TeX}%
4352 %
4353 % Assorted special characters.
4354 % (The following {} will end up in the sort string, but that's ok.)
4355 \def\bullet{bullet}%
4356 \def\comma{,}%
4357 \def\copyright{copyright}%
4358 \def\registeredsymbol{R}%
4359 \def\dots{...}%
4360 \def\enddots{...}%
4361 \def\equiv{==}%
4362 \def\error{error}%
4363 \def\euro{euro}%
4364 \def\guillemetleft{<<}%
4365 \def\guillemetright{>>}%
4366 \def\guilsinglleft{<}%
4367 \def\guilsinglright{>}%
4368 \def\expansion{==>}%
4369 \def\minus{-}%
4370 \def\pounds{pounds}%
4371 \def\point{.}%
4372 \def\print{-|}%
4373 \def\quotedblbase{"}%
4374 \def\quotedblleft{"}%
4375 \def\quotedblright{"}%
4376 \def\quoteleft{`}%
4377 \def\quoteright{'}%
4378 \def\quotesinglbase{,}%
4379 \def\result{=>}%
4380 \def\textdegree{degrees}%
4381 %
4382 % We need to get rid of all macros, leaving only the arguments (if present).
4383 % Of course this is not nearly correct, but it is the best we can do for now.
4384 % makeinfo does not expand macros in the argument to @deffn, which ends up
4385 % writing an index entry, and texindex isn't prepared for an index sort entry
4386 % that starts with \.
4387 %
4388 % Since macro invocations are followed by braces, we can just redefine them
4389 % to take a single TeX argument. The case of a macro invocation that
4390 % goes to end-of-line is not handled.
4391 %
4392 \macrolist
4393 }
4394
4395 \let\indexbackslash=0 %overridden during \printindex.
4396 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4397
4398 % Most index entries go through here, but \dosubind is the general case.
4399 % #1 is the index name, #2 is the entry text.
4400 \def\doind#1#2{\dosubind{#1}{#2}{}}
4401
4402 % Workhorse for all \fooindexes.
4403 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
4404 % empty if called from \doind, as we usually are (the main exception
4405 % is with most defuns, which call us directly).
4406 %
4407 \def\dosubind#1#2#3{%
4408 \iflinks
4409 {%
4410 % Store the main index entry text (including the third arg).
4411 \toks0 = {#2}%
4412 % If third arg is present, precede it with a space.
4413 \def\thirdarg{#3}%
4414 \ifx\thirdarg\empty \else
4415 \toks0 = \expandafter{\the\toks0 \space #3}%
4416 \fi
4417 %
4418 \edef\writeto{\csname#1indfile\endcsname}%
4419 %
4420 \safewhatsit\dosubindwrite
4421 }%
4422 \fi
4423 }
4424
4425 % Write the entry in \toks0 to the index file:
4426 %
4427 \def\dosubindwrite{%
4428 % Put the index entry in the margin if desired.
4429 \ifx\SETmarginindex\relax\else
4430 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
4431 \fi
4432 %
4433 % Remember, we are within a group.
4434 \indexdummies % Must do this here, since \bf, etc expand at this stage
4435 \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
4436 % so it will be output as is; and it will print as backslash.
4437 %
4438 % Process the index entry with all font commands turned off, to
4439 % get the string to sort by.
4440 {\indexnofonts
4441 \edef\temp{\the\toks0}% need full expansion
4442 \xdef\indexsorttmp{\temp}%
4443 }%
4444 %
4445 % Set up the complete index entry, with both the sort key and
4446 % the original text, including any font commands. We write
4447 % three arguments to \entry to the .?? file (four in the
4448 % subentry case), texindex reduces to two when writing the .??s
4449 % sorted result.
4450 \edef\temp{%
4451 \write\writeto{%
4452 \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
4453 }%
4454 \temp
4455 }
4456
4457 % Take care of unwanted page breaks/skips around a whatsit:
4458 %
4459 % If a skip is the last thing on the list now, preserve it
4460 % by backing up by \lastskip, doing the \write, then inserting
4461 % the skip again. Otherwise, the whatsit generated by the
4462 % \write or \pdfdest will make \lastskip zero. The result is that
4463 % sequences like this:
4464 % @end defun
4465 % @tindex whatever
4466 % @defun ...
4467 % will have extra space inserted, because the \medbreak in the
4468 % start of the @defun won't see the skip inserted by the @end of
4469 % the previous defun.
4470 %
4471 % But don't do any of this if we're not in vertical mode. We
4472 % don't want to do a \vskip and prematurely end a paragraph.
4473 %
4474 % Avoid page breaks due to these extra skips, too.
4475 %
4476 % But wait, there is a catch there:
4477 % We'll have to check whether \lastskip is zero skip. \ifdim is not
4478 % sufficient for this purpose, as it ignores stretch and shrink parts
4479 % of the skip. The only way seems to be to check the textual
4480 % representation of the skip.
4481 %
4482 % The following is almost like \def\zeroskipmacro{0.0pt} except that
4483 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
4484 %
4485 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
4486 %
4487 \newskip\whatsitskip
4488 \newcount\whatsitpenalty
4489 %
4490 % ..., ready, GO:
4491 %
4492 \def\safewhatsit#1{%
4493 \ifhmode
4494 #1%
4495 \else
4496 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
4497 \whatsitskip = \lastskip
4498 \edef\lastskipmacro{\the\lastskip}%
4499 \whatsitpenalty = \lastpenalty
4500 %
4501 % If \lastskip is nonzero, that means the last item was a
4502 % skip. And since a skip is discardable, that means this
4503 % -\whatsitskip glue we're inserting is preceded by a
4504 % non-discardable item, therefore it is not a potential
4505 % breakpoint, therefore no \nobreak needed.
4506 \ifx\lastskipmacro\zeroskipmacro
4507 \else
4508 \vskip-\whatsitskip
4509 \fi
4510 %
4511 #1%
4512 %
4513 \ifx\lastskipmacro\zeroskipmacro
4514 % If \lastskip was zero, perhaps the last item was a penalty, and
4515 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
4516 % to re-insert the same penalty (values >10000 are used for various
4517 % signals); since we just inserted a non-discardable item, any
4518 % following glue (such as a \parskip) would be a breakpoint. For example:
4519 %
4520 % @deffn deffn-whatever
4521 % @vindex index-whatever
4522 % Description.
4523 % would allow a break between the index-whatever whatsit
4524 % and the "Description." paragraph.
4525 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
4526 \else
4527 % On the other hand, if we had a nonzero \lastskip,
4528 % this make-up glue would be preceded by a non-discardable item
4529 % (the whatsit from the \write), so we must insert a \nobreak.
4530 \nobreak\vskip\whatsitskip
4531 \fi
4532 \fi
4533 }
4534
4535 % The index entry written in the file actually looks like
4536 % \entry {sortstring}{page}{topic}
4537 % or
4538 % \entry {sortstring}{page}{topic}{subtopic}
4539 % The texindex program reads in these files and writes files
4540 % containing these kinds of lines:
4541 % \initial {c}
4542 % before the first topic whose initial is c
4543 % \entry {topic}{pagelist}
4544 % for a topic that is used without subtopics
4545 % \primary {topic}
4546 % for the beginning of a topic that is used with subtopics
4547 % \secondary {subtopic}{pagelist}
4548 % for each subtopic.
4549
4550 % Define the user-accessible indexing commands
4551 % @findex, @vindex, @kindex, @cindex.
4552
4553 \def\findex {\fnindex}
4554 \def\kindex {\kyindex}
4555 \def\cindex {\cpindex}
4556 \def\vindex {\vrindex}
4557 \def\tindex {\tpindex}
4558 \def\pindex {\pgindex}
4559
4560 \def\cindexsub {\begingroup\obeylines\cindexsub}
4561 {\obeylines %
4562 \gdef\cindexsub "#1" #2^^M{\endgroup %
4563 \dosubind{cp}{#2}{#1}}}
4564
4565 % Define the macros used in formatting output of the sorted index material.
4566
4567 % @printindex causes a particular index (the ??s file) to get printed.
4568 % It does not print any chapter heading (usually an @unnumbered).
4569 %
4570 \parseargdef\printindex{\begingroup
4571 \dobreak \chapheadingskip{10000}%
4572 %
4573 \smallfonts \rm
4574 \tolerance = 9500
4575 \plainfrenchspacing
4576 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
4577 %
4578 % See if the index file exists and is nonempty.
4579 % Change catcode of @ here so that if the index file contains
4580 % \initial {@}
4581 % as its first line, TeX doesn't complain about mismatched braces
4582 % (because it thinks @} is a control sequence).
4583 \catcode`\@ = 11
4584 \openin 1 \jobname.#1s
4585 \ifeof 1
4586 % \enddoublecolumns gets confused if there is no text in the index,
4587 % and it loses the chapter title and the aux file entries for the
4588 % index. The easiest way to prevent this problem is to make sure
4589 % there is some text.
4590 \putwordIndexNonexistent
4591 \else
4592 %
4593 % If the index file exists but is empty, then \openin leaves \ifeof
4594 % false. We have to make TeX try to read something from the file, so
4595 % it can discover if there is anything in it.
4596 \read 1 to \temp
4597 \ifeof 1
4598 \putwordIndexIsEmpty
4599 \else
4600 % Index files are almost Texinfo source, but we use \ as the escape
4601 % character. It would be better to use @, but that's too big a change
4602 % to make right now.
4603 \def\indexbackslash{\backslashcurfont}%
4604 \catcode`\\ = 0
4605 \escapechar = `\\
4606 \begindoublecolumns
4607 \input \jobname.#1s
4608 \enddoublecolumns
4609 \fi
4610 \fi
4611 \closein 1
4612 \endgroup}
4613
4614 % These macros are used by the sorted index file itself.
4615 % Change them to control the appearance of the index.
4616
4617 \def\initial#1{{%
4618 % Some minor font changes for the special characters.
4619 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
4620 %
4621 % Remove any glue we may have, we'll be inserting our own.
4622 \removelastskip
4623 %
4624 % We like breaks before the index initials, so insert a bonus.
4625 \nobreak
4626 \vskip 0pt plus 3\baselineskip
4627 \penalty 0
4628 \vskip 0pt plus -3\baselineskip
4629 %
4630 % Typeset the initial. Making this add up to a whole number of
4631 % baselineskips increases the chance of the dots lining up from column
4632 % to column. It still won't often be perfect, because of the stretch
4633 % we need before each entry, but it's better.
4634 %
4635 % No shrink because it confuses \balancecolumns.
4636 \vskip 1.67\baselineskip plus .5\baselineskip
4637 \leftline{\secbf #1}%
4638 % Do our best not to break after the initial.
4639 \nobreak
4640 \vskip .33\baselineskip plus .1\baselineskip
4641 }}
4642
4643 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
4644 % then page number (#2) flushed to the right margin. It is used for index
4645 % and table of contents entries. The paragraph is indented by \leftskip.
4646 %
4647 % A straightforward implementation would start like this:
4648 % \def\entry#1#2{...
4649 % But this freezes the catcodes in the argument, and can cause problems to
4650 % @code, which sets - active. This problem was fixed by a kludge---
4651 % ``-'' was active throughout whole index, but this isn't really right.
4652 %
4653 % The right solution is to prevent \entry from swallowing the whole text.
4654 % --kasal, 21nov03
4655 \def\entry{%
4656 \begingroup
4657 %
4658 % Start a new paragraph if necessary, so our assignments below can't
4659 % affect previous text.
4660 \par
4661 %
4662 % Do not fill out the last line with white space.
4663 \parfillskip = 0in
4664 %
4665 % No extra space above this paragraph.
4666 \parskip = 0in
4667 %
4668 % Do not prefer a separate line ending with a hyphen to fewer lines.
4669 \finalhyphendemerits = 0
4670 %
4671 % \hangindent is only relevant when the entry text and page number
4672 % don't both fit on one line. In that case, bob suggests starting the
4673 % dots pretty far over on the line. Unfortunately, a large
4674 % indentation looks wrong when the entry text itself is broken across
4675 % lines. So we use a small indentation and put up with long leaders.
4676 %
4677 % \hangafter is reset to 1 (which is the value we want) at the start
4678 % of each paragraph, so we need not do anything with that.
4679 \hangindent = 2em
4680 %
4681 % When the entry text needs to be broken, just fill out the first line
4682 % with blank space.
4683 \rightskip = 0pt plus1fil
4684 %
4685 % A bit of stretch before each entry for the benefit of balancing
4686 % columns.
4687 \vskip 0pt plus1pt
4688 %
4689 % Swallow the left brace of the text (first parameter):
4690 \afterassignment\doentry
4691 \let\temp =
4692 }
4693 \def\doentry{%
4694 \bgroup % Instead of the swallowed brace.
4695 \noindent
4696 \aftergroup\finishentry
4697 % And now comes the text of the entry.
4698 }
4699 \def\finishentry#1{%
4700 % #1 is the page number.
4701 %
4702 % The following is kludged to not output a line of dots in the index if
4703 % there are no page numbers. The next person who breaks this will be
4704 % cursed by a Unix daemon.
4705 \setbox\boxA = \hbox{#1}%
4706 \ifdim\wd\boxA = 0pt
4707 \ %
4708 \else
4709 %
4710 % If we must, put the page number on a line of its own, and fill out
4711 % this line with blank space. (The \hfil is overwhelmed with the
4712 % fill leaders glue in \indexdotfill if the page number does fit.)
4713 \hfil\penalty50
4714 \null\nobreak\indexdotfill % Have leaders before the page number.
4715 %
4716 % The `\ ' here is removed by the implicit \unskip that TeX does as
4717 % part of (the primitive) \par. Without it, a spurious underfull
4718 % \hbox ensues.
4719 \ifpdf
4720 \pdfgettoks#1.%
4721 \ \the\toksA
4722 \else
4723 \ #1%
4724 \fi
4725 \fi
4726 \par
4727 \endgroup
4728 }
4729
4730 % Like plain.tex's \dotfill, except uses up at least 1 em.
4731 \def\indexdotfill{\cleaders
4732 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
4733
4734 \def\primary #1{\line{#1\hfil}}
4735
4736 \newskip\secondaryindent \secondaryindent=0.5cm
4737 \def\secondary#1#2{{%
4738 \parfillskip=0in
4739 \parskip=0in
4740 \hangindent=1in
4741 \hangafter=1
4742 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
4743 \ifpdf
4744 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
4745 \else
4746 #2
4747 \fi
4748 \par
4749 }}
4750
4751 % Define two-column mode, which we use to typeset indexes.
4752 % Adapted from the TeXbook, page 416, which is to say,
4753 % the manmac.tex format used to print the TeXbook itself.
4754 \catcode`\@=11
4755
4756 \newbox\partialpage
4757 \newdimen\doublecolumnhsize
4758
4759 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
4760 % Grab any single-column material above us.
4761 \output = {%
4762 %
4763 % Here is a possibility not foreseen in manmac: if we accumulate a
4764 % whole lot of material, we might end up calling this \output
4765 % routine twice in a row (see the doublecol-lose test, which is
4766 % essentially a couple of indexes with @setchapternewpage off). In
4767 % that case we just ship out what is in \partialpage with the normal
4768 % output routine. Generally, \partialpage will be empty when this
4769 % runs and this will be a no-op. See the indexspread.tex test case.
4770 \ifvoid\partialpage \else
4771 \onepageout{\pagecontents\partialpage}%
4772 \fi
4773 %
4774 \global\setbox\partialpage = \vbox{%
4775 % Unvbox the main output page.
4776 \unvbox\PAGE
4777 \kern-\topskip \kern\baselineskip
4778 }%
4779 }%
4780 \eject % run that output routine to set \partialpage
4781 %
4782 % Use the double-column output routine for subsequent pages.
4783 \output = {\doublecolumnout}%
4784 %
4785 % Change the page size parameters. We could do this once outside this
4786 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
4787 % format, but then we repeat the same computation. Repeating a couple
4788 % of assignments once per index is clearly meaningless for the
4789 % execution time, so we may as well do it in one place.
4790 %
4791 % First we halve the line length, less a little for the gutter between
4792 % the columns. We compute the gutter based on the line length, so it
4793 % changes automatically with the paper format. The magic constant
4794 % below is chosen so that the gutter has the same value (well, +-<1pt)
4795 % as it did when we hard-coded it.
4796 %
4797 % We put the result in a separate register, \doublecolumhsize, so we
4798 % can restore it in \pagesofar, after \hsize itself has (potentially)
4799 % been clobbered.
4800 %
4801 \doublecolumnhsize = \hsize
4802 \advance\doublecolumnhsize by -.04154\hsize
4803 \divide\doublecolumnhsize by 2
4804 \hsize = \doublecolumnhsize
4805 %
4806 % Double the \vsize as well. (We don't need a separate register here,
4807 % since nobody clobbers \vsize.)
4808 \vsize = 2\vsize
4809 }
4810
4811 % The double-column output routine for all double-column pages except
4812 % the last.
4813 %
4814 \def\doublecolumnout{%
4815 \splittopskip=\topskip \splitmaxdepth=\maxdepth
4816 % Get the available space for the double columns -- the normal
4817 % (undoubled) page height minus any material left over from the
4818 % previous page.
4819 \dimen@ = \vsize
4820 \divide\dimen@ by 2
4821 \advance\dimen@ by -\ht\partialpage
4822 %
4823 % box0 will be the left-hand column, box2 the right.
4824 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
4825 \onepageout\pagesofar
4826 \unvbox255
4827 \penalty\outputpenalty
4828 }
4829 %
4830 % Re-output the contents of the output page -- any previous material,
4831 % followed by the two boxes we just split, in box0 and box2.
4832 \def\pagesofar{%
4833 \unvbox\partialpage
4834 %
4835 \hsize = \doublecolumnhsize
4836 \wd0=\hsize \wd2=\hsize
4837 \hbox to\pagewidth{\box0\hfil\box2}%
4838 }
4839 %
4840 % All done with double columns.
4841 \def\enddoublecolumns{%
4842 % The following penalty ensures that the page builder is exercised
4843 % _before_ we change the output routine. This is necessary in the
4844 % following situation:
4845 %
4846 % The last section of the index consists only of a single entry.
4847 % Before this section, \pagetotal is less than \pagegoal, so no
4848 % break occurs before the last section starts. However, the last
4849 % section, consisting of \initial and the single \entry, does not
4850 % fit on the page and has to be broken off. Without the following
4851 % penalty the page builder will not be exercised until \eject
4852 % below, and by that time we'll already have changed the output
4853 % routine to the \balancecolumns version, so the next-to-last
4854 % double-column page will be processed with \balancecolumns, which
4855 % is wrong: The two columns will go to the main vertical list, with
4856 % the broken-off section in the recent contributions. As soon as
4857 % the output routine finishes, TeX starts reconsidering the page
4858 % break. The two columns and the broken-off section both fit on the
4859 % page, because the two columns now take up only half of the page
4860 % goal. When TeX sees \eject from below which follows the final
4861 % section, it invokes the new output routine that we've set after
4862 % \balancecolumns below; \onepageout will try to fit the two columns
4863 % and the final section into the vbox of \pageheight (see
4864 % \pagebody), causing an overfull box.
4865 %
4866 % Note that glue won't work here, because glue does not exercise the
4867 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
4868 \penalty0
4869 %
4870 \output = {%
4871 % Split the last of the double-column material. Leave it on the
4872 % current page, no automatic page break.
4873 \balancecolumns
4874 %
4875 % If we end up splitting too much material for the current page,
4876 % though, there will be another page break right after this \output
4877 % invocation ends. Having called \balancecolumns once, we do not
4878 % want to call it again. Therefore, reset \output to its normal
4879 % definition right away. (We hope \balancecolumns will never be
4880 % called on to balance too much material, but if it is, this makes
4881 % the output somewhat more palatable.)
4882 \global\output = {\onepageout{\pagecontents\PAGE}}%
4883 }%
4884 \eject
4885 \endgroup % started in \begindoublecolumns
4886 %
4887 % \pagegoal was set to the doubled \vsize above, since we restarted
4888 % the current page. We're now back to normal single-column
4889 % typesetting, so reset \pagegoal to the normal \vsize (after the
4890 % \endgroup where \vsize got restored).
4891 \pagegoal = \vsize
4892 }
4893 %
4894 % Called at the end of the double column material.
4895 \def\balancecolumns{%
4896 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
4897 \dimen@ = \ht0
4898 \advance\dimen@ by \topskip
4899 \advance\dimen@ by-\baselineskip
4900 \divide\dimen@ by 2 % target to split to
4901 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
4902 \splittopskip = \topskip
4903 % Loop until we get a decent breakpoint.
4904 {%
4905 \vbadness = 10000
4906 \loop
4907 \global\setbox3 = \copy0
4908 \global\setbox1 = \vsplit3 to \dimen@
4909 \ifdim\ht3>\dimen@
4910 \global\advance\dimen@ by 1pt
4911 \repeat
4912 }%
4913 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
4914 \setbox0=\vbox to\dimen@{\unvbox1}%
4915 \setbox2=\vbox to\dimen@{\unvbox3}%
4916 %
4917 \pagesofar
4918 }
4919 \catcode`\@ = \other
4920
4921
4922 \message{sectioning,}
4923 % Chapters, sections, etc.
4924
4925 % \unnumberedno is an oxymoron, of course. But we count the unnumbered
4926 % sections so that we can refer to them unambiguously in the pdf
4927 % outlines by their "section number". We avoid collisions with chapter
4928 % numbers by starting them at 10000. (If a document ever has 10000
4929 % chapters, we're in trouble anyway, I'm sure.)
4930 \newcount\unnumberedno \unnumberedno = 10000
4931 \newcount\chapno
4932 \newcount\secno \secno=0
4933 \newcount\subsecno \subsecno=0
4934 \newcount\subsubsecno \subsubsecno=0
4935
4936 % This counter is funny since it counts through charcodes of letters A, B, ...
4937 \newcount\appendixno \appendixno = `\@
4938 %
4939 % \def\appendixletter{\char\the\appendixno}
4940 % We do the following ugly conditional instead of the above simple
4941 % construct for the sake of pdftex, which needs the actual
4942 % letter in the expansion, not just typeset.
4943 %
4944 \def\appendixletter{%
4945 \ifnum\appendixno=`A A%
4946 \else\ifnum\appendixno=`B B%
4947 \else\ifnum\appendixno=`C C%
4948 \else\ifnum\appendixno=`D D%
4949 \else\ifnum\appendixno=`E E%
4950 \else\ifnum\appendixno=`F F%
4951 \else\ifnum\appendixno=`G G%
4952 \else\ifnum\appendixno=`H H%
4953 \else\ifnum\appendixno=`I I%
4954 \else\ifnum\appendixno=`J J%
4955 \else\ifnum\appendixno=`K K%
4956 \else\ifnum\appendixno=`L L%
4957 \else\ifnum\appendixno=`M M%
4958 \else\ifnum\appendixno=`N N%
4959 \else\ifnum\appendixno=`O O%
4960 \else\ifnum\appendixno=`P P%
4961 \else\ifnum\appendixno=`Q Q%
4962 \else\ifnum\appendixno=`R R%
4963 \else\ifnum\appendixno=`S S%
4964 \else\ifnum\appendixno=`T T%
4965 \else\ifnum\appendixno=`U U%
4966 \else\ifnum\appendixno=`V V%
4967 \else\ifnum\appendixno=`W W%
4968 \else\ifnum\appendixno=`X X%
4969 \else\ifnum\appendixno=`Y Y%
4970 \else\ifnum\appendixno=`Z Z%
4971 % The \the is necessary, despite appearances, because \appendixletter is
4972 % expanded while writing the .toc file. \char\appendixno is not
4973 % expandable, thus it is written literally, thus all appendixes come out
4974 % with the same letter (or @) in the toc without it.
4975 \else\char\the\appendixno
4976 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
4977 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
4978
4979 % Each @chapter defines these (using marks) as the number+name, number
4980 % and name of the chapter. Page headings and footings can use
4981 % these. @section does likewise.
4982 \def\thischapter{}
4983 \def\thischapternum{}
4984 \def\thischaptername{}
4985 \def\thissection{}
4986 \def\thissectionnum{}
4987 \def\thissectionname{}
4988
4989 \newcount\absseclevel % used to calculate proper heading level
4990 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
4991
4992 % @raisesections: treat @section as chapter, @subsection as section, etc.
4993 \def\raisesections{\global\advance\secbase by -1}
4994 \let\up=\raisesections % original BFox name
4995
4996 % @lowersections: treat @chapter as section, @section as subsection, etc.
4997 \def\lowersections{\global\advance\secbase by 1}
4998 \let\down=\lowersections % original BFox name
4999
5000 % we only have subsub.
5001 \chardef\maxseclevel = 3
5002 %
5003 % A numbered section within an unnumbered changes to unnumbered too.
5004 % To achive this, remember the "biggest" unnum. sec. we are currently in:
5005 \chardef\unmlevel = \maxseclevel
5006 %
5007 % Trace whether the current chapter is an appendix or not:
5008 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
5009 \def\chapheadtype{N}
5010
5011 % Choose a heading macro
5012 % #1 is heading type
5013 % #2 is heading level
5014 % #3 is text for heading
5015 \def\genhead#1#2#3{%
5016 % Compute the abs. sec. level:
5017 \absseclevel=#2
5018 \advance\absseclevel by \secbase
5019 % Make sure \absseclevel doesn't fall outside the range:
5020 \ifnum \absseclevel < 0
5021 \absseclevel = 0
5022 \else
5023 \ifnum \absseclevel > 3
5024 \absseclevel = 3
5025 \fi
5026 \fi
5027 % The heading type:
5028 \def\headtype{#1}%
5029 \if \headtype U%
5030 \ifnum \absseclevel < \unmlevel
5031 \chardef\unmlevel = \absseclevel
5032 \fi
5033 \else
5034 % Check for appendix sections:
5035 \ifnum \absseclevel = 0
5036 \edef\chapheadtype{\headtype}%
5037 \else
5038 \if \headtype A\if \chapheadtype N%
5039 \errmessage{@appendix... within a non-appendix chapter}%
5040 \fi\fi
5041 \fi
5042 % Check for numbered within unnumbered:
5043 \ifnum \absseclevel > \unmlevel
5044 \def\headtype{U}%
5045 \else
5046 \chardef\unmlevel = 3
5047 \fi
5048 \fi
5049 % Now print the heading:
5050 \if \headtype U%
5051 \ifcase\absseclevel
5052 \unnumberedzzz{#3}%
5053 \or \unnumberedseczzz{#3}%
5054 \or \unnumberedsubseczzz{#3}%
5055 \or \unnumberedsubsubseczzz{#3}%
5056 \fi
5057 \else
5058 \if \headtype A%
5059 \ifcase\absseclevel
5060 \appendixzzz{#3}%
5061 \or \appendixsectionzzz{#3}%
5062 \or \appendixsubseczzz{#3}%
5063 \or \appendixsubsubseczzz{#3}%
5064 \fi
5065 \else
5066 \ifcase\absseclevel
5067 \chapterzzz{#3}%
5068 \or \seczzz{#3}%
5069 \or \numberedsubseczzz{#3}%
5070 \or \numberedsubsubseczzz{#3}%
5071 \fi
5072 \fi
5073 \fi
5074 \suppressfirstparagraphindent
5075 }
5076
5077 % an interface:
5078 \def\numhead{\genhead N}
5079 \def\apphead{\genhead A}
5080 \def\unnmhead{\genhead U}
5081
5082 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
5083 % all lower-level sectioning counters to zero.
5084 %
5085 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
5086 % (e.g., figures), q.v. By default (before any chapter), that is empty.
5087 \let\chaplevelprefix = \empty
5088 %
5089 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
5090 \def\chapterzzz#1{%
5091 % section resetting is \global in case the chapter is in a group, such
5092 % as an @include file.
5093 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5094 \global\advance\chapno by 1
5095 %
5096 % Used for \float.
5097 \gdef\chaplevelprefix{\the\chapno.}%
5098 \resetallfloatnos
5099 %
5100 \message{\putwordChapter\space \the\chapno}%
5101 %
5102 % Write the actual heading.
5103 \chapmacro{#1}{Ynumbered}{\the\chapno}%
5104 %
5105 % So @section and the like are numbered underneath this chapter.
5106 \global\let\section = \numberedsec
5107 \global\let\subsection = \numberedsubsec
5108 \global\let\subsubsection = \numberedsubsubsec
5109 }
5110
5111 \outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz
5112 \def\appendixzzz#1{%
5113 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5114 \global\advance\appendixno by 1
5115 \gdef\chaplevelprefix{\appendixletter.}%
5116 \resetallfloatnos
5117 %
5118 \def\appendixnum{\putwordAppendix\space \appendixletter}%
5119 \message{\appendixnum}%
5120 %
5121 \chapmacro{#1}{Yappendix}{\appendixletter}%
5122 %
5123 \global\let\section = \appendixsec
5124 \global\let\subsection = \appendixsubsec
5125 \global\let\subsubsection = \appendixsubsubsec
5126 }
5127
5128 \outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumbe redzzz
5129 \def\unnumberedzzz#1{%
5130 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5131 \global\advance\unnumberedno by 1
5132 %
5133 % Since an unnumbered has no number, no prefix for figures.
5134 \global\let\chaplevelprefix = \empty
5135 \resetallfloatnos
5136 %
5137 % This used to be simply \message{#1}, but TeX fully expands the
5138 % argument to \message. Therefore, if #1 contained @-commands, TeX
5139 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
5140 % expanded @cite (which turns out to cause errors because \cite is meant
5141 % to be executed, not expanded).
5142 %
5143 % Anyway, we don't want the fully-expanded definition of @cite to appear
5144 % as a result of the \message, we just want `@cite' itself. We use
5145 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
5146 % simply yielding the contents of <toks register>. (We also do this for
5147 % the toc entries.)
5148 \toks0 = {#1}%
5149 \message{(\the\toks0)}%
5150 %
5151 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
5152 %
5153 \global\let\section = \unnumberedsec
5154 \global\let\subsection = \unnumberedsubsec
5155 \global\let\subsubsection = \unnumberedsubsubsec
5156 }
5157
5158 % @centerchap is like @unnumbered, but the heading is centered.
5159 \outer\parseargdef\centerchap{%
5160 % Well, we could do the following in a group, but that would break
5161 % an assumption that \chapmacro is called at the outermost level.
5162 % Thus we are safer this way: --kasal, 24feb04
5163 \let\centerparametersmaybe = \centerparameters
5164 \unnmhead0{#1}%
5165 \let\centerparametersmaybe = \relax
5166 }
5167
5168 % @top is like @unnumbered.
5169 \let\top\unnumbered
5170
5171 % Sections.
5172 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
5173 \def\seczzz#1{%
5174 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5175 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
5176 }
5177
5178 \outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsecti onzzz
5179 \def\appendixsectionzzz#1{%
5180 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5181 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
5182 }
5183 \let\appendixsec\appendixsection
5184
5185 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedsecz zz
5186 \def\unnumberedseczzz#1{%
5187 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5188 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
5189 }
5190
5191 % Subsections.
5192 \outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubsec zzz
5193 \def\numberedsubseczzz#1{%
5194 \global\subsubsecno=0 \global\advance\subsecno by 1
5195 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
5196 }
5197
5198 \outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubsec zzz
5199 \def\appendixsubseczzz#1{%
5200 \global\subsubsecno=0 \global\advance\subsecno by 1
5201 \sectionheading{#1}{subsec}{Yappendix}%
5202 {\appendixletter.\the\secno.\the\subsecno}%
5203 }
5204
5205 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsu bseczzz
5206 \def\unnumberedsubseczzz#1{%
5207 \global\subsubsecno=0 \global\advance\subsecno by 1
5208 \sectionheading{#1}{subsec}{Ynothing}%
5209 {\the\unnumberedno.\the\secno.\the\subsecno}%
5210 }
5211
5212 % Subsubsections.
5213 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubsec zzz
5214 \def\numberedsubsubseczzz#1{%
5215 \global\advance\subsubsecno by 1
5216 \sectionheading{#1}{subsubsec}{Ynumbered}%
5217 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
5218 }
5219
5220 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubsec zzz
5221 \def\appendixsubsubseczzz#1{%
5222 \global\advance\subsubsecno by 1
5223 \sectionheading{#1}{subsubsec}{Yappendix}%
5224 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
5225 }
5226
5227 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsu bseczzz
5228 \def\unnumberedsubsubseczzz#1{%
5229 \global\advance\subsubsecno by 1
5230 \sectionheading{#1}{subsubsec}{Ynothing}%
5231 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
5232 }
5233
5234 % These macros control what the section commands do, according
5235 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
5236 % Define them by default for a numbered chapter.
5237 \let\section = \numberedsec
5238 \let\subsection = \numberedsubsec
5239 \let\subsubsection = \numberedsubsubsec
5240
5241 % Define @majorheading, @heading and @subheading
5242
5243 % NOTE on use of \vbox for chapter headings, section headings, and such:
5244 % 1) We use \vbox rather than the earlier \line to permit
5245 % overlong headings to fold.
5246 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
5247 % heading is obnoxious; this forbids it.
5248 % 3) Likewise, headings look best if no \parindent is used, and
5249 % if justification is not attempted. Hence \raggedright.
5250
5251 \def\majorheading{%
5252 {\advance\chapheadingskip by 10pt \chapbreak }%
5253 \parsearg\chapheadingzzz
5254 }
5255
5256 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
5257 \def\chapheadingzzz#1{%
5258 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5259 \parindent=0pt\raggedright
5260 \rmisbold #1\hfill}}%
5261 \bigskip \par\penalty 200\relax
5262 \suppressfirstparagraphindent
5263 }
5264
5265 % @heading, @subheading, @subsubheading.
5266 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
5267 \suppressfirstparagraphindent}
5268 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
5269 \suppressfirstparagraphindent}
5270 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
5271 \suppressfirstparagraphindent}
5272
5273 % These macros generate a chapter, section, etc. heading only
5274 % (including whitespace, linebreaking, etc. around it),
5275 % given all the information in convenient, parsed form.
5276
5277 %%% Args are the skip and penalty (usually negative)
5278 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
5279
5280 %%% Define plain chapter starts, and page on/off switching for it
5281 % Parameter controlling skip before chapter headings (if needed)
5282
5283 \newskip\chapheadingskip
5284
5285 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
5286 \def\chappager{\par\vfill\supereject}
5287 % Because \domark is called before \chapoddpage, the filler page will
5288 % get the headings for the next chapter, which is wrong. But we don't
5289 % care -- we just disable all headings on the filler page.
5290 \def\chapoddpage{%
5291 \chappager
5292 \ifodd\pageno \else
5293 \begingroup
5294 \evenheadline={\hfil}\evenfootline={\hfil}%
5295 \oddheadline={\hfil}\oddfootline={\hfil}%
5296 \hbox to 0pt{}%
5297 \chappager
5298 \endgroup
5299 \fi
5300 }
5301
5302 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
5303
5304 \def\CHAPPAGoff{%
5305 \global\let\contentsalignmacro = \chappager
5306 \global\let\pchapsepmacro=\chapbreak
5307 \global\let\pagealignmacro=\chappager}
5308
5309 \def\CHAPPAGon{%
5310 \global\let\contentsalignmacro = \chappager
5311 \global\let\pchapsepmacro=\chappager
5312 \global\let\pagealignmacro=\chappager
5313 \global\def\HEADINGSon{\HEADINGSsingle}}
5314
5315 \def\CHAPPAGodd{%
5316 \global\let\contentsalignmacro = \chapoddpage
5317 \global\let\pchapsepmacro=\chapoddpage
5318 \global\let\pagealignmacro=\chapoddpage
5319 \global\def\HEADINGSon{\HEADINGSdouble}}
5320
5321 \CHAPPAGon
5322
5323 % Chapter opening.
5324 %
5325 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
5326 % Yappendix, Yomitfromtoc), #3 the chapter number.
5327 %
5328 % To test against our argument.
5329 \def\Ynothingkeyword{Ynothing}
5330 \def\Yomitfromtockeyword{Yomitfromtoc}
5331 \def\Yappendixkeyword{Yappendix}
5332 %
5333 \def\chapmacro#1#2#3{%
5334 % Insert the first mark before the heading break (see notes for \domark).
5335 \let\prevchapterdefs=\lastchapterdefs
5336 \let\prevsectiondefs=\lastsectiondefs
5337 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
5338 \gdef\thissection{}}%
5339 %
5340 \def\temptype{#2}%
5341 \ifx\temptype\Ynothingkeyword
5342 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5343 \gdef\thischapter{\thischaptername}}%
5344 \else\ifx\temptype\Yomitfromtockeyword
5345 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5346 \gdef\thischapter{}}%
5347 \else\ifx\temptype\Yappendixkeyword
5348 \toks0={#1}%
5349 \xdef\lastchapterdefs{%
5350 \gdef\noexpand\thischaptername{\the\toks0}%
5351 \gdef\noexpand\thischapternum{\appendixletter}%
5352 \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum:
5353 \noexpand\thischaptername}%
5354 }%
5355 \else
5356 \toks0={#1}%
5357 \xdef\lastchapterdefs{%
5358 \gdef\noexpand\thischaptername{\the\toks0}%
5359 \gdef\noexpand\thischapternum{\the\chapno}%
5360 \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum:
5361 \noexpand\thischaptername}%
5362 }%
5363 \fi\fi\fi
5364 %
5365 % Output the mark. Pass it through \safewhatsit, to take care of
5366 % the preceding space.
5367 \safewhatsit\domark
5368 %
5369 % Insert the chapter heading break.
5370 \pchapsepmacro
5371 %
5372 % Now the second mark, after the heading break. No break points
5373 % between here and the heading.
5374 \let\prevchapterdefs=\lastchapterdefs
5375 \let\prevsectiondefs=\lastsectiondefs
5376 \domark
5377 %
5378 {%
5379 \chapfonts \rmisbold
5380 %
5381 % Have to define \lastsection before calling \donoderef, because the
5382 % xref code eventually uses it. On the other hand, it has to be called
5383 % after \pchapsepmacro, or the headline will change too soon.
5384 \gdef\lastsection{#1}%
5385 %
5386 % Only insert the separating space if we have a chapter/appendix
5387 % number, and don't print the unnumbered ``number''.
5388 \ifx\temptype\Ynothingkeyword
5389 \setbox0 = \hbox{}%
5390 \def\toctype{unnchap}%
5391 \else\ifx\temptype\Yomitfromtockeyword
5392 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
5393 \def\toctype{omit}%
5394 \else\ifx\temptype\Yappendixkeyword
5395 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
5396 \def\toctype{app}%
5397 \else
5398 \setbox0 = \hbox{#3\enspace}%
5399 \def\toctype{numchap}%
5400 \fi\fi\fi
5401 %
5402 % Write the toc entry for this chapter. Must come before the
5403 % \donoderef, because we include the current node name in the toc
5404 % entry, and \donoderef resets it to empty.
5405 \writetocentry{\toctype}{#1}{#3}%
5406 %
5407 % For pdftex, we have to write out the node definition (aka, make
5408 % the pdfdest) after any page break, but before the actual text has
5409 % been typeset. If the destination for the pdf outline is after the
5410 % text, then jumping from the outline may wind up with the text not
5411 % being visible, for instance under high magnification.
5412 \donoderef{#2}%
5413 %
5414 % Typeset the actual heading.
5415 \nobreak % Avoid page breaks at the interline glue.
5416 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
5417 \hangindent=\wd0 \centerparametersmaybe
5418 \unhbox0 #1\par}%
5419 }%
5420 \nobreak\bigskip % no page break after a chapter title
5421 \nobreak
5422 }
5423
5424 % @centerchap -- centered and unnumbered.
5425 \let\centerparametersmaybe = \relax
5426 \def\centerparameters{%
5427 \advance\rightskip by 3\rightskip
5428 \leftskip = \rightskip
5429 \parfillskip = 0pt
5430 }
5431
5432
5433 % I don't think this chapter style is supported any more, so I'm not
5434 % updating it with the new noderef stuff. We'll see. --karl, 11aug03.
5435 %
5436 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
5437 %
5438 \def\unnchfopen #1{%
5439 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5440 \parindent=0pt\raggedright
5441 \rmisbold #1\hfill}}\bigskip \par\nobreak
5442 }
5443 \def\chfopen #1#2{\chapoddpage {\chapfonts
5444 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
5445 \par\penalty 5000 %
5446 }
5447 \def\centerchfopen #1{%
5448 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5449 \parindent=0pt
5450 \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak
5451 }
5452 \def\CHAPFopen{%
5453 \global\let\chapmacro=\chfopen
5454 \global\let\centerchapmacro=\centerchfopen}
5455
5456
5457 % Section titles. These macros combine the section number parts and
5458 % call the generic \sectionheading to do the printing.
5459 %
5460 \newskip\secheadingskip
5461 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
5462
5463 % Subsection titles.
5464 \newskip\subsecheadingskip
5465 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
5466
5467 % Subsubsection titles.
5468 \def\subsubsecheadingskip{\subsecheadingskip}
5469 \def\subsubsecheadingbreak{\subsecheadingbreak}
5470
5471
5472 % Print any size, any type, section title.
5473 %
5474 % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
5475 % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
5476 % section number.
5477 %
5478 \def\seckeyword{sec}
5479 %
5480 \def\sectionheading#1#2#3#4{%
5481 {%
5482 % Switch to the right set of fonts.
5483 \csname #2fonts\endcsname \rmisbold
5484 %
5485 \def\sectionlevel{#2}%
5486 \def\temptype{#3}%
5487 %
5488 % Insert first mark before the heading break (see notes for \domark).
5489 \let\prevsectiondefs=\lastsectiondefs
5490 \ifx\temptype\Ynothingkeyword
5491 \ifx\sectionlevel\seckeyword
5492 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
5493 \gdef\thissection{\thissectionname}}%
5494 \fi
5495 \else\ifx\temptype\Yomitfromtockeyword
5496 % Don't redefine \thissection.
5497 \else\ifx\temptype\Yappendixkeyword
5498 \ifx\sectionlevel\seckeyword
5499 \toks0={#1}%
5500 \xdef\lastsectiondefs{%
5501 \gdef\noexpand\thissectionname{\the\toks0}%
5502 \gdef\noexpand\thissectionnum{#4}%
5503 \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
5504 \noexpand\thissectionname}%
5505 }%
5506 \fi
5507 \else
5508 \ifx\sectionlevel\seckeyword
5509 \toks0={#1}%
5510 \xdef\lastsectiondefs{%
5511 \gdef\noexpand\thissectionname{\the\toks0}%
5512 \gdef\noexpand\thissectionnum{#4}%
5513 \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
5514 \noexpand\thissectionname}%
5515 }%
5516 \fi
5517 \fi\fi\fi
5518 %
5519 % Output the mark. Pass it through \safewhatsit, to take care of
5520 % the preceding space.
5521 \safewhatsit\domark
5522 %
5523 % Insert space above the heading.
5524 \csname #2headingbreak\endcsname
5525 %
5526 % Now the second mark, after the heading break. No break points
5527 % between here and the heading.
5528 \let\prevsectiondefs=\lastsectiondefs
5529 \domark
5530 %
5531 % Only insert the space after the number if we have a section number.
5532 \ifx\temptype\Ynothingkeyword
5533 \setbox0 = \hbox{}%
5534 \def\toctype{unn}%
5535 \gdef\lastsection{#1}%
5536 \else\ifx\temptype\Yomitfromtockeyword
5537 % for @headings -- no section number, don't include in toc,
5538 % and don't redefine \lastsection.
5539 \setbox0 = \hbox{}%
5540 \def\toctype{omit}%
5541 \let\sectionlevel=\empty
5542 \else\ifx\temptype\Yappendixkeyword
5543 \setbox0 = \hbox{#4\enspace}%
5544 \def\toctype{app}%
5545 \gdef\lastsection{#1}%
5546 \else
5547 \setbox0 = \hbox{#4\enspace}%
5548 \def\toctype{num}%
5549 \gdef\lastsection{#1}%
5550 \fi\fi\fi
5551 %
5552 % Write the toc entry (before \donoderef). See comments in \chapmacro.
5553 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
5554 %
5555 % Write the node reference (= pdf destination for pdftex).
5556 % Again, see comments in \chapmacro.
5557 \donoderef{#3}%
5558 %
5559 % Interline glue will be inserted when the vbox is completed.
5560 % That glue will be a valid breakpoint for the page, since it'll be
5561 % preceded by a whatsit (usually from the \donoderef, or from the
5562 % \writetocentry if there was no node). We don't want to allow that
5563 % break, since then the whatsits could end up on page n while the
5564 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
5565 \nobreak
5566 %
5567 % Output the actual section heading.
5568 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
5569 \hangindent=\wd0 % zero if no section number
5570 \unhbox0 #1}%
5571 }%
5572 % Add extra space after the heading -- half of whatever came above it.
5573 % Don't allow stretch, though.
5574 \kern .5 \csname #2headingskip\endcsname
5575 %
5576 % Do not let the kern be a potential breakpoint, as it would be if it
5577 % was followed by glue.
5578 \nobreak
5579 %
5580 % We'll almost certainly start a paragraph next, so don't let that
5581 % glue accumulate. (Not a breakpoint because it's preceded by a
5582 % discardable item.)
5583 \vskip-\parskip
5584 %
5585 % This is purely so the last item on the list is a known \penalty >
5586 % 10000. This is so \startdefun can avoid allowing breakpoints after
5587 % section headings. Otherwise, it would insert a valid breakpoint between:
5588 %
5589 % @section sec-whatever
5590 % @deffn def-whatever
5591 \penalty 10001
5592 }
5593
5594
5595 \message{toc,}
5596 % Table of contents.
5597 \newwrite\tocfile
5598
5599 % Write an entry to the toc file, opening it if necessary.
5600 % Called from @chapter, etc.
5601 %
5602 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
5603 % We append the current node name (if any) and page number as additional
5604 % arguments for the \{chap,sec,...}entry macros which will eventually
5605 % read this. The node name is used in the pdf outlines as the
5606 % destination to jump to.
5607 %
5608 % We open the .toc file for writing here instead of at @setfilename (or
5609 % any other fixed time) so that @contents can be anywhere in the document.
5610 % But if #1 is `omit', then we don't do anything. This is used for the
5611 % table of contents chapter openings themselves.
5612 %
5613 \newif\iftocfileopened
5614 \def\omitkeyword{omit}%
5615 %
5616 \def\writetocentry#1#2#3{%
5617 \edef\writetoctype{#1}%
5618 \ifx\writetoctype\omitkeyword \else
5619 \iftocfileopened\else
5620 \immediate\openout\tocfile = \jobname.toc
5621 \global\tocfileopenedtrue
5622 \fi
5623 %
5624 \iflinks
5625 {\atdummies
5626 \edef\temp{%
5627 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
5628 \temp
5629 }%
5630 \fi
5631 \fi
5632 %
5633 % Tell \shipout to create a pdf destination on each page, if we're
5634 % writing pdf. These are used in the table of contents. We can't
5635 % just write one on every page because the title pages are numbered
5636 % 1 and 2 (the page numbers aren't printed), and so are the first
5637 % two pages of the document. Thus, we'd have two destinations named
5638 % `1', and two named `2'.
5639 \ifpdf \global\pdfmakepagedesttrue \fi
5640 }
5641
5642
5643 % These characters do not print properly in the Computer Modern roman
5644 % fonts, so we must take special care. This is more or less redundant
5645 % with the Texinfo input format setup at the end of this file.
5646 %
5647 \def\activecatcodes{%
5648 \catcode`\"=\active
5649 \catcode`\$=\active
5650 \catcode`\<=\active
5651 \catcode`\>=\active
5652 \catcode`\\=\active
5653 \catcode`\^=\active
5654 \catcode`\_=\active
5655 \catcode`\|=\active
5656 \catcode`\~=\active
5657 }
5658
5659
5660 % Read the toc file, which is essentially Texinfo input.
5661 \def\readtocfile{%
5662 \setupdatafile
5663 \activecatcodes
5664 \input \tocreadfilename
5665 }
5666
5667 \newskip\contentsrightmargin \contentsrightmargin=1in
5668 \newcount\savepageno
5669 \newcount\lastnegativepageno \lastnegativepageno = -1
5670
5671 % Prepare to read what we've written to \tocfile.
5672 %
5673 \def\startcontents#1{%
5674 % If @setchapternewpage on, and @headings double, the contents should
5675 % start on an odd page, unlike chapters. Thus, we maintain
5676 % \contentsalignmacro in parallel with \pagealignmacro.
5677 % From: Torbjorn Granlund <tege@matematik.su.se>
5678 \contentsalignmacro
5679 \immediate\closeout\tocfile
5680 %
5681 % Don't need to put `Contents' or `Short Contents' in the headline.
5682 % It is abundantly clear what they are.
5683 \chapmacro{#1}{Yomitfromtoc}{}%
5684 %
5685 \savepageno = \pageno
5686 \begingroup % Set up to handle contents files properly.
5687 \raggedbottom % Worry more about breakpoints than the bottom.
5688 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
5689 %
5690 % Roman numerals for page numbers.
5691 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
5692 }
5693
5694 % redefined for the two-volume lispref. We always output on
5695 % \jobname.toc even if this is redefined.
5696 %
5697 \def\tocreadfilename{\jobname.toc}
5698
5699 % Normal (long) toc.
5700 %
5701 \def\contents{%
5702 \startcontents{\putwordTOC}%
5703 \openin 1 \tocreadfilename\space
5704 \ifeof 1 \else
5705 \readtocfile
5706 \fi
5707 \vfill \eject
5708 \contentsalignmacro % in case @setchapternewpage odd is in effect
5709 \ifeof 1 \else
5710 \pdfmakeoutlines
5711 \fi
5712 \closein 1
5713 \endgroup
5714 \lastnegativepageno = \pageno
5715 \global\pageno = \savepageno
5716 }
5717
5718 % And just the chapters.
5719 \def\summarycontents{%
5720 \startcontents{\putwordShortTOC}%
5721 %
5722 \let\numchapentry = \shortchapentry
5723 \let\appentry = \shortchapentry
5724 \let\unnchapentry = \shortunnchapentry
5725 % We want a true roman here for the page numbers.
5726 \secfonts
5727 \let\rm=\shortcontrm \let\bf=\shortcontbf
5728 \let\sl=\shortcontsl \let\tt=\shortconttt
5729 \rm
5730 \hyphenpenalty = 10000
5731 \advance\baselineskip by 1pt % Open it up a little.
5732 \def\numsecentry##1##2##3##4{}
5733 \let\appsecentry = \numsecentry
5734 \let\unnsecentry = \numsecentry
5735 \let\numsubsecentry = \numsecentry
5736 \let\appsubsecentry = \numsecentry
5737 \let\unnsubsecentry = \numsecentry
5738 \let\numsubsubsecentry = \numsecentry
5739 \let\appsubsubsecentry = \numsecentry
5740 \let\unnsubsubsecentry = \numsecentry
5741 \openin 1 \tocreadfilename\space
5742 \ifeof 1 \else
5743 \readtocfile
5744 \fi
5745 \closein 1
5746 \vfill \eject
5747 \contentsalignmacro % in case @setchapternewpage odd is in effect
5748 \endgroup
5749 \lastnegativepageno = \pageno
5750 \global\pageno = \savepageno
5751 }
5752 \let\shortcontents = \summarycontents
5753
5754 % Typeset the label for a chapter or appendix for the short contents.
5755 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
5756 %
5757 \def\shortchaplabel#1{%
5758 % This space should be enough, since a single number is .5em, and the
5759 % widest letter (M) is 1em, at least in the Computer Modern fonts.
5760 % But use \hss just in case.
5761 % (This space doesn't include the extra space that gets added after
5762 % the label; that gets put in by \shortchapentry above.)
5763 %
5764 % We'd like to right-justify chapter numbers, but that looks strange
5765 % with appendix letters. And right-justifying numbers and
5766 % left-justifying letters looks strange when there is less than 10
5767 % chapters. Have to read the whole toc once to know how many chapters
5768 % there are before deciding ...
5769 \hbox to 1em{#1\hss}%
5770 }
5771
5772 % These macros generate individual entries in the table of contents.
5773 % The first argument is the chapter or section name.
5774 % The last argument is the page number.
5775 % The arguments in between are the chapter number, section number, ...
5776
5777 % Chapters, in the main contents.
5778 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
5779 %
5780 % Chapters, in the short toc.
5781 % See comments in \dochapentry re vbox and related settings.
5782 \def\shortchapentry#1#2#3#4{%
5783 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
5784 }
5785
5786 % Appendices, in the main contents.
5787 % Need the word Appendix, and a fixed-size box.
5788 %
5789 \def\appendixbox#1{%
5790 % We use M since it's probably the widest letter.
5791 \setbox0 = \hbox{\putwordAppendix{} M}%
5792 \hbox to \wd0{\putwordAppendix{} #1\hss}}
5793 %
5794 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
5795
5796 % Unnumbered chapters.
5797 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
5798 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
5799
5800 % Sections.
5801 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
5802 \let\appsecentry=\numsecentry
5803 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
5804
5805 % Subsections.
5806 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
5807 \let\appsubsecentry=\numsubsecentry
5808 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
5809
5810 % And subsubsections.
5811 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
5812 \let\appsubsubsecentry=\numsubsubsecentry
5813 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
5814
5815 % This parameter controls the indentation of the various levels.
5816 % Same as \defaultparindent.
5817 \newdimen\tocindent \tocindent = 15pt
5818
5819 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
5820 % page number.
5821 %
5822 % If the toc has to be broken over pages, we want it to be at chapters
5823 % if at all possible; hence the \penalty.
5824 \def\dochapentry#1#2{%
5825 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
5826 \begingroup
5827 \chapentryfonts
5828 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
5829 \endgroup
5830 \nobreak\vskip .25\baselineskip plus.1\baselineskip
5831 }
5832
5833 \def\dosecentry#1#2{\begingroup
5834 \secentryfonts \leftskip=\tocindent
5835 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
5836 \endgroup}
5837
5838 \def\dosubsecentry#1#2{\begingroup
5839 \subsecentryfonts \leftskip=2\tocindent
5840 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
5841 \endgroup}
5842
5843 \def\dosubsubsecentry#1#2{\begingroup
5844 \subsubsecentryfonts \leftskip=3\tocindent
5845 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
5846 \endgroup}
5847
5848 % We use the same \entry macro as for the index entries.
5849 \let\tocentry = \entry
5850
5851 % Space between chapter (or whatever) number and the title.
5852 \def\labelspace{\hskip1em \relax}
5853
5854 \def\dopageno#1{{\rm #1}}
5855 \def\doshortpageno#1{{\rm #1}}
5856
5857 \def\chapentryfonts{\secfonts \rm}
5858 \def\secentryfonts{\textfonts}
5859 \def\subsecentryfonts{\textfonts}
5860 \def\subsubsecentryfonts{\textfonts}
5861
5862
5863 \message{environments,}
5864 % @foo ... @end foo.
5865
5866 % @tex ... @end tex escapes into raw Tex temporarily.
5867 % One exception: @ is still an escape character, so that @end tex works.
5868 % But \@ or @@ will get a plain tex @ character.
5869
5870 \envdef\tex{%
5871 \setupmarkupstyle{tex}%
5872 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
5873 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
5874 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
5875 \catcode `\%=14
5876 \catcode `\+=\other
5877 \catcode `\"=\other
5878 \catcode `\|=\other
5879 \catcode `\<=\other
5880 \catcode `\>=\other
5881 \catcode`\`=\other
5882 \catcode`\'=\other
5883 \escapechar=`\\
5884 %
5885 \let\b=\ptexb
5886 \let\bullet=\ptexbullet
5887 \let\c=\ptexc
5888 \let\,=\ptexcomma
5889 \let\.=\ptexdot
5890 \let\dots=\ptexdots
5891 \let\equiv=\ptexequiv
5892 \let\!=\ptexexclam
5893 \let\i=\ptexi
5894 \let\indent=\ptexindent
5895 \let\noindent=\ptexnoindent
5896 \let\{=\ptexlbrace
5897 \let\+=\tabalign
5898 \let\}=\ptexrbrace
5899 \let\/=\ptexslash
5900 \let\*=\ptexstar
5901 \let\t=\ptext
5902 \expandafter \let\csname top\endcsname=\ptextop % outer
5903 \let\frenchspacing=\plainfrenchspacing
5904 %
5905 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
5906 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
5907 \def\@{@}%
5908 }
5909 % There is no need to define \Etex.
5910
5911 % Define @lisp ... @end lisp.
5912 % @lisp environment forms a group so it can rebind things,
5913 % including the definition of @end lisp (which normally is erroneous).
5914
5915 % Amount to narrow the margins by for @lisp.
5916 \newskip\lispnarrowing \lispnarrowing=0.4in
5917
5918 % This is the definition that ^^M gets inside @lisp, @example, and other
5919 % such environments. \null is better than a space, since it doesn't
5920 % have any width.
5921 \def\lisppar{\null\endgraf}
5922
5923 % This space is always present above and below environments.
5924 \newskip\envskipamount \envskipamount = 0pt
5925
5926 % Make spacing and below environment symmetrical. We use \parskip here
5927 % to help in doing that, since in @example-like environments \parskip
5928 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
5929 % start of the next paragraph will insert \parskip.
5930 %
5931 \def\aboveenvbreak{{%
5932 % =10000 instead of <10000 because of a special case in \itemzzz and
5933 % \sectionheading, q.v.
5934 \ifnum \lastpenalty=10000 \else
5935 \advance\envskipamount by \parskip
5936 \endgraf
5937 \ifdim\lastskip<\envskipamount
5938 \removelastskip
5939 % it's not a good place to break if the last penalty was \nobreak
5940 % or better ...
5941 \ifnum\lastpenalty<10000 \penalty-50 \fi
5942 \vskip\envskipamount
5943 \fi
5944 \fi
5945 }}
5946
5947 \let\afterenvbreak = \aboveenvbreak
5948
5949 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
5950 % also clear it, so that its embedded environments do the narrowing again.
5951 \let\nonarrowing=\relax
5952
5953 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
5954 % environment contents.
5955 \font\circle=lcircle10
5956 \newdimen\circthick
5957 \newdimen\cartouter\newdimen\cartinner
5958 \newskip\normbskip\newskip\normpskip\newskip\normlskip
5959 \circthick=\fontdimen8\circle
5960 %
5961 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
5962 \def\ctr{{\hskip 6pt\circle\char'010}}
5963 \def\cbl{{\circle\char'012\hskip -6pt}}
5964 \def\cbr{{\hskip 6pt\circle\char'011}}
5965 \def\carttop{\hbox to \cartouter{\hskip\lskip
5966 \ctl\leaders\hrule height\circthick\hfil\ctr
5967 \hskip\rskip}}
5968 \def\cartbot{\hbox to \cartouter{\hskip\lskip
5969 \cbl\leaders\hrule height\circthick\hfil\cbr
5970 \hskip\rskip}}
5971 %
5972 \newskip\lskip\newskip\rskip
5973
5974 \envdef\cartouche{%
5975 \ifhmode\par\fi % can't be in the midst of a paragraph.
5976 \startsavinginserts
5977 \lskip=\leftskip \rskip=\rightskip
5978 \leftskip=0pt\rightskip=0pt % we want these *outside*.
5979 \cartinner=\hsize \advance\cartinner by-\lskip
5980 \advance\cartinner by-\rskip
5981 \cartouter=\hsize
5982 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
5983 % side, and for 6pt waste from
5984 % each corner char, and rule thickness
5985 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
5986 % Flag to tell @lisp, etc., not to narrow margin.
5987 \let\nonarrowing = t%
5988 \vbox\bgroup
5989 \baselineskip=0pt\parskip=0pt\lineskip=0pt
5990 \carttop
5991 \hbox\bgroup
5992 \hskip\lskip
5993 \vrule\kern3pt
5994 \vbox\bgroup
5995 \kern3pt
5996 \hsize=\cartinner
5997 \baselineskip=\normbskip
5998 \lineskip=\normlskip
5999 \parskip=\normpskip
6000 \vskip -\parskip
6001 \comment % For explanation, see the end of \def\group.
6002 }
6003 \def\Ecartouche{%
6004 \ifhmode\par\fi
6005 \kern3pt
6006 \egroup
6007 \kern3pt\vrule
6008 \hskip\rskip
6009 \egroup
6010 \cartbot
6011 \egroup
6012 \checkinserts
6013 }
6014
6015
6016 % This macro is called at the beginning of all the @example variants,
6017 % inside a group.
6018 \def\nonfillstart{%
6019 \aboveenvbreak
6020 \hfuzz = 12pt % Don't be fussy
6021 \sepspaces % Make spaces be word-separators rather than space tokens.
6022 \let\par = \lisppar % don't ignore blank lines
6023 \obeylines % each line of input is a line of output
6024 \parskip = 0pt
6025 \parindent = 0pt
6026 \emergencystretch = 0pt % don't try to avoid overfull boxes
6027 \ifx\nonarrowing\relax
6028 \advance \leftskip by \lispnarrowing
6029 \exdentamount=\lispnarrowing
6030 \else
6031 \let\nonarrowing = \relax
6032 \fi
6033 \let\exdent=\nofillexdent
6034 }
6035
6036 % If you want all examples etc. small: @set dispenvsize small.
6037 % If you want even small examples the full size: @set dispenvsize nosmall.
6038 % This affects the following displayed environments:
6039 % @example, @display, @format, @lisp
6040 %
6041 \def\smallword{small}
6042 \def\nosmallword{nosmall}
6043 \let\SETdispenvsize\relax
6044 \def\setnormaldispenv{%
6045 \ifx\SETdispenvsize\smallword
6046 % end paragraph for sake of leading, in case document has no blank
6047 % line. This is redundant with what happens in \aboveenvbreak, but
6048 % we need to do it before changing the fonts, and it's inconvenient
6049 % to change the fonts afterward.
6050 \ifnum \lastpenalty=10000 \else \endgraf \fi
6051 \smallexamplefonts \rm
6052 \fi
6053 }
6054 \def\setsmalldispenv{%
6055 \ifx\SETdispenvsize\nosmallword
6056 \else
6057 \ifnum \lastpenalty=10000 \else \endgraf \fi
6058 \smallexamplefonts \rm
6059 \fi
6060 }
6061
6062 % We often define two environments, @foo and @smallfoo.
6063 % Let's do it by one command:
6064 \def\makedispenv #1#2{
6065 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}
6066 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}
6067 \expandafter\let\csname E#1\endcsname \afterenvbreak
6068 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
6069 }
6070
6071 % Define two synonyms:
6072 \def\maketwodispenvs #1#2#3{
6073 \makedispenv{#1}{#3}
6074 \makedispenv{#2}{#3}
6075 }
6076
6077 % @lisp: indented, narrowed, typewriter font; @example: same as @lisp.
6078 %
6079 % @smallexample and @smalllisp: use smaller fonts.
6080 % Originally contributed by Pavel@xerox.
6081 %
6082 \maketwodispenvs {lisp}{example}{%
6083 \nonfillstart
6084 \tt\setupmarkupstyle{example}%
6085 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
6086 \gobble % eat return
6087 }
6088 % @display/@smalldisplay: same as @lisp except keep current font.
6089 %
6090 \makedispenv {display}{%
6091 \nonfillstart
6092 \gobble
6093 }
6094
6095 % @format/@smallformat: same as @display except don't narrow margins.
6096 %
6097 \makedispenv{format}{%
6098 \let\nonarrowing = t%
6099 \nonfillstart
6100 \gobble
6101 }
6102
6103 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
6104 \envdef\flushleft{%
6105 \let\nonarrowing = t%
6106 \nonfillstart
6107 \gobble
6108 }
6109 \let\Eflushleft = \afterenvbreak
6110
6111 % @flushright.
6112 %
6113 \envdef\flushright{%
6114 \let\nonarrowing = t%
6115 \nonfillstart
6116 \advance\leftskip by 0pt plus 1fill
6117 \gobble
6118 }
6119 \let\Eflushright = \afterenvbreak
6120
6121
6122 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
6123 % and narrows the margins. We keep \parskip nonzero in general, since
6124 % we're doing normal filling. So, when using \aboveenvbreak and
6125 % \afterenvbreak, temporarily make \parskip 0.
6126 %
6127 \def\quotationstart{%
6128 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
6129 \parindent=0pt
6130 %
6131 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
6132 \ifx\nonarrowing\relax
6133 \advance\leftskip by \lispnarrowing
6134 \advance\rightskip by \lispnarrowing
6135 \exdentamount = \lispnarrowing
6136 \else
6137 \let\nonarrowing = \relax
6138 \fi
6139 \parsearg\quotationlabel
6140 }
6141
6142 \envdef\quotation{%
6143 \setnormaldispenv
6144 \quotationstart
6145 }
6146
6147 \envdef\smallquotation{%
6148 \setsmalldispenv
6149 \quotationstart
6150 }
6151 \let\Esmallquotation = \Equotation
6152
6153 % We have retained a nonzero parskip for the environment, since we're
6154 % doing normal filling.
6155 %
6156 \def\Equotation{%
6157 \par
6158 \ifx\quotationauthor\undefined\else
6159 % indent a bit.
6160 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
6161 \fi
6162 {\parskip=0pt \afterenvbreak}%
6163 }
6164
6165 % If we're given an argument, typeset it in bold with a colon after.
6166 \def\quotationlabel#1{%
6167 \def\temp{#1}%
6168 \ifx\temp\empty \else
6169 {\bf #1: }%
6170 \fi
6171 }
6172
6173
6174 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
6175 % If we want to allow any <char> as delimiter,
6176 % we need the curly braces so that makeinfo sees the @verb command, eg:
6177 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
6178 %
6179 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
6180 %
6181 % [Knuth] p.344; only we need to do the other characters Texinfo sets
6182 % active too. Otherwise, they get lost as the first character on a
6183 % verbatim line.
6184 \def\dospecials{%
6185 \do\ \do\\\do\{\do\}\do\$\do\&%
6186 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
6187 \do\<\do\>\do\|\do\@\do+\do\"%
6188 % Don't do the quotes -- if we do, @set txicodequoteundirected and
6189 % @set txicodequotebacktick will not have effect on @verb and
6190 % @verbatim, and ?` and !` ligatures won't get disabled.
6191 %\do\`\do\'%
6192 }
6193 %
6194 % [Knuth] p. 380
6195 \def\uncatcodespecials{%
6196 \def\do##1{\catcode`##1=\other}\dospecials}
6197 %
6198 % Setup for the @verb command.
6199 %
6200 % Eight spaces for a tab
6201 \begingroup
6202 \catcode`\^^I=\active
6203 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
6204 \endgroup
6205 %
6206 \def\setupverb{%
6207 \tt % easiest (and conventionally used) font for verbatim
6208 \def\par{\leavevmode\endgraf}%
6209 \setupmarkupstyle{verb}%
6210 \tabeightspaces
6211 % Respect line breaks,
6212 % print special symbols as themselves, and
6213 % make each space count
6214 % must do in this order:
6215 \obeylines \uncatcodespecials \sepspaces
6216 }
6217
6218 % Setup for the @verbatim environment
6219 %
6220 % Real tab expansion
6221 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
6222 %
6223 \def\starttabbox{\setbox0=\hbox\bgroup}
6224 %
6225 \begingroup
6226 \catcode`\^^I=\active
6227 \gdef\tabexpand{%
6228 \catcode`\^^I=\active
6229 \def^^I{\leavevmode\egroup
6230 \dimen0=\wd0 % the width so far, or since the previous tab
6231 \divide\dimen0 by\tabw
6232 \multiply\dimen0 by\tabw % compute previous multiple of \tabw
6233 \advance\dimen0 by\tabw % advance to next multiple of \tabw
6234 \wd0=\dimen0 \box0 \starttabbox
6235 }%
6236 }
6237 \endgroup
6238
6239 % start the verbatim environment.
6240 \def\setupverbatim{%
6241 \let\nonarrowing = t%
6242 \nonfillstart
6243 % Easiest (and conventionally used) font for verbatim
6244 \tt
6245 \def\par{\leavevmode\egroup\box0\endgraf}%
6246 \tabexpand
6247 \setupmarkupstyle{verbatim}%
6248 % Respect line breaks,
6249 % print special symbols as themselves, and
6250 % make each space count
6251 % must do in this order:
6252 \obeylines \uncatcodespecials \sepspaces
6253 \everypar{\starttabbox}%
6254 }
6255
6256 % Do the @verb magic: verbatim text is quoted by unique
6257 % delimiter characters. Before first delimiter expect a
6258 % right brace, after last delimiter expect closing brace:
6259 %
6260 % \def\doverb'{'<char>#1<char>'}'{#1}
6261 %
6262 % [Knuth] p. 382; only eat outer {}
6263 \begingroup
6264 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
6265 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
6266 \endgroup
6267 %
6268 \def\verb{\begingroup\setupverb\doverb}
6269 %
6270 %
6271 % Do the @verbatim magic: define the macro \doverbatim so that
6272 % the (first) argument ends when '@end verbatim' is reached, ie:
6273 %
6274 % \def\doverbatim#1@end verbatim{#1}
6275 %
6276 % For Texinfo it's a lot easier than for LaTeX,
6277 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
6278 % we need not redefine '\', '{' and '}'.
6279 %
6280 % Inspired by LaTeX's verbatim command set [latex.ltx]
6281 %
6282 \begingroup
6283 \catcode`\ =\active
6284 \obeylines %
6285 % ignore everything up to the first ^^M, that's the newline at the end
6286 % of the @verbatim input line itself. Otherwise we get an extra blank
6287 % line in the output.
6288 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
6289 % We really want {...\end verbatim} in the body of the macro, but
6290 % without the active space; thus we have to use \xdef and \gobble.
6291 \endgroup
6292 %
6293 \envdef\verbatim{%
6294 \setupverbatim\doverbatim
6295 }
6296 \let\Everbatim = \afterenvbreak
6297
6298
6299 % @verbatiminclude FILE - insert text of file in verbatim environment.
6300 %
6301 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
6302 %
6303 \def\doverbatiminclude#1{%
6304 {%
6305 \makevalueexpandable
6306 \setupverbatim
6307 \indexnofonts % Allow `@@' and other weird things in file names.
6308 \input #1
6309 \afterenvbreak
6310 }%
6311 }
6312
6313 % @copying ... @end copying.
6314 % Save the text away for @insertcopying later.
6315 %
6316 % We save the uninterpreted tokens, rather than creating a box.
6317 % Saving the text in a box would be much easier, but then all the
6318 % typesetting commands (@smallbook, font changes, etc.) have to be done
6319 % beforehand -- and a) we want @copying to be done first in the source
6320 % file; b) letting users define the frontmatter in as flexible order as
6321 % possible is very desirable.
6322 %
6323 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
6324 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
6325 %
6326 \def\insertcopying{%
6327 \begingroup
6328 \parindent = 0pt % paragraph indentation looks wrong on title page
6329 \scanexp\copyingtext
6330 \endgroup
6331 }
6332
6333
6334 \message{defuns,}
6335 % @defun etc.
6336
6337 \newskip\defbodyindent \defbodyindent=.4in
6338 \newskip\defargsindent \defargsindent=50pt
6339 \newskip\deflastargmargin \deflastargmargin=18pt
6340 \newcount\defunpenalty
6341
6342 % Start the processing of @deffn:
6343 \def\startdefun{%
6344 \ifnum\lastpenalty<10000
6345 \medbreak
6346 \defunpenalty=10003 % Will keep this @deffn together with the
6347 % following @def command, see below.
6348 \else
6349 % If there are two @def commands in a row, we'll have a \nobreak,
6350 % which is there to keep the function description together with its
6351 % header. But if there's nothing but headers, we need to allow a
6352 % break somewhere. Check specifically for penalty 10002, inserted
6353 % by \printdefunline, instead of 10000, since the sectioning
6354 % commands also insert a nobreak penalty, and we don't want to allow
6355 % a break between a section heading and a defun.
6356 %
6357 % As a minor refinement, we avoid "club" headers by signalling
6358 % with penalty of 10003 after the very first @deffn in the
6359 % sequence (see above), and penalty of 10002 after any following
6360 % @def command.
6361 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
6362 %
6363 % Similarly, after a section heading, do not allow a break.
6364 % But do insert the glue.
6365 \medskip % preceded by discardable penalty, so not a breakpoint
6366 \fi
6367 %
6368 \parindent=0in
6369 \advance\leftskip by \defbodyindent
6370 \exdentamount=\defbodyindent
6371 }
6372
6373 \def\dodefunx#1{%
6374 % First, check whether we are in the right environment:
6375 \checkenv#1%
6376 %
6377 % As above, allow line break if we have multiple x headers in a row.
6378 % It's not a great place, though.
6379 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
6380 %
6381 % And now, it's time to reuse the body of the original defun:
6382 \expandafter\gobbledefun#1%
6383 }
6384 \def\gobbledefun#1\startdefun{}
6385
6386 % \printdefunline \deffnheader{text}
6387 %
6388 \def\printdefunline#1#2{%
6389 \begingroup
6390 % call \deffnheader:
6391 #1#2 \endheader
6392 % common ending:
6393 \interlinepenalty = 10000
6394 \advance\rightskip by 0pt plus 1fil
6395 \endgraf
6396 \nobreak\vskip -\parskip
6397 \penalty\defunpenalty % signal to \startdefun and \dodefunx
6398 % Some of the @defun-type tags do not enable magic parentheses,
6399 % rendering the following check redundant. But we don't optimize.
6400 \checkparencounts
6401 \endgroup
6402 }
6403
6404 \def\Edefun{\endgraf\medbreak}
6405
6406 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
6407 % the only thing remaining is to define \deffnheader.
6408 %
6409 \def\makedefun#1{%
6410 \expandafter\let\csname E#1\endcsname = \Edefun
6411 \edef\temp{\noexpand\domakedefun
6412 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
6413 \temp
6414 }
6415
6416 % \domakedefun \deffn \deffnx \deffnheader
6417 %
6418 % Define \deffn and \deffnx, without parameters.
6419 % \deffnheader has to be defined explicitly.
6420 %
6421 \def\domakedefun#1#2#3{%
6422 \envdef#1{%
6423 \startdefun
6424 \parseargusing\activeparens{\printdefunline#3}%
6425 }%
6426 \def#2{\dodefunx#1}%
6427 \def#3%
6428 }
6429
6430 %%% Untyped functions:
6431
6432 % @deffn category name args
6433 \makedefun{deffn}{\deffngeneral{}}
6434
6435 % @deffn category class name args
6436 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
6437
6438 % \defopon {category on}class name args
6439 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
6440
6441 % \deffngeneral {subind}category name args
6442 %
6443 \def\deffngeneral#1#2 #3 #4\endheader{%
6444 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
6445 \dosubind{fn}{\code{#3}}{#1}%
6446 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
6447 }
6448
6449 %%% Typed functions:
6450
6451 % @deftypefn category type name args
6452 \makedefun{deftypefn}{\deftypefngeneral{}}
6453
6454 % @deftypeop category class type name args
6455 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
6456
6457 % \deftypeopon {category on}class type name args
6458 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
6459
6460 % \deftypefngeneral {subind}category type name args
6461 %
6462 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
6463 \dosubind{fn}{\code{#4}}{#1}%
6464 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6465 }
6466
6467 %%% Typed variables:
6468
6469 % @deftypevr category type var args
6470 \makedefun{deftypevr}{\deftypecvgeneral{}}
6471
6472 % @deftypecv category class type var args
6473 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
6474
6475 % \deftypecvof {category of}class type var args
6476 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
6477
6478 % \deftypecvgeneral {subind}category type var args
6479 %
6480 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
6481 \dosubind{vr}{\code{#4}}{#1}%
6482 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6483 }
6484
6485 %%% Untyped variables:
6486
6487 % @defvr category var args
6488 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
6489
6490 % @defcv category class var args
6491 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
6492
6493 % \defcvof {category of}class var args
6494 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
6495
6496 %%% Type:
6497 % @deftp category name args
6498 \makedefun{deftp}#1 #2 #3\endheader{%
6499 \doind{tp}{\code{#2}}%
6500 \defname{#1}{}{#2}\defunargs{#3\unskip}%
6501 }
6502
6503 % Remaining @defun-like shortcuts:
6504 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
6505 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
6506 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
6507 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
6508 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
6509 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
6510 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
6511 \makedefun{defmethod}{\defopon\putwordMethodon}
6512 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
6513 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
6514 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
6515
6516 % \defname, which formats the name of the @def (not the args).
6517 % #1 is the category, such as "Function".
6518 % #2 is the return type, if any.
6519 % #3 is the function name.
6520 %
6521 % We are followed by (but not passed) the arguments, if any.
6522 %
6523 \def\defname#1#2#3{%
6524 % Get the values of \leftskip and \rightskip as they were outside the @def...
6525 \advance\leftskip by -\defbodyindent
6526 %
6527 % How we'll format the type name. Putting it in brackets helps
6528 % distinguish it from the body text that may end up on the next line
6529 % just below it.
6530 \def\temp{#1}%
6531 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
6532 %
6533 % Figure out line sizes for the paragraph shape.
6534 % The first line needs space for \box0; but if \rightskip is nonzero,
6535 % we need only space for the part of \box0 which exceeds it:
6536 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
6537 % The continuations:
6538 \dimen2=\hsize \advance\dimen2 by -\defargsindent
6539 % (plain.tex says that \dimen1 should be used only as global.)
6540 \parshape 2 0in \dimen0 \defargsindent \dimen2
6541 %
6542 % Put the type name to the right margin.
6543 \noindent
6544 \hbox to 0pt{%
6545 \hfil\box0 \kern-\hsize
6546 % \hsize has to be shortened this way:
6547 \kern\leftskip
6548 % Intentionally do not respect \rightskip, since we need the space.
6549 }%
6550 %
6551 % Allow all lines to be underfull without complaint:
6552 \tolerance=10000 \hbadness=10000
6553 \exdentamount=\defbodyindent
6554 {%
6555 % defun fonts. We use typewriter by default (used to be bold) because:
6556 % . we're printing identifiers, they should be in tt in principle.
6557 % . in languages with many accents, such as Czech or French, it's
6558 % common to leave accents off identifiers. The result looks ok in
6559 % tt, but exceedingly strange in rm.
6560 % . we don't want -- and --- to be treated as ligatures.
6561 % . this still does not fix the ?` and !` ligatures, but so far no
6562 % one has made identifiers using them :).
6563 \df \tt
6564 \def\temp{#2}% return value type
6565 \ifx\temp\empty\else \tclose{\temp} \fi
6566 #3% output function name
6567 }%
6568 {\rm\enskip}% hskip 0.5 em of \tenrm
6569 %
6570 \boldbrax
6571 % arguments will be output next, if any.
6572 }
6573
6574 % Print arguments in slanted roman (not ttsl), inconsistently with using
6575 % tt for the name. This is because literal text is sometimes needed in
6576 % the argument list (groff manual), and ttsl and tt are not very
6577 % distinguishable. Prevent hyphenation at `-' chars.
6578 %
6579 \def\defunargs#1{%
6580 % use sl by default (not ttsl),
6581 % tt for the names.
6582 \df \sl \hyphenchar\font=0
6583 %
6584 % On the other hand, if an argument has two dashes (for instance), we
6585 % want a way to get ttsl. Let's try @var for that.
6586 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
6587 #1%
6588 \sl\hyphenchar\font=45
6589 }
6590
6591 % We want ()&[] to print specially on the defun line.
6592 %
6593 \def\activeparens{%
6594 \catcode`\(=\active \catcode`\)=\active
6595 \catcode`\[=\active \catcode`\]=\active
6596 \catcode`\&=\active
6597 }
6598
6599 % Make control sequences which act like normal parenthesis chars.
6600 \let\lparen = ( \let\rparen = )
6601
6602 % Be sure that we always have a definition for `(', etc. For example,
6603 % if the fn name has parens in it, \boldbrax will not be in effect yet,
6604 % so TeX would otherwise complain about undefined control sequence.
6605 {
6606 \activeparens
6607 \global\let(=\lparen \global\let)=\rparen
6608 \global\let[=\lbrack \global\let]=\rbrack
6609 \global\let& = \&
6610
6611 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
6612 \gdef\magicamp{\let&=\amprm}
6613 }
6614
6615 \newcount\parencount
6616
6617 % If we encounter &foo, then turn on ()-hacking afterwards
6618 \newif\ifampseen
6619 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
6620
6621 \def\parenfont{%
6622 \ifampseen
6623 % At the first level, print parens in roman,
6624 % otherwise use the default font.
6625 \ifnum \parencount=1 \rm \fi
6626 \else
6627 % The \sf parens (in \boldbrax) actually are a little bolder than
6628 % the contained text. This is especially needed for [ and ] .
6629 \sf
6630 \fi
6631 }
6632 \def\infirstlevel#1{%
6633 \ifampseen
6634 \ifnum\parencount=1
6635 #1%
6636 \fi
6637 \fi
6638 }
6639 \def\bfafterword#1 {#1 \bf}
6640
6641 \def\opnr{%
6642 \global\advance\parencount by 1
6643 {\parenfont(}%
6644 \infirstlevel \bfafterword
6645 }
6646 \def\clnr{%
6647 {\parenfont)}%
6648 \infirstlevel \sl
6649 \global\advance\parencount by -1
6650 }
6651
6652 \newcount\brackcount
6653 \def\lbrb{%
6654 \global\advance\brackcount by 1
6655 {\bf[}%
6656 }
6657 \def\rbrb{%
6658 {\bf]}%
6659 \global\advance\brackcount by -1
6660 }
6661
6662 \def\checkparencounts{%
6663 \ifnum\parencount=0 \else \badparencount \fi
6664 \ifnum\brackcount=0 \else \badbrackcount \fi
6665 }
6666 % these should not use \errmessage; the glibc manual, at least, actually
6667 % has such constructs (when documenting function pointers).
6668 \def\badparencount{%
6669 \message{Warning: unbalanced parentheses in @def...}%
6670 \global\parencount=0
6671 }
6672 \def\badbrackcount{%
6673 \message{Warning: unbalanced square brackets in @def...}%
6674 \global\brackcount=0
6675 }
6676
6677
6678 \message{macros,}
6679 % @macro.
6680
6681 % To do this right we need a feature of e-TeX, \scantokens,
6682 % which we arrange to emulate with a temporary file in ordinary TeX.
6683 \ifx\eTeXversion\undefined
6684 \newwrite\macscribble
6685 \def\scantokens#1{%
6686 \toks0={#1}%
6687 \immediate\openout\macscribble=\jobname.tmp
6688 \immediate\write\macscribble{\the\toks0}%
6689 \immediate\closeout\macscribble
6690 \input \jobname.tmp
6691 }
6692 \fi
6693
6694 \def\scanmacro#1{%
6695 \begingroup
6696 \newlinechar`\^^M
6697 \let\xeatspaces\eatspaces
6698 % Undo catcode changes of \startcontents and \doprintindex
6699 % When called from @insertcopying or (short)caption, we need active
6700 % backslash to get it printed correctly. Previously, we had
6701 % \catcode`\\=\other instead. We'll see whether a problem appears
6702 % with macro expansion. --kasal, 19aug04
6703 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
6704 % ... and \example
6705 \spaceisspace
6706 %
6707 % Append \endinput to make sure that TeX does not see the ending newline.
6708 % I've verified that it is necessary both for e-TeX and for ordinary TeX
6709 % --kasal, 29nov03
6710 \scantokens{#1\endinput}%
6711 \endgroup
6712 }
6713
6714 \def\scanexp#1{%
6715 \edef\temp{\noexpand\scanmacro{#1}}%
6716 \temp
6717 }
6718
6719 \newcount\paramno % Count of parameters
6720 \newtoks\macname % Macro name
6721 \newif\ifrecursive % Is it recursive?
6722
6723 % List of all defined macros in the form
6724 % \definedummyword\macro1\definedummyword\macro2...
6725 % Currently is also contains all @aliases; the list can be split
6726 % if there is a need.
6727 \def\macrolist{}
6728
6729 % Add the macro to \macrolist
6730 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
6731 \def\addtomacrolistxxx#1{%
6732 \toks0 = \expandafter{\macrolist\definedummyword#1}%
6733 \xdef\macrolist{\the\toks0}%
6734 }
6735
6736 % Utility routines.
6737 % This does \let #1 = #2, with \csnames; that is,
6738 % \let \csname#1\endcsname = \csname#2\endcsname
6739 % (except of course we have to play expansion games).
6740 %
6741 \def\cslet#1#2{%
6742 \expandafter\let
6743 \csname#1\expandafter\endcsname
6744 \csname#2\endcsname
6745 }
6746
6747 % Trim leading and trailing spaces off a string.
6748 % Concepts from aro-bend problem 15 (see CTAN).
6749 {\catcode`\@=11
6750 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
6751 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
6752 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
6753 \def\unbrace#1{#1}
6754 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
6755 }
6756
6757 % Trim a single trailing ^^M off a string.
6758 {\catcode`\^^M=\other \catcode`\Q=3%
6759 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
6760 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
6761 \gdef\eatcrb#1Q#2Q{#1}%
6762 }
6763
6764 % Macro bodies are absorbed as an argument in a context where
6765 % all characters are catcode 10, 11 or 12, except \ which is active
6766 % (as in normal texinfo). It is necessary to change the definition of \.
6767
6768 % Non-ASCII encodings make 8-bit characters active, so un-activate
6769 % them to avoid their expansion. Must do this non-globally, to
6770 % confine the change to the current group.
6771
6772 % It's necessary to have hard CRs when the macro is executed. This is
6773 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
6774 % body, and then making it the \newlinechar in \scanmacro.
6775
6776 \def\scanctxt{%
6777 \catcode`\"=\other
6778 \catcode`\+=\other
6779 \catcode`\<=\other
6780 \catcode`\>=\other
6781 \catcode`\@=\other
6782 \catcode`\^=\other
6783 \catcode`\_=\other
6784 \catcode`\|=\other
6785 \catcode`\~=\other
6786 \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
6787 }
6788
6789 \def\scanargctxt{%
6790 \scanctxt
6791 \catcode`\\=\other
6792 \catcode`\^^M=\other
6793 }
6794
6795 \def\macrobodyctxt{%
6796 \scanctxt
6797 \catcode`\{=\other
6798 \catcode`\}=\other
6799 \catcode`\^^M=\other
6800 \usembodybackslash
6801 }
6802
6803 \def\macroargctxt{%
6804 \scanctxt
6805 \catcode`\\=\other
6806 }
6807
6808 % \mbodybackslash is the definition of \ in @macro bodies.
6809 % It maps \foo\ => \csname macarg.foo\endcsname => #N
6810 % where N is the macro parameter number.
6811 % We define \csname macarg.\endcsname to be \realbackslash, so
6812 % \\ in macro replacement text gets you a backslash.
6813
6814 {\catcode`@=0 @catcode`@\=@active
6815 @gdef@usembodybackslash{@let\=@mbodybackslash}
6816 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
6817 }
6818 \expandafter\def\csname macarg.\endcsname{\realbackslash}
6819
6820 \def\macro{\recursivefalse\parsearg\macroxxx}
6821 \def\rmacro{\recursivetrue\parsearg\macroxxx}
6822
6823 \def\macroxxx#1{%
6824 \getargs{#1}% now \macname is the macname and \argl the arglist
6825 \ifx\argl\empty % no arguments
6826 \paramno=0%
6827 \else
6828 \expandafter\parsemargdef \argl;%
6829 \fi
6830 \if1\csname ismacro.\the\macname\endcsname
6831 \message{Warning: redefining \the\macname}%
6832 \else
6833 \expandafter\ifx\csname \the\macname\endcsname \relax
6834 \else \errmessage{Macro name \the\macname\space already defined}\fi
6835 \global\cslet{macsave.\the\macname}{\the\macname}%
6836 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
6837 \addtomacrolist{\the\macname}%
6838 \fi
6839 \begingroup \macrobodyctxt
6840 \ifrecursive \expandafter\parsermacbody
6841 \else \expandafter\parsemacbody
6842 \fi}
6843
6844 \parseargdef\unmacro{%
6845 \if1\csname ismacro.#1\endcsname
6846 \global\cslet{#1}{macsave.#1}%
6847 \global\expandafter\let \csname ismacro.#1\endcsname=0%
6848 % Remove the macro name from \macrolist:
6849 \begingroup
6850 \expandafter\let\csname#1\endcsname \relax
6851 \let\definedummyword\unmacrodo
6852 \xdef\macrolist{\macrolist}%
6853 \endgroup
6854 \else
6855 \errmessage{Macro #1 not defined}%
6856 \fi
6857 }
6858
6859 % Called by \do from \dounmacro on each macro. The idea is to omit any
6860 % macro definitions that have been changed to \relax.
6861 %
6862 \def\unmacrodo#1{%
6863 \ifx #1\relax
6864 % remove this
6865 \else
6866 \noexpand\definedummyword \noexpand#1%
6867 \fi
6868 }
6869
6870 % This makes use of the obscure feature that if the last token of a
6871 % <parameter list> is #, then the preceding argument is delimited by
6872 % an opening brace, and that opening brace is not consumed.
6873 \def\getargs#1{\getargsxxx#1{}}
6874 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
6875 \def\getmacname #1 #2\relax{\macname={#1}}
6876 \def\getmacargs#1{\def\argl{#1}}
6877
6878 % Parse the optional {params} list. Set up \paramno and \paramlist
6879 % so \defmacro knows what to do. Define \macarg.blah for each blah
6880 % in the params list, to be ##N where N is the position in that list.
6881 % That gets used by \mbodybackslash (above).
6882
6883 % We need to get `macro parameter char #' into several definitions.
6884 % The technique used is stolen from LaTeX: let \hash be something
6885 % unexpandable, insert that wherever you need a #, and then redefine
6886 % it to # just before using the token list produced.
6887 %
6888 % The same technique is used to protect \eatspaces till just before
6889 % the macro is used.
6890
6891 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
6892 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
6893 \def\parsemargdefxxx#1,{%
6894 \if#1;\let\next=\relax
6895 \else \let\next=\parsemargdefxxx
6896 \advance\paramno by 1%
6897 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
6898 {\xeatspaces{\hash\the\paramno}}%
6899 \edef\paramlist{\paramlist\hash\the\paramno,}%
6900 \fi\next}
6901
6902 % These two commands read recursive and nonrecursive macro bodies.
6903 % (They're different since rec and nonrec macros end differently.)
6904
6905 \long\def\parsemacbody#1@end macro%
6906 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
6907 \long\def\parsermacbody#1@end rmacro%
6908 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
6909
6910 % This defines the macro itself. There are six cases: recursive and
6911 % nonrecursive macros of zero, one, and many arguments.
6912 % Much magic with \expandafter here.
6913 % \xdef is used so that macro definitions will survive the file
6914 % they're defined in; @include reads the file inside a group.
6915 \def\defmacro{%
6916 \let\hash=##% convert placeholders to macro parameter chars
6917 \ifrecursive
6918 \ifcase\paramno
6919 % 0
6920 \expandafter\xdef\csname\the\macname\endcsname{%
6921 \noexpand\scanmacro{\temp}}%
6922 \or % 1
6923 \expandafter\xdef\csname\the\macname\endcsname{%
6924 \bgroup\noexpand\macroargctxt
6925 \noexpand\braceorline
6926 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
6927 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
6928 \egroup\noexpand\scanmacro{\temp}}%
6929 \else % many
6930 \expandafter\xdef\csname\the\macname\endcsname{%
6931 \bgroup\noexpand\macroargctxt
6932 \noexpand\csname\the\macname xx\endcsname}%
6933 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
6934 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
6935 \expandafter\expandafter
6936 \expandafter\xdef
6937 \expandafter\expandafter
6938 \csname\the\macname xxx\endcsname
6939 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
6940 \fi
6941 \else
6942 \ifcase\paramno
6943 % 0
6944 \expandafter\xdef\csname\the\macname\endcsname{%
6945 \noexpand\norecurse{\the\macname}%
6946 \noexpand\scanmacro{\temp}\egroup}%
6947 \or % 1
6948 \expandafter\xdef\csname\the\macname\endcsname{%
6949 \bgroup\noexpand\macroargctxt
6950 \noexpand\braceorline
6951 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
6952 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
6953 \egroup
6954 \noexpand\norecurse{\the\macname}%
6955 \noexpand\scanmacro{\temp}\egroup}%
6956 \else % many
6957 \expandafter\xdef\csname\the\macname\endcsname{%
6958 \bgroup\noexpand\macroargctxt
6959 \expandafter\noexpand\csname\the\macname xx\endcsname}%
6960 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
6961 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
6962 \expandafter\expandafter
6963 \expandafter\xdef
6964 \expandafter\expandafter
6965 \csname\the\macname xxx\endcsname
6966 \paramlist{%
6967 \egroup
6968 \noexpand\norecurse{\the\macname}%
6969 \noexpand\scanmacro{\temp}\egroup}%
6970 \fi
6971 \fi}
6972
6973 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
6974
6975 % \braceorline decides whether the next nonwhitespace character is a
6976 % {. If so it reads up to the closing }, if not, it reads the whole
6977 % line. Whatever was read is then fed to the next control sequence
6978 % as an argument (by \parsebrace or \parsearg)
6979 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
6980 \def\braceorlinexxx{%
6981 \ifx\nchar\bgroup\else
6982 \expandafter\parsearg
6983 \fi \macnamexxx}
6984
6985
6986 % @alias.
6987 % We need some trickery to remove the optional spaces around the equal
6988 % sign. Just make them active and then expand them all to nothing.
6989 \def\alias{\parseargusing\obeyspaces\aliasxxx}
6990 \def\aliasxxx #1{\aliasyyy#1\relax}
6991 \def\aliasyyy #1=#2\relax{%
6992 {%
6993 \expandafter\let\obeyedspace=\empty
6994 \addtomacrolist{#1}%
6995 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
6996 }%
6997 \next
6998 }
6999
7000
7001 \message{cross references,}
7002
7003 \newwrite\auxfile
7004 \newif\ifhavexrefs % True if xref values are known.
7005 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
7006
7007 % @inforef is relatively simple.
7008 \def\inforef #1{\inforefzzz #1,,,,**}
7009 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{ \ignorespaces #3{}},
7010 node \samp{\ignorespaces#1{}}}
7011
7012 % @node's only job in TeX is to define \lastnode, which is used in
7013 % cross-references. The @node line might or might not have commas, and
7014 % might or might not have spaces before the first comma, like:
7015 % @node foo , bar , ...
7016 % We don't want such trailing spaces in the node name.
7017 %
7018 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
7019 %
7020 % also remove a trailing comma, in case of something like this:
7021 % @node Help-Cross, , , Cross-refs
7022 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
7023 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
7024
7025 \let\nwnode=\node
7026 \let\lastnode=\empty
7027
7028 % Write a cross-reference definition for the current node. #1 is the
7029 % type (Ynumbered, Yappendix, Ynothing).
7030 %
7031 \def\donoderef#1{%
7032 \ifx\lastnode\empty\else
7033 \setref{\lastnode}{#1}%
7034 \global\let\lastnode=\empty
7035 \fi
7036 }
7037
7038 % @anchor{NAME} -- define xref target at arbitrary point.
7039 %
7040 \newcount\savesfregister
7041 %
7042 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
7043 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
7044 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
7045
7046 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
7047 % anchor), which consists of three parts:
7048 % 1) NAME-title - the current sectioning name taken from \lastsection,
7049 % or the anchor name.
7050 % 2) NAME-snt - section number and type, passed as the SNT arg, or
7051 % empty for anchors.
7052 % 3) NAME-pg - the page number.
7053 %
7054 % This is called from \donoderef, \anchor, and \dofloat. In the case of
7055 % floats, there is an additional part, which is not written here:
7056 % 4) NAME-lof - the text as it should appear in a @listoffloats.
7057 %
7058 \def\setref#1#2{%
7059 \pdfmkdest{#1}%
7060 \iflinks
7061 {%
7062 \atdummies % preserve commands, but don't expand them
7063 \edef\writexrdef##1##2{%
7064 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
7065 ##1}{##2}}% these are parameters of \writexrdef
7066 }%
7067 \toks0 = \expandafter{\lastsection}%
7068 \immediate \writexrdef{title}{\the\toks0 }%
7069 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
7070 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \ship out
7071 }%
7072 \fi
7073 }
7074
7075 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
7076 % the node name, #2 the name of the Info cross-reference, #3 the printed
7077 % node name, #4 the name of the Info file, #5 the name of the printed
7078 % manual. All but the node name can be omitted.
7079 %
7080 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
7081 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
7082 \def\ref#1{\xrefX[#1,,,,,,,]}
7083 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
7084 \unsepspaces
7085 \def\printedmanual{\ignorespaces #5}%
7086 \def\printedrefname{\ignorespaces #3}%
7087 \setbox1=\hbox{\printedmanual\unskip}%
7088 \setbox0=\hbox{\printedrefname\unskip}%
7089 \ifdim \wd0 = 0pt
7090 % No printed node name was explicitly given.
7091 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
7092 % Use the node name inside the square brackets.
7093 \def\printedrefname{\ignorespaces #1}%
7094 \else
7095 % Use the actual chapter/section title appear inside
7096 % the square brackets. Use the real section title if we have it.
7097 \ifdim \wd1 > 0pt
7098 % It is in another manual, so we don't have it.
7099 \def\printedrefname{\ignorespaces #1}%
7100 \else
7101 \ifhavexrefs
7102 % We know the real title if we have the xref values.
7103 \def\printedrefname{\refx{#1-title}{}}%
7104 \else
7105 % Otherwise just copy the Info node name.
7106 \def\printedrefname{\ignorespaces #1}%
7107 \fi%
7108 \fi
7109 \fi
7110 \fi
7111 %
7112 % Make link in pdf output.
7113 \ifpdf
7114 {\indexnofonts
7115 \turnoffactive
7116 % This expands tokens, so do it after making catcode changes, so _
7117 % etc. don't get their TeX definitions.
7118 \getfilename{#4}%
7119 %
7120 % See comments at \activebackslashdouble.
7121 {\activebackslashdouble \xdef\pdfxrefdest{#1}%
7122 \backslashparens\pdfxrefdest}%
7123 %
7124 \leavevmode
7125 \startlink attr{/Border [0 0 0]}%
7126 \ifnum\filenamelength>0
7127 goto file{\the\filename.pdf} name{\pdfxrefdest}%
7128 \else
7129 goto name{\pdfmkpgn{\pdfxrefdest}}%
7130 \fi
7131 }%
7132 \setcolor{\linkcolor}%
7133 \fi
7134 %
7135 % Float references are printed completely differently: "Figure 1.2"
7136 % instead of "[somenode], p.3". We distinguish them by the
7137 % LABEL-title being set to a magic string.
7138 {%
7139 % Have to otherify everything special to allow the \csname to
7140 % include an _ in the xref name, etc.
7141 \indexnofonts
7142 \turnoffactive
7143 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
7144 \csname XR#1-title\endcsname
7145 }%
7146 \iffloat\Xthisreftitle
7147 % If the user specified the print name (third arg) to the ref,
7148 % print it instead of our usual "Figure 1.2".
7149 \ifdim\wd0 = 0pt
7150 \refx{#1-snt}{}%
7151 \else
7152 \printedrefname
7153 \fi
7154 %
7155 % if the user also gave the printed manual name (fifth arg), append
7156 % "in MANUALNAME".
7157 \ifdim \wd1 > 0pt
7158 \space \putwordin{} \cite{\printedmanual}%
7159 \fi
7160 \else
7161 % node/anchor (non-float) references.
7162 %
7163 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
7164 % insert empty discretionaries after hyphens, which means that it will
7165 % not find a line break at a hyphen in a node names. Since some manuals
7166 % are best written with fairly long node names, containing hyphens, this
7167 % is a loss. Therefore, we give the text of the node name again, so it
7168 % is as if TeX is seeing it for the first time.
7169 \ifdim \wd1 > 0pt
7170 \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
7171 \else
7172 % _ (for example) has to be the character _ for the purposes of the
7173 % control sequence corresponding to the node, but it has to expand
7174 % into the usual \leavevmode...\vrule stuff for purposes of
7175 % printing. So we \turnoffactive for the \refx-snt, back on for the
7176 % printing, back off for the \refx-pg.
7177 {\turnoffactive
7178 % Only output a following space if the -snt ref is nonempty; for
7179 % @unnumbered and @anchor, it won't be.
7180 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
7181 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
7182 }%
7183 % output the `[mynode]' via a macro so it can be overridden.
7184 \xrefprintnodename\printedrefname
7185 %
7186 % But we always want a comma and a space:
7187 ,\space
7188 %
7189 % output the `page 3'.
7190 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
7191 \fi
7192 \fi
7193 \endlink
7194 \endgroup}
7195
7196 % This macro is called from \xrefX for the `[nodename]' part of xref
7197 % output. It's a separate macro only so it can be changed more easily,
7198 % since square brackets don't work well in some documents. Particularly
7199 % one that Bob is working on :).
7200 %
7201 \def\xrefprintnodename#1{[#1]}
7202
7203 % Things referred to by \setref.
7204 %
7205 \def\Ynothing{}
7206 \def\Yomitfromtoc{}
7207 \def\Ynumbered{%
7208 \ifnum\secno=0
7209 \putwordChapter@tie \the\chapno
7210 \else \ifnum\subsecno=0
7211 \putwordSection@tie \the\chapno.\the\secno
7212 \else \ifnum\subsubsecno=0
7213 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
7214 \else
7215 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
7216 \fi\fi\fi
7217 }
7218 \def\Yappendix{%
7219 \ifnum\secno=0
7220 \putwordAppendix@tie @char\the\appendixno{}%
7221 \else \ifnum\subsecno=0
7222 \putwordSection@tie @char\the\appendixno.\the\secno
7223 \else \ifnum\subsubsecno=0
7224 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
7225 \else
7226 \putwordSection@tie
7227 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
7228 \fi\fi\fi
7229 }
7230
7231 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
7232 % If its value is nonempty, SUFFIX is output afterward.
7233 %
7234 \def\refx#1#2{%
7235 {%
7236 \indexnofonts
7237 \otherbackslash
7238 \expandafter\global\expandafter\let\expandafter\thisrefX
7239 \csname XR#1\endcsname
7240 }%
7241 \ifx\thisrefX\relax
7242 % If not defined, say something at least.
7243 \angleleft un\-de\-fined\angleright
7244 \iflinks
7245 \ifhavexrefs
7246 \message{\linenumber Undefined cross reference `#1'.}%
7247 \else
7248 \ifwarnedxrefs\else
7249 \global\warnedxrefstrue
7250 \message{Cross reference values unknown; you must run TeX again.}%
7251 \fi
7252 \fi
7253 \fi
7254 \else
7255 % It's defined, so just use it.
7256 \thisrefX
7257 \fi
7258 #2% Output the suffix in any case.
7259 }
7260
7261 % This is the macro invoked by entries in the aux file. Usually it's
7262 % just a \def (we prepend XR to the control sequence name to avoid
7263 % collisions). But if this is a float type, we have more work to do.
7264 %
7265 \def\xrdef#1#2{%
7266 {% The node name might contain 8-bit characters, which in our current
7267 % implementation are changed to commands like @'e. Don't let these
7268 % mess up the control sequence name.
7269 \indexnofonts
7270 \turnoffactive
7271 \xdef\safexrefname{#1}%
7272 }%
7273 %
7274 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
7275 %
7276 % Was that xref control sequence that we just defined for a float?
7277 \expandafter\iffloat\csname XR\safexrefname\endcsname
7278 % it was a float, and we have the (safe) float type in \iffloattype.
7279 \expandafter\let\expandafter\floatlist
7280 \csname floatlist\iffloattype\endcsname
7281 %
7282 % Is this the first time we've seen this float type?
7283 \expandafter\ifx\floatlist\relax
7284 \toks0 = {\do}% yes, so just \do
7285 \else
7286 % had it before, so preserve previous elements in list.
7287 \toks0 = \expandafter{\floatlist\do}%
7288 \fi
7289 %
7290 % Remember this xref in the control sequence \floatlistFLOATTYPE,
7291 % for later use in \listoffloats.
7292 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
7293 {\safexrefname}}%
7294 \fi
7295 }
7296
7297 % Read the last existing aux file, if any. No error if none exists.
7298 %
7299 \def\tryauxfile{%
7300 \openin 1 \jobname.aux
7301 \ifeof 1 \else
7302 \readdatafile{aux}%
7303 \global\havexrefstrue
7304 \fi
7305 \closein 1
7306 }
7307
7308 \def\setupdatafile{%
7309 \catcode`\^^@=\other
7310 \catcode`\^^A=\other
7311 \catcode`\^^B=\other
7312 \catcode`\^^C=\other
7313 \catcode`\^^D=\other
7314 \catcode`\^^E=\other
7315 \catcode`\^^F=\other
7316 \catcode`\^^G=\other
7317 \catcode`\^^H=\other
7318 \catcode`\^^K=\other
7319 \catcode`\^^L=\other
7320 \catcode`\^^N=\other
7321 \catcode`\^^P=\other
7322 \catcode`\^^Q=\other
7323 \catcode`\^^R=\other
7324 \catcode`\^^S=\other
7325 \catcode`\^^T=\other
7326 \catcode`\^^U=\other
7327 \catcode`\^^V=\other
7328 \catcode`\^^W=\other
7329 \catcode`\^^X=\other
7330 \catcode`\^^Z=\other
7331 \catcode`\^^[=\other
7332 \catcode`\^^\=\other
7333 \catcode`\^^]=\other
7334 \catcode`\^^^=\other
7335 \catcode`\^^_=\other
7336 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
7337 % in xref tags, i.e., node names. But since ^^e4 notation isn't
7338 % supported in the main text, it doesn't seem desirable. Furthermore,
7339 % that is not enough: for node names that actually contain a ^
7340 % character, we would end up writing a line like this: 'xrdef {'hat
7341 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
7342 % argument, and \hat is not an expandable control sequence. It could
7343 % all be worked out, but why? Either we support ^^ or we don't.
7344 %
7345 % The other change necessary for this was to define \auxhat:
7346 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
7347 % and then to call \auxhat in \setq.
7348 %
7349 \catcode`\^=\other
7350 %
7351 % Special characters. Should be turned off anyway, but...
7352 \catcode`\~=\other
7353 \catcode`\[=\other
7354 \catcode`\]=\other
7355 \catcode`\"=\other
7356 \catcode`\_=\other
7357 \catcode`\|=\other
7358 \catcode`\<=\other
7359 \catcode`\>=\other
7360 \catcode`\$=\other
7361 \catcode`\#=\other
7362 \catcode`\&=\other
7363 \catcode`\%=\other
7364 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
7365 %
7366 % This is to support \ in node names and titles, since the \
7367 % characters end up in a \csname. It's easier than
7368 % leaving it active and making its active definition an actual \
7369 % character. What I don't understand is why it works in the *value*
7370 % of the xrdef. Seems like it should be a catcode12 \, and that
7371 % should not typeset properly. But it works, so I'm moving on for
7372 % now. --karl, 15jan04.
7373 \catcode`\\=\other
7374 %
7375 % Make the characters 128-255 be printing characters.
7376 {%
7377 \count1=128
7378 \def\loop{%
7379 \catcode\count1=\other
7380 \advance\count1 by 1
7381 \ifnum \count1<256 \loop \fi
7382 }%
7383 }%
7384 %
7385 % @ is our escape character in .aux files, and we need braces.
7386 \catcode`\{=1
7387 \catcode`\}=2
7388 \catcode`\@=0
7389 }
7390
7391 \def\readdatafile#1{%
7392 \begingroup
7393 \setupdatafile
7394 \input\jobname.#1
7395 \endgroup}
7396
7397
7398 \message{insertions,}
7399 % including footnotes.
7400
7401 \newcount \footnoteno
7402
7403 % The trailing space in the following definition for supereject is
7404 % vital for proper filling; pages come out unaligned when you do a
7405 % pagealignmacro call if that space before the closing brace is
7406 % removed. (Generally, numeric constants should always be followed by a
7407 % space to prevent strange expansion errors.)
7408 \def\supereject{\par\penalty -20000\footnoteno =0 }
7409
7410 % @footnotestyle is meaningful for info output only.
7411 \let\footnotestyle=\comment
7412
7413 {\catcode `\@=11
7414 %
7415 % Auto-number footnotes. Otherwise like plain.
7416 \gdef\footnote{%
7417 \let\indent=\ptexindent
7418 \let\noindent=\ptexnoindent
7419 \global\advance\footnoteno by \@ne
7420 \edef\thisfootno{$^{\the\footnoteno}$}%
7421 %
7422 % In case the footnote comes at the end of a sentence, preserve the
7423 % extra spacing after we do the footnote number.
7424 \let\@sf\empty
7425 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
7426 %
7427 % Remove inadvertent blank space before typesetting the footnote number.
7428 \unskip
7429 \thisfootno\@sf
7430 \dofootnote
7431 }%
7432
7433 % Don't bother with the trickery in plain.tex to not require the
7434 % footnote text as a parameter. Our footnotes don't need to be so general.
7435 %
7436 % Oh yes, they do; otherwise, @ifset (and anything else that uses
7437 % \parseargline) fails inside footnotes because the tokens are fixed when
7438 % the footnote is read. --karl, 16nov96.
7439 %
7440 \gdef\dofootnote{%
7441 \insert\footins\bgroup
7442 % We want to typeset this text as a normal paragraph, even if the
7443 % footnote reference occurs in (for example) a display environment.
7444 % So reset some parameters.
7445 \hsize=\pagewidth
7446 \interlinepenalty\interfootnotelinepenalty
7447 \splittopskip\ht\strutbox % top baseline for broken footnotes
7448 \splitmaxdepth\dp\strutbox
7449 \floatingpenalty\@MM
7450 \leftskip\z@skip
7451 \rightskip\z@skip
7452 \spaceskip\z@skip
7453 \xspaceskip\z@skip
7454 \parindent\defaultparindent
7455 %
7456 \smallfonts \rm
7457 %
7458 % Because we use hanging indentation in footnotes, a @noindent appears
7459 % to exdent this text, so make it be a no-op. makeinfo does not use
7460 % hanging indentation so @noindent can still be needed within footnote
7461 % text after an @example or the like (not that this is good style).
7462 \let\noindent = \relax
7463 %
7464 % Hang the footnote text off the number. Use \everypar in case the
7465 % footnote extends for more than one paragraph.
7466 \everypar = {\hang}%
7467 \textindent{\thisfootno}%
7468 %
7469 % Don't crash into the line above the footnote text. Since this
7470 % expands into a box, it must come within the paragraph, lest it
7471 % provide a place where TeX can split the footnote.
7472 \footstrut
7473 \futurelet\next\fo@t
7474 }
7475 }%end \catcode `\@=11
7476
7477 % In case a @footnote appears in a vbox, save the footnote text and create
7478 % the real \insert just after the vbox finished. Otherwise, the insertion
7479 % would be lost.
7480 % Similarly, if a @footnote appears inside an alignment, save the footnote
7481 % text to a box and make the \insert when a row of the table is finished.
7482 % And the same can be done for other insert classes. --kasal, 16nov03.
7483
7484 % Replace the \insert primitive by a cheating macro.
7485 % Deeper inside, just make sure that the saved insertions are not spilled
7486 % out prematurely.
7487 %
7488 \def\startsavinginserts{%
7489 \ifx \insert\ptexinsert
7490 \let\insert\saveinsert
7491 \else
7492 \let\checkinserts\relax
7493 \fi
7494 }
7495
7496 % This \insert replacement works for both \insert\footins{foo} and
7497 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
7498 %
7499 \def\saveinsert#1{%
7500 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
7501 \afterassignment\next
7502 % swallow the left brace
7503 \let\temp =
7504 }
7505 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
7506 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
7507
7508 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
7509
7510 \def\placesaveins#1{%
7511 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
7512 {\box#1}%
7513 }
7514
7515 % eat @SAVE -- beware, all of them have catcode \other:
7516 {
7517 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
7518 \gdef\gobblesave @SAVE{}
7519 }
7520
7521 % initialization:
7522 \def\newsaveins #1{%
7523 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
7524 \next
7525 }
7526 \def\newsaveinsX #1{%
7527 \csname newbox\endcsname #1%
7528 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
7529 \checksaveins #1}%
7530 }
7531
7532 % initialize:
7533 \let\checkinserts\empty
7534 \newsaveins\footins
7535 \newsaveins\margin
7536
7537
7538 % @image. We use the macros from epsf.tex to support this.
7539 % If epsf.tex is not installed and @image is used, we complain.
7540 %
7541 % Check for and read epsf.tex up front. If we read it only at @image
7542 % time, we might be inside a group, and then its definitions would get
7543 % undone and the next image would fail.
7544 \openin 1 = epsf.tex
7545 \ifeof 1 \else
7546 % Do not bother showing banner with epsf.tex v2.7k (available in
7547 % doc/epsf.tex and on ctan).
7548 \def\epsfannounce{\toks0 = }%
7549 \input epsf.tex
7550 \fi
7551 \closein 1
7552 %
7553 % We will only complain once about lack of epsf.tex.
7554 \newif\ifwarnednoepsf
7555 \newhelp\noepsfhelp{epsf.tex must be installed for images to
7556 work. It is also included in the Texinfo distribution, or you can get
7557 it from ftp://tug.org/tex/epsf.tex.}
7558 %
7559 \def\image#1{%
7560 \ifx\epsfbox\undefined
7561 \ifwarnednoepsf \else
7562 \errhelp = \noepsfhelp
7563 \errmessage{epsf.tex not found, images will be ignored}%
7564 \global\warnednoepsftrue
7565 \fi
7566 \else
7567 \imagexxx #1,,,,,\finish
7568 \fi
7569 }
7570 %
7571 % Arguments to @image:
7572 % #1 is (mandatory) image filename; we tack on .eps extension.
7573 % #2 is (optional) width, #3 is (optional) height.
7574 % #4 is (ignored optional) html alt text.
7575 % #5 is (ignored optional) extension.
7576 % #6 is just the usual extra ignored arg for parsing this stuff.
7577 \newif\ifimagevmode
7578 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
7579 \catcode`\^^M = 5 % in case we're inside an example
7580 \normalturnoffactive % allow _ et al. in names
7581 % If the image is by itself, center it.
7582 \ifvmode
7583 \imagevmodetrue
7584 \nobreak\medskip
7585 % Usually we'll have text after the image which will insert
7586 % \parskip glue, so insert it here too to equalize the space
7587 % above and below.
7588 \nobreak\vskip\parskip
7589 \nobreak
7590 \fi
7591 %
7592 % Leave vertical mode so that indentation from an enclosing
7593 % environment such as @quotation is respected. On the other hand, if
7594 % it's at the top level, we don't want the normal paragraph indentation.
7595 \noindent
7596 %
7597 % Output the image.
7598 \ifpdf
7599 \dopdfimage{#1}{#2}{#3}%
7600 \else
7601 % \epsfbox itself resets \epsf?size at each figure.
7602 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
7603 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
7604 \epsfbox{#1.eps}%
7605 \fi
7606 %
7607 \ifimagevmode \medskip \fi % space after the standalone image
7608 \endgroup}
7609
7610
7611 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
7612 % etc. We don't actually implement floating yet, we always include the
7613 % float "here". But it seemed the best name for the future.
7614 %
7615 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
7616
7617 % There may be a space before second and/or third parameter; delete it.
7618 \def\eatcommaspace#1, {#1,}
7619
7620 % #1 is the optional FLOATTYPE, the text label for this float, typically
7621 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
7622 % this float will not be numbered and cannot be referred to.
7623 %
7624 % #2 is the optional xref label. Also must be present for the float to
7625 % be referable.
7626 %
7627 % #3 is the optional positioning argument; for now, it is ignored. It
7628 % will somehow specify the positions allowed to float to (here, top, bottom).
7629 %
7630 % We keep a separate counter for each FLOATTYPE, which we reset at each
7631 % chapter-level command.
7632 \let\resetallfloatnos=\empty
7633 %
7634 \def\dofloat#1,#2,#3,#4\finish{%
7635 \let\thiscaption=\empty
7636 \let\thisshortcaption=\empty
7637 %
7638 % don't lose footnotes inside @float.
7639 %
7640 % BEWARE: when the floats start float, we have to issue warning whenever an
7641 % insert appears inside a float which could possibly float. --kasal, 26may04
7642 %
7643 \startsavinginserts
7644 %
7645 % We can't be used inside a paragraph.
7646 \par
7647 %
7648 \vtop\bgroup
7649 \def\floattype{#1}%
7650 \def\floatlabel{#2}%
7651 \def\floatloc{#3}% we do nothing with this yet.
7652 %
7653 \ifx\floattype\empty
7654 \let\safefloattype=\empty
7655 \else
7656 {%
7657 % the floattype might have accents or other special characters,
7658 % but we need to use it in a control sequence name.
7659 \indexnofonts
7660 \turnoffactive
7661 \xdef\safefloattype{\floattype}%
7662 }%
7663 \fi
7664 %
7665 % If label is given but no type, we handle that as the empty type.
7666 \ifx\floatlabel\empty \else
7667 % We want each FLOATTYPE to be numbered separately (Figure 1,
7668 % Table 1, Figure 2, ...). (And if no label, no number.)
7669 %
7670 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
7671 \global\advance\floatno by 1
7672 %
7673 {%
7674 % This magic value for \lastsection is output by \setref as the
7675 % XREFLABEL-title value. \xrefX uses it to distinguish float
7676 % labels (which have a completely different output format) from
7677 % node and anchor labels. And \xrdef uses it to construct the
7678 % lists of floats.
7679 %
7680 \edef\lastsection{\floatmagic=\safefloattype}%
7681 \setref{\floatlabel}{Yfloat}%
7682 }%
7683 \fi
7684 %
7685 % start with \parskip glue, I guess.
7686 \vskip\parskip
7687 %
7688 % Don't suppress indentation if a float happens to start a section.
7689 \restorefirstparagraphindent
7690 }
7691
7692 % we have these possibilities:
7693 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
7694 % @float Foo,lbl & no caption: Foo 1.1
7695 % @float Foo & @caption{Cap}: Foo: Cap
7696 % @float Foo & no caption: Foo
7697 % @float ,lbl & Caption{Cap}: 1.1: Cap
7698 % @float ,lbl & no caption: 1.1
7699 % @float & @caption{Cap}: Cap
7700 % @float & no caption:
7701 %
7702 \def\Efloat{%
7703 \let\floatident = \empty
7704 %
7705 % In all cases, if we have a float type, it comes first.
7706 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
7707 %
7708 % If we have an xref label, the number comes next.
7709 \ifx\floatlabel\empty \else
7710 \ifx\floattype\empty \else % if also had float type, need tie first.
7711 \appendtomacro\floatident{\tie}%
7712 \fi
7713 % the number.
7714 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
7715 \fi
7716 %
7717 % Start the printed caption with what we've constructed in
7718 % \floatident, but keep it separate; we need \floatident again.
7719 \let\captionline = \floatident
7720 %
7721 \ifx\thiscaption\empty \else
7722 \ifx\floatident\empty \else
7723 \appendtomacro\captionline{: }% had ident, so need a colon between
7724 \fi
7725 %
7726 % caption text.
7727 \appendtomacro\captionline{\scanexp\thiscaption}%
7728 \fi
7729 %
7730 % If we have anything to print, print it, with space before.
7731 % Eventually this needs to become an \insert.
7732 \ifx\captionline\empty \else
7733 \vskip.5\parskip
7734 \captionline
7735 %
7736 % Space below caption.
7737 \vskip\parskip
7738 \fi
7739 %
7740 % If have an xref label, write the list of floats info. Do this
7741 % after the caption, to avoid chance of it being a breakpoint.
7742 \ifx\floatlabel\empty \else
7743 % Write the text that goes in the lof to the aux file as
7744 % \floatlabel-lof. Besides \floatident, we include the short
7745 % caption if specified, else the full caption if specified, else nothing.
7746 {%
7747 \atdummies
7748 %
7749 % since we read the caption text in the macro world, where ^^M
7750 % is turned into a normal character, we have to scan it back, so
7751 % we don't write the literal three characters "^^M" into the aux file.
7752 \scanexp{%
7753 \xdef\noexpand\gtemp{%
7754 \ifx\thisshortcaption\empty
7755 \thiscaption
7756 \else
7757 \thisshortcaption
7758 \fi
7759 }%
7760 }%
7761 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
7762 \ifx\gtemp\empty \else : \gtemp \fi}}%
7763 }%
7764 \fi
7765 \egroup % end of \vtop
7766 %
7767 % place the captured inserts
7768 %
7769 % BEWARE: when the floats start floating, we have to issue warning
7770 % whenever an insert appears inside a float which could possibly
7771 % float. --kasal, 26may04
7772 %
7773 \checkinserts
7774 }
7775
7776 % Append the tokens #2 to the definition of macro #1, not expanding either.
7777 %
7778 \def\appendtomacro#1#2{%
7779 \expandafter\def\expandafter#1\expandafter{#1#2}%
7780 }
7781
7782 % @caption, @shortcaption
7783 %
7784 \def\caption{\docaption\thiscaption}
7785 \def\shortcaption{\docaption\thisshortcaption}
7786 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
7787 \def\defcaption#1#2{\egroup \def#1{#2}}
7788
7789 % The parameter is the control sequence identifying the counter we are
7790 % going to use. Create it if it doesn't exist and assign it to \floatno.
7791 \def\getfloatno#1{%
7792 \ifx#1\relax
7793 % Haven't seen this figure type before.
7794 \csname newcount\endcsname #1%
7795 %
7796 % Remember to reset this floatno at the next chap.
7797 \expandafter\gdef\expandafter\resetallfloatnos
7798 \expandafter{\resetallfloatnos #1=0 }%
7799 \fi
7800 \let\floatno#1%
7801 }
7802
7803 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
7804 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
7805 % first read the @float command.
7806 %
7807 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
7808
7809 % Magic string used for the XREFLABEL-title value, so \xrefX can
7810 % distinguish floats from other xref types.
7811 \def\floatmagic{!!float!!}
7812
7813 % #1 is the control sequence we are passed; we expand into a conditional
7814 % which is true if #1 represents a float ref. That is, the magic
7815 % \lastsection value which we \setref above.
7816 %
7817 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
7818 %
7819 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
7820 % (safe) float type for this float. We set \iffloattype to #2.
7821 %
7822 \def\doiffloat#1=#2=#3\finish{%
7823 \def\temp{#1}%
7824 \def\iffloattype{#2}%
7825 \ifx\temp\floatmagic
7826 }
7827
7828 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
7829 %
7830 \parseargdef\listoffloats{%
7831 \def\floattype{#1}% floattype
7832 {%
7833 % the floattype might have accents or other special characters,
7834 % but we need to use it in a control sequence name.
7835 \indexnofonts
7836 \turnoffactive
7837 \xdef\safefloattype{\floattype}%
7838 }%
7839 %
7840 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
7841 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
7842 \ifhavexrefs
7843 % if the user said @listoffloats foo but never @float foo.
7844 \message{\linenumber No `\safefloattype' floats to list.}%
7845 \fi
7846 \else
7847 \begingroup
7848 \leftskip=\tocindent % indent these entries like a toc
7849 \let\do=\listoffloatsdo
7850 \csname floatlist\safefloattype\endcsname
7851 \endgroup
7852 \fi
7853 }
7854
7855 % This is called on each entry in a list of floats. We're passed the
7856 % xref label, in the form LABEL-title, which is how we save it in the
7857 % aux file. We strip off the -title and look up \XRLABEL-lof, which
7858 % has the text we're supposed to typeset here.
7859 %
7860 % Figures without xref labels will not be included in the list (since
7861 % they won't appear in the aux file).
7862 %
7863 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
7864 \def\listoffloatsdoentry#1-title\finish{{%
7865 % Can't fully expand XR#1-lof because it can contain anything. Just
7866 % pass the control sequence. On the other hand, XR#1-pg is just the
7867 % page number, and we want to fully expand that so we can get a link
7868 % in pdf output.
7869 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
7870 %
7871 % use the same \entry macro we use to generate the TOC and index.
7872 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
7873 \writeentry
7874 }}
7875
7876
7877 \message{localization,}
7878
7879 % For single-language documents, @documentlanguage is usually given very
7880 % early, just after @documentencoding. Single argument is the language
7881 % (de) or locale (de_DE) abbreviation.
7882 %
7883 {
7884 \catcode`\_ = \active
7885 \globaldefs=1
7886 \parseargdef\documentlanguage{\begingroup
7887 \let_=\normalunderscore % normal _ character for filenames
7888 \tex % read txi-??.tex file in plain TeX.
7889 % Read the file by the name they passed if it exists.
7890 \openin 1 txi-#1.tex
7891 \ifeof 1
7892 \documentlanguagetrywithoutunderscore{#1_\finish}%
7893 \else
7894 \globaldefs = 1 % everything in the txi-LL files needs to persist
7895 \input txi-#1.tex
7896 \fi
7897 \closein 1
7898 \endgroup % end raw TeX
7899 \endgroup}
7900 }
7901 %
7902 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
7903 % try txi-de.tex.
7904 %
7905 \def\documentlanguagetrywithoutunderscore#1_#2\finish{%
7906 \openin 1 txi-#1.tex
7907 \ifeof 1
7908 \errhelp = \nolanghelp
7909 \errmessage{Cannot read language file txi-#1.tex}%
7910 \else
7911 \input txi-#1.tex
7912 \fi
7913 \closein 1
7914 }
7915 %
7916 \newhelp\nolanghelp{The given language definition file cannot be found or
7917 is empty. Maybe you need to install it? Putting it in the current
7918 directory should work if nowhere else does.}
7919
7920 % This macro is called from txi-??.tex files; the first argument is the
7921 % \language name to set (without the "\lang@" prefix), the second and
7922 % third args are \{left,right}hyphenmin.
7923 %
7924 % The language names to pass are determined when the format is built.
7925 % See the etex.log file created at that time, e.g.,
7926 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
7927 %
7928 % With TeX Live 2008, etex now includes hyphenation patterns for all
7929 % available languages. This means we can support hyphenation in
7930 % Texinfo, at least to some extent. (This still doesn't solve the
7931 % accented characters problem.)
7932 %
7933 \catcode`@=11
7934 \def\txisetlanguage#1#2#3{%
7935 % do not set the language if the name is undefined in the current TeX.
7936 \expandafter\ifx\csname lang@#1\endcsname \relax
7937 \message{no patterns for #1}%
7938 \else
7939 \global\language = \csname lang@#1\endcsname
7940 \fi
7941 % but there is no harm in adjusting the hyphenmin values regardless.
7942 \global\lefthyphenmin = #2\relax
7943 \global\righthyphenmin = #3\relax
7944 }
7945
7946 % Helpers for encodings.
7947 % Set the catcode of characters 128 through 255 to the specified number.
7948 %
7949 \def\setnonasciicharscatcode#1{%
7950 \count255=128
7951 \loop\ifnum\count255<256
7952 \global\catcode\count255=#1\relax
7953 \advance\count255 by 1
7954 \repeat
7955 }
7956
7957 \def\setnonasciicharscatcodenonglobal#1{%
7958 \count255=128
7959 \loop\ifnum\count255<256
7960 \catcode\count255=#1\relax
7961 \advance\count255 by 1
7962 \repeat
7963 }
7964
7965 % @documentencoding sets the definition of non-ASCII characters
7966 % according to the specified encoding.
7967 %
7968 \parseargdef\documentencoding{%
7969 % Encoding being declared for the document.
7970 \def\declaredencoding{\csname #1.enc\endcsname}%
7971 %
7972 % Supported encodings: names converted to tokens in order to be able
7973 % to compare them with \ifx.
7974 \def\ascii{\csname US-ASCII.enc\endcsname}%
7975 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
7976 \def\latone{\csname ISO-8859-1.enc\endcsname}%
7977 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
7978 \def\utfeight{\csname UTF-8.enc\endcsname}%
7979 %
7980 \ifx \declaredencoding \ascii
7981 \asciichardefs
7982 %
7983 \else \ifx \declaredencoding \lattwo
7984 \setnonasciicharscatcode\active
7985 \lattwochardefs
7986 %
7987 \else \ifx \declaredencoding \latone
7988 \setnonasciicharscatcode\active
7989 \latonechardefs
7990 %
7991 \else \ifx \declaredencoding \latnine
7992 \setnonasciicharscatcode\active
7993 \latninechardefs
7994 %
7995 \else \ifx \declaredencoding \utfeight
7996 \setnonasciicharscatcode\active
7997 \utfeightchardefs
7998 %
7999 \else
8000 \message{Unknown document encoding #1, ignoring.}%
8001 %
8002 \fi % utfeight
8003 \fi % latnine
8004 \fi % latone
8005 \fi % lattwo
8006 \fi % ascii
8007 }
8008
8009 % A message to be logged when using a character that isn't available
8010 % the default font encoding (OT1).
8011 %
8012 \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
8013
8014 % Take account of \c (plain) vs. \, (Texinfo) difference.
8015 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
8016
8017 % First, make active non-ASCII characters in order for them to be
8018 % correctly categorized when TeX reads the replacement text of
8019 % macros containing the character definitions.
8020 \setnonasciicharscatcode\active
8021 %
8022 % Latin1 (ISO-8859-1) character definitions.
8023 \def\latonechardefs{%
8024 \gdef^^a0{~}
8025 \gdef^^a1{\exclamdown}
8026 \gdef^^a2{\missingcharmsg{CENT SIGN}}
8027 \gdef^^a3{{\pounds}}
8028 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
8029 \gdef^^a5{\missingcharmsg{YEN SIGN}}
8030 \gdef^^a6{\missingcharmsg{BROKEN BAR}}
8031 \gdef^^a7{\S}
8032 \gdef^^a8{\"{}}
8033 \gdef^^a9{\copyright}
8034 \gdef^^aa{\ordf}
8035 \gdef^^ab{\guillemetleft}
8036 \gdef^^ac{$\lnot$}
8037 \gdef^^ad{\-}
8038 \gdef^^ae{\registeredsymbol}
8039 \gdef^^af{\={}}
8040 %
8041 \gdef^^b0{\textdegree}
8042 \gdef^^b1{$\pm$}
8043 \gdef^^b2{$^2$}
8044 \gdef^^b3{$^3$}
8045 \gdef^^b4{\'{}}
8046 \gdef^^b5{$\mu$}
8047 \gdef^^b6{\P}
8048 %
8049 \gdef^^b7{$^.$}
8050 \gdef^^b8{\cedilla\ }
8051 \gdef^^b9{$^1$}
8052 \gdef^^ba{\ordm}
8053 %
8054 \gdef^^bb{\guilletright}
8055 \gdef^^bc{$1\over4$}
8056 \gdef^^bd{$1\over2$}
8057 \gdef^^be{$3\over4$}
8058 \gdef^^bf{\questiondown}
8059 %
8060 \gdef^^c0{\`A}
8061 \gdef^^c1{\'A}
8062 \gdef^^c2{\^A}
8063 \gdef^^c3{\~A}
8064 \gdef^^c4{\"A}
8065 \gdef^^c5{\ringaccent A}
8066 \gdef^^c6{\AE}
8067 \gdef^^c7{\cedilla C}
8068 \gdef^^c8{\`E}
8069 \gdef^^c9{\'E}
8070 \gdef^^ca{\^E}
8071 \gdef^^cb{\"E}
8072 \gdef^^cc{\`I}
8073 \gdef^^cd{\'I}
8074 \gdef^^ce{\^I}
8075 \gdef^^cf{\"I}
8076 %
8077 \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER ETH}}
8078 \gdef^^d1{\~N}
8079 \gdef^^d2{\`O}
8080 \gdef^^d3{\'O}
8081 \gdef^^d4{\^O}
8082 \gdef^^d5{\~O}
8083 \gdef^^d6{\"O}
8084 \gdef^^d7{$\times$}
8085 \gdef^^d8{\O}
8086 \gdef^^d9{\`U}
8087 \gdef^^da{\'U}
8088 \gdef^^db{\^U}
8089 \gdef^^dc{\"U}
8090 \gdef^^dd{\'Y}
8091 \gdef^^de{\missingcharmsg{LATIN CAPITAL LETTER THORN}}
8092 \gdef^^df{\ss}
8093 %
8094 \gdef^^e0{\`a}
8095 \gdef^^e1{\'a}
8096 \gdef^^e2{\^a}
8097 \gdef^^e3{\~a}
8098 \gdef^^e4{\"a}
8099 \gdef^^e5{\ringaccent a}
8100 \gdef^^e6{\ae}
8101 \gdef^^e7{\cedilla c}
8102 \gdef^^e8{\`e}
8103 \gdef^^e9{\'e}
8104 \gdef^^ea{\^e}
8105 \gdef^^eb{\"e}
8106 \gdef^^ec{\`{\dotless i}}
8107 \gdef^^ed{\'{\dotless i}}
8108 \gdef^^ee{\^{\dotless i}}
8109 \gdef^^ef{\"{\dotless i}}
8110 %
8111 \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER ETH}}
8112 \gdef^^f1{\~n}
8113 \gdef^^f2{\`o}
8114 \gdef^^f3{\'o}
8115 \gdef^^f4{\^o}
8116 \gdef^^f5{\~o}
8117 \gdef^^f6{\"o}
8118 \gdef^^f7{$\div$}
8119 \gdef^^f8{\o}
8120 \gdef^^f9{\`u}
8121 \gdef^^fa{\'u}
8122 \gdef^^fb{\^u}
8123 \gdef^^fc{\"u}
8124 \gdef^^fd{\'y}
8125 \gdef^^fe{\missingcharmsg{LATIN SMALL LETTER THORN}}
8126 \gdef^^ff{\"y}
8127 }
8128
8129 % Latin9 (ISO-8859-15) encoding character definitions.
8130 \def\latninechardefs{%
8131 % Encoding is almost identical to Latin1.
8132 \latonechardefs
8133 %
8134 \gdef^^a4{\euro}
8135 \gdef^^a6{\v S}
8136 \gdef^^a8{\v s}
8137 \gdef^^b4{\v Z}
8138 \gdef^^b8{\v z}
8139 \gdef^^bc{\OE}
8140 \gdef^^bd{\oe}
8141 \gdef^^be{\"Y}
8142 }
8143
8144 % Latin2 (ISO-8859-2) character definitions.
8145 \def\lattwochardefs{%
8146 \gdef^^a0{~}
8147 \gdef^^a1{\ogonek{A}}
8148 \gdef^^a2{\u{}}
8149 \gdef^^a3{\L}
8150 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
8151 \gdef^^a5{\v L}
8152 \gdef^^a6{\'S}
8153 \gdef^^a7{\S}
8154 \gdef^^a8{\"{}}
8155 \gdef^^a9{\v S}
8156 \gdef^^aa{\cedilla S}
8157 \gdef^^ab{\v T}
8158 \gdef^^ac{\'Z}
8159 \gdef^^ad{\-}
8160 \gdef^^ae{\v Z}
8161 \gdef^^af{\dotaccent Z}
8162 %
8163 \gdef^^b0{\textdegree}
8164 \gdef^^b1{\ogonek{a}}
8165 \gdef^^b2{\ogonek{ }}
8166 \gdef^^b3{\l}
8167 \gdef^^b4{\'{}}
8168 \gdef^^b5{\v l}
8169 \gdef^^b6{\'s}
8170 \gdef^^b7{\v{}}
8171 \gdef^^b8{\cedilla\ }
8172 \gdef^^b9{\v s}
8173 \gdef^^ba{\cedilla s}
8174 \gdef^^bb{\v t}
8175 \gdef^^bc{\'z}
8176 \gdef^^bd{\H{}}
8177 \gdef^^be{\v z}
8178 \gdef^^bf{\dotaccent z}
8179 %
8180 \gdef^^c0{\'R}
8181 \gdef^^c1{\'A}
8182 \gdef^^c2{\^A}
8183 \gdef^^c3{\u A}
8184 \gdef^^c4{\"A}
8185 \gdef^^c5{\'L}
8186 \gdef^^c6{\'C}
8187 \gdef^^c7{\cedilla C}
8188 \gdef^^c8{\v C}
8189 \gdef^^c9{\'E}
8190 \gdef^^ca{\ogonek{E}}
8191 \gdef^^cb{\"E}
8192 \gdef^^cc{\v E}
8193 \gdef^^cd{\'I}
8194 \gdef^^ce{\^I}
8195 \gdef^^cf{\v D}
8196 %
8197 \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER D WITH STROKE}}
8198 \gdef^^d1{\'N}
8199 \gdef^^d2{\v N}
8200 \gdef^^d3{\'O}
8201 \gdef^^d4{\^O}
8202 \gdef^^d5{\H O}
8203 \gdef^^d6{\"O}
8204 \gdef^^d7{$\times$}
8205 \gdef^^d8{\v R}
8206 \gdef^^d9{\ringaccent U}
8207 \gdef^^da{\'U}
8208 \gdef^^db{\H U}
8209 \gdef^^dc{\"U}
8210 \gdef^^dd{\'Y}
8211 \gdef^^de{\cedilla T}
8212 \gdef^^df{\ss}
8213 %
8214 \gdef^^e0{\'r}
8215 \gdef^^e1{\'a}
8216 \gdef^^e2{\^a}
8217 \gdef^^e3{\u a}
8218 \gdef^^e4{\"a}
8219 \gdef^^e5{\'l}
8220 \gdef^^e6{\'c}
8221 \gdef^^e7{\cedilla c}
8222 \gdef^^e8{\v c}
8223 \gdef^^e9{\'e}
8224 \gdef^^ea{\ogonek{e}}
8225 \gdef^^eb{\"e}
8226 \gdef^^ec{\v e}
8227 \gdef^^ed{\'\i}
8228 \gdef^^ee{\^\i}
8229 \gdef^^ef{\v d}
8230 %
8231 \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER D WITH STROKE}}
8232 \gdef^^f1{\'n}
8233 \gdef^^f2{\v n}
8234 \gdef^^f3{\'o}
8235 \gdef^^f4{\^o}
8236 \gdef^^f5{\H o}
8237 \gdef^^f6{\"o}
8238 \gdef^^f7{$\div$}
8239 \gdef^^f8{\v r}
8240 \gdef^^f9{\ringaccent u}
8241 \gdef^^fa{\'u}
8242 \gdef^^fb{\H u}
8243 \gdef^^fc{\"u}
8244 \gdef^^fd{\'y}
8245 \gdef^^fe{\cedilla t}
8246 \gdef^^ff{\dotaccent{}}
8247 }
8248
8249 % UTF-8 character definitions.
8250 %
8251 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
8252 % changes for Texinfo conventions. It is included here under the GPL by
8253 % permission from Frank Mittelbach and the LaTeX team.
8254 %
8255 \newcount\countUTFx
8256 \newcount\countUTFy
8257 \newcount\countUTFz
8258
8259 \gdef\UTFviiiTwoOctets#1#2{\expandafter
8260 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
8261 %
8262 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
8263 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
8264 %
8265 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
8266 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
8267
8268 \gdef\UTFviiiDefined#1{%
8269 \ifx #1\relax
8270 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
8271 \else
8272 \expandafter #1%
8273 \fi
8274 }
8275
8276 \begingroup
8277 \catcode`\~13
8278 \catcode`\"12
8279
8280 \def\UTFviiiLoop{%
8281 \global\catcode\countUTFx\active
8282 \uccode`\~\countUTFx
8283 \uppercase\expandafter{\UTFviiiTmp}%
8284 \advance\countUTFx by 1
8285 \ifnum\countUTFx < \countUTFy
8286 \expandafter\UTFviiiLoop
8287 \fi}
8288
8289 \countUTFx = "C2
8290 \countUTFy = "E0
8291 \def\UTFviiiTmp{%
8292 \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
8293 \UTFviiiLoop
8294
8295 \countUTFx = "E0
8296 \countUTFy = "F0
8297 \def\UTFviiiTmp{%
8298 \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
8299 \UTFviiiLoop
8300
8301 \countUTFx = "F0
8302 \countUTFy = "F4
8303 \def\UTFviiiTmp{%
8304 \xdef~{\noexpand\UTFviiiFourOctets\string~}}
8305 \UTFviiiLoop
8306 \endgroup
8307
8308 \begingroup
8309 \catcode`\"=12
8310 \catcode`\<=12
8311 \catcode`\.=12
8312 \catcode`\,=12
8313 \catcode`\;=12
8314 \catcode`\!=12
8315 \catcode`\~=13
8316
8317 \gdef\DeclareUnicodeCharacter#1#2{%
8318 \countUTFz = "#1\relax
8319 \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
8320 \begingroup
8321 \parseXMLCharref
8322 \def\UTFviiiTwoOctets##1##2{%
8323 \csname u8:##1\string ##2\endcsname}%
8324 \def\UTFviiiThreeOctets##1##2##3{%
8325 \csname u8:##1\string ##2\string ##3\endcsname}%
8326 \def\UTFviiiFourOctets##1##2##3##4{%
8327 \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
8328 \expandafter\expandafter\expandafter\expandafter
8329 \expandafter\expandafter\expandafter
8330 \gdef\UTFviiiTmp{#2}%
8331 \endgroup}
8332
8333 \gdef\parseXMLCharref{%
8334 \ifnum\countUTFz < "A0\relax
8335 \errhelp = \EMsimple
8336 \errmessage{Cannot define Unicode char value < 00A0}%
8337 \else\ifnum\countUTFz < "800\relax
8338 \parseUTFviiiA,%
8339 \parseUTFviiiB C\UTFviiiTwoOctets.,%
8340 \else\ifnum\countUTFz < "10000\relax
8341 \parseUTFviiiA;%
8342 \parseUTFviiiA,%
8343 \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
8344 \else
8345 \parseUTFviiiA;%
8346 \parseUTFviiiA,%
8347 \parseUTFviiiA!%
8348 \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
8349 \fi\fi\fi
8350 }
8351
8352 \gdef\parseUTFviiiA#1{%
8353 \countUTFx = \countUTFz
8354 \divide\countUTFz by 64
8355 \countUTFy = \countUTFz
8356 \multiply\countUTFz by 64
8357 \advance\countUTFx by -\countUTFz
8358 \advance\countUTFx by 128
8359 \uccode `#1\countUTFx
8360 \countUTFz = \countUTFy}
8361
8362 \gdef\parseUTFviiiB#1#2#3#4{%
8363 \advance\countUTFz by "#10\relax
8364 \uccode `#3\countUTFz
8365 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
8366 \endgroup
8367
8368 \def\utfeightchardefs{%
8369 \DeclareUnicodeCharacter{00A0}{\tie}
8370 \DeclareUnicodeCharacter{00A1}{\exclamdown}
8371 \DeclareUnicodeCharacter{00A3}{\pounds}
8372 \DeclareUnicodeCharacter{00A8}{\"{ }}
8373 \DeclareUnicodeCharacter{00A9}{\copyright}
8374 \DeclareUnicodeCharacter{00AA}{\ordf}
8375 \DeclareUnicodeCharacter{00AB}{\guillemetleft}
8376 \DeclareUnicodeCharacter{00AD}{\-}
8377 \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
8378 \DeclareUnicodeCharacter{00AF}{\={ }}
8379
8380 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
8381 \DeclareUnicodeCharacter{00B4}{\'{ }}
8382 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
8383 \DeclareUnicodeCharacter{00BA}{\ordm}
8384 \DeclareUnicodeCharacter{00BB}{\guillemetright}
8385 \DeclareUnicodeCharacter{00BF}{\questiondown}
8386
8387 \DeclareUnicodeCharacter{00C0}{\`A}
8388 \DeclareUnicodeCharacter{00C1}{\'A}
8389 \DeclareUnicodeCharacter{00C2}{\^A}
8390 \DeclareUnicodeCharacter{00C3}{\~A}
8391 \DeclareUnicodeCharacter{00C4}{\"A}
8392 \DeclareUnicodeCharacter{00C5}{\AA}
8393 \DeclareUnicodeCharacter{00C6}{\AE}
8394 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
8395 \DeclareUnicodeCharacter{00C8}{\`E}
8396 \DeclareUnicodeCharacter{00C9}{\'E}
8397 \DeclareUnicodeCharacter{00CA}{\^E}
8398 \DeclareUnicodeCharacter{00CB}{\"E}
8399 \DeclareUnicodeCharacter{00CC}{\`I}
8400 \DeclareUnicodeCharacter{00CD}{\'I}
8401 \DeclareUnicodeCharacter{00CE}{\^I}
8402 \DeclareUnicodeCharacter{00CF}{\"I}
8403
8404 \DeclareUnicodeCharacter{00D1}{\~N}
8405 \DeclareUnicodeCharacter{00D2}{\`O}
8406 \DeclareUnicodeCharacter{00D3}{\'O}
8407 \DeclareUnicodeCharacter{00D4}{\^O}
8408 \DeclareUnicodeCharacter{00D5}{\~O}
8409 \DeclareUnicodeCharacter{00D6}{\"O}
8410 \DeclareUnicodeCharacter{00D8}{\O}
8411 \DeclareUnicodeCharacter{00D9}{\`U}
8412 \DeclareUnicodeCharacter{00DA}{\'U}
8413 \DeclareUnicodeCharacter{00DB}{\^U}
8414 \DeclareUnicodeCharacter{00DC}{\"U}
8415 \DeclareUnicodeCharacter{00DD}{\'Y}
8416 \DeclareUnicodeCharacter{00DF}{\ss}
8417
8418 \DeclareUnicodeCharacter{00E0}{\`a}
8419 \DeclareUnicodeCharacter{00E1}{\'a}
8420 \DeclareUnicodeCharacter{00E2}{\^a}
8421 \DeclareUnicodeCharacter{00E3}{\~a}
8422 \DeclareUnicodeCharacter{00E4}{\"a}
8423 \DeclareUnicodeCharacter{00E5}{\aa}
8424 \DeclareUnicodeCharacter{00E6}{\ae}
8425 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
8426 \DeclareUnicodeCharacter{00E8}{\`e}
8427 \DeclareUnicodeCharacter{00E9}{\'e}
8428 \DeclareUnicodeCharacter{00EA}{\^e}
8429 \DeclareUnicodeCharacter{00EB}{\"e}
8430 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
8431 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
8432 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
8433 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
8434
8435 \DeclareUnicodeCharacter{00F1}{\~n}
8436 \DeclareUnicodeCharacter{00F2}{\`o}
8437 \DeclareUnicodeCharacter{00F3}{\'o}
8438 \DeclareUnicodeCharacter{00F4}{\^o}
8439 \DeclareUnicodeCharacter{00F5}{\~o}
8440 \DeclareUnicodeCharacter{00F6}{\"o}
8441 \DeclareUnicodeCharacter{00F8}{\o}
8442 \DeclareUnicodeCharacter{00F9}{\`u}
8443 \DeclareUnicodeCharacter{00FA}{\'u}
8444 \DeclareUnicodeCharacter{00FB}{\^u}
8445 \DeclareUnicodeCharacter{00FC}{\"u}
8446 \DeclareUnicodeCharacter{00FD}{\'y}
8447 \DeclareUnicodeCharacter{00FF}{\"y}
8448
8449 \DeclareUnicodeCharacter{0100}{\=A}
8450 \DeclareUnicodeCharacter{0101}{\=a}
8451 \DeclareUnicodeCharacter{0102}{\u{A}}
8452 \DeclareUnicodeCharacter{0103}{\u{a}}
8453 \DeclareUnicodeCharacter{0104}{\ogonek{A}}
8454 \DeclareUnicodeCharacter{0105}{\ogonek{a}}
8455 \DeclareUnicodeCharacter{0106}{\'C}
8456 \DeclareUnicodeCharacter{0107}{\'c}
8457 \DeclareUnicodeCharacter{0108}{\^C}
8458 \DeclareUnicodeCharacter{0109}{\^c}
8459 \DeclareUnicodeCharacter{0118}{\ogonek{E}}
8460 \DeclareUnicodeCharacter{0119}{\ogonek{e}}
8461 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
8462 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
8463 \DeclareUnicodeCharacter{010C}{\v{C}}
8464 \DeclareUnicodeCharacter{010D}{\v{c}}
8465 \DeclareUnicodeCharacter{010E}{\v{D}}
8466
8467 \DeclareUnicodeCharacter{0112}{\=E}
8468 \DeclareUnicodeCharacter{0113}{\=e}
8469 \DeclareUnicodeCharacter{0114}{\u{E}}
8470 \DeclareUnicodeCharacter{0115}{\u{e}}
8471 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
8472 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
8473 \DeclareUnicodeCharacter{011A}{\v{E}}
8474 \DeclareUnicodeCharacter{011B}{\v{e}}
8475 \DeclareUnicodeCharacter{011C}{\^G}
8476 \DeclareUnicodeCharacter{011D}{\^g}
8477 \DeclareUnicodeCharacter{011E}{\u{G}}
8478 \DeclareUnicodeCharacter{011F}{\u{g}}
8479
8480 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
8481 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
8482 \DeclareUnicodeCharacter{0124}{\^H}
8483 \DeclareUnicodeCharacter{0125}{\^h}
8484 \DeclareUnicodeCharacter{0128}{\~I}
8485 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
8486 \DeclareUnicodeCharacter{012A}{\=I}
8487 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
8488 \DeclareUnicodeCharacter{012C}{\u{I}}
8489 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
8490
8491 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
8492 \DeclareUnicodeCharacter{0131}{\dotless{i}}
8493 \DeclareUnicodeCharacter{0132}{IJ}
8494 \DeclareUnicodeCharacter{0133}{ij}
8495 \DeclareUnicodeCharacter{0134}{\^J}
8496 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
8497 \DeclareUnicodeCharacter{0139}{\'L}
8498 \DeclareUnicodeCharacter{013A}{\'l}
8499
8500 \DeclareUnicodeCharacter{0141}{\L}
8501 \DeclareUnicodeCharacter{0142}{\l}
8502 \DeclareUnicodeCharacter{0143}{\'N}
8503 \DeclareUnicodeCharacter{0144}{\'n}
8504 \DeclareUnicodeCharacter{0147}{\v{N}}
8505 \DeclareUnicodeCharacter{0148}{\v{n}}
8506 \DeclareUnicodeCharacter{014C}{\=O}
8507 \DeclareUnicodeCharacter{014D}{\=o}
8508 \DeclareUnicodeCharacter{014E}{\u{O}}
8509 \DeclareUnicodeCharacter{014F}{\u{o}}
8510
8511 \DeclareUnicodeCharacter{0150}{\H{O}}
8512 \DeclareUnicodeCharacter{0151}{\H{o}}
8513 \DeclareUnicodeCharacter{0152}{\OE}
8514 \DeclareUnicodeCharacter{0153}{\oe}
8515 \DeclareUnicodeCharacter{0154}{\'R}
8516 \DeclareUnicodeCharacter{0155}{\'r}
8517 \DeclareUnicodeCharacter{0158}{\v{R}}
8518 \DeclareUnicodeCharacter{0159}{\v{r}}
8519 \DeclareUnicodeCharacter{015A}{\'S}
8520 \DeclareUnicodeCharacter{015B}{\'s}
8521 \DeclareUnicodeCharacter{015C}{\^S}
8522 \DeclareUnicodeCharacter{015D}{\^s}
8523 \DeclareUnicodeCharacter{015E}{\cedilla{S}}
8524 \DeclareUnicodeCharacter{015F}{\cedilla{s}}
8525
8526 \DeclareUnicodeCharacter{0160}{\v{S}}
8527 \DeclareUnicodeCharacter{0161}{\v{s}}
8528 \DeclareUnicodeCharacter{0162}{\cedilla{t}}
8529 \DeclareUnicodeCharacter{0163}{\cedilla{T}}
8530 \DeclareUnicodeCharacter{0164}{\v{T}}
8531
8532 \DeclareUnicodeCharacter{0168}{\~U}
8533 \DeclareUnicodeCharacter{0169}{\~u}
8534 \DeclareUnicodeCharacter{016A}{\=U}
8535 \DeclareUnicodeCharacter{016B}{\=u}
8536 \DeclareUnicodeCharacter{016C}{\u{U}}
8537 \DeclareUnicodeCharacter{016D}{\u{u}}
8538 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
8539 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
8540
8541 \DeclareUnicodeCharacter{0170}{\H{U}}
8542 \DeclareUnicodeCharacter{0171}{\H{u}}
8543 \DeclareUnicodeCharacter{0174}{\^W}
8544 \DeclareUnicodeCharacter{0175}{\^w}
8545 \DeclareUnicodeCharacter{0176}{\^Y}
8546 \DeclareUnicodeCharacter{0177}{\^y}
8547 \DeclareUnicodeCharacter{0178}{\"Y}
8548 \DeclareUnicodeCharacter{0179}{\'Z}
8549 \DeclareUnicodeCharacter{017A}{\'z}
8550 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
8551 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
8552 \DeclareUnicodeCharacter{017D}{\v{Z}}
8553 \DeclareUnicodeCharacter{017E}{\v{z}}
8554
8555 \DeclareUnicodeCharacter{01C4}{D\v{Z}}
8556 \DeclareUnicodeCharacter{01C5}{D\v{z}}
8557 \DeclareUnicodeCharacter{01C6}{d\v{z}}
8558 \DeclareUnicodeCharacter{01C7}{LJ}
8559 \DeclareUnicodeCharacter{01C8}{Lj}
8560 \DeclareUnicodeCharacter{01C9}{lj}
8561 \DeclareUnicodeCharacter{01CA}{NJ}
8562 \DeclareUnicodeCharacter{01CB}{Nj}
8563 \DeclareUnicodeCharacter{01CC}{nj}
8564 \DeclareUnicodeCharacter{01CD}{\v{A}}
8565 \DeclareUnicodeCharacter{01CE}{\v{a}}
8566 \DeclareUnicodeCharacter{01CF}{\v{I}}
8567
8568 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
8569 \DeclareUnicodeCharacter{01D1}{\v{O}}
8570 \DeclareUnicodeCharacter{01D2}{\v{o}}
8571 \DeclareUnicodeCharacter{01D3}{\v{U}}
8572 \DeclareUnicodeCharacter{01D4}{\v{u}}
8573
8574 \DeclareUnicodeCharacter{01E2}{\={\AE}}
8575 \DeclareUnicodeCharacter{01E3}{\={\ae}}
8576 \DeclareUnicodeCharacter{01E6}{\v{G}}
8577 \DeclareUnicodeCharacter{01E7}{\v{g}}
8578 \DeclareUnicodeCharacter{01E8}{\v{K}}
8579 \DeclareUnicodeCharacter{01E9}{\v{k}}
8580
8581 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
8582 \DeclareUnicodeCharacter{01F1}{DZ}
8583 \DeclareUnicodeCharacter{01F2}{Dz}
8584 \DeclareUnicodeCharacter{01F3}{dz}
8585 \DeclareUnicodeCharacter{01F4}{\'G}
8586 \DeclareUnicodeCharacter{01F5}{\'g}
8587 \DeclareUnicodeCharacter{01F8}{\`N}
8588 \DeclareUnicodeCharacter{01F9}{\`n}
8589 \DeclareUnicodeCharacter{01FC}{\'{\AE}}
8590 \DeclareUnicodeCharacter{01FD}{\'{\ae}}
8591 \DeclareUnicodeCharacter{01FE}{\'{\O}}
8592 \DeclareUnicodeCharacter{01FF}{\'{\o}}
8593
8594 \DeclareUnicodeCharacter{021E}{\v{H}}
8595 \DeclareUnicodeCharacter{021F}{\v{h}}
8596
8597 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
8598 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
8599 \DeclareUnicodeCharacter{0228}{\cedilla{E}}
8600 \DeclareUnicodeCharacter{0229}{\cedilla{e}}
8601 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
8602 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
8603
8604 \DeclareUnicodeCharacter{0232}{\=Y}
8605 \DeclareUnicodeCharacter{0233}{\=y}
8606 \DeclareUnicodeCharacter{0237}{\dotless{j}}
8607
8608 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
8609
8610 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
8611 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
8612 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
8613 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
8614 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
8615 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
8616 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
8617 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
8618 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
8619 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
8620 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
8621 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
8622
8623 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
8624 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
8625
8626 \DeclareUnicodeCharacter{1E20}{\=G}
8627 \DeclareUnicodeCharacter{1E21}{\=g}
8628 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
8629 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
8630 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
8631 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
8632 \DeclareUnicodeCharacter{1E26}{\"H}
8633 \DeclareUnicodeCharacter{1E27}{\"h}
8634
8635 \DeclareUnicodeCharacter{1E30}{\'K}
8636 \DeclareUnicodeCharacter{1E31}{\'k}
8637 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
8638 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
8639 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
8640 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
8641 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
8642 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
8643 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
8644 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
8645 \DeclareUnicodeCharacter{1E3E}{\'M}
8646 \DeclareUnicodeCharacter{1E3F}{\'m}
8647
8648 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
8649 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
8650 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
8651 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
8652 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
8653 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
8654 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
8655 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
8656 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
8657 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
8658
8659 \DeclareUnicodeCharacter{1E54}{\'P}
8660 \DeclareUnicodeCharacter{1E55}{\'p}
8661 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
8662 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
8663 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
8664 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
8665 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
8666 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
8667 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
8668 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
8669
8670 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
8671 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
8672 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
8673 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
8674 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
8675 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
8676 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
8677 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
8678 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
8679 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
8680
8681 \DeclareUnicodeCharacter{1E7C}{\~V}
8682 \DeclareUnicodeCharacter{1E7D}{\~v}
8683 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
8684 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
8685
8686 \DeclareUnicodeCharacter{1E80}{\`W}
8687 \DeclareUnicodeCharacter{1E81}{\`w}
8688 \DeclareUnicodeCharacter{1E82}{\'W}
8689 \DeclareUnicodeCharacter{1E83}{\'w}
8690 \DeclareUnicodeCharacter{1E84}{\"W}
8691 \DeclareUnicodeCharacter{1E85}{\"w}
8692 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
8693 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
8694 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
8695 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
8696 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
8697 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
8698 \DeclareUnicodeCharacter{1E8C}{\"X}
8699 \DeclareUnicodeCharacter{1E8D}{\"x}
8700 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
8701 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
8702
8703 \DeclareUnicodeCharacter{1E90}{\^Z}
8704 \DeclareUnicodeCharacter{1E91}{\^z}
8705 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
8706 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
8707 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
8708 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
8709 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
8710 \DeclareUnicodeCharacter{1E97}{\"t}
8711 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
8712 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
8713
8714 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
8715 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
8716
8717 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
8718 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
8719 \DeclareUnicodeCharacter{1EBC}{\~E}
8720 \DeclareUnicodeCharacter{1EBD}{\~e}
8721
8722 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
8723 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
8724 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
8725 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
8726
8727 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
8728 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
8729
8730 \DeclareUnicodeCharacter{1EF2}{\`Y}
8731 \DeclareUnicodeCharacter{1EF3}{\`y}
8732 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
8733
8734 \DeclareUnicodeCharacter{1EF8}{\~Y}
8735 \DeclareUnicodeCharacter{1EF9}{\~y}
8736
8737 \DeclareUnicodeCharacter{2013}{--}
8738 \DeclareUnicodeCharacter{2014}{---}
8739 \DeclareUnicodeCharacter{2018}{\quoteleft}
8740 \DeclareUnicodeCharacter{2019}{\quoteright}
8741 \DeclareUnicodeCharacter{201A}{\quotesinglbase}
8742 \DeclareUnicodeCharacter{201C}{\quotedblleft}
8743 \DeclareUnicodeCharacter{201D}{\quotedblright}
8744 \DeclareUnicodeCharacter{201E}{\quotedblbase}
8745 \DeclareUnicodeCharacter{2022}{\bullet}
8746 \DeclareUnicodeCharacter{2026}{\dots}
8747 \DeclareUnicodeCharacter{2039}{\guilsinglleft}
8748 \DeclareUnicodeCharacter{203A}{\guilsinglright}
8749 \DeclareUnicodeCharacter{20AC}{\euro}
8750
8751 \DeclareUnicodeCharacter{2192}{\expansion}
8752 \DeclareUnicodeCharacter{21D2}{\result}
8753
8754 \DeclareUnicodeCharacter{2212}{\minus}
8755 \DeclareUnicodeCharacter{2217}{\point}
8756 \DeclareUnicodeCharacter{2261}{\equiv}
8757 }% end of \utfeightchardefs
8758
8759
8760 % US-ASCII character definitions.
8761 \def\asciichardefs{% nothing need be done
8762 \relax
8763 }
8764
8765 % Make non-ASCII characters printable again for compatibility with
8766 % existing Texinfo documents that may use them, even without declaring a
8767 % document encoding.
8768 %
8769 \setnonasciicharscatcode \other
8770
8771
8772 \message{formatting,}
8773
8774 \newdimen\defaultparindent \defaultparindent = 15pt
8775
8776 \chapheadingskip = 15pt plus 4pt minus 2pt
8777 \secheadingskip = 12pt plus 3pt minus 2pt
8778 \subsecheadingskip = 9pt plus 2pt minus 2pt
8779
8780 % Prevent underfull vbox error messages.
8781 \vbadness = 10000
8782
8783 % Don't be so finicky about underfull hboxes, either.
8784 \hbadness = 2000
8785
8786 % Following George Bush, get rid of widows and orphans.
8787 \widowpenalty=10000
8788 \clubpenalty=10000
8789
8790 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
8791 % using an old version of TeX, don't do anything. We want the amount of
8792 % stretch added to depend on the line length, hence the dependence on
8793 % \hsize. We call this whenever the paper size is set.
8794 %
8795 \def\setemergencystretch{%
8796 \ifx\emergencystretch\thisisundefined
8797 % Allow us to assign to \emergencystretch anyway.
8798 \def\emergencystretch{\dimen0}%
8799 \else
8800 \emergencystretch = .15\hsize
8801 \fi
8802 }
8803
8804 % Parameters in order: 1) textheight; 2) textwidth;
8805 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
8806 % 7) physical page height; 8) physical page width.
8807 %
8808 % We also call \setleading{\textleading}, so the caller should define
8809 % \textleading. The caller should also set \parskip.
8810 %
8811 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
8812 \voffset = #3\relax
8813 \topskip = #6\relax
8814 \splittopskip = \topskip
8815 %
8816 \vsize = #1\relax
8817 \advance\vsize by \topskip
8818 \outervsize = \vsize
8819 \advance\outervsize by 2\topandbottommargin
8820 \pageheight = \vsize
8821 %
8822 \hsize = #2\relax
8823 \outerhsize = \hsize
8824 \advance\outerhsize by 0.5in
8825 \pagewidth = \hsize
8826 %
8827 \normaloffset = #4\relax
8828 \bindingoffset = #5\relax
8829 %
8830 \ifpdf
8831 \pdfpageheight #7\relax
8832 \pdfpagewidth #8\relax
8833 % if we don't reset these, they will remain at "1 true in" of
8834 % whatever layout pdftex was dumped with.
8835 \pdfhorigin = 1 true in
8836 \pdfvorigin = 1 true in
8837 \fi
8838 %
8839 \setleading{\textleading}
8840 %
8841 \parindent = \defaultparindent
8842 \setemergencystretch
8843 }
8844
8845 % @letterpaper (the default).
8846 \def\letterpaper{{\globaldefs = 1
8847 \parskip = 3pt plus 2pt minus 1pt
8848 \textleading = 13.2pt
8849 %
8850 % If page is nothing but text, make it come out even.
8851 \internalpagesizes{607.2pt}{6in}% that's 46 lines
8852 {\voffset}{.25in}%
8853 {\bindingoffset}{36pt}%
8854 {11in}{8.5in}%
8855 }}
8856
8857 % Use @smallbook to reset parameters for 7x9.25 trim size.
8858 \def\smallbook{{\globaldefs = 1
8859 \parskip = 2pt plus 1pt
8860 \textleading = 12pt
8861 %
8862 \internalpagesizes{7.5in}{5in}%
8863 {-.2in}{0in}%
8864 {\bindingoffset}{16pt}%
8865 {9.25in}{7in}%
8866 %
8867 \lispnarrowing = 0.3in
8868 \tolerance = 700
8869 \hfuzz = 1pt
8870 \contentsrightmargin = 0pt
8871 \defbodyindent = .5cm
8872 }}
8873
8874 % Use @smallerbook to reset parameters for 6x9 trim size.
8875 % (Just testing, parameters still in flux.)
8876 \def\smallerbook{{\globaldefs = 1
8877 \parskip = 1.5pt plus 1pt
8878 \textleading = 12pt
8879 %
8880 \internalpagesizes{7.4in}{4.8in}%
8881 {-.2in}{-.4in}%
8882 {0pt}{14pt}%
8883 {9in}{6in}%
8884 %
8885 \lispnarrowing = 0.25in
8886 \tolerance = 700
8887 \hfuzz = 1pt
8888 \contentsrightmargin = 0pt
8889 \defbodyindent = .4cm
8890 }}
8891
8892 % Use @afourpaper to print on European A4 paper.
8893 \def\afourpaper{{\globaldefs = 1
8894 \parskip = 3pt plus 2pt minus 1pt
8895 \textleading = 13.2pt
8896 %
8897 % Double-side printing via postscript on Laserjet 4050
8898 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
8899 % To change the settings for a different printer or situation, adjust
8900 % \normaloffset until the front-side and back-side texts align. Then
8901 % do the same for \bindingoffset. You can set these for testing in
8902 % your texinfo source file like this:
8903 % @tex
8904 % \global\normaloffset = -6mm
8905 % \global\bindingoffset = 10mm
8906 % @end tex
8907 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
8908 {\voffset}{\hoffset}%
8909 {\bindingoffset}{44pt}%
8910 {297mm}{210mm}%
8911 %
8912 \tolerance = 700
8913 \hfuzz = 1pt
8914 \contentsrightmargin = 0pt
8915 \defbodyindent = 5mm
8916 }}
8917
8918 % Use @afivepaper to print on European A5 paper.
8919 % From romildo@urano.iceb.ufop.br, 2 July 2000.
8920 % He also recommends making @example and @lisp be small.
8921 \def\afivepaper{{\globaldefs = 1
8922 \parskip = 2pt plus 1pt minus 0.1pt
8923 \textleading = 12.5pt
8924 %
8925 \internalpagesizes{160mm}{120mm}%
8926 {\voffset}{\hoffset}%
8927 {\bindingoffset}{8pt}%
8928 {210mm}{148mm}%
8929 %
8930 \lispnarrowing = 0.2in
8931 \tolerance = 800
8932 \hfuzz = 1.2pt
8933 \contentsrightmargin = 0pt
8934 \defbodyindent = 2mm
8935 \tableindent = 12mm
8936 }}
8937
8938 % A specific text layout, 24x15cm overall, intended for A4 paper.
8939 \def\afourlatex{{\globaldefs = 1
8940 \afourpaper
8941 \internalpagesizes{237mm}{150mm}%
8942 {\voffset}{4.6mm}%
8943 {\bindingoffset}{7mm}%
8944 {297mm}{210mm}%
8945 %
8946 % Must explicitly reset to 0 because we call \afourpaper.
8947 \globaldefs = 0
8948 }}
8949
8950 % Use @afourwide to print on A4 paper in landscape format.
8951 \def\afourwide{{\globaldefs = 1
8952 \afourpaper
8953 \internalpagesizes{241mm}{165mm}%
8954 {\voffset}{-2.95mm}%
8955 {\bindingoffset}{7mm}%
8956 {297mm}{210mm}%
8957 \globaldefs = 0
8958 }}
8959
8960 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
8961 % Perhaps we should allow setting the margins, \topskip, \parskip,
8962 % and/or leading, also. Or perhaps we should compute them somehow.
8963 %
8964 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
8965 \def\pagesizesyyy#1,#2,#3\finish{{%
8966 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
8967 \globaldefs = 1
8968 %
8969 \parskip = 3pt plus 2pt minus 1pt
8970 \setleading{\textleading}%
8971 %
8972 \dimen0 = #1\relax
8973 \advance\dimen0 by \voffset
8974 %
8975 \dimen2 = \hsize
8976 \advance\dimen2 by \normaloffset
8977 %
8978 \internalpagesizes{#1}{\hsize}%
8979 {\voffset}{\normaloffset}%
8980 {\bindingoffset}{44pt}%
8981 {\dimen0}{\dimen2}%
8982 }}
8983
8984 % Set default to letter.
8985 %
8986 \letterpaper
8987
8988
8989 \message{and turning on texinfo input format.}
8990
8991 % DEL is a comment character, in case @c does not suffice.
8992 \catcode`\^^? = 14
8993
8994 % Define macros to output various characters with catcode for normal text.
8995 \catcode`\"=\other
8996 \catcode`\~=\other
8997 \catcode`\^=\other
8998 \catcode`\_=\other
8999 \catcode`\|=\other
9000 \catcode`\<=\other
9001 \catcode`\>=\other
9002 \catcode`\+=\other
9003 \catcode`\$=\other
9004 \def\normaldoublequote{"}
9005 \def\normaltilde{~}
9006 \def\normalcaret{^}
9007 \def\normalunderscore{_}
9008 \def\normalverticalbar{|}
9009 \def\normalless{<}
9010 \def\normalgreater{>}
9011 \def\normalplus{+}
9012 \def\normaldollar{$}%$ font-lock fix
9013
9014 % This macro is used to make a character print one way in \tt
9015 % (where it can probably be output as-is), and another way in other fonts,
9016 % where something hairier probably needs to be done.
9017 %
9018 % #1 is what to print if we are indeed using \tt; #2 is what to print
9019 % otherwise. Since all the Computer Modern typewriter fonts have zero
9020 % interword stretch (and shrink), and it is reasonable to expect all
9021 % typewriter fonts to have this, we can check that font parameter.
9022 %
9023 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
9024
9025 % Same as above, but check for italic font. Actually this also catches
9026 % non-italic slanted fonts since it is impossible to distinguish them from
9027 % italic fonts. But since this is only used by $ and it uses \sl anyway
9028 % this is not a problem.
9029 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
9030
9031 % Turn off all special characters except @
9032 % (and those which the user can use as if they were ordinary).
9033 % Most of these we simply print from the \tt font, but for some, we can
9034 % use math or other variants that look better in normal text.
9035
9036 \catcode`\"=\active
9037 \def\activedoublequote{{\tt\char34}}
9038 \let"=\activedoublequote
9039 \catcode`\~=\active
9040 \def~{{\tt\char126}}
9041 \chardef\hat=`\^
9042 \catcode`\^=\active
9043 \def^{{\tt \hat}}
9044
9045 \catcode`\_=\active
9046 \def_{\ifusingtt\normalunderscore\_}
9047 \let\realunder=_
9048 % Subroutine for the previous macro.
9049 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
9050
9051 \catcode`\|=\active
9052 \def|{{\tt\char124}}
9053 \chardef \less=`\<
9054 \catcode`\<=\active
9055 \def<{{\tt \less}}
9056 \chardef \gtr=`\>
9057 \catcode`\>=\active
9058 \def>{{\tt \gtr}}
9059 \catcode`\+=\active
9060 \def+{{\tt \char 43}}
9061 \catcode`\$=\active
9062 \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
9063
9064 % If a .fmt file is being used, characters that might appear in a file
9065 % name cannot be active until we have parsed the command line.
9066 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
9067 % \otherifyactive is called near the end of this file.
9068 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
9069
9070 % Used sometimes to turn off (effectively) the active characters even after
9071 % parsing them.
9072 \def\turnoffactive{%
9073 \normalturnoffactive
9074 \otherbackslash
9075 }
9076
9077 \catcode`\@=0
9078
9079 % \backslashcurfont outputs one backslash character in current font,
9080 % as in \char`\\.
9081 \global\chardef\backslashcurfont=`\\
9082 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
9083
9084 % \realbackslash is an actual character `\' with catcode other, and
9085 % \doublebackslash is two of them (for the pdf outlines).
9086 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
9087
9088 % In texinfo, backslash is an active character; it prints the backslash
9089 % in fixed width font.
9090 \catcode`\\=\active
9091 @def@normalbackslash{{@tt@backslashcurfont}}
9092 % On startup, @fixbackslash assigns:
9093 % @let \ = @normalbackslash
9094
9095 % \rawbackslash defines an active \ to do \backslashcurfont.
9096 % \otherbackslash defines an active \ to be a literal `\' character with
9097 % catcode other.
9098 @gdef@rawbackslash{@let\=@backslashcurfont}
9099 @gdef@otherbackslash{@let\=@realbackslash}
9100
9101 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
9102 % the literal character `\'.
9103 %
9104 @def@normalturnoffactive{%
9105 @let\=@normalbackslash
9106 @let"=@normaldoublequote
9107 @let~=@normaltilde
9108 @let^=@normalcaret
9109 @let_=@normalunderscore
9110 @let|=@normalverticalbar
9111 @let<=@normalless
9112 @let>=@normalgreater
9113 @let+=@normalplus
9114 @let$=@normaldollar %$ font-lock fix
9115 @markupsetuplqdefault
9116 @markupsetuprqdefault
9117 @unsepspaces
9118 }
9119
9120 % Make _ and + \other characters, temporarily.
9121 % This is canceled by @fixbackslash.
9122 @otherifyactive
9123
9124 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
9125 % That is what \eatinput is for; after that, the `\' should revert to printing
9126 % a backslash.
9127 %
9128 @gdef@eatinput input texinfo{@fixbackslash}
9129 @global@let\ = @eatinput
9130
9131 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
9132 % the first `\' in the file would cause an error. This macro tries to fix
9133 % that, assuming it is called before the first `\' could plausibly occur.
9134 % Also turn back on active characters that might appear in the input
9135 % file name, in case not using a pre-dumped format.
9136 %
9137 @gdef@fixbackslash{%
9138 @ifx\@eatinput @let\ = @normalbackslash @fi
9139 @catcode`+=@active
9140 @catcode`@_=@active
9141 }
9142
9143 % Say @foo, not \foo, in error messages.
9144 @escapechar = `@@
9145
9146 % These look ok in all fonts, so just make them not special.
9147 @catcode`@& = @other
9148 @catcode`@# = @other
9149 @catcode`@% = @other
9150
9151 @c Finally, make ` and ' active, so that txicodequoteundirected and
9152 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
9153 @c don't make ` and ' active, @code will not get them as active chars.
9154 @c Do this last of all since we use ` in the previous @catcode assignments.
9155 @catcode`@'=@active
9156 @catcode`@`=@active
9157 @markupsetuplqdefault
9158 @markupsetuprqdefault
9159
9160 @c Local variables:
9161 @c eval: (add-hook 'write-file-hooks 'time-stamp)
9162 @c page-delimiter: "^\\\\message"
9163 @c time-stamp-start: "def\\\\texinfoversion{"
9164 @c time-stamp-format: "%:y-%02m-%02d.%02H"
9165 @c time-stamp-end: "}"
9166 @c End:
9167
9168 @c vim:sw=2:
9169
9170 @ignore
9171 arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
9172 @end ignore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698