texinfo.tex 234 KB

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