texinfo.tex 129 KB

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