home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / emacs / man / texinfo.tex < prev    next >
Text File  |  1991-01-26  |  85KB  |  2,666 lines

  1. %% TeX macros to handle texinfo files
  2.  
  3. %   Copyright (C) 1985, 1986, 1988, 1990 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 1, 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.29}
  26. \message{Loading texinfo package [Version \texinfoversion]:}
  27. \message{}
  28.  
  29. % Print the version number if in a .fmt file.
  30. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  31.  
  32. % Save some parts of plain tex whose names we will redefine.
  33.  
  34. \let\ptexlbrace=\{
  35. \let\ptexrbrace=\}
  36. \let\ptexdots=\dots
  37. \let\ptexdot=\.
  38. \let\ptexstar=\*
  39. \let\ptexend=\end
  40. \let\ptexbullet=\bullet
  41. \let\ptexb=\b
  42. \let\ptexc=\c
  43. \let\ptexi=\i
  44. \let\ptext=\t
  45. \let\ptexl=\l
  46. \let\ptexL=\L
  47.  
  48. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  49.  
  50. \message{Basics,}
  51. \chardef\other=12
  52.  
  53. \hyphenation{ap-pen-dix}
  54. \hyphenation{mini-buf-fer mini-buf-fers}
  55. \hyphenation{eshell}
  56.  
  57. % Margin to add to right of even pages, to left of odd pages.
  58. \newdimen \bindingoffset  \bindingoffset=0pt
  59. \newdimen \normaloffset   \normaloffset=\hoffset
  60. \newdimen\pagewidth \newdimen\pageheight
  61. \pagewidth=\hsize \pageheight=\vsize
  62.  
  63. %---------------------Begin change-----------------------
  64. %
  65. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  66. %
  67. \newdimen\cornerlong \newdimen\cornerthick
  68. \newdimen \topandbottommargin
  69. \newdimen \outerhsize \newdimen \outervsize
  70. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  71. \outerhsize=7in
  72. \outervsize=9.5in
  73. \topandbottommargin=.75in
  74. %
  75. %---------------------End change-----------------------
  76.  
  77. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  78. % does insertions itself, but you have to call it yourself.
  79. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  80. \def\onepageout#1{\hoffset=\normaloffset
  81. \ifodd\pageno  \advance\hoffset by \bindingoffset
  82. \else \advance\hoffset by -\bindingoffset\fi
  83. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  84. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  85. {\let\hsize=\pagewidth \makefootline}}}%
  86. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  87.  
  88.  
  89. % Here is a modification of the main output routine for Near East Publications
  90. % This provides right-angle cropmarks at all four corners.
  91. % The contents of the page are centerlined into the cropmarks,
  92. % and any desired binding offset is added as an \hskip on either
  93. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  94. %
  95. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  96.          \shipout
  97.          \vbox to \outervsize{\hsize=\outerhsize
  98.                  \vbox{\line{\ewtop\hfill\ewtop}}
  99.                  \nointerlineskip
  100.                  \line{\vbox{\moveleft\cornerthick\nstop}
  101.                        \hfill
  102.                        \vbox{\moveright\cornerthick\nstop}}
  103.                  \vskip \topandbottommargin
  104.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  105.             \vbox{
  106.             {\let\hsize=\pagewidth \makeheadline}
  107.             \pagebody{#1}
  108.             {\let\hsize=\pagewidth \makefootline}}
  109.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  110.          \vskip \topandbottommargin plus1fill minus1fill
  111.                  \boxmaxdepth\cornerthick
  112.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  113.                        \hfill
  114.                        \vbox{\moveright\cornerthick\nsbot}}
  115.                  \nointerlineskip
  116.                  \vbox{\line{\ewbot\hfill\ewbot}}
  117.     }
  118.   \advancepageno 
  119.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  120. %
  121. % Do @cropmarks to get crop marks
  122. \def\cropmarks{\let\onepageout=\croppageout }
  123.  
  124. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  125. {\catcode`\@ =11
  126. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  127. \dimen@=\dp#1 \unvbox#1
  128. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  129. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  130. }
  131.  
  132. %
  133. % Here are the rules for the cropmarks.  Note that they are
  134. % offset so that the space between them is truly \outerhsize or \outervsize
  135. % (P. A. MacKay, 12 November, 1986)
  136. %
  137. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  138. \def\nstop{\vbox
  139.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  140. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  141. \def\nsbot{\vbox
  142.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  143.  
  144. % Parse an argument, then pass it to #1.
  145. % The argument can be delimited with [...] or with "..." or braces
  146. % or it can be a whole line.
  147. % #1 should be a macro which expects
  148. % an ordinary undelimited TeX argument.
  149.  
  150. \def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
  151.  
  152. \def\parseargx{%
  153. \ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
  154. \aftergroup \parseargline %
  155. \fi \endgroup}
  156.  
  157. {\obeyspaces %
  158. \gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
  159.  
  160. \gdef\obeyedspace{\ }
  161.  
  162. \def\parseargline{\begingroup \obeylines \parsearglinex}
  163. {\obeylines %
  164. \gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
  165.  
  166. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  167.  
  168. %% These are used to keep @begin/@end levels from running away
  169. %% Call \inENV within environments (after a \begingroup)
  170. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  171. \def\ENVcheck{%
  172. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  173. \endgroup\fi} % This is not perfect, but it should reduce lossage
  174.  
  175. % @begin foo  is the same as @foo, for now.
  176. \newhelp\EMsimple{Type <Return> to continue}
  177.  
  178. \outer\def\begin{\parsearg\beginxxx}
  179.  
  180. \def\beginxxx #1{%
  181. \expandafter\ifx\csname #1\endcsname\relax
  182. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  183. \csname #1\endcsname\fi}
  184.  
  185. %% @end foo executes the definition of \Efoo.
  186. %% foo can be delimited by doublequotes or brackets.
  187.  
  188. \def\end{\parsearg\endxxx}
  189.  
  190. \def\endxxx #1{%
  191. \expandafter\ifx\csname E#1\endcsname\relax
  192. \expandafter\ifx\csname #1\endcsname\relax
  193. \errmessage{Undefined command @end #1}\else
  194. \errorE{#1}\fi\fi
  195. \csname E#1\endcsname}
  196. \def\errorE#1{
  197. {\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
  198.  
  199. % Single-spacing is done by various environments.
  200.  
  201. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  202. \def\singlespace{%
  203. {\advance \baselineskip by -\singlespaceskip
  204. \kern \baselineskip}%
  205. \baselineskip=\singlespaceskip
  206. }
  207.  
  208. %% Simple single-character @ commands
  209.  
  210. % @@ prints an @
  211. % Kludge this until the fonts are right (grr).
  212. \def\@{{\tt \char '100}}
  213.  
  214. % Define @` and @' to be the same as ` and '
  215. % but suppressing ligatures.
  216. \def\`{{`}}
  217. \def\'{{'}}
  218.  
  219. % Used to generate quoted braces.
  220.  
  221. \def\mylbrace {{\tt \char '173}}
  222. \def\myrbrace {{\tt \char '175}}
  223. \let\{=\mylbrace
  224. \let\}=\myrbrace
  225.  
  226. % @: forces normal size whitespace following.
  227. \def\:{\spacefactor=1000 }
  228.  
  229. % @* forces a line break.
  230. \def\*{\hfil\break\hbox{}\ignorespaces}
  231.  
  232. % @. is an end-of-sentence period.
  233. \def\.{.\spacefactor=3000 }
  234.  
  235. % @w prevents a word break
  236. \def\w #1{\hbox{#1}}
  237.  
  238. % @group ... @end group  forces ... to be all on one page.
  239.  
  240. \def\group{\begingroup% \inENV ???
  241. \def \Egroup{\egroup\endgroup}
  242. \vbox\bgroup}
  243.  
  244. % @need space-in-mils
  245. % forces a page break if there is not space-in-mils remaining.
  246.  
  247. \newdimen\mil  \mil=0.001in
  248.  
  249. \def\need{\parsearg\needx}
  250.  
  251. \def\needx #1{\par %
  252. \begingroup %
  253. \dimen0=\pagetotal %
  254. \advance \dimen0 by #1\mil %
  255. \ifdim \dimen0>\pagegoal \vfill\eject \fi %
  256. \endgroup}
  257.  
  258.  
  259. % @br   forces paragraph break
  260.  
  261. \let\br = \par
  262.  
  263. % @dots{}  output some dots
  264.  
  265. \def\dots{$\ldots$}
  266.  
  267. % @page    forces the start of a new page
  268.  
  269. \def\page{\par\vfill\supereject}
  270.  
  271. % @exdent text....
  272. % outputs text on separate line in roman font, starting at standard page margin
  273.  
  274. \def\exdent{\errmessage{@exdent in filled text}}
  275.   % @lisp, etc, define \exdent locally from \internalexdent
  276.  
  277. {\obeyspaces
  278. \gdef\internalexdent{\parsearg\exdentzzz}}
  279.  
  280. \def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
  281. \advance \hsize by -\leftskip
  282. \advance \hsize by -\rightskip
  283. \leftline{{\rm#1}}}}
  284.  
  285. % @include file    insert text of that file as input.
  286.  
  287. \def\include{\parsearg\includezzz}
  288. \def\includezzz #1{{\def\thisfile{#1}\input #1
  289. }}
  290.  
  291. \def\thisfile{}
  292.  
  293. % @center line   outputs that line, centered
  294.  
  295. \def\center{\parsearg\centerzzz}
  296. \def\centerzzz #1{{\advance\hsize by -\leftskip
  297. \advance\hsize by -\rightskip
  298. \centerline{#1}}}
  299.  
  300. % @sp n   outputs n lines of vertical space
  301.  
  302. \def\sp{\parsearg\spxxx}
  303. \def\spxxx #1{\par \vskip #1\baselineskip}
  304.  
  305. % @comment ...line which is ignored...
  306. % @c is the same as @comment
  307. % @ignore ... @end ignore  is another way to write a comment
  308.  
  309. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  310. \parsearg \commentxxx}
  311.  
  312. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  313.  
  314. \let\c=\comment
  315.  
  316. % Prevent errors for section commands.
  317. % Used in @ignore and in failing conditionals.
  318. \def\ignoresections{%
  319. \let\chapter=\relax
  320. \let\unnumbered=\relax
  321. \let\unnumberedsec=\relax
  322. \let\unnumberedsection=\relax
  323. \let\unnumberedsubsec=\relax
  324. \let\unnumberedsubsection=\relax
  325. \let\unnumberedsubsubsec=\relax
  326. \let\unnumberedsubsubsection=\relax
  327. \let\section=\relax
  328. \let\subsec=\relax
  329. \let\subsubsec=\relax
  330. \let\subsection=\relax
  331. \let\subsubsection=\relax
  332. \let\appendix=\relax
  333. \let\appendixsec=\relax
  334. \let\appendixsection=\relax
  335. \let\appendixsubsec=\relax
  336. \let\appendixsubsection=\relax
  337. \let\appendixsubsubsec=\relax
  338. \let\appendixsubsubsection=\relax
  339. }
  340.  
  341. \def\ignore{\begingroup\ignoresections\ignorexxx}
  342. \long\def\ignorexxx #1\end ignore{\endgroup\ignorespaces}
  343.  
  344. \def\direntry{\begingroup\direntryxxx}
  345. \long\def\direntryxxx #1\end direntry{\endgroup\ignorespaces}
  346.  
  347. % Conditionals to test whether a flag is set.
  348.  
  349. \outer\def\ifset{\begingroup\ignoresections\parsearg\ifsetxxx}
  350.  
  351. \def\ifsetxxx #1{\endgroup
  352. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\ifsetfail
  353. \else \let\temp=\relax \fi
  354. \temp}
  355. \def\Eifset{}
  356. \def\ifsetfail{\begingroup\ignoresections\ifsetfailxxx}
  357. \long\def\ifsetfailxxx #1\end ifset{\endgroup\ignorespaces}
  358.  
  359. \outer\def\ifclear{\begingroup\ignoresections\parsearg\ifclearxxx}
  360.  
  361. \def\ifclearxxx #1{\endgroup
  362. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\relax
  363. \else \let\temp=\ifclearfail \fi
  364. \temp}
  365. \def\Eifclear{}
  366. \def\ifclearfail{\begingroup\ignoresections\ifclearfailxxx}
  367. \long\def\ifclearfailxxx #1\end ifclear{\endgroup\ignorespaces}
  368.  
  369. % Some texinfo constructs that are trivial in tex
  370.  
  371. \def\iftex{}
  372. \def\Eiftex{}
  373. \def\ifinfo{\begingroup\ignoresections\ifinfoxxx}
  374. \long\def\ifinfoxxx #1\end ifinfo{\endgroup\ignorespaces}
  375.  
  376. \long\def\menu #1\end menu{}
  377. \def\asis#1{#1}
  378.  
  379. % @math means output in math mode.
  380. % We don't use $'s directly in the definition of \math because control
  381. % sequences like \math are expanded when the toc file is written.  Then,
  382. % we read the toc file back, the $'s will be normal characters (as they
  383. % should be, according to the definition of Texinfo).  So we must use a
  384. % control sequence to switch into and out of math mode.
  385. % This isn't quite enough for @math to work properly in indices, but it
  386. % seems unlikely it will ever be needed there.
  387. \let\implicitmath = $
  388. \def\math#1{\implicitmath #1\implicitmath}
  389.  
  390. \def\node{\ENVcheck\parsearg\nodezzz}
  391. \def\nodezzz#1{\nodexxx [#1,]}
  392. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  393. \let\lastnode=\relax
  394.  
  395. \def\donoderef{\ifx\lastnode\relax\else
  396. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  397. \let\lastnode=\relax}
  398.  
  399. \def\unnumbnoderef{\ifx\lastnode\relax\else
  400. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  401. \let\lastnode=\relax}
  402.  
  403. \def\appendixnoderef{\ifx\lastnode\relax\else
  404. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  405. \let\lastnode=\relax}
  406.  
  407. \let\refill=\relax
  408.   
  409. % @setfilename is done at the beginning of every texinfo file.
  410. % So open here the files we need to have open while reading the input.
  411. % This makes it possible to make a .fmt file for texinfo.
  412. \def\setfilename{%
  413.    \readauxfile
  414.    \opencontents
  415.    \openindices
  416.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  417.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  418.    \comment % Ignore the actual filename.
  419. }
  420.  
  421. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  422.  
  423. \def\inforef #1{\inforefzzz #1,,,,**}
  424. \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}}, node `\losespace#1{}'}
  425. \def\losespace #1{#1}
  426.  
  427. \message{fonts,}
  428.  
  429. % Font-change commands.
  430.  
  431. %% Try out Computer Modern fonts at \magstephalf
  432. \font\tenrm=cmr10 scaled \magstephalf
  433. \font\tentt=cmtt10 scaled \magstephalf
  434. % Instead of cmb10, you many want to use cmbx10.
  435. % cmbx10 is a prettier font on its own, but cmb10
  436. % looks better when embedded in a line with cmr10.
  437. \font\tenbf=cmb10 scaled \magstephalf 
  438. \font\tenit=cmti10 scaled \magstephalf
  439. \font\tensl=cmsl10 scaled \magstephalf
  440. \font\tensf=cmss10 scaled \magstephalf
  441. \def\li{\sf}
  442. \font\tensc=cmcsc10 scaled \magstephalf
  443.  
  444. % Fonts for @defun, etc.
  445. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  446. \font\deftt=cmtt10 scaled \magstep1
  447. \def\df{\let\tt=\deftt \defbf}
  448.  
  449. % Font for title
  450. % There seems to have been a confusion: two definitions of this font.
  451. % It is not clear why, or which one is better.
  452. \font\titlerm = cmbx12 scaled \magstep3
  453.  
  454. % Fonts for indices and small examples.
  455. % We actually use the slanted font rather than the italic, 
  456. % because texinfo normally uses the slanted fonts for that.
  457. \font\ninett=cmtt9
  458. \font\indit=cmsl9 \font\indrm=cmr9
  459. \let\indtt=\ninett
  460. \def\indbf{\indrm} \def\indsl{\indit}
  461. \def\indexfonts{\let\it=\indit \let\sl=\indsl \let\bf=\indbf \let\rm=\indrm
  462. \let\tt=\indtt}
  463.  
  464. % Fonts for headings
  465. \font\chaprm=cmbx12 scaled \magstep2
  466. \font\chapit=cmti12 scaled \magstep2
  467. \font\chapsl=cmsl12 scaled \magstep2
  468. \font\chaptt=cmtt12 scaled \magstep2
  469. \font\chapsf=cmss12 scaled \magstep2
  470. \let\chapbf=\chaprm
  471.  
  472. \font\secrm=cmbx12 scaled \magstep1
  473. \font\secit=cmti12 scaled \magstep1
  474. \font\secsl=cmsl12 scaled \magstep1
  475. \font\sectt=cmtt12 scaled \magstep1
  476. \font\secsf=cmss12 scaled \magstep1
  477. \font\secbf=cmbx12 scaled \magstep1
  478.  
  479. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an fontlooked bad.
  480. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  481. % \font\ssecsl=cmsl10 scaled \magstep1
  482. % \font\ssectt=cmtt10 scaled \magstep1
  483. % \font\ssecsf=cmss10 scaled \magstep1
  484.  
  485. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  486. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  487. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  488. %\font\ssectt=cmtt10 scaled 1315
  489. %\font\ssecsf=cmss10 scaled 1315
  490.  
  491. %\let\ssecbf=\ssecrm
  492.  
  493. \font\ssecrm=cmbx12 scaled \magstephalf
  494. \font\ssecit=cmti12 scaled \magstephalf
  495. \font\ssecsl=cmsl12 scaled \magstephalf
  496. \font\ssectt=cmtt12 scaled \magstephalf
  497. \font\ssecsf=cmss12 scaled \magstephalf
  498. \font\ssecbf=cmbx12 scaled \magstephalf
  499.  
  500.  
  501. \def\textfonts{\let\rm=\tenrm\let\it=\tenit\let\sl=\tensl\let\bf=\tenbf%
  502. \let\smallcaps=\tensc\let\sf=\tensf}
  503. \def\chapfonts{\let\rm=\chaprm\let\it=\chapit\let\sl=\chapsl\let\bf=\chapbf\let\tt=\chaptt\let\sf=\chapsf}
  504. \def\secfonts{\let\rm=\secrm\let\it=\secit\let\sl=\secsl\let\bf=\secbf\let\tt=\sectt\let\sf=\secsf}
  505. \def\subsecfonts{\let\rm=\ssecrm\let\it=\ssecit\let\sl=\ssecsl\let\bf=\ssecbf\let\tt=\ssectt\let\sf=\ssecsf}
  506. % Count depth in font-changes, for error checks
  507. \newcount\fontdepth \fontdepth=0
  508.  
  509. % Font for table of contents.
  510. \font\truesecrm=cmr12
  511.  
  512. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  513. %% serif) and @ii for TeX italic
  514.  
  515. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  516. % unless the following character is such as not to need one.
  517. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  518. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  519.  
  520. \let\i=\smartitalic
  521. \let\var=\smartitalic
  522. \let\dfn=\smartitalic
  523. \let\emph=\smartitalic
  524. \let\cite=\smartitalic
  525.  
  526. \def\b#1{{\bf #1}}
  527. \let\strong=\b
  528.  
  529. \def\t#1{{\tt \rawbackslash \frenchspacing #1}\null}
  530. \let\ttfont = \t
  531. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  532. \def\samp #1{`\tclose{#1}'\null}
  533. \def\key #1{{\tt \uppercase{#1}}\null}
  534. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  535.  
  536. \let\file=\samp
  537.  
  538. % @code is a modification of @t,
  539. % which makes spaces the same size as normal in the surrounding text.
  540. \newdimen\tclosesave
  541. \newdimen\tcloserm
  542. \def\tclose#1{{\rm \tcloserm=\fontdimen2\font \tt \tclosesave=\fontdimen2\font
  543. \fontdimen2\font=\tcloserm
  544. \def\ {{\fontdimen2\font=\tclosesave{} }}%
  545.  \rawbackslash \frenchspacing #1\fontdimen2\font=\tclosesave}\null}
  546. \let\code=\tclose
  547. %\let\exp=\tclose  %Was temporary
  548.  
  549. % @kbd is like @code, except that if the argument is just one @key command, 
  550. % then @kbd has no effect.
  551.  
  552. \def\xkey{\key}
  553. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  554. \ifx\one\xkey\ifx\threex\three \key{#2}%
  555. \else\tclose{\look}\fi
  556. \else\tclose{\look}\fi}
  557.  
  558. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  559.  
  560. \def\l#1{{\li #1}\null}        % 
  561.  
  562. \def\r#1{{\rm #1}}        % roman font
  563. % Use of \lowercase was suggested.
  564. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  565. \def\ii#1{{\it #1}}        % italic font
  566.  
  567. \message{page headings,}
  568.  
  569. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  570. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  571.  
  572. % First the title page.  Must do @settitle before @titlepage.
  573. \def\titlefont#1{{\titlerm #1}}
  574.  
  575. \newtoks\realeverypar
  576. \newif\ifseenauthor
  577. \newif\iffinishedtitlepage
  578.  
  579. \def\titlepage{\begingroup \parindent=0pt \textfonts
  580.    \let\subtitlerm=\tenrm
  581. % I deinstalled the following change because \cmr12 is undefined.
  582. % This change was not in the ChangeLog anyway.  --rms.
  583. %   \let\subtitlerm=\cmr12
  584.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  585.    %
  586.    \font\authorrm = cmbx12 scaled \magstep1
  587.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  588.    %
  589.    % Leave some space at the very top of the page.
  590.    \vglue\titlepagetopglue
  591.    %
  592.    % Now you can print the title using @title.
  593.    \def\title{\parsearg\titlezzz}%
  594.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  595.             % print a rule at the page bottom also.
  596.             \finishedtitlepagefalse
  597.             \vskip4pt \hrule height 4pt \vskip4pt}%
  598.    % No rule at page bottom unless we print one at the top with @title.
  599.    \finishedtitlepagetrue
  600.    %
  601.    % Now you can put text using @subtitle.
  602.    \def\subtitle{\parsearg\subtitlezzz}%
  603.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  604.    %
  605.    % @author should come last, but may come many times.
  606.    \def\author{\parsearg\authorzzz}%
  607.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  608.       {\authorfont \leftline{##1}}}%
  609.    %  
  610.    % Most title ``pages'' are actually two pages long, with space
  611.    % at the top of the second.  We don't want the ragged left on the second.
  612.    \let\oldpage = \page
  613.    \def\page{%
  614.       \iffinishedtitlepage\else
  615.      \finishtitlepage
  616.       \fi
  617.       \oldpage
  618.       \let\page = \oldpage
  619.       \hbox{}}%
  620. %   \def\page{\oldpage \hbox{}}
  621. }
  622.  
  623. \def\Etitlepage{%
  624.    \iffinishedtitlepage\else
  625.       \finishtitlepage
  626.    \fi
  627.    \endgroup\page\HEADINGSon
  628. }
  629.  
  630. \def\finishtitlepage{%
  631.    \vskip4pt \hrule height 2pt
  632.    \vskip\titlepagebottomglue
  633.    \finishedtitlepagetrue
  634. }
  635.  
  636. %%% Set up page headings and footings.
  637.  
  638. \let\thispage=\folio
  639.  
  640. \newtoks \evenheadline    % Token sequence for heading line of even pages
  641. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  642. \newtoks \evenfootline    % Token sequence for footing line of even pages
  643. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  644.  
  645. % Now make Tex use those variables
  646. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}}
  647. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}}
  648.  
  649. % Commands to set those variables.
  650. % For example, this is what  @headings on  does
  651. % @evenheading @thistitle|@thispage|@thischapter
  652. % @oddheading @thischapter|@thispage|@thistitle
  653. % @evenfooting @thisfile||
  654. % @oddfooting ||@thisfile
  655.  
  656. \def\evenheading{\parsearg\evenheadingxxx}
  657. \def\oddheading{\parsearg\oddheadingxxx}
  658. \def\everyheading{\parsearg\everyheadingxxx}
  659.  
  660. \def\evenfooting{\parsearg\evenfootingxxx}
  661. \def\oddfooting{\parsearg\oddfootingxxx}
  662. \def\everyfooting{\parsearg\everyfootingxxx}
  663.  
  664. {\catcode`\@=0 %
  665.  
  666. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  667. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  668. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  669.  
  670. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  671. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  672. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  673.  
  674. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  675. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  676. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  677. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  678.  
  679. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  680. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  681. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  682.  
  683. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  684. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  685. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  686.  
  687. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  688. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  689. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  690. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  691. %
  692. }% unbind the catcode of @.
  693.  
  694. % @headings double    turns headings on for double-sided printing.
  695. % @headings single    turns headings on for single-sided printing.
  696. % @headings off        turns them off.
  697. % @headings on        same as @headings double, retained for compatibility.
  698. % By default, they are off.
  699.  
  700. \def\headings #1 {\csname HEADINGS#1\endcsname}
  701.  
  702. \def\HEADINGSoff{
  703. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  704. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  705. \HEADINGSoff
  706. % When we turn headings on, set the page number to 1.
  707. % For double-sided printing, put current file name in lower left corner,
  708. % chapter name on inside top of right hand pages, document
  709. % title on inside top of left hand pages, and page numbers on outside top
  710. % edge of all pages.
  711. \def\HEADINGSdouble{
  712. %\pagealignmacro
  713. \global\pageno=1
  714. \global\evenfootline={\hfil}
  715. \global\oddfootline={\hfil}
  716. \global\evenheadline={\line{\folio\hfil\thistitle}}
  717. \global\oddheadline={\line{\thischapter\hfil\folio}}
  718. }
  719. % For single-sided printing, chapter title goes across top left of page,
  720. % page number on top right.
  721. \def\HEADINGSsingle{
  722. %\pagealignmacro
  723. \global\pageno=1
  724. \global\evenfootline={\hfil}
  725. \global\oddfootline={\hfil}
  726. \global\evenheadline={\line{\thischapter\hfil\folio}}
  727. \global\oddheadline={\line{\thischapter\hfil\folio}}
  728. }
  729. \def\HEADINGSon{\HEADINGSdouble}
  730.  
  731. % Subroutines used in generating headings
  732. % Produces Day Month Year style of output.
  733. \def\today{\number\day\space
  734. \ifcase\month\or
  735. January\or February\or March\or April\or May\or June\or
  736. July\or August\or September\or October\or November\or December\fi
  737. \space\number\year}
  738.  
  739. % Use this if you want the Month Day, Year style of output.
  740. %\def\today{\ifcase\month\or
  741. %January\or February\or March\or April\or May\or June\or
  742. %July\or August\or September\or October\or November\or December\fi
  743. %\space\number\day, \number\year}
  744.  
  745. % @settitle line...  specifies the title of the document, for headings
  746. % It generates no output of its own
  747.  
  748. \def\thistitle{No Title}
  749. \def\settitle{\parsearg\settitlezzz}
  750. \def\settitlezzz #1{\gdef\thistitle{#1}}
  751.  
  752. \message{tables,}
  753.  
  754. % @tabs -- simple alignment
  755.  
  756. % These don't work.  For one thing, \+ is defined as outer.
  757. % So these macros cannot even be defined.
  758.  
  759. %\def\tabs{\parsearg\tabszzz}
  760. %\def\tabszzz #1{\settabs\+#1\cr}
  761. %\def\tabline{\parsearg\tablinezzz}
  762. %\def\tablinezzz #1{\+#1\cr}
  763. %\def\&{&}
  764.  
  765. % Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
  766.  
  767. % default indentation of table text
  768. \newdimen\tableindent \tableindent=.8in
  769. % default indentation of @itemize and @enumerate text
  770. \newdimen\itemindent  \itemindent=.3in
  771. % margin between end of table item and start of table text.
  772. \newdimen\itemmargin  \itemmargin=.1in
  773.  
  774. % used internally for \itemindent minus \itemmargin
  775. \newdimen\itemmax
  776.  
  777. % Note @table and @ftable define @item, @itemx, etc., with these defs.
  778. % They also define \itemindex
  779. % to index the item name in whatever manner is desired (perhaps none).
  780.  
  781. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  782. \def\internalBitemx{\par \parsearg\itemzzz}
  783.  
  784. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  785. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
  786.  
  787. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  788. \def\internalBkitemx{\par \parsearg\kitemzzz}
  789.  
  790. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}\itemzzz {#1}}
  791.  
  792. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}\itemzzz {#1}}
  793.  
  794. \def\itemzzz #1{\begingroup %
  795. \advance \hsize by -\rightskip %
  796. \advance \hsize by -\leftskip %
  797. \setbox0=\hbox{\itemfont{#1}}%
  798. \itemindex{#1}%
  799. \parskip=0in %
  800. \noindent %
  801. \ifdim \wd0>\itemmax %
  802. \vadjust{\penalty 10000}%
  803. \hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
  804. \else %
  805. \hbox to 0pt{\hskip -\tableindent\box0\hss}%
  806. \fi %
  807. \endgroup %
  808. }
  809.  
  810. \def\item{\errmessage{@item while not in a table}}
  811. \def\itemx{\errmessage{@itemx while not in a table}}
  812. \def\kitem{\errmessage{@kitem while not in a table}}
  813. \def\kitemx{\errmessage{@kitemx while not in a table}}
  814. \def\xitem{\errmessage{@xitem while not in a table}}
  815. \def\xitemx{\errmessage{@xitemx while not in a table}}
  816.  
  817. %% Contains a kludge to get @end[description] to work
  818. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  819.  
  820. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  821. {\obeylines\obeyspaces%
  822. \gdef\tablex #1^^M{%
  823. \tabley\dontindex#1        \endtabley}}
  824.  
  825. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  826. {\obeylines\obeyspaces%
  827. \gdef\ftablex #1^^M{%
  828. \tabley\fnitemindex#1        \endtabley}}
  829.  
  830. \def\dontindex #1{}
  831. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  832.  
  833. {\obeyspaces %
  834. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  835. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  836.  
  837. \def\tablez #1#2#3#4#5#6{%
  838. \aboveenvbreak %
  839. \begingroup %
  840. \def\Edescription{\Etable}% Neccessary kludge.
  841. \let\itemindex=#1%
  842. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  843. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  844. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  845. \def\itemfont{#2}%
  846. \itemmax=\tableindent %
  847. \advance \itemmax by -\itemmargin %
  848. \advance \leftskip by \tableindent %
  849. \parindent = 0pt
  850. \parskip = \smallskipamount
  851. \ifdim \parskip=0pt \parskip=2pt \fi%
  852. \def\Etable{\endgraf\endgroup\afterenvbreak}%
  853. \let\item = \internalBitem %
  854. \let\itemx = \internalBitemx %
  855. \let\kitem = \internalBkitem %
  856. \let\kitemx = \internalBkitemx %
  857. \let\xitem = \internalBxitem %
  858. \let\xitemx = \internalBxitemx %
  859. }
  860.  
  861. % This is the counter used by @enumerate, which is really @itemize
  862.  
  863. \newcount \itemno
  864.  
  865. \def\itemize{\parsearg\itemizezzz}
  866.  
  867. \def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
  868.  
  869. \def\itemizey #1#2{%
  870. \aboveenvbreak %
  871. \begingroup %
  872. \itemno = 0 %
  873. \itemmax=\itemindent %
  874. \advance \itemmax by -\itemmargin %
  875. \advance \leftskip by \itemindent %
  876. \parindent = 0pt
  877. \parskip = \smallskipamount
  878. \ifdim \parskip=0pt \parskip=2pt \fi%
  879. \def#2{\endgraf\endgroup\afterenvbreak}%
  880. \def\itemcontents{#1}%
  881. \let\item=\itemizeitem}
  882.  
  883. \def\bullet{$\ptexbullet$}
  884. \def\minus{$-$}
  885.  
  886. % Set sfcode to normal for the chars that usually have another value.
  887. % These are `.?!:;,'
  888. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  889.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  890.  
  891. \def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
  892.  
  893. % Definition of @item while inside @itemize.
  894.  
  895. \def\itemizeitem{%
  896. \advance\itemno by 1
  897. {\let\par=\endgraf \smallbreak}%
  898. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  899. {\parskip=0in \hskip 0pt
  900. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  901. \vadjust{\penalty 300}}%
  902. \flushcr}
  903.  
  904. \message{indexing,}
  905. % Index generation facilities
  906.  
  907. % Define \newwrite to be identical to plain tex's \newwrite
  908. % except not \outer, so it can be used within \newindex.
  909. {\catcode`\@=11
  910. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  911.  
  912. % \newindex {foo} defines an index named foo.
  913. % It automatically defines \fooindex such that
  914. % \fooindex ...rest of line... puts an entry in the index foo.
  915. % It also defines \fooindfile to be the number of the output channel for
  916. % the file that    accumulates this index.  The file's extension is foo.
  917. % The name of an index should be no more than 2 characters long
  918. % for the sake of vms.
  919.  
  920. \def\newindex #1{
  921. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  922. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  923. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  924. \noexpand\doindex {#1}}
  925. }
  926.  
  927. % @defindex foo  ==  \newindex{foo}
  928.  
  929. \def\defindex{\parsearg\newindex}
  930.  
  931. % Define @defcodeindex, like @defindex except put all entries in @code.
  932.  
  933. \def\newcodeindex #1{
  934. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  935. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  936. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  937. \noexpand\docodeindex {#1}}
  938. }
  939.  
  940. \def\defcodeindex{\parsearg\newcodeindex}
  941.  
  942. % @synindex foo bar    makes index foo feed into index bar.
  943. % Do this instead of @defindex foo if you don't want it as a separate index.
  944. \def\synindex #1 #2 {%
  945. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  946. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  947. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  948. \noexpand\doindex {#2}}%
  949. }
  950.  
  951. % @syncodeindex foo bar   similar, but put all entries made for index foo
  952. % inside @code.
  953. \def\syncodeindex #1 #2 {%
  954. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  955. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  956. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  957. \noexpand\docodeindex {#2}}%
  958. }
  959.  
  960. % Define \doindex, the driver for all \fooindex macros.
  961. % Argument #1 is generated by the calling \fooindex macro,
  962. %  and it is "foo", the name of the index.
  963.  
  964. % \doindex just uses \parsearg; it calls \doind for the actual work.
  965. % This is because \doind is more useful to call from other macros.
  966.  
  967. % There is also \dosubind {index}{topic}{subtopic}
  968. % which makes an entry in a two-level index such as the operation index.
  969.  
  970. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  971. \def\singleindexer #1{\doind{\indexname}{#1}}
  972.  
  973. % like the previous two, but they put @code around the argument.
  974. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  975. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  976.  
  977. \def\indexdummies{%
  978. \def\_{{\realbackslash normalunderscore}}%
  979. \def\w{\realbackslash w }%
  980. \def\bf{\realbackslash bf }%
  981. \def\rm{\realbackslash rm }%
  982. \def\sl{\realbackslash sl }%
  983. \def\sf{\realbackslash sf}%
  984. \def\tt{\realbackslash tt}%
  985. \def\gtr{\realbackslash gtr}%
  986. \def\less{\realbackslash less}%
  987. \def\hat{\realbackslash hat}%
  988. \def\char{\realbackslash char}%
  989. \def\TeX{\realbackslash TeX}%
  990. \def\dots{\realbackslash dots }%
  991. \def\copyright{\realbackslash copyright }%
  992. \def\tclose##1{\realbackslash tclose {##1}}%
  993. \def\code##1{\realbackslash code {##1}}%
  994. \def\samp##1{\realbackslash samp {##1}}%
  995. \def\t##1{\realbackslash r {##1}}%
  996. \def\r##1{\realbackslash r {##1}}%
  997. \def\i##1{\realbackslash i {##1}}%
  998. \def\b##1{\realbackslash b {##1}}%
  999. \def\cite##1{\realbackslash cite {##1}}%
  1000. \def\key##1{\realbackslash key {##1}}%
  1001. \def\file##1{\realbackslash file {##1}}%
  1002. \def\var##1{\realbackslash var {##1}}%
  1003. \def\kbd##1{\realbackslash kbd {##1}}%
  1004. }
  1005.  
  1006. % \indexnofonts no-ops all font-change commands.
  1007. % This is used when outputting the strings to sort the index by.
  1008. \def\indexdummyfont#1{#1}
  1009. \def\indexdummytex{TeX}
  1010. \def\indexdummydots{...}
  1011.  
  1012. \def\indexnofonts{%
  1013. \let\w=\indexdummyfont
  1014. \let\t=\indexdummyfont
  1015. \let\r=\indexdummyfont
  1016. \let\i=\indexdummyfont
  1017. \let\b=\indexdummyfont
  1018. \let\emph=\indexdummyfont
  1019. \let\strong=\indexdummyfont
  1020. \let\cite=\indexdummyfont
  1021. \let\sc=\indexdummyfont
  1022. %Don't no-op \tt, since it isn't a user-level command
  1023. % and is used in the definitions of the actuve chars like <, >, |...
  1024. %\let\tt=\indexdummyfont
  1025. \let\tclose=\indexdummyfont
  1026. \let\code=\indexdummyfont
  1027. \let\file=\indexdummyfont
  1028. \let\samp=\indexdummyfont
  1029. \let\kbd=\indexdummyfont
  1030. \let\key=\indexdummyfont
  1031. \let\var=\indexdummyfont
  1032. \let\TeX=\indexdummytex
  1033. \let\dots=\indexdummydots
  1034. }
  1035.  
  1036. % To define \realbackslash, we must make \ not be an escape.
  1037. % We must first make another character (@) an escape
  1038. % so we do not become unable to do a definition.
  1039.  
  1040. {\catcode`\@=0 \catcode`\\=\other
  1041. @gdef@realbackslash{\}}
  1042.  
  1043. \let\indexbackslash=0  %overridden during \printindex.
  1044.  
  1045. \def\doind #1#2{%
  1046. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1047. \count10=\lastpenalty %
  1048. \escapechar=`\\%
  1049. {\let\folio=0% Expand all macros now EXCEPT \folio
  1050. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1051. % so it will be output as is; and it will print as backslash in the indx.
  1052. %
  1053. % Now process the index-string once, with all font commands turned off,
  1054. % to get the string to sort the index by.
  1055. {\indexnofonts
  1056. \xdef\temp1{#2}%
  1057. }%
  1058. % Now produce the complete index entry.  We process the index-string again,
  1059. % this time with font commands expanded, to get what to print in the index.
  1060. \edef\temp{%
  1061. \write \csname#1indfile\endcsname{%
  1062. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1063. \temp }%
  1064. \penalty\count10}}
  1065.  
  1066. \def\dosubind #1#2#3{%
  1067. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1068. \count10=\lastpenalty %
  1069. \escapechar=`\\%
  1070. {\let\folio=0%
  1071. \def\rawbackslashxx{\indexbackslash}%
  1072. %
  1073. % Now process the index-string once, with all font commands turned off,
  1074. % to get the string to sort the index by.
  1075. {\indexnofonts
  1076. \xdef\temp1{#2 #3}%
  1077. }%
  1078. % Now produce the complete index entry.  We process the index-string again,
  1079. % this time with font commands expanded, to get what to print in the index.
  1080. \edef\temp{%
  1081. \write \csname#1indfile\endcsname{%
  1082. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1083. \temp }%
  1084. \penalty\count10}}
  1085.  
  1086. % The index entry written in the file actually looks like
  1087. %  \entry {sortstring}{page}{topic}
  1088. % or
  1089. %  \entry {sortstring}{page}{topic}{subtopic}
  1090. % The texindex program reads in these files and writes files
  1091. % containing these kinds of lines:
  1092. %  \initial {c}
  1093. %     before the first topic whose initial is c
  1094. %  \entry {topic}{pagelist}
  1095. %     for a topic that is used without subtopics
  1096. %  \primary {topic}
  1097. %     for the beginning of a topic that is used with subtopics
  1098. %  \secondary {subtopic}{pagelist}
  1099. %     for each subtopic.
  1100.  
  1101. % Define the user-accessible indexing commands 
  1102. % @findex, @vindex, @kindex, @cindex.
  1103.  
  1104. \def\findex {\fnindex}
  1105. \def\kindex {\kyindex}
  1106. \def\cindex {\cpindex}
  1107. \def\vindex {\vrindex}
  1108. \def\tindex {\tpindex}
  1109. \def\pindex {\pgindex}
  1110.  
  1111. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1112. {\obeylines %
  1113. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1114. \dosubind{cp}{#2}{#1}}}
  1115.  
  1116. % Define the macros used in formatting output of the sorted index material.
  1117.  
  1118. % This is what you call to cause a particular index to get printed.
  1119. % Write
  1120. % @unnumbered Function Index
  1121. % @printindex fn
  1122.  
  1123. \def\printindex{\parsearg\doprintindex}
  1124.  
  1125. \def\doprintindex#1{\tex %
  1126. \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1127. \catcode`\$=\other\catcode`\_=\other
  1128. \catcode`\~=\other
  1129. % The following don't help, since the chars were translated
  1130. % when the raw index was written, and their fonts were discarded
  1131. % due to \indexnofonts.
  1132. %\catcode`\"=\active
  1133. %\catcode`\^=\active
  1134. %\catcode`\_=\active
  1135. %\catcode`\|=\active
  1136. %\catcode`\<=\active
  1137. %\catcode`\>=\active
  1138. \def\indexbackslash{\rawbackslashxx}
  1139. \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1140. \begindoublecolumns
  1141. \openin 1 \jobname.#1s
  1142. \ifeof 1 \else \closein 1 \input \jobname.#1s
  1143. \fi
  1144. \enddoublecolumns
  1145. \Etex}
  1146.  
  1147. % These macros are used by the sorted index file itself.
  1148. % Change them to control the appearance of the index.
  1149.  
  1150. % Same as \bigskipamount except no shrink.
  1151. % \balancecolumns gets confused if there is any shrink.
  1152. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1153.  
  1154. \outer\def\initial #1{%
  1155. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1156. \ifdim\lastskip<\initialskipamount
  1157. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1158. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1159.  
  1160. \outer\def\entry #1#2{
  1161. {\parfillskip=0in \parskip=0in \parindent=0in
  1162. \hangindent=1in \hangafter=1%
  1163. \noindent\hbox{#1}\indexdotfill #2\par
  1164. }}
  1165.  
  1166. % Like \dotfill except takes at least 1 em.
  1167. \def\indexdotfill{\cleaders\hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
  1168.  
  1169. \def\primary #1{\line{#1\hfil}}
  1170.  
  1171. \newskip\secondaryindent \secondaryindent=0.5cm
  1172.  
  1173. \def\secondary #1#2{
  1174. {\parfillskip=0in \parskip=0in
  1175. \hangindent =1in \hangafter=1
  1176. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1177. }}
  1178.  
  1179. %% Define two-column mode, which is used in indexes.
  1180. %% Adapted from the TeXBook, page 416
  1181. \catcode `\@=11
  1182.  
  1183. \newbox\partialpage
  1184.  
  1185. \newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
  1186. \newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
  1187. \newdimen\availdimen@
  1188.  
  1189. \def\begindoublecolumns{\begingroup
  1190.   \output={\global\setbox\partialpage=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
  1191.   \output={\doublecolumnout} \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
  1192. \def\enddoublecolumns{\output={\balancecolumns}\eject
  1193.   \endgroup \pagegoal=\vsize}
  1194.  
  1195. \def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1196.   \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1197.   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1198.   \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
  1199. \def\pagesofar{\unvbox\partialpage %
  1200.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1201. %          changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
  1202.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1203. \def\balancecolumns{%
  1204. % Unset the glue.
  1205.   \setbox255=\vbox{\unvbox255}
  1206.   \dimen@=\ht255
  1207.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1208.   \divide\dimen@ by2
  1209.   \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpage
  1210. % If the remaining data is too big for one page,
  1211. % output one page normally, then work with what remains.
  1212.   \ifdim \dimen@>\availdimen@
  1213.    {
  1214.      \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1215.      \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1216.      \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1217.      \onepageout\pagesofar
  1218.    }
  1219. % Recompute size of what remains, in case we just output some of it.
  1220.   \dimen@=\ht255
  1221.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1222.   \divide\dimen@ by2
  1223.   \fi
  1224.   \setbox0=\vbox{\unvbox255}
  1225.   \splittopskip=\topskip
  1226.   {\vbadness=10000 \loop \global\setbox3=\copy0
  1227.     \global\setbox1=\vsplit3 to\dimen@
  1228.     \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
  1229.   \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
  1230.   \pagesofar}
  1231.  
  1232. \catcode `\@=\other
  1233. \message{sectioning,}
  1234. % Define chapters, sections, etc.
  1235.  
  1236. \newcount \chapno
  1237. \newcount \secno
  1238. \newcount \subsecno
  1239. \newcount \subsubsecno
  1240.  
  1241. % This counter is funny since it counts through charcodes of letters A, B, ...
  1242. \newcount \appendixno  \appendixno = `\@
  1243. \def\appendixletter{\char\the\appendixno}
  1244.  
  1245. \newwrite \contentsfile
  1246. % This is called from \setfilename.
  1247. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1248.  
  1249. % Each @chapter defines this as the name of the chapter.
  1250. % page headings and footings can use it.  @section does likewise
  1251.  
  1252. \def\thischapter{} \def\thissection{}
  1253. \def\seccheck#1{\if \pageno<0 %
  1254. \errmessage{@#1 not allowed after generating table of contents}\fi
  1255. %
  1256. }
  1257.  
  1258. \def\chapternofonts{%
  1259. \let\rawbackslash=\relax%
  1260. \let\frenchspacing=\relax%
  1261. \def\TeX{\realbackslash TeX}
  1262. \def\dots{\realbackslash dots}
  1263. \def\copyright{\realbackslash copyright}
  1264. \def\tt{\realbackslash tt}
  1265. \def\bf{\realbackslash bf }
  1266. \def\w{\realbackslash w}
  1267. \def\less{\realbackslash less}
  1268. \def\gtr{\realbackslash gtr}
  1269. \def\hat{\realbackslash hat}
  1270. \def\char{\realbackslash char}
  1271. \def\tclose##1{\realbackslash tclose {##1}}
  1272. \def\code##1{\realbackslash code {##1}}
  1273. \def\samp##1{\realbackslash samp {##1}}
  1274. \def\r##1{\realbackslash r {##1}}
  1275. \def\b##1{\realbackslash b {##1}}
  1276. \def\key##1{\realbackslash key {##1}}
  1277. \def\file##1{\realbackslash file {##1}}
  1278. \def\kbd##1{\realbackslash kbd {##1}}
  1279. % These are redefined because @smartitalic wouldn't work inside xdef.
  1280. \def\i##1{\realbackslash i {##1}}
  1281. \def\cite##1{\realbackslash cite {##1}}
  1282. \def\var##1{\realbackslash var {##1}}
  1283. \def\emph##1{\realbackslash emph {##1}}
  1284. \def\dfn##1{\realbackslash dfn {##1}}
  1285. }
  1286.  
  1287. \outer\def\chapter{\parsearg\chapterzzz}
  1288. \def\chapterzzz #1{\seccheck{chapter}%
  1289. \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1290. \chapmacro {#1}{\the\chapno}%
  1291. \gdef\thissection{#1}%
  1292. \gdef\thischaptername{#1}%
  1293. % We don't substitute the actual chapter name into \thischapter
  1294. % because we don't want its macros evaluated now.
  1295. \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
  1296. {\chapternofonts%
  1297. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1298. \escapechar=`\\%
  1299. \write \contentsfile \temp  %
  1300. \donoderef %
  1301. }}
  1302.  
  1303. \outer\def\appendix{\parsearg\appendixzzz}
  1304. \def\appendixzzz #1{\seccheck{appendix}%
  1305. \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1306. \chapmacro {#1}{Appendix \appendixletter}%
  1307. \gdef\thissection{#1}%
  1308. \gdef\thischaptername{#1}%
  1309. \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
  1310. {\chapternofonts%
  1311. \edef\temp{{\realbackslash chapentry {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1312. \escapechar=`\\%
  1313. \write \contentsfile \temp  %
  1314. \appendixnoderef %
  1315. }}
  1316.  
  1317. \outer\def\unnumbered{\parsearg\unnumberedzzz}
  1318. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1319. \secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
  1320. \unnumbchapmacro {#1}%
  1321. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1322. {\chapternofonts%
  1323. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1324. \escapechar=`\\%
  1325. \write \contentsfile \temp  %
  1326. \unnumbnoderef %
  1327. }}
  1328.  
  1329. \outer\def\section{\parsearg\sectionzzz}
  1330. \def\sectionzzz #1{\seccheck{section}%
  1331. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1332. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1333. {\chapternofonts%
  1334. \edef\temp{{\realbackslash secentry %
  1335. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1336. \escapechar=`\\%
  1337. \write \contentsfile \temp %
  1338. \donoderef %
  1339. \penalty 10000 %
  1340. }}
  1341.  
  1342. \outer\def\appendixsection{\parsearg\appendixsectionzzz}
  1343. \outer\def\appendixsec{\parsearg\appendixsectionzzz}
  1344. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1345. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1346. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1347. {\chapternofonts%
  1348. \edef\temp{{\realbackslash secentry %
  1349. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1350. \escapechar=`\\%
  1351. \write \contentsfile \temp %
  1352. \appendixnoderef %
  1353. \penalty 10000 %
  1354. }}
  1355.  
  1356. \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
  1357. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1358. \plainsecheading {#1}\gdef\thissection{#1}%
  1359. {\chapternofonts%
  1360. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1361. \escapechar=`\\%
  1362. \write \contentsfile \temp %
  1363. \unnumbnoderef %
  1364. \penalty 10000 %
  1365. }}
  1366.  
  1367. \outer\def\subsection{\parsearg\subsectionzzz}
  1368. \def\subsectionzzz #1{\seccheck{subsection}%
  1369. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1370. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1371. {\chapternofonts%
  1372. \edef\temp{{\realbackslash subsecentry %
  1373. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1374. \escapechar=`\\%
  1375. \write \contentsfile \temp %
  1376. \donoderef %
  1377. \penalty 10000 %
  1378. }}
  1379.  
  1380. \outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
  1381. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1382. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1383. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1384. {\chapternofonts%
  1385. \edef\temp{{\realbackslash subsecentry %
  1386. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1387. \escapechar=`\\%
  1388. \write \contentsfile \temp %
  1389. \appendixnoderef %
  1390. \penalty 10000 %
  1391. }}
  1392.  
  1393. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1394. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1395. \plainsecheading {#1}\gdef\thissection{#1}%
  1396. {\chapternofonts%
  1397. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1398. \escapechar=`\\%
  1399. \write \contentsfile \temp %
  1400. \unnumbnoderef %
  1401. \penalty 10000 %
  1402. }}
  1403.  
  1404. \outer\def\subsubsection{\parsearg\subsubsectionzzz}
  1405. \def\subsubsectionzzz #1{\seccheck{subsubsection}%
  1406. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1407. \subsubsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1408. {\chapternofonts%
  1409. \edef\temp{{\realbackslash subsubsecentry %
  1410. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
  1411. \escapechar=`\\%
  1412. \write \contentsfile \temp %
  1413. \donoderef %
  1414. \penalty 10000 %
  1415. }}
  1416.  
  1417. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1418. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1419. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1420. \subsubsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1421. {\chapternofonts%
  1422. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1423. {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
  1424. \escapechar=`\\%
  1425. \write \contentsfile \temp %
  1426. \appendixnoderef %
  1427. \penalty 10000 %
  1428. }}
  1429.  
  1430. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1431. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1432. \plainsecheading {#1}\gdef\thissection{#1}%
  1433. {\chapternofonts%
  1434. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1435. \escapechar=`\\%
  1436. \write \contentsfile \temp %
  1437. \unnumbnoderef %
  1438. \penalty 10000 %
  1439. }}
  1440.  
  1441. % These are variants which are not "outer", so they can appear in @ifinfo.
  1442. \def\infounnumbered{\parsearg\unnumberedzzz}
  1443. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1444. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1445. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1446.  
  1447. \def\infoappendix{\parsearg\appendixzzz}
  1448. \def\infoappendixsec{\parsearg\appendixseczzz}
  1449. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1450. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1451.  
  1452. \def\infochapter{\parsearg\chapterzzz}
  1453. \def\infosection{\parsearg\sectionzzz}
  1454. \def\infosubsection{\parsearg\subsectionzzz}
  1455. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  1456.  
  1457. % Define @majorheading, @heading and @subheading
  1458.  
  1459. \def\majorheading{\parsearg\majorheadingzzz}
  1460. \def\majorheadingzzz #1{%
  1461. {\advance\chapheadingskip by 10pt \chapbreak }%
  1462. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
  1463.  
  1464. \def\chapheading{\parsearg\chapheadingzzz}
  1465. \def\chapheadingzzz #1{\chapbreak %
  1466. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
  1467.  
  1468. \def\heading{\parsearg\secheadingi}
  1469.  
  1470. \def\subheading{\parsearg\subsecheadingi}
  1471.  
  1472. \def\subsubheading{\parsearg\subsubsecheadingi}
  1473.  
  1474. % These macros generate a chapter, section, etc. heading only
  1475. % (including whitespace, linebreaking, etc. around it),
  1476. % given all the information in convenient, parsed form.
  1477.  
  1478. %%% Args are the skip and penalty (usually negative)
  1479. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1480.  
  1481. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1482.  
  1483. %%% Define plain chapter starts, and page on/off switching for it
  1484. % Parameter controlling skip before chapter headings (if needed)
  1485.  
  1486. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1487.  
  1488. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1489. \def\chappager{\par\vfill\supereject}
  1490. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1491.  
  1492. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1493.  
  1494. \def\CHAPPAGoff{
  1495. \global\let\pchapsepmacro=\chapbreak
  1496. \global\let\pagealignmacro=\chappager}
  1497.  
  1498. \def\CHAPPAGon{
  1499. \global\let\pchapsepmacro=\chappager
  1500. \global\let\pagealignmacro=\chappager
  1501. \global\def\HEADINGSon{\HEADINGSsingle}}
  1502.  
  1503. \def\CHAPPAGodd{
  1504. \global\let\pchapsepmacro=\chapoddpage
  1505. \global\let\pagealignmacro=\chapoddpage
  1506. \global\def\HEADINGSon{\HEADINGSdouble}}
  1507.  
  1508. \CHAPPAGon
  1509.  
  1510. \def\CHAPFplain{
  1511. \global\let\chapmacro=\chfplain
  1512. \global\let\unnumbchapmacro=\unnchfplain}
  1513.  
  1514. \def\chfplain #1#2{%
  1515.   \pchapsepmacro
  1516.   {%
  1517.     \chapfonts
  1518.     \leftline{\rm #2\enspace #1}%
  1519.   }%
  1520.   \bigskip
  1521.   \penalty5000
  1522. }
  1523.  
  1524. \def\unnchfplain #1{%
  1525. \pchapsepmacro %
  1526. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
  1527. }
  1528. \CHAPFplain % The default
  1529.  
  1530. \def\unnchfopen #1{%
  1531. \chapoddpage {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
  1532. }
  1533.  
  1534. \def\chfopen #1#2{\chapoddpage {\chapfonts
  1535. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1536. \par\penalty 5000 %
  1537. }
  1538.  
  1539. \def\CHAPFopen{
  1540. \global\let\chapmacro=\chfopen
  1541. \global\let\unnumbchapmacro=\unnchfopen}
  1542.  
  1543. % Parameter controlling skip before section headings.
  1544.  
  1545. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  1546. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1547.  
  1548. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  1549. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  1550.  
  1551.  
  1552. % Section fonts are the base font at magstep2, which produces
  1553. % a size a bit more than 14 points in the default situation.    
  1554.  
  1555. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  1556. \def\plainsecheading #1{\secheadingi {#1}}
  1557. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  1558. \secheadingbreak}%
  1559. {\secfonts \line{\rm #1\hfill}}%
  1560. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1561.  
  1562.  
  1563. % Subsection fonts are the base font at magstep1, 
  1564. % which produces a size of 12 points.
  1565.  
  1566. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  1567. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1568. \subsecheadingbreak}%
  1569. {\subsecfonts \line{\rm #1\hfill}}%
  1570. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1571.  
  1572. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  1573.                   % Perhaps make sssec fonts scaled
  1574.                   % magstep half
  1575. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  1576. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1577. \subsecheadingbreak}%
  1578. {\subsubsecfonts \line{\rm #1\hfill}}%
  1579. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  1580.  
  1581.  
  1582. \message{toc printing,}
  1583.  
  1584. % Finish up the main text and prepare to read what we've written
  1585. % to \contentsfile.
  1586.  
  1587. \def\startcontents#1{%
  1588.    \ifnum \pageno>0
  1589.       \pagealignmacro
  1590.       \immediate\closeout \contentsfile
  1591.       \pageno = -1        % Request roman numbered pages.
  1592.    \fi
  1593.    % Don't need to put `Contents' or `Short Contents' in the headline. 
  1594.    % It is abundantly clear what they are.
  1595.    \unnumbchapmacro{#1}\def\thischapter{}%
  1596.    \begingroup           % Set up to handle contents files properly.
  1597.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  1598.       \raggedbottom             % Worry more about breakpoints than the bottom.
  1599.       \advance\hsize by -1in    % Don't use the full line length.
  1600. }
  1601.  
  1602.   
  1603. % Normal (long) toc.
  1604. \outer\def\contents{%
  1605.    \startcontents{Table of Contents}%
  1606.       \input \jobname.toc
  1607.    \endgroup
  1608.    \vfill \eject
  1609. }
  1610.  
  1611. % And just the chapters.
  1612. \outer\def\summarycontents{%
  1613.    \startcontents{Short Contents}%
  1614.       %
  1615.       \let\chapentry = \shortchapentry
  1616.       \let\unnumbchapentry = \shortunnumberedentry
  1617.       % We want a true roman here for the page numbers.
  1618.       \secfonts \let\rm = \truesecrm \rm
  1619.       \advance\baselineskip by 1pt % Open it up a little.
  1620.       \def\secentry ##1##2##3##4{}
  1621.       \def\unnumbsecentry ##1##2{}
  1622.       \def\subsecentry ##1##2##3##4##5{}
  1623.       \def\unnumbsubsecentry ##1##2{}
  1624.       \def\subsubsecentry ##1##2##3##4##5##6{}
  1625.       \def\unnumbsubsubsecentry ##1##2{}
  1626.       \input \jobname.toc
  1627.    \endgroup
  1628.    \vfill \eject
  1629. }
  1630. \let\shortcontents = \summarycontents
  1631.  
  1632. % These macros generate individual entries in the table of contents.
  1633. % The first argument is the chapter or section name.
  1634. % The last argument is the page number.
  1635. % The arguments in between are the chapter number, section number, ...
  1636.  
  1637. % Chapter-level things, for both the long and short contents.
  1638. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  1639. \def\shortchapentry#1#2#3{%
  1640.    \line{{#2\labelspace #1}\dotfill\doshortpageno{#3}}%
  1641. }
  1642.  
  1643. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  1644. \def\shortunnumberedentry#1#2{%
  1645.    \line{#1\dotfill\doshortpageno{#2}}%
  1646. }
  1647.  
  1648. % Sections.
  1649. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  1650. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  1651.  
  1652. % Subsections.
  1653. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  1654. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  1655.  
  1656. % And subsubsections.
  1657. \def\subsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  1658. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  1659.  
  1660.  
  1661. % This parameter controls the indentation of the various levels.
  1662. \newdimen\tocindent \tocindent = 3pc
  1663.  
  1664. % Now for the actual typesetting. In all these, #1 is the text and #2 is the 
  1665. % page number.
  1666. %
  1667. % If the toc has to be broken over pages, we would want to be at chapters 
  1668. % if at all possible; hence the \penalty.
  1669. \def\dochapentry#1#2{%
  1670.    \penalty-300 \vskip\baselineskip
  1671.    \line{\chapentryfonts #1\dotfill \dopageno{#2}}%
  1672.    \nobreak\vskip .25\baselineskip
  1673. }
  1674.  
  1675. \def\dosecentry#1#2{%
  1676.    \line{\secentryfonts \hskip\tocindent #1\dotfill \dopageno{#2}}%
  1677. }
  1678.  
  1679. \def\dosubsecentry#1#2{%
  1680.    \line{\subsecentryfonts \hskip2\tocindent #1\dotfill \dopageno{#2}}%
  1681. }
  1682.  
  1683. \def\dosubsubsecentry#1#2{%
  1684.    \line{\subsubsecentryfonts \hskip3\tocindent #1\dotfill \dopageno{#2}}%
  1685. }
  1686.  
  1687. % Space between chapter (or whatever) number and the title.
  1688. \def\labelspace{\hskip1em \relax}
  1689.  
  1690. \def\dopageno#1{{\rm #1}}
  1691. \def\doshortpageno#1{{\rm #1}}
  1692.  
  1693. \def\chapentryfonts{\secfonts \rm}
  1694. \def\secentryfonts{\textfonts}
  1695. \let\subsecentryfonts = \textfonts
  1696. \let\subsubsecentryfonts = \textfonts
  1697.  
  1698.  
  1699. \message{environments,}
  1700.  
  1701. % Since these characters are used in examples, it should be an even number of 
  1702. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  1703. % Furthermore, these definitions must come after we define our fonts.
  1704. \newbox\dblarrowbox    \newbox\longdblarrowbox
  1705. \newbox\pushcharbox    \newbox\bullbox
  1706. \newbox\equivbox       \newbox\errorbox
  1707.  
  1708. \let\ptexequiv = \equiv
  1709.  
  1710. {\tentt
  1711. \global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  1712. \global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  1713. \global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  1714. \global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  1715. % Adapted from the manmac format (p.420 of TeXbook)
  1716. \global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  1717.                                       depth .1ex\hfil}
  1718. }
  1719.  
  1720. \def\point{$\star$}
  1721.  
  1722. \def\result{\leavevmode\raise.15ex\copy\dblarrowbox}
  1723. \def\expansion{\leavevmode\raise.1ex\copy\longdblarrowbox}
  1724. \def\print{\leavevmode\lower.1ex\copy\pushcharbox}
  1725.  
  1726. \def\equiv{\leavevmode\lower.1ex\copy\equivbox}
  1727.  
  1728. % Does anyone really want this?
  1729. % \def\bull{\leavevmode\copy\bullbox}
  1730.  
  1731. % Adapted from the TeXbook's \boxit.
  1732. {\tentt \global\dimen0 = 3em}% Width of the box.
  1733. \dimen2 = .55pt % Thickness of rules
  1734. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  1735. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  1736.  
  1737. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  1738.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  1739.    \advance\hsize by -2\dimen2 % Rules.
  1740.    \vbox{
  1741.       \hrule height\dimen2
  1742.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  1743.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  1744.          \kern3pt\vrule width\dimen2}% Space to right.
  1745.       \hrule height\dimen2}
  1746.     \hfil}
  1747.  
  1748. % The @error{} command.
  1749. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  1750.  
  1751. % @tex ... @end tex    escapes into raw Tex temporarily.
  1752. % One exception: @ is still an escape character, so that @end tex works.
  1753. % But \@ or @@ will get a plain tex @ character.
  1754.  
  1755. \def\tex{\begingroup
  1756. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  1757. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  1758. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  1759. \catcode `\%=14
  1760. \catcode`\"=12
  1761. \catcode`\==12
  1762. \catcode`\|=12
  1763. \catcode`\<=12
  1764. \catcode`\>=12
  1765. \escapechar=`\\
  1766. %
  1767. \let\{=\ptexlbrace
  1768. \let\}=\ptexrbrace
  1769. \let\.=\ptexdot
  1770. \let\*=\ptexstar
  1771. \let\dots=\ptexdots
  1772. \def\@={@}%
  1773. \let\bullet=\ptexbullet
  1774. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  1775. \let\L=\ptexL
  1776. %
  1777. \let\Etex=\endgroup}
  1778.  
  1779. % Define @lisp ... @endlisp.
  1780. % @lisp does a \begingroup so it can rebind things,
  1781. % including the definition of @endlisp (which normally is erroneous).
  1782.  
  1783. % Amount to narrow the margins by for @lisp.
  1784. \newskip\lispnarrowing \lispnarrowing=0.4in
  1785.  
  1786. % This is the definition that ^M gets inside @lisp
  1787. % phr: changed space to \null, to avoid overfull hbox problems.
  1788. {\obeyspaces%
  1789. \gdef\lisppar{\null\endgraf}}
  1790.  
  1791. % Cause \obeyspaces to make each Space cause a word-separation
  1792. % rather than the default which is that it acts punctuation.
  1793. % This is because space in tt font looks funny.
  1794. {\obeyspaces %
  1795. \gdef\sepspaces{\def {\ }}}
  1796.  
  1797. \newskip\aboveenvskipamount \aboveenvskipamount= 0pt
  1798. \def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
  1799. \endgraf \ifdim\lastskip<\aboveenvskipamount
  1800. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
  1801.  
  1802. \def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
  1803. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
  1804.  
  1805. \def\lisp{\aboveenvbreak\begingroup\inENV %This group ends at the end of the @lisp body
  1806. \hfuzz=12truept % Don't be fussy
  1807. % Make spaces be word-separators rather than space tokens.
  1808. \sepspaces %
  1809. % Single space lines
  1810. \singlespace %
  1811. % The following causes blank lines not to be ignored
  1812. % by adding a space to the end of each line.
  1813. \let\par=\lisppar
  1814. \def\Elisp{\endgroup\afterenvbreak}%
  1815. \parskip=0pt
  1816. \advance \leftskip by \lispnarrowing
  1817. \parindent=0pt
  1818. \let\exdent=\internalexdent
  1819. \obeyspaces \obeylines \tt \rawbackslash
  1820. \def\next##1{}\next}
  1821.  
  1822.  
  1823. \let\example=\lisp
  1824. \def\Eexample{\Elisp}
  1825.  
  1826. \let\smallexample=\lisp
  1827. \def\Esmallexample{\Elisp}
  1828.  
  1829. % Macro for 9 pt. examples, necessary to print with 5" lines.
  1830. % From Pavel@xerox.  This is not really used unless the
  1831. % @smallbook command is given.
  1832.  
  1833. \def\smalllispx{\aboveenvbreak\begingroup\inENV
  1834. %            This group ends at the end of the @lisp body
  1835. \hfuzz=12truept % Don't be fussy
  1836. % Make spaces be word-separators rather than space tokens.
  1837. \sepspaces %
  1838. % Single space lines
  1839. \singlespace %
  1840. % The following causes blank lines not to be ignored
  1841. % by adding a space to the end of each line.
  1842. \let\par=\lisppar
  1843. \def\Esmalllisp{\endgroup\afterenvbreak}%
  1844. \parskip=0pt
  1845. \advance \leftskip by \lispnarrowing
  1846. \parindent=0pt
  1847. \let\exdent=\internalexdent
  1848. \obeyspaces \obeylines \ninett \indexfonts \rawbackslash
  1849. \def\next##1{}\next}
  1850.  
  1851. % This is @display; same as @lisp except use roman font.
  1852.  
  1853. \def\display{\begingroup\inENV %This group ends at the end of the @display body
  1854. \aboveenvbreak
  1855. % Make spaces be word-separators rather than space tokens.
  1856. \sepspaces %
  1857. % Single space lines
  1858. \singlespace %
  1859. % The following causes blank lines not to be ignored
  1860. % by adding a space to the end of each line.
  1861. \let\par=\lisppar
  1862. \def\Edisplay{\endgroup\afterenvbreak}%
  1863. \parskip=0pt
  1864. \advance \leftskip by \lispnarrowing
  1865. \parindent=0pt
  1866. \let\exdent=\internalexdent
  1867. \obeyspaces \obeylines
  1868. \def\next##1{}\next}
  1869.  
  1870. % This is @format; same as @lisp except use roman font and don't narrow margins
  1871.  
  1872. \def\format{\begingroup\inENV %This group ends at the end of the @format body
  1873. \aboveenvbreak
  1874. % Make spaces be word-separators rather than space tokens.
  1875. \sepspaces %
  1876. \singlespace %
  1877. % The following causes blank lines not to be ignored
  1878. % by adding a space to the end of each line.
  1879. \let\par=\lisppar
  1880. \def\Eformat{\endgroup\afterenvbreak}
  1881. \parskip=0pt \parindent=0pt
  1882. \obeyspaces \obeylines
  1883. \def\next##1{}\next}
  1884.  
  1885. % @flushleft and @flushright
  1886.  
  1887. \def\flushleft{\begingroup\inENV %This group ends at the end of the @format body
  1888. \aboveenvbreak
  1889. % Make spaces be word-separators rather than space tokens.
  1890. \sepspaces %
  1891. % The following causes blank lines not to be ignored
  1892. % by adding a space to the end of each line.
  1893. % This also causes @ to work when the directive name
  1894. % is terminated by end of line.
  1895. \let\par=\lisppar
  1896. \def\Eflushleft{\endgroup\afterenvbreak}%
  1897. \parskip=0pt \parindent=0pt
  1898. \obeyspaces \obeylines
  1899. \def\next##1{}\next}
  1900.  
  1901. \def\flushright{\begingroup\inENV %This group ends at the end of the @format body
  1902. \aboveenvbreak
  1903. % Make spaces be word-separators rather than space tokens.
  1904. \sepspaces %
  1905. % The following causes blank lines not to be ignored
  1906. % by adding a space to the end of each line.
  1907. % This also causes @ to work when the directive name
  1908. % is terminated by end of line.
  1909. \let\par=\lisppar
  1910. \def\Eflushright{\endgroup\afterenvbreak}%
  1911. \parskip=0pt \parindent=0pt
  1912. \advance \leftskip by 0pt plus 1fill
  1913. \obeyspaces \obeylines
  1914. \def\next##1{}\next}
  1915.  
  1916. % @quotation - narrow the margins.
  1917.  
  1918. \def\quotation{\begingroup\inENV %This group ends at the end of the @quotation body
  1919. {\parskip=0pt  % because we will skip by \parskip too, later
  1920. \aboveenvbreak}%
  1921. \singlespace
  1922. \parindent=0pt
  1923. \def\Equotation{\par\endgroup\afterenvbreak}%
  1924. \advance \rightskip by \lispnarrowing 
  1925. \advance \leftskip by \lispnarrowing}
  1926.  
  1927. \message{defuns,}
  1928. % Define formatter for defuns
  1929. % First, allow user to change definition object font (\df) internally
  1930. \def\setdeffont #1 {\csname DEF#1\endcsname}
  1931.  
  1932. \newskip\defbodyindent \defbodyindent=.4in
  1933. \newskip\defargsindent \defargsindent=50pt
  1934. \newskip\deftypemargin \deftypemargin=12pt
  1935. \newskip\deflastargmargin \deflastargmargin=18pt
  1936.  
  1937. \newcount\parencount
  1938. % define \functionparens, which makes ( and ) and & do special things.
  1939. % \functionparens affects the group it is contained in.
  1940. \def\activeparens{%
  1941. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  1942. \catcode`\[=\active \catcode`\]=\active}
  1943. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  1944. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  1945. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  1946.  
  1947. % Definitions of (, ) and & used in args for functions.
  1948. % This is the definition of ( outside of all parentheses.
  1949. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  1950. \global\advance\parencount by 1 }
  1951. %
  1952. % This is the definition of ( when already inside a level of parens.
  1953. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  1954. %
  1955. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  1956. % also in that case restore the outer-level definition of (.
  1957. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  1958. \global\advance \parencount by -1 }
  1959. % If we encounter &foo, then turn on ()-hacking afterwards
  1960. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  1961. %
  1962. \gdef\normalparens{\boldbrax\let&=\ampnr}
  1963. } % End of definition inside \activeparens
  1964. %% These parens (in \boldbrax) actually are a little bolder than the
  1965. %% contained text.  This is especially needed for [ and ]
  1966. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  1967. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  1968.  
  1969. % First, defname, which formats the header line itself.
  1970. % #1 should be the function name.
  1971. % #2 should be the type of definition, such as "Function".
  1972.  
  1973. \def\defname #1#2{%
  1974. \leftskip = 0in  %
  1975. \noindent        %
  1976. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  1977. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  1978. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  1979. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  1980. % Now output arg 2 ("Function" or some such)
  1981. % ending at \deftypemargin from the right margin,
  1982. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  1983. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}%
  1984. \tolerance=10000 \hbadness=10000    % Make all lines underfull and no complaints
  1985. {\df #1}\enskip        % Generate function name
  1986. }
  1987.  
  1988. % Actually process the body of a definition
  1989. % #1 should be the terminating control sequence, such as \Edefun.
  1990. % #2 should be the "another name" control sequence, such as \defunx.
  1991. % #3 should be the control sequence that actually processes the header,
  1992. %    such as \defunheader.
  1993.  
  1994. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  1995. \medbreak %
  1996. % Define the end token that this defining construct specifies
  1997. % so that it will exit this group.
  1998. \def#1{\endgraf\endgroup\medbreak}%
  1999. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2000. \parindent=0in \leftskip=\defbodyindent \rightskip=\defbodyindent %
  2001. \begingroup %
  2002. \catcode 61=\active %
  2003. \obeylines\activeparens\spacesplit#3}
  2004.  
  2005. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2006. \medbreak %
  2007. % Define the end token that this defining construct specifies
  2008. % so that it will exit this group.
  2009. \def#1{\endgraf\endgroup\medbreak}%
  2010. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2011. \parindent=0in \leftskip=\defbodyindent \rightskip=\defbodyindent %
  2012. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2013.  
  2014. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2015. \medbreak %
  2016. % Define the end token that this defining construct specifies
  2017. % so that it will exit this group.
  2018. \def#1{\endgraf\endgroup\medbreak}%
  2019. \def#2##1 ##2 {\def#4{##1}%
  2020. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2021. \parindent=0in \leftskip=\defbodyindent %
  2022. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2023.  
  2024. % Split up #2 at the first space token.
  2025. % call #1 with two arguments:
  2026. %  the first is all of #2 before the space token,
  2027. %  the second is all of #2 after that space token.
  2028. % If #2 contains no space token, all of it is passed as the first arg
  2029. % and the second is passed as empty.
  2030.  
  2031. {\obeylines
  2032. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2033. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2034. \ifx\relax #3%
  2035. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2036.  
  2037. % So much for the things common to all kinds of definitions.
  2038.  
  2039. % Define @defun.
  2040.  
  2041. % First, define the processing that is wanted for arguments of \defun
  2042. % Use this to expand the args and terminate the paragraph they make up
  2043.  
  2044. \def\defunargs #1{\functionparens \sl
  2045. % Expand, preventing hyphenation at `-' chars.
  2046. % Note that groups don't affect changes in \hyphenchar.
  2047. \hyphenchar\sl=0
  2048. #1%
  2049. \hyphenchar\sl=45
  2050. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2051. \interlinepenalty=10000
  2052. \advance\rightskip by 0pt plus 1fil
  2053. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2054. }
  2055.  
  2056. \def\deftypefunargs #1{%
  2057. % Expand, preventing hyphenation at `-' chars.
  2058. % Note that groups don't affect changes in \hyphenchar.
  2059. \functionparens
  2060. \code{#1}%
  2061. \interlinepenalty=10000
  2062. \advance\rightskip by 0pt plus 1fil
  2063. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2064. }
  2065.  
  2066. % Do complete processing of one @defun or @defunx line already parsed.
  2067.  
  2068. % @deffn Command forward-char nchars
  2069.  
  2070. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2071.  
  2072. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2073. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2074. \catcode 61=\other % Turn off change made in \defparsebody
  2075. }
  2076.  
  2077. % @defun == @deffn Function
  2078.  
  2079. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2080.  
  2081. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2082. \begingroup\defname {#1}{Function}%
  2083. \defunargs {#2}\endgroup %
  2084. \catcode 61=\other % Turn off change made in \defparsebody
  2085. }
  2086.  
  2087. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2088.  
  2089. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2090.  
  2091. % #1 is the data type.  #2 is the name and args.
  2092. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2093. % #1 is the data type, #2 the name, #3 the args.
  2094. \def\deftypefunheaderx #1#2 #3\relax{\doind {fn}{\code{#2}}% Make entry in function index
  2095. \begingroup\defname {\code{#1} #2}{Function}%
  2096. \deftypefunargs {#3}\endgroup %
  2097. \catcode 61=\other % Turn off change made in \defparsebody
  2098. }
  2099.  
  2100. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2101.  
  2102. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2103.  
  2104. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2105. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2106. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2107. \def\deftypefnheaderx #1#2#3 #4\relax{\doind {fn}{\code{#3}}% Make entry in function index
  2108. \begingroup\defname {\code{#2} #3}{#1}%
  2109. \deftypefunargs {#4}\endgroup %
  2110. \catcode 61=\other % Turn off change made in \defparsebody
  2111. }
  2112.  
  2113. % @defmac == @deffn Macro
  2114.  
  2115. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2116.  
  2117. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2118. \begingroup\defname {#1}{Macro}%
  2119. \defunargs {#2}\endgroup %
  2120. \catcode 61=\other % Turn off change made in \defparsebody
  2121. }
  2122.  
  2123. % @defspec == @deffn Special Form
  2124.  
  2125. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2126.  
  2127. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2128. \begingroup\defname {#1}{Special Form}%
  2129. \defunargs {#2}\endgroup %
  2130. \catcode 61=\other % Turn off change made in \defparsebody
  2131. }
  2132.  
  2133. % This definition is run if you use @defunx
  2134. % anywhere other than immediately after a @defun or @defunx.
  2135.  
  2136. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2137. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2138. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2139. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2140. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2141. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2142.  
  2143. % @defmethod, and so on
  2144.  
  2145. % @defop {Funny Method} foo-class frobnicate argument
  2146.  
  2147. \def\defop #1 {\def\defoptype{#1}%
  2148. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2149.  
  2150. \def\defopheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2151. \begingroup\defname {#2}{\defoptype{} on #1}%
  2152. \defunargs {#3}\endgroup %
  2153. }
  2154.  
  2155. % @defmethod == @defop Method
  2156.  
  2157. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2158.  
  2159. \def\defmethodheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2160. \begingroup\defname {#2}{Method on #1}%
  2161. \defunargs {#3}\endgroup %
  2162. }
  2163.  
  2164. % @defcv {Class Option} foo-class foo-flag
  2165.  
  2166. \def\defcv #1 {\def\defcvtype{#1}%
  2167. \defopparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2168.  
  2169. \def\defcvarheader #1#2#3{%
  2170. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2171. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2172. \defvarargs {#3}\endgroup %
  2173. }
  2174.  
  2175. % @defivar == @defcv {Instance Variable}
  2176.  
  2177. \def\defivar{\defmethparsebody\Edefivar\defivarx\defivarheader}
  2178.  
  2179. \def\defivarheader #1#2#3{%
  2180. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2181. \begingroup\defname {#2}{Instance Variable of #1}%
  2182. \defvarargs {#3}\endgroup %
  2183. }
  2184.  
  2185. % These definitions are run if you use @defmethodx, etc.,
  2186. % anywhere other than immediately after a @defmethod, etc.
  2187.  
  2188. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2189. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2190. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2191. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2192.  
  2193. % Now @defvar
  2194.  
  2195. % First, define the processing that is wanted for arguments of @defvar.
  2196. % This is actually simple: just print them in roman.
  2197. % This must expand the args and terminate the paragraph they make up
  2198. \def\defvarargs #1{\normalparens #1%
  2199. \interlinepenalty=10000
  2200. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2201.  
  2202. % @defvr Counter foo-count
  2203.  
  2204. \def\defvr{\defmethparsebody\Edefvr\defvrx\defvrheader}
  2205.  
  2206. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2207. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2208.  
  2209. % @defvar == @defvr Variable
  2210.  
  2211. \def\defvar{\defparsebody\Edefvar\defvarx\defvarheader}
  2212.  
  2213. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2214. \begingroup\defname {#1}{Variable}%
  2215. \defvarargs {#2}\endgroup %
  2216. }
  2217.  
  2218. % @defopt == @defvr {User Option}
  2219.  
  2220. \def\defopt{\defparsebody\Edefopt\defoptx\defoptheader}
  2221.  
  2222. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2223. \begingroup\defname {#1}{User Option}%
  2224. \defvarargs {#2}\endgroup %
  2225. }
  2226.  
  2227. % @deftypevar int foobar
  2228.  
  2229. \def\deftypevar{\defparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2230.  
  2231. % #1 is the data type.  #2 is the name.
  2232. \def\deftypevarheader #1#2{\doind {vr}{\code{#2}}% Make entry in variables index
  2233. \begingroup\defname {\code{#1} #2}{Variable}%
  2234. \interlinepenalty=10000
  2235. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2236. \endgroup}
  2237.  
  2238. % @deftypevr {Global Flag} int enable
  2239.  
  2240. \def\deftypevr{\defmethparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2241.  
  2242. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2243. \begingroup\defname {\code{#2} #3}{#1}
  2244. \interlinepenalty=10000
  2245. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2246. \endgroup}
  2247.  
  2248. % This definition is run if you use @defvarx
  2249. % anywhere other than immediately after a @defvar or @defvarx.
  2250.  
  2251. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2252. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2253. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2254. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2255. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2256.  
  2257. % Now define @deftp
  2258. % Args are printed in bold, a slight difference from @defvar.
  2259.  
  2260. \def\deftpargs #1{\bf \defvarargs{#1}}
  2261.  
  2262. % @deftp Class window height width ...
  2263.  
  2264. \def\deftp{\defmethparsebody\Edeftp\deftpx\deftpheader}
  2265.  
  2266. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2267. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2268.  
  2269. % This definition is run if you use @deftpx, etc
  2270. % anywhere other than immediately after a @deftp, etc.
  2271.  
  2272. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2273.  
  2274. \message{cross reference,}
  2275. % Define cross-reference macros
  2276. \newwrite \auxfile
  2277.  
  2278. \newif\ifhavexrefs  % True if xref values are known.
  2279. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2280.  
  2281. % \setref{foo} defines a cross-reference point named foo.
  2282.  
  2283. \def\setref#1{%
  2284. \dosetq{#1-title}{Ytitle}%
  2285. \dosetq{#1-pg}{Ypagenumber}%
  2286. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2287.  
  2288. \def\unnumbsetref#1{%
  2289. \dosetq{#1-title}{Ytitle}%
  2290. \dosetq{#1-pg}{Ypagenumber}%
  2291. \dosetq{#1-snt}{Ynothing}}
  2292.  
  2293. \def\appendixsetref#1{%
  2294. \dosetq{#1-title}{Ytitle}%
  2295. \dosetq{#1-pg}{Ypagenumber}%
  2296. \dosetq{#1-snt}{Yappendixletterandtype}}
  2297.  
  2298. % \xref, \pxref, and \ref generate cross-references to specified points.
  2299. % For \xrefX, #1 is the node name, #2 the name of the Info
  2300. % cross-reference, #3 the printed node name, #4 the name of the Info
  2301. % file, #5 the name of the printed manual.  All but the node name can be
  2302. % omitted.
  2303. \def\pxref#1{see \xrefX[#1,,,,,,,]}
  2304. \def\xref#1{See \xrefX[#1,,,,,,,]}
  2305. \def\ref#1{\xrefX[#1,,,,,,,]}
  2306. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
  2307. \def\printedmanual{\ignorespaces #5}%
  2308. \def\printednodename{\ignorespaces #3}%
  2309. %
  2310. \setbox1=\hbox{\i{\printedmanual}}%
  2311. \setbox0=\hbox{\printednodename}%
  2312. \ifdim \wd0=0pt%
  2313. \def\printednodename{\ignorespaces #1}%
  2314. %%% Uncommment the following line to make the actual chapter or section title
  2315. %%% appear inside the square brackets.
  2316. %\def\printednodename{#1-title}%
  2317. \fi%
  2318. %
  2319. %
  2320. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
  2321. % not insert empty discretionaries after hyphens, which means that it
  2322. % will not find a line break at a hyphen in a node names.  Since some
  2323. % manuals are best written with fairly long node names, containing
  2324. % hyphens, this is a loss.  Therefore, we simply give the text of
  2325. % the node name again, so it is as if TeX is seeing it for the first
  2326. % time.
  2327. \ifdim \wd1>0pt
  2328. section `\printednodename' in \printedmanual
  2329. \else%
  2330. \turnoffactive%
  2331. \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
  2332. \fi
  2333. \endgroup}
  2334.  
  2335. % \dosetq is the interface for calls from other macros
  2336.  
  2337. % Use \turnoffactive so that punctuation chars such as underscore
  2338. % work in node names.
  2339. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  2340. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2341. \next}}
  2342.  
  2343. % \internalsetq {foo}{page} expands into CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2344. % When the aux file is read, ' is the escape character
  2345.  
  2346. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2347.  
  2348. % Things to be expanded by \internalsetq
  2349.  
  2350. \def\Ypagenumber{\folio}
  2351.  
  2352. \def\Ytitle{\thischapter}
  2353.  
  2354. \def\Ynothing{}
  2355.  
  2356. \def\Ysectionnumberandtype{%
  2357. \ifnum\secno=0 Chapter\xreftie\the\chapno %
  2358. \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
  2359. \else \ifnum \subsubsecno=0 %
  2360. Section\xreftie\the\chapno.\the\secno.\the\subsecno %
  2361. \else %
  2362. Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2363. \fi \fi \fi }
  2364.  
  2365. \def\Yappendixletterandtype{%
  2366. \ifnum\secno=0 Appendix\xreftie'char\the\appendixno %
  2367. \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
  2368. \else \ifnum \subsubsecno=0 %
  2369. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2370. \else %
  2371. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2372. \fi \fi \fi }
  2373.  
  2374. \gdef\xreftie{'tie}
  2375.  
  2376. % Use TeX 3.0's \inputlineno to get the line number, for better error
  2377. % messages, but if we're using an old version of TeX, don't do anything.
  2378. \ifx\inputlineno\thisisundefined
  2379.   \let\linenumber = \empty % Non-3.0.
  2380. \else
  2381.   \def\linenumber{\the\inputlineno:\space}
  2382. \fi
  2383.  
  2384. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2385. % If its value is nonempty, SUFFIX is output afterward.
  2386.  
  2387. \def\refx#1#2{%
  2388.   \expandafter\ifx\csname X#1\endcsname\relax
  2389.     % If not defined, say something at least.
  2390.     $\langle$un\-de\-fined$\rangle$%
  2391.     \ifhavexrefs
  2392.       \message{\linenumber Undefined cross reference `#1'.}%
  2393.     \else
  2394.       \ifwarnedxrefs\else
  2395.         \global\warnedxrefstrue
  2396.         \message{Cross reference values unknown; you must run TeX again.}%
  2397.       \fi
  2398.     \fi
  2399.   \else
  2400.     % It's defined, so just use it.
  2401.     \csname X#1\endcsname
  2402.   \fi
  2403.   #2% Output the suffix in any case.
  2404. }
  2405.  
  2406. % Read the last existing aux file, if any.  No error if none exists.
  2407.  
  2408. % This is the macro invoked by entries in the aux file.
  2409. \def\xrdef #1#2{
  2410. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2411.  
  2412. \def\readauxfile{%
  2413. \begingroup
  2414. \catcode `\^^@=\other
  2415. \catcode `\=\other
  2416. \catcode `\=\other
  2417. \catcode `\^^C=\other
  2418. \catcode `\^^D=\other
  2419. \catcode `\^^E=\other
  2420. \catcode `\^^F=\other
  2421. \catcode `\^^G=\other
  2422. \catcode `\^^H=\other
  2423. \catcode `\ =\other
  2424. \catcode `\^^L=\other
  2425. \catcode `\=\other
  2426. \catcode `\=\other
  2427. \catcode `\=\other
  2428. \catcode `\=\other
  2429. \catcode `\=\other
  2430. \catcode `\=\other
  2431. \catcode `\=\other
  2432. \catcode `\=\other
  2433. \catcode `\=\other
  2434. \catcode `\=\other
  2435. \catcode `\=\other
  2436. \catcode `\=\other
  2437. \catcode `\=\other
  2438. \catcode `\^^[=\other
  2439. \catcode `\^^\=\other
  2440. \catcode `\^^]=\other
  2441. \catcode `\^^^=\other
  2442. \catcode `\^^_=\other
  2443. \catcode `\@=\other
  2444. \catcode `\^=\other
  2445. \catcode `\~=\other
  2446. \catcode `\[=\other
  2447. \catcode `\]=\other
  2448. \catcode`\"=\other
  2449. \catcode`\_=\other
  2450. \catcode`\|=\other
  2451. \catcode`\<=\other
  2452. \catcode`\>=\other
  2453. \catcode `\$=\other
  2454. \catcode `\#=\other
  2455. \catcode `\&=\other
  2456. % the aux file uses ' as the escape.
  2457. % Turn off \ as an escape so we do not lose on
  2458. % entries which were dumped with control sequences in their names.
  2459. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  2460. % Reference to such entries still does not work the way one would wish,
  2461. % but at least they do not bomb out when the aux file is read in.
  2462. \catcode `\{=1 \catcode `\}=2
  2463. \catcode `\%=\other
  2464. \catcode `\'=0
  2465. \catcode `\\=\other
  2466. \openin 1 \jobname.aux
  2467. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  2468. \fi
  2469. % Open the new aux file.  Tex will close it automatically at exit.
  2470. \openout \auxfile=\jobname.aux
  2471. \endgroup}
  2472.  
  2473.  
  2474. % Footnotes.
  2475.  
  2476. \newcount \footnoteno
  2477.  
  2478. \def\supereject{\par\penalty -20000\footnoteno =0 }
  2479.  
  2480. \let\ptexfootnote=\footnote
  2481.  
  2482. {\catcode `\@=11
  2483. \long\gdef\footnote #1{\global\advance \footnoteno by \@ne
  2484. \edef\thisfootno{$^{\the\footnoteno}$}%
  2485. \let\@sf\empty
  2486. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  2487. \thisfootno\@sf \footnotezzz{#1}}
  2488. % \parsearg\footnotezzz}
  2489.  
  2490. \long\gdef\footnotezzz #1{\insert\footins{
  2491. \interlinepenalty\interfootnotelinepenalty
  2492. \splittopskip\ht\strutbox % top baseline for broken footnotes
  2493. \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  2494. \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  2495. \footstrut\hang\textindent{\thisfootno}#1\strut}}
  2496.  
  2497. }%end \catcode `\@=11
  2498.  
  2499. % End of control word definitions.
  2500.  
  2501. \message{and turning on texinfo input format.}
  2502.  
  2503. \def\openindices{%
  2504.    \newindex{cp}%
  2505.    \newcodeindex{fn}%
  2506.    \newcodeindex{vr}%
  2507.    \newcodeindex{tp}%
  2508.    \newcodeindex{ky}%
  2509.    \newcodeindex{pg}%
  2510. }
  2511.  
  2512. % Set some numeric style parameters, for 8.5 x 11 format.
  2513.  
  2514. %\hsize = 6.5in
  2515. \parindent 15pt
  2516. \parskip 18pt plus 1pt
  2517. \baselineskip 15pt
  2518. \advance\topskip by 1.2cm
  2519.  
  2520. % Prevent underfull vbox error messages.
  2521. \vbadness=10000
  2522.  
  2523. % Use @smallbook to reset parameters for 7x9.5 format
  2524. \def\smallbook{
  2525. \global\lispnarrowing = 0.3in
  2526. \global\baselineskip 12pt
  2527. \global\parskip 3pt plus 1pt
  2528. \global\hsize = 5in
  2529. \global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
  2530. \global\vsize=7.5in
  2531. \global\tolerance=700
  2532. \global\hfuzz=1pt
  2533.  
  2534. \global\pagewidth=\hsize
  2535. \global\pageheight=\vsize
  2536.  
  2537. \global\let\smalllisp=\smalllispx
  2538. \global\let\smallexample=\smalllispx
  2539. \global\def\Esmallexample{\Esmalllisp}
  2540. }
  2541.  
  2542. %% For a final copy, take out the rectangles
  2543. %% that mark overfull boxes (in case you have decided
  2544. %% that the text looks ok even though it passes the margin).
  2545. \def\finalout{\overfullrule=0pt}
  2546.  
  2547. % Define macros to output various characters with catcode for normal text.
  2548. \catcode`\"=\other
  2549. \catcode`\~=\other
  2550. \catcode`\^=\other
  2551. \catcode`\_=\other
  2552. \catcode`\|=\other
  2553. \catcode`\<=\other
  2554. \catcode`\>=\other
  2555. \catcode`\+=\other
  2556. \def\normaldoublequote{"}
  2557. \def\normaltilde{~}
  2558. \def\normalcaret{^}
  2559. \def\normalunderscore{_}
  2560. \def\normalverticalbar{|}
  2561. \def\normalless{<}
  2562. \def\normalgreater{>}
  2563. \def\normalplus{+}
  2564.  
  2565. % This macro is used to make a character print one way in ttfont
  2566. % where it can probably just be output, and another way in other fonts,
  2567. % where something hairier probably needs to be done.
  2568. %
  2569. % #1 is what to print if we are indeed using \tt; #2 is what to print
  2570. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  2571. % interword stretch (and shrink), and it is reasonable to expect all
  2572. % typewriter fonts to have this, we can check that font parameter.
  2573. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  2574.  
  2575. % Turn off all special characters except @
  2576. % (and those which the user can use as if they were ordinary).
  2577. % Most of these we simply print from the \tt font, but for some, we can
  2578. % use math or other variants that look better in normal text.
  2579.  
  2580. \catcode`\"=\active
  2581. \def\activedoublequote{{\tt \char '042}}
  2582. \let"=\activedoublequote
  2583. \catcode`\~=\active
  2584. \def~{{\tt \char '176}}
  2585. \chardef\hat=`\^
  2586. \catcode`\^=\active
  2587. \def^{{\tt \hat}}
  2588.  
  2589. \catcode`\_=\active
  2590. \def_{\ifusingtt\normalunderscore\_}
  2591. % Subroutine for the previous macro.
  2592. \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  2593.  
  2594. \catcode`\|=\active
  2595. \def|{{\tt \char '174}}
  2596. \chardef \less=`\<
  2597. \catcode`\<=\active
  2598. \def<{{\tt \less}}
  2599. \chardef \gtr=`\>
  2600. \catcode`\>=\active
  2601. \def>{{\tt \gtr}}
  2602. \catcode`\+=\active
  2603. \def+{{\tt \char 43}}
  2604. %\catcode 27=\active
  2605. %\def^^[{$\diamondsuit$}
  2606.  
  2607. % Used sometimes to turn off (effectively) the active characters
  2608. % even after parsing them.
  2609. \def\turnoffactive{\let"=\normaldoublequote
  2610. \let~=\normaltilde
  2611. \let^=\normalcaret
  2612. \let_=\normalunderscore
  2613. \let|=\normalverticalbar
  2614. \let<=\normalless
  2615. \let>=\normalgreater
  2616. \let+=\normalplus}
  2617.  
  2618. % Set up an active definition for =, but don't enable it most of the time.
  2619. {\catcode`\==\active
  2620. \global\def={{\tt \char 61}}}
  2621.  
  2622. \catcode`\@=0
  2623.  
  2624. % \rawbackslashxx output one backslash character in current font
  2625. \global\chardef\rawbackslashxx=`\\
  2626. %{\catcode`\\=\other
  2627. %@gdef@rawbackslashxx{\}}
  2628.  
  2629. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  2630. {\catcode`\\=\active
  2631. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  2632.  
  2633. % \normalbackslash outputs one backslash in fixed width font.
  2634. \def\normalbackslash{{\tt\rawbackslashxx}}
  2635.  
  2636. % Say @foo, not \foo, in error messages.
  2637. \escapechar=`\@
  2638.  
  2639. % \catcode 17=0   % Define control-q
  2640. \catcode`\\=\active
  2641.  
  2642. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  2643. % That is what \eatinput is for; after that, the `\' should revert to printing 
  2644. % a backslash.
  2645. %
  2646. @gdef@eatinput input texinfo{@fixbackslash}
  2647. @global@let\ = @eatinput
  2648.  
  2649. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  2650. % the first `\{ in the file would cause an error. This macro tries to fix 
  2651. % that, assuming it is called before the first `\' could plausibly occur.
  2652. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  2653.  
  2654. %% These look ok in all fonts, so just make them not special.  The @rm below
  2655. %% makes sure that the current font starts out as the newly loaded cmr10
  2656. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  2657.  
  2658. @textfonts
  2659. @rm
  2660.