|
|
1.1 root 1: %% TeX macros to handle texinfo files
2:
1.1.1.4 ! root 3: % Copyright (C) 1985, 86, 88, 90, 91, 92 Free Software Foundation, Inc.
1.1 root 4:
5: %This texinfo.tex file is free software; you can redistribute it and/or
6: %modify it under the terms of the GNU General Public License as
7: %published by the Free Software Foundation; either version 2, or (at
8: %your option) any later version.
9:
10: %This texinfo.tex file is distributed in the hope that it will be
11: %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12: %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: %General Public License for more details.
14:
15: %You should have received a copy of the GNU General Public License
16: %along with this texinfo.tex file; see the file COPYING. If not, write
17: %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
18: %USA.
19:
20:
21: %In other words, you are welcome to use, share and improve this program.
22: %You are forbidden to forbid anyone else to use, share and improve
23: %what you give them. Help stamp out software-hoarding!
24:
1.1.1.4 ! root 25: \def\texinfoversion{2.89}
1.1 root 26: \message{Loading texinfo package [Version \texinfoversion]:}
27: \message{}
28:
29: % Print the version number if in a .fmt file.
30: \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
31:
32: % Save some parts of plain tex whose names we will redefine.
33:
34: \let\ptexlbrace=\{
35: \let\ptexrbrace=\}
36: \let\ptexdots=\dots
37: \let\ptexdot=\.
38: \let\ptexstar=\*
39: \let\ptexend=\end
40: \let\ptexbullet=\bullet
41: \let\ptexb=\b
42: \let\ptexc=\c
43: \let\ptexi=\i
44: \let\ptext=\t
45: \let\ptexl=\l
46: \let\ptexL=\L
47:
48: \def\tie{\penalty 10000\ } % Save plain tex definition of ~.
49:
50: \message{Basics,}
51: \chardef\other=12
52:
1.1.1.3 root 53: % If this character appears in an error message or help string, it
54: % starts a new line in the output.
55: \newlinechar = `^^J
56:
1.1.1.4 ! root 57: % Ignore a token.
! 58: %
! 59: \def\gobble#1{}
! 60:
1.1 root 61: \hyphenation{ap-pen-dix}
62: \hyphenation{mini-buf-fer mini-buf-fers}
63: \hyphenation{eshell}
64:
65: % Margin to add to right of even pages, to left of odd pages.
66: \newdimen \bindingoffset \bindingoffset=0pt
67: \newdimen \normaloffset \normaloffset=\hoffset
68: \newdimen\pagewidth \newdimen\pageheight
69: \pagewidth=\hsize \pageheight=\vsize
70:
1.1.1.3 root 71: % Sometimes it is convenient to have everything in the transcript file
72: % and nothing on the terminal. We don't just call \tracingall here,
73: % since that produces some useless output on the terminal.
74: %
75: \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
76: \def\loggingall{\tracingcommands2 \tracingstats2
77: \tracingpages1 \tracingoutput1 \tracinglostchars1
78: \tracingmacros2 \tracingparagraphs1 \tracingrestores1
79: \showboxbreadth\maxdimen\showboxdepth\maxdimen
80: }%
81:
1.1 root 82: %---------------------Begin change-----------------------
83: %
84: %%%% For @cropmarks command.
85: % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
86: %
87: \newdimen\cornerlong \newdimen\cornerthick
88: \newdimen \topandbottommargin
89: \newdimen \outerhsize \newdimen \outervsize
90: \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
91: \outerhsize=7in
92: %\outervsize=9.5in
93: % Alternative @smallbook page size is 9.25in
94: \outervsize=9.25in
95: \topandbottommargin=.75in
96: %
97: %---------------------End change-----------------------
98:
99: % \onepageout takes a vbox as an argument. Note that \pagecontents
100: % does insertions itself, but you have to call it yourself.
101: \chardef\PAGE=255 \output={\onepageout{\pagecontents\PAGE}}
102: \def\onepageout#1{\hoffset=\normaloffset
103: \ifodd\pageno \advance\hoffset by \bindingoffset
104: \else \advance\hoffset by -\bindingoffset\fi
105: {\escapechar=`\\\relax % makes sure backslash is used in output files.
106: \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
107: {\let\hsize=\pagewidth \makefootline}}}%
108: \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
109:
110: %%%% For @cropmarks command %%%%
111:
112: % Here is a modification of the main output routine for Near East Publications
113: % This provides right-angle cropmarks at all four corners.
114: % The contents of the page are centerlined into the cropmarks,
115: % and any desired binding offset is added as an \hskip on either
116: % site of the centerlined box. (P. A. MacKay, 12 November, 1986)
117: %
118: \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
119: \shipout
120: \vbox to \outervsize{\hsize=\outerhsize
121: \vbox{\line{\ewtop\hfill\ewtop}}
122: \nointerlineskip
123: \line{\vbox{\moveleft\cornerthick\nstop}
124: \hfill
125: \vbox{\moveright\cornerthick\nstop}}
126: \vskip \topandbottommargin
127: \centerline{\ifodd\pageno\hskip\bindingoffset\fi
128: \vbox{
129: {\let\hsize=\pagewidth \makeheadline}
130: \pagebody{#1}
131: {\let\hsize=\pagewidth \makefootline}}
132: \ifodd\pageno\else\hskip\bindingoffset\fi}
133: \vskip \topandbottommargin plus1fill minus1fill
134: \boxmaxdepth\cornerthick
135: \line{\vbox{\moveleft\cornerthick\nsbot}
136: \hfill
137: \vbox{\moveright\cornerthick\nsbot}}
138: \nointerlineskip
139: \vbox{\line{\ewbot\hfill\ewbot}}
140: }
141: \advancepageno
142: \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
143: %
144: % Do @cropmarks to get crop marks
145: \def\cropmarks{\let\onepageout=\croppageout }
146:
147: \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
148: {\catcode`\@ =11
149: \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
150: \dimen@=\dp#1 \unvbox#1
151: \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
152: \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
153: }
154:
155: %
156: % Here are the rules for the cropmarks. Note that they are
157: % offset so that the space between them is truly \outerhsize or \outervsize
158: % (P. A. MacKay, 12 November, 1986)
159: %
160: \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
161: \def\nstop{\vbox
162: {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
163: \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
164: \def\nsbot{\vbox
165: {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
166:
1.1.1.4 ! root 167: % Parse an argument, then pass it to #1. The argument is the rest of
! 168: % the input line (except we remove a trailing comment). #1 should be a
! 169: % macro which expects an ordinary undelimited TeX argument.
! 170: %
! 171: \def\parsearg#1{%
! 172: \let\next = #1%
! 173: \begingroup
! 174: \obeylines
! 175: \futurelet\temp\parseargx
! 176: }
1.1 root 177:
1.1.1.4 ! root 178: % If the next token is an obeyed space (from an @example environment or
! 179: % the like), remove it and recurse. Otherwise, we're done.
1.1 root 180: \def\parseargx{%
1.1.1.4 ! root 181: \ifx\obeyedspace\temp
! 182: \expandafter\parseargdiscardspace
! 183: \else
! 184: \expandafter\parseargline
! 185: \fi
! 186: }
1.1 root 187:
1.1.1.4 ! root 188: % Remove a single space (as the delimiter token to the macro call).
1.1 root 189: {\obeyspaces %
1.1.1.4 ! root 190: \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
1.1 root 191:
1.1.1.4 ! root 192: \def\obeyedspace{\ }
1.1 root 193:
194: {\obeylines %
1.1.1.4 ! root 195: \gdef\parseargline#1^^M{%
! 196: \endgroup % End of the group started in \parsearg.
! 197: %
! 198: % First remove any @c comment, then any @comment.
! 199: % Result of each macro is put in \toks0.
! 200: \argremovec #1\c\relax %
! 201: \expandafter\argremovecomment \the\toks0 \comment\relax %
! 202: %
! 203: % Call the caller's macro, saved as \next in \parsearg.
! 204: \expandafter\next\expandafter{\the\toks0}%
! 205: }%
! 206: }
! 207:
! 208: % Since all \c{,omment} does is throw away the argument, we can let TeX
! 209: % do that for us. The \relax here is matched by the \relax in the call
! 210: % in \parseargline; it could be more or less anything, its purpose is
! 211: % just to delimit the argument to the \c.
! 212: \def\argremovec#1\c#2\relax{\toks0 = {#1}}
! 213: \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
! 214:
! 215: % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
! 216: % @end itemize @c foo
! 217: % will have two active spaces as part of the argument with the
! 218: % `itemize'. Here we remove all active spaces from #1, and assign the
! 219: % result to \toks0.
! 220: %
! 221: % This loses if there are any *other* active characters besides spaces
! 222: % in the argument -- _ ^ +, for example -- since they get expanded.
! 223: % Fortunately, Texinfo does not define any such commands. (If it ever
! 224: % does, the catcode of the characters in questionwill have to be changed
! 225: % here.) But this means we cannot call \removeactivespaces as part of
! 226: % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
! 227: % that \parsearg gets might well have any character at all in it.
! 228: %
! 229: \def\removeactivespaces#1{%
! 230: \begingroup
! 231: \ignoreactivespaces
! 232: \edef\temp{#1}%
! 233: \global\toks0 = \expandafter{\temp}%
! 234: \endgroup
! 235: }
! 236:
! 237: % Change the active space to expand to nothing.
! 238: %
! 239: \begingroup
! 240: \obeyspaces
! 241: \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
! 242: \endgroup
! 243:
1.1 root 244:
245: \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
246:
247: %% These are used to keep @begin/@end levels from running away
248: %% Call \inENV within environments (after a \begingroup)
249: \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
250: \def\ENVcheck{%
251: \ifENV\errmessage{Still within an environment. Type Return to continue.}
252: \endgroup\fi} % This is not perfect, but it should reduce lossage
253:
254: % @begin foo is the same as @foo, for now.
1.1.1.4 ! root 255: \newhelp\EMsimple{Type <Return> to continue.}
1.1 root 256:
257: \outer\def\begin{\parsearg\beginxxx}
258:
259: \def\beginxxx #1{%
260: \expandafter\ifx\csname #1\endcsname\relax
261: {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
262: \csname #1\endcsname\fi}
263:
1.1.1.4 ! root 264: % @end foo executes the definition of \Efoo.
! 265: %
1.1 root 266: \def\end{\parsearg\endxxx}
267: \def\endxxx #1{%
1.1.1.4 ! root 268: \removeactivespaces{#1}%
! 269: \edef\endthing{\the\toks0}%
! 270: %
! 271: \expandafter\ifx\csname E\endthing\endcsname\relax
! 272: \expandafter\ifx\csname \endthing\endcsname\relax
! 273: % There's no \foo, i.e., no ``environment'' foo.
! 274: \errhelp = \EMsimple
! 275: \errmessage{Undefined command `@end \endthing'}%
! 276: \else
! 277: % There is an environment foo, but it hasn't been started.
! 278: \errhelp = \EMsimple
! 279: \errmessage{This `@end \endthing' doesn't have a matching `@\endthing'}%
! 280: \fi
! 281: \else
! 282: % Everything's ok; the right environment has been started.
! 283: \csname E\endthing\endcsname
! 284: \fi
! 285: }
! 286:
1.1 root 287:
288: % Single-spacing is done by various environments.
289:
290: \newskip\singlespaceskip \singlespaceskip = \baselineskip
291: \def\singlespace{%
292: {\advance \baselineskip by -\singlespaceskip
293: \kern \baselineskip}%
294: \baselineskip=\singlespaceskip
295: }
296:
297: %% Simple single-character @ commands
298:
299: % @@ prints an @
300: % Kludge this until the fonts are right (grr).
301: \def\@{{\tt \char '100}}
302:
1.1.1.4 ! root 303: % This is turned off because it was never documented
! 304: % and you can use @w{...} around a quote to suppress ligatures.
! 305: %% Define @` and @' to be the same as ` and '
! 306: %% but suppressing ligatures.
! 307: %\def\`{{`}}
! 308: %\def\'{{'}}
1.1 root 309:
310: % Used to generate quoted braces.
311:
312: \def\mylbrace {{\tt \char '173}}
313: \def\myrbrace {{\tt \char '175}}
314: \let\{=\mylbrace
315: \let\}=\myrbrace
316:
317: % @: forces normal size whitespace following.
318: \def\:{\spacefactor=1000 }
319:
320: % @* forces a line break.
321: \def\*{\hfil\break\hbox{}\ignorespaces}
322:
323: % @. is an end-of-sentence period.
324: \def\.{.\spacefactor=3000 }
325:
1.1.1.3 root 326: % @w prevents a word break. Without the \leavevmode, @w at the
327: % beginning of a paragraph, when TeX is still in vertical mode, would
328: % produce a whole line of output instead of starting the paragraph.
329: \def\w#1{\leavevmode\hbox{#1}}
330:
331: % @group ... @end group forces ... to be all on one page, by enclosing
332: % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
333: % to keep its height that of a normal line. According to the rules for
334: % \topskip (p.114 of the TeXbook), the glue inserted is
335: % max (\topskip - \ht (first item), 0). If that height is large,
336: % therefore, no glue is inserted, and the space between the headline and
337: % the text is small, which looks bad.
338: %
339: \def\group{\begingroup
340: \ifnum\catcode13=\active \else
341: \errhelp = \groupinvalidhelp
342: \errmessage{@group invalid in context where filling is enabled}%
343: \fi
1.1.1.4 ! root 344: %
! 345: % The \vtop we start below produces a box with large depth; thus, TeX
! 346: % puts \baselineskip glue before it, and (when the next line of text
! 347: % is done) \lineskip glue after it. (See p.82 of the TeXbook.) But
! 348: % the next line of text also gets us \parskip glue. Final result:
! 349: % space below is slightly more than space above.
! 350: \def\Egroup{%
! 351: \egroup % End the \vtop.
! 352: \endgroup % End the \group.
! 353: }%
! 354: %
1.1.1.3 root 355: \vtop\bgroup
1.1.1.4 ! root 356: % We do @comment here in case we are called inside an environment,
! 357: % such as @example, where each end-of-line in the input causes an
! 358: % end-of-line in the output. We don't want the end-of-line after
! 359: % the `@group' to put extra space in the output. Since @group
! 360: % should appear on a line by itself (according to the Texinfo
! 361: % manual), we don't worry about eating any user text.
! 362: \comment
1.1.1.3 root 363: }
364: %
365: % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
366: % message, so this ends up printing `@group can only ...'.
367: %
368: \newhelp\groupinvalidhelp{%
369: group can only be used in environments such as @example,^^J%
370: where each line of input produces a line of output.}
1.1 root 371:
372: % @need space-in-mils
373: % forces a page break if there is not space-in-mils remaining.
374:
375: \newdimen\mil \mil=0.001in
376:
377: \def\need{\parsearg\needx}
378:
1.1.1.3 root 379: % Old definition--didn't work.
380: %\def\needx #1{\par %
381: %% This method tries to make TeX break the page naturally
382: %% if the depth of the box does not fit.
383: %{\baselineskip=0pt%
384: %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
385: %\prevdepth=-1000pt
386: %}}
387:
388: \def\needx#1{%
389: % Go into vertical mode, so we don't make a big box in the middle of a
390: % paragraph.
391: \par
392: %
393: % Don't add any leading before our big empty box, but allow a page
394: % break, since the best break might be right here.
395: \allowbreak
396: \nointerlineskip
397: \vtop to #1\mil{\vfil}%
398: %
399: % TeX does not even consider page breaks if a penalty added to the
400: % main vertical list is 10000 or more. But in order to see if the
401: % empty box we just added fits on the page, we must make it consider
402: % page breaks. On the other hand, we don't want to actually break the
403: % page after the empty box. So we use a penalty of 9999.
404: %
405: % There is an extremely small chance that TeX will actually break the
406: % page at this \penalty, if there are no other feasible breakpoints in
407: % sight. (If the user is using lots of big @group commands, which
408: % almost-but-not-quite fill up a page, TeX will have a hard time doing
409: % good page breaking, for example.) However, I could not construct an
410: % example where a page broke at this \penalty; if it happens in a real
411: % document, then we can reconsider our strategy.
412: \penalty9999
413: %
414: % Back up by the size of the box, whether we did a page break or not.
415: \kern -#1\mil
416: %
417: % Do not allow a page break right after this kern.
418: \nobreak
419: }
1.1 root 420:
421: % @br forces paragraph break
422:
423: \let\br = \par
424:
425: % @dots{} output some dots
426:
427: \def\dots{$\ldots$}
428:
429: % @page forces the start of a new page
430:
431: \def\page{\par\vfill\supereject}
432:
433: % @exdent text....
434: % outputs text on separate line in roman font, starting at standard page margin
435:
1.1.1.3 root 436: % This records the amount of indent in the innermost environment.
437: % That's how much \exdent should take out.
438: \newskip\exdentamount
439:
440: % This defn is used inside fill environments such as @defun.
441: \def\exdent{\parsearg\exdentyyy}
442: \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
443:
444: % This defn is used inside nofill environments such as @example.
445: \def\nofillexdent{\parsearg\nofillexdentyyy}
446: \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
447: \leftline{\hskip\leftskip{\rm#1}}}}
1.1 root 448:
1.1.1.3 root 449: %\hbox{{\rm#1}}\hfil\break}}
1.1 root 450:
451: % @include file insert text of that file as input.
452:
453: \def\include{\parsearg\includezzz}
454: \def\includezzz #1{{\def\thisfile{#1}\input #1
455: }}
456:
457: \def\thisfile{}
458:
459: % @center line outputs that line, centered
460:
461: \def\center{\parsearg\centerzzz}
462: \def\centerzzz #1{{\advance\hsize by -\leftskip
463: \advance\hsize by -\rightskip
464: \centerline{#1}}}
465:
466: % @sp n outputs n lines of vertical space
467:
468: \def\sp{\parsearg\spxxx}
469: \def\spxxx #1{\par \vskip #1\baselineskip}
470:
471: % @comment ...line which is ignored...
472: % @c is the same as @comment
473: % @ignore ... @end ignore is another way to write a comment
474:
475: \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
476: \parsearg \commentxxx}
477:
478: \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
479:
480: \let\c=\comment
481:
482: % Prevent errors for section commands.
483: % Used in @ignore and in failing conditionals.
484: \def\ignoresections{%
485: \let\chapter=\relax
486: \let\unnumbered=\relax
487: \let\top=\relax
488: \let\unnumberedsec=\relax
489: \let\unnumberedsection=\relax
490: \let\unnumberedsubsec=\relax
491: \let\unnumberedsubsection=\relax
492: \let\unnumberedsubsubsec=\relax
493: \let\unnumberedsubsubsection=\relax
494: \let\section=\relax
495: \let\subsec=\relax
496: \let\subsubsec=\relax
497: \let\subsection=\relax
498: \let\subsubsection=\relax
499: \let\appendix=\relax
500: \let\appendixsec=\relax
501: \let\appendixsection=\relax
502: \let\appendixsubsec=\relax
503: \let\appendixsubsection=\relax
504: \let\appendixsubsubsec=\relax
505: \let\appendixsubsubsection=\relax
506: \let\contents=\relax
507: \let\smallbook=\relax
508: \let\titlepage=\relax
509: }
510:
1.1.1.4 ! root 511: % Ignore @ignore ... @end ignore.
! 512: %
! 513: \def\ignore{\doignore{ignore}}
! 514:
! 515: % We ignore @ifinfo text.
! 516: %
! 517: \def\ifinfo{\doignore{ifinfo}}
! 518:
! 519: % Ignore text until a line `@end #1'.
! 520: %
! 521: \def\doignore#1{\begingroup
! 522: % Don't complain about control sequences we have declared \outer.
! 523: \ignoresections
! 524: %
! 525: % Define a command to swallow text until we reach `@end #1'.
! 526: \long\def\doignoretext##1\end #1{\enddoignore}%
! 527: %
! 528: % Make sure that spaces turn into tokens that match what \doignoretext wants.
! 529: \catcode32 = 10
! 530: %
! 531: % And now expand that command.
! 532: \doignoretext
! 533: }
! 534:
! 535: % What we do to finish off ignored text.
! 536: %
! 537: \def\enddoignore{\endgroup\ignorespaces}%
1.1 root 538:
539: \def\direntry{\begingroup\direntryxxx}
540: \long\def\direntryxxx #1\end direntry{\endgroup\ignorespaces}
541:
542: % Conditionals to test whether a flag is set.
543:
544: \def\ifset{\begingroup\ignoresections\parsearg\ifsetxxx}
545:
546: \def\ifsetxxx #1{\endgroup
1.1.1.4 ! root 547: \expandafter\ifx\csname SET#1\endcsname\relax \let\temp=\ifsetfail
1.1 root 548: \else \let\temp=\relax \fi
549: \temp}
550: \def\Eifset{}
1.1.1.4 ! root 551: \def\ifsetfail{\doignore{ifset}}
1.1 root 552:
553: \def\ifclear{\begingroup\ignoresections\parsearg\ifclearxxx}
554:
555: \def\ifclearxxx #1{\endgroup
1.1.1.4 ! root 556: \expandafter\ifx\csname SET#1\endcsname\relax \let\temp=\relax
1.1 root 557: \else \let\temp=\ifclearfail \fi
558: \temp}
559: \def\Eifclear{}
1.1.1.4 ! root 560: \def\ifclearfail{\doignore{ifclear}}
1.1 root 561:
1.1.1.4 ! root 562: % @set foo
! 563: % to set the flag named foo to a default value (empty)
! 564: % @set foo REST-OF-LINE
! 565: % to set the flag named foo to a text string REST-OF-LINE
1.1 root 566: % @clear foo to clear the flag named foo.
1.1.1.4 ! root 567: % @value{foo} to set the text saved in foo
! 568: %
! 569: % @set command, work macro \setyyy
! 570: %
! 571: \def\setyyy#1 #2\endsetyyy{\expandafter\xdef\csname SET#1\endcsname{#2\unskip}}
! 572: %
! 573: \def\setxxx#1{\setyyy#1 \endsetyyy}
1.1 root 574: \def\set{\parsearg\setxxx}
575:
576: \def\clear{\parsearg\clearxxx}
577: \def\clearxxx #1{
1.1.1.4 ! root 578: \expandafter\let\csname SET#1\endcsname=\relax}
! 579:
! 580: \def\value#1{\expandafter
! 581: \ifx\csname SET#1\endcsname\relax
! 582: {\{No value for ``#1''\}}
! 583: \else \csname SET#1\endcsname \fi}
1.1 root 584:
585: % Some texinfo constructs that are trivial in tex
586:
587: \def\iftex{}
588: \def\Eiftex{}
589:
590: \long\def\menu #1\end menu{}
591: \def\asis#1{#1}
592:
593: % @math means output in math mode.
594: % We don't use $'s directly in the definition of \math because control
595: % sequences like \math are expanded when the toc file is written. Then,
596: % we read the toc file back, the $'s will be normal characters (as they
597: % should be, according to the definition of Texinfo). So we must use a
598: % control sequence to switch into and out of math mode.
599: %
600: % This isn't quite enough for @math to work properly in indices, but it
601: % seems unlikely it will ever be needed there.
602: %
603: \let\implicitmath = $
604: \def\math#1{\implicitmath #1\implicitmath}
605:
1.1.1.4 ! root 606: % @bullet and @minus need the same treatment as @math, just above.
! 607: \def\bullet{\implicitmath\ptexbullet\implicitmath}
! 608: \def\minus{\implicitmath-\implicitmath}
! 609:
1.1 root 610: \def\node{\ENVcheck\parsearg\nodezzz}
611: \def\nodezzz#1{\nodexxx [#1,]}
612: \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
613: \let\lastnode=\relax
614:
615: \def\donoderef{\ifx\lastnode\relax\else
616: \expandafter\expandafter\expandafter\setref{\lastnode}\fi
617: \let\lastnode=\relax}
618:
619: \def\unnumbnoderef{\ifx\lastnode\relax\else
620: \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
621: \let\lastnode=\relax}
622:
623: \def\appendixnoderef{\ifx\lastnode\relax\else
624: \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
625: \let\lastnode=\relax}
626:
627: \let\refill=\relax
628:
629: % @setfilename is done at the beginning of every texinfo file.
630: % So open here the files we need to have open while reading the input.
631: % This makes it possible to make a .fmt file for texinfo.
632: \def\setfilename{%
633: \readauxfile
634: \opencontents
635: \openindices
636: \fixbackslash % Turn off hack to swallow `\input texinfo'.
637: \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
638: \comment % Ignore the actual filename.
639: }
640:
641: \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
642:
643: \def\inforef #1{\inforefzzz #1,,,,**}
644: \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}},
645: node \samp{\losespace#1{}}}
646: \def\losespace #1{#1}
647:
648: \message{fonts,}
649:
650: % Font-change commands.
651:
652: % Texinfo supports the sans serif font style, which plain TeX does not.
653: % So we set up a \sf analogous to plain's \rm, etc.
654: \newfam\sffam
655: \def\sf{\fam=\sffam \tensf}
656: \let\li = \sf % Sometimes we call it \li, not \sf.
657:
658: %% Try out Computer Modern fonts at \magstephalf
659: \let\mainmagstep=\magstephalf
660:
661: \ifx\bigger\relax
662: \let\mainmagstep=\magstep1
663: \font\textrm=cmr12
664: \font\texttt=cmtt12
665: \else
666: \font\textrm=cmr10 scaled \mainmagstep
667: \font\texttt=cmtt10 scaled \mainmagstep
668: \fi
669: % Instead of cmb10, you many want to use cmbx10.
670: % cmbx10 is a prettier font on its own, but cmb10
671: % looks better when embedded in a line with cmr10.
672: \font\textbf=cmb10 scaled \mainmagstep
673: \font\textit=cmti10 scaled \mainmagstep
674: \font\textsl=cmsl10 scaled \mainmagstep
675: \font\textsf=cmss10 scaled \mainmagstep
676: \font\textsc=cmcsc10 scaled \mainmagstep
677: \font\texti=cmmi10 scaled \mainmagstep
678: \font\textsy=cmsy10 scaled \mainmagstep
679:
680: % A few fonts for @defun, etc.
681: \font\defbf=cmbx10 scaled \magstep1 %was 1314
682: \font\deftt=cmtt10 scaled \magstep1
683: \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
684:
685: % Fonts for indices and small examples.
686: % We actually use the slanted font rather than the italic,
687: % because texinfo normally uses the slanted fonts for that.
688: % Do not make many font distinctions in general in the index, since they
689: % aren't very useful.
690: \font\ninett=cmtt9
691: \font\indrm=cmr9
692: \font\indit=cmsl9
693: \let\indsl=\indit
694: \let\indtt=\ninett
695: \let\indsf=\indrm
696: \let\indbf=\indrm
697: \let\indsc=\indrm
698: \font\indi=cmmi9
699: \font\indsy=cmsy9
700:
701: % Fonts for headings
702: \font\chaprm=cmbx12 scaled \magstep2
703: \font\chapit=cmti12 scaled \magstep2
704: \font\chapsl=cmsl12 scaled \magstep2
705: \font\chaptt=cmtt12 scaled \magstep2
706: \font\chapsf=cmss12 scaled \magstep2
707: \let\chapbf=\chaprm
708: \font\chapsc=cmcsc10 scaled\magstep3
709: \font\chapi=cmmi12 scaled \magstep2
710: \font\chapsy=cmsy10 scaled \magstep3
711:
712: \font\secrm=cmbx12 scaled \magstep1
713: \font\secit=cmti12 scaled \magstep1
714: \font\secsl=cmsl12 scaled \magstep1
715: \font\sectt=cmtt12 scaled \magstep1
716: \font\secsf=cmss12 scaled \magstep1
717: \font\secbf=cmbx12 scaled \magstep1
718: \font\secsc=cmcsc10 scaled\magstep2
719: \font\seci=cmmi12 scaled \magstep1
720: \font\secsy=cmsy10 scaled \magstep2
721:
722: % \font\ssecrm=cmbx10 scaled \magstep1 % This size an font looked bad.
723: % \font\ssecit=cmti10 scaled \magstep1 % The letters were too crowded.
724: % \font\ssecsl=cmsl10 scaled \magstep1
725: % \font\ssectt=cmtt10 scaled \magstep1
726: % \font\ssecsf=cmss10 scaled \magstep1
727:
728: %\font\ssecrm=cmb10 scaled 1315 % Note the use of cmb rather than cmbx.
729: %\font\ssecit=cmti10 scaled 1315 % Also, the size is a little larger than
730: %\font\ssecsl=cmsl10 scaled 1315 % being scaled magstep1.
731: %\font\ssectt=cmtt10 scaled 1315
732: %\font\ssecsf=cmss10 scaled 1315
733:
734: %\let\ssecbf=\ssecrm
735:
736: \font\ssecrm=cmbx12 scaled \magstephalf
737: \font\ssecit=cmti12 scaled \magstephalf
738: \font\ssecsl=cmsl12 scaled \magstephalf
739: \font\ssectt=cmtt12 scaled \magstephalf
740: \font\ssecsf=cmss12 scaled \magstephalf
741: \font\ssecbf=cmbx12 scaled \magstephalf
742: \font\ssecsc=cmcsc10 scaled \magstep1
743: \font\sseci=cmmi12 scaled \magstephalf
744: \font\ssecsy=cmsy10 scaled \magstep1
745: % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
746: % but that is not a standard magnification.
747:
748: % Fonts for title page:
749: \font\titlerm = cmbx12 scaled \magstep3
750: \let\authorrm = \secrm
751:
752: % In order for the font changes to affect most math symbols and letters,
753: % we have to define the \textfont of the standard families. Since
754: % texinfo doesn't allow for producing subscripts and superscripts, we
755: % don't bother to reset \scriptfont and \scriptscriptfont (which would
756: % also require loading a lot more fonts).
757: %
758: \def\resetmathfonts{%
759: \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
760: \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
761: \textfont\ttfam = \tentt \textfont\sffam = \tensf
762: }
763:
764:
765: % The font-changing commands redefine the meanings of \tenSTYLE, instead
766: % of just \STYLE. We do this so that font changes will continue to work
767: % in math mode, where it is the current \fam that is relevant in most
768: % cases, not the current. Plain TeX does, for example,
769: % \def\bf{\fam=\bffam \tenbf} By redefining \tenbf, we obviate the need
770: % to redefine \bf itself.
771: \def\textfonts{%
772: \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
773: \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
774: \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
775: \resetmathfonts}
776: \def\chapfonts{%
777: \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
778: \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
779: \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
780: \resetmathfonts}
781: \def\secfonts{%
782: \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
783: \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
784: \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
785: \resetmathfonts}
786: \def\subsecfonts{%
787: \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
788: \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
789: \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
790: \resetmathfonts}
791: \def\indexfonts{%
792: \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
793: \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
794: \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
795: \resetmathfonts}
796:
797: % Set up the default fonts, so we can use them for creating boxes.
798: %
799: \textfonts
800:
801: % Count depth in font-changes, for error checks
802: \newcount\fontdepth \fontdepth=0
803:
804: % Fonts for short table of contents.
805: \font\shortcontrm=cmr12
806: \font\shortcontbf=cmbx12
807: \font\shortcontsl=cmsl12
808:
809: %% Add scribe-like font environments, plus @l for inline lisp (usually sans
810: %% serif) and @ii for TeX italic
811:
812: % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
813: % unless the following character is such as not to need one.
814: \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
815: \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
816:
817: \let\i=\smartitalic
818: \let\var=\smartitalic
819: \let\dfn=\smartitalic
820: \let\emph=\smartitalic
821: \let\cite=\smartitalic
822:
823: \def\b#1{{\bf #1}}
824: \let\strong=\b
825:
826: \def\t#1{{\tt \exhyphenpenalty=10000\rawbackslash \frenchspacing #1}\null}
827: \let\ttfont = \t
828: %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
829: \def\samp #1{`\tclose{#1}'\null}
830: \def\key #1{{\tt \exhyphenpenalty=10000\uppercase{#1}}\null}
831: \def\ctrl #1{{\tt \rawbackslash \hat}#1}
832:
833: \let\file=\samp
834:
835: % @code is a modification of @t,
836: % which makes spaces the same size as normal in the surrounding text.
837: \newdimen\tclosesave
838: \newdimen\tcloserm
839: \def\tclose#1{{\rm \tcloserm=\fontdimen2\font \tt \tclosesave=\fontdimen2\font
840: \fontdimen2\font=\tcloserm
841: % prevent breaking lines at hyphens.
842: \exhyphenpenalty=10000
843: \def\ {{\fontdimen2\font=\tclosesave{} }}%
844: \rawbackslash \frenchspacing #1\fontdimen2\font=\tclosesave}\null}
845: \let\code=\tclose
846: %\let\exp=\tclose %Was temporary
847:
848: % @kbd is like @code, except that if the argument is just one @key command,
849: % then @kbd has no effect.
850:
851: \def\xkey{\key}
852: \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
853: \ifx\one\xkey\ifx\threex\three \key{#2}%
854: \else\tclose{\look}\fi
855: \else\tclose{\look}\fi}
856:
857: % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
858: % argument is to make the input look right: @dmn{pt} instead of
859: % @dmn{}pt.
860: %
861: \def\dmn#1{\thinspace #1}
862:
863: \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
864:
865: \def\l#1{{\li #1}\null} %
866:
867: \def\r#1{{\rm #1}} % roman font
868: % Use of \lowercase was suggested.
869: \def\sc#1{{\smallcaps#1}} % smallcaps font
870: \def\ii#1{{\it #1}} % italic font
871:
872: \message{page headings,}
873:
874: \newskip\titlepagetopglue \titlepagetopglue = 1.5in
875: \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
876:
877: % First the title page. Must do @settitle before @titlepage.
878: \def\titlefont#1{{\titlerm #1}}
879:
880: \newtoks\realeverypar
881: \newif\ifseenauthor
882: \newif\iffinishedtitlepage
883:
884: \def\titlepage{\begingroup \parindent=0pt \textfonts
885: \let\subtitlerm=\tenrm
886: % I deinstalled the following change because \cmr12 is undefined.
887: % This change was not in the ChangeLog anyway. --rms.
888: % \let\subtitlerm=\cmr12
889: \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
890: %
891: \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
892: %
893: % Leave some space at the very top of the page.
894: \vglue\titlepagetopglue
895: %
896: % Now you can print the title using @title.
897: \def\title{\parsearg\titlezzz}%
898: \def\titlezzz##1{\leftline{\titlefont{##1}}
899: % print a rule at the page bottom also.
900: \finishedtitlepagefalse
901: \vskip4pt \hrule height 4pt \vskip4pt}%
902: % No rule at page bottom unless we print one at the top with @title.
903: \finishedtitlepagetrue
904: %
905: % Now you can put text using @subtitle.
906: \def\subtitle{\parsearg\subtitlezzz}%
907: \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
908: %
909: % @author should come last, but may come many times.
910: \def\author{\parsearg\authorzzz}%
911: \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
912: {\authorfont \leftline{##1}}}%
913: %
914: % Most title ``pages'' are actually two pages long, with space
915: % at the top of the second. We don't want the ragged left on the second.
916: \let\oldpage = \page
917: \def\page{%
918: \iffinishedtitlepage\else
919: \finishtitlepage
920: \fi
921: \oldpage
922: \let\page = \oldpage
923: \hbox{}}%
924: % \def\page{\oldpage \hbox{}}
925: }
926:
927: \def\Etitlepage{%
928: \iffinishedtitlepage\else
929: \finishtitlepage
930: \fi
931: % It is important to do the page break before ending the group,
932: % because the headline and footline are only empty inside the group.
933: % If we use the new definition of \page, we always get a blank page
934: % after the title page, which we certainly don't want.
935: \oldpage
936: \endgroup
937: \HEADINGSon
938: }
939:
940: \def\finishtitlepage{%
941: \vskip4pt \hrule height 2pt
942: \vskip\titlepagebottomglue
943: \finishedtitlepagetrue
944: }
945:
946: %%% Set up page headings and footings.
947:
948: \let\thispage=\folio
949:
950: \newtoks \evenheadline % Token sequence for heading line of even pages
951: \newtoks \oddheadline % Token sequence for heading line of odd pages
952: \newtoks \evenfootline % Token sequence for footing line of even pages
953: \newtoks \oddfootline % Token sequence for footing line of odd pages
954:
955: % Now make Tex use those variables
956: \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
957: \else \the\evenheadline \fi}}
958: \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
959: \else \the\evenfootline \fi}\HEADINGShook}
960: \let\HEADINGShook=\relax
961:
962: % Commands to set those variables.
963: % For example, this is what @headings on does
964: % @evenheading @thistitle|@thispage|@thischapter
965: % @oddheading @thischapter|@thispage|@thistitle
966: % @evenfooting @thisfile||
967: % @oddfooting ||@thisfile
968:
969: \def\evenheading{\parsearg\evenheadingxxx}
970: \def\oddheading{\parsearg\oddheadingxxx}
971: \def\everyheading{\parsearg\everyheadingxxx}
972:
973: \def\evenfooting{\parsearg\evenfootingxxx}
974: \def\oddfooting{\parsearg\oddfootingxxx}
975: \def\everyfooting{\parsearg\everyfootingxxx}
976:
977: {\catcode`\@=0 %
978:
979: \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
980: \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
981: \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
982:
983: \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
984: \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
985: \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
986:
987: \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
988: \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
989: \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
990: \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
991:
992: \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
993: \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
994: \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
995:
996: \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
997: \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
998: \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
999:
1000: \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
1001: \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
1002: \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1003: \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1004: %
1005: }% unbind the catcode of @.
1006:
1007: % @headings double turns headings on for double-sided printing.
1008: % @headings single turns headings on for single-sided printing.
1009: % @headings off turns them off.
1010: % @headings on same as @headings double, retained for compatibility.
1011: % @headings after turns on double-sided headings after this page.
1012: % @headings doubleafter turns on double-sided headings after this page.
1013: % @headings singleafter turns on single-sided headings after this page.
1014: % By default, they are off.
1015:
1016: \def\headings #1 {\csname HEADINGS#1\endcsname}
1017:
1018: \def\HEADINGSoff{
1019: \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1020: \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1021: \HEADINGSoff
1022: % When we turn headings on, set the page number to 1.
1023: % For double-sided printing, put current file name in lower left corner,
1024: % chapter name on inside top of right hand pages, document
1025: % title on inside top of left hand pages, and page numbers on outside top
1026: % edge of all pages.
1027: \def\HEADINGSdouble{
1028: %\pagealignmacro
1029: \global\pageno=1
1030: \global\evenfootline={\hfil}
1031: \global\oddfootline={\hfil}
1032: \global\evenheadline={\line{\folio\hfil\thistitle}}
1033: \global\oddheadline={\line{\thischapter\hfil\folio}}
1034: }
1035: % For single-sided printing, chapter title goes across top left of page,
1036: % page number on top right.
1037: \def\HEADINGSsingle{
1038: %\pagealignmacro
1039: \global\pageno=1
1040: \global\evenfootline={\hfil}
1041: \global\oddfootline={\hfil}
1042: \global\evenheadline={\line{\thischapter\hfil\folio}}
1043: \global\oddheadline={\line{\thischapter\hfil\folio}}
1044: }
1045: \def\HEADINGSon{\HEADINGSdouble}
1046:
1047: \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1048: \let\HEADINGSdoubleafter=\HEADINGSafter
1049: \def\HEADINGSdoublex{%
1050: \global\evenfootline={\hfil}
1051: \global\oddfootline={\hfil}
1052: \global\evenheadline={\line{\folio\hfil\thistitle}}
1053: \global\oddheadline={\line{\thischapter\hfil\folio}}
1054: }
1055:
1056: \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1057: \def\HEADINGSsinglex{%
1058: \global\evenfootline={\hfil}
1059: \global\oddfootline={\hfil}
1060: \global\evenheadline={\line{\thischapter\hfil\folio}}
1061: \global\oddheadline={\line{\thischapter\hfil\folio}}
1062: }
1063:
1064: % Subroutines used in generating headings
1065: % Produces Day Month Year style of output.
1066: \def\today{\number\day\space
1067: \ifcase\month\or
1068: January\or February\or March\or April\or May\or June\or
1069: July\or August\or September\or October\or November\or December\fi
1070: \space\number\year}
1071:
1072: % Use this if you want the Month Day, Year style of output.
1073: %\def\today{\ifcase\month\or
1074: %January\or February\or March\or April\or May\or June\or
1075: %July\or August\or September\or October\or November\or December\fi
1076: %\space\number\day, \number\year}
1077:
1078: % @settitle line... specifies the title of the document, for headings
1079: % It generates no output of its own
1080:
1081: \def\thistitle{No Title}
1082: \def\settitle{\parsearg\settitlezzz}
1083: \def\settitlezzz #1{\gdef\thistitle{#1}}
1084:
1085: \message{tables,}
1086:
1087: % @tabs -- simple alignment
1088:
1089: % These don't work. For one thing, \+ is defined as outer.
1090: % So these macros cannot even be defined.
1091:
1092: %\def\tabs{\parsearg\tabszzz}
1093: %\def\tabszzz #1{\settabs\+#1\cr}
1094: %\def\tabline{\parsearg\tablinezzz}
1095: %\def\tablinezzz #1{\+#1\cr}
1096: %\def\&{&}
1097:
1.1.1.3 root 1098: % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1.1 root 1099:
1100: % default indentation of table text
1101: \newdimen\tableindent \tableindent=.8in
1102: % default indentation of @itemize and @enumerate text
1103: \newdimen\itemindent \itemindent=.3in
1104: % margin between end of table item and start of table text.
1105: \newdimen\itemmargin \itemmargin=.1in
1106:
1107: % used internally for \itemindent minus \itemmargin
1108: \newdimen\itemmax
1109:
1.1.1.3 root 1110: % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1111: % these defs.
1.1 root 1112: % They also define \itemindex
1113: % to index the item name in whatever manner is desired (perhaps none).
1114:
1115: \def\internalBitem{\smallbreak \parsearg\itemzzz}
1116: \def\internalBitemx{\par \parsearg\itemzzz}
1117:
1118: \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1119: \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
1120:
1121: \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1122: \def\internalBkitemx{\par \parsearg\kitemzzz}
1123:
1124: \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1125: \itemzzz {#1}}
1126:
1127: \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1128: \itemzzz {#1}}
1129:
1130: \def\itemzzz #1{\begingroup %
1131: \advance\hsize by -\rightskip
1132: \advance\hsize by -\tableindent
1133: \setbox0=\hbox{\itemfont{#1}}%
1134: \itemindex{#1}%
1135: \nobreak % This prevents a break before @itemx.
1136: %
1137: % Be sure we are not still in the middle of a paragraph.
1138: \parskip=0in
1139: \par
1140: %
1141: % If the item text does not fit in the space we have, put it on a line
1142: % by itself, and do not allow a page break either before or after that
1143: % line. We do not start a paragraph here because then if the next
1144: % command is, e.g., @kindex, the whatsit would get put into the
1145: % horizontal list on a line by itself, resulting in extra blank space.
1146: \ifdim \wd0>\itemmax
1147: \setbox0=\hbox{\hskip \leftskip \hskip -\tableindent \unhbox0}\box0
1148: \nobreak
1149: \else
1150: % The item text fits into the space. Start a paragraph, so that the
1151: % following text (if any) will end up on the same line. Since that
1152: % text will be indented by \tableindent, we make the item text be in
1153: % a zero-width box.
1154: \noindent
1155: \rlap{\hskip -\tableindent\box0}%
1156: \fi
1157: \endgroup
1158: }
1159:
1160: \def\item{\errmessage{@item while not in a table}}
1161: \def\itemx{\errmessage{@itemx while not in a table}}
1162: \def\kitem{\errmessage{@kitem while not in a table}}
1163: \def\kitemx{\errmessage{@kitemx while not in a table}}
1164: \def\xitem{\errmessage{@xitem while not in a table}}
1165: \def\xitemx{\errmessage{@xitemx while not in a table}}
1166:
1167: %% Contains a kludge to get @end[description] to work
1168: \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1169:
1170: \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1171: {\obeylines\obeyspaces%
1172: \gdef\tablex #1^^M{%
1173: \tabley\dontindex#1 \endtabley}}
1174:
1175: \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1176: {\obeylines\obeyspaces%
1177: \gdef\ftablex #1^^M{%
1178: \tabley\fnitemindex#1 \endtabley
1179: \def\Eftable{\endgraf\endgroup\afterenvbreak}%
1180: \let\Etable=\relax}}
1181:
1.1.1.3 root 1182: \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1183: {\obeylines\obeyspaces%
1184: \gdef\vtablex #1^^M{%
1185: \tabley\vritemindex#1 \endtabley
1186: \def\Evtable{\endgraf\endgroup\afterenvbreak}%
1187: \let\Etable=\relax}}
1188:
1.1 root 1189: \def\dontindex #1{}
1190: \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1.1.1.3 root 1191: \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1.1 root 1192:
1193: {\obeyspaces %
1194: \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1195: \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1196:
1197: \def\tablez #1#2#3#4#5#6{%
1198: \aboveenvbreak %
1199: \begingroup %
1200: \def\Edescription{\Etable}% Neccessary kludge.
1201: \let\itemindex=#1%
1202: \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1203: \ifnum 0#4>0 \tableindent=#4\mil \fi %
1204: \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1205: \def\itemfont{#2}%
1206: \itemmax=\tableindent %
1207: \advance \itemmax by -\itemmargin %
1208: \advance \leftskip by \tableindent %
1.1.1.3 root 1209: \exdentamount=\tableindent
1.1 root 1210: \parindent = 0pt
1211: \parskip = \smallskipamount
1212: \ifdim \parskip=0pt \parskip=2pt \fi%
1213: \def\Etable{\endgraf\endgroup\afterenvbreak}%
1214: \let\item = \internalBitem %
1215: \let\itemx = \internalBitemx %
1216: \let\kitem = \internalBkitem %
1217: \let\kitemx = \internalBkitemx %
1218: \let\xitem = \internalBxitem %
1219: \let\xitemx = \internalBxitemx %
1220: }
1221:
1222: % This is the counter used by @enumerate, which is really @itemize
1223:
1224: \newcount \itemno
1225:
1226: \def\itemize{\parsearg\itemizezzz}
1227:
1228: \def\itemizezzz #1{%
1229: \begingroup % ended by the @end itemsize
1230: \itemizey {#1}{\Eitemize}
1231: }
1232:
1233: \def\itemizey #1#2{%
1234: \aboveenvbreak %
1235: \itemmax=\itemindent %
1236: \advance \itemmax by -\itemmargin %
1237: \advance \leftskip by \itemindent %
1.1.1.3 root 1238: \exdentamount=\itemindent
1.1 root 1239: \parindent = 0pt %
1240: \parskip = \smallskipamount %
1241: \ifdim \parskip=0pt \parskip=2pt \fi%
1242: \def#2{\endgraf\endgroup\afterenvbreak}%
1243: \def\itemcontents{#1}%
1244: \let\item=\itemizeitem}
1245:
1246: % Set sfcode to normal for the chars that usually have another value.
1247: % These are `.?!:;,'
1248: \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1249: \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1250:
1251: % \splitoff TOKENS\endmark defines \first to be the first token in
1252: % TOKENS, and \rest to be the remainder.
1253: %
1254: \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1255:
1256: % Allow an optional argument of an uppercase letter, lowercase letter,
1257: % or number, to specify the first label in the enumerated list. No
1258: % argument is the same as `1'.
1259: %
1260: \def\enumerate{\parsearg\enumeratezzz}
1261: \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1262: \def\enumeratey #1 #2\endenumeratey{%
1263: \begingroup % ended by the @end enumerate
1264: %
1265: % If we were given no argument, pretend we were given `1'.
1266: \def\thearg{#1}%
1267: \ifx\thearg\empty \def\thearg{1}\fi
1268: %
1269: % Detect if the argument is a single token. If so, it might be a
1270: % letter. Otherwise, the only valid thing it can be is a number.
1271: % (We will always have one token, because of the test we just made.
1272: % This is a good thing, since \splitoff doesn't work given nothing at
1273: % all -- the first parameter is undelimited.)
1274: \expandafter\splitoff\thearg\endmark
1275: \ifx\rest\empty
1276: % Only one token in the argument. It could still be anything.
1277: % A ``lowercase letter'' is one whose \lccode is nonzero.
1278: % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1279: % not equal to itself.
1280: % Otherwise, we assume it's a number.
1281: %
1282: % We need the \relax at the end of the \ifnum lines to stop TeX from
1283: % continuing to look for a <number>.
1284: %
1285: \ifnum\lccode\expandafter`\thearg=0\relax
1286: \numericenumerate % a number (we hope)
1287: \else
1288: % It's a letter.
1289: \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1290: \lowercaseenumerate % lowercase letter
1291: \else
1292: \uppercaseenumerate % uppercase letter
1293: \fi
1294: \fi
1295: \else
1296: % Multiple tokens in the argument. We hope it's a number.
1297: \numericenumerate
1298: \fi
1299: }
1300:
1301: % An @enumerate whose labels are integers. The starting integer is
1302: % given in \thearg.
1303: %
1304: \def\numericenumerate{%
1305: \itemno = \thearg
1306: \startenumeration{\the\itemno}%
1307: }
1308:
1309: % The starting (lowercase) letter is in \thearg.
1310: \def\lowercaseenumerate{%
1311: \itemno = \expandafter`\thearg
1312: \startenumeration{%
1313: % Be sure we're not beyond the end of the alphabet.
1314: \ifnum\itemno=0
1315: \errmessage{No more lowercase letters in @enumerate; get a bigger
1316: alphabet}%
1317: \fi
1318: \char\lccode\itemno
1319: }%
1320: }
1321:
1322: % The starting (uppercase) letter is in \thearg.
1323: \def\uppercaseenumerate{%
1324: \itemno = \expandafter`\thearg
1325: \startenumeration{%
1326: % Be sure we're not beyond the end of the alphabet.
1327: \ifnum\itemno=0
1328: \errmessage{No more uppercase letters in @enumerate; get a bigger
1329: alphabet}
1330: \fi
1331: \char\uccode\itemno
1332: }%
1333: }
1334:
1335: % Call itemizey, adding a period to the first argument and supplying the
1336: % common last two arguments. Also subtract one from the initial value in
1337: % \itemno, since @item increments \itemno.
1338: %
1339: \def\startenumeration#1{%
1340: \advance\itemno by -1
1341: \itemizey{#1.}\Eenumerate\flushcr
1342: }
1343:
1344: % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1345: % to @enumerate.
1346: %
1347: \def\alphaenumerate{\enumerate{a}}
1348: \def\capsenumerate{\enumerate{A}}
1349: \def\Ealphaenumerate{\Eenumerate}
1350: \def\Ecapsenumerate{\Eenumerate}
1351:
1352: % Definition of @item while inside @itemize.
1353:
1354: \def\itemizeitem{%
1355: \advance\itemno by 1
1356: {\let\par=\endgraf \smallbreak}%
1357: \ifhmode \errmessage{\in hmode at itemizeitem}\fi
1358: {\parskip=0in \hskip 0pt
1359: \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1360: \vadjust{\penalty 1200}}%
1361: \flushcr}
1362:
1363: \message{indexing,}
1364: % Index generation facilities
1365:
1366: % Define \newwrite to be identical to plain tex's \newwrite
1367: % except not \outer, so it can be used within \newindex.
1368: {\catcode`\@=11
1369: \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
1370:
1371: % \newindex {foo} defines an index named foo.
1372: % It automatically defines \fooindex such that
1373: % \fooindex ...rest of line... puts an entry in the index foo.
1374: % It also defines \fooindfile to be the number of the output channel for
1375: % the file that accumulates this index. The file's extension is foo.
1376: % The name of an index should be no more than 2 characters long
1377: % for the sake of vms.
1378:
1379: \def\newindex #1{
1380: \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
1381: \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
1382: \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1383: \noexpand\doindex {#1}}
1384: }
1385:
1386: % @defindex foo == \newindex{foo}
1387:
1388: \def\defindex{\parsearg\newindex}
1389:
1390: % Define @defcodeindex, like @defindex except put all entries in @code.
1391:
1392: \def\newcodeindex #1{
1393: \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
1394: \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
1395: \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1396: \noexpand\docodeindex {#1}}
1397: }
1398:
1399: \def\defcodeindex{\parsearg\newcodeindex}
1400:
1401: % @synindex foo bar makes index foo feed into index bar.
1402: % Do this instead of @defindex foo if you don't want it as a separate index.
1403: \def\synindex #1 #2 {%
1404: \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
1405: \expandafter\let\csname#1indfile\endcsname=\synindexfoo
1406: \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1407: \noexpand\doindex {#2}}%
1408: }
1409:
1410: % @syncodeindex foo bar similar, but put all entries made for index foo
1411: % inside @code.
1412: \def\syncodeindex #1 #2 {%
1413: \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
1414: \expandafter\let\csname#1indfile\endcsname=\synindexfoo
1415: \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1416: \noexpand\docodeindex {#2}}%
1417: }
1418:
1419: % Define \doindex, the driver for all \fooindex macros.
1420: % Argument #1 is generated by the calling \fooindex macro,
1421: % and it is "foo", the name of the index.
1422:
1423: % \doindex just uses \parsearg; it calls \doind for the actual work.
1424: % This is because \doind is more useful to call from other macros.
1425:
1426: % There is also \dosubind {index}{topic}{subtopic}
1427: % which makes an entry in a two-level index such as the operation index.
1428:
1429: \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
1430: \def\singleindexer #1{\doind{\indexname}{#1}}
1431:
1432: % like the previous two, but they put @code around the argument.
1433: \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
1434: \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
1435:
1436: \def\indexdummies{%
1437: \def\_{{\realbackslash _}}%
1438: \def\w{\realbackslash w }%
1439: \def\bf{\realbackslash bf }%
1440: \def\rm{\realbackslash rm }%
1441: \def\sl{\realbackslash sl }%
1442: \def\sf{\realbackslash sf}%
1443: \def\tt{\realbackslash tt}%
1444: \def\gtr{\realbackslash gtr}%
1445: \def\less{\realbackslash less}%
1446: \def\hat{\realbackslash hat}%
1447: \def\char{\realbackslash char}%
1448: \def\TeX{\realbackslash TeX}%
1449: \def\dots{\realbackslash dots }%
1450: \def\copyright{\realbackslash copyright }%
1451: \def\tclose##1{\realbackslash tclose {##1}}%
1452: \def\code##1{\realbackslash code {##1}}%
1453: \def\samp##1{\realbackslash samp {##1}}%
1454: \def\t##1{\realbackslash r {##1}}%
1455: \def\r##1{\realbackslash r {##1}}%
1456: \def\i##1{\realbackslash i {##1}}%
1457: \def\b##1{\realbackslash b {##1}}%
1458: \def\cite##1{\realbackslash cite {##1}}%
1459: \def\key##1{\realbackslash key {##1}}%
1460: \def\file##1{\realbackslash file {##1}}%
1461: \def\var##1{\realbackslash var {##1}}%
1462: \def\kbd##1{\realbackslash kbd {##1}}%
1463: }
1464:
1465: % \indexnofonts no-ops all font-change commands.
1466: % This is used when outputting the strings to sort the index by.
1467: \def\indexdummyfont#1{#1}
1468: \def\indexdummytex{TeX}
1469: \def\indexdummydots{...}
1470:
1471: \def\indexnofonts{%
1472: \let\w=\indexdummyfont
1473: \let\t=\indexdummyfont
1474: \let\r=\indexdummyfont
1475: \let\i=\indexdummyfont
1476: \let\b=\indexdummyfont
1477: \let\emph=\indexdummyfont
1478: \let\strong=\indexdummyfont
1479: \let\cite=\indexdummyfont
1480: \let\sc=\indexdummyfont
1481: %Don't no-op \tt, since it isn't a user-level command
1482: % and is used in the definitions of the active chars like <, >, |...
1483: %\let\tt=\indexdummyfont
1484: \let\tclose=\indexdummyfont
1485: \let\code=\indexdummyfont
1486: \let\file=\indexdummyfont
1487: \let\samp=\indexdummyfont
1488: \let\kbd=\indexdummyfont
1489: \let\key=\indexdummyfont
1490: \let\var=\indexdummyfont
1491: \let\TeX=\indexdummytex
1492: \let\dots=\indexdummydots
1493: }
1494:
1495: % To define \realbackslash, we must make \ not be an escape.
1496: % We must first make another character (@) an escape
1497: % so we do not become unable to do a definition.
1498:
1499: {\catcode`\@=0 \catcode`\\=\other
1500: @gdef@realbackslash{\}}
1501:
1502: \let\indexbackslash=0 %overridden during \printindex.
1503:
1504: \def\doind #1#2{%
1505: {\count10=\lastpenalty %
1506: {\indexdummies % Must do this here, since \bf, etc expand at this stage
1507: \escapechar=`\\%
1508: {\let\folio=0% Expand all macros now EXCEPT \folio
1509: \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
1510: % so it will be output as is; and it will print as backslash in the indx.
1511: %
1512: % Now process the index-string once, with all font commands turned off,
1513: % to get the string to sort the index by.
1514: {\indexnofonts
1515: \xdef\temp1{#2}%
1516: }%
1517: % Now produce the complete index entry. We process the index-string again,
1518: % this time with font commands expanded, to get what to print in the index.
1519: \edef\temp{%
1520: \write \csname#1indfile\endcsname{%
1521: \realbackslash entry {\temp1}{\folio}{#2}}}%
1522: \temp }%
1523: }\penalty\count10}}
1524:
1525: \def\dosubind #1#2#3{%
1526: {\count10=\lastpenalty %
1527: {\indexdummies % Must do this here, since \bf, etc expand at this stage
1528: \escapechar=`\\%
1529: {\let\folio=0%
1530: \def\rawbackslashxx{\indexbackslash}%
1531: %
1532: % Now process the index-string once, with all font commands turned off,
1533: % to get the string to sort the index by.
1534: {\indexnofonts
1535: \xdef\temp1{#2 #3}%
1536: }%
1537: % Now produce the complete index entry. We process the index-string again,
1538: % this time with font commands expanded, to get what to print in the index.
1539: \edef\temp{%
1540: \write \csname#1indfile\endcsname{%
1541: \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
1542: \temp }%
1543: }\penalty\count10}}
1544:
1545: % The index entry written in the file actually looks like
1546: % \entry {sortstring}{page}{topic}
1547: % or
1548: % \entry {sortstring}{page}{topic}{subtopic}
1549: % The texindex program reads in these files and writes files
1550: % containing these kinds of lines:
1551: % \initial {c}
1552: % before the first topic whose initial is c
1553: % \entry {topic}{pagelist}
1554: % for a topic that is used without subtopics
1555: % \primary {topic}
1556: % for the beginning of a topic that is used with subtopics
1557: % \secondary {subtopic}{pagelist}
1558: % for each subtopic.
1559:
1560: % Define the user-accessible indexing commands
1561: % @findex, @vindex, @kindex, @cindex.
1562:
1563: \def\findex {\fnindex}
1564: \def\kindex {\kyindex}
1565: \def\cindex {\cpindex}
1566: \def\vindex {\vrindex}
1567: \def\tindex {\tpindex}
1568: \def\pindex {\pgindex}
1569:
1570: \def\cindexsub {\begingroup\obeylines\cindexsub}
1571: {\obeylines %
1572: \gdef\cindexsub "#1" #2^^M{\endgroup %
1573: \dosubind{cp}{#2}{#1}}}
1574:
1575: % Define the macros used in formatting output of the sorted index material.
1576:
1577: % This is what you call to cause a particular index to get printed.
1578: % Write
1579: % @unnumbered Function Index
1580: % @printindex fn
1581:
1582: \def\printindex{\parsearg\doprintindex}
1583:
1584: \def\doprintindex#1{%
1585: \tex
1586: \dobreak \chapheadingskip {10000}
1587: \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
1588: \catcode`\$=\other\catcode`\_=\other
1589: \catcode`\~=\other
1590: %
1591: % The following don't help, since the chars were translated
1592: % when the raw index was written, and their fonts were discarded
1593: % due to \indexnofonts.
1594: %\catcode`\"=\active
1595: %\catcode`\^=\active
1596: %\catcode`\_=\active
1597: %\catcode`\|=\active
1598: %\catcode`\<=\active
1599: %\catcode`\>=\active
1600: % %
1601: \def\indexbackslash{\rawbackslashxx}
1602: \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
1603: \begindoublecolumns
1604: %
1605: % See if the index file exists and is nonempty.
1606: \openin 1 \jobname.#1s
1607: \ifeof 1
1608: % \enddoublecolumns gets confused if there is no text in the index,
1609: % and it loses the chapter title and the aux file entries for the
1610: % index. The easiest way to prevent this problem is to make sure
1611: % there is some text.
1612: (Index is nonexistent)
1613: \else
1614: %
1615: % If the index file exists but is empty, then \openin leaves \ifeof
1616: % false. We have to make TeX try to read something from the file, so
1617: % it can discover if there is anything in it.
1618: \read 1 to \temp
1619: \ifeof 1
1620: (Index is empty)
1621: \else
1622: \input \jobname.#1s
1623: \fi
1624: \fi
1625: \closein 1
1626: \enddoublecolumns
1627: \Etex
1628: }
1629:
1630: % These macros are used by the sorted index file itself.
1631: % Change them to control the appearance of the index.
1632:
1633: % Same as \bigskipamount except no shrink.
1634: % \balancecolumns gets confused if there is any shrink.
1635: \newskip\initialskipamount \initialskipamount 12pt plus4pt
1636:
1637: \def\initial #1{%
1638: {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
1639: \ifdim\lastskip<\initialskipamount
1640: \removelastskip \penalty-200 \vskip \initialskipamount\fi
1641: \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
1642:
1.1.1.4 ! root 1643: % This typesets a paragraph consisting of #1, dot leaders, and then #2
! 1644: % flush to the right margin. It is used for index and table of contents
! 1645: % entries. The paragraph is indented by \leftskip.
! 1646: %
1.1.1.3 root 1647: \def\entry #1#2{\begingroup
1648: %
1.1.1.4 ! root 1649: % Start a new paragraph if necessary, so our assignments below can't
! 1650: % affect previous text.
! 1651: \par
! 1652: %
! 1653: % Do not fill out the last line with white space.
! 1654: \parfillskip = 0in
! 1655: %
! 1656: % No extra space above this paragraph.
! 1657: \parskip = 0in
! 1658: %
! 1659: % Do not prefer a separate line ending with a hyphen to fewer lines.
! 1660: \finalhyphendemerits = 0
! 1661: %
! 1662: % \hangindent is only relevant when the entry text and page number
! 1663: % don't both fit on one line. In that case, bob suggests starting the
! 1664: % dots pretty far over on the line. Unfortunately, a large
! 1665: % indentation looks wrong when the entry text itself is broken across
! 1666: % lines. So we use a small indentation and put up with long leaders.
! 1667: %
! 1668: % \hangafter is reset to 1 (which is the value we want) at the start
! 1669: % of each paragraph, so we need not do anything with that.
! 1670: \hangindent=2em
! 1671: %
! 1672: % When the entry text needs to be broken, just fill out the first line
! 1673: % with blank space.
! 1674: \rightskip = 0pt plus1fil
! 1675: %
! 1676: % Start a ``paragraph'' for the index entry so the line breaking
! 1677: % parameters we've set above will have an effect.
1.1.1.3 root 1678: \noindent
1679: %
1.1.1.4 ! root 1680: % Insert the text of the index entry. TeX will do line-breaking on it.
! 1681: #1%
1.1.1.3 root 1682: %
1683: % If we must, put the page number on a line of its own, and fill out
1684: % this line with blank space. (The \hfil is overwhelmed with the
1685: % fill leaders glue in \indexdotfill if the page number does fit.)
1686: \hfil\penalty50
1687: \null\nobreak\indexdotfill % Have leaders before the page number.
1688: %
1689: % The `\ ' here is removed by the implicit \unskip that TeX does as
1.1.1.4 ! root 1690: % part of (the primitive) \par. Without it, a spurious underfull
! 1691: % \hbox ensues.
1.1.1.3 root 1692: \ #2% The page number ends the paragraph.
1693: \par
1694: \endgroup}
1.1 root 1695:
1696: % Like \dotfill except takes at least 1 em.
1697: \def\indexdotfill{\cleaders
1698: \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
1699:
1700: \def\primary #1{\line{#1\hfil}}
1701:
1702: \newskip\secondaryindent \secondaryindent=0.5cm
1703:
1704: \def\secondary #1#2{
1705: {\parfillskip=0in \parskip=0in
1706: \hangindent =1in \hangafter=1
1707: \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
1708: }}
1709:
1710: %% Define two-column mode, which is used in indexes.
1.1.1.4 ! root 1711: %% Adapted from the TeXbook, page 416.
1.1 root 1712: \catcode `\@=11
1713:
1714: \newbox\partialpage
1715:
1.1.1.4 ! root 1716: \newdimen\doublecolumnhsize
1.1 root 1717:
1718: \def\begindoublecolumns{\begingroup
1.1.1.4 ! root 1719: % Grab any single-column material above us.
! 1720: \output = {\global\setbox\partialpage
! 1721: =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
! 1722: \eject
! 1723: %
! 1724: % Now switch to the double-column output routine.
1.1 root 1725: \output={\doublecolumnout}%
1.1.1.4 ! root 1726: %
! 1727: % Change the page size parameters. We could do this once outside this
! 1728: % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
! 1729: % format, but then we repeat the same computation. Repeating a couple
! 1730: % of assignments once per index is clearly meaningless for the
! 1731: % execution time, so we may as well do it once.
! 1732: %
! 1733: % First we halve the line length, less a little for the gutter between
! 1734: % the columns. We compute the gutter based on the line length, so it
! 1735: % changes automatically with the paper format. The magic constant
! 1736: % below is chosen so that the gutter has the same value (well, +- <
! 1737: % 1pt) as it did when we hard-coded it.
! 1738: %
! 1739: % We put the result in a separate register, \doublecolumhsize, so we
! 1740: % can restore it in \pagesofar, after \hsize itself has (potentially)
! 1741: % been clobbered.
! 1742: %
! 1743: \doublecolumnhsize = \hsize
! 1744: \advance\doublecolumnhsize by -.04154\hsize
! 1745: \divide\doublecolumnhsize by 2
! 1746: \hsize = \doublecolumnhsize
! 1747: %
! 1748: % Double the \vsize as well. (We don't need a separate register here,
! 1749: % since nobody clobbers \vsize.)
! 1750: \vsize = 2\vsize
! 1751: \doublecolumnpagegoal
! 1752: }
! 1753:
! 1754: \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
! 1755:
! 1756: \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
! 1757: \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
! 1758: \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
! 1759: \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
! 1760: \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
! 1761: \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
! 1762: }
! 1763: \def\doublecolumnpagegoal{%
! 1764: \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
! 1765: }
1.1 root 1766: \def\pagesofar{\unvbox\partialpage %
1767: \hsize=\doublecolumnhsize % have to restore this since output routine
1768: \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
1.1.1.4 ! root 1769: \def\doublecolumnout{%
! 1770: \setbox5=\copy255
! 1771: {\vbadness=10000 \doublecolumnsplit}
! 1772: \ifvbox255
! 1773: \setbox0=\vtop to\dimen@{\unvbox0}
! 1774: \setbox2=\vtop to\dimen@{\unvbox2}
! 1775: \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
! 1776: \else
! 1777: \setbox0=\vbox{\unvbox5}
! 1778: \ifvbox0
! 1779: \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
! 1780: \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
! 1781: {\vbadness=10000
! 1782: \loop \global\setbox5=\copy0
! 1783: \setbox1=\vsplit5 to\dimen@
! 1784: \setbox3=\vsplit5 to\dimen@
! 1785: \ifvbox5 \global\advance\dimen@ by1pt \repeat
! 1786: \setbox0=\vbox to\dimen@{\unvbox1}
! 1787: \setbox2=\vbox to\dimen@{\unvbox3}
! 1788: \global\setbox\partialpage=\vbox{\pagesofar}
! 1789: \doublecolumnpagegoal
! 1790: }
! 1791: \fi
1.1 root 1792: \fi
1.1.1.4 ! root 1793: }
1.1 root 1794:
1795: \catcode `\@=\other
1796: \message{sectioning,}
1797: % Define chapters, sections, etc.
1798:
1799: \newcount \chapno
1800: \newcount \secno \secno=0
1801: \newcount \subsecno \subsecno=0
1802: \newcount \subsubsecno \subsubsecno=0
1803:
1804: % This counter is funny since it counts through charcodes of letters A, B, ...
1805: \newcount \appendixno \appendixno = `\@
1806: \def\appendixletter{\char\the\appendixno}
1807:
1808: \newwrite \contentsfile
1809: % This is called from \setfilename.
1810: \def\opencontents{\openout \contentsfile = \jobname.toc}
1811:
1812: % Each @chapter defines this as the name of the chapter.
1813: % page headings and footings can use it. @section does likewise
1814:
1815: \def\thischapter{} \def\thissection{}
1816: \def\seccheck#1{\if \pageno<0 %
1817: \errmessage{@#1 not allowed after generating table of contents}\fi
1818: %
1819: }
1820:
1821: \def\chapternofonts{%
1822: \let\rawbackslash=\relax%
1823: \let\frenchspacing=\relax%
1.1.1.3 root 1824: \def\result{\realbackslash result}
1825: \def\equiv{\realbackslash equiv}
1826: \def\expansion{\realbackslash expansion}
1827: \def\print{\realbackslash print}
1.1 root 1828: \def\TeX{\realbackslash TeX}
1829: \def\dots{\realbackslash dots}
1830: \def\copyright{\realbackslash copyright}
1831: \def\tt{\realbackslash tt}
1832: \def\bf{\realbackslash bf }
1833: \def\w{\realbackslash w}
1834: \def\less{\realbackslash less}
1835: \def\gtr{\realbackslash gtr}
1836: \def\hat{\realbackslash hat}
1837: \def\char{\realbackslash char}
1838: \def\tclose##1{\realbackslash tclose {##1}}
1839: \def\code##1{\realbackslash code {##1}}
1840: \def\samp##1{\realbackslash samp {##1}}
1841: \def\r##1{\realbackslash r {##1}}
1842: \def\b##1{\realbackslash b {##1}}
1843: \def\key##1{\realbackslash key {##1}}
1844: \def\file##1{\realbackslash file {##1}}
1845: \def\kbd##1{\realbackslash kbd {##1}}
1846: % These are redefined because @smartitalic wouldn't work inside xdef.
1847: \def\i##1{\realbackslash i {##1}}
1848: \def\cite##1{\realbackslash cite {##1}}
1849: \def\var##1{\realbackslash var {##1}}
1850: \def\emph##1{\realbackslash emph {##1}}
1851: \def\dfn##1{\realbackslash dfn {##1}}
1852: }
1853:
1854: \def\thischaptername{No Chapter Title}
1855: \outer\def\chapter{\parsearg\chapterzzz}
1856: \def\chapterzzz #1{\seccheck{chapter}%
1857: \secno=0 \subsecno=0 \subsubsecno=0
1858: \global\advance \chapno by 1 \message{Chapter \the\chapno}%
1859: \chapmacro {#1}{\the\chapno}%
1860: \gdef\thissection{#1}%
1861: \gdef\thischaptername{#1}%
1862: % We don't substitute the actual chapter name into \thischapter
1863: % because we don't want its macros evaluated now.
1864: \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
1865: {\chapternofonts%
1866: \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
1867: \escapechar=`\\%
1868: \write \contentsfile \temp %
1869: \donoderef %
1870: \global\let\section = \numberedsec
1871: \global\let\subsection = \numberedsubsec
1872: \global\let\subsubsection = \numberedsubsubsec
1873: }}
1874:
1875: \outer\def\appendix{\parsearg\appendixzzz}
1876: \def\appendixzzz #1{\seccheck{appendix}%
1877: \secno=0 \subsecno=0 \subsubsecno=0
1878: \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
1879: \chapmacro {#1}{Appendix \appendixletter}%
1880: \gdef\thissection{#1}%
1881: \gdef\thischaptername{#1}%
1882: \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
1883: {\chapternofonts%
1884: \edef\temp{{\realbackslash chapentry
1885: {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
1886: \escapechar=`\\%
1887: \write \contentsfile \temp %
1888: \appendixnoderef %
1889: \global\let\section = \appendixsec
1890: \global\let\subsection = \appendixsubsec
1891: \global\let\subsubsection = \appendixsubsubsec
1892: }}
1893:
1894: \outer\def\top{\parsearg\unnumberedzzz}
1895: \outer\def\unnumbered{\parsearg\unnumberedzzz}
1896: \def\unnumberedzzz #1{\seccheck{unnumbered}%
1.1.1.4 ! root 1897: \secno=0 \subsecno=0 \subsubsecno=0
! 1898: %
! 1899: % This used to be simply \message{#1}, but TeX fully expands the
! 1900: % argument to \message. Therefore, if #1 contained @-commands, TeX
! 1901: % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
! 1902: % expanded @cite (which turns out to cause errors because \cite is meant
! 1903: % to be executed, not expanded).
! 1904: %
! 1905: % Anyway, we don't want the fully-expanded definition of @cite to appear
! 1906: % as a result of the \message, we just want `@cite' itself. We use
! 1907: % \the<toks register> to achieve this: TeX expands \the<toks> only once,
! 1908: % simply yielding the contents of the <toks register>.
! 1909: \toks0 = {#1}\message{(\the\toks0)}%
! 1910: %
1.1 root 1911: \unnumbchapmacro {#1}%
1912: \gdef\thischapter{#1}\gdef\thissection{#1}%
1913: {\chapternofonts%
1914: \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
1915: \escapechar=`\\%
1916: \write \contentsfile \temp %
1917: \unnumbnoderef %
1918: \global\let\section = \unnumberedsec
1919: \global\let\subsection = \unnumberedsubsec
1920: \global\let\subsubsection = \unnumberedsubsubsec
1921: }}
1922:
1923: \outer\def\numberedsec{\parsearg\seczzz}
1924: \def\seczzz #1{\seccheck{section}%
1925: \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
1926: \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
1927: {\chapternofonts%
1928: \edef\temp{{\realbackslash secentry %
1929: {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
1930: \escapechar=`\\%
1931: \write \contentsfile \temp %
1932: \donoderef %
1933: \penalty 10000 %
1934: }}
1935:
1936: \outer\def\appendixsection{\parsearg\appendixsectionzzz}
1937: \outer\def\appendixsec{\parsearg\appendixsectionzzz}
1938: \def\appendixsectionzzz #1{\seccheck{appendixsection}%
1939: \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
1940: \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
1941: {\chapternofonts%
1942: \edef\temp{{\realbackslash secentry %
1943: {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
1944: \escapechar=`\\%
1945: \write \contentsfile \temp %
1946: \appendixnoderef %
1947: \penalty 10000 %
1948: }}
1949:
1950: \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
1951: \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
1952: \plainsecheading {#1}\gdef\thissection{#1}%
1953: {\chapternofonts%
1954: \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
1955: \escapechar=`\\%
1956: \write \contentsfile \temp %
1957: \unnumbnoderef %
1958: \penalty 10000 %
1959: }}
1960:
1961: \outer\def\numberedsubsec{\parsearg\numberedsubseczzz}
1962: \def\numberedsubseczzz #1{\seccheck{subsection}%
1963: \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
1964: \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
1965: {\chapternofonts%
1966: \edef\temp{{\realbackslash subsecentry %
1967: {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
1968: \escapechar=`\\%
1969: \write \contentsfile \temp %
1970: \donoderef %
1971: \penalty 10000 %
1972: }}
1973:
1974: \outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
1975: \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
1976: \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
1977: \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
1978: {\chapternofonts%
1979: \edef\temp{{\realbackslash subsecentry %
1980: {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
1981: \escapechar=`\\%
1982: \write \contentsfile \temp %
1983: \appendixnoderef %
1984: \penalty 10000 %
1985: }}
1986:
1987: \outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
1988: \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
1989: \plainsecheading {#1}\gdef\thissection{#1}%
1990: {\chapternofonts%
1991: \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
1992: \escapechar=`\\%
1993: \write \contentsfile \temp %
1994: \unnumbnoderef %
1995: \penalty 10000 %
1996: }}
1997:
1998: \outer\def\numberedsubsubsec{\parsearg\numberedsubsubseczzz}
1999: \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
2000: \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2001: \subsubsecheading {#1}
2002: {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2003: {\chapternofonts%
2004: \edef\temp{{\realbackslash subsubsecentry %
2005: {#1}
2006: {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
2007: {\noexpand\folio}}}%
2008: \escapechar=`\\%
2009: \write \contentsfile \temp %
2010: \donoderef %
2011: \penalty 10000 %
2012: }}
2013:
2014: \outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
2015: \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
2016: \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2017: \subsubsecheading {#1}
2018: {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2019: {\chapternofonts%
2020: \edef\temp{{\realbackslash subsubsecentry{#1}%
2021: {\appendixletter}
2022: {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
2023: \escapechar=`\\%
2024: \write \contentsfile \temp %
2025: \appendixnoderef %
2026: \penalty 10000 %
2027: }}
2028:
2029: \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
2030: \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
2031: \plainsecheading {#1}\gdef\thissection{#1}%
2032: {\chapternofonts%
2033: \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
2034: \escapechar=`\\%
2035: \write \contentsfile \temp %
2036: \unnumbnoderef %
2037: \penalty 10000 %
2038: }}
2039:
2040: % These are variants which are not "outer", so they can appear in @ifinfo.
2041: % Actually, they should now be obsolete; ordinary section commands should work.
2042: \def\infotop{\parsearg\unnumberedzzz}
2043: \def\infounnumbered{\parsearg\unnumberedzzz}
2044: \def\infounnumberedsec{\parsearg\unnumberedseczzz}
2045: \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
2046: \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
2047:
2048: \def\infoappendix{\parsearg\appendixzzz}
2049: \def\infoappendixsec{\parsearg\appendixseczzz}
2050: \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
2051: \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
2052:
2053: \def\infochapter{\parsearg\chapterzzz}
2054: \def\infosection{\parsearg\sectionzzz}
2055: \def\infosubsection{\parsearg\subsectionzzz}
2056: \def\infosubsubsection{\parsearg\subsubsectionzzz}
2057:
2058: % These macros control what the section commands do, according
2059: % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
2060: % Define them by default for a numbered chapter.
2061: \global\let\section = \numberedsec
2062: \global\let\subsection = \numberedsubsec
2063: \global\let\subsubsection = \numberedsubsubsec
2064:
2065: % Define @majorheading, @heading and @subheading
2066:
2067: % NOTE on use of \vbox for chapter headings, section headings, and
2068: % such:
2069: % 1) We use \vbox rather than the earlier \line to permit
2070: % overlong headings to fold.
2071: % 2) \hyphenpenalty is set to 10000 because hyphenation in a
2072: % heading is obnoxious; this forbids it.
2073: % 3) Likewise, headings look best if no \parindent is used, and
2074: % if justification is not attempted. Hence \raggedright.
2075:
2076:
2077: \def\majorheading{\parsearg\majorheadingzzz}
2078: \def\majorheadingzzz #1{%
2079: {\advance\chapheadingskip by 10pt \chapbreak }%
2080: {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2081: \parindent=0pt\raggedright
2082: \rm #1\hfill}}\bigskip \par\penalty 200}
2083:
2084: \def\chapheading{\parsearg\chapheadingzzz}
2085: \def\chapheadingzzz #1{\chapbreak %
2086: {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2087: \parindent=0pt\raggedright
2088: \rm #1\hfill}}\bigskip \par\penalty 200}
2089:
2090: \def\heading{\parsearg\secheadingi}
2091:
2092: \def\subheading{\parsearg\subsecheadingi}
2093:
2094: \def\subsubheading{\parsearg\subsubsecheadingi}
2095:
2096: % These macros generate a chapter, section, etc. heading only
2097: % (including whitespace, linebreaking, etc. around it),
2098: % given all the information in convenient, parsed form.
2099:
2100: %%% Args are the skip and penalty (usually negative)
2101: \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
2102:
2103: \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
2104:
2105: %%% Define plain chapter starts, and page on/off switching for it
2106: % Parameter controlling skip before chapter headings (if needed)
2107:
2108: \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
2109:
2110: \def\chapbreak{\dobreak \chapheadingskip {-4000}}
2111: \def\chappager{\par\vfill\supereject}
2112: \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
2113:
2114: \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
2115:
2116: \def\CHAPPAGoff{
2117: \global\let\pchapsepmacro=\chapbreak
2118: \global\let\pagealignmacro=\chappager}
2119:
2120: \def\CHAPPAGon{
2121: \global\let\pchapsepmacro=\chappager
2122: \global\let\pagealignmacro=\chappager
2123: \global\def\HEADINGSon{\HEADINGSsingle}}
2124:
2125: \def\CHAPPAGodd{
2126: \global\let\pchapsepmacro=\chapoddpage
2127: \global\let\pagealignmacro=\chapoddpage
2128: \global\def\HEADINGSon{\HEADINGSdouble}}
2129:
2130: \CHAPPAGon
2131:
2132: \def\CHAPFplain{
2133: \global\let\chapmacro=\chfplain
2134: \global\let\unnumbchapmacro=\unnchfplain}
2135:
2136: \def\chfplain #1#2{%
2137: \pchapsepmacro
2138: {%
2139: \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2140: \parindent=0pt\raggedright
2141: \rm #2\enspace #1}%
2142: }%
2143: \bigskip
2144: \penalty5000
2145: }
2146:
2147: \def\unnchfplain #1{%
2148: \pchapsepmacro %
2149: {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2150: \parindent=0pt\raggedright
2151: \rm #1\hfill}}\bigskip \par\penalty 10000 %
2152: }
2153: \CHAPFplain % The default
2154:
2155: \def\unnchfopen #1{%
2156: \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2157: \parindent=0pt\raggedright
2158: \rm #1\hfill}}\bigskip \par\penalty 10000 %
2159: }
2160:
2161: \def\chfopen #1#2{\chapoddpage {\chapfonts
2162: \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
2163: \par\penalty 5000 %
2164: }
2165:
2166: \def\CHAPFopen{
2167: \global\let\chapmacro=\chfopen
2168: \global\let\unnumbchapmacro=\unnchfopen}
2169:
2170: % Parameter controlling skip before section headings.
2171:
2172: \newskip \subsecheadingskip \subsecheadingskip = 17pt plus 8pt minus 4pt
2173: \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
2174:
2175: \newskip \secheadingskip \secheadingskip = 21pt plus 8pt minus 4pt
2176: \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
2177:
2178: % @paragraphindent is defined for the Info formatting commands only.
2179: \let\paragraphindent=\comment
2180:
2181: % Section fonts are the base font at magstep2, which produces
2182: % a size a bit more than 14 points in the default situation.
2183:
2184: \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
2185: \def\plainsecheading #1{\secheadingi {#1}}
2186: \def\secheadingi #1{{\advance \secheadingskip by \parskip %
2187: \secheadingbreak}%
2188: {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2189: \parindent=0pt\raggedright
2190: \rm #1\hfill}}%
2191: \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
2192:
2193:
2194: % Subsection fonts are the base font at magstep1,
2195: % which produces a size of 12 points.
2196:
2197: \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
2198: \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
2199: \subsecheadingbreak}%
2200: {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2201: \parindent=0pt\raggedright
2202: \rm #1\hfill}}%
2203: \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
2204:
2205: \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
2206: % Perhaps make sssec fonts scaled
2207: % magstep half
2208: \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
2209: \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
2210: \subsecheadingbreak}%
2211: {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2212: \parindent=0pt\raggedright
2213: \rm #1\hfill}}%
2214: \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
2215:
2216:
2217: \message{toc printing,}
2218:
2219: % Finish up the main text and prepare to read what we've written
2220: % to \contentsfile.
2221:
2222: \newskip\contentsrightmargin \contentsrightmargin=1in
2223: \def\startcontents#1{%
1.1.1.4 ! root 2224: \pagealignmacro
! 2225: \immediate\closeout \contentsfile
1.1 root 2226: \ifnum \pageno>0
2227: \pageno = -1 % Request roman numbered pages.
2228: \fi
2229: % Don't need to put `Contents' or `Short Contents' in the headline.
2230: % It is abundantly clear what they are.
2231: \unnumbchapmacro{#1}\def\thischapter{}%
2232: \begingroup % Set up to handle contents files properly.
2233: \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
2234: \raggedbottom % Worry more about breakpoints than the bottom.
2235: \advance\hsize by -\contentsrightmargin % Don't use the full line length.
2236: }
2237:
2238:
2239: % Normal (long) toc.
2240: \outer\def\contents{%
2241: \startcontents{Table of Contents}%
2242: \input \jobname.toc
2243: \endgroup
2244: \vfill \eject
2245: }
2246:
2247: % And just the chapters.
2248: \outer\def\summarycontents{%
2249: \startcontents{Short Contents}%
2250: %
2251: \let\chapentry = \shortchapentry
2252: \let\unnumbchapentry = \shortunnumberedentry
2253: % We want a true roman here for the page numbers.
2254: \secfonts
2255: \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
2256: \rm
2257: \advance\baselineskip by 1pt % Open it up a little.
2258: \def\secentry ##1##2##3##4{}
2259: \def\unnumbsecentry ##1##2{}
2260: \def\subsecentry ##1##2##3##4##5{}
2261: \def\unnumbsubsecentry ##1##2{}
2262: \def\subsubsecentry ##1##2##3##4##5##6{}
2263: \def\unnumbsubsubsecentry ##1##2{}
2264: \input \jobname.toc
2265: \endgroup
2266: \vfill \eject
2267: }
2268: \let\shortcontents = \summarycontents
2269:
2270: % These macros generate individual entries in the table of contents.
2271: % The first argument is the chapter or section name.
2272: % The last argument is the page number.
2273: % The arguments in between are the chapter number, section number, ...
2274:
2275: % Chapter-level things, for both the long and short contents.
2276: \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
2277:
2278: % See comments in \dochapentry re vbox and related settings
2279: \def\shortchapentry#1#2#3{%
1.1.1.4 ! root 2280: \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
1.1 root 2281: }
2282:
1.1.1.4 ! root 2283: % Typeset the label for a chapter or appendix for the short contents.
! 2284: % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
! 2285: % We could simplify the code here by writing out an \appendixentry
! 2286: % command in the toc file for appendices, instead of using \chapentry
! 2287: % for both, but it doesn't seem worth it.
! 2288: \setbox0 = \hbox{\shortcontrm Appendix }
! 2289: \newdimen\shortappendixwidth \shortappendixwidth = \wd0
! 2290:
! 2291: \def\shortchaplabel#1{%
! 2292: % We typeset #1 in a box of constant width, regardless of the text of
! 2293: % #1, so the chapter titles will come out aligned.
! 2294: \setbox0 = \hbox{#1}%
! 2295: \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
! 2296: %
! 2297: % This space should be plenty, since a single number is .5em, and the
! 2298: % widest letter (M) is 1em, at least in the Computer Modern fonts.
! 2299: % (This space doesn't include the extra space that gets added after
! 2300: % the label; that gets put in in \shortchapentry above.)
! 2301: \advance\dimen0 by 1.1em
! 2302: \hbox to \dimen0{#1\hfil}%
1.1 root 2303: }
2304:
1.1.1.4 ! root 2305: \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
! 2306: \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
! 2307:
1.1 root 2308: % Sections.
2309: \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
2310: \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
2311:
2312: % Subsections.
2313: \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
2314: \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
2315:
2316: % And subsubsections.
2317: \def\subsubsecentry#1#2#3#4#5#6{%
2318: \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
2319: \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
2320:
2321:
2322: % This parameter controls the indentation of the various levels.
2323: \newdimen\tocindent \tocindent = 3pc
2324:
2325: % Now for the actual typesetting. In all these, #1 is the text and #2 is the
2326: % page number.
2327: %
2328: % If the toc has to be broken over pages, we would want to be at chapters
2329: % if at all possible; hence the \penalty.
2330: \def\dochapentry#1#2{%
2331: \penalty-300 \vskip\baselineskip
1.1.1.4 ! root 2332: \begingroup
! 2333: \chapentryfonts
! 2334: \tocentry{#1}{\dopageno{#2}}%
! 2335: \endgroup
1.1 root 2336: \nobreak\vskip .25\baselineskip
2337: }
2338:
1.1.1.4 ! root 2339: \def\dosecentry#1#2{\begingroup
! 2340: \secentryfonts \leftskip=\tocindent
! 2341: \tocentry{#1}{\dopageno{#2}}%
! 2342: \endgroup}
! 2343:
! 2344: \def\dosubsecentry#1#2{\begingroup
! 2345: \subsecentryfonts \leftskip=2\tocindent
! 2346: \tocentry{#1}{\dopageno{#2}}%
! 2347: \endgroup}
! 2348:
! 2349: \def\dosubsubsecentry#1#2{\begingroup
! 2350: \subsubsecentryfonts \leftskip=3\tocindent
! 2351: \tocentry{#1}{\dopageno{#2}}%
! 2352: \endgroup}
! 2353:
! 2354: % Final typesetting of a toc entry; we use the same \entry macro as for
! 2355: % the index entries, but we want to suppress hyphenation here. (We
! 2356: % can't do that in the \entry macro, since index entries might consist
! 2357: % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
! 2358: %
! 2359: \def\tocentry#1#2{\begingroup
! 2360: \hyphenpenalty = 10000
! 2361: \entry{#1}{#2}%
! 2362: \endgroup}
1.1 root 2363:
2364: % Space between chapter (or whatever) number and the title.
2365: \def\labelspace{\hskip1em \relax}
2366:
2367: \def\dopageno#1{{\rm #1}}
2368: \def\doshortpageno#1{{\rm #1}}
2369:
2370: \def\chapentryfonts{\secfonts \rm}
2371: \def\secentryfonts{\textfonts}
2372: \let\subsecentryfonts = \textfonts
2373: \let\subsubsecentryfonts = \textfonts
2374:
2375:
2376: \message{environments,}
2377:
2378: % Since these characters are used in examples, it should be an even number of
2379: % \tt widths. Each \tt character is 1en, so two makes it 1em.
2380: % Furthermore, these definitions must come after we define our fonts.
2381: \newbox\dblarrowbox \newbox\longdblarrowbox
2382: \newbox\pushcharbox \newbox\bullbox
2383: \newbox\equivbox \newbox\errorbox
2384:
2385: \let\ptexequiv = \equiv
2386:
1.1.1.2 root 2387: %{\tentt
2388: %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
2389: %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
2390: %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
2391: %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
1.1 root 2392: % Adapted from the manmac format (p.420 of TeXbook)
1.1.1.2 root 2393: %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
2394: % depth .1ex\hfil}
2395: %}
1.1 root 2396:
2397: \def\point{$\star$}
2398:
1.1.1.2 root 2399: \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
2400: \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
2401: \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
1.1 root 2402:
1.1.1.2 root 2403: \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
1.1 root 2404:
2405: % Adapted from the TeXbook's \boxit.
2406: {\tentt \global\dimen0 = 3em}% Width of the box.
2407: \dimen2 = .55pt % Thickness of rules
2408: % The text. (`r' is open on the right, `e' somewhat less so on the left.)
2409: \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
2410:
2411: \global\setbox\errorbox=\hbox to \dimen0{\hfil
2412: \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
2413: \advance\hsize by -2\dimen2 % Rules.
2414: \vbox{
2415: \hrule height\dimen2
2416: \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
2417: \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
2418: \kern3pt\vrule width\dimen2}% Space to right.
2419: \hrule height\dimen2}
2420: \hfil}
2421:
2422: % The @error{} command.
2423: \def\error{\leavevmode\lower.7ex\copy\errorbox}
2424:
2425: % @tex ... @end tex escapes into raw Tex temporarily.
2426: % One exception: @ is still an escape character, so that @end tex works.
2427: % But \@ or @@ will get a plain tex @ character.
2428:
2429: \def\tex{\begingroup
2430: \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
2431: \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
2432: \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
2433: \catcode `\%=14
2434: \catcode 43=12
2435: \catcode`\"=12
2436: \catcode`\==12
2437: \catcode`\|=12
2438: \catcode`\<=12
2439: \catcode`\>=12
2440: \escapechar=`\\
2441: %
2442: \let\{=\ptexlbrace
2443: \let\}=\ptexrbrace
2444: \let\.=\ptexdot
2445: \let\*=\ptexstar
2446: \let\dots=\ptexdots
2447: \def\@{@}%
2448: \let\bullet=\ptexbullet
2449: \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
2450: \let\L=\ptexL
2451: %
2452: \let\Etex=\endgroup}
2453:
2454: % Define @lisp ... @endlisp.
2455: % @lisp does a \begingroup so it can rebind things,
2456: % including the definition of @endlisp (which normally is erroneous).
2457:
2458: % Amount to narrow the margins by for @lisp.
2459: \newskip\lispnarrowing \lispnarrowing=0.4in
2460:
2461: % This is the definition that ^M gets inside @lisp
2462: % phr: changed space to \null, to avoid overfull hbox problems.
2463: {\obeyspaces%
2464: \gdef\lisppar{\null\endgraf}}
2465:
2466: % Cause \obeyspaces to make each Space cause a word-separation
2467: % rather than the default which is that it acts punctuation.
2468: % This is because space in tt font looks funny.
2469: {\obeyspaces %
2470: \gdef\sepspaces{\def {\ }}}
2471:
1.1.1.4 ! root 2472: % This space is always present above and below environments.
! 2473: \newskip\envskipamount \envskipamount = 0pt
! 2474:
! 2475: % Make spacing and below environment symmetrical.
! 2476: \def\aboveenvbreak{{\advance\envskipamount by \parskip
! 2477: \endgraf \ifdim\lastskip<\envskipamount
! 2478: \removelastskip \penalty-50 \vskip\envskipamount \fi}}
1.1 root 2479:
1.1.1.4 ! root 2480: \let\afterenvbreak = \aboveenvbreak
1.1 root 2481:
2482: % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
2483: \let\nonarrowing=\relax
2484:
2485: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2486: % \cartouche: draw rectangle w/rounded corners around argument
2487: \font\circle=lcircle10
2488: \newdimen\circthick
2489: \newdimen\cartouter\newdimen\cartinner
2490: \newskip\normbskip\newskip\normpskip\newskip\normlskip
2491: \circthick=\fontdimen8\circle
2492: %
2493: \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
2494: \def\ctr{{\hskip 6pt\circle\char'010}}
2495: \def\cbl{{\circle\char'012\hskip -6pt}}
2496: \def\cbr{{\hskip 6pt\circle\char'011}}
2497: \def\carttop{\hbox to \cartouter{\hskip\lskip
2498: \ctl\leaders\hrule height\circthick\hfil\ctr
2499: \hskip\rskip}}
2500: \def\cartbot{\hbox to \cartouter{\hskip\lskip
2501: \cbl\leaders\hrule height\circthick\hfil\cbr
2502: \hskip\rskip}}
2503: %
2504: \newskip\lskip\newskip\rskip
2505:
2506: \long\def\cartouche{%
2507: \begingroup
2508: \lskip=\leftskip \rskip=\rightskip
2509: \leftskip=0pt\rightskip=0pt %we want these *outside*.
2510: \cartinner=\hsize \advance\cartinner by-\lskip
2511: \advance\cartinner by-\rskip
2512: \cartouter=\hsize
2513: \advance\cartouter by 18pt % allow for 3pt kerns on either
2514: % side, and for 6pt waste from
2515: % each corner char
2516: \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
2517: % Flag to tell @lisp, etc., not to narrow margin.
2518: \let\nonarrowing=\comment
2519: \vbox\bgroup
2520: \baselineskip=0pt\parskip=0pt\lineskip=0pt
2521: \carttop
2522: \hbox\bgroup
2523: \hskip\lskip
2524: \vrule\kern3pt
2525: \vbox\bgroup
2526: \hsize=\cartinner
2527: \kern3pt
2528: \begingroup
2529: \baselineskip=\normbskip
2530: \lineskip=\normlskip
2531: \parskip=\normpskip
2532: \vskip -\parskip
2533: \def\Ecartouche{%
2534: \endgroup
2535: \kern3pt
2536: \egroup
2537: \kern3pt\vrule
2538: \hskip\rskip
2539: \egroup
2540: \cartbot
2541: \egroup
2542: \endgroup
2543: }}
2544:
2545: \def\lisp{\aboveenvbreak
2546: \begingroup\inENV % This group ends at the end of the @lisp body
2547: \hfuzz=12truept % Don't be fussy
2548: % Make spaces be word-separators rather than space tokens.
2549: \sepspaces %
2550: % Single space lines
2551: \singlespace %
2552: % The following causes blank lines not to be ignored
2553: % by adding a space to the end of each line.
2554: \let\par=\lisppar
2555: \def\Elisp{\endgroup\afterenvbreak}%
2556: \parskip=0pt
2557: % @cartouche defines \nonarrowing to inhibit narrowing
2558: % at next level down.
2559: \ifx\nonarrowing\relax
2560: \advance \leftskip by \lispnarrowing
1.1.1.3 root 2561: \exdentamount=\lispnarrowing
2562: \let\exdent=\nofillexdent
1.1 root 2563: \let\nonarrowing=\relax
2564: \fi
2565: \parindent=0pt
2566: \obeyspaces \obeylines \tt \rawbackslash
1.1.1.4 ! root 2567: \gobble
! 2568: }
1.1 root 2569:
1.1.1.4 ! root 2570: % Define the \E... control sequence only if we are inside the
! 2571: % environment, so the error checking in \end will work.
! 2572: %
! 2573: % We must call \lisp last in the definition, since it reads the
! 2574: % return following the @example (or whatever) command.
! 2575: %
! 2576: \def\example{\begingroup \def\Eexample{\Elisp\endgroup}\lisp}
! 2577: \def\smallexample{\begingroup \def\Esmallexample{\Elisp\endgroup}\lisp}
1.1 root 2578:
2579: % Macro for 9 pt. examples, necessary to print with 5" lines.
2580: % From Pavel@xerox. This is not really used unless the
2581: % @smallbook command is given.
2582:
2583: \def\smalllispx{\aboveenvbreak\begingroup\inENV
2584: % This group ends at the end of the @lisp body
2585: \hfuzz=12truept % Don't be fussy
2586: % Make spaces be word-separators rather than space tokens.
2587: \sepspaces %
2588: % Single space lines
2589: \singlespace %
2590: % The following causes blank lines not to be ignored
2591: % by adding a space to the end of each line.
2592: \let\par=\lisppar
2593: \def\Esmalllisp{\endgroup\afterenvbreak}%
1.1.1.3 root 2594: %%%% Smaller baseline skip for small examples.
2595: \baselineskip 10pt
1.1 root 2596: \parskip=0pt
2597: % @cartouche defines \nonarrowing to inhibit narrowing
2598: % at next level down.
2599: \ifx\nonarrowing\relax
2600: \advance \leftskip by \lispnarrowing
1.1.1.3 root 2601: \exdentamount=\lispnarrowing
2602: \let\exdent=\nofillexdent
1.1 root 2603: \let\nonarrowing=\relax
2604: \fi
2605: \parindent=0pt
2606: \obeyspaces \obeylines \ninett \indexfonts \rawbackslash
2607: \def\next##1{}\next}
2608:
2609: % This is @display; same as @lisp except use roman font.
2610:
2611: \def\display{\begingroup\inENV %This group ends at the end of the @display body
2612: \aboveenvbreak
2613: % Make spaces be word-separators rather than space tokens.
2614: \sepspaces %
2615: % Single space lines
2616: \singlespace %
2617: % The following causes blank lines not to be ignored
2618: % by adding a space to the end of each line.
2619: \let\par=\lisppar
2620: \def\Edisplay{\endgroup\afterenvbreak}%
2621: \parskip=0pt
2622: % @cartouche defines \nonarrowing to inhibit narrowing
2623: % at next level down.
2624: \ifx\nonarrowing\relax
2625: \advance \leftskip by \lispnarrowing
1.1.1.3 root 2626: \exdentamount=\lispnarrowing
2627: \let\exdent=\nofillexdent
1.1 root 2628: \let\nonarrowing=\relax
2629: \fi
2630: \parindent=0pt
2631: \obeyspaces \obeylines
2632: \def\next##1{}\next}
2633:
2634: % This is @format; same as @lisp except use roman font and don't narrow margins
2635:
2636: \def\format{\begingroup\inENV %This group ends at the end of the @format body
2637: \aboveenvbreak
2638: % Make spaces be word-separators rather than space tokens.
2639: \sepspaces %
2640: \singlespace %
2641: % The following causes blank lines not to be ignored
2642: % by adding a space to the end of each line.
2643: \let\par=\lisppar
2644: \def\Eformat{\endgroup\afterenvbreak}
2645: \parskip=0pt \parindent=0pt
2646: \obeyspaces \obeylines
2647: \def\next##1{}\next}
2648:
2649: % @flushleft and @flushright
2650:
2651: \def\flushleft{%
2652: \begingroup\inENV %This group ends at the end of the @format body
2653: \aboveenvbreak
2654: % Make spaces be word-separators rather than space tokens.
2655: \sepspaces %
2656: % The following causes blank lines not to be ignored
2657: % by adding a space to the end of each line.
2658: % This also causes @ to work when the directive name
2659: % is terminated by end of line.
2660: \let\par=\lisppar
2661: \def\Eflushleft{\endgroup\afterenvbreak}%
2662: \parskip=0pt \parindent=0pt
2663: \obeyspaces \obeylines
2664: \def\next##1{}\next}
2665:
2666: \def\flushright{%
2667: \begingroup\inENV %This group ends at the end of the @format body
2668: \aboveenvbreak
2669: % Make spaces be word-separators rather than space tokens.
2670: \sepspaces %
2671: % The following causes blank lines not to be ignored
2672: % by adding a space to the end of each line.
2673: % This also causes @ to work when the directive name
2674: % is terminated by end of line.
2675: \let\par=\lisppar
2676: \def\Eflushright{\endgroup\afterenvbreak}%
2677: \parskip=0pt \parindent=0pt
2678: \advance \leftskip by 0pt plus 1fill
2679: \obeyspaces \obeylines
2680: \def\next##1{}\next}
2681:
2682: % @quotation - narrow the margins.
2683:
2684: \def\quotation{%
2685: \begingroup\inENV %This group ends at the end of the @quotation body
2686: {\parskip=0pt % because we will skip by \parskip too, later
2687: \aboveenvbreak}%
2688: \singlespace
2689: \parindent=0pt
2690: \def\Equotation{\par\endgroup\afterenvbreak}%
2691: % @cartouche defines \nonarrowing to inhibit narrowing
2692: % at next level down.
2693: \ifx\nonarrowing\relax
2694: \advance \leftskip by \lispnarrowing
2695: \advance \rightskip by \lispnarrowing
1.1.1.3 root 2696: \exdentamount=\lispnarrowing
1.1 root 2697: \let\nonarrowing=\relax
2698: \fi}
2699:
2700: \message{defuns,}
2701: % Define formatter for defuns
2702: % First, allow user to change definition object font (\df) internally
2703: \def\setdeffont #1 {\csname DEF#1\endcsname}
2704:
2705: \newskip\defbodyindent \defbodyindent=.4in
2706: \newskip\defargsindent \defargsindent=50pt
2707: \newskip\deftypemargin \deftypemargin=12pt
2708: \newskip\deflastargmargin \deflastargmargin=18pt
2709:
2710: \newcount\parencount
2711: % define \functionparens, which makes ( and ) and & do special things.
2712: % \functionparens affects the group it is contained in.
2713: \def\activeparens{%
2714: \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
2715: \catcode`\[=\active \catcode`\]=\active}
1.1.1.4 ! root 2716:
! 2717: % Make control sequences which act like normal parenthesis chars.
! 2718: \let\lparen = ( \let\rparen = )
! 2719:
1.1 root 2720: {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
1.1.1.4 ! root 2721:
! 2722: % Be sure that we always have a definition for `(', etc. For example,
! 2723: % if the fn name has parens in it, \boldbrax will not be in effect yet,
! 2724: % so TeX would otherwise complain about undefined control sequence.
! 2725: \global\let(=\lparen \global\let)=\rparen
! 2726: \global\let[=\lbrack \global\let]=\rbrack
! 2727:
1.1 root 2728: \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
2729: \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
2730:
2731: % Definitions of (, ) and & used in args for functions.
2732: % This is the definition of ( outside of all parentheses.
2733: \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
2734: \global\advance\parencount by 1 }
2735: %
2736: % This is the definition of ( when already inside a level of parens.
2737: \gdef\opnested{\char`\(\global\advance\parencount by 1 }
2738: %
2739: \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
2740: % also in that case restore the outer-level definition of (.
2741: \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
2742: \global\advance \parencount by -1 }
2743: % If we encounter &foo, then turn on ()-hacking afterwards
2744: \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
2745: %
2746: \gdef\normalparens{\boldbrax\let&=\ampnr}
2747: } % End of definition inside \activeparens
2748: %% These parens (in \boldbrax) actually are a little bolder than the
2749: %% contained text. This is especially needed for [ and ]
2750: \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
2751: \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
2752:
2753: % First, defname, which formats the header line itself.
2754: % #1 should be the function name.
2755: % #2 should be the type of definition, such as "Function".
2756:
2757: \def\defname #1#2{%
2758: % Get the values of \leftskip and \rightskip as they were
2759: % outside the @def...
2760: \dimen2=\leftskip
2761: \advance\dimen2 by -\defbodyindent
2762: \dimen3=\rightskip
2763: \advance\dimen3 by -\defbodyindent
2764: \noindent %
2765: \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
2766: \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
2767: \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
2768: \parshape 2 0in \dimen0 \defargsindent \dimen1 %
2769: % Now output arg 2 ("Function" or some such)
2770: % ending at \deftypemargin from the right margin,
2771: % but stuck inside a box of width 0 so it does not interfere with linebreaking
2772: {% Adjust \hsize to exclude the ambient margins,
2773: % so that \rightline will obey them.
2774: \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
2775: \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
2776: % Make all lines underfull and no complaints:
2777: \tolerance=10000 \hbadness=10000
2778: \advance\leftskip by -\defbodyindent
1.1.1.3 root 2779: \exdentamount=\defbodyindent
1.1 root 2780: {\df #1}\enskip % Generate function name
2781: }
2782:
2783: % Actually process the body of a definition
2784: % #1 should be the terminating control sequence, such as \Edefun.
2785: % #2 should be the "another name" control sequence, such as \defunx.
2786: % #3 should be the control sequence that actually processes the header,
2787: % such as \defunheader.
2788:
2789: \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
2790: \medbreak %
2791: % Define the end token that this defining construct specifies
2792: % so that it will exit this group.
2793: \def#1{\endgraf\endgroup\medbreak}%
2794: \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
2795: \parindent=0in
2796: \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
1.1.1.3 root 2797: \exdentamount=\defbodyindent
1.1 root 2798: \begingroup %
2799: \catcode 61=\active %
2800: \obeylines\activeparens\spacesplit#3}
2801:
2802: \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
2803: \medbreak %
2804: % Define the end token that this defining construct specifies
2805: % so that it will exit this group.
2806: \def#1{\endgraf\endgroup\medbreak}%
2807: \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
2808: \parindent=0in
2809: \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
1.1.1.3 root 2810: \exdentamount=\defbodyindent
1.1 root 2811: \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
2812:
2813: \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
2814: \medbreak %
2815: % Define the end token that this defining construct specifies
2816: % so that it will exit this group.
2817: \def#1{\endgraf\endgroup\medbreak}%
2818: \def#2##1 ##2 {\def#4{##1}%
2819: \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
2820: \parindent=0in
2821: \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
1.1.1.3 root 2822: \exdentamount=\defbodyindent
1.1 root 2823: \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
2824:
2825: % These parsing functions are similar to the preceding ones
2826: % except that they do not make parens into active characters.
2827: % These are used for "variables" since they have no arguments.
2828:
2829: \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
2830: \medbreak %
2831: % Define the end token that this defining construct specifies
2832: % so that it will exit this group.
2833: \def#1{\endgraf\endgroup\medbreak}%
2834: \def#2{\begingroup\obeylines\spacesplit#3}%
2835: \parindent=0in
2836: \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
1.1.1.3 root 2837: \exdentamount=\defbodyindent
1.1 root 2838: \begingroup %
2839: \catcode 61=\active %
2840: \obeylines\spacesplit#3}
2841:
2842: \def\defvrparsebody #1#2#3#4 {\begingroup\inENV %
2843: \medbreak %
2844: % Define the end token that this defining construct specifies
2845: % so that it will exit this group.
2846: \def#1{\endgraf\endgroup\medbreak}%
2847: \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
2848: \parindent=0in
2849: \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
1.1.1.3 root 2850: \exdentamount=\defbodyindent
1.1 root 2851: \begingroup\obeylines\spacesplit{#3{#4}}}
2852:
1.1.1.4 ! root 2853: % This is the same as all the others except for the last line. We need
! 2854: % to parse the arguments differently for @deftp, since the ``attributes''
! 2855: % there are optional.
! 2856: %
! 2857: \def\deftpparsebody #1#2#3#4 {\begingroup\inENV %
! 2858: \medbreak %
! 2859: % Define the end token that this defining construct specifies
! 2860: % so that it will exit this group.
! 2861: \def#1{\endgraf\endgroup\medbreak}%
! 2862: \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
! 2863: \parindent=0in
! 2864: \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
! 2865: \exdentamount=\defbodyindent
! 2866: \begingroup\obeylines\parsetpheaderline{#3{#4}}}
! 2867:
! 2868: {\obeylines %
! 2869: % Parse the type name and any attributes (field names, etc.).
! 2870: % #1 is the beginning of the macro call that will produce the output,
! 2871: % i.e., \deftpheader{CLASS}; this is passed from \deftpparsebody.
! 2872: % #2 is the type name, e.g., `struct termios'.
! 2873: % #3 is the (possibly empty) attribute list.
! 2874: %
! 2875: \gdef\parsetpheaderline#1#2#3^^M{%
! 2876: \endgroup % Started in \deftpparsebody.
! 2877: %
! 2878: % If the attribute list is in fact empty, there will be no space after
! 2879: % #2; so we can't put a space in our TeX parameter list. But if it
! 2880: % isn't empty, then #3 will begin with an unwanted space.
! 2881: \def\theargs{\ignorespaces #3}%
! 2882: %
! 2883: % Call the macro to produce the output.
! 2884: #1{#2}\theargs %
! 2885: }%
! 2886: }
! 2887:
1.1 root 2888: \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
2889: \medbreak %
2890: % Define the end token that this defining construct specifies
2891: % so that it will exit this group.
2892: \def#1{\endgraf\endgroup\medbreak}%
2893: \def#2##1 ##2 {\def#4{##1}%
2894: \begingroup\obeylines\spacesplit{#3{##2}}}%
2895: \parindent=0in
2896: \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
1.1.1.3 root 2897: \exdentamount=\defbodyindent
1.1 root 2898: \begingroup\obeylines\spacesplit{#3{#5}}}
2899:
2900: % Split up #2 at the first space token.
2901: % call #1 with two arguments:
2902: % the first is all of #2 before the space token,
2903: % the second is all of #2 after that space token.
2904: % If #2 contains no space token, all of it is passed as the first arg
2905: % and the second is passed as empty.
2906:
2907: {\obeylines
2908: \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
2909: \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
2910: \ifx\relax #3%
2911: #1{#2}{}\else #1{#2}{#3#4}\fi}}
2912:
2913: % So much for the things common to all kinds of definitions.
2914:
2915: % Define @defun.
2916:
2917: % First, define the processing that is wanted for arguments of \defun
2918: % Use this to expand the args and terminate the paragraph they make up
2919:
2920: \def\defunargs #1{\functionparens \sl
2921: % Expand, preventing hyphenation at `-' chars.
2922: % Note that groups don't affect changes in \hyphenchar.
2923: \hyphenchar\tensl=0
2924: #1%
2925: \hyphenchar\tensl=45
2926: \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
2927: \interlinepenalty=10000
2928: \advance\rightskip by 0pt plus 1fil
2929: \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
2930: }
2931:
2932: \def\deftypefunargs #1{%
2933: % Expand, preventing hyphenation at `-' chars.
2934: % Note that groups don't affect changes in \hyphenchar.
2935: \functionparens
2936: \code{#1}%
2937: \interlinepenalty=10000
2938: \advance\rightskip by 0pt plus 1fil
2939: \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
2940: }
2941:
2942: % Do complete processing of one @defun or @defunx line already parsed.
2943:
2944: % @deffn Command forward-char nchars
2945:
2946: \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
2947:
2948: \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
2949: \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
2950: \catcode 61=\other % Turn off change made in \defparsebody
2951: }
2952:
2953: % @defun == @deffn Function
2954:
2955: \def\defun{\defparsebody\Edefun\defunx\defunheader}
2956:
2957: \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
2958: \begingroup\defname {#1}{Function}%
2959: \defunargs {#2}\endgroup %
2960: \catcode 61=\other % Turn off change made in \defparsebody
2961: }
2962:
2963: % @deftypefun int foobar (int @var{foo}, float @var{bar})
2964:
2965: \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
2966:
2967: % #1 is the data type. #2 is the name and args.
2968: \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
2969: % #1 is the data type, #2 the name, #3 the args.
2970: \def\deftypefunheaderx #1#2 #3\relax{%
2971: \doind {fn}{\code{#2}}% Make entry in function index
2972: \begingroup\defname {\code{#1} #2}{Function}%
2973: \deftypefunargs {#3}\endgroup %
2974: \catcode 61=\other % Turn off change made in \defparsebody
2975: }
2976:
2977: % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
2978:
2979: \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
2980:
2981: % #1 is the classification. #2 is the data type. #3 is the name and args.
2982: \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
2983: % #1 is the classification, #2 the data type, #3 the name, #4 the args.
2984: \def\deftypefnheaderx #1#2#3 #4\relax{%
2985: \doind {fn}{\code{#3}}% Make entry in function index
2986: \begingroup\defname {\code{#2} #3}{#1}%
2987: \deftypefunargs {#4}\endgroup %
2988: \catcode 61=\other % Turn off change made in \defparsebody
2989: }
2990:
2991: % @defmac == @deffn Macro
2992:
2993: \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
2994:
2995: \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
2996: \begingroup\defname {#1}{Macro}%
2997: \defunargs {#2}\endgroup %
2998: \catcode 61=\other % Turn off change made in \defparsebody
2999: }
3000:
3001: % @defspec == @deffn Special Form
3002:
3003: \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
3004:
3005: \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3006: \begingroup\defname {#1}{Special Form}%
3007: \defunargs {#2}\endgroup %
3008: \catcode 61=\other % Turn off change made in \defparsebody
3009: }
3010:
3011: % This definition is run if you use @defunx
3012: % anywhere other than immediately after a @defun or @defunx.
3013:
3014: \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
3015: \def\defunx #1 {\errmessage{@defunx in invalid context}}
3016: \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
3017: \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
3018: \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
3019: \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
3020:
3021: % @defmethod, and so on
3022:
3023: % @defop {Funny Method} foo-class frobnicate argument
3024:
3025: \def\defop #1 {\def\defoptype{#1}%
3026: \defopparsebody\Edefop\defopx\defopheader\defoptype}
3027:
3028: \def\defopheader #1#2#3{%
3029: \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
3030: \begingroup\defname {#2}{\defoptype{} on #1}%
3031: \defunargs {#3}\endgroup %
3032: }
3033:
3034: % @defmethod == @defop Method
3035:
3036: \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
3037:
3038: \def\defmethodheader #1#2#3{%
3039: \dosubind {fn}{\code{#2}}{on #1}% entry in function index
3040: \begingroup\defname {#2}{Method on #1}%
3041: \defunargs {#3}\endgroup %
3042: }
3043:
3044: % @defcv {Class Option} foo-class foo-flag
3045:
3046: \def\defcv #1 {\def\defcvtype{#1}%
3047: \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
3048:
3049: \def\defcvarheader #1#2#3{%
3050: \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
3051: \begingroup\defname {#2}{\defcvtype{} of #1}%
3052: \defvarargs {#3}\endgroup %
3053: }
3054:
3055: % @defivar == @defcv {Instance Variable}
3056:
3057: \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
3058:
3059: \def\defivarheader #1#2#3{%
3060: \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
3061: \begingroup\defname {#2}{Instance Variable of #1}%
3062: \defvarargs {#3}\endgroup %
3063: }
3064:
3065: % These definitions are run if you use @defmethodx, etc.,
3066: % anywhere other than immediately after a @defmethod, etc.
3067:
3068: \def\defopx #1 {\errmessage{@defopx in invalid context}}
3069: \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
3070: \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
3071: \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
3072:
3073: % Now @defvar
3074:
3075: % First, define the processing that is wanted for arguments of @defvar.
3076: % This is actually simple: just print them in roman.
3077: % This must expand the args and terminate the paragraph they make up
3078: \def\defvarargs #1{\normalparens #1%
3079: \interlinepenalty=10000
3080: \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
3081:
3082: % @defvr Counter foo-count
3083:
3084: \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
3085:
3086: \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
3087: \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
3088:
3089: % @defvar == @defvr Variable
3090:
3091: \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
3092:
3093: \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
3094: \begingroup\defname {#1}{Variable}%
3095: \defvarargs {#2}\endgroup %
3096: }
3097:
3098: % @defopt == @defvr {User Option}
3099:
3100: \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
3101:
3102: \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
3103: \begingroup\defname {#1}{User Option}%
3104: \defvarargs {#2}\endgroup %
3105: }
3106:
3107: % @deftypevar int foobar
3108:
3109: \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
3110:
3111: % #1 is the data type. #2 is the name.
3112: \def\deftypevarheader #1#2{%
3113: \doind {vr}{\code{#2}}% Make entry in variables index
3114: \begingroup\defname {\code{#1} #2}{Variable}%
3115: \interlinepenalty=10000
3116: \endgraf\penalty 10000\vskip -\parskip\penalty 10000
3117: \endgroup}
3118:
3119: % @deftypevr {Global Flag} int enable
3120:
3121: \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
3122:
3123: \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
3124: \begingroup\defname {\code{#2} #3}{#1}
3125: \interlinepenalty=10000
3126: \endgraf\penalty 10000\vskip -\parskip\penalty 10000
3127: \endgroup}
3128:
3129: % This definition is run if you use @defvarx
3130: % anywhere other than immediately after a @defvar or @defvarx.
3131:
3132: \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
3133: \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
3134: \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
3135: \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
3136: \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
3137:
3138: % Now define @deftp
3139: % Args are printed in bold, a slight difference from @defvar.
3140:
3141: \def\deftpargs #1{\bf \defvarargs{#1}}
3142:
3143: % @deftp Class window height width ...
3144:
1.1.1.4 ! root 3145: \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
1.1 root 3146:
3147: \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
3148: \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
3149:
3150: % This definition is run if you use @deftpx, etc
3151: % anywhere other than immediately after a @deftp, etc.
3152:
3153: \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
3154:
3155: \message{cross reference,}
3156: % Define cross-reference macros
3157: \newwrite \auxfile
3158:
3159: \newif\ifhavexrefs % True if xref values are known.
3160: \newif\ifwarnedxrefs % True if we warned once that they aren't known.
3161:
3162: % \setref{foo} defines a cross-reference point named foo.
3163:
3164: \def\setref#1{%
3165: %\dosetq{#1-title}{Ytitle}%
3166: \dosetq{#1-pg}{Ypagenumber}%
3167: \dosetq{#1-snt}{Ysectionnumberandtype}}
3168:
3169: \def\unnumbsetref#1{%
3170: %\dosetq{#1-title}{Ytitle}%
3171: \dosetq{#1-pg}{Ypagenumber}%
3172: \dosetq{#1-snt}{Ynothing}}
3173:
3174: \def\appendixsetref#1{%
3175: %\dosetq{#1-title}{Ytitle}%
3176: \dosetq{#1-pg}{Ypagenumber}%
3177: \dosetq{#1-snt}{Yappendixletterandtype}}
3178:
3179: % \xref, \pxref, and \ref generate cross-references to specified points.
3180: % For \xrefX, #1 is the node name, #2 the name of the Info
3181: % cross-reference, #3 the printed node name, #4 the name of the Info
3182: % file, #5 the name of the printed manual. All but the node name can be
3183: % omitted.
3184: %
3185: \def\pxref#1{see \xrefX[#1,,,,,,,]}
3186: \def\xref#1{See \xrefX[#1,,,,,,,]}
3187: \def\ref#1{\xrefX[#1,,,,,,,]}
3188: \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
3189: \def\printedmanual{\ignorespaces #5}%
3190: \def\printednodename{\ignorespaces #3}%
3191: %
3192: \setbox1=\hbox{\printedmanual}%
3193: \setbox0=\hbox{\printednodename}%
3194: \ifdim \wd0=0pt%
3195: \def\printednodename{\ignorespaces #1}%
3196: %%% Uncommment the following line to make the actual chapter or section title
3197: %%% appear inside the square brackets.
3198: %\def\printednodename{#1-title}%
3199: \fi%
3200: %
3201: %
3202: % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
3203: % not insert empty discretionaries after hyphens, which means that it
3204: % will not find a line break at a hyphen in a node names. Since some
3205: % manuals are best written with fairly long node names, containing
3206: % hyphens, this is a loss. Therefore, we simply give the text of
3207: % the node name again, so it is as if TeX is seeing it for the first
3208: % time.
3209: \ifdim \wd1>0pt
3210: section ``\printednodename'' in \cite{\printedmanual}%
3211: \else%
3212: \turnoffactive%
3213: \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
3214: \fi
3215: \endgroup}
3216:
3217: % \dosetq is the interface for calls from other macros
3218:
3219: % Use \turnoffactive so that punctuation chars such as underscore
3220: % work in node names.
3221: \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
3222: \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
3223: \next}}
3224:
3225: % \internalsetq {foo}{page} expands into
3226: % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
3227: % When the aux file is read, ' is the escape character
3228:
3229: \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
3230:
3231: % Things to be expanded by \internalsetq
3232:
3233: \def\Ypagenumber{\folio}
3234:
3235: \def\Ytitle{\thischapter}
3236:
3237: \def\Ynothing{}
3238:
3239: \def\Ysectionnumberandtype{%
3240: \ifnum\secno=0 Chapter\xreftie\the\chapno %
3241: \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
3242: \else \ifnum \subsubsecno=0 %
3243: Section\xreftie\the\chapno.\the\secno.\the\subsecno %
3244: \else %
3245: Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
3246: \fi \fi \fi }
3247:
3248: \def\Yappendixletterandtype{%
3249: \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
3250: \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
3251: \else \ifnum \subsubsecno=0 %
3252: Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
3253: \else %
3254: Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
3255: \fi \fi \fi }
3256:
3257: \gdef\xreftie{'tie}
3258:
3259: % Use TeX 3.0's \inputlineno to get the line number, for better error
3260: % messages, but if we're using an old version of TeX, don't do anything.
3261: %
3262: \ifx\inputlineno\thisisundefined
3263: \let\linenumber = \empty % Non-3.0.
3264: \else
3265: \def\linenumber{\the\inputlineno:\space}
3266: \fi
3267:
3268: % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
3269: % If its value is nonempty, SUFFIX is output afterward.
3270:
3271: \def\refx#1#2{%
3272: \expandafter\ifx\csname X#1\endcsname\relax
3273: % If not defined, say something at least.
3274: $\langle$un\-de\-fined$\rangle$%
3275: \ifhavexrefs
3276: \message{\linenumber Undefined cross reference `#1'.}%
3277: \else
3278: \ifwarnedxrefs\else
3279: \global\warnedxrefstrue
3280: \message{Cross reference values unknown; you must run TeX again.}%
3281: \fi
3282: \fi
3283: \else
3284: % It's defined, so just use it.
3285: \csname X#1\endcsname
3286: \fi
3287: #2% Output the suffix in any case.
3288: }
3289:
3290: % Read the last existing aux file, if any. No error if none exists.
3291:
3292: % This is the macro invoked by entries in the aux file.
3293: \def\xrdef #1#2{
3294: {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
3295:
3296: \def\readauxfile{%
3297: \begingroup
3298: \catcode `\^^@=\other
3299: \catcode `\&=\other
3300: \catcode `\=\other
3301: \catcode `\^^C=\other
3302: \catcode `\^^D=\other
3303: \catcode `\^^E=\other
3304: \catcode `\^^F=\other
3305: \catcode `\^^G=\other
3306: \catcode `\^^H=\other
3307: \catcode `\=\other
3308: \catcode `\^^L=\other
3309: \catcode `\=\other
3310: \catcode `\=\other
3311: \catcode `\=\other
3312: \catcode `\=\other
3313: \catcode `\=\other
3314: \catcode `\=\other
3315: \catcode `\=\other
3316: \catcode `\=\other
3317: \catcode `\=\other
3318: \catcode `\=\other
3319: \catcode `\=\other
3320: \catcode `\=\other
3321: \catcode 26=\other
3322: \catcode `\^^[=\other
3323: \catcode `\^^\=\other
3324: \catcode `\^^]=\other
3325: \catcode `\^^^=\other
3326: \catcode `\^^_=\other
3327: \catcode `\@=\other
3328: \catcode `\^=\other
3329: \catcode `\~=\other
3330: \catcode `\[=\other
3331: \catcode `\]=\other
3332: \catcode`\"=\other
3333: \catcode`\_=\other
3334: \catcode`\|=\other
3335: \catcode`\<=\other
3336: \catcode`\>=\other
3337: \catcode `\$=\other
3338: \catcode `\#=\other
3339: \catcode `\&=\other
1.1.1.4 ! root 3340: % `\+ does not work, so use 43.
! 3341: \catcode 43=\other
1.1 root 3342: % the aux file uses ' as the escape.
3343: % Turn off \ as an escape so we do not lose on
3344: % entries which were dumped with control sequences in their names.
3345: % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
3346: % Reference to such entries still does not work the way one would wish,
3347: % but at least they do not bomb out when the aux file is read in.
3348: \catcode `\{=1 \catcode `\}=2
3349: \catcode `\%=\other
3350: \catcode `\'=0
3351: \catcode `\\=\other
3352: \openin 1 \jobname.aux
3353: \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
3354: \fi
3355: % Open the new aux file. Tex will close it automatically at exit.
3356: \openout \auxfile=\jobname.aux
3357: \endgroup}
3358:
3359:
3360: % Footnotes.
3361:
3362: \newcount \footnoteno
3363:
1.1.1.3 root 3364: % The trailing space in the following definition for supereject is
3365: % vital for proper filling; pages come out unaligned when you do a
3366: % pagealignmacro call if that space before the closing brace is
3367: % removed.
1.1 root 3368: \def\supereject{\par\penalty -20000\footnoteno =0 }
3369:
3370: % @footnotestyle is meaningful for info output only..
3371: \let\footnotestyle=\comment
3372:
3373: \let\ptexfootnote=\footnote
3374:
3375: {\catcode `\@=11
3376: \long\gdef\footnote #1{\global\advance \footnoteno by \@ne
3377: \unskip
3378: \edef\thisfootno{$^{\the\footnoteno}$}%
3379: \let\@sf\empty
3380: \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
3381: \thisfootno\@sf \footnotezzz{#1}}
3382: % \parsearg\footnotezzz}
3383:
3384: \long\gdef\footnotezzz #1{\insert\footins{
3385: \interlinepenalty\interfootnotelinepenalty
3386: \splittopskip\ht\strutbox % top baseline for broken footnotes
3387: \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
3388: \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
3389: \footstrut\parindent=\defaultparindent\hang\textindent{\thisfootno}#1\strut}}
3390:
3391: }%end \catcode `\@=11
3392:
1.1.1.4 ! root 3393: % Set the baselineskip to #1, and the lineskip and strut size
! 3394: % correspondingly. There is no deep meaning behind these magic numbers
! 3395: % used as factors; they just match (closely enough) what Knuth defined.
! 3396: %
! 3397: \def\lineskipfactor{.1}
! 3398: \def\strutheightpercent{.71}
! 3399: \def\strutdepthpercent{.29}
! 3400: %
! 3401: \def\setleading#1{%
! 3402: \baselineskip = #1\relax
! 3403: \normalbaselineskip = \baselineskip
! 3404: \lineskip = \lineskipfactor\baselineskip
! 3405: \setbox\strutbox =\hbox{%
! 3406: \vrule width0pt height\strutheightpercent\baselineskip
! 3407: depth \strutdepthpercent \baselineskip
! 3408: }%
! 3409: }
! 3410:
! 3411: % @| inserts a changebar to the left of the current line. It should
! 3412: % surround any changed text. This approach does *not* work if the
! 3413: % change spans more than two lines of output. To handle that, we would
! 3414: % have adopt a much more difficult approach (putting marks into the main
! 3415: % vertical list for the beginning and end of each change).
! 3416: %
! 3417: \def\|{%
! 3418: % \vadjust can only be used in horizontal mode.
! 3419: \leavevmode
! 3420: %
! 3421: % Append this vertical mode material after the current line in the output.
! 3422: \vadjust{%
! 3423: % We want to insert a rule with the height and depth of the current
! 3424: % leading; that is exactly what \strutbox is supposed to record.
! 3425: \vskip-\baselineskip
! 3426: %
! 3427: % \vadjust-items are inserted at the left edge of the type. So
! 3428: % the \llap here moves out into the left-hand margin.
! 3429: \llap{%
! 3430: %
! 3431: % For a thicker or thinner bar, change the `1pt'.
! 3432: \vrule height\baselineskip width1pt
! 3433: %
! 3434: % This is the space between the bar and the text.
! 3435: \hskip 12pt
! 3436: }%
! 3437: }%
! 3438: }
! 3439:
! 3440: % For a final copy, take out the rectangles
! 3441: % that mark overfull boxes (in case you have decided
! 3442: % that the text looks ok even though it passes the margin).
! 3443: %
! 3444: \def\finalout{\overfullrule=0pt}
! 3445:
! 3446:
1.1 root 3447: % End of control word definitions.
3448:
3449: \message{and turning on texinfo input format.}
3450:
3451: \def\openindices{%
3452: \newindex{cp}%
3453: \newcodeindex{fn}%
3454: \newcodeindex{vr}%
3455: \newcodeindex{tp}%
3456: \newcodeindex{ky}%
3457: \newcodeindex{pg}%
3458: }
3459:
3460: % Set some numeric style parameters, for 8.5 x 11 format.
3461:
3462: %\hsize = 6.5in
3463: \newdimen\defaultparindent \defaultparindent = 15pt
3464: \parindent = \defaultparindent
3465: \parskip 18pt plus 1pt
1.1.1.4 ! root 3466: \setleading{15pt}
1.1 root 3467: \advance\topskip by 1.2cm
3468:
3469: % Prevent underfull vbox error messages.
3470: \vbadness=10000
3471:
3472: % Following George Bush, just get rid of widows and orphans.
1.1.1.2 root 3473: \widowpenalty=10000
3474: \clubpenalty=10000
1.1 root 3475:
3476: % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
3477: % using an old version of TeX, don't do anything. We want the amount of
3478: % stretch added to depend on the line length, hence the dependence on
3479: % \hsize. This makes it come to about 9pt for the 8.5x11 format.
3480: %
3481: \ifx\emergencystretch\thisisundefined \else
3482: \emergencystretch = \hsize
3483: \divide\emergencystretch by 45
3484: \fi
3485:
3486: % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
3487: \def\smallbook{
1.1.1.4 ! root 3488:
! 3489: % These values for secheadingskip and subsecheadingskip are
! 3490: % experiments. RJC 7 Aug 1992
! 3491: \global\secheadingskip = 17pt plus 6pt minus 3pt
! 3492: \global\subsecheadingskip = 14pt plus 6pt minus 3pt
! 3493:
1.1 root 3494: \global\lispnarrowing = 0.3in
1.1.1.4 ! root 3495: \setleading{12pt}
1.1.1.3 root 3496: \advance\topskip by -1cm
1.1 root 3497: \global\parskip 3pt plus 1pt
3498: \global\hsize = 5in
3499: \global\vsize=7.5in
3500: \global\tolerance=700
3501: \global\hfuzz=1pt
3502: \global\contentsrightmargin=0pt
3503:
3504: \global\pagewidth=\hsize
3505: \global\pageheight=\vsize
3506:
3507: \global\let\smalllisp=\smalllispx
3508: \global\let\smallexample=\smalllispx
3509: \global\def\Esmallexample{\Esmalllisp}
3510: }
3511:
3512: % Use @afourpaper to print on European A4 paper.
3513: \def\afourpaper{
3514: \global\tolerance=700
3515: \global\hfuzz=1pt
1.1.1.4 ! root 3516: \setleading{12pt}
1.1 root 3517: \global\parskip 15pt plus 1pt
3518:
3519: \global\vsize= 53\baselineskip
3520: \advance\vsize by \topskip
3521: %\global\hsize= 5.85in % A4 wide 10pt
3522: \global\hsize= 6.5in
3523: \global\outerhsize=\hsize
3524: \global\advance\outerhsize by 0.5in
3525: \global\outervsize=\vsize
3526: \global\advance\outervsize by 0.6in
3527:
3528: \global\pagewidth=\hsize
3529: \global\pageheight=\vsize
3530: }
3531:
3532: % Define macros to output various characters with catcode for normal text.
3533: \catcode`\"=\other
3534: \catcode`\~=\other
3535: \catcode`\^=\other
3536: \catcode`\_=\other
3537: \catcode`\|=\other
3538: \catcode`\<=\other
3539: \catcode`\>=\other
3540: \catcode`\+=\other
3541: \def\normaldoublequote{"}
3542: \def\normaltilde{~}
3543: \def\normalcaret{^}
3544: \def\normalunderscore{_}
3545: \def\normalverticalbar{|}
3546: \def\normalless{<}
3547: \def\normalgreater{>}
3548: \def\normalplus{+}
3549:
3550: % This macro is used to make a character print one way in ttfont
3551: % where it can probably just be output, and another way in other fonts,
3552: % where something hairier probably needs to be done.
3553: %
3554: % #1 is what to print if we are indeed using \tt; #2 is what to print
3555: % otherwise. Since all the Computer Modern typewriter fonts have zero
3556: % interword stretch (and shrink), and it is reasonable to expect all
3557: % typewriter fonts to have this, we can check that font parameter.
3558: %
3559: \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
3560:
3561: % Turn off all special characters except @
3562: % (and those which the user can use as if they were ordinary).
3563: % Most of these we simply print from the \tt font, but for some, we can
3564: % use math or other variants that look better in normal text.
3565:
3566: \catcode`\"=\active
3567: \def\activedoublequote{{\tt \char '042}}
3568: \let"=\activedoublequote
3569: \catcode`\~=\active
3570: \def~{{\tt \char '176}}
3571: \chardef\hat=`\^
3572: \catcode`\^=\active
3573: \def^{{\tt \hat}}
3574:
3575: \catcode`\_=\active
3576: \def_{\ifusingtt\normalunderscore\_}
3577: % Subroutine for the previous macro.
3578: \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
3579:
3580: % \lvvmode is equivalent in function to \leavevmode.
3581: % Using \leavevmode runs into trouble when written out to
3582: % an index file due to the expansion of \leavevmode into ``\unhbox
3583: % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
3584: % magic tricks with @.
3585: \def\lvvmode{\vbox to 0pt{}}
3586:
3587: \catcode`\|=\active
3588: \def|{{\tt \char '174}}
3589: \chardef \less=`\<
3590: \catcode`\<=\active
3591: \def<{{\tt \less}}
3592: \chardef \gtr=`\>
3593: \catcode`\>=\active
3594: \def>{{\tt \gtr}}
3595: \catcode`\+=\active
3596: \def+{{\tt \char 43}}
3597: %\catcode 27=\active
3598: %\def^^[{$\diamondsuit$}
3599:
3600: % Used sometimes to turn off (effectively) the active characters
3601: % even after parsing them.
3602: \def\turnoffactive{\let"=\normaldoublequote
3603: \let~=\normaltilde
3604: \let^=\normalcaret
3605: \let_=\normalunderscore
3606: \let|=\normalverticalbar
3607: \let<=\normalless
3608: \let>=\normalgreater
3609: \let+=\normalplus}
3610:
3611: % Set up an active definition for =, but don't enable it most of the time.
3612: {\catcode`\==\active
3613: \global\def={{\tt \char 61}}}
3614:
3615: \catcode`\@=0
3616:
3617: % \rawbackslashxx output one backslash character in current font
3618: \global\chardef\rawbackslashxx=`\\
3619: %{\catcode`\\=\other
3620: %@gdef@rawbackslashxx{\}}
3621:
3622: % \rawbackslash redefines \ as input to do \rawbackslashxx.
3623: {\catcode`\\=\active
3624: @gdef@rawbackslash{@let\=@rawbackslashxx }}
3625:
3626: % \normalbackslash outputs one backslash in fixed width font.
3627: \def\normalbackslash{{\tt\rawbackslashxx}}
3628:
3629: % Say @foo, not \foo, in error messages.
3630: \escapechar=`\@
3631:
3632: % \catcode 17=0 % Define control-q
3633: \catcode`\\=\active
3634:
3635: % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
3636: % That is what \eatinput is for; after that, the `\' should revert to printing
3637: % a backslash.
3638: %
3639: @gdef@eatinput input texinfo{@fixbackslash}
3640: @global@let\ = @eatinput
3641:
3642: % On the other hand, perhaps the file did not have a `\input texinfo'. Then
3643: % the first `\{ in the file would cause an error. This macro tries to fix
3644: % that, assuming it is called before the first `\' could plausibly occur.
3645: %
3646: @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
3647:
3648: %% These look ok in all fonts, so just make them not special. The @rm below
3649: %% makes sure that the current font starts out as the newly loaded cmr10
3650: @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
3651:
3652: @textfonts
3653: @rm
3654:
3655: @c Local variables:
3656: @c page-delimiter: "^\\\\message"
3657: @c End:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.