xref: /freebsd/crypto/krb5/src/util/et/texinfo.tex (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert%% TeX macros to handle texinfo files
2*7f2fe78bSCy Schubert
3*7f2fe78bSCy Schubert%   Copyright (C) 1985, 1986, 1988 Richard M. Stallman
4*7f2fe78bSCy Schubert
5*7f2fe78bSCy Schubert%		       NO WARRANTY
6*7f2fe78bSCy Schubert
7*7f2fe78bSCy Schubert%  BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
8*7f2fe78bSCy Schubert%NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
9*7f2fe78bSCy Schubert%WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
10*7f2fe78bSCy Schubert%RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
11*7f2fe78bSCy Schubert%WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
12*7f2fe78bSCy Schubert%BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
13*7f2fe78bSCy Schubert%FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
14*7f2fe78bSCy Schubert%AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
15*7f2fe78bSCy Schubert%DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
16*7f2fe78bSCy Schubert%CORRECTION.
17*7f2fe78bSCy Schubert
18*7f2fe78bSCy Schubert% IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
19*7f2fe78bSCy Schubert%STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
20*7f2fe78bSCy Schubert%WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
21*7f2fe78bSCy Schubert%LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
22*7f2fe78bSCy Schubert%OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
23*7f2fe78bSCy Schubert%USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
24*7f2fe78bSCy Schubert%DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
25*7f2fe78bSCy Schubert%A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
26*7f2fe78bSCy Schubert%PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
27*7f2fe78bSCy Schubert%DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
28*7f2fe78bSCy Schubert
29*7f2fe78bSCy Schubert%		GENERAL PUBLIC LICENSE TO COPY
30*7f2fe78bSCy Schubert
31*7f2fe78bSCy Schubert%  1. You may copy and distribute verbatim copies of this source file
32*7f2fe78bSCy Schubert%as you receive it, in any medium, provided that you conspicuously
33*7f2fe78bSCy Schubert%and appropriately publish on each copy a valid copyright notice
34*7f2fe78bSCy Schubert%"Copyright (C) 1986 Richard M. Stallman"; and include
35*7f2fe78bSCy Schubert%following the copyright notice a verbatim copy of the above disclaimer
36*7f2fe78bSCy Schubert%of warranty and of this License.
37*7f2fe78bSCy Schubert
38*7f2fe78bSCy Schubert%  2. You may modify your copy or copies of this source file or
39*7f2fe78bSCy Schubert%any portion of it, and copy and distribute such modifications under
40*7f2fe78bSCy Schubert%the terms of Paragraph 1 above, provided that you also do the following:
41*7f2fe78bSCy Schubert
42*7f2fe78bSCy Schubert%    a) cause the modified files to carry prominent notices stating
43*7f2fe78bSCy Schubert%    that you changed the files and the date of any change; and
44*7f2fe78bSCy Schubert
45*7f2fe78bSCy Schubert%    b) cause the whole of any work that you distribute or publish,
46*7f2fe78bSCy Schubert%    that in whole or in part contains or is a derivative of this
47*7f2fe78bSCy Schubert%    program or any part thereof, to be licensed at no charge to all
48*7f2fe78bSCy Schubert%    third parties on terms identical to those contained in this
49*7f2fe78bSCy Schubert%    License Agreement (except that you may choose to grant more extensive
50*7f2fe78bSCy Schubert%    warranty protection to some or all third parties, at your option).
51*7f2fe78bSCy Schubert
52*7f2fe78bSCy Schubert%    c) You may charge a distribution fee for the physical act of
53*7f2fe78bSCy Schubert%    transferring a copy, and you may at your option offer warranty
54*7f2fe78bSCy Schubert%    protection in exchange for a fee.
55*7f2fe78bSCy Schubert
56*7f2fe78bSCy Schubert%Mere aggregation of another unrelated program with this program (or its
57*7f2fe78bSCy Schubert%derivative) on a volume of a storage or distribution medium does not bring
58*7f2fe78bSCy Schubert%the other program under the scope of these terms.
59*7f2fe78bSCy Schubert
60*7f2fe78bSCy Schubert%  3. You may copy and distribute this program (or a portion or derivative
61*7f2fe78bSCy Schubert%of it, under Paragraph 2) in object code or executable form under the terms
62*7f2fe78bSCy Schubert%of Paragraphs 1 and 2 above provided that you also do one of the following:
63*7f2fe78bSCy Schubert
64*7f2fe78bSCy Schubert%    a) accompany it with the complete corresponding machine-readable
65*7f2fe78bSCy Schubert%    source code, which must be distributed under the terms of
66*7f2fe78bSCy Schubert%    Paragraphs 1 and 2 above; or,
67*7f2fe78bSCy Schubert
68*7f2fe78bSCy Schubert%    b) accompany it with a written offer, valid for at least three
69*7f2fe78bSCy Schubert%    years, to give any third party free (except for a nominal
70*7f2fe78bSCy Schubert%    shipping charge) a complete machine-readable copy of the
71*7f2fe78bSCy Schubert%    corresponding source code, to be distributed under the terms of
72*7f2fe78bSCy Schubert%    Paragraphs 1 and 2 above; or,
73*7f2fe78bSCy Schubert
74*7f2fe78bSCy Schubert%    c) accompany it with the information you received as to where the
75*7f2fe78bSCy Schubert%    corresponding source code may be obtained.  (This alternative is
76*7f2fe78bSCy Schubert%    allowed only for noncommercial distribution and only if you
77*7f2fe78bSCy Schubert%    received the program in object code or executable form alone.)
78*7f2fe78bSCy Schubert
79*7f2fe78bSCy Schubert%For an executable file, complete source code means all the source code for
80*7f2fe78bSCy Schubert%all modules it contains; but, as a special exception, it need not include
81*7f2fe78bSCy Schubert%source code for modules which are standard libraries that accompany the
82*7f2fe78bSCy Schubert%operating system on which the executable file runs.
83*7f2fe78bSCy Schubert
84*7f2fe78bSCy Schubert%  4. You may not copy, sublicense, distribute or transfer this program
85*7f2fe78bSCy Schubert%except as expressly provided under this License Agreement.  Any attempt
86*7f2fe78bSCy Schubert%otherwise to copy, sublicense, distribute or transfer this program is void and
87*7f2fe78bSCy Schubert%your rights to use the program under this License agreement shall be
88*7f2fe78bSCy Schubert%automatically terminated.  However, parties who have received computer
89*7f2fe78bSCy Schubert%software programs from you with this License Agreement will not have
90*7f2fe78bSCy Schubert%their licenses terminated so long as such parties remain in full compliance.
91*7f2fe78bSCy Schubert
92*7f2fe78bSCy Schubert%  5. If you wish to incorporate parts of this program into other free
93*7f2fe78bSCy Schubert%programs whose distribution conditions are different, write to the Free
94*7f2fe78bSCy Schubert%Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
95*7f2fe78bSCy Schubert%worked out a simple rule that can be stated here, but we will often permit
96*7f2fe78bSCy Schubert%this.  We will be guided by the two goals of preserving the free status of
97*7f2fe78bSCy Schubert%all derivatives of our free software and of promoting the sharing and reuse of
98*7f2fe78bSCy Schubert%software.
99*7f2fe78bSCy Schubert
100*7f2fe78bSCy Schubert%In other words, you are welcome to use, share and improve this program.
101*7f2fe78bSCy Schubert%You are forbidden to forbid anyone else to use, share and improve
102*7f2fe78bSCy Schubert%what you give them.   Help stamp out software-hoarding!
103*7f2fe78bSCy Schubert
104*7f2fe78bSCy Schubert\def\texinfoversion{1.18}
105*7f2fe78bSCy Schubert\message{Loading texinfo package [Version \texinfoversion]:}
106*7f2fe78bSCy Schubert\message{}
107*7f2fe78bSCy Schubert
108*7f2fe78bSCy Schubert% Save some parts of plain tex whose names we will redefine.
109*7f2fe78bSCy Schubert
110*7f2fe78bSCy Schubert\let\ptexlbrace=\{
111*7f2fe78bSCy Schubert\let\ptexrbrace=\}
112*7f2fe78bSCy Schubert\let\ptexdot=\.
113*7f2fe78bSCy Schubert\let\ptexstar=\*
114*7f2fe78bSCy Schubert\let\ptexend=\end
115*7f2fe78bSCy Schubert\let\ptexbullet=\bullet
116*7f2fe78bSCy Schubert\let\ptexb=\b
117*7f2fe78bSCy Schubert\let\ptexc=\c
118*7f2fe78bSCy Schubert\let\ptexi=\i
119*7f2fe78bSCy Schubert\let\ptext=\t
120*7f2fe78bSCy Schubert\let\ptexl=\l
121*7f2fe78bSCy Schubert\let\ptexL=\L
122*7f2fe78bSCy Schubert
123*7f2fe78bSCy Schubert\def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
124*7f2fe78bSCy Schubert
125*7f2fe78bSCy Schubert\message{Basics,}
126*7f2fe78bSCy Schubert\chardef\other=12
127*7f2fe78bSCy Schubert
128*7f2fe78bSCy Schubert\hyphenation{ap-pen-dix}
129*7f2fe78bSCy Schubert\hyphenation{mini-buf-fer mini-buf-fers}
130*7f2fe78bSCy Schubert\hyphenation{eshell}
131*7f2fe78bSCy Schubert
132*7f2fe78bSCy Schubert% Margin to add to right of even pages, to left of odd pages.
133*7f2fe78bSCy Schubert\newdimen \bindingoffset  \bindingoffset=0pt
134*7f2fe78bSCy Schubert\newdimen \normaloffset   \normaloffset=\hoffset
135*7f2fe78bSCy Schubert\newdimen\pagewidth \newdimen\pageheight
136*7f2fe78bSCy Schubert\pagewidth=\hsize \pageheight=\vsize
137*7f2fe78bSCy Schubert
138*7f2fe78bSCy Schubert%---------------------Begin change-----------------------
139*7f2fe78bSCy Schubert%
140*7f2fe78bSCy Schubert% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
141*7f2fe78bSCy Schubert%
142*7f2fe78bSCy Schubert\newdimen\cornerlong \newdimen\cornerthick
143*7f2fe78bSCy Schubert\newdimen \topandbottommargin
144*7f2fe78bSCy Schubert\newdimen \outerhsize \newdimen \outervsize
145*7f2fe78bSCy Schubert\cornerlong=1pc\cornerthick=.3pt	% These set size of cropmarks
146*7f2fe78bSCy Schubert\outerhsize=7in
147*7f2fe78bSCy Schubert\outervsize=9.5in
148*7f2fe78bSCy Schubert\topandbottommargin=.75in
149*7f2fe78bSCy Schubert%
150*7f2fe78bSCy Schubert%---------------------End change-----------------------
151*7f2fe78bSCy Schubert
152*7f2fe78bSCy Schubert% \onepageout takes a vbox as an argument.  Note that \pagecontents
153*7f2fe78bSCy Schubert% does insertions itself, but you have to call it yourself.
154*7f2fe78bSCy Schubert\chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
155*7f2fe78bSCy Schubert\def\onepageout#1{\hoffset=\normaloffset
156*7f2fe78bSCy Schubert\ifodd\pageno  \advance\hoffset by \bindingoffset
157*7f2fe78bSCy Schubert\else \advance\hoffset by -\bindingoffset\fi
158*7f2fe78bSCy Schubert\shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
159*7f2fe78bSCy Schubert {\let\hsize=\pagewidth \makefootline}}
160*7f2fe78bSCy Schubert\advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
161*7f2fe78bSCy Schubert
162*7f2fe78bSCy Schubert
163*7f2fe78bSCy Schubert% Here is a modification of the main output routine for Near East Publications
164*7f2fe78bSCy Schubert% This provides right-angle cropmarks at all four corners.
165*7f2fe78bSCy Schubert% The contents of the page are centerlined into the cropmarks,
166*7f2fe78bSCy Schubert% and any desired binding offset is added as an \hskip on either
167*7f2fe78bSCy Schubert% site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
168*7f2fe78bSCy Schubert%
169*7f2fe78bSCy Schubert\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
170*7f2fe78bSCy Schubert		 \shipout
171*7f2fe78bSCy Schubert		 \vbox to \outervsize{\hsize=\outerhsize
172*7f2fe78bSCy Schubert                 \vbox{\line{\ewtop\hfill\ewtop}}
173*7f2fe78bSCy Schubert                 \nointerlineskip
174*7f2fe78bSCy Schubert                 \line{\vbox{\moveleft\cornerthick\nstop}
175*7f2fe78bSCy Schubert                       \hfill
176*7f2fe78bSCy Schubert                       \vbox{\moveright\cornerthick\nstop}}
177*7f2fe78bSCy Schubert                 \vskip \topandbottommargin
178*7f2fe78bSCy Schubert                 \centerline{\ifodd\pageno\hskip\bindingoffset\fi
179*7f2fe78bSCy Schubert			\vbox{
180*7f2fe78bSCy Schubert			{\let\hsize=\pagewidth \makeheadline}
181*7f2fe78bSCy Schubert			\pagebody{#1}
182*7f2fe78bSCy Schubert			{\let\hsize=\pagewidth \makefootline}}
183*7f2fe78bSCy Schubert			\ifodd\pageno\else\hskip\bindingoffset\fi}
184*7f2fe78bSCy Schubert		 \vskip \topandbottommargin plus1fill minus1fill
185*7f2fe78bSCy Schubert                 \boxmaxdepth\cornerthick
186*7f2fe78bSCy Schubert                 \line{\vbox{\moveleft\cornerthick\nsbot}
187*7f2fe78bSCy Schubert                       \hfill
188*7f2fe78bSCy Schubert                       \vbox{\moveright\cornerthick\nsbot}}
189*7f2fe78bSCy Schubert                 \nointerlineskip
190*7f2fe78bSCy Schubert                 \vbox{\line{\ewbot\hfill\ewbot}}
191*7f2fe78bSCy Schubert	}
192*7f2fe78bSCy Schubert  \advancepageno
193*7f2fe78bSCy Schubert  \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
194*7f2fe78bSCy Schubert%
195*7f2fe78bSCy Schubert% Do @cropmarks to get crop marks
196*7f2fe78bSCy Schubert\def\cropmarks{\let\onepageout=\croppageout }
197*7f2fe78bSCy Schubert
198*7f2fe78bSCy Schubert\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
199*7f2fe78bSCy Schubert{\catcode`\@ =11
200*7f2fe78bSCy Schubert\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
201*7f2fe78bSCy Schubert\dimen@=\dp#1 \unvbox#1
202*7f2fe78bSCy Schubert\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
203*7f2fe78bSCy Schubert\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
204*7f2fe78bSCy Schubert}
205*7f2fe78bSCy Schubert
206*7f2fe78bSCy Schubert%
207*7f2fe78bSCy Schubert% Here are the rules for the cropmarks.  Note that they are
208*7f2fe78bSCy Schubert% offset so that the space between them is truly \outerhsize or \outervsize
209*7f2fe78bSCy Schubert% (P. A. MacKay, 12 November, 1986)
210*7f2fe78bSCy Schubert%
211*7f2fe78bSCy Schubert\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
212*7f2fe78bSCy Schubert\def\nstop{\vbox
213*7f2fe78bSCy Schubert  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
214*7f2fe78bSCy Schubert\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
215*7f2fe78bSCy Schubert\def\nsbot{\vbox
216*7f2fe78bSCy Schubert  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
217*7f2fe78bSCy Schubert
218*7f2fe78bSCy Schubert% Parse an argument, then pass it to #1.
219*7f2fe78bSCy Schubert% The argument can be delimited with [...] or with "..." or braces
220*7f2fe78bSCy Schubert% or it can be a whole line.
221*7f2fe78bSCy Schubert% #1 should be a macro which expects
222*7f2fe78bSCy Schubert% an ordinary undelimited TeX argument.
223*7f2fe78bSCy Schubert
224*7f2fe78bSCy Schubert\def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
225*7f2fe78bSCy Schubert
226*7f2fe78bSCy Schubert\def\parseargx{%
227*7f2fe78bSCy Schubert\ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
228*7f2fe78bSCy Schubert\aftergroup \parseargline %
229*7f2fe78bSCy Schubert\fi \endgroup}
230*7f2fe78bSCy Schubert
231*7f2fe78bSCy Schubert{\obeyspaces %
232*7f2fe78bSCy Schubert\gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
233*7f2fe78bSCy Schubert
234*7f2fe78bSCy Schubert\gdef\obeyedspace{\ }
235*7f2fe78bSCy Schubert
236*7f2fe78bSCy Schubert\def\parseargline{\begingroup \obeylines \parsearglinex}
237*7f2fe78bSCy Schubert{\obeylines %
238*7f2fe78bSCy Schubert\gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
239*7f2fe78bSCy Schubert
240*7f2fe78bSCy Schubert\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
241*7f2fe78bSCy Schubert
242*7f2fe78bSCy Schubert%% These are used to keep @begin/@end levels from running away
243*7f2fe78bSCy Schubert%% Call \inENV within environments (after a \begingroup)
244*7f2fe78bSCy Schubert\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
245*7f2fe78bSCy Schubert\def\ENVcheck{%
246*7f2fe78bSCy Schubert\ifENV\errmessage{Still within an environment.  Type Return to continue.}
247*7f2fe78bSCy Schubert\endgroup\fi} % This is not perfect, but it should reduce lossage
248*7f2fe78bSCy Schubert
249*7f2fe78bSCy Schubert% @begin foo  is the same as @foo, for now.
250*7f2fe78bSCy Schubert\newhelp\EMsimple{Type <Return> to continue}
251*7f2fe78bSCy Schubert
252*7f2fe78bSCy Schubert\outer\def\begin{\parsearg\beginxxx}
253*7f2fe78bSCy Schubert
254*7f2fe78bSCy Schubert\def\beginxxx #1{%
255*7f2fe78bSCy Schubert\expandafter\ifx\csname #1\endcsname\relax
256*7f2fe78bSCy Schubert{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
257*7f2fe78bSCy Schubert\csname #1\endcsname\fi}
258*7f2fe78bSCy Schubert
259*7f2fe78bSCy Schubert%% @end foo executes the definition of \Efoo.
260*7f2fe78bSCy Schubert%% foo can be delimited by doublequotes or brackets.
261*7f2fe78bSCy Schubert
262*7f2fe78bSCy Schubert\def\end{\parsearg\endxxx}
263*7f2fe78bSCy Schubert
264*7f2fe78bSCy Schubert\def\endxxx #1{%
265*7f2fe78bSCy Schubert\expandafter\ifx\csname E#1\endcsname\relax
266*7f2fe78bSCy Schubert\expandafter\ifx\csname #1\endcsname\relax
267*7f2fe78bSCy Schubert\errmessage{Undefined command @end #1}\else
268*7f2fe78bSCy Schubert\errorE{#1}\fi\fi
269*7f2fe78bSCy Schubert\csname E#1\endcsname}
270*7f2fe78bSCy Schubert\def\errorE#1{
271*7f2fe78bSCy Schubert{\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
272*7f2fe78bSCy Schubert
273*7f2fe78bSCy Schubert% Single-spacing is done by various environments.
274*7f2fe78bSCy Schubert
275*7f2fe78bSCy Schubert\newskip\singlespaceskip \singlespaceskip = \baselineskip
276*7f2fe78bSCy Schubert\def\singlespace{%
277*7f2fe78bSCy Schubert{\advance \baselineskip by -\singlespaceskip
278*7f2fe78bSCy Schubert\kern \baselineskip}%
279*7f2fe78bSCy Schubert\baselineskip=\singlespaceskip
280*7f2fe78bSCy Schubert}
281*7f2fe78bSCy Schubert
282*7f2fe78bSCy Schubert%% Simple single-character @ commands
283*7f2fe78bSCy Schubert
284*7f2fe78bSCy Schubert% @@ prints an @
285*7f2fe78bSCy Schubert% Kludge this until the fonts are right (grr).
286*7f2fe78bSCy Schubert\def\@{{\sf \char '100}}
287*7f2fe78bSCy Schubert
288*7f2fe78bSCy Schubert% Define @` and @' to be the same as ` and '
289*7f2fe78bSCy Schubert% but suppressing ligatures.
290*7f2fe78bSCy Schubert\def\`{{`}}
291*7f2fe78bSCy Schubert\def\'{{'}}
292*7f2fe78bSCy Schubert
293*7f2fe78bSCy Schubert% Used to generate quoted braces.
294*7f2fe78bSCy Schubert
295*7f2fe78bSCy Schubert\def\mylbrace {{\tt \char '173}}
296*7f2fe78bSCy Schubert\def\myrbrace {{\tt \char '175}}
297*7f2fe78bSCy Schubert\let\{=\mylbrace
298*7f2fe78bSCy Schubert\let\}=\myrbrace
299*7f2fe78bSCy Schubert
300*7f2fe78bSCy Schubert% @: forces normal size whitespace following.
301*7f2fe78bSCy Schubert\def\:{\spacefactor=1000 }
302*7f2fe78bSCy Schubert
303*7f2fe78bSCy Schubert% @* forces a line break.
304*7f2fe78bSCy Schubert\def\*{\hfil\break}
305*7f2fe78bSCy Schubert
306*7f2fe78bSCy Schubert% @. is an end-of-sentence period.
307*7f2fe78bSCy Schubert\def\.{.\spacefactor=3000 }
308*7f2fe78bSCy Schubert
309*7f2fe78bSCy Schubert% @w prevents a word break
310*7f2fe78bSCy Schubert\def\w #1{\hbox{#1}}
311*7f2fe78bSCy Schubert
312*7f2fe78bSCy Schubert% @group ... @end group  forces ... to be all on one page.
313*7f2fe78bSCy Schubert
314*7f2fe78bSCy Schubert\def\group{\begingroup% \inENV ???
315*7f2fe78bSCy Schubert\def \Egroup{\egroup\endgroup}
316*7f2fe78bSCy Schubert\vbox\bgroup}
317*7f2fe78bSCy Schubert
318*7f2fe78bSCy Schubert% @br   forces paragraph break
319*7f2fe78bSCy Schubert
320*7f2fe78bSCy Schubert\let\br = \par
321*7f2fe78bSCy Schubert
322*7f2fe78bSCy Schubert% @dots{}  output some dots
323*7f2fe78bSCy Schubert
324*7f2fe78bSCy Schubert\def\dots{$\ldots$}
325*7f2fe78bSCy Schubert
326*7f2fe78bSCy Schubert% @page    forces the start of a new page
327*7f2fe78bSCy Schubert
328*7f2fe78bSCy Schubert\def\page{\par\vfill\supereject}
329*7f2fe78bSCy Schubert
330*7f2fe78bSCy Schubert% @exdent text....
331*7f2fe78bSCy Schubert% outputs text on separate line in roman font, starting at standard page margin
332*7f2fe78bSCy Schubert
333*7f2fe78bSCy Schubert\def\exdent{\errmessage{@exdent in filled text}}
334*7f2fe78bSCy Schubert  % @lisp, etc, define \exdent locally from \internalexdent
335*7f2fe78bSCy Schubert
336*7f2fe78bSCy Schubert{\obeyspaces
337*7f2fe78bSCy Schubert\gdef\internalexdent{\parsearg\exdentzzz}}
338*7f2fe78bSCy Schubert
339*7f2fe78bSCy Schubert\def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
340*7f2fe78bSCy Schubert\advance \hsize by -\leftskip
341*7f2fe78bSCy Schubert\advance \hsize by -\rightskip
342*7f2fe78bSCy Schubert\leftline{{\rm#1}}}}
343*7f2fe78bSCy Schubert
344*7f2fe78bSCy Schubert% @include file    insert text of that file as input.
345*7f2fe78bSCy Schubert
346*7f2fe78bSCy Schubert\def\include{\parsearg\includezzz}
347*7f2fe78bSCy Schubert\def\includezzz #1{{\def\thisfile{#1}\input #1
348*7f2fe78bSCy Schubert}}
349*7f2fe78bSCy Schubert
350*7f2fe78bSCy Schubert\def\thisfile{}
351*7f2fe78bSCy Schubert
352*7f2fe78bSCy Schubert% @center line   outputs that line, centered
353*7f2fe78bSCy Schubert
354*7f2fe78bSCy Schubert\def\center{\parsearg\centerzzz}
355*7f2fe78bSCy Schubert\def\centerzzz #1{{\advance\hsize by -\leftskip
356*7f2fe78bSCy Schubert\advance\hsize by -\rightskip
357*7f2fe78bSCy Schubert\centerline{#1}}}
358*7f2fe78bSCy Schubert
359*7f2fe78bSCy Schubert% @sp n   outputs n lines of vertical space
360*7f2fe78bSCy Schubert
361*7f2fe78bSCy Schubert\def\sp{\parsearg\spxxx}
362*7f2fe78bSCy Schubert\def\spxxx #1{\par \vskip #1\baselineskip}
363*7f2fe78bSCy Schubert
364*7f2fe78bSCy Schubert% @comment ...line which is ignored...
365*7f2fe78bSCy Schubert% @c is the same as @comment
366*7f2fe78bSCy Schubert% @ignore ... @end ignore  is another way to write a comment
367*7f2fe78bSCy Schubert
368*7f2fe78bSCy Schubert\def\comment{\parsearg \commentxxx}
369*7f2fe78bSCy Schubert
370*7f2fe78bSCy Schubert\def\commentxxx #1{}
371*7f2fe78bSCy Schubert
372*7f2fe78bSCy Schubert\let\c=\comment
373*7f2fe78bSCy Schubert
374*7f2fe78bSCy Schubert\long\def\ignore #1\end ignore{}
375*7f2fe78bSCy Schubert
376*7f2fe78bSCy Schubert\outer\def\ifset{\parsearg\ifsetxxx}
377*7f2fe78bSCy Schubert
378*7f2fe78bSCy Schubert\def\ifsetxxx #1#2\end ifset{%
379*7f2fe78bSCy Schubert\expandafter\ifx\csname IF#1\endcsname\relax \else #2\fi}
380*7f2fe78bSCy Schubert
381*7f2fe78bSCy Schubert\outer\def\ifclear{\parsearg\ifclearxxx}
382*7f2fe78bSCy Schubert
383*7f2fe78bSCy Schubert\def\ifclearxxx #1#2\end ifclear{%
384*7f2fe78bSCy Schubert\expandafter\ifx\csname IF#1\endcsname\relax #2\fi}
385*7f2fe78bSCy Schubert
386*7f2fe78bSCy Schubert% Some texinfo constructs that are trivial in tex
387*7f2fe78bSCy Schubert
388*7f2fe78bSCy Schubert\def\iftex{}
389*7f2fe78bSCy Schubert\def\Eiftex{}
390*7f2fe78bSCy Schubert\long\def\ifinfo #1\end ifinfo{}
391*7f2fe78bSCy Schubert\long\def\menu #1\end menu{}
392*7f2fe78bSCy Schubert\def\asis#1{#1}
393*7f2fe78bSCy Schubert
394*7f2fe78bSCy Schubert\def\node{\parsearg\nodezzz}
395*7f2fe78bSCy Schubert\def\nodezzz#1{\nodexxx [#1,]}
396*7f2fe78bSCy Schubert\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
397*7f2fe78bSCy Schubert\let\lastnode=\relax
398*7f2fe78bSCy Schubert
399*7f2fe78bSCy Schubert\def\donoderef{\ifx\lastnode\relax\else
400*7f2fe78bSCy Schubert\expandafter\expandafter\expandafter\setref{\lastnode}\fi
401*7f2fe78bSCy Schubert\let\lastnode=\relax}
402*7f2fe78bSCy Schubert
403*7f2fe78bSCy Schubert\def\unnumbnoderef{\ifx\lastnode\relax\else
404*7f2fe78bSCy Schubert\expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
405*7f2fe78bSCy Schubert\let\lastnode=\relax}
406*7f2fe78bSCy Schubert
407*7f2fe78bSCy Schubert\let\refill=\relax
408*7f2fe78bSCy Schubert
409*7f2fe78bSCy Schubert\let\setfilename=\comment
410*7f2fe78bSCy Schubert
411*7f2fe78bSCy Schubert\def\inforef #1{\inforefzzz #1,,,,**}
412*7f2fe78bSCy Schubert\def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}}, node `\losespace#1{}'}
413*7f2fe78bSCy Schubert\def\losespace #1{#1}
414*7f2fe78bSCy Schubert
415*7f2fe78bSCy Schubert\message{fonts,}
416*7f2fe78bSCy Schubert
417*7f2fe78bSCy Schubert% Font-change commands.
418*7f2fe78bSCy Schubert
419*7f2fe78bSCy Schubert%% Try out Computer Modern fonts at \magstephalf
420*7f2fe78bSCy Schubert\font\tenrm=cmr10 scaled \magstephalf
421*7f2fe78bSCy Schubert\font\tentt=cmtt10 scaled \magstephalf
422*7f2fe78bSCy Schubert% Instead of cmb10, you many want to use cmbx10.
423*7f2fe78bSCy Schubert% cmbx10 is a prettier font on its own, but cmb10
424*7f2fe78bSCy Schubert% looks better when embedded in a line with cmr10.
425*7f2fe78bSCy Schubert\font\tenbf=cmb10 scaled \magstephalf
426*7f2fe78bSCy Schubert\font\tenit=cmti10 scaled \magstephalf
427*7f2fe78bSCy Schubert\font\tensl=cmsl10 scaled \magstephalf
428*7f2fe78bSCy Schubert\font\tensf=cmss10 scaled \magstephalf
429*7f2fe78bSCy Schubert\def\li{\sf}
430*7f2fe78bSCy Schubert\font\tensc=cmcsc10 scaled \magstephalf
431*7f2fe78bSCy Schubert
432*7f2fe78bSCy Schubert% Fonts for @defun, etc.
433*7f2fe78bSCy Schubert\font\defbf=cmbx10 scaled \magstep1 %was 1314
434*7f2fe78bSCy Schubert\let\deftt=\tentt
435*7f2fe78bSCy Schubert\def\df{\let\tt=\deftt \defbf}
436*7f2fe78bSCy Schubert
437*7f2fe78bSCy Schubert% Font for title
438*7f2fe78bSCy Schubert\font\titlerm = cmbx10 scaled \magstep5
439*7f2fe78bSCy Schubert
440*7f2fe78bSCy Schubert% Fonts for indices
441*7f2fe78bSCy Schubert\font\indit=cmti9 \font\indrm=cmr9
442*7f2fe78bSCy Schubert\def\indbf{\indrm} \def\indsl{\indit}
443*7f2fe78bSCy Schubert\def\indexfonts{\let\it=\indit \let\sl=\indsl \let\bf=\indbf \let\rm=\indrm}
444*7f2fe78bSCy Schubert
445*7f2fe78bSCy Schubert% Fonts for headings
446*7f2fe78bSCy Schubert\font\chaprm=cmbx10 scaled \magstep3
447*7f2fe78bSCy Schubert\font\chapit=cmti10 scaled \magstep3
448*7f2fe78bSCy Schubert\font\chapsl=cmsl10 scaled \magstep3
449*7f2fe78bSCy Schubert\font\chaptt=cmtt10 scaled \magstep3
450*7f2fe78bSCy Schubert\font\chapsf=cmss10 scaled \magstep3
451*7f2fe78bSCy Schubert\let\chapbf=\chaprm
452*7f2fe78bSCy Schubert
453*7f2fe78bSCy Schubert\font\secrm=cmbx10 scaled \magstep2
454*7f2fe78bSCy Schubert\font\secit=cmti10 scaled \magstep2
455*7f2fe78bSCy Schubert\font\secsl=cmsl10 scaled \magstep2
456*7f2fe78bSCy Schubert\font\sectt=cmtt10 scaled \magstep2
457*7f2fe78bSCy Schubert\font\secsf=cmss10 scaled \magstep2
458*7f2fe78bSCy Schubert\let\secbf=\secrm
459*7f2fe78bSCy Schubert
460*7f2fe78bSCy Schubert\font\ssecrm=cmbx10 scaled \magstep1
461*7f2fe78bSCy Schubert\font\ssecit=cmti10 scaled \magstep1
462*7f2fe78bSCy Schubert\font\ssecsl=cmsl10 scaled \magstep1
463*7f2fe78bSCy Schubert\font\ssectt=cmtt10 scaled \magstep1
464*7f2fe78bSCy Schubert\font\ssecsf=cmss10 scaled \magstep1
465*7f2fe78bSCy Schubert\let\ssecbf=\ssecrm
466*7f2fe78bSCy Schubert
467*7f2fe78bSCy Schubert\def\textfonts{\let\rm=\tenrm\let\it=\tenit\let\sl=\tensl\let\bf=\tenbf%
468*7f2fe78bSCy Schubert\let\sc=\tensc\let\sf=\tensf}
469*7f2fe78bSCy Schubert\def\chapfonts{\let\rm=\chaprm\let\it=\chapit\let\sl=\chapsl\let\bf=\chapbf\let\tt=\chaptt\let\sf=\chapsf}
470*7f2fe78bSCy Schubert\def\secfonts{\let\rm=\secrm\let\it=\secit\let\sl=\secsl\let\bf=\secbf\let\tt=\sectt\let\sf=\secsf}
471*7f2fe78bSCy Schubert\def\subsecfonts{\let\rm=\ssecrm\let\it=\ssecit\let\sl=\ssecsl\let\bf=\ssecbf\let\tt=\ssectt\let\sf=\ssecsf}
472*7f2fe78bSCy Schubert% Count depth in font-changes, for error checks
473*7f2fe78bSCy Schubert\newcount\fontdepth \fontdepth=0
474*7f2fe78bSCy Schubert
475*7f2fe78bSCy Schubert%% Add scribe-like font environments, plus @l for inline lisp (usually sans
476*7f2fe78bSCy Schubert%% serif) and @ii for TeX italic
477*7f2fe78bSCy Schubert
478*7f2fe78bSCy Schubert\def\i#1{{\sl #1}}
479*7f2fe78bSCy Schubert\let\var=\i
480*7f2fe78bSCy Schubert\let\dfn=\i
481*7f2fe78bSCy Schubert\let\emph=\i
482*7f2fe78bSCy Schubert\let\cite=\i
483*7f2fe78bSCy Schubert
484*7f2fe78bSCy Schubert\def\b#1{{\bf #1}}
485*7f2fe78bSCy Schubert\let\strong=\b
486*7f2fe78bSCy Schubert
487*7f2fe78bSCy Schubert\def\t#1{{\tt \rawbackslash \frenchspacing #1}\null}
488*7f2fe78bSCy Schubert\let\ttfont = \t
489*7f2fe78bSCy Schubert\let\kbd=\t
490*7f2fe78bSCy Schubert\let\code=\t
491*7f2fe78bSCy Schubert\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
492*7f2fe78bSCy Schubert\def\key #1{{\tt \uppercase{#1}}\null}
493*7f2fe78bSCy Schubert\def\ctrl #1{{\tt \rawbackslash \hat}#1}
494*7f2fe78bSCy Schubert
495*7f2fe78bSCy Schubert\let\file=\samp
496*7f2fe78bSCy Schubert
497*7f2fe78bSCy Schubert\def\l#1{{\li #1}\null}
498*7f2fe78bSCy Schubert
499*7f2fe78bSCy Schubert\def\r#1{{\rm #1}}
500*7f2fe78bSCy Schubert\def\s#1{{\sc #1}}
501*7f2fe78bSCy Schubert\def\ii#1{{\it #1}}
502*7f2fe78bSCy Schubert
503*7f2fe78bSCy Schubert\def\titlefont#1{{\titlerm #1}}
504*7f2fe78bSCy Schubert
505*7f2fe78bSCy Schubert\def\titlepage{\begingroup \parindent=0pt \hbox{}%
506*7f2fe78bSCy Schubert\let\oldpage=\page
507*7f2fe78bSCy Schubert\def\page{\oldpage \hbox{}}}
508*7f2fe78bSCy Schubert
509*7f2fe78bSCy Schubert\def\Etitlepage{\endgroup\page\HEADINGSon}
510*7f2fe78bSCy Schubert
511*7f2fe78bSCy Schubert% Make altmode in file print out right
512*7f2fe78bSCy Schubert
513*7f2fe78bSCy Schubert\catcode `\^^[=\active \def^^[{$\diamondsuit$}
514*7f2fe78bSCy Schubert
515*7f2fe78bSCy Schubert\message{page headings,}
516*7f2fe78bSCy Schubert
517*7f2fe78bSCy Schubert%%% Set up page headings and footings.
518*7f2fe78bSCy Schubert
519*7f2fe78bSCy Schubert\let\thispage=\folio
520*7f2fe78bSCy Schubert
521*7f2fe78bSCy Schubert\newtoks \evenheadline    % Token sequence for heading line of even pages
522*7f2fe78bSCy Schubert\newtoks \oddheadline     % Token sequence for heading line of odd pages
523*7f2fe78bSCy Schubert\newtoks \evenfootline    % Token sequence for footing line of even pages
524*7f2fe78bSCy Schubert\newtoks \oddfootline     % Token sequence for footing line of odd pages
525*7f2fe78bSCy Schubert
526*7f2fe78bSCy Schubert% Now make Tex use those variables
527*7f2fe78bSCy Schubert\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}}
528*7f2fe78bSCy Schubert\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}}
529*7f2fe78bSCy Schubert
530*7f2fe78bSCy Schubert% Commands to set those variables.
531*7f2fe78bSCy Schubert% For example, this is what  @headings on  does
532*7f2fe78bSCy Schubert% @evenheading @thistitle|@thispage|@thischapter
533*7f2fe78bSCy Schubert% @oddheading @thischapter|@thispage|@thistitle
534*7f2fe78bSCy Schubert% @evenfooting @thisfile||
535*7f2fe78bSCy Schubert% @oddfooting ||@thisfile
536*7f2fe78bSCy Schubert
537*7f2fe78bSCy Schubert\def\evenheading{\parsearg\evenheadingxxx}
538*7f2fe78bSCy Schubert\def\oddheading{\parsearg\oddheadingxxx}
539*7f2fe78bSCy Schubert\def\everyheading{\parsearg\everyheadingxxx}
540*7f2fe78bSCy Schubert
541*7f2fe78bSCy Schubert\def\evenfooting{\parsearg\evenfootingxxx}
542*7f2fe78bSCy Schubert\def\oddfooting{\parsearg\oddfootingxxx}
543*7f2fe78bSCy Schubert\def\everyfooting{\parsearg\everyfootingxxx}
544*7f2fe78bSCy Schubert
545*7f2fe78bSCy Schubert{\catcode`\@=0 %
546*7f2fe78bSCy Schubert
547*7f2fe78bSCy Schubert\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
548*7f2fe78bSCy Schubert\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
549*7f2fe78bSCy Schubert\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
550*7f2fe78bSCy Schubert
551*7f2fe78bSCy Schubert\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
552*7f2fe78bSCy Schubert\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
553*7f2fe78bSCy Schubert\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
554*7f2fe78bSCy Schubert
555*7f2fe78bSCy Schubert\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
556*7f2fe78bSCy Schubert\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
557*7f2fe78bSCy Schubert\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
558*7f2fe78bSCy Schubert\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
559*7f2fe78bSCy Schubert
560*7f2fe78bSCy Schubert\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
561*7f2fe78bSCy Schubert\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
562*7f2fe78bSCy Schubert\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
563*7f2fe78bSCy Schubert
564*7f2fe78bSCy Schubert\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
565*7f2fe78bSCy Schubert\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
566*7f2fe78bSCy Schubert\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
567*7f2fe78bSCy Schubert
568*7f2fe78bSCy Schubert\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
569*7f2fe78bSCy Schubert\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
570*7f2fe78bSCy Schubert\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
571*7f2fe78bSCy Schubert\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
572*7f2fe78bSCy Schubert%
573*7f2fe78bSCy Schubert}% unbind the catcode of @.
574*7f2fe78bSCy Schubert
575*7f2fe78bSCy Schubert% @headings on   turns them on.
576*7f2fe78bSCy Schubert% @headings off  turns them off.
577*7f2fe78bSCy Schubert% By default, they are off.
578*7f2fe78bSCy Schubert
579*7f2fe78bSCy Schubert\def\headings #1 {\csname HEADINGS#1\endcsname}
580*7f2fe78bSCy Schubert
581*7f2fe78bSCy Schubert\def\HEADINGSoff{
582*7f2fe78bSCy Schubert\global\evenheadline={\hfil} \global\evenfootline={\hfil}
583*7f2fe78bSCy Schubert\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
584*7f2fe78bSCy Schubert\HEADINGSoff
585*7f2fe78bSCy Schubert% When we turn headings on, set the page number to 1,
586*7f2fe78bSCy Schubert% Put current file name in lower left corner,
587*7f2fe78bSCy Schubert% Put chapter name on inside top of right hand pages, document
588*7f2fe78bSCy Schubert% title on inside top of left hand pages, and page numbers on outside top
589*7f2fe78bSCy Schubert% edge of all pages.
590*7f2fe78bSCy Schubert\def\HEADINGSon{
591*7f2fe78bSCy Schubert\pagealignmacro
592*7f2fe78bSCy Schubert\global\pageno=1
593*7f2fe78bSCy Schubert\global\evenfootline={\hfil}
594*7f2fe78bSCy Schubert\global\oddfootline={\hfil}
595*7f2fe78bSCy Schubert\global\evenheadline={\line{\folio\hfil\thistitle}}
596*7f2fe78bSCy Schubert\global\oddheadline={\line{\thischapter\hfil\folio}}
597*7f2fe78bSCy Schubert}
598*7f2fe78bSCy Schubert
599*7f2fe78bSCy Schubert% Subroutines used in generating headings
600*7f2fe78bSCy Schubert% Produces Day Month Year style of output.
601*7f2fe78bSCy Schubert\def\today{\number\day\space
602*7f2fe78bSCy Schubert\ifcase\month\or
603*7f2fe78bSCy SchubertJanuary\or February\or March\or April\or May\or June\or
604*7f2fe78bSCy SchubertJuly\or August\or September\or October\or November\or December\fi
605*7f2fe78bSCy Schubert\space\number\year}
606*7f2fe78bSCy Schubert
607*7f2fe78bSCy Schubert% Use this if you want the Month Day, Year style of output.
608*7f2fe78bSCy Schubert%\def\today{\ifcase\month\or
609*7f2fe78bSCy Schubert%January\or February\or March\or April\or May\or June\or
610*7f2fe78bSCy Schubert%July\or August\or September\or October\or November\or December\fi
611*7f2fe78bSCy Schubert%\space\number\day, \number\year}
612*7f2fe78bSCy Schubert
613*7f2fe78bSCy Schubert% @settitle line...  specifies the title of the document, for headings
614*7f2fe78bSCy Schubert% It generates no output of its own
615*7f2fe78bSCy Schubert
616*7f2fe78bSCy Schubert\def\thistitle{No Title}
617*7f2fe78bSCy Schubert\def\settitle{\parsearg\settitlezzz}
618*7f2fe78bSCy Schubert\def\settitlezzz #1{\gdef\thistitle{#1}}
619*7f2fe78bSCy Schubert
620*7f2fe78bSCy Schubert\message{tables,}
621*7f2fe78bSCy Schubert
622*7f2fe78bSCy Schubert% Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
623*7f2fe78bSCy Schubert
624*7f2fe78bSCy Schubert% default indentation of table text
625*7f2fe78bSCy Schubert\newdimen\tableindent \tableindent=.8in
626*7f2fe78bSCy Schubert% default indentation of @itemize and @enumerate text
627*7f2fe78bSCy Schubert\newdimen\itemindent  \itemindent=.3in
628*7f2fe78bSCy Schubert% margin between end of table item and start of table text.
629*7f2fe78bSCy Schubert\newdimen\itemmargin  \itemmargin=.1in
630*7f2fe78bSCy Schubert
631*7f2fe78bSCy Schubert% used internally for \itemindent minus \itemmargin
632*7f2fe78bSCy Schubert\newdimen\itemmax
633*7f2fe78bSCy Schubert
634*7f2fe78bSCy Schubert% Note @table and @ftable define @item, @itemx, etc., with these defs.
635*7f2fe78bSCy Schubert% They also define \itemindex
636*7f2fe78bSCy Schubert% to index the item name in whatever manner is desired (perhaps none).
637*7f2fe78bSCy Schubert
638*7f2fe78bSCy Schubert\def\internalBitem{\smallbreak \parsearg\itemzzz}
639*7f2fe78bSCy Schubert\def\internalBitemx{\par \parsearg\itemzzz}
640*7f2fe78bSCy Schubert
641*7f2fe78bSCy Schubert\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
642*7f2fe78bSCy Schubert\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
643*7f2fe78bSCy Schubert
644*7f2fe78bSCy Schubert\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
645*7f2fe78bSCy Schubert\def\internalBkitemx{\par \parsearg\kitemzzz}
646*7f2fe78bSCy Schubert
647*7f2fe78bSCy Schubert\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}\itemzzz {#1}}
648*7f2fe78bSCy Schubert
649*7f2fe78bSCy Schubert\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}\itemzzz {#1}}
650*7f2fe78bSCy Schubert
651*7f2fe78bSCy Schubert\def\itemzzz #1{\begingroup %
652*7f2fe78bSCy Schubert\advance \hsize by -\rightskip %
653*7f2fe78bSCy Schubert\advance \hsize by -\leftskip %
654*7f2fe78bSCy Schubert\setbox0=\hbox{\itemfont{#1}}%
655*7f2fe78bSCy Schubert\itemindex{#1}%
656*7f2fe78bSCy Schubert\parskip=0in %
657*7f2fe78bSCy Schubert\noindent %
658*7f2fe78bSCy Schubert\ifdim \wd0>\itemmax %
659*7f2fe78bSCy Schubert\vadjust{\penalty 10000}%
660*7f2fe78bSCy Schubert\hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
661*7f2fe78bSCy Schubert\else %
662*7f2fe78bSCy Schubert\hbox to 0pt{\hskip -\tableindent\box0\hss}%
663*7f2fe78bSCy Schubert\fi %
664*7f2fe78bSCy Schubert\endgroup %
665*7f2fe78bSCy Schubert}
666*7f2fe78bSCy Schubert
667*7f2fe78bSCy Schubert\def\item{\errmessage{@item while not in a table}}
668*7f2fe78bSCy Schubert\def\itemx{\errmessage{@itemx while not in a table}}
669*7f2fe78bSCy Schubert\def\kitem{\errmessage{@kitem while not in a table}}
670*7f2fe78bSCy Schubert\def\kitemx{\errmessage{@kitemx while not in a table}}
671*7f2fe78bSCy Schubert\def\xitem{\errmessage{@xitem while not in a table}}
672*7f2fe78bSCy Schubert\def\xitemx{\errmessage{@xitemx while not in a table}}
673*7f2fe78bSCy Schubert
674*7f2fe78bSCy Schubert%% Contains a kludge to get @end[description] to work
675*7f2fe78bSCy Schubert\def\description{\tablez{\dontindex}{1}{}{}{}{}}
676*7f2fe78bSCy Schubert
677*7f2fe78bSCy Schubert\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
678*7f2fe78bSCy Schubert{\obeylines\obeyspaces%
679*7f2fe78bSCy Schubert\gdef\tablex #1^^M{%
680*7f2fe78bSCy Schubert\tabley\dontindex#1        \endtabley}}
681*7f2fe78bSCy Schubert
682*7f2fe78bSCy Schubert\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
683*7f2fe78bSCy Schubert{\obeylines\obeyspaces%
684*7f2fe78bSCy Schubert\gdef\ftablex #1^^M{%
685*7f2fe78bSCy Schubert\tabley\fnitemindex#1        \endtabley}}
686*7f2fe78bSCy Schubert
687*7f2fe78bSCy Schubert\def\dontindex #1{}
688*7f2fe78bSCy Schubert\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
689*7f2fe78bSCy Schubert
690*7f2fe78bSCy Schubert{\obeyspaces %
691*7f2fe78bSCy Schubert\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
692*7f2fe78bSCy Schubert\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
693*7f2fe78bSCy Schubert
694*7f2fe78bSCy Schubert\def\tablez #1#2#3#4#5#6{%
695*7f2fe78bSCy Schubert\aboveenvbreak %
696*7f2fe78bSCy Schubert\begingroup %
697*7f2fe78bSCy Schubert\def\Edescription{\Etable}% Neccessary kludge.
698*7f2fe78bSCy Schubert\let\itemindex=#1%
699*7f2fe78bSCy Schubert\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
700*7f2fe78bSCy Schubert\ifnum 0#4>0 \tableindent=#4\mil \fi %
701*7f2fe78bSCy Schubert\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
702*7f2fe78bSCy Schubert\def\itemfont{#2}%
703*7f2fe78bSCy Schubert\itemmax=\tableindent %
704*7f2fe78bSCy Schubert\advance \itemmax by -\itemmargin %
705*7f2fe78bSCy Schubert\advance \leftskip by \tableindent %
706*7f2fe78bSCy Schubert\parindent = 0pt
707*7f2fe78bSCy Schubert\parskip = \smallskipamount
708*7f2fe78bSCy Schubert\ifdim \parskip=0pt \parskip=2pt \fi%
709*7f2fe78bSCy Schubert\def\Etable{\endgraf\endgroup\afterenvbreak}%
710*7f2fe78bSCy Schubert\let\item = \internalBitem %
711*7f2fe78bSCy Schubert\let\itemx = \internalBitemx %
712*7f2fe78bSCy Schubert\let\kitem = \internalBkitem %
713*7f2fe78bSCy Schubert\let\kitemx = \internalBkitemx %
714*7f2fe78bSCy Schubert\let\xitem = \internalBxitem %
715*7f2fe78bSCy Schubert\let\xitemx = \internalBxitemx %
716*7f2fe78bSCy Schubert}
717*7f2fe78bSCy Schubert
718*7f2fe78bSCy Schubert% This is the counter used by @enumerate, which is really @itemize
719*7f2fe78bSCy Schubert
720*7f2fe78bSCy Schubert\newcount \itemno
721*7f2fe78bSCy Schubert
722*7f2fe78bSCy Schubert\def\itemize{\parsearg\itemizezzz}
723*7f2fe78bSCy Schubert
724*7f2fe78bSCy Schubert\def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
725*7f2fe78bSCy Schubert
726*7f2fe78bSCy Schubert\def\itemizey #1#2{%
727*7f2fe78bSCy Schubert\aboveenvbreak %
728*7f2fe78bSCy Schubert\begingroup %
729*7f2fe78bSCy Schubert\itemno = 0 %
730*7f2fe78bSCy Schubert\itemmax=\itemindent %
731*7f2fe78bSCy Schubert\advance \itemmax by -\itemmargin %
732*7f2fe78bSCy Schubert\advance \leftskip by \itemindent %
733*7f2fe78bSCy Schubert\parindent = 0pt
734*7f2fe78bSCy Schubert\parskip = \smallskipamount
735*7f2fe78bSCy Schubert\ifdim \parskip=0pt \parskip=2pt \fi%
736*7f2fe78bSCy Schubert\def#2{\endgraf\endgroup\afterenvbreak}%
737*7f2fe78bSCy Schubert\def\itemcontents{#1}%
738*7f2fe78bSCy Schubert\let\item=\itemizeitem}
739*7f2fe78bSCy Schubert
740*7f2fe78bSCy Schubert\def\bullet{$\ptexbullet$}
741*7f2fe78bSCy Schubert\def\minus{$-$}
742*7f2fe78bSCy Schubert
743*7f2fe78bSCy Schubert\def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
744*7f2fe78bSCy Schubert
745*7f2fe78bSCy Schubert% Definition of @item while inside @itemize.
746*7f2fe78bSCy Schubert
747*7f2fe78bSCy Schubert\def\itemizeitem{%
748*7f2fe78bSCy Schubert\advance\itemno by 1
749*7f2fe78bSCy Schubert{\let\par=\endgraf \smallbreak}%
750*7f2fe78bSCy Schubert\ifhmode \errmessage{\in hmode at itemizeitem}\fi
751*7f2fe78bSCy Schubert{\parskip=0in \hskip 0pt
752*7f2fe78bSCy Schubert\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
753*7f2fe78bSCy Schubert\vadjust{\penalty 300}}%
754*7f2fe78bSCy Schubert\flushcr}
755*7f2fe78bSCy Schubert
756*7f2fe78bSCy Schubert\message{indexing,}
757*7f2fe78bSCy Schubert% Index generation facilities
758*7f2fe78bSCy Schubert
759*7f2fe78bSCy Schubert% Define \newwrite to be identical to plain tex's \newwrite
760*7f2fe78bSCy Schubert% except not \outer, so it can be used within \newindex.
761*7f2fe78bSCy Schubert{\catcode`\@=11
762*7f2fe78bSCy Schubert\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
763*7f2fe78bSCy Schubert
764*7f2fe78bSCy Schubert% \newindex {foo} defines an index named foo.
765*7f2fe78bSCy Schubert% It automatically defines \fooindex such that
766*7f2fe78bSCy Schubert% \fooindex ...rest of line... puts an entry in the index foo.
767*7f2fe78bSCy Schubert% It also defines \fooindfile to be the number of the output channel for
768*7f2fe78bSCy Schubert% the file that	accumulates this index.  The file's extension is foo.
769*7f2fe78bSCy Schubert% The name of an index should be no more than 2 characters long
770*7f2fe78bSCy Schubert% for the sake of vms.
771*7f2fe78bSCy Schubert
772*7f2fe78bSCy Schubert\def\newindex #1{
773*7f2fe78bSCy Schubert\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
774*7f2fe78bSCy Schubert\openout \csname#1indfile\endcsname \jobname.#1	% Open the file
775*7f2fe78bSCy Schubert\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
776*7f2fe78bSCy Schubert\noexpand\doindex {#1}}
777*7f2fe78bSCy Schubert}
778*7f2fe78bSCy Schubert
779*7f2fe78bSCy Schubert% @defindex foo  ==  \newindex{foo}
780*7f2fe78bSCy Schubert
781*7f2fe78bSCy Schubert\def\defindex{\parsearg\newindex}
782*7f2fe78bSCy Schubert
783*7f2fe78bSCy Schubert% Define @defcodeindex, like @defindex except put all entries in @code.
784*7f2fe78bSCy Schubert
785*7f2fe78bSCy Schubert\def\newcodeindex #1{
786*7f2fe78bSCy Schubert\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
787*7f2fe78bSCy Schubert\openout \csname#1indfile\endcsname \jobname.#1	% Open the file
788*7f2fe78bSCy Schubert\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
789*7f2fe78bSCy Schubert\noexpand\docodeindex {#1}}
790*7f2fe78bSCy Schubert}
791*7f2fe78bSCy Schubert
792*7f2fe78bSCy Schubert\def\defcodeindex{\parsearg\newcodeindex}
793*7f2fe78bSCy Schubert
794*7f2fe78bSCy Schubert% @synindex foo bar    makes index foo feed into index bar.
795*7f2fe78bSCy Schubert% Do this instead of @defindex foo if you don't want it as a separate index.
796*7f2fe78bSCy Schubert\def\synindex #1 #2 {%
797*7f2fe78bSCy Schubert\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
798*7f2fe78bSCy Schubert\noexpand\doindex {#2}}%
799*7f2fe78bSCy Schubert}
800*7f2fe78bSCy Schubert
801*7f2fe78bSCy Schubert% @syncodeindex foo bar   similar, but put all entries made for index foo
802*7f2fe78bSCy Schubert% inside @code.
803*7f2fe78bSCy Schubert\def\syncodeindex #1 #2 {%
804*7f2fe78bSCy Schubert\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
805*7f2fe78bSCy Schubert\noexpand\docodeindex {#2}}%
806*7f2fe78bSCy Schubert}
807*7f2fe78bSCy Schubert
808*7f2fe78bSCy Schubert% Define \doindex, the driver for all \fooindex macros.
809*7f2fe78bSCy Schubert% Argument #1 is generated by the calling \fooindex macro,
810*7f2fe78bSCy Schubert%  and it is "foo", the name of the index.
811*7f2fe78bSCy Schubert
812*7f2fe78bSCy Schubert% \doindex just uses \parsearg; it calls \doind for the actual work.
813*7f2fe78bSCy Schubert% This is because \doind is more useful to call from other macros.
814*7f2fe78bSCy Schubert
815*7f2fe78bSCy Schubert% There is also \dosubind {index}{topic}{subtopic}
816*7f2fe78bSCy Schubert% which makes an entry in a two-level index such as the operation index.
817*7f2fe78bSCy Schubert
818*7f2fe78bSCy Schubert\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
819*7f2fe78bSCy Schubert\def\singleindexer #1{\doind{\indexname}{#1}}
820*7f2fe78bSCy Schubert
821*7f2fe78bSCy Schubert% like the previous two, but they put @code around the argument.
822*7f2fe78bSCy Schubert\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
823*7f2fe78bSCy Schubert\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
824*7f2fe78bSCy Schubert
825*7f2fe78bSCy Schubert\def\indexdummies{%
826*7f2fe78bSCy Schubert\def\bf{\realbackslash bf }%
827*7f2fe78bSCy Schubert\def\rm{\realbackslash rm }%
828*7f2fe78bSCy Schubert\def\sl{\realbackslash sl }%
829*7f2fe78bSCy Schubert\def\dots{\realbackslash dots }%
830*7f2fe78bSCy Schubert\def\copyright{\realbackslash copyright }%
831*7f2fe78bSCy Schubert}
832*7f2fe78bSCy Schubert
833*7f2fe78bSCy Schubert% \indexnofonts no-ops all font-change commands.
834*7f2fe78bSCy Schubert% This is used when outputting the strings to sort the index by.
835*7f2fe78bSCy Schubert\def\indexdummyfont#1{#1}
836*7f2fe78bSCy Schubert\def\indexnofonts{%
837*7f2fe78bSCy Schubert\let\code=\indexdummyfont
838*7f2fe78bSCy Schubert\let\samp=\indexdummyfont
839*7f2fe78bSCy Schubert\let\kbd=\indexdummyfont
840*7f2fe78bSCy Schubert\let\key=\indexdummyfont
841*7f2fe78bSCy Schubert\let\var=\indexdummyfont
842*7f2fe78bSCy Schubert}
843*7f2fe78bSCy Schubert
844*7f2fe78bSCy Schubert% To define \realbackslash, we must make \ not be an escape.
845*7f2fe78bSCy Schubert% We must first make another character (@) an escape
846*7f2fe78bSCy Schubert% so we do not become unable to do a definition.
847*7f2fe78bSCy Schubert
848*7f2fe78bSCy Schubert{\catcode`\@=0 \catcode`\\=\other
849*7f2fe78bSCy Schubert@gdef@realbackslash{\}}
850*7f2fe78bSCy Schubert
851*7f2fe78bSCy Schubert\let\indexbackslash=0  %overridden during \printindex.
852*7f2fe78bSCy Schubert
853*7f2fe78bSCy Schubert\def\doind #1#2{%
854*7f2fe78bSCy Schubert{\indexdummies % Must do this here, since \bf, etc expand at this stage
855*7f2fe78bSCy Schubert\count10=\lastpenalty %
856*7f2fe78bSCy Schubert\escapechar=`\\%
857*7f2fe78bSCy Schubert{\let\folio=0% Expand all macros now EXCEPT \folio
858*7f2fe78bSCy Schubert\def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
859*7f2fe78bSCy Schubert% so it will be output as is; and it will print as backslash in the indx.
860*7f2fe78bSCy Schubert%
861*7f2fe78bSCy Schubert% Now process the index-string once, with all font commands turned off,
862*7f2fe78bSCy Schubert% to get the string to sort the index by.
863*7f2fe78bSCy Schubert{\indexnofonts
864*7f2fe78bSCy Schubert\xdef\temp1{#2}%
865*7f2fe78bSCy Schubert}%
866*7f2fe78bSCy Schubert% Now produce the complete index entry.  We process the index-string again,
867*7f2fe78bSCy Schubert% this time with font commands expanded, to get what to print in the index.
868*7f2fe78bSCy Schubert\edef\temp{%
869*7f2fe78bSCy Schubert\write \csname#1indfile\endcsname{%
870*7f2fe78bSCy Schubert\realbackslash entry {\temp1}{\folio}{#2}}}%
871*7f2fe78bSCy Schubert\temp }%
872*7f2fe78bSCy Schubert\penalty\count10}}
873*7f2fe78bSCy Schubert
874*7f2fe78bSCy Schubert\def\dosubind #1#2#3{%
875*7f2fe78bSCy Schubert{\indexdummies % Must do this here, since \bf, etc expand at this stage
876*7f2fe78bSCy Schubert\count10=\lastpenalty %
877*7f2fe78bSCy Schubert\escapechar=`\\%
878*7f2fe78bSCy Schubert{\let\folio=0%
879*7f2fe78bSCy Schubert\def\rawbackslashxx{\indexbackslash}%
880*7f2fe78bSCy Schubert%
881*7f2fe78bSCy Schubert% Now process the index-string once, with all font commands turned off,
882*7f2fe78bSCy Schubert% to get the string to sort the index by.
883*7f2fe78bSCy Schubert{\indexnofonts
884*7f2fe78bSCy Schubert\xdef\temp1{#2 #3}%
885*7f2fe78bSCy Schubert}%
886*7f2fe78bSCy Schubert% Now produce the complete index entry.  We process the index-string again,
887*7f2fe78bSCy Schubert% this time with font commands expanded, to get what to print in the index.
888*7f2fe78bSCy Schubert\edef\temp{%
889*7f2fe78bSCy Schubert\write \csname#1indfile\endcsname{%
890*7f2fe78bSCy Schubert\realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
891*7f2fe78bSCy Schubert\temp }%
892*7f2fe78bSCy Schubert\penalty\count10}}
893*7f2fe78bSCy Schubert
894*7f2fe78bSCy Schubert% The index entry written in the file actually looks like
895*7f2fe78bSCy Schubert%  \entry {sortstring}{page}{topic}
896*7f2fe78bSCy Schubert% or
897*7f2fe78bSCy Schubert%  \entry {sortstring}{page}{topic}{subtopic}
898*7f2fe78bSCy Schubert% The texindex program reads in these files and writes files
899*7f2fe78bSCy Schubert% containing these kinds of lines:
900*7f2fe78bSCy Schubert%  \initial {c}
901*7f2fe78bSCy Schubert%     before the first topic whose initial is c
902*7f2fe78bSCy Schubert%  \entry {topic}{pagelist}
903*7f2fe78bSCy Schubert%     for a topic that is used without subtopics
904*7f2fe78bSCy Schubert%  \primary {topic}
905*7f2fe78bSCy Schubert%     for the beginning of a topic that is used with subtopics
906*7f2fe78bSCy Schubert%  \secondary {subtopic}{pagelist}
907*7f2fe78bSCy Schubert%     for each subtopic.
908*7f2fe78bSCy Schubert
909*7f2fe78bSCy Schubert% Define the user-accessible indexing commands
910*7f2fe78bSCy Schubert% @findex, @vindex, @kindex, @cindex.
911*7f2fe78bSCy Schubert
912*7f2fe78bSCy Schubert\def\findex {\fnindex}
913*7f2fe78bSCy Schubert\def\kindex {\kyindex}
914*7f2fe78bSCy Schubert\def\cindex {\cpindex}
915*7f2fe78bSCy Schubert\def\vindex {\vrindex}
916*7f2fe78bSCy Schubert\def\tindex {\tpindex}
917*7f2fe78bSCy Schubert\def\pindex {\pgindex}
918*7f2fe78bSCy Schubert
919*7f2fe78bSCy Schubert\def\cindexsub {\begingroup\obeylines\cindexsub}
920*7f2fe78bSCy Schubert{\obeylines %
921*7f2fe78bSCy Schubert\gdef\cindexsub "#1" #2^^M{\endgroup %
922*7f2fe78bSCy Schubert\dosubind{cp}{#2}{#1}}}
923*7f2fe78bSCy Schubert
924*7f2fe78bSCy Schubert% Define the macros used in formatting output of the sorted index material.
925*7f2fe78bSCy Schubert
926*7f2fe78bSCy Schubert% This is what you call to cause a particular index to get printed.
927*7f2fe78bSCy Schubert% Write
928*7f2fe78bSCy Schubert% @unnumbered Function Index
929*7f2fe78bSCy Schubert% @printindex fn
930*7f2fe78bSCy Schubert
931*7f2fe78bSCy Schubert\def\printindex{\parsearg\doprintindex}
932*7f2fe78bSCy Schubert
933*7f2fe78bSCy Schubert\def\doprintindex#1{\tex %
934*7f2fe78bSCy Schubert\catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
935*7f2fe78bSCy Schubert\catcode`\$=\other\catcode`\_=\other
936*7f2fe78bSCy Schubert\catcode`\~=\other
937*7f2fe78bSCy Schubert\def\indexbackslash{\rawbackslashxx}
938*7f2fe78bSCy Schubert\indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
939*7f2fe78bSCy Schubert\begindoublecolumns
940*7f2fe78bSCy Schubert\openin 1 \jobname.#1s
941*7f2fe78bSCy Schubert\ifeof 1 \else \closein 1 \input \jobname.#1s
942*7f2fe78bSCy Schubert\fi
943*7f2fe78bSCy Schubert\enddoublecolumns
944*7f2fe78bSCy Schubert\Etex}
945*7f2fe78bSCy Schubert
946*7f2fe78bSCy Schubert% These macros are used by the sorted index file itself.
947*7f2fe78bSCy Schubert% Change them to control the appearance of the index.
948*7f2fe78bSCy Schubert
949*7f2fe78bSCy Schubert% Same as \bigskipamount except no shrink.
950*7f2fe78bSCy Schubert% \balancecolumns gets confused if there is any shrink.
951*7f2fe78bSCy Schubert\newskip\initialskipamount \initialskipamount 12pt plus4pt
952*7f2fe78bSCy Schubert
953*7f2fe78bSCy Schubert\outer\def\initial #1{%
954*7f2fe78bSCy Schubert{\let\tentt=\sectt \let\sf=\sectt
955*7f2fe78bSCy Schubert\ifdim\lastskip<\initialskipamount
956*7f2fe78bSCy Schubert\removelastskip \penalty-200 \vskip \initialskipamount\fi
957*7f2fe78bSCy Schubert\line{\secbf#1\hfill}\kern 2pt\penalty3000}}
958*7f2fe78bSCy Schubert
959*7f2fe78bSCy Schubert\outer\def\entry #1#2{
960*7f2fe78bSCy Schubert{\parfillskip=0in \parskip=0in \parindent=0in
961*7f2fe78bSCy Schubert\hangindent=1in \hangafter=1%
962*7f2fe78bSCy Schubert\noindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll #2\par
963*7f2fe78bSCy Schubert}}
964*7f2fe78bSCy Schubert
965*7f2fe78bSCy Schubert\def\primary #1{\line{#1\hfil}}
966*7f2fe78bSCy Schubert
967*7f2fe78bSCy Schubert\newskip\secondaryindent \secondaryindent=0.5cm
968*7f2fe78bSCy Schubert
969*7f2fe78bSCy Schubert\def\secondary #1#2{
970*7f2fe78bSCy Schubert{\parfillskip=0in \parskip=0in
971*7f2fe78bSCy Schubert\hangindent =1in \hangafter=1
972*7f2fe78bSCy Schubert\noindent\hskip\secondaryindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll#2\par
973*7f2fe78bSCy Schubert}}
974*7f2fe78bSCy Schubert
975*7f2fe78bSCy Schubert%% Define two-column mode, which is used in indexes.
976*7f2fe78bSCy Schubert%% Adapted from the TeXBook, page 416
977*7f2fe78bSCy Schubert\catcode `\@=11
978*7f2fe78bSCy Schubert
979*7f2fe78bSCy Schubert\newbox\partialpage
980*7f2fe78bSCy Schubert
981*7f2fe78bSCy Schubert\newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
982*7f2fe78bSCy Schubert\newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
983*7f2fe78bSCy Schubert
984*7f2fe78bSCy Schubert\def\begindoublecolumns{\begingroup
985*7f2fe78bSCy Schubert  \output={\global\setbox\partialpage=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
986*7f2fe78bSCy Schubert  \output={\doublecolumnout} \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
987*7f2fe78bSCy Schubert\def\enddoublecolumns{\output={\balancecolumns}\eject
988*7f2fe78bSCy Schubert  \endgroup \pagegoal=\vsize}
989*7f2fe78bSCy Schubert
990*7f2fe78bSCy Schubert\def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
991*7f2fe78bSCy Schubert  \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
992*7f2fe78bSCy Schubert  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
993*7f2fe78bSCy Schubert  \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
994*7f2fe78bSCy Schubert\def\pagesofar{\unvbox\partialpage %
995*7f2fe78bSCy Schubert  \hsize=\doublecolumnhsize % have to restore this since output routine
996*7f2fe78bSCy Schubert%	      changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
997*7f2fe78bSCy Schubert  \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
998*7f2fe78bSCy Schubert\def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0
999*7f2fe78bSCy Schubert  \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
1000*7f2fe78bSCy Schubert  \divide\dimen@ by2 \splittopskip=\topskip
1001*7f2fe78bSCy Schubert  {\vbadness=10000 \loop \global\setbox3=\copy0
1002*7f2fe78bSCy Schubert    \global\setbox1=\vsplit3 to\dimen@
1003*7f2fe78bSCy Schubert    \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
1004*7f2fe78bSCy Schubert  \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
1005*7f2fe78bSCy Schubert  \pagesofar}
1006*7f2fe78bSCy Schubert
1007*7f2fe78bSCy Schubert\catcode `\@=\other
1008*7f2fe78bSCy Schubert\message{sectioning,}
1009*7f2fe78bSCy Schubert% Define chapters, sections, etc.
1010*7f2fe78bSCy Schubert
1011*7f2fe78bSCy Schubert\newcount \chapno
1012*7f2fe78bSCy Schubert\newcount \secno
1013*7f2fe78bSCy Schubert\newcount \subsecno
1014*7f2fe78bSCy Schubert\newcount \subsubsecno
1015*7f2fe78bSCy Schubert
1016*7f2fe78bSCy Schubert% This counter is funny since it counts through charcodes of letters A, B, ...
1017*7f2fe78bSCy Schubert\newcount \appendixno  \appendixno = `\@
1018*7f2fe78bSCy Schubert\def\appendixletter{\char\the\appendixno}
1019*7f2fe78bSCy Schubert
1020*7f2fe78bSCy Schubert\newwrite \contentsfile
1021*7f2fe78bSCy Schubert\openout \contentsfile = \jobname.toc
1022*7f2fe78bSCy Schubert
1023*7f2fe78bSCy Schubert% Each @chapter defines this as the name of the chapter.
1024*7f2fe78bSCy Schubert% page headings and footings can use it.  @section does likewise
1025*7f2fe78bSCy Schubert
1026*7f2fe78bSCy Schubert\def\thischapter{} \def\thissection{}
1027*7f2fe78bSCy Schubert\def\seccheck#1{\if \pageno<0 %
1028*7f2fe78bSCy Schubert\errmessage{@#1 not allowed after generating table of contents}\fi
1029*7f2fe78bSCy Schubert%
1030*7f2fe78bSCy Schubert}
1031*7f2fe78bSCy Schubert
1032*7f2fe78bSCy Schubert\outer\def\chapter{\parsearg\chapterzzz}
1033*7f2fe78bSCy Schubert\def\chapterzzz #1{\seccheck{chapter}%
1034*7f2fe78bSCy Schubert\secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
1035*7f2fe78bSCy Schubert\chapmacro {#1}{\the\chapno}%
1036*7f2fe78bSCy Schubert\gdef\thissection{#1}\gdef\thischapter{#1}%
1037*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1038*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1039*7f2fe78bSCy Schubert\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
1040*7f2fe78bSCy Schubert\escapechar=`\\%
1041*7f2fe78bSCy Schubert\write \contentsfile \temp  %
1042*7f2fe78bSCy Schubert\donoderef %
1043*7f2fe78bSCy Schubert}
1044*7f2fe78bSCy Schubert
1045*7f2fe78bSCy Schubert\outer\def\appendix{\parsearg\appendixzzz}
1046*7f2fe78bSCy Schubert\def\appendixzzz #1{\seccheck{appendix}%
1047*7f2fe78bSCy Schubert\secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
1048*7f2fe78bSCy Schubert\chapmacro {#1}{Appendix \appendixletter}%
1049*7f2fe78bSCy Schubert\gdef\thischapter{#1}\gdef\thissection{#1}%
1050*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1051*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1052*7f2fe78bSCy Schubert\edef\temp{{\realbackslash chapentry {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
1053*7f2fe78bSCy Schubert\escapechar=`\\%
1054*7f2fe78bSCy Schubert\write \contentsfile \temp  %
1055*7f2fe78bSCy Schubert\unnumbnoderef %
1056*7f2fe78bSCy Schubert}
1057*7f2fe78bSCy Schubert
1058*7f2fe78bSCy Schubert\outer\def\unnumbered{\parsearg\unnumberedzzz}
1059*7f2fe78bSCy Schubert\def\unnumberedzzz #1{\seccheck{unnumbered}%
1060*7f2fe78bSCy Schubert\secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
1061*7f2fe78bSCy Schubert\unnumbchapmacro {#1}%
1062*7f2fe78bSCy Schubert\gdef\thischapter{#1}\gdef\thissection{#1}%
1063*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1064*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1065*7f2fe78bSCy Schubert\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
1066*7f2fe78bSCy Schubert\escapechar=`\\%
1067*7f2fe78bSCy Schubert\write \contentsfile \temp  %
1068*7f2fe78bSCy Schubert\unnumbnoderef %
1069*7f2fe78bSCy Schubert}
1070*7f2fe78bSCy Schubert
1071*7f2fe78bSCy Schubert\outer\def\section{\parsearg\sectionzzz}
1072*7f2fe78bSCy Schubert\def\sectionzzz #1{\seccheck{section}%
1073*7f2fe78bSCy Schubert\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
1074*7f2fe78bSCy Schubert\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
1075*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1076*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1077*7f2fe78bSCy Schubert\edef\temp{{\realbackslash secentry %
1078*7f2fe78bSCy Schubert{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
1079*7f2fe78bSCy Schubert\escapechar=`\\%
1080*7f2fe78bSCy Schubert\write \contentsfile \temp %
1081*7f2fe78bSCy Schubert\donoderef %
1082*7f2fe78bSCy Schubert\penalty 10000 %
1083*7f2fe78bSCy Schubert}
1084*7f2fe78bSCy Schubert
1085*7f2fe78bSCy Schubert\outer\def\appendixsection{\parsearg\appendixsectionzzz}
1086*7f2fe78bSCy Schubert\outer\def\appendixsec{\parsearg\appendixsectionzzz}
1087*7f2fe78bSCy Schubert\def\appendixsectionzzz #1{\seccheck{appendixsection}%
1088*7f2fe78bSCy Schubert\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
1089*7f2fe78bSCy Schubert\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
1090*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1091*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1092*7f2fe78bSCy Schubert\edef\temp{{\realbackslash secentry %
1093*7f2fe78bSCy Schubert{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
1094*7f2fe78bSCy Schubert\escapechar=`\\%
1095*7f2fe78bSCy Schubert\write \contentsfile \temp %
1096*7f2fe78bSCy Schubert\unnumbnoderef %
1097*7f2fe78bSCy Schubert\penalty 10000 %
1098*7f2fe78bSCy Schubert}
1099*7f2fe78bSCy Schubert
1100*7f2fe78bSCy Schubert\outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
1101*7f2fe78bSCy Schubert\def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
1102*7f2fe78bSCy Schubert\plainsecheading {#1}\gdef\thissection{#1}%
1103*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1104*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1105*7f2fe78bSCy Schubert\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
1106*7f2fe78bSCy Schubert\escapechar=`\\%
1107*7f2fe78bSCy Schubert\write \contentsfile \temp %
1108*7f2fe78bSCy Schubert\unnumbnoderef %
1109*7f2fe78bSCy Schubert\penalty 10000 %
1110*7f2fe78bSCy Schubert}
1111*7f2fe78bSCy Schubert
1112*7f2fe78bSCy Schubert\outer\def\subsection{\parsearg\subsectionzzz}
1113*7f2fe78bSCy Schubert\def\subsectionzzz #1{\seccheck{subsection}%
1114*7f2fe78bSCy Schubert\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
1115*7f2fe78bSCy Schubert\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
1116*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1117*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1118*7f2fe78bSCy Schubert\edef\temp{{\realbackslash subsecentry %
1119*7f2fe78bSCy Schubert{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
1120*7f2fe78bSCy Schubert\escapechar=`\\%
1121*7f2fe78bSCy Schubert\write \contentsfile \temp %
1122*7f2fe78bSCy Schubert\donoderef %
1123*7f2fe78bSCy Schubert\penalty 10000 %
1124*7f2fe78bSCy Schubert}
1125*7f2fe78bSCy Schubert
1126*7f2fe78bSCy Schubert\outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
1127*7f2fe78bSCy Schubert\def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
1128*7f2fe78bSCy Schubert\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
1129*7f2fe78bSCy Schubert\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
1130*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1131*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1132*7f2fe78bSCy Schubert\edef\temp{{\realbackslash subsecentry %
1133*7f2fe78bSCy Schubert{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
1134*7f2fe78bSCy Schubert\escapechar=`\\%
1135*7f2fe78bSCy Schubert\write \contentsfile \temp %
1136*7f2fe78bSCy Schubert\unnumbnoderef %
1137*7f2fe78bSCy Schubert\penalty 10000 %
1138*7f2fe78bSCy Schubert}
1139*7f2fe78bSCy Schubert
1140*7f2fe78bSCy Schubert\outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
1141*7f2fe78bSCy Schubert\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
1142*7f2fe78bSCy Schubert\plainsecheading {#1}\gdef\thissection{#1}%
1143*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1144*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1145*7f2fe78bSCy Schubert\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
1146*7f2fe78bSCy Schubert\escapechar=`\\%
1147*7f2fe78bSCy Schubert\write \contentsfile \temp %
1148*7f2fe78bSCy Schubert\unnumbnoderef %
1149*7f2fe78bSCy Schubert\penalty 10000 %
1150*7f2fe78bSCy Schubert}
1151*7f2fe78bSCy Schubert
1152*7f2fe78bSCy Schubert\outer\def\subsubsection{\parsearg\subsubsectionzzz}
1153*7f2fe78bSCy Schubert\def\subsubsectionzzz #1{\seccheck{subsubsection}%
1154*7f2fe78bSCy Schubert\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
1155*7f2fe78bSCy Schubert\subsubsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
1156*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1157*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1158*7f2fe78bSCy Schubert\edef\temp{{\realbackslash subsubsecentry %
1159*7f2fe78bSCy Schubert{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
1160*7f2fe78bSCy Schubert\escapechar=`\\%
1161*7f2fe78bSCy Schubert\write \contentsfile \temp %
1162*7f2fe78bSCy Schubert\donoderef %
1163*7f2fe78bSCy Schubert\penalty 10000 %
1164*7f2fe78bSCy Schubert}
1165*7f2fe78bSCy Schubert
1166*7f2fe78bSCy Schubert\outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
1167*7f2fe78bSCy Schubert\def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
1168*7f2fe78bSCy Schubert\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
1169*7f2fe78bSCy Schubert\subsubsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
1170*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1171*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1172*7f2fe78bSCy Schubert\edef\temp{{\realbackslash subsubsecentry{#1}%
1173*7f2fe78bSCy Schubert{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
1174*7f2fe78bSCy Schubert\escapechar=`\\%
1175*7f2fe78bSCy Schubert\write \contentsfile \temp %
1176*7f2fe78bSCy Schubert\unnumbnoderef %
1177*7f2fe78bSCy Schubert\penalty 10000 %
1178*7f2fe78bSCy Schubert}
1179*7f2fe78bSCy Schubert
1180*7f2fe78bSCy Schubert\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
1181*7f2fe78bSCy Schubert\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
1182*7f2fe78bSCy Schubert\plainsecheading {#1}\gdef\thissection{#1}%
1183*7f2fe78bSCy Schubert\let\rawbackslash=\relax%
1184*7f2fe78bSCy Schubert\let\frenchspacing=\relax%
1185*7f2fe78bSCy Schubert\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
1186*7f2fe78bSCy Schubert\escapechar=`\\%
1187*7f2fe78bSCy Schubert\write \contentsfile \temp %
1188*7f2fe78bSCy Schubert\unnumbnoderef %
1189*7f2fe78bSCy Schubert\penalty 10000 %
1190*7f2fe78bSCy Schubert}
1191*7f2fe78bSCy Schubert
1192*7f2fe78bSCy Schubert% Define @majorheading, @heading and @subheading
1193*7f2fe78bSCy Schubert
1194*7f2fe78bSCy Schubert\outer\def\majorheading #1{%
1195*7f2fe78bSCy Schubert{\advance\chapheadingskip by 10pt \chapbreak }%
1196*7f2fe78bSCy Schubert{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200}
1197*7f2fe78bSCy Schubert
1198*7f2fe78bSCy Schubert\outer\def\chapheading #1{\chapbreak %
1199*7f2fe78bSCy Schubert{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200}
1200*7f2fe78bSCy Schubert
1201*7f2fe78bSCy Schubert\let\heading=\secheadingi
1202*7f2fe78bSCy Schubert\let\subheading=\subsecheadingi
1203*7f2fe78bSCy Schubert\let\subsubheading=\subsubsecheadingi
1204*7f2fe78bSCy Schubert
1205*7f2fe78bSCy Schubert% These macros generate a chapter, section, etc. heading only
1206*7f2fe78bSCy Schubert% (including whitespace, linebreaking, etc. around it),
1207*7f2fe78bSCy Schubert% given all the information in convenient, parsed form.
1208*7f2fe78bSCy Schubert
1209*7f2fe78bSCy Schubert%%% Args are the skip and penalty (usually negative)
1210*7f2fe78bSCy Schubert\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
1211*7f2fe78bSCy Schubert
1212*7f2fe78bSCy Schubert\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
1213*7f2fe78bSCy Schubert
1214*7f2fe78bSCy Schubert%%% Define plain chapter starts, and page on/off switching for it
1215*7f2fe78bSCy Schubert% Parameter controlling skip before chapter headings (if needed)
1216*7f2fe78bSCy Schubert
1217*7f2fe78bSCy Schubert\newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
1218*7f2fe78bSCy Schubert
1219*7f2fe78bSCy Schubert\def\chapbreak{\dobreak \chapheadingskip {-4000}}
1220*7f2fe78bSCy Schubert\def\chappager{\par\vfill\supereject}
1221*7f2fe78bSCy Schubert\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
1222*7f2fe78bSCy Schubert
1223*7f2fe78bSCy Schubert\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
1224*7f2fe78bSCy Schubert
1225*7f2fe78bSCy Schubert\def\CHAPPAGoff{
1226*7f2fe78bSCy Schubert\global\let\pchapsepmacro=\chapbreak
1227*7f2fe78bSCy Schubert\global\let\pagealignmacro=\chappager}
1228*7f2fe78bSCy Schubert
1229*7f2fe78bSCy Schubert\def\CHAPPAGon{
1230*7f2fe78bSCy Schubert\global\let\pchapsepmacro=\chappager
1231*7f2fe78bSCy Schubert\global\let\pagealignmacro=\chappager}
1232*7f2fe78bSCy Schubert
1233*7f2fe78bSCy Schubert\def\CHAPPAGodd{
1234*7f2fe78bSCy Schubert\global\let\pchapsepmacro=\chapoddpage
1235*7f2fe78bSCy Schubert\global\let\pagealignmacro=\chapoddpage}
1236*7f2fe78bSCy Schubert
1237*7f2fe78bSCy Schubert\CHAPPAGon
1238*7f2fe78bSCy Schubert
1239*7f2fe78bSCy Schubert\def\CHAPFplain{
1240*7f2fe78bSCy Schubert\global\let\chapmacro=\chfplain
1241*7f2fe78bSCy Schubert\global\let\unnumbchapmacro=\unnchfplain}
1242*7f2fe78bSCy Schubert
1243*7f2fe78bSCy Schubert\def\chfplain #1#2{%
1244*7f2fe78bSCy Schubert\pchapsepmacro %
1245*7f2fe78bSCy Schubert{\chapfonts \line{\chaprm #2.\enspace #1\hfill}}\bigskip \par\penalty 5000 %
1246*7f2fe78bSCy Schubert}
1247*7f2fe78bSCy Schubert
1248*7f2fe78bSCy Schubert\def\unnchfplain #1{%
1249*7f2fe78bSCy Schubert\pchapsepmacro %
1250*7f2fe78bSCy Schubert{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 %
1251*7f2fe78bSCy Schubert}
1252*7f2fe78bSCy Schubert\CHAPFplain % The default
1253*7f2fe78bSCy Schubert
1254*7f2fe78bSCy Schubert\def\unnchfopen #1{%
1255*7f2fe78bSCy Schubert\chapoddpage {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 %
1256*7f2fe78bSCy Schubert}
1257*7f2fe78bSCy Schubert
1258*7f2fe78bSCy Schubert\def\chfopen #1#2{\chapoddpage {\chapfonts
1259*7f2fe78bSCy Schubert\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
1260*7f2fe78bSCy Schubert\par\penalty 5000 %
1261*7f2fe78bSCy Schubert}
1262*7f2fe78bSCy Schubert
1263*7f2fe78bSCy Schubert\def\CHAPFopen{
1264*7f2fe78bSCy Schubert\global\let\chapmacro=\chfopen
1265*7f2fe78bSCy Schubert\global\let\unnumbchapmacro=\unnchfopen}
1266*7f2fe78bSCy Schubert
1267*7f2fe78bSCy Schubert% Parameter controlling skip before section headings.
1268*7f2fe78bSCy Schubert
1269*7f2fe78bSCy Schubert\newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
1270*7f2fe78bSCy Schubert\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
1271*7f2fe78bSCy Schubert
1272*7f2fe78bSCy Schubert\newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
1273*7f2fe78bSCy Schubert\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
1274*7f2fe78bSCy Schubert
1275*7f2fe78bSCy Schubert\def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
1276*7f2fe78bSCy Schubert\def\plainsecheading #1{\secheadingi {#1}}
1277*7f2fe78bSCy Schubert\def\secheadingi #1{{\advance \secheadingskip by \parskip %
1278*7f2fe78bSCy Schubert\secheadingbreak}%
1279*7f2fe78bSCy Schubert{\secfonts \line{\secrm #1\hfill}}%
1280*7f2fe78bSCy Schubert\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
1281*7f2fe78bSCy Schubert
1282*7f2fe78bSCy Schubert\def\subsecheading #1#2#3#4{{\advance \subsecheadingskip by \parskip %
1283*7f2fe78bSCy Schubert\subsecheadingbreak}%
1284*7f2fe78bSCy Schubert{\secfonts \line{\secrm#2.#3.#4\enspace #1\hfill}}%
1285*7f2fe78bSCy Schubert\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
1286*7f2fe78bSCy Schubert
1287*7f2fe78bSCy Schubert\def\subsubsecfonts{\subsecfonts} % Maybe this should change
1288*7f2fe78bSCy Schubert
1289*7f2fe78bSCy Schubert\def\subsubsecheading #1#2#3#4#5{{\advance \subsecheadingskip by \parskip %
1290*7f2fe78bSCy Schubert\subsecheadingbreak}%
1291*7f2fe78bSCy Schubert{\secfonts \line{\secrm#2.#3.#4.#5\enspace #1\hfill}}%
1292*7f2fe78bSCy Schubert\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
1293*7f2fe78bSCy Schubert
1294*7f2fe78bSCy Schubert\message{toc printing,}
1295*7f2fe78bSCy Schubert
1296*7f2fe78bSCy Schubert\def\Dotsbox{\hbox to 1em{\hss.\hss}} % Used by index macros
1297*7f2fe78bSCy Schubert
1298*7f2fe78bSCy Schubert\def\finishcontents{%
1299*7f2fe78bSCy Schubert\ifnum\pageno>0 %
1300*7f2fe78bSCy Schubert\pagealignmacro %
1301*7f2fe78bSCy Schubert\immediate\closeout \contentsfile%
1302*7f2fe78bSCy Schubert\pageno=-1		% Request roman numbered pages
1303*7f2fe78bSCy Schubert\fi}
1304*7f2fe78bSCy Schubert
1305*7f2fe78bSCy Schubert\outer\def\contents{%
1306*7f2fe78bSCy Schubert\finishcontents %
1307*7f2fe78bSCy Schubert\unnumbchapmacro{Table of Contents}
1308*7f2fe78bSCy Schubert\def\thischapter{Table of Contents}
1309*7f2fe78bSCy Schubert{\catcode`\\=0
1310*7f2fe78bSCy Schubert\catcode`\{=1		% Set up to handle contents files properly
1311*7f2fe78bSCy Schubert\catcode`\}=2
1312*7f2fe78bSCy Schubert\catcode`\@=11
1313*7f2fe78bSCy Schubert\input \jobname.toc
1314*7f2fe78bSCy Schubert}
1315*7f2fe78bSCy Schubert\vfill \eject}
1316*7f2fe78bSCy Schubert
1317*7f2fe78bSCy Schubert\outer\def\summarycontents{%
1318*7f2fe78bSCy Schubert\finishcontents %
1319*7f2fe78bSCy Schubert\unnumbchapmacro{Summary Table of Contents}
1320*7f2fe78bSCy Schubert\def\thischapter{Summary Table of Contents}
1321*7f2fe78bSCy Schubert{\catcode`\\=0
1322*7f2fe78bSCy Schubert\catcode`\{=1		% Set up to handle contents files properly
1323*7f2fe78bSCy Schubert\catcode`\}=2
1324*7f2fe78bSCy Schubert\catcode`\@=11
1325*7f2fe78bSCy Schubert\def\smallbreak{}
1326*7f2fe78bSCy Schubert\def\secentry ##1##2##3##4{}
1327*7f2fe78bSCy Schubert\def\subsecentry ##1##2##3##4##5{}
1328*7f2fe78bSCy Schubert\def\subsubsecentry ##1##2##3##4##5##6{}
1329*7f2fe78bSCy Schubert\def\unnumbsecentry ##1##2{}
1330*7f2fe78bSCy Schubert\def\unnumbsubsecentry ##1##2{}
1331*7f2fe78bSCy Schubert\def\unnumbsubsubsecentry ##1##2{}
1332*7f2fe78bSCy Schubert\let\medbreak=\smallbreak
1333*7f2fe78bSCy Schubert\input \jobname.toc
1334*7f2fe78bSCy Schubert}
1335*7f2fe78bSCy Schubert\vfill \eject}
1336*7f2fe78bSCy Schubert
1337*7f2fe78bSCy Schubert\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1338*7f2fe78bSCy Schubert
1339*7f2fe78bSCy Schubert% These macros generate individual entries in the table of contents
1340*7f2fe78bSCy Schubert% The first argument is the chapter or section name.
1341*7f2fe78bSCy Schubert% The last argument is the page number.
1342*7f2fe78bSCy Schubert% The arguments in between are the chapter number, section number, ...
1343*7f2fe78bSCy Schubert
1344*7f2fe78bSCy Schubert\def\chapentry #1#2#3{%
1345*7f2fe78bSCy Schubert\medbreak
1346*7f2fe78bSCy Schubert\line{#2.\space#1\leaders\hbox to 1em{\hss.\hss}\hfill #3}
1347*7f2fe78bSCy Schubert}
1348*7f2fe78bSCy Schubert
1349*7f2fe78bSCy Schubert\def\unnumbchapentry #1#2{%
1350*7f2fe78bSCy Schubert\medbreak
1351*7f2fe78bSCy Schubert\line{#1\leaders\Dotsbox\hfill #2}
1352*7f2fe78bSCy Schubert}
1353*7f2fe78bSCy Schubert
1354*7f2fe78bSCy Schubert\def\secentry #1#2#3#4{%
1355*7f2fe78bSCy Schubert\line{\enspace\enspace#2.#3\space#1\leaders\Dotsbox\hfill#4}
1356*7f2fe78bSCy Schubert}
1357*7f2fe78bSCy Schubert
1358*7f2fe78bSCy Schubert\def\unnumbsecentry #1#2{%
1359*7f2fe78bSCy Schubert\line{\enspace\enspace#1\leaders\Dotsbox\hfill #2}
1360*7f2fe78bSCy Schubert}
1361*7f2fe78bSCy Schubert
1362*7f2fe78bSCy Schubert\def\subsecentry #1#2#3#4#5{%
1363*7f2fe78bSCy Schubert\line{\enspace\enspace\enspace\enspace
1364*7f2fe78bSCy Schubert#2.#3.#4\space#1\leaders\Dotsbox\hfill #5}
1365*7f2fe78bSCy Schubert}
1366*7f2fe78bSCy Schubert
1367*7f2fe78bSCy Schubert\def\unnumbsubsecentry #1#2{%
1368*7f2fe78bSCy Schubert\line{\enspace\enspace\enspace\enspace#1\leaders\Dotsbox\hfill #2}
1369*7f2fe78bSCy Schubert}
1370*7f2fe78bSCy Schubert
1371*7f2fe78bSCy Schubert\def\subsubsecentry #1#2#3#4#5#6{%
1372*7f2fe78bSCy Schubert\line{\enspace\enspace\enspace\enspace\enspace\enspace
1373*7f2fe78bSCy Schubert#2.#3.#4.#5\space#1\leaders\Dotsbox\hfill #6}
1374*7f2fe78bSCy Schubert}
1375*7f2fe78bSCy Schubert
1376*7f2fe78bSCy Schubert\def\unnumbsubsubsecentry #1#2{%
1377*7f2fe78bSCy Schubert\line{\enspace\enspace\enspace\enspace\enspace\enspace#1\leaders\Dotsbox\hfill #2}
1378*7f2fe78bSCy Schubert}
1379*7f2fe78bSCy Schubert
1380*7f2fe78bSCy Schubert\message{environments,}
1381*7f2fe78bSCy Schubert
1382*7f2fe78bSCy Schubert% @tex ... @end tex    escapes into raw Tex temporarily.
1383*7f2fe78bSCy Schubert% One exception: @ is still an escape character, so that @end tex works.
1384*7f2fe78bSCy Schubert% But \@ or @@ will get a plain tex @ character.
1385*7f2fe78bSCy Schubert
1386*7f2fe78bSCy Schubert\def\tex{\begingroup
1387*7f2fe78bSCy Schubert\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
1388*7f2fe78bSCy Schubert\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
1389*7f2fe78bSCy Schubert\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
1390*7f2fe78bSCy Schubert\catcode `\%=14
1391*7f2fe78bSCy Schubert\catcode`\"=12
1392*7f2fe78bSCy Schubert\catcode`\|=12
1393*7f2fe78bSCy Schubert\catcode`\<=12
1394*7f2fe78bSCy Schubert\catcode`\>=12
1395*7f2fe78bSCy Schubert\escapechar=`\\
1396*7f2fe78bSCy Schubert%
1397*7f2fe78bSCy Schubert\let\{=\ptexlbrace
1398*7f2fe78bSCy Schubert\let\}=\ptexrbrace
1399*7f2fe78bSCy Schubert\let\.=\ptexdot
1400*7f2fe78bSCy Schubert\let\*=\ptexstar
1401*7f2fe78bSCy Schubert\def\@={@}%
1402*7f2fe78bSCy Schubert\let\bullet=\ptexbullet
1403*7f2fe78bSCy Schubert\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
1404*7f2fe78bSCy Schubert\let\L=\ptexL
1405*7f2fe78bSCy Schubert%
1406*7f2fe78bSCy Schubert\let\Etex=\endgroup}
1407*7f2fe78bSCy Schubert
1408*7f2fe78bSCy Schubert% Define @lisp ... @endlisp.
1409*7f2fe78bSCy Schubert% @lisp does a \begingroup so it can rebind things,
1410*7f2fe78bSCy Schubert% including the definition of @endlisp (which normally is erroneous).
1411*7f2fe78bSCy Schubert
1412*7f2fe78bSCy Schubert% Amount to narrow the margins by for @lisp.
1413*7f2fe78bSCy Schubert\newskip\lispnarrowing \lispnarrowing=0.4in
1414*7f2fe78bSCy Schubert
1415*7f2fe78bSCy Schubert% This is the definition that ^M gets inside @lisp
1416*7f2fe78bSCy Schubert% phr: changed space to \null, to avoid overfull hbox problems.
1417*7f2fe78bSCy Schubert{\obeyspaces%
1418*7f2fe78bSCy Schubert\gdef\lisppar{\null\endgraf}}
1419*7f2fe78bSCy Schubert
1420*7f2fe78bSCy Schubert% Cause \obeyspaces to make each Space cause a word-separation
1421*7f2fe78bSCy Schubert% rather than the default which is that it acts punctuation.
1422*7f2fe78bSCy Schubert% This is because space in tt font looks funny.
1423*7f2fe78bSCy Schubert{\obeyspaces %
1424*7f2fe78bSCy Schubert\gdef\sepspaces{\def {\ }}}
1425*7f2fe78bSCy Schubert
1426*7f2fe78bSCy Schubert\newskip\aboveenvskipamount \aboveenvskipamount= 0pt
1427*7f2fe78bSCy Schubert\def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
1428*7f2fe78bSCy Schubert\endgraf \ifdim\lastskip<\aboveenvskipamount
1429*7f2fe78bSCy Schubert\removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
1430*7f2fe78bSCy Schubert
1431*7f2fe78bSCy Schubert\def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
1432*7f2fe78bSCy Schubert\removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
1433*7f2fe78bSCy Schubert
1434*7f2fe78bSCy Schubert\def\lisp{\aboveenvbreak\begingroup\inENV %This group ends at the end of the @lisp body
1435*7f2fe78bSCy Schubert\hfuzz=12truept % Don't be fussy
1436*7f2fe78bSCy Schubert% Make spaces be word-separators rather than space tokens.
1437*7f2fe78bSCy Schubert\sepspaces %
1438*7f2fe78bSCy Schubert% Single space lines
1439*7f2fe78bSCy Schubert\singlespace %
1440*7f2fe78bSCy Schubert% The following causes blank lines not to be ignored
1441*7f2fe78bSCy Schubert% by adding a space to the end of each line.
1442*7f2fe78bSCy Schubert\let\par=\lisppar
1443*7f2fe78bSCy Schubert\def\Elisp{\endgroup\afterenvbreak}%
1444*7f2fe78bSCy Schubert\parskip=0pt \advance \rightskip by \lispnarrowing
1445*7f2fe78bSCy Schubert\advance \leftskip by \lispnarrowing
1446*7f2fe78bSCy Schubert\parindent=0pt
1447*7f2fe78bSCy Schubert\let\exdent=\internalexdent
1448*7f2fe78bSCy Schubert\obeyspaces \obeylines \tt \rawbackslash
1449*7f2fe78bSCy Schubert\def\next##1{}\next}
1450*7f2fe78bSCy Schubert
1451*7f2fe78bSCy Schubert
1452*7f2fe78bSCy Schubert\let\example=\lisp
1453*7f2fe78bSCy Schubert\def\Eexample{\Elisp}
1454*7f2fe78bSCy Schubert
1455*7f2fe78bSCy Schubert\let\smallexample=\lisp
1456*7f2fe78bSCy Schubert\def\Esmallexample{\Elisp}
1457*7f2fe78bSCy Schubert
1458*7f2fe78bSCy Schubert% Macro for 9 pt. examples, necessary to print with 5" lines.
1459*7f2fe78bSCy Schubert% From Pavel@xerox.  This is not really used unless the
1460*7f2fe78bSCy Schubert% @smallbook command is given.
1461*7f2fe78bSCy Schubert
1462*7f2fe78bSCy Schubert\def\smalllispx{\aboveenvbreak\begingroup\inENV
1463*7f2fe78bSCy Schubert%			This group ends at the end of the @lisp body
1464*7f2fe78bSCy Schubert\hfuzz=12truept % Don't be fussy
1465*7f2fe78bSCy Schubert% Make spaces be word-separators rather than space tokens.
1466*7f2fe78bSCy Schubert\sepspaces %
1467*7f2fe78bSCy Schubert% Single space lines
1468*7f2fe78bSCy Schubert\singlespace %
1469*7f2fe78bSCy Schubert% The following causes blank lines not to be ignored
1470*7f2fe78bSCy Schubert% by adding a space to the end of each line.
1471*7f2fe78bSCy Schubert\let\par=\lisppar
1472*7f2fe78bSCy Schubert\def\Esmalllisp{\endgroup\afterenvbreak}%
1473*7f2fe78bSCy Schubert\parskip=0pt \advance \rightskip by \lispnarrowing
1474*7f2fe78bSCy Schubert\advance \leftskip by \lispnarrowing
1475*7f2fe78bSCy Schubert\parindent=0pt
1476*7f2fe78bSCy Schubert\let\exdent=\internalexdent
1477*7f2fe78bSCy Schubert\obeyspaces \obeylines \ninett \rawbackslash
1478*7f2fe78bSCy Schubert\def\next##1{}\next}
1479*7f2fe78bSCy Schubert
1480*7f2fe78bSCy Schubert% This is @display; same as @lisp except use roman font.
1481*7f2fe78bSCy Schubert
1482*7f2fe78bSCy Schubert\def\display{\begingroup\inENV %This group ends at the end of the @display body
1483*7f2fe78bSCy Schubert\aboveenvbreak
1484*7f2fe78bSCy Schubert% Make spaces be word-separators rather than space tokens.
1485*7f2fe78bSCy Schubert\sepspaces %
1486*7f2fe78bSCy Schubert% Single space lines
1487*7f2fe78bSCy Schubert\singlespace %
1488*7f2fe78bSCy Schubert% The following causes blank lines not to be ignored
1489*7f2fe78bSCy Schubert% by adding a space to the end of each line.
1490*7f2fe78bSCy Schubert\let\par=\lisppar
1491*7f2fe78bSCy Schubert\def\Edisplay{\endgroup\afterenvbreak}%
1492*7f2fe78bSCy Schubert\parskip=0pt \advance \rightskip by \lispnarrowing
1493*7f2fe78bSCy Schubert\advance \leftskip by \lispnarrowing
1494*7f2fe78bSCy Schubert\parindent=0pt
1495*7f2fe78bSCy Schubert\let\exdent=\internalexdent
1496*7f2fe78bSCy Schubert\obeyspaces \obeylines
1497*7f2fe78bSCy Schubert\def\next##1{}\next}
1498*7f2fe78bSCy Schubert
1499*7f2fe78bSCy Schubert% This is @format; same as @lisp except use roman font and don't narrow margins
1500*7f2fe78bSCy Schubert
1501*7f2fe78bSCy Schubert\def\format{\begingroup\inENV %This group ends at the end of the @format body
1502*7f2fe78bSCy Schubert\aboveenvbreak
1503*7f2fe78bSCy Schubert% Make spaces be word-separators rather than space tokens.
1504*7f2fe78bSCy Schubert\sepspaces %
1505*7f2fe78bSCy Schubert\singlespace %
1506*7f2fe78bSCy Schubert% The following causes blank lines not to be ignored
1507*7f2fe78bSCy Schubert% by adding a space to the end of each line.
1508*7f2fe78bSCy Schubert\let\par=\lisppar
1509*7f2fe78bSCy Schubert\def\Eformat{\endgroup\afterenvbreak}
1510*7f2fe78bSCy Schubert\parskip=0pt \parindent=0pt
1511*7f2fe78bSCy Schubert\obeyspaces \obeylines
1512*7f2fe78bSCy Schubert\def\next##1{}\next}
1513*7f2fe78bSCy Schubert
1514*7f2fe78bSCy Schubert% @flushleft and @flushright
1515*7f2fe78bSCy Schubert
1516*7f2fe78bSCy Schubert\def\flushleft{\begingroup\inENV %This group ends at the end of the @format body
1517*7f2fe78bSCy Schubert\aboveenvbreak
1518*7f2fe78bSCy Schubert% Make spaces be word-separators rather than space tokens.
1519*7f2fe78bSCy Schubert\sepspaces %
1520*7f2fe78bSCy Schubert% The following causes blank lines not to be ignored
1521*7f2fe78bSCy Schubert% by adding a space to the end of each line.
1522*7f2fe78bSCy Schubert% This also causes @ to work when the directive name
1523*7f2fe78bSCy Schubert% is terminated by end of line.
1524*7f2fe78bSCy Schubert\let\par=\lisppar
1525*7f2fe78bSCy Schubert\def\Eflushleft{\endgroup\afterenvbreak}%
1526*7f2fe78bSCy Schubert\parskip=0pt \parindent=0pt
1527*7f2fe78bSCy Schubert\obeyspaces \obeylines
1528*7f2fe78bSCy Schubert\def\next##1{}\next}
1529*7f2fe78bSCy Schubert
1530*7f2fe78bSCy Schubert\def\flushright{\begingroup\inENV %This group ends at the end of the @format body
1531*7f2fe78bSCy Schubert\aboveenvbreak
1532*7f2fe78bSCy Schubert% Make spaces be word-separators rather than space tokens.
1533*7f2fe78bSCy Schubert\sepspaces %
1534*7f2fe78bSCy Schubert% The following causes blank lines not to be ignored
1535*7f2fe78bSCy Schubert% by adding a space to the end of each line.
1536*7f2fe78bSCy Schubert% This also causes @ to work when the directive name
1537*7f2fe78bSCy Schubert% is terminated by end of line.
1538*7f2fe78bSCy Schubert\let\par=\lisppar
1539*7f2fe78bSCy Schubert\def\Eflushright{\endgroup\afterenvbreak}%
1540*7f2fe78bSCy Schubert\parskip=0pt \parindent=0pt
1541*7f2fe78bSCy Schubert\advance \leftskip by 0pt plus 1fill
1542*7f2fe78bSCy Schubert\obeyspaces \obeylines
1543*7f2fe78bSCy Schubert\def\next##1{}\next}
1544*7f2fe78bSCy Schubert
1545*7f2fe78bSCy Schubert% @quotation - narrow the margins.
1546*7f2fe78bSCy Schubert
1547*7f2fe78bSCy Schubert\def\quotation{\begingroup\inENV %This group ends at the end of the @quotation body
1548*7f2fe78bSCy Schubert{\parskip=0pt  % because we will skip by \parskip too, later
1549*7f2fe78bSCy Schubert\aboveenvbreak}%
1550*7f2fe78bSCy Schubert\singlespace
1551*7f2fe78bSCy Schubert\parindent=0pt
1552*7f2fe78bSCy Schubert\def\Equotation{\par\endgroup\afterenvbreak}%
1553*7f2fe78bSCy Schubert\advance \rightskip by \lispnarrowing
1554*7f2fe78bSCy Schubert\advance \leftskip by \lispnarrowing}
1555*7f2fe78bSCy Schubert
1556*7f2fe78bSCy Schubert\message{defuns,}
1557*7f2fe78bSCy Schubert% Define formatter for defuns
1558*7f2fe78bSCy Schubert% First, allow user to change definition object font (\df) internally
1559*7f2fe78bSCy Schubert\def\setdeffont #1 {\csname DEF#1\endcsname}
1560*7f2fe78bSCy Schubert
1561*7f2fe78bSCy Schubert\newskip\defbodyindent \defbodyindent=36pt
1562*7f2fe78bSCy Schubert\newskip\defargsindent \defargsindent=50pt
1563*7f2fe78bSCy Schubert\newskip\deftypemargin \deftypemargin=12pt
1564*7f2fe78bSCy Schubert\newskip\deflastargmargin \deflastargmargin=18pt
1565*7f2fe78bSCy Schubert
1566*7f2fe78bSCy Schubert\newcount\parencount
1567*7f2fe78bSCy Schubert% define \functionparens, which makes ( and ) and & do special things.
1568*7f2fe78bSCy Schubert% \functionparens affects the group it is contained in.
1569*7f2fe78bSCy Schubert\def\activeparens{%
1570*7f2fe78bSCy Schubert\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
1571*7f2fe78bSCy Schubert\catcode`\[=\active \catcode`\]=\active}
1572*7f2fe78bSCy Schubert{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
1573*7f2fe78bSCy Schubert\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
1574*7f2fe78bSCy Schubert\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
1575*7f2fe78bSCy Schubert
1576*7f2fe78bSCy Schubert% Definitions of (, ) and & used in args for functions.
1577*7f2fe78bSCy Schubert% This is the definition of ( outside of all parentheses.
1578*7f2fe78bSCy Schubert\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
1579*7f2fe78bSCy Schubert\global\advance\parencount by 1 }
1580*7f2fe78bSCy Schubert%
1581*7f2fe78bSCy Schubert% This is the definition of ( when already inside a level of parens.
1582*7f2fe78bSCy Schubert\gdef\opnested{\char`\(\global\advance\parencount by 1 }
1583*7f2fe78bSCy Schubert%
1584*7f2fe78bSCy Schubert\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
1585*7f2fe78bSCy Schubert% also in that case restore the outer-level definition of (.
1586*7f2fe78bSCy Schubert\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
1587*7f2fe78bSCy Schubert\global\advance \parencount by -1 }
1588*7f2fe78bSCy Schubert% If we encounter &foo, then turn on ()-hacking afterwards
1589*7f2fe78bSCy Schubert\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
1590*7f2fe78bSCy Schubert%
1591*7f2fe78bSCy Schubert\gdef\normalparens{\boldbrax\let&=\ampnr}
1592*7f2fe78bSCy Schubert} % End of definition inside \activeparens
1593*7f2fe78bSCy Schubert%% These parens (in \boldbrax) actually are a little bolder than the
1594*7f2fe78bSCy Schubert%% contained text.  This is especially needed for [ and ]
1595*7f2fe78bSCy Schubert\def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
1596*7f2fe78bSCy Schubert\def\lbrb{{\tt\char`\[}} \def\rbrb{{\tt\char`\]}}
1597*7f2fe78bSCy Schubert
1598*7f2fe78bSCy Schubert% First, defname, which formats the header line itself.
1599*7f2fe78bSCy Schubert% #1 should be the function name.
1600*7f2fe78bSCy Schubert% #2 should be the type of definition, such as "Function".
1601*7f2fe78bSCy Schubert
1602*7f2fe78bSCy Schubert\def\defname #1#2{%
1603*7f2fe78bSCy Schubert\leftskip = 0in  %
1604*7f2fe78bSCy Schubert\noindent        %
1605*7f2fe78bSCy Schubert\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
1606*7f2fe78bSCy Schubert\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
1607*7f2fe78bSCy Schubert\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
1608*7f2fe78bSCy Schubert\parshape 2 0in \dimen0 \defargsindent \dimen1     %
1609*7f2fe78bSCy Schubert% Now output arg 2 ("Function" or some such)
1610*7f2fe78bSCy Schubert% ending at \deftypemargin from the right margin,
1611*7f2fe78bSCy Schubert% but stuck inside a box of width 0 so it does not interfere with linebreaking
1612*7f2fe78bSCy Schubert\rlap{\rightline{{\rm #2}\hskip \deftypemargin}}%
1613*7f2fe78bSCy Schubert\tolerance=10000 \hbadness=10000    % Make all lines underfull and no complaints
1614*7f2fe78bSCy Schubert{\df #1}\enskip        % Generate function name
1615*7f2fe78bSCy Schubert}
1616*7f2fe78bSCy Schubert
1617*7f2fe78bSCy Schubert% Actually process the body of a definition
1618*7f2fe78bSCy Schubert% #1 should be the terminating control sequence, such as \Edefun.
1619*7f2fe78bSCy Schubert% #2 should be the "another name" control sequence, such as \defunx.
1620*7f2fe78bSCy Schubert% #3 should be the control sequence that actually processes the header,
1621*7f2fe78bSCy Schubert%    such as \defunheader.
1622*7f2fe78bSCy Schubert
1623*7f2fe78bSCy Schubert\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
1624*7f2fe78bSCy Schubert\medbreak %
1625*7f2fe78bSCy Schubert% Define the end token that this defining construct specifies
1626*7f2fe78bSCy Schubert% so that it will exit this group.
1627*7f2fe78bSCy Schubert\def#1{\endgraf\endgroup\medbreak}%
1628*7f2fe78bSCy Schubert\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
1629*7f2fe78bSCy Schubert\parindent=0in \leftskip=\defbodyindent %
1630*7f2fe78bSCy Schubert\begingroup\obeylines\activeparens\spacesplit#3}
1631*7f2fe78bSCy Schubert
1632*7f2fe78bSCy Schubert\def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
1633*7f2fe78bSCy Schubert\medbreak %
1634*7f2fe78bSCy Schubert% Define the end token that this defining construct specifies
1635*7f2fe78bSCy Schubert% so that it will exit this group.
1636*7f2fe78bSCy Schubert\def#1{\endgraf\endgroup\medbreak}%
1637*7f2fe78bSCy Schubert\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
1638*7f2fe78bSCy Schubert\parindent=0in \leftskip=\defbodyindent %
1639*7f2fe78bSCy Schubert\begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
1640*7f2fe78bSCy Schubert
1641*7f2fe78bSCy Schubert% Split up #2 at the first space token.
1642*7f2fe78bSCy Schubert% call #1 with two arguments:
1643*7f2fe78bSCy Schubert%  the first is all of #2 before the space token,
1644*7f2fe78bSCy Schubert%  the second is all of #2 after that space token.
1645*7f2fe78bSCy Schubert% If #2 contains no space token, all of it is passed as the first arg
1646*7f2fe78bSCy Schubert% and the second is passed as empty.
1647*7f2fe78bSCy Schubert
1648*7f2fe78bSCy Schubert{\obeylines
1649*7f2fe78bSCy Schubert\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
1650*7f2fe78bSCy Schubert\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
1651*7f2fe78bSCy Schubert\ifx\relax #3%
1652*7f2fe78bSCy Schubert#1{#2}{}\else #1{#2}{#3#4}\fi}}
1653*7f2fe78bSCy Schubert
1654*7f2fe78bSCy Schubert% So much for the things common to all kinds of definitions.
1655*7f2fe78bSCy Schubert
1656*7f2fe78bSCy Schubert% Define @defun.
1657*7f2fe78bSCy Schubert
1658*7f2fe78bSCy Schubert% First, define the processing that is wanted for arguments of \defun
1659*7f2fe78bSCy Schubert% Use this to expand the args and terminate the paragraph they make up
1660*7f2fe78bSCy Schubert
1661*7f2fe78bSCy Schubert\def\defunargs #1{\functionparens \sl #1%
1662*7f2fe78bSCy Schubert\ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
1663*7f2fe78bSCy Schubert\interlinepenalty=10000
1664*7f2fe78bSCy Schubert\endgraf\vskip -\parskip \penalty 10000}
1665*7f2fe78bSCy Schubert
1666*7f2fe78bSCy Schubert% Do complete processing of one @defun or @defunx line already parsed.
1667*7f2fe78bSCy Schubert
1668*7f2fe78bSCy Schubert% @deffn Command forward-char nchars
1669*7f2fe78bSCy Schubert
1670*7f2fe78bSCy Schubert\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
1671*7f2fe78bSCy Schubert
1672*7f2fe78bSCy Schubert\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
1673*7f2fe78bSCy Schubert\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup}
1674*7f2fe78bSCy Schubert
1675*7f2fe78bSCy Schubert% @defun == @deffn Function
1676*7f2fe78bSCy Schubert
1677*7f2fe78bSCy Schubert\def\defun{\defparsebody\Edefun\defunx\defunheader}
1678*7f2fe78bSCy Schubert
1679*7f2fe78bSCy Schubert\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
1680*7f2fe78bSCy Schubert\begingroup\defname {#1}{Function}%
1681*7f2fe78bSCy Schubert\defunargs {#2}\endgroup %
1682*7f2fe78bSCy Schubert}
1683*7f2fe78bSCy Schubert
1684*7f2fe78bSCy Schubert% @defmac == @deffn Macro
1685*7f2fe78bSCy Schubert
1686*7f2fe78bSCy Schubert\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
1687*7f2fe78bSCy Schubert
1688*7f2fe78bSCy Schubert\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
1689*7f2fe78bSCy Schubert\begingroup\defname {#1}{Macro}%
1690*7f2fe78bSCy Schubert\defunargs {#2}\endgroup %
1691*7f2fe78bSCy Schubert}
1692*7f2fe78bSCy Schubert
1693*7f2fe78bSCy Schubert% @defspec == @deffn Special Form
1694*7f2fe78bSCy Schubert
1695*7f2fe78bSCy Schubert\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
1696*7f2fe78bSCy Schubert
1697*7f2fe78bSCy Schubert\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
1698*7f2fe78bSCy Schubert\begingroup\defname {#1}{Special form}%
1699*7f2fe78bSCy Schubert\defunargs {#2}\endgroup %
1700*7f2fe78bSCy Schubert}
1701*7f2fe78bSCy Schubert
1702*7f2fe78bSCy Schubert% This definition is run if you use @defunx
1703*7f2fe78bSCy Schubert% anywhere other than immediately after a @defun or @defunx.
1704*7f2fe78bSCy Schubert
1705*7f2fe78bSCy Schubert\def\deffnx #1 {\errmessage{@deffnx in invalid context}}
1706*7f2fe78bSCy Schubert\def\defunx #1 {\errmessage{@defunx in invalid context}}
1707*7f2fe78bSCy Schubert\def\defmacx #1 {\errmessage{@defmacx in invalid context}}
1708*7f2fe78bSCy Schubert\def\defspecx #1 {\errmessage{@defspecx in invalid context}}
1709*7f2fe78bSCy Schubert
1710*7f2fe78bSCy Schubert% @defmethod, and so on
1711*7f2fe78bSCy Schubert
1712*7f2fe78bSCy Schubert% @defop {Funny Method} foo-class frobnicate argument
1713*7f2fe78bSCy Schubert
1714*7f2fe78bSCy Schubert\def\defop #1 {\def\defoptype{#1}%
1715*7f2fe78bSCy Schubert\defmethparsebody\Edefop\defopx\defopheader}
1716*7f2fe78bSCy Schubert
1717*7f2fe78bSCy Schubert\def\defopheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
1718*7f2fe78bSCy Schubert\begingroup\defname {#2}{\defoptype{} on #1}%
1719*7f2fe78bSCy Schubert\defunargs {#3}\endgroup %
1720*7f2fe78bSCy Schubert}
1721*7f2fe78bSCy Schubert
1722*7f2fe78bSCy Schubert% @defmethod == @defop Method
1723*7f2fe78bSCy Schubert
1724*7f2fe78bSCy Schubert\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
1725*7f2fe78bSCy Schubert
1726*7f2fe78bSCy Schubert\def\defmethodheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% entry in function index
1727*7f2fe78bSCy Schubert\begingroup\defname {#2}{Operation on #1}%
1728*7f2fe78bSCy Schubert\defunargs {#3}\endgroup %
1729*7f2fe78bSCy Schubert}
1730*7f2fe78bSCy Schubert
1731*7f2fe78bSCy Schubert% @defcv {Class Option} foo-class foo-flag
1732*7f2fe78bSCy Schubert
1733*7f2fe78bSCy Schubert\def\defcv #1 {\def\defcvtype{#1}%
1734*7f2fe78bSCy Schubert\defmethparsebody\Edefcv\defcvx\defcvheader}
1735*7f2fe78bSCy Schubert
1736*7f2fe78bSCy Schubert\def\defcvarheader #1#2#3{%
1737*7f2fe78bSCy Schubert\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
1738*7f2fe78bSCy Schubert\begingroup\defname {#2}{\defcvtype of #1}%
1739*7f2fe78bSCy Schubert\defvarargs {#3}\endgroup %
1740*7f2fe78bSCy Schubert}
1741*7f2fe78bSCy Schubert
1742*7f2fe78bSCy Schubert% @defivar == @defcv {Instance Variable}
1743*7f2fe78bSCy Schubert
1744*7f2fe78bSCy Schubert\def\defivar{\defmethparsebody\Edefivar\defivarx\defivarheader}
1745*7f2fe78bSCy Schubert
1746*7f2fe78bSCy Schubert\def\defivarheader #1#2#3{%
1747*7f2fe78bSCy Schubert\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
1748*7f2fe78bSCy Schubert\begingroup\defname {#2}{Instance variable of #1}%
1749*7f2fe78bSCy Schubert\defvarargs {#3}\endgroup %
1750*7f2fe78bSCy Schubert}
1751*7f2fe78bSCy Schubert
1752*7f2fe78bSCy Schubert% These definitions are run if you use @defmethodx, etc.,
1753*7f2fe78bSCy Schubert% anywhere other than immediately after a @defmethod, etc.
1754*7f2fe78bSCy Schubert
1755*7f2fe78bSCy Schubert\def\defopx #1 {\errmessage{@defopx in invalid context}}
1756*7f2fe78bSCy Schubert\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
1757*7f2fe78bSCy Schubert\def\defcvx #1 {\errmessage{@defcvx in invalid context}}
1758*7f2fe78bSCy Schubert\def\defivarx #1 {\errmessage{@defivarx in invalid context}}
1759*7f2fe78bSCy Schubert
1760*7f2fe78bSCy Schubert% Now @defvar
1761*7f2fe78bSCy Schubert
1762*7f2fe78bSCy Schubert% First, define the processing that is wanted for arguments of @defvar.
1763*7f2fe78bSCy Schubert% This is actually simple: just print them in roman.
1764*7f2fe78bSCy Schubert% This must expand the args and terminate the paragraph they make up
1765*7f2fe78bSCy Schubert\def\defvarargs #1{\normalparens #1%
1766*7f2fe78bSCy Schubert\interlinepenalty=10000
1767*7f2fe78bSCy Schubert\endgraf\vskip -\parskip \penalty 10000}
1768*7f2fe78bSCy Schubert
1769*7f2fe78bSCy Schubert% @defvr Counter foo-count
1770*7f2fe78bSCy Schubert
1771*7f2fe78bSCy Schubert\def\defvr{\defmethparsebody\Edefvr\defvrx\defvrheader}
1772*7f2fe78bSCy Schubert
1773*7f2fe78bSCy Schubert\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
1774*7f2fe78bSCy Schubert\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
1775*7f2fe78bSCy Schubert
1776*7f2fe78bSCy Schubert% @defvar == @defvr Variable
1777*7f2fe78bSCy Schubert
1778*7f2fe78bSCy Schubert\def\defvar{\defparsebody\Edefvar\defvarx\defvarheader}
1779*7f2fe78bSCy Schubert
1780*7f2fe78bSCy Schubert\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
1781*7f2fe78bSCy Schubert\begingroup\defname {#1}{Variable}%
1782*7f2fe78bSCy Schubert\defvarargs {#2}\endgroup %
1783*7f2fe78bSCy Schubert}
1784*7f2fe78bSCy Schubert
1785*7f2fe78bSCy Schubert% @defopt == @defvr {User Option}
1786*7f2fe78bSCy Schubert
1787*7f2fe78bSCy Schubert\def\defopt{\defparsebody\Edefopt\defoptx\defoptheader}
1788*7f2fe78bSCy Schubert
1789*7f2fe78bSCy Schubert\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
1790*7f2fe78bSCy Schubert\begingroup\defname {#1}{User Option}%
1791*7f2fe78bSCy Schubert\defvarargs {#2}\endgroup %
1792*7f2fe78bSCy Schubert}
1793*7f2fe78bSCy Schubert
1794*7f2fe78bSCy Schubert% This definition is run if you use @defvarx
1795*7f2fe78bSCy Schubert% anywhere other than immediately after a @defvar or @defvarx.
1796*7f2fe78bSCy Schubert
1797*7f2fe78bSCy Schubert\def\defvrx #1 {\errmessage{@defvrx in invalid context}}
1798*7f2fe78bSCy Schubert\def\defvarx #1 {\errmessage{@defvarx in invalid context}}
1799*7f2fe78bSCy Schubert\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
1800*7f2fe78bSCy Schubert
1801*7f2fe78bSCy Schubert% Now define @deftp
1802*7f2fe78bSCy Schubert% Args are printed in bold, a slight difference from @defvar.
1803*7f2fe78bSCy Schubert
1804*7f2fe78bSCy Schubert\def\deftpargs #1{\bf \defvarargs{#1}}
1805*7f2fe78bSCy Schubert
1806*7f2fe78bSCy Schubert% @deftp Class window height width ...
1807*7f2fe78bSCy Schubert
1808*7f2fe78bSCy Schubert\def\deftp{\defmethparsebody\Edeftp\deftpx\deftpheader}
1809*7f2fe78bSCy Schubert
1810*7f2fe78bSCy Schubert\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
1811*7f2fe78bSCy Schubert\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
1812*7f2fe78bSCy Schubert
1813*7f2fe78bSCy Schubert% This definition is run if you use @deftpx, etc
1814*7f2fe78bSCy Schubert% anywhere other than immediately after a @deftp, etc.
1815*7f2fe78bSCy Schubert
1816*7f2fe78bSCy Schubert\def\deftpx #1 {\errmessage{@deftpx in invalid context}}
1817*7f2fe78bSCy Schubert
1818*7f2fe78bSCy Schubert\message{cross reference,}
1819*7f2fe78bSCy Schubert% Define cross-reference macros
1820*7f2fe78bSCy Schubert\newwrite \auxfile
1821*7f2fe78bSCy Schubert
1822*7f2fe78bSCy Schubert% \setref{foo} defines a cross-reference point named foo.
1823*7f2fe78bSCy Schubert
1824*7f2fe78bSCy Schubert\def\setref#1{%
1825*7f2fe78bSCy Schubert\dosetq{#1-pg}{Ypagenumber}%
1826*7f2fe78bSCy Schubert\dosetq{#1-snt}{Ysectionnumberandtype}}
1827*7f2fe78bSCy Schubert
1828*7f2fe78bSCy Schubert\def\unnumbsetref#1{%
1829*7f2fe78bSCy Schubert\dosetq{#1-pg}{Ypagenumber}%
1830*7f2fe78bSCy Schubert\dosetq{#1-snt}{Ynothing}}
1831*7f2fe78bSCy Schubert
1832*7f2fe78bSCy Schubert% \xref and \pxref generate cross references to specified points.
1833*7f2fe78bSCy Schubert
1834*7f2fe78bSCy Schubert\def\pxref #1{see \xrefX [#1,,,,,,,]}
1835*7f2fe78bSCy Schubert\def\xref #1{See \xrefX [#1,,,,,,,]}
1836*7f2fe78bSCy Schubert\def\xrefX [#1,#2,#3,#4,#5,#6]{%
1837*7f2fe78bSCy Schubert\setbox1=\hbox{\i{\losespace#5{}}}%
1838*7f2fe78bSCy Schubert\setbox0=\hbox{\losespace#3{}}%
1839*7f2fe78bSCy Schubert\ifdim \wd0 =0pt \setbox0=\hbox{\losespace#1{}}\fi%
1840*7f2fe78bSCy Schubert\ifdim \wd1 >0pt%
1841*7f2fe78bSCy Schubertsection \unhbox0{} in \unhbox1%
1842*7f2fe78bSCy Schubert\else%
1843*7f2fe78bSCy Schubert\refx{#1-snt} [\unhbox0], page\tie \refx{#1-pg}%
1844*7f2fe78bSCy Schubert\fi }
1845*7f2fe78bSCy Schubert
1846*7f2fe78bSCy Schubert% \dosetq is the interface for calls from other macros
1847*7f2fe78bSCy Schubert
1848*7f2fe78bSCy Schubert\def\dosetq #1#2{{\let\folio=0%
1849*7f2fe78bSCy Schubert\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
1850*7f2fe78bSCy Schubert\next}}
1851*7f2fe78bSCy Schubert
1852*7f2fe78bSCy Schubert% \internalsetq {foo}{page} expands into CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
1853*7f2fe78bSCy Schubert% When the aux file is read, ' is the escape character
1854*7f2fe78bSCy Schubert
1855*7f2fe78bSCy Schubert\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
1856*7f2fe78bSCy Schubert
1857*7f2fe78bSCy Schubert% Things to be expanded by \internalsetq
1858*7f2fe78bSCy Schubert
1859*7f2fe78bSCy Schubert\def\Ypagenumber{\folio}
1860*7f2fe78bSCy Schubert
1861*7f2fe78bSCy Schubert\def\Ynothing{}
1862*7f2fe78bSCy Schubert
1863*7f2fe78bSCy Schubert\def\Ysectionnumberandtype{%
1864*7f2fe78bSCy Schubert\ifnum\secno=0 chapter\xreftie\the\chapno %
1865*7f2fe78bSCy Schubert\else \ifnum \subsecno=0 section\xreftie\the\chapno.\the\secno %
1866*7f2fe78bSCy Schubert\else \ifnum \subsubsecno=0 %
1867*7f2fe78bSCy Schubertsection\xreftie\the\chapno.\the\secno.\the\subsecno %
1868*7f2fe78bSCy Schubert\else %
1869*7f2fe78bSCy Schubertsection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
1870*7f2fe78bSCy Schubert\fi \fi \fi }
1871*7f2fe78bSCy Schubert
1872*7f2fe78bSCy Schubert\gdef\xreftie{'tie}
1873*7f2fe78bSCy Schubert
1874*7f2fe78bSCy Schubert% Define @refx to reference a specific cross-reference string.
1875*7f2fe78bSCy Schubert
1876*7f2fe78bSCy Schubert\def\refx#1{%
1877*7f2fe78bSCy Schubert{%
1878*7f2fe78bSCy Schubert\expandafter\ifx\csname X#1\endcsname\relax
1879*7f2fe78bSCy Schubert% If not defined, say something at least.
1880*7f2fe78bSCy Schubert\expandafter\gdef\csname X#1\endcsname {$<$undefined$>$}%
1881*7f2fe78bSCy Schubert\message {WARNING: Cross-reference "#1" used but not yet defined}%
1882*7f2fe78bSCy Schubert\message {}%
1883*7f2fe78bSCy Schubert\fi %
1884*7f2fe78bSCy Schubert\csname X#1\endcsname %It's defined, so just use it.
1885*7f2fe78bSCy Schubert}}
1886*7f2fe78bSCy Schubert
1887*7f2fe78bSCy Schubert% Read the last existing aux file, if any.  No error if none exists.
1888*7f2fe78bSCy Schubert
1889*7f2fe78bSCy Schubert% This is the macro invoked by entries in the aux file.
1890*7f2fe78bSCy Schubert\def\xrdef #1#2{
1891*7f2fe78bSCy Schubert{\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
1892*7f2fe78bSCy Schubert
1893*7f2fe78bSCy Schubert{
1894*7f2fe78bSCy Schubert\catcode `\^^@=\other
1895*7f2fe78bSCy Schubert\catcode `\^^A=\other
1896*7f2fe78bSCy Schubert\catcode `\^^B=\other
1897*7f2fe78bSCy Schubert\catcode `\^^C=\other
1898*7f2fe78bSCy Schubert\catcode `\^^D=\other
1899*7f2fe78bSCy Schubert\catcode `\^^E=\other
1900*7f2fe78bSCy Schubert\catcode `\^^F=\other
1901*7f2fe78bSCy Schubert\catcode `\^^G=\other
1902*7f2fe78bSCy Schubert\catcode `\^^H=\other
1903*7f2fe78bSCy Schubert\catcode `\^^K=\other
1904*7f2fe78bSCy Schubert\catcode `\^^L=\other
1905*7f2fe78bSCy Schubert\catcode `\^^N=\other
1906*7f2fe78bSCy Schubert\catcode `\^^O=\other
1907*7f2fe78bSCy Schubert\catcode `\^^P=\other
1908*7f2fe78bSCy Schubert\catcode `\^^Q=\other
1909*7f2fe78bSCy Schubert\catcode `\^^R=\other
1910*7f2fe78bSCy Schubert\catcode `\^^S=\other
1911*7f2fe78bSCy Schubert\catcode `\^^T=\other
1912*7f2fe78bSCy Schubert\catcode `\^^U=\other
1913*7f2fe78bSCy Schubert\catcode `\^^V=\other
1914*7f2fe78bSCy Schubert\catcode `\^^W=\other
1915*7f2fe78bSCy Schubert\catcode `\^^X=\other
1916*7f2fe78bSCy Schubert\catcode `\^^Y=\other
1917*7f2fe78bSCy Schubert\catcode `\^^Z=\other
1918*7f2fe78bSCy Schubert\catcode `\^^[=\other
1919*7f2fe78bSCy Schubert\catcode `\^^\=\other
1920*7f2fe78bSCy Schubert\catcode `\^^]=\other
1921*7f2fe78bSCy Schubert\catcode `\^^^=\other
1922*7f2fe78bSCy Schubert\catcode `\^^_=\other
1923*7f2fe78bSCy Schubert\catcode `\@=\other
1924*7f2fe78bSCy Schubert\catcode `\^=\other
1925*7f2fe78bSCy Schubert\catcode `\~=\other
1926*7f2fe78bSCy Schubert\catcode `\[=\other
1927*7f2fe78bSCy Schubert\catcode `\]=\other
1928*7f2fe78bSCy Schubert\catcode`\"=\other
1929*7f2fe78bSCy Schubert\catcode`\_=\other
1930*7f2fe78bSCy Schubert\catcode`\|=\other
1931*7f2fe78bSCy Schubert\catcode`\<=\other
1932*7f2fe78bSCy Schubert\catcode`\>=\other
1933*7f2fe78bSCy Schubert\catcode `\$=\other
1934*7f2fe78bSCy Schubert\catcode `\#=\other
1935*7f2fe78bSCy Schubert\catcode `\&=\other
1936*7f2fe78bSCy Schubert
1937*7f2fe78bSCy Schubert% the aux file uses ' as the escape.
1938*7f2fe78bSCy Schubert% Turn off \ as an escape so we do not lose on
1939*7f2fe78bSCy Schubert% entries which were dumped with control sequences in their names.
1940*7f2fe78bSCy Schubert% For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
1941*7f2fe78bSCy Schubert% Reference to such entries still does not work the way one would wish,
1942*7f2fe78bSCy Schubert% but at least they do not bomb out when the aux file is read in.
1943*7f2fe78bSCy Schubert
1944*7f2fe78bSCy Schubert\catcode `\{=1 \catcode `\}=2
1945*7f2fe78bSCy Schubert\catcode `\%=\other
1946*7f2fe78bSCy Schubert\catcode `\'=0
1947*7f2fe78bSCy Schubert\catcode `\\=\other
1948*7f2fe78bSCy Schubert
1949*7f2fe78bSCy Schubert'openin 1 'jobname.aux
1950*7f2fe78bSCy Schubert'ifeof 1 'else 'closein 1 'input 'jobname.aux
1951*7f2fe78bSCy Schubert'fi
1952*7f2fe78bSCy Schubert}
1953*7f2fe78bSCy Schubert
1954*7f2fe78bSCy Schubert% Open the new aux file.  Tex will close it automatically at exit.
1955*7f2fe78bSCy Schubert
1956*7f2fe78bSCy Schubert\openout \auxfile=\jobname.aux
1957*7f2fe78bSCy Schubert
1958*7f2fe78bSCy Schubert% Footnotes.
1959*7f2fe78bSCy Schubert
1960*7f2fe78bSCy Schubert\newcount \footnoteno
1961*7f2fe78bSCy Schubert
1962*7f2fe78bSCy Schubert\def\supereject{\par\penalty -20000\footnoteno =0 }
1963*7f2fe78bSCy Schubert
1964*7f2fe78bSCy Schubert\let\ptexfootnote=\footnote
1965*7f2fe78bSCy Schubert
1966*7f2fe78bSCy Schubert{\catcode `\@=11
1967*7f2fe78bSCy Schubert\gdef\footnote{\global\advance \footnoteno by \@ne
1968*7f2fe78bSCy Schubert\edef\thisfootno{$^{\the\footnoteno}$}%
1969*7f2fe78bSCy Schubert\let\@sf\empty
1970*7f2fe78bSCy Schubert\ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
1971*7f2fe78bSCy Schubert\thisfootno\@sf\parsearg\footnotezzz}
1972*7f2fe78bSCy Schubert
1973*7f2fe78bSCy Schubert\gdef\footnotezzz #1{\insert\footins{
1974*7f2fe78bSCy Schubert\interlinepenalty\interfootnotelinepenalty
1975*7f2fe78bSCy Schubert\splittopskip\ht\strutbox % top baseline for broken footnotes
1976*7f2fe78bSCy Schubert\splitmaxdepth\dp\strutbox \floatingpenalty\@MM
1977*7f2fe78bSCy Schubert\leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
1978*7f2fe78bSCy Schubert\footstrut\hang\textindent{\thisfootno}#1\strut}}
1979*7f2fe78bSCy Schubert
1980*7f2fe78bSCy Schubert}%end \catcode `\@=11
1981*7f2fe78bSCy Schubert
1982*7f2fe78bSCy Schubert% End of control word definitions.
1983*7f2fe78bSCy Schubert
1984*7f2fe78bSCy Schubert\message{and turning on texinfo input format.}
1985*7f2fe78bSCy Schubert
1986*7f2fe78bSCy Schubert\newindex{cp}
1987*7f2fe78bSCy Schubert\newcodeindex{fn}
1988*7f2fe78bSCy Schubert\newcodeindex{vr}
1989*7f2fe78bSCy Schubert\newcodeindex{tp}
1990*7f2fe78bSCy Schubert\newcodeindex{ky}
1991*7f2fe78bSCy Schubert\newcodeindex{pg}
1992*7f2fe78bSCy Schubert
1993*7f2fe78bSCy Schubert% Set some numeric style parameters, for 8.5 x 11 format.
1994*7f2fe78bSCy Schubert
1995*7f2fe78bSCy Schubert\hsize = 6.5in
1996*7f2fe78bSCy Schubert\parindent 15pt
1997*7f2fe78bSCy Schubert\parskip 18pt plus 1pt
1998*7f2fe78bSCy Schubert\baselineskip 15pt
1999*7f2fe78bSCy Schubert\advance\topskip by 1.2cm
2000*7f2fe78bSCy Schubert
2001*7f2fe78bSCy Schubert% Prevent underfull vbox error messages.
2002*7f2fe78bSCy Schubert\vbadness=10000
2003*7f2fe78bSCy Schubert
2004*7f2fe78bSCy Schubert% Use @smallbook to reset parameters for 7x9.5 format
2005*7f2fe78bSCy Schubert\def\smallbook{
2006*7f2fe78bSCy Schubert\global\lispnarrowing = 0.3in
2007*7f2fe78bSCy Schubert\global\baselineskip 12pt
2008*7f2fe78bSCy Schubert\global\parskip 3pt plus 1pt
2009*7f2fe78bSCy Schubert\global\hsize = 5in
2010*7f2fe78bSCy Schubert\global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
2011*7f2fe78bSCy Schubert\global\vsize=7.5in
2012*7f2fe78bSCy Schubert\global\tolerance=700
2013*7f2fe78bSCy Schubert\global\hfuzz=1pt
2014*7f2fe78bSCy Schubert
2015*7f2fe78bSCy Schubert\global\pagewidth=\hsize
2016*7f2fe78bSCy Schubert\global\pageheight=\vsize
2017*7f2fe78bSCy Schubert\global\font\ninett=cmtt9
2018*7f2fe78bSCy Schubert
2019*7f2fe78bSCy Schubert\global\let\smalllisp=\smalllispx
2020*7f2fe78bSCy Schubert\global\let\smallexample=\smalllispx
2021*7f2fe78bSCy Schubert\global\def\Esmallexample{\Esmalllisp}
2022*7f2fe78bSCy Schubert}
2023*7f2fe78bSCy Schubert
2024*7f2fe78bSCy Schubert%% For a final copy, take out the rectangles
2025*7f2fe78bSCy Schubert%% that mark overfull boxes (in case you have decided
2026*7f2fe78bSCy Schubert%% that the text looks ok even though it passes the margin).
2027*7f2fe78bSCy Schubert\def\finalout{\overfullrule=0pt}
2028*7f2fe78bSCy Schubert
2029*7f2fe78bSCy Schubert% Turn off all special characters except @
2030*7f2fe78bSCy Schubert% (and those which the user can use as if they were ordinary)
2031*7f2fe78bSCy Schubert% Define certain chars to be always in tt font.
2032*7f2fe78bSCy Schubert
2033*7f2fe78bSCy Schubert\catcode`\"=\active
2034*7f2fe78bSCy Schubert\def\activedoublequote{{\tt \char '042}}
2035*7f2fe78bSCy Schubert\let"=\activedoublequote
2036*7f2fe78bSCy Schubert\catcode`\~=\active
2037*7f2fe78bSCy Schubert\def~{{\tt \char '176}}
2038*7f2fe78bSCy Schubert\chardef\hat=`\^
2039*7f2fe78bSCy Schubert\catcode`\^=\active
2040*7f2fe78bSCy Schubert\def^{{\tt \hat}}
2041*7f2fe78bSCy Schubert\catcode`\_=\active
2042*7f2fe78bSCy Schubert\def_{{\tt \char '137}}
2043*7f2fe78bSCy Schubert\catcode`\|=\active
2044*7f2fe78bSCy Schubert\def|{{\tt \char '174}}
2045*7f2fe78bSCy Schubert\chardef \less=`\<
2046*7f2fe78bSCy Schubert\catcode`\<=\active
2047*7f2fe78bSCy Schubert\def<{{\tt \less}}
2048*7f2fe78bSCy Schubert\chardef \gtr=`\>
2049*7f2fe78bSCy Schubert\catcode`\>=\active
2050*7f2fe78bSCy Schubert\def>{{\tt \gtr}}
2051*7f2fe78bSCy Schubert
2052*7f2fe78bSCy Schubert\catcode`\@=0
2053*7f2fe78bSCy Schubert
2054*7f2fe78bSCy Schubert% \rawbackslashxx output one backslash character in current font
2055*7f2fe78bSCy Schubert{\catcode`\\=\other
2056*7f2fe78bSCy Schubert@gdef@rawbackslashxx{\}}
2057*7f2fe78bSCy Schubert
2058*7f2fe78bSCy Schubert% \rawbackslash redefines \ as input to do \rawbackslashxx.
2059*7f2fe78bSCy Schubert{\catcode`\\=\active
2060*7f2fe78bSCy Schubert@gdef@rawbackslash{@let\=@rawbackslashxx }}
2061*7f2fe78bSCy Schubert
2062*7f2fe78bSCy Schubert% \normalbackslash outputs one backslash in fixed width font.
2063*7f2fe78bSCy Schubert\def\normalbackslash{{\tt\rawbackslashxx}}
2064*7f2fe78bSCy Schubert
2065*7f2fe78bSCy Schubert% Say @foo, not \foo, in error messages.
2066*7f2fe78bSCy Schubert\escapechar=`\@
2067*7f2fe78bSCy Schubert
2068*7f2fe78bSCy Schubert%% These look ok in all fonts, so just make them not special.  The @rm below
2069*7f2fe78bSCy Schubert%% makes sure that the current font starts out as the newly loaded cmr10
2070*7f2fe78bSCy Schubert\catcode`\$=\other \catcode`\%=\other \catcode`\&=\other \catcode`\#=\other
2071*7f2fe78bSCy Schubert
2072*7f2fe78bSCy Schubert\catcode 17=0   @c Define control-q
2073*7f2fe78bSCy Schubert\catcode`\\=\active
2074*7f2fe78bSCy Schubert@let\=@normalbackslash
2075*7f2fe78bSCy Schubert
2076*7f2fe78bSCy Schubert@textfonts
2077*7f2fe78bSCy Schubert@rm
2078