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