home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / texinfo.lzh / TEXINFO / TEXINFO.TEX (.txt)
LaTeX Document  |  1991-08-08  |  91KB  |  2,259 lines

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