texinfo.tex 143 KB

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