texinfo.tex 163 KB

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