TEXINFO.TEX 75 KB

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