texinfo.tex 214 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688
  1. % texinfo.tex -- TeX macros to handle Texinfo files.
  2. %
  3. % Load plain if necessary, i.e., if running under initex.
  4. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
  5. %
  6. \def\texinfoversion{2003-02-03.16}
  7. %
  8. % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
  9. % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
  10. %
  11. % This texinfo.tex file is free software; you can redistribute it and/or
  12. % modify it under the terms of the GNU General Public License as
  13. % published by the Free Software Foundation; either version 2, or (at
  14. % your option) any later version.
  15. %
  16. % This texinfo.tex file is distributed in the hope that it will be
  17. % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  18. % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. % General Public License for more details.
  20. %
  21. % You should have received a copy of the GNU General Public License
  22. % along with this texinfo.tex file; see the file COPYING. If not, write
  23. % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  24. % Boston, MA 02111-1307, USA.
  25. %
  26. % In other words, you are welcome to use, share and improve this program.
  27. % You are forbidden to forbid anyone else to use, share and improve
  28. % what you give them. Help stamp out software-hoarding!
  29. %
  30. % Please try the latest version of texinfo.tex before submitting bug
  31. % reports; you can get the latest version from:
  32. % ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
  33. % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
  34. % ftp://tug.org/tex/texinfo.tex
  35. % (and all CTAN mirrors, see http://www.ctan.org),
  36. % and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
  37. %
  38. % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
  39. %
  40. % The texinfo.tex in any given Texinfo distribution could well be out
  41. % of date, so if that's what you're using, please check.
  42. %
  43. % Send bug reports to bug-texinfo@gnu.org. Please include including a
  44. % complete document in each bug report with which we can reproduce the
  45. % problem. Patches are, of course, greatly appreciated.
  46. %
  47. % To process a Texinfo manual with TeX, it's most reliable to use the
  48. % texi2dvi shell script that comes with the distribution. For a simple
  49. % manual foo.texi, however, you can get away with this:
  50. % tex foo.texi
  51. % texindex foo.??
  52. % tex foo.texi
  53. % tex foo.texi
  54. % dvips foo.dvi -o # or whatever; this makes foo.ps.
  55. % The extra TeX runs get the cross-reference information correct.
  56. % Sometimes one run after texindex suffices, and sometimes you need more
  57. % than two; texi2dvi does it as many times as necessary.
  58. %
  59. % It is possible to adapt texinfo.tex for other languages, to some
  60. % extent. You can get the existing language-specific files from the
  61. % full Texinfo distribution.
  62. \message{Loading texinfo [version \texinfoversion]:}
  63. % If in a .fmt file, print the version number
  64. % and turn on active characters that we couldn't do earlier because
  65. % they might have appeared in the input file name.
  66. \everyjob{\message{[Texinfo version \texinfoversion]}%
  67. \catcode`+=\active \catcode`\_=\active}
  68. \message{Basics,}
  69. \chardef\other=12
  70. % We never want plain's outer \+ definition in Texinfo.
  71. % For @tex, we can use \tabalign.
  72. \let\+ = \relax
  73. % Save some parts of plain tex whose names we will redefine.
  74. \let\ptexb=\b
  75. \let\ptexbullet=\bullet
  76. \let\ptexc=\c
  77. \let\ptexcomma=\,
  78. \let\ptexdot=\.
  79. \let\ptexdots=\dots
  80. \let\ptexend=\end
  81. \let\ptexequiv=\equiv
  82. \let\ptexexclam=\!
  83. \let\ptexgtr=>
  84. \let\ptexhat=^
  85. \let\ptexi=\i
  86. \let\ptexlbrace=\{
  87. \let\ptexless=<
  88. \let\ptexplus=+
  89. \let\ptexrbrace=\}
  90. \let\ptexstar=\*
  91. \let\ptext=\t
  92. % If this character appears in an error message or help string, it
  93. % starts a new line in the output.
  94. \newlinechar = `^^J
  95. % Set up fixed words for English if not already set.
  96. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
  97. \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
  98. \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
  99. \ifx\putwordin\undefined \gdef\putwordin{in}\fi
  100. \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
  101. \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
  102. \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
  103. \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
  104. \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
  105. \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
  106. \ifx\putwordof\undefined \gdef\putwordof{of}\fi
  107. \ifx\putwordon\undefined \gdef\putwordon{on}\fi
  108. \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
  109. \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
  110. \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
  111. \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
  112. \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
  113. \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
  114. \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
  115. %
  116. \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
  117. \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
  118. \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
  119. \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
  120. \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
  121. \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
  122. \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
  123. \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
  124. \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
  125. \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
  126. \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
  127. \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
  128. %
  129. \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
  130. \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
  131. \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
  132. \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
  133. \ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
  134. \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
  135. \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
  136. % In some macros, we cannot use the `\? notation---the left quote is
  137. % in some cases the escape char.
  138. \chardef\colonChar = `\:
  139. \chardef\commaChar = `\,
  140. \chardef\dotChar = `\.
  141. \chardef\equalChar = `\=
  142. \chardef\exclamChar= `\!
  143. \chardef\questChar = `\?
  144. \chardef\semiChar = `\;
  145. \chardef\spaceChar = `\ %
  146. \chardef\underChar = `\_
  147. % Ignore a token.
  148. %
  149. \def\gobble#1{}
  150. % True if #1 is the empty string, i.e., called like `\ifempty{}'.
  151. %
  152. \def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
  153. \def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
  154. % Hyphenation fixes.
  155. \hyphenation{ap-pen-dix}
  156. \hyphenation{mini-buf-fer mini-buf-fers}
  157. \hyphenation{eshell}
  158. \hyphenation{white-space}
  159. % Margin to add to right of even pages, to left of odd pages.
  160. \newdimen\bindingoffset
  161. \newdimen\normaloffset
  162. \newdimen\pagewidth \newdimen\pageheight
  163. % Sometimes it is convenient to have everything in the transcript file
  164. % and nothing on the terminal. We don't just call \tracingall here,
  165. % since that produces some useless output on the terminal. We also make
  166. % some effort to order the tracing commands to reduce output in the log
  167. % file; cf. trace.sty in LaTeX.
  168. %
  169. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  170. \def\loggingall{%
  171. \tracingstats2
  172. \tracingpages1
  173. \tracinglostchars2 % 2 gives us more in etex
  174. \tracingparagraphs1
  175. \tracingoutput1
  176. \tracingmacros2
  177. \tracingrestores1
  178. \showboxbreadth\maxdimen \showboxdepth\maxdimen
  179. \ifx\eTeXversion\undefined\else % etex gives us more logging
  180. \tracingscantokens1
  181. \tracingifs1
  182. \tracinggroups1
  183. \tracingnesting2
  184. \tracingassigns1
  185. \fi
  186. \tracingcommands3 % 3 gives us more in etex
  187. \errorcontextlines\maxdimen
  188. }%
  189. % add check for \lastpenalty to plain's definitions. If the last thing
  190. % we did was a \nobreak, we don't want to insert more space.
  191. %
  192. \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  193. \removelastskip\penalty-50\smallskip\fi\fi}
  194. \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  195. \removelastskip\penalty-100\medskip\fi\fi}
  196. \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  197. \removelastskip\penalty-200\bigskip\fi\fi}
  198. % For @cropmarks command.
  199. % Do @cropmarks to get crop marks.
  200. %
  201. \newif\ifcropmarks
  202. \let\cropmarks = \cropmarkstrue
  203. %
  204. % Dimensions to add cropmarks at corners.
  205. % Added by P. A. MacKay, 12 Nov. 1986
  206. %
  207. \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  208. \newdimen\cornerlong \cornerlong=1pc
  209. \newdimen\cornerthick \cornerthick=.3pt
  210. \newdimen\topandbottommargin \topandbottommargin=.75in
  211. % Main output routine.
  212. \chardef\PAGE = 255
  213. \output = {\onepageout{\pagecontents\PAGE}}
  214. \newbox\headlinebox
  215. \newbox\footlinebox
  216. % \onepageout takes a vbox as an argument. Note that \pagecontents
  217. % does insertions, but you have to call it yourself.
  218. \def\onepageout#1{%
  219. \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  220. %
  221. \ifodd\pageno \advance\hoffset by \bindingoffset
  222. \else \advance\hoffset by -\bindingoffset\fi
  223. %
  224. % Do this outside of the \shipout so @code etc. will be expanded in
  225. % the headline as they should be, not taken literally (outputting ''code).
  226. \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
  227. \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
  228. %
  229. {%
  230. % Have to do this stuff outside the \shipout because we want it to
  231. % take effect in \write's, yet the group defined by the \vbox ends
  232. % before the \shipout runs.
  233. %
  234. \escapechar = `\\ % use backslash in output files.
  235. \indexdummies % don't expand commands in the output.
  236. \normalturnoffactive % \ in index entries must not stay \, e.g., if
  237. % the page break happens to be in the middle of an example.
  238. \shipout\vbox{%
  239. % Do this early so pdf references go to the beginning of the page.
  240. \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
  241. %
  242. \ifcropmarks \vbox to \outervsize\bgroup
  243. \hsize = \outerhsize
  244. \vskip-\topandbottommargin
  245. \vtop to0pt{%
  246. \line{\ewtop\hfil\ewtop}%
  247. \nointerlineskip
  248. \line{%
  249. \vbox{\moveleft\cornerthick\nstop}%
  250. \hfill
  251. \vbox{\moveright\cornerthick\nstop}%
  252. }%
  253. \vss}%
  254. \vskip\topandbottommargin
  255. \line\bgroup
  256. \hfil % center the page within the outer (page) hsize.
  257. \ifodd\pageno\hskip\bindingoffset\fi
  258. \vbox\bgroup
  259. \fi
  260. %
  261. \unvbox\headlinebox
  262. \pagebody{#1}%
  263. \ifdim\ht\footlinebox > 0pt
  264. % Only leave this space if the footline is nonempty.
  265. % (We lessened \vsize for it in \oddfootingxxx.)
  266. % The \baselineskip=24pt in plain's \makefootline has no effect.
  267. \vskip 2\baselineskip
  268. \unvbox\footlinebox
  269. \fi
  270. %
  271. \ifcropmarks
  272. \egroup % end of \vbox\bgroup
  273. \hfil\egroup % end of (centering) \line\bgroup
  274. \vskip\topandbottommargin plus1fill minus1fill
  275. \boxmaxdepth = \cornerthick
  276. \vbox to0pt{\vss
  277. \line{%
  278. \vbox{\moveleft\cornerthick\nsbot}%
  279. \hfill
  280. \vbox{\moveright\cornerthick\nsbot}%
  281. }%
  282. \nointerlineskip
  283. \line{\ewbot\hfil\ewbot}%
  284. }%
  285. \egroup % \vbox from first cropmarks clause
  286. \fi
  287. }% end of \shipout\vbox
  288. }% end of group with \normalturnoffactive
  289. \advancepageno
  290. \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  291. }
  292. \newinsert\margin \dimen\margin=\maxdimen
  293. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  294. {\catcode`\@ =11
  295. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  296. % marginal hacks, juha@viisa.uucp (Juha Takala)
  297. \ifvoid\margin\else % marginal info is present
  298. \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  299. \dimen@=\dp#1 \unvbox#1
  300. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  301. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  302. }
  303. % Here are the rules for the cropmarks. Note that they are
  304. % offset so that the space between them is truly \outerhsize or \outervsize
  305. % (P. A. MacKay, 12 November, 1986)
  306. %
  307. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  308. \def\nstop{\vbox
  309. {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  310. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  311. \def\nsbot{\vbox
  312. {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  313. % Parse an argument, then pass it to #1. The argument is the rest of
  314. % the input line (except we remove a trailing comment). #1 should be a
  315. % macro which expects an ordinary undelimited TeX argument.
  316. %
  317. \def\parsearg#1{%
  318. \let\next = #1%
  319. \begingroup
  320. \obeylines
  321. \futurelet\temp\parseargx
  322. }
  323. % If the next token is an obeyed space (from an @example environment or
  324. % the like), remove it and recurse. Otherwise, we're done.
  325. \def\parseargx{%
  326. % \obeyedspace is defined far below, after the definition of \sepspaces.
  327. \ifx\obeyedspace\temp
  328. \expandafter\parseargdiscardspace
  329. \else
  330. \expandafter\parseargline
  331. \fi
  332. }
  333. % Remove a single space (as the delimiter token to the macro call).
  334. {\obeyspaces %
  335. \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  336. {\obeylines %
  337. \gdef\parseargline#1^^M{%
  338. \endgroup % End of the group started in \parsearg.
  339. %
  340. % First remove any @c comment, then any @comment.
  341. % Result of each macro is put in \toks0.
  342. \argremovec #1\c\relax %
  343. \expandafter\argremovecomment \the\toks0 \comment\relax %
  344. %
  345. % Call the caller's macro, saved as \next in \parsearg.
  346. \expandafter\next\expandafter{\the\toks0}%
  347. }%
  348. }
  349. % Since all \c{,omment} does is throw away the argument, we can let TeX
  350. % do that for us. The \relax here is matched by the \relax in the call
  351. % in \parseargline; it could be more or less anything, its purpose is
  352. % just to delimit the argument to the \c.
  353. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  354. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  355. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  356. % @end itemize @c foo
  357. % will have two active spaces as part of the argument with the
  358. % `itemize'. Here we remove all active spaces from #1, and assign the
  359. % result to \toks0.
  360. %
  361. % This loses if there are any *other* active characters besides spaces
  362. % in the argument -- _ ^ +, for example -- since they get expanded.
  363. % Fortunately, Texinfo does not define any such commands. (If it ever
  364. % does, the catcode of the characters in questionwill have to be changed
  365. % here.) But this means we cannot call \removeactivespaces as part of
  366. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  367. % that \parsearg gets might well have any character at all in it.
  368. %
  369. \def\removeactivespaces#1{%
  370. \begingroup
  371. \ignoreactivespaces
  372. \edef\temp{#1}%
  373. \global\toks0 = \expandafter{\temp}%
  374. \endgroup
  375. }
  376. % Change the active space to expand to nothing.
  377. %
  378. \begingroup
  379. \obeyspaces
  380. \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  381. \endgroup
  382. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  383. %% These are used to keep @begin/@end levels from running away
  384. %% Call \inENV within environments (after a \begingroup)
  385. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  386. \def\ENVcheck{%
  387. \ifENV\errmessage{Still within an environment; press RETURN to continue}
  388. \endgroup\fi} % This is not perfect, but it should reduce lossage
  389. % @begin foo is the same as @foo, for now.
  390. \newhelp\EMsimple{Press RETURN to continue.}
  391. \outer\def\begin{\parsearg\beginxxx}
  392. \def\beginxxx #1{%
  393. \expandafter\ifx\csname #1\endcsname\relax
  394. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  395. \csname #1\endcsname\fi}
  396. % @end foo executes the definition of \Efoo.
  397. %
  398. \def\end{\parsearg\endxxx}
  399. \def\endxxx #1{%
  400. \removeactivespaces{#1}%
  401. \edef\endthing{\the\toks0}%
  402. %
  403. \expandafter\ifx\csname E\endthing\endcsname\relax
  404. \expandafter\ifx\csname \endthing\endcsname\relax
  405. % There's no \foo, i.e., no ``environment'' foo.
  406. \errhelp = \EMsimple
  407. \errmessage{Undefined command `@end \endthing'}%
  408. \else
  409. \unmatchedenderror\endthing
  410. \fi
  411. \else
  412. % Everything's ok; the right environment has been started.
  413. \csname E\endthing\endcsname
  414. \fi
  415. }
  416. % There is an environment #1, but it hasn't been started. Give an error.
  417. %
  418. \def\unmatchedenderror#1{%
  419. \errhelp = \EMsimple
  420. \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  421. }
  422. % Define the control sequence \E#1 to give an unmatched @end error.
  423. %
  424. \def\defineunmatchedend#1{%
  425. \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  426. }
  427. %% Simple single-character @ commands
  428. % @@ prints an @
  429. % Kludge this until the fonts are right (grr).
  430. \def\@{{\tt\char64}}
  431. % This is turned off because it was never documented
  432. % and you can use @w{...} around a quote to suppress ligatures.
  433. %% Define @` and @' to be the same as ` and '
  434. %% but suppressing ligatures.
  435. %\def\`{{`}}
  436. %\def\'{{'}}
  437. % Used to generate quoted braces.
  438. \def\mylbrace {{\tt\char123}}
  439. \def\myrbrace {{\tt\char125}}
  440. \let\{=\mylbrace
  441. \let\}=\myrbrace
  442. \begingroup
  443. % Definitions to produce \{ and \} commands for indices,
  444. % and @{ and @} for the aux file.
  445. \catcode`\{ = \other \catcode`\} = \other
  446. \catcode`\[ = 1 \catcode`\] = 2
  447. \catcode`\! = 0 \catcode`\\ = \other
  448. !gdef!lbracecmd[\{]%
  449. !gdef!rbracecmd[\}]%
  450. !gdef!lbraceatcmd[@{]%
  451. !gdef!rbraceatcmd[@}]%
  452. !endgroup
  453. % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  454. % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
  455. \let\, = \c
  456. \let\dotaccent = \.
  457. \def\ringaccent#1{{\accent23 #1}}
  458. \let\tieaccent = \t
  459. \let\ubaraccent = \b
  460. \let\udotaccent = \d
  461. % Other special characters: @questiondown @exclamdown
  462. % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
  463. \def\questiondown{?`}
  464. \def\exclamdown{!`}
  465. % Dotless i and dotless j, used for accents.
  466. \def\imacro{i}
  467. \def\jmacro{j}
  468. \def\dotless#1{%
  469. \def\temp{#1}%
  470. \ifx\temp\imacro \ptexi
  471. \else\ifx\temp\jmacro \j
  472. \else \errmessage{@dotless can be used only with i or j}%
  473. \fi\fi
  474. }
  475. % Be sure we're in horizontal mode when doing a tie, since we make space
  476. % equivalent to this in @example-like environments. Otherwise, a space
  477. % at the beginning of a line will start with \penalty -- and
  478. % since \penalty is valid in vertical mode, we'd end up putting the
  479. % penalty on the vertical list instead of in the new paragraph.
  480. {\catcode`@ = 11
  481. % Avoid using \@M directly, because that causes trouble
  482. % if the definition is written into an index file.
  483. \global\let\tiepenalty = \@M
  484. \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  485. }
  486. % @: forces normal size whitespace following.
  487. \def\:{\spacefactor=1000 }
  488. % @* forces a line break.
  489. \def\*{\hfil\break\hbox{}\ignorespaces}
  490. % @. is an end-of-sentence period.
  491. \def\.{.\spacefactor=3000 }
  492. % @! is an end-of-sentence bang.
  493. \def\!{!\spacefactor=3000 }
  494. % @? is an end-of-sentence query.
  495. \def\?{?\spacefactor=3000 }
  496. % @w prevents a word break. Without the \leavevmode, @w at the
  497. % beginning of a paragraph, when TeX is still in vertical mode, would
  498. % produce a whole line of output instead of starting the paragraph.
  499. \def\w#1{\leavevmode\hbox{#1}}
  500. % @group ... @end group forces ... to be all on one page, by enclosing
  501. % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
  502. % to keep its height that of a normal line. According to the rules for
  503. % \topskip (p.114 of the TeXbook), the glue inserted is
  504. % max (\topskip - \ht (first item), 0). If that height is large,
  505. % therefore, no glue is inserted, and the space between the headline and
  506. % the text is small, which looks bad.
  507. %
  508. % Another complication is that the group might be very large. This can
  509. % cause the glue on the previous page to be unduly stretched, because it
  510. % does not have much material. In this case, it's better to add an
  511. % explicit \vfill so that the extra space is at the bottom. The
  512. % threshold for doing this is if the group is more than \vfilllimit
  513. % percent of a page (\vfilllimit can be changed inside of @tex).
  514. %
  515. \newbox\groupbox
  516. \def\vfilllimit{0.7}
  517. %
  518. \def\group{\begingroup
  519. \ifnum\catcode13=\active \else
  520. \errhelp = \groupinvalidhelp
  521. \errmessage{@group invalid in context where filling is enabled}%
  522. \fi
  523. %
  524. % The \vtop we start below produces a box with normal height and large
  525. % depth; thus, TeX puts \baselineskip glue before it, and (when the
  526. % next line of text is done) \lineskip glue after it. (See p.82 of
  527. % the TeXbook.) Thus, space below is not quite equal to space
  528. % above. But it's pretty close.
  529. \def\Egroup{%
  530. \egroup % End the \vtop.
  531. % \dimen0 is the vertical size of the group's box.
  532. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
  533. % \dimen2 is how much space is left on the page (more or less).
  534. \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
  535. % if the group doesn't fit on the current page, and it's a big big
  536. % group, force a page break.
  537. \ifdim \dimen0 > \dimen2
  538. \ifdim \pagetotal < \vfilllimit\pageheight
  539. \page
  540. \fi
  541. \fi
  542. \copy\groupbox
  543. \endgroup % End the \group.
  544. }%
  545. %
  546. \setbox\groupbox = \vtop\bgroup
  547. % We have to put a strut on the last line in case the @group is in
  548. % the midst of an example, rather than completely enclosing it.
  549. % Otherwise, the interline space between the last line of the group
  550. % and the first line afterwards is too small. But we can't put the
  551. % strut in \Egroup, since there it would be on a line by itself.
  552. % Hence this just inserts a strut at the beginning of each line.
  553. \everypar = {\strut}%
  554. %
  555. % Since we have a strut on every line, we don't need any of TeX's
  556. % normal interline spacing.
  557. \offinterlineskip
  558. %
  559. % OK, but now we have to do something about blank
  560. % lines in the input in @example-like environments, which normally
  561. % just turn into \lisppar, which will insert no space now that we've
  562. % turned off the interline space. Simplest is to make them be an
  563. % empty paragraph.
  564. \ifx\par\lisppar
  565. \edef\par{\leavevmode \par}%
  566. %
  567. % Reset ^^M's definition to new definition of \par.
  568. \obeylines
  569. \fi
  570. %
  571. % Do @comment since we are called inside an environment such as
  572. % @example, where each end-of-line in the input causes an
  573. % end-of-line in the output. We don't want the end-of-line after
  574. % the `@group' to put extra space in the output. Since @group
  575. % should appear on a line by itself (according to the Texinfo
  576. % manual), we don't worry about eating any user text.
  577. \comment
  578. }
  579. %
  580. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  581. % message, so this ends up printing `@group can only ...'.
  582. %
  583. \newhelp\groupinvalidhelp{%
  584. group can only be used in environments such as @example,^^J%
  585. where each line of input produces a line of output.}
  586. % @need space-in-mils
  587. % forces a page break if there is not space-in-mils remaining.
  588. \newdimen\mil \mil=0.001in
  589. \def\need{\parsearg\needx}
  590. % Old definition--didn't work.
  591. %\def\needx #1{\par %
  592. %% This method tries to make TeX break the page naturally
  593. %% if the depth of the box does not fit.
  594. %{\baselineskip=0pt%
  595. %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
  596. %\prevdepth=-1000pt
  597. %}}
  598. \def\needx#1{%
  599. % Ensure vertical mode, so we don't make a big box in the middle of a
  600. % paragraph.
  601. \par
  602. %
  603. % If the @need value is less than one line space, it's useless.
  604. \dimen0 = #1\mil
  605. \dimen2 = \ht\strutbox
  606. \advance\dimen2 by \dp\strutbox
  607. \ifdim\dimen0 > \dimen2
  608. %
  609. % Do a \strut just to make the height of this box be normal, so the
  610. % normal leading is inserted relative to the preceding line.
  611. % And a page break here is fine.
  612. \vtop to #1\mil{\strut\vfil}%
  613. %
  614. % TeX does not even consider page breaks if a penalty added to the
  615. % main vertical list is 10000 or more. But in order to see if the
  616. % empty box we just added fits on the page, we must make it consider
  617. % page breaks. On the other hand, we don't want to actually break the
  618. % page after the empty box. So we use a penalty of 9999.
  619. %
  620. % There is an extremely small chance that TeX will actually break the
  621. % page at this \penalty, if there are no other feasible breakpoints in
  622. % sight. (If the user is using lots of big @group commands, which
  623. % almost-but-not-quite fill up a page, TeX will have a hard time doing
  624. % good page breaking, for example.) However, I could not construct an
  625. % example where a page broke at this \penalty; if it happens in a real
  626. % document, then we can reconsider our strategy.
  627. \penalty9999
  628. %
  629. % Back up by the size of the box, whether we did a page break or not.
  630. \kern -#1\mil
  631. %
  632. % Do not allow a page break right after this kern.
  633. \nobreak
  634. \fi
  635. }
  636. % @br forces paragraph break
  637. \let\br = \par
  638. % @dots{} output an ellipsis using the current font.
  639. % We do .5em per period so that it has the same spacing in a typewriter
  640. % font as three actual period characters.
  641. %
  642. \def\dots{%
  643. \leavevmode
  644. \hbox to 1.5em{%
  645. \hskip 0pt plus 0.25fil minus 0.25fil
  646. .\hss.\hss.%
  647. \hskip 0pt plus 0.5fil minus 0.5fil
  648. }%
  649. }
  650. % @enddots{} is an end-of-sentence ellipsis.
  651. %
  652. \def\enddots{%
  653. \leavevmode
  654. \hbox to 2em{%
  655. \hskip 0pt plus 0.25fil minus 0.25fil
  656. .\hss.\hss.\hss.%
  657. \hskip 0pt plus 0.5fil minus 0.5fil
  658. }%
  659. \spacefactor=3000
  660. }
  661. % @page forces the start of a new page
  662. %
  663. \def\page{\par\vfill\supereject}
  664. % @exdent text....
  665. % outputs text on separate line in roman font, starting at standard page margin
  666. % This records the amount of indent in the innermost environment.
  667. % That's how much \exdent should take out.
  668. \newskip\exdentamount
  669. % This defn is used inside fill environments such as @defun.
  670. \def\exdent{\parsearg\exdentyyy}
  671. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  672. % This defn is used inside nofill environments such as @example.
  673. \def\nofillexdent{\parsearg\nofillexdentyyy}
  674. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  675. \leftline{\hskip\leftskip{\rm#1}}}}
  676. % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
  677. % paragraph. For more general purposes, use the \margin insertion
  678. % class. WHICH is `l' or `r'.
  679. %
  680. \newskip\inmarginspacing \inmarginspacing=1cm
  681. \def\strutdepth{\dp\strutbox}
  682. %
  683. \def\doinmargin#1#2{\strut\vadjust{%
  684. \nobreak
  685. \kern-\strutdepth
  686. \vtop to \strutdepth{%
  687. \baselineskip=\strutdepth
  688. \vss
  689. % if you have multiple lines of stuff to put here, you'll need to
  690. % make the vbox yourself of the appropriate size.
  691. \ifx#1l%
  692. \llap{\ignorespaces #2\hskip\inmarginspacing}%
  693. \else
  694. \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
  695. \fi
  696. \null
  697. }%
  698. }}
  699. \def\inleftmargin{\doinmargin l}
  700. \def\inrightmargin{\doinmargin r}
  701. %
  702. % @inmargin{TEXT [, RIGHT-TEXT]}
  703. % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  704. % else use TEXT for both).
  705. %
  706. \def\inmargin#1{\parseinmargin #1,,\finish}
  707. \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  708. \setbox0 = \hbox{\ignorespaces #2}%
  709. \ifdim\wd0 > 0pt
  710. \def\lefttext{#1}% have both texts
  711. \def\righttext{#2}%
  712. \else
  713. \def\lefttext{#1}% have only one text
  714. \def\righttext{#1}%
  715. \fi
  716. %
  717. \ifodd\pageno
  718. \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  719. \else
  720. \def\temp{\inleftmargin\lefttext}%
  721. \fi
  722. \temp
  723. }
  724. % @include file insert text of that file as input.
  725. % Allow normal characters that we make active in the argument (a file name).
  726. \def\include{\begingroup
  727. \catcode`\\=\other
  728. \catcode`~=\other
  729. \catcode`^=\other
  730. \catcode`_=\other
  731. \catcode`|=\other
  732. \catcode`<=\other
  733. \catcode`>=\other
  734. \catcode`+=\other
  735. \parsearg\includezzz}
  736. % Restore active chars for included file.
  737. \def\includezzz#1{\endgroup\begingroup
  738. % Read the included file in a group so nested @include's work.
  739. \def\thisfile{#1}%
  740. \let\value=\expandablevalue
  741. \input\thisfile
  742. \endgroup}
  743. \def\thisfile{}
  744. % @center line
  745. % outputs that line, centered.
  746. %
  747. \def\center{\parsearg\docenter}
  748. \def\docenter#1{{%
  749. \ifhmode \hfil\break \fi
  750. \advance\hsize by -\leftskip
  751. \advance\hsize by -\rightskip
  752. \line{\hfil \ignorespaces#1\unskip \hfil}%
  753. \ifhmode \break \fi
  754. }}
  755. % @sp n outputs n lines of vertical space
  756. \def\sp{\parsearg\spxxx}
  757. \def\spxxx #1{\vskip #1\baselineskip}
  758. % @comment ...line which is ignored...
  759. % @c is the same as @comment
  760. % @ignore ... @end ignore is another way to write a comment
  761. \def\comment{\begingroup \catcode`\^^M=\other%
  762. \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  763. \commentxxx}
  764. {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
  765. \let\c=\comment
  766. % @paragraphindent NCHARS
  767. % We'll use ems for NCHARS, close enough.
  768. % We cannot implement @paragraphindent asis, though.
  769. %
  770. \def\asisword{asis} % no translation, these are keywords
  771. \def\noneword{none}
  772. %
  773. \def\paragraphindent{\parsearg\doparagraphindent}
  774. \def\doparagraphindent#1{%
  775. \def\temp{#1}%
  776. \ifx\temp\asisword
  777. \else
  778. \ifx\temp\noneword
  779. \defaultparindent = 0pt
  780. \else
  781. \defaultparindent = #1em
  782. \fi
  783. \fi
  784. \parindent = \defaultparindent
  785. }
  786. % @exampleindent NCHARS
  787. % We'll use ems for NCHARS like @paragraphindent.
  788. % It seems @exampleindent asis isn't necessary, but
  789. % I preserve it to make it similar to @paragraphindent.
  790. \def\exampleindent{\parsearg\doexampleindent}
  791. \def\doexampleindent#1{%
  792. \def\temp{#1}%
  793. \ifx\temp\asisword
  794. \else
  795. \ifx\temp\noneword
  796. \lispnarrowing = 0pt
  797. \else
  798. \lispnarrowing = #1em
  799. \fi
  800. \fi
  801. }
  802. % @asis just yields its argument. Used with @table, for example.
  803. %
  804. \def\asis#1{#1}
  805. % @math outputs its argument in math mode.
  806. % We don't use $'s directly in the definition of \math because we need
  807. % to set catcodes according to plain TeX first, to allow for subscripts,
  808. % superscripts, special math chars, etc.
  809. %
  810. \let\implicitmath = $%$ font-lock fix
  811. %
  812. % One complication: _ usually means subscripts, but it could also mean
  813. % an actual _ character, as in @math{@var{some_variable} + 1}. So make
  814. % _ within @math be active (mathcode "8000), and distinguish by seeing
  815. % if the current family is \slfam, which is what @var uses.
  816. %
  817. {\catcode\underChar = \active
  818. \gdef\mathunderscore{%
  819. \catcode\underChar=\active
  820. \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
  821. }}
  822. %
  823. % Another complication: we want \\ (and @\) to output a \ character.
  824. % FYI, plain.tex uses \\ as a temporary control sequence (why?), but
  825. % this is not advertised and we don't care. Texinfo does not
  826. % otherwise define @\.
  827. %
  828. % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
  829. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
  830. %
  831. \def\math{%
  832. \tex
  833. \mathcode`\_="8000 \mathunderscore
  834. \let\\ = \mathbackslash
  835. \mathactive
  836. \implicitmath\finishmath}
  837. \def\finishmath#1{#1\implicitmath\Etex}
  838. % Some active characters (such as <) are spaced differently in math.
  839. % We have to reset their definitions in case the @math was an
  840. % argument to a command which set the catcodes (such as @item or @section).
  841. %
  842. {
  843. \catcode`^ = \active
  844. \catcode`< = \active
  845. \catcode`> = \active
  846. \catcode`+ = \active
  847. \gdef\mathactive{%
  848. \let^ = \ptexhat
  849. \let< = \ptexless
  850. \let> = \ptexgtr
  851. \let+ = \ptexplus
  852. }
  853. }
  854. % @bullet and @minus need the same treatment as @math, just above.
  855. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  856. \def\minus{\implicitmath-\implicitmath}
  857. % @refill is a no-op.
  858. \let\refill=\relax
  859. % If working on a large document in chapters, it is convenient to
  860. % be able to disable indexing, cross-referencing, and contents, for test runs.
  861. % This is done with @novalidate (before @setfilename).
  862. %
  863. \newif\iflinks \linkstrue % by default we want the aux files.
  864. \let\novalidate = \linksfalse
  865. % @setfilename is done at the beginning of every texinfo file.
  866. % So open here the files we need to have open while reading the input.
  867. % This makes it possible to make a .fmt file for texinfo.
  868. \def\setfilename{%
  869. \iflinks
  870. \readauxfile
  871. \fi % \openindices needs to do some work in any case.
  872. \openindices
  873. \fixbackslash % Turn off hack to swallow `\input texinfo'.
  874. \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  875. %
  876. % If texinfo.cnf is present on the system, read it.
  877. % Useful for site-wide @afourpaper, etc.
  878. % Just to be on the safe side, close the input stream before the \input.
  879. \openin 1 texinfo.cnf
  880. \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
  881. \closein1
  882. \temp
  883. %
  884. \comment % Ignore the actual filename.
  885. }
  886. % Called from \setfilename.
  887. %
  888. \def\openindices{%
  889. \newindex{cp}%
  890. \newcodeindex{fn}%
  891. \newcodeindex{vr}%
  892. \newcodeindex{tp}%
  893. \newcodeindex{ky}%
  894. \newcodeindex{pg}%
  895. }
  896. % @bye.
  897. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  898. \message{pdf,}
  899. % adobe `portable' document format
  900. \newcount\tempnum
  901. \newcount\lnkcount
  902. \newtoks\filename
  903. \newcount\filenamelength
  904. \newcount\pgn
  905. \newtoks\toksA
  906. \newtoks\toksB
  907. \newtoks\toksC
  908. \newtoks\toksD
  909. \newbox\boxA
  910. \newcount\countA
  911. \newif\ifpdf
  912. \newif\ifpdfmakepagedest
  913. \ifx\pdfoutput\undefined
  914. \pdffalse
  915. \let\pdfmkdest = \gobble
  916. \let\pdfurl = \gobble
  917. \let\endlink = \relax
  918. \let\linkcolor = \relax
  919. \let\pdfmakeoutlines = \relax
  920. \else
  921. \pdftrue
  922. \pdfoutput = 1
  923. \input pdfcolor
  924. \def\dopdfimage#1#2#3{%
  925. \def\imagewidth{#2}%
  926. \def\imageheight{#3}%
  927. % without \immediate, pdftex seg faults when the same image is
  928. % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
  929. \ifnum\pdftexversion < 14
  930. \immediate\pdfimage
  931. \else
  932. \immediate\pdfximage
  933. \fi
  934. \ifx\empty\imagewidth\else width \imagewidth \fi
  935. \ifx\empty\imageheight\else height \imageheight \fi
  936. \ifnum\pdftexversion<13
  937. #1.pdf%
  938. \else
  939. {#1.pdf}%
  940. \fi
  941. \ifnum\pdftexversion < 14 \else
  942. \pdfrefximage \pdflastximage
  943. \fi}
  944. \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
  945. \def\pdfmkpgn#1{#1}
  946. \let\linkcolor = \Blue % was Cyan, but that seems light?
  947. \def\endlink{\Black\pdfendlink}
  948. % Adding outlines to PDF; macros for calculating structure of outlines
  949. % come from Petr Olsak
  950. \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
  951. \else \csname#1\endcsname \fi}
  952. \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
  953. \advance\tempnum by1
  954. \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  955. \def\pdfmakeoutlines{{%
  956. \openin 1 \jobname.toc
  957. \ifeof 1\else\begingroup
  958. \closein 1
  959. % Thanh's hack / proper braces in bookmarks
  960. \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
  961. \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
  962. %
  963. \def\chapentry ##1##2##3{}
  964. \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
  965. \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
  966. \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
  967. \let\appendixentry = \chapentry
  968. \let\unnumbchapentry = \chapentry
  969. \let\unnumbsecentry = \secentry
  970. \let\unnumbsubsecentry = \subsecentry
  971. \let\unnumbsubsubsecentry = \subsubsecentry
  972. \input \jobname.toc
  973. \def\chapentry ##1##2##3{%
  974. \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
  975. \def\secentry ##1##2##3##4{%
  976. \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
  977. \def\subsecentry ##1##2##3##4##5{%
  978. \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
  979. \def\subsubsecentry ##1##2##3##4##5##6{%
  980. \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
  981. \let\appendixentry = \chapentry
  982. \let\unnumbchapentry = \chapentry
  983. \let\unnumbsecentry = \secentry
  984. \let\unnumbsubsecentry = \subsecentry
  985. \let\unnumbsubsubsecentry = \subsubsecentry
  986. %
  987. % Make special characters normal for writing to the pdf file.
  988. %
  989. \indexnofonts
  990. \let\tt=\relax
  991. \turnoffactive
  992. \input \jobname.toc
  993. \endgroup\fi
  994. }}
  995. \def\makelinks #1,{%
  996. \def\params{#1}\def\E{END}%
  997. \ifx\params\E
  998. \let\nextmakelinks=\relax
  999. \else
  1000. \let\nextmakelinks=\makelinks
  1001. \ifnum\lnkcount>0,\fi
  1002. \picknum{#1}%
  1003. \startlink attr{/Border [0 0 0]}
  1004. goto name{\pdfmkpgn{\the\pgn}}%
  1005. \linkcolor #1%
  1006. \advance\lnkcount by 1%
  1007. \endlink
  1008. \fi
  1009. \nextmakelinks
  1010. }
  1011. \def\picknum#1{\expandafter\pn#1}
  1012. \def\pn#1{%
  1013. \def\p{#1}%
  1014. \ifx\p\lbrace
  1015. \let\nextpn=\ppn
  1016. \else
  1017. \let\nextpn=\ppnn
  1018. \def\first{#1}
  1019. \fi
  1020. \nextpn
  1021. }
  1022. \def\ppn#1{\pgn=#1\gobble}
  1023. \def\ppnn{\pgn=\first}
  1024. \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
  1025. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1026. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1027. \ifx\PP\D\let\nextsp\relax
  1028. \else\let\nextsp\skipspaces
  1029. \ifx\p\space\else\addtokens{\filename}{\PP}%
  1030. \advance\filenamelength by 1
  1031. \fi
  1032. \fi
  1033. \nextsp}
  1034. \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
  1035. \ifnum\pdftexversion < 14
  1036. \let \startlink \pdfannotlink
  1037. \else
  1038. \let \startlink \pdfstartlink
  1039. \fi
  1040. \def\pdfurl#1{%
  1041. \begingroup
  1042. \normalturnoffactive\def\@{@}%
  1043. \let\value=\expandablevalue
  1044. \leavevmode\Red
  1045. \startlink attr{/Border [0 0 0]}%
  1046. user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
  1047. % #1
  1048. \endgroup}
  1049. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1050. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1051. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1052. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1053. \def\maketoks{%
  1054. \expandafter\poptoks\the\toksA|ENDTOKS|
  1055. \ifx\first0\adn0
  1056. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1057. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1058. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1059. \else
  1060. \ifnum0=\countA\else\makelink\fi
  1061. \ifx\first.\let\next=\done\else
  1062. \let\next=\maketoks
  1063. \addtokens{\toksB}{\the\toksD}
  1064. \ifx\first,\addtokens{\toksB}{\space}\fi
  1065. \fi
  1066. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1067. \next}
  1068. \def\makelink{\addtokens{\toksB}%
  1069. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1070. \def\pdflink#1{%
  1071. \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
  1072. \linkcolor #1\endlink}
  1073. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1074. \fi % \ifx\pdfoutput
  1075. \message{fonts,}
  1076. % Font-change commands.
  1077. % Texinfo sort of supports the sans serif font style, which plain TeX does not.
  1078. % So we set up a \sf analogous to plain's \rm, etc.
  1079. \newfam\sffam
  1080. \def\sf{\fam=\sffam \tensf}
  1081. \let\li = \sf % Sometimes we call it \li, not \sf.
  1082. % We don't need math for this one.
  1083. \def\ttsl{\tenttsl}
  1084. % Default leading.
  1085. \newdimen\textleading \textleading = 13.2pt
  1086. % Set the baselineskip to #1, and the lineskip and strut size
  1087. % correspondingly. There is no deep meaning behind these magic numbers
  1088. % used as factors; they just match (closely enough) what Knuth defined.
  1089. %
  1090. \def\lineskipfactor{.08333}
  1091. \def\strutheightpercent{.70833}
  1092. \def\strutdepthpercent {.29167}
  1093. %
  1094. \def\setleading#1{%
  1095. \normalbaselineskip = #1\relax
  1096. \normallineskip = \lineskipfactor\normalbaselineskip
  1097. \normalbaselines
  1098. \setbox\strutbox =\hbox{%
  1099. \vrule width0pt height\strutheightpercent\baselineskip
  1100. depth \strutdepthpercent \baselineskip
  1101. }%
  1102. }
  1103. % Set the font macro #1 to the font named #2, adding on the
  1104. % specified font prefix (normally `cm').
  1105. % #3 is the font's design size, #4 is a scale factor
  1106. \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
  1107. % Use cm as the default font prefix.
  1108. % To specify the font prefix, you must define \fontprefix
  1109. % before you read in texinfo.tex.
  1110. \ifx\fontprefix\undefined
  1111. \def\fontprefix{cm}
  1112. \fi
  1113. % Support font families that don't use the same naming scheme as CM.
  1114. \def\rmshape{r}
  1115. \def\rmbshape{bx} %where the normal face is bold
  1116. \def\bfshape{b}
  1117. \def\bxshape{bx}
  1118. \def\ttshape{tt}
  1119. \def\ttbshape{tt}
  1120. \def\ttslshape{sltt}
  1121. \def\itshape{ti}
  1122. \def\itbshape{bxti}
  1123. \def\slshape{sl}
  1124. \def\slbshape{bxsl}
  1125. \def\sfshape{ss}
  1126. \def\sfbshape{ss}
  1127. \def\scshape{csc}
  1128. \def\scbshape{csc}
  1129. \newcount\mainmagstep
  1130. \ifx\bigger\relax
  1131. % not really supported.
  1132. \mainmagstep=\magstep1
  1133. \setfont\textrm\rmshape{12}{1000}
  1134. \setfont\texttt\ttshape{12}{1000}
  1135. \else
  1136. \mainmagstep=\magstephalf
  1137. \setfont\textrm\rmshape{10}{\mainmagstep}
  1138. \setfont\texttt\ttshape{10}{\mainmagstep}
  1139. \fi
  1140. % Instead of cmb10, you may want to use cmbx10.
  1141. % cmbx10 is a prettier font on its own, but cmb10
  1142. % looks better when embedded in a line with cmr10
  1143. % (in Bob's opinion).
  1144. \setfont\textbf\bfshape{10}{\mainmagstep}
  1145. \setfont\textit\itshape{10}{\mainmagstep}
  1146. \setfont\textsl\slshape{10}{\mainmagstep}
  1147. \setfont\textsf\sfshape{10}{\mainmagstep}
  1148. \setfont\textsc\scshape{10}{\mainmagstep}
  1149. \setfont\textttsl\ttslshape{10}{\mainmagstep}
  1150. \font\texti=cmmi10 scaled \mainmagstep
  1151. \font\textsy=cmsy10 scaled \mainmagstep
  1152. % A few fonts for @defun, etc.
  1153. \setfont\defbf\bxshape{10}{\magstep1} %was 1314
  1154. \setfont\deftt\ttshape{10}{\magstep1}
  1155. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  1156. % Fonts for indices, footnotes, small examples (9pt).
  1157. \setfont\smallrm\rmshape{9}{1000}
  1158. \setfont\smalltt\ttshape{9}{1000}
  1159. \setfont\smallbf\bfshape{10}{900}
  1160. \setfont\smallit\itshape{9}{1000}
  1161. \setfont\smallsl\slshape{9}{1000}
  1162. \setfont\smallsf\sfshape{9}{1000}
  1163. \setfont\smallsc\scshape{10}{900}
  1164. \setfont\smallttsl\ttslshape{10}{900}
  1165. \font\smalli=cmmi9
  1166. \font\smallsy=cmsy9
  1167. % Fonts for small examples (8pt).
  1168. \setfont\smallerrm\rmshape{8}{1000}
  1169. \setfont\smallertt\ttshape{8}{1000}
  1170. \setfont\smallerbf\bfshape{10}{800}
  1171. \setfont\smallerit\itshape{8}{1000}
  1172. \setfont\smallersl\slshape{8}{1000}
  1173. \setfont\smallersf\sfshape{8}{1000}
  1174. \setfont\smallersc\scshape{10}{800}
  1175. \setfont\smallerttsl\ttslshape{10}{800}
  1176. \font\smalleri=cmmi8
  1177. \font\smallersy=cmsy8
  1178. % Fonts for title page:
  1179. \setfont\titlerm\rmbshape{12}{\magstep3}
  1180. \setfont\titleit\itbshape{10}{\magstep4}
  1181. \setfont\titlesl\slbshape{10}{\magstep4}
  1182. \setfont\titlett\ttbshape{12}{\magstep3}
  1183. \setfont\titlettsl\ttslshape{10}{\magstep4}
  1184. \setfont\titlesf\sfbshape{17}{\magstep1}
  1185. \let\titlebf=\titlerm
  1186. \setfont\titlesc\scbshape{10}{\magstep4}
  1187. \font\titlei=cmmi12 scaled \magstep3
  1188. \font\titlesy=cmsy10 scaled \magstep4
  1189. \def\authorrm{\secrm}
  1190. \def\authortt{\sectt}
  1191. % Chapter (and unnumbered) fonts (17.28pt).
  1192. \setfont\chaprm\rmbshape{12}{\magstep2}
  1193. \setfont\chapit\itbshape{10}{\magstep3}
  1194. \setfont\chapsl\slbshape{10}{\magstep3}
  1195. \setfont\chaptt\ttbshape{12}{\magstep2}
  1196. \setfont\chapttsl\ttslshape{10}{\magstep3}
  1197. \setfont\chapsf\sfbshape{17}{1000}
  1198. \let\chapbf=\chaprm
  1199. \setfont\chapsc\scbshape{10}{\magstep3}
  1200. \font\chapi=cmmi12 scaled \magstep2
  1201. \font\chapsy=cmsy10 scaled \magstep3
  1202. % Section fonts (14.4pt).
  1203. \setfont\secrm\rmbshape{12}{\magstep1}
  1204. \setfont\secit\itbshape{10}{\magstep2}
  1205. \setfont\secsl\slbshape{10}{\magstep2}
  1206. \setfont\sectt\ttbshape{12}{\magstep1}
  1207. \setfont\secttsl\ttslshape{10}{\magstep2}
  1208. \setfont\secsf\sfbshape{12}{\magstep1}
  1209. \let\secbf\secrm
  1210. \setfont\secsc\scbshape{10}{\magstep2}
  1211. \font\seci=cmmi12 scaled \magstep1
  1212. \font\secsy=cmsy10 scaled \magstep2
  1213. % Subsection fonts (13.15pt).
  1214. \setfont\ssecrm\rmbshape{12}{\magstephalf}
  1215. \setfont\ssecit\itbshape{10}{1315}
  1216. \setfont\ssecsl\slbshape{10}{1315}
  1217. \setfont\ssectt\ttbshape{12}{\magstephalf}
  1218. \setfont\ssecttsl\ttslshape{10}{1315}
  1219. \setfont\ssecsf\sfbshape{12}{\magstephalf}
  1220. \let\ssecbf\ssecrm
  1221. \setfont\ssecsc\scbshape{10}{\magstep1}
  1222. \font\sseci=cmmi12 scaled \magstephalf
  1223. \font\ssecsy=cmsy10 scaled 1315
  1224. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  1225. % but that is not a standard magnification.
  1226. % In order for the font changes to affect most math symbols and letters,
  1227. % we have to define the \textfont of the standard families. Since
  1228. % texinfo doesn't allow for producing subscripts and superscripts except
  1229. % in the main text, we don't bother to reset \scriptfont and
  1230. % \scriptscriptfont (which would also require loading a lot more fonts).
  1231. %
  1232. \def\resetmathfonts{%
  1233. \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
  1234. \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
  1235. \textfont\ttfam=\tentt \textfont\sffam=\tensf
  1236. }
  1237. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  1238. % of just \STYLE. We do this so that font changes will continue to work
  1239. % in math mode, where it is the current \fam that is relevant in most
  1240. % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
  1241. % \tenbf}, for example. By redefining \tenbf, we obviate the need to
  1242. % redefine \bf itself.
  1243. \def\textfonts{%
  1244. \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  1245. \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  1246. \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
  1247. \resetmathfonts \setleading{\textleading}}
  1248. \def\titlefonts{%
  1249. \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
  1250. \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
  1251. \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
  1252. \let\tenttsl=\titlettsl
  1253. \resetmathfonts \setleading{25pt}}
  1254. \def\titlefont#1{{\titlefonts\rm #1}}
  1255. \def\chapfonts{%
  1256. \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  1257. \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  1258. \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
  1259. \resetmathfonts \setleading{19pt}}
  1260. \def\secfonts{%
  1261. \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  1262. \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  1263. \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
  1264. \resetmathfonts \setleading{16pt}}
  1265. \def\subsecfonts{%
  1266. \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  1267. \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  1268. \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
  1269. \resetmathfonts \setleading{15pt}}
  1270. \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
  1271. \def\smallfonts{%
  1272. \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
  1273. \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
  1274. \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
  1275. \let\tenttsl=\smallttsl
  1276. \resetmathfonts \setleading{10.5pt}}
  1277. \def\smallerfonts{%
  1278. \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
  1279. \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
  1280. \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
  1281. \let\tenttsl=\smallerttsl
  1282. \resetmathfonts \setleading{9.5pt}}
  1283. % Set the fonts to use with the @small... environments.
  1284. \let\smallexamplefonts = \smallfonts
  1285. % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
  1286. % can fit this many characters:
  1287. % 8.5x11=86 smallbook=72 a4=90 a5=69
  1288. % If we use \smallerfonts (8pt), then we can fit this many characters:
  1289. % 8.5x11=90+ smallbook=80 a4=90+ a5=77
  1290. % For me, subjectively, the few extra characters that fit aren't worth
  1291. % the additional smallness of 8pt. So I'm making the default 9pt.
  1292. %
  1293. % By the way, for comparison, here's what fits with @example (10pt):
  1294. % 8.5x11=71 smallbook=60 a4=75 a5=58
  1295. %
  1296. % I wish we used A4 paper on this side of the Atlantic.
  1297. %
  1298. % --karl, 24jan03.
  1299. % Set up the default fonts, so we can use them for creating boxes.
  1300. %
  1301. \textfonts
  1302. % Define these so they can be easily changed for other fonts.
  1303. \def\angleleft{$\langle$}
  1304. \def\angleright{$\rangle$}
  1305. % Count depth in font-changes, for error checks
  1306. \newcount\fontdepth \fontdepth=0
  1307. % Fonts for short table of contents.
  1308. \setfont\shortcontrm\rmshape{12}{1000}
  1309. \setfont\shortcontbf\bxshape{12}{1000}
  1310. \setfont\shortcontsl\slshape{12}{1000}
  1311. \setfont\shortconttt\ttshape{12}{1000}
  1312. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  1313. %% serif) and @ii for TeX italic
  1314. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  1315. % unless the following character is such as not to need one.
  1316. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  1317. \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
  1318. \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
  1319. \let\i=\smartitalic
  1320. \let\var=\smartslanted
  1321. \let\dfn=\smartslanted
  1322. \let\emph=\smartitalic
  1323. \let\cite=\smartslanted
  1324. \def\b#1{{\bf #1}}
  1325. \let\strong=\b
  1326. % We can't just use \exhyphenpenalty, because that only has effect at
  1327. % the end of a paragraph. Restore normal hyphenation at the end of the
  1328. % group within which \nohyphenation is presumably called.
  1329. %
  1330. \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
  1331. \def\restorehyphenation{\hyphenchar\font = `- }
  1332. % Set sfcode to normal for the chars that usually have another value.
  1333. % Can't use plain's \frenchspacing because it uses the `\x notation, and
  1334. % sometimes \x has an active definition that messes things up.
  1335. %
  1336. \catcode`@=11
  1337. \def\frenchspacing{%
  1338. \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
  1339. \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
  1340. }
  1341. \catcode`@=\other
  1342. \def\t#1{%
  1343. {\tt \rawbackslash \frenchspacing #1}%
  1344. \null
  1345. }
  1346. \let\ttfont=\t
  1347. \def\samp#1{`\tclose{#1}'\null}
  1348. \setfont\keyrm\rmshape{8}{1000}
  1349. \font\keysy=cmsy9
  1350. \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
  1351. \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
  1352. \vbox{\hrule\kern-0.4pt
  1353. \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
  1354. \kern-0.4pt\hrule}%
  1355. \kern-.06em\raise0.4pt\hbox{\angleright}}}}
  1356. % The old definition, with no lozenge:
  1357. %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
  1358. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  1359. % @file, @option are the same as @samp.
  1360. \let\file=\samp
  1361. \let\option=\samp
  1362. % @code is a modification of @t,
  1363. % which makes spaces the same size as normal in the surrounding text.
  1364. \def\tclose#1{%
  1365. {%
  1366. % Change normal interword space to be same as for the current font.
  1367. \spaceskip = \fontdimen2\font
  1368. %
  1369. % Switch to typewriter.
  1370. \tt
  1371. %
  1372. % But `\ ' produces the large typewriter interword space.
  1373. \def\ {{\spaceskip = 0pt{} }}%
  1374. %
  1375. % Turn off hyphenation.
  1376. \nohyphenation
  1377. %
  1378. \rawbackslash
  1379. \frenchspacing
  1380. #1%
  1381. }%
  1382. \null
  1383. }
  1384. % We *must* turn on hyphenation at `-' and `_' in \code.
  1385. % Otherwise, it is too hard to avoid overfull hboxes
  1386. % in the Emacs manual, the Library manual, etc.
  1387. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  1388. % both hyphenation at - and hyphenation within words.
  1389. % We must therefore turn them both off (\tclose does that)
  1390. % and arrange explicitly to hyphenate at a dash.
  1391. % -- rms.
  1392. {
  1393. \catcode`\-=\active
  1394. \catcode`\_=\active
  1395. %
  1396. \global\def\code{\begingroup
  1397. \catcode`\-=\active \let-\codedash
  1398. \catcode`\_=\active \let_\codeunder
  1399. \codex
  1400. }
  1401. %
  1402. % If we end up with any active - characters when handling the index,
  1403. % just treat them as a normal -.
  1404. \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
  1405. }
  1406. \def\realdash{-}
  1407. \def\codedash{-\discretionary{}{}{}}
  1408. \def\codeunder{%
  1409. % this is all so @math{@code{var_name}+1} can work. In math mode, _
  1410. % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  1411. % will therefore expand the active definition of _, which is us
  1412. % (inside @code that is), therefore an endless loop.
  1413. \ifusingtt{\ifmmode
  1414. \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
  1415. \else\normalunderscore \fi
  1416. \discretionary{}{}{}}%
  1417. {\_}%
  1418. }
  1419. \def\codex #1{\tclose{#1}\endgroup}
  1420. % @kbd is like @code, except that if the argument is just one @key command,
  1421. % then @kbd has no effect.
  1422. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  1423. % `example' (@kbd uses ttsl only inside of @example and friends),
  1424. % or `code' (@kbd uses normal tty font always).
  1425. \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
  1426. \def\kbdinputstylexxx#1{%
  1427. \def\arg{#1}%
  1428. \ifx\arg\worddistinct
  1429. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  1430. \else\ifx\arg\wordexample
  1431. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  1432. \else\ifx\arg\wordcode
  1433. \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  1434. \else
  1435. \errhelp = \EMsimple
  1436. \errmessage{Unknown @kbdinputstyle `\arg'}%
  1437. \fi\fi\fi
  1438. }
  1439. \def\worddistinct{distinct}
  1440. \def\wordexample{example}
  1441. \def\wordcode{code}
  1442. % Default is `distinct.'
  1443. \kbdinputstyle distinct
  1444. \def\xkey{\key}
  1445. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  1446. \ifx\one\xkey\ifx\threex\three \key{#2}%
  1447. \else{\tclose{\kbdfont\look}}\fi
  1448. \else{\tclose{\kbdfont\look}}\fi}
  1449. % For @url, @env, @command quotes seem unnecessary, so use \code.
  1450. \let\url=\code
  1451. \let\env=\code
  1452. \let\command=\code
  1453. % @uref (abbreviation for `urlref') takes an optional (comma-separated)
  1454. % second argument specifying the text to display and an optional third
  1455. % arg as text to display instead of (rather than in addition to) the url
  1456. % itself. First (mandatory) arg is the url. Perhaps eventually put in
  1457. % a hypertex \special here.
  1458. %
  1459. \def\uref#1{\douref #1,,,\finish}
  1460. \def\douref#1,#2,#3,#4\finish{\begingroup
  1461. \unsepspaces
  1462. \pdfurl{#1}%
  1463. \setbox0 = \hbox{\ignorespaces #3}%
  1464. \ifdim\wd0 > 0pt
  1465. \unhbox0 % third arg given, show only that
  1466. \else
  1467. \setbox0 = \hbox{\ignorespaces #2}%
  1468. \ifdim\wd0 > 0pt
  1469. \ifpdf
  1470. \unhbox0 % PDF: 2nd arg given, show only it
  1471. \else
  1472. \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
  1473. \fi
  1474. \else
  1475. \code{#1}% only url given, so show it
  1476. \fi
  1477. \fi
  1478. \endlink
  1479. \endgroup}
  1480. % rms does not like angle brackets --karl, 17may97.
  1481. % So now @email is just like @uref, unless we are pdf.
  1482. %
  1483. %\def\email#1{\angleleft{\tt #1}\angleright}
  1484. \ifpdf
  1485. \def\email#1{\doemail#1,,\finish}
  1486. \def\doemail#1,#2,#3\finish{\begingroup
  1487. \unsepspaces
  1488. \pdfurl{mailto:#1}%
  1489. \setbox0 = \hbox{\ignorespaces #2}%
  1490. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  1491. \endlink
  1492. \endgroup}
  1493. \else
  1494. \let\email=\uref
  1495. \fi
  1496. % Check if we are currently using a typewriter font. Since all the
  1497. % Computer Modern typewriter fonts have zero interword stretch (and
  1498. % shrink), and it is reasonable to expect all typewriter fonts to have
  1499. % this property, we can check that font parameter.
  1500. %
  1501. \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
  1502. % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
  1503. % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
  1504. %
  1505. \def\dmn#1{\thinspace #1}
  1506. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  1507. % @l was never documented to mean ``switch to the Lisp font'',
  1508. % and it is not used as such in any manual I can find. We need it for
  1509. % Polish suppressed-l. --karl, 22sep96.
  1510. %\def\l#1{{\li #1}\null}
  1511. % Explicit font changes: @r, @sc, undocumented @ii.
  1512. \def\r#1{{\rm #1}} % roman font
  1513. \def\sc#1{{\smallcaps#1}} % smallcaps font
  1514. \def\ii#1{{\it #1}} % italic font
  1515. % @acronym downcases the argument and prints in smallcaps.
  1516. \def\acronym#1{{\smallcaps \lowercase{#1}}}
  1517. % @pounds{} is a sterling sign.
  1518. \def\pounds{{\it\$}}
  1519. \message{page headings,}
  1520. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  1521. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  1522. % First the title page. Must do @settitle before @titlepage.
  1523. \newif\ifseenauthor
  1524. \newif\iffinishedtitlepage
  1525. % Do an implicit @contents or @shortcontents after @end titlepage if the
  1526. % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
  1527. %
  1528. \newif\ifsetcontentsaftertitlepage
  1529. \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
  1530. \newif\ifsetshortcontentsaftertitlepage
  1531. \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
  1532. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  1533. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  1534. \endgroup\page\hbox{}\page}
  1535. \def\titlepage{\begingroup \parindent=0pt \textfonts
  1536. \let\subtitlerm=\tenrm
  1537. \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  1538. %
  1539. \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
  1540. \let\tt=\authortt}%
  1541. %
  1542. % Leave some space at the very top of the page.
  1543. \vglue\titlepagetopglue
  1544. %
  1545. % Now you can print the title using @title.
  1546. \def\title{\parsearg\titlezzz}%
  1547. \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
  1548. % print a rule at the page bottom also.
  1549. \finishedtitlepagefalse
  1550. \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  1551. % No rule at page bottom unless we print one at the top with @title.
  1552. \finishedtitlepagetrue
  1553. %
  1554. % Now you can put text using @subtitle.
  1555. \def\subtitle{\parsearg\subtitlezzz}%
  1556. \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  1557. %
  1558. % @author should come last, but may come many times.
  1559. \def\author{\parsearg\authorzzz}%
  1560. \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  1561. {\authorfont \leftline{##1}}}%
  1562. %
  1563. % Most title ``pages'' are actually two pages long, with space
  1564. % at the top of the second. We don't want the ragged left on the second.
  1565. \let\oldpage = \page
  1566. \def\page{%
  1567. \iffinishedtitlepage\else
  1568. \finishtitlepage
  1569. \fi
  1570. \oldpage
  1571. \let\page = \oldpage
  1572. \hbox{}}%
  1573. % \def\page{\oldpage \hbox{}}
  1574. }
  1575. \def\Etitlepage{%
  1576. \iffinishedtitlepage\else
  1577. \finishtitlepage
  1578. \fi
  1579. % It is important to do the page break before ending the group,
  1580. % because the headline and footline are only empty inside the group.
  1581. % If we use the new definition of \page, we always get a blank page
  1582. % after the title page, which we certainly don't want.
  1583. \oldpage
  1584. \endgroup
  1585. %
  1586. % Need this before the \...aftertitlepage checks so that if they are
  1587. % in effect the toc pages will come out with page numbers.
  1588. \HEADINGSon
  1589. %
  1590. % If they want short, they certainly want long too.
  1591. \ifsetshortcontentsaftertitlepage
  1592. \shortcontents
  1593. \contents
  1594. \global\let\shortcontents = \relax
  1595. \global\let\contents = \relax
  1596. \fi
  1597. %
  1598. \ifsetcontentsaftertitlepage
  1599. \contents
  1600. \global\let\contents = \relax
  1601. \global\let\shortcontents = \relax
  1602. \fi
  1603. }
  1604. \def\finishtitlepage{%
  1605. \vskip4pt \hrule height 2pt width \hsize
  1606. \vskip\titlepagebottomglue
  1607. \finishedtitlepagetrue
  1608. }
  1609. %%% Set up page headings and footings.
  1610. \let\thispage=\folio
  1611. \newtoks\evenheadline % headline on even pages
  1612. \newtoks\oddheadline % headline on odd pages
  1613. \newtoks\evenfootline % footline on even pages
  1614. \newtoks\oddfootline % footline on odd pages
  1615. % Now make Tex use those variables
  1616. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  1617. \else \the\evenheadline \fi}}
  1618. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  1619. \else \the\evenfootline \fi}\HEADINGShook}
  1620. \let\HEADINGShook=\relax
  1621. % Commands to set those variables.
  1622. % For example, this is what @headings on does
  1623. % @evenheading @thistitle|@thispage|@thischapter
  1624. % @oddheading @thischapter|@thispage|@thistitle
  1625. % @evenfooting @thisfile||
  1626. % @oddfooting ||@thisfile
  1627. \def\evenheading{\parsearg\evenheadingxxx}
  1628. \def\oddheading{\parsearg\oddheadingxxx}
  1629. \def\everyheading{\parsearg\everyheadingxxx}
  1630. \def\evenfooting{\parsearg\evenfootingxxx}
  1631. \def\oddfooting{\parsearg\oddfootingxxx}
  1632. \def\everyfooting{\parsearg\everyfootingxxx}
  1633. {\catcode`\@=0 %
  1634. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  1635. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  1636. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1637. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  1638. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  1639. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1640. \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
  1641. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  1642. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  1643. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1644. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  1645. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  1646. \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  1647. %
  1648. % Leave some space for the footline. Hopefully ok to assume
  1649. % @evenfooting will not be used by itself.
  1650. \global\advance\pageheight by -\baselineskip
  1651. \global\advance\vsize by -\baselineskip
  1652. }
  1653. \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
  1654. %
  1655. }% unbind the catcode of @.
  1656. % @headings double turns headings on for double-sided printing.
  1657. % @headings single turns headings on for single-sided printing.
  1658. % @headings off turns them off.
  1659. % @headings on same as @headings double, retained for compatibility.
  1660. % @headings after turns on double-sided headings after this page.
  1661. % @headings doubleafter turns on double-sided headings after this page.
  1662. % @headings singleafter turns on single-sided headings after this page.
  1663. % By default, they are off at the start of a document,
  1664. % and turned `on' after @end titlepage.
  1665. \def\headings #1 {\csname HEADINGS#1\endcsname}
  1666. \def\HEADINGSoff{
  1667. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  1668. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  1669. \HEADINGSoff
  1670. % When we turn headings on, set the page number to 1.
  1671. % For double-sided printing, put current file name in lower left corner,
  1672. % chapter name on inside top of right hand pages, document
  1673. % title on inside top of left hand pages, and page numbers on outside top
  1674. % edge of all pages.
  1675. \def\HEADINGSdouble{
  1676. \global\pageno=1
  1677. \global\evenfootline={\hfil}
  1678. \global\oddfootline={\hfil}
  1679. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1680. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1681. \global\let\contentsalignmacro = \chapoddpage
  1682. }
  1683. \let\contentsalignmacro = \chappager
  1684. % For single-sided printing, chapter title goes across top left of page,
  1685. % page number on top right.
  1686. \def\HEADINGSsingle{
  1687. \global\pageno=1
  1688. \global\evenfootline={\hfil}
  1689. \global\oddfootline={\hfil}
  1690. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1691. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1692. \global\let\contentsalignmacro = \chappager
  1693. }
  1694. \def\HEADINGSon{\HEADINGSdouble}
  1695. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1696. \let\HEADINGSdoubleafter=\HEADINGSafter
  1697. \def\HEADINGSdoublex{%
  1698. \global\evenfootline={\hfil}
  1699. \global\oddfootline={\hfil}
  1700. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1701. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1702. \global\let\contentsalignmacro = \chapoddpage
  1703. }
  1704. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1705. \def\HEADINGSsinglex{%
  1706. \global\evenfootline={\hfil}
  1707. \global\oddfootline={\hfil}
  1708. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1709. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1710. \global\let\contentsalignmacro = \chappager
  1711. }
  1712. % Subroutines used in generating headings
  1713. % This produces Day Month Year style of output.
  1714. % Only define if not already defined, in case a txi-??.tex file has set
  1715. % up a different format (e.g., txi-cs.tex does this).
  1716. \ifx\today\undefined
  1717. \def\today{%
  1718. \number\day\space
  1719. \ifcase\month
  1720. \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  1721. \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  1722. \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  1723. \fi
  1724. \space\number\year}
  1725. \fi
  1726. % @settitle line... specifies the title of the document, for headings.
  1727. % It generates no output of its own.
  1728. \def\thistitle{\putwordNoTitle}
  1729. \def\settitle{\parsearg\settitlezzz}
  1730. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1731. \message{tables,}
  1732. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1733. % default indentation of table text
  1734. \newdimen\tableindent \tableindent=.8in
  1735. % default indentation of @itemize and @enumerate text
  1736. \newdimen\itemindent \itemindent=.3in
  1737. % margin between end of table item and start of table text.
  1738. \newdimen\itemmargin \itemmargin=.1in
  1739. % used internally for \itemindent minus \itemmargin
  1740. \newdimen\itemmax
  1741. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1742. % these defs.
  1743. % They also define \itemindex
  1744. % to index the item name in whatever manner is desired (perhaps none).
  1745. \newif\ifitemxneedsnegativevskip
  1746. \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
  1747. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1748. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  1749. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1750. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
  1751. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1752. \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
  1753. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1754. \itemzzz {#1}}
  1755. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1756. \itemzzz {#1}}
  1757. \def\itemzzz #1{\begingroup %
  1758. \advance\hsize by -\rightskip
  1759. \advance\hsize by -\tableindent
  1760. \setbox0=\hbox{\itemfont{#1}}%
  1761. \itemindex{#1}%
  1762. \nobreak % This prevents a break before @itemx.
  1763. %
  1764. % If the item text does not fit in the space we have, put it on a line
  1765. % by itself, and do not allow a page break either before or after that
  1766. % line. We do not start a paragraph here because then if the next
  1767. % command is, e.g., @kindex, the whatsit would get put into the
  1768. % horizontal list on a line by itself, resulting in extra blank space.
  1769. \ifdim \wd0>\itemmax
  1770. %
  1771. % Make this a paragraph so we get the \parskip glue and wrapping,
  1772. % but leave it ragged-right.
  1773. \begingroup
  1774. \advance\leftskip by-\tableindent
  1775. \advance\hsize by\tableindent
  1776. \advance\rightskip by0pt plus1fil
  1777. \leavevmode\unhbox0\par
  1778. \endgroup
  1779. %
  1780. % We're going to be starting a paragraph, but we don't want the
  1781. % \parskip glue -- logically it's part of the @item we just started.
  1782. \nobreak \vskip-\parskip
  1783. %
  1784. % Stop a page break at the \parskip glue coming up. (Unfortunately
  1785. % we can't prevent a possible page break at the following
  1786. % \baselineskip glue.) However, if what follows is an environment
  1787. % such as @example, there will be no \parskip glue; then
  1788. % the negative vskip we just would cause the example and the item to
  1789. % crash together. So we use this bizarre value of 10001 as a signal
  1790. % to \aboveenvbreak to insert \parskip glue after all.
  1791. % (Possibly there are other commands that could be followed by
  1792. % @example which need the same treatment, but not section titles; or
  1793. % maybe section titles are the only special case and they should be
  1794. % penalty 10001...)
  1795. \penalty 10001
  1796. \endgroup
  1797. \itemxneedsnegativevskipfalse
  1798. \else
  1799. % The item text fits into the space. Start a paragraph, so that the
  1800. % following text (if any) will end up on the same line.
  1801. \noindent
  1802. % Do this with kerns and \unhbox so that if there is a footnote in
  1803. % the item text, it can migrate to the main vertical list and
  1804. % eventually be printed.
  1805. \nobreak\kern-\tableindent
  1806. \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  1807. \unhbox0
  1808. \nobreak\kern\dimen0
  1809. \endgroup
  1810. \itemxneedsnegativevskiptrue
  1811. \fi
  1812. }
  1813. \def\item{\errmessage{@item while not in a table}}
  1814. \def\itemx{\errmessage{@itemx while not in a table}}
  1815. \def\kitem{\errmessage{@kitem while not in a table}}
  1816. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1817. \def\xitem{\errmessage{@xitem while not in a table}}
  1818. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1819. % Contains a kludge to get @end[description] to work.
  1820. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1821. % @table, @ftable, @vtable.
  1822. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1823. {\obeylines\obeyspaces%
  1824. \gdef\tablex #1^^M{%
  1825. \tabley\dontindex#1 \endtabley}}
  1826. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1827. {\obeylines\obeyspaces%
  1828. \gdef\ftablex #1^^M{%
  1829. \tabley\fnitemindex#1 \endtabley
  1830. \def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1831. \let\Etable=\relax}}
  1832. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1833. {\obeylines\obeyspaces%
  1834. \gdef\vtablex #1^^M{%
  1835. \tabley\vritemindex#1 \endtabley
  1836. \def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1837. \let\Etable=\relax}}
  1838. \def\dontindex #1{}
  1839. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1840. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1841. {\obeyspaces %
  1842. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1843. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1844. \def\tablez #1#2#3#4#5#6{%
  1845. \aboveenvbreak %
  1846. \begingroup %
  1847. \def\Edescription{\Etable}% Necessary kludge.
  1848. \let\itemindex=#1%
  1849. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1850. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1851. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1852. \def\itemfont{#2}%
  1853. \itemmax=\tableindent %
  1854. \advance \itemmax by -\itemmargin %
  1855. \advance \leftskip by \tableindent %
  1856. \exdentamount=\tableindent
  1857. \parindent = 0pt
  1858. \parskip = \smallskipamount
  1859. \ifdim \parskip=0pt \parskip=2pt \fi%
  1860. \def\Etable{\endgraf\afterenvbreak\endgroup}%
  1861. \let\item = \internalBitem %
  1862. \let\itemx = \internalBitemx %
  1863. \let\kitem = \internalBkitem %
  1864. \let\kitemx = \internalBkitemx %
  1865. \let\xitem = \internalBxitem %
  1866. \let\xitemx = \internalBxitemx %
  1867. }
  1868. % This is the counter used by @enumerate, which is really @itemize
  1869. \newcount \itemno
  1870. \def\itemize{\parsearg\itemizezzz}
  1871. \def\itemizezzz #1{%
  1872. \begingroup % ended by the @end itemize
  1873. \itemizey {#1}{\Eitemize}
  1874. }
  1875. \def\itemizey #1#2{%
  1876. \aboveenvbreak %
  1877. \itemmax=\itemindent %
  1878. \advance \itemmax by -\itemmargin %
  1879. \advance \leftskip by \itemindent %
  1880. \exdentamount=\itemindent
  1881. \parindent = 0pt %
  1882. \parskip = \smallskipamount %
  1883. \ifdim \parskip=0pt \parskip=2pt \fi%
  1884. \def#2{\endgraf\afterenvbreak\endgroup}%
  1885. \def\itemcontents{#1}%
  1886. \let\item=\itemizeitem}
  1887. % \splitoff TOKENS\endmark defines \first to be the first token in
  1888. % TOKENS, and \rest to be the remainder.
  1889. %
  1890. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1891. % Allow an optional argument of an uppercase letter, lowercase letter,
  1892. % or number, to specify the first label in the enumerated list. No
  1893. % argument is the same as `1'.
  1894. %
  1895. \def\enumerate{\parsearg\enumeratezzz}
  1896. \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
  1897. \def\enumeratey #1 #2\endenumeratey{%
  1898. \begingroup % ended by the @end enumerate
  1899. %
  1900. % If we were given no argument, pretend we were given `1'.
  1901. \def\thearg{#1}%
  1902. \ifx\thearg\empty \def\thearg{1}\fi
  1903. %
  1904. % Detect if the argument is a single token. If so, it might be a
  1905. % letter. Otherwise, the only valid thing it can be is a number.
  1906. % (We will always have one token, because of the test we just made.
  1907. % This is a good thing, since \splitoff doesn't work given nothing at
  1908. % all -- the first parameter is undelimited.)
  1909. \expandafter\splitoff\thearg\endmark
  1910. \ifx\rest\empty
  1911. % Only one token in the argument. It could still be anything.
  1912. % A ``lowercase letter'' is one whose \lccode is nonzero.
  1913. % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1914. % not equal to itself.
  1915. % Otherwise, we assume it's a number.
  1916. %
  1917. % We need the \relax at the end of the \ifnum lines to stop TeX from
  1918. % continuing to look for a <number>.
  1919. %
  1920. \ifnum\lccode\expandafter`\thearg=0\relax
  1921. \numericenumerate % a number (we hope)
  1922. \else
  1923. % It's a letter.
  1924. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1925. \lowercaseenumerate % lowercase letter
  1926. \else
  1927. \uppercaseenumerate % uppercase letter
  1928. \fi
  1929. \fi
  1930. \else
  1931. % Multiple tokens in the argument. We hope it's a number.
  1932. \numericenumerate
  1933. \fi
  1934. }
  1935. % An @enumerate whose labels are integers. The starting integer is
  1936. % given in \thearg.
  1937. %
  1938. \def\numericenumerate{%
  1939. \itemno = \thearg
  1940. \startenumeration{\the\itemno}%
  1941. }
  1942. % The starting (lowercase) letter is in \thearg.
  1943. \def\lowercaseenumerate{%
  1944. \itemno = \expandafter`\thearg
  1945. \startenumeration{%
  1946. % Be sure we're not beyond the end of the alphabet.
  1947. \ifnum\itemno=0
  1948. \errmessage{No more lowercase letters in @enumerate; get a bigger
  1949. alphabet}%
  1950. \fi
  1951. \char\lccode\itemno
  1952. }%
  1953. }
  1954. % The starting (uppercase) letter is in \thearg.
  1955. \def\uppercaseenumerate{%
  1956. \itemno = \expandafter`\thearg
  1957. \startenumeration{%
  1958. % Be sure we're not beyond the end of the alphabet.
  1959. \ifnum\itemno=0
  1960. \errmessage{No more uppercase letters in @enumerate; get a bigger
  1961. alphabet}
  1962. \fi
  1963. \char\uccode\itemno
  1964. }%
  1965. }
  1966. % Call itemizey, adding a period to the first argument and supplying the
  1967. % common last two arguments. Also subtract one from the initial value in
  1968. % \itemno, since @item increments \itemno.
  1969. %
  1970. \def\startenumeration#1{%
  1971. \advance\itemno by -1
  1972. \itemizey{#1.}\Eenumerate\flushcr
  1973. }
  1974. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1975. % to @enumerate.
  1976. %
  1977. \def\alphaenumerate{\enumerate{a}}
  1978. \def\capsenumerate{\enumerate{A}}
  1979. \def\Ealphaenumerate{\Eenumerate}
  1980. \def\Ecapsenumerate{\Eenumerate}
  1981. % Definition of @item while inside @itemize.
  1982. \def\itemizeitem{%
  1983. \advance\itemno by 1
  1984. {\let\par=\endgraf \smallbreak}%
  1985. \ifhmode \errmessage{In hmode at itemizeitem}\fi
  1986. {\parskip=0in \hskip 0pt
  1987. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1988. \vadjust{\penalty 1200}}%
  1989. \flushcr}
  1990. % @multitable macros
  1991. % Amy Hendrickson, 8/18/94, 3/6/96
  1992. %
  1993. % @multitable ... @end multitable will make as many columns as desired.
  1994. % Contents of each column will wrap at width given in preamble. Width
  1995. % can be specified either with sample text given in a template line,
  1996. % or in percent of \hsize, the current width of text on page.
  1997. % Table can continue over pages but will only break between lines.
  1998. % To make preamble:
  1999. %
  2000. % Either define widths of columns in terms of percent of \hsize:
  2001. % @multitable @columnfractions .25 .3 .45
  2002. % @item ...
  2003. %
  2004. % Numbers following @columnfractions are the percent of the total
  2005. % current hsize to be used for each column. You may use as many
  2006. % columns as desired.
  2007. % Or use a template:
  2008. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  2009. % @item ...
  2010. % using the widest term desired in each column.
  2011. %
  2012. % For those who want to use more than one line's worth of words in
  2013. % the preamble, break the line within one argument and it
  2014. % will parse correctly, i.e.,
  2015. %
  2016. % @multitable {Column 1 template} {Column 2 template} {Column 3
  2017. % template}
  2018. % Not:
  2019. % @multitable {Column 1 template} {Column 2 template}
  2020. % {Column 3 template}
  2021. % Each new table line starts with @item, each subsequent new column
  2022. % starts with @tab. Empty columns may be produced by supplying @tab's
  2023. % with nothing between them for as many times as empty columns are needed,
  2024. % ie, @tab@tab@tab will produce two empty columns.
  2025. % @item, @tab, @multitable or @end multitable do not need to be on their
  2026. % own lines, but it will not hurt if they are.
  2027. % Sample multitable:
  2028. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  2029. % @item first col stuff @tab second col stuff @tab third col
  2030. % @item
  2031. % first col stuff
  2032. % @tab
  2033. % second col stuff
  2034. % @tab
  2035. % third col
  2036. % @item first col stuff @tab second col stuff
  2037. % @tab Many paragraphs of text may be used in any column.
  2038. %
  2039. % They will wrap at the width determined by the template.
  2040. % @item@tab@tab This will be in third column.
  2041. % @end multitable
  2042. % Default dimensions may be reset by user.
  2043. % @multitableparskip is vertical space between paragraphs in table.
  2044. % @multitableparindent is paragraph indent in table.
  2045. % @multitablecolmargin is horizontal space to be left between columns.
  2046. % @multitablelinespace is space to leave between table items, baseline
  2047. % to baseline.
  2048. % 0pt means it depends on current normal line spacing.
  2049. %
  2050. \newskip\multitableparskip
  2051. \newskip\multitableparindent
  2052. \newdimen\multitablecolspace
  2053. \newskip\multitablelinespace
  2054. \multitableparskip=0pt
  2055. \multitableparindent=6pt
  2056. \multitablecolspace=12pt
  2057. \multitablelinespace=0pt
  2058. % Macros used to set up halign preamble:
  2059. %
  2060. \let\endsetuptable\relax
  2061. \def\xendsetuptable{\endsetuptable}
  2062. \let\columnfractions\relax
  2063. \def\xcolumnfractions{\columnfractions}
  2064. \newif\ifsetpercent
  2065. % #1 is the part of the @columnfraction before the decimal point, which
  2066. % is presumably either 0 or the empty string (but we don't check, we
  2067. % just throw it away). #2 is the decimal part, which we use as the
  2068. % percent of \hsize for this column.
  2069. \def\pickupwholefraction#1.#2 {%
  2070. \global\advance\colcount by 1
  2071. \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
  2072. \setuptable
  2073. }
  2074. \newcount\colcount
  2075. \def\setuptable#1{%
  2076. \def\firstarg{#1}%
  2077. \ifx\firstarg\xendsetuptable
  2078. \let\go = \relax
  2079. \else
  2080. \ifx\firstarg\xcolumnfractions
  2081. \global\setpercenttrue
  2082. \else
  2083. \ifsetpercent
  2084. \let\go\pickupwholefraction
  2085. \else
  2086. \global\advance\colcount by 1
  2087. \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
  2088. % separator; typically that is always in the input, anyway.
  2089. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  2090. \fi
  2091. \fi
  2092. \ifx\go\pickupwholefraction
  2093. % Put the argument back for the \pickupwholefraction call, so
  2094. % we'll always have a period there to be parsed.
  2095. \def\go{\pickupwholefraction#1}%
  2096. \else
  2097. \let\go = \setuptable
  2098. \fi%
  2099. \fi
  2100. \go
  2101. }
  2102. % @multitable ... @end multitable definitions:
  2103. %
  2104. \def\multitable{\parsearg\dotable}
  2105. \def\dotable#1{\bgroup
  2106. \vskip\parskip
  2107. \let\item=\crcrwithfootnotes
  2108. % A \tab used to include \hskip1sp. But then the space in a template
  2109. % line is not enough. That is bad. So let's go back to just & until
  2110. % we encounter the problem it was intended to solve again. --karl,
  2111. % nathan@acm.org, 20apr99.
  2112. \let\tab=&%
  2113. \let\startfootins=\startsavedfootnote
  2114. \tolerance=9500
  2115. \hbadness=9500
  2116. \setmultitablespacing
  2117. \parskip=\multitableparskip
  2118. \parindent=\multitableparindent
  2119. \overfullrule=0pt
  2120. \global\colcount=0
  2121. \def\Emultitable{%
  2122. \global\setpercentfalse
  2123. \crcrwithfootnotes\crcr
  2124. \egroup\egroup
  2125. }%
  2126. %
  2127. % To parse everything between @multitable and @item:
  2128. \setuptable#1 \endsetuptable
  2129. %
  2130. % \everycr will reset column counter, \colcount, at the end of
  2131. % each line. Every column entry will cause \colcount to advance by one.
  2132. % The table preamble
  2133. % looks at the current \colcount to find the correct column width.
  2134. \everycr{\noalign{%
  2135. %
  2136. % \filbreak%% keeps underfull box messages off when table breaks over pages.
  2137. % Maybe so, but it also creates really weird page breaks when the table
  2138. % breaks over pages. Wouldn't \vfil be better? Wait until the problem
  2139. % manifests itself, so it can be fixed for real --karl.
  2140. \global\colcount=0\relax}}%
  2141. %
  2142. % This preamble sets up a generic column definition, which will
  2143. % be used as many times as user calls for columns.
  2144. % \vtop will set a single line and will also let text wrap and
  2145. % continue for many paragraphs if desired.
  2146. \halign\bgroup&\global\advance\colcount by 1\relax
  2147. \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
  2148. %
  2149. % In order to keep entries from bumping into each other
  2150. % we will add a \leftskip of \multitablecolspace to all columns after
  2151. % the first one.
  2152. %
  2153. % If a template has been used, we will add \multitablecolspace
  2154. % to the width of each template entry.
  2155. %
  2156. % If the user has set preamble in terms of percent of \hsize we will
  2157. % use that dimension as the width of the column, and the \leftskip
  2158. % will keep entries from bumping into each other. Table will start at
  2159. % left margin and final column will justify at right margin.
  2160. %
  2161. % Make sure we don't inherit \rightskip from the outer environment.
  2162. \rightskip=0pt
  2163. \ifnum\colcount=1
  2164. % The first column will be indented with the surrounding text.
  2165. \advance\hsize by\leftskip
  2166. \else
  2167. \ifsetpercent \else
  2168. % If user has not set preamble in terms of percent of \hsize
  2169. % we will advance \hsize by \multitablecolspace.
  2170. \advance\hsize by \multitablecolspace
  2171. \fi
  2172. % In either case we will make \leftskip=\multitablecolspace:
  2173. \leftskip=\multitablecolspace
  2174. \fi
  2175. % Ignoring space at the beginning and end avoids an occasional spurious
  2176. % blank line, when TeX decides to break the line at the space before the
  2177. % box from the multistrut, so the strut ends up on a line by itself.
  2178. % For example:
  2179. % @multitable @columnfractions .11 .89
  2180. % @item @code{#}
  2181. % @tab Legal holiday which is valid in major parts of the whole country.
  2182. % Is automatically provided with highlighting sequences respectively marking
  2183. % characters.
  2184. \noindent\ignorespaces##\unskip\multistrut}\cr
  2185. }
  2186. \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
  2187. % If so, do nothing. If not, give it an appropriate dimension based on
  2188. % current baselineskip.
  2189. \ifdim\multitablelinespace=0pt
  2190. \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
  2191. \global\advance\multitablelinespace by-\ht0
  2192. %% strut to put in table in case some entry doesn't have descenders,
  2193. %% to keep lines equally spaced
  2194. \let\multistrut = \strut
  2195. \else
  2196. %% FIXME: what is \box0 supposed to be?
  2197. \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
  2198. width0pt\relax} \fi
  2199. %% Test to see if parskip is larger than space between lines of
  2200. %% table. If not, do nothing.
  2201. %% If so, set to same dimension as multitablelinespace.
  2202. \ifdim\multitableparskip>\multitablelinespace
  2203. \global\multitableparskip=\multitablelinespace
  2204. \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  2205. %% than skip between lines in the table.
  2206. \fi%
  2207. \ifdim\multitableparskip=0pt
  2208. \global\multitableparskip=\multitablelinespace
  2209. \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  2210. %% than skip between lines in the table.
  2211. \fi}
  2212. % In case a @footnote appears inside an alignment, save the footnote
  2213. % text to a box and make the \insert when a row of the table is
  2214. % finished. Otherwise, the insertion is lost, it never migrates to the
  2215. % main vertical list. --kasal, 22jan03.
  2216. %
  2217. \newbox\savedfootnotes
  2218. %
  2219. % \dotable \let's \startfootins to this, so that \dofootnote will call
  2220. % it instead of starting the insertion right away.
  2221. \def\startsavedfootnote{%
  2222. \global\setbox\savedfootnotes = \vbox\bgroup
  2223. \unvbox\savedfootnotes
  2224. }
  2225. \def\crcrwithfootnotes{%
  2226. \crcr
  2227. \ifvoid\savedfootnotes \else
  2228. \noalign{\insert\footins{\box\savedfootnotes}}%
  2229. \fi
  2230. }
  2231. \message{conditionals,}
  2232. % Prevent errors for section commands.
  2233. % Used in @ignore and in failing conditionals.
  2234. \def\ignoresections{%
  2235. \let\chapter=\relax
  2236. \let\unnumbered=\relax
  2237. \let\top=\relax
  2238. \let\unnumberedsec=\relax
  2239. \let\unnumberedsection=\relax
  2240. \let\unnumberedsubsec=\relax
  2241. \let\unnumberedsubsection=\relax
  2242. \let\unnumberedsubsubsec=\relax
  2243. \let\unnumberedsubsubsection=\relax
  2244. \let\section=\relax
  2245. \let\subsec=\relax
  2246. \let\subsubsec=\relax
  2247. \let\subsection=\relax
  2248. \let\subsubsection=\relax
  2249. \let\appendix=\relax
  2250. \let\appendixsec=\relax
  2251. \let\appendixsection=\relax
  2252. \let\appendixsubsec=\relax
  2253. \let\appendixsubsection=\relax
  2254. \let\appendixsubsubsec=\relax
  2255. \let\appendixsubsubsection=\relax
  2256. \let\contents=\relax
  2257. \let\smallbook=\relax
  2258. \let\titlepage=\relax
  2259. }
  2260. % Used in nested conditionals, where we have to parse the Texinfo source
  2261. % and so want to turn off most commands, in case they are used
  2262. % incorrectly.
  2263. %
  2264. % We use \empty instead of \relax for the @def... commands, so that \end
  2265. % doesn't throw an error. For instance:
  2266. % @ignore
  2267. % @deffn ...
  2268. % @end deffn
  2269. % @end ignore
  2270. %
  2271. % The @end deffn is going to get expanded, because we're trying to allow
  2272. % nested conditionals. But we don't want to expand the actual @deffn,
  2273. % since it might be syntactically correct and intended to be ignored.
  2274. % Since \end checks for \relax, using \empty does not cause an error.
  2275. %
  2276. \def\ignoremorecommands{%
  2277. \let\defcodeindex = \relax
  2278. \let\defcv = \empty
  2279. \let\defcvx = \empty
  2280. \let\Edefcv = \empty
  2281. \let\deffn = \empty
  2282. \let\deffnx = \empty
  2283. \let\Edeffn = \empty
  2284. \let\defindex = \relax
  2285. \let\defivar = \empty
  2286. \let\defivarx = \empty
  2287. \let\Edefivar = \empty
  2288. \let\defmac = \empty
  2289. \let\defmacx = \empty
  2290. \let\Edefmac = \empty
  2291. \let\defmethod = \empty
  2292. \let\defmethodx = \empty
  2293. \let\Edefmethod = \empty
  2294. \let\defop = \empty
  2295. \let\defopx = \empty
  2296. \let\Edefop = \empty
  2297. \let\defopt = \empty
  2298. \let\defoptx = \empty
  2299. \let\Edefopt = \empty
  2300. \let\defspec = \empty
  2301. \let\defspecx = \empty
  2302. \let\Edefspec = \empty
  2303. \let\deftp = \empty
  2304. \let\deftpx = \empty
  2305. \let\Edeftp = \empty
  2306. \let\deftypefn = \empty
  2307. \let\deftypefnx = \empty
  2308. \let\Edeftypefn = \empty
  2309. \let\deftypefun = \empty
  2310. \let\deftypefunx = \empty
  2311. \let\Edeftypefun = \empty
  2312. \let\deftypeivar = \empty
  2313. \let\deftypeivarx = \empty
  2314. \let\Edeftypeivar = \empty
  2315. \let\deftypemethod = \empty
  2316. \let\deftypemethodx = \empty
  2317. \let\Edeftypemethod = \empty
  2318. \let\deftypeop = \empty
  2319. \let\deftypeopx = \empty
  2320. \let\Edeftypeop = \empty
  2321. \let\deftypevar = \empty
  2322. \let\deftypevarx = \empty
  2323. \let\Edeftypevar = \empty
  2324. \let\deftypevr = \empty
  2325. \let\deftypevrx = \empty
  2326. \let\Edeftypevr = \empty
  2327. \let\defun = \empty
  2328. \let\defunx = \empty
  2329. \let\Edefun = \empty
  2330. \let\defvar = \empty
  2331. \let\defvarx = \empty
  2332. \let\Edefvar = \empty
  2333. \let\defvr = \empty
  2334. \let\defvrx = \empty
  2335. \let\Edefvr = \empty
  2336. \let\clear = \relax
  2337. \let\down = \relax
  2338. \let\evenfooting = \relax
  2339. \let\evenheading = \relax
  2340. \let\everyfooting = \relax
  2341. \let\everyheading = \relax
  2342. \let\headings = \relax
  2343. \let\include = \relax
  2344. \let\item = \relax
  2345. \let\lowersections = \relax
  2346. \let\oddfooting = \relax
  2347. \let\oddheading = \relax
  2348. \let\printindex = \relax
  2349. \let\pxref = \relax
  2350. \let\raisesections = \relax
  2351. \let\ref = \relax
  2352. \let\set = \relax
  2353. \let\setchapternewpage = \relax
  2354. \let\setchapterstyle = \relax
  2355. \let\settitle = \relax
  2356. \let\up = \relax
  2357. \let\verbatiminclude = \relax
  2358. \let\xref = \relax
  2359. }
  2360. % Ignore @ignore, @ifhtml, @ifinfo, and the like.
  2361. %
  2362. \def\direntry{\doignore{direntry}}
  2363. \def\documentdescriptionword{documentdescription}
  2364. \def\documentdescription{\doignore{documentdescription}}
  2365. \def\html{\doignore{html}}
  2366. \def\ifhtml{\doignore{ifhtml}}
  2367. \def\ifinfo{\doignore{ifinfo}}
  2368. \def\ifnottex{\doignore{ifnottex}}
  2369. \def\ifplaintext{\doignore{ifplaintext}}
  2370. \def\ifxml{\doignore{ifxml}}
  2371. \def\ignore{\doignore{ignore}}
  2372. \def\menu{\doignore{menu}}
  2373. \def\xml{\doignore{xml}}
  2374. % @dircategory CATEGORY -- specify a category of the dir file
  2375. % which this file should belong to. Ignore this in TeX.
  2376. \let\dircategory = \comment
  2377. % Ignore text until a line `@end #1'.
  2378. %
  2379. \def\doignore#1{\begingroup
  2380. % Don't complain about control sequences we have declared \outer.
  2381. \ignoresections
  2382. %
  2383. % Define a command to swallow text until we reach `@end #1'.
  2384. % This @ is a catcode 12 token (that is the normal catcode of @ in
  2385. % this texinfo.tex file). We change the catcode of @ below to match.
  2386. \long\def\doignoretext##1@end #1{\enddoignore}%
  2387. %
  2388. % Make sure that spaces turn into tokens that match what \doignoretext wants.
  2389. \catcode\spaceChar = 10
  2390. %
  2391. % Ignore braces, too, so mismatched braces don't cause trouble.
  2392. \catcode`\{ = 9
  2393. \catcode`\} = 9
  2394. %
  2395. % We must not have @c interpreted as a control sequence.
  2396. \catcode`\@ = 12
  2397. %
  2398. \def\ignoreword{#1}%
  2399. \ifx\ignoreword\documentdescriptionword
  2400. % The c kludge breaks documentdescription, since
  2401. % `documentdescription' contains a `c'. Means not everything will
  2402. % be ignored inside @documentdescription, but oh well...
  2403. \else
  2404. % Make the letter c a comment character so that the rest of the line
  2405. % will be ignored. This way, the document can have (for example)
  2406. % @c @end ifinfo
  2407. % and the @end ifinfo will be properly ignored.
  2408. % (We've just changed @ to catcode 12.)
  2409. \catcode`\c = 14
  2410. \fi
  2411. %
  2412. % And now expand the command defined above.
  2413. \doignoretext
  2414. }
  2415. % What we do to finish off ignored text.
  2416. %
  2417. \def\enddoignore{\endgroup\ignorespaces}%
  2418. \newif\ifwarnedobs\warnedobsfalse
  2419. \def\obstexwarn{%
  2420. \ifwarnedobs\relax\else
  2421. % We need to warn folks that they may have trouble with TeX 3.0.
  2422. % This uses \immediate\write16 rather than \message to get newlines.
  2423. \immediate\write16{}
  2424. \immediate\write16{WARNING: for users of Unix TeX 3.0!}
  2425. \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  2426. \immediate\write16{If you are running another version of TeX, relax.}
  2427. \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  2428. \immediate\write16{ Then upgrade your TeX installation if you can.}
  2429. \immediate\write16{ (See ftp://ftp.gnu.org/non-gnu/TeX.README.)}
  2430. \immediate\write16{If you are stuck with version 3.0, run the}
  2431. \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
  2432. \immediate\write16{ to use a workaround.}
  2433. \immediate\write16{}
  2434. \global\warnedobstrue
  2435. \fi
  2436. }
  2437. % **In TeX 3.0, setting text in \nullfont hangs tex. For a
  2438. % workaround (which requires the file ``dummy.tfm'' to be installed),
  2439. % uncomment the following line:
  2440. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  2441. % Ignore text, except that we keep track of conditional commands for
  2442. % purposes of nesting, up to an `@end #1' command.
  2443. %
  2444. \def\nestedignore#1{%
  2445. \obstexwarn
  2446. % We must actually expand the ignored text to look for the @end
  2447. % command, so that nested ignore constructs work. Thus, we put the
  2448. % text into a \vbox and then do nothing with the result. To minimize
  2449. % the chance of memory overflow, we follow the approach outlined on
  2450. % page 401 of the TeXbook.
  2451. %
  2452. \setbox0 = \vbox\bgroup
  2453. % Don't complain about control sequences we have declared \outer.
  2454. \ignoresections
  2455. %
  2456. % Define `@end #1' to end the box, which will in turn undefine the
  2457. % @end command again.
  2458. \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  2459. %
  2460. % We are going to be parsing Texinfo commands. Most cause no
  2461. % trouble when they are used incorrectly, but some commands do
  2462. % complicated argument parsing or otherwise get confused, so we
  2463. % undefine them.
  2464. %
  2465. % We can't do anything about stray @-signs, unfortunately;
  2466. % they'll produce `undefined control sequence' errors.
  2467. \ignoremorecommands
  2468. %
  2469. % Set the current font to be \nullfont, a TeX primitive, and define
  2470. % all the font commands to also use \nullfont. We don't use
  2471. % dummy.tfm, as suggested in the TeXbook, because some sites
  2472. % might not have that installed. Therefore, math mode will still
  2473. % produce output, but that should be an extremely small amount of
  2474. % stuff compared to the main input.
  2475. %
  2476. \nullfont
  2477. \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
  2478. \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
  2479. \let\tensf=\nullfont
  2480. % Similarly for index fonts.
  2481. \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
  2482. \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
  2483. \let\smallsf=\nullfont
  2484. % Similarly for smallexample fonts.
  2485. \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont
  2486. \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont
  2487. \let\smallersf=\nullfont
  2488. %
  2489. % Don't complain when characters are missing from the fonts.
  2490. \tracinglostchars = 0
  2491. %
  2492. % Don't bother to do space factor calculations.
  2493. \frenchspacing
  2494. %
  2495. % Don't report underfull hboxes.
  2496. \hbadness = 10000
  2497. %
  2498. % Do minimal line-breaking.
  2499. \pretolerance = 10000
  2500. %
  2501. % Do not execute instructions in @tex.
  2502. \def\tex{\doignore{tex}}%
  2503. % Do not execute macro definitions.
  2504. % `c' is a comment character, so the word `macro' will get cut off.
  2505. \def\macro{\doignore{ma}}%
  2506. }
  2507. % @set VAR sets the variable VAR to an empty value.
  2508. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  2509. %
  2510. % Since we want to separate VAR from REST-OF-LINE (which might be
  2511. % empty), we can't just use \parsearg; we have to insert a space of our
  2512. % own to delimit the rest of the line, and then take it out again if we
  2513. % didn't need it. Make sure the catcode of space is correct to avoid
  2514. % losing inside @example, for instance.
  2515. %
  2516. \def\set{\begingroup\catcode` =10
  2517. \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
  2518. \parsearg\setxxx}
  2519. \def\setxxx#1{\setyyy#1 \endsetyyy}
  2520. \def\setyyy#1 #2\endsetyyy{%
  2521. \def\temp{#2}%
  2522. \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  2523. \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  2524. \fi
  2525. \endgroup
  2526. }
  2527. % Can't use \xdef to pre-expand #2 and save some time, since \temp or
  2528. % \next or other control sequences that we've defined might get us into
  2529. % an infinite loop. Consider `@set foo @cite{bar}'.
  2530. \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
  2531. % @clear VAR clears (i.e., unsets) the variable VAR.
  2532. %
  2533. \def\clear{\parsearg\clearxxx}
  2534. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  2535. % @value{foo} gets the text saved in variable foo.
  2536. {
  2537. \catcode`\_ = \active
  2538. %
  2539. % We might end up with active _ or - characters in the argument if
  2540. % we're called from @code, as @code{@value{foo-bar_}}. So \let any
  2541. % such active characters to their normal equivalents.
  2542. \gdef\value{\begingroup
  2543. \catcode`\-=\other \catcode`\_=\other
  2544. \indexbreaks \let_\normalunderscore
  2545. \valuexxx}
  2546. }
  2547. \def\valuexxx#1{\expandablevalue{#1}\endgroup}
  2548. % We have this subroutine so that we can handle at least some @value's
  2549. % properly in indexes (we \let\value to this in \indexdummies). Ones
  2550. % whose names contain - or _ still won't work, but we can't do anything
  2551. % about that. The command has to be fully expandable (if the variable
  2552. % is set), since the result winds up in the index file. This means that
  2553. % if the variable's value contains other Texinfo commands, it's almost
  2554. % certain it will fail (although perhaps we could fix that with
  2555. % sufficient work to do a one-level expansion on the result, instead of
  2556. % complete).
  2557. %
  2558. \def\expandablevalue#1{%
  2559. \expandafter\ifx\csname SET#1\endcsname\relax
  2560. {[No value for ``#1'']}%
  2561. \message{Variable `#1', used in @value, is not set.}%
  2562. \else
  2563. \csname SET#1\endcsname
  2564. \fi
  2565. }
  2566. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  2567. % with @set.
  2568. %
  2569. \def\ifset{\parsearg\doifset}
  2570. \def\doifset#1{%
  2571. \expandafter\ifx\csname SET#1\endcsname\relax
  2572. \let\next=\ifsetfail
  2573. \else
  2574. \let\next=\ifsetsucceed
  2575. \fi
  2576. \next
  2577. }
  2578. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  2579. \def\ifsetfail{\nestedignore{ifset}}
  2580. \defineunmatchedend{ifset}
  2581. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  2582. % defined with @set, or has been undefined with @clear.
  2583. %
  2584. \def\ifclear{\parsearg\doifclear}
  2585. \def\doifclear#1{%
  2586. \expandafter\ifx\csname SET#1\endcsname\relax
  2587. \let\next=\ifclearsucceed
  2588. \else
  2589. \let\next=\ifclearfail
  2590. \fi
  2591. \next
  2592. }
  2593. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  2594. \def\ifclearfail{\nestedignore{ifclear}}
  2595. \defineunmatchedend{ifclear}
  2596. % @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
  2597. % read the text following, through the first @end iftex (etc.). Make
  2598. % `@end iftex' (etc.) valid only after an @iftex.
  2599. %
  2600. \def\iftex{\conditionalsucceed{iftex}}
  2601. \def\ifnothtml{\conditionalsucceed{ifnothtml}}
  2602. \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
  2603. \def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
  2604. \defineunmatchedend{iftex}
  2605. \defineunmatchedend{ifnothtml}
  2606. \defineunmatchedend{ifnotinfo}
  2607. \defineunmatchedend{ifnotplaintext}
  2608. % True conditional. Since \set globally defines its variables, we can
  2609. % just start and end a group (to keep the @end definition undefined at
  2610. % the outer level).
  2611. %
  2612. \def\conditionalsucceed#1{\begingroup
  2613. \expandafter\def\csname E#1\endcsname{\endgroup}%
  2614. }
  2615. % @defininfoenclose.
  2616. \let\definfoenclose=\comment
  2617. \message{indexing,}
  2618. % Index generation facilities
  2619. % Define \newwrite to be identical to plain tex's \newwrite
  2620. % except not \outer, so it can be used within \newindex.
  2621. {\catcode`\@=11
  2622. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  2623. % \newindex {foo} defines an index named foo.
  2624. % It automatically defines \fooindex such that
  2625. % \fooindex ...rest of line... puts an entry in the index foo.
  2626. % It also defines \fooindfile to be the number of the output channel for
  2627. % the file that accumulates this index. The file's extension is foo.
  2628. % The name of an index should be no more than 2 characters long
  2629. % for the sake of vms.
  2630. %
  2631. \def\newindex#1{%
  2632. \iflinks
  2633. \expandafter\newwrite \csname#1indfile\endcsname
  2634. \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
  2635. \fi
  2636. \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
  2637. \noexpand\doindex{#1}}
  2638. }
  2639. % @defindex foo == \newindex{foo}
  2640. %
  2641. \def\defindex{\parsearg\newindex}
  2642. % Define @defcodeindex, like @defindex except put all entries in @code.
  2643. %
  2644. \def\defcodeindex{\parsearg\newcodeindex}
  2645. %
  2646. \def\newcodeindex#1{%
  2647. \iflinks
  2648. \expandafter\newwrite \csname#1indfile\endcsname
  2649. \openout \csname#1indfile\endcsname \jobname.#1
  2650. \fi
  2651. \expandafter\xdef\csname#1index\endcsname{%
  2652. \noexpand\docodeindex{#1}}%
  2653. }
  2654. % @synindex foo bar makes index foo feed into index bar.
  2655. % Do this instead of @defindex foo if you don't want it as a separate index.
  2656. %
  2657. % @syncodeindex foo bar similar, but put all entries made for index foo
  2658. % inside @code.
  2659. %
  2660. \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
  2661. \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
  2662. % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
  2663. % #3 the target index (bar).
  2664. \def\dosynindex#1#2#3{%
  2665. % Only do \closeout if we haven't already done it, else we'll end up
  2666. % closing the target index.
  2667. \expandafter \ifx\csname donesynindex#2\endcsname \undefined
  2668. % The \closeout helps reduce unnecessary open files; the limit on the
  2669. % Acorn RISC OS is a mere 16 files.
  2670. \expandafter\closeout\csname#2indfile\endcsname
  2671. \expandafter\let\csname\donesynindex#2\endcsname = 1
  2672. \fi
  2673. % redefine \fooindfile:
  2674. \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  2675. \expandafter\let\csname#2indfile\endcsname=\temp
  2676. % redefine \fooindex:
  2677. \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
  2678. }
  2679. % Define \doindex, the driver for all \fooindex macros.
  2680. % Argument #1 is generated by the calling \fooindex macro,
  2681. % and it is "foo", the name of the index.
  2682. % \doindex just uses \parsearg; it calls \doind for the actual work.
  2683. % This is because \doind is more useful to call from other macros.
  2684. % There is also \dosubind {index}{topic}{subtopic}
  2685. % which makes an entry in a two-level index such as the operation index.
  2686. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  2687. \def\singleindexer #1{\doind{\indexname}{#1}}
  2688. % like the previous two, but they put @code around the argument.
  2689. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  2690. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  2691. % Take care of Texinfo commands that can appear in an index entry.
  2692. % Since there are some commands we want to expand, and others we don't,
  2693. % we have to laboriously prevent expansion for those that we don't.
  2694. %
  2695. \def\indexdummies{%
  2696. \def\@{@}% change to @@ when we switch to @ as escape char in index files.
  2697. \def\ {\realbackslash\space }%
  2698. % Need these in case \tex is in effect and \{ is a \delimiter again.
  2699. % But can't use \lbracecmd and \rbracecmd because texindex assumes
  2700. % braces and backslashes are used only as delimiters.
  2701. \let\{ = \mylbrace
  2702. \let\} = \myrbrace
  2703. %
  2704. % \definedummyword defines \#1 as \realbackslash #1\space, thus
  2705. % effectively preventing its expansion. This is used only for control
  2706. % words, not control letters, because the \space would be incorrect
  2707. % for control characters, but is needed to separate the control word
  2708. % from whatever follows.
  2709. %
  2710. % For control letters, we have \definedummyletter, which omits the
  2711. % space.
  2712. %
  2713. % These can be used both for control words that take an argument and
  2714. % those that do not. If it is followed by {arg} in the input, then
  2715. % that will dutifully get written to the index (or wherever).
  2716. %
  2717. \def\definedummyword##1{%
  2718. \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
  2719. }%
  2720. \def\definedummyletter##1{%
  2721. \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
  2722. }%
  2723. %
  2724. % Do the redefinitions.
  2725. \commondummies
  2726. }
  2727. % For the aux file, @ is the escape character. So we want to redefine
  2728. % everything using @ instead of \realbackslash. When everything uses
  2729. % @, this will be simpler.
  2730. %
  2731. \def\atdummies{%
  2732. \def\@{@@}%
  2733. \def\ {@ }%
  2734. \let\{ = \lbraceatcmd
  2735. \let\} = \rbraceatcmd
  2736. %
  2737. % (See comments in \indexdummies.)
  2738. \def\definedummyword##1{%
  2739. \expandafter\def\csname ##1\endcsname{@##1\space}%
  2740. }%
  2741. \def\definedummyletter##1{%
  2742. \expandafter\def\csname ##1\endcsname{@##1}%
  2743. }%
  2744. %
  2745. % Do the redefinitions.
  2746. \commondummies
  2747. }
  2748. % Called from \indexdummies and \atdummies. \definedummyword and
  2749. % \definedummyletter must be defined first.
  2750. %
  2751. \def\commondummies{%
  2752. %
  2753. \normalturnoffactive
  2754. %
  2755. % Control letters and accents.
  2756. \definedummyletter{_}%
  2757. \definedummyletter{,}%
  2758. \definedummyletter{"}%
  2759. \definedummyletter{`}%
  2760. \definedummyletter{'}%
  2761. \definedummyletter{^}%
  2762. \definedummyletter{~}%
  2763. \definedummyletter{=}%
  2764. \definedummyword{u}%
  2765. \definedummyword{v}%
  2766. \definedummyword{H}%
  2767. \definedummyword{dotaccent}%
  2768. \definedummyword{ringaccent}%
  2769. \definedummyword{tieaccent}%
  2770. \definedummyword{ubaraccent}%
  2771. \definedummyword{udotaccent}%
  2772. \definedummyword{dotless}%
  2773. %
  2774. % Other non-English letters.
  2775. \definedummyword{AA}%
  2776. \definedummyword{AE}%
  2777. \definedummyword{L}%
  2778. \definedummyword{OE}%
  2779. \definedummyword{O}%
  2780. \definedummyword{aa}%
  2781. \definedummyword{ae}%
  2782. \definedummyword{l}%
  2783. \definedummyword{oe}%
  2784. \definedummyword{o}%
  2785. \definedummyword{ss}%
  2786. %
  2787. % Although these internal commands shouldn't show up, sometimes they do.
  2788. \definedummyword{bf}%
  2789. \definedummyword{gtr}%
  2790. \definedummyword{hat}%
  2791. \definedummyword{less}%
  2792. \definedummyword{sf}%
  2793. \definedummyword{sl}%
  2794. \definedummyword{tclose}%
  2795. \definedummyword{tt}%
  2796. %
  2797. % Texinfo font commands.
  2798. \definedummyword{b}%
  2799. \definedummyword{i}%
  2800. \definedummyword{r}%
  2801. \definedummyword{sc}%
  2802. \definedummyword{t}%
  2803. %
  2804. \definedummyword{TeX}%
  2805. \definedummyword{acronym}%
  2806. \definedummyword{cite}%
  2807. \definedummyword{code}%
  2808. \definedummyword{command}%
  2809. \definedummyword{dfn}%
  2810. \definedummyword{dots}%
  2811. \definedummyword{emph}%
  2812. \definedummyword{env}%
  2813. \definedummyword{file}%
  2814. \definedummyword{kbd}%
  2815. \definedummyword{key}%
  2816. \definedummyword{math}%
  2817. \definedummyword{option}%
  2818. \definedummyword{samp}%
  2819. \definedummyword{strong}%
  2820. \definedummyword{uref}%
  2821. \definedummyword{url}%
  2822. \definedummyword{var}%
  2823. \definedummyword{w}%
  2824. %
  2825. % Assorted special characters.
  2826. \definedummyword{bullet}%
  2827. \definedummyword{copyright}%
  2828. \definedummyword{dots}%
  2829. \definedummyword{enddots}%
  2830. \definedummyword{equiv}%
  2831. \definedummyword{error}%
  2832. \definedummyword{expansion}%
  2833. \definedummyword{minus}%
  2834. \definedummyword{pounds}%
  2835. \definedummyword{point}%
  2836. \definedummyword{print}%
  2837. \definedummyword{result}%
  2838. %
  2839. % Handle some cases of @value -- where the variable name does not
  2840. % contain - or _, and the value does not contain any
  2841. % (non-fully-expandable) commands.
  2842. \let\value = \expandablevalue
  2843. %
  2844. % Normal spaces, not active ones.
  2845. \unsepspaces
  2846. %
  2847. % No macro expansion.
  2848. \turnoffmacros
  2849. }
  2850. % If an index command is used in an @example environment, any spaces
  2851. % therein should become regular spaces in the raw index file, not the
  2852. % expansion of \tie (\leavevmode \penalty \@M \ ).
  2853. {\obeyspaces
  2854. \gdef\unsepspaces{\obeyspaces\let =\space}}
  2855. % \indexnofonts is used when outputting the strings to sort the index
  2856. % by, and when constructing control sequence names. It eliminates all
  2857. % control sequences and just writes whatever the best ASCII sort string
  2858. % would be for a given command (usually its argument).
  2859. %
  2860. \def\indexdummytex{TeX}
  2861. \def\indexdummydots{...}
  2862. %
  2863. \def\indexnofonts{%
  2864. \def\ { }%
  2865. \def\@{@}%
  2866. % how to handle braces?
  2867. \def\_{\normalunderscore}%
  2868. %
  2869. \let\,=\asis
  2870. \let\"=\asis
  2871. \let\`=\asis
  2872. \let\'=\asis
  2873. \let\^=\asis
  2874. \let\~=\asis
  2875. \let\==\asis
  2876. \let\u=\asis
  2877. \let\v=\asis
  2878. \let\H=\asis
  2879. \let\dotaccent=\asis
  2880. \let\ringaccent=\asis
  2881. \let\tieaccent=\asis
  2882. \let\ubaraccent=\asis
  2883. \let\udotaccent=\asis
  2884. \let\dotless=\asis
  2885. %
  2886. % Other non-English letters.
  2887. \def\AA{AA}%
  2888. \def\AE{AE}%
  2889. \def\L{L}%
  2890. \def\OE{OE}%
  2891. \def\O{O}%
  2892. \def\aa{aa}%
  2893. \def\ae{ae}%
  2894. \def\l{l}%
  2895. \def\oe{oe}%
  2896. \def\o{o}%
  2897. \def\ss{ss}%
  2898. \def\exclamdown{!}%
  2899. \def\questiondown{?}%
  2900. %
  2901. % Don't no-op \tt, since it isn't a user-level command
  2902. % and is used in the definitions of the active chars like <, >, |, etc.
  2903. % Likewise with the other plain tex font commands.
  2904. %\let\tt=\asis
  2905. %
  2906. % Texinfo font commands.
  2907. \let\b=\asis
  2908. \let\i=\asis
  2909. \let\r=\asis
  2910. \let\sc=\asis
  2911. \let\t=\asis
  2912. %
  2913. \let\TeX=\indexdummytex
  2914. \let\acronym=\asis
  2915. \let\cite=\asis
  2916. \let\code=\asis
  2917. \let\command=\asis
  2918. \let\dfn=\asis
  2919. \let\dots=\indexdummydots
  2920. \let\emph=\asis
  2921. \let\env=\asis
  2922. \let\file=\asis
  2923. \let\kbd=\asis
  2924. \let\key=\asis
  2925. \let\math=\asis
  2926. \let\option=\asis
  2927. \let\samp=\asis
  2928. \let\strong=\asis
  2929. \let\uref=\asis
  2930. \let\url=\asis
  2931. \let\var=\asis
  2932. \let\w=\asis
  2933. }
  2934. \let\indexbackslash=0 %overridden during \printindex.
  2935. \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  2936. % For \ifx comparisons.
  2937. \def\emptymacro{\empty}
  2938. % Most index entries go through here, but \dosubind is the general case.
  2939. %
  2940. \def\doind#1#2{\dosubind{#1}{#2}\empty}
  2941. % Workhorse for all \fooindexes.
  2942. % #1 is name of index, #2 is stuff to put there, #3 is subentry --
  2943. % \empty if called from \doind, as we usually are. The main exception
  2944. % is with defuns, which call us directly.
  2945. %
  2946. \def\dosubind#1#2#3{%
  2947. % Put the index entry in the margin if desired.
  2948. \ifx\SETmarginindex\relax\else
  2949. \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
  2950. \fi
  2951. {%
  2952. \count255=\lastpenalty
  2953. {%
  2954. \indexdummies % Must do this here, since \bf, etc expand at this stage
  2955. \escapechar=`\\
  2956. {%
  2957. \let\folio = 0% We will expand all macros now EXCEPT \folio.
  2958. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  2959. % so it will be output as is; and it will print as backslash.
  2960. %
  2961. % The main index entry text.
  2962. \toks0 = {#2}%
  2963. %
  2964. % If third arg is present, precede it with space in sort key.
  2965. \def\thirdarg{#3}%
  2966. \ifx\thirdarg\emptymacro \else
  2967. % If the third (subentry) arg is present, add it to the index
  2968. % line to write.
  2969. \toks0 = \expandafter{\the\toks0 \space #3}%
  2970. \fi
  2971. %
  2972. % Process the index entry with all font commands turned off, to
  2973. % get the string to sort by.
  2974. {\indexnofonts
  2975. \edef\temp{\the\toks0}% need full expansion
  2976. \xdef\indexsorttmp{\temp}%
  2977. }%
  2978. %
  2979. % Set up the complete index entry, with both the sort key and
  2980. % the original text, including any font commands. We write
  2981. % three arguments to \entry to the .?? file (four in the
  2982. % subentry case), texindex reduces to two when writing the .??s
  2983. % sorted result.
  2984. \edef\temp{%
  2985. \write\csname#1indfile\endcsname{%
  2986. \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
  2987. }%
  2988. %
  2989. % If a skip is the last thing on the list now, preserve it
  2990. % by backing up by \lastskip, doing the \write, then inserting
  2991. % the skip again. Otherwise, the whatsit generated by the
  2992. % \write will make \lastskip zero. The result is that sequences
  2993. % like this:
  2994. % @end defun
  2995. % @tindex whatever
  2996. % @defun ...
  2997. % will have extra space inserted, because the \medbreak in the
  2998. % start of the @defun won't see the skip inserted by the @end of
  2999. % the previous defun.
  3000. %
  3001. % But don't do any of this if we're not in vertical mode. We
  3002. % don't want to do a \vskip and prematurely end a paragraph.
  3003. %
  3004. % Avoid page breaks due to these extra skips, too.
  3005. %
  3006. \iflinks
  3007. \ifvmode
  3008. \skip0 = \lastskip
  3009. \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi
  3010. \fi
  3011. %
  3012. \temp % do the write
  3013. %
  3014. \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
  3015. \fi
  3016. }%
  3017. }%
  3018. \penalty\count255
  3019. }%
  3020. }
  3021. % The index entry written in the file actually looks like
  3022. % \entry {sortstring}{page}{topic}
  3023. % or
  3024. % \entry {sortstring}{page}{topic}{subtopic}
  3025. % The texindex program reads in these files and writes files
  3026. % containing these kinds of lines:
  3027. % \initial {c}
  3028. % before the first topic whose initial is c
  3029. % \entry {topic}{pagelist}
  3030. % for a topic that is used without subtopics
  3031. % \primary {topic}
  3032. % for the beginning of a topic that is used with subtopics
  3033. % \secondary {subtopic}{pagelist}
  3034. % for each subtopic.
  3035. % Define the user-accessible indexing commands
  3036. % @findex, @vindex, @kindex, @cindex.
  3037. \def\findex {\fnindex}
  3038. \def\kindex {\kyindex}
  3039. \def\cindex {\cpindex}
  3040. \def\vindex {\vrindex}
  3041. \def\tindex {\tpindex}
  3042. \def\pindex {\pgindex}
  3043. \def\cindexsub {\begingroup\obeylines\cindexsub}
  3044. {\obeylines %
  3045. \gdef\cindexsub "#1" #2^^M{\endgroup %
  3046. \dosubind{cp}{#2}{#1}}}
  3047. % Define the macros used in formatting output of the sorted index material.
  3048. % @printindex causes a particular index (the ??s file) to get printed.
  3049. % It does not print any chapter heading (usually an @unnumbered).
  3050. %
  3051. \def\printindex{\parsearg\doprintindex}
  3052. \def\doprintindex#1{\begingroup
  3053. \dobreak \chapheadingskip{10000}%
  3054. %
  3055. \smallfonts \rm
  3056. \tolerance = 9500
  3057. \indexbreaks
  3058. %
  3059. % See if the index file exists and is nonempty.
  3060. % Change catcode of @ here so that if the index file contains
  3061. % \initial {@}
  3062. % as its first line, TeX doesn't complain about mismatched braces
  3063. % (because it thinks @} is a control sequence).
  3064. \catcode`\@ = 11
  3065. \openin 1 \jobname.#1s
  3066. \ifeof 1
  3067. % \enddoublecolumns gets confused if there is no text in the index,
  3068. % and it loses the chapter title and the aux file entries for the
  3069. % index. The easiest way to prevent this problem is to make sure
  3070. % there is some text.
  3071. \putwordIndexNonexistent
  3072. \else
  3073. %
  3074. % If the index file exists but is empty, then \openin leaves \ifeof
  3075. % false. We have to make TeX try to read something from the file, so
  3076. % it can discover if there is anything in it.
  3077. \read 1 to \temp
  3078. \ifeof 1
  3079. \putwordIndexIsEmpty
  3080. \else
  3081. % Index files are almost Texinfo source, but we use \ as the escape
  3082. % character. It would be better to use @, but that's too big a change
  3083. % to make right now.
  3084. \def\indexbackslash{\rawbackslashxx}%
  3085. \catcode`\\ = 0
  3086. \escapechar = `\\
  3087. \begindoublecolumns
  3088. \input \jobname.#1s
  3089. \enddoublecolumns
  3090. \fi
  3091. \fi
  3092. \closein 1
  3093. \endgroup}
  3094. % These macros are used by the sorted index file itself.
  3095. % Change them to control the appearance of the index.
  3096. \def\initial#1{{%
  3097. % Some minor font changes for the special characters.
  3098. \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  3099. %
  3100. % Remove any glue we may have, we'll be inserting our own.
  3101. \removelastskip
  3102. %
  3103. % We like breaks before the index initials, so insert a bonus.
  3104. \penalty -300
  3105. %
  3106. % Typeset the initial. Making this add up to a whole number of
  3107. % baselineskips increases the chance of the dots lining up from column
  3108. % to column. It still won't often be perfect, because of the stretch
  3109. % we need before each entry, but it's better.
  3110. %
  3111. % No shrink because it confuses \balancecolumns.
  3112. \vskip 1.67\baselineskip plus .5\baselineskip
  3113. \leftline{\secbf #1}%
  3114. \vskip .33\baselineskip plus .1\baselineskip
  3115. %
  3116. % Do our best not to break after the initial.
  3117. \nobreak
  3118. }}
  3119. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  3120. % flush to the right margin. It is used for index and table of contents
  3121. % entries. The paragraph is indented by \leftskip.
  3122. %
  3123. \def\entry#1#2{\begingroup
  3124. %
  3125. % Start a new paragraph if necessary, so our assignments below can't
  3126. % affect previous text.
  3127. \par
  3128. %
  3129. % Do not fill out the last line with white space.
  3130. \parfillskip = 0in
  3131. %
  3132. % No extra space above this paragraph.
  3133. \parskip = 0in
  3134. %
  3135. % Do not prefer a separate line ending with a hyphen to fewer lines.
  3136. \finalhyphendemerits = 0
  3137. %
  3138. % \hangindent is only relevant when the entry text and page number
  3139. % don't both fit on one line. In that case, bob suggests starting the
  3140. % dots pretty far over on the line. Unfortunately, a large
  3141. % indentation looks wrong when the entry text itself is broken across
  3142. % lines. So we use a small indentation and put up with long leaders.
  3143. %
  3144. % \hangafter is reset to 1 (which is the value we want) at the start
  3145. % of each paragraph, so we need not do anything with that.
  3146. \hangindent = 2em
  3147. %
  3148. % When the entry text needs to be broken, just fill out the first line
  3149. % with blank space.
  3150. \rightskip = 0pt plus1fil
  3151. %
  3152. % A bit of stretch before each entry for the benefit of balancing columns.
  3153. \vskip 0pt plus1pt
  3154. %
  3155. % Start a ``paragraph'' for the index entry so the line breaking
  3156. % parameters we've set above will have an effect.
  3157. \noindent
  3158. %
  3159. % Insert the text of the index entry. TeX will do line-breaking on it.
  3160. #1%
  3161. % The following is kludged to not output a line of dots in the index if
  3162. % there are no page numbers. The next person who breaks this will be
  3163. % cursed by a Unix daemon.
  3164. \def\tempa{{\rm }}%
  3165. \def\tempb{#2}%
  3166. \edef\tempc{\tempa}%
  3167. \edef\tempd{\tempb}%
  3168. \ifx\tempc\tempd\ \else%
  3169. %
  3170. % If we must, put the page number on a line of its own, and fill out
  3171. % this line with blank space. (The \hfil is overwhelmed with the
  3172. % fill leaders glue in \indexdotfill if the page number does fit.)
  3173. \hfil\penalty50
  3174. \null\nobreak\indexdotfill % Have leaders before the page number.
  3175. %
  3176. % The `\ ' here is removed by the implicit \unskip that TeX does as
  3177. % part of (the primitive) \par. Without it, a spurious underfull
  3178. % \hbox ensues.
  3179. \ifpdf
  3180. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  3181. \else
  3182. \ #2% The page number ends the paragraph.
  3183. \fi
  3184. \fi%
  3185. \par
  3186. \endgroup}
  3187. % Like \dotfill except takes at least 1 em.
  3188. \def\indexdotfill{\cleaders
  3189. \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
  3190. \def\primary #1{\line{#1\hfil}}
  3191. \newskip\secondaryindent \secondaryindent=0.5cm
  3192. \def\secondary#1#2{{%
  3193. \parfillskip=0in
  3194. \parskip=0in
  3195. \hangindent=1in
  3196. \hangafter=1
  3197. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  3198. \ifpdf
  3199. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  3200. \else
  3201. #2
  3202. \fi
  3203. \par
  3204. }}
  3205. % Define two-column mode, which we use to typeset indexes.
  3206. % Adapted from the TeXbook, page 416, which is to say,
  3207. % the manmac.tex format used to print the TeXbook itself.
  3208. \catcode`\@=11
  3209. \newbox\partialpage
  3210. \newdimen\doublecolumnhsize
  3211. \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  3212. % Grab any single-column material above us.
  3213. \output = {%
  3214. %
  3215. % Here is a possibility not foreseen in manmac: if we accumulate a
  3216. % whole lot of material, we might end up calling this \output
  3217. % routine twice in a row (see the doublecol-lose test, which is
  3218. % essentially a couple of indexes with @setchapternewpage off). In
  3219. % that case we just ship out what is in \partialpage with the normal
  3220. % output routine. Generally, \partialpage will be empty when this
  3221. % runs and this will be a no-op. See the indexspread.tex test case.
  3222. \ifvoid\partialpage \else
  3223. \onepageout{\pagecontents\partialpage}%
  3224. \fi
  3225. %
  3226. \global\setbox\partialpage = \vbox{%
  3227. % Unvbox the main output page.
  3228. \unvbox\PAGE
  3229. \kern-\topskip \kern\baselineskip
  3230. }%
  3231. }%
  3232. \eject % run that output routine to set \partialpage
  3233. %
  3234. % Use the double-column output routine for subsequent pages.
  3235. \output = {\doublecolumnout}%
  3236. %
  3237. % Change the page size parameters. We could do this once outside this
  3238. % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  3239. % format, but then we repeat the same computation. Repeating a couple
  3240. % of assignments once per index is clearly meaningless for the
  3241. % execution time, so we may as well do it in one place.
  3242. %
  3243. % First we halve the line length, less a little for the gutter between
  3244. % the columns. We compute the gutter based on the line length, so it
  3245. % changes automatically with the paper format. The magic constant
  3246. % below is chosen so that the gutter has the same value (well, +-<1pt)
  3247. % as it did when we hard-coded it.
  3248. %
  3249. % We put the result in a separate register, \doublecolumhsize, so we
  3250. % can restore it in \pagesofar, after \hsize itself has (potentially)
  3251. % been clobbered.
  3252. %
  3253. \doublecolumnhsize = \hsize
  3254. \advance\doublecolumnhsize by -.04154\hsize
  3255. \divide\doublecolumnhsize by 2
  3256. \hsize = \doublecolumnhsize
  3257. %
  3258. % Double the \vsize as well. (We don't need a separate register here,
  3259. % since nobody clobbers \vsize.)
  3260. \vsize = 2\vsize
  3261. }
  3262. % The double-column output routine for all double-column pages except
  3263. % the last.
  3264. %
  3265. \def\doublecolumnout{%
  3266. \splittopskip=\topskip \splitmaxdepth=\maxdepth
  3267. % Get the available space for the double columns -- the normal
  3268. % (undoubled) page height minus any material left over from the
  3269. % previous page.
  3270. \dimen@ = \vsize
  3271. \divide\dimen@ by 2
  3272. \advance\dimen@ by -\ht\partialpage
  3273. %
  3274. % box0 will be the left-hand column, box2 the right.
  3275. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  3276. \onepageout\pagesofar
  3277. \unvbox255
  3278. \penalty\outputpenalty
  3279. }
  3280. %
  3281. % Re-output the contents of the output page -- any previous material,
  3282. % followed by the two boxes we just split, in box0 and box2.
  3283. \def\pagesofar{%
  3284. \unvbox\partialpage
  3285. %
  3286. \hsize = \doublecolumnhsize
  3287. \wd0=\hsize \wd2=\hsize
  3288. \hbox to\pagewidth{\box0\hfil\box2}%
  3289. }
  3290. %
  3291. % All done with double columns.
  3292. \def\enddoublecolumns{%
  3293. \output = {%
  3294. % Split the last of the double-column material. Leave it on the
  3295. % current page, no automatic page break.
  3296. \balancecolumns
  3297. %
  3298. % If we end up splitting too much material for the current page,
  3299. % though, there will be another page break right after this \output
  3300. % invocation ends. Having called \balancecolumns once, we do not
  3301. % want to call it again. Therefore, reset \output to its normal
  3302. % definition right away. (We hope \balancecolumns will never be
  3303. % called on to balance too much material, but if it is, this makes
  3304. % the output somewhat more palatable.)
  3305. \global\output = {\onepageout{\pagecontents\PAGE}}%
  3306. }%
  3307. \eject
  3308. \endgroup % started in \begindoublecolumns
  3309. %
  3310. % \pagegoal was set to the doubled \vsize above, since we restarted
  3311. % the current page. We're now back to normal single-column
  3312. % typesetting, so reset \pagegoal to the normal \vsize (after the
  3313. % \endgroup where \vsize got restored).
  3314. \pagegoal = \vsize
  3315. }
  3316. %
  3317. % Called at the end of the double column material.
  3318. \def\balancecolumns{%
  3319. \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
  3320. \dimen@ = \ht0
  3321. \advance\dimen@ by \topskip
  3322. \advance\dimen@ by-\baselineskip
  3323. \divide\dimen@ by 2 % target to split to
  3324. %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
  3325. \splittopskip = \topskip
  3326. % Loop until we get a decent breakpoint.
  3327. {%
  3328. \vbadness = 10000
  3329. \loop
  3330. \global\setbox3 = \copy0
  3331. \global\setbox1 = \vsplit3 to \dimen@
  3332. \ifdim\ht3>\dimen@
  3333. \global\advance\dimen@ by 1pt
  3334. \repeat
  3335. }%
  3336. %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
  3337. \setbox0=\vbox to\dimen@{\unvbox1}%
  3338. \setbox2=\vbox to\dimen@{\unvbox3}%
  3339. %
  3340. \pagesofar
  3341. }
  3342. \catcode`\@ = \other
  3343. \message{sectioning,}
  3344. % Chapters, sections, etc.
  3345. \newcount\chapno
  3346. \newcount\secno \secno=0
  3347. \newcount\subsecno \subsecno=0
  3348. \newcount\subsubsecno \subsubsecno=0
  3349. % This counter is funny since it counts through charcodes of letters A, B, ...
  3350. \newcount\appendixno \appendixno = `\@
  3351. % \def\appendixletter{\char\the\appendixno}
  3352. % We do the following for the sake of pdftex, which needs the actual
  3353. % letter in the expansion, not just typeset.
  3354. \def\appendixletter{%
  3355. \ifnum\appendixno=`A A%
  3356. \else\ifnum\appendixno=`B B%
  3357. \else\ifnum\appendixno=`C C%
  3358. \else\ifnum\appendixno=`D D%
  3359. \else\ifnum\appendixno=`E E%
  3360. \else\ifnum\appendixno=`F F%
  3361. \else\ifnum\appendixno=`G G%
  3362. \else\ifnum\appendixno=`H H%
  3363. \else\ifnum\appendixno=`I I%
  3364. \else\ifnum\appendixno=`J J%
  3365. \else\ifnum\appendixno=`K K%
  3366. \else\ifnum\appendixno=`L L%
  3367. \else\ifnum\appendixno=`M M%
  3368. \else\ifnum\appendixno=`N N%
  3369. \else\ifnum\appendixno=`O O%
  3370. \else\ifnum\appendixno=`P P%
  3371. \else\ifnum\appendixno=`Q Q%
  3372. \else\ifnum\appendixno=`R R%
  3373. \else\ifnum\appendixno=`S S%
  3374. \else\ifnum\appendixno=`T T%
  3375. \else\ifnum\appendixno=`U U%
  3376. \else\ifnum\appendixno=`V V%
  3377. \else\ifnum\appendixno=`W W%
  3378. \else\ifnum\appendixno=`X X%
  3379. \else\ifnum\appendixno=`Y Y%
  3380. \else\ifnum\appendixno=`Z Z%
  3381. % The \the is necessary, despite appearances, because \appendixletter is
  3382. % expanded while writing the .toc file. \char\appendixno is not
  3383. % expandable, thus it is written literally, thus all appendixes come out
  3384. % with the same letter (or @) in the toc without it.
  3385. \else\char\the\appendixno
  3386. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  3387. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  3388. % Each @chapter defines this as the name of the chapter.
  3389. % page headings and footings can use it. @section does likewise.
  3390. \def\thischapter{}
  3391. \def\thissection{}
  3392. \newcount\absseclevel % used to calculate proper heading level
  3393. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  3394. % @raisesections: treat @section as chapter, @subsection as section, etc.
  3395. \def\raisesections{\global\advance\secbase by -1}
  3396. \let\up=\raisesections % original BFox name
  3397. % @lowersections: treat @chapter as section, @section as subsection, etc.
  3398. \def\lowersections{\global\advance\secbase by 1}
  3399. \let\down=\lowersections % original BFox name
  3400. % Choose a numbered-heading macro
  3401. % #1 is heading level if unmodified by @raisesections or @lowersections
  3402. % #2 is text for heading
  3403. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  3404. \ifcase\absseclevel
  3405. \chapterzzz{#2}
  3406. \or
  3407. \seczzz{#2}
  3408. \or
  3409. \numberedsubseczzz{#2}
  3410. \or
  3411. \numberedsubsubseczzz{#2}
  3412. \else
  3413. \ifnum \absseclevel<0
  3414. \chapterzzz{#2}
  3415. \else
  3416. \numberedsubsubseczzz{#2}
  3417. \fi
  3418. \fi
  3419. }
  3420. % like \numhead, but chooses appendix heading levels
  3421. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  3422. \ifcase\absseclevel
  3423. \appendixzzz{#2}
  3424. \or
  3425. \appendixsectionzzz{#2}
  3426. \or
  3427. \appendixsubseczzz{#2}
  3428. \or
  3429. \appendixsubsubseczzz{#2}
  3430. \else
  3431. \ifnum \absseclevel<0
  3432. \appendixzzz{#2}
  3433. \else
  3434. \appendixsubsubseczzz{#2}
  3435. \fi
  3436. \fi
  3437. }
  3438. % like \numhead, but chooses numberless heading levels
  3439. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  3440. \ifcase\absseclevel
  3441. \unnumberedzzz{#2}
  3442. \or
  3443. \unnumberedseczzz{#2}
  3444. \or
  3445. \unnumberedsubseczzz{#2}
  3446. \or
  3447. \unnumberedsubsubseczzz{#2}
  3448. \else
  3449. \ifnum \absseclevel<0
  3450. \unnumberedzzz{#2}
  3451. \else
  3452. \unnumberedsubsubseczzz{#2}
  3453. \fi
  3454. \fi
  3455. }
  3456. % @chapter, @appendix, @unnumbered.
  3457. \def\thischaptername{No Chapter Title}
  3458. \outer\def\chapter{\parsearg\chapteryyy}
  3459. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  3460. \def\chapterzzz #1{%
  3461. \secno=0 \subsecno=0 \subsubsecno=0
  3462. \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
  3463. \chapmacro {#1}{\the\chapno}%
  3464. \gdef\thissection{#1}%
  3465. \gdef\thischaptername{#1}%
  3466. % We don't substitute the actual chapter name into \thischapter
  3467. % because we don't want its macros evaluated now.
  3468. \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
  3469. \writetocentry{chap}{#1}{{\the\chapno}}
  3470. \donoderef
  3471. \global\let\section = \numberedsec
  3472. \global\let\subsection = \numberedsubsec
  3473. \global\let\subsubsection = \numberedsubsubsec
  3474. }
  3475. % we use \chapno to avoid indenting back
  3476. \def\appendixbox#1{%
  3477. \setbox0 = \hbox{\putwordAppendix{} \the\chapno}%
  3478. \hbox to \wd0{#1\hss}}
  3479. \outer\def\appendix{\parsearg\appendixyyy}
  3480. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  3481. \def\appendixzzz #1{%
  3482. \secno=0 \subsecno=0 \subsubsecno=0
  3483. \global\advance \appendixno by 1
  3484. \message{\putwordAppendix\space \appendixletter}%
  3485. \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}%
  3486. \gdef\thissection{#1}%
  3487. \gdef\thischaptername{#1}%
  3488. \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
  3489. \writetocentry{appendix}{#1}{{\appendixletter}}
  3490. \appendixnoderef
  3491. \global\let\section = \appendixsec
  3492. \global\let\subsection = \appendixsubsec
  3493. \global\let\subsubsection = \appendixsubsubsec
  3494. }
  3495. % @centerchap is like @unnumbered, but the heading is centered.
  3496. \outer\def\centerchap{\parsearg\centerchapyyy}
  3497. \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
  3498. % @top is like @unnumbered.
  3499. \outer\def\top{\parsearg\unnumberedyyy}
  3500. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  3501. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  3502. \def\unnumberedzzz #1{%
  3503. \secno=0 \subsecno=0 \subsubsecno=0
  3504. %
  3505. % This used to be simply \message{#1}, but TeX fully expands the
  3506. % argument to \message. Therefore, if #1 contained @-commands, TeX
  3507. % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
  3508. % expanded @cite (which turns out to cause errors because \cite is meant
  3509. % to be executed, not expanded).
  3510. %
  3511. % Anyway, we don't want the fully-expanded definition of @cite to appear
  3512. % as a result of the \message, we just want `@cite' itself. We use
  3513. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  3514. % simply yielding the contents of <toks register>. (We also do this for
  3515. % the toc entries.)
  3516. \toks0 = {#1}\message{(\the\toks0)}%
  3517. %
  3518. \unnumbchapmacro {#1}%
  3519. \gdef\thischapter{#1}\gdef\thissection{#1}%
  3520. \writetocentry{unnumbchap}{#1}{{\the\chapno}}
  3521. \unnumbnoderef
  3522. \global\let\section = \unnumberedsec
  3523. \global\let\subsection = \unnumberedsubsec
  3524. \global\let\subsubsection = \unnumberedsubsubsec
  3525. }
  3526. % Sections.
  3527. \outer\def\numberedsec{\parsearg\secyyy}
  3528. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  3529. \def\seczzz #1{%
  3530. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  3531. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  3532. \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}}
  3533. \donoderef
  3534. \nobreak
  3535. }
  3536. \outer\def\appendixsection{\parsearg\appendixsecyyy}
  3537. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  3538. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  3539. \def\appendixsectionzzz #1{%
  3540. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  3541. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  3542. \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}}
  3543. \appendixnoderef
  3544. \nobreak
  3545. }
  3546. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  3547. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  3548. \def\unnumberedseczzz #1{%
  3549. \plainsecheading {#1}\gdef\thissection{#1}%
  3550. \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}}
  3551. \unnumbnoderef
  3552. \nobreak
  3553. }
  3554. % Subsections.
  3555. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  3556. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  3557. \def\numberedsubseczzz #1{%
  3558. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  3559. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  3560. \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
  3561. \donoderef
  3562. \nobreak
  3563. }
  3564. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  3565. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  3566. \def\appendixsubseczzz #1{%
  3567. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  3568. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  3569. \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}}
  3570. \appendixnoderef
  3571. \nobreak
  3572. }
  3573. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  3574. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  3575. \def\unnumberedsubseczzz #1{%
  3576. \plainsubsecheading {#1}\gdef\thissection{#1}%
  3577. \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
  3578. \unnumbnoderef
  3579. \nobreak
  3580. }
  3581. % Subsubsections.
  3582. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  3583. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  3584. \def\numberedsubsubseczzz #1{%
  3585. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  3586. \subsubsecheading {#1}
  3587. {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  3588. \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  3589. \donoderef
  3590. \nobreak
  3591. }
  3592. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  3593. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  3594. \def\appendixsubsubseczzz #1{%
  3595. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  3596. \subsubsecheading {#1}
  3597. {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  3598. \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  3599. \appendixnoderef
  3600. \nobreak
  3601. }
  3602. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  3603. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  3604. \def\unnumberedsubsubseczzz #1{%
  3605. \plainsubsubsecheading {#1}\gdef\thissection{#1}%
  3606. \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  3607. \unnumbnoderef
  3608. \nobreak
  3609. }
  3610. % These are variants which are not "outer", so they can appear in @ifinfo.
  3611. % Actually, they should now be obsolete; ordinary section commands should work.
  3612. \def\infotop{\parsearg\unnumberedzzz}
  3613. \def\infounnumbered{\parsearg\unnumberedzzz}
  3614. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  3615. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  3616. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  3617. \def\infoappendix{\parsearg\appendixzzz}
  3618. \def\infoappendixsec{\parsearg\appendixseczzz}
  3619. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  3620. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  3621. \def\infochapter{\parsearg\chapterzzz}
  3622. \def\infosection{\parsearg\sectionzzz}
  3623. \def\infosubsection{\parsearg\subsectionzzz}
  3624. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  3625. % These macros control what the section commands do, according
  3626. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  3627. % Define them by default for a numbered chapter.
  3628. \global\let\section = \numberedsec
  3629. \global\let\subsection = \numberedsubsec
  3630. \global\let\subsubsection = \numberedsubsubsec
  3631. % Define @majorheading, @heading and @subheading
  3632. % NOTE on use of \vbox for chapter headings, section headings, and such:
  3633. % 1) We use \vbox rather than the earlier \line to permit
  3634. % overlong headings to fold.
  3635. % 2) \hyphenpenalty is set to 10000 because hyphenation in a
  3636. % heading is obnoxious; this forbids it.
  3637. % 3) Likewise, headings look best if no \parindent is used, and
  3638. % if justification is not attempted. Hence \raggedright.
  3639. \def\majorheading{\parsearg\majorheadingzzz}
  3640. \def\majorheadingzzz #1{%
  3641. {\advance\chapheadingskip by 10pt \chapbreak }%
  3642. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  3643. \parindent=0pt\raggedright
  3644. \rm #1\hfill}}\bigskip \par\penalty 200}
  3645. \def\chapheading{\parsearg\chapheadingzzz}
  3646. \def\chapheadingzzz #1{\chapbreak %
  3647. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  3648. \parindent=0pt\raggedright
  3649. \rm #1\hfill}}\bigskip \par\penalty 200}
  3650. % @heading, @subheading, @subsubheading.
  3651. \def\heading{\parsearg\plainsecheading}
  3652. \def\subheading{\parsearg\plainsubsecheading}
  3653. \def\subsubheading{\parsearg\plainsubsubsecheading}
  3654. % These macros generate a chapter, section, etc. heading only
  3655. % (including whitespace, linebreaking, etc. around it),
  3656. % given all the information in convenient, parsed form.
  3657. %%% Args are the skip and penalty (usually negative)
  3658. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  3659. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  3660. %%% Define plain chapter starts, and page on/off switching for it
  3661. % Parameter controlling skip before chapter headings (if needed)
  3662. \newskip\chapheadingskip
  3663. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  3664. \def\chappager{\par\vfill\supereject}
  3665. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  3666. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  3667. \def\CHAPPAGoff{%
  3668. \global\let\contentsalignmacro = \chappager
  3669. \global\let\pchapsepmacro=\chapbreak
  3670. \global\let\pagealignmacro=\chappager}
  3671. \def\CHAPPAGon{%
  3672. \global\let\contentsalignmacro = \chappager
  3673. \global\let\pchapsepmacro=\chappager
  3674. \global\let\pagealignmacro=\chappager
  3675. \global\def\HEADINGSon{\HEADINGSsingle}}
  3676. \def\CHAPPAGodd{
  3677. \global\let\contentsalignmacro = \chapoddpage
  3678. \global\let\pchapsepmacro=\chapoddpage
  3679. \global\let\pagealignmacro=\chapoddpage
  3680. \global\def\HEADINGSon{\HEADINGSdouble}}
  3681. \CHAPPAGon
  3682. \def\CHAPFplain{
  3683. \global\let\chapmacro=\chfplain
  3684. \global\let\unnumbchapmacro=\unnchfplain
  3685. \global\let\centerchapmacro=\centerchfplain}
  3686. % Plain chapter opening.
  3687. % #1 is the text, #2 the chapter number or empty if unnumbered.
  3688. \def\chfplain#1#2{%
  3689. \pchapsepmacro
  3690. {%
  3691. \chapfonts \rm
  3692. \def\chapnum{#2}%
  3693. \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
  3694. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
  3695. \hangindent = \wd0 \centerparametersmaybe
  3696. \unhbox0 #1\par}%
  3697. }%
  3698. \nobreak\bigskip % no page break after a chapter title
  3699. \nobreak
  3700. }
  3701. % Plain opening for unnumbered.
  3702. \def\unnchfplain#1{\chfplain{#1}{}}
  3703. % @centerchap -- centered and unnumbered.
  3704. \let\centerparametersmaybe = \relax
  3705. \def\centerchfplain#1{{%
  3706. \def\centerparametersmaybe{%
  3707. \advance\rightskip by 3\rightskip
  3708. \leftskip = \rightskip
  3709. \parfillskip = 0pt
  3710. }%
  3711. \chfplain{#1}{}%
  3712. }}
  3713. \CHAPFplain % The default
  3714. \def\unnchfopen #1{%
  3715. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  3716. \parindent=0pt\raggedright
  3717. \rm #1\hfill}}\bigskip \par\nobreak
  3718. }
  3719. \def\chfopen #1#2{\chapoddpage {\chapfonts
  3720. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  3721. \par\penalty 5000 %
  3722. }
  3723. \def\centerchfopen #1{%
  3724. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  3725. \parindent=0pt
  3726. \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
  3727. }
  3728. \def\CHAPFopen{
  3729. \global\let\chapmacro=\chfopen
  3730. \global\let\unnumbchapmacro=\unnchfopen
  3731. \global\let\centerchapmacro=\centerchfopen}
  3732. % Section titles.
  3733. \newskip\secheadingskip
  3734. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  3735. \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
  3736. \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
  3737. % Subsection titles.
  3738. \newskip \subsecheadingskip
  3739. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  3740. \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
  3741. \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
  3742. % Subsubsection titles.
  3743. \let\subsubsecheadingskip = \subsecheadingskip
  3744. \let\subsubsecheadingbreak = \subsecheadingbreak
  3745. \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
  3746. \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
  3747. % Print any size section title.
  3748. %
  3749. % #1 is the section type (sec/subsec/subsubsec), #2 is the section
  3750. % number (maybe empty), #3 the text.
  3751. \def\sectionheading#1#2#3{%
  3752. {%
  3753. \expandafter\advance\csname #1headingskip\endcsname by \parskip
  3754. \csname #1headingbreak\endcsname
  3755. }%
  3756. {%
  3757. % Switch to the right set of fonts.
  3758. \csname #1fonts\endcsname \rm
  3759. %
  3760. % Only insert the separating space if we have a section number.
  3761. \def\secnum{#2}%
  3762. \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
  3763. %
  3764. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
  3765. \hangindent = \wd0 % zero if no section number
  3766. \unhbox0 #3}%
  3767. }%
  3768. % Add extra space after the heading -- either a line space or a
  3769. % paragraph space, whichever is more. (Some people like to set
  3770. % \parskip to large values for some reason.) Don't allow stretch, though.
  3771. \nobreak
  3772. \ifdim\parskip>\normalbaselineskip
  3773. \kern\parskip
  3774. \else
  3775. \kern\normalbaselineskip
  3776. \fi
  3777. \nobreak
  3778. }
  3779. \message{toc,}
  3780. % Table of contents.
  3781. \newwrite\tocfile
  3782. % Write an entry to the toc file, opening it if necessary.
  3783. % Called from @chapter, etc. We supply {\folio} at the end of the
  3784. % argument, which will end up as the last argument to the \...entry macro.
  3785. %
  3786. % Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}}
  3787. % We open the .toc file for writing here instead of at @setfilename (or
  3788. % any other fixed time) so that @contents can be anywhere in the document.
  3789. %
  3790. \newif\iftocfileopened
  3791. \def\writetocentry#1#2#3{%
  3792. \iftocfileopened\else
  3793. \immediate\openout\tocfile = \jobname.toc
  3794. \global\tocfileopenedtrue
  3795. \fi
  3796. %
  3797. \iflinks
  3798. \toks0 = {#2}%
  3799. \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}%
  3800. \temp
  3801. \fi
  3802. %
  3803. % Tell \shipout to create a page destination if we're doing pdf, which
  3804. % will be the target of the links in the table of contents. We can't
  3805. % just do it on every page because the title pages are numbered 1 and
  3806. % 2 (the page numbers aren't printed), and so are the first two pages
  3807. % of the document. Thus, we'd have two destinations named `1', and
  3808. % two named `2'.
  3809. \ifpdf \pdfmakepagedesttrue \fi
  3810. }
  3811. \newskip\contentsrightmargin \contentsrightmargin=1in
  3812. \newcount\savepageno
  3813. \newcount\lastnegativepageno \lastnegativepageno = -1
  3814. % Finish up the main text and prepare to read what we've written
  3815. % to \tocfile.
  3816. %
  3817. \def\startcontents#1{%
  3818. % If @setchapternewpage on, and @headings double, the contents should
  3819. % start on an odd page, unlike chapters. Thus, we maintain
  3820. % \contentsalignmacro in parallel with \pagealignmacro.
  3821. % From: Torbjorn Granlund <tege@matematik.su.se>
  3822. \contentsalignmacro
  3823. \immediate\closeout\tocfile
  3824. %
  3825. % Don't need to put `Contents' or `Short Contents' in the headline.
  3826. % It is abundantly clear what they are.
  3827. \unnumbchapmacro{#1}\def\thischapter{}%
  3828. \savepageno = \pageno
  3829. \begingroup % Set up to handle contents files properly.
  3830. \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
  3831. % We can't do this, because then an actual ^ in a section
  3832. % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
  3833. %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
  3834. \raggedbottom % Worry more about breakpoints than the bottom.
  3835. \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  3836. %
  3837. % Roman numerals for page numbers.
  3838. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  3839. }
  3840. % Normal (long) toc.
  3841. \def\contents{%
  3842. \startcontents{\putwordTOC}%
  3843. \openin 1 \jobname.toc
  3844. \ifeof 1 \else
  3845. \closein 1
  3846. \input \jobname.toc
  3847. \fi
  3848. \vfill \eject
  3849. \contentsalignmacro % in case @setchapternewpage odd is in effect
  3850. \pdfmakeoutlines
  3851. \endgroup
  3852. \lastnegativepageno = \pageno
  3853. \global\pageno = \savepageno
  3854. }
  3855. % And just the chapters.
  3856. \def\summarycontents{%
  3857. \startcontents{\putwordShortTOC}%
  3858. %
  3859. \let\chapentry = \shortchapentry
  3860. \let\appendixentry = \shortappendixentry
  3861. \let\unnumbchapentry = \shortunnumberedentry
  3862. % We want a true roman here for the page numbers.
  3863. \secfonts
  3864. \let\rm=\shortcontrm \let\bf=\shortcontbf
  3865. \let\sl=\shortcontsl \let\tt=\shortconttt
  3866. \rm
  3867. \hyphenpenalty = 10000
  3868. \advance\baselineskip by 1pt % Open it up a little.
  3869. \def\secentry ##1##2##3##4{}
  3870. \def\subsecentry ##1##2##3##4##5{}
  3871. \def\subsubsecentry ##1##2##3##4##5##6{}
  3872. \let\unnumbsecentry = \secentry
  3873. \let\unnumbsubsecentry = \subsecentry
  3874. \let\unnumbsubsubsecentry = \subsubsecentry
  3875. \openin 1 \jobname.toc
  3876. \ifeof 1 \else
  3877. \closein 1
  3878. \input \jobname.toc
  3879. \fi
  3880. \vfill \eject
  3881. \contentsalignmacro % in case @setchapternewpage odd is in effect
  3882. \endgroup
  3883. \lastnegativepageno = \pageno
  3884. \global\pageno = \savepageno
  3885. }
  3886. \let\shortcontents = \summarycontents
  3887. \ifpdf
  3888. \pdfcatalog{/PageMode /UseOutlines}%
  3889. \fi
  3890. % These macros generate individual entries in the table of contents.
  3891. % The first argument is the chapter or section name.
  3892. % The last argument is the page number.
  3893. % The arguments in between are the chapter number, section number, ...
  3894. % Chapters, in the main contents.
  3895. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  3896. %
  3897. % Chapters, in the short toc.
  3898. % See comments in \dochapentry re vbox and related settings.
  3899. \def\shortchapentry#1#2#3{%
  3900. \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
  3901. }
  3902. % Appendices, in the main contents.
  3903. \def\appendixentry#1#2#3{%
  3904. \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}}
  3905. %
  3906. % Appendices, in the short toc.
  3907. \let\shortappendixentry = \shortchapentry
  3908. % Typeset the label for a chapter or appendix for the short contents.
  3909. % The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
  3910. % We could simplify the code here by writing out an \appendixentry
  3911. % command in the toc file for appendices, instead of using \chapentry
  3912. % for both, but it doesn't seem worth it.
  3913. %
  3914. \newdimen\shortappendixwidth
  3915. %
  3916. \def\shortchaplabel#1{%
  3917. % This space should be enough, since a single number is .5em, and the
  3918. % widest letter (M) is 1em, at least in the Computer Modern fonts.
  3919. % But use \hss just in case.
  3920. % (This space doesn't include the extra space that gets added after
  3921. % the label; that gets put in by \shortchapentry above.)
  3922. \dimen0 = 1em
  3923. \hbox to \dimen0{#1\hss}%
  3924. }
  3925. % Unnumbered chapters.
  3926. \def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
  3927. \def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
  3928. % Sections.
  3929. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  3930. \def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
  3931. % Subsections.
  3932. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  3933. \def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
  3934. % And subsubsections.
  3935. \def\subsubsecentry#1#2#3#4#5#6{%
  3936. \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  3937. \def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
  3938. % This parameter controls the indentation of the various levels.
  3939. \newdimen\tocindent \tocindent = 3pc
  3940. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  3941. % page number.
  3942. %
  3943. % If the toc has to be broken over pages, we want it to be at chapters
  3944. % if at all possible; hence the \penalty.
  3945. \def\dochapentry#1#2{%
  3946. \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  3947. \begingroup
  3948. \chapentryfonts
  3949. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  3950. \endgroup
  3951. \nobreak\vskip .25\baselineskip plus.1\baselineskip
  3952. }
  3953. \def\dosecentry#1#2{\begingroup
  3954. \secentryfonts \leftskip=\tocindent
  3955. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  3956. \endgroup}
  3957. \def\dosubsecentry#1#2{\begingroup
  3958. \subsecentryfonts \leftskip=2\tocindent
  3959. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  3960. \endgroup}
  3961. \def\dosubsubsecentry#1#2{\begingroup
  3962. \subsubsecentryfonts \leftskip=3\tocindent
  3963. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  3964. \endgroup}
  3965. % Final typesetting of a toc entry; we use the same \entry macro as for
  3966. % the index entries, but we want to suppress hyphenation here. (We
  3967. % can't do that in the \entry macro, since index entries might consist
  3968. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  3969. \def\tocentry#1#2{\begingroup
  3970. \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
  3971. % Do not use \turnoffactive in these arguments. Since the toc is
  3972. % typeset in cmr, characters such as _ would come out wrong; we
  3973. % have to do the usual translation tricks.
  3974. \entry{#1}{#2}%
  3975. \endgroup}
  3976. % Space between chapter (or whatever) number and the title.
  3977. \def\labelspace{\hskip1em \relax}
  3978. \def\dopageno#1{{\rm #1}}
  3979. \def\doshortpageno#1{{\rm #1}}
  3980. \def\chapentryfonts{\secfonts \rm}
  3981. \def\secentryfonts{\textfonts}
  3982. \let\subsecentryfonts = \textfonts
  3983. \let\subsubsecentryfonts = \textfonts
  3984. \message{environments,}
  3985. % @foo ... @end foo.
  3986. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
  3987. %
  3988. % Since these characters are used in examples, it should be an even number of
  3989. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  3990. %
  3991. \def\point{$\star$}
  3992. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  3993. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  3994. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  3995. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  3996. % The @error{} command.
  3997. % Adapted from the TeXbook's \boxit.
  3998. %
  3999. \newbox\errorbox
  4000. %
  4001. {\tentt \global\dimen0 = 3em}% Width of the box.
  4002. \dimen2 = .55pt % Thickness of rules
  4003. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  4004. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  4005. %
  4006. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  4007. \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  4008. \advance\hsize by -2\dimen2 % Rules.
  4009. \vbox{
  4010. \hrule height\dimen2
  4011. \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
  4012. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  4013. \kern3pt\vrule width\dimen2}% Space to right.
  4014. \hrule height\dimen2}
  4015. \hfil}
  4016. %
  4017. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  4018. % @tex ... @end tex escapes into raw Tex temporarily.
  4019. % One exception: @ is still an escape character, so that @end tex works.
  4020. % But \@ or @@ will get a plain tex @ character.
  4021. \def\tex{\begingroup
  4022. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  4023. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  4024. \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  4025. \catcode `\%=14
  4026. \catcode `\+=\other
  4027. \catcode `\"=\other
  4028. \catcode `\==\other
  4029. \catcode `\|=\other
  4030. \catcode `\<=\other
  4031. \catcode `\>=\other
  4032. \escapechar=`\\
  4033. %
  4034. \let\b=\ptexb
  4035. \let\bullet=\ptexbullet
  4036. \let\c=\ptexc
  4037. \let\,=\ptexcomma
  4038. \let\.=\ptexdot
  4039. \let\dots=\ptexdots
  4040. \let\equiv=\ptexequiv
  4041. \let\!=\ptexexclam
  4042. \let\i=\ptexi
  4043. \let\{=\ptexlbrace
  4044. \let\+=\tabalign
  4045. \let\}=\ptexrbrace
  4046. \let\*=\ptexstar
  4047. \let\t=\ptext
  4048. %
  4049. \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  4050. \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  4051. \def\@{@}%
  4052. \let\Etex=\endgroup}
  4053. % Define @lisp ... @end lisp.
  4054. % @lisp does a \begingroup so it can rebind things,
  4055. % including the definition of @end lisp (which normally is erroneous).
  4056. % Amount to narrow the margins by for @lisp.
  4057. \newskip\lispnarrowing \lispnarrowing=0.4in
  4058. % This is the definition that ^^M gets inside @lisp, @example, and other
  4059. % such environments. \null is better than a space, since it doesn't
  4060. % have any width.
  4061. \def\lisppar{\null\endgraf}
  4062. % Make each space character in the input produce a normal interword
  4063. % space in the output. Don't allow a line break at this space, as this
  4064. % is used only in environments like @example, where each line of input
  4065. % should produce a line of output anyway.
  4066. %
  4067. {\obeyspaces %
  4068. \gdef\sepspaces{\obeyspaces\let =\tie}}
  4069. % Define \obeyedspace to be our active space, whatever it is. This is
  4070. % for use in \parsearg.
  4071. {\sepspaces%
  4072. \global\let\obeyedspace= }
  4073. % This space is always present above and below environments.
  4074. \newskip\envskipamount \envskipamount = 0pt
  4075. % Make spacing and below environment symmetrical. We use \parskip here
  4076. % to help in doing that, since in @example-like environments \parskip
  4077. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  4078. % start of the next paragraph will insert \parskip.
  4079. %
  4080. \def\aboveenvbreak{{%
  4081. % =10000 instead of <10000 because of a special case in \itemzzz, q.v.
  4082. \ifnum \lastpenalty=10000 \else
  4083. \advance\envskipamount by \parskip
  4084. \endgraf
  4085. \ifdim\lastskip<\envskipamount
  4086. \removelastskip
  4087. % it's not a good place to break if the last penalty was \nobreak
  4088. % or better ...
  4089. \ifnum\lastpenalty>10000 \else \penalty-50 \fi
  4090. \vskip\envskipamount
  4091. \fi
  4092. \fi
  4093. }}
  4094. \let\afterenvbreak = \aboveenvbreak
  4095. % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
  4096. \let\nonarrowing=\relax
  4097. % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  4098. % environment contents.
  4099. \font\circle=lcircle10
  4100. \newdimen\circthick
  4101. \newdimen\cartouter\newdimen\cartinner
  4102. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  4103. \circthick=\fontdimen8\circle
  4104. %
  4105. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  4106. \def\ctr{{\hskip 6pt\circle\char'010}}
  4107. \def\cbl{{\circle\char'012\hskip -6pt}}
  4108. \def\cbr{{\hskip 6pt\circle\char'011}}
  4109. \def\carttop{\hbox to \cartouter{\hskip\lskip
  4110. \ctl\leaders\hrule height\circthick\hfil\ctr
  4111. \hskip\rskip}}
  4112. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  4113. \cbl\leaders\hrule height\circthick\hfil\cbr
  4114. \hskip\rskip}}
  4115. %
  4116. \newskip\lskip\newskip\rskip
  4117. \def\cartouche{%
  4118. \par % can't be in the midst of a paragraph.
  4119. \begingroup
  4120. \lskip=\leftskip \rskip=\rightskip
  4121. \leftskip=0pt\rightskip=0pt %we want these *outside*.
  4122. \cartinner=\hsize \advance\cartinner by-\lskip
  4123. \advance\cartinner by-\rskip
  4124. \cartouter=\hsize
  4125. \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  4126. % side, and for 6pt waste from
  4127. % each corner char, and rule thickness
  4128. \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  4129. % Flag to tell @lisp, etc., not to narrow margin.
  4130. \let\nonarrowing=\comment
  4131. \vbox\bgroup
  4132. \baselineskip=0pt\parskip=0pt\lineskip=0pt
  4133. \carttop
  4134. \hbox\bgroup
  4135. \hskip\lskip
  4136. \vrule\kern3pt
  4137. \vbox\bgroup
  4138. \hsize=\cartinner
  4139. \kern3pt
  4140. \begingroup
  4141. \baselineskip=\normbskip
  4142. \lineskip=\normlskip
  4143. \parskip=\normpskip
  4144. \vskip -\parskip
  4145. \def\Ecartouche{%
  4146. \endgroup
  4147. \kern3pt
  4148. \egroup
  4149. \kern3pt\vrule
  4150. \hskip\rskip
  4151. \egroup
  4152. \cartbot
  4153. \egroup
  4154. \endgroup
  4155. }}
  4156. % This macro is called at the beginning of all the @example variants,
  4157. % inside a group.
  4158. \def\nonfillstart{%
  4159. \aboveenvbreak
  4160. \inENV % This group ends at the end of the body
  4161. \hfuzz = 12pt % Don't be fussy
  4162. \sepspaces % Make spaces be word-separators rather than space tokens.
  4163. \let\par = \lisppar % don't ignore blank lines
  4164. \obeylines % each line of input is a line of output
  4165. \parskip = 0pt
  4166. \parindent = 0pt
  4167. \emergencystretch = 0pt % don't try to avoid overfull boxes
  4168. % @cartouche defines \nonarrowing to inhibit narrowing
  4169. % at next level down.
  4170. \ifx\nonarrowing\relax
  4171. \advance \leftskip by \lispnarrowing
  4172. \exdentamount=\lispnarrowing
  4173. \let\exdent=\nofillexdent
  4174. \let\nonarrowing=\relax
  4175. \fi
  4176. }
  4177. % Define the \E... control sequence only if we are inside the particular
  4178. % environment, so the error checking in \end will work.
  4179. %
  4180. % To end an @example-like environment, we first end the paragraph (via
  4181. % \afterenvbreak's vertical glue), and then the group. That way we keep
  4182. % the zero \parskip that the environments set -- \parskip glue will be
  4183. % inserted at the beginning of the next paragraph in the document, after
  4184. % the environment.
  4185. %
  4186. \def\nonfillfinish{\afterenvbreak\endgroup}
  4187. % @lisp: indented, narrowed, typewriter font.
  4188. \def\lisp{\begingroup
  4189. \nonfillstart
  4190. \let\Elisp = \nonfillfinish
  4191. \tt
  4192. \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  4193. \gobble % eat return
  4194. }
  4195. % @example: Same as @lisp.
  4196. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  4197. % @smallexample and @smalllisp: use smaller fonts.
  4198. % Originally contributed by Pavel@xerox.
  4199. \def\smalllisp{\begingroup
  4200. \def\Esmalllisp{\nonfillfinish\endgroup}%
  4201. \def\Esmallexample{\nonfillfinish\endgroup}%
  4202. \smallexamplefonts
  4203. \lisp
  4204. }
  4205. \let\smallexample = \smalllisp
  4206. % @display: same as @lisp except keep current font.
  4207. %
  4208. \def\display{\begingroup
  4209. \nonfillstart
  4210. \let\Edisplay = \nonfillfinish
  4211. \gobble
  4212. }
  4213. %
  4214. % @smalldisplay: @display plus smaller fonts.
  4215. %
  4216. \def\smalldisplay{\begingroup
  4217. \def\Esmalldisplay{\nonfillfinish\endgroup}%
  4218. \smallexamplefonts \rm
  4219. \display
  4220. }
  4221. % @format: same as @display except don't narrow margins.
  4222. %
  4223. \def\format{\begingroup
  4224. \let\nonarrowing = t
  4225. \nonfillstart
  4226. \let\Eformat = \nonfillfinish
  4227. \gobble
  4228. }
  4229. %
  4230. % @smallformat: @format plus smaller fonts.
  4231. %
  4232. \def\smallformat{\begingroup
  4233. \def\Esmallformat{\nonfillfinish\endgroup}%
  4234. \smallexamplefonts \rm
  4235. \format
  4236. }
  4237. % @flushleft (same as @format).
  4238. %
  4239. \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
  4240. % @flushright.
  4241. %
  4242. \def\flushright{\begingroup
  4243. \let\nonarrowing = t
  4244. \nonfillstart
  4245. \let\Eflushright = \nonfillfinish
  4246. \advance\leftskip by 0pt plus 1fill
  4247. \gobble
  4248. }
  4249. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  4250. % and narrows the margins.
  4251. %
  4252. \def\quotation{%
  4253. \begingroup\inENV %This group ends at the end of the @quotation body
  4254. {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  4255. \parindent=0pt
  4256. % We have retained a nonzero parskip for the environment, since we're
  4257. % doing normal filling. So to avoid extra space below the environment...
  4258. \def\Equotation{\parskip = 0pt \nonfillfinish}%
  4259. %
  4260. % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  4261. \ifx\nonarrowing\relax
  4262. \advance\leftskip by \lispnarrowing
  4263. \advance\rightskip by \lispnarrowing
  4264. \exdentamount = \lispnarrowing
  4265. \let\nonarrowing = \relax
  4266. \fi
  4267. }
  4268. % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
  4269. % If we want to allow any <char> as delimiter,
  4270. % we need the curly braces so that makeinfo sees the @verb command, eg:
  4271. % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
  4272. %
  4273. % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
  4274. %
  4275. % [Knuth] p.344; only we need to do the other characters Texinfo sets
  4276. % active too. Otherwise, they get lost as the first character on a
  4277. % verbatim line.
  4278. \def\dospecials{%
  4279. \do\ \do\\\do\{\do\}\do\$\do\&%
  4280. \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  4281. \do\<\do\>\do\|\do\@\do+\do\"%
  4282. }
  4283. %
  4284. % [Knuth] p. 380
  4285. \def\uncatcodespecials{%
  4286. \def\do##1{\catcode`##1=12}\dospecials}
  4287. %
  4288. % [Knuth] pp. 380,381,391
  4289. % Disable Spanish ligatures ?` and !` of \tt font
  4290. \begingroup
  4291. \catcode`\`=\active\gdef`{\relax\lq}
  4292. \endgroup
  4293. %
  4294. % Setup for the @verb command.
  4295. %
  4296. % Eight spaces for a tab
  4297. \begingroup
  4298. \catcode`\^^I=\active
  4299. \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
  4300. \endgroup
  4301. %
  4302. \def\setupverb{%
  4303. \tt % easiest (and conventionally used) font for verbatim
  4304. \def\par{\leavevmode\endgraf}%
  4305. \catcode`\`=\active
  4306. \tabeightspaces
  4307. % Respect line breaks,
  4308. % print special symbols as themselves, and
  4309. % make each space count
  4310. % must do in this order:
  4311. \obeylines \uncatcodespecials \sepspaces
  4312. }
  4313. % Setup for the @verbatim environment
  4314. %
  4315. % Real tab expansion
  4316. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
  4317. %
  4318. \def\starttabbox{\setbox0=\hbox\bgroup}
  4319. \begingroup
  4320. \catcode`\^^I=\active
  4321. \gdef\tabexpand{%
  4322. \catcode`\^^I=\active
  4323. \def^^I{\leavevmode\egroup
  4324. \dimen0=\wd0 % the width so far, or since the previous tab
  4325. \divide\dimen0 by\tabw
  4326. \multiply\dimen0 by\tabw % compute previous multiple of \tabw
  4327. \advance\dimen0 by\tabw % advance to next multiple of \tabw
  4328. \wd0=\dimen0 \box0 \starttabbox
  4329. }%
  4330. }
  4331. \endgroup
  4332. \def\setupverbatim{%
  4333. % Easiest (and conventionally used) font for verbatim
  4334. \tt
  4335. \def\par{\leavevmode\egroup\box0\endgraf}%
  4336. \catcode`\`=\active
  4337. \tabexpand
  4338. % Respect line breaks,
  4339. % print special symbols as themselves, and
  4340. % make each space count
  4341. % must do in this order:
  4342. \obeylines \uncatcodespecials \sepspaces
  4343. \everypar{\starttabbox}%
  4344. }
  4345. % Do the @verb magic: verbatim text is quoted by unique
  4346. % delimiter characters. Before first delimiter expect a
  4347. % right brace, after last delimiter expect closing brace:
  4348. %
  4349. % \def\doverb'{'<char>#1<char>'}'{#1}
  4350. %
  4351. % [Knuth] p. 382; only eat outer {}
  4352. \begingroup
  4353. \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
  4354. \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
  4355. \endgroup
  4356. %
  4357. \def\verb{\begingroup\setupverb\doverb}
  4358. %
  4359. %
  4360. % Do the @verbatim magic: define the macro \doverbatim so that
  4361. % the (first) argument ends when '@end verbatim' is reached, ie:
  4362. %
  4363. % \def\doverbatim#1@end verbatim{#1}
  4364. %
  4365. % For Texinfo it's a lot easier than for LaTeX,
  4366. % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
  4367. % we need not redefine '\', '{' and '}'.
  4368. %
  4369. % Inspired by LaTeX's verbatim command set [latex.ltx]
  4370. %% Include LaTeX hack for completeness -- never know
  4371. %% \begingroup
  4372. %% \catcode`|=0 \catcode`[=1
  4373. %% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
  4374. %% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
  4375. %% #1|endgroup|def|Everbatim[]|end[verbatim]]
  4376. %% |endgroup
  4377. %
  4378. \begingroup
  4379. \catcode`\ =\active
  4380. \obeylines %
  4381. % ignore everything up to the first ^^M, that's the newline at the end
  4382. % of the @verbatim input line itself. Otherwise we get an extra blank
  4383. % line in the output.
  4384. \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}%
  4385. \endgroup
  4386. %
  4387. \def\verbatim{%
  4388. \def\Everbatim{\nonfillfinish\endgroup}%
  4389. \begingroup
  4390. \nonfillstart
  4391. \advance\leftskip by -\defbodyindent
  4392. \begingroup\setupverbatim\doverbatim
  4393. }
  4394. % @verbatiminclude FILE - insert text of file in verbatim environment.
  4395. %
  4396. % Allow normal characters that we make active in the argument (a file name).
  4397. \def\verbatiminclude{%
  4398. \begingroup
  4399. \catcode`\\=\other
  4400. \catcode`~=\other
  4401. \catcode`^=\other
  4402. \catcode`_=\other
  4403. \catcode`|=\other
  4404. \catcode`<=\other
  4405. \catcode`>=\other
  4406. \catcode`+=\other
  4407. \parsearg\doverbatiminclude
  4408. }
  4409. \def\setupverbatiminclude{%
  4410. \begingroup
  4411. \nonfillstart
  4412. \advance\leftskip by -\defbodyindent
  4413. \begingroup\setupverbatim
  4414. }
  4415. %
  4416. \def\doverbatiminclude#1{%
  4417. % Restore active chars for included file.
  4418. \endgroup
  4419. \begingroup
  4420. \let\value=\expandablevalue
  4421. \def\thisfile{#1}%
  4422. \expandafter\expandafter\setupverbatiminclude\input\thisfile
  4423. \endgroup
  4424. \nonfillfinish
  4425. \endgroup
  4426. }
  4427. % @copying ... @end copying.
  4428. % Save the text away for @insertcopying later. Many commands won't be
  4429. % allowed in this context, but that's ok.
  4430. %
  4431. % We save the uninterpreted tokens, rather than creating a box.
  4432. % Saving the text in a box would be much easier, but then all the
  4433. % typesetting commands (@smallbook, font changes, etc.) have to be done
  4434. % beforehand -- and a) we want @copying to be done first in the source
  4435. % file; b) letting users define the frontmatter in as flexible order as
  4436. % possible is very desirable.
  4437. %
  4438. \def\copying{\begingroup
  4439. % Define a command to swallow text until we reach `@end copying'.
  4440. % \ is the escape char in this texinfo.tex file, so it is the
  4441. % delimiter for the command; @ will be the escape char when we read
  4442. % it, but that doesn't matter.
  4443. \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
  4444. %
  4445. % We must preserve ^^M's in the input file; see \insertcopying below.
  4446. \catcode`\^^M = \active
  4447. \docopying
  4448. }
  4449. % What we do to finish off the copying text.
  4450. %
  4451. \def\enddocopying{\endgroup\ignorespaces}
  4452. % @insertcopying. Here we must play games with ^^M's. On the one hand,
  4453. % we need them to delimit commands such as `@end quotation', so they
  4454. % must be active. On the other hand, we certainly don't want every
  4455. % end-of-line to be a \par, as would happen with the normal active
  4456. % definition of ^^M. On the third hand, two ^^M's in a row should still
  4457. % generate a \par.
  4458. %
  4459. % Our approach is to make ^^M insert a space and a penalty1 normally;
  4460. % then it can also check if \lastpenalty=1. If it does, then manually
  4461. % do \par.
  4462. %
  4463. % This messes up the normal definitions of @c[omment], so we redefine
  4464. % it. Similarly for @ignore. (These commands are used in the gcc
  4465. % manual for man page generation.)
  4466. %
  4467. % Seems pretty fragile, most line-oriented commands will presumably
  4468. % fail, but for the limited use of getting the copying text (which
  4469. % should be quite simple) inserted, we can hope it's ok.
  4470. %
  4471. {\catcode`\^^M=\active %
  4472. \gdef\insertcopying{\begingroup %
  4473. \parindent = 0pt % looks wrong on title page
  4474. \def^^M{%
  4475. \ifnum \lastpenalty=1 %
  4476. \par %
  4477. \else %
  4478. \space \penalty 1 %
  4479. \fi %
  4480. }%
  4481. %
  4482. % Fix @c[omment] for catcode 13 ^^M's.
  4483. \def\c##1^^M{\ignorespaces}%
  4484. \let\comment = \c %
  4485. %
  4486. % Don't bother jumping through all the hoops that \doignore does, it
  4487. % would be very hard since the catcodes are already set.
  4488. \long\def\ignore##1\end ignore{\ignorespaces}%
  4489. %
  4490. \copyingtext %
  4491. \endgroup}%
  4492. }
  4493. \message{defuns,}
  4494. % @defun etc.
  4495. % Allow user to change definition object font (\df) internally
  4496. \def\setdeffont#1 {\csname DEF#1\endcsname}
  4497. \newskip\defbodyindent \defbodyindent=.4in
  4498. \newskip\defargsindent \defargsindent=50pt
  4499. \newskip\deflastargmargin \deflastargmargin=18pt
  4500. \newcount\parencount
  4501. % We want ()&[] to print specially on the defun line.
  4502. %
  4503. \def\activeparens{%
  4504. \catcode`\(=\active \catcode`\)=\active
  4505. \catcode`\&=\active
  4506. \catcode`\[=\active \catcode`\]=\active
  4507. }
  4508. % Make control sequences which act like normal parenthesis chars.
  4509. \let\lparen = ( \let\rparen = )
  4510. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  4511. % Be sure that we always have a definition for `(', etc. For example,
  4512. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  4513. % so TeX would otherwise complain about undefined control sequence.
  4514. \global\let(=\lparen \global\let)=\rparen
  4515. \global\let[=\lbrack \global\let]=\rbrack
  4516. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  4517. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  4518. % This is used to turn on special parens
  4519. % but make & act ordinary (given that it's active).
  4520. \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
  4521. % Definitions of (, ) and & used in args for functions.
  4522. % This is the definition of ( outside of all parentheses.
  4523. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
  4524. \global\advance\parencount by 1
  4525. }
  4526. %
  4527. % This is the definition of ( when already inside a level of parens.
  4528. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  4529. %
  4530. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  4531. % also in that case restore the outer-level definition of (.
  4532. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  4533. \global\advance \parencount by -1 }
  4534. % If we encounter &foo, then turn on ()-hacking afterwards
  4535. \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
  4536. %
  4537. \gdef\normalparens{\boldbrax\let&=\ampnr}
  4538. } % End of definition inside \activeparens
  4539. %% These parens (in \boldbrax) actually are a little bolder than the
  4540. %% contained text. This is especially needed for [ and ]
  4541. \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
  4542. \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
  4543. \let\ampnr = \&
  4544. \def\lbrb{{\bf\char`\[}}
  4545. \def\rbrb{{\bf\char`\]}}
  4546. % Active &'s sneak into the index arguments, so make sure it's defined.
  4547. {
  4548. \catcode`& = \active
  4549. \global\let& = \ampnr
  4550. }
  4551. % \defname, which formats the name of the @def (not the args).
  4552. % #1 is the function name.
  4553. % #2 is the type of definition, such as "Function".
  4554. %
  4555. \def\defname#1#2{%
  4556. % How we'll output the type name. Putting it in brackets helps
  4557. % distinguish it from the body text that may end up on the next line
  4558. % just below it.
  4559. \ifempty{#2}%
  4560. \def\defnametype{}%
  4561. \else
  4562. \def\defnametype{[\rm #2]}%
  4563. \fi
  4564. %
  4565. % Get the values of \leftskip and \rightskip as they were outside the @def...
  4566. \dimen2=\leftskip
  4567. \advance\dimen2 by -\defbodyindent
  4568. %
  4569. % Figure out values for the paragraph shape.
  4570. \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
  4571. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  4572. \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations
  4573. \parshape 2 0in \dimen0 \defargsindent \dimen1
  4574. %
  4575. % Output arg 2 ("Function" or some such) but stuck inside a box of
  4576. % width 0 so it does not interfere with linebreaking.
  4577. \noindent
  4578. %
  4579. {% Adjust \hsize to exclude the ambient margins,
  4580. % so that \rightline will obey them.
  4581. \advance \hsize by -\dimen2
  4582. \dimen3 = 0pt % was -1.25pc
  4583. \rlap{\rightline{\defnametype\kern\dimen3}}%
  4584. }%
  4585. %
  4586. % Allow all lines to be underfull without complaint:
  4587. \tolerance=10000 \hbadness=10000
  4588. \advance\leftskip by -\defbodyindent
  4589. \exdentamount=\defbodyindent
  4590. {\df #1}\enskip % output function name
  4591. % \defunargs will be called next to output the arguments, if any.
  4592. }
  4593. % Common pieces to start any @def...
  4594. % #1 is the \E... control sequence to end the definition (which we define).
  4595. % #2 is the \...x control sequence (which our caller defines).
  4596. % #3 is the control sequence to process the header, such as \defunheader.
  4597. %
  4598. \def\parsebodycommon#1#2#3{%
  4599. \begingroup\inENV
  4600. % If there are two @def commands in a row, we'll have a \nobreak,
  4601. % which is there to keep the function description together with its
  4602. % header. But if there's nothing but headers, we want to allow a
  4603. % break after all. Check for penalty 10002 (inserted by
  4604. % \defargscommonending) instead of 10000, since the sectioning
  4605. % commands insert a \penalty10000, and we don't want to allow a break
  4606. % between a section heading and a defun.
  4607. \ifnum\lastpenalty=10002 \penalty0 \fi
  4608. \medbreak
  4609. %
  4610. % Define the \E... end token that this defining construct specifies
  4611. % so that it will exit this group.
  4612. \def#1{\endgraf\endgroup\medbreak}%
  4613. %
  4614. \parindent=0in
  4615. \advance\leftskip by \defbodyindent
  4616. \exdentamount=\defbodyindent
  4617. }
  4618. % Common part of the \...x definitions.
  4619. %
  4620. \def\defxbodycommon{%
  4621. % As with \parsebodycommon above, allow line break if we have multiple
  4622. % x headers in a row. It's not a great place, though.
  4623. \ifnum\lastpenalty=10000 \penalty1000 \fi
  4624. %
  4625. \begingroup\obeylines
  4626. }
  4627. % Process body of @defun, @deffn, @defmac, etc.
  4628. %
  4629. \def\defparsebody#1#2#3{%
  4630. \parsebodycommon{#1}{#2}{#3}%
  4631. \def#2{\defxbodycommon \activeparens \spacesplit#3}%
  4632. \catcode\equalChar=\active
  4633. \begingroup\obeylines\activeparens
  4634. \spacesplit#3%
  4635. }
  4636. % #1, #2, #3 are the common arguments (see \parsebodycommon above).
  4637. % #4, delimited by the space, is the class name.
  4638. %
  4639. \def\defmethparsebody#1#2#3#4 {%
  4640. \parsebodycommon{#1}{#2}{#3}%
  4641. \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
  4642. \begingroup\obeylines\activeparens
  4643. % The \empty here prevents misinterpretation of a construct such as
  4644. % @deffn {whatever} {Enharmonic comma}
  4645. % See comments at \deftpparsebody, although in our case we don't have
  4646. % to remove the \empty afterwards, since it is empty.
  4647. \spacesplit{#3{#4}}\empty
  4648. }
  4649. % Used for @deftypemethod and @deftypeivar.
  4650. % #1, #2, #3 are the common arguments (see \defparsebody).
  4651. % #4, delimited by a space, is the class name.
  4652. % #5 is the method's return type.
  4653. %
  4654. \def\deftypemethparsebody#1#2#3#4 #5 {%
  4655. \parsebodycommon{#1}{#2}{#3}%
  4656. \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}%
  4657. \begingroup\obeylines\activeparens
  4658. \spacesplit{#3{#4}{#5}}%
  4659. }
  4660. % Used for @deftypeop. The change from \deftypemethparsebody is an
  4661. % extra argument at the beginning which is the `category', instead of it
  4662. % being the hardwired string `Method' or `Instance Variable'. We have
  4663. % to account for this both in the \...x definition and in parsing the
  4664. % input at hand. Thus also need a control sequence (passed as #5) for
  4665. % the \E... definition to assign the category name to.
  4666. %
  4667. \def\deftypeopparsebody#1#2#3#4#5 #6 {%
  4668. \parsebodycommon{#1}{#2}{#3}%
  4669. \def#2##1 ##2 ##3 {\def#4{##1}%
  4670. \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
  4671. \begingroup\obeylines\activeparens
  4672. \spacesplit{#3{#5}{#6}}%
  4673. }
  4674. % For @defop.
  4675. \def\defopparsebody #1#2#3#4#5 {%
  4676. \parsebodycommon{#1}{#2}{#3}%
  4677. \def#2##1 ##2 {\def#4{##1}%
  4678. \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
  4679. \begingroup\obeylines\activeparens
  4680. \spacesplit{#3{#5}}%
  4681. }
  4682. % These parsing functions are similar to the preceding ones
  4683. % except that they do not make parens into active characters.
  4684. % These are used for "variables" since they have no arguments.
  4685. %
  4686. \def\defvarparsebody #1#2#3{%
  4687. \parsebodycommon{#1}{#2}{#3}%
  4688. \def#2{\defxbodycommon \spacesplit#3}%
  4689. \catcode\equalChar=\active
  4690. \begingroup\obeylines
  4691. \spacesplit#3%
  4692. }
  4693. % @defopvar.
  4694. \def\defopvarparsebody #1#2#3#4#5 {%
  4695. \parsebodycommon{#1}{#2}{#3}%
  4696. \def#2##1 ##2 {\def#4{##1}%
  4697. \defxbodycommon \spacesplit{#3{##2}}}%
  4698. \begingroup\obeylines
  4699. \spacesplit{#3{#5}}%
  4700. }
  4701. \def\defvrparsebody#1#2#3#4 {%
  4702. \parsebodycommon{#1}{#2}{#3}%
  4703. \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
  4704. \begingroup\obeylines
  4705. \spacesplit{#3{#4}}%
  4706. }
  4707. % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
  4708. % type is just `struct', because we lose the braces in `{struct
  4709. % termios}' when \spacesplit reads its undelimited argument. Sigh.
  4710. % \let\deftpparsebody=\defvrparsebody
  4711. %
  4712. % So, to get around this, we put \empty in with the type name. That
  4713. % way, TeX won't find exactly `{...}' as an undelimited argument, and
  4714. % won't strip off the braces.
  4715. %
  4716. \def\deftpparsebody #1#2#3#4 {%
  4717. \parsebodycommon{#1}{#2}{#3}%
  4718. \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
  4719. \begingroup\obeylines
  4720. \spacesplit{\parsetpheaderline{#3{#4}}}\empty
  4721. }
  4722. % Fine, but then we have to eventually remove the \empty *and* the
  4723. % braces (if any). That's what this does.
  4724. %
  4725. \def\removeemptybraces\empty#1\relax{#1}
  4726. % After \spacesplit has done its work, this is called -- #1 is the final
  4727. % thing to call, #2 the type name (which starts with \empty), and #3
  4728. % (which might be empty) the arguments.
  4729. %
  4730. \def\parsetpheaderline#1#2#3{%
  4731. #1{\removeemptybraces#2\relax}{#3}%
  4732. }%
  4733. % Split up #2 (the rest of the input line) at the first space token.
  4734. % call #1 with two arguments:
  4735. % the first is all of #2 before the space token,
  4736. % the second is all of #2 after that space token.
  4737. % If #2 contains no space token, all of it is passed as the first arg
  4738. % and the second is passed as empty.
  4739. %
  4740. {\obeylines %
  4741. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}%
  4742. \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
  4743. \ifx\relax #3%
  4744. #1{#2}{}%
  4745. \else %
  4746. #1{#2}{#3#4}%
  4747. \fi}%
  4748. }
  4749. % Define @defun.
  4750. % This is called to end the arguments processing for all the @def... commands.
  4751. %
  4752. \def\defargscommonending{%
  4753. \interlinepenalty = 10000
  4754. \advance\rightskip by 0pt plus 1fil
  4755. \endgraf
  4756. \nobreak\vskip -\parskip
  4757. \penalty 10002 % signal to \parsebodycommon.
  4758. }
  4759. % This expands the args and terminates the paragraph they comprise.
  4760. %
  4761. \def\defunargs#1{\functionparens \sl
  4762. % Expand, preventing hyphenation at `-' chars.
  4763. % Note that groups don't affect changes in \hyphenchar.
  4764. % Set the font temporarily and use \font in case \setfont made \tensl a macro.
  4765. {\tensl\hyphenchar\font=0}%
  4766. #1%
  4767. {\tensl\hyphenchar\font=45}%
  4768. \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
  4769. \defargscommonending
  4770. }
  4771. \def\deftypefunargs #1{%
  4772. % Expand, preventing hyphenation at `-' chars.
  4773. % Note that groups don't affect changes in \hyphenchar.
  4774. % Use \boldbraxnoamp, not \functionparens, so that & is not special.
  4775. \boldbraxnoamp
  4776. \tclose{#1}% avoid \code because of side effects on active chars
  4777. \defargscommonending
  4778. }
  4779. % Do complete processing of one @defun or @defunx line already parsed.
  4780. % @deffn Command forward-char nchars
  4781. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  4782. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  4783. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  4784. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4785. }
  4786. % @defun == @deffn Function
  4787. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  4788. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  4789. \begingroup\defname {#1}{\putwordDeffunc}%
  4790. \defunargs {#2}\endgroup %
  4791. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4792. }
  4793. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  4794. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  4795. % #1 is the data type. #2 is the name and args.
  4796. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  4797. % #1 is the data type, #2 the name, #3 the args.
  4798. \def\deftypefunheaderx #1#2 #3\relax{%
  4799. \doind {fn}{\code{#2}}% Make entry in function index
  4800. \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
  4801. \deftypefunargs {#3}\endgroup %
  4802. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4803. }
  4804. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  4805. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  4806. % \defheaderxcond#1\relax$.$
  4807. % puts #1 in @code, followed by a space, but does nothing if #1 is null.
  4808. \def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
  4809. % #1 is the classification. #2 is the data type. #3 is the name and args.
  4810. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  4811. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  4812. \def\deftypefnheaderx #1#2#3 #4\relax{%
  4813. \doind {fn}{\code{#3}}% Make entry in function index
  4814. \begingroup
  4815. \normalparens % notably, turn off `&' magic, which prevents
  4816. % at least some C++ text from working
  4817. \defname {\defheaderxcond#2\relax$.$#3}{#1}%
  4818. \deftypefunargs {#4}\endgroup %
  4819. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4820. }
  4821. % @defmac == @deffn Macro
  4822. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  4823. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  4824. \begingroup\defname {#1}{\putwordDefmac}%
  4825. \defunargs {#2}\endgroup %
  4826. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4827. }
  4828. % @defspec == @deffn Special Form
  4829. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  4830. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  4831. \begingroup\defname {#1}{\putwordDefspec}%
  4832. \defunargs {#2}\endgroup %
  4833. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4834. }
  4835. % @defop CATEGORY CLASS OPERATION ARG...
  4836. %
  4837. \def\defop #1 {\def\defoptype{#1}%
  4838. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  4839. %
  4840. \def\defopheader#1#2#3{%
  4841. \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry
  4842. \begingroup
  4843. \defname{#2}{\defoptype\ \putwordon\ #1}%
  4844. \defunargs{#3}%
  4845. \endgroup
  4846. }
  4847. % @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
  4848. %
  4849. \def\deftypeop #1 {\def\deftypeopcategory{#1}%
  4850. \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
  4851. \deftypeopcategory}
  4852. %
  4853. % #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
  4854. \def\deftypeopheader#1#2#3#4{%
  4855. \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
  4856. \begingroup
  4857. \defname{\defheaderxcond#2\relax$.$#3}
  4858. {\deftypeopcategory\ \putwordon\ \code{#1}}%
  4859. \deftypefunargs{#4}%
  4860. \endgroup
  4861. }
  4862. % @deftypemethod CLASS TYPE METHOD ARG...
  4863. %
  4864. \def\deftypemethod{%
  4865. \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
  4866. %
  4867. % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
  4868. \def\deftypemethodheader#1#2#3#4{%
  4869. \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
  4870. \begingroup
  4871. \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
  4872. \deftypefunargs{#4}%
  4873. \endgroup
  4874. }
  4875. % @deftypeivar CLASS TYPE VARNAME
  4876. %
  4877. \def\deftypeivar{%
  4878. \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
  4879. %
  4880. % #1 is the class name, #2 the data type, #3 the variable name.
  4881. \def\deftypeivarheader#1#2#3{%
  4882. \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
  4883. \begingroup
  4884. \defname{\defheaderxcond#2\relax$.$#3}
  4885. {\putwordInstanceVariableof\ \code{#1}}%
  4886. \defvarargs{#3}%
  4887. \endgroup
  4888. }
  4889. % @defmethod == @defop Method
  4890. %
  4891. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  4892. %
  4893. % #1 is the class name, #2 the method name, #3 the args.
  4894. \def\defmethodheader#1#2#3{%
  4895. \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
  4896. \begingroup
  4897. \defname{#2}{\putwordMethodon\ \code{#1}}%
  4898. \defunargs{#3}%
  4899. \endgroup
  4900. }
  4901. % @defcv {Class Option} foo-class foo-flag
  4902. \def\defcv #1 {\def\defcvtype{#1}%
  4903. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  4904. \def\defcvarheader #1#2#3{%
  4905. \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry
  4906. \begingroup
  4907. \defname{#2}{\defcvtype\ \putwordof\ #1}%
  4908. \defvarargs{#3}%
  4909. \endgroup
  4910. }
  4911. % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
  4912. %
  4913. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  4914. %
  4915. \def\defivarheader#1#2#3{%
  4916. \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index
  4917. \begingroup
  4918. \defname{#2}{\putwordInstanceVariableof\ #1}%
  4919. \defvarargs{#3}%
  4920. \endgroup
  4921. }
  4922. % @defvar
  4923. % First, define the processing that is wanted for arguments of @defvar.
  4924. % This is actually simple: just print them in roman.
  4925. % This must expand the args and terminate the paragraph they make up
  4926. \def\defvarargs #1{\normalparens #1%
  4927. \defargscommonending
  4928. }
  4929. % @defvr Counter foo-count
  4930. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  4931. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  4932. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  4933. % @defvar == @defvr Variable
  4934. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  4935. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  4936. \begingroup\defname {#1}{\putwordDefvar}%
  4937. \defvarargs {#2}\endgroup %
  4938. }
  4939. % @defopt == @defvr {User Option}
  4940. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  4941. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  4942. \begingroup\defname {#1}{\putwordDefopt}%
  4943. \defvarargs {#2}\endgroup %
  4944. }
  4945. % @deftypevar int foobar
  4946. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  4947. % #1 is the data type. #2 is the name, perhaps followed by text that
  4948. % is actually part of the data type, which should not be put into the index.
  4949. \def\deftypevarheader #1#2{%
  4950. \dovarind#2 \relax% Make entry in variables index
  4951. \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
  4952. \defargscommonending
  4953. \endgroup}
  4954. \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
  4955. % @deftypevr {Global Flag} int enable
  4956. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  4957. \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
  4958. \begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
  4959. \defargscommonending
  4960. \endgroup}
  4961. % Now define @deftp
  4962. % Args are printed in bold, a slight difference from @defvar.
  4963. \def\deftpargs #1{\bf \defvarargs{#1}}
  4964. % @deftp Class window height width ...
  4965. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  4966. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  4967. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  4968. % These definitions are used if you use @defunx (etc.)
  4969. % anywhere other than immediately after a @defun or @defunx.
  4970. %
  4971. \def\defcvx#1 {\errmessage{@defcvx in invalid context}}
  4972. \def\deffnx#1 {\errmessage{@deffnx in invalid context}}
  4973. \def\defivarx#1 {\errmessage{@defivarx in invalid context}}
  4974. \def\defmacx#1 {\errmessage{@defmacx in invalid context}}
  4975. \def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
  4976. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  4977. \def\defopx#1 {\errmessage{@defopx in invalid context}}
  4978. \def\defspecx#1 {\errmessage{@defspecx in invalid context}}
  4979. \def\deftpx#1 {\errmessage{@deftpx in invalid context}}
  4980. \def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
  4981. \def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
  4982. \def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
  4983. \def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
  4984. \def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
  4985. \def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
  4986. \def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
  4987. \def\defunx#1 {\errmessage{@defunx in invalid context}}
  4988. \def\defvarx#1 {\errmessage{@defvarx in invalid context}}
  4989. \def\defvrx#1 {\errmessage{@defvrx in invalid context}}
  4990. \message{macros,}
  4991. % @macro.
  4992. % To do this right we need a feature of e-TeX, \scantokens,
  4993. % which we arrange to emulate with a temporary file in ordinary TeX.
  4994. \ifx\eTeXversion\undefined
  4995. \newwrite\macscribble
  4996. \def\scanmacro#1{%
  4997. \begingroup \newlinechar`\^^M
  4998. % Undo catcode changes of \startcontents and \doprintindex
  4999. \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
  5000. % Append \endinput to make sure that TeX does not see the ending newline.
  5001. \toks0={#1\endinput}%
  5002. \immediate\openout\macscribble=\jobname.tmp
  5003. \immediate\write\macscribble{\the\toks0}%
  5004. \immediate\closeout\macscribble
  5005. \let\xeatspaces\eatspaces
  5006. \input \jobname.tmp
  5007. \endgroup
  5008. }
  5009. \else
  5010. \def\scanmacro#1{%
  5011. \begingroup \newlinechar`\^^M
  5012. % Undo catcode changes of \startcontents and \doprintindex
  5013. \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
  5014. \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
  5015. \fi
  5016. \newcount\paramno % Count of parameters
  5017. \newtoks\macname % Macro name
  5018. \newif\ifrecursive % Is it recursive?
  5019. \def\macrolist{} % List of all defined macros in the form
  5020. % \do\macro1\do\macro2...
  5021. % Utility routines.
  5022. % Thisdoes \let #1 = #2, except with \csnames.
  5023. \def\cslet#1#2{%
  5024. \expandafter\expandafter
  5025. \expandafter\let
  5026. \expandafter\expandafter
  5027. \csname#1\endcsname
  5028. \csname#2\endcsname}
  5029. % Trim leading and trailing spaces off a string.
  5030. % Concepts from aro-bend problem 15 (see CTAN).
  5031. {\catcode`\@=11
  5032. \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  5033. \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  5034. \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  5035. \def\unbrace#1{#1}
  5036. \unbrace{\gdef\trim@@@ #1 } #2@{#1}
  5037. }
  5038. % Trim a single trailing ^^M off a string.
  5039. {\catcode`\^^M=\other \catcode`\Q=3%
  5040. \gdef\eatcr #1{\eatcra #1Q^^MQ}%
  5041. \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  5042. \gdef\eatcrb#1Q#2Q{#1}%
  5043. }
  5044. % Macro bodies are absorbed as an argument in a context where
  5045. % all characters are catcode 10, 11 or 12, except \ which is active
  5046. % (as in normal texinfo). It is necessary to change the definition of \.
  5047. % It's necessary to have hard CRs when the macro is executed. This is
  5048. % done by making ^^M (\endlinechar) catcode 12 when reading the macro
  5049. % body, and then making it the \newlinechar in \scanmacro.
  5050. \def\macrobodyctxt{%
  5051. \catcode`\~=\other
  5052. \catcode`\^=\other
  5053. \catcode`\_=\other
  5054. \catcode`\|=\other
  5055. \catcode`\<=\other
  5056. \catcode`\>=\other
  5057. \catcode`\+=\other
  5058. \catcode`\{=\other
  5059. \catcode`\}=\other
  5060. \catcode`\@=\other
  5061. \catcode`\^^M=\other
  5062. \usembodybackslash}
  5063. \def\macroargctxt{%
  5064. \catcode`\~=\other
  5065. \catcode`\^=\other
  5066. \catcode`\_=\other
  5067. \catcode`\|=\other
  5068. \catcode`\<=\other
  5069. \catcode`\>=\other
  5070. \catcode`\+=\other
  5071. \catcode`\@=\other
  5072. \catcode`\\=\other}
  5073. % \mbodybackslash is the definition of \ in @macro bodies.
  5074. % It maps \foo\ => \csname macarg.foo\endcsname => #N
  5075. % where N is the macro parameter number.
  5076. % We define \csname macarg.\endcsname to be \realbackslash, so
  5077. % \\ in macro replacement text gets you a backslash.
  5078. {\catcode`@=0 @catcode`@\=@active
  5079. @gdef@usembodybackslash{@let\=@mbodybackslash}
  5080. @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  5081. }
  5082. \expandafter\def\csname macarg.\endcsname{\realbackslash}
  5083. \def\macro{\recursivefalse\parsearg\macroxxx}
  5084. \def\rmacro{\recursivetrue\parsearg\macroxxx}
  5085. \def\macroxxx#1{%
  5086. \getargs{#1}% now \macname is the macname and \argl the arglist
  5087. \ifx\argl\empty % no arguments
  5088. \paramno=0%
  5089. \else
  5090. \expandafter\parsemargdef \argl;%
  5091. \fi
  5092. \if1\csname ismacro.\the\macname\endcsname
  5093. \message{Warning: redefining \the\macname}%
  5094. \else
  5095. \expandafter\ifx\csname \the\macname\endcsname \relax
  5096. \else \errmessage{Macro name \the\macname\space already defined}\fi
  5097. \global\cslet{macsave.\the\macname}{\the\macname}%
  5098. \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  5099. % Add the macroname to \macrolist
  5100. \toks0 = \expandafter{\macrolist\do}%
  5101. \xdef\macrolist{\the\toks0
  5102. \expandafter\noexpand\csname\the\macname\endcsname}%
  5103. \fi
  5104. \begingroup \macrobodyctxt
  5105. \ifrecursive \expandafter\parsermacbody
  5106. \else \expandafter\parsemacbody
  5107. \fi}
  5108. \def\unmacro{\parsearg\dounmacro}
  5109. \def\dounmacro#1{%
  5110. \if1\csname ismacro.#1\endcsname
  5111. \global\cslet{#1}{macsave.#1}%
  5112. \global\expandafter\let \csname ismacro.#1\endcsname=0%
  5113. % Remove the macro name from \macrolist:
  5114. \begingroup
  5115. \expandafter\let\csname#1\endcsname \relax
  5116. \let\do\unmacrodo
  5117. \xdef\macrolist{\macrolist}%
  5118. \endgroup
  5119. \else
  5120. \errmessage{Macro #1 not defined}%
  5121. \fi
  5122. }
  5123. % Called by \do from \dounmacro on each macro. The idea is to omit any
  5124. % macro definitions that have been changed to \relax.
  5125. %
  5126. \def\unmacrodo#1{%
  5127. \ifx#1\relax
  5128. % remove this
  5129. \else
  5130. \noexpand\do \noexpand #1%
  5131. \fi
  5132. }
  5133. % This makes use of the obscure feature that if the last token of a
  5134. % <parameter list> is #, then the preceding argument is delimited by
  5135. % an opening brace, and that opening brace is not consumed.
  5136. \def\getargs#1{\getargsxxx#1{}}
  5137. \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  5138. \def\getmacname #1 #2\relax{\macname={#1}}
  5139. \def\getmacargs#1{\def\argl{#1}}
  5140. % Parse the optional {params} list. Set up \paramno and \paramlist
  5141. % so \defmacro knows what to do. Define \macarg.blah for each blah
  5142. % in the params list, to be ##N where N is the position in that list.
  5143. % That gets used by \mbodybackslash (above).
  5144. % We need to get `macro parameter char #' into several definitions.
  5145. % The technique used is stolen from LaTeX: let \hash be something
  5146. % unexpandable, insert that wherever you need a #, and then redefine
  5147. % it to # just before using the token list produced.
  5148. %
  5149. % The same technique is used to protect \eatspaces till just before
  5150. % the macro is used.
  5151. \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
  5152. \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
  5153. \def\parsemargdefxxx#1,{%
  5154. \if#1;\let\next=\relax
  5155. \else \let\next=\parsemargdefxxx
  5156. \advance\paramno by 1%
  5157. \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  5158. {\xeatspaces{\hash\the\paramno}}%
  5159. \edef\paramlist{\paramlist\hash\the\paramno,}%
  5160. \fi\next}
  5161. % These two commands read recursive and nonrecursive macro bodies.
  5162. % (They're different since rec and nonrec macros end differently.)
  5163. \long\def\parsemacbody#1@end macro%
  5164. {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
  5165. \long\def\parsermacbody#1@end rmacro%
  5166. {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
  5167. % This defines the macro itself. There are six cases: recursive and
  5168. % nonrecursive macros of zero, one, and many arguments.
  5169. % Much magic with \expandafter here.
  5170. % \xdef is used so that macro definitions will survive the file
  5171. % they're defined in; @include reads the file inside a group.
  5172. \def\defmacro{%
  5173. \let\hash=##% convert placeholders to macro parameter chars
  5174. \ifrecursive
  5175. \ifcase\paramno
  5176. % 0
  5177. \expandafter\xdef\csname\the\macname\endcsname{%
  5178. \noexpand\scanmacro{\temp}}%
  5179. \or % 1
  5180. \expandafter\xdef\csname\the\macname\endcsname{%
  5181. \bgroup\noexpand\macroargctxt
  5182. \noexpand\braceorline
  5183. \expandafter\noexpand\csname\the\macname xxx\endcsname}%
  5184. \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
  5185. \egroup\noexpand\scanmacro{\temp}}%
  5186. \else % many
  5187. \expandafter\xdef\csname\the\macname\endcsname{%
  5188. \bgroup\noexpand\macroargctxt
  5189. \noexpand\csname\the\macname xx\endcsname}%
  5190. \expandafter\xdef\csname\the\macname xx\endcsname##1{%
  5191. \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
  5192. \expandafter\expandafter
  5193. \expandafter\xdef
  5194. \expandafter\expandafter
  5195. \csname\the\macname xxx\endcsname
  5196. \paramlist{\egroup\noexpand\scanmacro{\temp}}%
  5197. \fi
  5198. \else
  5199. \ifcase\paramno
  5200. % 0
  5201. \expandafter\xdef\csname\the\macname\endcsname{%
  5202. \noexpand\norecurse{\the\macname}%
  5203. \noexpand\scanmacro{\temp}\egroup}%
  5204. \or % 1
  5205. \expandafter\xdef\csname\the\macname\endcsname{%
  5206. \bgroup\noexpand\macroargctxt
  5207. \noexpand\braceorline
  5208. \expandafter\noexpand\csname\the\macname xxx\endcsname}%
  5209. \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
  5210. \egroup
  5211. \noexpand\norecurse{\the\macname}%
  5212. \noexpand\scanmacro{\temp}\egroup}%
  5213. \else % many
  5214. \expandafter\xdef\csname\the\macname\endcsname{%
  5215. \bgroup\noexpand\macroargctxt
  5216. \expandafter\noexpand\csname\the\macname xx\endcsname}%
  5217. \expandafter\xdef\csname\the\macname xx\endcsname##1{%
  5218. \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
  5219. \expandafter\expandafter
  5220. \expandafter\xdef
  5221. \expandafter\expandafter
  5222. \csname\the\macname xxx\endcsname
  5223. \paramlist{%
  5224. \egroup
  5225. \noexpand\norecurse{\the\macname}%
  5226. \noexpand\scanmacro{\temp}\egroup}%
  5227. \fi
  5228. \fi}
  5229. \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  5230. % \braceorline decides whether the next nonwhitespace character is a
  5231. % {. If so it reads up to the closing }, if not, it reads the whole
  5232. % line. Whatever was read is then fed to the next control sequence
  5233. % as an argument (by \parsebrace or \parsearg)
  5234. \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
  5235. \def\braceorlinexxx{%
  5236. \ifx\nchar\bgroup\else
  5237. \expandafter\parsearg
  5238. \fi \next}
  5239. % We mant to disable all macros during \shipout so that they are not
  5240. % expanded by \write.
  5241. \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
  5242. \edef\next{\macrolist}\expandafter\endgroup\next}
  5243. % @alias.
  5244. % We need some trickery to remove the optional spaces around the equal
  5245. % sign. Just make them active and then expand them all to nothing.
  5246. \def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
  5247. \def\aliasxxx #1{\aliasyyy#1\relax}
  5248. \def\aliasyyy #1=#2\relax{\ignoreactivespaces
  5249. \edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
  5250. \expandafter\noexpand\csname#2\endcsname}%
  5251. \expandafter\endgroup\next}
  5252. \message{cross references,}
  5253. % @xref etc.
  5254. \newwrite\auxfile
  5255. \newif\ifhavexrefs % True if xref values are known.
  5256. \newif\ifwarnedxrefs % True if we warned once that they aren't known.
  5257. % @inforef is relatively simple.
  5258. \def\inforef #1{\inforefzzz #1,,,,**}
  5259. \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  5260. node \samp{\ignorespaces#1{}}}
  5261. % @node's job is to define \lastnode.
  5262. \def\node{\ENVcheck\parsearg\nodezzz}
  5263. \def\nodezzz#1{\nodexxx [#1,]}
  5264. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  5265. \let\nwnode=\node
  5266. \let\lastnode=\relax
  5267. % The sectioning commands (@chapter, etc.) call these.
  5268. \def\donoderef{%
  5269. \ifx\lastnode\relax\else
  5270. \expandafter\expandafter\expandafter\setref{\lastnode}%
  5271. {Ysectionnumberandtype}%
  5272. \global\let\lastnode=\relax
  5273. \fi
  5274. }
  5275. \def\unnumbnoderef{%
  5276. \ifx\lastnode\relax\else
  5277. \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
  5278. \global\let\lastnode=\relax
  5279. \fi
  5280. }
  5281. \def\appendixnoderef{%
  5282. \ifx\lastnode\relax\else
  5283. \expandafter\expandafter\expandafter\setref{\lastnode}%
  5284. {Yappendixletterandtype}%
  5285. \global\let\lastnode=\relax
  5286. \fi
  5287. }
  5288. % @anchor{NAME} -- define xref target at arbitrary point.
  5289. %
  5290. \newcount\savesfregister
  5291. \gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
  5292. \gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
  5293. \gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
  5294. % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
  5295. % anchor), namely NAME-title (the corresponding @chapter/etc. name),
  5296. % NAME-pg (the page number), and NAME-snt (section number and type).
  5297. % Called from \foonoderef.
  5298. %
  5299. % We have to set \indexdummies so commands such as @code in a section
  5300. % title aren't expanded. It would be nicer not to expand the titles in
  5301. % the first place, but there's so many layers that that is hard to do.
  5302. %
  5303. % Likewise, use \turnoffactive so that punctuation chars such as underscore
  5304. % and backslash work in node names.
  5305. %
  5306. \def\setref#1#2{{%
  5307. \atdummies
  5308. \pdfmkdest{#1}%
  5309. %
  5310. \turnoffactive
  5311. \dosetq{#1-title}{Ytitle}%
  5312. \dosetq{#1-pg}{Ypagenumber}%
  5313. \dosetq{#1-snt}{#2}%
  5314. }}
  5315. % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
  5316. % the node name, #2 the name of the Info cross-reference, #3 the printed
  5317. % node name, #4 the name of the Info file, #5 the name of the printed
  5318. % manual. All but the node name can be omitted.
  5319. %
  5320. \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
  5321. \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
  5322. \def\ref#1{\xrefX[#1,,,,,,,]}
  5323. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  5324. \unsepspaces
  5325. \def\printedmanual{\ignorespaces #5}%
  5326. \def\printednodename{\ignorespaces #3}%
  5327. \setbox1=\hbox{\printedmanual}%
  5328. \setbox0=\hbox{\printednodename}%
  5329. \ifdim \wd0 = 0pt
  5330. % No printed node name was explicitly given.
  5331. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
  5332. % Use the node name inside the square brackets.
  5333. \def\printednodename{\ignorespaces #1}%
  5334. \else
  5335. % Use the actual chapter/section title appear inside
  5336. % the square brackets. Use the real section title if we have it.
  5337. \ifdim \wd1 > 0pt
  5338. % It is in another manual, so we don't have it.
  5339. \def\printednodename{\ignorespaces #1}%
  5340. \else
  5341. \ifhavexrefs
  5342. % We know the real title if we have the xref values.
  5343. \def\printednodename{\refx{#1-title}{}}%
  5344. \else
  5345. % Otherwise just copy the Info node name.
  5346. \def\printednodename{\ignorespaces #1}%
  5347. \fi%
  5348. \fi
  5349. \fi
  5350. \fi
  5351. %
  5352. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
  5353. % insert empty discretionaries after hyphens, which means that it will
  5354. % not find a line break at a hyphen in a node names. Since some manuals
  5355. % are best written with fairly long node names, containing hyphens, this
  5356. % is a loss. Therefore, we give the text of the node name again, so it
  5357. % is as if TeX is seeing it for the first time.
  5358. \ifpdf
  5359. \leavevmode
  5360. \getfilename{#4}%
  5361. {\turnoffactive \otherbackslash
  5362. \ifnum\filenamelength>0
  5363. \startlink attr{/Border [0 0 0]}%
  5364. goto file{\the\filename.pdf} name{#1}%
  5365. \else
  5366. \startlink attr{/Border [0 0 0]}%
  5367. goto name{#1}%
  5368. \fi
  5369. }%
  5370. \linkcolor
  5371. \fi
  5372. %
  5373. \ifdim \wd1 > 0pt
  5374. \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
  5375. \else
  5376. % _ (for example) has to be the character _ for the purposes of the
  5377. % control sequence corresponding to the node, but it has to expand
  5378. % into the usual \leavevmode...\vrule stuff for purposes of
  5379. % printing. So we \turnoffactive for the \refx-snt, back on for the
  5380. % printing, back off for the \refx-pg.
  5381. {\turnoffactive \otherbackslash
  5382. % Only output a following space if the -snt ref is nonempty; for
  5383. % @unnumbered and @anchor, it won't be.
  5384. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  5385. \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  5386. }%
  5387. % [mynode],
  5388. [\printednodename],\space
  5389. % page 3
  5390. \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
  5391. \fi
  5392. \endlink
  5393. \endgroup}
  5394. % \dosetq is called from \setref to do the actual \write (\iflinks).
  5395. %
  5396. \def\dosetq#1#2{%
  5397. {\let\folio=0%
  5398. \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
  5399. \iflinks \next \fi
  5400. }%
  5401. }
  5402. % \internalsetq{foo}{page} expands into
  5403. % CHARACTERS @xrdef{foo}{...expansion of \page...}
  5404. \def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}}
  5405. % Things to be expanded by \internalsetq.
  5406. %
  5407. \def\Ypagenumber{\folio}
  5408. \def\Ytitle{\thissection}
  5409. \def\Ynothing{}
  5410. \def\Ysectionnumberandtype{%
  5411. \ifnum\secno=0
  5412. \putwordChapter@tie \the\chapno
  5413. \else \ifnum\subsecno=0
  5414. \putwordSection@tie \the\chapno.\the\secno
  5415. \else \ifnum\subsubsecno=0
  5416. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  5417. \else
  5418. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  5419. \fi\fi\fi
  5420. }
  5421. \def\Yappendixletterandtype{%
  5422. \ifnum\secno=0
  5423. \putwordAppendix@tie @char\the\appendixno{}%
  5424. \else \ifnum\subsecno=0
  5425. \putwordSection@tie @char\the\appendixno.\the\secno
  5426. \else \ifnum\subsubsecno=0
  5427. \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  5428. \else
  5429. \putwordSection@tie
  5430. @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  5431. \fi\fi\fi
  5432. }
  5433. % Use TeX 3.0's \inputlineno to get the line number, for better error
  5434. % messages, but if we're using an old version of TeX, don't do anything.
  5435. %
  5436. \ifx\inputlineno\thisisundefined
  5437. \let\linenumber = \empty % Pre-3.0.
  5438. \else
  5439. \def\linenumber{\the\inputlineno:\space}
  5440. \fi
  5441. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  5442. % If its value is nonempty, SUFFIX is output afterward.
  5443. %
  5444. \def\refx#1#2{%
  5445. {%
  5446. \indexnofonts
  5447. \otherbackslash
  5448. \expandafter\global\expandafter\let\expandafter\thisrefX
  5449. \csname X#1\endcsname
  5450. }%
  5451. \ifx\thisrefX\relax
  5452. % If not defined, say something at least.
  5453. \angleleft un\-de\-fined\angleright
  5454. \iflinks
  5455. \ifhavexrefs
  5456. \message{\linenumber Undefined cross reference `#1'.}%
  5457. \else
  5458. \ifwarnedxrefs\else
  5459. \global\warnedxrefstrue
  5460. \message{Cross reference values unknown; you must run TeX again.}%
  5461. \fi
  5462. \fi
  5463. \fi
  5464. \else
  5465. % It's defined, so just use it.
  5466. \thisrefX
  5467. \fi
  5468. #2% Output the suffix in any case.
  5469. }
  5470. % This is the macro invoked by entries in the aux file.
  5471. %
  5472. \def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
  5473. % Read the last existing aux file, if any. No error if none exists.
  5474. \def\readauxfile{\begingroup
  5475. \catcode`\^^@=\other
  5476. \catcode`\^^A=\other
  5477. \catcode`\^^B=\other
  5478. \catcode`\^^C=\other
  5479. \catcode`\^^D=\other
  5480. \catcode`\^^E=\other
  5481. \catcode`\^^F=\other
  5482. \catcode`\^^G=\other
  5483. \catcode`\^^H=\other
  5484. \catcode`\^^K=\other
  5485. \catcode`\^^L=\other
  5486. \catcode`\^^N=\other
  5487. \catcode`\^^P=\other
  5488. \catcode`\^^Q=\other
  5489. \catcode`\^^R=\other
  5490. \catcode`\^^S=\other
  5491. \catcode`\^^T=\other
  5492. \catcode`\^^U=\other
  5493. \catcode`\^^V=\other
  5494. \catcode`\^^W=\other
  5495. \catcode`\^^X=\other
  5496. \catcode`\^^Z=\other
  5497. \catcode`\^^[=\other
  5498. \catcode`\^^\=\other
  5499. \catcode`\^^]=\other
  5500. \catcode`\^^^=\other
  5501. \catcode`\^^_=\other
  5502. % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  5503. % in xref tags, i.e., node names. But since ^^e4 notation isn't
  5504. % supported in the main text, it doesn't seem desirable. Furthermore,
  5505. % that is not enough: for node names that actually contain a ^
  5506. % character, we would end up writing a line like this: 'xrdef {'hat
  5507. % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  5508. % argument, and \hat is not an expandable control sequence. It could
  5509. % all be worked out, but why? Either we support ^^ or we don't.
  5510. %
  5511. % The other change necessary for this was to define \auxhat:
  5512. % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  5513. % and then to call \auxhat in \setq.
  5514. %
  5515. \catcode`\^=\other
  5516. %
  5517. % Special characters. Should be turned off anyway, but...
  5518. \catcode`\~=\other
  5519. \catcode`\[=\other
  5520. \catcode`\]=\other
  5521. \catcode`\"=\other
  5522. \catcode`\_=\other
  5523. \catcode`\|=\other
  5524. \catcode`\<=\other
  5525. \catcode`\>=\other
  5526. \catcode`\$=\other
  5527. \catcode`\#=\other
  5528. \catcode`\&=\other
  5529. \catcode`\%=\other
  5530. \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  5531. %
  5532. % Make the characters 128-255 be printing characters
  5533. {%
  5534. \count 1=128
  5535. \def\loop{%
  5536. \catcode\count 1=\other
  5537. \advance\count 1 by 1
  5538. \ifnum \count 1<256 \loop \fi
  5539. }%
  5540. }%
  5541. %
  5542. % Turn off \ as an escape so we do not lose on
  5543. % entries which were dumped with control sequences in their names.
  5544. % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^
  5545. % Reference to such entries still does not work the way one would wish,
  5546. % but at least they do not bomb out when the aux file is read in.
  5547. \catcode`\\=\other
  5548. %
  5549. % @ is our escape character in .aux files.
  5550. \catcode`\{=1
  5551. \catcode`\}=2
  5552. \catcode`\@=0
  5553. %
  5554. \openin 1 \jobname.aux
  5555. \ifeof 1 \else
  5556. \closein 1
  5557. \input \jobname.aux
  5558. \global\havexrefstrue
  5559. \global\warnedobstrue
  5560. \fi
  5561. % Open the new aux file. TeX will close it automatically at exit.
  5562. \openout\auxfile=\jobname.aux
  5563. \endgroup}
  5564. % Footnotes.
  5565. \newcount \footnoteno
  5566. % The trailing space in the following definition for supereject is
  5567. % vital for proper filling; pages come out unaligned when you do a
  5568. % pagealignmacro call if that space before the closing brace is
  5569. % removed. (Generally, numeric constants should always be followed by a
  5570. % space to prevent strange expansion errors.)
  5571. \def\supereject{\par\penalty -20000\footnoteno =0 }
  5572. % @footnotestyle is meaningful for info output only.
  5573. \let\footnotestyle=\comment
  5574. \let\ptexfootnote=\footnote
  5575. {\catcode `\@=11
  5576. %
  5577. % Auto-number footnotes. Otherwise like plain.
  5578. \gdef\footnote{%
  5579. \global\advance\footnoteno by \@ne
  5580. \edef\thisfootno{$^{\the\footnoteno}$}%
  5581. %
  5582. % In case the footnote comes at the end of a sentence, preserve the
  5583. % extra spacing after we do the footnote number.
  5584. \let\@sf\empty
  5585. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  5586. %
  5587. % Remove inadvertent blank space before typesetting the footnote number.
  5588. \unskip
  5589. \thisfootno\@sf
  5590. \dofootnote
  5591. }%
  5592. % Don't bother with the trickery in plain.tex to not require the
  5593. % footnote text as a parameter. Our footnotes don't need to be so general.
  5594. %
  5595. % Oh yes, they do; otherwise, @ifset and anything else that uses
  5596. % \parseargline fail inside footnotes because the tokens are fixed when
  5597. % the footnote is read. --karl, 16nov96.
  5598. %
  5599. % The start of the footnote looks usually like this:
  5600. \gdef\startfootins{\insert\footins\bgroup}
  5601. %
  5602. % ... but this macro is redefined inside @multitable.
  5603. %
  5604. \gdef\dofootnote{%
  5605. \startfootins
  5606. % We want to typeset this text as a normal paragraph, even if the
  5607. % footnote reference occurs in (for example) a display environment.
  5608. % So reset some parameters.
  5609. \hsize=\pagewidth
  5610. \interlinepenalty\interfootnotelinepenalty
  5611. \splittopskip\ht\strutbox % top baseline for broken footnotes
  5612. \splitmaxdepth\dp\strutbox
  5613. \floatingpenalty\@MM
  5614. \leftskip\z@skip
  5615. \rightskip\z@skip
  5616. \spaceskip\z@skip
  5617. \xspaceskip\z@skip
  5618. \parindent\defaultparindent
  5619. %
  5620. \smallfonts \rm
  5621. %
  5622. % Because we use hanging indentation in footnotes, a @noindent appears
  5623. % to exdent this text, so make it be a no-op. makeinfo does not use
  5624. % hanging indentation so @noindent can still be needed within footnote
  5625. % text after an @example or the like (not that this is good style).
  5626. \let\noindent = \relax
  5627. %
  5628. % Hang the footnote text off the number. Use \everypar in case the
  5629. % footnote extends for more than one paragraph.
  5630. \everypar = {\hang}%
  5631. \textindent{\thisfootno}%
  5632. %
  5633. % Don't crash into the line above the footnote text. Since this
  5634. % expands into a box, it must come within the paragraph, lest it
  5635. % provide a place where TeX can split the footnote.
  5636. \footstrut
  5637. \futurelet\next\fo@t
  5638. }
  5639. }%end \catcode `\@=11
  5640. % @| inserts a changebar to the left of the current line. It should
  5641. % surround any changed text. This approach does *not* work if the
  5642. % change spans more than two lines of output. To handle that, we would
  5643. % have adopt a much more difficult approach (putting marks into the main
  5644. % vertical list for the beginning and end of each change).
  5645. %
  5646. \def\|{%
  5647. % \vadjust can only be used in horizontal mode.
  5648. \leavevmode
  5649. %
  5650. % Append this vertical mode material after the current line in the output.
  5651. \vadjust{%
  5652. % We want to insert a rule with the height and depth of the current
  5653. % leading; that is exactly what \strutbox is supposed to record.
  5654. \vskip-\baselineskip
  5655. %
  5656. % \vadjust-items are inserted at the left edge of the type. So
  5657. % the \llap here moves out into the left-hand margin.
  5658. \llap{%
  5659. %
  5660. % For a thicker or thinner bar, change the `1pt'.
  5661. \vrule height\baselineskip width1pt
  5662. %
  5663. % This is the space between the bar and the text.
  5664. \hskip 12pt
  5665. }%
  5666. }%
  5667. }
  5668. % For a final copy, take out the rectangles
  5669. % that mark overfull boxes (in case you have decided
  5670. % that the text looks ok even though it passes the margin).
  5671. %
  5672. \def\finalout{\overfullrule=0pt}
  5673. % @image. We use the macros from epsf.tex to support this.
  5674. % If epsf.tex is not installed and @image is used, we complain.
  5675. %
  5676. % Check for and read epsf.tex up front. If we read it only at @image
  5677. % time, we might be inside a group, and then its definitions would get
  5678. % undone and the next image would fail.
  5679. \openin 1 = epsf.tex
  5680. \ifeof 1 \else
  5681. \closein 1
  5682. % Do not bother showing banner with epsf.tex v2.7k (available in
  5683. % doc/epsf.tex and on ctan).
  5684. \def\epsfannounce{\toks0 = }%
  5685. \input epsf.tex
  5686. \fi
  5687. %
  5688. % We will only complain once about lack of epsf.tex.
  5689. \newif\ifwarnednoepsf
  5690. \newhelp\noepsfhelp{epsf.tex must be installed for images to
  5691. work. It is also included in the Texinfo distribution, or you can get
  5692. it from ftp://tug.org/tex/epsf.tex.}
  5693. %
  5694. \def\image#1{%
  5695. \ifx\epsfbox\undefined
  5696. \ifwarnednoepsf \else
  5697. \errhelp = \noepsfhelp
  5698. \errmessage{epsf.tex not found, images will be ignored}%
  5699. \global\warnednoepsftrue
  5700. \fi
  5701. \else
  5702. \imagexxx #1,,,,,\finish
  5703. \fi
  5704. }
  5705. %
  5706. % Arguments to @image:
  5707. % #1 is (mandatory) image filename; we tack on .eps extension.
  5708. % #2 is (optional) width, #3 is (optional) height.
  5709. % #4 is (ignored optional) html alt text.
  5710. % #5 is (ignored optional) extension.
  5711. % #6 is just the usual extra ignored arg for parsing this stuff.
  5712. \newif\ifimagevmode
  5713. \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  5714. \catcode`\^^M = 5 % in case we're inside an example
  5715. \normalturnoffactive % allow _ et al. in names
  5716. % If the image is by itself, center it.
  5717. \ifvmode
  5718. \imagevmodetrue
  5719. \nobreak\bigskip
  5720. % Usually we'll have text after the image which will insert
  5721. % \parskip glue, so insert it here too to equalize the space
  5722. % above and below.
  5723. \nobreak\vskip\parskip
  5724. \nobreak
  5725. \line\bgroup\hss
  5726. \fi
  5727. %
  5728. % Output the image.
  5729. \ifpdf
  5730. \dopdfimage{#1}{#2}{#3}%
  5731. \else
  5732. % \epsfbox itself resets \epsf?size at each figure.
  5733. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  5734. \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  5735. \epsfbox{#1.eps}%
  5736. \fi
  5737. %
  5738. \ifimagevmode \hss \egroup \bigbreak \fi % space after the image
  5739. \endgroup}
  5740. \message{localization,}
  5741. % and i18n.
  5742. % @documentlanguage is usually given very early, just after
  5743. % @setfilename. If done too late, it may not override everything
  5744. % properly. Single argument is the language abbreviation.
  5745. % It would be nice if we could set up a hyphenation file here.
  5746. %
  5747. \def\documentlanguage{\parsearg\dodocumentlanguage}
  5748. \def\dodocumentlanguage#1{%
  5749. \tex % read txi-??.tex file in plain TeX.
  5750. % Read the file if it exists.
  5751. \openin 1 txi-#1.tex
  5752. \ifeof1
  5753. \errhelp = \nolanghelp
  5754. \errmessage{Cannot read language file txi-#1.tex}%
  5755. \let\temp = \relax
  5756. \else
  5757. \def\temp{\input txi-#1.tex }%
  5758. \fi
  5759. \temp
  5760. \endgroup
  5761. }
  5762. \newhelp\nolanghelp{The given language definition file cannot be found or
  5763. is empty. Maybe you need to install it? In the current directory
  5764. should work if nowhere else does.}
  5765. % @documentencoding should change something in TeX eventually, most
  5766. % likely, but for now just recognize it.
  5767. \let\documentencoding = \comment
  5768. % Page size parameters.
  5769. %
  5770. \newdimen\defaultparindent \defaultparindent = 15pt
  5771. \chapheadingskip = 15pt plus 4pt minus 2pt
  5772. \secheadingskip = 12pt plus 3pt minus 2pt
  5773. \subsecheadingskip = 9pt plus 2pt minus 2pt
  5774. % Prevent underfull vbox error messages.
  5775. \vbadness = 10000
  5776. % Don't be so finicky about underfull hboxes, either.
  5777. \hbadness = 2000
  5778. % Following George Bush, just get rid of widows and orphans.
  5779. \widowpenalty=10000
  5780. \clubpenalty=10000
  5781. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  5782. % using an old version of TeX, don't do anything. We want the amount of
  5783. % stretch added to depend on the line length, hence the dependence on
  5784. % \hsize. We call this whenever the paper size is set.
  5785. %
  5786. \def\setemergencystretch{%
  5787. \ifx\emergencystretch\thisisundefined
  5788. % Allow us to assign to \emergencystretch anyway.
  5789. \def\emergencystretch{\dimen0}%
  5790. \else
  5791. \emergencystretch = .15\hsize
  5792. \fi
  5793. }
  5794. % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
  5795. % 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
  5796. % physical page width.
  5797. %
  5798. % We also call \setleading{\textleading}, so the caller should define
  5799. % \textleading. The caller should also set \parskip.
  5800. %
  5801. \def\internalpagesizes#1#2#3#4#5#6#7#8{%
  5802. \voffset = #3\relax
  5803. \topskip = #6\relax
  5804. \splittopskip = \topskip
  5805. %
  5806. \vsize = #1\relax
  5807. \advance\vsize by \topskip
  5808. \outervsize = \vsize
  5809. \advance\outervsize by 2\topandbottommargin
  5810. \pageheight = \vsize
  5811. %
  5812. \hsize = #2\relax
  5813. \outerhsize = \hsize
  5814. \advance\outerhsize by 0.5in
  5815. \pagewidth = \hsize
  5816. %
  5817. \normaloffset = #4\relax
  5818. \bindingoffset = #5\relax
  5819. %
  5820. \ifpdf
  5821. \pdfpageheight #7\relax
  5822. \pdfpagewidth #8\relax
  5823. \fi
  5824. %
  5825. \setleading{\textleading}
  5826. %
  5827. \parindent = \defaultparindent
  5828. \setemergencystretch
  5829. }
  5830. % @letterpaper (the default).
  5831. \def\letterpaper{{\globaldefs = 1
  5832. \parskip = 3pt plus 2pt minus 1pt
  5833. \textleading = 13.2pt
  5834. %
  5835. % If page is nothing but text, make it come out even.
  5836. \internalpagesizes{46\baselineskip}{6in}%
  5837. {\voffset}{.25in}%
  5838. {\bindingoffset}{36pt}%
  5839. {11in}{8.5in}%
  5840. }}
  5841. % Use @smallbook to reset parameters for 7x9.5 (or so) format.
  5842. \def\smallbook{{\globaldefs = 1
  5843. \parskip = 2pt plus 1pt
  5844. \textleading = 12pt
  5845. %
  5846. \internalpagesizes{7.5in}{5in}%
  5847. {\voffset}{.25in}%
  5848. {\bindingoffset}{16pt}%
  5849. {9.25in}{7in}%
  5850. %
  5851. \lispnarrowing = 0.3in
  5852. \tolerance = 700
  5853. \hfuzz = 1pt
  5854. \contentsrightmargin = 0pt
  5855. \defbodyindent = .5cm
  5856. }}
  5857. % Use @afourpaper to print on European A4 paper.
  5858. \def\afourpaper{{\globaldefs = 1
  5859. \parskip = 3pt plus 2pt minus 1pt
  5860. \textleading = 13.2pt
  5861. %
  5862. % Double-side printing via postscript on Laserjet 4050
  5863. % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  5864. % To change the settings for a different printer or situation, adjust
  5865. % \normaloffset until the front-side and back-side texts align. Then
  5866. % do the same for \bindingoffset. You can set these for testing in
  5867. % your texinfo source file like this:
  5868. % @tex
  5869. % \global\normaloffset = -6mm
  5870. % \global\bindingoffset = 10mm
  5871. % @end tex
  5872. \internalpagesizes{51\baselineskip}{160mm}
  5873. {\voffset}{\hoffset}%
  5874. {\bindingoffset}{44pt}%
  5875. {297mm}{210mm}%
  5876. %
  5877. \tolerance = 700
  5878. \hfuzz = 1pt
  5879. \contentsrightmargin = 0pt
  5880. \defbodyindent = 5mm
  5881. }}
  5882. % Use @afivepaper to print on European A5 paper.
  5883. % From romildo@urano.iceb.ufop.br, 2 July 2000.
  5884. % He also recommends making @example and @lisp be small.
  5885. \def\afivepaper{{\globaldefs = 1
  5886. \parskip = 2pt plus 1pt minus 0.1pt
  5887. \textleading = 12.5pt
  5888. %
  5889. \internalpagesizes{160mm}{120mm}%
  5890. {\voffset}{\hoffset}%
  5891. {\bindingoffset}{8pt}%
  5892. {210mm}{148mm}%
  5893. %
  5894. \lispnarrowing = 0.2in
  5895. \tolerance = 800
  5896. \hfuzz = 1.2pt
  5897. \contentsrightmargin = 0pt
  5898. \defbodyindent = 2mm
  5899. \tableindent = 12mm
  5900. }}
  5901. % A specific text layout, 24x15cm overall, intended for A4 paper.
  5902. \def\afourlatex{{\globaldefs = 1
  5903. \afourpaper
  5904. \internalpagesizes{237mm}{150mm}%
  5905. {\voffset}{4.6mm}%
  5906. {\bindingoffset}{7mm}%
  5907. {297mm}{210mm}%
  5908. %
  5909. % Must explicitly reset to 0 because we call \afourpaper.
  5910. \globaldefs = 0
  5911. }}
  5912. % Use @afourwide to print on A4 paper in landscape format.
  5913. \def\afourwide{{\globaldefs = 1
  5914. \afourpaper
  5915. \internalpagesizes{241mm}{165mm}%
  5916. {\voffset}{-2.95mm}%
  5917. {\bindingoffset}{7mm}%
  5918. {297mm}{210mm}%
  5919. \globaldefs = 0
  5920. }}
  5921. % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  5922. % Perhaps we should allow setting the margins, \topskip, \parskip,
  5923. % and/or leading, also. Or perhaps we should compute them somehow.
  5924. %
  5925. \def\pagesizes{\parsearg\pagesizesxxx}
  5926. \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
  5927. \def\pagesizesyyy#1,#2,#3\finish{{%
  5928. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  5929. \globaldefs = 1
  5930. %
  5931. \parskip = 3pt plus 2pt minus 1pt
  5932. \setleading{\textleading}%
  5933. %
  5934. \dimen0 = #1
  5935. \advance\dimen0 by \voffset
  5936. %
  5937. \dimen2 = \hsize
  5938. \advance\dimen2 by \normaloffset
  5939. %
  5940. \internalpagesizes{#1}{\hsize}%
  5941. {\voffset}{\normaloffset}%
  5942. {\bindingoffset}{44pt}%
  5943. {\dimen0}{\dimen2}%
  5944. }}
  5945. % Set default to letter.
  5946. %
  5947. \letterpaper
  5948. \message{and turning on texinfo input format.}
  5949. % Define macros to output various characters with catcode for normal text.
  5950. \catcode`\"=\other
  5951. \catcode`\~=\other
  5952. \catcode`\^=\other
  5953. \catcode`\_=\other
  5954. \catcode`\|=\other
  5955. \catcode`\<=\other
  5956. \catcode`\>=\other
  5957. \catcode`\+=\other
  5958. \catcode`\$=\other
  5959. \def\normaldoublequote{"}
  5960. \def\normaltilde{~}
  5961. \def\normalcaret{^}
  5962. \def\normalunderscore{_}
  5963. \def\normalverticalbar{|}
  5964. \def\normalless{<}
  5965. \def\normalgreater{>}
  5966. \def\normalplus{+}
  5967. \def\normaldollar{$}%$ font-lock fix
  5968. % This macro is used to make a character print one way in ttfont
  5969. % where it can probably just be output, and another way in other fonts,
  5970. % where something hairier probably needs to be done.
  5971. %
  5972. % #1 is what to print if we are indeed using \tt; #2 is what to print
  5973. % otherwise. Since all the Computer Modern typewriter fonts have zero
  5974. % interword stretch (and shrink), and it is reasonable to expect all
  5975. % typewriter fonts to have this, we can check that font parameter.
  5976. %
  5977. \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
  5978. % Same as above, but check for italic font. Actually this also catches
  5979. % non-italic slanted fonts since it is impossible to distinguish them from
  5980. % italic fonts. But since this is only used by $ and it uses \sl anyway
  5981. % this is not a problem.
  5982. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
  5983. % Turn off all special characters except @
  5984. % (and those which the user can use as if they were ordinary).
  5985. % Most of these we simply print from the \tt font, but for some, we can
  5986. % use math or other variants that look better in normal text.
  5987. \catcode`\"=\active
  5988. \def\activedoublequote{{\tt\char34}}
  5989. \let"=\activedoublequote
  5990. \catcode`\~=\active
  5991. \def~{{\tt\char126}}
  5992. \chardef\hat=`\^
  5993. \catcode`\^=\active
  5994. \def^{{\tt \hat}}
  5995. \catcode`\_=\active
  5996. \def_{\ifusingtt\normalunderscore\_}
  5997. % Subroutine for the previous macro.
  5998. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
  5999. \catcode`\|=\active
  6000. \def|{{\tt\char124}}
  6001. \chardef \less=`\<
  6002. \catcode`\<=\active
  6003. \def<{{\tt \less}}
  6004. \chardef \gtr=`\>
  6005. \catcode`\>=\active
  6006. \def>{{\tt \gtr}}
  6007. \catcode`\+=\active
  6008. \def+{{\tt \char 43}}
  6009. \catcode`\$=\active
  6010. \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  6011. % Set up an active definition for =, but don't enable it most of the time.
  6012. {\catcode`\==\active
  6013. \global\def={{\tt \char 61}}}
  6014. \catcode`+=\active
  6015. \catcode`\_=\active
  6016. % If a .fmt file is being used, characters that might appear in a file
  6017. % name cannot be active until we have parsed the command line.
  6018. % So turn them off again, and have \everyjob (or @setfilename) turn them on.
  6019. % \otherifyactive is called near the end of this file.
  6020. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
  6021. \catcode`\@=0
  6022. % \rawbackslashxx outputs one backslash character in current font,
  6023. % as in \char`\\.
  6024. \global\chardef\rawbackslashxx=`\\
  6025. % \rawbackslash defines an active \ to do \rawbackslashxx.
  6026. % \otherbackslash defines an active \ to be a literal `\' character with
  6027. % catcode other.
  6028. {\catcode`\\=\active
  6029. @gdef@rawbackslash{@let\=@rawbackslashxx}
  6030. @gdef@otherbackslash{@let\=@realbackslash}
  6031. }
  6032. % \realbackslash is an actual character `\' with catcode other.
  6033. {\catcode`\\=\other @gdef@realbackslash{\}}
  6034. % \normalbackslash outputs one backslash in fixed width font.
  6035. \def\normalbackslash{{\tt\rawbackslashxx}}
  6036. \catcode`\\=\active
  6037. % Used sometimes to turn off (effectively) the active characters
  6038. % even after parsing them.
  6039. @def@turnoffactive{%
  6040. @let"=@normaldoublequote
  6041. @let\=@realbackslash
  6042. @let~=@normaltilde
  6043. @let^=@normalcaret
  6044. @let_=@normalunderscore
  6045. @let|=@normalverticalbar
  6046. @let<=@normalless
  6047. @let>=@normalgreater
  6048. @let+=@normalplus
  6049. @let$=@normaldollar %$ font-lock fix
  6050. }
  6051. % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  6052. % the literal character `\'. (Thus, \ is not expandable when this is in
  6053. % effect.)
  6054. %
  6055. @def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
  6056. % Make _ and + \other characters, temporarily.
  6057. % This is canceled by @fixbackslash.
  6058. @otherifyactive
  6059. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  6060. % That is what \eatinput is for; after that, the `\' should revert to printing
  6061. % a backslash.
  6062. %
  6063. @gdef@eatinput input texinfo{@fixbackslash}
  6064. @global@let\ = @eatinput
  6065. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  6066. % the first `\{ in the file would cause an error. This macro tries to fix
  6067. % that, assuming it is called before the first `\' could plausibly occur.
  6068. % Also back turn on active characters that might appear in the input
  6069. % file name, in case not using a pre-dumped format.
  6070. %
  6071. @gdef@fixbackslash{%
  6072. @ifx\@eatinput @let\ = @normalbackslash @fi
  6073. @catcode`+=@active
  6074. @catcode`@_=@active
  6075. }
  6076. % Say @foo, not \foo, in error messages.
  6077. @escapechar = `@@
  6078. % These look ok in all fonts, so just make them not special.
  6079. @catcode`@& = @other
  6080. @catcode`@# = @other
  6081. @catcode`@% = @other
  6082. @c Set initial fonts.
  6083. @textfonts
  6084. @rm
  6085. @c Local variables:
  6086. @c eval: (add-hook 'write-file-hooks 'time-stamp)
  6087. @c page-delimiter: "^\\\\message"
  6088. @c time-stamp-start: "def\\\\texinfoversion{"
  6089. @c time-stamp-format: "%:y-%02m-%02d.%02H"
  6090. @c time-stamp-end: "}"
  6091. @c End: