texinfo.tex 288 KB

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