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