texinfo.tex 374 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724
  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{2016-08-16.20}
  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, 2010, 2011, 2012, 2013, 2014, 2015, 2016
  11. % Free Software Foundation, Inc.
  12. %
  13. % This texinfo.tex file is free software: you can redistribute it and/or
  14. % modify it under the terms of the GNU General Public License as
  15. % published by the Free Software Foundation, either version 3 of the
  16. % License, or (at your option) any later version.
  17. %
  18. % This texinfo.tex file is distributed in the hope that it will be
  19. % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  20. % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. % General Public License for more details.
  22. %
  23. % You should have received a copy of the GNU General Public License
  24. % along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. %
  26. % As a special exception, when this file is read by TeX when processing
  27. % a Texinfo source document, you may use the result without
  28. % restriction. This Exception is an additional permission under section 7
  29. % of the GNU General Public License, version 3 ("GPLv3").
  30. %
  31. % Please try the latest version of texinfo.tex before submitting bug
  32. % reports; you can get the latest version from:
  33. % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
  34. % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
  35. % http://www.gnu.org/software/texinfo/ (the Texinfo home page)
  36. % The texinfo.tex in any given distribution could well be out
  37. % of date, so if that's what you're using, please check.
  38. %
  39. % Send bug reports to bug-texinfo@gnu.org. Please include including a
  40. % complete document in each bug report with which we can reproduce the
  41. % problem. Patches are, of course, greatly appreciated.
  42. %
  43. % To process a Texinfo manual with TeX, it's most reliable to use the
  44. % texi2dvi shell script that comes with the distribution. For a simple
  45. % manual foo.texi, however, you can get away with this:
  46. % tex foo.texi
  47. % texindex foo.??
  48. % tex foo.texi
  49. % tex foo.texi
  50. % dvips foo.dvi -o # or whatever; this makes foo.ps.
  51. % The extra TeX runs get the cross-reference information correct.
  52. % Sometimes one run after texindex suffices, and sometimes you need more
  53. % than two; texi2dvi does it as many times as necessary.
  54. %
  55. % It is possible to adapt texinfo.tex for other languages, to some
  56. % extent. You can get the existing language-specific files from the
  57. % full Texinfo distribution.
  58. %
  59. % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
  60. \message{Loading texinfo [version \texinfoversion]:}
  61. % If in a .fmt file, print the version number
  62. % and turn on active characters that we couldn't do earlier because
  63. % they might have appeared in the input file name.
  64. \everyjob{\message{[Texinfo version \texinfoversion]}%
  65. \catcode`+=\active \catcode`\_=\active}
  66. % LaTeX's \typeout. This ensures that the messages it is used for
  67. % are identical in format to the corresponding ones from latex/pdflatex.
  68. \def\typeout{\immediate\write17}%
  69. \chardef\other=12
  70. % We never want plain's \outer definition of \+ in Texinfo.
  71. % For @tex, we can use \tabalign.
  72. \let\+ = \relax
  73. % Save some plain tex macros whose names we will redefine.
  74. \let\ptexb=\b
  75. \let\ptexbullet=\bullet
  76. \let\ptexc=\c
  77. \let\ptexcomma=\,
  78. \let\ptexdot=\.
  79. \let\ptexdots=\dots
  80. \let\ptexend=\end
  81. \let\ptexequiv=\equiv
  82. \let\ptexexclam=\!
  83. \let\ptexfootnote=\footnote
  84. \let\ptexgtr=>
  85. \let\ptexhat=^
  86. \let\ptexi=\i
  87. \let\ptexindent=\indent
  88. \let\ptexinsert=\insert
  89. \let\ptexlbrace=\{
  90. \let\ptexless=<
  91. \let\ptexnewwrite\newwrite
  92. \let\ptexnoindent=\noindent
  93. \let\ptexplus=+
  94. \let\ptexraggedright=\raggedright
  95. \let\ptexrbrace=\}
  96. \let\ptexslash=\/
  97. \let\ptexsp=\sp
  98. \let\ptexstar=\*
  99. \let\ptexsup=\sup
  100. \let\ptext=\t
  101. \let\ptextop=\top
  102. {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
  103. % If this character appears in an error message or help string, it
  104. % starts a new line in the output.
  105. \newlinechar = `^^J
  106. % Use TeX 3.0's \inputlineno to get the line number, for better error
  107. % messages, but if we're using an old version of TeX, don't do anything.
  108. %
  109. \ifx\inputlineno\thisisundefined
  110. \let\linenumber = \empty % Pre-3.0.
  111. \else
  112. \def\linenumber{l.\the\inputlineno:\space}
  113. \fi
  114. % Set up fixed words for English if not already set.
  115. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
  116. \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
  117. \ifx\putworderror\undefined \gdef\putworderror{error}\fi
  118. \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
  119. \ifx\putwordin\undefined \gdef\putwordin{in}\fi
  120. \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
  121. \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
  122. \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
  123. \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
  124. \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
  125. \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
  126. \ifx\putwordof\undefined \gdef\putwordof{of}\fi
  127. \ifx\putwordon\undefined \gdef\putwordon{on}\fi
  128. \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
  129. \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
  130. \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
  131. \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
  132. \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
  133. \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
  134. \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
  135. %
  136. \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
  137. \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
  138. \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
  139. \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
  140. \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
  141. \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
  142. \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
  143. \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
  144. \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
  145. \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
  146. \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
  147. \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
  148. %
  149. \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
  150. \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
  151. \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
  152. \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
  153. \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
  154. % Give the space character the catcode for a space.
  155. \def\spaceisspace{\catcode`\ =10\relax}
  156. \chardef\dashChar = `\-
  157. \chardef\slashChar = `\/
  158. \chardef\underChar = `\_
  159. % Ignore a token.
  160. %
  161. \def\gobble#1{}
  162. % The following is used inside several \edef's.
  163. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
  164. % Hyphenation fixes.
  165. \hyphenation{
  166. Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
  167. ap-pen-dix bit-map bit-maps
  168. data-base data-bases eshell fall-ing half-way long-est man-u-script
  169. man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
  170. par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
  171. spell-ing spell-ings
  172. stand-alone strong-est time-stamp time-stamps which-ever white-space
  173. wide-spread wrap-around
  174. }
  175. % Sometimes it is convenient to have everything in the transcript file
  176. % and nothing on the terminal. We don't just call \tracingall here,
  177. % since that produces some useless output on the terminal. We also make
  178. % some effort to order the tracing commands to reduce output in the log
  179. % file; cf. trace.sty in LaTeX.
  180. %
  181. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  182. \def\loggingall{%
  183. \tracingstats2
  184. \tracingpages1
  185. \tracinglostchars2 % 2 gives us more in etex
  186. \tracingparagraphs1
  187. \tracingoutput1
  188. \tracingmacros2
  189. \tracingrestores1
  190. \showboxbreadth\maxdimen \showboxdepth\maxdimen
  191. \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
  192. \tracingscantokens1
  193. \tracingifs1
  194. \tracinggroups1
  195. \tracingnesting2
  196. \tracingassigns1
  197. \fi
  198. \tracingcommands3 % 3 gives us more in etex
  199. \errorcontextlines16
  200. }%
  201. % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
  202. % aren't perfect, it's not the end of the world, being an error message,
  203. % after all.
  204. %
  205. \def\errormsg{\begingroup \indexnofonts \doerrormsg}
  206. \def\doerrormsg#1{\errmessage{#1}}
  207. % add check for \lastpenalty to plain's definitions. If the last thing
  208. % we did was a \nobreak, we don't want to insert more space.
  209. %
  210. \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  211. \removelastskip\penalty-50\smallskip\fi\fi}
  212. \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  213. \removelastskip\penalty-100\medskip\fi\fi}
  214. \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  215. \removelastskip\penalty-200\bigskip\fi\fi}
  216. % Output routine
  217. %
  218. % For a final copy, take out the rectangles
  219. % that mark overfull boxes (in case you have decided
  220. % that the text looks ok even though it passes the margin).
  221. %
  222. \def\finalout{\overfullrule=0pt }
  223. % Do @cropmarks to get crop marks.
  224. %
  225. \newif\ifcropmarks
  226. \let\cropmarks = \cropmarkstrue
  227. %
  228. % Dimensions to add cropmarks at corners.
  229. % Added by P. A. MacKay, 12 Nov. 1986
  230. %
  231. \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  232. \newdimen\cornerlong \cornerlong=1pc
  233. \newdimen\cornerthick \cornerthick=.3pt
  234. \newdimen\topandbottommargin \topandbottommargin=.75in
  235. % Output a mark which sets \thischapter, \thissection and \thiscolor.
  236. % We dump everything together because we only have one kind of mark.
  237. % This works because we only use \botmark / \topmark, not \firstmark.
  238. %
  239. % A mark contains a subexpression of the \ifcase ... \fi construct.
  240. % \get*marks macros below extract the needed part using \ifcase.
  241. %
  242. % Another complication is to let the user choose whether \thischapter
  243. % (\thissection) refers to the chapter (section) in effect at the top
  244. % of a page, or that at the bottom of a page.
  245. % \domark is called twice inside \chapmacro, to add one
  246. % mark before the section break, and one after.
  247. % In the second call \prevchapterdefs is the same as \lastchapterdefs,
  248. % and \prevsectiondefs is the same as \lastsectiondefs.
  249. % Then if the page is not broken at the mark, some of the previous
  250. % section appears on the page, and we can get the name of this section
  251. % from \firstmark for @everyheadingmarks top.
  252. % @everyheadingmarks bottom uses \botmark.
  253. %
  254. % See page 260 of The TeXbook.
  255. \def\domark{%
  256. \toks0=\expandafter{\lastchapterdefs}%
  257. \toks2=\expandafter{\lastsectiondefs}%
  258. \toks4=\expandafter{\prevchapterdefs}%
  259. \toks6=\expandafter{\prevsectiondefs}%
  260. \toks8=\expandafter{\lastcolordefs}%
  261. \mark{%
  262. \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
  263. \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
  264. \noexpand\else \the\toks8 % 2: color marks
  265. }%
  266. }
  267. % \gettopheadingmarks, \getbottomheadingmarks,
  268. % \getcolormarks - extract needed part of mark.
  269. %
  270. % \topmark doesn't work for the very first chapter (after the title
  271. % page or the contents), so we use \firstmark there -- this gets us
  272. % the mark with the chapter defs, unless the user sneaks in, e.g.,
  273. % @setcolor (or @url, or @link, etc.) between @contents and the very
  274. % first @chapter.
  275. \def\gettopheadingmarks{%
  276. \ifcase0\topmark\fi
  277. \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
  278. }
  279. \def\getbottomheadingmarks{\ifcase1\botmark\fi}
  280. \def\getcolormarks{\ifcase2\topmark\fi}
  281. % Avoid "undefined control sequence" errors.
  282. \def\lastchapterdefs{}
  283. \def\lastsectiondefs{}
  284. \def\lastsection{}
  285. \def\prevchapterdefs{}
  286. \def\prevsectiondefs{}
  287. \def\lastcolordefs{}
  288. % Margin to add to right of even pages, to left of odd pages.
  289. \newdimen\bindingoffset
  290. \newdimen\normaloffset
  291. \newdimen\txipagewidth \newdimen\txipageheight
  292. % Main output routine.
  293. %
  294. \chardef\PAGE = 255
  295. \output = {\onepageout{\pagecontents\PAGE}}
  296. \newbox\headlinebox
  297. \newbox\footlinebox
  298. % \onepageout takes a vbox as an argument.
  299. % \shipout a vbox for a single page, adding an optional header, footer,
  300. % cropmarks, and footnote. This also causes index entries for this page
  301. % to be written to the auxiliary files.
  302. %
  303. \def\onepageout#1{%
  304. \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  305. %
  306. \ifodd\pageno \advance\hoffset by \bindingoffset
  307. \else \advance\hoffset by -\bindingoffset\fi
  308. %
  309. % Common context changes for both heading and footing.
  310. % Do this outside of the \shipout so @code etc. will be expanded in
  311. % the headline as they should be, not taken literally (outputting ''code).
  312. \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
  313. %
  314. % Retrieve the information for the headings from the marks in the page,
  315. % and call Plain TeX's \makeheadline and \makefootline, which use the
  316. % values in \headline and \footline.
  317. %
  318. % This is used to check if we are on the first page of a chapter.
  319. \ifcase1\topmark\fi
  320. \let\prevchaptername\thischaptername
  321. \ifcase0\firstmark\fi
  322. \let\curchaptername\thischaptername
  323. %
  324. \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
  325. \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
  326. %
  327. \ifx\curchaptername\prevchaptername
  328. \let\thischapterheading\thischapter
  329. \else
  330. % \thischapterheading is the same as \thischapter except it is blank
  331. % for the first page of a chapter. This is to prevent the chapter name
  332. % being shown twice.
  333. \def\thischapterheading{}%
  334. \fi
  335. %
  336. \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
  337. \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
  338. %
  339. {%
  340. % Set context for writing to auxiliary files like index files.
  341. % Have to do this stuff outside the \shipout because we want it to
  342. % take effect in \write's, yet the group defined by the \vbox ends
  343. % before the \shipout runs.
  344. %
  345. \indexdummies % don't expand commands in the output.
  346. \normalturnoffactive % \ in index entries must not stay \, e.g., if
  347. % the page break happens to be in the middle of an example.
  348. % We don't want .vr (or whatever) entries like this:
  349. % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
  350. % "\acronym" won't work when it's read back in;
  351. % it needs to be
  352. % {\code {{\backslashcurfont }acronym}
  353. \shipout\vbox{%
  354. % Do this early so pdf references go to the beginning of the page.
  355. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
  356. %
  357. \ifcropmarks \vbox to \outervsize\bgroup
  358. \hsize = \outerhsize
  359. \vskip-\topandbottommargin
  360. \vtop to0pt{%
  361. \line{\ewtop\hfil\ewtop}%
  362. \nointerlineskip
  363. \line{%
  364. \vbox{\moveleft\cornerthick\nstop}%
  365. \hfill
  366. \vbox{\moveright\cornerthick\nstop}%
  367. }%
  368. \vss}%
  369. \vskip\topandbottommargin
  370. \line\bgroup
  371. \hfil % center the page within the outer (page) hsize.
  372. \ifodd\pageno\hskip\bindingoffset\fi
  373. \vbox\bgroup
  374. \fi
  375. %
  376. \unvbox\headlinebox
  377. \pagebody{#1}%
  378. \ifdim\ht\footlinebox > 0pt
  379. % Only leave this space if the footline is nonempty.
  380. % (We lessened \vsize for it in \oddfootingyyy.)
  381. % The \baselineskip=24pt in plain's \makefootline has no effect.
  382. \vskip 24pt
  383. \unvbox\footlinebox
  384. \fi
  385. %
  386. \ifcropmarks
  387. \egroup % end of \vbox\bgroup
  388. \hfil\egroup % end of (centering) \line\bgroup
  389. \vskip\topandbottommargin plus1fill minus1fill
  390. \boxmaxdepth = \cornerthick
  391. \vbox to0pt{\vss
  392. \line{%
  393. \vbox{\moveleft\cornerthick\nsbot}%
  394. \hfill
  395. \vbox{\moveright\cornerthick\nsbot}%
  396. }%
  397. \nointerlineskip
  398. \line{\ewbot\hfil\ewbot}%
  399. }%
  400. \egroup % \vbox from first cropmarks clause
  401. \fi
  402. }% end of \shipout\vbox
  403. }% end of group with \indexdummies
  404. \advancepageno
  405. \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  406. }
  407. \newinsert\margin \dimen\margin=\maxdimen
  408. % Main part of page, including any footnotes
  409. \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
  410. {\catcode`\@ =11
  411. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  412. % marginal hacks, juha@viisa.uucp (Juha Takala)
  413. \ifvoid\margin\else % marginal info is present
  414. \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  415. \dimen@=\dp#1\relax \unvbox#1\relax
  416. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  417. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  418. }
  419. % Here are the rules for the cropmarks. Note that they are
  420. % offset so that the space between them is truly \outerhsize or \outervsize
  421. % (P. A. MacKay, 12 November, 1986)
  422. %
  423. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  424. \def\nstop{\vbox
  425. {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  426. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  427. \def\nsbot{\vbox
  428. {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  429. % Argument parsing
  430. % Parse an argument, then pass it to #1. The argument is the rest of
  431. % the input line (except we remove a trailing comment). #1 should be a
  432. % macro which expects an ordinary undelimited TeX argument.
  433. % For example, \def\foo{\parsearg\fooxxx}.
  434. %
  435. \def\parsearg{\parseargusing{}}
  436. \def\parseargusing#1#2{%
  437. \def\argtorun{#2}%
  438. \begingroup
  439. \obeylines
  440. \spaceisspace
  441. #1%
  442. \parseargline\empty% Insert the \empty token, see \finishparsearg below.
  443. }
  444. {\obeylines %
  445. \gdef\parseargline#1^^M{%
  446. \endgroup % End of the group started in \parsearg.
  447. \argremovecomment #1\comment\ArgTerm%
  448. }%
  449. }
  450. % First remove any @comment, then any @c comment. Also remove a @texinfoc
  451. % comment (see \scanmacro for details). Pass the result on to \argcheckspaces.
  452. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
  453. \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
  454. \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
  455. % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
  456. %
  457. % \argremovec might leave us with trailing space, e.g.,
  458. % @end itemize @c foo
  459. % This space token undergoes the same procedure and is eventually removed
  460. % by \finishparsearg.
  461. %
  462. \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
  463. \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
  464. \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
  465. \def\temp{#3}%
  466. \ifx\temp\empty
  467. % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
  468. \let\temp\finishparsearg
  469. \else
  470. \let\temp\argcheckspaces
  471. \fi
  472. % Put the space token in:
  473. \temp#1 #3\ArgTerm
  474. }
  475. % If a _delimited_ argument is enclosed in braces, they get stripped; so
  476. % to get _exactly_ the rest of the line, we had to prevent such situation.
  477. % We prepended an \empty token at the very beginning and we expand it now,
  478. % just before passing the control to \argtorun.
  479. % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
  480. % either the null string, or it ends with \^^M---thus there is no danger
  481. % that a pair of braces would be stripped.
  482. %
  483. % But first, we have to remove the trailing space token.
  484. %
  485. \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
  486. % \parseargdef - define a command taking an argument on the line
  487. %
  488. % \parseargdef\foo{...}
  489. % is roughly equivalent to
  490. % \def\foo{\parsearg\Xfoo}
  491. % \def\Xfoo#1{...}
  492. \def\parseargdef#1{%
  493. \expandafter \doparseargdef \csname\string#1\endcsname #1%
  494. }
  495. \def\doparseargdef#1#2{%
  496. \def#2{\parsearg#1}%
  497. \def#1##1%
  498. }
  499. % Several utility definitions with active space:
  500. {
  501. \obeyspaces
  502. \gdef\obeyedspace{ }
  503. % Make each space character in the input produce a normal interword
  504. % space in the output. Don't allow a line break at this space, as this
  505. % is used only in environments like @example, where each line of input
  506. % should produce a line of output anyway.
  507. %
  508. \gdef\sepspaces{\obeyspaces\let =\tie}
  509. % If an index command is used in an @example environment, any spaces
  510. % therein should become regular spaces in the raw index file, not the
  511. % expansion of \tie (\leavevmode \penalty \@M \ ).
  512. \gdef\unsepspaces{\let =\space}
  513. }
  514. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  515. % Define the framework for environments in texinfo.tex. It's used like this:
  516. %
  517. % \envdef\foo{...}
  518. % \def\Efoo{...}
  519. %
  520. % It's the responsibility of \envdef to insert \begingroup before the
  521. % actual body; @end closes the group after calling \Efoo. \envdef also
  522. % defines \thisenv, so the current environment is known; @end checks
  523. % whether the environment name matches. The \checkenv macro can also be
  524. % used to check whether the current environment is the one expected.
  525. %
  526. % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
  527. % are not treated as environments; they don't open a group. (The
  528. % implementation of @end takes care not to call \endgroup in this
  529. % special case.)
  530. % At run-time, environments start with this:
  531. \def\startenvironment#1{\begingroup\def\thisenv{#1}}
  532. % initialize
  533. \let\thisenv\empty
  534. % ... but they get defined via ``\envdef\foo{...}'':
  535. \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
  536. \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
  537. % Check whether we're in the right environment:
  538. \def\checkenv#1{%
  539. \def\temp{#1}%
  540. \ifx\thisenv\temp
  541. \else
  542. \badenverr
  543. \fi
  544. }
  545. % Environment mismatch, #1 expected:
  546. \def\badenverr{%
  547. \errhelp = \EMsimple
  548. \errmessage{This command can appear only \inenvironment\temp,
  549. not \inenvironment\thisenv}%
  550. }
  551. \def\inenvironment#1{%
  552. \ifx#1\empty
  553. outside of any environment%
  554. \else
  555. in environment \expandafter\string#1%
  556. \fi
  557. }
  558. % @end foo executes the definition of \Efoo.
  559. % But first, it executes a specialized version of \checkenv
  560. %
  561. \parseargdef\end{%
  562. \if 1\csname iscond.#1\endcsname
  563. \else
  564. % The general wording of \badenverr may not be ideal.
  565. \expandafter\checkenv\csname#1\endcsname
  566. \csname E#1\endcsname
  567. \endgroup
  568. \fi
  569. }
  570. \newhelp\EMsimple{Press RETURN to continue.}
  571. % Be sure we're in horizontal mode when doing a tie, since we make space
  572. % equivalent to this in @example-like environments. Otherwise, a space
  573. % at the beginning of a line will start with \penalty -- and
  574. % since \penalty is valid in vertical mode, we'd end up putting the
  575. % penalty on the vertical list instead of in the new paragraph.
  576. {\catcode`@ = 11
  577. % Avoid using \@M directly, because that causes trouble
  578. % if the definition is written into an index file.
  579. \global\let\tiepenalty = \@M
  580. \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  581. }
  582. % @: forces normal size whitespace following.
  583. \def\:{\spacefactor=1000 }
  584. % @* forces a line break.
  585. \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
  586. % @/ allows a line break.
  587. \let\/=\allowbreak
  588. % @. is an end-of-sentence period.
  589. \def\.{.\spacefactor=\endofsentencespacefactor\space}
  590. % @! is an end-of-sentence bang.
  591. \def\!{!\spacefactor=\endofsentencespacefactor\space}
  592. % @? is an end-of-sentence query.
  593. \def\?{?\spacefactor=\endofsentencespacefactor\space}
  594. % @frenchspacing on|off says whether to put extra space after punctuation.
  595. %
  596. \def\onword{on}
  597. \def\offword{off}
  598. %
  599. \parseargdef\frenchspacing{%
  600. \def\temp{#1}%
  601. \ifx\temp\onword \plainfrenchspacing
  602. \else\ifx\temp\offword \plainnonfrenchspacing
  603. \else
  604. \errhelp = \EMsimple
  605. \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
  606. \fi\fi
  607. }
  608. % @w prevents a word break. Without the \leavevmode, @w at the
  609. % beginning of a paragraph, when TeX is still in vertical mode, would
  610. % produce a whole line of output instead of starting the paragraph.
  611. \def\w#1{\leavevmode\hbox{#1}}
  612. % @group ... @end group forces ... to be all on one page, by enclosing
  613. % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
  614. % to keep its height that of a normal line. According to the rules for
  615. % \topskip (p.114 of the TeXbook), the glue inserted is
  616. % max (\topskip - \ht (first item), 0). If that height is large,
  617. % therefore, no glue is inserted, and the space between the headline and
  618. % the text is small, which looks bad.
  619. %
  620. % Another complication is that the group might be very large. This can
  621. % cause the glue on the previous page to be unduly stretched, because it
  622. % does not have much material. In this case, it's better to add an
  623. % explicit \vfill so that the extra space is at the bottom. The
  624. % threshold for doing this is if the group is more than \vfilllimit
  625. % percent of a page (\vfilllimit can be changed inside of @tex).
  626. %
  627. \newbox\groupbox
  628. \def\vfilllimit{0.7}
  629. %
  630. \envdef\group{%
  631. \ifnum\catcode`\^^M=\active \else
  632. \errhelp = \groupinvalidhelp
  633. \errmessage{@group invalid in context where filling is enabled}%
  634. \fi
  635. \startsavinginserts
  636. %
  637. \setbox\groupbox = \vtop\bgroup
  638. % Do @comment since we are called inside an environment such as
  639. % @example, where each end-of-line in the input causes an
  640. % end-of-line in the output. We don't want the end-of-line after
  641. % the `@group' to put extra space in the output. Since @group
  642. % should appear on a line by itself (according to the Texinfo
  643. % manual), we don't worry about eating any user text.
  644. \comment
  645. }
  646. %
  647. % The \vtop produces a box with normal height and large depth; thus, TeX puts
  648. % \baselineskip glue before it, and (when the next line of text is done)
  649. % \lineskip glue after it. Thus, space below is not quite equal to space
  650. % above. But it's pretty close.
  651. \def\Egroup{%
  652. % To get correct interline space between the last line of the group
  653. % and the first line afterwards, we have to propagate \prevdepth.
  654. \endgraf % Not \par, as it may have been set to \lisppar.
  655. \global\dimen1 = \prevdepth
  656. \egroup % End the \vtop.
  657. \addgroupbox
  658. \prevdepth = \dimen1
  659. \checkinserts
  660. }
  661. \def\addgroupbox{
  662. % \dimen0 is the vertical size of the group's box.
  663. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
  664. % \dimen2 is how much space is left on the page (more or less).
  665. \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
  666. % if the group doesn't fit on the current page, and it's a big big
  667. % group, force a page break.
  668. \ifdim \dimen0 > \dimen2
  669. \ifdim \pagetotal < \vfilllimit\txipageheight
  670. \page
  671. \fi
  672. \fi
  673. \box\groupbox
  674. }
  675. %
  676. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  677. % message, so this ends up printing `@group can only ...'.
  678. %
  679. \newhelp\groupinvalidhelp{%
  680. group can only be used in environments such as @example,^^J%
  681. where each line of input produces a line of output.}
  682. % @need space-in-mils
  683. % forces a page break if there is not space-in-mils remaining.
  684. \newdimen\mil \mil=0.001in
  685. \parseargdef\need{%
  686. % Ensure vertical mode, so we don't make a big box in the middle of a
  687. % paragraph.
  688. \par
  689. %
  690. % If the @need value is less than one line space, it's useless.
  691. \dimen0 = #1\mil
  692. \dimen2 = \ht\strutbox
  693. \advance\dimen2 by \dp\strutbox
  694. \ifdim\dimen0 > \dimen2
  695. %
  696. % Do a \strut just to make the height of this box be normal, so the
  697. % normal leading is inserted relative to the preceding line.
  698. % And a page break here is fine.
  699. \vtop to #1\mil{\strut\vfil}%
  700. %
  701. % TeX does not even consider page breaks if a penalty added to the
  702. % main vertical list is 10000 or more. But in order to see if the
  703. % empty box we just added fits on the page, we must make it consider
  704. % page breaks. On the other hand, we don't want to actually break the
  705. % page after the empty box. So we use a penalty of 9999.
  706. %
  707. % There is an extremely small chance that TeX will actually break the
  708. % page at this \penalty, if there are no other feasible breakpoints in
  709. % sight. (If the user is using lots of big @group commands, which
  710. % almost-but-not-quite fill up a page, TeX will have a hard time doing
  711. % good page breaking, for example.) However, I could not construct an
  712. % example where a page broke at this \penalty; if it happens in a real
  713. % document, then we can reconsider our strategy.
  714. \penalty9999
  715. %
  716. % Back up by the size of the box, whether we did a page break or not.
  717. \kern -#1\mil
  718. %
  719. % Do not allow a page break right after this kern.
  720. \nobreak
  721. \fi
  722. }
  723. % @br forces paragraph break (and is undocumented).
  724. \let\br = \par
  725. % @page forces the start of a new page.
  726. %
  727. \def\page{\par\vfill\supereject}
  728. % @exdent text....
  729. % outputs text on separate line in roman font, starting at standard page margin
  730. % This records the amount of indent in the innermost environment.
  731. % That's how much \exdent should take out.
  732. \newskip\exdentamount
  733. % This defn is used inside fill environments such as @defun.
  734. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
  735. % This defn is used inside nofill environments such as @example.
  736. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
  737. \leftline{\hskip\leftskip{\rm#1}}}}
  738. % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
  739. % paragraph. For more general purposes, use the \margin insertion
  740. % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
  741. %
  742. \newskip\inmarginspacing \inmarginspacing=1cm
  743. \def\strutdepth{\dp\strutbox}
  744. %
  745. \def\doinmargin#1#2{\strut\vadjust{%
  746. \nobreak
  747. \kern-\strutdepth
  748. \vtop to \strutdepth{%
  749. \baselineskip=\strutdepth
  750. \vss
  751. % if you have multiple lines of stuff to put here, you'll need to
  752. % make the vbox yourself of the appropriate size.
  753. \ifx#1l%
  754. \llap{\ignorespaces #2\hskip\inmarginspacing}%
  755. \else
  756. \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
  757. \fi
  758. \null
  759. }%
  760. }}
  761. \def\inleftmargin{\doinmargin l}
  762. \def\inrightmargin{\doinmargin r}
  763. %
  764. % @inmargin{TEXT [, RIGHT-TEXT]}
  765. % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  766. % else use TEXT for both).
  767. %
  768. \def\inmargin#1{\parseinmargin #1,,\finish}
  769. \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  770. \setbox0 = \hbox{\ignorespaces #2}%
  771. \ifdim\wd0 > 0pt
  772. \def\lefttext{#1}% have both texts
  773. \def\righttext{#2}%
  774. \else
  775. \def\lefttext{#1}% have only one text
  776. \def\righttext{#1}%
  777. \fi
  778. %
  779. \ifodd\pageno
  780. \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  781. \else
  782. \def\temp{\inleftmargin\lefttext}%
  783. \fi
  784. \temp
  785. }
  786. % @| inserts a changebar to the left of the current line. It should
  787. % surround any changed text. This approach does *not* work if the
  788. % change spans more than two lines of output. To handle that, we would
  789. % have adopt a much more difficult approach (putting marks into the main
  790. % vertical list for the beginning and end of each change). This command
  791. % is not documented, not supported, and doesn't work.
  792. %
  793. \def\|{%
  794. % \vadjust can only be used in horizontal mode.
  795. \leavevmode
  796. %
  797. % Append this vertical mode material after the current line in the output.
  798. \vadjust{%
  799. % We want to insert a rule with the height and depth of the current
  800. % leading; that is exactly what \strutbox is supposed to record.
  801. \vskip-\baselineskip
  802. %
  803. % \vadjust-items are inserted at the left edge of the type. So
  804. % the \llap here moves out into the left-hand margin.
  805. \llap{%
  806. %
  807. % For a thicker or thinner bar, change the `1pt'.
  808. \vrule height\baselineskip width1pt
  809. %
  810. % This is the space between the bar and the text.
  811. \hskip 12pt
  812. }%
  813. }%
  814. }
  815. % @include FILE -- \input text of FILE.
  816. %
  817. \def\include{\parseargusing\filenamecatcodes\includezzz}
  818. \def\includezzz#1{%
  819. \pushthisfilestack
  820. \def\thisfile{#1}%
  821. {%
  822. \makevalueexpandable % we want to expand any @value in FILE.
  823. \turnoffactive % and allow special characters in the expansion
  824. \indexnofonts % Allow `@@' and other weird things in file names.
  825. \wlog{texinfo.tex: doing @include of #1^^J}%
  826. \edef\temp{\noexpand\input #1 }%
  827. %
  828. % This trickery is to read FILE outside of a group, in case it makes
  829. % definitions, etc.
  830. \expandafter
  831. }\temp
  832. \popthisfilestack
  833. }
  834. \def\filenamecatcodes{%
  835. \catcode`\\=\other
  836. \catcode`~=\other
  837. \catcode`^=\other
  838. \catcode`_=\other
  839. \catcode`|=\other
  840. \catcode`<=\other
  841. \catcode`>=\other
  842. \catcode`+=\other
  843. \catcode`-=\other
  844. \catcode`\`=\other
  845. \catcode`\'=\other
  846. }
  847. \def\pushthisfilestack{%
  848. \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
  849. }
  850. \def\pushthisfilestackX{%
  851. \expandafter\pushthisfilestackY\thisfile\StackTerm
  852. }
  853. \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
  854. \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
  855. }
  856. \def\popthisfilestack{\errthisfilestackempty}
  857. \def\errthisfilestackempty{\errmessage{Internal error:
  858. the stack of filenames is empty.}}
  859. %
  860. \def\thisfile{}
  861. % @center line
  862. % outputs that line, centered.
  863. %
  864. \parseargdef\center{%
  865. \ifhmode
  866. \let\centersub\centerH
  867. \else
  868. \let\centersub\centerV
  869. \fi
  870. \centersub{\hfil \ignorespaces#1\unskip \hfil}%
  871. \let\centersub\relax % don't let the definition persist, just in case
  872. }
  873. \def\centerH#1{{%
  874. \hfil\break
  875. \advance\hsize by -\leftskip
  876. \advance\hsize by -\rightskip
  877. \line{#1}%
  878. \break
  879. }}
  880. %
  881. \newcount\centerpenalty
  882. \def\centerV#1{%
  883. % The idea here is the same as in \startdefun, \cartouche, etc.: if
  884. % @center is the first thing after a section heading, we need to wipe
  885. % out the negative parskip inserted by \sectionheading, but still
  886. % prevent a page break here.
  887. \centerpenalty = \lastpenalty
  888. \ifnum\centerpenalty>10000 \vskip\parskip \fi
  889. \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
  890. \line{\kern\leftskip #1\kern\rightskip}%
  891. }
  892. % @sp n outputs n lines of vertical space
  893. %
  894. \parseargdef\sp{\vskip #1\baselineskip}
  895. % @comment ...line which is ignored...
  896. % @c is the same as @comment
  897. % @ignore ... @end ignore is another way to write a comment
  898. %
  899. \def\comment{\begingroup \catcode`\^^M=\active%
  900. \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other\commentxxx}%
  901. {\catcode`\^^M=\active%
  902. \gdef\commentxxx#1^^M{\endgroup%
  903. \futurelet\nexttoken\commentxxxx}%
  904. \gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}%
  905. }
  906. \def\c{\begingroup \catcode`\^^M=\active%
  907. \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  908. \cxxx}
  909. {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
  910. % See comment in \scanmacro about why the definitions of @c and @comment differ
  911. % @paragraphindent NCHARS
  912. % We'll use ems for NCHARS, close enough.
  913. % NCHARS can also be the word `asis' or `none'.
  914. % We cannot feasibly implement @paragraphindent asis, though.
  915. %
  916. \def\asisword{asis} % no translation, these are keywords
  917. \def\noneword{none}
  918. %
  919. \parseargdef\paragraphindent{%
  920. \def\temp{#1}%
  921. \ifx\temp\asisword
  922. \else
  923. \ifx\temp\noneword
  924. \defaultparindent = 0pt
  925. \else
  926. \defaultparindent = #1em
  927. \fi
  928. \fi
  929. \parindent = \defaultparindent
  930. }
  931. % @exampleindent NCHARS
  932. % We'll use ems for NCHARS like @paragraphindent.
  933. % It seems @exampleindent asis isn't necessary, but
  934. % I preserve it to make it similar to @paragraphindent.
  935. \parseargdef\exampleindent{%
  936. \def\temp{#1}%
  937. \ifx\temp\asisword
  938. \else
  939. \ifx\temp\noneword
  940. \lispnarrowing = 0pt
  941. \else
  942. \lispnarrowing = #1em
  943. \fi
  944. \fi
  945. }
  946. % @firstparagraphindent WORD
  947. % If WORD is `none', then suppress indentation of the first paragraph
  948. % after a section heading. If WORD is `insert', then do indent at such
  949. % paragraphs.
  950. %
  951. % The paragraph indentation is suppressed or not by calling
  952. % \suppressfirstparagraphindent, which the sectioning commands do.
  953. % We switch the definition of this back and forth according to WORD.
  954. % By default, we suppress indentation.
  955. %
  956. \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
  957. \def\insertword{insert}
  958. %
  959. \parseargdef\firstparagraphindent{%
  960. \def\temp{#1}%
  961. \ifx\temp\noneword
  962. \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
  963. \else\ifx\temp\insertword
  964. \let\suppressfirstparagraphindent = \relax
  965. \else
  966. \errhelp = \EMsimple
  967. \errmessage{Unknown @firstparagraphindent option `\temp'}%
  968. \fi\fi
  969. }
  970. % Here is how we actually suppress indentation. Redefine \everypar to
  971. % \kern backwards by \parindent, and then reset itself to empty.
  972. %
  973. % We also make \indent itself not actually do anything until the next
  974. % paragraph.
  975. %
  976. \gdef\dosuppressfirstparagraphindent{%
  977. \gdef\indent {\restorefirstparagraphindent \indent}%
  978. \gdef\noindent{\restorefirstparagraphindent \noindent}%
  979. \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
  980. }
  981. %
  982. \gdef\restorefirstparagraphindent{%
  983. \global\let\indent = \ptexindent
  984. \global\let\noindent = \ptexnoindent
  985. \global\everypar = {}%
  986. }
  987. % @refill is a no-op.
  988. \let\refill=\relax
  989. % @setfilename INFO-FILENAME - ignored
  990. \let\setfilename=\comment
  991. % @bye.
  992. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  993. \message{pdf,}
  994. % adobe `portable' document format
  995. \newcount\tempnum
  996. \newcount\lnkcount
  997. \newtoks\filename
  998. \newcount\filenamelength
  999. \newcount\pgn
  1000. \newtoks\toksA
  1001. \newtoks\toksB
  1002. \newtoks\toksC
  1003. \newtoks\toksD
  1004. \newbox\boxA
  1005. \newbox\boxB
  1006. \newcount\countA
  1007. \newif\ifpdf
  1008. \newif\ifpdfmakepagedest
  1009. %
  1010. % For LuaTeX
  1011. %
  1012. \newif\iftxiuseunicodedestname
  1013. \txiuseunicodedestnamefalse % For pdfTeX etc.
  1014. \ifx\luatexversion\thisisundefined
  1015. \else
  1016. % Use Unicode destination names
  1017. \txiuseunicodedestnametrue
  1018. % Escape PDF strings with converting UTF-16 from UTF-8
  1019. \begingroup
  1020. \catcode`\%=12
  1021. \directlua{
  1022. function UTF16oct(str)
  1023. tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
  1024. for c in string.utfvalues(str) do
  1025. if c < 0x10000 then
  1026. tex.sprint(
  1027. string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
  1028. string.char(0x5c) .. string.char(0x25) .. '03o',
  1029. (c / 256), (c % 256)))
  1030. else
  1031. c = c - 0x10000
  1032. local c_hi = c / 1024 + 0xd800
  1033. local c_lo = c % 1024 + 0xdc00
  1034. tex.sprint(
  1035. string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
  1036. string.char(0x5c) .. string.char(0x25) .. '03o' ..
  1037. string.char(0x5c) .. string.char(0x25) .. '03o' ..
  1038. string.char(0x5c) .. string.char(0x25) .. '03o',
  1039. (c_hi / 256), (c_hi % 256),
  1040. (c_lo / 256), (c_lo % 256)))
  1041. end
  1042. end
  1043. end
  1044. }
  1045. \endgroup
  1046. \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
  1047. % Escape PDF strings without converting
  1048. \begingroup
  1049. \directlua{
  1050. function PDFescstr(str)
  1051. for c in string.bytes(str) do
  1052. if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
  1053. tex.sprint(
  1054. string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
  1055. c))
  1056. else
  1057. tex.sprint(string.char(c))
  1058. end
  1059. end
  1060. end
  1061. }
  1062. \endgroup
  1063. \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
  1064. \ifnum\luatexversion>84
  1065. % For LuaTeX >= 0.85
  1066. \def\pdfdest{\pdfextension dest}
  1067. \let\pdfoutput\outputmode
  1068. \def\pdfliteral{\pdfextension literal}
  1069. \def\pdfcatalog{\pdfextension catalog}
  1070. \def\pdftexversion{\numexpr\pdffeedback version\relax}
  1071. \let\pdfximage\saveimageresource
  1072. \let\pdfrefximage\useimageresource
  1073. \let\pdflastximage\lastsavedimageresourceindex
  1074. \def\pdfendlink{\pdfextension endlink\relax}
  1075. \def\pdfoutline{\pdfextension outline}
  1076. \def\pdfstartlink{\pdfextension startlink}
  1077. \def\pdffontattr{\pdfextension fontattr}
  1078. \def\pdfobj{\pdfextension obj}
  1079. \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
  1080. \let\pdfpagewidth\pagewidth
  1081. \let\pdfpageheight\pageheight
  1082. \edef\pdfhorigin{\pdfvariable horigin}
  1083. \edef\pdfvorigin{\pdfvariable vorigin}
  1084. \fi
  1085. \fi
  1086. % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
  1087. % can be set). So we test for \relax and 0 as well as being undefined.
  1088. \ifx\pdfoutput\thisisundefined
  1089. \else
  1090. \ifx\pdfoutput\relax
  1091. \else
  1092. \ifcase\pdfoutput
  1093. \else
  1094. \pdftrue
  1095. \fi
  1096. \fi
  1097. \fi
  1098. % PDF uses PostScript string constants for the names of xref targets,
  1099. % for display in the outlines, and in other places. Thus, we have to
  1100. % double any backslashes. Otherwise, a name like "\node" will be
  1101. % interpreted as a newline (\n), followed by o, d, e. Not good.
  1102. %
  1103. % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
  1104. % related messages. The final outcome is that it is up to the TeX user
  1105. % to double the backslashes and otherwise make the string valid, so
  1106. % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
  1107. % do this reliably, so we use it.
  1108. % #1 is a control sequence in which to do the replacements,
  1109. % which we \xdef.
  1110. \def\txiescapepdf#1{%
  1111. \ifx\pdfescapestring\thisisundefined
  1112. % No primitive available; should we give a warning or log?
  1113. % Many times it won't matter.
  1114. \xdef#1{#1}%
  1115. \else
  1116. % The expandable \pdfescapestring primitive escapes parentheses,
  1117. % backslashes, and other special chars.
  1118. \xdef#1{\pdfescapestring{#1}}%
  1119. \fi
  1120. }
  1121. \def\txiescapepdfutfsixteen#1{%
  1122. \ifx\pdfescapestrutfsixteen\thisisundefined
  1123. % No UTF-16 converting macro available.
  1124. \txiescapepdf{#1}%
  1125. \else
  1126. \xdef#1{\pdfescapestrutfsixteen{#1}}%
  1127. \fi
  1128. }
  1129. \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
  1130. with PDF output, and none of those formats could be found. (.eps cannot
  1131. be supported due to the design of the PDF format; use regular TeX (DVI
  1132. output) for that.)}
  1133. \ifpdf
  1134. %
  1135. % Color manipulation macros using ideas from pdfcolor.tex,
  1136. % except using rgb instead of cmyk; the latter is said to render as a
  1137. % very dark gray on-screen and a very dark halftone in print, instead
  1138. % of actual black. The dark red here is dark enough to print on paper as
  1139. % nearly black, but still distinguishable for online viewing. We use
  1140. % black by default, though.
  1141. \def\rgbDarkRed{0.50 0.09 0.12}
  1142. \def\rgbBlack{0 0 0}
  1143. %
  1144. % rg sets the color for filling (usual text, etc.);
  1145. % RG sets the color for stroking (thin rules, e.g., normal _'s).
  1146. \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
  1147. %
  1148. % Set color, and create a mark which defines \thiscolor accordingly,
  1149. % so that \makeheadline knows which color to restore.
  1150. \def\setcolor#1{%
  1151. \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
  1152. \domark
  1153. \pdfsetcolor{#1}%
  1154. }
  1155. %
  1156. \def\maincolor{\rgbBlack}
  1157. \pdfsetcolor{\maincolor}
  1158. \edef\thiscolor{\maincolor}
  1159. \def\lastcolordefs{}
  1160. %
  1161. \def\makefootline{%
  1162. \baselineskip24pt
  1163. \line{\pdfsetcolor{\maincolor}\the\footline}%
  1164. }
  1165. %
  1166. \def\makeheadline{%
  1167. \vbox to 0pt{%
  1168. \vskip-22.5pt
  1169. \line{%
  1170. \vbox to8.5pt{}%
  1171. % Extract \thiscolor definition from the marks.
  1172. \getcolormarks
  1173. % Typeset the headline with \maincolor, then restore the color.
  1174. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
  1175. }%
  1176. \vss
  1177. }%
  1178. \nointerlineskip
  1179. }
  1180. %
  1181. %
  1182. \pdfcatalog{/PageMode /UseOutlines}
  1183. %
  1184. % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
  1185. \def\dopdfimage#1#2#3{%
  1186. \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
  1187. \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
  1188. %
  1189. % pdftex (and the PDF format) support .pdf, .png, .jpg (among
  1190. % others). Let's try in that order, PDF first since if
  1191. % someone has a scalable image, presumably better to use that than a
  1192. % bitmap.
  1193. \let\pdfimgext=\empty
  1194. \begingroup
  1195. \openin 1 #1.pdf \ifeof 1
  1196. \openin 1 #1.PDF \ifeof 1
  1197. \openin 1 #1.png \ifeof 1
  1198. \openin 1 #1.jpg \ifeof 1
  1199. \openin 1 #1.jpeg \ifeof 1
  1200. \openin 1 #1.JPG \ifeof 1
  1201. \errhelp = \nopdfimagehelp
  1202. \errmessage{Could not find image file #1 for pdf}%
  1203. \else \gdef\pdfimgext{JPG}%
  1204. \fi
  1205. \else \gdef\pdfimgext{jpeg}%
  1206. \fi
  1207. \else \gdef\pdfimgext{jpg}%
  1208. \fi
  1209. \else \gdef\pdfimgext{png}%
  1210. \fi
  1211. \else \gdef\pdfimgext{PDF}%
  1212. \fi
  1213. \else \gdef\pdfimgext{pdf}%
  1214. \fi
  1215. \closein 1
  1216. \endgroup
  1217. %
  1218. % without \immediate, ancient pdftex seg faults when the same image is
  1219. % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
  1220. \ifnum\pdftexversion < 14
  1221. \immediate\pdfimage
  1222. \else
  1223. \immediate\pdfximage
  1224. \fi
  1225. \ifdim \wd0 >0pt width \pdfimagewidth \fi
  1226. \ifdim \wd2 >0pt height \pdfimageheight \fi
  1227. \ifnum\pdftexversion<13
  1228. #1.\pdfimgext
  1229. \else
  1230. {#1.\pdfimgext}%
  1231. \fi
  1232. \ifnum\pdftexversion < 14 \else
  1233. \pdfrefximage \pdflastximage
  1234. \fi}
  1235. %
  1236. \def\setpdfdestname#1{{%
  1237. % We have to set dummies so commands such as @code, and characters
  1238. % such as \, aren't expanded when present in a section title.
  1239. \indexnofonts
  1240. \makevalueexpandable
  1241. \turnoffactive
  1242. \iftxiuseunicodedestname
  1243. \ifx \declaredencoding \latone
  1244. % Pass through Latin-1 characters.
  1245. % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
  1246. \else
  1247. \ifx \declaredencoding \utfeight
  1248. % Pass through Unicode characters.
  1249. \else
  1250. % Use ASCII approximations in destination names.
  1251. \passthroughcharsfalse
  1252. \fi
  1253. \fi
  1254. \else
  1255. % Use ASCII approximations in destination names.
  1256. \passthroughcharsfalse
  1257. \fi
  1258. \def\pdfdestname{#1}%
  1259. \txiescapepdf\pdfdestname
  1260. }}
  1261. %
  1262. \def\setpdfoutlinetext#1{{%
  1263. \indexnofonts
  1264. \makevalueexpandable
  1265. \turnoffactive
  1266. \ifx \declaredencoding \latone
  1267. % The PDF format can use an extended form of Latin-1 in bookmark
  1268. % strings. See Appendix D of the PDF Reference, Sixth Edition, for
  1269. % the "PDFDocEncoding".
  1270. \passthroughcharstrue
  1271. % Pass through Latin-1 characters.
  1272. % LuaTeX: Convert to Unicode
  1273. % pdfTeX: Use Latin-1 as PDFDocEncoding
  1274. \def\pdfoutlinetext{#1}%
  1275. \else
  1276. \ifx \declaredencoding \utfeight
  1277. \ifx\luatexversion\thisisundefined
  1278. % For pdfTeX with UTF-8.
  1279. % TODO: the PDF format can use UTF-16 in bookmark strings,
  1280. % but the code for this isn't done yet.
  1281. % Use ASCII approximations.
  1282. \passthroughcharsfalse
  1283. \def\pdfoutlinetext{#1}%
  1284. \else
  1285. % For LuaTeX with UTF-8.
  1286. % Pass through Unicode characters for title texts.
  1287. \passthroughcharstrue
  1288. \def\pdfoutlinetext{#1}%
  1289. \fi
  1290. \else
  1291. % For non-Latin-1 or non-UTF-8 encodings.
  1292. % Use ASCII approximations.
  1293. \passthroughcharsfalse
  1294. \def\pdfoutlinetext{#1}%
  1295. \fi
  1296. \fi
  1297. % LuaTeX: Convert to UTF-16
  1298. % pdfTeX: Use Latin-1 as PDFDocEncoding
  1299. \txiescapepdfutfsixteen\pdfoutlinetext
  1300. }}
  1301. %
  1302. \def\pdfmkdest#1{%
  1303. \setpdfdestname{#1}%
  1304. \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
  1305. }
  1306. %
  1307. % used to mark target names; must be expandable.
  1308. \def\pdfmkpgn#1{#1}
  1309. %
  1310. % by default, use black for everything.
  1311. \def\urlcolor{\rgbBlack}
  1312. \def\linkcolor{\rgbBlack}
  1313. \def\endlink{\setcolor{\maincolor}\pdfendlink}
  1314. %
  1315. % Adding outlines to PDF; macros for calculating structure of outlines
  1316. % come from Petr Olsak
  1317. \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
  1318. \else \csname#1\endcsname \fi}
  1319. \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
  1320. \advance\tempnum by 1
  1321. \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  1322. %
  1323. % #1 is the section text, which is what will be displayed in the
  1324. % outline by the pdf viewer. #2 is the pdf expression for the number
  1325. % of subentries (or empty, for subsubsections). #3 is the node text,
  1326. % which might be empty if this toc entry had no corresponding node.
  1327. % #4 is the page number
  1328. %
  1329. \def\dopdfoutline#1#2#3#4{%
  1330. % Generate a link to the node text if that exists; else, use the
  1331. % page number. We could generate a destination for the section
  1332. % text in the case where a section has no node, but it doesn't
  1333. % seem worth the trouble, since most documents are normally structured.
  1334. \setpdfoutlinetext{#1}
  1335. \setpdfdestname{#3}
  1336. \ifx\pdfdestname\empty
  1337. \def\pdfdestname{#4}%
  1338. \fi
  1339. %
  1340. \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
  1341. }
  1342. %
  1343. \def\pdfmakeoutlines{%
  1344. \begingroup
  1345. % Read toc silently, to get counts of subentries for \pdfoutline.
  1346. \def\partentry##1##2##3##4{}% ignore parts in the outlines
  1347. \def\numchapentry##1##2##3##4{%
  1348. \def\thischapnum{##2}%
  1349. \def\thissecnum{0}%
  1350. \def\thissubsecnum{0}%
  1351. }%
  1352. \def\numsecentry##1##2##3##4{%
  1353. \advancenumber{chap\thischapnum}%
  1354. \def\thissecnum{##2}%
  1355. \def\thissubsecnum{0}%
  1356. }%
  1357. \def\numsubsecentry##1##2##3##4{%
  1358. \advancenumber{sec\thissecnum}%
  1359. \def\thissubsecnum{##2}%
  1360. }%
  1361. \def\numsubsubsecentry##1##2##3##4{%
  1362. \advancenumber{subsec\thissubsecnum}%
  1363. }%
  1364. \def\thischapnum{0}%
  1365. \def\thissecnum{0}%
  1366. \def\thissubsecnum{0}%
  1367. %
  1368. % use \def rather than \let here because we redefine \chapentry et
  1369. % al. a second time, below.
  1370. \def\appentry{\numchapentry}%
  1371. \def\appsecentry{\numsecentry}%
  1372. \def\appsubsecentry{\numsubsecentry}%
  1373. \def\appsubsubsecentry{\numsubsubsecentry}%
  1374. \def\unnchapentry{\numchapentry}%
  1375. \def\unnsecentry{\numsecentry}%
  1376. \def\unnsubsecentry{\numsubsecentry}%
  1377. \def\unnsubsubsecentry{\numsubsubsecentry}%
  1378. \readdatafile{toc}%
  1379. %
  1380. % Read toc second time, this time actually producing the outlines.
  1381. % The `-' means take the \expnumber as the absolute number of
  1382. % subentries, which we calculated on our first read of the .toc above.
  1383. %
  1384. % We use the node names as the destinations.
  1385. \def\numchapentry##1##2##3##4{%
  1386. \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
  1387. \def\numsecentry##1##2##3##4{%
  1388. \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
  1389. \def\numsubsecentry##1##2##3##4{%
  1390. \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
  1391. \def\numsubsubsecentry##1##2##3##4{% count is always zero
  1392. \dopdfoutline{##1}{}{##3}{##4}}%
  1393. %
  1394. % PDF outlines are displayed using system fonts, instead of
  1395. % document fonts. Therefore we cannot use special characters,
  1396. % since the encoding is unknown. For example, the eogonek from
  1397. % Latin 2 (0xea) gets translated to a | character. Info from
  1398. % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
  1399. %
  1400. % TODO this right, we have to translate 8-bit characters to
  1401. % their "best" equivalent, based on the @documentencoding. Too
  1402. % much work for too little return. Just use the ASCII equivalents
  1403. % we use for the index sort strings.
  1404. %
  1405. \indexnofonts
  1406. \setupdatafile
  1407. % We can have normal brace characters in the PDF outlines, unlike
  1408. % Texinfo index files. So set that up.
  1409. \def\{{\lbracecharliteral}%
  1410. \def\}{\rbracecharliteral}%
  1411. \catcode`\\=\active \otherbackslash
  1412. \input \tocreadfilename
  1413. \endgroup
  1414. }
  1415. {\catcode`[=1 \catcode`]=2
  1416. \catcode`{=\other \catcode`}=\other
  1417. \gdef\lbracecharliteral[{]%
  1418. \gdef\rbracecharliteral[}]%
  1419. ]
  1420. %
  1421. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1422. \ifx\PP\D\let\nextsp\relax
  1423. \else\let\nextsp\skipspaces
  1424. \addtokens{\filename}{\PP}%
  1425. \advance\filenamelength by 1
  1426. \fi
  1427. \nextsp}
  1428. \def\getfilename#1{%
  1429. \filenamelength=0
  1430. % If we don't expand the argument now, \skipspaces will get
  1431. % snagged on things like "@value{foo}".
  1432. \edef\temp{#1}%
  1433. \expandafter\skipspaces\temp|\relax
  1434. }
  1435. \ifnum\pdftexversion < 14
  1436. \let \startlink \pdfannotlink
  1437. \else
  1438. \let \startlink \pdfstartlink
  1439. \fi
  1440. % make a live url in pdf output.
  1441. \def\pdfurl#1{%
  1442. \begingroup
  1443. % it seems we really need yet another set of dummies; have not
  1444. % tried to figure out what each command should do in the context
  1445. % of @url. for now, just make @/ a no-op, that's the only one
  1446. % people have actually reported a problem with.
  1447. %
  1448. \normalturnoffactive
  1449. \def\@{@}%
  1450. \let\/=\empty
  1451. \makevalueexpandable
  1452. % do we want to go so far as to use \indexnofonts instead of just
  1453. % special-casing \var here?
  1454. \def\var##1{##1}%
  1455. %
  1456. \leavevmode\setcolor{\urlcolor}%
  1457. \startlink attr{/Border [0 0 0]}%
  1458. user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
  1459. \endgroup}
  1460. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1461. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1462. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1463. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1464. \def\maketoks{%
  1465. \expandafter\poptoks\the\toksA|ENDTOKS|\relax
  1466. \ifx\first0\adn0
  1467. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1468. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1469. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1470. \else
  1471. \ifnum0=\countA\else\makelink\fi
  1472. \ifx\first.\let\next=\done\else
  1473. \let\next=\maketoks
  1474. \addtokens{\toksB}{\the\toksD}
  1475. \ifx\first,\addtokens{\toksB}{\space}\fi
  1476. \fi
  1477. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1478. \next}
  1479. \def\makelink{\addtokens{\toksB}%
  1480. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1481. \def\pdflink#1{%
  1482. \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
  1483. \setcolor{\linkcolor}#1\endlink}
  1484. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1485. \else
  1486. % non-pdf mode
  1487. \let\pdfmkdest = \gobble
  1488. \let\pdfurl = \gobble
  1489. \let\endlink = \relax
  1490. \let\setcolor = \gobble
  1491. \let\pdfsetcolor = \gobble
  1492. \let\pdfmakeoutlines = \relax
  1493. \fi % \ifx\pdfoutput
  1494. %
  1495. % For XeTeX
  1496. %
  1497. \ifx\XeTeXrevision\thisisundefined
  1498. \else
  1499. %
  1500. % XeTeX version check
  1501. %
  1502. \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
  1503. % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
  1504. % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
  1505. % For avoiding PDF destination name replacement, we use this special
  1506. % instead of xdvipdfmx's command line option `-C 0x0010'.
  1507. \special{dvipdfmx:config C 0x0010}
  1508. % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
  1509. % It can handle Unicode destination names for PDF.
  1510. \txiuseunicodedestnametrue
  1511. \else
  1512. % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
  1513. % `dvipdfmx:config' special.
  1514. % So for avoiding PDF destination name replacement,
  1515. % xdvipdfmx's command line option `-C 0x0010' is necessary.
  1516. %
  1517. % XeTeX < 0.99995 can not handle Unicode destination names for PDF
  1518. % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
  1519. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
  1520. \txiuseunicodedestnamefalse
  1521. \fi
  1522. %
  1523. % Color support
  1524. %
  1525. \def\rgbDarkRed{0.50 0.09 0.12}
  1526. \def\rgbBlack{0 0 0}
  1527. %
  1528. \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
  1529. %
  1530. % Set color, and create a mark which defines \thiscolor accordingly,
  1531. % so that \makeheadline knows which color to restore.
  1532. \def\setcolor#1{%
  1533. \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
  1534. \domark
  1535. \pdfsetcolor{#1}%
  1536. }
  1537. %
  1538. \def\maincolor{\rgbBlack}
  1539. \pdfsetcolor{\maincolor}
  1540. \edef\thiscolor{\maincolor}
  1541. \def\lastcolordefs{}
  1542. %
  1543. \def\makefootline{%
  1544. \baselineskip24pt
  1545. \line{\pdfsetcolor{\maincolor}\the\footline}%
  1546. }
  1547. %
  1548. \def\makeheadline{%
  1549. \vbox to 0pt{%
  1550. \vskip-22.5pt
  1551. \line{%
  1552. \vbox to8.5pt{}%
  1553. % Extract \thiscolor definition from the marks.
  1554. \getcolormarks
  1555. % Typeset the headline with \maincolor, then restore the color.
  1556. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
  1557. }%
  1558. \vss
  1559. }%
  1560. \nointerlineskip
  1561. }
  1562. %
  1563. % PDF outline support
  1564. %
  1565. % Emulate pdfTeX primitive
  1566. \def\pdfdest name#1 xyz{%
  1567. \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
  1568. }
  1569. %
  1570. \def\setpdfdestname#1{{%
  1571. % We have to set dummies so commands such as @code, and characters
  1572. % such as \, aren't expanded when present in a section title.
  1573. \indexnofonts
  1574. \makevalueexpandable
  1575. \turnoffactive
  1576. \iftxiuseunicodedestname
  1577. % Pass through Unicode characters.
  1578. \else
  1579. % Use ASCII approximations in destination names.
  1580. \passthroughcharsfalse
  1581. \fi
  1582. \def\pdfdestname{#1}%
  1583. \txiescapepdf\pdfdestname
  1584. }}
  1585. %
  1586. \def\setpdfoutlinetext#1{{%
  1587. \turnoffactive
  1588. % Always use Unicode characters in title texts.
  1589. \def\pdfoutlinetext{#1}%
  1590. % For XeTeX, xdvipdfmx converts to UTF-16.
  1591. % So we do not convert.
  1592. \txiescapepdf\pdfoutlinetext
  1593. }}
  1594. %
  1595. \def\pdfmkdest#1{%
  1596. \setpdfdestname{#1}%
  1597. \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
  1598. }
  1599. %
  1600. % by default, use black for everything.
  1601. \def\urlcolor{\rgbBlack}
  1602. \def\linkcolor{\rgbBlack}
  1603. \def\endlink{\setcolor{\maincolor}\pdfendlink}
  1604. %
  1605. \def\dopdfoutline#1#2#3#4{%
  1606. \setpdfoutlinetext{#1}
  1607. \setpdfdestname{#3}
  1608. \ifx\pdfdestname\empty
  1609. \def\pdfdestname{#4}%
  1610. \fi
  1611. %
  1612. \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
  1613. << /S /GoTo /D (\pdfdestname) >> >> }%
  1614. }
  1615. %
  1616. \def\pdfmakeoutlines{%
  1617. \begingroup
  1618. %
  1619. % For XeTeX, counts of subentries are not necessary.
  1620. % Therefore, we read toc only once.
  1621. %
  1622. % We use node names as destinations.
  1623. \def\partentry##1##2##3##4{}% ignore parts in the outlines
  1624. \def\numchapentry##1##2##3##4{%
  1625. \dopdfoutline{##1}{1}{##3}{##4}}%
  1626. \def\numsecentry##1##2##3##4{%
  1627. \dopdfoutline{##1}{2}{##3}{##4}}%
  1628. \def\numsubsecentry##1##2##3##4{%
  1629. \dopdfoutline{##1}{3}{##3}{##4}}%
  1630. \def\numsubsubsecentry##1##2##3##4{%
  1631. \dopdfoutline{##1}{4}{##3}{##4}}%
  1632. %
  1633. \let\appentry\numchapentry%
  1634. \let\appsecentry\numsecentry%
  1635. \let\appsubsecentry\numsubsecentry%
  1636. \let\appsubsubsecentry\numsubsubsecentry%
  1637. \let\unnchapentry\numchapentry%
  1638. \let\unnsecentry\numsecentry%
  1639. \let\unnsubsecentry\numsubsecentry%
  1640. \let\unnsubsubsecentry\numsubsubsecentry%
  1641. %
  1642. % For XeTeX, xdvipdfmx converts strings to UTF-16.
  1643. % Therefore, the encoding and the language may not be considered.
  1644. %
  1645. \indexnofonts
  1646. \setupdatafile
  1647. % We can have normal brace characters in the PDF outlines, unlike
  1648. % Texinfo index files. So set that up.
  1649. \def\{{\lbracecharliteral}%
  1650. \def\}{\rbracecharliteral}%
  1651. \catcode`\\=\active \otherbackslash
  1652. \input \tocreadfilename
  1653. \endgroup
  1654. }
  1655. {\catcode`[=1 \catcode`]=2
  1656. \catcode`{=\other \catcode`}=\other
  1657. \gdef\lbracecharliteral[{]%
  1658. \gdef\rbracecharliteral[}]%
  1659. ]
  1660. \special{pdf:docview << /PageMode /UseOutlines >> }
  1661. % ``\special{pdf:tounicode ...}'' is not necessary
  1662. % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
  1663. % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
  1664. % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
  1665. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
  1666. %
  1667. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1668. \ifx\PP\D\let\nextsp\relax
  1669. \else\let\nextsp\skipspaces
  1670. \addtokens{\filename}{\PP}%
  1671. \advance\filenamelength by 1
  1672. \fi
  1673. \nextsp}
  1674. \def\getfilename#1{%
  1675. \filenamelength=0
  1676. % If we don't expand the argument now, \skipspaces will get
  1677. % snagged on things like "@value{foo}".
  1678. \edef\temp{#1}%
  1679. \expandafter\skipspaces\temp|\relax
  1680. }
  1681. % make a live url in pdf output.
  1682. \def\pdfurl#1{%
  1683. \begingroup
  1684. % it seems we really need yet another set of dummies; have not
  1685. % tried to figure out what each command should do in the context
  1686. % of @url. for now, just make @/ a no-op, that's the only one
  1687. % people have actually reported a problem with.
  1688. %
  1689. \normalturnoffactive
  1690. \def\@{@}%
  1691. \let\/=\empty
  1692. \makevalueexpandable
  1693. % do we want to go so far as to use \indexnofonts instead of just
  1694. % special-casing \var here?
  1695. \def\var##1{##1}%
  1696. %
  1697. \leavevmode\setcolor{\urlcolor}%
  1698. \special{pdf:bann << /Border [0 0 0]
  1699. /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
  1700. \endgroup}
  1701. \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
  1702. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1703. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1704. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1705. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1706. \def\maketoks{%
  1707. \expandafter\poptoks\the\toksA|ENDTOKS|\relax
  1708. \ifx\first0\adn0
  1709. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1710. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1711. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1712. \else
  1713. \ifnum0=\countA\else\makelink\fi
  1714. \ifx\first.\let\next=\done\else
  1715. \let\next=\maketoks
  1716. \addtokens{\toksB}{\the\toksD}
  1717. \ifx\first,\addtokens{\toksB}{\space}\fi
  1718. \fi
  1719. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1720. \next}
  1721. \def\makelink{\addtokens{\toksB}%
  1722. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1723. \def\pdflink#1{%
  1724. \special{pdf:bann << /Border [0 0 0]
  1725. /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
  1726. \setcolor{\linkcolor}#1\endlink}
  1727. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1728. %
  1729. %
  1730. % @image support
  1731. %
  1732. % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
  1733. \def\doxeteximage#1#2#3{%
  1734. \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
  1735. \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
  1736. %
  1737. % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
  1738. % others). Let's try in that order, PDF first since if
  1739. % someone has a scalable image, presumably better to use that than a
  1740. % bitmap.
  1741. \let\xeteximgext=\empty
  1742. \begingroup
  1743. \openin 1 #1.pdf \ifeof 1
  1744. \openin 1 #1.PDF \ifeof 1
  1745. \openin 1 #1.png \ifeof 1
  1746. \openin 1 #1.jpg \ifeof 1
  1747. \openin 1 #1.jpeg \ifeof 1
  1748. \openin 1 #1.JPG \ifeof 1
  1749. \errmessage{Could not find image file #1 for XeTeX}%
  1750. \else \gdef\xeteximgext{JPG}%
  1751. \fi
  1752. \else \gdef\xeteximgext{jpeg}%
  1753. \fi
  1754. \else \gdef\xeteximgext{jpg}%
  1755. \fi
  1756. \else \gdef\xeteximgext{png}%
  1757. \fi
  1758. \else \gdef\xeteximgext{PDF}%
  1759. \fi
  1760. \else \gdef\xeteximgext{pdf}%
  1761. \fi
  1762. \closein 1
  1763. \endgroup
  1764. %
  1765. \def\xetexpdfext{pdf}%
  1766. \ifx\xeteximgext\xetexpdfext
  1767. \XeTeXpdffile "#1".\xeteximgext ""
  1768. \else
  1769. \def\xetexpdfext{PDF}%
  1770. \ifx\xeteximgext\xetexpdfext
  1771. \XeTeXpdffile "#1".\xeteximgext ""
  1772. \else
  1773. \XeTeXpicfile "#1".\xeteximgext ""
  1774. \fi
  1775. \fi
  1776. \ifdim \wd0 >0pt width \xeteximagewidth \fi
  1777. \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
  1778. }
  1779. \fi
  1780. \message{fonts,}
  1781. % Change the current font style to #1, remembering it in \curfontstyle.
  1782. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
  1783. % italics, not bold italics.
  1784. %
  1785. \def\setfontstyle#1{%
  1786. \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
  1787. \csname ten#1\endcsname % change the current font
  1788. }
  1789. % Select #1 fonts with the current style.
  1790. %
  1791. \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
  1792. \def\rm{\fam=0 \setfontstyle{rm}}
  1793. \def\it{\fam=\itfam \setfontstyle{it}}
  1794. \def\sl{\fam=\slfam \setfontstyle{sl}}
  1795. \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
  1796. \def\tt{\fam=\ttfam \setfontstyle{tt}}
  1797. % Unfortunately, we have to override this for titles and the like, since
  1798. % in those cases "rm" is bold. Sigh.
  1799. \def\rmisbold{\rm\def\curfontstyle{bf}}
  1800. % Texinfo sort of supports the sans serif font style, which plain TeX does not.
  1801. % So we set up a \sf.
  1802. \newfam\sffam
  1803. \def\sf{\fam=\sffam \setfontstyle{sf}}
  1804. \let\li = \sf % Sometimes we call it \li, not \sf.
  1805. % We don't need math for this font style.
  1806. \def\ttsl{\setfontstyle{ttsl}}
  1807. % Set the baselineskip to #1, and the lineskip and strut size
  1808. % correspondingly. There is no deep meaning behind these magic numbers
  1809. % used as factors; they just match (closely enough) what Knuth defined.
  1810. %
  1811. \def\lineskipfactor{.08333}
  1812. \def\strutheightpercent{.70833}
  1813. \def\strutdepthpercent {.29167}
  1814. %
  1815. % can get a sort of poor man's double spacing by redefining this.
  1816. \def\baselinefactor{1}
  1817. %
  1818. \newdimen\textleading
  1819. \def\setleading#1{%
  1820. \dimen0 = #1\relax
  1821. \normalbaselineskip = \baselinefactor\dimen0
  1822. \normallineskip = \lineskipfactor\normalbaselineskip
  1823. \normalbaselines
  1824. \setbox\strutbox =\hbox{%
  1825. \vrule width0pt height\strutheightpercent\baselineskip
  1826. depth \strutdepthpercent \baselineskip
  1827. }%
  1828. }
  1829. % PDF CMaps. See also LaTeX's t1.cmap.
  1830. %
  1831. % do nothing with this by default.
  1832. \expandafter\let\csname cmapOT1\endcsname\gobble
  1833. \expandafter\let\csname cmapOT1IT\endcsname\gobble
  1834. \expandafter\let\csname cmapOT1TT\endcsname\gobble
  1835. % if we are producing pdf, and we have \pdffontattr, then define cmaps.
  1836. % (\pdffontattr was introduced many years ago, but people still run
  1837. % older pdftex's; it's easy to conditionalize, so we do.)
  1838. \ifpdf \ifx\pdffontattr\thisisundefined \else
  1839. \begingroup
  1840. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  1841. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  1842. %%DocumentNeededResources: ProcSet (CIDInit)
  1843. %%IncludeResource: ProcSet (CIDInit)
  1844. %%BeginResource: CMap (TeX-OT1-0)
  1845. %%Title: (TeX-OT1-0 TeX OT1 0)
  1846. %%Version: 1.000
  1847. %%EndComments
  1848. /CIDInit /ProcSet findresource begin
  1849. 12 dict begin
  1850. begincmap
  1851. /CIDSystemInfo
  1852. << /Registry (TeX)
  1853. /Ordering (OT1)
  1854. /Supplement 0
  1855. >> def
  1856. /CMapName /TeX-OT1-0 def
  1857. /CMapType 2 def
  1858. 1 begincodespacerange
  1859. <00> <7F>
  1860. endcodespacerange
  1861. 8 beginbfrange
  1862. <00> <01> <0393>
  1863. <09> <0A> <03A8>
  1864. <23> <26> <0023>
  1865. <28> <3B> <0028>
  1866. <3F> <5B> <003F>
  1867. <5D> <5E> <005D>
  1868. <61> <7A> <0061>
  1869. <7B> <7C> <2013>
  1870. endbfrange
  1871. 40 beginbfchar
  1872. <02> <0398>
  1873. <03> <039B>
  1874. <04> <039E>
  1875. <05> <03A0>
  1876. <06> <03A3>
  1877. <07> <03D2>
  1878. <08> <03A6>
  1879. <0B> <00660066>
  1880. <0C> <00660069>
  1881. <0D> <0066006C>
  1882. <0E> <006600660069>
  1883. <0F> <00660066006C>
  1884. <10> <0131>
  1885. <11> <0237>
  1886. <12> <0060>
  1887. <13> <00B4>
  1888. <14> <02C7>
  1889. <15> <02D8>
  1890. <16> <00AF>
  1891. <17> <02DA>
  1892. <18> <00B8>
  1893. <19> <00DF>
  1894. <1A> <00E6>
  1895. <1B> <0153>
  1896. <1C> <00F8>
  1897. <1D> <00C6>
  1898. <1E> <0152>
  1899. <1F> <00D8>
  1900. <21> <0021>
  1901. <22> <201D>
  1902. <27> <2019>
  1903. <3C> <00A1>
  1904. <3D> <003D>
  1905. <3E> <00BF>
  1906. <5C> <201C>
  1907. <5F> <02D9>
  1908. <60> <2018>
  1909. <7D> <02DD>
  1910. <7E> <007E>
  1911. <7F> <00A8>
  1912. endbfchar
  1913. endcmap
  1914. CMapName currentdict /CMap defineresource pop
  1915. end
  1916. end
  1917. %%EndResource
  1918. %%EOF
  1919. }\endgroup
  1920. \expandafter\edef\csname cmapOT1\endcsname#1{%
  1921. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  1922. }%
  1923. %
  1924. % \cmapOT1IT
  1925. \begingroup
  1926. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  1927. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  1928. %%DocumentNeededResources: ProcSet (CIDInit)
  1929. %%IncludeResource: ProcSet (CIDInit)
  1930. %%BeginResource: CMap (TeX-OT1IT-0)
  1931. %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
  1932. %%Version: 1.000
  1933. %%EndComments
  1934. /CIDInit /ProcSet findresource begin
  1935. 12 dict begin
  1936. begincmap
  1937. /CIDSystemInfo
  1938. << /Registry (TeX)
  1939. /Ordering (OT1IT)
  1940. /Supplement 0
  1941. >> def
  1942. /CMapName /TeX-OT1IT-0 def
  1943. /CMapType 2 def
  1944. 1 begincodespacerange
  1945. <00> <7F>
  1946. endcodespacerange
  1947. 8 beginbfrange
  1948. <00> <01> <0393>
  1949. <09> <0A> <03A8>
  1950. <25> <26> <0025>
  1951. <28> <3B> <0028>
  1952. <3F> <5B> <003F>
  1953. <5D> <5E> <005D>
  1954. <61> <7A> <0061>
  1955. <7B> <7C> <2013>
  1956. endbfrange
  1957. 42 beginbfchar
  1958. <02> <0398>
  1959. <03> <039B>
  1960. <04> <039E>
  1961. <05> <03A0>
  1962. <06> <03A3>
  1963. <07> <03D2>
  1964. <08> <03A6>
  1965. <0B> <00660066>
  1966. <0C> <00660069>
  1967. <0D> <0066006C>
  1968. <0E> <006600660069>
  1969. <0F> <00660066006C>
  1970. <10> <0131>
  1971. <11> <0237>
  1972. <12> <0060>
  1973. <13> <00B4>
  1974. <14> <02C7>
  1975. <15> <02D8>
  1976. <16> <00AF>
  1977. <17> <02DA>
  1978. <18> <00B8>
  1979. <19> <00DF>
  1980. <1A> <00E6>
  1981. <1B> <0153>
  1982. <1C> <00F8>
  1983. <1D> <00C6>
  1984. <1E> <0152>
  1985. <1F> <00D8>
  1986. <21> <0021>
  1987. <22> <201D>
  1988. <23> <0023>
  1989. <24> <00A3>
  1990. <27> <2019>
  1991. <3C> <00A1>
  1992. <3D> <003D>
  1993. <3E> <00BF>
  1994. <5C> <201C>
  1995. <5F> <02D9>
  1996. <60> <2018>
  1997. <7D> <02DD>
  1998. <7E> <007E>
  1999. <7F> <00A8>
  2000. endbfchar
  2001. endcmap
  2002. CMapName currentdict /CMap defineresource pop
  2003. end
  2004. end
  2005. %%EndResource
  2006. %%EOF
  2007. }\endgroup
  2008. \expandafter\edef\csname cmapOT1IT\endcsname#1{%
  2009. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  2010. }%
  2011. %
  2012. % \cmapOT1TT
  2013. \begingroup
  2014. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  2015. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  2016. %%DocumentNeededResources: ProcSet (CIDInit)
  2017. %%IncludeResource: ProcSet (CIDInit)
  2018. %%BeginResource: CMap (TeX-OT1TT-0)
  2019. %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
  2020. %%Version: 1.000
  2021. %%EndComments
  2022. /CIDInit /ProcSet findresource begin
  2023. 12 dict begin
  2024. begincmap
  2025. /CIDSystemInfo
  2026. << /Registry (TeX)
  2027. /Ordering (OT1TT)
  2028. /Supplement 0
  2029. >> def
  2030. /CMapName /TeX-OT1TT-0 def
  2031. /CMapType 2 def
  2032. 1 begincodespacerange
  2033. <00> <7F>
  2034. endcodespacerange
  2035. 5 beginbfrange
  2036. <00> <01> <0393>
  2037. <09> <0A> <03A8>
  2038. <21> <26> <0021>
  2039. <28> <5F> <0028>
  2040. <61> <7E> <0061>
  2041. endbfrange
  2042. 32 beginbfchar
  2043. <02> <0398>
  2044. <03> <039B>
  2045. <04> <039E>
  2046. <05> <03A0>
  2047. <06> <03A3>
  2048. <07> <03D2>
  2049. <08> <03A6>
  2050. <0B> <2191>
  2051. <0C> <2193>
  2052. <0D> <0027>
  2053. <0E> <00A1>
  2054. <0F> <00BF>
  2055. <10> <0131>
  2056. <11> <0237>
  2057. <12> <0060>
  2058. <13> <00B4>
  2059. <14> <02C7>
  2060. <15> <02D8>
  2061. <16> <00AF>
  2062. <17> <02DA>
  2063. <18> <00B8>
  2064. <19> <00DF>
  2065. <1A> <00E6>
  2066. <1B> <0153>
  2067. <1C> <00F8>
  2068. <1D> <00C6>
  2069. <1E> <0152>
  2070. <1F> <00D8>
  2071. <20> <2423>
  2072. <27> <2019>
  2073. <60> <2018>
  2074. <7F> <00A8>
  2075. endbfchar
  2076. endcmap
  2077. CMapName currentdict /CMap defineresource pop
  2078. end
  2079. end
  2080. %%EndResource
  2081. %%EOF
  2082. }\endgroup
  2083. \expandafter\edef\csname cmapOT1TT\endcsname#1{%
  2084. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  2085. }%
  2086. \fi\fi
  2087. % Set the font macro #1 to the font named \fontprefix#2.
  2088. % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
  2089. % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
  2090. % Example:
  2091. % #1 = \textrm
  2092. % #2 = \rmshape
  2093. % #3 = 10
  2094. % #4 = \mainmagstep
  2095. % #5 = OT1
  2096. %
  2097. \def\setfont#1#2#3#4#5{%
  2098. \font#1=\fontprefix#2#3 scaled #4
  2099. \csname cmap#5\endcsname#1%
  2100. }
  2101. % This is what gets called when #5 of \setfont is empty.
  2102. \let\cmap\gobble
  2103. %
  2104. % (end of cmaps)
  2105. % Use cm as the default font prefix.
  2106. % To specify the font prefix, you must define \fontprefix
  2107. % before you read in texinfo.tex.
  2108. \ifx\fontprefix\thisisundefined
  2109. \def\fontprefix{cm}
  2110. \fi
  2111. % Support font families that don't use the same naming scheme as CM.
  2112. \def\rmshape{r}
  2113. \def\rmbshape{bx} % where the normal face is bold
  2114. \def\bfshape{b}
  2115. \def\bxshape{bx}
  2116. \def\ttshape{tt}
  2117. \def\ttbshape{tt}
  2118. \def\ttslshape{sltt}
  2119. \def\itshape{ti}
  2120. \def\itbshape{bxti}
  2121. \def\slshape{sl}
  2122. \def\slbshape{bxsl}
  2123. \def\sfshape{ss}
  2124. \def\sfbshape{ss}
  2125. \def\scshape{csc}
  2126. \def\scbshape{csc}
  2127. % Definitions for a main text size of 11pt. (The default in Texinfo.)
  2128. %
  2129. \def\definetextfontsizexi{%
  2130. % Text fonts (11.2pt, magstep1).
  2131. \def\textnominalsize{11pt}
  2132. \edef\mainmagstep{\magstephalf}
  2133. \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
  2134. \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
  2135. \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
  2136. \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
  2137. \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
  2138. \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
  2139. \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
  2140. \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
  2141. \font\texti=cmmi10 scaled \mainmagstep
  2142. \font\textsy=cmsy10 scaled \mainmagstep
  2143. \def\textecsize{1095}
  2144. % A few fonts for @defun names and args.
  2145. \setfont\defbf\bfshape{10}{\magstep1}{OT1}
  2146. \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
  2147. \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
  2148. \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
  2149. \def\df{\let\tentt=\deftt \let\tenbf = \defbf
  2150. \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
  2151. % Fonts for indices, footnotes, small examples (9pt).
  2152. \def\smallnominalsize{9pt}
  2153. \setfont\smallrm\rmshape{9}{1000}{OT1}
  2154. \setfont\smalltt\ttshape{9}{1000}{OT1TT}
  2155. \setfont\smallbf\bfshape{10}{900}{OT1}
  2156. \setfont\smallit\itshape{9}{1000}{OT1IT}
  2157. \setfont\smallsl\slshape{9}{1000}{OT1}
  2158. \setfont\smallsf\sfshape{9}{1000}{OT1}
  2159. \setfont\smallsc\scshape{10}{900}{OT1}
  2160. \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
  2161. \font\smalli=cmmi9
  2162. \font\smallsy=cmsy9
  2163. \def\smallecsize{0900}
  2164. % Fonts for small examples (8pt).
  2165. \def\smallernominalsize{8pt}
  2166. \setfont\smallerrm\rmshape{8}{1000}{OT1}
  2167. \setfont\smallertt\ttshape{8}{1000}{OT1TT}
  2168. \setfont\smallerbf\bfshape{10}{800}{OT1}
  2169. \setfont\smallerit\itshape{8}{1000}{OT1IT}
  2170. \setfont\smallersl\slshape{8}{1000}{OT1}
  2171. \setfont\smallersf\sfshape{8}{1000}{OT1}
  2172. \setfont\smallersc\scshape{10}{800}{OT1}
  2173. \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
  2174. \font\smalleri=cmmi8
  2175. \font\smallersy=cmsy8
  2176. \def\smallerecsize{0800}
  2177. % Fonts for title page (20.4pt):
  2178. \def\titlenominalsize{20pt}
  2179. \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
  2180. \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
  2181. \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
  2182. \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
  2183. \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
  2184. \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
  2185. \let\titlebf=\titlerm
  2186. \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
  2187. \font\titlei=cmmi12 scaled \magstep3
  2188. \font\titlesy=cmsy10 scaled \magstep4
  2189. \def\titleecsize{2074}
  2190. % Chapter (and unnumbered) fonts (17.28pt).
  2191. \def\chapnominalsize{17pt}
  2192. \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
  2193. \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
  2194. \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
  2195. \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
  2196. \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
  2197. \setfont\chapsf\sfbshape{17}{1000}{OT1}
  2198. \let\chapbf=\chaprm
  2199. \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
  2200. \font\chapi=cmmi12 scaled \magstep2
  2201. \font\chapsy=cmsy10 scaled \magstep3
  2202. \def\chapecsize{1728}
  2203. % Section fonts (14.4pt).
  2204. \def\secnominalsize{14pt}
  2205. \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
  2206. \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
  2207. \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
  2208. \setfont\secsl\slbshape{10}{\magstep2}{OT1}
  2209. \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
  2210. \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
  2211. \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
  2212. \let\secbf\secrm
  2213. \setfont\secsc\scbshape{10}{\magstep2}{OT1}
  2214. \font\seci=cmmi12 scaled \magstep1
  2215. \font\secsy=cmsy10 scaled \magstep2
  2216. \def\sececsize{1440}
  2217. % Subsection fonts (13.15pt).
  2218. \def\ssecnominalsize{13pt}
  2219. \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
  2220. \setfont\ssecit\itbshape{10}{1315}{OT1IT}
  2221. \setfont\ssecsl\slbshape{10}{1315}{OT1}
  2222. \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
  2223. \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
  2224. \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
  2225. \let\ssecbf\ssecrm
  2226. \setfont\ssecsc\scbshape{10}{1315}{OT1}
  2227. \font\sseci=cmmi12 scaled \magstephalf
  2228. \font\ssecsy=cmsy10 scaled 1315
  2229. \def\ssececsize{1200}
  2230. % Reduced fonts for @acro in text (10pt).
  2231. \def\reducednominalsize{10pt}
  2232. \setfont\reducedrm\rmshape{10}{1000}{OT1}
  2233. \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
  2234. \setfont\reducedbf\bfshape{10}{1000}{OT1}
  2235. \setfont\reducedit\itshape{10}{1000}{OT1IT}
  2236. \setfont\reducedsl\slshape{10}{1000}{OT1}
  2237. \setfont\reducedsf\sfshape{10}{1000}{OT1}
  2238. \setfont\reducedsc\scshape{10}{1000}{OT1}
  2239. \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
  2240. \font\reducedi=cmmi10
  2241. \font\reducedsy=cmsy10
  2242. \def\reducedecsize{1000}
  2243. \textleading = 13.2pt % line spacing for 11pt CM
  2244. \textfonts % reset the current fonts
  2245. \rm
  2246. } % end of 11pt text font size definitions, \definetextfontsizexi
  2247. % Definitions to make the main text be 10pt Computer Modern, with
  2248. % section, chapter, etc., sizes following suit. This is for the GNU
  2249. % Press printing of the Emacs 22 manual. Maybe other manuals in the
  2250. % future. Used with @smallbook, which sets the leading to 12pt.
  2251. %
  2252. \def\definetextfontsizex{%
  2253. % Text fonts (10pt).
  2254. \def\textnominalsize{10pt}
  2255. \edef\mainmagstep{1000}
  2256. \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
  2257. \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
  2258. \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
  2259. \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
  2260. \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
  2261. \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
  2262. \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
  2263. \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
  2264. \font\texti=cmmi10 scaled \mainmagstep
  2265. \font\textsy=cmsy10 scaled \mainmagstep
  2266. \def\textecsize{1000}
  2267. % A few fonts for @defun names and args.
  2268. \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
  2269. \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
  2270. \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
  2271. \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
  2272. \def\df{\let\tentt=\deftt \let\tenbf = \defbf
  2273. \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
  2274. % Fonts for indices, footnotes, small examples (9pt).
  2275. \def\smallnominalsize{9pt}
  2276. \setfont\smallrm\rmshape{9}{1000}{OT1}
  2277. \setfont\smalltt\ttshape{9}{1000}{OT1TT}
  2278. \setfont\smallbf\bfshape{10}{900}{OT1}
  2279. \setfont\smallit\itshape{9}{1000}{OT1IT}
  2280. \setfont\smallsl\slshape{9}{1000}{OT1}
  2281. \setfont\smallsf\sfshape{9}{1000}{OT1}
  2282. \setfont\smallsc\scshape{10}{900}{OT1}
  2283. \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
  2284. \font\smalli=cmmi9
  2285. \font\smallsy=cmsy9
  2286. \def\smallecsize{0900}
  2287. % Fonts for small examples (8pt).
  2288. \def\smallernominalsize{8pt}
  2289. \setfont\smallerrm\rmshape{8}{1000}{OT1}
  2290. \setfont\smallertt\ttshape{8}{1000}{OT1TT}
  2291. \setfont\smallerbf\bfshape{10}{800}{OT1}
  2292. \setfont\smallerit\itshape{8}{1000}{OT1IT}
  2293. \setfont\smallersl\slshape{8}{1000}{OT1}
  2294. \setfont\smallersf\sfshape{8}{1000}{OT1}
  2295. \setfont\smallersc\scshape{10}{800}{OT1}
  2296. \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
  2297. \font\smalleri=cmmi8
  2298. \font\smallersy=cmsy8
  2299. \def\smallerecsize{0800}
  2300. % Fonts for title page (20.4pt):
  2301. \def\titlenominalsize{20pt}
  2302. \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
  2303. \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
  2304. \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
  2305. \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
  2306. \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
  2307. \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
  2308. \let\titlebf=\titlerm
  2309. \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
  2310. \font\titlei=cmmi12 scaled \magstep3
  2311. \font\titlesy=cmsy10 scaled \magstep4
  2312. \def\titleecsize{2074}
  2313. % Chapter fonts (14.4pt).
  2314. \def\chapnominalsize{14pt}
  2315. \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
  2316. \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
  2317. \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
  2318. \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
  2319. \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
  2320. \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
  2321. \let\chapbf\chaprm
  2322. \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
  2323. \font\chapi=cmmi12 scaled \magstep1
  2324. \font\chapsy=cmsy10 scaled \magstep2
  2325. \def\chapecsize{1440}
  2326. % Section fonts (12pt).
  2327. \def\secnominalsize{12pt}
  2328. \setfont\secrm\rmbshape{12}{1000}{OT1}
  2329. \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
  2330. \setfont\secsl\slbshape{10}{\magstep1}{OT1}
  2331. \setfont\sectt\ttbshape{12}{1000}{OT1TT}
  2332. \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
  2333. \setfont\secsf\sfbshape{12}{1000}{OT1}
  2334. \let\secbf\secrm
  2335. \setfont\secsc\scbshape{10}{\magstep1}{OT1}
  2336. \font\seci=cmmi12
  2337. \font\secsy=cmsy10 scaled \magstep1
  2338. \def\sececsize{1200}
  2339. % Subsection fonts (10pt).
  2340. \def\ssecnominalsize{10pt}
  2341. \setfont\ssecrm\rmbshape{10}{1000}{OT1}
  2342. \setfont\ssecit\itbshape{10}{1000}{OT1IT}
  2343. \setfont\ssecsl\slbshape{10}{1000}{OT1}
  2344. \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
  2345. \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
  2346. \setfont\ssecsf\sfbshape{10}{1000}{OT1}
  2347. \let\ssecbf\ssecrm
  2348. \setfont\ssecsc\scbshape{10}{1000}{OT1}
  2349. \font\sseci=cmmi10
  2350. \font\ssecsy=cmsy10
  2351. \def\ssececsize{1000}
  2352. % Reduced fonts for @acro in text (9pt).
  2353. \def\reducednominalsize{9pt}
  2354. \setfont\reducedrm\rmshape{9}{1000}{OT1}
  2355. \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
  2356. \setfont\reducedbf\bfshape{10}{900}{OT1}
  2357. \setfont\reducedit\itshape{9}{1000}{OT1IT}
  2358. \setfont\reducedsl\slshape{9}{1000}{OT1}
  2359. \setfont\reducedsf\sfshape{9}{1000}{OT1}
  2360. \setfont\reducedsc\scshape{10}{900}{OT1}
  2361. \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
  2362. \font\reducedi=cmmi9
  2363. \font\reducedsy=cmsy9
  2364. \def\reducedecsize{0900}
  2365. \divide\parskip by 2 % reduce space between paragraphs
  2366. \textleading = 12pt % line spacing for 10pt CM
  2367. \textfonts % reset the current fonts
  2368. \rm
  2369. } % end of 10pt text font size definitions, \definetextfontsizex
  2370. % We provide the user-level command
  2371. % @fonttextsize 10
  2372. % (or 11) to redefine the text font size. pt is assumed.
  2373. %
  2374. \def\xiword{11}
  2375. \def\xword{10}
  2376. \def\xwordpt{10pt}
  2377. %
  2378. \parseargdef\fonttextsize{%
  2379. \def\textsizearg{#1}%
  2380. %\wlog{doing @fonttextsize \textsizearg}%
  2381. %
  2382. % Set \globaldefs so that documents can use this inside @tex, since
  2383. % makeinfo 4.8 does not support it, but we need it nonetheless.
  2384. %
  2385. \begingroup \globaldefs=1
  2386. \ifx\textsizearg\xword \definetextfontsizex
  2387. \else \ifx\textsizearg\xiword \definetextfontsizexi
  2388. \else
  2389. \errhelp=\EMsimple
  2390. \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
  2391. \fi\fi
  2392. \endgroup
  2393. }
  2394. % In order for the font changes to affect most math symbols and letters,
  2395. % we have to define the \textfont of the standard families. We don't
  2396. % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
  2397. %
  2398. \def\resetmathfonts{%
  2399. \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
  2400. \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
  2401. \textfont\ttfam=\tentt \textfont\sffam=\tensf
  2402. }
  2403. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  2404. % of just \STYLE. We do this because \STYLE needs to also set the
  2405. % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
  2406. % \tenSTYLE to set the current font.
  2407. %
  2408. % Each font-changing command also sets the names \lsize (one size lower)
  2409. % and \lllsize (three sizes lower). These relative commands are used
  2410. % in, e.g., the LaTeX logo and acronyms.
  2411. %
  2412. % This all needs generalizing, badly.
  2413. %
  2414. \def\textfonts{%
  2415. \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  2416. \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  2417. \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  2418. \let\tenttsl=\textttsl
  2419. \def\curfontsize{text}%
  2420. \def\lsize{reduced}\def\lllsize{smaller}%
  2421. \resetmathfonts \setleading{\textleading}}
  2422. \def\titlefonts{%
  2423. \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
  2424. \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
  2425. \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
  2426. \let\tenttsl=\titlettsl
  2427. \def\curfontsize{title}%
  2428. \def\lsize{chap}\def\lllsize{subsec}%
  2429. \resetmathfonts \setleading{27pt}}
  2430. \def\titlefont#1{{\titlefonts\rmisbold #1}}
  2431. \def\chapfonts{%
  2432. \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  2433. \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  2434. \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  2435. \let\tenttsl=\chapttsl
  2436. \def\curfontsize{chap}%
  2437. \def\lsize{sec}\def\lllsize{text}%
  2438. \resetmathfonts \setleading{19pt}}
  2439. \def\secfonts{%
  2440. \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  2441. \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  2442. \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  2443. \let\tenttsl=\secttsl
  2444. \def\curfontsize{sec}%
  2445. \def\lsize{subsec}\def\lllsize{reduced}%
  2446. \resetmathfonts \setleading{17pt}}
  2447. \def\subsecfonts{%
  2448. \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  2449. \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  2450. \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  2451. \let\tenttsl=\ssecttsl
  2452. \def\curfontsize{ssec}%
  2453. \def\lsize{text}\def\lllsize{small}%
  2454. \resetmathfonts \setleading{15pt}}
  2455. \let\subsubsecfonts = \subsecfonts
  2456. \def\reducedfonts{%
  2457. \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
  2458. \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
  2459. \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
  2460. \let\tenttsl=\reducedttsl
  2461. \def\curfontsize{reduced}%
  2462. \def\lsize{small}\def\lllsize{smaller}%
  2463. \resetmathfonts \setleading{10.5pt}}
  2464. \def\smallfonts{%
  2465. \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
  2466. \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
  2467. \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
  2468. \let\tenttsl=\smallttsl
  2469. \def\curfontsize{small}%
  2470. \def\lsize{smaller}\def\lllsize{smaller}%
  2471. \resetmathfonts \setleading{10.5pt}}
  2472. \def\smallerfonts{%
  2473. \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
  2474. \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
  2475. \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
  2476. \let\tenttsl=\smallerttsl
  2477. \def\curfontsize{smaller}%
  2478. \def\lsize{smaller}\def\lllsize{smaller}%
  2479. \resetmathfonts \setleading{9.5pt}}
  2480. % Fonts for short table of contents.
  2481. \setfont\shortcontrm\rmshape{12}{1000}{OT1}
  2482. \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
  2483. \setfont\shortcontsl\slshape{12}{1000}{OT1}
  2484. \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
  2485. % Define these just so they can be easily changed for other fonts.
  2486. \def\angleleft{$\langle$}
  2487. \def\angleright{$\rangle$}
  2488. % Set the fonts to use with the @small... environments.
  2489. \let\smallexamplefonts = \smallfonts
  2490. % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
  2491. % can fit this many characters:
  2492. % 8.5x11=86 smallbook=72 a4=90 a5=69
  2493. % If we use \scriptfonts (8pt), then we can fit this many characters:
  2494. % 8.5x11=90+ smallbook=80 a4=90+ a5=77
  2495. % For me, subjectively, the few extra characters that fit aren't worth
  2496. % the additional smallness of 8pt. So I'm making the default 9pt.
  2497. %
  2498. % By the way, for comparison, here's what fits with @example (10pt):
  2499. % 8.5x11=71 smallbook=60 a4=75 a5=58
  2500. % --karl, 24jan03.
  2501. % Set up the default fonts, so we can use them for creating boxes.
  2502. %
  2503. \definetextfontsizexi
  2504. \message{markup,}
  2505. % Check if we are currently using a typewriter font. Since all the
  2506. % Computer Modern typewriter fonts have zero interword stretch (and
  2507. % shrink), and it is reasonable to expect all typewriter fonts to have
  2508. % this property, we can check that font parameter.
  2509. %
  2510. \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
  2511. % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
  2512. % define and register \INITMACRO to be called on markup style changes.
  2513. % \INITMACRO can check \currentmarkupstyle for the innermost
  2514. % style and the set of \ifmarkupSTYLE switches for all styles
  2515. % currently in effect.
  2516. \newif\ifmarkupvar
  2517. \newif\ifmarkupsamp
  2518. \newif\ifmarkupkey
  2519. %\newif\ifmarkupfile % @file == @samp.
  2520. %\newif\ifmarkupoption % @option == @samp.
  2521. \newif\ifmarkupcode
  2522. \newif\ifmarkupkbd
  2523. %\newif\ifmarkupenv % @env == @code.
  2524. %\newif\ifmarkupcommand % @command == @code.
  2525. \newif\ifmarkuptex % @tex (and part of @math, for now).
  2526. \newif\ifmarkupexample
  2527. \newif\ifmarkupverb
  2528. \newif\ifmarkupverbatim
  2529. \let\currentmarkupstyle\empty
  2530. \def\setupmarkupstyle#1{%
  2531. \csname markup#1true\endcsname
  2532. \def\currentmarkupstyle{#1}%
  2533. \markupstylesetup
  2534. }
  2535. \let\markupstylesetup\empty
  2536. \def\defmarkupstylesetup#1{%
  2537. \expandafter\def\expandafter\markupstylesetup
  2538. \expandafter{\markupstylesetup #1}%
  2539. \def#1%
  2540. }
  2541. % Markup style setup for left and right quotes.
  2542. \defmarkupstylesetup\markupsetuplq{%
  2543. \expandafter\let\expandafter \temp
  2544. \csname markupsetuplq\currentmarkupstyle\endcsname
  2545. \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
  2546. }
  2547. \defmarkupstylesetup\markupsetuprq{%
  2548. \expandafter\let\expandafter \temp
  2549. \csname markupsetuprq\currentmarkupstyle\endcsname
  2550. \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
  2551. }
  2552. {
  2553. \catcode`\'=\active
  2554. \catcode`\`=\active
  2555. \gdef\markupsetuplqdefault{\let`\lq}
  2556. \gdef\markupsetuprqdefault{\let'\rq}
  2557. \gdef\markupsetcodequoteleft{\let`\codequoteleft}
  2558. \gdef\markupsetcodequoteright{\let'\codequoteright}
  2559. }
  2560. \let\markupsetuplqcode \markupsetcodequoteleft
  2561. \let\markupsetuprqcode \markupsetcodequoteright
  2562. %
  2563. \let\markupsetuplqexample \markupsetcodequoteleft
  2564. \let\markupsetuprqexample \markupsetcodequoteright
  2565. %
  2566. \let\markupsetuplqkbd \markupsetcodequoteleft
  2567. \let\markupsetuprqkbd \markupsetcodequoteright
  2568. %
  2569. \let\markupsetuplqsamp \markupsetcodequoteleft
  2570. \let\markupsetuprqsamp \markupsetcodequoteright
  2571. %
  2572. \let\markupsetuplqverb \markupsetcodequoteleft
  2573. \let\markupsetuprqverb \markupsetcodequoteright
  2574. %
  2575. \let\markupsetuplqverbatim \markupsetcodequoteleft
  2576. \let\markupsetuprqverbatim \markupsetcodequoteright
  2577. % Allow an option to not use regular directed right quote/apostrophe
  2578. % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
  2579. % The undirected quote is ugly, so don't make it the default, but it
  2580. % works for pasting with more pdf viewers (at least evince), the
  2581. % lilypond developers report. xpdf does work with the regular 0x27.
  2582. %
  2583. \def\codequoteright{%
  2584. \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
  2585. \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
  2586. '%
  2587. \else \char'15 \fi
  2588. \else \char'15 \fi
  2589. }
  2590. %
  2591. % and a similar option for the left quote char vs. a grave accent.
  2592. % Modern fonts display ASCII 0x60 as a grave accent, so some people like
  2593. % the code environments to do likewise.
  2594. %
  2595. \def\codequoteleft{%
  2596. \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
  2597. \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
  2598. % [Knuth] pp. 380,381,391
  2599. % \relax disables Spanish ligatures ?` and !` of \tt font.
  2600. \relax`%
  2601. \else \char'22 \fi
  2602. \else \char'22 \fi
  2603. }
  2604. % Commands to set the quote options.
  2605. %
  2606. \parseargdef\codequoteundirected{%
  2607. \def\temp{#1}%
  2608. \ifx\temp\onword
  2609. \expandafter\let\csname SETtxicodequoteundirected\endcsname
  2610. = t%
  2611. \else\ifx\temp\offword
  2612. \expandafter\let\csname SETtxicodequoteundirected\endcsname
  2613. = \relax
  2614. \else
  2615. \errhelp = \EMsimple
  2616. \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
  2617. \fi\fi
  2618. }
  2619. %
  2620. \parseargdef\codequotebacktick{%
  2621. \def\temp{#1}%
  2622. \ifx\temp\onword
  2623. \expandafter\let\csname SETtxicodequotebacktick\endcsname
  2624. = t%
  2625. \else\ifx\temp\offword
  2626. \expandafter\let\csname SETtxicodequotebacktick\endcsname
  2627. = \relax
  2628. \else
  2629. \errhelp = \EMsimple
  2630. \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
  2631. \fi\fi
  2632. }
  2633. % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
  2634. \def\noligaturesquoteleft{\relax\lq}
  2635. % Count depth in font-changes, for error checks
  2636. \newcount\fontdepth \fontdepth=0
  2637. % Font commands.
  2638. % #1 is the font command (\sl or \it), #2 is the text to slant.
  2639. % If we are in a monospaced environment, however, 1) always use \ttsl,
  2640. % and 2) do not add an italic correction.
  2641. \def\dosmartslant#1#2{%
  2642. \ifusingtt
  2643. {{\ttsl #2}\let\next=\relax}%
  2644. {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
  2645. \next
  2646. }
  2647. \def\smartslanted{\dosmartslant\sl}
  2648. \def\smartitalic{\dosmartslant\it}
  2649. % Output an italic correction unless \next (presumed to be the following
  2650. % character) is such as not to need one.
  2651. \def\smartitaliccorrection{%
  2652. \ifx\next,%
  2653. \else\ifx\next-%
  2654. \else\ifx\next.%
  2655. \else\ifx\next\.%
  2656. \else\ifx\next\comma%
  2657. \else\ptexslash
  2658. \fi\fi\fi\fi\fi
  2659. \aftersmartic
  2660. }
  2661. % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
  2662. \def\ttslanted#1{{\ttsl #1}}
  2663. % @cite is like \smartslanted except unconditionally use \sl. We never want
  2664. % ttsl for book titles, do we?
  2665. \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
  2666. \def\aftersmartic{}
  2667. \def\var#1{%
  2668. \let\saveaftersmartic = \aftersmartic
  2669. \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
  2670. \smartslanted{#1}%
  2671. }
  2672. \let\i=\smartitalic
  2673. \let\slanted=\smartslanted
  2674. \let\dfn=\smartslanted
  2675. \let\emph=\smartitalic
  2676. % Explicit font changes: @r, @sc, undocumented @ii.
  2677. \def\r#1{{\rm #1}} % roman font
  2678. \def\sc#1{{\smallcaps#1}} % smallcaps font
  2679. \def\ii#1{{\it #1}} % italic font
  2680. % @b, explicit bold. Also @strong.
  2681. \def\b#1{{\bf #1}}
  2682. \let\strong=\b
  2683. % @sansserif, explicit sans.
  2684. \def\sansserif#1{{\sf #1}}
  2685. % We can't just use \exhyphenpenalty, because that only has effect at
  2686. % the end of a paragraph. Restore normal hyphenation at the end of the
  2687. % group within which \nohyphenation is presumably called.
  2688. %
  2689. \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
  2690. \def\restorehyphenation{\hyphenchar\font = `- }
  2691. % Set sfcode to normal for the chars that usually have another value.
  2692. % Can't use plain's \frenchspacing because it uses the `\x notation, and
  2693. % sometimes \x has an active definition that messes things up.
  2694. %
  2695. \catcode`@=11
  2696. \def\plainfrenchspacing{%
  2697. \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
  2698. \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
  2699. \def\endofsentencespacefactor{1000}% for @. and friends
  2700. }
  2701. \def\plainnonfrenchspacing{%
  2702. \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
  2703. \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
  2704. \def\endofsentencespacefactor{3000}% for @. and friends
  2705. }
  2706. \catcode`@=\other
  2707. \def\endofsentencespacefactor{3000}% default
  2708. % @t, explicit typewriter.
  2709. \def\t#1{%
  2710. {\tt \rawbackslash \plainfrenchspacing #1}%
  2711. \null
  2712. }
  2713. % @samp.
  2714. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
  2715. % @indicateurl is \samp, that is, with quotes.
  2716. \let\indicateurl=\samp
  2717. % @code (and similar) prints in typewriter, but with spaces the same
  2718. % size as normal in the surrounding text, without hyphenation, etc.
  2719. % This is a subroutine for that.
  2720. \def\tclose#1{%
  2721. {%
  2722. % Change normal interword space to be same as for the current font.
  2723. \spaceskip = \fontdimen2\font
  2724. %
  2725. % Switch to typewriter.
  2726. \tt
  2727. %
  2728. % But `\ ' produces the large typewriter interword space.
  2729. \def\ {{\spaceskip = 0pt{} }}%
  2730. %
  2731. % Turn off hyphenation.
  2732. \nohyphenation
  2733. %
  2734. \rawbackslash
  2735. \plainfrenchspacing
  2736. #1%
  2737. }%
  2738. \null % reset spacefactor to 1000
  2739. }
  2740. % We *must* turn on hyphenation at `-' and `_' in @code.
  2741. % (But see \codedashfinish below.)
  2742. % Otherwise, it is too hard to avoid overfull hboxes
  2743. % in the Emacs manual, the Library manual, etc.
  2744. %
  2745. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  2746. % both hyphenation at - and hyphenation within words.
  2747. % We must therefore turn them both off (\tclose does that)
  2748. % and arrange explicitly to hyphenate at a dash. -- rms.
  2749. {
  2750. \catcode`\-=\active \catcode`\_=\active
  2751. \catcode`\'=\active \catcode`\`=\active
  2752. \global\let'=\rq \global\let`=\lq % default definitions
  2753. %
  2754. \global\def\code{\begingroup
  2755. \setupmarkupstyle{code}%
  2756. % The following should really be moved into \setupmarkupstyle handlers.
  2757. \catcode\dashChar=\active \catcode\underChar=\active
  2758. \ifallowcodebreaks
  2759. \let-\codedash
  2760. \let_\codeunder
  2761. \else
  2762. \let-\normaldash
  2763. \let_\realunder
  2764. \fi
  2765. % Given -foo (with a single dash), we do not want to allow a break
  2766. % after the hyphen.
  2767. \global\let\codedashprev=\codedash
  2768. %
  2769. \codex
  2770. }
  2771. %
  2772. \gdef\codedash{\futurelet\next\codedashfinish}
  2773. \gdef\codedashfinish{%
  2774. \normaldash % always output the dash character itself.
  2775. %
  2776. % Now, output a discretionary to allow a line break, unless
  2777. % (a) the next character is a -, or
  2778. % (b) the preceding character is a -.
  2779. % E.g., given --posix, we do not want to allow a break after either -.
  2780. % Given --foo-bar, we do want to allow a break between the - and the b.
  2781. \ifx\next\codedash \else
  2782. \ifx\codedashprev\codedash
  2783. \else \discretionary{}{}{}\fi
  2784. \fi
  2785. % we need the space after the = for the case when \next itself is a
  2786. % space token; it would get swallowed otherwise. As in @code{- a}.
  2787. \global\let\codedashprev= \next
  2788. }
  2789. }
  2790. \def\normaldash{-}
  2791. %
  2792. \def\codex #1{\tclose{#1}\endgroup}
  2793. \def\codeunder{%
  2794. % this is all so @math{@code{var_name}+1} can work. In math mode, _
  2795. % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  2796. % will therefore expand the active definition of _, which is us
  2797. % (inside @code that is), therefore an endless loop.
  2798. \ifusingtt{\ifmmode
  2799. \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
  2800. \else\normalunderscore \fi
  2801. \discretionary{}{}{}}%
  2802. {\_}%
  2803. }
  2804. % An additional complication: the above will allow breaks after, e.g.,
  2805. % each of the four underscores in __typeof__. This is bad.
  2806. % @allowcodebreaks provides a document-level way to turn breaking at -
  2807. % and _ on and off.
  2808. %
  2809. \newif\ifallowcodebreaks \allowcodebreakstrue
  2810. \def\keywordtrue{true}
  2811. \def\keywordfalse{false}
  2812. \parseargdef\allowcodebreaks{%
  2813. \def\txiarg{#1}%
  2814. \ifx\txiarg\keywordtrue
  2815. \allowcodebreakstrue
  2816. \else\ifx\txiarg\keywordfalse
  2817. \allowcodebreaksfalse
  2818. \else
  2819. \errhelp = \EMsimple
  2820. \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
  2821. \fi\fi
  2822. }
  2823. % For @command, @env, @file, @option quotes seem unnecessary,
  2824. % so use \code rather than \samp.
  2825. \let\command=\code
  2826. \let\env=\code
  2827. \let\file=\code
  2828. \let\option=\code
  2829. % @uref (abbreviation for `urlref') aka @url takes an optional
  2830. % (comma-separated) second argument specifying the text to display and
  2831. % an optional third arg as text to display instead of (rather than in
  2832. % addition to) the url itself. First (mandatory) arg is the url.
  2833. % TeX-only option to allow changing PDF output to show only the second
  2834. % arg (if given), and not the url (which is then just the link target).
  2835. \newif\ifurefurlonlylink
  2836. % The main macro is \urefbreak, which allows breaking at expected
  2837. % places within the url. (There used to be another version, which
  2838. % didn't support automatic breaking.)
  2839. \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
  2840. \let\uref=\urefbreak
  2841. %
  2842. \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
  2843. \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
  2844. \unsepspaces
  2845. \pdfurl{#1}%
  2846. \setbox0 = \hbox{\ignorespaces #3}%
  2847. \ifdim\wd0 > 0pt
  2848. \unhbox0 % third arg given, show only that
  2849. \else
  2850. \setbox0 = \hbox{\ignorespaces #2}% look for second arg
  2851. \ifdim\wd0 > 0pt
  2852. \ifpdf
  2853. % For pdfTeX and LuaTeX
  2854. \ifurefurlonlylink
  2855. % PDF plus option to not display url, show just arg
  2856. \unhbox0
  2857. \else
  2858. % PDF, normally display both arg and url for consistency,
  2859. % visibility, if the pdf is eventually used to print, etc.
  2860. \unhbox0\ (\urefcode{#1})%
  2861. \fi
  2862. \else
  2863. \ifx\XeTeXrevision\thisisundefined
  2864. \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
  2865. \else
  2866. % For XeTeX
  2867. \ifurefurlonlylink
  2868. % PDF plus option to not display url, show just arg
  2869. \unhbox0
  2870. \else
  2871. % PDF, normally display both arg and url for consistency,
  2872. % visibility, if the pdf is eventually used to print, etc.
  2873. \unhbox0\ (\urefcode{#1})%
  2874. \fi
  2875. \fi
  2876. \fi
  2877. \else
  2878. \urefcode{#1}% only url given, so show it
  2879. \fi
  2880. \fi
  2881. \endlink
  2882. \endgroup}
  2883. % Allow line breaks around only a few characters (only).
  2884. \def\urefcatcodes{%
  2885. \catcode`\&=\active \catcode`\.=\active
  2886. \catcode`\#=\active \catcode`\?=\active
  2887. \catcode`\/=\active
  2888. }
  2889. {
  2890. \urefcatcodes
  2891. %
  2892. \global\def\urefcode{\begingroup
  2893. \setupmarkupstyle{code}%
  2894. \urefcatcodes
  2895. \let&\urefcodeamp
  2896. \let.\urefcodedot
  2897. \let#\urefcodehash
  2898. \let?\urefcodequest
  2899. \let/\urefcodeslash
  2900. \codex
  2901. }
  2902. %
  2903. % By default, they are just regular characters.
  2904. \global\def&{\normalamp}
  2905. \global\def.{\normaldot}
  2906. \global\def#{\normalhash}
  2907. \global\def?{\normalquest}
  2908. \global\def/{\normalslash}
  2909. }
  2910. % we put a little stretch before and after the breakable chars, to help
  2911. % line breaking of long url's. The unequal skips make look better in
  2912. % cmtt at least, especially for dots.
  2913. \def\urefprestretchamount{.13em}
  2914. \def\urefpoststretchamount{.1em}
  2915. \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
  2916. \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
  2917. %
  2918. \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
  2919. \def\urefcodedot{\urefprestretch .\urefpoststretch}
  2920. \def\urefcodehash{\urefprestretch \#\urefpoststretch}
  2921. \def\urefcodequest{\urefprestretch ?\urefpoststretch}
  2922. \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
  2923. {
  2924. \catcode`\/=\active
  2925. \global\def\urefcodeslashfinish{%
  2926. \urefprestretch \slashChar
  2927. % Allow line break only after the final / in a sequence of
  2928. % slashes, to avoid line break between the slashes in http://.
  2929. \ifx\next/\else \urefpoststretch \fi
  2930. }
  2931. }
  2932. % One more complication: by default we'll break after the special
  2933. % characters, but some people like to break before the special chars, so
  2934. % allow that. Also allow no breaking at all, for manual control.
  2935. %
  2936. \parseargdef\urefbreakstyle{%
  2937. \def\txiarg{#1}%
  2938. \ifx\txiarg\wordnone
  2939. \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
  2940. \else\ifx\txiarg\wordbefore
  2941. \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
  2942. \else\ifx\txiarg\wordafter
  2943. \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
  2944. \else
  2945. \errhelp = \EMsimple
  2946. \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
  2947. \fi\fi\fi
  2948. }
  2949. \def\wordafter{after}
  2950. \def\wordbefore{before}
  2951. \def\wordnone{none}
  2952. \urefbreakstyle after
  2953. % @url synonym for @uref, since that's how everyone uses it.
  2954. %
  2955. \let\url=\uref
  2956. % rms does not like angle brackets --karl, 17may97.
  2957. % So now @email is just like @uref, unless we are pdf.
  2958. %
  2959. %\def\email#1{\angleleft{\tt #1}\angleright}
  2960. \ifpdf
  2961. \def\email#1{\doemail#1,,\finish}
  2962. \def\doemail#1,#2,#3\finish{\begingroup
  2963. \unsepspaces
  2964. \pdfurl{mailto:#1}%
  2965. \setbox0 = \hbox{\ignorespaces #2}%
  2966. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  2967. \endlink
  2968. \endgroup}
  2969. \else
  2970. \ifx\XeTeXrevision\thisisundefined
  2971. \let\email=\uref
  2972. \else
  2973. \def\email#1{\doemail#1,,\finish}
  2974. \def\doemail#1,#2,#3\finish{\begingroup
  2975. \unsepspaces
  2976. \pdfurl{mailto:#1}%
  2977. \setbox0 = \hbox{\ignorespaces #2}%
  2978. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  2979. \endlink
  2980. \endgroup}
  2981. \fi
  2982. \fi
  2983. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  2984. % `example' (@kbd uses ttsl only inside of @example and friends),
  2985. % or `code' (@kbd uses normal tty font always).
  2986. \parseargdef\kbdinputstyle{%
  2987. \def\txiarg{#1}%
  2988. \ifx\txiarg\worddistinct
  2989. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  2990. \else\ifx\txiarg\wordexample
  2991. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  2992. \else\ifx\txiarg\wordcode
  2993. \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  2994. \else
  2995. \errhelp = \EMsimple
  2996. \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
  2997. \fi\fi\fi
  2998. }
  2999. \def\worddistinct{distinct}
  3000. \def\wordexample{example}
  3001. \def\wordcode{code}
  3002. % Default is `distinct'.
  3003. \kbdinputstyle distinct
  3004. % @kbd is like @code, except that if the argument is just one @key command,
  3005. % then @kbd has no effect.
  3006. \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
  3007. \def\xkey{\key}
  3008. \def\kbdsub#1#2#3\par{%
  3009. \def\one{#1}\def\three{#3}\def\threex{??}%
  3010. \ifx\one\xkey\ifx\threex\three \key{#2}%
  3011. \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  3012. \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  3013. }
  3014. % definition of @key that produces a lozenge. Doesn't adjust to text size.
  3015. %\setfont\keyrm\rmshape{8}{1000}{OT1}
  3016. %\font\keysy=cmsy9
  3017. %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
  3018. % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
  3019. % \vbox{\hrule\kern-0.4pt
  3020. % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
  3021. % \kern-0.4pt\hrule}%
  3022. % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
  3023. % definition of @key with no lozenge. If the current font is already
  3024. % monospace, don't change it; that way, we respect @kbdinputstyle. But
  3025. % if it isn't monospace, then use \tt.
  3026. %
  3027. \def\key#1{{\setupmarkupstyle{key}%
  3028. \nohyphenation
  3029. \ifmonospace\else\tt\fi
  3030. #1}\null}
  3031. % @clicksequence{File @click{} Open ...}
  3032. \def\clicksequence#1{\begingroup #1\endgroup}
  3033. % @clickstyle @arrow (by default)
  3034. \parseargdef\clickstyle{\def\click{#1}}
  3035. \def\click{\arrow}
  3036. % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
  3037. % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
  3038. %
  3039. \def\dmn#1{\thinspace #1}
  3040. % @acronym for "FBI", "NATO", and the like.
  3041. % We print this one point size smaller, since it's intended for
  3042. % all-uppercase.
  3043. %
  3044. \def\acronym#1{\doacronym #1,,\finish}
  3045. \def\doacronym#1,#2,#3\finish{%
  3046. {\selectfonts\lsize #1}%
  3047. \def\temp{#2}%
  3048. \ifx\temp\empty \else
  3049. \space ({\unsepspaces \ignorespaces \temp \unskip})%
  3050. \fi
  3051. \null % reset \spacefactor=1000
  3052. }
  3053. % @abbr for "Comput. J." and the like.
  3054. % No font change, but don't do end-of-sentence spacing.
  3055. %
  3056. \def\abbr#1{\doabbr #1,,\finish}
  3057. \def\doabbr#1,#2,#3\finish{%
  3058. {\plainfrenchspacing #1}%
  3059. \def\temp{#2}%
  3060. \ifx\temp\empty \else
  3061. \space ({\unsepspaces \ignorespaces \temp \unskip})%
  3062. \fi
  3063. \null % reset \spacefactor=1000
  3064. }
  3065. % @asis just yields its argument. Used with @table, for example.
  3066. %
  3067. \def\asis#1{#1}
  3068. % @math outputs its argument in math mode.
  3069. %
  3070. % One complication: _ usually means subscripts, but it could also mean
  3071. % an actual _ character, as in @math{@var{some_variable} + 1}. So make
  3072. % _ active, and distinguish by seeing if the current family is \slfam,
  3073. % which is what @var uses.
  3074. {
  3075. \catcode`\_ = \active
  3076. \gdef\mathunderscore{%
  3077. \catcode`\_=\active
  3078. \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
  3079. }
  3080. }
  3081. % Another complication: we want \\ (and @\) to output a math (or tt) \.
  3082. % FYI, plain.tex uses \\ as a temporary control sequence (for no
  3083. % particular reason), but this is not advertised and we don't care.
  3084. %
  3085. % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
  3086. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
  3087. %
  3088. \def\math{%
  3089. \ifmmode\else % only go into math if not in math mode already
  3090. \tex
  3091. \mathunderscore
  3092. \let\\ = \mathbackslash
  3093. \mathactive
  3094. % make the texinfo accent commands work in math mode
  3095. \let\"=\ddot
  3096. \let\'=\acute
  3097. \let\==\bar
  3098. \let\^=\hat
  3099. \let\`=\grave
  3100. \let\u=\breve
  3101. \let\v=\check
  3102. \let\~=\tilde
  3103. \let\dotaccent=\dot
  3104. % have to provide another name for sup operator
  3105. \let\mathopsup=\sup
  3106. $\expandafter\finishmath\fi
  3107. }
  3108. \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
  3109. % Some active characters (such as <) are spaced differently in math.
  3110. % We have to reset their definitions in case the @math was an argument
  3111. % to a command which sets the catcodes (such as @item or @section).
  3112. %
  3113. {
  3114. \catcode`^ = \active
  3115. \catcode`< = \active
  3116. \catcode`> = \active
  3117. \catcode`+ = \active
  3118. \catcode`' = \active
  3119. \gdef\mathactive{%
  3120. \let^ = \ptexhat
  3121. \let< = \ptexless
  3122. \let> = \ptexgtr
  3123. \let+ = \ptexplus
  3124. \let' = \ptexquoteright
  3125. }
  3126. }
  3127. % for @sub and @sup, if in math mode, just do a normal sub/superscript.
  3128. % If in text, use math to place as sub/superscript, but switch
  3129. % into text mode, with smaller fonts. This is a different font than the
  3130. % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
  3131. % fix it (significant additions to font machinery) until someone notices.
  3132. %
  3133. \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
  3134. \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
  3135. %
  3136. \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
  3137. \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
  3138. % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
  3139. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
  3140. % except specified as a normal braced arg, so no newlines to worry about.
  3141. %
  3142. \def\outfmtnametex{tex}
  3143. %
  3144. \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
  3145. \long\def\doinlinefmt#1,#2,\finish{%
  3146. \def\inlinefmtname{#1}%
  3147. \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
  3148. }
  3149. %
  3150. % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
  3151. % FMTNAME is tex, else ELSE-TEXT.
  3152. \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
  3153. \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
  3154. \def\inlinefmtname{#1}%
  3155. \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
  3156. }
  3157. %
  3158. % For raw, must switch into @tex before parsing the argument, to avoid
  3159. % setting catcodes prematurely. Doing it this way means that, for
  3160. % example, @inlineraw{html, foo{bar} gets a parse error instead of being
  3161. % ignored. But this isn't important because if people want a literal
  3162. % *right* brace they would have to use a command anyway, so they may as
  3163. % well use a command to get a left brace too. We could re-use the
  3164. % delimiter character idea from \verb, but it seems like overkill.
  3165. %
  3166. \long\def\inlineraw{\tex \doinlineraw}
  3167. \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
  3168. \def\doinlinerawtwo#1,#2,\finish{%
  3169. \def\inlinerawname{#1}%
  3170. \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
  3171. \endgroup % close group opened by \tex.
  3172. }
  3173. % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
  3174. %
  3175. \long\def\inlineifset#1{\doinlineifset #1,\finish}
  3176. \long\def\doinlineifset#1,#2,\finish{%
  3177. \def\inlinevarname{#1}%
  3178. \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
  3179. \else\ignorespaces#2\fi
  3180. }
  3181. % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
  3182. %
  3183. \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
  3184. \long\def\doinlineifclear#1,#2,\finish{%
  3185. \def\inlinevarname{#1}%
  3186. \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
  3187. }
  3188. \message{glyphs,}
  3189. % and logos.
  3190. % @@ prints an @, as does @atchar{}.
  3191. \def\@{\char64 }
  3192. \let\atchar=\@
  3193. % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
  3194. \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
  3195. \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
  3196. \let\{=\lbracechar
  3197. \let\}=\rbracechar
  3198. % @comma{} to avoid , parsing problems.
  3199. \let\comma = ,
  3200. % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  3201. % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
  3202. \let\, = \ptexc
  3203. \let\dotaccent = \ptexdot
  3204. \def\ringaccent#1{{\accent23 #1}}
  3205. \let\tieaccent = \ptext
  3206. \let\ubaraccent = \ptexb
  3207. \let\udotaccent = \d
  3208. % Other special characters: @questiondown @exclamdown @ordf @ordm
  3209. % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
  3210. \def\questiondown{?`}
  3211. \def\exclamdown{!`}
  3212. \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
  3213. \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
  3214. % Dotless i and dotless j, used for accents.
  3215. \def\imacro{i}
  3216. \def\jmacro{j}
  3217. \def\dotless#1{%
  3218. \def\temp{#1}%
  3219. \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
  3220. \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
  3221. \else \errmessage{@dotless can be used only with i or j}%
  3222. \fi\fi
  3223. }
  3224. % The \TeX{} logo, as in plain, but resetting the spacing so that a
  3225. % period following counts as ending a sentence. (Idea found in latex.)
  3226. %
  3227. \edef\TeX{\TeX \spacefactor=1000 }
  3228. % @LaTeX{} logo. Not quite the same results as the definition in
  3229. % latex.ltx, since we use a different font for the raised A; it's most
  3230. % convenient for us to use an explicitly smaller font, rather than using
  3231. % the \scriptstyle font (since we don't reset \scriptstyle and
  3232. % \scriptscriptstyle).
  3233. %
  3234. \def\LaTeX{%
  3235. L\kern-.36em
  3236. {\setbox0=\hbox{T}%
  3237. \vbox to \ht0{\hbox{%
  3238. \ifx\textnominalsize\xwordpt
  3239. % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
  3240. % Revert to plain's \scriptsize, which is 7pt.
  3241. \count255=\the\fam $\fam\count255 \scriptstyle A$%
  3242. \else
  3243. % For 11pt, we can use our lllsize.
  3244. \selectfonts\lllsize A%
  3245. \fi
  3246. }%
  3247. \vss
  3248. }}%
  3249. \kern-.15em
  3250. \TeX
  3251. }
  3252. % Some math mode symbols. Define \ensuremath to switch into math mode
  3253. % unless we are already there. Expansion tricks may not be needed here,
  3254. % but safer, and can't hurt.
  3255. \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
  3256. \def\ensuredmath#1{$\relax#1$}
  3257. %
  3258. \def\bullet{\ensuremath\ptexbullet}
  3259. \def\geq{\ensuremath\ge}
  3260. \def\leq{\ensuremath\le}
  3261. \def\minus{\ensuremath-}
  3262. % @dots{} outputs an ellipsis using the current font.
  3263. % We do .5em per period so that it has the same spacing in the cm
  3264. % typewriter fonts as three actual period characters; on the other hand,
  3265. % in other typewriter fonts three periods are wider than 1.5em. So do
  3266. % whichever is larger.
  3267. %
  3268. \def\dots{%
  3269. \leavevmode
  3270. \setbox0=\hbox{...}% get width of three periods
  3271. \ifdim\wd0 > 1.5em
  3272. \dimen0 = \wd0
  3273. \else
  3274. \dimen0 = 1.5em
  3275. \fi
  3276. \hbox to \dimen0{%
  3277. \hskip 0pt plus.25fil
  3278. .\hskip 0pt plus1fil
  3279. .\hskip 0pt plus1fil
  3280. .\hskip 0pt plus.5fil
  3281. }%
  3282. }
  3283. % @enddots{} is an end-of-sentence ellipsis.
  3284. %
  3285. \def\enddots{%
  3286. \dots
  3287. \spacefactor=\endofsentencespacefactor
  3288. }
  3289. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
  3290. %
  3291. % Since these characters are used in examples, they should be an even number of
  3292. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  3293. %
  3294. \def\point{$\star$}
  3295. \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
  3296. \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  3297. \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
  3298. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  3299. \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  3300. % The @error{} command.
  3301. % Adapted from the TeXbook's \boxit.
  3302. %
  3303. \newbox\errorbox
  3304. %
  3305. {\tentt \global\dimen0 = 3em}% Width of the box.
  3306. \dimen2 = .55pt % Thickness of rules
  3307. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  3308. \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
  3309. %
  3310. \setbox\errorbox=\hbox to \dimen0{\hfil
  3311. \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  3312. \advance\hsize by -2\dimen2 % Rules.
  3313. \vbox{%
  3314. \hrule height\dimen2
  3315. \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
  3316. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  3317. \kern3pt\vrule width\dimen2}% Space to right.
  3318. \hrule height\dimen2}
  3319. \hfil}
  3320. %
  3321. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  3322. % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
  3323. %
  3324. \def\pounds{{\it\$}}
  3325. % @euro{} comes from a separate font, depending on the current style.
  3326. % We use the free feym* fonts from the eurosym package by Henrik
  3327. % Theiling, which support regular, slanted, bold and bold slanted (and
  3328. % "outlined" (blackboard board, sort of) versions, which we don't need).
  3329. % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
  3330. %
  3331. % Although only regular is the truly official Euro symbol, we ignore
  3332. % that. The Euro is designed to be slightly taller than the regular
  3333. % font height.
  3334. %
  3335. % feymr - regular
  3336. % feymo - slanted
  3337. % feybr - bold
  3338. % feybo - bold slanted
  3339. %
  3340. % There is no good (free) typewriter version, to my knowledge.
  3341. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
  3342. % Hmm.
  3343. %
  3344. % Also doesn't work in math. Do we need to do math with euro symbols?
  3345. % Hope not.
  3346. %
  3347. %
  3348. \def\euro{{\eurofont e}}
  3349. \def\eurofont{%
  3350. % We set the font at each command, rather than predefining it in
  3351. % \textfonts and the other font-switching commands, so that
  3352. % installations which never need the symbol don't have to have the
  3353. % font installed.
  3354. %
  3355. % There is only one designed size (nominal 10pt), so we always scale
  3356. % that to the current nominal size.
  3357. %
  3358. % By the way, simply using "at 1em" works for cmr10 and the like, but
  3359. % does not work for cmbx10 and other extended/shrunken fonts.
  3360. %
  3361. \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
  3362. %
  3363. \ifx\curfontstyle\bfstylename
  3364. % bold:
  3365. \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
  3366. \else
  3367. % regular:
  3368. \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
  3369. \fi
  3370. \thiseurofont
  3371. }
  3372. % Glyphs from the EC fonts. We don't use \let for the aliases, because
  3373. % sometimes we redefine the original macro, and the alias should reflect
  3374. % the redefinition.
  3375. %
  3376. % Use LaTeX names for the Icelandic letters.
  3377. \def\DH{{\ecfont \char"D0}} % Eth
  3378. \def\dh{{\ecfont \char"F0}} % eth
  3379. \def\TH{{\ecfont \char"DE}} % Thorn
  3380. \def\th{{\ecfont \char"FE}} % thorn
  3381. %
  3382. \def\guillemetleft{{\ecfont \char"13}}
  3383. \def\guillemotleft{\guillemetleft}
  3384. \def\guillemetright{{\ecfont \char"14}}
  3385. \def\guillemotright{\guillemetright}
  3386. \def\guilsinglleft{{\ecfont \char"0E}}
  3387. \def\guilsinglright{{\ecfont \char"0F}}
  3388. \def\quotedblbase{{\ecfont \char"12}}
  3389. \def\quotesinglbase{{\ecfont \char"0D}}
  3390. %
  3391. % This positioning is not perfect (see the ogonek LaTeX package), but
  3392. % we have the precomposed glyphs for the most common cases. We put the
  3393. % tests to use those glyphs in the single \ogonek macro so we have fewer
  3394. % dummy definitions to worry about for index entries, etc.
  3395. %
  3396. % ogonek is also used with other letters in Lithuanian (IOU), but using
  3397. % the precomposed glyphs for those is not so easy since they aren't in
  3398. % the same EC font.
  3399. \def\ogonek#1{{%
  3400. \def\temp{#1}%
  3401. \ifx\temp\macrocharA\Aogonek
  3402. \else\ifx\temp\macrochara\aogonek
  3403. \else\ifx\temp\macrocharE\Eogonek
  3404. \else\ifx\temp\macrochare\eogonek
  3405. \else
  3406. \ecfont \setbox0=\hbox{#1}%
  3407. \ifdim\ht0=1ex\accent"0C #1%
  3408. \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
  3409. \fi
  3410. \fi\fi\fi\fi
  3411. }%
  3412. }
  3413. \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
  3414. \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
  3415. \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
  3416. \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
  3417. %
  3418. % Use the European Computer Modern fonts (cm-super in outline format)
  3419. % for non-CM glyphs. That is ec* for regular text and tc* for the text
  3420. % companion symbols (LaTeX TS1 encoding). Both are part of the ec
  3421. % package and follow the same conventions.
  3422. %
  3423. \def\ecfont{\etcfont{e}}
  3424. \def\tcfont{\etcfont{t}}
  3425. %
  3426. \def\etcfont#1{%
  3427. % We can't distinguish serif/sans and italic/slanted, but this
  3428. % is used for crude hacks anyway (like adding French and German
  3429. % quotes to documents typeset with CM, where we lose kerning), so
  3430. % hopefully nobody will notice/care.
  3431. \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
  3432. \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
  3433. \ifmonospace
  3434. % typewriter:
  3435. \font\thisecfont = #1ctt\ecsize \space at \nominalsize
  3436. \else
  3437. \ifx\curfontstyle\bfstylename
  3438. % bold:
  3439. \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
  3440. \else
  3441. % regular:
  3442. \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
  3443. \fi
  3444. \fi
  3445. \thisecfont
  3446. }
  3447. % @registeredsymbol - R in a circle. The font for the R should really
  3448. % be smaller yet, but lllsize is the best we can do for now.
  3449. % Adapted from the plain.tex definition of \copyright.
  3450. %
  3451. \def\registeredsymbol{%
  3452. $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
  3453. \hfil\crcr\Orb}}%
  3454. }$%
  3455. }
  3456. % @textdegree - the normal degrees sign.
  3457. %
  3458. \def\textdegree{$^\circ$}
  3459. % Laurent Siebenmann reports \Orb undefined with:
  3460. % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
  3461. % so we'll define it if necessary.
  3462. %
  3463. \ifx\Orb\thisisundefined
  3464. \def\Orb{\mathhexbox20D}
  3465. \fi
  3466. % Quotes.
  3467. \chardef\quotedblleft="5C
  3468. \chardef\quotedblright=`\"
  3469. \chardef\quoteleft=`\`
  3470. \chardef\quoteright=`\'
  3471. \message{page headings,}
  3472. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  3473. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  3474. % First the title page. Must do @settitle before @titlepage.
  3475. \newif\ifseenauthor
  3476. \newif\iffinishedtitlepage
  3477. % @setcontentsaftertitlepage used to do an implicit @contents or
  3478. % @shortcontents after @end titlepage, but it is now obsolete.
  3479. \def\setcontentsaftertitlepage{%
  3480. \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
  3481. command; move your @contents command if you want the contents
  3482. after the title page.}}%
  3483. \def\setshortcontentsaftertitlepage{%
  3484. \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
  3485. command; move your @shortcontents and @contents commands if you
  3486. want the contents after the title page.}}%
  3487. \parseargdef\shorttitlepage{%
  3488. \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  3489. \endgroup\page\hbox{}\page}
  3490. \envdef\titlepage{%
  3491. % Open one extra group, as we want to close it in the middle of \Etitlepage.
  3492. \begingroup
  3493. \parindent=0pt \textfonts
  3494. % Leave some space at the very top of the page.
  3495. \vglue\titlepagetopglue
  3496. % No rule at page bottom unless we print one at the top with @title.
  3497. \finishedtitlepagetrue
  3498. %
  3499. % Most title ``pages'' are actually two pages long, with space
  3500. % at the top of the second. We don't want the ragged left on the second.
  3501. \let\oldpage = \page
  3502. \def\page{%
  3503. \iffinishedtitlepage\else
  3504. \finishtitlepage
  3505. \fi
  3506. \let\page = \oldpage
  3507. \page
  3508. \null
  3509. }%
  3510. }
  3511. \def\Etitlepage{%
  3512. \iffinishedtitlepage\else
  3513. \finishtitlepage
  3514. \fi
  3515. % It is important to do the page break before ending the group,
  3516. % because the headline and footline are only empty inside the group.
  3517. % If we use the new definition of \page, we always get a blank page
  3518. % after the title page, which we certainly don't want.
  3519. \oldpage
  3520. \endgroup
  3521. %
  3522. % Need this before the \...aftertitlepage checks so that if they are
  3523. % in effect the toc pages will come out with page numbers.
  3524. \HEADINGSon
  3525. }
  3526. \def\finishtitlepage{%
  3527. \vskip4pt \hrule height 2pt width \hsize
  3528. \vskip\titlepagebottomglue
  3529. \finishedtitlepagetrue
  3530. }
  3531. % Settings used for typesetting titles: no hyphenation, no indentation,
  3532. % don't worry much about spacing, ragged right. This should be used
  3533. % inside a \vbox, and fonts need to be set appropriately first. Because
  3534. % it is always used for titles, nothing else, we call \rmisbold. \par
  3535. % should be specified before the end of the \vbox, since a vbox is a group.
  3536. %
  3537. \def\raggedtitlesettings{%
  3538. \rmisbold
  3539. \hyphenpenalty=10000
  3540. \parindent=0pt
  3541. \tolerance=5000
  3542. \ptexraggedright
  3543. }
  3544. % Macros to be used within @titlepage:
  3545. \let\subtitlerm=\tenrm
  3546. \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
  3547. \parseargdef\title{%
  3548. \checkenv\titlepage
  3549. \vbox{\titlefonts \raggedtitlesettings #1\par}%
  3550. % print a rule at the page bottom also.
  3551. \finishedtitlepagefalse
  3552. \vskip4pt \hrule height 4pt width \hsize \vskip4pt
  3553. }
  3554. \parseargdef\subtitle{%
  3555. \checkenv\titlepage
  3556. {\subtitlefont \rightline{#1}}%
  3557. }
  3558. % @author should come last, but may come many times.
  3559. % It can also be used inside @quotation.
  3560. %
  3561. \parseargdef\author{%
  3562. \def\temp{\quotation}%
  3563. \ifx\thisenv\temp
  3564. \def\quotationauthor{#1}% printed in \Equotation.
  3565. \else
  3566. \checkenv\titlepage
  3567. \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
  3568. {\secfonts\rmisbold \leftline{#1}}%
  3569. \fi
  3570. }
  3571. % Set up page headings and footings.
  3572. \let\thispage=\folio
  3573. \newtoks\evenheadline % headline on even pages
  3574. \newtoks\oddheadline % headline on odd pages
  3575. \newtoks\evenfootline % footline on even pages
  3576. \newtoks\oddfootline % footline on odd pages
  3577. % Now make \makeheadline and \makefootline in Plain TeX use those variables
  3578. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  3579. \else \the\evenheadline \fi}}
  3580. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  3581. \else \the\evenfootline \fi}\HEADINGShook}
  3582. \let\HEADINGShook=\relax
  3583. % Commands to set those variables.
  3584. % For example, this is what @headings on does
  3585. % @evenheading @thistitle|@thispage|@thischapter
  3586. % @oddheading @thischapter|@thispage|@thistitle
  3587. % @evenfooting @thisfile||
  3588. % @oddfooting ||@thisfile
  3589. \def\evenheading{\parsearg\evenheadingxxx}
  3590. \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
  3591. \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
  3592. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3593. \def\oddheading{\parsearg\oddheadingxxx}
  3594. \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
  3595. \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
  3596. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3597. \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
  3598. \def\evenfooting{\parsearg\evenfootingxxx}
  3599. \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
  3600. \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
  3601. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3602. \def\oddfooting{\parsearg\oddfootingxxx}
  3603. \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
  3604. \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
  3605. \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  3606. %
  3607. % Leave some space for the footline. Hopefully ok to assume
  3608. % @evenfooting will not be used by itself.
  3609. \global\advance\txipageheight by -12pt
  3610. \global\advance\vsize by -12pt
  3611. }
  3612. \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
  3613. % @evenheadingmarks top \thischapter <- chapter at the top of a page
  3614. % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
  3615. %
  3616. % The same set of arguments for:
  3617. %
  3618. % @oddheadingmarks
  3619. % @evenfootingmarks
  3620. % @oddfootingmarks
  3621. % @everyheadingmarks
  3622. % @everyfootingmarks
  3623. % These define \getoddheadingmarks, \getevenheadingmarks,
  3624. % \getoddfootingmarks, and \getevenfootingmarks, each to one of
  3625. % \gettopheadingmarks, \getbottomheadingmarks.
  3626. %
  3627. \def\evenheadingmarks{\headingmarks{even}{heading}}
  3628. \def\oddheadingmarks{\headingmarks{odd}{heading}}
  3629. \def\evenfootingmarks{\headingmarks{even}{footing}}
  3630. \def\oddfootingmarks{\headingmarks{odd}{footing}}
  3631. \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
  3632. \headingmarks{odd}{heading}{#1} }
  3633. \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
  3634. \headingmarks{odd}{footing}{#1} }
  3635. % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
  3636. \def\headingmarks#1#2#3 {%
  3637. \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
  3638. \global\expandafter\let\csname get#1#2marks\endcsname \temp
  3639. }
  3640. \everyheadingmarks bottom
  3641. \everyfootingmarks bottom
  3642. % @headings double turns headings on for double-sided printing.
  3643. % @headings single turns headings on for single-sided printing.
  3644. % @headings off turns them off.
  3645. % @headings on same as @headings double, retained for compatibility.
  3646. % @headings after turns on double-sided headings after this page.
  3647. % @headings doubleafter turns on double-sided headings after this page.
  3648. % @headings singleafter turns on single-sided headings after this page.
  3649. % By default, they are off at the start of a document,
  3650. % and turned `on' after @end titlepage.
  3651. \parseargdef\headings{\csname HEADINGS#1\endcsname}
  3652. \def\headingsoff{% non-global headings elimination
  3653. \evenheadline={\hfil}\evenfootline={\hfil}%
  3654. \oddheadline={\hfil}\oddfootline={\hfil}%
  3655. }
  3656. \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
  3657. \HEADINGSoff % it's the default
  3658. % When we turn headings on, set the page number to 1.
  3659. % For double-sided printing, put current file name in lower left corner,
  3660. % chapter name on inside top of right hand pages, document
  3661. % title on inside top of left hand pages, and page numbers on outside top
  3662. % edge of all pages.
  3663. \def\HEADINGSdouble{%
  3664. \global\pageno=1
  3665. \global\evenfootline={\hfil}
  3666. \global\oddfootline={\hfil}
  3667. \global\evenheadline={\line{\folio\hfil\thistitle}}
  3668. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3669. \global\let\contentsalignmacro = \chapoddpage
  3670. }
  3671. \let\contentsalignmacro = \chappager
  3672. % For single-sided printing, chapter title goes across top left of page,
  3673. % page number on top right.
  3674. \def\HEADINGSsingle{%
  3675. \global\pageno=1
  3676. \global\evenfootline={\hfil}
  3677. \global\oddfootline={\hfil}
  3678. \global\evenheadline={\line{\thischapterheading\hfil\folio}}
  3679. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3680. \global\let\contentsalignmacro = \chappager
  3681. }
  3682. \def\HEADINGSon{\HEADINGSdouble}
  3683. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  3684. \let\HEADINGSdoubleafter=\HEADINGSafter
  3685. \def\HEADINGSdoublex{%
  3686. \global\evenfootline={\hfil}
  3687. \global\oddfootline={\hfil}
  3688. \global\evenheadline={\line{\folio\hfil\thistitle}}
  3689. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3690. \global\let\contentsalignmacro = \chapoddpage
  3691. }
  3692. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  3693. \def\HEADINGSsinglex{%
  3694. \global\evenfootline={\hfil}
  3695. \global\oddfootline={\hfil}
  3696. \global\evenheadline={\line{\thischapterheading\hfil\folio}}
  3697. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3698. \global\let\contentsalignmacro = \chappager
  3699. }
  3700. % Subroutines used in generating headings
  3701. % This produces Day Month Year style of output.
  3702. % Only define if not already defined, in case a txi-??.tex file has set
  3703. % up a different format (e.g., txi-cs.tex does this).
  3704. \ifx\today\thisisundefined
  3705. \def\today{%
  3706. \number\day\space
  3707. \ifcase\month
  3708. \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  3709. \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  3710. \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  3711. \fi
  3712. \space\number\year}
  3713. \fi
  3714. % @settitle line... specifies the title of the document, for headings.
  3715. % It generates no output of its own.
  3716. \def\thistitle{\putwordNoTitle}
  3717. \def\settitle{\parsearg{\gdef\thistitle}}
  3718. \message{tables,}
  3719. % Tables -- @table, @ftable, @vtable, @item(x).
  3720. % default indentation of table text
  3721. \newdimen\tableindent \tableindent=.8in
  3722. % default indentation of @itemize and @enumerate text
  3723. \newdimen\itemindent \itemindent=.3in
  3724. % margin between end of table item and start of table text.
  3725. \newdimen\itemmargin \itemmargin=.1in
  3726. % used internally for \itemindent minus \itemmargin
  3727. \newdimen\itemmax
  3728. % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
  3729. % these defs.
  3730. % They also define \itemindex
  3731. % to index the item name in whatever manner is desired (perhaps none).
  3732. \newif\ifitemxneedsnegativevskip
  3733. \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
  3734. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  3735. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  3736. \def\itemzzz #1{\begingroup %
  3737. \advance\hsize by -\rightskip
  3738. \advance\hsize by -\tableindent
  3739. \setbox0=\hbox{\itemindicate{#1}}%
  3740. \itemindex{#1}%
  3741. \nobreak % This prevents a break before @itemx.
  3742. %
  3743. % If the item text does not fit in the space we have, put it on a line
  3744. % by itself, and do not allow a page break either before or after that
  3745. % line. We do not start a paragraph here because then if the next
  3746. % command is, e.g., @kindex, the whatsit would get put into the
  3747. % horizontal list on a line by itself, resulting in extra blank space.
  3748. \ifdim \wd0>\itemmax
  3749. %
  3750. % Make this a paragraph so we get the \parskip glue and wrapping,
  3751. % but leave it ragged-right.
  3752. \begingroup
  3753. \advance\leftskip by-\tableindent
  3754. \advance\hsize by\tableindent
  3755. \advance\rightskip by0pt plus1fil\relax
  3756. \leavevmode\unhbox0\par
  3757. \endgroup
  3758. %
  3759. % We're going to be starting a paragraph, but we don't want the
  3760. % \parskip glue -- logically it's part of the @item we just started.
  3761. \nobreak \vskip-\parskip
  3762. %
  3763. % Stop a page break at the \parskip glue coming up. However, if
  3764. % what follows is an environment such as @example, there will be no
  3765. % \parskip glue; then the negative vskip we just inserted would
  3766. % cause the example and the item to crash together. So we use this
  3767. % bizarre value of 10001 as a signal to \aboveenvbreak to insert
  3768. % \parskip glue after all. Section titles are handled this way also.
  3769. %
  3770. \penalty 10001
  3771. \endgroup
  3772. \itemxneedsnegativevskipfalse
  3773. \else
  3774. % The item text fits into the space. Start a paragraph, so that the
  3775. % following text (if any) will end up on the same line.
  3776. \noindent
  3777. % Do this with kerns and \unhbox so that if there is a footnote in
  3778. % the item text, it can migrate to the main vertical list and
  3779. % eventually be printed.
  3780. \nobreak\kern-\tableindent
  3781. \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  3782. \unhbox0
  3783. \nobreak\kern\dimen0
  3784. \endgroup
  3785. \itemxneedsnegativevskiptrue
  3786. \fi
  3787. }
  3788. \def\item{\errmessage{@item while not in a list environment}}
  3789. \def\itemx{\errmessage{@itemx while not in a list environment}}
  3790. % @table, @ftable, @vtable.
  3791. \envdef\table{%
  3792. \let\itemindex\gobble
  3793. \tablecheck{table}%
  3794. }
  3795. \envdef\ftable{%
  3796. \def\itemindex ##1{\doind {fn}{\code{##1}}}%
  3797. \tablecheck{ftable}%
  3798. }
  3799. \envdef\vtable{%
  3800. \def\itemindex ##1{\doind {vr}{\code{##1}}}%
  3801. \tablecheck{vtable}%
  3802. }
  3803. \def\tablecheck#1{%
  3804. \ifnum \the\catcode`\^^M=\active
  3805. \endgroup
  3806. \errmessage{This command won't work in this context; perhaps the problem is
  3807. that we are \inenvironment\thisenv}%
  3808. \def\next{\doignore{#1}}%
  3809. \else
  3810. \let\next\tablex
  3811. \fi
  3812. \next
  3813. }
  3814. \def\tablex#1{%
  3815. \def\itemindicate{#1}%
  3816. \parsearg\tabley
  3817. }
  3818. \def\tabley#1{%
  3819. {%
  3820. \makevalueexpandable
  3821. \edef\temp{\noexpand\tablez #1\space\space\space}%
  3822. \expandafter
  3823. }\temp \endtablez
  3824. }
  3825. \def\tablez #1 #2 #3 #4\endtablez{%
  3826. \aboveenvbreak
  3827. \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
  3828. \ifnum 0#2>0 \tableindent=#2\mil \fi
  3829. \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
  3830. \itemmax=\tableindent
  3831. \advance \itemmax by -\itemmargin
  3832. \advance \leftskip by \tableindent
  3833. \exdentamount=\tableindent
  3834. \parindent = 0pt
  3835. \parskip = \smallskipamount
  3836. \ifdim \parskip=0pt \parskip=2pt \fi
  3837. \let\item = \internalBitem
  3838. \let\itemx = \internalBitemx
  3839. }
  3840. \def\Etable{\endgraf\afterenvbreak}
  3841. \let\Eftable\Etable
  3842. \let\Evtable\Etable
  3843. \let\Eitemize\Etable
  3844. \let\Eenumerate\Etable
  3845. % This is the counter used by @enumerate, which is really @itemize
  3846. \newcount \itemno
  3847. \envdef\itemize{\parsearg\doitemize}
  3848. \def\doitemize#1{%
  3849. \aboveenvbreak
  3850. \itemmax=\itemindent
  3851. \advance\itemmax by -\itemmargin
  3852. \advance\leftskip by \itemindent
  3853. \exdentamount=\itemindent
  3854. \parindent=0pt
  3855. \parskip=\smallskipamount
  3856. \ifdim\parskip=0pt \parskip=2pt \fi
  3857. %
  3858. % Try typesetting the item mark so that if the document erroneously says
  3859. % something like @itemize @samp (intending @table), there's an error
  3860. % right away at the @itemize. It's not the best error message in the
  3861. % world, but it's better than leaving it to the @item. This means if
  3862. % the user wants an empty mark, they have to say @w{} not just @w.
  3863. \def\itemcontents{#1}%
  3864. \setbox0 = \hbox{\itemcontents}%
  3865. %
  3866. % @itemize with no arg is equivalent to @itemize @bullet.
  3867. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
  3868. %
  3869. \let\item=\itemizeitem
  3870. }
  3871. % Definition of @item while inside @itemize and @enumerate.
  3872. %
  3873. \def\itemizeitem{%
  3874. \advance\itemno by 1 % for enumerations
  3875. {\let\par=\endgraf \smallbreak}% reasonable place to break
  3876. {%
  3877. % If the document has an @itemize directly after a section title, a
  3878. % \nobreak will be last on the list, and \sectionheading will have
  3879. % done a \vskip-\parskip. In that case, we don't want to zero
  3880. % parskip, or the item text will crash with the heading. On the
  3881. % other hand, when there is normal text preceding the item (as there
  3882. % usually is), we do want to zero parskip, or there would be too much
  3883. % space. In that case, we won't have a \nobreak before. At least
  3884. % that's the theory.
  3885. \ifnum\lastpenalty<10000 \parskip=0in \fi
  3886. \noindent
  3887. \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
  3888. %
  3889. \ifinner\else
  3890. \vadjust{\penalty 1200}% not good to break after first line of item.
  3891. \fi
  3892. % We can be in inner vertical mode in a footnote, although an
  3893. % @itemize looks awful there.
  3894. }%
  3895. \flushcr
  3896. }
  3897. % \splitoff TOKENS\endmark defines \first to be the first token in
  3898. % TOKENS, and \rest to be the remainder.
  3899. %
  3900. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  3901. % Allow an optional argument of an uppercase letter, lowercase letter,
  3902. % or number, to specify the first label in the enumerated list. No
  3903. % argument is the same as `1'.
  3904. %
  3905. \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
  3906. \def\enumeratey #1 #2\endenumeratey{%
  3907. % If we were given no argument, pretend we were given `1'.
  3908. \def\thearg{#1}%
  3909. \ifx\thearg\empty \def\thearg{1}\fi
  3910. %
  3911. % Detect if the argument is a single token. If so, it might be a
  3912. % letter. Otherwise, the only valid thing it can be is a number.
  3913. % (We will always have one token, because of the test we just made.
  3914. % This is a good thing, since \splitoff doesn't work given nothing at
  3915. % all -- the first parameter is undelimited.)
  3916. \expandafter\splitoff\thearg\endmark
  3917. \ifx\rest\empty
  3918. % Only one token in the argument. It could still be anything.
  3919. % A ``lowercase letter'' is one whose \lccode is nonzero.
  3920. % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  3921. % not equal to itself.
  3922. % Otherwise, we assume it's a number.
  3923. %
  3924. % We need the \relax at the end of the \ifnum lines to stop TeX from
  3925. % continuing to look for a <number>.
  3926. %
  3927. \ifnum\lccode\expandafter`\thearg=0\relax
  3928. \numericenumerate % a number (we hope)
  3929. \else
  3930. % It's a letter.
  3931. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  3932. \lowercaseenumerate % lowercase letter
  3933. \else
  3934. \uppercaseenumerate % uppercase letter
  3935. \fi
  3936. \fi
  3937. \else
  3938. % Multiple tokens in the argument. We hope it's a number.
  3939. \numericenumerate
  3940. \fi
  3941. }
  3942. % An @enumerate whose labels are integers. The starting integer is
  3943. % given in \thearg.
  3944. %
  3945. \def\numericenumerate{%
  3946. \itemno = \thearg
  3947. \startenumeration{\the\itemno}%
  3948. }
  3949. % The starting (lowercase) letter is in \thearg.
  3950. \def\lowercaseenumerate{%
  3951. \itemno = \expandafter`\thearg
  3952. \startenumeration{%
  3953. % Be sure we're not beyond the end of the alphabet.
  3954. \ifnum\itemno=0
  3955. \errmessage{No more lowercase letters in @enumerate; get a bigger
  3956. alphabet}%
  3957. \fi
  3958. \char\lccode\itemno
  3959. }%
  3960. }
  3961. % The starting (uppercase) letter is in \thearg.
  3962. \def\uppercaseenumerate{%
  3963. \itemno = \expandafter`\thearg
  3964. \startenumeration{%
  3965. % Be sure we're not beyond the end of the alphabet.
  3966. \ifnum\itemno=0
  3967. \errmessage{No more uppercase letters in @enumerate; get a bigger
  3968. alphabet}
  3969. \fi
  3970. \char\uccode\itemno
  3971. }%
  3972. }
  3973. % Call \doitemize, adding a period to the first argument and supplying the
  3974. % common last two arguments. Also subtract one from the initial value in
  3975. % \itemno, since @item increments \itemno.
  3976. %
  3977. \def\startenumeration#1{%
  3978. \advance\itemno by -1
  3979. \doitemize{#1.}\flushcr
  3980. }
  3981. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  3982. % to @enumerate.
  3983. %
  3984. \def\alphaenumerate{\enumerate{a}}
  3985. \def\capsenumerate{\enumerate{A}}
  3986. \def\Ealphaenumerate{\Eenumerate}
  3987. \def\Ecapsenumerate{\Eenumerate}
  3988. % @multitable macros
  3989. % Amy Hendrickson, 8/18/94, 3/6/96
  3990. %
  3991. % @multitable ... @end multitable will make as many columns as desired.
  3992. % Contents of each column will wrap at width given in preamble. Width
  3993. % can be specified either with sample text given in a template line,
  3994. % or in percent of \hsize, the current width of text on page.
  3995. % Table can continue over pages but will only break between lines.
  3996. % To make preamble:
  3997. %
  3998. % Either define widths of columns in terms of percent of \hsize:
  3999. % @multitable @columnfractions .25 .3 .45
  4000. % @item ...
  4001. %
  4002. % Numbers following @columnfractions are the percent of the total
  4003. % current hsize to be used for each column. You may use as many
  4004. % columns as desired.
  4005. % Or use a template:
  4006. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  4007. % @item ...
  4008. % using the widest term desired in each column.
  4009. % Each new table line starts with @item, each subsequent new column
  4010. % starts with @tab. Empty columns may be produced by supplying @tab's
  4011. % with nothing between them for as many times as empty columns are needed,
  4012. % ie, @tab@tab@tab will produce two empty columns.
  4013. % @item, @tab do not need to be on their own lines, but it will not hurt
  4014. % if they are.
  4015. % Sample multitable:
  4016. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  4017. % @item first col stuff @tab second col stuff @tab third col
  4018. % @item
  4019. % first col stuff
  4020. % @tab
  4021. % second col stuff
  4022. % @tab
  4023. % third col
  4024. % @item first col stuff @tab second col stuff
  4025. % @tab Many paragraphs of text may be used in any column.
  4026. %
  4027. % They will wrap at the width determined by the template.
  4028. % @item@tab@tab This will be in third column.
  4029. % @end multitable
  4030. % Default dimensions may be reset by user.
  4031. % @multitableparskip is vertical space between paragraphs in table.
  4032. % @multitableparindent is paragraph indent in table.
  4033. % @multitablecolmargin is horizontal space to be left between columns.
  4034. % @multitablelinespace is space to leave between table items, baseline
  4035. % to baseline.
  4036. % 0pt means it depends on current normal line spacing.
  4037. %
  4038. \newskip\multitableparskip
  4039. \newskip\multitableparindent
  4040. \newdimen\multitablecolspace
  4041. \newskip\multitablelinespace
  4042. \multitableparskip=0pt
  4043. \multitableparindent=6pt
  4044. \multitablecolspace=12pt
  4045. \multitablelinespace=0pt
  4046. % Macros used to set up halign preamble:
  4047. %
  4048. \let\endsetuptable\relax
  4049. \def\xendsetuptable{\endsetuptable}
  4050. \let\columnfractions\relax
  4051. \def\xcolumnfractions{\columnfractions}
  4052. \newif\ifsetpercent
  4053. % #1 is the @columnfraction, usually a decimal number like .5, but might
  4054. % be just 1. We just use it, whatever it is.
  4055. %
  4056. \def\pickupwholefraction#1 {%
  4057. \global\advance\colcount by 1
  4058. \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
  4059. \setuptable
  4060. }
  4061. \newcount\colcount
  4062. \def\setuptable#1{%
  4063. \def\firstarg{#1}%
  4064. \ifx\firstarg\xendsetuptable
  4065. \let\go = \relax
  4066. \else
  4067. \ifx\firstarg\xcolumnfractions
  4068. \global\setpercenttrue
  4069. \else
  4070. \ifsetpercent
  4071. \let\go\pickupwholefraction
  4072. \else
  4073. \global\advance\colcount by 1
  4074. \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
  4075. % separator; typically that is always in the input, anyway.
  4076. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  4077. \fi
  4078. \fi
  4079. \ifx\go\pickupwholefraction
  4080. % Put the argument back for the \pickupwholefraction call, so
  4081. % we'll always have a period there to be parsed.
  4082. \def\go{\pickupwholefraction#1}%
  4083. \else
  4084. \let\go = \setuptable
  4085. \fi%
  4086. \fi
  4087. \go
  4088. }
  4089. % multitable-only commands.
  4090. %
  4091. % @headitem starts a heading row, which we typeset in bold. Assignments
  4092. % have to be global since we are inside the implicit group of an
  4093. % alignment entry. \everycr below resets \everytab so we don't have to
  4094. % undo it ourselves.
  4095. \def\headitemfont{\b}% for people to use in the template row; not changeable
  4096. \def\headitem{%
  4097. \checkenv\multitable
  4098. \crcr
  4099. \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
  4100. \global\everytab={\bf}% can't use \headitemfont since the parsing differs
  4101. \the\everytab % for the first item
  4102. }%
  4103. %
  4104. % default for tables with no headings.
  4105. \let\headitemcrhook=\relax
  4106. %
  4107. % A \tab used to include \hskip1sp. But then the space in a template
  4108. % line is not enough. That is bad. So let's go back to just `&' until
  4109. % we again encounter the problem the 1sp was intended to solve.
  4110. % --karl, nathan@acm.org, 20apr99.
  4111. \def\tab{\checkenv\multitable &\the\everytab}%
  4112. % @multitable ... @end multitable definitions:
  4113. %
  4114. \newtoks\everytab % insert after every tab.
  4115. %
  4116. \envdef\multitable{%
  4117. \vskip\parskip
  4118. \startsavinginserts
  4119. %
  4120. % @item within a multitable starts a normal row.
  4121. % We use \def instead of \let so that if one of the multitable entries
  4122. % contains an @itemize, we don't choke on the \item (seen as \crcr aka
  4123. % \endtemplate) expanding \doitemize.
  4124. \def\item{\crcr}%
  4125. %
  4126. \tolerance=9500
  4127. \hbadness=9500
  4128. \setmultitablespacing
  4129. \parskip=\multitableparskip
  4130. \parindent=\multitableparindent
  4131. \overfullrule=0pt
  4132. \global\colcount=0
  4133. %
  4134. \everycr = {%
  4135. \noalign{%
  4136. \global\everytab={}% Reset from possible headitem.
  4137. \global\colcount=0 % Reset the column counter.
  4138. %
  4139. % Check for saved footnotes, etc.:
  4140. \checkinserts
  4141. %
  4142. % Perhaps a \nobreak, then reset:
  4143. \headitemcrhook
  4144. \global\let\headitemcrhook=\relax
  4145. }%
  4146. }%
  4147. %
  4148. \parsearg\domultitable
  4149. }
  4150. \def\domultitable#1{%
  4151. % To parse everything between @multitable and @item:
  4152. \setuptable#1 \endsetuptable
  4153. %
  4154. % This preamble sets up a generic column definition, which will
  4155. % be used as many times as user calls for columns.
  4156. % \vtop will set a single line and will also let text wrap and
  4157. % continue for many paragraphs if desired.
  4158. \halign\bgroup &%
  4159. \global\advance\colcount by 1
  4160. \multistrut
  4161. \vtop{%
  4162. % Use the current \colcount to find the correct column width:
  4163. \hsize=\expandafter\csname col\the\colcount\endcsname
  4164. %
  4165. % In order to keep entries from bumping into each other
  4166. % we will add a \leftskip of \multitablecolspace to all columns after
  4167. % the first one.
  4168. %
  4169. % If a template has been used, we will add \multitablecolspace
  4170. % to the width of each template entry.
  4171. %
  4172. % If the user has set preamble in terms of percent of \hsize we will
  4173. % use that dimension as the width of the column, and the \leftskip
  4174. % will keep entries from bumping into each other. Table will start at
  4175. % left margin and final column will justify at right margin.
  4176. %
  4177. % Make sure we don't inherit \rightskip from the outer environment.
  4178. \rightskip=0pt
  4179. \ifnum\colcount=1
  4180. % The first column will be indented with the surrounding text.
  4181. \advance\hsize by\leftskip
  4182. \else
  4183. \ifsetpercent \else
  4184. % If user has not set preamble in terms of percent of \hsize
  4185. % we will advance \hsize by \multitablecolspace.
  4186. \advance\hsize by \multitablecolspace
  4187. \fi
  4188. % In either case we will make \leftskip=\multitablecolspace:
  4189. \leftskip=\multitablecolspace
  4190. \fi
  4191. % Ignoring space at the beginning and end avoids an occasional spurious
  4192. % blank line, when TeX decides to break the line at the space before the
  4193. % box from the multistrut, so the strut ends up on a line by itself.
  4194. % For example:
  4195. % @multitable @columnfractions .11 .89
  4196. % @item @code{#}
  4197. % @tab Legal holiday which is valid in major parts of the whole country.
  4198. % Is automatically provided with highlighting sequences respectively
  4199. % marking characters.
  4200. \noindent\ignorespaces##\unskip\multistrut
  4201. }\cr
  4202. }
  4203. \def\Emultitable{%
  4204. \crcr
  4205. \egroup % end the \halign
  4206. \global\setpercentfalse
  4207. }
  4208. \def\setmultitablespacing{%
  4209. \def\multistrut{\strut}% just use the standard line spacing
  4210. %
  4211. % Compute \multitablelinespace (if not defined by user) for use in
  4212. % \multitableparskip calculation. We used define \multistrut based on
  4213. % this, but (ironically) that caused the spacing to be off.
  4214. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
  4215. \ifdim\multitablelinespace=0pt
  4216. \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
  4217. \global\advance\multitablelinespace by-\ht0
  4218. \fi
  4219. % Test to see if parskip is larger than space between lines of
  4220. % table. If not, do nothing.
  4221. % If so, set to same dimension as multitablelinespace.
  4222. \ifdim\multitableparskip>\multitablelinespace
  4223. \global\multitableparskip=\multitablelinespace
  4224. \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
  4225. % than skip between lines in the table.
  4226. \fi%
  4227. \ifdim\multitableparskip=0pt
  4228. \global\multitableparskip=\multitablelinespace
  4229. \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
  4230. % than skip between lines in the table.
  4231. \fi}
  4232. \message{conditionals,}
  4233. % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
  4234. % @ifnotxml always succeed. They currently do nothing; we don't
  4235. % attempt to check whether the conditionals are properly nested. But we
  4236. % have to remember that they are conditionals, so that @end doesn't
  4237. % attempt to close an environment group.
  4238. %
  4239. \def\makecond#1{%
  4240. \expandafter\let\csname #1\endcsname = \relax
  4241. \expandafter\let\csname iscond.#1\endcsname = 1
  4242. }
  4243. \makecond{iftex}
  4244. \makecond{ifnotdocbook}
  4245. \makecond{ifnothtml}
  4246. \makecond{ifnotinfo}
  4247. \makecond{ifnotplaintext}
  4248. \makecond{ifnotxml}
  4249. % Ignore @ignore, @ifhtml, @ifinfo, and the like.
  4250. %
  4251. \def\direntry{\doignore{direntry}}
  4252. \def\documentdescription{\doignore{documentdescription}}
  4253. \def\docbook{\doignore{docbook}}
  4254. \def\html{\doignore{html}}
  4255. \def\ifdocbook{\doignore{ifdocbook}}
  4256. \def\ifhtml{\doignore{ifhtml}}
  4257. \def\ifinfo{\doignore{ifinfo}}
  4258. \def\ifnottex{\doignore{ifnottex}}
  4259. \def\ifplaintext{\doignore{ifplaintext}}
  4260. \def\ifxml{\doignore{ifxml}}
  4261. \def\ignore{\doignore{ignore}}
  4262. \def\menu{\doignore{menu}}
  4263. \def\xml{\doignore{xml}}
  4264. % Ignore text until a line `@end #1', keeping track of nested conditionals.
  4265. %
  4266. % A count to remember the depth of nesting.
  4267. \newcount\doignorecount
  4268. \def\doignore#1{\begingroup
  4269. % Scan in ``verbatim'' mode:
  4270. \obeylines
  4271. \catcode`\@ = \other
  4272. \catcode`\{ = \other
  4273. \catcode`\} = \other
  4274. %
  4275. % Make sure that spaces turn into tokens that match what \doignoretext wants.
  4276. \spaceisspace
  4277. %
  4278. % Count number of #1's that we've seen.
  4279. \doignorecount = 0
  4280. %
  4281. % Swallow text until we reach the matching `@end #1'.
  4282. \dodoignore{#1}%
  4283. }
  4284. { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
  4285. \obeylines %
  4286. %
  4287. \gdef\dodoignore#1{%
  4288. % #1 contains the command name as a string, e.g., `ifinfo'.
  4289. %
  4290. % Define a command to find the next `@end #1'.
  4291. \long\def\doignoretext##1^^M@end #1{%
  4292. \doignoretextyyy##1^^M@#1\_STOP_}%
  4293. %
  4294. % And this command to find another #1 command, at the beginning of a
  4295. % line. (Otherwise, we would consider a line `@c @ifset', for
  4296. % example, to count as an @ifset for nesting.)
  4297. \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
  4298. %
  4299. % And now expand that command.
  4300. \doignoretext ^^M%
  4301. }%
  4302. }
  4303. \def\doignoreyyy#1{%
  4304. \def\temp{#1}%
  4305. \ifx\temp\empty % Nothing found.
  4306. \let\next\doignoretextzzz
  4307. \else % Found a nested condition, ...
  4308. \advance\doignorecount by 1
  4309. \let\next\doignoretextyyy % ..., look for another.
  4310. % If we're here, #1 ends with ^^M\ifinfo (for example).
  4311. \fi
  4312. \next #1% the token \_STOP_ is present just after this macro.
  4313. }
  4314. % We have to swallow the remaining "\_STOP_".
  4315. %
  4316. \def\doignoretextzzz#1{%
  4317. \ifnum\doignorecount = 0 % We have just found the outermost @end.
  4318. \let\next\enddoignore
  4319. \else % Still inside a nested condition.
  4320. \advance\doignorecount by -1
  4321. \let\next\doignoretext % Look for the next @end.
  4322. \fi
  4323. \next
  4324. }
  4325. % Finish off ignored text.
  4326. { \obeylines%
  4327. % Ignore anything after the last `@end #1'; this matters in verbatim
  4328. % environments, where otherwise the newline after an ignored conditional
  4329. % would result in a blank line in the output.
  4330. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
  4331. }
  4332. % @set VAR sets the variable VAR to an empty value.
  4333. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  4334. %
  4335. % Since we want to separate VAR from REST-OF-LINE (which might be
  4336. % empty), we can't just use \parsearg; we have to insert a space of our
  4337. % own to delimit the rest of the line, and then take it out again if we
  4338. % didn't need it.
  4339. % We rely on the fact that \parsearg sets \catcode`\ =10.
  4340. %
  4341. \parseargdef\set{\setyyy#1 \endsetyyy}
  4342. \def\setyyy#1 #2\endsetyyy{%
  4343. {%
  4344. \makevalueexpandable
  4345. \def\temp{#2}%
  4346. \edef\next{\gdef\makecsname{SET#1}}%
  4347. \ifx\temp\empty
  4348. \next{}%
  4349. \else
  4350. \setzzz#2\endsetzzz
  4351. \fi
  4352. }%
  4353. }
  4354. % Remove the trailing space \setxxx inserted.
  4355. \def\setzzz#1 \endsetzzz{\next{#1}}
  4356. % @clear VAR clears (i.e., unsets) the variable VAR.
  4357. %
  4358. \parseargdef\clear{%
  4359. {%
  4360. \makevalueexpandable
  4361. \global\expandafter\let\csname SET#1\endcsname=\relax
  4362. }%
  4363. }
  4364. % @value{foo} gets the text saved in variable foo.
  4365. \def\value{\begingroup\makevalueexpandable\valuexxx}
  4366. \def\valuexxx#1{\expandablevalue{#1}\endgroup}
  4367. {
  4368. \catcode`\-=\active \catcode`\_=\active
  4369. %
  4370. \gdef\makevalueexpandable{%
  4371. \let\value = \expandablevalue
  4372. % We don't want these characters active, ...
  4373. \catcode`\-=\other \catcode`\_=\other
  4374. % ..., but we might end up with active ones in the argument if
  4375. % we're called from @code, as @code{@value{foo-bar_}}, though.
  4376. % So \let them to their normal equivalents.
  4377. \let-\normaldash \let_\normalunderscore
  4378. }
  4379. }
  4380. % We have this subroutine so that we can handle at least some @value's
  4381. % properly in indexes (we call \makevalueexpandable in \indexdummies).
  4382. % The command has to be fully expandable (if the variable is set), since
  4383. % the result winds up in the index file. This means that if the
  4384. % variable's value contains other Texinfo commands, it's almost certain
  4385. % it will fail (although perhaps we could fix that with sufficient work
  4386. % to do a one-level expansion on the result, instead of complete).
  4387. %
  4388. % Unfortunately, this has the consequence that when _ is in the *value*
  4389. % of an @set, it does not print properly in the roman fonts (get the cmr
  4390. % dot accent at position 126 instead). No fix comes to mind, and it's
  4391. % been this way since 2003 or earlier, so just ignore it.
  4392. %
  4393. \def\expandablevalue#1{%
  4394. \expandafter\ifx\csname SET#1\endcsname\relax
  4395. {[No value for ``#1'']}%
  4396. \message{Variable `#1', used in @value, is not set.}%
  4397. \else
  4398. \csname SET#1\endcsname
  4399. \fi
  4400. }
  4401. % Like \expandablevalue, but completely expandable (the \message in the
  4402. % definition above operates at the execution level of TeX). Used when
  4403. % writing to auxiliary files, due to the expansion that \write does.
  4404. % If flag is undefined, pass through an unexpanded @value command: maybe it
  4405. % will be set by the time it is read back in.
  4406. %
  4407. % NB flag names containing - or _ may not work here.
  4408. \def\dummyvalue#1{%
  4409. \expandafter\ifx\csname SET#1\endcsname\relax
  4410. \noexpand\value{#1}%
  4411. \else
  4412. \csname SET#1\endcsname
  4413. \fi
  4414. }
  4415. % Used for @value's in index entries to form the sort key: expand the @value
  4416. % if possible, otherwise sort late.
  4417. \def\indexnofontsvalue#1{%
  4418. \expandafter\ifx\csname SET#1\endcsname\relax
  4419. ZZZZZZZ
  4420. \else
  4421. \csname SET#1\endcsname
  4422. \fi
  4423. }
  4424. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  4425. % with @set.
  4426. %
  4427. % To get the special treatment we need for `@end ifset,' we call
  4428. % \makecond and then redefine.
  4429. %
  4430. \makecond{ifset}
  4431. \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
  4432. \def\doifset#1#2{%
  4433. {%
  4434. \makevalueexpandable
  4435. \let\next=\empty
  4436. \expandafter\ifx\csname SET#2\endcsname\relax
  4437. #1% If not set, redefine \next.
  4438. \fi
  4439. \expandafter
  4440. }\next
  4441. }
  4442. \def\ifsetfail{\doignore{ifset}}
  4443. % @ifclear VAR ... @end executes the `...' iff VAR has never been
  4444. % defined with @set, or has been undefined with @clear.
  4445. %
  4446. % The `\else' inside the `\doifset' parameter is a trick to reuse the
  4447. % above code: if the variable is not set, do nothing, if it is set,
  4448. % then redefine \next to \ifclearfail.
  4449. %
  4450. \makecond{ifclear}
  4451. \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
  4452. \def\ifclearfail{\doignore{ifclear}}
  4453. % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
  4454. % without the @) is in fact defined. We can only feasibly check at the
  4455. % TeX level, so something like `mathcode' is going to considered
  4456. % defined even though it is not a Texinfo command.
  4457. %
  4458. \makecond{ifcommanddefined}
  4459. \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
  4460. %
  4461. \def\doifcmddefined#1#2{{%
  4462. \makevalueexpandable
  4463. \let\next=\empty
  4464. \expandafter\ifx\csname #2\endcsname\relax
  4465. #1% If not defined, \let\next as above.
  4466. \fi
  4467. \expandafter
  4468. }\next
  4469. }
  4470. \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
  4471. % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
  4472. \makecond{ifcommandnotdefined}
  4473. \def\ifcommandnotdefined{%
  4474. \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
  4475. \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
  4476. % Set the `txicommandconditionals' variable, so documents have a way to
  4477. % test if the @ifcommand...defined conditionals are available.
  4478. \set txicommandconditionals
  4479. % @dircategory CATEGORY -- specify a category of the dir file
  4480. % which this file should belong to. Ignore this in TeX.
  4481. \let\dircategory=\comment
  4482. % @defininfoenclose.
  4483. \let\definfoenclose=\comment
  4484. \message{indexing,}
  4485. % Index generation facilities
  4486. % Define \newwrite to be identical to plain tex's \newwrite
  4487. % except not \outer, so it can be used within macros and \if's.
  4488. \edef\newwrite{\makecsname{ptexnewwrite}}
  4489. % \newindex {foo} defines an index named IX.
  4490. % It automatically defines \IXindex such that
  4491. % \IXindex ...rest of line... puts an entry in the index IX.
  4492. % It also defines \IXindfile to be the number of the output channel for
  4493. % the file that accumulates this index. The file's extension is IX.
  4494. % The name of an index should be no more than 2 characters long
  4495. % for the sake of vms.
  4496. %
  4497. \def\newindex#1{%
  4498. \expandafter\chardef\csname#1indfile\endcsname=0
  4499. \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
  4500. \noexpand\doindex{#1}}
  4501. }
  4502. % @defindex foo == \newindex{foo}
  4503. %
  4504. \def\defindex{\parsearg\newindex}
  4505. % Define @defcodeindex, like @defindex except put all entries in @code.
  4506. %
  4507. \def\defcodeindex{\parsearg\newcodeindex}
  4508. %
  4509. \def\newcodeindex#1{%
  4510. \expandafter\chardef\csname#1indfile\endcsname=0
  4511. \expandafter\xdef\csname#1index\endcsname{%
  4512. \noexpand\docodeindex{#1}}%
  4513. }
  4514. % The default indices:
  4515. \newindex{cp}% concepts,
  4516. \newcodeindex{fn}% functions,
  4517. \newcodeindex{vr}% variables,
  4518. \newcodeindex{tp}% types,
  4519. \newcodeindex{ky}% keys
  4520. \newcodeindex{pg}% and programs.
  4521. % @synindex foo bar makes index foo feed into index bar.
  4522. % Do this instead of @defindex foo if you don't want it as a separate index.
  4523. %
  4524. % @syncodeindex foo bar similar, but put all entries made for index foo
  4525. % inside @code.
  4526. %
  4527. \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
  4528. \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
  4529. % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
  4530. % #3 the target index (bar).
  4531. \def\dosynindex#1#2#3{%
  4532. \requireopenindexfile{#3}%
  4533. % redefine \fooindfile:
  4534. \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  4535. \expandafter\let\csname#2indfile\endcsname=\temp
  4536. % redefine \fooindex:
  4537. \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
  4538. }
  4539. % Define \doindex, the driver for all index macros.
  4540. % Argument #1 is generated by the calling \fooindex macro,
  4541. % and it is the two-letter name of the index.
  4542. \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
  4543. \def\doindexxxx #1{\doind{\indexname}{#1}}
  4544. % like the previous two, but they put @code around the argument.
  4545. \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
  4546. \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
  4547. % Used when writing an index entry out to an index file to prevent
  4548. % expansion of Texinfo commands that can appear in an index entry.
  4549. %
  4550. \def\indexdummies{%
  4551. \escapechar = `\\ % use backslash in output files.
  4552. \definedummyletter\@%
  4553. \definedummyletter\ %
  4554. %
  4555. % For texindex which always views { and } as separators.
  4556. \def\{{\lbracechar{}}%
  4557. \def\}{\rbracechar{}}%
  4558. %
  4559. % Do the redefinitions.
  4560. \definedummies
  4561. }
  4562. % Used for the aux and toc files, where @ is the escape character.
  4563. %
  4564. \def\atdummies{%
  4565. \definedummyletter\@%
  4566. \definedummyletter\ %
  4567. \definedummyletter\{%
  4568. \definedummyletter\}%
  4569. %
  4570. % Do the redefinitions.
  4571. \definedummies
  4572. \otherbackslash
  4573. }
  4574. % \definedummyword defines \#1 as \string\#1\space, thus effectively
  4575. % preventing its expansion. This is used only for control words,
  4576. % not control letters, because the \space would be incorrect for
  4577. % control characters, but is needed to separate the control word
  4578. % from whatever follows.
  4579. %
  4580. % These can be used both for control words that take an argument and
  4581. % those that do not. If it is followed by {arg} in the input, then
  4582. % that will dutifully get written to the index (or wherever).
  4583. %
  4584. % For control letters, we have \definedummyletter, which omits the
  4585. % space.
  4586. %
  4587. \def\definedummyword #1{\def#1{\string#1\space}}%
  4588. \def\definedummyletter#1{\def#1{\string#1}}%
  4589. \let\definedummyaccent\definedummyletter
  4590. % Called from \indexdummies and \atdummies, to effectively prevent
  4591. % the expansion of commands.
  4592. %
  4593. \def\definedummies{%
  4594. %
  4595. \let\commondummyword\definedummyword
  4596. \let\commondummyletter\definedummyletter
  4597. \let\commondummyaccent\definedummyaccent
  4598. \commondummiesnofonts
  4599. %
  4600. \definedummyletter\_%
  4601. \definedummyletter\-%
  4602. %
  4603. % Non-English letters.
  4604. \definedummyword\AA
  4605. \definedummyword\AE
  4606. \definedummyword\DH
  4607. \definedummyword\L
  4608. \definedummyword\O
  4609. \definedummyword\OE
  4610. \definedummyword\TH
  4611. \definedummyword\aa
  4612. \definedummyword\ae
  4613. \definedummyword\dh
  4614. \definedummyword\exclamdown
  4615. \definedummyword\l
  4616. \definedummyword\o
  4617. \definedummyword\oe
  4618. \definedummyword\ordf
  4619. \definedummyword\ordm
  4620. \definedummyword\questiondown
  4621. \definedummyword\ss
  4622. \definedummyword\th
  4623. %
  4624. % Although these internal commands shouldn't show up, sometimes they do.
  4625. \definedummyword\bf
  4626. \definedummyword\gtr
  4627. \definedummyword\hat
  4628. \definedummyword\less
  4629. \definedummyword\sf
  4630. \definedummyword\sl
  4631. \definedummyword\tclose
  4632. \definedummyword\tt
  4633. %
  4634. \definedummyword\LaTeX
  4635. \definedummyword\TeX
  4636. %
  4637. % Assorted special characters.
  4638. \definedummyword\atchar
  4639. \definedummyword\arrow
  4640. \definedummyword\bullet
  4641. \definedummyword\comma
  4642. \definedummyword\copyright
  4643. \definedummyword\registeredsymbol
  4644. \definedummyword\dots
  4645. \definedummyword\enddots
  4646. \definedummyword\entrybreak
  4647. \definedummyword\equiv
  4648. \definedummyword\error
  4649. \definedummyword\euro
  4650. \definedummyword\expansion
  4651. \definedummyword\geq
  4652. \definedummyword\guillemetleft
  4653. \definedummyword\guillemetright
  4654. \definedummyword\guilsinglleft
  4655. \definedummyword\guilsinglright
  4656. \definedummyword\lbracechar
  4657. \definedummyword\leq
  4658. \definedummyword\mathopsup
  4659. \definedummyword\minus
  4660. \definedummyword\ogonek
  4661. \definedummyword\pounds
  4662. \definedummyword\point
  4663. \definedummyword\print
  4664. \definedummyword\quotedblbase
  4665. \definedummyword\quotedblleft
  4666. \definedummyword\quotedblright
  4667. \definedummyword\quoteleft
  4668. \definedummyword\quoteright
  4669. \definedummyword\quotesinglbase
  4670. \definedummyword\rbracechar
  4671. \definedummyword\result
  4672. \definedummyword\sub
  4673. \definedummyword\sup
  4674. \definedummyword\textdegree
  4675. %
  4676. % We want to disable all macros so that they are not expanded by \write.
  4677. \macrolist
  4678. \let\value\dummyvalue
  4679. %
  4680. \normalturnoffactive
  4681. }
  4682. % \commondummiesnofonts: common to \definedummies and \indexnofonts.
  4683. % Define \commondummyletter, \commondummyaccent and \commondummyword before
  4684. % using. Used for accents, font commands, and various control letters.
  4685. %
  4686. \def\commondummiesnofonts{%
  4687. % Control letters and accents.
  4688. \commondummyletter\!%
  4689. \commondummyaccent\"%
  4690. \commondummyaccent\'%
  4691. \commondummyletter\*%
  4692. \commondummyaccent\,%
  4693. \commondummyletter\.%
  4694. \commondummyletter\/%
  4695. \commondummyletter\:%
  4696. \commondummyaccent\=%
  4697. \commondummyletter\?%
  4698. \commondummyaccent\^%
  4699. \commondummyaccent\`%
  4700. \commondummyaccent\~%
  4701. \commondummyword\u
  4702. \commondummyword\v
  4703. \commondummyword\H
  4704. \commondummyword\dotaccent
  4705. \commondummyword\ogonek
  4706. \commondummyword\ringaccent
  4707. \commondummyword\tieaccent
  4708. \commondummyword\ubaraccent
  4709. \commondummyword\udotaccent
  4710. \commondummyword\dotless
  4711. %
  4712. % Texinfo font commands.
  4713. \commondummyword\b
  4714. \commondummyword\i
  4715. \commondummyword\r
  4716. \commondummyword\sansserif
  4717. \commondummyword\sc
  4718. \commondummyword\slanted
  4719. \commondummyword\t
  4720. %
  4721. % Commands that take arguments.
  4722. \commondummyword\abbr
  4723. \commondummyword\acronym
  4724. \commondummyword\anchor
  4725. \commondummyword\cite
  4726. \commondummyword\code
  4727. \commondummyword\command
  4728. \commondummyword\dfn
  4729. \commondummyword\dmn
  4730. \commondummyword\email
  4731. \commondummyword\emph
  4732. \commondummyword\env
  4733. \commondummyword\file
  4734. \commondummyword\image
  4735. \commondummyword\indicateurl
  4736. \commondummyword\inforef
  4737. \commondummyword\kbd
  4738. \commondummyword\key
  4739. \commondummyword\math
  4740. \commondummyword\option
  4741. \commondummyword\pxref
  4742. \commondummyword\ref
  4743. \commondummyword\samp
  4744. \commondummyword\strong
  4745. \commondummyword\tie
  4746. \commondummyword\U
  4747. \commondummyword\uref
  4748. \commondummyword\url
  4749. \commondummyword\var
  4750. \commondummyword\verb
  4751. \commondummyword\w
  4752. \commondummyword\xref
  4753. }
  4754. % For testing: output @{ and @} in index sort strings as \{ and \}.
  4755. \newif\ifusebracesinindexes
  4756. \let\indexlbrace\relax
  4757. \let\indexrbrace\relax
  4758. {\catcode`\@=0
  4759. \catcode`\\=13
  4760. @gdef@backslashdisappear{@def\{}}
  4761. }
  4762. {
  4763. \catcode`\<=13
  4764. \catcode`\-=13
  4765. \catcode`\`=13
  4766. \gdef\indexnonalnumdisappear{%
  4767. \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
  4768. % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
  4769. % (Introduced for FSFS 2nd ed.)
  4770. \let`=\empty
  4771. \fi
  4772. %
  4773. \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
  4774. \backslashdisappear
  4775. \fi
  4776. %
  4777. \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
  4778. \def-{}%
  4779. \fi
  4780. \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
  4781. \def<{}%
  4782. \fi
  4783. \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
  4784. \def\@{}%
  4785. \fi
  4786. }
  4787. \gdef\indexnonalnumreappear{%
  4788. \useindexbackslash
  4789. \let-\normaldash
  4790. \let<\normalless
  4791. \def\@{@}%
  4792. }
  4793. }
  4794. % \indexnofonts is used when outputting the strings to sort the index
  4795. % by, and when constructing control sequence names. It eliminates all
  4796. % control sequences and just writes whatever the best ASCII sort string
  4797. % would be for a given command (usually its argument).
  4798. %
  4799. \def\indexnofonts{%
  4800. % Accent commands should become @asis.
  4801. \def\commondummyaccent##1{\let##1\asis}%
  4802. % We can just ignore other control letters.
  4803. \def\commondummyletter##1{\let##1\empty}%
  4804. % All control words become @asis by default; overrides below.
  4805. \let\commondummyword\commondummyaccent
  4806. \commondummiesnofonts
  4807. %
  4808. % Don't no-op \tt, since it isn't a user-level command
  4809. % and is used in the definitions of the active chars like <, >, |, etc.
  4810. % Likewise with the other plain tex font commands.
  4811. %\let\tt=\asis
  4812. %
  4813. \def\ { }%
  4814. \def\@{@}%
  4815. \def\_{\normalunderscore}%
  4816. \def\-{}% @- shouldn't affect sorting
  4817. %
  4818. \uccode`\1=`\{ \uppercase{\def\{{1}}%
  4819. \uccode`\1=`\} \uppercase{\def\}{1}}%
  4820. \let\lbracechar\{%
  4821. \let\rbracechar\}%
  4822. %
  4823. % Non-English letters.
  4824. \def\AA{AA}%
  4825. \def\AE{AE}%
  4826. \def\DH{DZZ}%
  4827. \def\L{L}%
  4828. \def\OE{OE}%
  4829. \def\O{O}%
  4830. \def\TH{TH}%
  4831. \def\aa{aa}%
  4832. \def\ae{ae}%
  4833. \def\dh{dzz}%
  4834. \def\exclamdown{!}%
  4835. \def\l{l}%
  4836. \def\oe{oe}%
  4837. \def\ordf{a}%
  4838. \def\ordm{o}%
  4839. \def\o{o}%
  4840. \def\questiondown{?}%
  4841. \def\ss{ss}%
  4842. \def\th{th}%
  4843. %
  4844. \def\LaTeX{LaTeX}%
  4845. \def\TeX{TeX}%
  4846. %
  4847. % Assorted special characters. \defglyph gives the control sequence a
  4848. % definition that removes the {} that follows its use.
  4849. \defglyph\atchar{@}%
  4850. \defglyph\arrow{->}%
  4851. \defglyph\bullet{bullet}%
  4852. \defglyph\comma{,}%
  4853. \defglyph\copyright{copyright}%
  4854. \defglyph\dots{...}%
  4855. \defglyph\enddots{...}%
  4856. \defglyph\equiv{==}%
  4857. \defglyph\error{error}%
  4858. \defglyph\euro{euro}%
  4859. \defglyph\expansion{==>}%
  4860. \defglyph\geq{>=}%
  4861. \defglyph\guillemetleft{<<}%
  4862. \defglyph\guillemetright{>>}%
  4863. \defglyph\guilsinglleft{<}%
  4864. \defglyph\guilsinglright{>}%
  4865. \defglyph\leq{<=}%
  4866. \defglyph\lbracechar{\{}%
  4867. \defglyph\minus{-}%
  4868. \defglyph\point{.}%
  4869. \defglyph\pounds{pounds}%
  4870. \defglyph\print{-|}%
  4871. \defglyph\quotedblbase{"}%
  4872. \defglyph\quotedblleft{"}%
  4873. \defglyph\quotedblright{"}%
  4874. \defglyph\quoteleft{`}%
  4875. \defglyph\quoteright{'}%
  4876. \defglyph\quotesinglbase{,}%
  4877. \defglyph\rbracechar{\}}%
  4878. \defglyph\registeredsymbol{R}%
  4879. \defglyph\result{=>}%
  4880. \defglyph\textdegree{o}%
  4881. %
  4882. % We need to get rid of all macros, leaving only the arguments (if present).
  4883. % Of course this is not nearly correct, but it is the best we can do for now.
  4884. % makeinfo does not expand macros in the argument to @deffn, which ends up
  4885. % writing an index entry, and texindex isn't prepared for an index sort entry
  4886. % that starts with \.
  4887. %
  4888. % Since macro invocations are followed by braces, we can just redefine them
  4889. % to take a single TeX argument. The case of a macro invocation that
  4890. % goes to end-of-line is not handled.
  4891. %
  4892. \macrolist
  4893. \let\value\indexnofontsvalue
  4894. }
  4895. \def\defglyph#1#2{\def#1##1{#2}} % see above
  4896. \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  4897. % Most index entries go through here, but \dosubind is the general case.
  4898. % #1 is the index name, #2 is the entry text.
  4899. \def\doind#1#2{\dosubind{#1}{#2}{}}
  4900. % There is also \dosubind {index}{topic}{subtopic}
  4901. % which makes an entry in a two-level index such as the operation index.
  4902. % TODO: Two-level index? Operation index?
  4903. % Workhorse for all indexes.
  4904. % #1 is name of index, #2 is stuff to put there, #3 is subentry --
  4905. % empty if called from \doind, as we usually are (the main exception
  4906. % is with most defuns, which call us directly).
  4907. %
  4908. \def\dosubind#1#2#3{%
  4909. \iflinks
  4910. {%
  4911. \requireopenindexfile{#1}%
  4912. % Store the main index entry text (including the third arg).
  4913. \toks0 = {#2}%
  4914. % If third arg is present, precede it with a space.
  4915. \def\thirdarg{#3}%
  4916. \ifx\thirdarg\empty \else
  4917. \toks0 = \expandafter{\the\toks0 \space #3}%
  4918. \fi
  4919. %
  4920. \edef\writeto{\csname#1indfile\endcsname}%
  4921. %
  4922. \safewhatsit\dosubindwrite
  4923. }%
  4924. \fi
  4925. }
  4926. % Check if an index file has been opened, and if not, open it.
  4927. \def\requireopenindexfile#1{%
  4928. \ifnum\csname #1indfile\endcsname=0
  4929. \expandafter\newwrite \csname#1indfile\endcsname
  4930. \edef\suffix{#1}%
  4931. % A .fls suffix would conflict with the file extension for the output
  4932. % of -recorder, so use .f1s instead.
  4933. \ifx\suffix\indexisfl\def\suffix{f1}\fi
  4934. % Open the file
  4935. \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
  4936. % Using \immediate above here prevents an object entering into the current
  4937. % box, which could confound checks such as those in \safewhatsit for
  4938. % preceding skips.
  4939. \typeout{Writing index file \jobname.\suffix}%
  4940. \fi}
  4941. \def\indexisfl{fl}
  4942. % Output \ as {\indexbackslash}, because \ is an escape character in
  4943. % the index files.
  4944. \let\indexbackslash=\relax
  4945. {\catcode`\@=0 \catcode`\\=\active
  4946. @gdef@useindexbackslash{@def\{{@indexbackslash}}}
  4947. }
  4948. % Definition for writing index entry text.
  4949. \def\sortas#1{\ignorespaces}%
  4950. % Definition for writing index entry sort key. Should occur at the at
  4951. % the beginning of the index entry, like
  4952. % @cindex @sortas{september} \september
  4953. % The \ignorespaces takes care of following space, but there's no way
  4954. % to remove space before it.
  4955. {
  4956. \catcode`\-=13
  4957. \gdef\indexwritesortas{%
  4958. \begingroup
  4959. \indexnonalnumreappear
  4960. \indexwritesortasxxx}
  4961. \gdef\indexwritesortasxxx#1{%
  4962. \xdef\indexsortkey{#1}\endgroup}
  4963. }
  4964. % Write the entry in \toks0 to the index file.
  4965. %
  4966. \def\dosubindwrite{%
  4967. % Put the index entry in the margin if desired.
  4968. \ifx\SETmarginindex\relax\else
  4969. \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
  4970. \fi
  4971. %
  4972. % Remember, we are within a group.
  4973. \indexdummies % Must do this here, since \bf, etc expand at this stage
  4974. \useindexbackslash % \indexbackslash isn't defined now so it will be output
  4975. % as is; and it will print as backslash.
  4976. % The braces around \indexbrace are recognized by texindex.
  4977. %
  4978. % Get the string to sort by, by processing the index entry with all
  4979. % font commands turned off.
  4980. {\indexnofonts
  4981. \def\lbracechar{{\indexlbrace}}%
  4982. \def\rbracechar{{\indexrbrace}}%
  4983. \let\{=\lbracechar
  4984. \let\}=\rbracechar
  4985. \indexnonalnumdisappear
  4986. \xdef\indexsortkey{}%
  4987. \let\sortas=\indexwritesortas
  4988. \edef\temp{\the\toks0}%
  4989. \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
  4990. \ifx\indexsortkey\empty
  4991. \xdef\indexsortkey{\temp}%
  4992. \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
  4993. \fi
  4994. }%
  4995. %
  4996. % Set up the complete index entry, with both the sort key and
  4997. % the original text, including any font commands. We write
  4998. % three arguments to \entry to the .?? file (four in the
  4999. % subentry case), texindex reduces to two when writing the .??s
  5000. % sorted result.
  5001. \edef\temp{%
  5002. \write\writeto{%
  5003. \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
  5004. }%
  5005. \temp
  5006. }
  5007. \newbox\dummybox % used above
  5008. % Take care of unwanted page breaks/skips around a whatsit:
  5009. %
  5010. % If a skip is the last thing on the list now, preserve it
  5011. % by backing up by \lastskip, doing the \write, then inserting
  5012. % the skip again. Otherwise, the whatsit generated by the
  5013. % \write or \pdfdest will make \lastskip zero. The result is that
  5014. % sequences like this:
  5015. % @end defun
  5016. % @tindex whatever
  5017. % @defun ...
  5018. % will have extra space inserted, because the \medbreak in the
  5019. % start of the @defun won't see the skip inserted by the @end of
  5020. % the previous defun.
  5021. %
  5022. % But don't do any of this if we're not in vertical mode. We
  5023. % don't want to do a \vskip and prematurely end a paragraph.
  5024. %
  5025. % Avoid page breaks due to these extra skips, too.
  5026. %
  5027. % But wait, there is a catch there:
  5028. % We'll have to check whether \lastskip is zero skip. \ifdim is not
  5029. % sufficient for this purpose, as it ignores stretch and shrink parts
  5030. % of the skip. The only way seems to be to check the textual
  5031. % representation of the skip.
  5032. %
  5033. % The following is almost like \def\zeroskipmacro{0.0pt} except that
  5034. % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
  5035. %
  5036. \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
  5037. %
  5038. \newskip\whatsitskip
  5039. \newcount\whatsitpenalty
  5040. %
  5041. % ..., ready, GO:
  5042. %
  5043. \def\safewhatsit#1{\ifhmode
  5044. #1%
  5045. \else
  5046. % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
  5047. \whatsitskip = \lastskip
  5048. \edef\lastskipmacro{\the\lastskip}%
  5049. \whatsitpenalty = \lastpenalty
  5050. %
  5051. % If \lastskip is nonzero, that means the last item was a
  5052. % skip. And since a skip is discardable, that means this
  5053. % -\whatsitskip glue we're inserting is preceded by a
  5054. % non-discardable item, therefore it is not a potential
  5055. % breakpoint, therefore no \nobreak needed.
  5056. \ifx\lastskipmacro\zeroskipmacro
  5057. \else
  5058. \vskip-\whatsitskip
  5059. \fi
  5060. %
  5061. #1%
  5062. %
  5063. \ifx\lastskipmacro\zeroskipmacro
  5064. % If \lastskip was zero, perhaps the last item was a penalty, and
  5065. % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
  5066. % to re-insert the same penalty (values >10000 are used for various
  5067. % signals); since we just inserted a non-discardable item, any
  5068. % following glue (such as a \parskip) would be a breakpoint. For example:
  5069. % @deffn deffn-whatever
  5070. % @vindex index-whatever
  5071. % Description.
  5072. % would allow a break between the index-whatever whatsit
  5073. % and the "Description." paragraph.
  5074. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
  5075. \else
  5076. % On the other hand, if we had a nonzero \lastskip,
  5077. % this make-up glue would be preceded by a non-discardable item
  5078. % (the whatsit from the \write), so we must insert a \nobreak.
  5079. \nobreak\vskip\whatsitskip
  5080. \fi
  5081. \fi}
  5082. % The index entry written in the file actually looks like
  5083. % \entry {sortstring}{page}{topic}
  5084. % or
  5085. % \entry {sortstring}{page}{topic}{subtopic}
  5086. % The texindex program reads in these files and writes files
  5087. % containing these kinds of lines:
  5088. % \initial {c}
  5089. % before the first topic whose initial is c
  5090. % \entry {topic}{pagelist}
  5091. % for a topic that is used without subtopics
  5092. % \primary {topic}
  5093. % for the beginning of a topic that is used with subtopics
  5094. % \secondary {subtopic}{pagelist}
  5095. % for each subtopic.
  5096. % Define the user-accessible indexing commands
  5097. % @findex, @vindex, @kindex, @cindex.
  5098. \def\findex {\fnindex}
  5099. \def\kindex {\kyindex}
  5100. \def\cindex {\cpindex}
  5101. \def\vindex {\vrindex}
  5102. \def\tindex {\tpindex}
  5103. \def\pindex {\pgindex}
  5104. \def\cindexsub {\begingroup\obeylines\cindexsub}
  5105. {\obeylines %
  5106. \gdef\cindexsub "#1" #2^^M{\endgroup %
  5107. \dosubind{cp}{#2}{#1}}}
  5108. % Define the macros used in formatting output of the sorted index material.
  5109. % @printindex causes a particular index (the ??s file) to get printed.
  5110. % It does not print any chapter heading (usually an @unnumbered).
  5111. %
  5112. \parseargdef\printindex{\begingroup
  5113. \dobreak \chapheadingskip{10000}%
  5114. %
  5115. \smallfonts \rm
  5116. \tolerance = 9500
  5117. \plainfrenchspacing
  5118. \everypar = {}% don't want the \kern\-parindent from indentation suppression.
  5119. %
  5120. % See if the index file exists and is nonempty.
  5121. % Change catcode of @ here so that if the index file contains
  5122. % \initial {@}
  5123. % as its first line, TeX doesn't complain about mismatched braces
  5124. % (because it thinks @} is a control sequence).
  5125. \catcode`\@ = 12
  5126. % See comment in \requireopenindexfile.
  5127. \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
  5128. \openin 1 \jobname.\indexname s
  5129. \ifeof 1
  5130. % \enddoublecolumns gets confused if there is no text in the index,
  5131. % and it loses the chapter title and the aux file entries for the
  5132. % index. The easiest way to prevent this problem is to make sure
  5133. % there is some text.
  5134. \putwordIndexNonexistent
  5135. \typeout{No file \jobname.\indexname s.}%
  5136. \else
  5137. \catcode`\\ = 0
  5138. %
  5139. % If the index file exists but is empty, then \openin leaves \ifeof
  5140. % false. We have to make TeX try to read something from the file, so
  5141. % it can discover if there is anything in it.
  5142. \read 1 to \thisline
  5143. \ifeof 1
  5144. \putwordIndexIsEmpty
  5145. \else
  5146. % Index files are almost Texinfo source, but we use \ as the escape
  5147. % character. It would be better to use @, but that's too big a change
  5148. % to make right now.
  5149. \def\indexbackslash{\ttbackslash}%
  5150. \let\indexlbrace\{ % Likewise, set these sequences for braces
  5151. \let\indexrbrace\} % used in the sort key.
  5152. \begindoublecolumns
  5153. \let\entrywidowpenalty=\indexwidowpenalty
  5154. %
  5155. % Read input from the index file line by line.
  5156. \loopdo
  5157. \ifeof1
  5158. \let\firsttoken\relax
  5159. \else
  5160. \read 1 to \nextline
  5161. \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
  5162. \act
  5163. \fi
  5164. \thisline
  5165. %
  5166. \ifeof1\else
  5167. \let\thisline\nextline
  5168. \repeat
  5169. %%
  5170. \enddoublecolumns
  5171. \fi
  5172. \fi
  5173. \closein 1
  5174. \endgroup}
  5175. \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
  5176. \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
  5177. \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
  5178. \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
  5179. % These macros are used by the sorted index file itself.
  5180. % Change them to control the appearance of the index.
  5181. {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
  5182. \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
  5183. \catcode`\$=3
  5184. \gdef\initialglyphs{%
  5185. % Some changes for non-alphabetic characters. Using the glyphs from the
  5186. % math fonts looks more consistent than the typewriter font used elsewhere
  5187. % for these characters.
  5188. \def\indexbackslash{\math{\backslash}}%
  5189. \let\\=\indexbackslash
  5190. %
  5191. % Can't get bold backslash so don't use bold forward slash
  5192. \catcode`\/=13
  5193. \def/{{\secrmnotbold \normalslash}}%
  5194. \def-{{\normaldash\normaldash}}% en dash `--'
  5195. \def^{{\chapbf \normalcaret}}%
  5196. \def~{{\chapbf \normaltilde}}%
  5197. \def\_{%
  5198. \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
  5199. \def|{$\vert$}%
  5200. \def<{$\less$}%
  5201. \def>{$\gtr$}%
  5202. \def+{$\normalplus$}%
  5203. }}
  5204. \def\initial{%
  5205. \bgroup
  5206. \initialglyphs
  5207. \initialx
  5208. }
  5209. \def\initialx#1{%
  5210. % Remove any glue we may have, we'll be inserting our own.
  5211. \removelastskip
  5212. %
  5213. % We like breaks before the index initials, so insert a bonus.
  5214. % The glue before the bonus allows a little bit of space at the
  5215. % bottom of a column to reduce an increase in inter-line spacing.
  5216. \nobreak
  5217. \vskip 0pt plus 5\baselineskip
  5218. \penalty -300
  5219. \vskip 0pt plus -5\baselineskip
  5220. %
  5221. % Typeset the initial. Making this add up to a whole number of
  5222. % baselineskips increases the chance of the dots lining up from column
  5223. % to column. It still won't often be perfect, because of the stretch
  5224. % we need before each entry, but it's better.
  5225. %
  5226. % No shrink because it confuses \balancecolumns.
  5227. \vskip 1.67\baselineskip plus 1\baselineskip
  5228. \leftline{\secfonts \kern-0.05em \secbf #1}%
  5229. % \secfonts is inside the argument of \leftline so that the change of
  5230. % \baselineskip will not affect any glue inserted before the vbox that
  5231. % \leftline creates.
  5232. % Do our best not to break after the initial.
  5233. \nobreak
  5234. \vskip .33\baselineskip plus .1\baselineskip
  5235. \egroup % \initialglyphs
  5236. }
  5237. \newdimen\entryrightmargin
  5238. \entryrightmargin=0pt
  5239. % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
  5240. % then page number (#2) flushed to the right margin. It is used for index
  5241. % and table of contents entries. The paragraph is indented by \leftskip.
  5242. %
  5243. \def\entry{%
  5244. \begingroup
  5245. %
  5246. % For pdfTeX and XeTeX.
  5247. % The redefinition of \domark stops marks being added in \pdflink to
  5248. % preserve coloured links across page boundaries. Otherwise the marks
  5249. % would get in the way of \lastbox in \insertindexentrybox.
  5250. \let\domark\relax
  5251. %
  5252. % Start a new paragraph if necessary, so our assignments below can't
  5253. % affect previous text.
  5254. \par
  5255. %
  5256. % No extra space above this paragraph.
  5257. \parskip = 0in
  5258. %
  5259. % When reading the text of entry, convert explicit line breaks
  5260. % from @* into spaces. The user might give these in long section
  5261. % titles, for instance.
  5262. \def\*{\unskip\space\ignorespaces}%
  5263. \def\entrybreak{\hfil\break}% An undocumented command
  5264. %
  5265. % Swallow the left brace of the text (first parameter):
  5266. \afterassignment\doentry
  5267. \let\temp =
  5268. }
  5269. \def\entrybreak{\unskip\space\ignorespaces}%
  5270. \def\doentry{%
  5271. % Save the text of the entry
  5272. \global\setbox\boxA=\hbox\bgroup
  5273. \bgroup % Instead of the swallowed brace.
  5274. \noindent
  5275. \aftergroup\finishentry
  5276. % And now comes the text of the entry.
  5277. % Not absorbing as a macro argument reduces the chance of problems
  5278. % with catcodes occurring.
  5279. }
  5280. {\catcode`\@=11
  5281. \gdef\finishentry#1{%
  5282. \egroup % end box A
  5283. \dimen@ = \wd\boxA % Length of text of entry
  5284. \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
  5285. % #1 is the page number.
  5286. %
  5287. % Get the width of the page numbers, and only use
  5288. % leaders if they are present.
  5289. \global\setbox\boxB = \hbox{#1}%
  5290. \ifdim\wd\boxB = 0pt
  5291. \null\nobreak\hfill\ %
  5292. \else
  5293. %
  5294. \null\nobreak\indexdotfill % Have leaders before the page number.
  5295. %
  5296. \ifpdf
  5297. \pdfgettoks#1.%
  5298. \hskip\skip\thinshrinkable\the\toksA
  5299. \else
  5300. \ifx\XeTeXrevision\thisisundefined
  5301. \hskip\skip\thinshrinkable #1%
  5302. \else
  5303. \pdfgettoks#1.%
  5304. \hskip\skip\thinshrinkable\the\toksA
  5305. \fi
  5306. \fi
  5307. \fi
  5308. \egroup % end \boxA
  5309. \ifdim\wd\boxB = 0pt
  5310. \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
  5311. \else
  5312. \global\setbox\entryindexbox=\vbox\bgroup
  5313. % We want the text of the entries to be aligned to the left, and the
  5314. % page numbers to be aligned to the right.
  5315. %
  5316. \parindent = 0pt
  5317. \advance\leftskip by 0pt plus 1fil
  5318. \advance\leftskip by 0pt plus -1fill
  5319. \rightskip = 0pt plus -1fil
  5320. \advance\rightskip by 0pt plus 1fill
  5321. % Cause last line, which could consist of page numbers on their own
  5322. % if the list of page numbers is long, to be aligned to the right.
  5323. \parfillskip=0pt plus -1fill
  5324. %
  5325. \advance\rightskip by \entryrightmargin
  5326. % Determine how far we can stretch into the margin.
  5327. % This allows, e.g., "Appendix H GNU Free Documentation License" to
  5328. % fit on one line in @letterpaper format.
  5329. \ifdim\entryrightmargin>2.1em
  5330. \dimen@i=2.1em
  5331. \else
  5332. \dimen@i=0em
  5333. \fi
  5334. \advance \parfillskip by 0pt minus 1\dimen@i
  5335. %
  5336. \dimen@ii = \hsize
  5337. \advance\dimen@ii by -1\leftskip
  5338. \advance\dimen@ii by -1\entryrightmargin
  5339. \advance\dimen@ii by 1\dimen@i
  5340. \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
  5341. \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
  5342. \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
  5343. \dimen@ii = \hsize
  5344. \ifnum\dimen@>\dimen@ii
  5345. % If the entry is too long, use the whole line
  5346. \dimen@ = \dimen@ii
  5347. \fi
  5348. \advance\leftskip by 0pt plus 1fill % ragged right
  5349. \advance \dimen@ by 1\rightskip
  5350. \parshape = 2 0pt \dimen@ 0em \dimen@ii
  5351. % Ideally we'd add a finite glue at the end of the first line only,
  5352. % instead of using \parshape with explicit line lengths, but TeX
  5353. % doesn't seem to provide a way to do such a thing.
  5354. %
  5355. \leftskip = 1em
  5356. \parindent = -1em
  5357. \fi\fi
  5358. \indent % start paragraph
  5359. \unhbox\boxA
  5360. %
  5361. % Do not prefer a separate line ending with a hyphen to fewer lines.
  5362. \finalhyphendemerits = 0
  5363. %
  5364. % Word spacing - no stretch
  5365. \spaceskip=\fontdimen2\font minus \fontdimen4\font
  5366. %
  5367. \linepenalty=1000 % Discourage line breaks.
  5368. \hyphenpenalty=5000 % Discourage hyphenation.
  5369. %
  5370. \par % format the paragraph
  5371. \egroup % The \vbox
  5372. \fi
  5373. \endgroup
  5374. % delay text of entry until after penalty
  5375. \bgroup\aftergroup\insertindexentrybox
  5376. \entrywidowpenalty
  5377. }}
  5378. \newskip\thinshrinkable
  5379. \skip\thinshrinkable=.15em minus .15em
  5380. \newbox\entryindexbox
  5381. \def\insertindexentrybox{%
  5382. \ourunvbox\entryindexbox
  5383. }
  5384. % Use \lastbox to take apart vbox box by box, and add each sub-box
  5385. % to the current vertical list.
  5386. \def\ourunvbox#1{%
  5387. \bgroup % for local binding of \delayedbox
  5388. % Remove the last box from box #1
  5389. \global\setbox#1=\vbox{%
  5390. \unvbox#1%
  5391. \unskip % remove any glue
  5392. \unpenalty
  5393. \global\setbox\interbox=\lastbox
  5394. }%
  5395. \setbox\delayedbox=\box\interbox
  5396. \ifdim\ht#1=0pt\else
  5397. \ourunvbox#1 % Repeat on what's left of the box
  5398. \nobreak
  5399. \fi
  5400. \box\delayedbox
  5401. \egroup
  5402. }
  5403. \newbox\delayedbox
  5404. \newbox\interbox
  5405. % Default is no penalty
  5406. \let\entrywidowpenalty\egroup
  5407. % Used from \printindex. \firsttoken should be the first token
  5408. % after the \entry. If it's not another \entry, we are at the last
  5409. % line of a group of index entries, so insert a penalty to discourage
  5410. % widowed index entries.
  5411. \long\def\indexwidowpenalty{%
  5412. \def\isentry{\entry}%
  5413. \ifx\firsttoken\isentry
  5414. \else
  5415. \penalty 9000
  5416. \fi
  5417. \egroup % now comes the box added with \aftergroup
  5418. }
  5419. % Like plain.tex's \dotfill, except uses up at least 1 em.
  5420. % The filll stretch here overpowers both the fil and fill stretch to push
  5421. % the page number to the right.
  5422. \def\indexdotfill{\cleaders
  5423. \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
  5424. \def\primary #1{\line{#1\hfil}}
  5425. \newskip\secondaryindent \secondaryindent=0.5cm
  5426. \def\secondary#1#2{{%
  5427. \parfillskip=0in
  5428. \parskip=0in
  5429. \hangindent=1in
  5430. \hangafter=1
  5431. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  5432. \ifpdf
  5433. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5434. \else
  5435. \ifx\XeTeXrevision\thisisundefined
  5436. #2
  5437. \else
  5438. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5439. \fi
  5440. \fi
  5441. \par
  5442. }}
  5443. % Define two-column mode, which we use to typeset indexes.
  5444. % Adapted from the TeXbook, page 416, which is to say,
  5445. % the manmac.tex format used to print the TeXbook itself.
  5446. \catcode`\@=11 % private names
  5447. \newbox\partialpage
  5448. \newdimen\doublecolumnhsize
  5449. % Use inside an output routine to save \topmark and \firstmark
  5450. \def\savemarks{%
  5451. \global\savedtopmark=\expandafter{\topmark }%
  5452. \global\savedfirstmark=\expandafter{\firstmark }%
  5453. }
  5454. \newtoks\savedtopmark
  5455. \newtoks\savedfirstmark
  5456. % Set \topmark and \firstmark for next time \output runs.
  5457. % Can't be run from withinside \output (because any material
  5458. % added while an output routine is active, including
  5459. % penalties, is saved for after it finishes). The page so far
  5460. % should be empty, otherwise what's on it will be thrown away.
  5461. \def\restoremarks{%
  5462. \mark{\the\savedtopmark}%
  5463. \bgroup\output = {%
  5464. \setbox\dummybox=\box\PAGE
  5465. }abc\eject\egroup
  5466. % "abc" because output routine doesn't fire for a completely empty page.
  5467. \mark{\the\savedfirstmark}%
  5468. }
  5469. \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  5470. % If not much space left on page, start a new page.
  5471. \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
  5472. %
  5473. % Grab any single-column material above us.
  5474. \output = {%
  5475. %
  5476. % Here is a possibility not foreseen in manmac: if we accumulate a
  5477. % whole lot of material, we might end up calling this \output
  5478. % routine twice in a row (see the doublecol-lose test, which is
  5479. % essentially a couple of indexes with @setchapternewpage off). In
  5480. % that case we just ship out what is in \partialpage with the normal
  5481. % output routine. Generally, \partialpage will be empty when this
  5482. % runs and this will be a no-op. See the indexspread.tex test case.
  5483. \ifvoid\partialpage \else
  5484. \onepageout{\pagecontents\partialpage}%
  5485. \fi
  5486. %
  5487. \global\setbox\partialpage = \vbox{%
  5488. % Unvbox the main output page.
  5489. \unvbox\PAGE
  5490. \kern-\topskip \kern\baselineskip
  5491. }%
  5492. \savemarks
  5493. }%
  5494. \eject % run that output routine to set \partialpage
  5495. \restoremarks
  5496. %
  5497. % We recover the two marks that the last output routine saved in order
  5498. % to propagate the information in marks added around a chapter heading,
  5499. % which could be otherwise be lost by the time the final page is output.
  5500. %
  5501. %
  5502. % Use the double-column output routine for subsequent pages.
  5503. \output = {\doublecolumnout}%
  5504. %
  5505. % Change the page size parameters. We could do this once outside this
  5506. % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  5507. % format, but then we repeat the same computation. Repeating a couple
  5508. % of assignments once per index is clearly meaningless for the
  5509. % execution time, so we may as well do it in one place.
  5510. %
  5511. % First we halve the line length, less a little for the gutter between
  5512. % the columns. We compute the gutter based on the line length, so it
  5513. % changes automatically with the paper format. The magic constant
  5514. % below is chosen so that the gutter has the same value (well, +-<1pt)
  5515. % as it did when we hard-coded it.
  5516. %
  5517. % We put the result in a separate register, \doublecolumhsize, so we
  5518. % can restore it in \pagesofar, after \hsize itself has (potentially)
  5519. % been clobbered.
  5520. %
  5521. \doublecolumnhsize = \hsize
  5522. \advance\doublecolumnhsize by -.04154\hsize
  5523. \divide\doublecolumnhsize by 2
  5524. \hsize = \doublecolumnhsize
  5525. %
  5526. % Double the \vsize as well. (We don't need a separate register here,
  5527. % since nobody clobbers \vsize.)
  5528. \vsize = 2\vsize
  5529. %
  5530. % For the benefit of balancing columns
  5531. \advance\baselineskip by 0pt plus 0.5pt
  5532. }
  5533. % The double-column output routine for all double-column pages except
  5534. % the last, which is done by \balancecolumns.
  5535. %
  5536. \def\doublecolumnout{%
  5537. %
  5538. \splittopskip=\topskip \splitmaxdepth=\maxdepth
  5539. % Get the available space for the double columns -- the normal
  5540. % (undoubled) page height minus any material left over from the
  5541. % previous page.
  5542. \dimen@ = \vsize
  5543. \divide\dimen@ by 2
  5544. \advance\dimen@ by -\ht\partialpage
  5545. %
  5546. % box0 will be the left-hand column, box2 the right.
  5547. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  5548. \onepageout\pagesofar
  5549. \unvbox255
  5550. \penalty\outputpenalty
  5551. }
  5552. %
  5553. % Re-output the contents of the output page -- any previous material,
  5554. % followed by the two boxes we just split, in box0 and box2.
  5555. \def\pagesofar{%
  5556. \unvbox\partialpage
  5557. %
  5558. \hsize = \doublecolumnhsize
  5559. \wd0=\hsize \wd2=\hsize
  5560. \hbox to\txipagewidth{\box0\hfil\box2}%
  5561. }
  5562. % Finished with with double columns.
  5563. \def\enddoublecolumns{%
  5564. % The following penalty ensures that the page builder is exercised
  5565. % _before_ we change the output routine. This is necessary in the
  5566. % following situation:
  5567. %
  5568. % The last section of the index consists only of a single entry.
  5569. % Before this section, \pagetotal is less than \pagegoal, so no
  5570. % break occurs before the last section starts. However, the last
  5571. % section, consisting of \initial and the single \entry, does not
  5572. % fit on the page and has to be broken off. Without the following
  5573. % penalty the page builder will not be exercised until \eject
  5574. % below, and by that time we'll already have changed the output
  5575. % routine to the \balancecolumns version, so the next-to-last
  5576. % double-column page will be processed with \balancecolumns, which
  5577. % is wrong: The two columns will go to the main vertical list, with
  5578. % the broken-off section in the recent contributions. As soon as
  5579. % the output routine finishes, TeX starts reconsidering the page
  5580. % break. The two columns and the broken-off section both fit on the
  5581. % page, because the two columns now take up only half of the page
  5582. % goal. When TeX sees \eject from below which follows the final
  5583. % section, it invokes the new output routine that we've set after
  5584. % \balancecolumns below; \onepageout will try to fit the two columns
  5585. % and the final section into the vbox of \txipageheight (see
  5586. % \pagebody), causing an overfull box.
  5587. %
  5588. % Note that glue won't work here, because glue does not exercise the
  5589. % page builder, unlike penalties (see The TeXbook, pp. 280-281).
  5590. \penalty0
  5591. %
  5592. \output = {%
  5593. % Split the last of the double-column material.
  5594. \savemarks
  5595. \balancecolumns
  5596. %
  5597. % Having called \balancecolumns once, we do not
  5598. % want to call it again. Therefore, reset \output to its normal
  5599. % definition right away.
  5600. \global\output = {\onepageout{\pagecontents\PAGE}}%
  5601. }%
  5602. \eject
  5603. \endgroup % started in \begindoublecolumns
  5604. \restoremarks
  5605. % Leave the double-column material on the current page, no automatic
  5606. % page break.
  5607. \box\balancedcolumns
  5608. %
  5609. % \pagegoal was set to the doubled \vsize above, since we restarted
  5610. % the current page. We're now back to normal single-column
  5611. % typesetting, so reset \pagegoal to the normal \vsize (after the
  5612. % \endgroup where \vsize got restored).
  5613. \pagegoal = \vsize
  5614. }
  5615. \newbox\balancedcolumns
  5616. \setbox\balancedcolumns=\vbox{shouldnt see this}%
  5617. %
  5618. % Only called for the last of the double column material. \doublecolumnout
  5619. % does the others.
  5620. \def\balancecolumns{%
  5621. \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
  5622. \dimen@ = \ht0
  5623. \advance\dimen@ by \topskip
  5624. \advance\dimen@ by-\baselineskip
  5625. \ifdim\dimen@<5\baselineskip
  5626. % Don't split a short final column in two.
  5627. \setbox2=\vbox{}%
  5628. \else
  5629. \divide\dimen@ by 2 % target to split to
  5630. \dimen@ii = \dimen@
  5631. \splittopskip = \topskip
  5632. % Loop until left column is at least as high as the right column.
  5633. {%
  5634. \vbadness = 10000
  5635. \loop
  5636. \global\setbox3 = \copy0
  5637. \global\setbox1 = \vsplit3 to \dimen@
  5638. \ifdim\ht1<\ht3
  5639. \global\advance\dimen@ by 1pt
  5640. \repeat
  5641. }%
  5642. % Now the left column is in box 1, and the right column in box 3.
  5643. % Check whether the left column has come out higher than the page itself.
  5644. % (Note that we have doubled \vsize for the double columns, so
  5645. % the actual height of the page is 0.5\vsize).
  5646. \ifdim2\ht1>\vsize
  5647. % Just split the last of the double column material roughly in half.
  5648. \setbox2=\box0
  5649. \setbox0 = \vsplit2 to \dimen@ii
  5650. \setbox0=\vbox to \dimen@ii {\unvbox0\vfill}%
  5651. \setbox2=\vbox to \dimen@ii {\unvbox2\vfill}%
  5652. \else
  5653. % Compare the heights of the two columns.
  5654. \ifdim4\ht1>5\ht3
  5655. % Column heights are too different, so don't make their bottoms
  5656. % flush with each other.
  5657. \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
  5658. \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
  5659. \else
  5660. % Make column bottoms flush with each other.
  5661. \setbox2=\vbox to\ht1{\unvbox3\unskip}%
  5662. \setbox0=\vbox to\ht1{\unvbox1\unskip}%
  5663. \fi
  5664. \fi
  5665. \fi
  5666. %
  5667. \global\setbox\balancedcolumns=\vbox{\pagesofar}%
  5668. }
  5669. \catcode`\@ = \other
  5670. \message{sectioning,}
  5671. % Chapters, sections, etc.
  5672. % Let's start with @part.
  5673. \outer\parseargdef\part{\partzzz{#1}}
  5674. \def\partzzz#1{%
  5675. \chapoddpage
  5676. \null
  5677. \vskip.3\vsize % move it down on the page a bit
  5678. \begingroup
  5679. \noindent \titlefonts\rmisbold #1\par % the text
  5680. \let\lastnode=\empty % no node to associate with
  5681. \writetocentry{part}{#1}{}% but put it in the toc
  5682. \headingsoff % no headline or footline on the part page
  5683. % This outputs a mark at the end of the page that clears \thischapter
  5684. % and \thissection, as is done in \startcontents.
  5685. \let\pchapsepmacro\relax
  5686. \chapmacro{}{Yomitfromtoc}{}%
  5687. \chapoddpage
  5688. \endgroup
  5689. }
  5690. % \unnumberedno is an oxymoron. But we count the unnumbered
  5691. % sections so that we can refer to them unambiguously in the pdf
  5692. % outlines by their "section number". We avoid collisions with chapter
  5693. % numbers by starting them at 10000. (If a document ever has 10000
  5694. % chapters, we're in trouble anyway, I'm sure.)
  5695. \newcount\unnumberedno \unnumberedno = 10000
  5696. \newcount\chapno
  5697. \newcount\secno \secno=0
  5698. \newcount\subsecno \subsecno=0
  5699. \newcount\subsubsecno \subsubsecno=0
  5700. % This counter is funny since it counts through charcodes of letters A, B, ...
  5701. \newcount\appendixno \appendixno = `\@
  5702. %
  5703. % \def\appendixletter{\char\the\appendixno}
  5704. % We do the following ugly conditional instead of the above simple
  5705. % construct for the sake of pdftex, which needs the actual
  5706. % letter in the expansion, not just typeset.
  5707. %
  5708. \def\appendixletter{%
  5709. \ifnum\appendixno=`A A%
  5710. \else\ifnum\appendixno=`B B%
  5711. \else\ifnum\appendixno=`C C%
  5712. \else\ifnum\appendixno=`D D%
  5713. \else\ifnum\appendixno=`E E%
  5714. \else\ifnum\appendixno=`F F%
  5715. \else\ifnum\appendixno=`G G%
  5716. \else\ifnum\appendixno=`H H%
  5717. \else\ifnum\appendixno=`I I%
  5718. \else\ifnum\appendixno=`J J%
  5719. \else\ifnum\appendixno=`K K%
  5720. \else\ifnum\appendixno=`L L%
  5721. \else\ifnum\appendixno=`M M%
  5722. \else\ifnum\appendixno=`N N%
  5723. \else\ifnum\appendixno=`O O%
  5724. \else\ifnum\appendixno=`P P%
  5725. \else\ifnum\appendixno=`Q Q%
  5726. \else\ifnum\appendixno=`R R%
  5727. \else\ifnum\appendixno=`S S%
  5728. \else\ifnum\appendixno=`T T%
  5729. \else\ifnum\appendixno=`U U%
  5730. \else\ifnum\appendixno=`V V%
  5731. \else\ifnum\appendixno=`W W%
  5732. \else\ifnum\appendixno=`X X%
  5733. \else\ifnum\appendixno=`Y Y%
  5734. \else\ifnum\appendixno=`Z Z%
  5735. % The \the is necessary, despite appearances, because \appendixletter is
  5736. % expanded while writing the .toc file. \char\appendixno is not
  5737. % expandable, thus it is written literally, thus all appendixes come out
  5738. % with the same letter (or @) in the toc without it.
  5739. \else\char\the\appendixno
  5740. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  5741. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  5742. % Each @chapter defines these (using marks) as the number+name, number
  5743. % and name of the chapter. Page headings and footings can use
  5744. % these. @section does likewise.
  5745. \def\thischapter{}
  5746. \def\thischapternum{}
  5747. \def\thischaptername{}
  5748. \def\thissection{}
  5749. \def\thissectionnum{}
  5750. \def\thissectionname{}
  5751. \newcount\absseclevel % used to calculate proper heading level
  5752. \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
  5753. % @raisesections: treat @section as chapter, @subsection as section, etc.
  5754. \def\raisesections{\global\advance\secbase by -1}
  5755. \let\up=\raisesections % original BFox name
  5756. % @lowersections: treat @chapter as section, @section as subsection, etc.
  5757. \def\lowersections{\global\advance\secbase by 1}
  5758. \let\down=\lowersections % original BFox name
  5759. % we only have subsub.
  5760. \chardef\maxseclevel = 3
  5761. %
  5762. % A numbered section within an unnumbered changes to unnumbered too.
  5763. % To achieve this, remember the "biggest" unnum. sec. we are currently in:
  5764. \chardef\unnlevel = \maxseclevel
  5765. %
  5766. % Trace whether the current chapter is an appendix or not:
  5767. % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
  5768. \def\chapheadtype{N}
  5769. % Choose a heading macro
  5770. % #1 is heading type
  5771. % #2 is heading level
  5772. % #3 is text for heading
  5773. \def\genhead#1#2#3{%
  5774. % Compute the abs. sec. level:
  5775. \absseclevel=#2
  5776. \advance\absseclevel by \secbase
  5777. % Make sure \absseclevel doesn't fall outside the range:
  5778. \ifnum \absseclevel < 0
  5779. \absseclevel = 0
  5780. \else
  5781. \ifnum \absseclevel > 3
  5782. \absseclevel = 3
  5783. \fi
  5784. \fi
  5785. % The heading type:
  5786. \def\headtype{#1}%
  5787. \if \headtype U%
  5788. \ifnum \absseclevel < \unnlevel
  5789. \chardef\unnlevel = \absseclevel
  5790. \fi
  5791. \else
  5792. % Check for appendix sections:
  5793. \ifnum \absseclevel = 0
  5794. \edef\chapheadtype{\headtype}%
  5795. \else
  5796. \if \headtype A\if \chapheadtype N%
  5797. \errmessage{@appendix... within a non-appendix chapter}%
  5798. \fi\fi
  5799. \fi
  5800. % Check for numbered within unnumbered:
  5801. \ifnum \absseclevel > \unnlevel
  5802. \def\headtype{U}%
  5803. \else
  5804. \chardef\unnlevel = 3
  5805. \fi
  5806. \fi
  5807. % Now print the heading:
  5808. \if \headtype U%
  5809. \ifcase\absseclevel
  5810. \unnumberedzzz{#3}%
  5811. \or \unnumberedseczzz{#3}%
  5812. \or \unnumberedsubseczzz{#3}%
  5813. \or \unnumberedsubsubseczzz{#3}%
  5814. \fi
  5815. \else
  5816. \if \headtype A%
  5817. \ifcase\absseclevel
  5818. \appendixzzz{#3}%
  5819. \or \appendixsectionzzz{#3}%
  5820. \or \appendixsubseczzz{#3}%
  5821. \or \appendixsubsubseczzz{#3}%
  5822. \fi
  5823. \else
  5824. \ifcase\absseclevel
  5825. \chapterzzz{#3}%
  5826. \or \seczzz{#3}%
  5827. \or \numberedsubseczzz{#3}%
  5828. \or \numberedsubsubseczzz{#3}%
  5829. \fi
  5830. \fi
  5831. \fi
  5832. \suppressfirstparagraphindent
  5833. }
  5834. % an interface:
  5835. \def\numhead{\genhead N}
  5836. \def\apphead{\genhead A}
  5837. \def\unnmhead{\genhead U}
  5838. % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
  5839. % all lower-level sectioning counters to zero.
  5840. %
  5841. % Also set \chaplevelprefix, which we prepend to @float sequence numbers
  5842. % (e.g., figures), q.v. By default (before any chapter), that is empty.
  5843. \let\chaplevelprefix = \empty
  5844. %
  5845. \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
  5846. \def\chapterzzz#1{%
  5847. % section resetting is \global in case the chapter is in a group, such
  5848. % as an @include file.
  5849. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5850. \global\advance\chapno by 1
  5851. %
  5852. % Used for \float.
  5853. \gdef\chaplevelprefix{\the\chapno.}%
  5854. \resetallfloatnos
  5855. %
  5856. % \putwordChapter can contain complex things in translations.
  5857. \toks0=\expandafter{\putwordChapter}%
  5858. \message{\the\toks0 \space \the\chapno}%
  5859. %
  5860. % Write the actual heading.
  5861. \chapmacro{#1}{Ynumbered}{\the\chapno}%
  5862. %
  5863. % So @section and the like are numbered underneath this chapter.
  5864. \global\let\section = \numberedsec
  5865. \global\let\subsection = \numberedsubsec
  5866. \global\let\subsubsection = \numberedsubsubsec
  5867. }
  5868. \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
  5869. %
  5870. \def\appendixzzz#1{%
  5871. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5872. \global\advance\appendixno by 1
  5873. \gdef\chaplevelprefix{\appendixletter.}%
  5874. \resetallfloatnos
  5875. %
  5876. % \putwordAppendix can contain complex things in translations.
  5877. \toks0=\expandafter{\putwordAppendix}%
  5878. \message{\the\toks0 \space \appendixletter}%
  5879. %
  5880. \chapmacro{#1}{Yappendix}{\appendixletter}%
  5881. %
  5882. \global\let\section = \appendixsec
  5883. \global\let\subsection = \appendixsubsec
  5884. \global\let\subsubsection = \appendixsubsubsec
  5885. }
  5886. % normally unnmhead0 calls unnumberedzzz:
  5887. \outer\parseargdef\unnumbered{\unnmhead0{#1}}
  5888. \def\unnumberedzzz#1{%
  5889. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5890. \global\advance\unnumberedno by 1
  5891. %
  5892. % Since an unnumbered has no number, no prefix for figures.
  5893. \global\let\chaplevelprefix = \empty
  5894. \resetallfloatnos
  5895. %
  5896. % This used to be simply \message{#1}, but TeX fully expands the
  5897. % argument to \message. Therefore, if #1 contained @-commands, TeX
  5898. % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
  5899. % expanded @cite (which turns out to cause errors because \cite is meant
  5900. % to be executed, not expanded).
  5901. %
  5902. % Anyway, we don't want the fully-expanded definition of @cite to appear
  5903. % as a result of the \message, we just want `@cite' itself. We use
  5904. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  5905. % simply yielding the contents of <toks register>. (We also do this for
  5906. % the toc entries.)
  5907. \toks0 = {#1}%
  5908. \message{(\the\toks0)}%
  5909. %
  5910. \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
  5911. %
  5912. \global\let\section = \unnumberedsec
  5913. \global\let\subsection = \unnumberedsubsec
  5914. \global\let\subsubsection = \unnumberedsubsubsec
  5915. }
  5916. % @centerchap is like @unnumbered, but the heading is centered.
  5917. \outer\parseargdef\centerchap{%
  5918. \let\centerparametersmaybe = \centerparameters
  5919. \unnmhead0{#1}%
  5920. \let\centerparametersmaybe = \relax
  5921. }
  5922. % @top is like @unnumbered.
  5923. \let\top\unnumbered
  5924. % Sections.
  5925. %
  5926. \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
  5927. \def\seczzz#1{%
  5928. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5929. \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
  5930. }
  5931. % normally calls appendixsectionzzz:
  5932. \outer\parseargdef\appendixsection{\apphead1{#1}}
  5933. \def\appendixsectionzzz#1{%
  5934. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5935. \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
  5936. }
  5937. \let\appendixsec\appendixsection
  5938. % normally calls unnumberedseczzz:
  5939. \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
  5940. \def\unnumberedseczzz#1{%
  5941. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5942. \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
  5943. }
  5944. % Subsections.
  5945. %
  5946. % normally calls numberedsubseczzz:
  5947. \outer\parseargdef\numberedsubsec{\numhead2{#1}}
  5948. \def\numberedsubseczzz#1{%
  5949. \global\subsubsecno=0 \global\advance\subsecno by 1
  5950. \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
  5951. }
  5952. % normally calls appendixsubseczzz:
  5953. \outer\parseargdef\appendixsubsec{\apphead2{#1}}
  5954. \def\appendixsubseczzz#1{%
  5955. \global\subsubsecno=0 \global\advance\subsecno by 1
  5956. \sectionheading{#1}{subsec}{Yappendix}%
  5957. {\appendixletter.\the\secno.\the\subsecno}%
  5958. }
  5959. % normally calls unnumberedsubseczzz:
  5960. \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
  5961. \def\unnumberedsubseczzz#1{%
  5962. \global\subsubsecno=0 \global\advance\subsecno by 1
  5963. \sectionheading{#1}{subsec}{Ynothing}%
  5964. {\the\unnumberedno.\the\secno.\the\subsecno}%
  5965. }
  5966. % Subsubsections.
  5967. %
  5968. % normally numberedsubsubseczzz:
  5969. \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
  5970. \def\numberedsubsubseczzz#1{%
  5971. \global\advance\subsubsecno by 1
  5972. \sectionheading{#1}{subsubsec}{Ynumbered}%
  5973. {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5974. }
  5975. % normally appendixsubsubseczzz:
  5976. \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
  5977. \def\appendixsubsubseczzz#1{%
  5978. \global\advance\subsubsecno by 1
  5979. \sectionheading{#1}{subsubsec}{Yappendix}%
  5980. {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
  5981. }
  5982. % normally unnumberedsubsubseczzz:
  5983. \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
  5984. \def\unnumberedsubsubseczzz#1{%
  5985. \global\advance\subsubsecno by 1
  5986. \sectionheading{#1}{subsubsec}{Ynothing}%
  5987. {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5988. }
  5989. % These macros control what the section commands do, according
  5990. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  5991. % Define them by default for a numbered chapter.
  5992. \let\section = \numberedsec
  5993. \let\subsection = \numberedsubsec
  5994. \let\subsubsection = \numberedsubsubsec
  5995. % Define @majorheading, @heading and @subheading
  5996. \def\majorheading{%
  5997. {\advance\chapheadingskip by 10pt \chapbreak }%
  5998. \parsearg\chapheadingzzz
  5999. }
  6000. \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
  6001. \def\chapheadingzzz#1{%
  6002. \vbox{\chapfonts \raggedtitlesettings #1\par}%
  6003. \nobreak\bigskip \nobreak
  6004. \suppressfirstparagraphindent
  6005. }
  6006. % @heading, @subheading, @subsubheading.
  6007. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
  6008. \suppressfirstparagraphindent}
  6009. \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
  6010. \suppressfirstparagraphindent}
  6011. \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
  6012. \suppressfirstparagraphindent}
  6013. % These macros generate a chapter, section, etc. heading only
  6014. % (including whitespace, linebreaking, etc. around it),
  6015. % given all the information in convenient, parsed form.
  6016. % Args are the skip and penalty (usually negative)
  6017. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  6018. % Parameter controlling skip before chapter headings (if needed)
  6019. \newskip\chapheadingskip
  6020. % Define plain chapter starts, and page on/off switching for it.
  6021. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  6022. % Start a new page
  6023. \def\chappager{\par\vfill\supereject}
  6024. % \chapoddpage - start on an odd page for a new chapter
  6025. % Because \domark is called before \chapoddpage, the filler page will
  6026. % get the headings for the next chapter, which is wrong. But we don't
  6027. % care -- we just disable all headings on the filler page.
  6028. \def\chapoddpage{%
  6029. \chappager
  6030. \ifodd\pageno \else
  6031. \begingroup
  6032. \headingsoff
  6033. \null
  6034. \chappager
  6035. \endgroup
  6036. \fi
  6037. }
  6038. \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
  6039. \def\CHAPPAGoff{%
  6040. \global\let\contentsalignmacro = \chappager
  6041. \global\let\pchapsepmacro=\chapbreak
  6042. \global\let\pagealignmacro=\chappager}
  6043. \def\CHAPPAGon{%
  6044. \global\let\contentsalignmacro = \chappager
  6045. \global\let\pchapsepmacro=\chappager
  6046. \global\let\pagealignmacro=\chappager
  6047. \global\def\HEADINGSon{\HEADINGSsingle}}
  6048. \def\CHAPPAGodd{%
  6049. \global\let\contentsalignmacro = \chapoddpage
  6050. \global\let\pchapsepmacro=\chapoddpage
  6051. \global\let\pagealignmacro=\chapoddpage
  6052. \global\def\HEADINGSon{\HEADINGSdouble}}
  6053. \CHAPPAGon
  6054. % \chapmacro - Chapter opening.
  6055. %
  6056. % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
  6057. % Yappendix, Yomitfromtoc), #3 the chapter number.
  6058. % Not used for @heading series.
  6059. %
  6060. % To test against our argument.
  6061. \def\Ynothingkeyword{Ynothing}
  6062. \def\Yappendixkeyword{Yappendix}
  6063. \def\Yomitfromtockeyword{Yomitfromtoc}
  6064. %
  6065. \def\chapmacro#1#2#3{%
  6066. \expandafter\ifx\thisenv\titlepage\else
  6067. \checkenv{}% chapters, etc., should not start inside an environment.
  6068. \fi
  6069. % FIXME: \chapmacro is currently called from inside \titlepage when
  6070. % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
  6071. % this should probably be done by \sectionheading with an option to print
  6072. % in chapter size.
  6073. %
  6074. % Insert the first mark before the heading break (see notes for \domark).
  6075. \let\prevchapterdefs=\lastchapterdefs
  6076. \let\prevsectiondefs=\lastsectiondefs
  6077. \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
  6078. \gdef\thissection{}}%
  6079. %
  6080. \def\temptype{#2}%
  6081. \ifx\temptype\Ynothingkeyword
  6082. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6083. \gdef\thischapter{\thischaptername}}%
  6084. \else\ifx\temptype\Yomitfromtockeyword
  6085. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6086. \gdef\thischapter{}}%
  6087. \else\ifx\temptype\Yappendixkeyword
  6088. \toks0={#1}%
  6089. \xdef\lastchapterdefs{%
  6090. \gdef\noexpand\thischaptername{\the\toks0}%
  6091. \gdef\noexpand\thischapternum{\appendixletter}%
  6092. % \noexpand\putwordAppendix avoids expanding indigestible
  6093. % commands in some of the translations.
  6094. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
  6095. \noexpand\thischapternum:
  6096. \noexpand\thischaptername}%
  6097. }%
  6098. \else
  6099. \toks0={#1}%
  6100. \xdef\lastchapterdefs{%
  6101. \gdef\noexpand\thischaptername{\the\toks0}%
  6102. \gdef\noexpand\thischapternum{\the\chapno}%
  6103. % \noexpand\putwordChapter avoids expanding indigestible
  6104. % commands in some of the translations.
  6105. \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
  6106. \noexpand\thischapternum:
  6107. \noexpand\thischaptername}%
  6108. }%
  6109. \fi\fi\fi
  6110. %
  6111. % Output the mark. Pass it through \safewhatsit, to take care of
  6112. % the preceding space.
  6113. \safewhatsit\domark
  6114. %
  6115. % Insert the chapter heading break.
  6116. \pchapsepmacro
  6117. %
  6118. % Now the second mark, after the heading break. No break points
  6119. % between here and the heading.
  6120. \let\prevchapterdefs=\lastchapterdefs
  6121. \let\prevsectiondefs=\lastsectiondefs
  6122. \domark
  6123. %
  6124. {%
  6125. \chapfonts \rmisbold
  6126. \let\footnote=\errfootnoteheading % give better error message
  6127. %
  6128. % Have to define \lastsection before calling \donoderef, because the
  6129. % xref code eventually uses it. On the other hand, it has to be called
  6130. % after \pchapsepmacro, or the headline will change too soon.
  6131. \gdef\lastsection{#1}%
  6132. %
  6133. % Only insert the separating space if we have a chapter/appendix
  6134. % number, and don't print the unnumbered ``number''.
  6135. \ifx\temptype\Ynothingkeyword
  6136. \setbox0 = \hbox{}%
  6137. \def\toctype{unnchap}%
  6138. \else\ifx\temptype\Yomitfromtockeyword
  6139. \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
  6140. \def\toctype{omit}%
  6141. \else\ifx\temptype\Yappendixkeyword
  6142. \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
  6143. \def\toctype{app}%
  6144. \else
  6145. \setbox0 = \hbox{#3\enspace}%
  6146. \def\toctype{numchap}%
  6147. \fi\fi\fi
  6148. %
  6149. % Write the toc entry for this chapter. Must come before the
  6150. % \donoderef, because we include the current node name in the toc
  6151. % entry, and \donoderef resets it to empty.
  6152. \writetocentry{\toctype}{#1}{#3}%
  6153. %
  6154. % For pdftex, we have to write out the node definition (aka, make
  6155. % the pdfdest) after any page break, but before the actual text has
  6156. % been typeset. If the destination for the pdf outline is after the
  6157. % text, then jumping from the outline may wind up with the text not
  6158. % being visible, for instance under high magnification.
  6159. \donoderef{#2}%
  6160. %
  6161. % Typeset the actual heading.
  6162. \nobreak % Avoid page breaks at the interline glue.
  6163. \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
  6164. \unhbox0 #1\par}%
  6165. }%
  6166. \nobreak\bigskip % no page break after a chapter title
  6167. \nobreak
  6168. }
  6169. % @centerchap -- centered and unnumbered.
  6170. \let\centerparametersmaybe = \relax
  6171. \def\centerparameters{%
  6172. \advance\rightskip by 3\rightskip
  6173. \leftskip = \rightskip
  6174. \parfillskip = 0pt
  6175. }
  6176. % Section titles. These macros combine the section number parts and
  6177. % call the generic \sectionheading to do the printing.
  6178. %
  6179. \newskip\secheadingskip
  6180. \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
  6181. % Subsection titles.
  6182. \newskip\subsecheadingskip
  6183. \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
  6184. % Subsubsection titles.
  6185. \def\subsubsecheadingskip{\subsecheadingskip}
  6186. \def\subsubsecheadingbreak{\subsecheadingbreak}
  6187. % Print any size, any type, section title.
  6188. %
  6189. % #1 is the text of the title,
  6190. % #2 is the section level (sec/subsec/subsubsec),
  6191. % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
  6192. % #4 is the section number.
  6193. %
  6194. \def\seckeyword{sec}
  6195. %
  6196. \def\sectionheading#1#2#3#4{%
  6197. {%
  6198. \def\sectionlevel{#2}%
  6199. \def\temptype{#3}%
  6200. %
  6201. % It is ok for the @heading series commands to appear inside an
  6202. % environment (it's been historically allowed, though the logic is
  6203. % dubious), but not the others.
  6204. \ifx\temptype\Yomitfromtockeyword\else
  6205. \checkenv{}% non-@*heading should not be in an environment.
  6206. \fi
  6207. \let\footnote=\errfootnoteheading
  6208. %
  6209. % Switch to the right set of fonts.
  6210. \csname #2fonts\endcsname \rmisbold
  6211. %
  6212. % Insert first mark before the heading break (see notes for \domark).
  6213. \let\prevsectiondefs=\lastsectiondefs
  6214. \ifx\temptype\Ynothingkeyword
  6215. \ifx\sectionlevel\seckeyword
  6216. \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
  6217. \gdef\thissection{\thissectionname}}%
  6218. \fi
  6219. \else\ifx\temptype\Yomitfromtockeyword
  6220. % Don't redefine \thissection.
  6221. \else\ifx\temptype\Yappendixkeyword
  6222. \ifx\sectionlevel\seckeyword
  6223. \toks0={#1}%
  6224. \xdef\lastsectiondefs{%
  6225. \gdef\noexpand\thissectionname{\the\toks0}%
  6226. \gdef\noexpand\thissectionnum{#4}%
  6227. % \noexpand\putwordSection avoids expanding indigestible
  6228. % commands in some of the translations.
  6229. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6230. \noexpand\thissectionnum:
  6231. \noexpand\thissectionname}%
  6232. }%
  6233. \fi
  6234. \else
  6235. \ifx\sectionlevel\seckeyword
  6236. \toks0={#1}%
  6237. \xdef\lastsectiondefs{%
  6238. \gdef\noexpand\thissectionname{\the\toks0}%
  6239. \gdef\noexpand\thissectionnum{#4}%
  6240. % \noexpand\putwordSection avoids expanding indigestible
  6241. % commands in some of the translations.
  6242. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6243. \noexpand\thissectionnum:
  6244. \noexpand\thissectionname}%
  6245. }%
  6246. \fi
  6247. \fi\fi\fi
  6248. %
  6249. % Go into vertical mode. Usually we'll already be there, but we
  6250. % don't want the following whatsit to end up in a preceding paragraph
  6251. % if the document didn't happen to have a blank line.
  6252. \par
  6253. %
  6254. % Output the mark. Pass it through \safewhatsit, to take care of
  6255. % the preceding space.
  6256. \safewhatsit\domark
  6257. %
  6258. % Insert space above the heading.
  6259. \csname #2headingbreak\endcsname
  6260. %
  6261. % Now the second mark, after the heading break. No break points
  6262. % between here and the heading.
  6263. \global\let\prevsectiondefs=\lastsectiondefs
  6264. \domark
  6265. %
  6266. % Only insert the space after the number if we have a section number.
  6267. \ifx\temptype\Ynothingkeyword
  6268. \setbox0 = \hbox{}%
  6269. \def\toctype{unn}%
  6270. \gdef\lastsection{#1}%
  6271. \else\ifx\temptype\Yomitfromtockeyword
  6272. % for @headings -- no section number, don't include in toc,
  6273. % and don't redefine \lastsection.
  6274. \setbox0 = \hbox{}%
  6275. \def\toctype{omit}%
  6276. \let\sectionlevel=\empty
  6277. \else\ifx\temptype\Yappendixkeyword
  6278. \setbox0 = \hbox{#4\enspace}%
  6279. \def\toctype{app}%
  6280. \gdef\lastsection{#1}%
  6281. \else
  6282. \setbox0 = \hbox{#4\enspace}%
  6283. \def\toctype{num}%
  6284. \gdef\lastsection{#1}%
  6285. \fi\fi\fi
  6286. %
  6287. % Write the toc entry (before \donoderef). See comments in \chapmacro.
  6288. \writetocentry{\toctype\sectionlevel}{#1}{#4}%
  6289. %
  6290. % Write the node reference (= pdf destination for pdftex).
  6291. % Again, see comments in \chapmacro.
  6292. \donoderef{#3}%
  6293. %
  6294. % Interline glue will be inserted when the vbox is completed.
  6295. % That glue will be a valid breakpoint for the page, since it'll be
  6296. % preceded by a whatsit (usually from the \donoderef, or from the
  6297. % \writetocentry if there was no node). We don't want to allow that
  6298. % break, since then the whatsits could end up on page n while the
  6299. % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
  6300. \nobreak
  6301. %
  6302. % Output the actual section heading.
  6303. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
  6304. \hangindent=\wd0 % zero if no section number
  6305. \unhbox0 #1}%
  6306. }%
  6307. % Add extra space after the heading -- half of whatever came above it.
  6308. % Don't allow stretch, though.
  6309. \kern .5 \csname #2headingskip\endcsname
  6310. %
  6311. % Do not let the kern be a potential breakpoint, as it would be if it
  6312. % was followed by glue.
  6313. \nobreak
  6314. %
  6315. % We'll almost certainly start a paragraph next, so don't let that
  6316. % glue accumulate. (Not a breakpoint because it's preceded by a
  6317. % discardable item.) However, when a paragraph is not started next
  6318. % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
  6319. % or the negative glue will cause weirdly wrong output, typically
  6320. % obscuring the section heading with something else.
  6321. \vskip-\parskip
  6322. %
  6323. % This is so the last item on the main vertical list is a known
  6324. % \penalty > 10000, so \startdefun, etc., can recognize the situation
  6325. % and do the needful.
  6326. \penalty 10001
  6327. }
  6328. \message{toc,}
  6329. % Table of contents.
  6330. \newwrite\tocfile
  6331. % Write an entry to the toc file, opening it if necessary.
  6332. % Called from @chapter, etc.
  6333. %
  6334. % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
  6335. % We append the current node name (if any) and page number as additional
  6336. % arguments for the \{chap,sec,...}entry macros which will eventually
  6337. % read this. The node name is used in the pdf outlines as the
  6338. % destination to jump to.
  6339. %
  6340. % We open the .toc file for writing here instead of at @setfilename (or
  6341. % any other fixed time) so that @contents can be anywhere in the document.
  6342. % But if #1 is `omit', then we don't do anything. This is used for the
  6343. % table of contents chapter openings themselves.
  6344. %
  6345. \newif\iftocfileopened
  6346. \def\omitkeyword{omit}%
  6347. %
  6348. \def\writetocentry#1#2#3{%
  6349. \edef\writetoctype{#1}%
  6350. \ifx\writetoctype\omitkeyword \else
  6351. \iftocfileopened\else
  6352. \immediate\openout\tocfile = \jobname.toc
  6353. \global\tocfileopenedtrue
  6354. \fi
  6355. %
  6356. \iflinks
  6357. {\atdummies
  6358. \edef\temp{%
  6359. \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
  6360. \temp
  6361. }%
  6362. \fi
  6363. \fi
  6364. %
  6365. % Tell \shipout to create a pdf destination on each page, if we're
  6366. % writing pdf. These are used in the table of contents. We can't
  6367. % just write one on every page because the title pages are numbered
  6368. % 1 and 2 (the page numbers aren't printed), and so are the first
  6369. % two pages of the document. Thus, we'd have two destinations named
  6370. % `1', and two named `2'.
  6371. \ifpdf
  6372. \global\pdfmakepagedesttrue
  6373. \else
  6374. \ifx\XeTeXrevision\thisisundefined
  6375. \else
  6376. \global\pdfmakepagedesttrue
  6377. \fi
  6378. \fi
  6379. }
  6380. % These characters do not print properly in the Computer Modern roman
  6381. % fonts, so we must take special care. This is more or less redundant
  6382. % with the Texinfo input format setup at the end of this file.
  6383. %
  6384. \def\activecatcodes{%
  6385. \catcode`\"=\active
  6386. \catcode`\$=\active
  6387. \catcode`\<=\active
  6388. \catcode`\>=\active
  6389. \catcode`\\=\active
  6390. \catcode`\^=\active
  6391. \catcode`\_=\active
  6392. \catcode`\|=\active
  6393. \catcode`\~=\active
  6394. }
  6395. % Read the toc file, which is essentially Texinfo input.
  6396. \def\readtocfile{%
  6397. \setupdatafile
  6398. \activecatcodes
  6399. \input \tocreadfilename
  6400. }
  6401. \newskip\contentsrightmargin \contentsrightmargin=1in
  6402. \newcount\savepageno
  6403. \newcount\lastnegativepageno \lastnegativepageno = -1
  6404. % Prepare to read what we've written to \tocfile.
  6405. %
  6406. \def\startcontents#1{%
  6407. % If @setchapternewpage on, and @headings double, the contents should
  6408. % start on an odd page, unlike chapters. Thus, we maintain
  6409. % \contentsalignmacro in parallel with \pagealignmacro.
  6410. % From: Torbjorn Granlund <tege@matematik.su.se>
  6411. \contentsalignmacro
  6412. \immediate\closeout\tocfile
  6413. %
  6414. % Don't need to put `Contents' or `Short Contents' in the headline.
  6415. % It is abundantly clear what they are.
  6416. \chapmacro{#1}{Yomitfromtoc}{}%
  6417. %
  6418. \savepageno = \pageno
  6419. \begingroup % Set up to handle contents files properly.
  6420. \raggedbottom % Worry more about breakpoints than the bottom.
  6421. \entryrightmargin=\contentsrightmargin % Don't use the full line length.
  6422. %
  6423. % Roman numerals for page numbers.
  6424. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  6425. }
  6426. % redefined for the two-volume lispref. We always output on
  6427. % \jobname.toc even if this is redefined.
  6428. %
  6429. \def\tocreadfilename{\jobname.toc}
  6430. % Normal (long) toc.
  6431. %
  6432. \def\contents{%
  6433. \startcontents{\putwordTOC}%
  6434. \openin 1 \tocreadfilename\space
  6435. \ifeof 1 \else
  6436. \readtocfile
  6437. \fi
  6438. \vfill \eject
  6439. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6440. \ifeof 1 \else
  6441. \pdfmakeoutlines
  6442. \fi
  6443. \closein 1
  6444. \endgroup
  6445. \lastnegativepageno = \pageno
  6446. \global\pageno = \savepageno
  6447. }
  6448. % And just the chapters.
  6449. \def\summarycontents{%
  6450. \startcontents{\putwordShortTOC}%
  6451. %
  6452. \let\partentry = \shortpartentry
  6453. \let\numchapentry = \shortchapentry
  6454. \let\appentry = \shortchapentry
  6455. \let\unnchapentry = \shortunnchapentry
  6456. % We want a true roman here for the page numbers.
  6457. \secfonts
  6458. \let\rm=\shortcontrm \let\bf=\shortcontbf
  6459. \let\sl=\shortcontsl \let\tt=\shortconttt
  6460. \rm
  6461. \hyphenpenalty = 10000
  6462. \advance\baselineskip by 1pt % Open it up a little.
  6463. \def\numsecentry##1##2##3##4{}
  6464. \let\appsecentry = \numsecentry
  6465. \let\unnsecentry = \numsecentry
  6466. \let\numsubsecentry = \numsecentry
  6467. \let\appsubsecentry = \numsecentry
  6468. \let\unnsubsecentry = \numsecentry
  6469. \let\numsubsubsecentry = \numsecentry
  6470. \let\appsubsubsecentry = \numsecentry
  6471. \let\unnsubsubsecentry = \numsecentry
  6472. \openin 1 \tocreadfilename\space
  6473. \ifeof 1 \else
  6474. \readtocfile
  6475. \fi
  6476. \closein 1
  6477. \vfill \eject
  6478. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6479. \endgroup
  6480. \lastnegativepageno = \pageno
  6481. \global\pageno = \savepageno
  6482. }
  6483. \let\shortcontents = \summarycontents
  6484. % Typeset the label for a chapter or appendix for the short contents.
  6485. % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
  6486. %
  6487. \def\shortchaplabel#1{%
  6488. % This space should be enough, since a single number is .5em, and the
  6489. % widest letter (M) is 1em, at least in the Computer Modern fonts.
  6490. % But use \hss just in case.
  6491. % (This space doesn't include the extra space that gets added after
  6492. % the label; that gets put in by \shortchapentry above.)
  6493. %
  6494. % We'd like to right-justify chapter numbers, but that looks strange
  6495. % with appendix letters. And right-justifying numbers and
  6496. % left-justifying letters looks strange when there is less than 10
  6497. % chapters. Have to read the whole toc once to know how many chapters
  6498. % there are before deciding ...
  6499. \hbox to 1em{#1\hss}%
  6500. }
  6501. % These macros generate individual entries in the table of contents.
  6502. % The first argument is the chapter or section name.
  6503. % The last argument is the page number.
  6504. % The arguments in between are the chapter number, section number, ...
  6505. % Parts, in the main contents. Replace the part number, which doesn't
  6506. % exist, with an empty box. Let's hope all the numbers have the same width.
  6507. % Also ignore the page number, which is conventionally not printed.
  6508. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
  6509. \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
  6510. %
  6511. % Parts, in the short toc.
  6512. \def\shortpartentry#1#2#3#4{%
  6513. \penalty-300
  6514. \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
  6515. \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
  6516. }
  6517. % Chapters, in the main contents.
  6518. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
  6519. % Chapters, in the short toc.
  6520. % See comments in \dochapentry re vbox and related settings.
  6521. \def\shortchapentry#1#2#3#4{%
  6522. \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
  6523. }
  6524. % Appendices, in the main contents.
  6525. % Need the word Appendix, and a fixed-size box.
  6526. %
  6527. \def\appendixbox#1{%
  6528. % We use M since it's probably the widest letter.
  6529. \setbox0 = \hbox{\putwordAppendix{} M}%
  6530. \hbox to \wd0{\putwordAppendix{} #1\hss}}
  6531. %
  6532. \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
  6533. % Unnumbered chapters.
  6534. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
  6535. \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
  6536. % Sections.
  6537. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
  6538. \let\appsecentry=\numsecentry
  6539. \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
  6540. % Subsections.
  6541. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
  6542. \let\appsubsecentry=\numsubsecentry
  6543. \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
  6544. % And subsubsections.
  6545. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
  6546. \let\appsubsubsecentry=\numsubsubsecentry
  6547. \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
  6548. % This parameter controls the indentation of the various levels.
  6549. % Same as \defaultparindent.
  6550. \newdimen\tocindent \tocindent = 15pt
  6551. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  6552. % page number.
  6553. %
  6554. % If the toc has to be broken over pages, we want it to be at chapters
  6555. % if at all possible; hence the \penalty.
  6556. \def\dochapentry#1#2{%
  6557. \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  6558. \begingroup
  6559. % Move the page numbers slightly to the right
  6560. \advance\entryrightmargin by -0.05em
  6561. \chapentryfonts
  6562. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6563. \endgroup
  6564. \nobreak\vskip .25\baselineskip plus.1\baselineskip
  6565. }
  6566. \def\dosecentry#1#2{\begingroup
  6567. \secentryfonts \leftskip=\tocindent
  6568. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6569. \endgroup}
  6570. \def\dosubsecentry#1#2{\begingroup
  6571. \subsecentryfonts \leftskip=2\tocindent
  6572. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6573. \endgroup}
  6574. \def\dosubsubsecentry#1#2{\begingroup
  6575. \subsubsecentryfonts \leftskip=3\tocindent
  6576. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6577. \endgroup}
  6578. % We use the same \entry macro as for the index entries.
  6579. \let\tocentry = \entry
  6580. % Space between chapter (or whatever) number and the title.
  6581. \def\labelspace{\hskip1em \relax}
  6582. \def\dopageno#1{{\rm #1}}
  6583. \def\doshortpageno#1{{\rm #1}}
  6584. \def\chapentryfonts{\secfonts \rm}
  6585. \def\secentryfonts{\textfonts}
  6586. \def\subsecentryfonts{\textfonts}
  6587. \def\subsubsecentryfonts{\textfonts}
  6588. \message{environments,}
  6589. % @foo ... @end foo.
  6590. % @tex ... @end tex escapes into raw TeX temporarily.
  6591. % One exception: @ is still an escape character, so that @end tex works.
  6592. % But \@ or @@ will get a plain @ character.
  6593. \envdef\tex{%
  6594. \setupmarkupstyle{tex}%
  6595. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  6596. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  6597. \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  6598. \catcode `\%=14
  6599. \catcode `\+=\other
  6600. \catcode `\"=\other
  6601. \catcode `\|=\other
  6602. \catcode `\<=\other
  6603. \catcode `\>=\other
  6604. \catcode `\`=\other
  6605. \catcode `\'=\other
  6606. %
  6607. % ' is active in math mode (mathcode"8000). So reset it, and all our
  6608. % other math active characters (just in case), to plain's definitions.
  6609. \mathactive
  6610. %
  6611. % Inverse of the list at the beginning of the file.
  6612. \let\b=\ptexb
  6613. \let\bullet=\ptexbullet
  6614. \let\c=\ptexc
  6615. \let\,=\ptexcomma
  6616. \let\.=\ptexdot
  6617. \let\dots=\ptexdots
  6618. \let\equiv=\ptexequiv
  6619. \let\!=\ptexexclam
  6620. \let\i=\ptexi
  6621. \let\indent=\ptexindent
  6622. \let\noindent=\ptexnoindent
  6623. \let\{=\ptexlbrace
  6624. \let\+=\tabalign
  6625. \let\}=\ptexrbrace
  6626. \let\/=\ptexslash
  6627. \let\sp=\ptexsp
  6628. \let\*=\ptexstar
  6629. %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
  6630. \let\t=\ptext
  6631. \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
  6632. \let\frenchspacing=\plainfrenchspacing
  6633. %
  6634. \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  6635. \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  6636. \def\@{@}%
  6637. }
  6638. % There is no need to define \Etex.
  6639. % Define @lisp ... @end lisp.
  6640. % @lisp environment forms a group so it can rebind things,
  6641. % including the definition of @end lisp (which normally is erroneous).
  6642. % Amount to narrow the margins by for @lisp.
  6643. \newskip\lispnarrowing \lispnarrowing=0.4in
  6644. % This is the definition that ^^M gets inside @lisp, @example, and other
  6645. % such environments. \null is better than a space, since it doesn't
  6646. % have any width.
  6647. \def\lisppar{\null\endgraf}
  6648. % This space is always present above and below environments.
  6649. \newskip\envskipamount \envskipamount = 0pt
  6650. % Make spacing and below environment symmetrical. We use \parskip here
  6651. % to help in doing that, since in @example-like environments \parskip
  6652. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  6653. % start of the next paragraph will insert \parskip.
  6654. %
  6655. \def\aboveenvbreak{{%
  6656. % =10000 instead of <10000 because of a special case in \itemzzz and
  6657. % \sectionheading, q.v.
  6658. \ifnum \lastpenalty=10000 \else
  6659. \advance\envskipamount by \parskip
  6660. \endgraf
  6661. \ifdim\lastskip<\envskipamount
  6662. \removelastskip
  6663. \ifnum\lastpenalty<10000
  6664. % Penalize breaking before the environment, because preceding text
  6665. % often leads into it.
  6666. \penalty100
  6667. \fi
  6668. \vskip\envskipamount
  6669. \fi
  6670. \fi
  6671. }}
  6672. \def\afterenvbreak{{%
  6673. % =10000 instead of <10000 because of a special case in \itemzzz and
  6674. % \sectionheading, q.v.
  6675. \ifnum \lastpenalty=10000 \else
  6676. \advance\envskipamount by \parskip
  6677. \endgraf
  6678. \ifdim\lastskip<\envskipamount
  6679. \removelastskip
  6680. % it's not a good place to break if the last penalty was \nobreak
  6681. % or better ...
  6682. \ifnum\lastpenalty<10000 \penalty-50 \fi
  6683. \vskip\envskipamount
  6684. \fi
  6685. \fi
  6686. }}
  6687. % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
  6688. % also clear it, so that its embedded environments do the narrowing again.
  6689. \let\nonarrowing=\relax
  6690. % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  6691. % environment contents.
  6692. \font\circle=lcircle10
  6693. \newdimen\circthick
  6694. \newdimen\cartouter\newdimen\cartinner
  6695. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  6696. \circthick=\fontdimen8\circle
  6697. %
  6698. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  6699. \def\ctr{{\hskip 6pt\circle\char'010}}
  6700. \def\cbl{{\circle\char'012\hskip -6pt}}
  6701. \def\cbr{{\hskip 6pt\circle\char'011}}
  6702. \def\carttop{\hbox to \cartouter{\hskip\lskip
  6703. \ctl\leaders\hrule height\circthick\hfil\ctr
  6704. \hskip\rskip}}
  6705. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  6706. \cbl\leaders\hrule height\circthick\hfil\cbr
  6707. \hskip\rskip}}
  6708. %
  6709. \newskip\lskip\newskip\rskip
  6710. \envdef\cartouche{%
  6711. \ifhmode\par\fi % can't be in the midst of a paragraph.
  6712. \startsavinginserts
  6713. \lskip=\leftskip \rskip=\rightskip
  6714. \leftskip=0pt\rightskip=0pt % we want these *outside*.
  6715. \cartinner=\hsize \advance\cartinner by-\lskip
  6716. \advance\cartinner by-\rskip
  6717. \cartouter=\hsize
  6718. \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  6719. % side, and for 6pt waste from
  6720. % each corner char, and rule thickness
  6721. \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  6722. %
  6723. % If this cartouche directly follows a sectioning command, we need the
  6724. % \parskip glue (backspaced over by default) or the cartouche can
  6725. % collide with the section heading.
  6726. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
  6727. %
  6728. \setbox\groupbox=\vbox\bgroup
  6729. \baselineskip=0pt\parskip=0pt\lineskip=0pt
  6730. \carttop
  6731. \hbox\bgroup
  6732. \hskip\lskip
  6733. \vrule\kern3pt
  6734. \vbox\bgroup
  6735. \kern3pt
  6736. \hsize=\cartinner
  6737. \baselineskip=\normbskip
  6738. \lineskip=\normlskip
  6739. \parskip=\normpskip
  6740. \vskip -\parskip
  6741. \comment % For explanation, see the end of def\group.
  6742. }
  6743. \def\Ecartouche{%
  6744. \ifhmode\par\fi
  6745. \kern3pt
  6746. \egroup
  6747. \kern3pt\vrule
  6748. \hskip\rskip
  6749. \egroup
  6750. \cartbot
  6751. \egroup
  6752. \addgroupbox
  6753. \checkinserts
  6754. }
  6755. % This macro is called at the beginning of all the @example variants,
  6756. % inside a group.
  6757. \newdimen\nonfillparindent
  6758. \def\nonfillstart{%
  6759. \aboveenvbreak
  6760. \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
  6761. \sepspaces % Make spaces be word-separators rather than space tokens.
  6762. \let\par = \lisppar % don't ignore blank lines
  6763. \obeylines % each line of input is a line of output
  6764. \parskip = 0pt
  6765. % Turn off paragraph indentation but redefine \indent to emulate
  6766. % the normal \indent.
  6767. \nonfillparindent=\parindent
  6768. \parindent = 0pt
  6769. \let\indent\nonfillindent
  6770. %
  6771. \emergencystretch = 0pt % don't try to avoid overfull boxes
  6772. \ifx\nonarrowing\relax
  6773. \advance \leftskip by \lispnarrowing
  6774. \exdentamount=\lispnarrowing
  6775. \else
  6776. \let\nonarrowing = \relax
  6777. \fi
  6778. \let\exdent=\nofillexdent
  6779. }
  6780. \begingroup
  6781. \obeyspaces
  6782. % We want to swallow spaces (but not other tokens) after the fake
  6783. % @indent in our nonfill-environments, where spaces are normally
  6784. % active and set to @tie, resulting in them not being ignored after
  6785. % @indent.
  6786. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
  6787. \gdef\nonfillindentcheck{%
  6788. \ifx\temp %
  6789. \expandafter\nonfillindentgobble%
  6790. \else%
  6791. \leavevmode\nonfillindentbox%
  6792. \fi%
  6793. }%
  6794. \endgroup
  6795. \def\nonfillindentgobble#1{\nonfillindent}
  6796. \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
  6797. % If you want all examples etc. small: @set dispenvsize small.
  6798. % If you want even small examples the full size: @set dispenvsize nosmall.
  6799. % This affects the following displayed environments:
  6800. % @example, @display, @format, @lisp
  6801. %
  6802. \def\smallword{small}
  6803. \def\nosmallword{nosmall}
  6804. \let\SETdispenvsize\relax
  6805. \def\setnormaldispenv{%
  6806. \ifx\SETdispenvsize\smallword
  6807. % end paragraph for sake of leading, in case document has no blank
  6808. % line. This is redundant with what happens in \aboveenvbreak, but
  6809. % we need to do it before changing the fonts, and it's inconvenient
  6810. % to change the fonts afterward.
  6811. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6812. \smallexamplefonts \rm
  6813. \fi
  6814. }
  6815. \def\setsmalldispenv{%
  6816. \ifx\SETdispenvsize\nosmallword
  6817. \else
  6818. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6819. \smallexamplefonts \rm
  6820. \fi
  6821. }
  6822. % We often define two environments, @foo and @smallfoo.
  6823. % Let's do it in one command. #1 is the env name, #2 the definition.
  6824. \def\makedispenvdef#1#2{%
  6825. \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
  6826. \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
  6827. \expandafter\let\csname E#1\endcsname \afterenvbreak
  6828. \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
  6829. }
  6830. % Define two environment synonyms (#1 and #2) for an environment.
  6831. \def\maketwodispenvdef#1#2#3{%
  6832. \makedispenvdef{#1}{#3}%
  6833. \makedispenvdef{#2}{#3}%
  6834. }
  6835. %
  6836. % @lisp: indented, narrowed, typewriter font;
  6837. % @example: same as @lisp.
  6838. %
  6839. % @smallexample and @smalllisp: use smaller fonts.
  6840. % Originally contributed by Pavel@xerox.
  6841. %
  6842. \maketwodispenvdef{lisp}{example}{%
  6843. \nonfillstart
  6844. \tt\setupmarkupstyle{example}%
  6845. \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  6846. \gobble % eat return
  6847. }
  6848. % @display/@smalldisplay: same as @lisp except keep current font.
  6849. %
  6850. \makedispenvdef{display}{%
  6851. \nonfillstart
  6852. \gobble
  6853. }
  6854. % @format/@smallformat: same as @display except don't narrow margins.
  6855. %
  6856. \makedispenvdef{format}{%
  6857. \let\nonarrowing = t%
  6858. \nonfillstart
  6859. \gobble
  6860. }
  6861. % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
  6862. \envdef\flushleft{%
  6863. \let\nonarrowing = t%
  6864. \nonfillstart
  6865. \gobble
  6866. }
  6867. \let\Eflushleft = \afterenvbreak
  6868. % @flushright.
  6869. %
  6870. \envdef\flushright{%
  6871. \let\nonarrowing = t%
  6872. \nonfillstart
  6873. \advance\leftskip by 0pt plus 1fill\relax
  6874. \gobble
  6875. }
  6876. \let\Eflushright = \afterenvbreak
  6877. % @raggedright does more-or-less normal line breaking but no right
  6878. % justification. From plain.tex. Don't stretch around special
  6879. % characters in urls in this environment, since the stretch at the right
  6880. % should be enough.
  6881. \envdef\raggedright{%
  6882. \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
  6883. \def\urefprestretchamount{0pt}%
  6884. \def\urefpoststretchamount{0pt}%
  6885. }
  6886. \let\Eraggedright\par
  6887. \envdef\raggedleft{%
  6888. \parindent=0pt \leftskip0pt plus2em
  6889. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6890. \hbadness=10000 % Last line will usually be underfull, so turn off
  6891. % badness reporting.
  6892. }
  6893. \let\Eraggedleft\par
  6894. \envdef\raggedcenter{%
  6895. \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
  6896. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6897. \hbadness=10000 % Last line will usually be underfull, so turn off
  6898. % badness reporting.
  6899. }
  6900. \let\Eraggedcenter\par
  6901. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  6902. % and narrows the margins. We keep \parskip nonzero in general, since
  6903. % we're doing normal filling. So, when using \aboveenvbreak and
  6904. % \afterenvbreak, temporarily make \parskip 0.
  6905. %
  6906. \makedispenvdef{quotation}{\quotationstart}
  6907. %
  6908. \def\quotationstart{%
  6909. \indentedblockstart % same as \indentedblock, but increase right margin too.
  6910. \ifx\nonarrowing\relax
  6911. \advance\rightskip by \lispnarrowing
  6912. \fi
  6913. \parsearg\quotationlabel
  6914. }
  6915. % We have retained a nonzero parskip for the environment, since we're
  6916. % doing normal filling.
  6917. %
  6918. \def\Equotation{%
  6919. \par
  6920. \ifx\quotationauthor\thisisundefined\else
  6921. % indent a bit.
  6922. \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
  6923. \fi
  6924. {\parskip=0pt \afterenvbreak}%
  6925. }
  6926. \def\Esmallquotation{\Equotation}
  6927. % If we're given an argument, typeset it in bold with a colon after.
  6928. \def\quotationlabel#1{%
  6929. \def\temp{#1}%
  6930. \ifx\temp\empty \else
  6931. {\bf #1: }%
  6932. \fi
  6933. }
  6934. % @indentedblock is like @quotation, but indents only on the left and
  6935. % has no optional argument.
  6936. %
  6937. \makedispenvdef{indentedblock}{\indentedblockstart}
  6938. %
  6939. \def\indentedblockstart{%
  6940. {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  6941. \parindent=0pt
  6942. %
  6943. % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  6944. \ifx\nonarrowing\relax
  6945. \advance\leftskip by \lispnarrowing
  6946. \exdentamount = \lispnarrowing
  6947. \else
  6948. \let\nonarrowing = \relax
  6949. \fi
  6950. }
  6951. % Keep a nonzero parskip for the environment, since we're doing normal filling.
  6952. %
  6953. \def\Eindentedblock{%
  6954. \par
  6955. {\parskip=0pt \afterenvbreak}%
  6956. }
  6957. \def\Esmallindentedblock{\Eindentedblock}
  6958. % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
  6959. % If we want to allow any <char> as delimiter,
  6960. % we need the curly braces so that makeinfo sees the @verb command, eg:
  6961. % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
  6962. %
  6963. % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
  6964. %
  6965. % [Knuth] p.344; only we need to do the other characters Texinfo sets
  6966. % active too. Otherwise, they get lost as the first character on a
  6967. % verbatim line.
  6968. \def\dospecials{%
  6969. \do\ \do\\\do\{\do\}\do\$\do\&%
  6970. \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  6971. \do\<\do\>\do\|\do\@\do+\do\"%
  6972. % Don't do the quotes -- if we do, @set txicodequoteundirected and
  6973. % @set txicodequotebacktick will not have effect on @verb and
  6974. % @verbatim, and ?` and !` ligatures won't get disabled.
  6975. %\do\`\do\'%
  6976. }
  6977. %
  6978. % [Knuth] p. 380
  6979. \def\uncatcodespecials{%
  6980. \def\do##1{\catcode`##1=\other}\dospecials}
  6981. %
  6982. % Setup for the @verb command.
  6983. %
  6984. % Eight spaces for a tab
  6985. \begingroup
  6986. \catcode`\^^I=\active
  6987. \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
  6988. \endgroup
  6989. %
  6990. \def\setupverb{%
  6991. \tt % easiest (and conventionally used) font for verbatim
  6992. \def\par{\leavevmode\endgraf}%
  6993. \setupmarkupstyle{verb}%
  6994. \tabeightspaces
  6995. % Respect line breaks,
  6996. % print special symbols as themselves, and
  6997. % make each space count
  6998. % must do in this order:
  6999. \obeylines \uncatcodespecials \sepspaces
  7000. }
  7001. % Setup for the @verbatim environment
  7002. %
  7003. % Real tab expansion.
  7004. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
  7005. %
  7006. % We typeset each line of the verbatim in an \hbox, so we can handle
  7007. % tabs. The \global is in case the verbatim line starts with an accent,
  7008. % or some other command that starts with a begin-group. Otherwise, the
  7009. % entire \verbbox would disappear at the corresponding end-group, before
  7010. % it is typeset. Meanwhile, we can't have nested verbatim commands
  7011. % (can we?), so the \global won't be overwriting itself.
  7012. \newbox\verbbox
  7013. \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
  7014. %
  7015. \begingroup
  7016. \catcode`\^^I=\active
  7017. \gdef\tabexpand{%
  7018. \catcode`\^^I=\active
  7019. \def^^I{\leavevmode\egroup
  7020. \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
  7021. \divide\dimen\verbbox by\tabw
  7022. \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
  7023. \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
  7024. \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
  7025. }%
  7026. }
  7027. \endgroup
  7028. % start the verbatim environment.
  7029. \def\setupverbatim{%
  7030. \let\nonarrowing = t%
  7031. \nonfillstart
  7032. \tt % easiest (and conventionally used) font for verbatim
  7033. % The \leavevmode here is for blank lines. Otherwise, we would
  7034. % never \starttabox and the \egroup would end verbatim mode.
  7035. \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
  7036. \tabexpand
  7037. \setupmarkupstyle{verbatim}%
  7038. % Respect line breaks,
  7039. % print special symbols as themselves, and
  7040. % make each space count.
  7041. % Must do in this order:
  7042. \obeylines \uncatcodespecials \sepspaces
  7043. \everypar{\starttabbox}%
  7044. }
  7045. % Do the @verb magic: verbatim text is quoted by unique
  7046. % delimiter characters. Before first delimiter expect a
  7047. % right brace, after last delimiter expect closing brace:
  7048. %
  7049. % \def\doverb'{'<char>#1<char>'}'{#1}
  7050. %
  7051. % [Knuth] p. 382; only eat outer {}
  7052. \begingroup
  7053. \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
  7054. \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
  7055. \endgroup
  7056. %
  7057. \def\verb{\begingroup\setupverb\doverb}
  7058. %
  7059. %
  7060. % Do the @verbatim magic: define the macro \doverbatim so that
  7061. % the (first) argument ends when '@end verbatim' is reached, ie:
  7062. %
  7063. % \def\doverbatim#1@end verbatim{#1}
  7064. %
  7065. % For Texinfo it's a lot easier than for LaTeX,
  7066. % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
  7067. % we need not redefine '\', '{' and '}'.
  7068. %
  7069. % Inspired by LaTeX's verbatim command set [latex.ltx]
  7070. %
  7071. \begingroup
  7072. \catcode`\ =\active
  7073. \obeylines %
  7074. % ignore everything up to the first ^^M, that's the newline at the end
  7075. % of the @verbatim input line itself. Otherwise we get an extra blank
  7076. % line in the output.
  7077. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
  7078. % We really want {...\end verbatim} in the body of the macro, but
  7079. % without the active space; thus we have to use \xdef and \gobble.
  7080. \endgroup
  7081. %
  7082. \envdef\verbatim{%
  7083. \setupverbatim\doverbatim
  7084. }
  7085. \let\Everbatim = \afterenvbreak
  7086. % @verbatiminclude FILE - insert text of file in verbatim environment.
  7087. %
  7088. \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
  7089. %
  7090. \def\doverbatiminclude#1{%
  7091. {%
  7092. \makevalueexpandable
  7093. \setupverbatim
  7094. \indexnofonts % Allow `@@' and other weird things in file names.
  7095. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
  7096. \input #1
  7097. \afterenvbreak
  7098. }%
  7099. }
  7100. % @copying ... @end copying.
  7101. % Save the text away for @insertcopying later.
  7102. %
  7103. % We save the uninterpreted tokens, rather than creating a box.
  7104. % Saving the text in a box would be much easier, but then all the
  7105. % typesetting commands (@smallbook, font changes, etc.) have to be done
  7106. % beforehand -- and a) we want @copying to be done first in the source
  7107. % file; b) letting users define the frontmatter in as flexible order as
  7108. % possible is desirable.
  7109. %
  7110. \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
  7111. \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
  7112. %
  7113. \def\insertcopying{%
  7114. \begingroup
  7115. \parindent = 0pt % paragraph indentation looks wrong on title page
  7116. \scanexp\copyingtext
  7117. \endgroup
  7118. }
  7119. \message{defuns,}
  7120. % @defun etc.
  7121. \newskip\defbodyindent \defbodyindent=.4in
  7122. \newskip\defargsindent \defargsindent=50pt
  7123. \newskip\deflastargmargin \deflastargmargin=18pt
  7124. \newcount\defunpenalty
  7125. % Start the processing of @deffn:
  7126. \def\startdefun{%
  7127. \ifnum\lastpenalty<10000
  7128. \medbreak
  7129. \defunpenalty=10003 % Will keep this @deffn together with the
  7130. % following @def command, see below.
  7131. \else
  7132. % If there are two @def commands in a row, we'll have a \nobreak,
  7133. % which is there to keep the function description together with its
  7134. % header. But if there's nothing but headers, we need to allow a
  7135. % break somewhere. Check specifically for penalty 10002, inserted
  7136. % by \printdefunline, instead of 10000, since the sectioning
  7137. % commands also insert a nobreak penalty, and we don't want to allow
  7138. % a break between a section heading and a defun.
  7139. %
  7140. % As a further refinement, we avoid "club" headers by signalling
  7141. % with penalty of 10003 after the very first @deffn in the
  7142. % sequence (see above), and penalty of 10002 after any following
  7143. % @def command.
  7144. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
  7145. %
  7146. % Similarly, after a section heading, do not allow a break.
  7147. % But do insert the glue.
  7148. \medskip % preceded by discardable penalty, so not a breakpoint
  7149. \fi
  7150. %
  7151. \parindent=0in
  7152. \advance\leftskip by \defbodyindent
  7153. \exdentamount=\defbodyindent
  7154. }
  7155. \def\dodefunx#1{%
  7156. % First, check whether we are in the right environment:
  7157. \checkenv#1%
  7158. %
  7159. % As above, allow line break if we have multiple x headers in a row.
  7160. % It's not a great place, though.
  7161. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
  7162. %
  7163. % And now, it's time to reuse the body of the original defun:
  7164. \expandafter\gobbledefun#1%
  7165. }
  7166. \def\gobbledefun#1\startdefun{}
  7167. % \printdefunline \deffnheader{text}
  7168. %
  7169. \def\printdefunline#1#2{%
  7170. \begingroup
  7171. % call \deffnheader:
  7172. #1#2 \endheader
  7173. % common ending:
  7174. \interlinepenalty = 10000
  7175. \advance\rightskip by 0pt plus 1fil\relax
  7176. \endgraf
  7177. \nobreak\vskip -\parskip
  7178. \penalty\defunpenalty % signal to \startdefun and \dodefunx
  7179. % Some of the @defun-type tags do not enable magic parentheses,
  7180. % rendering the following check redundant. But we don't optimize.
  7181. \checkparencounts
  7182. \endgroup
  7183. }
  7184. \def\Edefun{\endgraf\medbreak}
  7185. % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
  7186. % the only thing remaining is to define \deffnheader.
  7187. %
  7188. \def\makedefun#1{%
  7189. \expandafter\let\csname E#1\endcsname = \Edefun
  7190. \edef\temp{\noexpand\domakedefun
  7191. \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
  7192. \temp
  7193. }
  7194. % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
  7195. %
  7196. % Define \deffn and \deffnx, without parameters.
  7197. % \deffnheader has to be defined explicitly.
  7198. %
  7199. \def\domakedefun#1#2#3{%
  7200. \envdef#1{%
  7201. \startdefun
  7202. \doingtypefnfalse % distinguish typed functions from all else
  7203. \parseargusing\activeparens{\printdefunline#3}%
  7204. }%
  7205. \def#2{\dodefunx#1}%
  7206. \def#3%
  7207. }
  7208. \newif\ifdoingtypefn % doing typed function?
  7209. \newif\ifrettypeownline % typeset return type on its own line?
  7210. % @deftypefnnewline on|off says whether the return type of typed functions
  7211. % are printed on their own line. This affects @deftypefn, @deftypefun,
  7212. % @deftypeop, and @deftypemethod.
  7213. %
  7214. \parseargdef\deftypefnnewline{%
  7215. \def\temp{#1}%
  7216. \ifx\temp\onword
  7217. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7218. = \empty
  7219. \else\ifx\temp\offword
  7220. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7221. = \relax
  7222. \else
  7223. \errhelp = \EMsimple
  7224. \errmessage{Unknown @txideftypefnnl value `\temp',
  7225. must be on|off}%
  7226. \fi\fi
  7227. }
  7228. % Untyped functions:
  7229. % @deffn category name args
  7230. \makedefun{deffn}{\deffngeneral{}}
  7231. % @deffn category class name args
  7232. \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
  7233. % \defopon {category on}class name args
  7234. \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7235. % \deffngeneral {subind}category name args
  7236. %
  7237. \def\deffngeneral#1#2 #3 #4\endheader{%
  7238. % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
  7239. \dosubind{fn}{\code{#3}}{#1}%
  7240. \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
  7241. }
  7242. % Typed functions:
  7243. % @deftypefn category type name args
  7244. \makedefun{deftypefn}{\deftypefngeneral{}}
  7245. % @deftypeop category class type name args
  7246. \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
  7247. % \deftypeopon {category on}class type name args
  7248. \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7249. % \deftypefngeneral {subind}category type name args
  7250. %
  7251. \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
  7252. \dosubind{fn}{\code{#4}}{#1}%
  7253. \doingtypefntrue
  7254. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7255. }
  7256. % Typed variables:
  7257. % @deftypevr category type var args
  7258. \makedefun{deftypevr}{\deftypecvgeneral{}}
  7259. % @deftypecv category class type var args
  7260. \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
  7261. % \deftypecvof {category of}class type var args
  7262. \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
  7263. % \deftypecvgeneral {subind}category type var args
  7264. %
  7265. \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
  7266. \dosubind{vr}{\code{#4}}{#1}%
  7267. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7268. }
  7269. % Untyped variables:
  7270. % @defvr category var args
  7271. \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
  7272. % @defcv category class var args
  7273. \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
  7274. % \defcvof {category of}class var args
  7275. \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
  7276. % Types:
  7277. % @deftp category name args
  7278. \makedefun{deftp}#1 #2 #3\endheader{%
  7279. \doind{tp}{\code{#2}}%
  7280. \defname{#1}{}{#2}\defunargs{#3\unskip}%
  7281. }
  7282. % Remaining @defun-like shortcuts:
  7283. \makedefun{defun}{\deffnheader{\putwordDeffunc} }
  7284. \makedefun{defmac}{\deffnheader{\putwordDefmac} }
  7285. \makedefun{defspec}{\deffnheader{\putwordDefspec} }
  7286. \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
  7287. \makedefun{defvar}{\defvrheader{\putwordDefvar} }
  7288. \makedefun{defopt}{\defvrheader{\putwordDefopt} }
  7289. \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
  7290. \makedefun{defmethod}{\defopon\putwordMethodon}
  7291. \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
  7292. \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
  7293. \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
  7294. % \defname, which formats the name of the @def (not the args).
  7295. % #1 is the category, such as "Function".
  7296. % #2 is the return type, if any.
  7297. % #3 is the function name.
  7298. %
  7299. % We are followed by (but not passed) the arguments, if any.
  7300. %
  7301. \def\defname#1#2#3{%
  7302. \par
  7303. % Get the values of \leftskip and \rightskip as they were outside the @def...
  7304. \advance\leftskip by -\defbodyindent
  7305. %
  7306. % Determine if we are typesetting the return type of a typed function
  7307. % on a line by itself.
  7308. \rettypeownlinefalse
  7309. \ifdoingtypefn % doing a typed function specifically?
  7310. % then check user option for putting return type on its own line:
  7311. \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
  7312. \rettypeownlinetrue
  7313. \fi
  7314. \fi
  7315. %
  7316. % How we'll format the category name. Putting it in brackets helps
  7317. % distinguish it from the body text that may end up on the next line
  7318. % just below it.
  7319. \def\temp{#1}%
  7320. \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
  7321. %
  7322. % Figure out line sizes for the paragraph shape. We'll always have at
  7323. % least two.
  7324. \tempnum = 2
  7325. %
  7326. % The first line needs space for \box0; but if \rightskip is nonzero,
  7327. % we need only space for the part of \box0 which exceeds it:
  7328. \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
  7329. %
  7330. % If doing a return type on its own line, we'll have another line.
  7331. \ifrettypeownline
  7332. \advance\tempnum by 1
  7333. \def\maybeshapeline{0in \hsize}%
  7334. \else
  7335. \def\maybeshapeline{}%
  7336. \fi
  7337. %
  7338. % The continuations:
  7339. \dimen2=\hsize \advance\dimen2 by -\defargsindent
  7340. %
  7341. % The final paragraph shape:
  7342. \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
  7343. %
  7344. % Put the category name at the right margin.
  7345. \noindent
  7346. \hbox to 0pt{%
  7347. \hfil\box0 \kern-\hsize
  7348. % \hsize has to be shortened this way:
  7349. \kern\leftskip
  7350. % Intentionally do not respect \rightskip, since we need the space.
  7351. }%
  7352. %
  7353. % Allow all lines to be underfull without complaint:
  7354. \tolerance=10000 \hbadness=10000
  7355. \exdentamount=\defbodyindent
  7356. {%
  7357. % defun fonts. We use typewriter by default (used to be bold) because:
  7358. % . we're printing identifiers, they should be in tt in principle.
  7359. % . in languages with many accents, such as Czech or French, it's
  7360. % common to leave accents off identifiers. The result looks ok in
  7361. % tt, but exceedingly strange in rm.
  7362. % . we don't want -- and --- to be treated as ligatures.
  7363. % . this still does not fix the ?` and !` ligatures, but so far no
  7364. % one has made identifiers using them :).
  7365. \df \tt
  7366. \def\temp{#2}% text of the return type
  7367. \ifx\temp\empty\else
  7368. \tclose{\temp}% typeset the return type
  7369. \ifrettypeownline
  7370. % put return type on its own line; prohibit line break following:
  7371. \hfil\vadjust{\nobreak}\break
  7372. \else
  7373. \space % type on same line, so just followed by a space
  7374. \fi
  7375. \fi % no return type
  7376. #3% output function name
  7377. }%
  7378. {\rm\enskip}% hskip 0.5 em of \tenrm
  7379. %
  7380. \boldbrax
  7381. % arguments will be output next, if any.
  7382. }
  7383. % Print arguments in slanted roman (not ttsl), inconsistently with using
  7384. % tt for the name. This is because literal text is sometimes needed in
  7385. % the argument list (groff manual), and ttsl and tt are not very
  7386. % distinguishable. Prevent hyphenation at `-' chars.
  7387. %
  7388. \def\defunargs#1{%
  7389. % use sl by default (not ttsl),
  7390. % tt for the names.
  7391. \df \sl \hyphenchar\font=0
  7392. %
  7393. % On the other hand, if an argument has two dashes (for instance), we
  7394. % want a way to get ttsl. We used to recommend @var for that, so
  7395. % leave the code in, but it's strange for @var to lead to typewriter.
  7396. % Nowadays we recommend @code, since the difference between a ttsl hyphen
  7397. % and a tt hyphen is pretty tiny. @code also disables ?` !`.
  7398. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
  7399. #1%
  7400. \sl\hyphenchar\font=45
  7401. }
  7402. % We want ()&[] to print specially on the defun line.
  7403. %
  7404. \def\activeparens{%
  7405. \catcode`\(=\active \catcode`\)=\active
  7406. \catcode`\[=\active \catcode`\]=\active
  7407. \catcode`\&=\active
  7408. }
  7409. % Make control sequences which act like normal parenthesis chars.
  7410. \let\lparen = ( \let\rparen = )
  7411. % Be sure that we always have a definition for `(', etc. For example,
  7412. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  7413. % so TeX would otherwise complain about undefined control sequence.
  7414. {
  7415. \activeparens
  7416. \global\let(=\lparen \global\let)=\rparen
  7417. \global\let[=\lbrack \global\let]=\rbrack
  7418. \global\let& = \&
  7419. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  7420. \gdef\magicamp{\let&=\amprm}
  7421. }
  7422. \newcount\parencount
  7423. % If we encounter &foo, then turn on ()-hacking afterwards
  7424. \newif\ifampseen
  7425. \def\amprm#1 {\ampseentrue{\bf\&#1 }}
  7426. \def\parenfont{%
  7427. \ifampseen
  7428. % At the first level, print parens in roman,
  7429. % otherwise use the default font.
  7430. \ifnum \parencount=1 \rm \fi
  7431. \else
  7432. % The \sf parens (in \boldbrax) actually are a little bolder than
  7433. % the contained text. This is especially needed for [ and ] .
  7434. \sf
  7435. \fi
  7436. }
  7437. \def\infirstlevel#1{%
  7438. \ifampseen
  7439. \ifnum\parencount=1
  7440. #1%
  7441. \fi
  7442. \fi
  7443. }
  7444. \def\bfafterword#1 {#1 \bf}
  7445. \def\opnr{%
  7446. \global\advance\parencount by 1
  7447. {\parenfont(}%
  7448. \infirstlevel \bfafterword
  7449. }
  7450. \def\clnr{%
  7451. {\parenfont)}%
  7452. \infirstlevel \sl
  7453. \global\advance\parencount by -1
  7454. }
  7455. \newcount\brackcount
  7456. \def\lbrb{%
  7457. \global\advance\brackcount by 1
  7458. {\bf[}%
  7459. }
  7460. \def\rbrb{%
  7461. {\bf]}%
  7462. \global\advance\brackcount by -1
  7463. }
  7464. \def\checkparencounts{%
  7465. \ifnum\parencount=0 \else \badparencount \fi
  7466. \ifnum\brackcount=0 \else \badbrackcount \fi
  7467. }
  7468. % these should not use \errmessage; the glibc manual, at least, actually
  7469. % has such constructs (when documenting function pointers).
  7470. \def\badparencount{%
  7471. \message{Warning: unbalanced parentheses in @def...}%
  7472. \global\parencount=0
  7473. }
  7474. \def\badbrackcount{%
  7475. \message{Warning: unbalanced square brackets in @def...}%
  7476. \global\brackcount=0
  7477. }
  7478. \message{macros,}
  7479. % @macro.
  7480. % To do this right we need a feature of e-TeX, \scantokens,
  7481. % which we arrange to emulate with a temporary file in ordinary TeX.
  7482. \ifx\eTeXversion\thisisundefined
  7483. \newwrite\macscribble
  7484. \def\scantokens#1{%
  7485. \toks0={#1}%
  7486. \immediate\openout\macscribble=\jobname.tmp
  7487. \immediate\write\macscribble{\the\toks0}%
  7488. \immediate\closeout\macscribble
  7489. \input \jobname.tmp
  7490. }
  7491. \fi
  7492. \let\aftermacroxxx\relax
  7493. \def\aftermacro{\aftermacroxxx}
  7494. % alias because \c means cedilla in @tex or @math
  7495. \let\texinfoc=\c
  7496. \newcount\savedcatcodeone
  7497. \newcount\savedcatcodetwo
  7498. % Used at the time of macro expansion.
  7499. % Argument is macro body with arguments substituted
  7500. \def\scanmacro#1{%
  7501. \newlinechar`\^^M
  7502. \def\xeatspaces{\eatspaces}%
  7503. %
  7504. % Temporarily undo catcode changes of \printindex. Set catcode of @ to
  7505. % 0 so that @-commands in macro expansions aren't printed literally when
  7506. % formatting an index file, where \ is used as the escape character.
  7507. \savedcatcodeone=\catcode`\@
  7508. \savedcatcodetwo=\catcode`\\
  7509. \catcode`\@=0
  7510. \catcode`\\=\active
  7511. %
  7512. % Process the macro body under the current catcode regime.
  7513. \scantokens{#1@texinfoc}\aftermacro%
  7514. %
  7515. \catcode`\@=\savedcatcodeone
  7516. \catcode`\\=\savedcatcodetwo
  7517. %
  7518. % The \texinfoc is to remove the \newlinechar added by \scantokens, and
  7519. % can be noticed by \parsearg.
  7520. % The \aftermacro allows a \comment at the end of the macro definition
  7521. % to duplicate itself past the final \newlinechar added by \scantokens:
  7522. % this is used in the definition of \group to comment out a newline. We
  7523. % don't do the same for \c to support Texinfo files with macros that ended
  7524. % with a @c, which should no longer be necessary.
  7525. % We avoid surrounding the call to \scantokens with \bgroup and \egroup
  7526. % to allow macros to open or close groups themselves.
  7527. }
  7528. % Used for copying and captions
  7529. \def\scanexp#1{%
  7530. \expandafter\scanmacro\expandafter{#1}%
  7531. }
  7532. \newcount\paramno % Count of parameters
  7533. \newtoks\macname % Macro name
  7534. \newif\ifrecursive % Is it recursive?
  7535. % List of all defined macros in the form
  7536. % \commondummyword\macro1\commondummyword\macro2...
  7537. % Currently is also contains all @aliases; the list can be split
  7538. % if there is a need.
  7539. \def\macrolist{}
  7540. % Add the macro to \macrolist
  7541. \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
  7542. \def\addtomacrolistxxx#1{%
  7543. \toks0 = \expandafter{\macrolist\commondummyword#1}%
  7544. \xdef\macrolist{\the\toks0}%
  7545. }
  7546. % Utility routines.
  7547. % This does \let #1 = #2, with \csnames; that is,
  7548. % \let \csname#1\endcsname = \csname#2\endcsname
  7549. % (except of course we have to play expansion games).
  7550. %
  7551. \def\cslet#1#2{%
  7552. \expandafter\let
  7553. \csname#1\expandafter\endcsname
  7554. \csname#2\endcsname
  7555. }
  7556. % Trim leading and trailing spaces off a string.
  7557. % Concepts from aro-bend problem 15 (see CTAN).
  7558. {\catcode`\@=11
  7559. \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  7560. \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  7561. \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  7562. \def\unbrace#1{#1}
  7563. \unbrace{\gdef\trim@@@ #1 } #2@{#1}
  7564. }
  7565. % Trim a single trailing ^^M off a string.
  7566. {\catcode`\^^M=\other \catcode`\Q=3%
  7567. \gdef\eatcr #1{\eatcra #1Q^^MQ}%
  7568. \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  7569. \gdef\eatcrb#1Q#2Q{#1}%
  7570. }
  7571. % Macro bodies are absorbed as an argument in a context where
  7572. % all characters are catcode 10, 11 or 12, except \ which is active
  7573. % (as in normal texinfo). It is necessary to change the definition of \
  7574. % to recognize macro arguments; this is the job of \mbodybackslash.
  7575. %
  7576. % Non-ASCII encodings make 8-bit characters active, so un-activate
  7577. % them to avoid their expansion. Must do this non-globally, to
  7578. % confine the change to the current group.
  7579. %
  7580. % It's necessary to have hard CRs when the macro is executed. This is
  7581. % done by making ^^M (\endlinechar) catcode 12 when reading the macro
  7582. % body, and then making it the \newlinechar in \scanmacro.
  7583. %
  7584. \def\scanctxt{% used as subroutine
  7585. \catcode`\"=\other
  7586. \catcode`\+=\other
  7587. \catcode`\<=\other
  7588. \catcode`\>=\other
  7589. \catcode`\^=\other
  7590. \catcode`\_=\other
  7591. \catcode`\|=\other
  7592. \catcode`\~=\other
  7593. \passthroughcharstrue
  7594. }
  7595. \def\scanargctxt{% used for copying and captions, not macros.
  7596. \scanctxt
  7597. \catcode`\@=\other
  7598. \catcode`\\=\other
  7599. \catcode`\^^M=\other
  7600. }
  7601. \def\macrobodyctxt{% used for @macro definitions
  7602. \scanctxt
  7603. \catcode`\ =\other
  7604. \catcode`\@=\other
  7605. \catcode`\{=\other
  7606. \catcode`\}=\other
  7607. \catcode`\^^M=\other
  7608. \usembodybackslash
  7609. }
  7610. % Used when scanning braced macro arguments. Note, however, that catcode
  7611. % changes here are ineffectual if the macro invocation was nested inside
  7612. % an argument to another Texinfo command.
  7613. \def\macroargctxt{%
  7614. \scanctxt
  7615. \catcode`\ =\active
  7616. \catcode`\^^M=\other
  7617. \catcode`\\=\active
  7618. }
  7619. \def\macrolineargctxt{% used for whole-line arguments without braces
  7620. \scanctxt
  7621. \catcode`\{=\other
  7622. \catcode`\}=\other
  7623. }
  7624. % \mbodybackslash is the definition of \ in @macro bodies.
  7625. % It maps \foo\ => \csname macarg.foo\endcsname => #N
  7626. % where N is the macro parameter number.
  7627. % We define \csname macarg.\endcsname to be \realbackslash, so
  7628. % \\ in macro replacement text gets you a backslash.
  7629. %
  7630. {\catcode`@=0 @catcode`@\=@active
  7631. @gdef@usembodybackslash{@let\=@mbodybackslash}
  7632. @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  7633. }
  7634. \expandafter\def\csname macarg.\endcsname{\realbackslash}
  7635. \def\margbackslash#1{\char`\#1 }
  7636. \def\macro{\recursivefalse\parsearg\macroxxx}
  7637. \def\rmacro{\recursivetrue\parsearg\macroxxx}
  7638. \def\macroxxx#1{%
  7639. \getargs{#1}% now \macname is the macname and \argl the arglist
  7640. \ifx\argl\empty % no arguments
  7641. \paramno=0\relax
  7642. \else
  7643. \expandafter\parsemargdef \argl;%
  7644. \if\paramno>256\relax
  7645. \ifx\eTeXversion\thisisundefined
  7646. \errhelp = \EMsimple
  7647. \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
  7648. \fi
  7649. \fi
  7650. \fi
  7651. \if1\csname ismacro.\the\macname\endcsname
  7652. \message{Warning: redefining \the\macname}%
  7653. \else
  7654. \expandafter\ifx\csname \the\macname\endcsname \relax
  7655. \else \errmessage{Macro name \the\macname\space already defined}\fi
  7656. \global\cslet{macsave.\the\macname}{\the\macname}%
  7657. \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  7658. \addtomacrolist{\the\macname}%
  7659. \fi
  7660. \begingroup \macrobodyctxt
  7661. \ifrecursive \expandafter\parsermacbody
  7662. \else \expandafter\parsemacbody
  7663. \fi}
  7664. \parseargdef\unmacro{%
  7665. \if1\csname ismacro.#1\endcsname
  7666. \global\cslet{#1}{macsave.#1}%
  7667. \global\expandafter\let \csname ismacro.#1\endcsname=0%
  7668. % Remove the macro name from \macrolist:
  7669. \begingroup
  7670. \expandafter\let\csname#1\endcsname \relax
  7671. \let\commondummyword\unmacrodo
  7672. \xdef\macrolist{\macrolist}%
  7673. \endgroup
  7674. \else
  7675. \errmessage{Macro #1 not defined}%
  7676. \fi
  7677. }
  7678. % Called by \do from \dounmacro on each macro. The idea is to omit any
  7679. % macro definitions that have been changed to \relax.
  7680. %
  7681. \def\unmacrodo#1{%
  7682. \ifx #1\relax
  7683. % remove this
  7684. \else
  7685. \noexpand\commondummyword \noexpand#1%
  7686. \fi
  7687. }
  7688. % \getargs -- Parse the arguments to a @macro line. Set \macname to
  7689. % the name of the macro, and \argl to the braced argument list.
  7690. \def\getargs#1{\getargsxxx#1{}}
  7691. \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  7692. \def\getmacname#1 #2\relax{\macname={#1}}
  7693. \def\getmacargs#1{\def\argl{#1}}
  7694. % This made use of the feature that if the last token of a
  7695. % <parameter list> is #, then the preceding argument is delimited by
  7696. % an opening brace, and that opening brace is not consumed.
  7697. % Parse the optional {params} list to @macro or @rmacro.
  7698. % Set \paramno to the number of arguments,
  7699. % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
  7700. % three-param macro.) Define \macarg.BLAH for each BLAH in the params
  7701. % list to some hook where the argument is to be expanded. If there are
  7702. % less than 10 arguments that hook is to be replaced by ##N where N
  7703. % is the position in that list, that is to say the macro arguments are to be
  7704. % defined `a la TeX in the macro body.
  7705. %
  7706. % That gets used by \mbodybackslash (above).
  7707. %
  7708. % If there are 10 or more arguments, a different technique is used: see
  7709. % \parsemmanyargdef.
  7710. %
  7711. \def\parsemargdef#1;{%
  7712. \paramno=0\def\paramlist{}%
  7713. \let\hash\relax
  7714. % \hash is redefined to `#' later to get it into definitions
  7715. \let\xeatspaces\relax
  7716. \parsemargdefxxx#1,;,%
  7717. \ifnum\paramno<10\relax\else
  7718. \paramno0\relax
  7719. \parsemmanyargdef@@#1,;,% 10 or more arguments
  7720. \fi
  7721. }
  7722. \def\parsemargdefxxx#1,{%
  7723. \if#1;\let\next=\relax
  7724. \else \let\next=\parsemargdefxxx
  7725. \advance\paramno by 1
  7726. \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  7727. {\xeatspaces{\hash\the\paramno}}%
  7728. \edef\paramlist{\paramlist\hash\the\paramno,}%
  7729. \fi\next}
  7730. % \parsemacbody, \parsermacbody
  7731. %
  7732. % Read recursive and nonrecursive macro bodies. (They're different since
  7733. % rec and nonrec macros end differently.)
  7734. %
  7735. % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
  7736. % body to be transformed.
  7737. % Set \macrobody to the body of the macro, and call \defmacro.
  7738. %
  7739. {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
  7740. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7741. {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
  7742. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7743. % Make @ a letter, so that we can make private-to-Texinfo macro names.
  7744. \edef\texiatcatcode{\the\catcode`\@}
  7745. \catcode `@=11\relax
  7746. %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
  7747. % If there are 10 or more arguments, a different technique is used, where the
  7748. % hook remains in the body, and when macro is to be expanded the body is
  7749. % processed again to replace the arguments.
  7750. %
  7751. % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
  7752. % argument N value and then \edef the body (nothing else will expand because of
  7753. % the catcode regime under which the body was input).
  7754. %
  7755. % If you compile with TeX (not eTeX), and you have macros with 10 or more
  7756. % arguments, no macro can have more than 256 arguments (else error).
  7757. %
  7758. % In case that there are 10 or more arguments we parse again the arguments
  7759. % list to set new definitions for the \macarg.BLAH macros corresponding to
  7760. % each BLAH argument. It was anyhow needed to parse already once this list
  7761. % in order to count the arguments, and as macros with at most 9 arguments
  7762. % are by far more frequent than macro with 10 or more arguments, defining
  7763. % twice the \macarg.BLAH macros does not cost too much processing power.
  7764. \def\parsemmanyargdef@@#1,{%
  7765. \if#1;\let\next=\relax
  7766. \else
  7767. \let\next=\parsemmanyargdef@@
  7768. \edef\tempb{\eatspaces{#1}}%
  7769. \expandafter\def\expandafter\tempa
  7770. \expandafter{\csname macarg.\tempb\endcsname}%
  7771. % Note that we need some extra \noexpand\noexpand, this is because we
  7772. % don't want \the to be expanded in the \parsermacbody as it uses an
  7773. % \xdef .
  7774. \expandafter\edef\tempa
  7775. {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
  7776. \advance\paramno by 1\relax
  7777. \fi\next}
  7778. \let\endargs@\relax
  7779. \let\nil@\relax
  7780. \def\nilm@{\nil@}%
  7781. \long\def\nillm@{\nil@}%
  7782. % This macro is expanded during the Texinfo macro expansion, not during its
  7783. % definition. It gets all the arguments' values and assigns them to macros
  7784. % macarg.ARGNAME
  7785. %
  7786. % #1 is the macro name
  7787. % #2 is the list of argument names
  7788. % #3 is the list of argument values
  7789. \def\getargvals@#1#2#3{%
  7790. \def\macargdeflist@{}%
  7791. \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
  7792. \def\paramlist{#2,\nil@}%
  7793. \def\macroname{#1}%
  7794. \begingroup
  7795. \macroargctxt
  7796. \def\argvaluelist{#3,\nil@}%
  7797. \def\@tempa{#3}%
  7798. \ifx\@tempa\empty
  7799. \setemptyargvalues@
  7800. \else
  7801. \getargvals@@
  7802. \fi
  7803. }
  7804. \def\getargvals@@{%
  7805. \ifx\paramlist\nilm@
  7806. % Some sanity check needed here that \argvaluelist is also empty.
  7807. \ifx\argvaluelist\nillm@
  7808. \else
  7809. \errhelp = \EMsimple
  7810. \errmessage{Too many arguments in macro `\macroname'!}%
  7811. \fi
  7812. \let\next\macargexpandinbody@
  7813. \else
  7814. \ifx\argvaluelist\nillm@
  7815. % No more arguments values passed to macro. Set remaining named-arg
  7816. % macros to empty.
  7817. \let\next\setemptyargvalues@
  7818. \else
  7819. % pop current arg name into \@tempb
  7820. \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
  7821. \expandafter\@tempa\expandafter{\paramlist}%
  7822. % pop current argument value into \@tempc
  7823. \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
  7824. \expandafter\@tempa\expandafter{\argvaluelist}%
  7825. % Here \@tempb is the current arg name and \@tempc is the current arg value.
  7826. % First place the new argument macro definition into \@tempd
  7827. \expandafter\macname\expandafter{\@tempc}%
  7828. \expandafter\let\csname macarg.\@tempb\endcsname\relax
  7829. \expandafter\def\expandafter\@tempe\expandafter{%
  7830. \csname macarg.\@tempb\endcsname}%
  7831. \edef\@tempd{\long\def\@tempe{\the\macname}}%
  7832. \push@\@tempd\macargdeflist@
  7833. \let\next\getargvals@@
  7834. \fi
  7835. \fi
  7836. \next
  7837. }
  7838. \def\push@#1#2{%
  7839. \expandafter\expandafter\expandafter\def
  7840. \expandafter\expandafter\expandafter#2%
  7841. \expandafter\expandafter\expandafter{%
  7842. \expandafter#1#2}%
  7843. }
  7844. % Replace arguments by their values in the macro body, and place the result
  7845. % in macro \@tempa.
  7846. %
  7847. \def\macvalstoargs@{%
  7848. % To do this we use the property that token registers that are \the'ed
  7849. % within an \edef expand only once. So we are going to place all argument
  7850. % values into respective token registers.
  7851. %
  7852. % First we save the token context, and initialize argument numbering.
  7853. \begingroup
  7854. \paramno0\relax
  7855. % Then, for each argument number #N, we place the corresponding argument
  7856. % value into a new token list register \toks#N
  7857. \expandafter\putargsintokens@\saveparamlist@,;,%
  7858. % Then, we expand the body so that argument are replaced by their
  7859. % values. The trick for values not to be expanded themselves is that they
  7860. % are within tokens and that tokens expand only once in an \edef .
  7861. \edef\@tempc{\csname mac.\macroname .body\endcsname}%
  7862. % Now we restore the token stack pointer to free the token list registers
  7863. % which we have used, but we make sure that expanded body is saved after
  7864. % group.
  7865. \expandafter
  7866. \endgroup
  7867. \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
  7868. }
  7869. % Define the named-macro outside of this group and then close this group.
  7870. %
  7871. \def\macargexpandinbody@{%
  7872. \expandafter
  7873. \endgroup
  7874. \macargdeflist@
  7875. % First the replace in body the macro arguments by their values, the result
  7876. % is in \@tempa .
  7877. \macvalstoargs@
  7878. % Then we point at the \norecurse or \gobble (for recursive) macro value
  7879. % with \@tempb .
  7880. \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
  7881. % Depending on whether it is recursive or not, we need some tailing
  7882. % \egroup .
  7883. \ifx\@tempb\gobble
  7884. \let\@tempc\relax
  7885. \else
  7886. \let\@tempc\egroup
  7887. \fi
  7888. % And now we do the real job:
  7889. \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
  7890. \@tempd
  7891. }
  7892. \def\putargsintokens@#1,{%
  7893. \if#1;\let\next\relax
  7894. \else
  7895. \let\next\putargsintokens@
  7896. % First we allocate the new token list register, and give it a temporary
  7897. % alias \@tempb .
  7898. \toksdef\@tempb\the\paramno
  7899. % Then we place the argument value into that token list register.
  7900. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
  7901. \expandafter\@tempb\expandafter{\@tempa}%
  7902. \advance\paramno by 1\relax
  7903. \fi
  7904. \next
  7905. }
  7906. % Trailing missing arguments are set to empty.
  7907. %
  7908. \def\setemptyargvalues@{%
  7909. \ifx\paramlist\nilm@
  7910. \let\next\macargexpandinbody@
  7911. \else
  7912. \expandafter\setemptyargvaluesparser@\paramlist\endargs@
  7913. \let\next\setemptyargvalues@
  7914. \fi
  7915. \next
  7916. }
  7917. \def\setemptyargvaluesparser@#1,#2\endargs@{%
  7918. \expandafter\def\expandafter\@tempa\expandafter{%
  7919. \expandafter\def\csname macarg.#1\endcsname{}}%
  7920. \push@\@tempa\macargdeflist@
  7921. \def\paramlist{#2}%
  7922. }
  7923. % #1 is the element target macro
  7924. % #2 is the list macro
  7925. % #3,#4\endargs@ is the list value
  7926. \def\pop@#1#2#3,#4\endargs@{%
  7927. \def#1{#3}%
  7928. \def#2{#4}%
  7929. }
  7930. \long\def\longpop@#1#2#3,#4\endargs@{%
  7931. \long\def#1{#3}%
  7932. \long\def#2{#4}%
  7933. }
  7934. %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
  7935. % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
  7936. % \macrobody has the body of the macro in it, with placeholders for
  7937. % its parameters, looking like "\xeatspaces{\hash 1}".
  7938. % \paramno is the number of parameters
  7939. % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
  7940. % There are four cases: macros of zero, one, up to nine, and many arguments.
  7941. % \xdef is used so that macro definitions will survive the file
  7942. % they're defined in: @include reads the file inside a group.
  7943. %
  7944. \def\defmacro{%
  7945. \let\hash=##% convert placeholders to macro parameter chars
  7946. \ifnum\paramno=1
  7947. \def\xeatspaces##1{##1}%
  7948. % This removes the pair of braces around the argument. We don't
  7949. % use \eatspaces, because this can cause ends of lines to be lost
  7950. % when the argument to \eatspaces is read, leading to line-based
  7951. % commands like "@itemize" not being read correctly.
  7952. \else
  7953. \let\xeatspaces\relax % suppress expansion
  7954. \fi
  7955. \ifcase\paramno
  7956. % 0
  7957. \expandafter\xdef\csname\the\macname\endcsname{%
  7958. \noexpand\scanmacro{\macrobody}}%
  7959. \or % 1
  7960. \expandafter\xdef\csname\the\macname\endcsname{%
  7961. \bgroup
  7962. \noexpand\braceorline
  7963. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7964. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7965. \egroup
  7966. \noexpand\scanmacro{\macrobody}%
  7967. }%
  7968. \else % at most 9
  7969. \ifnum\paramno<10\relax
  7970. % @MACNAME sets the context for reading the macro argument
  7971. % @MACNAME@@ gets the argument, processes backslashes and appends a
  7972. % comma.
  7973. % @MACNAME@@@ removes braces surrounding the argument list.
  7974. % @MACNAME@@@@ scans the macro body with arguments substituted.
  7975. \expandafter\xdef\csname\the\macname\endcsname{%
  7976. \bgroup
  7977. \noexpand\expandafter % This \expandafter skip any spaces after the
  7978. \noexpand\macroargctxt % macro before we change the catcode of space.
  7979. \noexpand\expandafter
  7980. \expandafter\noexpand\csname\the\macname @@\endcsname}%
  7981. \expandafter\xdef\csname\the\macname @@\endcsname##1{%
  7982. \noexpand\passargtomacro
  7983. \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
  7984. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7985. \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
  7986. \expandafter\expandafter
  7987. \expandafter\xdef
  7988. \expandafter\expandafter
  7989. \csname\the\macname @@@@\endcsname\paramlist{%
  7990. \egroup\noexpand\scanmacro{\macrobody}}%
  7991. \else % 10 or more:
  7992. \expandafter\xdef\csname\the\macname\endcsname{%
  7993. \noexpand\getargvals@{\the\macname}{\argl}%
  7994. }%
  7995. \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
  7996. \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
  7997. \fi
  7998. \fi}
  7999. \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
  8000. \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  8001. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8002. %
  8003. {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
  8004. @catcode`@_=11 % private names
  8005. @catcode`@!=11 % used as argument separator
  8006. % \passargtomacro#1#2 -
  8007. % Call #1 with a list of tokens #2, with any doubled backslashes in #2
  8008. % compressed to one.
  8009. %
  8010. % This implementation works by expansion, and not execution (so we cannot use
  8011. % \def or similar). This reduces the risk of this failing in contexts where
  8012. % complete expansion is done with no execution (for example, in writing out to
  8013. % an auxiliary file for an index entry).
  8014. %
  8015. % State is kept in the input stream: the argument passed to
  8016. % @look_ahead, @gobble_and_check_finish and @add_segment is
  8017. %
  8018. % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
  8019. %
  8020. % where:
  8021. % THE_MACRO - name of the macro we want to call
  8022. % ARG_RESULT - argument list we build to pass to that macro
  8023. % PENDING_BS - either a backslash or nothing
  8024. % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
  8025. @gdef@passargtomacro#1#2{%
  8026. @add_segment #1!{}@relax#2\@_finish\%
  8027. }
  8028. @gdef@_finish{@_finishx} @global@let@_finishx@relax
  8029. % #1 - THE_MACRO ARG_RESULT
  8030. % #2 - PENDING_BS
  8031. % #3 - NEXT_TOKEN
  8032. % #4 used to look ahead
  8033. %
  8034. % If the next token is not a backslash, process the rest of the argument;
  8035. % otherwise, remove the next token.
  8036. @gdef@look_ahead#1!#2#3#4{%
  8037. @ifx#4\%
  8038. @expandafter@gobble_and_check_finish
  8039. @else
  8040. @expandafter@add_segment
  8041. @fi#1!{#2}#4#4%
  8042. }
  8043. % #1 - THE_MACRO ARG_RESULT
  8044. % #2 - PENDING_BS
  8045. % #3 - NEXT_TOKEN
  8046. % #4 should be a backslash, which is gobbled.
  8047. % #5 looks ahead
  8048. %
  8049. % Double backslash found. Add a single backslash, and look ahead.
  8050. @gdef@gobble_and_check_finish#1!#2#3#4#5{%
  8051. @add_segment#1\!{}#5#5%
  8052. }
  8053. @gdef@is_fi{@fi}
  8054. % #1 - THE_MACRO ARG_RESULT
  8055. % #2 - PENDING_BS
  8056. % #3 - NEXT_TOKEN
  8057. % #4 is input stream until next backslash
  8058. %
  8059. % Input stream is either at the start of the argument, or just after a
  8060. % backslash sequence, either a lone backslash, or a doubled backslash.
  8061. % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
  8062. % finish; otherwise, append to ARG_RESULT the segment of the argument up until
  8063. % the next backslash. PENDING_BACKSLASH contains a backslash to represent
  8064. % a backslash just before the start of the input stream that has not been
  8065. % added to ARG_RESULT.
  8066. @gdef@add_segment#1!#2#3#4\{%
  8067. @ifx#3@_finish
  8068. @call_the_macro#1!%
  8069. @else
  8070. % append the pending backslash to the result, followed by the next segment
  8071. @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
  8072. % this @fi is discarded by @look_ahead.
  8073. % we can't get rid of it with \expandafter because we don't know how
  8074. % long #4 is.
  8075. }
  8076. % #1 - THE_MACRO
  8077. % #2 - ARG_RESULT
  8078. % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
  8079. % conditional.
  8080. @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
  8081. }
  8082. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8083. % \braceorline MAC is used for a one-argument macro MAC. It checks
  8084. % whether the next non-whitespace character is a {. It sets the context
  8085. % for reading the argument (slightly different in the two cases). Then,
  8086. % to read the argument, in the whole-line case, it then calls the regular
  8087. % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
  8088. %
  8089. \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
  8090. \def\braceorlinexxx{%
  8091. \ifx\nchar\bgroup
  8092. \macroargctxt
  8093. \expandafter\passargtomacro
  8094. \else
  8095. \macrolineargctxt\expandafter\parsearg
  8096. \fi \macnamexxx}
  8097. % @alias.
  8098. % We need some trickery to remove the optional spaces around the equal
  8099. % sign. Make them active and then expand them all to nothing.
  8100. %
  8101. \def\alias{\parseargusing\obeyspaces\aliasxxx}
  8102. \def\aliasxxx #1{\aliasyyy#1\relax}
  8103. \def\aliasyyy #1=#2\relax{%
  8104. {%
  8105. \expandafter\let\obeyedspace=\empty
  8106. \addtomacrolist{#1}%
  8107. \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
  8108. }%
  8109. \next
  8110. }
  8111. \message{cross references,}
  8112. \newwrite\auxfile
  8113. \newif\ifhavexrefs % True if xref values are known.
  8114. \newif\ifwarnedxrefs % True if we warned once that they aren't known.
  8115. % @inforef is relatively simple.
  8116. \def\inforef #1{\inforefzzz #1,,,,**}
  8117. \def\inforefzzz #1,#2,#3,#4**{%
  8118. \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  8119. node \samp{\ignorespaces#1{}}}
  8120. % @node's only job in TeX is to define \lastnode, which is used in
  8121. % cross-references. The @node line might or might not have commas, and
  8122. % might or might not have spaces before the first comma, like:
  8123. % @node foo , bar , ...
  8124. % We don't want such trailing spaces in the node name.
  8125. %
  8126. \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
  8127. %
  8128. % also remove a trailing comma, in case of something like this:
  8129. % @node Help-Cross, , , Cross-refs
  8130. \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
  8131. \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
  8132. \let\nwnode=\node
  8133. \let\lastnode=\empty
  8134. % Write a cross-reference definition for the current node. #1 is the
  8135. % type (Ynumbered, Yappendix, Ynothing).
  8136. %
  8137. \def\donoderef#1{%
  8138. \ifx\lastnode\empty\else
  8139. \setref{\lastnode}{#1}%
  8140. \global\let\lastnode=\empty
  8141. \fi
  8142. }
  8143. % @anchor{NAME} -- define xref target at arbitrary point.
  8144. %
  8145. \newcount\savesfregister
  8146. %
  8147. \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
  8148. \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
  8149. \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
  8150. % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
  8151. % anchor), which consists of three parts:
  8152. % 1) NAME-title - the current sectioning name taken from \lastsection,
  8153. % or the anchor name.
  8154. % 2) NAME-snt - section number and type, passed as the SNT arg, or
  8155. % empty for anchors.
  8156. % 3) NAME-pg - the page number.
  8157. %
  8158. % This is called from \donoderef, \anchor, and \dofloat. In the case of
  8159. % floats, there is an additional part, which is not written here:
  8160. % 4) NAME-lof - the text as it should appear in a @listoffloats.
  8161. %
  8162. \def\setref#1#2{%
  8163. \pdfmkdest{#1}%
  8164. \iflinks
  8165. {%
  8166. \requireauxfile
  8167. \atdummies % preserve commands, but don't expand them
  8168. % match definition in \xrdef, \refx, \xrefX.
  8169. \def\value##1{##1}%
  8170. \edef\writexrdef##1##2{%
  8171. \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
  8172. ##1}{##2}}% these are parameters of \writexrdef
  8173. }%
  8174. \toks0 = \expandafter{\lastsection}%
  8175. \immediate \writexrdef{title}{\the\toks0 }%
  8176. \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
  8177. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
  8178. }%
  8179. \fi
  8180. }
  8181. % @xrefautosectiontitle on|off says whether @section(ing) names are used
  8182. % automatically in xrefs, if the third arg is not explicitly specified.
  8183. % This was provided as a "secret" @set xref-automatic-section-title
  8184. % variable, now it's official.
  8185. %
  8186. \parseargdef\xrefautomaticsectiontitle{%
  8187. \def\temp{#1}%
  8188. \ifx\temp\onword
  8189. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8190. = \empty
  8191. \else\ifx\temp\offword
  8192. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8193. = \relax
  8194. \else
  8195. \errhelp = \EMsimple
  8196. \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
  8197. must be on|off}%
  8198. \fi\fi
  8199. }
  8200. %
  8201. % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
  8202. % the node name, #2 the name of the Info cross-reference, #3 the printed
  8203. % node name, #4 the name of the Info file, #5 the name of the printed
  8204. % manual. All but the node name can be omitted.
  8205. %
  8206. \def\pxref{\putwordsee{} \xrefXX}
  8207. \def\xref{\putwordSee{} \xrefXX}
  8208. \def\ref{\xrefXX}
  8209. \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
  8210. \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
  8211. %
  8212. \newbox\toprefbox
  8213. \newbox\printedrefnamebox
  8214. \newbox\infofilenamebox
  8215. \newbox\printedmanualbox
  8216. %
  8217. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  8218. \unsepspaces
  8219. %
  8220. % Get args without leading/trailing spaces.
  8221. \def\printedrefname{\ignorespaces #3}%
  8222. \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
  8223. %
  8224. \def\infofilename{\ignorespaces #4}%
  8225. \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
  8226. %
  8227. \def\printedmanual{\ignorespaces #5}%
  8228. \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
  8229. %
  8230. % If the printed reference name (arg #3) was not explicitly given in
  8231. % the @xref, figure out what we want to use.
  8232. \ifdim \wd\printedrefnamebox = 0pt
  8233. % No printed node name was explicitly given.
  8234. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
  8235. % Not auto section-title: use node name inside the square brackets.
  8236. \def\printedrefname{\ignorespaces #1}%
  8237. \else
  8238. % Auto section-title: use chapter/section title inside
  8239. % the square brackets if we have it.
  8240. \ifdim \wd\printedmanualbox > 0pt
  8241. % It is in another manual, so we don't have it; use node name.
  8242. \def\printedrefname{\ignorespaces #1}%
  8243. \else
  8244. \ifhavexrefs
  8245. % We (should) know the real title if we have the xref values.
  8246. \def\printedrefname{\refx{#1-title}{}}%
  8247. \else
  8248. % Otherwise just copy the Info node name.
  8249. \def\printedrefname{\ignorespaces #1}%
  8250. \fi%
  8251. \fi
  8252. \fi
  8253. \fi
  8254. %
  8255. % Make link in pdf output.
  8256. \ifpdf
  8257. % For pdfTeX and LuaTeX
  8258. {\indexnofonts
  8259. \makevalueexpandable
  8260. \turnoffactive
  8261. % This expands tokens, so do it after making catcode changes, so _
  8262. % etc. don't get their TeX definitions. This ignores all spaces in
  8263. % #4, including (wrongly) those in the middle of the filename.
  8264. \getfilename{#4}%
  8265. %
  8266. % This (wrongly) does not take account of leading or trailing
  8267. % spaces in #1, which should be ignored.
  8268. \setpdfdestname{#1}%
  8269. %
  8270. \ifx\pdfdestname\empty
  8271. \def\pdfdestname{Top}% no empty targets
  8272. \fi
  8273. %
  8274. \leavevmode
  8275. \startlink attr{/Border [0 0 0]}%
  8276. \ifnum\filenamelength>0
  8277. goto file{\the\filename.pdf} name{\pdfdestname}%
  8278. \else
  8279. goto name{\pdfmkpgn{\pdfdestname}}%
  8280. \fi
  8281. }%
  8282. \setcolor{\linkcolor}%
  8283. \else
  8284. \ifx\XeTeXrevision\thisisundefined
  8285. \else
  8286. % For XeTeX
  8287. {\indexnofonts
  8288. \makevalueexpandable
  8289. \turnoffactive
  8290. % This expands tokens, so do it after making catcode changes, so _
  8291. % etc. don't get their TeX definitions. This ignores all spaces in
  8292. % #4, including (wrongly) those in the middle of the filename.
  8293. \getfilename{#4}%
  8294. %
  8295. % This (wrongly) does not take account of leading or trailing
  8296. % spaces in #1, which should be ignored.
  8297. \setpdfdestname{#1}%
  8298. %
  8299. \ifx\pdfdestname\empty
  8300. \def\pdfdestname{Top}% no empty targets
  8301. \fi
  8302. %
  8303. \leavevmode
  8304. \ifnum\filenamelength>0
  8305. % With default settings,
  8306. % XeTeX (xdvipdfmx) replaces link destination names with integers.
  8307. % In this case, the replaced destination names of
  8308. % remote PDFs are no longer known. In order to avoid a replacement,
  8309. % you can use xdvipdfmx's command line option `-C 0x0010'.
  8310. % If you use XeTeX 0.99996+ (TeX Live 2016+),
  8311. % this command line option is no longer necessary
  8312. % because we can use the `dvipdfmx:config' special.
  8313. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8314. << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
  8315. \else
  8316. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8317. << /S /GoTo /D (\pdfdestname) >> >>}%
  8318. \fi
  8319. }%
  8320. \setcolor{\linkcolor}%
  8321. \fi
  8322. \fi
  8323. {%
  8324. % Have to otherify everything special to allow the \csname to
  8325. % include an _ in the xref name, etc.
  8326. \indexnofonts
  8327. \turnoffactive
  8328. \def\value##1{##1}%
  8329. \expandafter\global\expandafter\let\expandafter\Xthisreftitle
  8330. \csname XR#1-title\endcsname
  8331. }%
  8332. %
  8333. % Float references are printed completely differently: "Figure 1.2"
  8334. % instead of "[somenode], p.3". \iffloat distinguishes them by
  8335. % \Xthisreftitle being set to a magic string.
  8336. \iffloat\Xthisreftitle
  8337. % If the user specified the print name (third arg) to the ref,
  8338. % print it instead of our usual "Figure 1.2".
  8339. \ifdim\wd\printedrefnamebox = 0pt
  8340. \refx{#1-snt}{}%
  8341. \else
  8342. \printedrefname
  8343. \fi
  8344. %
  8345. % If the user also gave the printed manual name (fifth arg), append
  8346. % "in MANUALNAME".
  8347. \ifdim \wd\printedmanualbox > 0pt
  8348. \space \putwordin{} \cite{\printedmanual}%
  8349. \fi
  8350. \else
  8351. % node/anchor (non-float) references.
  8352. %
  8353. % If we use \unhbox to print the node names, TeX does not insert
  8354. % empty discretionaries after hyphens, which means that it will not
  8355. % find a line break at a hyphen in a node names. Since some manuals
  8356. % are best written with fairly long node names, containing hyphens,
  8357. % this is a loss. Therefore, we give the text of the node name
  8358. % again, so it is as if TeX is seeing it for the first time.
  8359. %
  8360. \ifdim \wd\printedmanualbox > 0pt
  8361. % Cross-manual reference with a printed manual name.
  8362. %
  8363. \crossmanualxref{\cite{\printedmanual\unskip}}%
  8364. %
  8365. \else\ifdim \wd\infofilenamebox > 0pt
  8366. % Cross-manual reference with only an info filename (arg 4), no
  8367. % printed manual name (arg 5). This is essentially the same as
  8368. % the case above; we output the filename, since we have nothing else.
  8369. %
  8370. \crossmanualxref{\code{\infofilename\unskip}}%
  8371. %
  8372. \else
  8373. % Reference within this manual.
  8374. %
  8375. % _ (for example) has to be the character _ for the purposes of the
  8376. % control sequence corresponding to the node, but it has to expand
  8377. % into the usual \leavevmode...\vrule stuff for purposes of
  8378. % printing. So we \turnoffactive for the \refx-snt, back on for the
  8379. % printing, back off for the \refx-pg.
  8380. {\turnoffactive
  8381. % Only output a following space if the -snt ref is nonempty; for
  8382. % @unnumbered and @anchor, it won't be.
  8383. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  8384. \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  8385. }%
  8386. % output the `[mynode]' via the macro below so it can be overridden.
  8387. \xrefprintnodename\printedrefname
  8388. %
  8389. % But we always want a comma and a space:
  8390. ,\space
  8391. %
  8392. % output the `page 3'.
  8393. \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
  8394. % Add a , if xref followed by a space
  8395. \if\space\noexpand\tokenafterxref ,%
  8396. \else\ifx\ \tokenafterxref ,% @TAB
  8397. \else\ifx\*\tokenafterxref ,% @*
  8398. \else\ifx\ \tokenafterxref ,% @SPACE
  8399. \else\ifx\
  8400. \tokenafterxref ,% @NL
  8401. \else\ifx\tie\tokenafterxref ,% @tie
  8402. \fi\fi\fi\fi\fi\fi
  8403. \fi\fi
  8404. \fi
  8405. \endlink
  8406. \endgroup}
  8407. % Output a cross-manual xref to #1. Used just above (twice).
  8408. %
  8409. % Only include the text "Section ``foo'' in" if the foo is neither
  8410. % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
  8411. % "see The Foo Manual", the idea being to refer to the whole manual.
  8412. %
  8413. % But, this being TeX, we can't easily compare our node name against the
  8414. % string "Top" while ignoring the possible spaces before and after in
  8415. % the input. By adding the arbitrary 7sp below, we make it much less
  8416. % likely that a real node name would have the same width as "Top" (e.g.,
  8417. % in a monospaced font). Hopefully it will never happen in practice.
  8418. %
  8419. % For the same basic reason, we retypeset the "Top" at every
  8420. % reference, since the current font is indeterminate.
  8421. %
  8422. \def\crossmanualxref#1{%
  8423. \setbox\toprefbox = \hbox{Top\kern7sp}%
  8424. \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
  8425. \ifdim \wd2 > 7sp % nonempty?
  8426. \ifdim \wd2 = \wd\toprefbox \else % same as Top?
  8427. \putwordSection{} ``\printedrefname'' \putwordin{}\space
  8428. \fi
  8429. \fi
  8430. #1%
  8431. }
  8432. % This macro is called from \xrefX for the `[nodename]' part of xref
  8433. % output. It's a separate macro only so it can be changed more easily,
  8434. % since square brackets don't work well in some documents. Particularly
  8435. % one that Bob is working on :).
  8436. %
  8437. \def\xrefprintnodename#1{[#1]}
  8438. % Things referred to by \setref.
  8439. %
  8440. \def\Ynothing{}
  8441. \def\Yomitfromtoc{}
  8442. \def\Ynumbered{%
  8443. \ifnum\secno=0
  8444. \putwordChapter@tie \the\chapno
  8445. \else \ifnum\subsecno=0
  8446. \putwordSection@tie \the\chapno.\the\secno
  8447. \else \ifnum\subsubsecno=0
  8448. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  8449. \else
  8450. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  8451. \fi\fi\fi
  8452. }
  8453. \def\Yappendix{%
  8454. \ifnum\secno=0
  8455. \putwordAppendix@tie @char\the\appendixno{}%
  8456. \else \ifnum\subsecno=0
  8457. \putwordSection@tie @char\the\appendixno.\the\secno
  8458. \else \ifnum\subsubsecno=0
  8459. \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  8460. \else
  8461. \putwordSection@tie
  8462. @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  8463. \fi\fi\fi
  8464. }
  8465. % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
  8466. % is output afterwards if non-empty.
  8467. \def\refx#1#2{%
  8468. \requireauxfile
  8469. {%
  8470. \indexnofonts
  8471. \otherbackslash
  8472. \def\value##1{##1}%
  8473. \expandafter\global\expandafter\let\expandafter\thisrefX
  8474. \csname XR#1\endcsname
  8475. }%
  8476. \ifx\thisrefX\relax
  8477. % If not defined, say something at least.
  8478. \angleleft un\-de\-fined\angleright
  8479. \iflinks
  8480. \ifhavexrefs
  8481. {\toks0 = {#1}% avoid expansion of possibly-complex value
  8482. \message{\linenumber Undefined cross reference `\the\toks0'.}}%
  8483. \else
  8484. \ifwarnedxrefs\else
  8485. \global\warnedxrefstrue
  8486. \message{Cross reference values unknown; you must run TeX again.}%
  8487. \fi
  8488. \fi
  8489. \fi
  8490. \else
  8491. % It's defined, so just use it.
  8492. \thisrefX
  8493. \fi
  8494. #2% Output the suffix in any case.
  8495. }
  8496. % This is the macro invoked by entries in the aux file. Define a control
  8497. % sequence for a cross-reference target (we prepend XR to the control sequence
  8498. % name to avoid collisions). The value is the page number. If this is a float
  8499. % type, we have more work to do.
  8500. %
  8501. \def\xrdef#1#2{%
  8502. {% Expand the node or anchor name to remove control sequences.
  8503. % \turnoffactive stops 8-bit characters being changed to commands
  8504. % like @'e. \refx does the same to retrieve the value in the definition.
  8505. \indexnofonts
  8506. \turnoffactive
  8507. \def\value##1{##1}%
  8508. \xdef\safexrefname{#1}%
  8509. }%
  8510. %
  8511. \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
  8512. %
  8513. % Was that xref control sequence that we just defined for a float?
  8514. \expandafter\iffloat\csname XR\safexrefname\endcsname
  8515. % it was a float, and we have the (safe) float type in \iffloattype.
  8516. \expandafter\let\expandafter\floatlist
  8517. \csname floatlist\iffloattype\endcsname
  8518. %
  8519. % Is this the first time we've seen this float type?
  8520. \expandafter\ifx\floatlist\relax
  8521. \toks0 = {\do}% yes, so just \do
  8522. \else
  8523. % had it before, so preserve previous elements in list.
  8524. \toks0 = \expandafter{\floatlist\do}%
  8525. \fi
  8526. %
  8527. % Remember this xref in the control sequence \floatlistFLOATTYPE,
  8528. % for later use in \listoffloats.
  8529. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
  8530. {\safexrefname}}%
  8531. \fi
  8532. }
  8533. % If working on a large document in chapters, it is convenient to
  8534. % be able to disable indexing, cross-referencing, and contents, for test runs.
  8535. % This is done with @novalidate at the beginning of the file.
  8536. %
  8537. \newif\iflinks \linkstrue % by default we want the aux files.
  8538. \let\novalidate = \linksfalse
  8539. % Used when writing to the aux file, or when using data from it.
  8540. \def\requireauxfile{%
  8541. \iflinks
  8542. \tryauxfile
  8543. % Open the new aux file. TeX will close it automatically at exit.
  8544. \immediate\openout\auxfile=\jobname.aux
  8545. \fi
  8546. \global\let\requireauxfile=\relax % Only do this once.
  8547. }
  8548. % Read the last existing aux file, if any. No error if none exists.
  8549. %
  8550. \def\tryauxfile{%
  8551. \openin 1 \jobname.aux
  8552. \ifeof 1 \else
  8553. \readdatafile{aux}%
  8554. \global\havexrefstrue
  8555. \fi
  8556. \closein 1
  8557. }
  8558. \def\setupdatafile{%
  8559. \catcode`\^^@=\other
  8560. \catcode`\^^A=\other
  8561. \catcode`\^^B=\other
  8562. \catcode`\^^C=\other
  8563. \catcode`\^^D=\other
  8564. \catcode`\^^E=\other
  8565. \catcode`\^^F=\other
  8566. \catcode`\^^G=\other
  8567. \catcode`\^^H=\other
  8568. \catcode`\^^K=\other
  8569. \catcode`\^^L=\other
  8570. \catcode`\^^N=\other
  8571. \catcode`\^^P=\other
  8572. \catcode`\^^Q=\other
  8573. \catcode`\^^R=\other
  8574. \catcode`\^^S=\other
  8575. \catcode`\^^T=\other
  8576. \catcode`\^^U=\other
  8577. \catcode`\^^V=\other
  8578. \catcode`\^^W=\other
  8579. \catcode`\^^X=\other
  8580. \catcode`\^^Z=\other
  8581. \catcode`\^^[=\other
  8582. \catcode`\^^\=\other
  8583. \catcode`\^^]=\other
  8584. \catcode`\^^^=\other
  8585. \catcode`\^^_=\other
  8586. % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  8587. % in xref tags, i.e., node names. But since ^^e4 notation isn't
  8588. % supported in the main text, it doesn't seem desirable. Furthermore,
  8589. % that is not enough: for node names that actually contain a ^
  8590. % character, we would end up writing a line like this: 'xrdef {'hat
  8591. % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  8592. % argument, and \hat is not an expandable control sequence. It could
  8593. % all be worked out, but why? Either we support ^^ or we don't.
  8594. %
  8595. % The other change necessary for this was to define \auxhat:
  8596. % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  8597. % and then to call \auxhat in \setq.
  8598. %
  8599. \catcode`\^=\other
  8600. %
  8601. % Special characters. Should be turned off anyway, but...
  8602. \catcode`\~=\other
  8603. \catcode`\[=\other
  8604. \catcode`\]=\other
  8605. \catcode`\"=\other
  8606. \catcode`\_=\other
  8607. \catcode`\|=\other
  8608. \catcode`\<=\other
  8609. \catcode`\>=\other
  8610. \catcode`\$=\other
  8611. \catcode`\#=\other
  8612. \catcode`\&=\other
  8613. \catcode`\%=\other
  8614. \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  8615. %
  8616. % This is to support \ in node names and titles, since the \
  8617. % characters end up in a \csname. It's easier than
  8618. % leaving it active and making its active definition an actual \
  8619. % character. What I don't understand is why it works in the *value*
  8620. % of the xrdef. Seems like it should be a catcode12 \, and that
  8621. % should not typeset properly. But it works, so I'm moving on for
  8622. % now. --karl, 15jan04.
  8623. \catcode`\\=\other
  8624. %
  8625. % @ is our escape character in .aux files, and we need braces.
  8626. \catcode`\{=1
  8627. \catcode`\}=2
  8628. \catcode`\@=0
  8629. }
  8630. \def\readdatafile#1{%
  8631. \begingroup
  8632. \setupdatafile
  8633. \input\jobname.#1
  8634. \endgroup}
  8635. \message{insertions,}
  8636. % including footnotes.
  8637. \newcount \footnoteno
  8638. % The trailing space in the following definition for supereject is
  8639. % vital for proper filling; pages come out unaligned when you do a
  8640. % pagealignmacro call if that space before the closing brace is
  8641. % removed. (Generally, numeric constants should always be followed by a
  8642. % space to prevent strange expansion errors.)
  8643. \def\supereject{\par\penalty -20000\footnoteno =0 }
  8644. % @footnotestyle is meaningful for Info output only.
  8645. \let\footnotestyle=\comment
  8646. {\catcode `\@=11
  8647. %
  8648. % Auto-number footnotes. Otherwise like plain.
  8649. \gdef\footnote{%
  8650. \global\advance\footnoteno by \@ne
  8651. \edef\thisfootno{$^{\the\footnoteno}$}%
  8652. %
  8653. % In case the footnote comes at the end of a sentence, preserve the
  8654. % extra spacing after we do the footnote number.
  8655. \let\@sf\empty
  8656. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
  8657. %
  8658. % Remove inadvertent blank space before typesetting the footnote number.
  8659. \unskip
  8660. \thisfootno\@sf
  8661. \dofootnote
  8662. }%
  8663. % Don't bother with the trickery in plain.tex to not require the
  8664. % footnote text as a parameter. Our footnotes don't need to be so general.
  8665. %
  8666. % Oh yes, they do; otherwise, @ifset (and anything else that uses
  8667. % \parseargline) fails inside footnotes because the tokens are fixed when
  8668. % the footnote is read. --karl, 16nov96.
  8669. %
  8670. \gdef\dofootnote{%
  8671. \insert\footins\bgroup
  8672. %
  8673. % Nested footnotes are not supported in TeX, that would take a lot
  8674. % more work. (\startsavinginserts does not suffice.)
  8675. \let\footnote=\errfootnotenest
  8676. %
  8677. % We want to typeset this text as a normal paragraph, even if the
  8678. % footnote reference occurs in (for example) a display environment.
  8679. % So reset some parameters.
  8680. \hsize=\txipagewidth
  8681. \interlinepenalty\interfootnotelinepenalty
  8682. \splittopskip\ht\strutbox % top baseline for broken footnotes
  8683. \splitmaxdepth\dp\strutbox
  8684. \floatingpenalty\@MM
  8685. \leftskip\z@skip
  8686. \rightskip\z@skip
  8687. \spaceskip\z@skip
  8688. \xspaceskip\z@skip
  8689. \parindent\defaultparindent
  8690. %
  8691. \smallfonts \rm
  8692. %
  8693. % Because we use hanging indentation in footnotes, a @noindent appears
  8694. % to exdent this text, so make it be a no-op. makeinfo does not use
  8695. % hanging indentation so @noindent can still be needed within footnote
  8696. % text after an @example or the like (not that this is good style).
  8697. \let\noindent = \relax
  8698. %
  8699. % Hang the footnote text off the number. Use \everypar in case the
  8700. % footnote extends for more than one paragraph.
  8701. \everypar = {\hang}%
  8702. \textindent{\thisfootno}%
  8703. %
  8704. % Don't crash into the line above the footnote text. Since this
  8705. % expands into a box, it must come within the paragraph, lest it
  8706. % provide a place where TeX can split the footnote.
  8707. \footstrut
  8708. %
  8709. % Invoke rest of plain TeX footnote routine.
  8710. \futurelet\next\fo@t
  8711. }
  8712. }%end \catcode `\@=11
  8713. \def\errfootnotenest{%
  8714. \errhelp=\EMsimple
  8715. \errmessage{Nested footnotes not supported in texinfo.tex,
  8716. even though they work in makeinfo; sorry}
  8717. }
  8718. \def\errfootnoteheading{%
  8719. \errhelp=\EMsimple
  8720. \errmessage{Footnotes in chapters, sections, etc., are not supported}
  8721. }
  8722. % In case a @footnote appears in a vbox, save the footnote text and create
  8723. % the real \insert just after the vbox finished. Otherwise, the insertion
  8724. % would be lost.
  8725. % Similarly, if a @footnote appears inside an alignment, save the footnote
  8726. % text to a box and make the \insert when a row of the table is finished.
  8727. % And the same can be done for other insert classes. --kasal, 16nov03.
  8728. %
  8729. % Replace the \insert primitive by a cheating macro.
  8730. % Deeper inside, just make sure that the saved insertions are not spilled
  8731. % out prematurely.
  8732. %
  8733. \def\startsavinginserts{%
  8734. \ifx \insert\ptexinsert
  8735. \let\insert\saveinsert
  8736. \else
  8737. \let\checkinserts\relax
  8738. \fi
  8739. }
  8740. % This \insert replacement works for both \insert\footins{foo} and
  8741. % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
  8742. %
  8743. \def\saveinsert#1{%
  8744. \edef\next{\noexpand\savetobox \makeSAVEname#1}%
  8745. \afterassignment\next
  8746. % swallow the left brace
  8747. \let\temp =
  8748. }
  8749. \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
  8750. \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
  8751. \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
  8752. \def\placesaveins#1{%
  8753. \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
  8754. {\box#1}%
  8755. }
  8756. % eat @SAVE -- beware, all of them have catcode \other:
  8757. {
  8758. \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
  8759. \gdef\gobblesave @SAVE{}
  8760. }
  8761. % initialization:
  8762. \def\newsaveins #1{%
  8763. \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
  8764. \next
  8765. }
  8766. \def\newsaveinsX #1{%
  8767. \csname newbox\endcsname #1%
  8768. \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
  8769. \checksaveins #1}%
  8770. }
  8771. % initialize:
  8772. \let\checkinserts\empty
  8773. \newsaveins\footins
  8774. \newsaveins\margin
  8775. % @image. We use the macros from epsf.tex to support this.
  8776. % If epsf.tex is not installed and @image is used, we complain.
  8777. %
  8778. % Check for and read epsf.tex up front. If we read it only at @image
  8779. % time, we might be inside a group, and then its definitions would get
  8780. % undone and the next image would fail.
  8781. \openin 1 = epsf.tex
  8782. \ifeof 1 \else
  8783. % Do not bother showing banner with epsf.tex v2.7k (available in
  8784. % doc/epsf.tex and on ctan).
  8785. \def\epsfannounce{\toks0 = }%
  8786. \input epsf.tex
  8787. \fi
  8788. \closein 1
  8789. %
  8790. % We will only complain once about lack of epsf.tex.
  8791. \newif\ifwarnednoepsf
  8792. \newhelp\noepsfhelp{epsf.tex must be installed for images to
  8793. work. It is also included in the Texinfo distribution, or you can get
  8794. it from ftp://tug.org/tex/epsf.tex.}
  8795. %
  8796. \def\image#1{%
  8797. \ifx\epsfbox\thisisundefined
  8798. \ifwarnednoepsf \else
  8799. \errhelp = \noepsfhelp
  8800. \errmessage{epsf.tex not found, images will be ignored}%
  8801. \global\warnednoepsftrue
  8802. \fi
  8803. \else
  8804. \imagexxx #1,,,,,\finish
  8805. \fi
  8806. }
  8807. %
  8808. % Arguments to @image:
  8809. % #1 is (mandatory) image filename; we tack on .eps extension.
  8810. % #2 is (optional) width, #3 is (optional) height.
  8811. % #4 is (ignored optional) html alt text.
  8812. % #5 is (ignored optional) extension.
  8813. % #6 is just the usual extra ignored arg for parsing stuff.
  8814. \newif\ifimagevmode
  8815. \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  8816. \catcode`\^^M = 5 % in case we're inside an example
  8817. \normalturnoffactive % allow _ et al. in names
  8818. \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
  8819. % If the image is by itself, center it.
  8820. \ifvmode
  8821. \imagevmodetrue
  8822. \else \ifx\centersub\centerV
  8823. % for @center @image, we need a vbox so we can have our vertical space
  8824. \imagevmodetrue
  8825. \vbox\bgroup % vbox has better behavior than vtop herev
  8826. \fi\fi
  8827. %
  8828. \ifimagevmode
  8829. \nobreak\medskip
  8830. % Usually we'll have text after the image which will insert
  8831. % \parskip glue, so insert it here too to equalize the space
  8832. % above and below.
  8833. \nobreak\vskip\parskip
  8834. \nobreak
  8835. \fi
  8836. %
  8837. % Leave vertical mode so that indentation from an enclosing
  8838. % environment such as @quotation is respected.
  8839. % However, if we're at the top level, we don't want the
  8840. % normal paragraph indentation.
  8841. % On the other hand, if we are in the case of @center @image, we don't
  8842. % want to start a paragraph, which will create a hsize-width box and
  8843. % eradicate the centering.
  8844. \ifx\centersub\centerV\else \noindent \fi
  8845. %
  8846. % Output the image.
  8847. \ifpdf
  8848. % For pdfTeX and LuaTeX <= 0.80
  8849. \dopdfimage{#1}{#2}{#3}%
  8850. \else
  8851. \ifx\XeTeXrevision\thisisundefined
  8852. % For epsf.tex
  8853. % \epsfbox itself resets \epsf?size at each figure.
  8854. \setbox0 = \hbox{\ignorespaces #2}%
  8855. \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  8856. \setbox0 = \hbox{\ignorespaces #3}%
  8857. \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  8858. \epsfbox{#1.eps}%
  8859. \else
  8860. % For XeTeX
  8861. \doxeteximage{#1}{#2}{#3}%
  8862. \fi
  8863. \fi
  8864. %
  8865. \ifimagevmode
  8866. \medskip % space after a standalone image
  8867. \fi
  8868. \ifx\centersub\centerV \egroup \fi
  8869. \endgroup}
  8870. % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
  8871. % etc. We don't actually implement floating yet, we always include the
  8872. % float "here". But it seemed the best name for the future.
  8873. %
  8874. \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
  8875. % There may be a space before second and/or third parameter; delete it.
  8876. \def\eatcommaspace#1, {#1,}
  8877. % #1 is the optional FLOATTYPE, the text label for this float, typically
  8878. % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
  8879. % this float will not be numbered and cannot be referred to.
  8880. %
  8881. % #2 is the optional xref label. Also must be present for the float to
  8882. % be referable.
  8883. %
  8884. % #3 is the optional positioning argument; for now, it is ignored. It
  8885. % will somehow specify the positions allowed to float to (here, top, bottom).
  8886. %
  8887. % We keep a separate counter for each FLOATTYPE, which we reset at each
  8888. % chapter-level command.
  8889. \let\resetallfloatnos=\empty
  8890. %
  8891. \def\dofloat#1,#2,#3,#4\finish{%
  8892. \let\thiscaption=\empty
  8893. \let\thisshortcaption=\empty
  8894. %
  8895. % don't lose footnotes inside @float.
  8896. %
  8897. % BEWARE: when the floats start float, we have to issue warning whenever an
  8898. % insert appears inside a float which could possibly float. --kasal, 26may04
  8899. %
  8900. \startsavinginserts
  8901. %
  8902. % We can't be used inside a paragraph.
  8903. \par
  8904. %
  8905. \vtop\bgroup
  8906. \def\floattype{#1}%
  8907. \def\floatlabel{#2}%
  8908. \def\floatloc{#3}% we do nothing with this yet.
  8909. %
  8910. \ifx\floattype\empty
  8911. \let\safefloattype=\empty
  8912. \else
  8913. {%
  8914. % the floattype might have accents or other special characters,
  8915. % but we need to use it in a control sequence name.
  8916. \indexnofonts
  8917. \turnoffactive
  8918. \xdef\safefloattype{\floattype}%
  8919. }%
  8920. \fi
  8921. %
  8922. % If label is given but no type, we handle that as the empty type.
  8923. \ifx\floatlabel\empty \else
  8924. % We want each FLOATTYPE to be numbered separately (Figure 1,
  8925. % Table 1, Figure 2, ...). (And if no label, no number.)
  8926. %
  8927. \expandafter\getfloatno\csname\safefloattype floatno\endcsname
  8928. \global\advance\floatno by 1
  8929. %
  8930. {%
  8931. % This magic value for \lastsection is output by \setref as the
  8932. % XREFLABEL-title value. \xrefX uses it to distinguish float
  8933. % labels (which have a completely different output format) from
  8934. % node and anchor labels. And \xrdef uses it to construct the
  8935. % lists of floats.
  8936. %
  8937. \edef\lastsection{\floatmagic=\safefloattype}%
  8938. \setref{\floatlabel}{Yfloat}%
  8939. }%
  8940. \fi
  8941. %
  8942. % start with \parskip glue, I guess.
  8943. \vskip\parskip
  8944. %
  8945. % Don't suppress indentation if a float happens to start a section.
  8946. \restorefirstparagraphindent
  8947. }
  8948. % we have these possibilities:
  8949. % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
  8950. % @float Foo,lbl & no caption: Foo 1.1
  8951. % @float Foo & @caption{Cap}: Foo: Cap
  8952. % @float Foo & no caption: Foo
  8953. % @float ,lbl & Caption{Cap}: 1.1: Cap
  8954. % @float ,lbl & no caption: 1.1
  8955. % @float & @caption{Cap}: Cap
  8956. % @float & no caption:
  8957. %
  8958. \def\Efloat{%
  8959. \let\floatident = \empty
  8960. %
  8961. % In all cases, if we have a float type, it comes first.
  8962. \ifx\floattype\empty \else \def\floatident{\floattype}\fi
  8963. %
  8964. % If we have an xref label, the number comes next.
  8965. \ifx\floatlabel\empty \else
  8966. \ifx\floattype\empty \else % if also had float type, need tie first.
  8967. \appendtomacro\floatident{\tie}%
  8968. \fi
  8969. % the number.
  8970. \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
  8971. \fi
  8972. %
  8973. % Start the printed caption with what we've constructed in
  8974. % \floatident, but keep it separate; we need \floatident again.
  8975. \let\captionline = \floatident
  8976. %
  8977. \ifx\thiscaption\empty \else
  8978. \ifx\floatident\empty \else
  8979. \appendtomacro\captionline{: }% had ident, so need a colon between
  8980. \fi
  8981. %
  8982. % caption text.
  8983. \appendtomacro\captionline{\scanexp\thiscaption}%
  8984. \fi
  8985. %
  8986. % If we have anything to print, print it, with space before.
  8987. % Eventually this needs to become an \insert.
  8988. \ifx\captionline\empty \else
  8989. \vskip.5\parskip
  8990. \captionline
  8991. %
  8992. % Space below caption.
  8993. \vskip\parskip
  8994. \fi
  8995. %
  8996. % If have an xref label, write the list of floats info. Do this
  8997. % after the caption, to avoid chance of it being a breakpoint.
  8998. \ifx\floatlabel\empty \else
  8999. % Write the text that goes in the lof to the aux file as
  9000. % \floatlabel-lof. Besides \floatident, we include the short
  9001. % caption if specified, else the full caption if specified, else nothing.
  9002. {%
  9003. \requireauxfile
  9004. \atdummies
  9005. %
  9006. \ifx\thisshortcaption\empty
  9007. \def\gtemp{\thiscaption}%
  9008. \else
  9009. \def\gtemp{\thisshortcaption}%
  9010. \fi
  9011. \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
  9012. \ifx\gtemp\empty \else : \gtemp \fi}}%
  9013. }%
  9014. \fi
  9015. \egroup % end of \vtop
  9016. %
  9017. \checkinserts
  9018. }
  9019. % Append the tokens #2 to the definition of macro #1, not expanding either.
  9020. %
  9021. \def\appendtomacro#1#2{%
  9022. \expandafter\def\expandafter#1\expandafter{#1#2}%
  9023. }
  9024. % @caption, @shortcaption
  9025. %
  9026. \def\caption{\docaption\thiscaption}
  9027. \def\shortcaption{\docaption\thisshortcaption}
  9028. \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
  9029. \def\defcaption#1#2{\egroup \def#1{#2}}
  9030. % The parameter is the control sequence identifying the counter we are
  9031. % going to use. Create it if it doesn't exist and assign it to \floatno.
  9032. \def\getfloatno#1{%
  9033. \ifx#1\relax
  9034. % Haven't seen this figure type before.
  9035. \csname newcount\endcsname #1%
  9036. %
  9037. % Remember to reset this floatno at the next chap.
  9038. \expandafter\gdef\expandafter\resetallfloatnos
  9039. \expandafter{\resetallfloatnos #1=0 }%
  9040. \fi
  9041. \let\floatno#1%
  9042. }
  9043. % \setref calls this to get the XREFLABEL-snt value. We want an @xref
  9044. % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
  9045. % first read the @float command.
  9046. %
  9047. \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
  9048. % Magic string used for the XREFLABEL-title value, so \xrefX can
  9049. % distinguish floats from other xref types.
  9050. \def\floatmagic{!!float!!}
  9051. % #1 is the control sequence we are passed; we expand into a conditional
  9052. % which is true if #1 represents a float ref. That is, the magic
  9053. % \lastsection value which we \setref above.
  9054. %
  9055. \def\iffloat#1{\expandafter\doiffloat#1==\finish}
  9056. %
  9057. % #1 is (maybe) the \floatmagic string. If so, #2 will be the
  9058. % (safe) float type for this float. We set \iffloattype to #2.
  9059. %
  9060. \def\doiffloat#1=#2=#3\finish{%
  9061. \def\temp{#1}%
  9062. \def\iffloattype{#2}%
  9063. \ifx\temp\floatmagic
  9064. }
  9065. % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
  9066. %
  9067. \parseargdef\listoffloats{%
  9068. \def\floattype{#1}% floattype
  9069. {%
  9070. % the floattype might have accents or other special characters,
  9071. % but we need to use it in a control sequence name.
  9072. \indexnofonts
  9073. \turnoffactive
  9074. \xdef\safefloattype{\floattype}%
  9075. }%
  9076. %
  9077. % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
  9078. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
  9079. \ifhavexrefs
  9080. % if the user said @listoffloats foo but never @float foo.
  9081. \message{\linenumber No `\safefloattype' floats to list.}%
  9082. \fi
  9083. \else
  9084. \begingroup
  9085. \leftskip=\tocindent % indent these entries like a toc
  9086. \let\do=\listoffloatsdo
  9087. \csname floatlist\safefloattype\endcsname
  9088. \endgroup
  9089. \fi
  9090. }
  9091. % This is called on each entry in a list of floats. We're passed the
  9092. % xref label, in the form LABEL-title, which is how we save it in the
  9093. % aux file. We strip off the -title and look up \XRLABEL-lof, which
  9094. % has the text we're supposed to typeset here.
  9095. %
  9096. % Figures without xref labels will not be included in the list (since
  9097. % they won't appear in the aux file).
  9098. %
  9099. \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
  9100. \def\listoffloatsdoentry#1-title\finish{{%
  9101. % Can't fully expand XR#1-lof because it can contain anything. Just
  9102. % pass the control sequence. On the other hand, XR#1-pg is just the
  9103. % page number, and we want to fully expand that so we can get a link
  9104. % in pdf output.
  9105. \toksA = \expandafter{\csname XR#1-lof\endcsname}%
  9106. %
  9107. % use the same \entry macro we use to generate the TOC and index.
  9108. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
  9109. \writeentry
  9110. }}
  9111. \message{localization,}
  9112. % For single-language documents, @documentlanguage is usually given very
  9113. % early, just after @documentencoding. Single argument is the language
  9114. % (de) or locale (de_DE) abbreviation.
  9115. %
  9116. {
  9117. \catcode`\_ = \active
  9118. \globaldefs=1
  9119. \parseargdef\documentlanguage{%
  9120. \tex % read txi-??.tex file in plain TeX.
  9121. % Read the file by the name they passed if it exists.
  9122. \let_ = \normalunderscore % normal _ character for filename test
  9123. \openin 1 txi-#1.tex
  9124. \ifeof 1
  9125. \documentlanguagetrywithoutunderscore #1_\finish
  9126. \else
  9127. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9128. \input txi-#1.tex
  9129. \fi
  9130. \closein 1
  9131. \endgroup % end raw TeX
  9132. }
  9133. %
  9134. % If they passed de_DE, and txi-de_DE.tex doesn't exist,
  9135. % try txi-de.tex.
  9136. %
  9137. \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
  9138. \openin 1 txi-#1.tex
  9139. \ifeof 1
  9140. \errhelp = \nolanghelp
  9141. \errmessage{Cannot read language file txi-#1.tex}%
  9142. \else
  9143. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9144. \input txi-#1.tex
  9145. \fi
  9146. \closein 1
  9147. }
  9148. }% end of special _ catcode
  9149. %
  9150. \newhelp\nolanghelp{The given language definition file cannot be found or
  9151. is empty. Maybe you need to install it? Putting it in the current
  9152. directory should work if nowhere else does.}
  9153. % This macro is called from txi-??.tex files; the first argument is the
  9154. % \language name to set (without the "\lang@" prefix), the second and
  9155. % third args are \{left,right}hyphenmin.
  9156. %
  9157. % The language names to pass are determined when the format is built.
  9158. % See the etex.log file created at that time, e.g.,
  9159. % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
  9160. %
  9161. % With TeX Live 2008, etex now includes hyphenation patterns for all
  9162. % available languages. This means we can support hyphenation in
  9163. % Texinfo, at least to some extent. (This still doesn't solve the
  9164. % accented characters problem.)
  9165. %
  9166. \catcode`@=11
  9167. \def\txisetlanguage#1#2#3{%
  9168. % do not set the language if the name is undefined in the current TeX.
  9169. \expandafter\ifx\csname lang@#1\endcsname \relax
  9170. \message{no patterns for #1}%
  9171. \else
  9172. \global\language = \csname lang@#1\endcsname
  9173. \fi
  9174. % but there is no harm in adjusting the hyphenmin values regardless.
  9175. \global\lefthyphenmin = #2\relax
  9176. \global\righthyphenmin = #3\relax
  9177. }
  9178. % XeTeX and LuaTeX can handle Unicode natively.
  9179. % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
  9180. % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
  9181. %
  9182. \newif\iftxinativeunicodecapable
  9183. \newif\iftxiusebytewiseio
  9184. \ifx\XeTeXrevision\thisisundefined
  9185. \ifx\luatexversion\thisisundefined
  9186. \txinativeunicodecapablefalse
  9187. \txiusebytewiseiotrue
  9188. \else
  9189. \txinativeunicodecapabletrue
  9190. \txiusebytewiseiofalse
  9191. \fi
  9192. \else
  9193. \txinativeunicodecapabletrue
  9194. \txiusebytewiseiofalse
  9195. \fi
  9196. % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
  9197. % for non-UTF-8 (byte-wise) encodings.
  9198. %
  9199. \def\setbytewiseio{%
  9200. \ifx\XeTeXrevision\thisisundefined
  9201. \else
  9202. \XeTeXdefaultencoding "bytes" % For subsequent files to be read
  9203. \XeTeXinputencoding "bytes" % For document root file
  9204. % Unfortunately, there seems to be no corresponding XeTeX command for
  9205. % output encoding. This is a problem for auxiliary index and TOC files.
  9206. % The only solution would be perhaps to write out @U{...} sequences in
  9207. % place of non-ASCII characters.
  9208. \fi
  9209. \ifx\luatexversion\thisisundefined
  9210. \else
  9211. \directlua{
  9212. local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
  9213. local function convert_char (char)
  9214. return utf8_char(byte(char))
  9215. end
  9216. local function convert_line (line)
  9217. return gsub(line, ".", convert_char)
  9218. end
  9219. callback.register("process_input_buffer", convert_line)
  9220. local function convert_line_out (line)
  9221. local line_out = ""
  9222. for c in string.utfvalues(line) do
  9223. line_out = line_out .. string.char(c)
  9224. end
  9225. return line_out
  9226. end
  9227. callback.register("process_output_buffer", convert_line_out)
  9228. }
  9229. \fi
  9230. \txiusebytewiseiotrue
  9231. }
  9232. % Helpers for encodings.
  9233. % Set the catcode of characters 128 through 255 to the specified number.
  9234. %
  9235. \def\setnonasciicharscatcode#1{%
  9236. \count255=128
  9237. \loop\ifnum\count255<256
  9238. \global\catcode\count255=#1\relax
  9239. \advance\count255 by 1
  9240. \repeat
  9241. }
  9242. \def\setnonasciicharscatcodenonglobal#1{%
  9243. \count255=128
  9244. \loop\ifnum\count255<256
  9245. \catcode\count255=#1\relax
  9246. \advance\count255 by 1
  9247. \repeat
  9248. }
  9249. % @documentencoding sets the definition of non-ASCII characters
  9250. % according to the specified encoding.
  9251. %
  9252. \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
  9253. \def\documentencodingzzz#1{%
  9254. %
  9255. % Encoding being declared for the document.
  9256. \def\declaredencoding{\csname #1.enc\endcsname}%
  9257. %
  9258. % Supported encodings: names converted to tokens in order to be able
  9259. % to compare them with \ifx.
  9260. \def\ascii{\csname US-ASCII.enc\endcsname}%
  9261. \def\latnine{\csname ISO-8859-15.enc\endcsname}%
  9262. \def\latone{\csname ISO-8859-1.enc\endcsname}%
  9263. \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
  9264. \def\utfeight{\csname UTF-8.enc\endcsname}%
  9265. %
  9266. \ifx \declaredencoding \ascii
  9267. \asciichardefs
  9268. %
  9269. \else \ifx \declaredencoding \lattwo
  9270. \iftxinativeunicodecapable
  9271. \setbytewiseio
  9272. \fi
  9273. \setnonasciicharscatcode\active
  9274. \lattwochardefs
  9275. %
  9276. \else \ifx \declaredencoding \latone
  9277. \iftxinativeunicodecapable
  9278. \setbytewiseio
  9279. \fi
  9280. \setnonasciicharscatcode\active
  9281. \latonechardefs
  9282. %
  9283. \else \ifx \declaredencoding \latnine
  9284. \iftxinativeunicodecapable
  9285. \setbytewiseio
  9286. \fi
  9287. \setnonasciicharscatcode\active
  9288. \latninechardefs
  9289. %
  9290. \else \ifx \declaredencoding \utfeight
  9291. \iftxinativeunicodecapable
  9292. % For native Unicode handling (XeTeX and LuaTeX)
  9293. \nativeunicodechardefs
  9294. \else
  9295. % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
  9296. \setnonasciicharscatcode\active
  9297. % since we already invoked \utfeightchardefs at the top level
  9298. % (below), do not re-invoke it, otherwise our check for duplicated
  9299. % definitions gets triggered. Making non-ascii chars active is
  9300. % sufficient.
  9301. \fi
  9302. %
  9303. \else
  9304. \message{Ignoring unknown document encoding: #1.}%
  9305. %
  9306. \fi % utfeight
  9307. \fi % latnine
  9308. \fi % latone
  9309. \fi % lattwo
  9310. \fi % ascii
  9311. %
  9312. \ifx\XeTeXrevision\thisisundefined
  9313. \else
  9314. \ifx \declaredencoding \utfeight
  9315. \else
  9316. \ifx \declaredencoding \ascii
  9317. \else
  9318. \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
  9319. non-ASCII characters in auxiliary files.}%
  9320. \fi
  9321. \fi
  9322. \fi
  9323. }
  9324. % emacs-page
  9325. % A message to be logged when using a character that isn't available
  9326. % the default font encoding (OT1).
  9327. %
  9328. \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
  9329. % Take account of \c (plain) vs. \, (Texinfo) difference.
  9330. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
  9331. % First, make active non-ASCII characters in order for them to be
  9332. % correctly categorized when TeX reads the replacement text of
  9333. % macros containing the character definitions.
  9334. \setnonasciicharscatcode\active
  9335. %
  9336. \def\gdefchar#1#2{%
  9337. \gdef#1{%
  9338. \ifpassthroughchars
  9339. \string#1%
  9340. \else
  9341. #2%
  9342. \fi
  9343. }}
  9344. % Latin1 (ISO-8859-1) character definitions.
  9345. \def\latonechardefs{%
  9346. \gdefchar^^a0{\tie}
  9347. \gdefchar^^a1{\exclamdown}
  9348. \gdefchar^^a2{{\tcfont \char162}} % cent
  9349. \gdefchar^^a3{\pounds}
  9350. \gdefchar^^a4{{\tcfont \char164}} % currency
  9351. \gdefchar^^a5{{\tcfont \char165}} % yen
  9352. \gdefchar^^a6{{\tcfont \char166}} % broken bar
  9353. \gdefchar^^a7{\S}
  9354. \gdefchar^^a8{\"{}}
  9355. \gdefchar^^a9{\copyright}
  9356. \gdefchar^^aa{\ordf}
  9357. \gdefchar^^ab{\guillemetleft}
  9358. \gdefchar^^ac{\ensuremath\lnot}
  9359. \gdefchar^^ad{\-}
  9360. \gdefchar^^ae{\registeredsymbol}
  9361. \gdefchar^^af{\={}}
  9362. %
  9363. \gdefchar^^b0{\textdegree}
  9364. \gdefchar^^b1{$\pm$}
  9365. \gdefchar^^b2{$^2$}
  9366. \gdefchar^^b3{$^3$}
  9367. \gdefchar^^b4{\'{}}
  9368. \gdefchar^^b5{$\mu$}
  9369. \gdefchar^^b6{\P}
  9370. \gdefchar^^b7{\ensuremath\cdot}
  9371. \gdefchar^^b8{\cedilla\ }
  9372. \gdefchar^^b9{$^1$}
  9373. \gdefchar^^ba{\ordm}
  9374. \gdefchar^^bb{\guillemetright}
  9375. \gdefchar^^bc{$1\over4$}
  9376. \gdefchar^^bd{$1\over2$}
  9377. \gdefchar^^be{$3\over4$}
  9378. \gdefchar^^bf{\questiondown}
  9379. %
  9380. \gdefchar^^c0{\`A}
  9381. \gdefchar^^c1{\'A}
  9382. \gdefchar^^c2{\^A}
  9383. \gdefchar^^c3{\~A}
  9384. \gdefchar^^c4{\"A}
  9385. \gdefchar^^c5{\ringaccent A}
  9386. \gdefchar^^c6{\AE}
  9387. \gdefchar^^c7{\cedilla C}
  9388. \gdefchar^^c8{\`E}
  9389. \gdefchar^^c9{\'E}
  9390. \gdefchar^^ca{\^E}
  9391. \gdefchar^^cb{\"E}
  9392. \gdefchar^^cc{\`I}
  9393. \gdefchar^^cd{\'I}
  9394. \gdefchar^^ce{\^I}
  9395. \gdefchar^^cf{\"I}
  9396. %
  9397. \gdefchar^^d0{\DH}
  9398. \gdefchar^^d1{\~N}
  9399. \gdefchar^^d2{\`O}
  9400. \gdefchar^^d3{\'O}
  9401. \gdefchar^^d4{\^O}
  9402. \gdefchar^^d5{\~O}
  9403. \gdefchar^^d6{\"O}
  9404. \gdefchar^^d7{$\times$}
  9405. \gdefchar^^d8{\O}
  9406. \gdefchar^^d9{\`U}
  9407. \gdefchar^^da{\'U}
  9408. \gdefchar^^db{\^U}
  9409. \gdefchar^^dc{\"U}
  9410. \gdefchar^^dd{\'Y}
  9411. \gdefchar^^de{\TH}
  9412. \gdefchar^^df{\ss}
  9413. %
  9414. \gdefchar^^e0{\`a}
  9415. \gdefchar^^e1{\'a}
  9416. \gdefchar^^e2{\^a}
  9417. \gdefchar^^e3{\~a}
  9418. \gdefchar^^e4{\"a}
  9419. \gdefchar^^e5{\ringaccent a}
  9420. \gdefchar^^e6{\ae}
  9421. \gdefchar^^e7{\cedilla c}
  9422. \gdefchar^^e8{\`e}
  9423. \gdefchar^^e9{\'e}
  9424. \gdefchar^^ea{\^e}
  9425. \gdefchar^^eb{\"e}
  9426. \gdefchar^^ec{\`{\dotless i}}
  9427. \gdefchar^^ed{\'{\dotless i}}
  9428. \gdefchar^^ee{\^{\dotless i}}
  9429. \gdefchar^^ef{\"{\dotless i}}
  9430. %
  9431. \gdefchar^^f0{\dh}
  9432. \gdefchar^^f1{\~n}
  9433. \gdefchar^^f2{\`o}
  9434. \gdefchar^^f3{\'o}
  9435. \gdefchar^^f4{\^o}
  9436. \gdefchar^^f5{\~o}
  9437. \gdefchar^^f6{\"o}
  9438. \gdefchar^^f7{$\div$}
  9439. \gdefchar^^f8{\o}
  9440. \gdefchar^^f9{\`u}
  9441. \gdefchar^^fa{\'u}
  9442. \gdefchar^^fb{\^u}
  9443. \gdefchar^^fc{\"u}
  9444. \gdefchar^^fd{\'y}
  9445. \gdefchar^^fe{\th}
  9446. \gdefchar^^ff{\"y}
  9447. }
  9448. % Latin9 (ISO-8859-15) encoding character definitions.
  9449. \def\latninechardefs{%
  9450. % Encoding is almost identical to Latin1.
  9451. \latonechardefs
  9452. %
  9453. \gdefchar^^a4{\euro}
  9454. \gdefchar^^a6{\v S}
  9455. \gdefchar^^a8{\v s}
  9456. \gdefchar^^b4{\v Z}
  9457. \gdefchar^^b8{\v z}
  9458. \gdefchar^^bc{\OE}
  9459. \gdefchar^^bd{\oe}
  9460. \gdefchar^^be{\"Y}
  9461. }
  9462. % Latin2 (ISO-8859-2) character definitions.
  9463. \def\lattwochardefs{%
  9464. \gdefchar^^a0{\tie}
  9465. \gdefchar^^a1{\ogonek{A}}
  9466. \gdefchar^^a2{\u{}}
  9467. \gdefchar^^a3{\L}
  9468. \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
  9469. \gdefchar^^a5{\v L}
  9470. \gdefchar^^a6{\'S}
  9471. \gdefchar^^a7{\S}
  9472. \gdefchar^^a8{\"{}}
  9473. \gdefchar^^a9{\v S}
  9474. \gdefchar^^aa{\cedilla S}
  9475. \gdefchar^^ab{\v T}
  9476. \gdefchar^^ac{\'Z}
  9477. \gdefchar^^ad{\-}
  9478. \gdefchar^^ae{\v Z}
  9479. \gdefchar^^af{\dotaccent Z}
  9480. %
  9481. \gdefchar^^b0{\textdegree}
  9482. \gdefchar^^b1{\ogonek{a}}
  9483. \gdefchar^^b2{\ogonek{ }}
  9484. \gdefchar^^b3{\l}
  9485. \gdefchar^^b4{\'{}}
  9486. \gdefchar^^b5{\v l}
  9487. \gdefchar^^b6{\'s}
  9488. \gdefchar^^b7{\v{}}
  9489. \gdefchar^^b8{\cedilla\ }
  9490. \gdefchar^^b9{\v s}
  9491. \gdefchar^^ba{\cedilla s}
  9492. \gdefchar^^bb{\v t}
  9493. \gdefchar^^bc{\'z}
  9494. \gdefchar^^bd{\H{}}
  9495. \gdefchar^^be{\v z}
  9496. \gdefchar^^bf{\dotaccent z}
  9497. %
  9498. \gdefchar^^c0{\'R}
  9499. \gdefchar^^c1{\'A}
  9500. \gdefchar^^c2{\^A}
  9501. \gdefchar^^c3{\u A}
  9502. \gdefchar^^c4{\"A}
  9503. \gdefchar^^c5{\'L}
  9504. \gdefchar^^c6{\'C}
  9505. \gdefchar^^c7{\cedilla C}
  9506. \gdefchar^^c8{\v C}
  9507. \gdefchar^^c9{\'E}
  9508. \gdefchar^^ca{\ogonek{E}}
  9509. \gdefchar^^cb{\"E}
  9510. \gdefchar^^cc{\v E}
  9511. \gdefchar^^cd{\'I}
  9512. \gdefchar^^ce{\^I}
  9513. \gdefchar^^cf{\v D}
  9514. %
  9515. \gdefchar^^d0{\DH}
  9516. \gdefchar^^d1{\'N}
  9517. \gdefchar^^d2{\v N}
  9518. \gdefchar^^d3{\'O}
  9519. \gdefchar^^d4{\^O}
  9520. \gdefchar^^d5{\H O}
  9521. \gdefchar^^d6{\"O}
  9522. \gdefchar^^d7{$\times$}
  9523. \gdefchar^^d8{\v R}
  9524. \gdefchar^^d9{\ringaccent U}
  9525. \gdefchar^^da{\'U}
  9526. \gdefchar^^db{\H U}
  9527. \gdefchar^^dc{\"U}
  9528. \gdefchar^^dd{\'Y}
  9529. \gdefchar^^de{\cedilla T}
  9530. \gdefchar^^df{\ss}
  9531. %
  9532. \gdefchar^^e0{\'r}
  9533. \gdefchar^^e1{\'a}
  9534. \gdefchar^^e2{\^a}
  9535. \gdefchar^^e3{\u a}
  9536. \gdefchar^^e4{\"a}
  9537. \gdefchar^^e5{\'l}
  9538. \gdefchar^^e6{\'c}
  9539. \gdefchar^^e7{\cedilla c}
  9540. \gdefchar^^e8{\v c}
  9541. \gdefchar^^e9{\'e}
  9542. \gdefchar^^ea{\ogonek{e}}
  9543. \gdefchar^^eb{\"e}
  9544. \gdefchar^^ec{\v e}
  9545. \gdefchar^^ed{\'{\dotless{i}}}
  9546. \gdefchar^^ee{\^{\dotless{i}}}
  9547. \gdefchar^^ef{\v d}
  9548. %
  9549. \gdefchar^^f0{\dh}
  9550. \gdefchar^^f1{\'n}
  9551. \gdefchar^^f2{\v n}
  9552. \gdefchar^^f3{\'o}
  9553. \gdefchar^^f4{\^o}
  9554. \gdefchar^^f5{\H o}
  9555. \gdefchar^^f6{\"o}
  9556. \gdefchar^^f7{$\div$}
  9557. \gdefchar^^f8{\v r}
  9558. \gdefchar^^f9{\ringaccent u}
  9559. \gdefchar^^fa{\'u}
  9560. \gdefchar^^fb{\H u}
  9561. \gdefchar^^fc{\"u}
  9562. \gdefchar^^fd{\'y}
  9563. \gdefchar^^fe{\cedilla t}
  9564. \gdefchar^^ff{\dotaccent{}}
  9565. }
  9566. % UTF-8 character definitions.
  9567. %
  9568. % This code to support UTF-8 is based on LaTeX's utf8.def, with some
  9569. % changes for Texinfo conventions. It is included here under the GPL by
  9570. % permission from Frank Mittelbach and the LaTeX team.
  9571. %
  9572. \newcount\countUTFx
  9573. \newcount\countUTFy
  9574. \newcount\countUTFz
  9575. \gdef\UTFviiiTwoOctets#1#2{\expandafter
  9576. \UTFviiiDefined\csname u8:#1\string #2\endcsname}
  9577. %
  9578. \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
  9579. \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
  9580. %
  9581. \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
  9582. \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
  9583. \gdef\UTFviiiDefined#1{%
  9584. \ifx #1\relax
  9585. \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
  9586. \else
  9587. \expandafter #1%
  9588. \fi
  9589. }
  9590. % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
  9591. \begingroup
  9592. \catcode`\~13
  9593. \catcode`\$12
  9594. \catcode`\"12
  9595. % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
  9596. % substituting ~ and $ with a character token of that value.
  9597. \def\UTFviiiLoop{%
  9598. \global\catcode\countUTFx\active
  9599. \uccode`\~\countUTFx
  9600. \uccode`\$\countUTFx
  9601. \uppercase\expandafter{\UTFviiiTmp}%
  9602. \advance\countUTFx by 1
  9603. \ifnum\countUTFx < \countUTFy
  9604. \expandafter\UTFviiiLoop
  9605. \fi}
  9606. % For bytes other than the first in a UTF-8 sequence. Not expected to
  9607. % be expanded except when writing to auxiliary files.
  9608. \countUTFx = "80
  9609. \countUTFy = "C2
  9610. \def\UTFviiiTmp{%
  9611. \gdef~{%
  9612. \ifpassthroughchars $\fi}}%
  9613. \UTFviiiLoop
  9614. \countUTFx = "C2
  9615. \countUTFy = "E0
  9616. \def\UTFviiiTmp{%
  9617. \gdef~{%
  9618. \ifpassthroughchars $%
  9619. \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
  9620. \UTFviiiLoop
  9621. \countUTFx = "E0
  9622. \countUTFy = "F0
  9623. \def\UTFviiiTmp{%
  9624. \gdef~{%
  9625. \ifpassthroughchars $%
  9626. \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
  9627. \UTFviiiLoop
  9628. \countUTFx = "F0
  9629. \countUTFy = "F4
  9630. \def\UTFviiiTmp{%
  9631. \gdef~{%
  9632. \ifpassthroughchars $%
  9633. \else\expandafter\UTFviiiFourOctets\expandafter$\fi
  9634. }}%
  9635. \UTFviiiLoop
  9636. \endgroup
  9637. \def\globallet{\global\let} % save some \expandafter's below
  9638. % @U{xxxx} to produce U+xxxx, if we support it.
  9639. \def\U#1{%
  9640. \expandafter\ifx\csname uni:#1\endcsname \relax
  9641. \iftxinativeunicodecapable
  9642. % All Unicode characters can be used if native Unicode handling is
  9643. % active. However, if the font does not have the glyph,
  9644. % letters are missing.
  9645. \begingroup
  9646. \uccode`\.="#1\relax
  9647. \uppercase{.}
  9648. \endgroup
  9649. \else
  9650. \errhelp = \EMsimple
  9651. \errmessage{Unicode character U+#1 not supported, sorry}%
  9652. \fi
  9653. \else
  9654. \csname uni:#1\endcsname
  9655. \fi
  9656. }
  9657. % These macros are used here to construct the name of a control
  9658. % sequence to be defined.
  9659. \def\UTFviiiTwoOctetsName#1#2{%
  9660. \csname u8:#1\string #2\endcsname}%
  9661. \def\UTFviiiThreeOctetsName#1#2#3{%
  9662. \csname u8:#1\string #2\string #3\endcsname}%
  9663. \def\UTFviiiFourOctetsName#1#2#3#4{%
  9664. \csname u8:#1\string #2\string #3\string #4\endcsname}%
  9665. % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
  9666. % provide a definition macro to replace a Unicode character;
  9667. % this gets used by the @U command
  9668. %
  9669. \begingroup
  9670. \catcode`\"=12
  9671. \catcode`\<=12
  9672. \catcode`\.=12
  9673. \catcode`\,=12
  9674. \catcode`\;=12
  9675. \catcode`\!=12
  9676. \catcode`\~=13
  9677. \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
  9678. \countUTFz = "#1\relax
  9679. \begingroup
  9680. \parseXMLCharref
  9681. % Give \u8:... its definition. The sequence of seven \expandafter's
  9682. % expands after the \gdef three times, e.g.
  9683. %
  9684. % 1. \UTFviiTwoOctetsName B1 B2
  9685. % 2. \csname u8:B1 \string B2 \endcsname
  9686. % 3. \u8: B1 B2 (a single control sequence token)
  9687. %
  9688. \expandafter\expandafter
  9689. \expandafter\expandafter
  9690. \expandafter\expandafter
  9691. \expandafter\gdef \UTFviiiTmp{#2}%
  9692. %
  9693. \expandafter\ifx\csname uni:#1\endcsname \relax \else
  9694. \message{Internal error, already defined: #1}%
  9695. \fi
  9696. %
  9697. % define an additional control sequence for this code point.
  9698. \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
  9699. \endgroup}
  9700. %
  9701. % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
  9702. % to the corresponding UTF-8 sequence.
  9703. \gdef\parseXMLCharref{%
  9704. \ifnum\countUTFz < "A0\relax
  9705. \errhelp = \EMsimple
  9706. \errmessage{Cannot define Unicode char value < 00A0}%
  9707. \else\ifnum\countUTFz < "800\relax
  9708. \parseUTFviiiA,%
  9709. \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
  9710. \else\ifnum\countUTFz < "10000\relax
  9711. \parseUTFviiiA;%
  9712. \parseUTFviiiA,%
  9713. \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
  9714. \else
  9715. \parseUTFviiiA;%
  9716. \parseUTFviiiA,%
  9717. \parseUTFviiiA!%
  9718. \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
  9719. \fi\fi\fi
  9720. }
  9721. % Extract a byte from the end of the UTF-8 representation of \countUTFx.
  9722. % It must be a non-initial byte in the sequence.
  9723. % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
  9724. % of the bytes.
  9725. \gdef\parseUTFviiiA#1{%
  9726. \countUTFx = \countUTFz
  9727. \divide\countUTFz by 64
  9728. \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
  9729. \multiply\countUTFz by 64
  9730. % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
  9731. % in order to get the last five bits.
  9732. \advance\countUTFx by -\countUTFz
  9733. % Convert this to the byte in the UTF-8 sequence.
  9734. \advance\countUTFx by 128
  9735. \uccode `#1\countUTFx
  9736. \countUTFz = \countUTFy}
  9737. % Used to put a UTF-8 byte sequence into \UTFviiiTmp
  9738. % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
  9739. % sequence.
  9740. % #2 is one of the \UTFviii*OctetsName macros.
  9741. % #3 is always a full stop (.)
  9742. % #4 is a template for the other bytes in the sequence. The values for these
  9743. % bytes is substituted in here with \uppercase using the \uccode's.
  9744. \gdef\parseUTFviiiB#1#2#3#4{%
  9745. \advance\countUTFz by "#10\relax
  9746. \uccode `#3\countUTFz
  9747. \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
  9748. \endgroup
  9749. % For native Unicode handling (XeTeX and LuaTeX),
  9750. % provide a definition macro that sets a catcode to `other' non-globally
  9751. %
  9752. \def\DeclareUnicodeCharacterNativeOther#1#2{%
  9753. \catcode"#1=\other
  9754. }
  9755. % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
  9756. % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
  9757. % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
  9758. % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
  9759. % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
  9760. %
  9761. % Many of our renditions are less than wonderful, and all the missing
  9762. % characters are available somewhere. Loading the necessary fonts
  9763. % awaits user request. We can't truly support Unicode without
  9764. % reimplementing everything that's been done in LaTeX for many years,
  9765. % plus probably using luatex or xetex, and who knows what else.
  9766. % We won't be doing that here in this simple file. But we can try to at
  9767. % least make most of the characters not bomb out.
  9768. %
  9769. \def\unicodechardefs{%
  9770. \DeclareUnicodeCharacter{00A0}{\tie}%
  9771. \DeclareUnicodeCharacter{00A1}{\exclamdown}%
  9772. \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
  9773. \DeclareUnicodeCharacter{00A3}{\pounds}%
  9774. \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
  9775. \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
  9776. \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
  9777. \DeclareUnicodeCharacter{00A7}{\S}%
  9778. \DeclareUnicodeCharacter{00A8}{\"{ }}%
  9779. \DeclareUnicodeCharacter{00A9}{\copyright}%
  9780. \DeclareUnicodeCharacter{00AA}{\ordf}%
  9781. \DeclareUnicodeCharacter{00AB}{\guillemetleft}%
  9782. \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
  9783. \DeclareUnicodeCharacter{00AD}{\-}%
  9784. \DeclareUnicodeCharacter{00AE}{\registeredsymbol}%
  9785. \DeclareUnicodeCharacter{00AF}{\={ }}%
  9786. %
  9787. \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
  9788. \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
  9789. \DeclareUnicodeCharacter{00B2}{$^2$}%
  9790. \DeclareUnicodeCharacter{00B3}{$^3$}%
  9791. \DeclareUnicodeCharacter{00B4}{\'{ }}%
  9792. \DeclareUnicodeCharacter{00B5}{$\mu$}%
  9793. \DeclareUnicodeCharacter{00B6}{\P}%
  9794. \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
  9795. \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
  9796. \DeclareUnicodeCharacter{00B9}{$^1$}%
  9797. \DeclareUnicodeCharacter{00BA}{\ordm}%
  9798. \DeclareUnicodeCharacter{00BB}{\guillemetright}%
  9799. \DeclareUnicodeCharacter{00BC}{$1\over4$}%
  9800. \DeclareUnicodeCharacter{00BD}{$1\over2$}%
  9801. \DeclareUnicodeCharacter{00BE}{$3\over4$}%
  9802. \DeclareUnicodeCharacter{00BF}{\questiondown}%
  9803. %
  9804. \DeclareUnicodeCharacter{00C0}{\`A}%
  9805. \DeclareUnicodeCharacter{00C1}{\'A}%
  9806. \DeclareUnicodeCharacter{00C2}{\^A}%
  9807. \DeclareUnicodeCharacter{00C3}{\~A}%
  9808. \DeclareUnicodeCharacter{00C4}{\"A}%
  9809. \DeclareUnicodeCharacter{00C5}{\AA}%
  9810. \DeclareUnicodeCharacter{00C6}{\AE}%
  9811. \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
  9812. \DeclareUnicodeCharacter{00C8}{\`E}%
  9813. \DeclareUnicodeCharacter{00C9}{\'E}%
  9814. \DeclareUnicodeCharacter{00CA}{\^E}%
  9815. \DeclareUnicodeCharacter{00CB}{\"E}%
  9816. \DeclareUnicodeCharacter{00CC}{\`I}%
  9817. \DeclareUnicodeCharacter{00CD}{\'I}%
  9818. \DeclareUnicodeCharacter{00CE}{\^I}%
  9819. \DeclareUnicodeCharacter{00CF}{\"I}%
  9820. %
  9821. \DeclareUnicodeCharacter{00D0}{\DH}%
  9822. \DeclareUnicodeCharacter{00D1}{\~N}%
  9823. \DeclareUnicodeCharacter{00D2}{\`O}%
  9824. \DeclareUnicodeCharacter{00D3}{\'O}%
  9825. \DeclareUnicodeCharacter{00D4}{\^O}%
  9826. \DeclareUnicodeCharacter{00D5}{\~O}%
  9827. \DeclareUnicodeCharacter{00D6}{\"O}%
  9828. \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
  9829. \DeclareUnicodeCharacter{00D8}{\O}%
  9830. \DeclareUnicodeCharacter{00D9}{\`U}%
  9831. \DeclareUnicodeCharacter{00DA}{\'U}%
  9832. \DeclareUnicodeCharacter{00DB}{\^U}%
  9833. \DeclareUnicodeCharacter{00DC}{\"U}%
  9834. \DeclareUnicodeCharacter{00DD}{\'Y}%
  9835. \DeclareUnicodeCharacter{00DE}{\TH}%
  9836. \DeclareUnicodeCharacter{00DF}{\ss}%
  9837. %
  9838. \DeclareUnicodeCharacter{00E0}{\`a}%
  9839. \DeclareUnicodeCharacter{00E1}{\'a}%
  9840. \DeclareUnicodeCharacter{00E2}{\^a}%
  9841. \DeclareUnicodeCharacter{00E3}{\~a}%
  9842. \DeclareUnicodeCharacter{00E4}{\"a}%
  9843. \DeclareUnicodeCharacter{00E5}{\aa}%
  9844. \DeclareUnicodeCharacter{00E6}{\ae}%
  9845. \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
  9846. \DeclareUnicodeCharacter{00E8}{\`e}%
  9847. \DeclareUnicodeCharacter{00E9}{\'e}%
  9848. \DeclareUnicodeCharacter{00EA}{\^e}%
  9849. \DeclareUnicodeCharacter{00EB}{\"e}%
  9850. \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
  9851. \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
  9852. \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
  9853. \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
  9854. %
  9855. \DeclareUnicodeCharacter{00F0}{\dh}%
  9856. \DeclareUnicodeCharacter{00F1}{\~n}%
  9857. \DeclareUnicodeCharacter{00F2}{\`o}%
  9858. \DeclareUnicodeCharacter{00F3}{\'o}%
  9859. \DeclareUnicodeCharacter{00F4}{\^o}%
  9860. \DeclareUnicodeCharacter{00F5}{\~o}%
  9861. \DeclareUnicodeCharacter{00F6}{\"o}%
  9862. \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
  9863. \DeclareUnicodeCharacter{00F8}{\o}%
  9864. \DeclareUnicodeCharacter{00F9}{\`u}%
  9865. \DeclareUnicodeCharacter{00FA}{\'u}%
  9866. \DeclareUnicodeCharacter{00FB}{\^u}%
  9867. \DeclareUnicodeCharacter{00FC}{\"u}%
  9868. \DeclareUnicodeCharacter{00FD}{\'y}%
  9869. \DeclareUnicodeCharacter{00FE}{\th}%
  9870. \DeclareUnicodeCharacter{00FF}{\"y}%
  9871. %
  9872. \DeclareUnicodeCharacter{0100}{\=A}%
  9873. \DeclareUnicodeCharacter{0101}{\=a}%
  9874. \DeclareUnicodeCharacter{0102}{\u{A}}%
  9875. \DeclareUnicodeCharacter{0103}{\u{a}}%
  9876. \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
  9877. \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
  9878. \DeclareUnicodeCharacter{0106}{\'C}%
  9879. \DeclareUnicodeCharacter{0107}{\'c}%
  9880. \DeclareUnicodeCharacter{0108}{\^C}%
  9881. \DeclareUnicodeCharacter{0109}{\^c}%
  9882. \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
  9883. \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
  9884. \DeclareUnicodeCharacter{010C}{\v{C}}%
  9885. \DeclareUnicodeCharacter{010D}{\v{c}}%
  9886. \DeclareUnicodeCharacter{010E}{\v{D}}%
  9887. \DeclareUnicodeCharacter{010F}{d'}%
  9888. %
  9889. \DeclareUnicodeCharacter{0110}{\DH}%
  9890. \DeclareUnicodeCharacter{0111}{\dh}%
  9891. \DeclareUnicodeCharacter{0112}{\=E}%
  9892. \DeclareUnicodeCharacter{0113}{\=e}%
  9893. \DeclareUnicodeCharacter{0114}{\u{E}}%
  9894. \DeclareUnicodeCharacter{0115}{\u{e}}%
  9895. \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
  9896. \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
  9897. \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
  9898. \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
  9899. \DeclareUnicodeCharacter{011A}{\v{E}}%
  9900. \DeclareUnicodeCharacter{011B}{\v{e}}%
  9901. \DeclareUnicodeCharacter{011C}{\^G}%
  9902. \DeclareUnicodeCharacter{011D}{\^g}%
  9903. \DeclareUnicodeCharacter{011E}{\u{G}}%
  9904. \DeclareUnicodeCharacter{011F}{\u{g}}%
  9905. %
  9906. \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
  9907. \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
  9908. \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
  9909. \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
  9910. \DeclareUnicodeCharacter{0124}{\^H}%
  9911. \DeclareUnicodeCharacter{0125}{\^h}%
  9912. \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
  9913. \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
  9914. \DeclareUnicodeCharacter{0128}{\~I}%
  9915. \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
  9916. \DeclareUnicodeCharacter{012A}{\=I}%
  9917. \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
  9918. \DeclareUnicodeCharacter{012C}{\u{I}}%
  9919. \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
  9920. \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
  9921. \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
  9922. %
  9923. \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
  9924. \DeclareUnicodeCharacter{0131}{\dotless{i}}%
  9925. \DeclareUnicodeCharacter{0132}{IJ}%
  9926. \DeclareUnicodeCharacter{0133}{ij}%
  9927. \DeclareUnicodeCharacter{0134}{\^J}%
  9928. \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
  9929. \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
  9930. \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
  9931. \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
  9932. \DeclareUnicodeCharacter{0139}{\'L}%
  9933. \DeclareUnicodeCharacter{013A}{\'l}%
  9934. \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
  9935. \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
  9936. \DeclareUnicodeCharacter{013D}{L'}% should kern
  9937. \DeclareUnicodeCharacter{013E}{l'}% should kern
  9938. \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
  9939. %
  9940. \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
  9941. \DeclareUnicodeCharacter{0141}{\L}%
  9942. \DeclareUnicodeCharacter{0142}{\l}%
  9943. \DeclareUnicodeCharacter{0143}{\'N}%
  9944. \DeclareUnicodeCharacter{0144}{\'n}%
  9945. \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
  9946. \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
  9947. \DeclareUnicodeCharacter{0147}{\v{N}}%
  9948. \DeclareUnicodeCharacter{0148}{\v{n}}%
  9949. \DeclareUnicodeCharacter{0149}{'n}%
  9950. \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
  9951. \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
  9952. \DeclareUnicodeCharacter{014C}{\=O}%
  9953. \DeclareUnicodeCharacter{014D}{\=o}%
  9954. \DeclareUnicodeCharacter{014E}{\u{O}}%
  9955. \DeclareUnicodeCharacter{014F}{\u{o}}%
  9956. %
  9957. \DeclareUnicodeCharacter{0150}{\H{O}}%
  9958. \DeclareUnicodeCharacter{0151}{\H{o}}%
  9959. \DeclareUnicodeCharacter{0152}{\OE}%
  9960. \DeclareUnicodeCharacter{0153}{\oe}%
  9961. \DeclareUnicodeCharacter{0154}{\'R}%
  9962. \DeclareUnicodeCharacter{0155}{\'r}%
  9963. \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
  9964. \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
  9965. \DeclareUnicodeCharacter{0158}{\v{R}}%
  9966. \DeclareUnicodeCharacter{0159}{\v{r}}%
  9967. \DeclareUnicodeCharacter{015A}{\'S}%
  9968. \DeclareUnicodeCharacter{015B}{\'s}%
  9969. \DeclareUnicodeCharacter{015C}{\^S}%
  9970. \DeclareUnicodeCharacter{015D}{\^s}%
  9971. \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
  9972. \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
  9973. %
  9974. \DeclareUnicodeCharacter{0160}{\v{S}}%
  9975. \DeclareUnicodeCharacter{0161}{\v{s}}%
  9976. \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
  9977. \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
  9978. \DeclareUnicodeCharacter{0164}{\v{T}}%
  9979. \DeclareUnicodeCharacter{0165}{\v{t}}%
  9980. \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
  9981. \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
  9982. \DeclareUnicodeCharacter{0168}{\~U}%
  9983. \DeclareUnicodeCharacter{0169}{\~u}%
  9984. \DeclareUnicodeCharacter{016A}{\=U}%
  9985. \DeclareUnicodeCharacter{016B}{\=u}%
  9986. \DeclareUnicodeCharacter{016C}{\u{U}}%
  9987. \DeclareUnicodeCharacter{016D}{\u{u}}%
  9988. \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
  9989. \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
  9990. %
  9991. \DeclareUnicodeCharacter{0170}{\H{U}}%
  9992. \DeclareUnicodeCharacter{0171}{\H{u}}%
  9993. \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
  9994. \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
  9995. \DeclareUnicodeCharacter{0174}{\^W}%
  9996. \DeclareUnicodeCharacter{0175}{\^w}%
  9997. \DeclareUnicodeCharacter{0176}{\^Y}%
  9998. \DeclareUnicodeCharacter{0177}{\^y}%
  9999. \DeclareUnicodeCharacter{0178}{\"Y}%
  10000. \DeclareUnicodeCharacter{0179}{\'Z}%
  10001. \DeclareUnicodeCharacter{017A}{\'z}%
  10002. \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
  10003. \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
  10004. \DeclareUnicodeCharacter{017D}{\v{Z}}%
  10005. \DeclareUnicodeCharacter{017E}{\v{z}}%
  10006. \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
  10007. %
  10008. \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
  10009. \DeclareUnicodeCharacter{01C5}{D\v{z}}%
  10010. \DeclareUnicodeCharacter{01C6}{d\v{z}}%
  10011. \DeclareUnicodeCharacter{01C7}{LJ}%
  10012. \DeclareUnicodeCharacter{01C8}{Lj}%
  10013. \DeclareUnicodeCharacter{01C9}{lj}%
  10014. \DeclareUnicodeCharacter{01CA}{NJ}%
  10015. \DeclareUnicodeCharacter{01CB}{Nj}%
  10016. \DeclareUnicodeCharacter{01CC}{nj}%
  10017. \DeclareUnicodeCharacter{01CD}{\v{A}}%
  10018. \DeclareUnicodeCharacter{01CE}{\v{a}}%
  10019. \DeclareUnicodeCharacter{01CF}{\v{I}}%
  10020. %
  10021. \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
  10022. \DeclareUnicodeCharacter{01D1}{\v{O}}%
  10023. \DeclareUnicodeCharacter{01D2}{\v{o}}%
  10024. \DeclareUnicodeCharacter{01D3}{\v{U}}%
  10025. \DeclareUnicodeCharacter{01D4}{\v{u}}%
  10026. %
  10027. \DeclareUnicodeCharacter{01E2}{\={\AE}}%
  10028. \DeclareUnicodeCharacter{01E3}{\={\ae}}%
  10029. \DeclareUnicodeCharacter{01E6}{\v{G}}%
  10030. \DeclareUnicodeCharacter{01E7}{\v{g}}%
  10031. \DeclareUnicodeCharacter{01E8}{\v{K}}%
  10032. \DeclareUnicodeCharacter{01E9}{\v{k}}%
  10033. %
  10034. \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
  10035. \DeclareUnicodeCharacter{01F1}{DZ}%
  10036. \DeclareUnicodeCharacter{01F2}{Dz}%
  10037. \DeclareUnicodeCharacter{01F3}{dz}%
  10038. \DeclareUnicodeCharacter{01F4}{\'G}%
  10039. \DeclareUnicodeCharacter{01F5}{\'g}%
  10040. \DeclareUnicodeCharacter{01F8}{\`N}%
  10041. \DeclareUnicodeCharacter{01F9}{\`n}%
  10042. \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
  10043. \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
  10044. \DeclareUnicodeCharacter{01FE}{\'{\O}}%
  10045. \DeclareUnicodeCharacter{01FF}{\'{\o}}%
  10046. %
  10047. \DeclareUnicodeCharacter{021E}{\v{H}}%
  10048. \DeclareUnicodeCharacter{021F}{\v{h}}%
  10049. %
  10050. \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
  10051. \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
  10052. \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
  10053. \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
  10054. \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
  10055. \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
  10056. %
  10057. \DeclareUnicodeCharacter{0232}{\=Y}%
  10058. \DeclareUnicodeCharacter{0233}{\=y}%
  10059. \DeclareUnicodeCharacter{0237}{\dotless{j}}%
  10060. %
  10061. \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
  10062. %
  10063. % Greek letters upper case
  10064. \DeclareUnicodeCharacter{0391}{{\it A}}%
  10065. \DeclareUnicodeCharacter{0392}{{\it B}}%
  10066. \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
  10067. \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
  10068. \DeclareUnicodeCharacter{0395}{{\it E}}%
  10069. \DeclareUnicodeCharacter{0396}{{\it Z}}%
  10070. \DeclareUnicodeCharacter{0397}{{\it H}}%
  10071. \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
  10072. \DeclareUnicodeCharacter{0399}{{\it I}}%
  10073. \DeclareUnicodeCharacter{039A}{{\it K}}%
  10074. \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
  10075. \DeclareUnicodeCharacter{039C}{{\it M}}%
  10076. \DeclareUnicodeCharacter{039D}{{\it N}}%
  10077. \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
  10078. \DeclareUnicodeCharacter{039F}{{\it O}}%
  10079. \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
  10080. \DeclareUnicodeCharacter{03A1}{{\it P}}%
  10081. %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
  10082. \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
  10083. \DeclareUnicodeCharacter{03A4}{{\it T}}%
  10084. \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
  10085. \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
  10086. \DeclareUnicodeCharacter{03A7}{{\it X}}%
  10087. \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
  10088. \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
  10089. %
  10090. % Vowels with accents
  10091. \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
  10092. \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
  10093. \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
  10094. \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
  10095. \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
  10096. \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
  10097. %
  10098. % Standalone accent
  10099. \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
  10100. %
  10101. % Greek letters lower case
  10102. \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
  10103. \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
  10104. \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
  10105. \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
  10106. \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
  10107. \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
  10108. \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
  10109. \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
  10110. \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
  10111. \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
  10112. \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
  10113. \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
  10114. \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
  10115. \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
  10116. \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
  10117. \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
  10118. \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
  10119. \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
  10120. \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
  10121. \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
  10122. \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
  10123. \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
  10124. \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
  10125. \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
  10126. \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
  10127. %
  10128. % More Greek vowels with accents
  10129. \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
  10130. \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
  10131. \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
  10132. \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
  10133. \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
  10134. %
  10135. % Variant Greek letters
  10136. \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
  10137. \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
  10138. \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
  10139. %
  10140. \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
  10141. \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
  10142. \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
  10143. \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
  10144. \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
  10145. \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
  10146. \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
  10147. \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
  10148. \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
  10149. \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
  10150. \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
  10151. \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
  10152. %
  10153. \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
  10154. \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
  10155. %
  10156. \DeclareUnicodeCharacter{1E20}{\=G}%
  10157. \DeclareUnicodeCharacter{1E21}{\=g}%
  10158. \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
  10159. \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
  10160. \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
  10161. \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
  10162. \DeclareUnicodeCharacter{1E26}{\"H}%
  10163. \DeclareUnicodeCharacter{1E27}{\"h}%
  10164. %
  10165. \DeclareUnicodeCharacter{1E30}{\'K}%
  10166. \DeclareUnicodeCharacter{1E31}{\'k}%
  10167. \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
  10168. \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
  10169. \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
  10170. \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
  10171. \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
  10172. \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
  10173. \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
  10174. \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
  10175. \DeclareUnicodeCharacter{1E3E}{\'M}%
  10176. \DeclareUnicodeCharacter{1E3F}{\'m}%
  10177. %
  10178. \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
  10179. \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
  10180. \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
  10181. \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
  10182. \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
  10183. \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
  10184. \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
  10185. \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
  10186. \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
  10187. \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
  10188. %
  10189. \DeclareUnicodeCharacter{1E54}{\'P}%
  10190. \DeclareUnicodeCharacter{1E55}{\'p}%
  10191. \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
  10192. \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
  10193. \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
  10194. \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
  10195. \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
  10196. \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
  10197. \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
  10198. \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
  10199. %
  10200. \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
  10201. \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
  10202. \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
  10203. \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
  10204. \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
  10205. \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
  10206. \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
  10207. \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
  10208. \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
  10209. \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
  10210. %
  10211. \DeclareUnicodeCharacter{1E7C}{\~V}%
  10212. \DeclareUnicodeCharacter{1E7D}{\~v}%
  10213. \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
  10214. \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
  10215. %
  10216. \DeclareUnicodeCharacter{1E80}{\`W}%
  10217. \DeclareUnicodeCharacter{1E81}{\`w}%
  10218. \DeclareUnicodeCharacter{1E82}{\'W}%
  10219. \DeclareUnicodeCharacter{1E83}{\'w}%
  10220. \DeclareUnicodeCharacter{1E84}{\"W}%
  10221. \DeclareUnicodeCharacter{1E85}{\"w}%
  10222. \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
  10223. \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
  10224. \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
  10225. \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
  10226. \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
  10227. \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
  10228. \DeclareUnicodeCharacter{1E8C}{\"X}%
  10229. \DeclareUnicodeCharacter{1E8D}{\"x}%
  10230. \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
  10231. \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
  10232. %
  10233. \DeclareUnicodeCharacter{1E90}{\^Z}%
  10234. \DeclareUnicodeCharacter{1E91}{\^z}%
  10235. \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
  10236. \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
  10237. \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
  10238. \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
  10239. \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
  10240. \DeclareUnicodeCharacter{1E97}{\"t}%
  10241. \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
  10242. \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
  10243. %
  10244. \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
  10245. \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
  10246. %
  10247. \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
  10248. \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
  10249. \DeclareUnicodeCharacter{1EBC}{\~E}%
  10250. \DeclareUnicodeCharacter{1EBD}{\~e}%
  10251. %
  10252. \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
  10253. \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
  10254. \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
  10255. \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
  10256. %
  10257. \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
  10258. \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
  10259. %
  10260. \DeclareUnicodeCharacter{1EF2}{\`Y}%
  10261. \DeclareUnicodeCharacter{1EF3}{\`y}%
  10262. \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
  10263. %
  10264. \DeclareUnicodeCharacter{1EF8}{\~Y}%
  10265. \DeclareUnicodeCharacter{1EF9}{\~y}%
  10266. %
  10267. % Punctuation
  10268. \DeclareUnicodeCharacter{2013}{--}%
  10269. \DeclareUnicodeCharacter{2014}{---}%
  10270. \DeclareUnicodeCharacter{2018}{\quoteleft}%
  10271. \DeclareUnicodeCharacter{2019}{\quoteright}%
  10272. \DeclareUnicodeCharacter{201A}{\quotesinglbase}%
  10273. \DeclareUnicodeCharacter{201C}{\quotedblleft}%
  10274. \DeclareUnicodeCharacter{201D}{\quotedblright}%
  10275. \DeclareUnicodeCharacter{201E}{\quotedblbase}%
  10276. \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
  10277. \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
  10278. \DeclareUnicodeCharacter{2022}{\bullet}%
  10279. \DeclareUnicodeCharacter{202F}{\thinspace}%
  10280. \DeclareUnicodeCharacter{2026}{\dots}%
  10281. \DeclareUnicodeCharacter{2039}{\guilsinglleft}%
  10282. \DeclareUnicodeCharacter{203A}{\guilsinglright}%
  10283. %
  10284. \DeclareUnicodeCharacter{20AC}{\euro}%
  10285. %
  10286. \DeclareUnicodeCharacter{2192}{\expansion}%
  10287. \DeclareUnicodeCharacter{21D2}{\result}%
  10288. %
  10289. % Mathematical symbols
  10290. \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
  10291. \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
  10292. \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
  10293. \DeclareUnicodeCharacter{2212}{\minus}%
  10294. \DeclareUnicodeCharacter{2217}{\ast}%
  10295. \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
  10296. \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
  10297. \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
  10298. \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
  10299. \DeclareUnicodeCharacter{2261}{\equiv}%
  10300. \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
  10301. \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
  10302. \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
  10303. \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
  10304. %
  10305. \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
  10306. \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
  10307. \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
  10308. \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
  10309. \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
  10310. \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
  10311. \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
  10312. \DeclareUnicodeCharacter{2127}{\ensuremath\mho}%
  10313. \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
  10314. \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
  10315. \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
  10316. \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
  10317. \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
  10318. \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
  10319. \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
  10320. \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
  10321. \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
  10322. \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
  10323. \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
  10324. \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
  10325. \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
  10326. \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
  10327. \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
  10328. \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}%
  10329. \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
  10330. \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
  10331. \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
  10332. \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
  10333. \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
  10334. \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
  10335. \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
  10336. \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
  10337. \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}%
  10338. \DeclareUnicodeCharacter{2201}{\ensuremath\complement}%
  10339. \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
  10340. \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
  10341. \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
  10342. \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
  10343. \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
  10344. \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
  10345. \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
  10346. \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
  10347. \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
  10348. \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
  10349. \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
  10350. \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
  10351. \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
  10352. \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
  10353. \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
  10354. \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
  10355. \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
  10356. \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
  10357. \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
  10358. \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
  10359. \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
  10360. \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
  10361. \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
  10362. \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
  10363. \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
  10364. \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
  10365. \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
  10366. \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
  10367. \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
  10368. \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
  10369. \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
  10370. \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
  10371. \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
  10372. \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}%
  10373. \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}%
  10374. \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
  10375. \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
  10376. \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
  10377. \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
  10378. \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
  10379. \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
  10380. \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
  10381. \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
  10382. \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
  10383. \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
  10384. \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
  10385. \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
  10386. \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
  10387. \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
  10388. \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}%
  10389. \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}%
  10390. \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
  10391. \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
  10392. \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
  10393. \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
  10394. \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
  10395. \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
  10396. \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
  10397. \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
  10398. \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
  10399. \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
  10400. \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
  10401. \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
  10402. \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
  10403. \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
  10404. %
  10405. \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}%
  10406. \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
  10407. \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
  10408. \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
  10409. \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
  10410. \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}%
  10411. \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
  10412. \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
  10413. \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
  10414. \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
  10415. \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
  10416. \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
  10417. \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
  10418. \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
  10419. \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
  10420. \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
  10421. \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
  10422. \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
  10423. \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
  10424. \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
  10425. \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
  10426. \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
  10427. \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
  10428. \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
  10429. \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
  10430. \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
  10431. \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
  10432. \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}%
  10433. \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
  10434. \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
  10435. \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
  10436. %
  10437. \global\mathchardef\checkmark="1370% actually the square root sign
  10438. \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
  10439. }% end of \unicodechardefs
  10440. % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
  10441. % It makes the setting that replace UTF-8 byte sequence.
  10442. \def\utfeightchardefs{%
  10443. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
  10444. \unicodechardefs
  10445. }
  10446. % Whether the active definitions of non-ASCII characters expand to
  10447. % non-active tokens with the same character code. This is used to
  10448. % write characters literally, instead of using active definitions for
  10449. % printing the correct glyphs.
  10450. \newif\ifpassthroughchars
  10451. \passthroughcharsfalse
  10452. % For native Unicode handling (XeTeX and LuaTeX),
  10453. % provide a definition macro to replace/pass-through a Unicode character
  10454. %
  10455. \def\DeclareUnicodeCharacterNative#1#2{%
  10456. \catcode"#1=\active
  10457. \def\dodeclareunicodecharacternative##1##2##3{%
  10458. \begingroup
  10459. \uccode`\~="##2\relax
  10460. \uppercase{\gdef~}{%
  10461. \ifpassthroughchars
  10462. ##1%
  10463. \else
  10464. ##3%
  10465. \fi
  10466. }
  10467. \endgroup
  10468. }
  10469. \begingroup
  10470. \uccode`\.="#1\relax
  10471. \uppercase{\def\UTFNativeTmp{.}}%
  10472. \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
  10473. \endgroup
  10474. }
  10475. % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
  10476. % It activates the setting that replaces Unicode characters.
  10477. \def\nativeunicodechardefs{%
  10478. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
  10479. \unicodechardefs
  10480. }
  10481. % For native Unicode handling (XeTeX and LuaTeX),
  10482. % make the character token expand
  10483. % to the sequences given in \unicodechardefs for printing.
  10484. \def\DeclareUnicodeCharacterNativeAtU#1#2{%
  10485. \def\UTFAtUTmp{#2}
  10486. \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
  10487. }
  10488. % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
  10489. \def\nativeunicodechardefsatu{%
  10490. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
  10491. \unicodechardefs
  10492. }
  10493. % US-ASCII character definitions.
  10494. \def\asciichardefs{% nothing need be done
  10495. \relax
  10496. }
  10497. % define all Unicode characters we know about, for the sake of @U.
  10498. \iftxinativeunicodecapable
  10499. \nativeunicodechardefsatu
  10500. \else
  10501. \utfeightchardefs
  10502. \fi
  10503. % Make non-ASCII characters printable again for compatibility with
  10504. % existing Texinfo documents that may use them, even without declaring a
  10505. % document encoding.
  10506. %
  10507. \setnonasciicharscatcode \other
  10508. \message{formatting,}
  10509. \newdimen\defaultparindent \defaultparindent = 15pt
  10510. \chapheadingskip = 15pt plus 4pt minus 2pt
  10511. \secheadingskip = 12pt plus 3pt minus 2pt
  10512. \subsecheadingskip = 9pt plus 2pt minus 2pt
  10513. % Prevent underfull vbox error messages.
  10514. \vbadness = 10000
  10515. % Don't be very finicky about underfull hboxes, either.
  10516. \hbadness = 6666
  10517. % Following George Bush, get rid of widows and orphans.
  10518. \widowpenalty=10000
  10519. \clubpenalty=10000
  10520. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  10521. % using an old version of TeX, don't do anything. We want the amount of
  10522. % stretch added to depend on the line length, hence the dependence on
  10523. % \hsize. We call this whenever the paper size is set.
  10524. %
  10525. \def\setemergencystretch{%
  10526. \ifx\emergencystretch\thisisundefined
  10527. % Allow us to assign to \emergencystretch anyway.
  10528. \def\emergencystretch{\dimen0}%
  10529. \else
  10530. \emergencystretch = .15\hsize
  10531. \fi
  10532. }
  10533. % Parameters in order: 1) textheight; 2) textwidth;
  10534. % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
  10535. % 7) physical page height; 8) physical page width.
  10536. %
  10537. % We also call \setleading{\textleading}, so the caller should define
  10538. % \textleading. The caller should also set \parskip.
  10539. %
  10540. \def\internalpagesizes#1#2#3#4#5#6#7#8{%
  10541. \voffset = #3\relax
  10542. \topskip = #6\relax
  10543. \splittopskip = \topskip
  10544. %
  10545. \vsize = #1\relax
  10546. \advance\vsize by \topskip
  10547. \outervsize = \vsize
  10548. \advance\outervsize by 2\topandbottommargin
  10549. \txipageheight = \vsize
  10550. %
  10551. \hsize = #2\relax
  10552. \outerhsize = \hsize
  10553. \advance\outerhsize by 0.5in
  10554. \txipagewidth = \hsize
  10555. %
  10556. \normaloffset = #4\relax
  10557. \bindingoffset = #5\relax
  10558. %
  10559. \ifpdf
  10560. \pdfpageheight #7\relax
  10561. \pdfpagewidth #8\relax
  10562. % if we don't reset these, they will remain at "1 true in" of
  10563. % whatever layout pdftex was dumped with.
  10564. \pdfhorigin = 1 true in
  10565. \pdfvorigin = 1 true in
  10566. \else
  10567. \ifx\XeTeXrevision\thisisundefined
  10568. \else
  10569. \pdfpageheight #7\relax
  10570. \pdfpagewidth #8\relax
  10571. % XeTeX does not have \pdfhorigin and \pdfvorigin.
  10572. \fi
  10573. \fi
  10574. %
  10575. \setleading{\textleading}
  10576. %
  10577. \parindent = \defaultparindent
  10578. \setemergencystretch
  10579. }
  10580. % @letterpaper (the default).
  10581. \def\letterpaper{{\globaldefs = 1
  10582. \parskip = 3pt plus 2pt minus 1pt
  10583. \textleading = 13.2pt
  10584. %
  10585. % If page is nothing but text, make it come out even.
  10586. \internalpagesizes{607.2pt}{6in}% that's 46 lines
  10587. {\voffset}{.25in}%
  10588. {\bindingoffset}{36pt}%
  10589. {11in}{8.5in}%
  10590. }}
  10591. % Use @smallbook to reset parameters for 7x9.25 trim size.
  10592. \def\smallbook{{\globaldefs = 1
  10593. \parskip = 2pt plus 1pt
  10594. \textleading = 12pt
  10595. %
  10596. \internalpagesizes{7.5in}{5in}%
  10597. {-.2in}{0in}%
  10598. {\bindingoffset}{16pt}%
  10599. {9.25in}{7in}%
  10600. %
  10601. \lispnarrowing = 0.3in
  10602. \tolerance = 700
  10603. \hfuzz = 1pt
  10604. \contentsrightmargin = 0pt
  10605. \defbodyindent = .5cm
  10606. }}
  10607. % Use @smallerbook to reset parameters for 6x9 trim size.
  10608. % (Just testing, parameters still in flux.)
  10609. \def\smallerbook{{\globaldefs = 1
  10610. \parskip = 1.5pt plus 1pt
  10611. \textleading = 12pt
  10612. %
  10613. \internalpagesizes{7.4in}{4.8in}%
  10614. {-.2in}{-.4in}%
  10615. {0pt}{14pt}%
  10616. {9in}{6in}%
  10617. %
  10618. \lispnarrowing = 0.25in
  10619. \tolerance = 700
  10620. \hfuzz = 1pt
  10621. \contentsrightmargin = 0pt
  10622. \defbodyindent = .4cm
  10623. }}
  10624. % Use @afourpaper to print on European A4 paper.
  10625. \def\afourpaper{{\globaldefs = 1
  10626. \parskip = 3pt plus 2pt minus 1pt
  10627. \textleading = 13.2pt
  10628. %
  10629. % Double-side printing via postscript on Laserjet 4050
  10630. % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  10631. % To change the settings for a different printer or situation, adjust
  10632. % \normaloffset until the front-side and back-side texts align. Then
  10633. % do the same for \bindingoffset. You can set these for testing in
  10634. % your texinfo source file like this:
  10635. % @tex
  10636. % \global\normaloffset = -6mm
  10637. % \global\bindingoffset = 10mm
  10638. % @end tex
  10639. \internalpagesizes{673.2pt}{160mm}% that's 51 lines
  10640. {\voffset}{\hoffset}%
  10641. {\bindingoffset}{44pt}%
  10642. {297mm}{210mm}%
  10643. %
  10644. \tolerance = 700
  10645. \hfuzz = 1pt
  10646. \contentsrightmargin = 0pt
  10647. \defbodyindent = 5mm
  10648. }}
  10649. % Use @afivepaper to print on European A5 paper.
  10650. % From romildo@urano.iceb.ufop.br, 2 July 2000.
  10651. % He also recommends making @example and @lisp be small.
  10652. \def\afivepaper{{\globaldefs = 1
  10653. \parskip = 2pt plus 1pt minus 0.1pt
  10654. \textleading = 12.5pt
  10655. %
  10656. \internalpagesizes{160mm}{120mm}%
  10657. {\voffset}{\hoffset}%
  10658. {\bindingoffset}{8pt}%
  10659. {210mm}{148mm}%
  10660. %
  10661. \lispnarrowing = 0.2in
  10662. \tolerance = 800
  10663. \hfuzz = 1.2pt
  10664. \contentsrightmargin = 0pt
  10665. \defbodyindent = 2mm
  10666. \tableindent = 12mm
  10667. }}
  10668. % A specific text layout, 24x15cm overall, intended for A4 paper.
  10669. \def\afourlatex{{\globaldefs = 1
  10670. \afourpaper
  10671. \internalpagesizes{237mm}{150mm}%
  10672. {\voffset}{4.6mm}%
  10673. {\bindingoffset}{7mm}%
  10674. {297mm}{210mm}%
  10675. %
  10676. % Must explicitly reset to 0 because we call \afourpaper.
  10677. \globaldefs = 0
  10678. }}
  10679. % Use @afourwide to print on A4 paper in landscape format.
  10680. \def\afourwide{{\globaldefs = 1
  10681. \afourpaper
  10682. \internalpagesizes{241mm}{165mm}%
  10683. {\voffset}{-2.95mm}%
  10684. {\bindingoffset}{7mm}%
  10685. {297mm}{210mm}%
  10686. \globaldefs = 0
  10687. }}
  10688. % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  10689. % Perhaps we should allow setting the margins, \topskip, \parskip,
  10690. % and/or leading, also. Or perhaps we should compute them somehow.
  10691. %
  10692. \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
  10693. \def\pagesizesyyy#1,#2,#3\finish{{%
  10694. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  10695. \globaldefs = 1
  10696. %
  10697. \parskip = 3pt plus 2pt minus 1pt
  10698. \setleading{\textleading}%
  10699. %
  10700. \dimen0 = #1\relax
  10701. \advance\dimen0 by \voffset
  10702. %
  10703. \dimen2 = \hsize
  10704. \advance\dimen2 by \normaloffset
  10705. %
  10706. \internalpagesizes{#1}{\hsize}%
  10707. {\voffset}{\normaloffset}%
  10708. {\bindingoffset}{44pt}%
  10709. {\dimen0}{\dimen2}%
  10710. }}
  10711. % Set default to letter.
  10712. %
  10713. \letterpaper
  10714. \message{and turning on texinfo input format.}
  10715. \def^^L{\par} % remove \outer, so ^L can appear in an @comment
  10716. % DEL is a comment character, in case @c does not suffice.
  10717. \catcode`\^^? = 14
  10718. % Define macros to output various characters with catcode for normal text.
  10719. \catcode`\"=\other \def\normaldoublequote{"}
  10720. \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
  10721. \catcode`\+=\other \def\normalplus{+}
  10722. \catcode`\<=\other \def\normalless{<}
  10723. \catcode`\>=\other \def\normalgreater{>}
  10724. \catcode`\^=\other \def\normalcaret{^}
  10725. \catcode`\_=\other \def\normalunderscore{_}
  10726. \catcode`\|=\other \def\normalverticalbar{|}
  10727. \catcode`\~=\other \def\normaltilde{~}
  10728. % This macro is used to make a character print one way in \tt
  10729. % (where it can probably be output as-is), and another way in other fonts,
  10730. % where something hairier probably needs to be done.
  10731. %
  10732. % #1 is what to print if we are indeed using \tt; #2 is what to print
  10733. % otherwise. Since all the Computer Modern typewriter fonts have zero
  10734. % interword stretch (and shrink), and it is reasonable to expect all
  10735. % typewriter fonts to have this, we can check that font parameter.
  10736. %
  10737. \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
  10738. % Same as above, but check for italic font. Actually this also catches
  10739. % non-italic slanted fonts since it is impossible to distinguish them from
  10740. % italic fonts. But since this is only used by $ and it uses \sl anyway
  10741. % this is not a problem.
  10742. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
  10743. % Set catcodes for Texinfo file
  10744. % Active characters for printing the wanted glyph.
  10745. % Most of these we simply print from the \tt font, but for some, we can
  10746. % use math or other variants that look better in normal text.
  10747. %
  10748. \catcode`\"=\active
  10749. \def\activedoublequote{{\tt\char34}}
  10750. \let"=\activedoublequote
  10751. \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
  10752. \chardef\hatchar=`\^
  10753. \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
  10754. \catcode`\_=\active
  10755. \def_{\ifusingtt\normalunderscore\_}
  10756. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
  10757. \let\realunder=_
  10758. \catcode`\|=\active \def|{{\tt\char124}}
  10759. \chardef \less=`\<
  10760. \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
  10761. \chardef \gtr=`\>
  10762. \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
  10763. \catcode`\+=\active \def+{{\tt \char 43}}
  10764. \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  10765. \catcode`\-=\active \let-=\normaldash
  10766. % used for headline/footline in the output routine, in case the page
  10767. % breaks in the middle of an @tex block.
  10768. \def\texinfochars{%
  10769. \let< = \activeless
  10770. \let> = \activegtr
  10771. \let~ = \activetilde
  10772. \let^ = \activehat
  10773. \markupsetuplqdefault \markupsetuprqdefault
  10774. \let\b = \strong
  10775. \let\i = \smartitalic
  10776. % in principle, all other definitions in \tex have to be undone too.
  10777. }
  10778. % Used sometimes to turn off (effectively) the active characters even after
  10779. % parsing them.
  10780. \def\turnoffactive{%
  10781. \normalturnoffactive
  10782. \otherbackslash
  10783. }
  10784. \catcode`\@=0
  10785. % \backslashcurfont outputs one backslash character in current font,
  10786. % as in \char`\\.
  10787. \global\chardef\backslashcurfont=`\\
  10788. \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
  10789. % \realbackslash is an actual character `\' with catcode other, and
  10790. % \doublebackslash is two of them (for the pdf outlines).
  10791. {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
  10792. % In Texinfo, backslash is an active character; it prints the backslash
  10793. % in fixed width font.
  10794. \catcode`\\=\active % @ for escape char from now on.
  10795. % Print a typewriter backslash. For math mode, we can't simply use
  10796. % \backslashcurfont: the story here is that in math mode, the \char
  10797. % of \backslashcurfont ends up printing the roman \ from the math symbol
  10798. % font (because \char in math mode uses the \mathcode, and plain.tex
  10799. % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
  10800. % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
  10801. % ignored family value; char position "5C). We can't use " for the
  10802. % usual hex value because it has already been made active.
  10803. @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
  10804. @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
  10805. % \rawbackslash defines an active \ to do \backslashcurfont.
  10806. % \otherbackslash defines an active \ to be a literal `\' character with
  10807. % catcode other. We switch back and forth between these.
  10808. @gdef@rawbackslash{@let\=@backslashcurfont}
  10809. @gdef@otherbackslash{@let\=@realbackslash}
  10810. % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  10811. % the literal character `\'.
  10812. %
  10813. {@catcode`- = @active
  10814. @gdef@normalturnoffactive{%
  10815. @passthroughcharstrue
  10816. @let-=@normaldash
  10817. @let"=@normaldoublequote
  10818. @let$=@normaldollar %$ font-lock fix
  10819. @let+=@normalplus
  10820. @let<=@normalless
  10821. @let>=@normalgreater
  10822. @let^=@normalcaret
  10823. @let_=@normalunderscore
  10824. @let|=@normalverticalbar
  10825. @let~=@normaltilde
  10826. @let\=@ttbackslash
  10827. @markupsetuplqdefault
  10828. @markupsetuprqdefault
  10829. @unsepspaces
  10830. }
  10831. }
  10832. % If a .fmt file is being used, characters that might appear in a file
  10833. % name cannot be active until we have parsed the command line.
  10834. % So turn them off again, and have @fixbackslash turn them back on.
  10835. @catcode`+=@other @catcode`@_=@other
  10836. % \enablebackslashhack - allow file to begin `\input texinfo'
  10837. %
  10838. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  10839. % That is what \eatinput is for; after that, the `\' should revert to printing
  10840. % a backslash.
  10841. % If the file did not have a `\input texinfo', then it is turned off after
  10842. % the first line; otherwise the first `\' in the file would cause an error.
  10843. % This is used on the very last line of this file, texinfo.tex.
  10844. % We also use @c to call @fixbackslash, in case ends of lines are hidden.
  10845. {
  10846. @catcode`@^=7
  10847. @catcode`@^^M=13@gdef@enablebackslashhack{%
  10848. @global@let\ = @eatinput%
  10849. @catcode`@^^M=13%
  10850. @def@c{@fixbackslash@c}%
  10851. % Definition for the newline at the end of this file.
  10852. @def ^^M{@let^^M@secondlinenl}%
  10853. % Definition for a newline in the main Texinfo file.
  10854. @gdef @secondlinenl{@fixbackslash}%
  10855. }}
  10856. {@catcode`@^=7 @catcode`@^^M=13%
  10857. @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
  10858. % Emergency active definition of newline, in case an active newline token
  10859. % appears by mistake.
  10860. {@catcode`@^=7 @catcode13=13%
  10861. @gdef@enableemergencynewline{%
  10862. @gdef^^M{%
  10863. @par%
  10864. %<warning: active newline>@par%
  10865. }}}
  10866. @gdef@fixbackslash{%
  10867. @ifx\@eatinput @let\ = @ttbackslash @fi
  10868. @catcode13=5 % regular end of line
  10869. @enableemergencynewline
  10870. @let@c=@texinfoc
  10871. % Also turn back on active characters that might appear in the input
  10872. % file name, in case not using a pre-dumped format.
  10873. @catcode`+=@active
  10874. @catcode`@_=@active
  10875. %
  10876. % If texinfo.cnf is present on the system, read it.
  10877. % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
  10878. % called at the beginning of every Texinfo file. Not opening texinfo.cnf
  10879. % directly in this file, texinfo.tex, makes it possible to make a format
  10880. % file for Texinfo.
  10881. %
  10882. @openin 1 texinfo.cnf
  10883. @ifeof 1 @else @input texinfo.cnf @fi
  10884. @closein 1
  10885. }
  10886. % Say @foo, not \foo, in error messages.
  10887. @escapechar = `@@
  10888. % These (along with & and #) are made active for url-breaking, so need
  10889. % active definitions as the normal characters.
  10890. @def@normaldot{.}
  10891. @def@normalquest{?}
  10892. @def@normalslash{/}
  10893. % These look ok in all fonts, so just make them not special.
  10894. % @hashchar{} gets its own user-level command, because of #line.
  10895. @catcode`@& = @other @def@normalamp{&}
  10896. @catcode`@# = @other @def@normalhash{#}
  10897. @catcode`@% = @other @def@normalpercent{%}
  10898. @let @hashchar = @normalhash
  10899. @c Finally, make ` and ' active, so that txicodequoteundirected and
  10900. @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
  10901. @c don't make ` and ' active, @code will not get them as active chars.
  10902. @c Do this last of all since we use ` in the previous @catcode assignments.
  10903. @catcode`@'=@active
  10904. @catcode`@`=@active
  10905. @markupsetuplqdefault
  10906. @markupsetuprqdefault
  10907. @c Local variables:
  10908. @c eval: (add-hook 'write-file-hooks 'time-stamp)
  10909. @c page-delimiter: "^\\\\message\\|emacs-page"
  10910. @c time-stamp-start: "def\\\\texinfoversion{"
  10911. @c time-stamp-format: "%:y-%02m-%02d.%02H"
  10912. @c time-stamp-end: "}"
  10913. @c End:
  10914. @c vim:sw=2:
  10915. @ignore
  10916. arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
  10917. @end ignore
  10918. @enablebackslashhack