|
|
1.1 root 1: %% TeX macros to handle texinfo files
2:
3: % Copyright (C) 1985 Richard M. Stallman
4: %
5: %This program is distributed in the hope that it will be useful,
6: %but without any warranty. No author or distributor
7: %accepts responsibility to anyone for the consequences of using it
8: %or for whether it serves any particular purpose or works at all,
9: %unless he says so in writing.
10: %
11: % Permission is granted to anyone to distribute verbatim copies
12: % of this program's source code as received, in any medium, provided that
13: % the copyright notice, the nonwarraty notice above
14: % and this permission notice are preserved,
15: % and that the distributor grants the recipient all rights
16: % for further redistribution as permitted by this notice,
17: % and informs him of these rights.
18: %
19: % Permission is granted to distribute modified versions of this
20: % program's source code, or of portions of it, under the above
21: % conditions, plus the conditions that all changed files carry
22: % prominent notices stating who last changed them and that the
23: % entire derived work, including anything packaged as part of it and
24: % conceptually functioning as a modification of it rather than an
25: % application of it, is in its entirety subject to a permission
26: % notice identical to this one.
27: %
28: % Permission is granted to distribute this program (verbatim or
29: % as modified) in compiled or executable form, provided verbatim
30: % redistribution is permitted as stated above for source code, and
31: % A. it is accompanied by the corresponding machine-readable
32: % source code, under the above conditions, or
33: % B. it is accompanied by a written offer, with no time limit,
34: % to distribute the corresponding machine-readable source code,
35: % under the above conditions, to any one, in return for reimbursement
36: % of the cost of distribution. Verbatim redistribution of the
37: % written offer must be permitted. Or,
38: % C. it is distributed by someone who received only the
39: % compiled or executable form, and is accompanied by a copy of the
40: % written offer of source code which he received along with it.
41: %
42: %In other words, you are welcome to use, share and improve this program.
43: %You are forbidden to forbid anyone else to use, share and improve
44: %what you give them. Help stamp out software-hoarding!
45:
46: \def\texinfoversion{1}
47: \message{Loading texinfo package [Version \texinfoversion]:}
48: \message{}
49:
50: \message{Basics,}
51: \chardef\other=12
52: \parskip=1.5pt
53: \advance\topskip by 1.2cm
54:
55: \hyphenation{ap-pen-dix}
56: \hyphenation{mini-buf-fer mini-buf-fers}
57:
58: % Margin to add to right of even pages, to left of odd pages.
59: \newdimen \bindingoffset \bindingoffset=0pt
60: \newdimen \normaloffset \normaloffset=\hoffset
61: \newdimen\pagewidth \newdimen\pageheight
62: \pagewidth=\hsize \pageheight=\vsize
63:
64: % \onepageout takes a vbox as an argument. Note that \pagecontents
65: % does insertions itself, but you have to call it yourself.
66: \chardef\PAGE=255 \output={\onepageout{\pagecontents\PAGE}}
67: \def\onepageout#1{\hoffset=\normaloffset
68: \ifodd\pageno \advance\hoffset by \bindingoffset
69: \else \advance\hoffset by -\bindingoffset\fi
70: \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
71: {\let\hsize=\pagewidth \makefootline}}
72: \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
73: \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
74: {\catcode`\@ =11
75: \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
76: \dimen@=\dp#1 \unvbox#1
77: \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
78: \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
79: }
80:
81: % Parse an argument, then pass it to #1.
82: % The argument can be delimited with [...] or with "..." or braces
83: % or it can be a whole line.
84: % #1 should be a macro which expects
85: % an ordinary undelimited TeX argument.
86:
87: \def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
88:
89: \def\parseargx{%
90: \ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
91: \aftergroup \parseargline %
92: \fi \endgroup}
93:
94: {\obeyspaces %
95: \gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
96:
97: \gdef\obeyedspace{\ }
98:
99: \def\parseargline{\begingroup \obeylines \parsearglinex}
100: {\obeylines %
101: \gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
102:
103: \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
104:
105: %% These are used to keep @begin/@end levels from running away
106: %% Call \inENV within environments (after a \begingroup)
107: \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
108: \def\ENVcheck{%
109: \ifENV\errmessage{Still within an environment. Type Return to continue.}
110: \endgroup\fi} % This is not perfect, but it should reduce lossage
111:
112: % @begin foo is the same as @foo, for now.
113: \newhelp\EMsimple{Type <Return> to continue}
114:
115: \outer\def\begin{\parsearg\beginxxx}
116:
117: \def\beginxxx #1{%
118: \expandafter\ifx\csname #1\endcsname\relax
119: {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
120: \csname #1\endcsname\fi}
121:
122: %% @end foo executes the definition of \Efoo.
123: %% foo can be delimited by doublequotes or brackets.
124: \let\ptexend = \end
125:
126: \def\end{\parsearg\endxxx}
127:
128: \def\endxxx #1{%
129: \expandafter\ifx\csname E#1\endcsname\relax
130: \expandafter\ifx\csname #1\endcsname\relax
131: \errmessage{Undefined command @end #1}\else
132: \errorE{#1}\fi\fi
133: \csname E#1\endcsname}
134: \def\errorE#1{
135: {\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
136:
137: % Simple aliases that make some plain tex constructs available.
138:
139: \let\ptexnobreak=\nobreak
140: \def\nobreak{\par\penalty 10000}
141:
142: % Single-spacing is done by various environments.
143:
144: \newskip\singlespaceskip \singlespaceskip = \baselineskip
145: \def\singlespace{%
146: {\advance \baselineskip by -\singlespaceskip
147: \kern \baselineskip}%
148: \baselineskip=\singlespaceskip
149: }
150:
151: % @@ prints an @ -- for Scribe compatibility.
152: % Kludge this until the fonts are right (grr).
153: \def\@{{\sf @}}
154:
155: % Define @` and @' to be the same as ` and '
156: % but suppressing ligatures.
157: \def\`{{`}}
158: \def\'{{'}}
159:
160: % @: is forces normal size whitespace following.
161: \def\:{\spacefactor=1000 }
162:
163: % @* forces a line break.
164: \let\ptexstar=\* \def\*{\hfil\break}
165:
166: % @. is an end-of-sentence period.
167: \let\ptexdot=\. \def\.{.\spacefactor=3000 }
168:
169: % @# leaves space for a special character.
170: \let\ptexnumsign=\# \def\#{\write19{(@##)}\hbox to 0.7em{\hfil}}
171:
172: % @w prevents a word break
173: \def\w #1{\hbox{#1}}
174:
175: % Save the essence of & for tabular environments as @\ for BoTeX
176: % Say @settabs 4 @columns, then @<col0@\col1@\col2@\col3@cr
177: \let\\=& \let\<=\+
178: % @+ raises its argument, @- lowers.
179: \let\ptexplus=\+
180: \def\+ #1{\raise 1ex\hbox{#1}}
181:
182: \let\ptexminus=\-
183: \def\- #1{\lower 1ex\hbox{#1}}
184:
185: % @group ... @end group forces ... to be all on one page.
186:
187: \def\group{\begingroup% \inENV ???
188: \def \Egroup{\egroup\endgroup}
189: \vbox\bgroup}
190:
191: % @br forces paragraph break
192:
193: \let\br = \par
194:
195: % @dots{} output some dots
196:
197: \def\dots{$\ldots$}
198:
199: % @page forces the start of a new page
200:
201: \def\page{\par\vfill\supereject}
202:
203: % @exdent text....
204: % outputs text on separate line in roman font, starting at standard page margin
205:
206: \def\exdent{\errmessage{@exdent in filled text}}
207: % @lisp, etc, define \exdent locally from \internalexdent
208:
209: {\obeyspaces
210: \gdef\internalexdent{\parsearg\exdentzzz}}
211:
212: \def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
213: \advance \hsize by -\leftskip
214: \advance \hsize by -\rightskip
215: \leftline{{\rm#1}}}}
216:
217: % @include file insert text of that file as input.
218:
219: \def\include{\parsearg\includezzz}
220: \def\includezzz #1{{\def\thisfile{#1}\input #1
221: }}
222:
223: \def\thisfile{}
224:
225: % @need space-in-mils
226: % forces a page break if there is not space-in-mils remaining.
227:
228: \newdimen\mil \mil=0.001in
229:
230: \def\need{\parsearg\needx}
231:
232: \def\needx #1{\par %
233: \begingroup %
234: \dimen0=\pagetotal %
235: \advance \dimen0 by #1\mil %
236: \ifdim \dimen0>\pagegoal \vfill\eject \fi %
237: \endgroup}
238:
239: % @center line outputs that line, centered
240:
241: \def\center{\parsearg\centerzzz}
242: \def\centerzzz #1{{\advance\hsize by -\leftskip
243: \advance\hsize by -\rightskip
244: \centerline{#1}}}
245:
246: % @sp n outputs n lines of vertical space
247:
248: \def\sp{\parsearg\spxxx}
249: \def\spxxx #1{\par \vskip #1\baselineskip}
250:
251: % @comment ...line which is ignored...
252: % @c is the same as @comment
253: % @ignore ... @end ignore is another way to write a comment
254:
255: \def\comment{\parsearg \commentxxx}
256:
257: \def\commentxxx #1{}
258:
259: \let\c=\comment
260:
261: \long\def\ignore #1\end ignore{}
262:
263: % Some texinfo constructs that are trivial in tex
264:
265: \def\iftex{}
266: \def\Eiftex{}
267: \long\def\ifinfo #1\end ifinfo{}
268: \long\def\menu #1\end menu{}
269: \def\asis#1{#1}
270:
271: \def\node{\parsearg\nodezzz}
272: \def\nodezzz#1{\nodexxx [#1,]}
273: \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
274: \let\lastnode=\relax
275:
276: \def\donoderef{\ifx\lastnode\relax\else
277: \expandafter\expandafter\expandafter\setref{\lastnode}\fi
278: \let\lastnode=\relax}
279:
280: \let\refill=\relax
281:
282: \let\setfilename=\comment
283:
284: \def\inforef #1{\inforefzzz #1,,,,**}
285: \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}}, node `\losespace#1{}'}
286: \def\losespace #1{#1}
287:
288: \message{fonts,}
289:
290: % Font-change commands.
291:
292: %% Try out Computer Modern fonts at a little bigger than \magstephalf
293: \font\tenrm=amr10 scaled \magstephalf
294: \font\tentt=amtt10 scaled \magstephalf
295: \font\tenbf=amb10 scaled \magstephalf
296: \font\tenit=amti10 scaled \magstephalf
297: \font\tensl=amsl10 scaled \magstephalf
298: \font\tensf=amss10 scaled \magstephalf
299: \def\li{\sf}
300: \font\tensc=amcsc10 scaled \magstephalf
301:
302: % Font for title
303: \font\titlerm = ambx10 scaled \magstep5
304:
305: % Fonts for indices
306: \font\indit=amti9 \font\indrm=amr9
307: \def\indbf{\indrm} \def\indsl{\indit}
308: \def\indexfonts{\let\it=\indit \let\sl=\indsl \let\bf=\indbf \let\rm=\indrm}
309:
310: % Fonts for headings
311: \font\chaprm=ambx10 scaled \magstep3
312: \font\chapit=amti10 scaled \magstep3
313: \font\chapsl=amsl10 scaled \magstep3
314: \let\chapbf=\chaprm
315:
316: \font\secrm=ambx10 scaled \magstep2
317: \font\secit=amti10 scaled \magstep2
318: \font\secsl=amsl10 scaled \magstep2
319: \let\secbf=\secrm
320:
321: \font\ssecrm=ambx10 scaled \magstep1
322: \font\ssecit=amti10 scaled \magstep1
323: \font\ssecsl=amsl10 scaled \magstep1
324: \let\ssecbf=\ssecrm
325:
326: \def\textfonts{\let\rm=\tenrm\let\it=\tenit\let\sl=\tensl\let\bf=\tenbf%
327: \let\sc=\tensc\let\sf=\tensf}
328: \def\chapfonts{\let\rm=\chaprm\let\it=\chapit\let\sl=\chapsl\let\bf=\chapbf}
329: \def\secfonts{\let\rm=\secrm\let\it=\secit\let\sl=\secsl\let\bf=\secbf}
330: \def\subsecfonts{\let\rm=\ssecrm\let\it=\ssecit\let\sl=\ssecsl\let\bf=\ssecbf}
331: % Count depth in font-changes, for error checks
332: \newcount\fontdepth \fontdepth=0
333:
334: %% Add scribe-like font environments, plus @l for inline lisp (usually sans
335: %% serif) and @ii for TeX italic
336: \let\ptexb=\b \let\ptexc=\c \let\ptexi=\i \let\ptext=\t
337: \let\ptexl=\l \let\ptexL=\L
338:
339: \def\i#1{{\sl #1}}
340: \let\var=\i
341: \let\dfn=\i
342:
343: \def\b#1{{\bf #1}}
344:
345: \def\t#1{{\tt \rawbackslash #1}}
346: \let\ttfont = \t
347: \let\kbd=\t
348: \def\samp #1{`{\tt \rawbackslash #1}'}
349: \def\key #1{{\tt \uppercase{#1}}}
350: \def\ctrl #1{{\tt \rawbackslash \hat}#1}
351:
352: \let\file=\samp
353:
354: \def\l#1{{\li #1}}
355: \let\code=\l
356:
357: \def\r#1{{\rm #1}}
358: \def\s#1{{\sc #1}}
359: \def\ii#1{{\it #1}}
360:
361: \def\titlefont#1{{\titlerm #1}}
362:
363: \def\titlepage{\begingroup \parindent=0pt \hbox{}%
364: \let\oldpage=\page
365: \def\page{\oldpage \hbox{}}}
366:
367: \def\Etitlepage{\endgroup\page\HEADINGSon}
368:
369: % Used to generate quoted braces.
370:
371: \def\mylbrace {{\tt \char '173}}
372: \def\myrbrace {{\tt \char '175}}
373: \let\{=\mylbrace
374: \let\}=\myrbrace
375:
376: \def\tie{\penalty 10000\ } % Save plain tex definition of ~.
377:
378: % Make altmode in file print out right
379:
380: \catcode `\^^[=\active \def^^[{$\diamondsuit$}
381:
382: \message{page headings,}
383:
384: %%% Set up page headings and footings.
385:
386: \let\thispage=\folio
387:
388: \newtoks \evenheadline % Token sequence for heading line of even pages
389: \newtoks \oddheadline % Token sequence for heading line of odd pages
390: \newtoks \evenfootline % Token sequence for footing line of even pages
391: \newtoks \oddfootline % Token sequence for footing line of odd pages
392:
393: % Now make Tex use those variables
394: \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}}
395: \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}}
396:
397: % Commands to set those variables.
398: % For example, this is what @headings on does
399: % @evenheading @thistitle|@thispage|@thischapter
400: % @oddheading @thischapter|@thispage|@thistitle
401: % @evenfooting @thisfile||
402: % @oddfooting ||@thisfile
403:
404: \def\evenheading{\parsearg\evenheadingxxx}
405: \def\oddheading{\parsearg\oddheadingxxx}
406: \def\everyheading{\parsearg\everyheadingxxx}
407:
408: \def\evenfooting{\parsearg\evenfootingxxx}
409: \def\oddfooting{\parsearg\oddfootingxxx}
410: \def\everyfooting{\parsearg\everyfootingxxx}
411:
412: \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
413: \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
414: \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
415:
416: \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
417: \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
418: \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
419:
420: \def\everyheadingxxx #1{\everyheadingyyy #1\|\|\|\|\finish}
421: \def\everyheadingyyy #1\|#2\|#3\|#4\finish{%
422: \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
423: \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
424:
425: \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
426: \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
427: \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
428:
429: \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
430: \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
431: \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
432:
433: \def\everyfootingxxx #1{\everyfootingyyy #1\|\|\|\|\finish}
434: \def\everyfootingyyy #1\|#2\|#3\|#4\finish{%
435: \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
436: \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
437:
438: % @headings on turns them on.
439: % @headings off turns them off.
440: % By default, they are off.
441:
442: \def\headings #1 {\csname HEADINGS#1\endcsname}
443:
444: \def\HEADINGSoff{
445: \global\evenheadline={\hfil} \global\evenfootline={\hfil}
446: \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
447: \HEADINGSoff
448: % When we turn headings on, set the page number to 1,
449: % Put current file name in lower left corner,
450: % Put chapter name on inside top of right hand pages, document
451: % title on inside top of left hand pages, and page numbers on outside top
452: % edge of all pages.
453: \def\HEADINGSon{
454: \global\pageno=1
455: \global\evenfootline={\thisfile\hfil}
456: \global\oddfootline={\thisfile\hfil}
457: \global\evenheadline={\line{\folio\hfil\thistitle}}
458: \global\oddheadline={\line{\thischapter\hfil\folio}}
459: }
460:
461: % Subroutines used in generating headings
462: \def\today{\ifcase\month\or
463: January\or February\or March\or April\or May\or June\or
464: July\or August\or September\or October\or November\or December\fi
465: \space\number\day, \number\year}
466:
467: % @settitle line... specifies the title of the document, for headings
468: % It generates no output of its own
469:
470: \def\thistitle{No Title}
471: \def\settitle{\parsearg\settitlezzz}
472: \def\settitlezzz #1{\gdef\thistitle{#1}}
473:
474: \message{tables,}
475:
476: % Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
477:
478: % default indentation of table text
479: \newdimen\tableindent \tableindent=.8in
480: % default indentation of @itemize and @enumerate text
481: \newdimen\itemindent \itemindent=.8in
482: % margin between end of table item and start of table text.
483: \newdimen\itemmargin \itemmargin=.1in
484:
485: % used internally for \itemindent minus \itemmargin
486: \newdimen\itemmax
487:
488: % Note @table and @ftable define @item, @itemx, etc., with these defs.
489: % They also define \itemindex
490: % to index the item name in whatever manner is desired (perhaps none).
491:
492: \def\internalBitem{\smallbreak \parsearg\itemzzz}
493: \def\internalBitemx{\par \parsearg\itemzzz}
494:
495: \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
496: \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
497:
498: \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
499: \def\internalBkitemx{\par \parsearg\kitemzzz}
500:
501: \def\kitemzzz #1{\dosubind {kw}{#1}{for {\bf \lastfunction}}\itemzzz {#1}}
502:
503: \def\xitemzzz #1{\dosubind {kw}{#1}{for {\bf \xitemsubtopic}}\itemzzz {#1}}
504:
505: \def\itemzzz #1{\begingroup %
506: \advance \hsize by -\rightskip %
507: \advance \hsize by -\leftskip %
508: \setbox0=\hbox{\itemfont{#1}}%
509: \itemindex{#1}%
510: \parskip=0in %
511: \noindent %
512: \ifdim \wd0>\itemmax %
513: \vadjust{\penalty 10000}%
514: \hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
515: \else %
516: \hbox to 0pt{\hskip -\tableindent\box0\hss}%
517: \fi %
518: \endgroup %
519: }
520:
521: \def\item{\errmessage{@item while not in a table}}
522: \def\itemx{\errmessage{@itemx while not in a table}}
523: \def\kitem{\errmessage{@kitem while not in a table}}
524: \def\kitemx{\errmessage{@kitemx while not in a table}}
525: \def\xitem{\errmessage{@xitem while not in a table}}
526: \def\xitemx{\errmessage{@xitemx while not in a table}}
527:
528: %% Contains a kludge to get @end[description] to work
529: \def\description{\tablez{\dontindex}{1}{}{}{}{}}
530:
531: \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
532: {\obeylines\obeyspaces%
533: \gdef\tablex #1^^M{%
534: \tabley\dontindex#1 \endtabley}}
535:
536: \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
537: {\obeylines\obeyspaces%
538: \gdef\ftablex #1^^M{%
539: \tabley\fnitemindex#1 \endtabley}}
540:
541: \def\dontindex #1{}
542: \def\fnitemindex #1{\doind {fn}{#1}}%
543:
544: {\obeyspaces %
545: \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
546: \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
547:
548: \def\tablez #1#2#3#4#5#6{%
549: \aboveenvbreak %
550: \begingroup %
551: \def\Edescription{\Etable}% Neccessary kludge.
552: \let\itemindex=#1%
553: \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
554: \ifnum 0#4>0 \tableindent=#4\mil \fi %
555: \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
556: \def\itemfont{#2}%
557: \itemmax=\tableindent %
558: \advance \itemmax by -\itemmargin %
559: \advance \leftskip by \tableindent %
560: \parindent = 0pt
561: \parskip = \smallskipamount
562: \ifdim \parskip=0pt \parskip=2pt \fi%
563: \def\Etable{\endgraf\endgroup\afterenvbreak}%
564: \let\item = \internalBitem %
565: \let\itemx = \internalBitemx %
566: \let\kitem = \internalBkitem %
567: \let\kitemx = \internalBkitemx %
568: \let\xitem = \internalBxitem %
569: \let\xitemx = \internalBxitemx %
570: }
571:
572: % This is the counter used by @enumerate, which is really @itemize
573:
574: \newcount \itemno
575:
576: \def\itemize{\parsearg\itemizezzz}
577:
578: \def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
579:
580: \def\itemizey #1#2{%
581: \aboveenvbreak %
582: \begingroup %
583: \itemno = 0 %
584: \itemmax=\itemindent %
585: \advance \itemmax by -\itemmargin %
586: \advance \leftskip by \itemindent %
587: \parindent = 0pt
588: \parskip = \smallskipamount
589: \ifdim \parskip=0pt \parskip=2pt \fi%
590: \def#2{\endgraf\endgroup\afterenvbreak}%
591: \def\itemcontents{#1}%
592: \let\item=\itemizeitem}
593:
594: \let\ptexbullet=\bullet
595: \def\bullet{$\ptexbullet$}
596:
597: \def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
598:
599: % Definition of @item while inside @itemize.
600:
601: \def\itemizeitem{%
602: \advance\itemno by 1
603: {\let\par=\endgraf \smallbreak}%
604: \ifhmode \errmessage{\in hmode at itemizeitem}\fi
605: {\parskip=0in \hskip 0pt
606: \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
607: \vadjust{\penalty 300}}%
608: \flushcr}
609:
610: \message{figures,} % Floating insertions, basically
611: \newcount\figno \figno=0
612: \def\basicaption{\parsearg\captionx}
613: \def\captionx #1{\global\advance\figno by 1%
614: \par{\textfonts\line{\hfil{\bf Figure \the\figno .} #1\hfil}}}
615: \def\filcaption{\vfil\basicaption}
616: \def\iEfigure{\smallskip\hrule\endinsert}
617: \def\fullpagefigure{%
618: \pageinsert\inENV\let\caption=\filcaption\let\Efullpagefigure=\iEfigure\hrule\smallskip}
619: \def\figure{% This tries to be near where the command was
620: \midinsert\inENV\let\caption=\basicaption\let\Efigure=\iEfigure\hrule\smallskip}
621: \def\topfigure{% This tries to be near the top of a page
622: \topinsert\inENV\let\caption=\basicaption\let\Etopfigure=\iEfigure\hrule\smallskip}
623:
624: \message{footnotes,}% Footnotes
625:
626: \newcount \footnoteno
627:
628: \def\supereject{\par\penalty -20000\footnoteno =0 }
629:
630: \let\ptexfootnote=\footnote
631:
632: {\catcode `\@=11
633: \gdef\footnote{\global\advance \footnoteno by \@ne
634: \edef\thisfootno{$^{\the\footnoteno}$}%
635: \let\@sf\empty
636: \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
637: \thisfootno\@sf\parsearg\footnotezzz}
638:
639: \gdef\footnotezzz #1{\insert\footins{
640: \interlinepenalty\interfootnotelinepenalty
641: \splittopskip\ht\strutbox % top baseline for broken footnotes
642: \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
643: \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
644: \footstrut\hang\textindent{\thisfootno}#1\strut}}
645:
646: } %end \catcode `\@=11
647:
648: \message{indexing,}
649: % Index generation facilities
650:
651: % Define \newwrite to be identical to plain tex's \newwrite
652: % except not \outer, so it can be used within \newindex.
653: {\catcode`\@=11
654: \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
655:
656: % \newindex {foo} defines an index named foo.
657: % It automatically defines \fooindex such that
658: % \fooindex ...rest of line... puts an entry in the index foo.
659: % It also defines \fooindfile to be the number of the output channel for
660: % the file that accumulates this index. The file's extension is foo.
661: % The name of an index should be no more than 2 characters long
662: % for the sake of vms.
663:
664: \def\newindex #1{
665: \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
666: \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
667: \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
668: \noexpand\doindex {#1}}
669: }
670:
671: % @defindex foo == \newindex{foo}
672:
673: \def\defindex{\parsearg\newindex}
674:
675: % @synindex foo bar makes index foo feed into index bar.
676: % Do this instead of @defindex foo if you don't want it as a separate index.
677: \def\synindex #1 #2 {%
678: \expandafter \xdef \csname#1index\endcsname {\noexpand\csname#2index\endcsname}%
679: \expandafter \chardef \csname#1indfile\endcsname %
680: = \csname#2indfile\endcsname}
681:
682: % Define \doindex, the driver for all \fooindex macros.
683: % Argument #1 is generated by the calling \fooindex macro,
684: % and it is "foo", the name of the index.
685:
686: % \doindex just uses \parsearg; it calls \doind for the actual work.
687: % This is because \doind is more useful to call from other macros.
688:
689: % There is also \dosubind {index}{topic}{subtopic}
690: % which makes an entry in a two-level index such as the operation index.
691:
692: \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
693: \def\singleindexer #1{\doind{\indexname}{#1}}
694:
695: \def\indexdummies{%
696: \def\bf{\realbackslash bf }%
697: \def\rm{\realbackslash rm }%
698: \def\sl{\realbackslash sl }%
699: }
700:
701: % To define \realbackslash, we must make \ not be an escape.
702: % We must first make another character (@) an escape
703: % so we do not become unable to do a definition.
704:
705: {\catcode`\@=0 \catcode`\\=\other
706: @gdef@realbackslash{\}}
707:
708: \let\indexbackslash=0 %overridden during \printindex.
709:
710: \def\doind #1#2{%
711: {\indexdummies % Must do this here, since \bf, etc expand at this stage
712: \count10=\lastpenalty %
713: {\let\folio=0% Expand all macros now EXCEPT \folio
714: \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
715: % so it will be output as is; and it will print as backslash in the indx.
716: \edef\temp{%
717: \write \csname#1indfile\endcsname{%
718: \realbackslash entry {#2}{\folio}{#2}}}%
719: \temp }%
720: \penalty\count10}}
721:
722: \def\dosubind #1#2#3{%
723: {\indexdummies % Must do this here, since \bf, etc expand at this stage
724: \count10=\lastpenalty %
725: {\let\folio=0%
726: \def\rawbackslashxx{\indexbackslash}%
727: \edef\temp{%
728: \write \csname#1indfile\endcsname{%
729: \realbackslash entry {#2 #3}{\folio}{#2}{#3}}}%
730: \temp }%
731: \penalty\count10}}
732:
733: % The index entry written in the file actually looks like
734: % \entry {sortstring}{page}{topic}
735: % or
736: % \entry {sortstring}{page}{topic}{subtopic}
737: % The texindex program reads in these files and writes files
738: % containing these kinds of lines:
739: % \initial {c}
740: % before the first topic whose initial is c
741: % \entry {topic}{pagelist}
742: % for a topic that is used without subtopics
743: % \primary {topic}
744: % for the beginning of a topic that is used with subtopics
745: % \secondary {subtopic}{pagelist}
746: % for each subtopic.
747:
748: % Define the user-accessible indexing commands
749: % @findex, @vindex, @kindex, @cindex.
750:
751: \def\findex {\fnindex}
752: \def\kindex {\kyindex}
753: \def\cindex {\cpindex}
754: \def\vindex {\vrindex}
755: \def\tindex {\tpindex}
756: \def\pindex {\pgindex}
757:
758: \def\cindexsub {\begingroup\obeylines\cindexsub}
759: {\obeylines %
760: \gdef\cindexsub "#1" #2^^M{\endgroup %
761: \dosubind{cp}{#2}{#1}}}
762:
763: % Define the macros used in formatting output of the sorted index material.
764:
765: % This is what you call to cause a particular index to get printed.
766: % Write
767: % @unnumbered Function Index
768: % @printindex fn
769:
770: \def\printindex{\parsearg\doprintindex}
771:
772: \def\doprintindex#1{\tex %
773: \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
774: \catcode`\@=\other\catcode`\$=\other\catcode`\_=\other
775: \catcode`\~=\other
776: \def\indexbackslash{\rawbackslashxx}
777: \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
778: \begindoublecolumns
779: \openin 1 \jobname.#1s
780: \ifeof 1 \else \closein 1 \input \jobname.#1s
781: \fi
782: \enddoublecolumns
783: \Etex}
784:
785: % These macros are used by the sorted index file itself.
786: % Change them to control the appearance of the index.
787:
788: \outer\def\initial #1{\bigbreak\line{\secbf#1\hfill}\kern 2pt\penalty3000}
789:
790: \outer\def\entry #1#2{
791: {\parfillskip=0in \parskip=0in \parindent=0in
792: \hangindent=1in \hangafter=1%
793: \noindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll #2\par
794: }}
795:
796: \def\primary #1{\line{#1\hfil}}
797:
798: \newskip\secondaryindent \secondaryindent=0.5cm
799:
800: \def\secondary #1#2{
801: {\parfillskip=0in \parskip=0in
802: \hangindent =1in \hangafter=1
803: \noindent\hskip\secondaryindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll#2\par
804: }}
805:
806: %% Define two-column mode, which is used in indexes.
807: %% Adapted from the TeXBook, page 416
808: \catcode `\@=11
809:
810: \newbox\partialpage
811:
812: \newdimen\doublecolumnhsize \doublecolumnhsize = 3.11in
813: \newdimen\doublecolumnvsize \doublecolumnvsize = 19.1in
814:
815: \def\begindoublecolumns{\begingroup
816: \output={\global\setbox\partialpage=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
817: \output={\doublecolumnout} \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
818: \def\enddoublecolumns{\output={\balancecolumns}\eject
819: \endgroup \pagegoal=\vsize}
820:
821: \def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
822: \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
823: \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
824: \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
825: \def\pagesofar{\unvbox\partialpage %
826: \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
827: \def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0
828: \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
829: \divide\dimen@ by2 \splittopskip=\topskip
830: {\vbadness=10000 \loop \global\setbox3=\copy0
831: \global\setbox1=\vsplit3 to\dimen@
832: \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
833: \setbox0=\vbox to\dimen@{\unvbox1} \setbox2=\vbox to\dimen@{\unvbox3}
834: \pagesofar}
835:
836: \catcode `\@=\other
837: \message{sectioning,}
838: % Define chapters, sections, etc.
839:
840: \newcount \chapno
841: \newcount \secno
842: \newcount \subsecno
843: \newcount \subsubsecno
844:
845: % This counter is funny since it counts through charcodes of letters A, B, ...
846: \newcount \appendixno \appendixno = `\@
847: \def\appendixletter{\char\the\appendixno}
848:
849: \newwrite \contentsfile
850: \openout \contentsfile = \jobname.toc
851:
852: % Each @chapter defines this as the name of the chapter.
853: % page headings and footings can use it. @section does likewise
854:
855: \def\thischapter{} \def\thissection{}
856: \def\seccheck#1{\if \pageno<0 %
857: \errmessage{@#1 not allowed after generating table of contents}\fi
858: %
859: }
860:
861: \outer\def\chapter{\parsearg\chapterzzz}
862: \def\chapterzzz #1{\seccheck{chapter}%
863: \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
864: \chapmacro {#1}{\the\chapno}%
865: \gdef\thissection{#1}\gdef\thischapter{#1}%
866: \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
867: \write \contentsfile \temp %
868: \donoderef %
869: }
870:
871: \outer\def\appendix{\parsearg\appendixzzz}
872: \def\appendixzzz #1{\seccheck{appendix}%
873: \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
874: \chapmacro {#1}{Appendix \appendixletter}%
875: \gdef\thischapter{#1}\gdef\thissection{#1}%
876: \edef\temp{{\realbackslash chapentry {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
877: \write \contentsfile \temp %
878: \donoderef %
879: }
880:
881: \outer\def\unnumbered{\parsearg\unnumberedzzz}
882: \def\unnumberedzzz #1{\seccheck{unnumbered}%
883: \secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
884: \unnumbchapmacro {#1}%
885: \gdef\thischapter{#1}\gdef\thissection{#1}%
886: \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
887: \write \contentsfile \temp %
888: \donoderef %
889: }
890:
891: \outer\def\section{\parsearg\sectionzzz}
892: \def\sectionzzz #1{\seccheck{section}%
893: \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
894: \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
895: \edef\temp{{\realbackslash secentry %
896: {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
897: \write \contentsfile \temp %
898: \donoderef %
899: \penalty 10000 %
900: }
901:
902: \outer\def\appendixsection{\parsearg\appendixsectionzzz}
903: \def\appendixsectionzzz #1{\seccheck{appendixsection}%
904: \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
905: \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
906: \edef\temp{{\realbackslash secentry %
907: {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
908: \write \contentsfile \temp %
909: \donoderef %
910: \penalty 10000 %
911: }
912:
913: \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
914: \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
915: \plainsecheading {#1}\gdef\thissection{#1}%
916: \edef\temp{{\realbackslash unnumbsecentry %
917: {#1}{\noexpand\folio}}}%
918: \write \contentsfile \temp %
919: \donoderef %
920: \penalty 10000 %
921: }
922:
923: \outer\def\subsection{\parsearg\subsectionzzz}
924: \def\subsectionzzz #1{\seccheck{subsection}%
925: \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
926: \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
927: \edef\temp{{\realbackslash subsecentry %
928: {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
929: \write \contentsfile \temp %
930: \donoderef %
931: \penalty 10000 %
932: }
933:
934: \outer\def\subsubsection{\parsearg\subsubsectionzzz}
935: \def\subsubsectionzzz #1{\seccheck{subsubsection}%
936: \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
937: \subsubsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
938: \edef\temp{{\realbackslash subsubsecentry %
939: {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
940: \write \contentsfile \temp %
941: \donoderef %
942: \penalty 10000 %
943: }
944:
945: % Define @majorheading, @heading and @subheading
946:
947: \outer\def\majorheading #1{%
948: {\advance\chapheadingskip by 10pt \chapbreak }%
949: {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200}
950:
951: \outer\def\heading #1{\chapbreak %
952: {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200}
953:
954: \let\subheading=\secheadingi
955: \let\subsubheading=\subsecheadingi
956:
957: % These macros generate a chapter, section, etc. heading only
958: % (including whitespace, linebreaking, etc. around it),
959: % given all the information in convenient, parsed form.
960:
961: %%% Args are the skip and penalty (usually negative)
962: \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
963:
964: \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
965:
966: %%% Define plain chapter starts, and page on/off switching for it
967: % Parameter controlling skip before chapter headings (if needed)
968:
969: \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
970:
971: \def\chapbreak{\dobreak \chapheadingskip {-4000}}
972: \def\chappager{\par\vfill\supereject}
973: \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
974:
975: \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
976: \def\CHAPPAGoff{\global\let\pchapsepmacro=\chapbreak}
977: \def\CHAPPAGon{\global\let\pchapsepmacro=\chappager}
978: \def\CHAPPAGodd{\global\let\pchapsepmacro=\chapoddpage}
979: \CHAPPAGon
980:
981: \def\CHAPFplain{
982: \global\let\chapmacro=\chfplain
983: \global\let\unnumbchapmacro=\unnchfplain}
984:
985: \def\chfplain #1#2{%
986: \pchapsepmacro %
987: {\chapfonts \line{\chaprm #2.\enspace #1\hfill}}\bigskip \par\penalty 5000 %
988: }
989:
990: \def\unnchfplain #1{%
991: \pchapsepmacro %
992: {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 %
993: }
994: \CHAPFplain % The default
995:
996: \def\unnchfopen #1{%
997: \chapoddpage {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 %
998: }
999:
1000: \def\chfopen #1#2{\chapoddpage {\chapfonts
1001: \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
1002: \par\penalty 5000 %
1003: }
1004:
1005: \def\CHAPFopen{
1006: \global\let\chapmacro=\chfopen
1007: \global\let\unnumbchapmacro=\unnchfopen}
1008:
1009: % Parameter controlling skip before section headings.
1010:
1011: \newskip \subsecheadingskip \subsecheadingskip = 17pt plus 8pt minus 4pt
1012: \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
1013:
1014: \newskip \secheadingskip \secheadingskip = 21pt plus 8pt minus 4pt
1015: \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
1016:
1017: \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
1018: \def\plainsecheading #1{\secheadingi {#1}}
1019: \def\secheadingi #1{{\advance \secheadingskip by \parskip %
1020: \secheadingbreak}%
1021: {\secfonts \line{\secrm #1\hfill}}%
1022: \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
1023:
1024: \def\subsecheading #1#2#3#4{{\advance \subsecheadingskip by \parskip %
1025: \subsecheadingbreak}%
1026: {\subsecfonts \line{\secrm#2.#3.#4\enspace #1\hfill}}%
1027: \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
1028:
1029: \def\subsubsecfonts{\subsecfonts} % Maybe this should change
1030:
1031: \def\subsubsecheading #1#2#3#4#5{{\advance \subsecheadingskip by \parskip %
1032: \subsecheadingbreak}%
1033: {\subsubsecfonts \line{\secrm#2.#3.#4.#5\enspace #1\hfill}}%
1034: \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
1035:
1036: \message{toc printing,}
1037:
1038: \def\Dotsbox{\hbox to 1em{\hss.\hss}} % Used by index macros
1039:
1040: \def\finishcontents{%
1041: \ifnum\pageno>0 %
1042: \par\vfill\supereject %
1043: \immediate\closeout \contentsfile%
1044: \pageno=-1 % Request roman numbered pages
1045: \fi}
1046:
1047: \outer\def\contents{%
1048: \finishcontents %
1049: \unnumbchapmacro{Table of Contents}
1050: \def\thischapter{Table of Contents}
1051: {\catcode`\\=0
1052: \catcode`\{=1 % Set up to handle contents files properly
1053: \catcode`\}=2
1054: \catcode`\@=11
1055: \input \jobname.toc
1056: }
1057: \vfill \eject}
1058:
1059: \outer\def\summarycontents{%
1060: \finishcontents %
1061: \unnumbchapmacro{Summary Table of Contents}
1062: \def\thischapter{Summary Table of Contents}
1063: {\catcode`\\=0
1064: \catcode`\{=1 % Set up to handle contents files properly
1065: \catcode`\}=2
1066: \catcode`\@=11
1067: \def\smallbreak{}
1068: \def\secentry ##1##2##3##4{}
1069: \def\subsecentry ##1##2##3##4##5{}
1070: \def\subsubsecentry ##1##2##3##4##5##6{}
1071: \def\unnumbsecentry ##1##2{}
1072: \let\medbreak=\smallbreak
1073: \input \jobname.toc
1074: }
1075: \vfill \eject}
1076:
1077: \outer\def\bye{\par\vfill\supereject\tracingstats=1\ptexend}
1078:
1079: % These macros generate individual entries in the table of contents
1080: % The first argument is the chapter or section name.
1081: % The last argument is the page number.
1082: % The arguments in between are the chapter number, section number, ...
1083:
1084: \def\chapentry #1#2#3{%
1085: \medbreak
1086: \line{#2.\space#1\leaders\hbox to 1em{\hss.\hss}\hfill #3}
1087: }
1088:
1089: \def\unnumbchapentry #1#2{%
1090: \medbreak
1091: \line{#1\leaders\Dotsbox\hfill #2}
1092: }
1093:
1094: \def\secentry #1#2#3#4{%
1095: \line{\enspace\enspace#2.#3\space#1\leaders\Dotsbox\hfill#4}
1096: }
1097:
1098: \def\unnumbsecentry #1#2{%
1099: \line{\enspace\enspace#1\leaders\Dotsbox\hfill #2}
1100: }
1101:
1102: \def\subsecentry #1#2#3#4#5{%
1103: \line{\enspace\enspace\enspace\enspace
1104: #2.#3.#4\space#1\leaders\Dotsbox\hfill #5}
1105: }
1106:
1107: \def\subsubsecentry #1#2#3#4#5#6{%
1108: \line{\enspace\enspace\enspace\enspace\enspace\enspace
1109: #2.#3.#4.#5\space#1\leaders\Dotsbox\hfill #6}
1110: }
1111:
1112: \message{environments,}
1113:
1114: % @tex ... @end tex escapes into raw Tex temporarily.
1115:
1116: \def\tex{\begingroup
1117: \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
1118: \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
1119: \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
1120: \let\{=\lbrace \let\}=\rbrace
1121: \let\nobreak=\ptexnobreak
1122: \let\.=\ptexdot
1123: \let\#=\ptexnumsign
1124: \let\*=\ptexstar
1125: \let\+=\tabalign
1126: \let\-=\ptexminus
1127: \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
1128: \let\L=\ptexL
1129: \catcode `\%=14 \let\Etex=\endgroup}
1130:
1131: % Define @lisp ... @endlisp.
1132: % @lisp does a \begingroup so it can rebind things,
1133: % including the definition of @endlisp (which normally is erroneous).
1134:
1135: % Amount to narrow the margins by for @lisp.
1136: \newskip\lispnarrowing \lispnarrowing=0.3in
1137:
1138: % This is the definition that ^M gets inside @lisp
1139: % phr: changed space to \null, to avoid overfull hbox problems.
1140: {\obeyspaces%
1141: \gdef\lisppar{\null\endgraf}}
1142:
1143: % Cause \obeyspaces to make each Space cause a word-separation
1144: % rather than the default which is that it acts punctuation.
1145: % This is because space in tt font looks funny.
1146: {\obeyspaces %
1147: \gdef\sepspaces{\def {\ }}}
1148:
1149: \newskip\aboveenvskipamount \aboveenvskipamount=3pt plus 10pt
1150: \def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
1151: \endgraf \ifdim\lastskip<\aboveenvskipamount
1152: \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
1153:
1154: \def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
1155: \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
1156:
1157: \def\lisp{\aboveenvbreak\begingroup\inENV %This group ends at the end of the @lisp body
1158: \hfuzz=12truept % Don't be fussy
1159: % Make spaces be word-separators rather than space tokens.
1160: \sepspaces %
1161: % Single space lines
1162: \singlespace %
1163: % The following causes blank lines not to be ignored
1164: % by adding a space to the end of each line.
1165: \let\par=\lisppar
1166: \def\Elisp{\endgroup\afterenvbreak}%
1167: \parskip=0pt \advance \rightskip by \lispnarrowing
1168: \advance \leftskip by \lispnarrowing
1169: \parindent=0pt
1170: \let\exdent=\internalexdent
1171: \obeyspaces \obeylines \tt \rawbackslash
1172: \def\next##1{}\next}
1173:
1174:
1175: \let\example=\lisp
1176: \def\Eexample{\Elisp}
1177:
1178: \let\smallexample=\lisp
1179: \def\Esmallexample{\Elisp}
1180:
1181: % Macro for 9 pt. examples, necessary to print with 5" lines.
1182: % From Pavel@xerox. This is not really used unless the
1183: % @smallbook command is given.
1184:
1185: \def\smalllispx{\aboveenvbreak\begingroup\inENV
1186: % This group ends at the end of the @lisp body
1187: \hfuzz=12truept % Don't be fussy
1188: % Make spaces be word-separators rather than space tokens.
1189: \sepspaces %
1190: % Single space lines
1191: \singlespace %
1192: % The following causes blank lines not to be ignored
1193: % by adding a space to the end of each line.
1194: \let\par=\lisppar
1195: \def\Esmalllisp{\endgroup\afterenvbreak}%
1196: \parskip=0pt \advance \rightskip by \lispnarrowing
1197: \advance \leftskip by \lispnarrowing
1198: \parindent=0pt
1199: \let\exdent=\internalexdent
1200: \obeyspaces \obeylines \ninett \rawbackslash
1201: \def\next##1{}\next}
1202:
1203: % This is @display; same as @lisp except use roman font.
1204:
1205: \def\display{\begingroup\inENV %This group ends at the end of the @display body
1206: \aboveenvbreak
1207: % Make spaces be word-separators rather than space tokens.
1208: \sepspaces %
1209: % Single space lines
1210: \singlespace %
1211: % The following causes blank lines not to be ignored
1212: % by adding a space to the end of each line.
1213: \let\par=\lisppar
1214: \def\Edisplay{\endgroup\afterenvbreak}%
1215: \parskip=0pt \advance \rightskip by \lispnarrowing
1216: \advance \leftskip by \lispnarrowing
1217: \parindent=0pt
1218: \let\exdent=\internalexdent
1219: \obeyspaces \obeylines
1220: \def\next##1{}\next}
1221:
1222: % This is @format; same as @lisp except use roman font and don't narrow margins
1223:
1224: \def\format{\begingroup\inENV %This group ends at the end of the @format body
1225: \aboveenvbreak
1226: % Make spaces be word-separators rather than space tokens.
1227: \sepspaces %
1228: \singlespace %
1229: % The following causes blank lines not to be ignored
1230: % by adding a space to the end of each line.
1231: \let\par=\lisppar
1232: \def\Eformat{\endgroup\afterenvbreak}
1233: \parskip=0pt \parindent=0pt
1234: \obeyspaces \obeylines
1235: \def\next##1{}\next}
1236:
1237: % @flushleft and @flushright
1238:
1239: \def\flushleft{\begingroup\inENV %This group ends at the end of the @format body
1240: \aboveenvbreak
1241: % Make spaces be word-separators rather than space tokens.
1242: \sepspaces %
1243: % The following causes blank lines not to be ignored
1244: % by adding a space to the end of each line.
1245: % This also causes @ to work when the directive name
1246: % is terminated by end of line.
1247: \let\par=\lisppar
1248: \def\Eflushleft{\endgroup\afterenvbreak}%
1249: \parskip=0pt \parindent=0pt
1250: \obeyspaces \obeylines
1251: \def\next##1{}\next}
1252:
1253: \def\flushright{\begingroup\inENV %This group ends at the end of the @format body
1254: \aboveenvbreak
1255: % Make spaces be word-separators rather than space tokens.
1256: \sepspaces %
1257: % The following causes blank lines not to be ignored
1258: % by adding a space to the end of each line.
1259: % This also causes @ to work when the directive name
1260: % is terminated by end of line.
1261: \let\par=\lisppar
1262: \def\Eflushright{\endgroup\afterenvbreak}%
1263: \parskip=0pt \parindent=0pt
1264: \advance \leftskip by 0pt plus 1fill
1265: \obeyspaces \obeylines
1266: \def\next##1{}\next}
1267:
1268: % @quotation - narrow the margins.
1269:
1270: \def\quotation{\begingroup\inENV %This group ends at the end of the @quotation body
1271: {\parskip=0pt % because we will skip by \parskip too, later
1272: \aboveenvbreak}%
1273: \singlespace
1274: \parindent=0pt
1275: \def\Equotation{\par\endgroup\afterenvbreak}%
1276: \advance \rightskip by \lispnarrowing
1277: \advance \leftskip by \lispnarrowing}
1278:
1279: % @undent - make every paragraph have a hanging indentation
1280:
1281: \def\undent{\begingroup %This group ends at the end of the @undent body
1282: \def\Eundent{\par\endgroup}%
1283: \everypar={\hangindent=\parindent \hskip-\parindent \hangafter=1 }}
1284:
1285: \message{cross reference,}
1286: % Define cross-reference macros
1287: \newwrite \auxfile
1288:
1289: % \setref{foo} defines a cross-reference point named foo.
1290:
1291: \def\setref#1{%
1292: \dosetq{#1-pg}{Ypagenumber}%
1293: \dosetq{#1-snt}{Ysectionnumberandtype}}
1294:
1295: % \xref and \pxref generate cross references to specified points.
1296:
1297: \def\pxref #1{see \xrefX [#1,,,,,,,]}
1298: \def\xref #1{See \xrefX [#1,,,,,,,]}
1299: \def\xrefX [#1,#2,#3,#4,#5,#6]{\refx{#1-snt} [%
1300: {\setbox0=\hbox{\losespace#3{}}%
1301: \ifdim \wd0 =0pt \losespace#1{}\else\unhbox0\fi}],
1302: page\tie \refx{#1-pg}}
1303:
1304: % \dosetq is the interface for calls from other macros
1305:
1306: \def\dosetq #1#2{{\let\folio=0%
1307: \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
1308: \next}}
1309:
1310: % \internalsetq {foo}{page} expands into CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
1311: % When the aux file is read, ' is the escape character
1312:
1313: \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
1314:
1315: % Things to be expanded by \internalsetq
1316:
1317: \def\Ypagenumber{\folio}
1318:
1319: \def\Ysectionnumberandtype{%
1320: \ifnum\secno=0 chapter\xreftie\the\chapno %
1321: \else \ifnum \subsecno=0 section\xreftie\the\chapno.\the\secno %
1322: \else \ifnum \subsubsecno=0 %
1323: section\xreftie\the\chapno.\the\secno.\the\subsecno %
1324: \else %
1325: section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
1326: \fi \fi \fi }
1327:
1328: \gdef\xreftie{'tie}
1329:
1330: % Define @refx to reference a specific cross-reference string.
1331:
1332: \def\refx#1{%
1333: {%
1334: \setbox0=\hbox{\csname X#1\endcsname}%
1335: \ifdim\wd0>0in \else % If not defined, say something at least.
1336: \expandafter\gdef\csname X#1\endcsname {$<$undefined$>$}%
1337: \message {WARNING: Cross-reference "#1" used but not yet defined}%
1338: \message {}%
1339: \fi %
1340: \csname X#1\endcsname %It's defined, so just use it.
1341: }}
1342:
1343: % Read the last existing aux file, if any. No error if none exists.
1344:
1345: % This is the macro invoked by entries in the aux file.
1346: \def\xrdef #1#2{
1347: {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
1348:
1349: {
1350: \catcode `\^^@=\other
1351: \catcode `\&=\other
1352: \catcode `\=\other
1353: \catcode `\^^C=\other
1354: \catcode `\^^D=\other
1355: \catcode `\^^E=\other
1356: \catcode `\^^F=\other
1357: \catcode `\^^G=\other
1358: \catcode `\^^H=\other
1359: \catcode `\=\other
1360: \catcode `\^^L=\other
1361: \catcode `\=\other
1362: \catcode `\=\other
1363: \catcode `\=\other
1364: \catcode `\=\other
1365: \catcode `\=\other
1366: \catcode `\=\other
1367: \catcode `\=\other
1368: \catcode `\=\other
1369: \catcode `\=\other
1370: \catcode `\=\other
1371: \catcode `\=\other
1372: \catcode `\=\other
1373: \catcode `\=\other
1374: \catcode `\^^[=\other
1375: \catcode `\^^\=\other
1376: \catcode `\^^]=\other
1377: \catcode `\^^^=\other
1378: \catcode `\^^_=\other
1379: \catcode `\@=\other
1380: \catcode `\^=\other
1381: \catcode `\~=\other
1382: \catcode `\[=\other
1383: \catcode `\]=\other
1384: \catcode`\"=\other
1385: \catcode`\_=\other
1386: \catcode`\|=\other
1387: \catcode`\<=\other
1388: \catcode`\>=\other
1389: \catcode `\$=\other
1390: \catcode `\#=\other
1391: \catcode `\&=\other
1392:
1393: % the aux file uses ' as the escape.
1394: % Turn off \ as an escape so we do not lose on
1395: % entries which were dumped with control sequences in their names.
1396: % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
1397: % Reference to such entries still does not work the way one would wish,
1398: % but at least they do not bomb out when the aux file is read in.
1399:
1400: \catcode `\{=1 \catcode `\}=2
1401: \catcode `\%=\other
1402: \catcode `\'=0
1403: \catcode `\\=\other
1404:
1405: 'openin 1 'jobname.aux
1406: 'ifeof 1 'else 'closein 1 'input 'jobname.aux
1407: 'fi
1408: }
1409:
1410: % Open the new aux file. Tex will close it automatically at exit.
1411:
1412: \openout \auxfile=\jobname.aux
1413:
1414: % End of control word definitions.
1415:
1416: \message{and turning on texinfo input format.}
1417:
1418: \newindex{cp}
1419: \newindex{fn}
1420: \newindex{vr}
1421: \newindex{tp}
1422: \newindex{ky}
1423: \newindex{pg}
1424:
1425: % Set some numeric style parameters, for 8.5 x 11 format.
1426:
1427: \hsize = 6.5in
1428: \parindent 15pt
1429: \parskip 18pt plus 1pt
1430: \aboveenvskipamount 0pt plus 3pt
1431: \baselineskip 15pt
1432: \itemindent = 0.3in
1433: \tableindent = 0.8in
1434: \lispnarrowing = 0.4in
1435:
1436: % Use @smallbook to reset parameters for 7x9.5 format
1437: \def\smallbook{
1438: \global\lispnarrowing = 0.3in
1439: \global\baselineskip 12pt
1440: \global\parskip 3pt plus 1pt
1441: \global\hsize = 5in
1442: \global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
1443: \global\vsize=7.5in
1444: \global\tolerance=700
1445: \global\hfuzz=1pt
1446:
1447: \global\font\ninett=amtt9
1448:
1449: \global\let\smalllisp=\smalllispx
1450: \global\let\smallexample=\smalllispx
1451: \global\def\Esmallexample{\Esmalllisp}
1452: }
1453:
1454: %% For a final copy, take out the rectangles
1455: %% that mark overfull boxes (in case you have decided
1456: %% that the text looks ok even though it passes the margin).
1457: \def\finalout{\overfullrule=0pt}
1458:
1459: % Turn off all special characters except @
1460: % (and those which the user can use as if they were ordinary)
1461: % Define certain chars to be always in tt font.
1462:
1463: \catcode`\"=\active
1464: \def\activedoublequote{{\tt \char '042}}
1465: \let"=\activedoublequote
1466: \catcode`\~=\active
1467: \def~{{\tt \char '176}}
1468: \chardef\hat=`\^
1469: \catcode`\^=\active
1470: \def^{{\tt \hat}}
1471: \catcode`\_=\active
1472: \def_{{\tt \char '137}}
1473: \catcode`\|=\active
1474: \def|{{\tt \char '174}}
1475: \chardef \less=`\<
1476: \catcode`\<=\active
1477: \def<{{\tt \less}}
1478: \chardef \gtr=`\>
1479: \catcode`\>=\active
1480: \def>{{\tt \gtr}}
1481:
1482: \catcode`\@=0
1483:
1484: % \rawbackslashxx output one backslash character in current font
1485: {\catcode`\\=\other
1486: @gdef@rawbackslashxx{\}}
1487:
1488: % \rawbackslash redefines \ as input to do \rawbackslashxx.
1489: {\catcode`\\=\active
1490: @gdef@rawbackslash{@let\=@rawbackslashxx }}
1491:
1492: % \normalbackslash outputs one backslash in fixed width font.
1493: \def\normalbackslash{{\tt\rawbackslashxx}}
1494:
1495: %% These look ok in all fonts, so just make them not special. The @rm below
1496: %% makes sure that the current font starts out as the newly loaded cmr10
1497: \catcode`\$=\other \catcode`\%=\other \catcode`\&=\other \catcode`\#=\other
1498:
1499: \catcode 17=0 @c Define control-q
1500: \catcode`\\=\active
1501: @let\=@normalbackslash
1502:
1503: @textfonts
1504: @rm
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.