texinfo.tex 126 KB

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