texinfo.tex 373 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727
  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{2018-01-09.11}
  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, 2017, 2018
  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 <https://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. % https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
  34. % https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
  35. % https://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 https://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. % Likewise for ^^M, the end of line character.
  157. \def\endlineisspace{\catcode13=10\relax}
  158. \chardef\dashChar = `\-
  159. \chardef\slashChar = `\/
  160. \chardef\underChar = `\_
  161. % Ignore a token.
  162. %
  163. \def\gobble#1{}
  164. % The following is used inside several \edef's.
  165. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
  166. % Hyphenation fixes.
  167. \hyphenation{
  168. Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
  169. ap-pen-dix bit-map bit-maps
  170. data-base data-bases eshell fall-ing half-way long-est man-u-script
  171. man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
  172. par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
  173. spell-ing spell-ings
  174. stand-alone strong-est time-stamp time-stamps which-ever white-space
  175. wide-spread wrap-around
  176. }
  177. % Sometimes it is convenient to have everything in the transcript file
  178. % and nothing on the terminal. We don't just call \tracingall here,
  179. % since that produces some useless output on the terminal. We also make
  180. % some effort to order the tracing commands to reduce output in the log
  181. % file; cf. trace.sty in LaTeX.
  182. %
  183. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  184. \def\loggingall{%
  185. \tracingstats2
  186. \tracingpages1
  187. \tracinglostchars2 % 2 gives us more in etex
  188. \tracingparagraphs1
  189. \tracingoutput1
  190. \tracingmacros2
  191. \tracingrestores1
  192. \showboxbreadth\maxdimen \showboxdepth\maxdimen
  193. \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
  194. \tracingscantokens1
  195. \tracingifs1
  196. \tracinggroups1
  197. \tracingnesting2
  198. \tracingassigns1
  199. \fi
  200. \tracingcommands3 % 3 gives us more in etex
  201. \errorcontextlines16
  202. }%
  203. % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
  204. % aren't perfect, it's not the end of the world, being an error message,
  205. % after all.
  206. %
  207. \def\errormsg{\begingroup \indexnofonts \doerrormsg}
  208. \def\doerrormsg#1{\errmessage{#1}}
  209. % add check for \lastpenalty to plain's definitions. If the last thing
  210. % we did was a \nobreak, we don't want to insert more space.
  211. %
  212. \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  213. \removelastskip\penalty-50\smallskip\fi\fi}
  214. \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  215. \removelastskip\penalty-100\medskip\fi\fi}
  216. \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  217. \removelastskip\penalty-200\bigskip\fi\fi}
  218. % Output routine
  219. %
  220. % For a final copy, take out the rectangles
  221. % that mark overfull boxes (in case you have decided
  222. % that the text looks ok even though it passes the margin).
  223. %
  224. \def\finalout{\overfullrule=0pt }
  225. % Do @cropmarks to get crop marks.
  226. %
  227. \newif\ifcropmarks
  228. \let\cropmarks = \cropmarkstrue
  229. %
  230. % Dimensions to add cropmarks at corners.
  231. % Added by P. A. MacKay, 12 Nov. 1986
  232. %
  233. \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  234. \newdimen\cornerlong \cornerlong=1pc
  235. \newdimen\cornerthick \cornerthick=.3pt
  236. \newdimen\topandbottommargin \topandbottommargin=.75in
  237. % Output a mark which sets \thischapter, \thissection and \thiscolor.
  238. % We dump everything together because we only have one kind of mark.
  239. % This works because we only use \botmark / \topmark, not \firstmark.
  240. %
  241. % A mark contains a subexpression of the \ifcase ... \fi construct.
  242. % \get*marks macros below extract the needed part using \ifcase.
  243. %
  244. % Another complication is to let the user choose whether \thischapter
  245. % (\thissection) refers to the chapter (section) in effect at the top
  246. % of a page, or that at the bottom of a page.
  247. % \domark is called twice inside \chapmacro, to add one
  248. % mark before the section break, and one after.
  249. % In the second call \prevchapterdefs is the same as \lastchapterdefs,
  250. % and \prevsectiondefs is the same as \lastsectiondefs.
  251. % Then if the page is not broken at the mark, some of the previous
  252. % section appears on the page, and we can get the name of this section
  253. % from \firstmark for @everyheadingmarks top.
  254. % @everyheadingmarks bottom uses \botmark.
  255. %
  256. % See page 260 of The TeXbook.
  257. \def\domark{%
  258. \toks0=\expandafter{\lastchapterdefs}%
  259. \toks2=\expandafter{\lastsectiondefs}%
  260. \toks4=\expandafter{\prevchapterdefs}%
  261. \toks6=\expandafter{\prevsectiondefs}%
  262. \toks8=\expandafter{\lastcolordefs}%
  263. \mark{%
  264. \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
  265. \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
  266. \noexpand\else \the\toks8 % 2: color marks
  267. }%
  268. }
  269. % \gettopheadingmarks, \getbottomheadingmarks,
  270. % \getcolormarks - extract needed part of mark.
  271. %
  272. % \topmark doesn't work for the very first chapter (after the title
  273. % page or the contents), so we use \firstmark there -- this gets us
  274. % the mark with the chapter defs, unless the user sneaks in, e.g.,
  275. % @setcolor (or @url, or @link, etc.) between @contents and the very
  276. % first @chapter.
  277. \def\gettopheadingmarks{%
  278. \ifcase0\topmark\fi
  279. \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
  280. }
  281. \def\getbottomheadingmarks{\ifcase1\botmark\fi}
  282. \def\getcolormarks{\ifcase2\topmark\fi}
  283. % Avoid "undefined control sequence" errors.
  284. \def\lastchapterdefs{}
  285. \def\lastsectiondefs{}
  286. \def\lastsection{}
  287. \def\prevchapterdefs{}
  288. \def\prevsectiondefs{}
  289. \def\lastcolordefs{}
  290. % Margin to add to right of even pages, to left of odd pages.
  291. \newdimen\bindingoffset
  292. \newdimen\normaloffset
  293. \newdimen\txipagewidth \newdimen\txipageheight
  294. % Main output routine.
  295. %
  296. \chardef\PAGE = 255
  297. \output = {\onepageout{\pagecontents\PAGE}}
  298. \newbox\headlinebox
  299. \newbox\footlinebox
  300. % \onepageout takes a vbox as an argument.
  301. % \shipout a vbox for a single page, adding an optional header, footer,
  302. % cropmarks, and footnote. This also causes index entries for this page
  303. % to be written to the auxiliary files.
  304. %
  305. \def\onepageout#1{%
  306. \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  307. %
  308. \ifodd\pageno \advance\hoffset by \bindingoffset
  309. \else \advance\hoffset by -\bindingoffset\fi
  310. %
  311. % Common context changes for both heading and footing.
  312. % Do this outside of the \shipout so @code etc. will be expanded in
  313. % the headline as they should be, not taken literally (outputting ''code).
  314. \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
  315. %
  316. % Retrieve the information for the headings from the marks in the page,
  317. % and call Plain TeX's \makeheadline and \makefootline, which use the
  318. % values in \headline and \footline.
  319. %
  320. % This is used to check if we are on the first page of a chapter.
  321. \ifcase1\topmark\fi
  322. \let\prevchaptername\thischaptername
  323. \ifcase0\firstmark\fi
  324. \let\curchaptername\thischaptername
  325. %
  326. \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
  327. \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
  328. %
  329. \ifx\curchaptername\prevchaptername
  330. \let\thischapterheading\thischapter
  331. \else
  332. % \thischapterheading is the same as \thischapter except it is blank
  333. % for the first page of a chapter. This is to prevent the chapter name
  334. % being shown twice.
  335. \def\thischapterheading{}%
  336. \fi
  337. %
  338. \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
  339. \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
  340. %
  341. {%
  342. % Set context for writing to auxiliary files like index files.
  343. % Have to do this stuff outside the \shipout because we want it to
  344. % take effect in \write's, yet the group defined by the \vbox ends
  345. % before the \shipout runs.
  346. %
  347. \indexdummies % don't expand commands in the output.
  348. \normalturnoffactive % \ in index entries must not stay \, e.g., if
  349. % the page break happens to be in the middle of an example.
  350. % We don't want .vr (or whatever) entries like this:
  351. % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
  352. % "\acronym" won't work when it's read back in;
  353. % it needs to be
  354. % {\code {{\backslashcurfont }acronym}
  355. \shipout\vbox{%
  356. % Do this early so pdf references go to the beginning of the page.
  357. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
  358. %
  359. \ifcropmarks \vbox to \outervsize\bgroup
  360. \hsize = \outerhsize
  361. \vskip-\topandbottommargin
  362. \vtop to0pt{%
  363. \line{\ewtop\hfil\ewtop}%
  364. \nointerlineskip
  365. \line{%
  366. \vbox{\moveleft\cornerthick\nstop}%
  367. \hfill
  368. \vbox{\moveright\cornerthick\nstop}%
  369. }%
  370. \vss}%
  371. \vskip\topandbottommargin
  372. \line\bgroup
  373. \hfil % center the page within the outer (page) hsize.
  374. \ifodd\pageno\hskip\bindingoffset\fi
  375. \vbox\bgroup
  376. \fi
  377. %
  378. \unvbox\headlinebox
  379. \pagebody{#1}%
  380. \ifdim\ht\footlinebox > 0pt
  381. % Only leave this space if the footline is nonempty.
  382. % (We lessened \vsize for it in \oddfootingyyy.)
  383. % The \baselineskip=24pt in plain's \makefootline has no effect.
  384. \vskip 24pt
  385. \unvbox\footlinebox
  386. \fi
  387. %
  388. \ifcropmarks
  389. \egroup % end of \vbox\bgroup
  390. \hfil\egroup % end of (centering) \line\bgroup
  391. \vskip\topandbottommargin plus1fill minus1fill
  392. \boxmaxdepth = \cornerthick
  393. \vbox to0pt{\vss
  394. \line{%
  395. \vbox{\moveleft\cornerthick\nsbot}%
  396. \hfill
  397. \vbox{\moveright\cornerthick\nsbot}%
  398. }%
  399. \nointerlineskip
  400. \line{\ewbot\hfil\ewbot}%
  401. }%
  402. \egroup % \vbox from first cropmarks clause
  403. \fi
  404. }% end of \shipout\vbox
  405. }% end of group with \indexdummies
  406. \advancepageno
  407. \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  408. }
  409. \newinsert\margin \dimen\margin=\maxdimen
  410. % Main part of page, including any footnotes
  411. \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
  412. {\catcode`\@ =11
  413. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  414. % marginal hacks, juha@viisa.uucp (Juha Takala)
  415. \ifvoid\margin\else % marginal info is present
  416. \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  417. \dimen@=\dp#1\relax \unvbox#1\relax
  418. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  419. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  420. }
  421. % Here are the rules for the cropmarks. Note that they are
  422. % offset so that the space between them is truly \outerhsize or \outervsize
  423. % (P. A. MacKay, 12 November, 1986)
  424. %
  425. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  426. \def\nstop{\vbox
  427. {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  428. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  429. \def\nsbot{\vbox
  430. {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  431. % Argument parsing
  432. % Parse an argument, then pass it to #1. The argument is the rest of
  433. % the input line (except we remove a trailing comment). #1 should be a
  434. % macro which expects an ordinary undelimited TeX argument.
  435. % For example, \def\foo{\parsearg\fooxxx}.
  436. %
  437. \def\parsearg{\parseargusing{}}
  438. \def\parseargusing#1#2{%
  439. \def\argtorun{#2}%
  440. \begingroup
  441. \obeylines
  442. \spaceisspace
  443. #1%
  444. \parseargline\empty% Insert the \empty token, see \finishparsearg below.
  445. }
  446. {\obeylines %
  447. \gdef\parseargline#1^^M{%
  448. \endgroup % End of the group started in \parsearg.
  449. \argremovecomment #1\comment\ArgTerm%
  450. }%
  451. }
  452. % First remove any @comment, then any @c comment. Also remove a @texinfoc
  453. % comment (see \scanmacro for details). Pass the result on to \argcheckspaces.
  454. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
  455. \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
  456. \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
  457. % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
  458. %
  459. % \argremovec might leave us with trailing space, e.g.,
  460. % @end itemize @c foo
  461. % This space token undergoes the same procedure and is eventually removed
  462. % by \finishparsearg.
  463. %
  464. \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
  465. \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
  466. \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
  467. \def\temp{#3}%
  468. \ifx\temp\empty
  469. % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
  470. \let\temp\finishparsearg
  471. \else
  472. \let\temp\argcheckspaces
  473. \fi
  474. % Put the space token in:
  475. \temp#1 #3\ArgTerm
  476. }
  477. % If a _delimited_ argument is enclosed in braces, they get stripped; so
  478. % to get _exactly_ the rest of the line, we had to prevent such situation.
  479. % We prepended an \empty token at the very beginning and we expand it now,
  480. % just before passing the control to \argtorun.
  481. % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
  482. % either the null string, or it ends with \^^M---thus there is no danger
  483. % that a pair of braces would be stripped.
  484. %
  485. % But first, we have to remove the trailing space token.
  486. %
  487. \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
  488. % \parseargdef - define a command taking an argument on the line
  489. %
  490. % \parseargdef\foo{...}
  491. % is roughly equivalent to
  492. % \def\foo{\parsearg\Xfoo}
  493. % \def\Xfoo#1{...}
  494. \def\parseargdef#1{%
  495. \expandafter \doparseargdef \csname\string#1\endcsname #1%
  496. }
  497. \def\doparseargdef#1#2{%
  498. \def#2{\parsearg#1}%
  499. \def#1##1%
  500. }
  501. % Several utility definitions with active space:
  502. {
  503. \obeyspaces
  504. \gdef\obeyedspace{ }
  505. % Make each space character in the input produce a normal interword
  506. % space in the output. Don't allow a line break at this space, as this
  507. % is used only in environments like @example, where each line of input
  508. % should produce a line of output anyway.
  509. %
  510. \gdef\sepspaces{\obeyspaces\let =\tie}
  511. % If an index command is used in an @example environment, any spaces
  512. % therein should become regular spaces in the raw index file, not the
  513. % expansion of \tie (\leavevmode \penalty \@M \ ).
  514. \gdef\unsepspaces{\let =\space}
  515. }
  516. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  517. % Define the framework for environments in texinfo.tex. It's used like this:
  518. %
  519. % \envdef\foo{...}
  520. % \def\Efoo{...}
  521. %
  522. % It's the responsibility of \envdef to insert \begingroup before the
  523. % actual body; @end closes the group after calling \Efoo. \envdef also
  524. % defines \thisenv, so the current environment is known; @end checks
  525. % whether the environment name matches. The \checkenv macro can also be
  526. % used to check whether the current environment is the one expected.
  527. %
  528. % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
  529. % are not treated as environments; they don't open a group. (The
  530. % implementation of @end takes care not to call \endgroup in this
  531. % special case.)
  532. % At run-time, environments start with this:
  533. \def\startenvironment#1{\begingroup\def\thisenv{#1}}
  534. % initialize
  535. \let\thisenv\empty
  536. % ... but they get defined via ``\envdef\foo{...}'':
  537. \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
  538. \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
  539. % Check whether we're in the right environment:
  540. \def\checkenv#1{%
  541. \def\temp{#1}%
  542. \ifx\thisenv\temp
  543. \else
  544. \badenverr
  545. \fi
  546. }
  547. % Environment mismatch, #1 expected:
  548. \def\badenverr{%
  549. \errhelp = \EMsimple
  550. \errmessage{This command can appear only \inenvironment\temp,
  551. not \inenvironment\thisenv}%
  552. }
  553. \def\inenvironment#1{%
  554. \ifx#1\empty
  555. outside of any environment%
  556. \else
  557. in environment \expandafter\string#1%
  558. \fi
  559. }
  560. % @end foo executes the definition of \Efoo.
  561. % But first, it executes a specialized version of \checkenv
  562. %
  563. \parseargdef\end{%
  564. \if 1\csname iscond.#1\endcsname
  565. \else
  566. % The general wording of \badenverr may not be ideal.
  567. \expandafter\checkenv\csname#1\endcsname
  568. \csname E#1\endcsname
  569. \endgroup
  570. \fi
  571. }
  572. \newhelp\EMsimple{Press RETURN to continue.}
  573. % Be sure we're in horizontal mode when doing a tie, since we make space
  574. % equivalent to this in @example-like environments. Otherwise, a space
  575. % at the beginning of a line will start with \penalty -- and
  576. % since \penalty is valid in vertical mode, we'd end up putting the
  577. % penalty on the vertical list instead of in the new paragraph.
  578. {\catcode`@ = 11
  579. % Avoid using \@M directly, because that causes trouble
  580. % if the definition is written into an index file.
  581. \global\let\tiepenalty = \@M
  582. \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  583. }
  584. % @: forces normal size whitespace following.
  585. \def\:{\spacefactor=1000 }
  586. % @* forces a line break.
  587. \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
  588. % @/ allows a line break.
  589. \let\/=\allowbreak
  590. % @. is an end-of-sentence period.
  591. \def\.{.\spacefactor=\endofsentencespacefactor\space}
  592. % @! is an end-of-sentence bang.
  593. \def\!{!\spacefactor=\endofsentencespacefactor\space}
  594. % @? is an end-of-sentence query.
  595. \def\?{?\spacefactor=\endofsentencespacefactor\space}
  596. % @frenchspacing on|off says whether to put extra space after punctuation.
  597. %
  598. \def\onword{on}
  599. \def\offword{off}
  600. %
  601. \parseargdef\frenchspacing{%
  602. \def\temp{#1}%
  603. \ifx\temp\onword \plainfrenchspacing
  604. \else\ifx\temp\offword \plainnonfrenchspacing
  605. \else
  606. \errhelp = \EMsimple
  607. \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
  608. \fi\fi
  609. }
  610. % @w prevents a word break. Without the \leavevmode, @w at the
  611. % beginning of a paragraph, when TeX is still in vertical mode, would
  612. % produce a whole line of output instead of starting the paragraph.
  613. \def\w#1{\leavevmode\hbox{#1}}
  614. % @group ... @end group forces ... to be all on one page, by enclosing
  615. % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
  616. % to keep its height that of a normal line. According to the rules for
  617. % \topskip (p.114 of the TeXbook), the glue inserted is
  618. % max (\topskip - \ht (first item), 0). If that height is large,
  619. % therefore, no glue is inserted, and the space between the headline and
  620. % the text is small, which looks bad.
  621. %
  622. % Another complication is that the group might be very large. This can
  623. % cause the glue on the previous page to be unduly stretched, because it
  624. % does not have much material. In this case, it's better to add an
  625. % explicit \vfill so that the extra space is at the bottom. The
  626. % threshold for doing this is if the group is more than \vfilllimit
  627. % percent of a page (\vfilllimit can be changed inside of @tex).
  628. %
  629. \newbox\groupbox
  630. \def\vfilllimit{0.7}
  631. %
  632. \envdef\group{%
  633. \ifnum\catcode`\^^M=\active \else
  634. \errhelp = \groupinvalidhelp
  635. \errmessage{@group invalid in context where filling is enabled}%
  636. \fi
  637. \startsavinginserts
  638. %
  639. \setbox\groupbox = \vtop\bgroup
  640. % Do @comment since we are called inside an environment such as
  641. % @example, where each end-of-line in the input causes an
  642. % end-of-line in the output. We don't want the end-of-line after
  643. % the `@group' to put extra space in the output. Since @group
  644. % should appear on a line by itself (according to the Texinfo
  645. % manual), we don't worry about eating any user text.
  646. \comment
  647. }
  648. %
  649. % The \vtop produces a box with normal height and large depth; thus, TeX puts
  650. % \baselineskip glue before it, and (when the next line of text is done)
  651. % \lineskip glue after it. Thus, space below is not quite equal to space
  652. % above. But it's pretty close.
  653. \def\Egroup{%
  654. % To get correct interline space between the last line of the group
  655. % and the first line afterwards, we have to propagate \prevdepth.
  656. \endgraf % Not \par, as it may have been set to \lisppar.
  657. \global\dimen1 = \prevdepth
  658. \egroup % End the \vtop.
  659. \addgroupbox
  660. \prevdepth = \dimen1
  661. \checkinserts
  662. }
  663. \def\addgroupbox{
  664. % \dimen0 is the vertical size of the group's box.
  665. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
  666. % \dimen2 is how much space is left on the page (more or less).
  667. \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
  668. % if the group doesn't fit on the current page, and it's a big big
  669. % group, force a page break.
  670. \ifdim \dimen0 > \dimen2
  671. \ifdim \pagetotal < \vfilllimit\txipageheight
  672. \page
  673. \fi
  674. \fi
  675. \box\groupbox
  676. }
  677. %
  678. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  679. % message, so this ends up printing `@group can only ...'.
  680. %
  681. \newhelp\groupinvalidhelp{%
  682. group can only be used in environments such as @example,^^J%
  683. where each line of input produces a line of output.}
  684. % @need space-in-mils
  685. % forces a page break if there is not space-in-mils remaining.
  686. \newdimen\mil \mil=0.001in
  687. \parseargdef\need{%
  688. % Ensure vertical mode, so we don't make a big box in the middle of a
  689. % paragraph.
  690. \par
  691. %
  692. % If the @need value is less than one line space, it's useless.
  693. \dimen0 = #1\mil
  694. \dimen2 = \ht\strutbox
  695. \advance\dimen2 by \dp\strutbox
  696. \ifdim\dimen0 > \dimen2
  697. %
  698. % Do a \strut just to make the height of this box be normal, so the
  699. % normal leading is inserted relative to the preceding line.
  700. % And a page break here is fine.
  701. \vtop to #1\mil{\strut\vfil}%
  702. %
  703. % TeX does not even consider page breaks if a penalty added to the
  704. % main vertical list is 10000 or more. But in order to see if the
  705. % empty box we just added fits on the page, we must make it consider
  706. % page breaks. On the other hand, we don't want to actually break the
  707. % page after the empty box. So we use a penalty of 9999.
  708. %
  709. % There is an extremely small chance that TeX will actually break the
  710. % page at this \penalty, if there are no other feasible breakpoints in
  711. % sight. (If the user is using lots of big @group commands, which
  712. % almost-but-not-quite fill up a page, TeX will have a hard time doing
  713. % good page breaking, for example.) However, I could not construct an
  714. % example where a page broke at this \penalty; if it happens in a real
  715. % document, then we can reconsider our strategy.
  716. \penalty9999
  717. %
  718. % Back up by the size of the box, whether we did a page break or not.
  719. \kern -#1\mil
  720. %
  721. % Do not allow a page break right after this kern.
  722. \nobreak
  723. \fi
  724. }
  725. % @br forces paragraph break (and is undocumented).
  726. \let\br = \par
  727. % @page forces the start of a new page.
  728. %
  729. \def\page{\par\vfill\supereject}
  730. % @exdent text....
  731. % outputs text on separate line in roman font, starting at standard page margin
  732. % This records the amount of indent in the innermost environment.
  733. % That's how much \exdent should take out.
  734. \newskip\exdentamount
  735. % This defn is used inside fill environments such as @defun.
  736. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
  737. % This defn is used inside nofill environments such as @example.
  738. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
  739. \leftline{\hskip\leftskip{\rm#1}}}}
  740. % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
  741. % paragraph. For more general purposes, use the \margin insertion
  742. % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
  743. %
  744. \newskip\inmarginspacing \inmarginspacing=1cm
  745. \def\strutdepth{\dp\strutbox}
  746. %
  747. \def\doinmargin#1#2{\strut\vadjust{%
  748. \nobreak
  749. \kern-\strutdepth
  750. \vtop to \strutdepth{%
  751. \baselineskip=\strutdepth
  752. \vss
  753. % if you have multiple lines of stuff to put here, you'll need to
  754. % make the vbox yourself of the appropriate size.
  755. \ifx#1l%
  756. \llap{\ignorespaces #2\hskip\inmarginspacing}%
  757. \else
  758. \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
  759. \fi
  760. \null
  761. }%
  762. }}
  763. \def\inleftmargin{\doinmargin l}
  764. \def\inrightmargin{\doinmargin r}
  765. %
  766. % @inmargin{TEXT [, RIGHT-TEXT]}
  767. % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  768. % else use TEXT for both).
  769. %
  770. \def\inmargin#1{\parseinmargin #1,,\finish}
  771. \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  772. \setbox0 = \hbox{\ignorespaces #2}%
  773. \ifdim\wd0 > 0pt
  774. \def\lefttext{#1}% have both texts
  775. \def\righttext{#2}%
  776. \else
  777. \def\lefttext{#1}% have only one text
  778. \def\righttext{#1}%
  779. \fi
  780. %
  781. \ifodd\pageno
  782. \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  783. \else
  784. \def\temp{\inleftmargin\lefttext}%
  785. \fi
  786. \temp
  787. }
  788. % @include FILE -- \input text of FILE.
  789. %
  790. \def\include{\parseargusing\filenamecatcodes\includezzz}
  791. \def\includezzz#1{%
  792. \pushthisfilestack
  793. \def\thisfile{#1}%
  794. {%
  795. \makevalueexpandable % we want to expand any @value in FILE.
  796. \turnoffactive % and allow special characters in the expansion
  797. \indexnofonts % Allow `@@' and other weird things in file names.
  798. \wlog{texinfo.tex: doing @include of #1^^J}%
  799. \edef\temp{\noexpand\input #1 }%
  800. %
  801. % This trickery is to read FILE outside of a group, in case it makes
  802. % definitions, etc.
  803. \expandafter
  804. }\temp
  805. \popthisfilestack
  806. }
  807. \def\filenamecatcodes{%
  808. \catcode`\\=\other
  809. \catcode`~=\other
  810. \catcode`^=\other
  811. \catcode`_=\other
  812. \catcode`|=\other
  813. \catcode`<=\other
  814. \catcode`>=\other
  815. \catcode`+=\other
  816. \catcode`-=\other
  817. \catcode`\`=\other
  818. \catcode`\'=\other
  819. }
  820. \def\pushthisfilestack{%
  821. \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
  822. }
  823. \def\pushthisfilestackX{%
  824. \expandafter\pushthisfilestackY\thisfile\StackTerm
  825. }
  826. \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
  827. \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
  828. }
  829. \def\popthisfilestack{\errthisfilestackempty}
  830. \def\errthisfilestackempty{\errmessage{Internal error:
  831. the stack of filenames is empty.}}
  832. %
  833. \def\thisfile{}
  834. % @center line
  835. % outputs that line, centered.
  836. %
  837. \parseargdef\center{%
  838. \ifhmode
  839. \let\centersub\centerH
  840. \else
  841. \let\centersub\centerV
  842. \fi
  843. \centersub{\hfil \ignorespaces#1\unskip \hfil}%
  844. \let\centersub\relax % don't let the definition persist, just in case
  845. }
  846. \def\centerH#1{{%
  847. \hfil\break
  848. \advance\hsize by -\leftskip
  849. \advance\hsize by -\rightskip
  850. \line{#1}%
  851. \break
  852. }}
  853. %
  854. \newcount\centerpenalty
  855. \def\centerV#1{%
  856. % The idea here is the same as in \startdefun, \cartouche, etc.: if
  857. % @center is the first thing after a section heading, we need to wipe
  858. % out the negative parskip inserted by \sectionheading, but still
  859. % prevent a page break here.
  860. \centerpenalty = \lastpenalty
  861. \ifnum\centerpenalty>10000 \vskip\parskip \fi
  862. \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
  863. \line{\kern\leftskip #1\kern\rightskip}%
  864. }
  865. % @sp n outputs n lines of vertical space
  866. %
  867. \parseargdef\sp{\vskip #1\baselineskip}
  868. % @comment ...line which is ignored...
  869. % @c is the same as @comment
  870. % @ignore ... @end ignore is another way to write a comment
  871. \def\c{\begingroup \catcode`\^^M=\active%
  872. \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  873. \cxxx}
  874. {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
  875. %
  876. \let\comment\c
  877. % @paragraphindent NCHARS
  878. % We'll use ems for NCHARS, close enough.
  879. % NCHARS can also be the word `asis' or `none'.
  880. % We cannot feasibly implement @paragraphindent asis, though.
  881. %
  882. \def\asisword{asis} % no translation, these are keywords
  883. \def\noneword{none}
  884. %
  885. \parseargdef\paragraphindent{%
  886. \def\temp{#1}%
  887. \ifx\temp\asisword
  888. \else
  889. \ifx\temp\noneword
  890. \defaultparindent = 0pt
  891. \else
  892. \defaultparindent = #1em
  893. \fi
  894. \fi
  895. \parindent = \defaultparindent
  896. }
  897. % @exampleindent NCHARS
  898. % We'll use ems for NCHARS like @paragraphindent.
  899. % It seems @exampleindent asis isn't necessary, but
  900. % I preserve it to make it similar to @paragraphindent.
  901. \parseargdef\exampleindent{%
  902. \def\temp{#1}%
  903. \ifx\temp\asisword
  904. \else
  905. \ifx\temp\noneword
  906. \lispnarrowing = 0pt
  907. \else
  908. \lispnarrowing = #1em
  909. \fi
  910. \fi
  911. }
  912. % @firstparagraphindent WORD
  913. % If WORD is `none', then suppress indentation of the first paragraph
  914. % after a section heading. If WORD is `insert', then do indent at such
  915. % paragraphs.
  916. %
  917. % The paragraph indentation is suppressed or not by calling
  918. % \suppressfirstparagraphindent, which the sectioning commands do.
  919. % We switch the definition of this back and forth according to WORD.
  920. % By default, we suppress indentation.
  921. %
  922. \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
  923. \def\insertword{insert}
  924. %
  925. \parseargdef\firstparagraphindent{%
  926. \def\temp{#1}%
  927. \ifx\temp\noneword
  928. \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
  929. \else\ifx\temp\insertword
  930. \let\suppressfirstparagraphindent = \relax
  931. \else
  932. \errhelp = \EMsimple
  933. \errmessage{Unknown @firstparagraphindent option `\temp'}%
  934. \fi\fi
  935. }
  936. % Here is how we actually suppress indentation. Redefine \everypar to
  937. % \kern backwards by \parindent, and then reset itself to empty.
  938. %
  939. % We also make \indent itself not actually do anything until the next
  940. % paragraph.
  941. %
  942. \gdef\dosuppressfirstparagraphindent{%
  943. \gdef\indent {\restorefirstparagraphindent \indent}%
  944. \gdef\noindent{\restorefirstparagraphindent \noindent}%
  945. \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
  946. }
  947. %
  948. \gdef\restorefirstparagraphindent{%
  949. \global\let\indent = \ptexindent
  950. \global\let\noindent = \ptexnoindent
  951. \global\everypar = {}%
  952. }
  953. % @refill is a no-op.
  954. \let\refill=\relax
  955. % @setfilename INFO-FILENAME - ignored
  956. \let\setfilename=\comment
  957. % @bye.
  958. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  959. \message{pdf,}
  960. % adobe `portable' document format
  961. \newcount\tempnum
  962. \newcount\lnkcount
  963. \newtoks\filename
  964. \newcount\filenamelength
  965. \newcount\pgn
  966. \newtoks\toksA
  967. \newtoks\toksB
  968. \newtoks\toksC
  969. \newtoks\toksD
  970. \newbox\boxA
  971. \newbox\boxB
  972. \newcount\countA
  973. \newif\ifpdf
  974. \newif\ifpdfmakepagedest
  975. %
  976. % For LuaTeX
  977. %
  978. \newif\iftxiuseunicodedestname
  979. \txiuseunicodedestnamefalse % For pdfTeX etc.
  980. \ifx\luatexversion\thisisundefined
  981. \else
  982. % Use Unicode destination names
  983. \txiuseunicodedestnametrue
  984. % Escape PDF strings with converting UTF-16 from UTF-8
  985. \begingroup
  986. \catcode`\%=12
  987. \directlua{
  988. function UTF16oct(str)
  989. tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
  990. for c in string.utfvalues(str) do
  991. if c < 0x10000 then
  992. tex.sprint(
  993. string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
  994. string.char(0x5c) .. string.char(0x25) .. '03o',
  995. (c / 256), (c % 256)))
  996. else
  997. c = c - 0x10000
  998. local c_hi = c / 1024 + 0xd800
  999. local c_lo = c % 1024 + 0xdc00
  1000. tex.sprint(
  1001. string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
  1002. string.char(0x5c) .. string.char(0x25) .. '03o' ..
  1003. string.char(0x5c) .. string.char(0x25) .. '03o' ..
  1004. string.char(0x5c) .. string.char(0x25) .. '03o',
  1005. (c_hi / 256), (c_hi % 256),
  1006. (c_lo / 256), (c_lo % 256)))
  1007. end
  1008. end
  1009. end
  1010. }
  1011. \endgroup
  1012. \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
  1013. % Escape PDF strings without converting
  1014. \begingroup
  1015. \directlua{
  1016. function PDFescstr(str)
  1017. for c in string.bytes(str) do
  1018. if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
  1019. tex.sprint(
  1020. string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
  1021. c))
  1022. else
  1023. tex.sprint(string.char(c))
  1024. end
  1025. end
  1026. end
  1027. }
  1028. \endgroup
  1029. \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
  1030. \ifnum\luatexversion>84
  1031. % For LuaTeX >= 0.85
  1032. \def\pdfdest{\pdfextension dest}
  1033. \let\pdfoutput\outputmode
  1034. \def\pdfliteral{\pdfextension literal}
  1035. \def\pdfcatalog{\pdfextension catalog}
  1036. \def\pdftexversion{\numexpr\pdffeedback version\relax}
  1037. \let\pdfximage\saveimageresource
  1038. \let\pdfrefximage\useimageresource
  1039. \let\pdflastximage\lastsavedimageresourceindex
  1040. \def\pdfendlink{\pdfextension endlink\relax}
  1041. \def\pdfoutline{\pdfextension outline}
  1042. \def\pdfstartlink{\pdfextension startlink}
  1043. \def\pdffontattr{\pdfextension fontattr}
  1044. \def\pdfobj{\pdfextension obj}
  1045. \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
  1046. \let\pdfpagewidth\pagewidth
  1047. \let\pdfpageheight\pageheight
  1048. \edef\pdfhorigin{\pdfvariable horigin}
  1049. \edef\pdfvorigin{\pdfvariable vorigin}
  1050. \fi
  1051. \fi
  1052. % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
  1053. % can be set). So we test for \relax and 0 as well as being undefined.
  1054. \ifx\pdfoutput\thisisundefined
  1055. \else
  1056. \ifx\pdfoutput\relax
  1057. \else
  1058. \ifcase\pdfoutput
  1059. \else
  1060. \pdftrue
  1061. \fi
  1062. \fi
  1063. \fi
  1064. % PDF uses PostScript string constants for the names of xref targets,
  1065. % for display in the outlines, and in other places. Thus, we have to
  1066. % double any backslashes. Otherwise, a name like "\node" will be
  1067. % interpreted as a newline (\n), followed by o, d, e. Not good.
  1068. %
  1069. % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
  1070. % related messages. The final outcome is that it is up to the TeX user
  1071. % to double the backslashes and otherwise make the string valid, so
  1072. % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
  1073. % do this reliably, so we use it.
  1074. % #1 is a control sequence in which to do the replacements,
  1075. % which we \xdef.
  1076. \def\txiescapepdf#1{%
  1077. \ifx\pdfescapestring\thisisundefined
  1078. % No primitive available; should we give a warning or log?
  1079. % Many times it won't matter.
  1080. \xdef#1{#1}%
  1081. \else
  1082. % The expandable \pdfescapestring primitive escapes parentheses,
  1083. % backslashes, and other special chars.
  1084. \xdef#1{\pdfescapestring{#1}}%
  1085. \fi
  1086. }
  1087. \def\txiescapepdfutfsixteen#1{%
  1088. \ifx\pdfescapestrutfsixteen\thisisundefined
  1089. % No UTF-16 converting macro available.
  1090. \txiescapepdf{#1}%
  1091. \else
  1092. \xdef#1{\pdfescapestrutfsixteen{#1}}%
  1093. \fi
  1094. }
  1095. \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
  1096. with PDF output, and none of those formats could be found. (.eps cannot
  1097. be supported due to the design of the PDF format; use regular TeX (DVI
  1098. output) for that.)}
  1099. \ifpdf
  1100. %
  1101. % Color manipulation macros using ideas from pdfcolor.tex,
  1102. % except using rgb instead of cmyk; the latter is said to render as a
  1103. % very dark gray on-screen and a very dark halftone in print, instead
  1104. % of actual black. The dark red here is dark enough to print on paper as
  1105. % nearly black, but still distinguishable for online viewing. We use
  1106. % black by default, though.
  1107. \def\rgbDarkRed{0.50 0.09 0.12}
  1108. \def\rgbBlack{0 0 0}
  1109. %
  1110. % rg sets the color for filling (usual text, etc.);
  1111. % RG sets the color for stroking (thin rules, e.g., normal _'s).
  1112. \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
  1113. %
  1114. % Set color, and create a mark which defines \thiscolor accordingly,
  1115. % so that \makeheadline knows which color to restore.
  1116. \def\setcolor#1{%
  1117. \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
  1118. \domark
  1119. \pdfsetcolor{#1}%
  1120. }
  1121. %
  1122. \def\maincolor{\rgbBlack}
  1123. \pdfsetcolor{\maincolor}
  1124. \edef\thiscolor{\maincolor}
  1125. \def\lastcolordefs{}
  1126. %
  1127. \def\makefootline{%
  1128. \baselineskip24pt
  1129. \line{\pdfsetcolor{\maincolor}\the\footline}%
  1130. }
  1131. %
  1132. \def\makeheadline{%
  1133. \vbox to 0pt{%
  1134. \vskip-22.5pt
  1135. \line{%
  1136. \vbox to8.5pt{}%
  1137. % Extract \thiscolor definition from the marks.
  1138. \getcolormarks
  1139. % Typeset the headline with \maincolor, then restore the color.
  1140. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
  1141. }%
  1142. \vss
  1143. }%
  1144. \nointerlineskip
  1145. }
  1146. %
  1147. %
  1148. \pdfcatalog{/PageMode /UseOutlines}
  1149. %
  1150. % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
  1151. \def\dopdfimage#1#2#3{%
  1152. \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
  1153. \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
  1154. %
  1155. % pdftex (and the PDF format) support .pdf, .png, .jpg (among
  1156. % others). Let's try in that order, PDF first since if
  1157. % someone has a scalable image, presumably better to use that than a
  1158. % bitmap.
  1159. \let\pdfimgext=\empty
  1160. \begingroup
  1161. \openin 1 #1.pdf \ifeof 1
  1162. \openin 1 #1.PDF \ifeof 1
  1163. \openin 1 #1.png \ifeof 1
  1164. \openin 1 #1.jpg \ifeof 1
  1165. \openin 1 #1.jpeg \ifeof 1
  1166. \openin 1 #1.JPG \ifeof 1
  1167. \errhelp = \nopdfimagehelp
  1168. \errmessage{Could not find image file #1 for pdf}%
  1169. \else \gdef\pdfimgext{JPG}%
  1170. \fi
  1171. \else \gdef\pdfimgext{jpeg}%
  1172. \fi
  1173. \else \gdef\pdfimgext{jpg}%
  1174. \fi
  1175. \else \gdef\pdfimgext{png}%
  1176. \fi
  1177. \else \gdef\pdfimgext{PDF}%
  1178. \fi
  1179. \else \gdef\pdfimgext{pdf}%
  1180. \fi
  1181. \closein 1
  1182. \endgroup
  1183. %
  1184. % without \immediate, ancient pdftex seg faults when the same image is
  1185. % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
  1186. \ifnum\pdftexversion < 14
  1187. \immediate\pdfimage
  1188. \else
  1189. \immediate\pdfximage
  1190. \fi
  1191. \ifdim \wd0 >0pt width \pdfimagewidth \fi
  1192. \ifdim \wd2 >0pt height \pdfimageheight \fi
  1193. \ifnum\pdftexversion<13
  1194. #1.\pdfimgext
  1195. \else
  1196. {#1.\pdfimgext}%
  1197. \fi
  1198. \ifnum\pdftexversion < 14 \else
  1199. \pdfrefximage \pdflastximage
  1200. \fi}
  1201. %
  1202. \def\setpdfdestname#1{{%
  1203. % We have to set dummies so commands such as @code, and characters
  1204. % such as \, aren't expanded when present in a section title.
  1205. \indexnofonts
  1206. \makevalueexpandable
  1207. \turnoffactive
  1208. \iftxiuseunicodedestname
  1209. \ifx \declaredencoding \latone
  1210. % Pass through Latin-1 characters.
  1211. % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
  1212. \else
  1213. \ifx \declaredencoding \utfeight
  1214. % Pass through Unicode characters.
  1215. \else
  1216. % Use ASCII approximations in destination names.
  1217. \passthroughcharsfalse
  1218. \fi
  1219. \fi
  1220. \else
  1221. % Use ASCII approximations in destination names.
  1222. \passthroughcharsfalse
  1223. \fi
  1224. \def\pdfdestname{#1}%
  1225. \txiescapepdf\pdfdestname
  1226. }}
  1227. %
  1228. \def\setpdfoutlinetext#1{{%
  1229. \indexnofonts
  1230. \makevalueexpandable
  1231. \turnoffactive
  1232. \ifx \declaredencoding \latone
  1233. % The PDF format can use an extended form of Latin-1 in bookmark
  1234. % strings. See Appendix D of the PDF Reference, Sixth Edition, for
  1235. % the "PDFDocEncoding".
  1236. \passthroughcharstrue
  1237. % Pass through Latin-1 characters.
  1238. % LuaTeX: Convert to Unicode
  1239. % pdfTeX: Use Latin-1 as PDFDocEncoding
  1240. \def\pdfoutlinetext{#1}%
  1241. \else
  1242. \ifx \declaredencoding \utfeight
  1243. \ifx\luatexversion\thisisundefined
  1244. % For pdfTeX with UTF-8.
  1245. % TODO: the PDF format can use UTF-16 in bookmark strings,
  1246. % but the code for this isn't done yet.
  1247. % Use ASCII approximations.
  1248. \passthroughcharsfalse
  1249. \def\pdfoutlinetext{#1}%
  1250. \else
  1251. % For LuaTeX with UTF-8.
  1252. % Pass through Unicode characters for title texts.
  1253. \passthroughcharstrue
  1254. \def\pdfoutlinetext{#1}%
  1255. \fi
  1256. \else
  1257. % For non-Latin-1 or non-UTF-8 encodings.
  1258. % Use ASCII approximations.
  1259. \passthroughcharsfalse
  1260. \def\pdfoutlinetext{#1}%
  1261. \fi
  1262. \fi
  1263. % LuaTeX: Convert to UTF-16
  1264. % pdfTeX: Use Latin-1 as PDFDocEncoding
  1265. \txiescapepdfutfsixteen\pdfoutlinetext
  1266. }}
  1267. %
  1268. \def\pdfmkdest#1{%
  1269. \setpdfdestname{#1}%
  1270. \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
  1271. }
  1272. %
  1273. % used to mark target names; must be expandable.
  1274. \def\pdfmkpgn#1{#1}
  1275. %
  1276. % by default, use black for everything.
  1277. \def\urlcolor{\rgbBlack}
  1278. \def\linkcolor{\rgbBlack}
  1279. \def\endlink{\setcolor{\maincolor}\pdfendlink}
  1280. %
  1281. % Adding outlines to PDF; macros for calculating structure of outlines
  1282. % come from Petr Olsak
  1283. \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
  1284. \else \csname#1\endcsname \fi}
  1285. \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
  1286. \advance\tempnum by 1
  1287. \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  1288. %
  1289. % #1 is the section text, which is what will be displayed in the
  1290. % outline by the pdf viewer. #2 is the pdf expression for the number
  1291. % of subentries (or empty, for subsubsections). #3 is the node text,
  1292. % which might be empty if this toc entry had no corresponding node.
  1293. % #4 is the page number
  1294. %
  1295. \def\dopdfoutline#1#2#3#4{%
  1296. % Generate a link to the node text if that exists; else, use the
  1297. % page number. We could generate a destination for the section
  1298. % text in the case where a section has no node, but it doesn't
  1299. % seem worth the trouble, since most documents are normally structured.
  1300. \setpdfoutlinetext{#1}
  1301. \setpdfdestname{#3}
  1302. \ifx\pdfdestname\empty
  1303. \def\pdfdestname{#4}%
  1304. \fi
  1305. %
  1306. \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
  1307. }
  1308. %
  1309. \def\pdfmakeoutlines{%
  1310. \begingroup
  1311. % Read toc silently, to get counts of subentries for \pdfoutline.
  1312. \def\partentry##1##2##3##4{}% ignore parts in the outlines
  1313. \def\numchapentry##1##2##3##4{%
  1314. \def\thischapnum{##2}%
  1315. \def\thissecnum{0}%
  1316. \def\thissubsecnum{0}%
  1317. }%
  1318. \def\numsecentry##1##2##3##4{%
  1319. \advancenumber{chap\thischapnum}%
  1320. \def\thissecnum{##2}%
  1321. \def\thissubsecnum{0}%
  1322. }%
  1323. \def\numsubsecentry##1##2##3##4{%
  1324. \advancenumber{sec\thissecnum}%
  1325. \def\thissubsecnum{##2}%
  1326. }%
  1327. \def\numsubsubsecentry##1##2##3##4{%
  1328. \advancenumber{subsec\thissubsecnum}%
  1329. }%
  1330. \def\thischapnum{0}%
  1331. \def\thissecnum{0}%
  1332. \def\thissubsecnum{0}%
  1333. %
  1334. % use \def rather than \let here because we redefine \chapentry et
  1335. % al. a second time, below.
  1336. \def\appentry{\numchapentry}%
  1337. \def\appsecentry{\numsecentry}%
  1338. \def\appsubsecentry{\numsubsecentry}%
  1339. \def\appsubsubsecentry{\numsubsubsecentry}%
  1340. \def\unnchapentry{\numchapentry}%
  1341. \def\unnsecentry{\numsecentry}%
  1342. \def\unnsubsecentry{\numsubsecentry}%
  1343. \def\unnsubsubsecentry{\numsubsubsecentry}%
  1344. \readdatafile{toc}%
  1345. %
  1346. % Read toc second time, this time actually producing the outlines.
  1347. % The `-' means take the \expnumber as the absolute number of
  1348. % subentries, which we calculated on our first read of the .toc above.
  1349. %
  1350. % We use the node names as the destinations.
  1351. \def\numchapentry##1##2##3##4{%
  1352. \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
  1353. \def\numsecentry##1##2##3##4{%
  1354. \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
  1355. \def\numsubsecentry##1##2##3##4{%
  1356. \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
  1357. \def\numsubsubsecentry##1##2##3##4{% count is always zero
  1358. \dopdfoutline{##1}{}{##3}{##4}}%
  1359. %
  1360. % PDF outlines are displayed using system fonts, instead of
  1361. % document fonts. Therefore we cannot use special characters,
  1362. % since the encoding is unknown. For example, the eogonek from
  1363. % Latin 2 (0xea) gets translated to a | character. Info from
  1364. % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
  1365. %
  1366. % TODO this right, we have to translate 8-bit characters to
  1367. % their "best" equivalent, based on the @documentencoding. Too
  1368. % much work for too little return. Just use the ASCII equivalents
  1369. % we use for the index sort strings.
  1370. %
  1371. \indexnofonts
  1372. \setupdatafile
  1373. % We can have normal brace characters in the PDF outlines, unlike
  1374. % Texinfo index files. So set that up.
  1375. \def\{{\lbracecharliteral}%
  1376. \def\}{\rbracecharliteral}%
  1377. \catcode`\\=\active \otherbackslash
  1378. \input \tocreadfilename
  1379. \endgroup
  1380. }
  1381. {\catcode`[=1 \catcode`]=2
  1382. \catcode`{=\other \catcode`}=\other
  1383. \gdef\lbracecharliteral[{]%
  1384. \gdef\rbracecharliteral[}]%
  1385. ]
  1386. %
  1387. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1388. \ifx\PP\D\let\nextsp\relax
  1389. \else\let\nextsp\skipspaces
  1390. \addtokens{\filename}{\PP}%
  1391. \advance\filenamelength by 1
  1392. \fi
  1393. \nextsp}
  1394. \def\getfilename#1{%
  1395. \filenamelength=0
  1396. % If we don't expand the argument now, \skipspaces will get
  1397. % snagged on things like "@value{foo}".
  1398. \edef\temp{#1}%
  1399. \expandafter\skipspaces\temp|\relax
  1400. }
  1401. \ifnum\pdftexversion < 14
  1402. \let \startlink \pdfannotlink
  1403. \else
  1404. \let \startlink \pdfstartlink
  1405. \fi
  1406. % make a live url in pdf output.
  1407. \def\pdfurl#1{%
  1408. \begingroup
  1409. % it seems we really need yet another set of dummies; have not
  1410. % tried to figure out what each command should do in the context
  1411. % of @url. for now, just make @/ a no-op, that's the only one
  1412. % people have actually reported a problem with.
  1413. %
  1414. \normalturnoffactive
  1415. \def\@{@}%
  1416. \let\/=\empty
  1417. \makevalueexpandable
  1418. % do we want to go so far as to use \indexnofonts instead of just
  1419. % special-casing \var here?
  1420. \def\var##1{##1}%
  1421. %
  1422. \leavevmode\setcolor{\urlcolor}%
  1423. \startlink attr{/Border [0 0 0]}%
  1424. user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
  1425. \endgroup}
  1426. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1427. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1428. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1429. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1430. \def\maketoks{%
  1431. \expandafter\poptoks\the\toksA|ENDTOKS|\relax
  1432. \ifx\first0\adn0
  1433. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1434. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1435. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1436. \else
  1437. \ifnum0=\countA\else\makelink\fi
  1438. \ifx\first.\let\next=\done\else
  1439. \let\next=\maketoks
  1440. \addtokens{\toksB}{\the\toksD}
  1441. \ifx\first,\addtokens{\toksB}{\space}\fi
  1442. \fi
  1443. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1444. \next}
  1445. \def\makelink{\addtokens{\toksB}%
  1446. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1447. \def\pdflink#1{%
  1448. \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
  1449. \setcolor{\linkcolor}#1\endlink}
  1450. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1451. \else
  1452. % non-pdf mode
  1453. \let\pdfmkdest = \gobble
  1454. \let\pdfurl = \gobble
  1455. \let\endlink = \relax
  1456. \let\setcolor = \gobble
  1457. \let\pdfsetcolor = \gobble
  1458. \let\pdfmakeoutlines = \relax
  1459. \fi % \ifx\pdfoutput
  1460. %
  1461. % For XeTeX
  1462. %
  1463. \ifx\XeTeXrevision\thisisundefined
  1464. \else
  1465. %
  1466. % XeTeX version check
  1467. %
  1468. \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
  1469. % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
  1470. % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
  1471. % For avoiding PDF destination name replacement, we use this special
  1472. % instead of xdvipdfmx's command line option `-C 0x0010'.
  1473. \special{dvipdfmx:config C 0x0010}
  1474. % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
  1475. % It can handle Unicode destination names for PDF.
  1476. \txiuseunicodedestnametrue
  1477. \else
  1478. % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
  1479. % `dvipdfmx:config' special.
  1480. % So for avoiding PDF destination name replacement,
  1481. % xdvipdfmx's command line option `-C 0x0010' is necessary.
  1482. %
  1483. % XeTeX < 0.99995 can not handle Unicode destination names for PDF
  1484. % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
  1485. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
  1486. \txiuseunicodedestnamefalse
  1487. \fi
  1488. %
  1489. % Color support
  1490. %
  1491. \def\rgbDarkRed{0.50 0.09 0.12}
  1492. \def\rgbBlack{0 0 0}
  1493. %
  1494. \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
  1495. %
  1496. % Set color, and create a mark which defines \thiscolor accordingly,
  1497. % so that \makeheadline knows which color to restore.
  1498. \def\setcolor#1{%
  1499. \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
  1500. \domark
  1501. \pdfsetcolor{#1}%
  1502. }
  1503. %
  1504. \def\maincolor{\rgbBlack}
  1505. \pdfsetcolor{\maincolor}
  1506. \edef\thiscolor{\maincolor}
  1507. \def\lastcolordefs{}
  1508. %
  1509. \def\makefootline{%
  1510. \baselineskip24pt
  1511. \line{\pdfsetcolor{\maincolor}\the\footline}%
  1512. }
  1513. %
  1514. \def\makeheadline{%
  1515. \vbox to 0pt{%
  1516. \vskip-22.5pt
  1517. \line{%
  1518. \vbox to8.5pt{}%
  1519. % Extract \thiscolor definition from the marks.
  1520. \getcolormarks
  1521. % Typeset the headline with \maincolor, then restore the color.
  1522. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
  1523. }%
  1524. \vss
  1525. }%
  1526. \nointerlineskip
  1527. }
  1528. %
  1529. % PDF outline support
  1530. %
  1531. % Emulate pdfTeX primitive
  1532. \def\pdfdest name#1 xyz{%
  1533. \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
  1534. }
  1535. %
  1536. \def\setpdfdestname#1{{%
  1537. % We have to set dummies so commands such as @code, and characters
  1538. % such as \, aren't expanded when present in a section title.
  1539. \indexnofonts
  1540. \makevalueexpandable
  1541. \turnoffactive
  1542. \iftxiuseunicodedestname
  1543. % Pass through Unicode characters.
  1544. \else
  1545. % Use ASCII approximations in destination names.
  1546. \passthroughcharsfalse
  1547. \fi
  1548. \def\pdfdestname{#1}%
  1549. \txiescapepdf\pdfdestname
  1550. }}
  1551. %
  1552. \def\setpdfoutlinetext#1{{%
  1553. \turnoffactive
  1554. % Always use Unicode characters in title texts.
  1555. \def\pdfoutlinetext{#1}%
  1556. % For XeTeX, xdvipdfmx converts to UTF-16.
  1557. % So we do not convert.
  1558. \txiescapepdf\pdfoutlinetext
  1559. }}
  1560. %
  1561. \def\pdfmkdest#1{%
  1562. \setpdfdestname{#1}%
  1563. \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
  1564. }
  1565. %
  1566. % by default, use black for everything.
  1567. \def\urlcolor{\rgbBlack}
  1568. \def\linkcolor{\rgbBlack}
  1569. \def\endlink{\setcolor{\maincolor}\pdfendlink}
  1570. %
  1571. \def\dopdfoutline#1#2#3#4{%
  1572. \setpdfoutlinetext{#1}
  1573. \setpdfdestname{#3}
  1574. \ifx\pdfdestname\empty
  1575. \def\pdfdestname{#4}%
  1576. \fi
  1577. %
  1578. \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
  1579. << /S /GoTo /D (\pdfdestname) >> >> }%
  1580. }
  1581. %
  1582. \def\pdfmakeoutlines{%
  1583. \begingroup
  1584. %
  1585. % For XeTeX, counts of subentries are not necessary.
  1586. % Therefore, we read toc only once.
  1587. %
  1588. % We use node names as destinations.
  1589. \def\partentry##1##2##3##4{}% ignore parts in the outlines
  1590. \def\numchapentry##1##2##3##4{%
  1591. \dopdfoutline{##1}{1}{##3}{##4}}%
  1592. \def\numsecentry##1##2##3##4{%
  1593. \dopdfoutline{##1}{2}{##3}{##4}}%
  1594. \def\numsubsecentry##1##2##3##4{%
  1595. \dopdfoutline{##1}{3}{##3}{##4}}%
  1596. \def\numsubsubsecentry##1##2##3##4{%
  1597. \dopdfoutline{##1}{4}{##3}{##4}}%
  1598. %
  1599. \let\appentry\numchapentry%
  1600. \let\appsecentry\numsecentry%
  1601. \let\appsubsecentry\numsubsecentry%
  1602. \let\appsubsubsecentry\numsubsubsecentry%
  1603. \let\unnchapentry\numchapentry%
  1604. \let\unnsecentry\numsecentry%
  1605. \let\unnsubsecentry\numsubsecentry%
  1606. \let\unnsubsubsecentry\numsubsubsecentry%
  1607. %
  1608. % For XeTeX, xdvipdfmx converts strings to UTF-16.
  1609. % Therefore, the encoding and the language may not be considered.
  1610. %
  1611. \indexnofonts
  1612. \setupdatafile
  1613. % We can have normal brace characters in the PDF outlines, unlike
  1614. % Texinfo index files. So set that up.
  1615. \def\{{\lbracecharliteral}%
  1616. \def\}{\rbracecharliteral}%
  1617. \catcode`\\=\active \otherbackslash
  1618. \input \tocreadfilename
  1619. \endgroup
  1620. }
  1621. {\catcode`[=1 \catcode`]=2
  1622. \catcode`{=\other \catcode`}=\other
  1623. \gdef\lbracecharliteral[{]%
  1624. \gdef\rbracecharliteral[}]%
  1625. ]
  1626. \special{pdf:docview << /PageMode /UseOutlines >> }
  1627. % ``\special{pdf:tounicode ...}'' is not necessary
  1628. % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
  1629. % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
  1630. % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
  1631. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
  1632. %
  1633. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1634. \ifx\PP\D\let\nextsp\relax
  1635. \else\let\nextsp\skipspaces
  1636. \addtokens{\filename}{\PP}%
  1637. \advance\filenamelength by 1
  1638. \fi
  1639. \nextsp}
  1640. \def\getfilename#1{%
  1641. \filenamelength=0
  1642. % If we don't expand the argument now, \skipspaces will get
  1643. % snagged on things like "@value{foo}".
  1644. \edef\temp{#1}%
  1645. \expandafter\skipspaces\temp|\relax
  1646. }
  1647. % make a live url in pdf output.
  1648. \def\pdfurl#1{%
  1649. \begingroup
  1650. % it seems we really need yet another set of dummies; have not
  1651. % tried to figure out what each command should do in the context
  1652. % of @url. for now, just make @/ a no-op, that's the only one
  1653. % people have actually reported a problem with.
  1654. %
  1655. \normalturnoffactive
  1656. \def\@{@}%
  1657. \let\/=\empty
  1658. \makevalueexpandable
  1659. % do we want to go so far as to use \indexnofonts instead of just
  1660. % special-casing \var here?
  1661. \def\var##1{##1}%
  1662. %
  1663. \leavevmode\setcolor{\urlcolor}%
  1664. \special{pdf:bann << /Border [0 0 0]
  1665. /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
  1666. \endgroup}
  1667. \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
  1668. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1669. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1670. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1671. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1672. \def\maketoks{%
  1673. \expandafter\poptoks\the\toksA|ENDTOKS|\relax
  1674. \ifx\first0\adn0
  1675. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1676. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1677. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1678. \else
  1679. \ifnum0=\countA\else\makelink\fi
  1680. \ifx\first.\let\next=\done\else
  1681. \let\next=\maketoks
  1682. \addtokens{\toksB}{\the\toksD}
  1683. \ifx\first,\addtokens{\toksB}{\space}\fi
  1684. \fi
  1685. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1686. \next}
  1687. \def\makelink{\addtokens{\toksB}%
  1688. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1689. \def\pdflink#1{%
  1690. \special{pdf:bann << /Border [0 0 0]
  1691. /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
  1692. \setcolor{\linkcolor}#1\endlink}
  1693. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1694. %
  1695. %
  1696. % @image support
  1697. %
  1698. % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
  1699. \def\doxeteximage#1#2#3{%
  1700. \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
  1701. \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
  1702. %
  1703. % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
  1704. % others). Let's try in that order, PDF first since if
  1705. % someone has a scalable image, presumably better to use that than a
  1706. % bitmap.
  1707. \let\xeteximgext=\empty
  1708. \begingroup
  1709. \openin 1 #1.pdf \ifeof 1
  1710. \openin 1 #1.PDF \ifeof 1
  1711. \openin 1 #1.png \ifeof 1
  1712. \openin 1 #1.jpg \ifeof 1
  1713. \openin 1 #1.jpeg \ifeof 1
  1714. \openin 1 #1.JPG \ifeof 1
  1715. \errmessage{Could not find image file #1 for XeTeX}%
  1716. \else \gdef\xeteximgext{JPG}%
  1717. \fi
  1718. \else \gdef\xeteximgext{jpeg}%
  1719. \fi
  1720. \else \gdef\xeteximgext{jpg}%
  1721. \fi
  1722. \else \gdef\xeteximgext{png}%
  1723. \fi
  1724. \else \gdef\xeteximgext{PDF}%
  1725. \fi
  1726. \else \gdef\xeteximgext{pdf}%
  1727. \fi
  1728. \closein 1
  1729. \endgroup
  1730. %
  1731. \def\xetexpdfext{pdf}%
  1732. \ifx\xeteximgext\xetexpdfext
  1733. \XeTeXpdffile "#1".\xeteximgext ""
  1734. \else
  1735. \def\xetexpdfext{PDF}%
  1736. \ifx\xeteximgext\xetexpdfext
  1737. \XeTeXpdffile "#1".\xeteximgext ""
  1738. \else
  1739. \XeTeXpicfile "#1".\xeteximgext ""
  1740. \fi
  1741. \fi
  1742. \ifdim \wd0 >0pt width \xeteximagewidth \fi
  1743. \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
  1744. }
  1745. \fi
  1746. %
  1747. \message{fonts,}
  1748. % Set the baselineskip to #1, and the lineskip and strut size
  1749. % correspondingly. There is no deep meaning behind these magic numbers
  1750. % used as factors; they just match (closely enough) what Knuth defined.
  1751. %
  1752. \def\lineskipfactor{.08333}
  1753. \def\strutheightpercent{.70833}
  1754. \def\strutdepthpercent {.29167}
  1755. %
  1756. % can get a sort of poor man's double spacing by redefining this.
  1757. \def\baselinefactor{1}
  1758. %
  1759. \newdimen\textleading
  1760. \def\setleading#1{%
  1761. \dimen0 = #1\relax
  1762. \normalbaselineskip = \baselinefactor\dimen0
  1763. \normallineskip = \lineskipfactor\normalbaselineskip
  1764. \normalbaselines
  1765. \setbox\strutbox =\hbox{%
  1766. \vrule width0pt height\strutheightpercent\baselineskip
  1767. depth \strutdepthpercent \baselineskip
  1768. }%
  1769. }
  1770. % PDF CMaps. See also LaTeX's t1.cmap.
  1771. %
  1772. % do nothing with this by default.
  1773. \expandafter\let\csname cmapOT1\endcsname\gobble
  1774. \expandafter\let\csname cmapOT1IT\endcsname\gobble
  1775. \expandafter\let\csname cmapOT1TT\endcsname\gobble
  1776. % if we are producing pdf, and we have \pdffontattr, then define cmaps.
  1777. % (\pdffontattr was introduced many years ago, but people still run
  1778. % older pdftex's; it's easy to conditionalize, so we do.)
  1779. \ifpdf \ifx\pdffontattr\thisisundefined \else
  1780. \begingroup
  1781. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  1782. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  1783. %%DocumentNeededResources: ProcSet (CIDInit)
  1784. %%IncludeResource: ProcSet (CIDInit)
  1785. %%BeginResource: CMap (TeX-OT1-0)
  1786. %%Title: (TeX-OT1-0 TeX OT1 0)
  1787. %%Version: 1.000
  1788. %%EndComments
  1789. /CIDInit /ProcSet findresource begin
  1790. 12 dict begin
  1791. begincmap
  1792. /CIDSystemInfo
  1793. << /Registry (TeX)
  1794. /Ordering (OT1)
  1795. /Supplement 0
  1796. >> def
  1797. /CMapName /TeX-OT1-0 def
  1798. /CMapType 2 def
  1799. 1 begincodespacerange
  1800. <00> <7F>
  1801. endcodespacerange
  1802. 8 beginbfrange
  1803. <00> <01> <0393>
  1804. <09> <0A> <03A8>
  1805. <23> <26> <0023>
  1806. <28> <3B> <0028>
  1807. <3F> <5B> <003F>
  1808. <5D> <5E> <005D>
  1809. <61> <7A> <0061>
  1810. <7B> <7C> <2013>
  1811. endbfrange
  1812. 40 beginbfchar
  1813. <02> <0398>
  1814. <03> <039B>
  1815. <04> <039E>
  1816. <05> <03A0>
  1817. <06> <03A3>
  1818. <07> <03D2>
  1819. <08> <03A6>
  1820. <0B> <00660066>
  1821. <0C> <00660069>
  1822. <0D> <0066006C>
  1823. <0E> <006600660069>
  1824. <0F> <00660066006C>
  1825. <10> <0131>
  1826. <11> <0237>
  1827. <12> <0060>
  1828. <13> <00B4>
  1829. <14> <02C7>
  1830. <15> <02D8>
  1831. <16> <00AF>
  1832. <17> <02DA>
  1833. <18> <00B8>
  1834. <19> <00DF>
  1835. <1A> <00E6>
  1836. <1B> <0153>
  1837. <1C> <00F8>
  1838. <1D> <00C6>
  1839. <1E> <0152>
  1840. <1F> <00D8>
  1841. <21> <0021>
  1842. <22> <201D>
  1843. <27> <2019>
  1844. <3C> <00A1>
  1845. <3D> <003D>
  1846. <3E> <00BF>
  1847. <5C> <201C>
  1848. <5F> <02D9>
  1849. <60> <2018>
  1850. <7D> <02DD>
  1851. <7E> <007E>
  1852. <7F> <00A8>
  1853. endbfchar
  1854. endcmap
  1855. CMapName currentdict /CMap defineresource pop
  1856. end
  1857. end
  1858. %%EndResource
  1859. %%EOF
  1860. }\endgroup
  1861. \expandafter\edef\csname cmapOT1\endcsname#1{%
  1862. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  1863. }%
  1864. %
  1865. % \cmapOT1IT
  1866. \begingroup
  1867. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  1868. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  1869. %%DocumentNeededResources: ProcSet (CIDInit)
  1870. %%IncludeResource: ProcSet (CIDInit)
  1871. %%BeginResource: CMap (TeX-OT1IT-0)
  1872. %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
  1873. %%Version: 1.000
  1874. %%EndComments
  1875. /CIDInit /ProcSet findresource begin
  1876. 12 dict begin
  1877. begincmap
  1878. /CIDSystemInfo
  1879. << /Registry (TeX)
  1880. /Ordering (OT1IT)
  1881. /Supplement 0
  1882. >> def
  1883. /CMapName /TeX-OT1IT-0 def
  1884. /CMapType 2 def
  1885. 1 begincodespacerange
  1886. <00> <7F>
  1887. endcodespacerange
  1888. 8 beginbfrange
  1889. <00> <01> <0393>
  1890. <09> <0A> <03A8>
  1891. <25> <26> <0025>
  1892. <28> <3B> <0028>
  1893. <3F> <5B> <003F>
  1894. <5D> <5E> <005D>
  1895. <61> <7A> <0061>
  1896. <7B> <7C> <2013>
  1897. endbfrange
  1898. 42 beginbfchar
  1899. <02> <0398>
  1900. <03> <039B>
  1901. <04> <039E>
  1902. <05> <03A0>
  1903. <06> <03A3>
  1904. <07> <03D2>
  1905. <08> <03A6>
  1906. <0B> <00660066>
  1907. <0C> <00660069>
  1908. <0D> <0066006C>
  1909. <0E> <006600660069>
  1910. <0F> <00660066006C>
  1911. <10> <0131>
  1912. <11> <0237>
  1913. <12> <0060>
  1914. <13> <00B4>
  1915. <14> <02C7>
  1916. <15> <02D8>
  1917. <16> <00AF>
  1918. <17> <02DA>
  1919. <18> <00B8>
  1920. <19> <00DF>
  1921. <1A> <00E6>
  1922. <1B> <0153>
  1923. <1C> <00F8>
  1924. <1D> <00C6>
  1925. <1E> <0152>
  1926. <1F> <00D8>
  1927. <21> <0021>
  1928. <22> <201D>
  1929. <23> <0023>
  1930. <24> <00A3>
  1931. <27> <2019>
  1932. <3C> <00A1>
  1933. <3D> <003D>
  1934. <3E> <00BF>
  1935. <5C> <201C>
  1936. <5F> <02D9>
  1937. <60> <2018>
  1938. <7D> <02DD>
  1939. <7E> <007E>
  1940. <7F> <00A8>
  1941. endbfchar
  1942. endcmap
  1943. CMapName currentdict /CMap defineresource pop
  1944. end
  1945. end
  1946. %%EndResource
  1947. %%EOF
  1948. }\endgroup
  1949. \expandafter\edef\csname cmapOT1IT\endcsname#1{%
  1950. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  1951. }%
  1952. %
  1953. % \cmapOT1TT
  1954. \begingroup
  1955. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  1956. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  1957. %%DocumentNeededResources: ProcSet (CIDInit)
  1958. %%IncludeResource: ProcSet (CIDInit)
  1959. %%BeginResource: CMap (TeX-OT1TT-0)
  1960. %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
  1961. %%Version: 1.000
  1962. %%EndComments
  1963. /CIDInit /ProcSet findresource begin
  1964. 12 dict begin
  1965. begincmap
  1966. /CIDSystemInfo
  1967. << /Registry (TeX)
  1968. /Ordering (OT1TT)
  1969. /Supplement 0
  1970. >> def
  1971. /CMapName /TeX-OT1TT-0 def
  1972. /CMapType 2 def
  1973. 1 begincodespacerange
  1974. <00> <7F>
  1975. endcodespacerange
  1976. 5 beginbfrange
  1977. <00> <01> <0393>
  1978. <09> <0A> <03A8>
  1979. <21> <26> <0021>
  1980. <28> <5F> <0028>
  1981. <61> <7E> <0061>
  1982. endbfrange
  1983. 32 beginbfchar
  1984. <02> <0398>
  1985. <03> <039B>
  1986. <04> <039E>
  1987. <05> <03A0>
  1988. <06> <03A3>
  1989. <07> <03D2>
  1990. <08> <03A6>
  1991. <0B> <2191>
  1992. <0C> <2193>
  1993. <0D> <0027>
  1994. <0E> <00A1>
  1995. <0F> <00BF>
  1996. <10> <0131>
  1997. <11> <0237>
  1998. <12> <0060>
  1999. <13> <00B4>
  2000. <14> <02C7>
  2001. <15> <02D8>
  2002. <16> <00AF>
  2003. <17> <02DA>
  2004. <18> <00B8>
  2005. <19> <00DF>
  2006. <1A> <00E6>
  2007. <1B> <0153>
  2008. <1C> <00F8>
  2009. <1D> <00C6>
  2010. <1E> <0152>
  2011. <1F> <00D8>
  2012. <20> <2423>
  2013. <27> <2019>
  2014. <60> <2018>
  2015. <7F> <00A8>
  2016. endbfchar
  2017. endcmap
  2018. CMapName currentdict /CMap defineresource pop
  2019. end
  2020. end
  2021. %%EndResource
  2022. %%EOF
  2023. }\endgroup
  2024. \expandafter\edef\csname cmapOT1TT\endcsname#1{%
  2025. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  2026. }%
  2027. \fi\fi
  2028. % Set the font macro #1 to the font named \fontprefix#2.
  2029. % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
  2030. % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
  2031. % Example:
  2032. % #1 = \textrm
  2033. % #2 = \rmshape
  2034. % #3 = 10
  2035. % #4 = \mainmagstep
  2036. % #5 = OT1
  2037. %
  2038. \def\setfont#1#2#3#4#5{%
  2039. \font#1=\fontprefix#2#3 scaled #4
  2040. \csname cmap#5\endcsname#1%
  2041. }
  2042. % This is what gets called when #5 of \setfont is empty.
  2043. \let\cmap\gobble
  2044. %
  2045. % (end of cmaps)
  2046. % Use cm as the default font prefix.
  2047. % To specify the font prefix, you must define \fontprefix
  2048. % before you read in texinfo.tex.
  2049. \ifx\fontprefix\thisisundefined
  2050. \def\fontprefix{cm}
  2051. \fi
  2052. % Support font families that don't use the same naming scheme as CM.
  2053. \def\rmshape{r}
  2054. \def\rmbshape{bx} % where the normal face is bold
  2055. \def\bfshape{b}
  2056. \def\bxshape{bx}
  2057. \def\ttshape{tt}
  2058. \def\ttbshape{tt}
  2059. \def\ttslshape{sltt}
  2060. \def\itshape{ti}
  2061. \def\itbshape{bxti}
  2062. \def\slshape{sl}
  2063. \def\slbshape{bxsl}
  2064. \def\sfshape{ss}
  2065. \def\sfbshape{ss}
  2066. \def\scshape{csc}
  2067. \def\scbshape{csc}
  2068. % Definitions for a main text size of 11pt. (The default in Texinfo.)
  2069. %
  2070. \def\definetextfontsizexi{%
  2071. % Text fonts (11.2pt, magstep1).
  2072. \def\textnominalsize{11pt}
  2073. \edef\mainmagstep{\magstephalf}
  2074. \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
  2075. \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
  2076. \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
  2077. \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
  2078. \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
  2079. \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
  2080. \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
  2081. \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
  2082. \font\texti=cmmi10 scaled \mainmagstep
  2083. \font\textsy=cmsy10 scaled \mainmagstep
  2084. \def\textecsize{1095}
  2085. % A few fonts for @defun names and args.
  2086. \setfont\defbf\bfshape{10}{\magstep1}{OT1}
  2087. \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
  2088. \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
  2089. \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
  2090. \def\df{\let\ttfont=\deftt \let\bffont = \defbf
  2091. \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
  2092. % Fonts for indices, footnotes, small examples (9pt).
  2093. \def\smallnominalsize{9pt}
  2094. \setfont\smallrm\rmshape{9}{1000}{OT1}
  2095. \setfont\smalltt\ttshape{9}{1000}{OT1TT}
  2096. \setfont\smallbf\bfshape{10}{900}{OT1}
  2097. \setfont\smallit\itshape{9}{1000}{OT1IT}
  2098. \setfont\smallsl\slshape{9}{1000}{OT1}
  2099. \setfont\smallsf\sfshape{9}{1000}{OT1}
  2100. \setfont\smallsc\scshape{10}{900}{OT1}
  2101. \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
  2102. \font\smalli=cmmi9
  2103. \font\smallsy=cmsy9
  2104. \def\smallecsize{0900}
  2105. % Fonts for small examples (8pt).
  2106. \def\smallernominalsize{8pt}
  2107. \setfont\smallerrm\rmshape{8}{1000}{OT1}
  2108. \setfont\smallertt\ttshape{8}{1000}{OT1TT}
  2109. \setfont\smallerbf\bfshape{10}{800}{OT1}
  2110. \setfont\smallerit\itshape{8}{1000}{OT1IT}
  2111. \setfont\smallersl\slshape{8}{1000}{OT1}
  2112. \setfont\smallersf\sfshape{8}{1000}{OT1}
  2113. \setfont\smallersc\scshape{10}{800}{OT1}
  2114. \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
  2115. \font\smalleri=cmmi8
  2116. \font\smallersy=cmsy8
  2117. \def\smallerecsize{0800}
  2118. % Fonts for math mode superscripts (7pt).
  2119. \def\sevennominalsize{7pt}
  2120. \setfont\sevenrm\rmshape{7}{1000}{OT1}
  2121. \setfont\seventt\ttshape{10}{700}{OT1TT}
  2122. \setfont\sevenbf\bfshape{10}{700}{OT1}
  2123. \setfont\sevenit\itshape{7}{1000}{OT1IT}
  2124. \setfont\sevensl\slshape{10}{700}{OT1}
  2125. \setfont\sevensf\sfshape{10}{700}{OT1}
  2126. \setfont\sevensc\scshape{10}{700}{OT1}
  2127. \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
  2128. \font\seveni=cmmi7
  2129. \font\sevensy=cmsy7
  2130. \def\sevenecsize{0700}
  2131. % Fonts for title page (20.4pt):
  2132. \def\titlenominalsize{20pt}
  2133. \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
  2134. \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
  2135. \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
  2136. \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
  2137. \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
  2138. \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
  2139. \let\titlebf=\titlerm
  2140. \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
  2141. \font\titlei=cmmi12 scaled \magstep3
  2142. \font\titlesy=cmsy10 scaled \magstep4
  2143. \def\titleecsize{2074}
  2144. % Chapter (and unnumbered) fonts (17.28pt).
  2145. \def\chapnominalsize{17pt}
  2146. \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
  2147. \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
  2148. \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
  2149. \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
  2150. \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
  2151. \setfont\chapsf\sfbshape{17}{1000}{OT1}
  2152. \let\chapbf=\chaprm
  2153. \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
  2154. \font\chapi=cmmi12 scaled \magstep2
  2155. \font\chapsy=cmsy10 scaled \magstep3
  2156. \def\chapecsize{1728}
  2157. % Section fonts (14.4pt).
  2158. \def\secnominalsize{14pt}
  2159. \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
  2160. \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
  2161. \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
  2162. \setfont\secsl\slbshape{10}{\magstep2}{OT1}
  2163. \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
  2164. \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
  2165. \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
  2166. \let\secbf\secrm
  2167. \setfont\secsc\scbshape{10}{\magstep2}{OT1}
  2168. \font\seci=cmmi12 scaled \magstep1
  2169. \font\secsy=cmsy10 scaled \magstep2
  2170. \def\sececsize{1440}
  2171. % Subsection fonts (13.15pt).
  2172. \def\ssecnominalsize{13pt}
  2173. \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
  2174. \setfont\ssecit\itbshape{10}{1315}{OT1IT}
  2175. \setfont\ssecsl\slbshape{10}{1315}{OT1}
  2176. \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
  2177. \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
  2178. \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
  2179. \let\ssecbf\ssecrm
  2180. \setfont\ssecsc\scbshape{10}{1315}{OT1}
  2181. \font\sseci=cmmi12 scaled \magstephalf
  2182. \font\ssecsy=cmsy10 scaled 1315
  2183. \def\ssececsize{1200}
  2184. % Reduced fonts for @acronym in text (10pt).
  2185. \def\reducednominalsize{10pt}
  2186. \setfont\reducedrm\rmshape{10}{1000}{OT1}
  2187. \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
  2188. \setfont\reducedbf\bfshape{10}{1000}{OT1}
  2189. \setfont\reducedit\itshape{10}{1000}{OT1IT}
  2190. \setfont\reducedsl\slshape{10}{1000}{OT1}
  2191. \setfont\reducedsf\sfshape{10}{1000}{OT1}
  2192. \setfont\reducedsc\scshape{10}{1000}{OT1}
  2193. \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
  2194. \font\reducedi=cmmi10
  2195. \font\reducedsy=cmsy10
  2196. \def\reducedecsize{1000}
  2197. \textleading = 13.2pt % line spacing for 11pt CM
  2198. \textfonts % reset the current fonts
  2199. \rm
  2200. } % end of 11pt text font size definitions, \definetextfontsizexi
  2201. % Definitions to make the main text be 10pt Computer Modern, with
  2202. % section, chapter, etc., sizes following suit. This is for the GNU
  2203. % Press printing of the Emacs 22 manual. Maybe other manuals in the
  2204. % future. Used with @smallbook, which sets the leading to 12pt.
  2205. %
  2206. \def\definetextfontsizex{%
  2207. % Text fonts (10pt).
  2208. \def\textnominalsize{10pt}
  2209. \edef\mainmagstep{1000}
  2210. \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
  2211. \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
  2212. \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
  2213. \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
  2214. \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
  2215. \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
  2216. \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
  2217. \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
  2218. \font\texti=cmmi10 scaled \mainmagstep
  2219. \font\textsy=cmsy10 scaled \mainmagstep
  2220. \def\textecsize{1000}
  2221. % A few fonts for @defun names and args.
  2222. \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
  2223. \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
  2224. \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
  2225. \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
  2226. \def\df{\let\ttfont=\deftt \let\bffont = \defbf
  2227. \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
  2228. % Fonts for indices, footnotes, small examples (9pt).
  2229. \def\smallnominalsize{9pt}
  2230. \setfont\smallrm\rmshape{9}{1000}{OT1}
  2231. \setfont\smalltt\ttshape{9}{1000}{OT1TT}
  2232. \setfont\smallbf\bfshape{10}{900}{OT1}
  2233. \setfont\smallit\itshape{9}{1000}{OT1IT}
  2234. \setfont\smallsl\slshape{9}{1000}{OT1}
  2235. \setfont\smallsf\sfshape{9}{1000}{OT1}
  2236. \setfont\smallsc\scshape{10}{900}{OT1}
  2237. \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
  2238. \font\smalli=cmmi9
  2239. \font\smallsy=cmsy9
  2240. \def\smallecsize{0900}
  2241. % Fonts for small examples (8pt).
  2242. \def\smallernominalsize{8pt}
  2243. \setfont\smallerrm\rmshape{8}{1000}{OT1}
  2244. \setfont\smallertt\ttshape{8}{1000}{OT1TT}
  2245. \setfont\smallerbf\bfshape{10}{800}{OT1}
  2246. \setfont\smallerit\itshape{8}{1000}{OT1IT}
  2247. \setfont\smallersl\slshape{8}{1000}{OT1}
  2248. \setfont\smallersf\sfshape{8}{1000}{OT1}
  2249. \setfont\smallersc\scshape{10}{800}{OT1}
  2250. \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
  2251. \font\smalleri=cmmi8
  2252. \font\smallersy=cmsy8
  2253. \def\smallerecsize{0800}
  2254. % Fonts for math mode superscripts (7pt).
  2255. \def\sevennominalsize{7pt}
  2256. \setfont\sevenrm\rmshape{7}{1000}{OT1}
  2257. \setfont\seventt\ttshape{10}{700}{OT1TT}
  2258. \setfont\sevenbf\bfshape{10}{700}{OT1}
  2259. \setfont\sevenit\itshape{7}{1000}{OT1IT}
  2260. \setfont\sevensl\slshape{10}{700}{OT1}
  2261. \setfont\sevensf\sfshape{10}{700}{OT1}
  2262. \setfont\sevensc\scshape{10}{700}{OT1}
  2263. \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
  2264. \font\seveni=cmmi7
  2265. \font\sevensy=cmsy7
  2266. \def\sevenecsize{0700}
  2267. % Fonts for title page (20.4pt):
  2268. \def\titlenominalsize{20pt}
  2269. \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
  2270. \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
  2271. \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
  2272. \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
  2273. \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
  2274. \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
  2275. \let\titlebf=\titlerm
  2276. \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
  2277. \font\titlei=cmmi12 scaled \magstep3
  2278. \font\titlesy=cmsy10 scaled \magstep4
  2279. \def\titleecsize{2074}
  2280. % Chapter fonts (14.4pt).
  2281. \def\chapnominalsize{14pt}
  2282. \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
  2283. \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
  2284. \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
  2285. \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
  2286. \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
  2287. \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
  2288. \let\chapbf\chaprm
  2289. \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
  2290. \font\chapi=cmmi12 scaled \magstep1
  2291. \font\chapsy=cmsy10 scaled \magstep2
  2292. \def\chapecsize{1440}
  2293. % Section fonts (12pt).
  2294. \def\secnominalsize{12pt}
  2295. \setfont\secrm\rmbshape{12}{1000}{OT1}
  2296. \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
  2297. \setfont\secsl\slbshape{10}{\magstep1}{OT1}
  2298. \setfont\sectt\ttbshape{12}{1000}{OT1TT}
  2299. \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
  2300. \setfont\secsf\sfbshape{12}{1000}{OT1}
  2301. \let\secbf\secrm
  2302. \setfont\secsc\scbshape{10}{\magstep1}{OT1}
  2303. \font\seci=cmmi12
  2304. \font\secsy=cmsy10 scaled \magstep1
  2305. \def\sececsize{1200}
  2306. % Subsection fonts (10pt).
  2307. \def\ssecnominalsize{10pt}
  2308. \setfont\ssecrm\rmbshape{10}{1000}{OT1}
  2309. \setfont\ssecit\itbshape{10}{1000}{OT1IT}
  2310. \setfont\ssecsl\slbshape{10}{1000}{OT1}
  2311. \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
  2312. \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
  2313. \setfont\ssecsf\sfbshape{10}{1000}{OT1}
  2314. \let\ssecbf\ssecrm
  2315. \setfont\ssecsc\scbshape{10}{1000}{OT1}
  2316. \font\sseci=cmmi10
  2317. \font\ssecsy=cmsy10
  2318. \def\ssececsize{1000}
  2319. % Reduced fonts for @acronym in text (9pt).
  2320. \def\reducednominalsize{9pt}
  2321. \setfont\reducedrm\rmshape{9}{1000}{OT1}
  2322. \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
  2323. \setfont\reducedbf\bfshape{10}{900}{OT1}
  2324. \setfont\reducedit\itshape{9}{1000}{OT1IT}
  2325. \setfont\reducedsl\slshape{9}{1000}{OT1}
  2326. \setfont\reducedsf\sfshape{9}{1000}{OT1}
  2327. \setfont\reducedsc\scshape{10}{900}{OT1}
  2328. \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
  2329. \font\reducedi=cmmi9
  2330. \font\reducedsy=cmsy9
  2331. \def\reducedecsize{0900}
  2332. \divide\parskip by 2 % reduce space between paragraphs
  2333. \textleading = 12pt % line spacing for 10pt CM
  2334. \textfonts % reset the current fonts
  2335. \rm
  2336. } % end of 10pt text font size definitions, \definetextfontsizex
  2337. % Fonts for short table of contents.
  2338. \setfont\shortcontrm\rmshape{12}{1000}{OT1}
  2339. \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
  2340. \setfont\shortcontsl\slshape{12}{1000}{OT1}
  2341. \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
  2342. % We provide the user-level command
  2343. % @fonttextsize 10
  2344. % (or 11) to redefine the text font size. pt is assumed.
  2345. %
  2346. \def\xiword{11}
  2347. \def\xword{10}
  2348. \def\xwordpt{10pt}
  2349. %
  2350. \parseargdef\fonttextsize{%
  2351. \def\textsizearg{#1}%
  2352. %\wlog{doing @fonttextsize \textsizearg}%
  2353. %
  2354. % Set \globaldefs so that documents can use this inside @tex, since
  2355. % makeinfo 4.8 does not support it, but we need it nonetheless.
  2356. %
  2357. \begingroup \globaldefs=1
  2358. \ifx\textsizearg\xword \definetextfontsizex
  2359. \else \ifx\textsizearg\xiword \definetextfontsizexi
  2360. \else
  2361. \errhelp=\EMsimple
  2362. \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
  2363. \fi\fi
  2364. \endgroup
  2365. }
  2366. %
  2367. % Change the current font style to #1, remembering it in \curfontstyle.
  2368. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
  2369. % italics, not bold italics.
  2370. %
  2371. \def\setfontstyle#1{%
  2372. \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
  2373. \csname #1font\endcsname % change the current font
  2374. }
  2375. \def\rm{\fam=0 \setfontstyle{rm}}
  2376. \def\it{\fam=\itfam \setfontstyle{it}}
  2377. \def\sl{\fam=\slfam \setfontstyle{sl}}
  2378. \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
  2379. \def\tt{\fam=\ttfam \setfontstyle{tt}}
  2380. % Texinfo sort of supports the sans serif font style, which plain TeX does not.
  2381. % So we set up a \sf.
  2382. \newfam\sffam
  2383. \def\sf{\fam=\sffam \setfontstyle{sf}}
  2384. % We don't need math for this font style.
  2385. \def\ttsl{\setfontstyle{ttsl}}
  2386. % In order for the font changes to affect most math symbols and letters,
  2387. % we have to define the \textfont of the standard families.
  2388. % We don't bother to reset \scriptscriptfont; awaiting user need.
  2389. %
  2390. \def\resetmathfonts{%
  2391. \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
  2392. \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
  2393. \textfont\ttfam=\ttfont \textfont\sffam=\sffont
  2394. %
  2395. % Fonts for superscript. Note that the 7pt fonts are used regardless
  2396. % of the current font size.
  2397. \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
  2398. \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
  2399. \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
  2400. \scriptfont\sffam=\sevensf
  2401. }
  2402. %
  2403. % The font-changing commands (all called \...fonts) redefine the meanings
  2404. % of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
  2405. % to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
  2406. % commands hardwire \STYLEfont to set the current font.
  2407. %
  2408. % The fonts used for \ifont are for "math italics" (\itfont is for italics
  2409. % in regular text). \syfont is also used in math mode only.
  2410. %
  2411. % Each font-changing command also sets the names \lsize (one size lower)
  2412. % and \lllsize (three sizes lower). These relative commands are used
  2413. % in, e.g., the LaTeX logo and acronyms.
  2414. %
  2415. % This all needs generalizing, badly.
  2416. %
  2417. \def\assignfonts#1{%
  2418. \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
  2419. \expandafter\let\expandafter\itfont\csname #1it\endcsname
  2420. \expandafter\let\expandafter\slfont\csname #1sl\endcsname
  2421. \expandafter\let\expandafter\bffont\csname #1bf\endcsname
  2422. \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
  2423. \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
  2424. \expandafter\let\expandafter\sffont \csname #1sf\endcsname
  2425. \expandafter\let\expandafter\ifont \csname #1i\endcsname
  2426. \expandafter\let\expandafter\syfont \csname #1sy\endcsname
  2427. \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
  2428. }
  2429. \newif\ifrmisbold
  2430. % Select smaller font size with the current style. Used to change font size
  2431. % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
  2432. % normal roman text, also use bold fonts for roman text in the smaller size.
  2433. \def\switchtolllsize{%
  2434. \expandafter\assignfonts\expandafter{\lllsize}%
  2435. \ifrmisbold
  2436. \let\rmfont\bffont
  2437. \fi
  2438. \csname\curfontstyle\endcsname
  2439. }%
  2440. \def\switchtolsize{%
  2441. \expandafter\assignfonts\expandafter{\lsize}%
  2442. \ifrmisbold
  2443. \let\rmfont\bffont
  2444. \fi
  2445. \csname\curfontstyle\endcsname
  2446. }%
  2447. \def\definefontsetatsize#1#2#3#4#5{%
  2448. \expandafter\def\csname #1fonts\endcsname{%
  2449. \def\curfontsize{#1}%
  2450. \def\lsize{#2}\def\lllsize{#3}%
  2451. \csname rmisbold#5\endcsname
  2452. \assignfonts{#1}%
  2453. \resetmathfonts
  2454. \setleading{#4}%
  2455. }}
  2456. \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
  2457. \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
  2458. \definefontsetatsize{chap} {sec} {text} {19pt} {true}
  2459. \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
  2460. \definefontsetatsize{ssec} {text} {small} {15pt} {true}
  2461. \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
  2462. \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
  2463. \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
  2464. \def\titlefont#1{{\titlefonts\rm #1}}
  2465. \let\subsecfonts = \ssecfonts
  2466. \let\subsubsecfonts = \ssecfonts
  2467. % Define these just so they can be easily changed for other fonts.
  2468. \def\angleleft{$\langle$}
  2469. \def\angleright{$\rangle$}
  2470. % Set the fonts to use with the @small... environments.
  2471. \let\smallexamplefonts = \smallfonts
  2472. % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
  2473. % can fit this many characters:
  2474. % 8.5x11=86 smallbook=72 a4=90 a5=69
  2475. % If we use \scriptfonts (8pt), then we can fit this many characters:
  2476. % 8.5x11=90+ smallbook=80 a4=90+ a5=77
  2477. % For me, subjectively, the few extra characters that fit aren't worth
  2478. % the additional smallness of 8pt. So I'm making the default 9pt.
  2479. %
  2480. % By the way, for comparison, here's what fits with @example (10pt):
  2481. % 8.5x11=71 smallbook=60 a4=75 a5=58
  2482. % --karl, 24jan03.
  2483. % Set up the default fonts, so we can use them for creating boxes.
  2484. %
  2485. \definetextfontsizexi
  2486. \message{markup,}
  2487. % Check if we are currently using a typewriter font. Since all the
  2488. % Computer Modern typewriter fonts have zero interword stretch (and
  2489. % shrink), and it is reasonable to expect all typewriter fonts to have
  2490. % this property, we can check that font parameter.
  2491. %
  2492. \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
  2493. % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
  2494. % define and register \INITMACRO to be called on markup style changes.
  2495. % \INITMACRO can check \currentmarkupstyle for the innermost
  2496. % style.
  2497. \let\currentmarkupstyle\empty
  2498. \def\setupmarkupstyle#1{%
  2499. \def\currentmarkupstyle{#1}%
  2500. \markupstylesetup
  2501. }
  2502. \let\markupstylesetup\empty
  2503. \def\defmarkupstylesetup#1{%
  2504. \expandafter\def\expandafter\markupstylesetup
  2505. \expandafter{\markupstylesetup #1}%
  2506. \def#1%
  2507. }
  2508. % Markup style setup for left and right quotes.
  2509. \defmarkupstylesetup\markupsetuplq{%
  2510. \expandafter\let\expandafter \temp
  2511. \csname markupsetuplq\currentmarkupstyle\endcsname
  2512. \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
  2513. }
  2514. \defmarkupstylesetup\markupsetuprq{%
  2515. \expandafter\let\expandafter \temp
  2516. \csname markupsetuprq\currentmarkupstyle\endcsname
  2517. \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
  2518. }
  2519. {
  2520. \catcode`\'=\active
  2521. \catcode`\`=\active
  2522. \gdef\markupsetuplqdefault{\let`\lq}
  2523. \gdef\markupsetuprqdefault{\let'\rq}
  2524. \gdef\markupsetcodequoteleft{\let`\codequoteleft}
  2525. \gdef\markupsetcodequoteright{\let'\codequoteright}
  2526. }
  2527. \let\markupsetuplqcode \markupsetcodequoteleft
  2528. \let\markupsetuprqcode \markupsetcodequoteright
  2529. %
  2530. \let\markupsetuplqexample \markupsetcodequoteleft
  2531. \let\markupsetuprqexample \markupsetcodequoteright
  2532. %
  2533. \let\markupsetuplqkbd \markupsetcodequoteleft
  2534. \let\markupsetuprqkbd \markupsetcodequoteright
  2535. %
  2536. \let\markupsetuplqsamp \markupsetcodequoteleft
  2537. \let\markupsetuprqsamp \markupsetcodequoteright
  2538. %
  2539. \let\markupsetuplqverb \markupsetcodequoteleft
  2540. \let\markupsetuprqverb \markupsetcodequoteright
  2541. %
  2542. \let\markupsetuplqverbatim \markupsetcodequoteleft
  2543. \let\markupsetuprqverbatim \markupsetcodequoteright
  2544. % Allow an option to not use regular directed right quote/apostrophe
  2545. % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
  2546. % The undirected quote is ugly, so don't make it the default, but it
  2547. % works for pasting with more pdf viewers (at least evince), the
  2548. % lilypond developers report. xpdf does work with the regular 0x27.
  2549. %
  2550. \def\codequoteright{%
  2551. \ifmonospace
  2552. \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
  2553. \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
  2554. '%
  2555. \else \char'15 \fi
  2556. \else \char'15 \fi
  2557. \else
  2558. '%
  2559. \fi
  2560. }
  2561. %
  2562. % and a similar option for the left quote char vs. a grave accent.
  2563. % Modern fonts display ASCII 0x60 as a grave accent, so some people like
  2564. % the code environments to do likewise.
  2565. %
  2566. \def\codequoteleft{%
  2567. \ifmonospace
  2568. \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
  2569. \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
  2570. % [Knuth] pp. 380,381,391
  2571. % \relax disables Spanish ligatures ?` and !` of \tt font.
  2572. \relax`%
  2573. \else \char'22 \fi
  2574. \else \char'22 \fi
  2575. \else
  2576. \relax`%
  2577. \fi
  2578. }
  2579. % Commands to set the quote options.
  2580. %
  2581. \parseargdef\codequoteundirected{%
  2582. \def\temp{#1}%
  2583. \ifx\temp\onword
  2584. \expandafter\let\csname SETtxicodequoteundirected\endcsname
  2585. = t%
  2586. \else\ifx\temp\offword
  2587. \expandafter\let\csname SETtxicodequoteundirected\endcsname
  2588. = \relax
  2589. \else
  2590. \errhelp = \EMsimple
  2591. \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
  2592. \fi\fi
  2593. }
  2594. %
  2595. \parseargdef\codequotebacktick{%
  2596. \def\temp{#1}%
  2597. \ifx\temp\onword
  2598. \expandafter\let\csname SETtxicodequotebacktick\endcsname
  2599. = t%
  2600. \else\ifx\temp\offword
  2601. \expandafter\let\csname SETtxicodequotebacktick\endcsname
  2602. = \relax
  2603. \else
  2604. \errhelp = \EMsimple
  2605. \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
  2606. \fi\fi
  2607. }
  2608. % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
  2609. \def\noligaturesquoteleft{\relax\lq}
  2610. % Count depth in font-changes, for error checks
  2611. \newcount\fontdepth \fontdepth=0
  2612. % Font commands.
  2613. % #1 is the font command (\sl or \it), #2 is the text to slant.
  2614. % If we are in a monospaced environment, however, 1) always use \ttsl,
  2615. % and 2) do not add an italic correction.
  2616. \def\dosmartslant#1#2{%
  2617. \ifusingtt
  2618. {{\ttsl #2}\let\next=\relax}%
  2619. {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
  2620. \next
  2621. }
  2622. \def\smartslanted{\dosmartslant\sl}
  2623. \def\smartitalic{\dosmartslant\it}
  2624. % Output an italic correction unless \next (presumed to be the following
  2625. % character) is such as not to need one.
  2626. \def\smartitaliccorrection{%
  2627. \ifx\next,%
  2628. \else\ifx\next-%
  2629. \else\ifx\next.%
  2630. \else\ifx\next\.%
  2631. \else\ifx\next\comma%
  2632. \else\ptexslash
  2633. \fi\fi\fi\fi\fi
  2634. \aftersmartic
  2635. }
  2636. % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
  2637. \def\ttslanted#1{{\ttsl #1}}
  2638. % @cite is like \smartslanted except unconditionally use \sl. We never want
  2639. % ttsl for book titles, do we?
  2640. \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
  2641. \def\aftersmartic{}
  2642. \def\var#1{%
  2643. \let\saveaftersmartic = \aftersmartic
  2644. \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
  2645. \smartslanted{#1}%
  2646. }
  2647. \let\i=\smartitalic
  2648. \let\slanted=\smartslanted
  2649. \let\dfn=\smartslanted
  2650. \let\emph=\smartitalic
  2651. % Explicit font changes: @r, @sc, undocumented @ii.
  2652. \def\r#1{{\rm #1}} % roman font
  2653. \def\sc#1{{\smallcaps#1}} % smallcaps font
  2654. \def\ii#1{{\it #1}} % italic font
  2655. % @b, explicit bold. Also @strong.
  2656. \def\b#1{{\bf #1}}
  2657. \let\strong=\b
  2658. % @sansserif, explicit sans.
  2659. \def\sansserif#1{{\sf #1}}
  2660. % We can't just use \exhyphenpenalty, because that only has effect at
  2661. % the end of a paragraph. Restore normal hyphenation at the end of the
  2662. % group within which \nohyphenation is presumably called.
  2663. %
  2664. \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
  2665. \def\restorehyphenation{\hyphenchar\font = `- }
  2666. % Set sfcode to normal for the chars that usually have another value.
  2667. % Can't use plain's \frenchspacing because it uses the `\x notation, and
  2668. % sometimes \x has an active definition that messes things up.
  2669. %
  2670. \catcode`@=11
  2671. \def\plainfrenchspacing{%
  2672. \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
  2673. \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
  2674. \def\endofsentencespacefactor{1000}% for @. and friends
  2675. }
  2676. \def\plainnonfrenchspacing{%
  2677. \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
  2678. \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
  2679. \def\endofsentencespacefactor{3000}% for @. and friends
  2680. }
  2681. \catcode`@=\other
  2682. \def\endofsentencespacefactor{3000}% default
  2683. % @t, explicit typewriter.
  2684. \def\t#1{%
  2685. {\tt \rawbackslash \plainfrenchspacing #1}%
  2686. \null
  2687. }
  2688. % @samp.
  2689. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
  2690. % @indicateurl is \samp, that is, with quotes.
  2691. \let\indicateurl=\samp
  2692. % @code (and similar) prints in typewriter, but with spaces the same
  2693. % size as normal in the surrounding text, without hyphenation, etc.
  2694. % This is a subroutine for that.
  2695. \def\tclose#1{%
  2696. {%
  2697. % Change normal interword space to be same as for the current font.
  2698. \spaceskip = \fontdimen2\font
  2699. %
  2700. % Switch to typewriter.
  2701. \tt
  2702. %
  2703. % But `\ ' produces the large typewriter interword space.
  2704. \def\ {{\spaceskip = 0pt{} }}%
  2705. %
  2706. % Turn off hyphenation.
  2707. \nohyphenation
  2708. %
  2709. \rawbackslash
  2710. \plainfrenchspacing
  2711. #1%
  2712. }%
  2713. \null % reset spacefactor to 1000
  2714. }
  2715. % We *must* turn on hyphenation at `-' and `_' in @code.
  2716. % (But see \codedashfinish below.)
  2717. % Otherwise, it is too hard to avoid overfull hboxes
  2718. % in the Emacs manual, the Library manual, etc.
  2719. %
  2720. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  2721. % both hyphenation at - and hyphenation within words.
  2722. % We must therefore turn them both off (\tclose does that)
  2723. % and arrange explicitly to hyphenate at a dash. -- rms.
  2724. {
  2725. \catcode`\-=\active \catcode`\_=\active
  2726. \catcode`\'=\active \catcode`\`=\active
  2727. \global\let'=\rq \global\let`=\lq % default definitions
  2728. %
  2729. \global\def\code{\begingroup
  2730. \setupmarkupstyle{code}%
  2731. % The following should really be moved into \setupmarkupstyle handlers.
  2732. \catcode\dashChar=\active \catcode\underChar=\active
  2733. \ifallowcodebreaks
  2734. \let-\codedash
  2735. \let_\codeunder
  2736. \else
  2737. \let-\normaldash
  2738. \let_\realunder
  2739. \fi
  2740. % Given -foo (with a single dash), we do not want to allow a break
  2741. % after the hyphen.
  2742. \global\let\codedashprev=\codedash
  2743. %
  2744. \codex
  2745. }
  2746. %
  2747. \gdef\codedash{\futurelet\next\codedashfinish}
  2748. \gdef\codedashfinish{%
  2749. \normaldash % always output the dash character itself.
  2750. %
  2751. % Now, output a discretionary to allow a line break, unless
  2752. % (a) the next character is a -, or
  2753. % (b) the preceding character is a -.
  2754. % E.g., given --posix, we do not want to allow a break after either -.
  2755. % Given --foo-bar, we do want to allow a break between the - and the b.
  2756. \ifx\next\codedash \else
  2757. \ifx\codedashprev\codedash
  2758. \else \discretionary{}{}{}\fi
  2759. \fi
  2760. % we need the space after the = for the case when \next itself is a
  2761. % space token; it would get swallowed otherwise. As in @code{- a}.
  2762. \global\let\codedashprev= \next
  2763. }
  2764. }
  2765. \def\normaldash{-}
  2766. %
  2767. \def\codex #1{\tclose{#1}\endgroup}
  2768. \def\codeunder{%
  2769. % this is all so @math{@code{var_name}+1} can work. In math mode, _
  2770. % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  2771. % will therefore expand the active definition of _, which is us
  2772. % (inside @code that is), therefore an endless loop.
  2773. \ifusingtt{\ifmmode
  2774. \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
  2775. \else\normalunderscore \fi
  2776. \discretionary{}{}{}}%
  2777. {\_}%
  2778. }
  2779. % An additional complication: the above will allow breaks after, e.g.,
  2780. % each of the four underscores in __typeof__. This is bad.
  2781. % @allowcodebreaks provides a document-level way to turn breaking at -
  2782. % and _ on and off.
  2783. %
  2784. \newif\ifallowcodebreaks \allowcodebreakstrue
  2785. \def\keywordtrue{true}
  2786. \def\keywordfalse{false}
  2787. \parseargdef\allowcodebreaks{%
  2788. \def\txiarg{#1}%
  2789. \ifx\txiarg\keywordtrue
  2790. \allowcodebreakstrue
  2791. \else\ifx\txiarg\keywordfalse
  2792. \allowcodebreaksfalse
  2793. \else
  2794. \errhelp = \EMsimple
  2795. \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
  2796. \fi\fi
  2797. }
  2798. % For @command, @env, @file, @option quotes seem unnecessary,
  2799. % so use \code rather than \samp.
  2800. \let\command=\code
  2801. \let\env=\code
  2802. \let\file=\code
  2803. \let\option=\code
  2804. % @uref (abbreviation for `urlref') aka @url takes an optional
  2805. % (comma-separated) second argument specifying the text to display and
  2806. % an optional third arg as text to display instead of (rather than in
  2807. % addition to) the url itself. First (mandatory) arg is the url.
  2808. % TeX-only option to allow changing PDF output to show only the second
  2809. % arg (if given), and not the url (which is then just the link target).
  2810. \newif\ifurefurlonlylink
  2811. % The main macro is \urefbreak, which allows breaking at expected
  2812. % places within the url. (There used to be another version, which
  2813. % didn't support automatic breaking.)
  2814. \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
  2815. \let\uref=\urefbreak
  2816. %
  2817. \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
  2818. \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
  2819. \unsepspaces
  2820. \pdfurl{#1}%
  2821. \setbox0 = \hbox{\ignorespaces #3}%
  2822. \ifdim\wd0 > 0pt
  2823. \unhbox0 % third arg given, show only that
  2824. \else
  2825. \setbox0 = \hbox{\ignorespaces #2}% look for second arg
  2826. \ifdim\wd0 > 0pt
  2827. \ifpdf
  2828. % For pdfTeX and LuaTeX
  2829. \ifurefurlonlylink
  2830. % PDF plus option to not display url, show just arg
  2831. \unhbox0
  2832. \else
  2833. % PDF, normally display both arg and url for consistency,
  2834. % visibility, if the pdf is eventually used to print, etc.
  2835. \unhbox0\ (\urefcode{#1})%
  2836. \fi
  2837. \else
  2838. \ifx\XeTeXrevision\thisisundefined
  2839. \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
  2840. \else
  2841. % For XeTeX
  2842. \ifurefurlonlylink
  2843. % PDF plus option to not display url, show just arg
  2844. \unhbox0
  2845. \else
  2846. % PDF, normally display both arg and url for consistency,
  2847. % visibility, if the pdf is eventually used to print, etc.
  2848. \unhbox0\ (\urefcode{#1})%
  2849. \fi
  2850. \fi
  2851. \fi
  2852. \else
  2853. \urefcode{#1}% only url given, so show it
  2854. \fi
  2855. \fi
  2856. \endlink
  2857. \endgroup}
  2858. % Allow line breaks around only a few characters (only).
  2859. \def\urefcatcodes{%
  2860. \catcode`\&=\active \catcode`\.=\active
  2861. \catcode`\#=\active \catcode`\?=\active
  2862. \catcode`\/=\active
  2863. }
  2864. {
  2865. \urefcatcodes
  2866. %
  2867. \global\def\urefcode{\begingroup
  2868. \setupmarkupstyle{code}%
  2869. \urefcatcodes
  2870. \let&\urefcodeamp
  2871. \let.\urefcodedot
  2872. \let#\urefcodehash
  2873. \let?\urefcodequest
  2874. \let/\urefcodeslash
  2875. \codex
  2876. }
  2877. %
  2878. % By default, they are just regular characters.
  2879. \global\def&{\normalamp}
  2880. \global\def.{\normaldot}
  2881. \global\def#{\normalhash}
  2882. \global\def?{\normalquest}
  2883. \global\def/{\normalslash}
  2884. }
  2885. % we put a little stretch before and after the breakable chars, to help
  2886. % line breaking of long url's. The unequal skips make look better in
  2887. % cmtt at least, especially for dots.
  2888. \def\urefprestretchamount{.13em}
  2889. \def\urefpoststretchamount{.1em}
  2890. \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
  2891. \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
  2892. %
  2893. \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
  2894. \def\urefcodedot{\urefprestretch .\urefpoststretch}
  2895. \def\urefcodehash{\urefprestretch \#\urefpoststretch}
  2896. \def\urefcodequest{\urefprestretch ?\urefpoststretch}
  2897. \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
  2898. {
  2899. \catcode`\/=\active
  2900. \global\def\urefcodeslashfinish{%
  2901. \urefprestretch \slashChar
  2902. % Allow line break only after the final / in a sequence of
  2903. % slashes, to avoid line break between the slashes in http://.
  2904. \ifx\next/\else \urefpoststretch \fi
  2905. }
  2906. }
  2907. % One more complication: by default we'll break after the special
  2908. % characters, but some people like to break before the special chars, so
  2909. % allow that. Also allow no breaking at all, for manual control.
  2910. %
  2911. \parseargdef\urefbreakstyle{%
  2912. \def\txiarg{#1}%
  2913. \ifx\txiarg\wordnone
  2914. \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
  2915. \else\ifx\txiarg\wordbefore
  2916. \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
  2917. \else\ifx\txiarg\wordafter
  2918. \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
  2919. \else
  2920. \errhelp = \EMsimple
  2921. \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
  2922. \fi\fi\fi
  2923. }
  2924. \def\wordafter{after}
  2925. \def\wordbefore{before}
  2926. \def\wordnone{none}
  2927. \urefbreakstyle after
  2928. % @url synonym for @uref, since that's how everyone uses it.
  2929. %
  2930. \let\url=\uref
  2931. % rms does not like angle brackets --karl, 17may97.
  2932. % So now @email is just like @uref, unless we are pdf.
  2933. %
  2934. %\def\email#1{\angleleft{\tt #1}\angleright}
  2935. \ifpdf
  2936. \def\email#1{\doemail#1,,\finish}
  2937. \def\doemail#1,#2,#3\finish{\begingroup
  2938. \unsepspaces
  2939. \pdfurl{mailto:#1}%
  2940. \setbox0 = \hbox{\ignorespaces #2}%
  2941. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  2942. \endlink
  2943. \endgroup}
  2944. \else
  2945. \ifx\XeTeXrevision\thisisundefined
  2946. \let\email=\uref
  2947. \else
  2948. \def\email#1{\doemail#1,,\finish}
  2949. \def\doemail#1,#2,#3\finish{\begingroup
  2950. \unsepspaces
  2951. \pdfurl{mailto:#1}%
  2952. \setbox0 = \hbox{\ignorespaces #2}%
  2953. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  2954. \endlink
  2955. \endgroup}
  2956. \fi
  2957. \fi
  2958. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  2959. % `example' (@kbd uses ttsl only inside of @example and friends),
  2960. % or `code' (@kbd uses normal tty font always).
  2961. \parseargdef\kbdinputstyle{%
  2962. \def\txiarg{#1}%
  2963. \ifx\txiarg\worddistinct
  2964. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  2965. \else\ifx\txiarg\wordexample
  2966. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  2967. \else\ifx\txiarg\wordcode
  2968. \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  2969. \else
  2970. \errhelp = \EMsimple
  2971. \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
  2972. \fi\fi\fi
  2973. }
  2974. \def\worddistinct{distinct}
  2975. \def\wordexample{example}
  2976. \def\wordcode{code}
  2977. % Default is `distinct'.
  2978. \kbdinputstyle distinct
  2979. % @kbd is like @code, except that if the argument is just one @key command,
  2980. % then @kbd has no effect.
  2981. \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
  2982. \def\xkey{\key}
  2983. \def\kbdsub#1#2#3\par{%
  2984. \def\one{#1}\def\three{#3}\def\threex{??}%
  2985. \ifx\one\xkey\ifx\threex\three \key{#2}%
  2986. \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  2987. \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  2988. }
  2989. % definition of @key that produces a lozenge. Doesn't adjust to text size.
  2990. %\setfont\keyrm\rmshape{8}{1000}{OT1}
  2991. %\font\keysy=cmsy9
  2992. %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
  2993. % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
  2994. % \vbox{\hrule\kern-0.4pt
  2995. % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
  2996. % \kern-0.4pt\hrule}%
  2997. % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
  2998. % definition of @key with no lozenge. If the current font is already
  2999. % monospace, don't change it; that way, we respect @kbdinputstyle. But
  3000. % if it isn't monospace, then use \tt.
  3001. %
  3002. \def\key#1{{\setupmarkupstyle{key}%
  3003. \nohyphenation
  3004. \ifmonospace\else\tt\fi
  3005. #1}\null}
  3006. % @clicksequence{File @click{} Open ...}
  3007. \def\clicksequence#1{\begingroup #1\endgroup}
  3008. % @clickstyle @arrow (by default)
  3009. \parseargdef\clickstyle{\def\click{#1}}
  3010. \def\click{\arrow}
  3011. % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
  3012. % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
  3013. %
  3014. \def\dmn#1{\thinspace #1}
  3015. % @acronym for "FBI", "NATO", and the like.
  3016. % We print this one point size smaller, since it's intended for
  3017. % all-uppercase.
  3018. %
  3019. \def\acronym#1{\doacronym #1,,\finish}
  3020. \def\doacronym#1,#2,#3\finish{%
  3021. {\switchtolsize #1}%
  3022. \def\temp{#2}%
  3023. \ifx\temp\empty \else
  3024. \space ({\unsepspaces \ignorespaces \temp \unskip})%
  3025. \fi
  3026. \null % reset \spacefactor=1000
  3027. }
  3028. % @abbr for "Comput. J." and the like.
  3029. % No font change, but don't do end-of-sentence spacing.
  3030. %
  3031. \def\abbr#1{\doabbr #1,,\finish}
  3032. \def\doabbr#1,#2,#3\finish{%
  3033. {\plainfrenchspacing #1}%
  3034. \def\temp{#2}%
  3035. \ifx\temp\empty \else
  3036. \space ({\unsepspaces \ignorespaces \temp \unskip})%
  3037. \fi
  3038. \null % reset \spacefactor=1000
  3039. }
  3040. % @asis just yields its argument. Used with @table, for example.
  3041. %
  3042. \def\asis#1{#1}
  3043. % @math outputs its argument in math mode.
  3044. %
  3045. % One complication: _ usually means subscripts, but it could also mean
  3046. % an actual _ character, as in @math{@var{some_variable} + 1}. So make
  3047. % _ active, and distinguish by seeing if the current family is \slfam,
  3048. % which is what @var uses.
  3049. {
  3050. \catcode`\_ = \active
  3051. \gdef\mathunderscore{%
  3052. \catcode`\_=\active
  3053. \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
  3054. }
  3055. }
  3056. % Another complication: we want \\ (and @\) to output a math (or tt) \.
  3057. % FYI, plain.tex uses \\ as a temporary control sequence (for no
  3058. % particular reason), but this is not advertised and we don't care.
  3059. %
  3060. % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
  3061. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
  3062. %
  3063. \def\math{%
  3064. \ifmmode\else % only go into math if not in math mode already
  3065. \tex
  3066. \mathunderscore
  3067. \let\\ = \mathbackslash
  3068. \mathactive
  3069. % make the texinfo accent commands work in math mode
  3070. \let\"=\ddot
  3071. \let\'=\acute
  3072. \let\==\bar
  3073. \let\^=\hat
  3074. \let\`=\grave
  3075. \let\u=\breve
  3076. \let\v=\check
  3077. \let\~=\tilde
  3078. \let\dotaccent=\dot
  3079. % have to provide another name for sup operator
  3080. \let\mathopsup=\sup
  3081. $\expandafter\finishmath\fi
  3082. }
  3083. \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
  3084. % Some active characters (such as <) are spaced differently in math.
  3085. % We have to reset their definitions in case the @math was an argument
  3086. % to a command which sets the catcodes (such as @item or @section).
  3087. %
  3088. {
  3089. \catcode`^ = \active
  3090. \catcode`< = \active
  3091. \catcode`> = \active
  3092. \catcode`+ = \active
  3093. \catcode`' = \active
  3094. \gdef\mathactive{%
  3095. \let^ = \ptexhat
  3096. \let< = \ptexless
  3097. \let> = \ptexgtr
  3098. \let+ = \ptexplus
  3099. \let' = \ptexquoteright
  3100. }
  3101. }
  3102. % for @sub and @sup, if in math mode, just do a normal sub/superscript.
  3103. % If in text, use math to place as sub/superscript, but switch
  3104. % into text mode, with smaller fonts. This is a different font than the
  3105. % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
  3106. % fix it (significant additions to font machinery) until someone notices.
  3107. %
  3108. \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
  3109. \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
  3110. %
  3111. \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
  3112. \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
  3113. % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
  3114. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
  3115. % except specified as a normal braced arg, so no newlines to worry about.
  3116. %
  3117. \def\outfmtnametex{tex}
  3118. %
  3119. \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
  3120. \long\def\doinlinefmt#1,#2,\finish{%
  3121. \def\inlinefmtname{#1}%
  3122. \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
  3123. }
  3124. %
  3125. % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
  3126. % FMTNAME is tex, else ELSE-TEXT.
  3127. \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
  3128. \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
  3129. \def\inlinefmtname{#1}%
  3130. \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
  3131. }
  3132. %
  3133. % For raw, must switch into @tex before parsing the argument, to avoid
  3134. % setting catcodes prematurely. Doing it this way means that, for
  3135. % example, @inlineraw{html, foo{bar} gets a parse error instead of being
  3136. % ignored. But this isn't important because if people want a literal
  3137. % *right* brace they would have to use a command anyway, so they may as
  3138. % well use a command to get a left brace too. We could re-use the
  3139. % delimiter character idea from \verb, but it seems like overkill.
  3140. %
  3141. \long\def\inlineraw{\tex \doinlineraw}
  3142. \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
  3143. \def\doinlinerawtwo#1,#2,\finish{%
  3144. \def\inlinerawname{#1}%
  3145. \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
  3146. \endgroup % close group opened by \tex.
  3147. }
  3148. % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
  3149. %
  3150. \long\def\inlineifset#1{\doinlineifset #1,\finish}
  3151. \long\def\doinlineifset#1,#2,\finish{%
  3152. \def\inlinevarname{#1}%
  3153. \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
  3154. \else\ignorespaces#2\fi
  3155. }
  3156. % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
  3157. %
  3158. \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
  3159. \long\def\doinlineifclear#1,#2,\finish{%
  3160. \def\inlinevarname{#1}%
  3161. \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
  3162. }
  3163. \message{glyphs,}
  3164. % and logos.
  3165. % @@ prints an @, as does @atchar{}.
  3166. \def\@{\char64 }
  3167. \let\atchar=\@
  3168. % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
  3169. \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
  3170. \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
  3171. \let\{=\lbracechar
  3172. \let\}=\rbracechar
  3173. % @comma{} to avoid , parsing problems.
  3174. \let\comma = ,
  3175. % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  3176. % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
  3177. \let\, = \ptexc
  3178. \let\dotaccent = \ptexdot
  3179. \def\ringaccent#1{{\accent23 #1}}
  3180. \let\tieaccent = \ptext
  3181. \let\ubaraccent = \ptexb
  3182. \let\udotaccent = \d
  3183. % Other special characters: @questiondown @exclamdown @ordf @ordm
  3184. % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
  3185. \def\questiondown{?`}
  3186. \def\exclamdown{!`}
  3187. \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
  3188. \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
  3189. % Dotless i and dotless j, used for accents.
  3190. \def\imacro{i}
  3191. \def\jmacro{j}
  3192. \def\dotless#1{%
  3193. \def\temp{#1}%
  3194. \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
  3195. \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
  3196. \else \errmessage{@dotless can be used only with i or j}%
  3197. \fi\fi
  3198. }
  3199. % The \TeX{} logo, as in plain, but resetting the spacing so that a
  3200. % period following counts as ending a sentence. (Idea found in latex.)
  3201. %
  3202. \edef\TeX{\TeX \spacefactor=1000 }
  3203. % @LaTeX{} logo. Not quite the same results as the definition in
  3204. % latex.ltx, since we use a different font for the raised A; it's most
  3205. % convenient for us to use an explicitly smaller font, rather than using
  3206. % the \scriptstyle font (since we don't reset \scriptstyle and
  3207. % \scriptscriptstyle).
  3208. %
  3209. \def\LaTeX{%
  3210. L\kern-.36em
  3211. {\setbox0=\hbox{T}%
  3212. \vbox to \ht0{\hbox{%
  3213. \ifx\textnominalsize\xwordpt
  3214. % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
  3215. % Revert to plain's \scriptsize, which is 7pt.
  3216. \count255=\the\fam $\fam\count255 \scriptstyle A$%
  3217. \else
  3218. % For 11pt, we can use our lllsize.
  3219. \switchtolllsize A%
  3220. \fi
  3221. }%
  3222. \vss
  3223. }}%
  3224. \kern-.15em
  3225. \TeX
  3226. }
  3227. % Some math mode symbols. Define \ensuremath to switch into math mode
  3228. % unless we are already there. Expansion tricks may not be needed here,
  3229. % but safer, and can't hurt.
  3230. \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
  3231. \def\ensuredmath#1{$\relax#1$}
  3232. %
  3233. \def\bullet{\ensuremath\ptexbullet}
  3234. \def\geq{\ensuremath\ge}
  3235. \def\leq{\ensuremath\le}
  3236. \def\minus{\ensuremath-}
  3237. % @dots{} outputs an ellipsis using the current font.
  3238. % We do .5em per period so that it has the same spacing in the cm
  3239. % typewriter fonts as three actual period characters; on the other hand,
  3240. % in other typewriter fonts three periods are wider than 1.5em. So do
  3241. % whichever is larger.
  3242. %
  3243. \def\dots{%
  3244. \leavevmode
  3245. \setbox0=\hbox{...}% get width of three periods
  3246. \ifdim\wd0 > 1.5em
  3247. \dimen0 = \wd0
  3248. \else
  3249. \dimen0 = 1.5em
  3250. \fi
  3251. \hbox to \dimen0{%
  3252. \hskip 0pt plus.25fil
  3253. .\hskip 0pt plus1fil
  3254. .\hskip 0pt plus1fil
  3255. .\hskip 0pt plus.5fil
  3256. }%
  3257. }
  3258. % @enddots{} is an end-of-sentence ellipsis.
  3259. %
  3260. \def\enddots{%
  3261. \dots
  3262. \spacefactor=\endofsentencespacefactor
  3263. }
  3264. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
  3265. %
  3266. % Since these characters are used in examples, they should be an even number of
  3267. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  3268. %
  3269. \def\point{$\star$}
  3270. \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
  3271. \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  3272. \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
  3273. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  3274. \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  3275. % The @error{} command.
  3276. % Adapted from the TeXbook's \boxit.
  3277. %
  3278. \newbox\errorbox
  3279. %
  3280. {\ttfont \global\dimen0 = 3em}% Width of the box.
  3281. \dimen2 = .55pt % Thickness of rules
  3282. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  3283. \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
  3284. %
  3285. \setbox\errorbox=\hbox to \dimen0{\hfil
  3286. \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  3287. \advance\hsize by -2\dimen2 % Rules.
  3288. \vbox{%
  3289. \hrule height\dimen2
  3290. \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
  3291. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  3292. \kern3pt\vrule width\dimen2}% Space to right.
  3293. \hrule height\dimen2}
  3294. \hfil}
  3295. %
  3296. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  3297. % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
  3298. %
  3299. \def\pounds{{\it\$}}
  3300. % @euro{} comes from a separate font, depending on the current style.
  3301. % We use the free feym* fonts from the eurosym package by Henrik
  3302. % Theiling, which support regular, slanted, bold and bold slanted (and
  3303. % "outlined" (blackboard board, sort of) versions, which we don't need).
  3304. % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
  3305. %
  3306. % Although only regular is the truly official Euro symbol, we ignore
  3307. % that. The Euro is designed to be slightly taller than the regular
  3308. % font height.
  3309. %
  3310. % feymr - regular
  3311. % feymo - slanted
  3312. % feybr - bold
  3313. % feybo - bold slanted
  3314. %
  3315. % There is no good (free) typewriter version, to my knowledge.
  3316. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
  3317. % Hmm.
  3318. %
  3319. % Also doesn't work in math. Do we need to do math with euro symbols?
  3320. % Hope not.
  3321. %
  3322. %
  3323. \def\euro{{\eurofont e}}
  3324. \def\eurofont{%
  3325. % We set the font at each command, rather than predefining it in
  3326. % \textfonts and the other font-switching commands, so that
  3327. % installations which never need the symbol don't have to have the
  3328. % font installed.
  3329. %
  3330. % There is only one designed size (nominal 10pt), so we always scale
  3331. % that to the current nominal size.
  3332. %
  3333. % By the way, simply using "at 1em" works for cmr10 and the like, but
  3334. % does not work for cmbx10 and other extended/shrunken fonts.
  3335. %
  3336. \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
  3337. %
  3338. \ifx\curfontstyle\bfstylename
  3339. % bold:
  3340. \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
  3341. \else
  3342. % regular:
  3343. \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
  3344. \fi
  3345. \thiseurofont
  3346. }
  3347. % Glyphs from the EC fonts. We don't use \let for the aliases, because
  3348. % sometimes we redefine the original macro, and the alias should reflect
  3349. % the redefinition.
  3350. %
  3351. % Use LaTeX names for the Icelandic letters.
  3352. \def\DH{{\ecfont \char"D0}} % Eth
  3353. \def\dh{{\ecfont \char"F0}} % eth
  3354. \def\TH{{\ecfont \char"DE}} % Thorn
  3355. \def\th{{\ecfont \char"FE}} % thorn
  3356. %
  3357. \def\guillemetleft{{\ecfont \char"13}}
  3358. \def\guillemotleft{\guillemetleft}
  3359. \def\guillemetright{{\ecfont \char"14}}
  3360. \def\guillemotright{\guillemetright}
  3361. \def\guilsinglleft{{\ecfont \char"0E}}
  3362. \def\guilsinglright{{\ecfont \char"0F}}
  3363. \def\quotedblbase{{\ecfont \char"12}}
  3364. \def\quotesinglbase{{\ecfont \char"0D}}
  3365. %
  3366. % This positioning is not perfect (see the ogonek LaTeX package), but
  3367. % we have the precomposed glyphs for the most common cases. We put the
  3368. % tests to use those glyphs in the single \ogonek macro so we have fewer
  3369. % dummy definitions to worry about for index entries, etc.
  3370. %
  3371. % ogonek is also used with other letters in Lithuanian (IOU), but using
  3372. % the precomposed glyphs for those is not so easy since they aren't in
  3373. % the same EC font.
  3374. \def\ogonek#1{{%
  3375. \def\temp{#1}%
  3376. \ifx\temp\macrocharA\Aogonek
  3377. \else\ifx\temp\macrochara\aogonek
  3378. \else\ifx\temp\macrocharE\Eogonek
  3379. \else\ifx\temp\macrochare\eogonek
  3380. \else
  3381. \ecfont \setbox0=\hbox{#1}%
  3382. \ifdim\ht0=1ex\accent"0C #1%
  3383. \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
  3384. \fi
  3385. \fi\fi\fi\fi
  3386. }%
  3387. }
  3388. \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
  3389. \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
  3390. \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
  3391. \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
  3392. %
  3393. % Use the European Computer Modern fonts (cm-super in outline format)
  3394. % for non-CM glyphs. That is ec* for regular text and tc* for the text
  3395. % companion symbols (LaTeX TS1 encoding). Both are part of the ec
  3396. % package and follow the same conventions.
  3397. %
  3398. \def\ecfont{\etcfont{e}}
  3399. \def\tcfont{\etcfont{t}}
  3400. %
  3401. \def\etcfont#1{%
  3402. % We can't distinguish serif/sans and italic/slanted, but this
  3403. % is used for crude hacks anyway (like adding French and German
  3404. % quotes to documents typeset with CM, where we lose kerning), so
  3405. % hopefully nobody will notice/care.
  3406. \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
  3407. \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
  3408. \ifmonospace
  3409. % typewriter:
  3410. \font\thisecfont = #1ctt\ecsize \space at \nominalsize
  3411. \else
  3412. \ifx\curfontstyle\bfstylename
  3413. % bold:
  3414. \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
  3415. \else
  3416. % regular:
  3417. \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
  3418. \fi
  3419. \fi
  3420. \thisecfont
  3421. }
  3422. % @registeredsymbol - R in a circle. The font for the R should really
  3423. % be smaller yet, but lllsize is the best we can do for now.
  3424. % Adapted from the plain.tex definition of \copyright.
  3425. %
  3426. \def\registeredsymbol{%
  3427. $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
  3428. \hfil\crcr\Orb}}%
  3429. }$%
  3430. }
  3431. % @textdegree - the normal degrees sign.
  3432. %
  3433. \def\textdegree{$^\circ$}
  3434. % Laurent Siebenmann reports \Orb undefined with:
  3435. % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
  3436. % so we'll define it if necessary.
  3437. %
  3438. \ifx\Orb\thisisundefined
  3439. \def\Orb{\mathhexbox20D}
  3440. \fi
  3441. % Quotes.
  3442. \chardef\quotedblleft="5C
  3443. \chardef\quotedblright=`\"
  3444. \chardef\quoteleft=`\`
  3445. \chardef\quoteright=`\'
  3446. \message{page headings,}
  3447. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  3448. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  3449. % First the title page. Must do @settitle before @titlepage.
  3450. \newif\ifseenauthor
  3451. \newif\iffinishedtitlepage
  3452. % @setcontentsaftertitlepage used to do an implicit @contents or
  3453. % @shortcontents after @end titlepage, but it is now obsolete.
  3454. \def\setcontentsaftertitlepage{%
  3455. \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
  3456. command; move your @contents command if you want the contents
  3457. after the title page.}}%
  3458. \def\setshortcontentsaftertitlepage{%
  3459. \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
  3460. command; move your @shortcontents and @contents commands if you
  3461. want the contents after the title page.}}%
  3462. \parseargdef\shorttitlepage{%
  3463. \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  3464. \endgroup\page\hbox{}\page}
  3465. \envdef\titlepage{%
  3466. % Open one extra group, as we want to close it in the middle of \Etitlepage.
  3467. \begingroup
  3468. \parindent=0pt \textfonts
  3469. % Leave some space at the very top of the page.
  3470. \vglue\titlepagetopglue
  3471. % No rule at page bottom unless we print one at the top with @title.
  3472. \finishedtitlepagetrue
  3473. %
  3474. % Most title ``pages'' are actually two pages long, with space
  3475. % at the top of the second. We don't want the ragged left on the second.
  3476. \let\oldpage = \page
  3477. \def\page{%
  3478. \iffinishedtitlepage\else
  3479. \finishtitlepage
  3480. \fi
  3481. \let\page = \oldpage
  3482. \page
  3483. \null
  3484. }%
  3485. }
  3486. \def\Etitlepage{%
  3487. \iffinishedtitlepage\else
  3488. \finishtitlepage
  3489. \fi
  3490. % It is important to do the page break before ending the group,
  3491. % because the headline and footline are only empty inside the group.
  3492. % If we use the new definition of \page, we always get a blank page
  3493. % after the title page, which we certainly don't want.
  3494. \oldpage
  3495. \endgroup
  3496. %
  3497. % Need this before the \...aftertitlepage checks so that if they are
  3498. % in effect the toc pages will come out with page numbers.
  3499. \HEADINGSon
  3500. }
  3501. \def\finishtitlepage{%
  3502. \vskip4pt \hrule height 2pt width \hsize
  3503. \vskip\titlepagebottomglue
  3504. \finishedtitlepagetrue
  3505. }
  3506. % Settings used for typesetting titles: no hyphenation, no indentation,
  3507. % don't worry much about spacing, ragged right. This should be used
  3508. % inside a \vbox, and fonts need to be set appropriately first. \par should
  3509. % be specified before the end of the \vbox, since a vbox is a group.
  3510. %
  3511. \def\raggedtitlesettings{%
  3512. \rm
  3513. \hyphenpenalty=10000
  3514. \parindent=0pt
  3515. \tolerance=5000
  3516. \ptexraggedright
  3517. }
  3518. % Macros to be used within @titlepage:
  3519. \let\subtitlerm=\rmfont
  3520. \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
  3521. \parseargdef\title{%
  3522. \checkenv\titlepage
  3523. \vbox{\titlefonts \raggedtitlesettings #1\par}%
  3524. % print a rule at the page bottom also.
  3525. \finishedtitlepagefalse
  3526. \vskip4pt \hrule height 4pt width \hsize \vskip4pt
  3527. }
  3528. \parseargdef\subtitle{%
  3529. \checkenv\titlepage
  3530. {\subtitlefont \rightline{#1}}%
  3531. }
  3532. % @author should come last, but may come many times.
  3533. % It can also be used inside @quotation.
  3534. %
  3535. \parseargdef\author{%
  3536. \def\temp{\quotation}%
  3537. \ifx\thisenv\temp
  3538. \def\quotationauthor{#1}% printed in \Equotation.
  3539. \else
  3540. \checkenv\titlepage
  3541. \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
  3542. {\secfonts\rm \leftline{#1}}%
  3543. \fi
  3544. }
  3545. % Set up page headings and footings.
  3546. \let\thispage=\folio
  3547. \newtoks\evenheadline % headline on even pages
  3548. \newtoks\oddheadline % headline on odd pages
  3549. \newtoks\evenfootline % footline on even pages
  3550. \newtoks\oddfootline % footline on odd pages
  3551. % Now make \makeheadline and \makefootline in Plain TeX use those variables
  3552. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  3553. \else \the\evenheadline \fi}}
  3554. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  3555. \else \the\evenfootline \fi}\HEADINGShook}
  3556. \let\HEADINGShook=\relax
  3557. % Commands to set those variables.
  3558. % For example, this is what @headings on does
  3559. % @evenheading @thistitle|@thispage|@thischapter
  3560. % @oddheading @thischapter|@thispage|@thistitle
  3561. % @evenfooting @thisfile||
  3562. % @oddfooting ||@thisfile
  3563. \def\evenheading{\parsearg\evenheadingxxx}
  3564. \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
  3565. \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
  3566. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3567. \def\oddheading{\parsearg\oddheadingxxx}
  3568. \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
  3569. \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
  3570. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3571. \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
  3572. \def\evenfooting{\parsearg\evenfootingxxx}
  3573. \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
  3574. \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
  3575. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3576. \def\oddfooting{\parsearg\oddfootingxxx}
  3577. \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
  3578. \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
  3579. \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  3580. %
  3581. % Leave some space for the footline. Hopefully ok to assume
  3582. % @evenfooting will not be used by itself.
  3583. \global\advance\txipageheight by -12pt
  3584. \global\advance\vsize by -12pt
  3585. }
  3586. \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
  3587. % @evenheadingmarks top \thischapter <- chapter at the top of a page
  3588. % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
  3589. %
  3590. % The same set of arguments for:
  3591. %
  3592. % @oddheadingmarks
  3593. % @evenfootingmarks
  3594. % @oddfootingmarks
  3595. % @everyheadingmarks
  3596. % @everyfootingmarks
  3597. % These define \getoddheadingmarks, \getevenheadingmarks,
  3598. % \getoddfootingmarks, and \getevenfootingmarks, each to one of
  3599. % \gettopheadingmarks, \getbottomheadingmarks.
  3600. %
  3601. \def\evenheadingmarks{\headingmarks{even}{heading}}
  3602. \def\oddheadingmarks{\headingmarks{odd}{heading}}
  3603. \def\evenfootingmarks{\headingmarks{even}{footing}}
  3604. \def\oddfootingmarks{\headingmarks{odd}{footing}}
  3605. \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
  3606. \headingmarks{odd}{heading}{#1} }
  3607. \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
  3608. \headingmarks{odd}{footing}{#1} }
  3609. % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
  3610. \def\headingmarks#1#2#3 {%
  3611. \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
  3612. \global\expandafter\let\csname get#1#2marks\endcsname \temp
  3613. }
  3614. \everyheadingmarks bottom
  3615. \everyfootingmarks bottom
  3616. % @headings double turns headings on for double-sided printing.
  3617. % @headings single turns headings on for single-sided printing.
  3618. % @headings off turns them off.
  3619. % @headings on same as @headings double, retained for compatibility.
  3620. % @headings after turns on double-sided headings after this page.
  3621. % @headings doubleafter turns on double-sided headings after this page.
  3622. % @headings singleafter turns on single-sided headings after this page.
  3623. % By default, they are off at the start of a document,
  3624. % and turned `on' after @end titlepage.
  3625. \parseargdef\headings{\csname HEADINGS#1\endcsname}
  3626. \def\headingsoff{% non-global headings elimination
  3627. \evenheadline={\hfil}\evenfootline={\hfil}%
  3628. \oddheadline={\hfil}\oddfootline={\hfil}%
  3629. }
  3630. \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
  3631. \HEADINGSoff % it's the default
  3632. % When we turn headings on, set the page number to 1.
  3633. % For double-sided printing, put current file name in lower left corner,
  3634. % chapter name on inside top of right hand pages, document
  3635. % title on inside top of left hand pages, and page numbers on outside top
  3636. % edge of all pages.
  3637. \def\HEADINGSdouble{%
  3638. \global\pageno=1
  3639. \global\evenfootline={\hfil}
  3640. \global\oddfootline={\hfil}
  3641. \global\evenheadline={\line{\folio\hfil\thistitle}}
  3642. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3643. \global\let\contentsalignmacro = \chapoddpage
  3644. }
  3645. \let\contentsalignmacro = \chappager
  3646. % For single-sided printing, chapter title goes across top left of page,
  3647. % page number on top right.
  3648. \def\HEADINGSsingle{%
  3649. \global\pageno=1
  3650. \global\evenfootline={\hfil}
  3651. \global\oddfootline={\hfil}
  3652. \global\evenheadline={\line{\thischapterheading\hfil\folio}}
  3653. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3654. \global\let\contentsalignmacro = \chappager
  3655. }
  3656. \def\HEADINGSon{\HEADINGSdouble}
  3657. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  3658. \let\HEADINGSdoubleafter=\HEADINGSafter
  3659. \def\HEADINGSdoublex{%
  3660. \global\evenfootline={\hfil}
  3661. \global\oddfootline={\hfil}
  3662. \global\evenheadline={\line{\folio\hfil\thistitle}}
  3663. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3664. \global\let\contentsalignmacro = \chapoddpage
  3665. }
  3666. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  3667. \def\HEADINGSsinglex{%
  3668. \global\evenfootline={\hfil}
  3669. \global\oddfootline={\hfil}
  3670. \global\evenheadline={\line{\thischapterheading\hfil\folio}}
  3671. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3672. \global\let\contentsalignmacro = \chappager
  3673. }
  3674. % Subroutines used in generating headings
  3675. % This produces Day Month Year style of output.
  3676. % Only define if not already defined, in case a txi-??.tex file has set
  3677. % up a different format (e.g., txi-cs.tex does this).
  3678. \ifx\today\thisisundefined
  3679. \def\today{%
  3680. \number\day\space
  3681. \ifcase\month
  3682. \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  3683. \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  3684. \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  3685. \fi
  3686. \space\number\year}
  3687. \fi
  3688. % @settitle line... specifies the title of the document, for headings.
  3689. % It generates no output of its own.
  3690. \def\thistitle{\putwordNoTitle}
  3691. \def\settitle{\parsearg{\gdef\thistitle}}
  3692. \message{tables,}
  3693. % Tables -- @table, @ftable, @vtable, @item(x).
  3694. % default indentation of table text
  3695. \newdimen\tableindent \tableindent=.8in
  3696. % default indentation of @itemize and @enumerate text
  3697. \newdimen\itemindent \itemindent=.3in
  3698. % margin between end of table item and start of table text.
  3699. \newdimen\itemmargin \itemmargin=.1in
  3700. % used internally for \itemindent minus \itemmargin
  3701. \newdimen\itemmax
  3702. % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
  3703. % these defs.
  3704. % They also define \itemindex
  3705. % to index the item name in whatever manner is desired (perhaps none).
  3706. \newif\ifitemxneedsnegativevskip
  3707. \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
  3708. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  3709. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  3710. \def\itemzzz #1{\begingroup %
  3711. \advance\hsize by -\rightskip
  3712. \advance\hsize by -\tableindent
  3713. \setbox0=\hbox{\itemindicate{#1}}%
  3714. \itemindex{#1}%
  3715. \nobreak % This prevents a break before @itemx.
  3716. %
  3717. % If the item text does not fit in the space we have, put it on a line
  3718. % by itself, and do not allow a page break either before or after that
  3719. % line. We do not start a paragraph here because then if the next
  3720. % command is, e.g., @kindex, the whatsit would get put into the
  3721. % horizontal list on a line by itself, resulting in extra blank space.
  3722. \ifdim \wd0>\itemmax
  3723. %
  3724. % Make this a paragraph so we get the \parskip glue and wrapping,
  3725. % but leave it ragged-right.
  3726. \begingroup
  3727. \advance\leftskip by-\tableindent
  3728. \advance\hsize by\tableindent
  3729. \advance\rightskip by0pt plus1fil\relax
  3730. \leavevmode\unhbox0\par
  3731. \endgroup
  3732. %
  3733. % We're going to be starting a paragraph, but we don't want the
  3734. % \parskip glue -- logically it's part of the @item we just started.
  3735. \nobreak \vskip-\parskip
  3736. %
  3737. % Stop a page break at the \parskip glue coming up. However, if
  3738. % what follows is an environment such as @example, there will be no
  3739. % \parskip glue; then the negative vskip we just inserted would
  3740. % cause the example and the item to crash together. So we use this
  3741. % bizarre value of 10001 as a signal to \aboveenvbreak to insert
  3742. % \parskip glue after all. Section titles are handled this way also.
  3743. %
  3744. \penalty 10001
  3745. \endgroup
  3746. \itemxneedsnegativevskipfalse
  3747. \else
  3748. % The item text fits into the space. Start a paragraph, so that the
  3749. % following text (if any) will end up on the same line.
  3750. \noindent
  3751. % Do this with kerns and \unhbox so that if there is a footnote in
  3752. % the item text, it can migrate to the main vertical list and
  3753. % eventually be printed.
  3754. \nobreak\kern-\tableindent
  3755. \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  3756. \unhbox0
  3757. \nobreak\kern\dimen0
  3758. \endgroup
  3759. \itemxneedsnegativevskiptrue
  3760. \fi
  3761. }
  3762. \def\item{\errmessage{@item while not in a list environment}}
  3763. \def\itemx{\errmessage{@itemx while not in a list environment}}
  3764. % @table, @ftable, @vtable.
  3765. \envdef\table{%
  3766. \let\itemindex\gobble
  3767. \tablecheck{table}%
  3768. }
  3769. \envdef\ftable{%
  3770. \def\itemindex ##1{\doind {fn}{\code{##1}}}%
  3771. \tablecheck{ftable}%
  3772. }
  3773. \envdef\vtable{%
  3774. \def\itemindex ##1{\doind {vr}{\code{##1}}}%
  3775. \tablecheck{vtable}%
  3776. }
  3777. \def\tablecheck#1{%
  3778. \ifnum \the\catcode`\^^M=\active
  3779. \endgroup
  3780. \errmessage{This command won't work in this context; perhaps the problem is
  3781. that we are \inenvironment\thisenv}%
  3782. \def\next{\doignore{#1}}%
  3783. \else
  3784. \let\next\tablex
  3785. \fi
  3786. \next
  3787. }
  3788. \def\tablex#1{%
  3789. \def\itemindicate{#1}%
  3790. \parsearg\tabley
  3791. }
  3792. \def\tabley#1{%
  3793. {%
  3794. \makevalueexpandable
  3795. \edef\temp{\noexpand\tablez #1\space\space\space}%
  3796. \expandafter
  3797. }\temp \endtablez
  3798. }
  3799. \def\tablez #1 #2 #3 #4\endtablez{%
  3800. \aboveenvbreak
  3801. \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
  3802. \ifnum 0#2>0 \tableindent=#2\mil \fi
  3803. \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
  3804. \itemmax=\tableindent
  3805. \advance \itemmax by -\itemmargin
  3806. \advance \leftskip by \tableindent
  3807. \exdentamount=\tableindent
  3808. \parindent = 0pt
  3809. \parskip = \smallskipamount
  3810. \ifdim \parskip=0pt \parskip=2pt \fi
  3811. \let\item = \internalBitem
  3812. \let\itemx = \internalBitemx
  3813. }
  3814. \def\Etable{\endgraf\afterenvbreak}
  3815. \let\Eftable\Etable
  3816. \let\Evtable\Etable
  3817. \let\Eitemize\Etable
  3818. \let\Eenumerate\Etable
  3819. % This is the counter used by @enumerate, which is really @itemize
  3820. \newcount \itemno
  3821. \envdef\itemize{\parsearg\doitemize}
  3822. \def\doitemize#1{%
  3823. \aboveenvbreak
  3824. \itemmax=\itemindent
  3825. \advance\itemmax by -\itemmargin
  3826. \advance\leftskip by \itemindent
  3827. \exdentamount=\itemindent
  3828. \parindent=0pt
  3829. \parskip=\smallskipamount
  3830. \ifdim\parskip=0pt \parskip=2pt \fi
  3831. %
  3832. % Try typesetting the item mark so that if the document erroneously says
  3833. % something like @itemize @samp (intending @table), there's an error
  3834. % right away at the @itemize. It's not the best error message in the
  3835. % world, but it's better than leaving it to the @item. This means if
  3836. % the user wants an empty mark, they have to say @w{} not just @w.
  3837. \def\itemcontents{#1}%
  3838. \setbox0 = \hbox{\itemcontents}%
  3839. %
  3840. % @itemize with no arg is equivalent to @itemize @bullet.
  3841. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
  3842. %
  3843. \let\item=\itemizeitem
  3844. }
  3845. % Definition of @item while inside @itemize and @enumerate.
  3846. %
  3847. \def\itemizeitem{%
  3848. \advance\itemno by 1 % for enumerations
  3849. {\let\par=\endgraf \smallbreak}% reasonable place to break
  3850. {%
  3851. % If the document has an @itemize directly after a section title, a
  3852. % \nobreak will be last on the list, and \sectionheading will have
  3853. % done a \vskip-\parskip. In that case, we don't want to zero
  3854. % parskip, or the item text will crash with the heading. On the
  3855. % other hand, when there is normal text preceding the item (as there
  3856. % usually is), we do want to zero parskip, or there would be too much
  3857. % space. In that case, we won't have a \nobreak before. At least
  3858. % that's the theory.
  3859. \ifnum\lastpenalty<10000 \parskip=0in \fi
  3860. \noindent
  3861. \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
  3862. %
  3863. \ifinner\else
  3864. \vadjust{\penalty 1200}% not good to break after first line of item.
  3865. \fi
  3866. % We can be in inner vertical mode in a footnote, although an
  3867. % @itemize looks awful there.
  3868. }%
  3869. \flushcr
  3870. }
  3871. % \splitoff TOKENS\endmark defines \first to be the first token in
  3872. % TOKENS, and \rest to be the remainder.
  3873. %
  3874. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  3875. % Allow an optional argument of an uppercase letter, lowercase letter,
  3876. % or number, to specify the first label in the enumerated list. No
  3877. % argument is the same as `1'.
  3878. %
  3879. \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
  3880. \def\enumeratey #1 #2\endenumeratey{%
  3881. % If we were given no argument, pretend we were given `1'.
  3882. \def\thearg{#1}%
  3883. \ifx\thearg\empty \def\thearg{1}\fi
  3884. %
  3885. % Detect if the argument is a single token. If so, it might be a
  3886. % letter. Otherwise, the only valid thing it can be is a number.
  3887. % (We will always have one token, because of the test we just made.
  3888. % This is a good thing, since \splitoff doesn't work given nothing at
  3889. % all -- the first parameter is undelimited.)
  3890. \expandafter\splitoff\thearg\endmark
  3891. \ifx\rest\empty
  3892. % Only one token in the argument. It could still be anything.
  3893. % A ``lowercase letter'' is one whose \lccode is nonzero.
  3894. % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  3895. % not equal to itself.
  3896. % Otherwise, we assume it's a number.
  3897. %
  3898. % We need the \relax at the end of the \ifnum lines to stop TeX from
  3899. % continuing to look for a <number>.
  3900. %
  3901. \ifnum\lccode\expandafter`\thearg=0\relax
  3902. \numericenumerate % a number (we hope)
  3903. \else
  3904. % It's a letter.
  3905. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  3906. \lowercaseenumerate % lowercase letter
  3907. \else
  3908. \uppercaseenumerate % uppercase letter
  3909. \fi
  3910. \fi
  3911. \else
  3912. % Multiple tokens in the argument. We hope it's a number.
  3913. \numericenumerate
  3914. \fi
  3915. }
  3916. % An @enumerate whose labels are integers. The starting integer is
  3917. % given in \thearg.
  3918. %
  3919. \def\numericenumerate{%
  3920. \itemno = \thearg
  3921. \startenumeration{\the\itemno}%
  3922. }
  3923. % The starting (lowercase) letter is in \thearg.
  3924. \def\lowercaseenumerate{%
  3925. \itemno = \expandafter`\thearg
  3926. \startenumeration{%
  3927. % Be sure we're not beyond the end of the alphabet.
  3928. \ifnum\itemno=0
  3929. \errmessage{No more lowercase letters in @enumerate; get a bigger
  3930. alphabet}%
  3931. \fi
  3932. \char\lccode\itemno
  3933. }%
  3934. }
  3935. % The starting (uppercase) letter is in \thearg.
  3936. \def\uppercaseenumerate{%
  3937. \itemno = \expandafter`\thearg
  3938. \startenumeration{%
  3939. % Be sure we're not beyond the end of the alphabet.
  3940. \ifnum\itemno=0
  3941. \errmessage{No more uppercase letters in @enumerate; get a bigger
  3942. alphabet}
  3943. \fi
  3944. \char\uccode\itemno
  3945. }%
  3946. }
  3947. % Call \doitemize, adding a period to the first argument and supplying the
  3948. % common last two arguments. Also subtract one from the initial value in
  3949. % \itemno, since @item increments \itemno.
  3950. %
  3951. \def\startenumeration#1{%
  3952. \advance\itemno by -1
  3953. \doitemize{#1.}\flushcr
  3954. }
  3955. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  3956. % to @enumerate.
  3957. %
  3958. \def\alphaenumerate{\enumerate{a}}
  3959. \def\capsenumerate{\enumerate{A}}
  3960. \def\Ealphaenumerate{\Eenumerate}
  3961. \def\Ecapsenumerate{\Eenumerate}
  3962. % @multitable macros
  3963. % Amy Hendrickson, 8/18/94, 3/6/96
  3964. %
  3965. % @multitable ... @end multitable will make as many columns as desired.
  3966. % Contents of each column will wrap at width given in preamble. Width
  3967. % can be specified either with sample text given in a template line,
  3968. % or in percent of \hsize, the current width of text on page.
  3969. % Table can continue over pages but will only break between lines.
  3970. % To make preamble:
  3971. %
  3972. % Either define widths of columns in terms of percent of \hsize:
  3973. % @multitable @columnfractions .25 .3 .45
  3974. % @item ...
  3975. %
  3976. % Numbers following @columnfractions are the percent of the total
  3977. % current hsize to be used for each column. You may use as many
  3978. % columns as desired.
  3979. % Or use a template:
  3980. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  3981. % @item ...
  3982. % using the widest term desired in each column.
  3983. % Each new table line starts with @item, each subsequent new column
  3984. % starts with @tab. Empty columns may be produced by supplying @tab's
  3985. % with nothing between them for as many times as empty columns are needed,
  3986. % ie, @tab@tab@tab will produce two empty columns.
  3987. % @item, @tab do not need to be on their own lines, but it will not hurt
  3988. % if they are.
  3989. % Sample multitable:
  3990. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  3991. % @item first col stuff @tab second col stuff @tab third col
  3992. % @item
  3993. % first col stuff
  3994. % @tab
  3995. % second col stuff
  3996. % @tab
  3997. % third col
  3998. % @item first col stuff @tab second col stuff
  3999. % @tab Many paragraphs of text may be used in any column.
  4000. %
  4001. % They will wrap at the width determined by the template.
  4002. % @item@tab@tab This will be in third column.
  4003. % @end multitable
  4004. % Default dimensions may be reset by user.
  4005. % @multitableparskip is vertical space between paragraphs in table.
  4006. % @multitableparindent is paragraph indent in table.
  4007. % @multitablecolmargin is horizontal space to be left between columns.
  4008. % @multitablelinespace is space to leave between table items, baseline
  4009. % to baseline.
  4010. % 0pt means it depends on current normal line spacing.
  4011. %
  4012. \newskip\multitableparskip
  4013. \newskip\multitableparindent
  4014. \newdimen\multitablecolspace
  4015. \newskip\multitablelinespace
  4016. \multitableparskip=0pt
  4017. \multitableparindent=6pt
  4018. \multitablecolspace=12pt
  4019. \multitablelinespace=0pt
  4020. % Macros used to set up halign preamble:
  4021. %
  4022. \let\endsetuptable\relax
  4023. \def\xendsetuptable{\endsetuptable}
  4024. \let\columnfractions\relax
  4025. \def\xcolumnfractions{\columnfractions}
  4026. \newif\ifsetpercent
  4027. % #1 is the @columnfraction, usually a decimal number like .5, but might
  4028. % be just 1. We just use it, whatever it is.
  4029. %
  4030. \def\pickupwholefraction#1 {%
  4031. \global\advance\colcount by 1
  4032. \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
  4033. \setuptable
  4034. }
  4035. \newcount\colcount
  4036. \def\setuptable#1{%
  4037. \def\firstarg{#1}%
  4038. \ifx\firstarg\xendsetuptable
  4039. \let\go = \relax
  4040. \else
  4041. \ifx\firstarg\xcolumnfractions
  4042. \global\setpercenttrue
  4043. \else
  4044. \ifsetpercent
  4045. \let\go\pickupwholefraction
  4046. \else
  4047. \global\advance\colcount by 1
  4048. \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
  4049. % separator; typically that is always in the input, anyway.
  4050. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  4051. \fi
  4052. \fi
  4053. \ifx\go\pickupwholefraction
  4054. % Put the argument back for the \pickupwholefraction call, so
  4055. % we'll always have a period there to be parsed.
  4056. \def\go{\pickupwholefraction#1}%
  4057. \else
  4058. \let\go = \setuptable
  4059. \fi%
  4060. \fi
  4061. \go
  4062. }
  4063. % multitable-only commands.
  4064. %
  4065. % @headitem starts a heading row, which we typeset in bold. Assignments
  4066. % have to be global since we are inside the implicit group of an
  4067. % alignment entry. \everycr below resets \everytab so we don't have to
  4068. % undo it ourselves.
  4069. \def\headitemfont{\b}% for people to use in the template row; not changeable
  4070. \def\headitem{%
  4071. \checkenv\multitable
  4072. \crcr
  4073. \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
  4074. \global\everytab={\bf}% can't use \headitemfont since the parsing differs
  4075. \the\everytab % for the first item
  4076. }%
  4077. %
  4078. % default for tables with no headings.
  4079. \let\headitemcrhook=\relax
  4080. %
  4081. % A \tab used to include \hskip1sp. But then the space in a template
  4082. % line is not enough. That is bad. So let's go back to just `&' until
  4083. % we again encounter the problem the 1sp was intended to solve.
  4084. % --karl, nathan@acm.org, 20apr99.
  4085. \def\tab{\checkenv\multitable &\the\everytab}%
  4086. % @multitable ... @end multitable definitions:
  4087. %
  4088. \newtoks\everytab % insert after every tab.
  4089. %
  4090. \envdef\multitable{%
  4091. \vskip\parskip
  4092. \startsavinginserts
  4093. %
  4094. % @item within a multitable starts a normal row.
  4095. % We use \def instead of \let so that if one of the multitable entries
  4096. % contains an @itemize, we don't choke on the \item (seen as \crcr aka
  4097. % \endtemplate) expanding \doitemize.
  4098. \def\item{\crcr}%
  4099. %
  4100. \tolerance=9500
  4101. \hbadness=9500
  4102. \setmultitablespacing
  4103. \parskip=\multitableparskip
  4104. \parindent=\multitableparindent
  4105. \overfullrule=0pt
  4106. \global\colcount=0
  4107. %
  4108. \everycr = {%
  4109. \noalign{%
  4110. \global\everytab={}% Reset from possible headitem.
  4111. \global\colcount=0 % Reset the column counter.
  4112. %
  4113. % Check for saved footnotes, etc.:
  4114. \checkinserts
  4115. %
  4116. % Perhaps a \nobreak, then reset:
  4117. \headitemcrhook
  4118. \global\let\headitemcrhook=\relax
  4119. }%
  4120. }%
  4121. %
  4122. \parsearg\domultitable
  4123. }
  4124. \def\domultitable#1{%
  4125. % To parse everything between @multitable and @item:
  4126. \setuptable#1 \endsetuptable
  4127. %
  4128. % This preamble sets up a generic column definition, which will
  4129. % be used as many times as user calls for columns.
  4130. % \vtop will set a single line and will also let text wrap and
  4131. % continue for many paragraphs if desired.
  4132. \halign\bgroup &%
  4133. \global\advance\colcount by 1
  4134. \multistrut
  4135. \vtop{%
  4136. % Use the current \colcount to find the correct column width:
  4137. \hsize=\expandafter\csname col\the\colcount\endcsname
  4138. %
  4139. % In order to keep entries from bumping into each other
  4140. % we will add a \leftskip of \multitablecolspace to all columns after
  4141. % the first one.
  4142. %
  4143. % If a template has been used, we will add \multitablecolspace
  4144. % to the width of each template entry.
  4145. %
  4146. % If the user has set preamble in terms of percent of \hsize we will
  4147. % use that dimension as the width of the column, and the \leftskip
  4148. % will keep entries from bumping into each other. Table will start at
  4149. % left margin and final column will justify at right margin.
  4150. %
  4151. % Make sure we don't inherit \rightskip from the outer environment.
  4152. \rightskip=0pt
  4153. \ifnum\colcount=1
  4154. % The first column will be indented with the surrounding text.
  4155. \advance\hsize by\leftskip
  4156. \else
  4157. \ifsetpercent \else
  4158. % If user has not set preamble in terms of percent of \hsize
  4159. % we will advance \hsize by \multitablecolspace.
  4160. \advance\hsize by \multitablecolspace
  4161. \fi
  4162. % In either case we will make \leftskip=\multitablecolspace:
  4163. \leftskip=\multitablecolspace
  4164. \fi
  4165. % Ignoring space at the beginning and end avoids an occasional spurious
  4166. % blank line, when TeX decides to break the line at the space before the
  4167. % box from the multistrut, so the strut ends up on a line by itself.
  4168. % For example:
  4169. % @multitable @columnfractions .11 .89
  4170. % @item @code{#}
  4171. % @tab Legal holiday which is valid in major parts of the whole country.
  4172. % Is automatically provided with highlighting sequences respectively
  4173. % marking characters.
  4174. \noindent\ignorespaces##\unskip\multistrut
  4175. }\cr
  4176. }
  4177. \def\Emultitable{%
  4178. \crcr
  4179. \egroup % end the \halign
  4180. \global\setpercentfalse
  4181. }
  4182. \def\setmultitablespacing{%
  4183. \def\multistrut{\strut}% just use the standard line spacing
  4184. %
  4185. % Compute \multitablelinespace (if not defined by user) for use in
  4186. % \multitableparskip calculation. We used define \multistrut based on
  4187. % this, but (ironically) that caused the spacing to be off.
  4188. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
  4189. \ifdim\multitablelinespace=0pt
  4190. \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
  4191. \global\advance\multitablelinespace by-\ht0
  4192. \fi
  4193. % Test to see if parskip is larger than space between lines of
  4194. % table. If not, do nothing.
  4195. % If so, set to same dimension as multitablelinespace.
  4196. \ifdim\multitableparskip>\multitablelinespace
  4197. \global\multitableparskip=\multitablelinespace
  4198. \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
  4199. % than skip between lines in the table.
  4200. \fi%
  4201. \ifdim\multitableparskip=0pt
  4202. \global\multitableparskip=\multitablelinespace
  4203. \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
  4204. % than skip between lines in the table.
  4205. \fi}
  4206. \message{conditionals,}
  4207. % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
  4208. % @ifnotxml always succeed. They currently do nothing; we don't
  4209. % attempt to check whether the conditionals are properly nested. But we
  4210. % have to remember that they are conditionals, so that @end doesn't
  4211. % attempt to close an environment group.
  4212. %
  4213. \def\makecond#1{%
  4214. \expandafter\let\csname #1\endcsname = \relax
  4215. \expandafter\let\csname iscond.#1\endcsname = 1
  4216. }
  4217. \makecond{iftex}
  4218. \makecond{ifnotdocbook}
  4219. \makecond{ifnothtml}
  4220. \makecond{ifnotinfo}
  4221. \makecond{ifnotplaintext}
  4222. \makecond{ifnotxml}
  4223. % Ignore @ignore, @ifhtml, @ifinfo, and the like.
  4224. %
  4225. \def\direntry{\doignore{direntry}}
  4226. \def\documentdescription{\doignore{documentdescription}}
  4227. \def\docbook{\doignore{docbook}}
  4228. \def\html{\doignore{html}}
  4229. \def\ifdocbook{\doignore{ifdocbook}}
  4230. \def\ifhtml{\doignore{ifhtml}}
  4231. \def\ifinfo{\doignore{ifinfo}}
  4232. \def\ifnottex{\doignore{ifnottex}}
  4233. \def\ifplaintext{\doignore{ifplaintext}}
  4234. \def\ifxml{\doignore{ifxml}}
  4235. \def\ignore{\doignore{ignore}}
  4236. \def\menu{\doignore{menu}}
  4237. \def\xml{\doignore{xml}}
  4238. % Ignore text until a line `@end #1', keeping track of nested conditionals.
  4239. %
  4240. % A count to remember the depth of nesting.
  4241. \newcount\doignorecount
  4242. \def\doignore#1{\begingroup
  4243. % Scan in ``verbatim'' mode:
  4244. \obeylines
  4245. \catcode`\@ = \other
  4246. \catcode`\{ = \other
  4247. \catcode`\} = \other
  4248. %
  4249. % Make sure that spaces turn into tokens that match what \doignoretext wants.
  4250. \spaceisspace
  4251. %
  4252. % Count number of #1's that we've seen.
  4253. \doignorecount = 0
  4254. %
  4255. % Swallow text until we reach the matching `@end #1'.
  4256. \dodoignore{#1}%
  4257. }
  4258. { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
  4259. \obeylines %
  4260. %
  4261. \gdef\dodoignore#1{%
  4262. % #1 contains the command name as a string, e.g., `ifinfo'.
  4263. %
  4264. % Define a command to find the next `@end #1'.
  4265. \long\def\doignoretext##1^^M@end #1{%
  4266. \doignoretextyyy##1^^M@#1\_STOP_}%
  4267. %
  4268. % And this command to find another #1 command, at the beginning of a
  4269. % line. (Otherwise, we would consider a line `@c @ifset', for
  4270. % example, to count as an @ifset for nesting.)
  4271. \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
  4272. %
  4273. % And now expand that command.
  4274. \doignoretext ^^M%
  4275. }%
  4276. }
  4277. \def\doignoreyyy#1{%
  4278. \def\temp{#1}%
  4279. \ifx\temp\empty % Nothing found.
  4280. \let\next\doignoretextzzz
  4281. \else % Found a nested condition, ...
  4282. \advance\doignorecount by 1
  4283. \let\next\doignoretextyyy % ..., look for another.
  4284. % If we're here, #1 ends with ^^M\ifinfo (for example).
  4285. \fi
  4286. \next #1% the token \_STOP_ is present just after this macro.
  4287. }
  4288. % We have to swallow the remaining "\_STOP_".
  4289. %
  4290. \def\doignoretextzzz#1{%
  4291. \ifnum\doignorecount = 0 % We have just found the outermost @end.
  4292. \let\next\enddoignore
  4293. \else % Still inside a nested condition.
  4294. \advance\doignorecount by -1
  4295. \let\next\doignoretext % Look for the next @end.
  4296. \fi
  4297. \next
  4298. }
  4299. % Finish off ignored text.
  4300. { \obeylines%
  4301. % Ignore anything after the last `@end #1'; this matters in verbatim
  4302. % environments, where otherwise the newline after an ignored conditional
  4303. % would result in a blank line in the output.
  4304. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
  4305. }
  4306. % @set VAR sets the variable VAR to an empty value.
  4307. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  4308. %
  4309. % Since we want to separate VAR from REST-OF-LINE (which might be
  4310. % empty), we can't just use \parsearg; we have to insert a space of our
  4311. % own to delimit the rest of the line, and then take it out again if we
  4312. % didn't need it.
  4313. % We rely on the fact that \parsearg sets \catcode`\ =10.
  4314. %
  4315. \parseargdef\set{\setyyy#1 \endsetyyy}
  4316. \def\setyyy#1 #2\endsetyyy{%
  4317. {%
  4318. \makevalueexpandable
  4319. \def\temp{#2}%
  4320. \edef\next{\gdef\makecsname{SET#1}}%
  4321. \ifx\temp\empty
  4322. \next{}%
  4323. \else
  4324. \setzzz#2\endsetzzz
  4325. \fi
  4326. }%
  4327. }
  4328. % Remove the trailing space \setxxx inserted.
  4329. \def\setzzz#1 \endsetzzz{\next{#1}}
  4330. % @clear VAR clears (i.e., unsets) the variable VAR.
  4331. %
  4332. \parseargdef\clear{%
  4333. {%
  4334. \makevalueexpandable
  4335. \global\expandafter\let\csname SET#1\endcsname=\relax
  4336. }%
  4337. }
  4338. % @value{foo} gets the text saved in variable foo.
  4339. \def\value{\begingroup\makevalueexpandable\valuexxx}
  4340. \def\valuexxx#1{\expandablevalue{#1}\endgroup}
  4341. {
  4342. \catcode`\-=\active \catcode`\_=\active
  4343. %
  4344. \gdef\makevalueexpandable{%
  4345. \let\value = \expandablevalue
  4346. % We don't want these characters active, ...
  4347. \catcode`\-=\other \catcode`\_=\other
  4348. % ..., but we might end up with active ones in the argument if
  4349. % we're called from @code, as @code{@value{foo-bar_}}, though.
  4350. % So \let them to their normal equivalents.
  4351. \let-\normaldash \let_\normalunderscore
  4352. }
  4353. }
  4354. % We have this subroutine so that we can handle at least some @value's
  4355. % properly in indexes (we call \makevalueexpandable in \indexdummies).
  4356. % The command has to be fully expandable (if the variable is set), since
  4357. % the result winds up in the index file. This means that if the
  4358. % variable's value contains other Texinfo commands, it's almost certain
  4359. % it will fail (although perhaps we could fix that with sufficient work
  4360. % to do a one-level expansion on the result, instead of complete).
  4361. %
  4362. % Unfortunately, this has the consequence that when _ is in the *value*
  4363. % of an @set, it does not print properly in the roman fonts (get the cmr
  4364. % dot accent at position 126 instead). No fix comes to mind, and it's
  4365. % been this way since 2003 or earlier, so just ignore it.
  4366. %
  4367. \def\expandablevalue#1{%
  4368. \expandafter\ifx\csname SET#1\endcsname\relax
  4369. {[No value for ``#1'']}%
  4370. \message{Variable `#1', used in @value, is not set.}%
  4371. \else
  4372. \csname SET#1\endcsname
  4373. \fi
  4374. }
  4375. % Like \expandablevalue, but completely expandable (the \message in the
  4376. % definition above operates at the execution level of TeX). Used when
  4377. % writing to auxiliary files, due to the expansion that \write does.
  4378. % If flag is undefined, pass through an unexpanded @value command: maybe it
  4379. % will be set by the time it is read back in.
  4380. %
  4381. % NB flag names containing - or _ may not work here.
  4382. \def\dummyvalue#1{%
  4383. \expandafter\ifx\csname SET#1\endcsname\relax
  4384. \noexpand\value{#1}%
  4385. \else
  4386. \csname SET#1\endcsname
  4387. \fi
  4388. }
  4389. % Used for @value's in index entries to form the sort key: expand the @value
  4390. % if possible, otherwise sort late.
  4391. \def\indexnofontsvalue#1{%
  4392. \expandafter\ifx\csname SET#1\endcsname\relax
  4393. ZZZZZZZ
  4394. \else
  4395. \csname SET#1\endcsname
  4396. \fi
  4397. }
  4398. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  4399. % with @set.
  4400. %
  4401. % To get the special treatment we need for `@end ifset,' we call
  4402. % \makecond and then redefine.
  4403. %
  4404. \makecond{ifset}
  4405. \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
  4406. \def\doifset#1#2{%
  4407. {%
  4408. \makevalueexpandable
  4409. \let\next=\empty
  4410. \expandafter\ifx\csname SET#2\endcsname\relax
  4411. #1% If not set, redefine \next.
  4412. \fi
  4413. \expandafter
  4414. }\next
  4415. }
  4416. \def\ifsetfail{\doignore{ifset}}
  4417. % @ifclear VAR ... @end executes the `...' iff VAR has never been
  4418. % defined with @set, or has been undefined with @clear.
  4419. %
  4420. % The `\else' inside the `\doifset' parameter is a trick to reuse the
  4421. % above code: if the variable is not set, do nothing, if it is set,
  4422. % then redefine \next to \ifclearfail.
  4423. %
  4424. \makecond{ifclear}
  4425. \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
  4426. \def\ifclearfail{\doignore{ifclear}}
  4427. % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
  4428. % without the @) is in fact defined. We can only feasibly check at the
  4429. % TeX level, so something like `mathcode' is going to considered
  4430. % defined even though it is not a Texinfo command.
  4431. %
  4432. \makecond{ifcommanddefined}
  4433. \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
  4434. %
  4435. \def\doifcmddefined#1#2{{%
  4436. \makevalueexpandable
  4437. \let\next=\empty
  4438. \expandafter\ifx\csname #2\endcsname\relax
  4439. #1% If not defined, \let\next as above.
  4440. \fi
  4441. \expandafter
  4442. }\next
  4443. }
  4444. \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
  4445. % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
  4446. \makecond{ifcommandnotdefined}
  4447. \def\ifcommandnotdefined{%
  4448. \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
  4449. \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
  4450. % Set the `txicommandconditionals' variable, so documents have a way to
  4451. % test if the @ifcommand...defined conditionals are available.
  4452. \set txicommandconditionals
  4453. % @dircategory CATEGORY -- specify a category of the dir file
  4454. % which this file should belong to. Ignore this in TeX.
  4455. \let\dircategory=\comment
  4456. % @defininfoenclose.
  4457. \let\definfoenclose=\comment
  4458. \message{indexing,}
  4459. % Index generation facilities
  4460. % Define \newwrite to be identical to plain tex's \newwrite
  4461. % except not \outer, so it can be used within macros and \if's.
  4462. \edef\newwrite{\makecsname{ptexnewwrite}}
  4463. % \newindex {foo} defines an index named IX.
  4464. % It automatically defines \IXindex such that
  4465. % \IXindex ...rest of line... puts an entry in the index IX.
  4466. % It also defines \IXindfile to be the number of the output channel for
  4467. % the file that accumulates this index. The file's extension is IX.
  4468. % The name of an index should be no more than 2 characters long
  4469. % for the sake of vms.
  4470. %
  4471. \def\newindex#1{%
  4472. \expandafter\chardef\csname#1indfile\endcsname=0
  4473. \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
  4474. \noexpand\doindex{#1}}
  4475. }
  4476. % @defindex foo == \newindex{foo}
  4477. %
  4478. \def\defindex{\parsearg\newindex}
  4479. % Define @defcodeindex, like @defindex except put all entries in @code.
  4480. %
  4481. \def\defcodeindex{\parsearg\newcodeindex}
  4482. %
  4483. \def\newcodeindex#1{%
  4484. \expandafter\chardef\csname#1indfile\endcsname=0
  4485. \expandafter\xdef\csname#1index\endcsname{%
  4486. \noexpand\docodeindex{#1}}%
  4487. }
  4488. % The default indices:
  4489. \newindex{cp}% concepts,
  4490. \newcodeindex{fn}% functions,
  4491. \newcodeindex{vr}% variables,
  4492. \newcodeindex{tp}% types,
  4493. \newcodeindex{ky}% keys
  4494. \newcodeindex{pg}% and programs.
  4495. % @synindex foo bar makes index foo feed into index bar.
  4496. % Do this instead of @defindex foo if you don't want it as a separate index.
  4497. %
  4498. % @syncodeindex foo bar similar, but put all entries made for index foo
  4499. % inside @code.
  4500. %
  4501. \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
  4502. \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
  4503. % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
  4504. % #3 the target index (bar).
  4505. \def\dosynindex#1#2#3{%
  4506. \requireopenindexfile{#3}%
  4507. % redefine \fooindfile:
  4508. \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  4509. \expandafter\let\csname#2indfile\endcsname=\temp
  4510. % redefine \fooindex:
  4511. \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
  4512. }
  4513. % Define \doindex, the driver for all index macros.
  4514. % Argument #1 is generated by the calling \fooindex macro,
  4515. % and it is the two-letter name of the index.
  4516. \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
  4517. \def\doindexxxx #1{\doind{\indexname}{#1}}
  4518. % like the previous two, but they put @code around the argument.
  4519. \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
  4520. \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
  4521. % Used when writing an index entry out to an index file to prevent
  4522. % expansion of Texinfo commands that can appear in an index entry.
  4523. %
  4524. \def\indexdummies{%
  4525. \escapechar = `\\ % use backslash in output files.
  4526. \definedummyletter\@%
  4527. \definedummyletter\ %
  4528. %
  4529. % For texindex which always views { and } as separators.
  4530. \def\{{\lbracechar{}}%
  4531. \def\}{\rbracechar{}}%
  4532. %
  4533. % Do the redefinitions.
  4534. \definedummies
  4535. }
  4536. % Used for the aux and toc files, where @ is the escape character.
  4537. %
  4538. \def\atdummies{%
  4539. \definedummyletter\@%
  4540. \definedummyletter\ %
  4541. \definedummyletter\{%
  4542. \definedummyletter\}%
  4543. %
  4544. % Do the redefinitions.
  4545. \definedummies
  4546. \otherbackslash
  4547. }
  4548. % \definedummyword defines \#1 as \string\#1\space, thus effectively
  4549. % preventing its expansion. This is used only for control words,
  4550. % not control letters, because the \space would be incorrect for
  4551. % control characters, but is needed to separate the control word
  4552. % from whatever follows.
  4553. %
  4554. % These can be used both for control words that take an argument and
  4555. % those that do not. If it is followed by {arg} in the input, then
  4556. % that will dutifully get written to the index (or wherever).
  4557. %
  4558. % For control letters, we have \definedummyletter, which omits the
  4559. % space.
  4560. %
  4561. \def\definedummyword #1{\def#1{\string#1\space}}%
  4562. \def\definedummyletter#1{\def#1{\string#1}}%
  4563. \let\definedummyaccent\definedummyletter
  4564. % Called from \indexdummies and \atdummies, to effectively prevent
  4565. % the expansion of commands.
  4566. %
  4567. \def\definedummies{%
  4568. %
  4569. \let\commondummyword\definedummyword
  4570. \let\commondummyletter\definedummyletter
  4571. \let\commondummyaccent\definedummyaccent
  4572. \commondummiesnofonts
  4573. %
  4574. \definedummyletter\_%
  4575. \definedummyletter\-%
  4576. %
  4577. % Non-English letters.
  4578. \definedummyword\AA
  4579. \definedummyword\AE
  4580. \definedummyword\DH
  4581. \definedummyword\L
  4582. \definedummyword\O
  4583. \definedummyword\OE
  4584. \definedummyword\TH
  4585. \definedummyword\aa
  4586. \definedummyword\ae
  4587. \definedummyword\dh
  4588. \definedummyword\exclamdown
  4589. \definedummyword\l
  4590. \definedummyword\o
  4591. \definedummyword\oe
  4592. \definedummyword\ordf
  4593. \definedummyword\ordm
  4594. \definedummyword\questiondown
  4595. \definedummyword\ss
  4596. \definedummyword\th
  4597. %
  4598. % Although these internal commands shouldn't show up, sometimes they do.
  4599. \definedummyword\bf
  4600. \definedummyword\gtr
  4601. \definedummyword\hat
  4602. \definedummyword\less
  4603. \definedummyword\sf
  4604. \definedummyword\sl
  4605. \definedummyword\tclose
  4606. \definedummyword\tt
  4607. %
  4608. \definedummyword\LaTeX
  4609. \definedummyword\TeX
  4610. %
  4611. % Assorted special characters.
  4612. \definedummyword\atchar
  4613. \definedummyword\arrow
  4614. \definedummyword\bullet
  4615. \definedummyword\comma
  4616. \definedummyword\copyright
  4617. \definedummyword\registeredsymbol
  4618. \definedummyword\dots
  4619. \definedummyword\enddots
  4620. \definedummyword\entrybreak
  4621. \definedummyword\equiv
  4622. \definedummyword\error
  4623. \definedummyword\euro
  4624. \definedummyword\expansion
  4625. \definedummyword\geq
  4626. \definedummyword\guillemetleft
  4627. \definedummyword\guillemetright
  4628. \definedummyword\guilsinglleft
  4629. \definedummyword\guilsinglright
  4630. \definedummyword\lbracechar
  4631. \definedummyword\leq
  4632. \definedummyword\mathopsup
  4633. \definedummyword\minus
  4634. \definedummyword\ogonek
  4635. \definedummyword\pounds
  4636. \definedummyword\point
  4637. \definedummyword\print
  4638. \definedummyword\quotedblbase
  4639. \definedummyword\quotedblleft
  4640. \definedummyword\quotedblright
  4641. \definedummyword\quoteleft
  4642. \definedummyword\quoteright
  4643. \definedummyword\quotesinglbase
  4644. \definedummyword\rbracechar
  4645. \definedummyword\result
  4646. \definedummyword\sub
  4647. \definedummyword\sup
  4648. \definedummyword\textdegree
  4649. %
  4650. % We want to disable all macros so that they are not expanded by \write.
  4651. \macrolist
  4652. \let\value\dummyvalue
  4653. %
  4654. \normalturnoffactive
  4655. }
  4656. % \commondummiesnofonts: common to \definedummies and \indexnofonts.
  4657. % Define \commondummyletter, \commondummyaccent and \commondummyword before
  4658. % using. Used for accents, font commands, and various control letters.
  4659. %
  4660. \def\commondummiesnofonts{%
  4661. % Control letters and accents.
  4662. \commondummyletter\!%
  4663. \commondummyaccent\"%
  4664. \commondummyaccent\'%
  4665. \commondummyletter\*%
  4666. \commondummyaccent\,%
  4667. \commondummyletter\.%
  4668. \commondummyletter\/%
  4669. \commondummyletter\:%
  4670. \commondummyaccent\=%
  4671. \commondummyletter\?%
  4672. \commondummyaccent\^%
  4673. \commondummyaccent\`%
  4674. \commondummyaccent\~%
  4675. \commondummyword\u
  4676. \commondummyword\v
  4677. \commondummyword\H
  4678. \commondummyword\dotaccent
  4679. \commondummyword\ogonek
  4680. \commondummyword\ringaccent
  4681. \commondummyword\tieaccent
  4682. \commondummyword\ubaraccent
  4683. \commondummyword\udotaccent
  4684. \commondummyword\dotless
  4685. %
  4686. % Texinfo font commands.
  4687. \commondummyword\b
  4688. \commondummyword\i
  4689. \commondummyword\r
  4690. \commondummyword\sansserif
  4691. \commondummyword\sc
  4692. \commondummyword\slanted
  4693. \commondummyword\t
  4694. %
  4695. % Commands that take arguments.
  4696. \commondummyword\abbr
  4697. \commondummyword\acronym
  4698. \commondummyword\anchor
  4699. \commondummyword\cite
  4700. \commondummyword\code
  4701. \commondummyword\command
  4702. \commondummyword\dfn
  4703. \commondummyword\dmn
  4704. \commondummyword\email
  4705. \commondummyword\emph
  4706. \commondummyword\env
  4707. \commondummyword\file
  4708. \commondummyword\image
  4709. \commondummyword\indicateurl
  4710. \commondummyword\inforef
  4711. \commondummyword\kbd
  4712. \commondummyword\key
  4713. \commondummyword\math
  4714. \commondummyword\option
  4715. \commondummyword\pxref
  4716. \commondummyword\ref
  4717. \commondummyword\samp
  4718. \commondummyword\strong
  4719. \commondummyword\tie
  4720. \commondummyword\U
  4721. \commondummyword\uref
  4722. \commondummyword\url
  4723. \commondummyword\var
  4724. \commondummyword\verb
  4725. \commondummyword\w
  4726. \commondummyword\xref
  4727. }
  4728. % For testing: output @{ and @} in index sort strings as \{ and \}.
  4729. \newif\ifusebracesinindexes
  4730. \let\indexlbrace\relax
  4731. \let\indexrbrace\relax
  4732. {\catcode`\@=0
  4733. \catcode`\\=13
  4734. @gdef@backslashdisappear{@def\{}}
  4735. }
  4736. {
  4737. \catcode`\<=13
  4738. \catcode`\-=13
  4739. \catcode`\`=13
  4740. \gdef\indexnonalnumdisappear{%
  4741. \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
  4742. % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
  4743. % (Introduced for FSFS 2nd ed.)
  4744. \let`=\empty
  4745. \fi
  4746. %
  4747. \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
  4748. \backslashdisappear
  4749. \fi
  4750. %
  4751. \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
  4752. \def-{}%
  4753. \fi
  4754. \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
  4755. \def<{}%
  4756. \fi
  4757. \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
  4758. \def\@{}%
  4759. \fi
  4760. }
  4761. \gdef\indexnonalnumreappear{%
  4762. \useindexbackslash
  4763. \let-\normaldash
  4764. \let<\normalless
  4765. \def\@{@}%
  4766. }
  4767. }
  4768. % \indexnofonts is used when outputting the strings to sort the index
  4769. % by, and when constructing control sequence names. It eliminates all
  4770. % control sequences and just writes whatever the best ASCII sort string
  4771. % would be for a given command (usually its argument).
  4772. %
  4773. \def\indexnofonts{%
  4774. % Accent commands should become @asis.
  4775. \def\commondummyaccent##1{\let##1\asis}%
  4776. % We can just ignore other control letters.
  4777. \def\commondummyletter##1{\let##1\empty}%
  4778. % All control words become @asis by default; overrides below.
  4779. \let\commondummyword\commondummyaccent
  4780. \commondummiesnofonts
  4781. %
  4782. % Don't no-op \tt, since it isn't a user-level command
  4783. % and is used in the definitions of the active chars like <, >, |, etc.
  4784. % Likewise with the other plain tex font commands.
  4785. %\let\tt=\asis
  4786. %
  4787. \def\ { }%
  4788. \def\@{@}%
  4789. \def\_{\normalunderscore}%
  4790. \def\-{}% @- shouldn't affect sorting
  4791. %
  4792. \uccode`\1=`\{ \uppercase{\def\{{1}}%
  4793. \uccode`\1=`\} \uppercase{\def\}{1}}%
  4794. \let\lbracechar\{%
  4795. \let\rbracechar\}%
  4796. %
  4797. % Non-English letters.
  4798. \def\AA{AA}%
  4799. \def\AE{AE}%
  4800. \def\DH{DZZ}%
  4801. \def\L{L}%
  4802. \def\OE{OE}%
  4803. \def\O{O}%
  4804. \def\TH{TH}%
  4805. \def\aa{aa}%
  4806. \def\ae{ae}%
  4807. \def\dh{dzz}%
  4808. \def\exclamdown{!}%
  4809. \def\l{l}%
  4810. \def\oe{oe}%
  4811. \def\ordf{a}%
  4812. \def\ordm{o}%
  4813. \def\o{o}%
  4814. \def\questiondown{?}%
  4815. \def\ss{ss}%
  4816. \def\th{th}%
  4817. %
  4818. \def\LaTeX{LaTeX}%
  4819. \def\TeX{TeX}%
  4820. %
  4821. % Assorted special characters. \defglyph gives the control sequence a
  4822. % definition that removes the {} that follows its use.
  4823. \defglyph\atchar{@}%
  4824. \defglyph\arrow{->}%
  4825. \defglyph\bullet{bullet}%
  4826. \defglyph\comma{,}%
  4827. \defglyph\copyright{copyright}%
  4828. \defglyph\dots{...}%
  4829. \defglyph\enddots{...}%
  4830. \defglyph\equiv{==}%
  4831. \defglyph\error{error}%
  4832. \defglyph\euro{euro}%
  4833. \defglyph\expansion{==>}%
  4834. \defglyph\geq{>=}%
  4835. \defglyph\guillemetleft{<<}%
  4836. \defglyph\guillemetright{>>}%
  4837. \defglyph\guilsinglleft{<}%
  4838. \defglyph\guilsinglright{>}%
  4839. \defglyph\leq{<=}%
  4840. \defglyph\lbracechar{\{}%
  4841. \defglyph\minus{-}%
  4842. \defglyph\point{.}%
  4843. \defglyph\pounds{pounds}%
  4844. \defglyph\print{-|}%
  4845. \defglyph\quotedblbase{"}%
  4846. \defglyph\quotedblleft{"}%
  4847. \defglyph\quotedblright{"}%
  4848. \defglyph\quoteleft{`}%
  4849. \defglyph\quoteright{'}%
  4850. \defglyph\quotesinglbase{,}%
  4851. \defglyph\rbracechar{\}}%
  4852. \defglyph\registeredsymbol{R}%
  4853. \defglyph\result{=>}%
  4854. \defglyph\textdegree{o}%
  4855. %
  4856. % We need to get rid of all macros, leaving only the arguments (if present).
  4857. % Of course this is not nearly correct, but it is the best we can do for now.
  4858. % makeinfo does not expand macros in the argument to @deffn, which ends up
  4859. % writing an index entry, and texindex isn't prepared for an index sort entry
  4860. % that starts with \.
  4861. %
  4862. % Since macro invocations are followed by braces, we can just redefine them
  4863. % to take a single TeX argument. The case of a macro invocation that
  4864. % goes to end-of-line is not handled.
  4865. %
  4866. \macrolist
  4867. \let\value\indexnofontsvalue
  4868. }
  4869. \def\defglyph#1#2{\def#1##1{#2}} % see above
  4870. \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  4871. % Most index entries go through here, but \dosubind is the general case.
  4872. % #1 is the index name, #2 is the entry text.
  4873. \def\doind#1#2{\dosubind{#1}{#2}{}}
  4874. % There is also \dosubind {index}{topic}{subtopic}
  4875. % which makes an entry in a two-level index such as the operation index.
  4876. % TODO: Two-level index? Operation index?
  4877. % Workhorse for all indexes.
  4878. % #1 is name of index, #2 is stuff to put there, #3 is subentry --
  4879. % empty if called from \doind, as we usually are (the main exception
  4880. % is with most defuns, which call us directly).
  4881. %
  4882. \def\dosubind#1#2#3{%
  4883. \iflinks
  4884. {%
  4885. \requireopenindexfile{#1}%
  4886. % Store the main index entry text (including the third arg).
  4887. \toks0 = {#2}%
  4888. % If third arg is present, precede it with a space.
  4889. \def\thirdarg{#3}%
  4890. \ifx\thirdarg\empty \else
  4891. \toks0 = \expandafter{\the\toks0 \space #3}%
  4892. \fi
  4893. %
  4894. \edef\writeto{\csname#1indfile\endcsname}%
  4895. %
  4896. \safewhatsit\dosubindwrite
  4897. }%
  4898. \fi
  4899. }
  4900. % Check if an index file has been opened, and if not, open it.
  4901. \def\requireopenindexfile#1{%
  4902. \ifnum\csname #1indfile\endcsname=0
  4903. \expandafter\newwrite \csname#1indfile\endcsname
  4904. \edef\suffix{#1}%
  4905. % A .fls suffix would conflict with the file extension for the output
  4906. % of -recorder, so use .f1s instead.
  4907. \ifx\suffix\indexisfl\def\suffix{f1}\fi
  4908. % Open the file
  4909. \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
  4910. % Using \immediate above here prevents an object entering into the current
  4911. % box, which could confound checks such as those in \safewhatsit for
  4912. % preceding skips.
  4913. \typeout{Writing index file \jobname.\suffix}%
  4914. \fi}
  4915. \def\indexisfl{fl}
  4916. % Output \ as {\indexbackslash}, because \ is an escape character in
  4917. % the index files.
  4918. \let\indexbackslash=\relax
  4919. {\catcode`\@=0 \catcode`\\=\active
  4920. @gdef@useindexbackslash{@def\{{@indexbackslash}}}
  4921. }
  4922. % Definition for writing index entry text.
  4923. \def\sortas#1{\ignorespaces}%
  4924. % Definition for writing index entry sort key. Should occur at the at
  4925. % the beginning of the index entry, like
  4926. % @cindex @sortas{september} \september
  4927. % The \ignorespaces takes care of following space, but there's no way
  4928. % to remove space before it.
  4929. {
  4930. \catcode`\-=13
  4931. \gdef\indexwritesortas{%
  4932. \begingroup
  4933. \indexnonalnumreappear
  4934. \indexwritesortasxxx}
  4935. \gdef\indexwritesortasxxx#1{%
  4936. \xdef\indexsortkey{#1}\endgroup}
  4937. }
  4938. % Write the entry in \toks0 to the index file.
  4939. %
  4940. \def\dosubindwrite{%
  4941. % Put the index entry in the margin if desired.
  4942. \ifx\SETmarginindex\relax\else
  4943. \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
  4944. \fi
  4945. %
  4946. % Remember, we are within a group.
  4947. \indexdummies % Must do this here, since \bf, etc expand at this stage
  4948. \useindexbackslash % \indexbackslash isn't defined now so it will be output
  4949. % as is; and it will print as backslash.
  4950. % The braces around \indexbrace are recognized by texindex.
  4951. %
  4952. % Get the string to sort by, by processing the index entry with all
  4953. % font commands turned off.
  4954. {\indexnofonts
  4955. \def\lbracechar{{\indexlbrace}}%
  4956. \def\rbracechar{{\indexrbrace}}%
  4957. \let\{=\lbracechar
  4958. \let\}=\rbracechar
  4959. \indexnonalnumdisappear
  4960. \xdef\indexsortkey{}%
  4961. \let\sortas=\indexwritesortas
  4962. \edef\temp{\the\toks0}%
  4963. \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
  4964. \ifx\indexsortkey\empty
  4965. \xdef\indexsortkey{\temp}%
  4966. \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
  4967. \fi
  4968. }%
  4969. %
  4970. % Set up the complete index entry, with both the sort key and
  4971. % the original text, including any font commands. We write
  4972. % three arguments to \entry to the .?? file (four in the
  4973. % subentry case), texindex reduces to two when writing the .??s
  4974. % sorted result.
  4975. \edef\temp{%
  4976. \write\writeto{%
  4977. \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
  4978. }%
  4979. \temp
  4980. }
  4981. \newbox\dummybox % used above
  4982. % Take care of unwanted page breaks/skips around a whatsit:
  4983. %
  4984. % If a skip is the last thing on the list now, preserve it
  4985. % by backing up by \lastskip, doing the \write, then inserting
  4986. % the skip again. Otherwise, the whatsit generated by the
  4987. % \write or \pdfdest will make \lastskip zero. The result is that
  4988. % sequences like this:
  4989. % @end defun
  4990. % @tindex whatever
  4991. % @defun ...
  4992. % will have extra space inserted, because the \medbreak in the
  4993. % start of the @defun won't see the skip inserted by the @end of
  4994. % the previous defun.
  4995. %
  4996. % But don't do any of this if we're not in vertical mode. We
  4997. % don't want to do a \vskip and prematurely end a paragraph.
  4998. %
  4999. % Avoid page breaks due to these extra skips, too.
  5000. %
  5001. % But wait, there is a catch there:
  5002. % We'll have to check whether \lastskip is zero skip. \ifdim is not
  5003. % sufficient for this purpose, as it ignores stretch and shrink parts
  5004. % of the skip. The only way seems to be to check the textual
  5005. % representation of the skip.
  5006. %
  5007. % The following is almost like \def\zeroskipmacro{0.0pt} except that
  5008. % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
  5009. %
  5010. \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
  5011. %
  5012. \newskip\whatsitskip
  5013. \newcount\whatsitpenalty
  5014. %
  5015. % ..., ready, GO:
  5016. %
  5017. \def\safewhatsit#1{\ifhmode
  5018. #1%
  5019. \else
  5020. % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
  5021. \whatsitskip = \lastskip
  5022. \edef\lastskipmacro{\the\lastskip}%
  5023. \whatsitpenalty = \lastpenalty
  5024. %
  5025. % If \lastskip is nonzero, that means the last item was a
  5026. % skip. And since a skip is discardable, that means this
  5027. % -\whatsitskip glue we're inserting is preceded by a
  5028. % non-discardable item, therefore it is not a potential
  5029. % breakpoint, therefore no \nobreak needed.
  5030. \ifx\lastskipmacro\zeroskipmacro
  5031. \else
  5032. \vskip-\whatsitskip
  5033. \fi
  5034. %
  5035. #1%
  5036. %
  5037. \ifx\lastskipmacro\zeroskipmacro
  5038. % If \lastskip was zero, perhaps the last item was a penalty, and
  5039. % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
  5040. % to re-insert the same penalty (values >10000 are used for various
  5041. % signals); since we just inserted a non-discardable item, any
  5042. % following glue (such as a \parskip) would be a breakpoint. For example:
  5043. % @deffn deffn-whatever
  5044. % @vindex index-whatever
  5045. % Description.
  5046. % would allow a break between the index-whatever whatsit
  5047. % and the "Description." paragraph.
  5048. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
  5049. \else
  5050. % On the other hand, if we had a nonzero \lastskip,
  5051. % this make-up glue would be preceded by a non-discardable item
  5052. % (the whatsit from the \write), so we must insert a \nobreak.
  5053. \nobreak\vskip\whatsitskip
  5054. \fi
  5055. \fi}
  5056. % The index entry written in the file actually looks like
  5057. % \entry {sortstring}{page}{topic}
  5058. % or
  5059. % \entry {sortstring}{page}{topic}{subtopic}
  5060. % The texindex program reads in these files and writes files
  5061. % containing these kinds of lines:
  5062. % \initial {c}
  5063. % before the first topic whose initial is c
  5064. % \entry {topic}{pagelist}
  5065. % for a topic that is used without subtopics
  5066. % \primary {topic}
  5067. % for the beginning of a topic that is used with subtopics
  5068. % \secondary {subtopic}{pagelist}
  5069. % for each subtopic.
  5070. % Define the user-accessible indexing commands
  5071. % @findex, @vindex, @kindex, @cindex.
  5072. \def\findex {\fnindex}
  5073. \def\kindex {\kyindex}
  5074. \def\cindex {\cpindex}
  5075. \def\vindex {\vrindex}
  5076. \def\tindex {\tpindex}
  5077. \def\pindex {\pgindex}
  5078. \def\cindexsub {\begingroup\obeylines\cindexsub}
  5079. {\obeylines %
  5080. \gdef\cindexsub "#1" #2^^M{\endgroup %
  5081. \dosubind{cp}{#2}{#1}}}
  5082. % Define the macros used in formatting output of the sorted index material.
  5083. % @printindex causes a particular index (the ??s file) to get printed.
  5084. % It does not print any chapter heading (usually an @unnumbered).
  5085. %
  5086. \parseargdef\printindex{\begingroup
  5087. \dobreak \chapheadingskip{10000}%
  5088. %
  5089. \smallfonts \rm
  5090. \tolerance = 9500
  5091. \plainfrenchspacing
  5092. \everypar = {}% don't want the \kern\-parindent from indentation suppression.
  5093. %
  5094. % See if the index file exists and is nonempty.
  5095. % Change catcode of @ here so that if the index file contains
  5096. % \initial {@}
  5097. % as its first line, TeX doesn't complain about mismatched braces
  5098. % (because it thinks @} is a control sequence).
  5099. \catcode`\@ = 12
  5100. % See comment in \requireopenindexfile.
  5101. \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
  5102. \openin 1 \jobname.\indexname s
  5103. \ifeof 1
  5104. % \enddoublecolumns gets confused if there is no text in the index,
  5105. % and it loses the chapter title and the aux file entries for the
  5106. % index. The easiest way to prevent this problem is to make sure
  5107. % there is some text.
  5108. \putwordIndexNonexistent
  5109. \typeout{No file \jobname.\indexname s.}%
  5110. \else
  5111. \catcode`\\ = 0
  5112. %
  5113. % If the index file exists but is empty, then \openin leaves \ifeof
  5114. % false. We have to make TeX try to read something from the file, so
  5115. % it can discover if there is anything in it.
  5116. \read 1 to \thisline
  5117. \ifeof 1
  5118. \putwordIndexIsEmpty
  5119. \else
  5120. % Index files are almost Texinfo source, but we use \ as the escape
  5121. % character. It would be better to use @, but that's too big a change
  5122. % to make right now.
  5123. \def\indexbackslash{\ttbackslash}%
  5124. \let\indexlbrace\{ % Likewise, set these sequences for braces
  5125. \let\indexrbrace\} % used in the sort key.
  5126. \begindoublecolumns
  5127. \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
  5128. %
  5129. % Read input from the index file line by line.
  5130. \loopdo
  5131. \ifeof1 \else
  5132. \read 1 to \nextline
  5133. \fi
  5134. %
  5135. \indexinputprocessing
  5136. \thisline
  5137. %
  5138. \ifeof1\else
  5139. \let\thisline\nextline
  5140. \repeat
  5141. %%
  5142. \enddoublecolumns
  5143. \fi
  5144. \fi
  5145. \closein 1
  5146. \endgroup}
  5147. \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
  5148. \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
  5149. \def\indexinputprocessing{%
  5150. \ifeof1
  5151. \let\firsttoken\relax
  5152. \else
  5153. \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
  5154. \act
  5155. \fi
  5156. }
  5157. \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
  5158. \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
  5159. % These macros are used by the sorted index file itself.
  5160. % Change them to control the appearance of the index.
  5161. {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
  5162. \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
  5163. \catcode`\$=3
  5164. \gdef\initialglyphs{%
  5165. % Some changes for non-alphabetic characters. Using the glyphs from the
  5166. % math fonts looks more consistent than the typewriter font used elsewhere
  5167. % for these characters.
  5168. \def\indexbackslash{\math{\backslash}}%
  5169. \let\\=\indexbackslash
  5170. %
  5171. % Can't get bold backslash so don't use bold forward slash
  5172. \catcode`\/=13
  5173. \def/{{\secrmnotbold \normalslash}}%
  5174. \def-{{\normaldash\normaldash}}% en dash `--'
  5175. \def^{{\chapbf \normalcaret}}%
  5176. \def~{{\chapbf \normaltilde}}%
  5177. \def\_{%
  5178. \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
  5179. \def|{$\vert$}%
  5180. \def<{$\less$}%
  5181. \def>{$\gtr$}%
  5182. \def+{$\normalplus$}%
  5183. }}
  5184. \def\initial{%
  5185. \bgroup
  5186. \initialglyphs
  5187. \initialx
  5188. }
  5189. \def\initialx#1{%
  5190. % Remove any glue we may have, we'll be inserting our own.
  5191. \removelastskip
  5192. %
  5193. % We like breaks before the index initials, so insert a bonus.
  5194. % The glue before the bonus allows a little bit of space at the
  5195. % bottom of a column to reduce an increase in inter-line spacing.
  5196. \nobreak
  5197. \vskip 0pt plus 5\baselineskip
  5198. \penalty -300
  5199. \vskip 0pt plus -5\baselineskip
  5200. %
  5201. % Typeset the initial. Making this add up to a whole number of
  5202. % baselineskips increases the chance of the dots lining up from column
  5203. % to column. It still won't often be perfect, because of the stretch
  5204. % we need before each entry, but it's better.
  5205. %
  5206. % No shrink because it confuses \balancecolumns.
  5207. \vskip 1.67\baselineskip plus 1\baselineskip
  5208. \leftline{\secfonts \kern-0.05em \secbf #1}%
  5209. % \secfonts is inside the argument of \leftline so that the change of
  5210. % \baselineskip will not affect any glue inserted before the vbox that
  5211. % \leftline creates.
  5212. % Do our best not to break after the initial.
  5213. \nobreak
  5214. \vskip .33\baselineskip plus .1\baselineskip
  5215. \egroup % \initialglyphs
  5216. }
  5217. \newdimen\entryrightmargin
  5218. \entryrightmargin=0pt
  5219. % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
  5220. % then page number (#2) flushed to the right margin. It is used for index
  5221. % and table of contents entries. The paragraph is indented by \leftskip.
  5222. %
  5223. \def\entry{%
  5224. \begingroup
  5225. %
  5226. % For pdfTeX and XeTeX.
  5227. % The redefinition of \domark stops marks being added in \pdflink to
  5228. % preserve coloured links across page boundaries. Otherwise the marks
  5229. % would get in the way of \lastbox in \insertentrybox.
  5230. \let\domark\relax
  5231. %
  5232. % Start a new paragraph if necessary, so our assignments below can't
  5233. % affect previous text.
  5234. \par
  5235. %
  5236. % No extra space above this paragraph.
  5237. \parskip = 0in
  5238. %
  5239. % When reading the text of entry, convert explicit line breaks
  5240. % from @* into spaces. The user might give these in long section
  5241. % titles, for instance.
  5242. \def\*{\unskip\space\ignorespaces}%
  5243. \def\entrybreak{\hfil\break}% An undocumented command
  5244. %
  5245. % Swallow the left brace of the text (first parameter):
  5246. \afterassignment\doentry
  5247. \let\temp =
  5248. }
  5249. \def\entrybreak{\unskip\space\ignorespaces}%
  5250. \def\doentry{%
  5251. % Save the text of the entry
  5252. \global\setbox\boxA=\hbox\bgroup
  5253. \bgroup % Instead of the swallowed brace.
  5254. \noindent
  5255. \aftergroup\finishentry
  5256. % And now comes the text of the entry.
  5257. % Not absorbing as a macro argument reduces the chance of problems
  5258. % with catcodes occurring.
  5259. }
  5260. {\catcode`\@=11
  5261. \gdef\finishentry#1{%
  5262. \egroup % end box A
  5263. \dimen@ = \wd\boxA % Length of text of entry
  5264. \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
  5265. % #1 is the page number.
  5266. %
  5267. % Get the width of the page numbers, and only use
  5268. % leaders if they are present.
  5269. \global\setbox\boxB = \hbox{#1}%
  5270. \ifdim\wd\boxB = 0pt
  5271. \null\nobreak\hfill\ %
  5272. \else
  5273. %
  5274. \null\nobreak\indexdotfill % Have leaders before the page number.
  5275. %
  5276. \ifpdf
  5277. \pdfgettoks#1.%
  5278. \hskip\skip\thinshrinkable\the\toksA
  5279. \else
  5280. \ifx\XeTeXrevision\thisisundefined
  5281. \hskip\skip\thinshrinkable #1%
  5282. \else
  5283. \pdfgettoks#1.%
  5284. \hskip\skip\thinshrinkable\the\toksA
  5285. \fi
  5286. \fi
  5287. \fi
  5288. \egroup % end \boxA
  5289. \ifdim\wd\boxB = 0pt
  5290. \global\setbox\entrybox=\vbox{\unhbox\boxA}%
  5291. \else
  5292. \global\setbox\entrybox=\vbox\bgroup
  5293. % We want the text of the entries to be aligned to the left, and the
  5294. % page numbers to be aligned to the right.
  5295. %
  5296. \parindent = 0pt
  5297. \advance\leftskip by 0pt plus 1fil
  5298. \advance\leftskip by 0pt plus -1fill
  5299. \rightskip = 0pt plus -1fil
  5300. \advance\rightskip by 0pt plus 1fill
  5301. % Cause last line, which could consist of page numbers on their own
  5302. % if the list of page numbers is long, to be aligned to the right.
  5303. \parfillskip=0pt plus -1fill
  5304. %
  5305. \advance\rightskip by \entryrightmargin
  5306. % Determine how far we can stretch into the margin.
  5307. % This allows, e.g., "Appendix H GNU Free Documentation License" to
  5308. % fit on one line in @letterpaper format.
  5309. \ifdim\entryrightmargin>2.1em
  5310. \dimen@i=2.1em
  5311. \else
  5312. \dimen@i=0em
  5313. \fi
  5314. \advance \parfillskip by 0pt minus 1\dimen@i
  5315. %
  5316. \dimen@ii = \hsize
  5317. \advance\dimen@ii by -1\leftskip
  5318. \advance\dimen@ii by -1\entryrightmargin
  5319. \advance\dimen@ii by 1\dimen@i
  5320. \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
  5321. \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
  5322. % Try to split the text roughly evenly. \dimen@ will be the length of
  5323. % the first line.
  5324. \dimen@ = 0.7\dimen@
  5325. \dimen@ii = \hsize
  5326. \ifnum\dimen@>\dimen@ii
  5327. % If the entry is too long (for example, if it needs more than
  5328. % two lines), use all the space in the first line.
  5329. \dimen@ = \dimen@ii
  5330. \fi
  5331. \advance\leftskip by 0pt plus 1fill % ragged right
  5332. \advance \dimen@ by 1\rightskip
  5333. \parshape = 2 0pt \dimen@ 0em \dimen@ii
  5334. % Ideally we'd add a finite glue at the end of the first line only,
  5335. % instead of using \parshape with explicit line lengths, but TeX
  5336. % doesn't seem to provide a way to do such a thing.
  5337. %
  5338. % Indent all lines but the first one.
  5339. \advance\leftskip by 1em
  5340. \advance\parindent by -1em
  5341. \fi\fi
  5342. \indent % start paragraph
  5343. \unhbox\boxA
  5344. %
  5345. % Do not prefer a separate line ending with a hyphen to fewer lines.
  5346. \finalhyphendemerits = 0
  5347. %
  5348. % Word spacing - no stretch
  5349. \spaceskip=\fontdimen2\font minus \fontdimen4\font
  5350. %
  5351. \linepenalty=1000 % Discourage line breaks.
  5352. \hyphenpenalty=5000 % Discourage hyphenation.
  5353. %
  5354. \par % format the paragraph
  5355. \egroup % The \vbox
  5356. \fi
  5357. \endgroup
  5358. \dotheinsertentrybox
  5359. }}
  5360. \newskip\thinshrinkable
  5361. \skip\thinshrinkable=.15em minus .15em
  5362. \newbox\entrybox
  5363. \def\insertentrybox{%
  5364. \ourunvbox\entrybox
  5365. }
  5366. % default definition
  5367. \let\dotheinsertentrybox\insertentrybox
  5368. % Use \lastbox to take apart vbox box by box, and add each sub-box
  5369. % to the current vertical list.
  5370. \def\ourunvbox#1{%
  5371. \bgroup % for local binding of \delayedbox
  5372. % Remove the last box from box #1
  5373. \global\setbox#1=\vbox{%
  5374. \unvbox#1%
  5375. \unskip % remove any glue
  5376. \unpenalty
  5377. \global\setbox\interbox=\lastbox
  5378. }%
  5379. \setbox\delayedbox=\box\interbox
  5380. \ifdim\ht#1=0pt\else
  5381. \ourunvbox#1 % Repeat on what's left of the box
  5382. \nobreak
  5383. \fi
  5384. \box\delayedbox
  5385. \egroup
  5386. }
  5387. \newbox\delayedbox
  5388. \newbox\interbox
  5389. % Used from \printindex. \firsttoken should be the first token
  5390. % after the \entry. If it's not another \entry, we are at the last
  5391. % line of a group of index entries, so insert a penalty to discourage
  5392. % widowed index entries.
  5393. \def\dotheinsertentryboxwithpenalty{%
  5394. \ifx\firsttoken\isentry
  5395. \else
  5396. \penalty 9000
  5397. \fi
  5398. \insertentrybox
  5399. }
  5400. \def\isentry{\entry}%
  5401. % Like plain.tex's \dotfill, except uses up at least 1 em.
  5402. % The filll stretch here overpowers both the fil and fill stretch to push
  5403. % the page number to the right.
  5404. \def\indexdotfill{\cleaders
  5405. \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
  5406. \def\primary #1{\line{#1\hfil}}
  5407. \newskip\secondaryindent \secondaryindent=0.5cm
  5408. \def\secondary#1#2{{%
  5409. \parfillskip=0in
  5410. \parskip=0in
  5411. \hangindent=1in
  5412. \hangafter=1
  5413. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  5414. \ifpdf
  5415. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5416. \else
  5417. \ifx\XeTeXrevision\thisisundefined
  5418. #2
  5419. \else
  5420. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5421. \fi
  5422. \fi
  5423. \par
  5424. }}
  5425. % Define two-column mode, which we use to typeset indexes.
  5426. % Adapted from the TeXbook, page 416, which is to say,
  5427. % the manmac.tex format used to print the TeXbook itself.
  5428. \catcode`\@=11 % private names
  5429. \newbox\partialpage
  5430. \newdimen\doublecolumnhsize
  5431. % Use inside an output routine to save \topmark and \firstmark
  5432. \def\savemarks{%
  5433. \global\savedtopmark=\expandafter{\topmark }%
  5434. \global\savedfirstmark=\expandafter{\firstmark }%
  5435. }
  5436. \newtoks\savedtopmark
  5437. \newtoks\savedfirstmark
  5438. % Set \topmark and \firstmark for next time \output runs.
  5439. % Can't be run from withinside \output (because any material
  5440. % added while an output routine is active, including
  5441. % penalties, is saved for after it finishes). The page so far
  5442. % should be empty, otherwise what's on it will be thrown away.
  5443. \def\restoremarks{%
  5444. \mark{\the\savedtopmark}%
  5445. \bgroup\output = {%
  5446. \setbox\dummybox=\box\PAGE
  5447. }abc\eject\egroup
  5448. % "abc" because output routine doesn't fire for a completely empty page.
  5449. \mark{\the\savedfirstmark}%
  5450. }
  5451. \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  5452. % If not much space left on page, start a new page.
  5453. \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
  5454. %
  5455. % Grab any single-column material above us.
  5456. \output = {%
  5457. %
  5458. % Here is a possibility not foreseen in manmac: if we accumulate a
  5459. % whole lot of material, we might end up calling this \output
  5460. % routine twice in a row (see the doublecol-lose test, which is
  5461. % essentially a couple of indexes with @setchapternewpage off). In
  5462. % that case we just ship out what is in \partialpage with the normal
  5463. % output routine. Generally, \partialpage will be empty when this
  5464. % runs and this will be a no-op. See the indexspread.tex test case.
  5465. \ifvoid\partialpage \else
  5466. \onepageout{\pagecontents\partialpage}%
  5467. \fi
  5468. %
  5469. \global\setbox\partialpage = \vbox{%
  5470. % Unvbox the main output page.
  5471. \unvbox\PAGE
  5472. \kern-\topskip \kern\baselineskip
  5473. }%
  5474. \savemarks
  5475. }%
  5476. \eject % run that output routine to set \partialpage
  5477. \restoremarks
  5478. %
  5479. % We recover the two marks that the last output routine saved in order
  5480. % to propagate the information in marks added around a chapter heading,
  5481. % which could be otherwise be lost by the time the final page is output.
  5482. %
  5483. %
  5484. % Use the double-column output routine for subsequent pages.
  5485. \output = {\doublecolumnout}%
  5486. %
  5487. % Change the page size parameters. We could do this once outside this
  5488. % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  5489. % format, but then we repeat the same computation. Repeating a couple
  5490. % of assignments once per index is clearly meaningless for the
  5491. % execution time, so we may as well do it in one place.
  5492. %
  5493. % First we halve the line length, less a little for the gutter between
  5494. % the columns. We compute the gutter based on the line length, so it
  5495. % changes automatically with the paper format. The magic constant
  5496. % below is chosen so that the gutter has the same value (well, +-<1pt)
  5497. % as it did when we hard-coded it.
  5498. %
  5499. % We put the result in a separate register, \doublecolumhsize, so we
  5500. % can restore it in \pagesofar, after \hsize itself has (potentially)
  5501. % been clobbered.
  5502. %
  5503. \doublecolumnhsize = \hsize
  5504. \advance\doublecolumnhsize by -.04154\hsize
  5505. \divide\doublecolumnhsize by 2
  5506. \hsize = \doublecolumnhsize
  5507. %
  5508. % Double the \vsize as well.
  5509. \advance\vsize by -\ht\partialpage
  5510. \vsize = 2\vsize
  5511. %
  5512. % For the benefit of balancing columns
  5513. \advance\baselineskip by 0pt plus 0.5pt
  5514. }
  5515. % The double-column output routine for all double-column pages except
  5516. % the last, which is done by \balancecolumns.
  5517. %
  5518. \def\doublecolumnout{%
  5519. %
  5520. \splittopskip=\topskip \splitmaxdepth=\maxdepth
  5521. % Get the available space for the double columns -- the normal
  5522. % (undoubled) page height minus any material left over from the
  5523. % previous page.
  5524. \dimen@ = \vsize
  5525. \divide\dimen@ by 2
  5526. %
  5527. % box0 will be the left-hand column, box2 the right.
  5528. \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
  5529. \global\advance\vsize by 2\ht\partialpage
  5530. \onepageout\pagesofar
  5531. \unvbox\PAGE
  5532. \penalty\outputpenalty
  5533. }
  5534. %
  5535. % Re-output the contents of the output page -- any previous material,
  5536. % followed by the two boxes we just split, in box0 and box2.
  5537. \def\pagesofar{%
  5538. \unvbox\partialpage
  5539. %
  5540. \hsize = \doublecolumnhsize
  5541. \wd0=\hsize \wd2=\hsize
  5542. \hbox to\txipagewidth{\box0\hfil\box2}%
  5543. }
  5544. % Finished with with double columns.
  5545. \def\enddoublecolumns{%
  5546. % The following penalty ensures that the page builder is exercised
  5547. % _before_ we change the output routine. This is necessary in the
  5548. % following situation:
  5549. %
  5550. % The last section of the index consists only of a single entry.
  5551. % Before this section, \pagetotal is less than \pagegoal, so no
  5552. % break occurs before the last section starts. However, the last
  5553. % section, consisting of \initial and the single \entry, does not
  5554. % fit on the page and has to be broken off. Without the following
  5555. % penalty the page builder will not be exercised until \eject
  5556. % below, and by that time we'll already have changed the output
  5557. % routine to the \balancecolumns version, so the next-to-last
  5558. % double-column page will be processed with \balancecolumns, which
  5559. % is wrong: The two columns will go to the main vertical list, with
  5560. % the broken-off section in the recent contributions. As soon as
  5561. % the output routine finishes, TeX starts reconsidering the page
  5562. % break. The two columns and the broken-off section both fit on the
  5563. % page, because the two columns now take up only half of the page
  5564. % goal. When TeX sees \eject from below which follows the final
  5565. % section, it invokes the new output routine that we've set after
  5566. % \balancecolumns below; \onepageout will try to fit the two columns
  5567. % and the final section into the vbox of \txipageheight (see
  5568. % \pagebody), causing an overfull box.
  5569. %
  5570. % Note that glue won't work here, because glue does not exercise the
  5571. % page builder, unlike penalties (see The TeXbook, pp. 280-281).
  5572. \penalty0
  5573. %
  5574. \output = {%
  5575. % Split the last of the double-column material.
  5576. \savemarks
  5577. \balancecolumns
  5578. }%
  5579. \eject % call the \output just set
  5580. \ifdim\pagetotal=0pt
  5581. % Having called \balancecolumns once, we do not
  5582. % want to call it again. Therefore, reset \output to its normal
  5583. % definition right away.
  5584. \global\output = {\onepageout{\pagecontents\PAGE}}%
  5585. %
  5586. \endgroup % started in \begindoublecolumns
  5587. \restoremarks
  5588. % Leave the double-column material on the current page, no automatic
  5589. % page break.
  5590. \box\balancedcolumns
  5591. %
  5592. % \pagegoal was set to the doubled \vsize above, since we restarted
  5593. % the current page. We're now back to normal single-column
  5594. % typesetting, so reset \pagegoal to the normal \vsize.
  5595. \global\vsize = \txipageheight %
  5596. \pagegoal = \txipageheight %
  5597. \else
  5598. % We had some left-over material. This might happen when \doublecolumnout
  5599. % is called in \balancecolumns. Try again.
  5600. \expandafter\enddoublecolumns
  5601. \fi
  5602. }
  5603. \newbox\balancedcolumns
  5604. \setbox\balancedcolumns=\vbox{shouldnt see this}%
  5605. %
  5606. % Only called for the last of the double column material. \doublecolumnout
  5607. % does the others.
  5608. \def\balancecolumns{%
  5609. \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
  5610. \dimen@ = \ht0
  5611. \advance\dimen@ by \topskip
  5612. \advance\dimen@ by-\baselineskip
  5613. \ifdim\dimen@<5\baselineskip
  5614. % Don't split a short final column in two.
  5615. \setbox2=\vbox{}%
  5616. \global\setbox\balancedcolumns=\vbox{\pagesofar}%
  5617. \else
  5618. \divide\dimen@ by 2 % target to split to
  5619. \dimen@ii = \dimen@
  5620. \splittopskip = \topskip
  5621. % Loop until left column is at least as high as the right column.
  5622. {%
  5623. \vbadness = 10000
  5624. \loop
  5625. \global\setbox3 = \copy0
  5626. \global\setbox1 = \vsplit3 to \dimen@
  5627. \ifdim\ht1<\ht3
  5628. \global\advance\dimen@ by 1pt
  5629. \repeat
  5630. }%
  5631. % Now the left column is in box 1, and the right column in box 3.
  5632. %
  5633. % Check whether the left column has come out higher than the page itself.
  5634. % (Note that we have doubled \vsize for the double columns, so
  5635. % the actual height of the page is 0.5\vsize).
  5636. \ifdim2\ht1>\vsize
  5637. % It appears that we have been called upon to balance too much material.
  5638. % Output some of it with \doublecolumnout, leaving the rest on the page.
  5639. \setbox\PAGE=\box0
  5640. \doublecolumnout
  5641. \else
  5642. % Compare the heights of the two columns.
  5643. \ifdim4\ht1>5\ht3
  5644. % Column heights are too different, so don't make their bottoms
  5645. % flush with each other.
  5646. \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
  5647. \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
  5648. \else
  5649. % Make column bottoms flush with each other.
  5650. \setbox2=\vbox to\ht1{\unvbox3\unskip}%
  5651. \setbox0=\vbox to\ht1{\unvbox1\unskip}%
  5652. \fi
  5653. \global\setbox\balancedcolumns=\vbox{\pagesofar}%
  5654. \fi
  5655. \fi
  5656. %
  5657. }
  5658. \catcode`\@ = \other
  5659. \message{sectioning,}
  5660. % Chapters, sections, etc.
  5661. % Let's start with @part.
  5662. \outer\parseargdef\part{\partzzz{#1}}
  5663. \def\partzzz#1{%
  5664. \chapoddpage
  5665. \null
  5666. \vskip.3\vsize % move it down on the page a bit
  5667. \begingroup
  5668. \noindent \titlefonts\rm #1\par % the text
  5669. \let\lastnode=\empty % no node to associate with
  5670. \writetocentry{part}{#1}{}% but put it in the toc
  5671. \headingsoff % no headline or footline on the part page
  5672. % This outputs a mark at the end of the page that clears \thischapter
  5673. % and \thissection, as is done in \startcontents.
  5674. \let\pchapsepmacro\relax
  5675. \chapmacro{}{Yomitfromtoc}{}%
  5676. \chapoddpage
  5677. \endgroup
  5678. }
  5679. % \unnumberedno is an oxymoron. But we count the unnumbered
  5680. % sections so that we can refer to them unambiguously in the pdf
  5681. % outlines by their "section number". We avoid collisions with chapter
  5682. % numbers by starting them at 10000. (If a document ever has 10000
  5683. % chapters, we're in trouble anyway, I'm sure.)
  5684. \newcount\unnumberedno \unnumberedno = 10000
  5685. \newcount\chapno
  5686. \newcount\secno \secno=0
  5687. \newcount\subsecno \subsecno=0
  5688. \newcount\subsubsecno \subsubsecno=0
  5689. % This counter is funny since it counts through charcodes of letters A, B, ...
  5690. \newcount\appendixno \appendixno = `\@
  5691. %
  5692. % \def\appendixletter{\char\the\appendixno}
  5693. % We do the following ugly conditional instead of the above simple
  5694. % construct for the sake of pdftex, which needs the actual
  5695. % letter in the expansion, not just typeset.
  5696. %
  5697. \def\appendixletter{%
  5698. \ifnum\appendixno=`A A%
  5699. \else\ifnum\appendixno=`B B%
  5700. \else\ifnum\appendixno=`C C%
  5701. \else\ifnum\appendixno=`D D%
  5702. \else\ifnum\appendixno=`E E%
  5703. \else\ifnum\appendixno=`F F%
  5704. \else\ifnum\appendixno=`G G%
  5705. \else\ifnum\appendixno=`H H%
  5706. \else\ifnum\appendixno=`I I%
  5707. \else\ifnum\appendixno=`J J%
  5708. \else\ifnum\appendixno=`K K%
  5709. \else\ifnum\appendixno=`L L%
  5710. \else\ifnum\appendixno=`M M%
  5711. \else\ifnum\appendixno=`N N%
  5712. \else\ifnum\appendixno=`O O%
  5713. \else\ifnum\appendixno=`P P%
  5714. \else\ifnum\appendixno=`Q Q%
  5715. \else\ifnum\appendixno=`R R%
  5716. \else\ifnum\appendixno=`S S%
  5717. \else\ifnum\appendixno=`T T%
  5718. \else\ifnum\appendixno=`U U%
  5719. \else\ifnum\appendixno=`V V%
  5720. \else\ifnum\appendixno=`W W%
  5721. \else\ifnum\appendixno=`X X%
  5722. \else\ifnum\appendixno=`Y Y%
  5723. \else\ifnum\appendixno=`Z Z%
  5724. % The \the is necessary, despite appearances, because \appendixletter is
  5725. % expanded while writing the .toc file. \char\appendixno is not
  5726. % expandable, thus it is written literally, thus all appendixes come out
  5727. % with the same letter (or @) in the toc without it.
  5728. \else\char\the\appendixno
  5729. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  5730. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  5731. % Each @chapter defines these (using marks) as the number+name, number
  5732. % and name of the chapter. Page headings and footings can use
  5733. % these. @section does likewise.
  5734. \def\thischapter{}
  5735. \def\thischapternum{}
  5736. \def\thischaptername{}
  5737. \def\thissection{}
  5738. \def\thissectionnum{}
  5739. \def\thissectionname{}
  5740. \newcount\absseclevel % used to calculate proper heading level
  5741. \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
  5742. % @raisesections: treat @section as chapter, @subsection as section, etc.
  5743. \def\raisesections{\global\advance\secbase by -1}
  5744. \let\up=\raisesections % original BFox name
  5745. % @lowersections: treat @chapter as section, @section as subsection, etc.
  5746. \def\lowersections{\global\advance\secbase by 1}
  5747. \let\down=\lowersections % original BFox name
  5748. % we only have subsub.
  5749. \chardef\maxseclevel = 3
  5750. %
  5751. % A numbered section within an unnumbered changes to unnumbered too.
  5752. % To achieve this, remember the "biggest" unnum. sec. we are currently in:
  5753. \chardef\unnlevel = \maxseclevel
  5754. %
  5755. % Trace whether the current chapter is an appendix or not:
  5756. % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
  5757. \def\chapheadtype{N}
  5758. % Choose a heading macro
  5759. % #1 is heading type
  5760. % #2 is heading level
  5761. % #3 is text for heading
  5762. \def\genhead#1#2#3{%
  5763. % Compute the abs. sec. level:
  5764. \absseclevel=#2
  5765. \advance\absseclevel by \secbase
  5766. % Make sure \absseclevel doesn't fall outside the range:
  5767. \ifnum \absseclevel < 0
  5768. \absseclevel = 0
  5769. \else
  5770. \ifnum \absseclevel > 3
  5771. \absseclevel = 3
  5772. \fi
  5773. \fi
  5774. % The heading type:
  5775. \def\headtype{#1}%
  5776. \if \headtype U%
  5777. \ifnum \absseclevel < \unnlevel
  5778. \chardef\unnlevel = \absseclevel
  5779. \fi
  5780. \else
  5781. % Check for appendix sections:
  5782. \ifnum \absseclevel = 0
  5783. \edef\chapheadtype{\headtype}%
  5784. \else
  5785. \if \headtype A\if \chapheadtype N%
  5786. \errmessage{@appendix... within a non-appendix chapter}%
  5787. \fi\fi
  5788. \fi
  5789. % Check for numbered within unnumbered:
  5790. \ifnum \absseclevel > \unnlevel
  5791. \def\headtype{U}%
  5792. \else
  5793. \chardef\unnlevel = 3
  5794. \fi
  5795. \fi
  5796. % Now print the heading:
  5797. \if \headtype U%
  5798. \ifcase\absseclevel
  5799. \unnumberedzzz{#3}%
  5800. \or \unnumberedseczzz{#3}%
  5801. \or \unnumberedsubseczzz{#3}%
  5802. \or \unnumberedsubsubseczzz{#3}%
  5803. \fi
  5804. \else
  5805. \if \headtype A%
  5806. \ifcase\absseclevel
  5807. \appendixzzz{#3}%
  5808. \or \appendixsectionzzz{#3}%
  5809. \or \appendixsubseczzz{#3}%
  5810. \or \appendixsubsubseczzz{#3}%
  5811. \fi
  5812. \else
  5813. \ifcase\absseclevel
  5814. \chapterzzz{#3}%
  5815. \or \seczzz{#3}%
  5816. \or \numberedsubseczzz{#3}%
  5817. \or \numberedsubsubseczzz{#3}%
  5818. \fi
  5819. \fi
  5820. \fi
  5821. \suppressfirstparagraphindent
  5822. }
  5823. % an interface:
  5824. \def\numhead{\genhead N}
  5825. \def\apphead{\genhead A}
  5826. \def\unnmhead{\genhead U}
  5827. % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
  5828. % all lower-level sectioning counters to zero.
  5829. %
  5830. % Also set \chaplevelprefix, which we prepend to @float sequence numbers
  5831. % (e.g., figures), q.v. By default (before any chapter), that is empty.
  5832. \let\chaplevelprefix = \empty
  5833. %
  5834. \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
  5835. \def\chapterzzz#1{%
  5836. % section resetting is \global in case the chapter is in a group, such
  5837. % as an @include file.
  5838. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5839. \global\advance\chapno by 1
  5840. %
  5841. % Used for \float.
  5842. \gdef\chaplevelprefix{\the\chapno.}%
  5843. \resetallfloatnos
  5844. %
  5845. % \putwordChapter can contain complex things in translations.
  5846. \toks0=\expandafter{\putwordChapter}%
  5847. \message{\the\toks0 \space \the\chapno}%
  5848. %
  5849. % Write the actual heading.
  5850. \chapmacro{#1}{Ynumbered}{\the\chapno}%
  5851. %
  5852. % So @section and the like are numbered underneath this chapter.
  5853. \global\let\section = \numberedsec
  5854. \global\let\subsection = \numberedsubsec
  5855. \global\let\subsubsection = \numberedsubsubsec
  5856. }
  5857. \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
  5858. %
  5859. \def\appendixzzz#1{%
  5860. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5861. \global\advance\appendixno by 1
  5862. \gdef\chaplevelprefix{\appendixletter.}%
  5863. \resetallfloatnos
  5864. %
  5865. % \putwordAppendix can contain complex things in translations.
  5866. \toks0=\expandafter{\putwordAppendix}%
  5867. \message{\the\toks0 \space \appendixletter}%
  5868. %
  5869. \chapmacro{#1}{Yappendix}{\appendixletter}%
  5870. %
  5871. \global\let\section = \appendixsec
  5872. \global\let\subsection = \appendixsubsec
  5873. \global\let\subsubsection = \appendixsubsubsec
  5874. }
  5875. % normally unnmhead0 calls unnumberedzzz:
  5876. \outer\parseargdef\unnumbered{\unnmhead0{#1}}
  5877. \def\unnumberedzzz#1{%
  5878. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5879. \global\advance\unnumberedno by 1
  5880. %
  5881. % Since an unnumbered has no number, no prefix for figures.
  5882. \global\let\chaplevelprefix = \empty
  5883. \resetallfloatnos
  5884. %
  5885. % This used to be simply \message{#1}, but TeX fully expands the
  5886. % argument to \message. Therefore, if #1 contained @-commands, TeX
  5887. % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
  5888. % expanded @cite (which turns out to cause errors because \cite is meant
  5889. % to be executed, not expanded).
  5890. %
  5891. % Anyway, we don't want the fully-expanded definition of @cite to appear
  5892. % as a result of the \message, we just want `@cite' itself. We use
  5893. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  5894. % simply yielding the contents of <toks register>. (We also do this for
  5895. % the toc entries.)
  5896. \toks0 = {#1}%
  5897. \message{(\the\toks0)}%
  5898. %
  5899. \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
  5900. %
  5901. \global\let\section = \unnumberedsec
  5902. \global\let\subsection = \unnumberedsubsec
  5903. \global\let\subsubsection = \unnumberedsubsubsec
  5904. }
  5905. % @centerchap is like @unnumbered, but the heading is centered.
  5906. \outer\parseargdef\centerchap{%
  5907. \let\centerparametersmaybe = \centerparameters
  5908. \unnmhead0{#1}%
  5909. \let\centerparametersmaybe = \relax
  5910. }
  5911. % @top is like @unnumbered.
  5912. \let\top\unnumbered
  5913. % Sections.
  5914. %
  5915. \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
  5916. \def\seczzz#1{%
  5917. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5918. \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
  5919. }
  5920. % normally calls appendixsectionzzz:
  5921. \outer\parseargdef\appendixsection{\apphead1{#1}}
  5922. \def\appendixsectionzzz#1{%
  5923. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5924. \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
  5925. }
  5926. \let\appendixsec\appendixsection
  5927. % normally calls unnumberedseczzz:
  5928. \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
  5929. \def\unnumberedseczzz#1{%
  5930. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5931. \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
  5932. }
  5933. % Subsections.
  5934. %
  5935. % normally calls numberedsubseczzz:
  5936. \outer\parseargdef\numberedsubsec{\numhead2{#1}}
  5937. \def\numberedsubseczzz#1{%
  5938. \global\subsubsecno=0 \global\advance\subsecno by 1
  5939. \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
  5940. }
  5941. % normally calls appendixsubseczzz:
  5942. \outer\parseargdef\appendixsubsec{\apphead2{#1}}
  5943. \def\appendixsubseczzz#1{%
  5944. \global\subsubsecno=0 \global\advance\subsecno by 1
  5945. \sectionheading{#1}{subsec}{Yappendix}%
  5946. {\appendixletter.\the\secno.\the\subsecno}%
  5947. }
  5948. % normally calls unnumberedsubseczzz:
  5949. \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
  5950. \def\unnumberedsubseczzz#1{%
  5951. \global\subsubsecno=0 \global\advance\subsecno by 1
  5952. \sectionheading{#1}{subsec}{Ynothing}%
  5953. {\the\unnumberedno.\the\secno.\the\subsecno}%
  5954. }
  5955. % Subsubsections.
  5956. %
  5957. % normally numberedsubsubseczzz:
  5958. \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
  5959. \def\numberedsubsubseczzz#1{%
  5960. \global\advance\subsubsecno by 1
  5961. \sectionheading{#1}{subsubsec}{Ynumbered}%
  5962. {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5963. }
  5964. % normally appendixsubsubseczzz:
  5965. \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
  5966. \def\appendixsubsubseczzz#1{%
  5967. \global\advance\subsubsecno by 1
  5968. \sectionheading{#1}{subsubsec}{Yappendix}%
  5969. {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
  5970. }
  5971. % normally unnumberedsubsubseczzz:
  5972. \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
  5973. \def\unnumberedsubsubseczzz#1{%
  5974. \global\advance\subsubsecno by 1
  5975. \sectionheading{#1}{subsubsec}{Ynothing}%
  5976. {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5977. }
  5978. % These macros control what the section commands do, according
  5979. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  5980. % Define them by default for a numbered chapter.
  5981. \let\section = \numberedsec
  5982. \let\subsection = \numberedsubsec
  5983. \let\subsubsection = \numberedsubsubsec
  5984. % Define @majorheading, @heading and @subheading
  5985. \def\majorheading{%
  5986. {\advance\chapheadingskip by 10pt \chapbreak }%
  5987. \parsearg\chapheadingzzz
  5988. }
  5989. \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
  5990. \def\chapheadingzzz#1{%
  5991. \vbox{\chapfonts \raggedtitlesettings #1\par}%
  5992. \nobreak\bigskip \nobreak
  5993. \suppressfirstparagraphindent
  5994. }
  5995. % @heading, @subheading, @subsubheading.
  5996. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
  5997. \suppressfirstparagraphindent}
  5998. \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
  5999. \suppressfirstparagraphindent}
  6000. \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
  6001. \suppressfirstparagraphindent}
  6002. % These macros generate a chapter, section, etc. heading only
  6003. % (including whitespace, linebreaking, etc. around it),
  6004. % given all the information in convenient, parsed form.
  6005. % Args are the skip and penalty (usually negative)
  6006. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  6007. % Parameter controlling skip before chapter headings (if needed)
  6008. \newskip\chapheadingskip
  6009. % Define plain chapter starts, and page on/off switching for it.
  6010. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  6011. % Start a new page
  6012. \def\chappager{\par\vfill\supereject}
  6013. % \chapoddpage - start on an odd page for a new chapter
  6014. % Because \domark is called before \chapoddpage, the filler page will
  6015. % get the headings for the next chapter, which is wrong. But we don't
  6016. % care -- we just disable all headings on the filler page.
  6017. \def\chapoddpage{%
  6018. \chappager
  6019. \ifodd\pageno \else
  6020. \begingroup
  6021. \headingsoff
  6022. \null
  6023. \chappager
  6024. \endgroup
  6025. \fi
  6026. }
  6027. \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
  6028. \def\CHAPPAGoff{%
  6029. \global\let\contentsalignmacro = \chappager
  6030. \global\let\pchapsepmacro=\chapbreak
  6031. \global\let\pagealignmacro=\chappager}
  6032. \def\CHAPPAGon{%
  6033. \global\let\contentsalignmacro = \chappager
  6034. \global\let\pchapsepmacro=\chappager
  6035. \global\let\pagealignmacro=\chappager
  6036. \global\def\HEADINGSon{\HEADINGSsingle}}
  6037. \def\CHAPPAGodd{%
  6038. \global\let\contentsalignmacro = \chapoddpage
  6039. \global\let\pchapsepmacro=\chapoddpage
  6040. \global\let\pagealignmacro=\chapoddpage
  6041. \global\def\HEADINGSon{\HEADINGSdouble}}
  6042. \CHAPPAGon
  6043. % \chapmacro - Chapter opening.
  6044. %
  6045. % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
  6046. % Yappendix, Yomitfromtoc), #3 the chapter number.
  6047. % Not used for @heading series.
  6048. %
  6049. % To test against our argument.
  6050. \def\Ynothingkeyword{Ynothing}
  6051. \def\Yappendixkeyword{Yappendix}
  6052. \def\Yomitfromtockeyword{Yomitfromtoc}
  6053. %
  6054. \def\chapmacro#1#2#3{%
  6055. \expandafter\ifx\thisenv\titlepage\else
  6056. \checkenv{}% chapters, etc., should not start inside an environment.
  6057. \fi
  6058. % FIXME: \chapmacro is currently called from inside \titlepage when
  6059. % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
  6060. % this should probably be done by \sectionheading with an option to print
  6061. % in chapter size.
  6062. %
  6063. % Insert the first mark before the heading break (see notes for \domark).
  6064. \let\prevchapterdefs=\lastchapterdefs
  6065. \let\prevsectiondefs=\lastsectiondefs
  6066. \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
  6067. \gdef\thissection{}}%
  6068. %
  6069. \def\temptype{#2}%
  6070. \ifx\temptype\Ynothingkeyword
  6071. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6072. \gdef\thischapter{\thischaptername}}%
  6073. \else\ifx\temptype\Yomitfromtockeyword
  6074. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6075. \gdef\thischapter{}}%
  6076. \else\ifx\temptype\Yappendixkeyword
  6077. \toks0={#1}%
  6078. \xdef\lastchapterdefs{%
  6079. \gdef\noexpand\thischaptername{\the\toks0}%
  6080. \gdef\noexpand\thischapternum{\appendixletter}%
  6081. % \noexpand\putwordAppendix avoids expanding indigestible
  6082. % commands in some of the translations.
  6083. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
  6084. \noexpand\thischapternum:
  6085. \noexpand\thischaptername}%
  6086. }%
  6087. \else
  6088. \toks0={#1}%
  6089. \xdef\lastchapterdefs{%
  6090. \gdef\noexpand\thischaptername{\the\toks0}%
  6091. \gdef\noexpand\thischapternum{\the\chapno}%
  6092. % \noexpand\putwordChapter avoids expanding indigestible
  6093. % commands in some of the translations.
  6094. \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
  6095. \noexpand\thischapternum:
  6096. \noexpand\thischaptername}%
  6097. }%
  6098. \fi\fi\fi
  6099. %
  6100. % Output the mark. Pass it through \safewhatsit, to take care of
  6101. % the preceding space.
  6102. \safewhatsit\domark
  6103. %
  6104. % Insert the chapter heading break.
  6105. \pchapsepmacro
  6106. %
  6107. % Now the second mark, after the heading break. No break points
  6108. % between here and the heading.
  6109. \let\prevchapterdefs=\lastchapterdefs
  6110. \let\prevsectiondefs=\lastsectiondefs
  6111. \domark
  6112. %
  6113. {%
  6114. \chapfonts \rm
  6115. \let\footnote=\errfootnoteheading % give better error message
  6116. %
  6117. % Have to define \lastsection before calling \donoderef, because the
  6118. % xref code eventually uses it. On the other hand, it has to be called
  6119. % after \pchapsepmacro, or the headline will change too soon.
  6120. \gdef\lastsection{#1}%
  6121. %
  6122. % Only insert the separating space if we have a chapter/appendix
  6123. % number, and don't print the unnumbered ``number''.
  6124. \ifx\temptype\Ynothingkeyword
  6125. \setbox0 = \hbox{}%
  6126. \def\toctype{unnchap}%
  6127. \else\ifx\temptype\Yomitfromtockeyword
  6128. \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
  6129. \def\toctype{omit}%
  6130. \else\ifx\temptype\Yappendixkeyword
  6131. \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
  6132. \def\toctype{app}%
  6133. \else
  6134. \setbox0 = \hbox{#3\enspace}%
  6135. \def\toctype{numchap}%
  6136. \fi\fi\fi
  6137. %
  6138. % Write the toc entry for this chapter. Must come before the
  6139. % \donoderef, because we include the current node name in the toc
  6140. % entry, and \donoderef resets it to empty.
  6141. \writetocentry{\toctype}{#1}{#3}%
  6142. %
  6143. % For pdftex, we have to write out the node definition (aka, make
  6144. % the pdfdest) after any page break, but before the actual text has
  6145. % been typeset. If the destination for the pdf outline is after the
  6146. % text, then jumping from the outline may wind up with the text not
  6147. % being visible, for instance under high magnification.
  6148. \donoderef{#2}%
  6149. %
  6150. % Typeset the actual heading.
  6151. \nobreak % Avoid page breaks at the interline glue.
  6152. \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
  6153. \unhbox0 #1\par}%
  6154. }%
  6155. \nobreak\bigskip % no page break after a chapter title
  6156. \nobreak
  6157. }
  6158. % @centerchap -- centered and unnumbered.
  6159. \let\centerparametersmaybe = \relax
  6160. \def\centerparameters{%
  6161. \advance\rightskip by 3\rightskip
  6162. \leftskip = \rightskip
  6163. \parfillskip = 0pt
  6164. }
  6165. % Section titles. These macros combine the section number parts and
  6166. % call the generic \sectionheading to do the printing.
  6167. %
  6168. \newskip\secheadingskip
  6169. \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
  6170. % Subsection titles.
  6171. \newskip\subsecheadingskip
  6172. \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
  6173. % Subsubsection titles.
  6174. \def\subsubsecheadingskip{\subsecheadingskip}
  6175. \def\subsubsecheadingbreak{\subsecheadingbreak}
  6176. % Print any size, any type, section title.
  6177. %
  6178. % #1 is the text of the title,
  6179. % #2 is the section level (sec/subsec/subsubsec),
  6180. % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
  6181. % #4 is the section number.
  6182. %
  6183. \def\seckeyword{sec}
  6184. %
  6185. \def\sectionheading#1#2#3#4{%
  6186. {%
  6187. \def\sectionlevel{#2}%
  6188. \def\temptype{#3}%
  6189. %
  6190. % It is ok for the @heading series commands to appear inside an
  6191. % environment (it's been historically allowed, though the logic is
  6192. % dubious), but not the others.
  6193. \ifx\temptype\Yomitfromtockeyword\else
  6194. \checkenv{}% non-@*heading should not be in an environment.
  6195. \fi
  6196. \let\footnote=\errfootnoteheading
  6197. %
  6198. % Switch to the right set of fonts.
  6199. \csname #2fonts\endcsname \rm
  6200. %
  6201. % Insert first mark before the heading break (see notes for \domark).
  6202. \let\prevsectiondefs=\lastsectiondefs
  6203. \ifx\temptype\Ynothingkeyword
  6204. \ifx\sectionlevel\seckeyword
  6205. \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
  6206. \gdef\thissection{\thissectionname}}%
  6207. \fi
  6208. \else\ifx\temptype\Yomitfromtockeyword
  6209. % Don't redefine \thissection.
  6210. \else\ifx\temptype\Yappendixkeyword
  6211. \ifx\sectionlevel\seckeyword
  6212. \toks0={#1}%
  6213. \xdef\lastsectiondefs{%
  6214. \gdef\noexpand\thissectionname{\the\toks0}%
  6215. \gdef\noexpand\thissectionnum{#4}%
  6216. % \noexpand\putwordSection avoids expanding indigestible
  6217. % commands in some of the translations.
  6218. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6219. \noexpand\thissectionnum:
  6220. \noexpand\thissectionname}%
  6221. }%
  6222. \fi
  6223. \else
  6224. \ifx\sectionlevel\seckeyword
  6225. \toks0={#1}%
  6226. \xdef\lastsectiondefs{%
  6227. \gdef\noexpand\thissectionname{\the\toks0}%
  6228. \gdef\noexpand\thissectionnum{#4}%
  6229. % \noexpand\putwordSection avoids expanding indigestible
  6230. % commands in some of the translations.
  6231. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6232. \noexpand\thissectionnum:
  6233. \noexpand\thissectionname}%
  6234. }%
  6235. \fi
  6236. \fi\fi\fi
  6237. %
  6238. % Go into vertical mode. Usually we'll already be there, but we
  6239. % don't want the following whatsit to end up in a preceding paragraph
  6240. % if the document didn't happen to have a blank line.
  6241. \par
  6242. %
  6243. % Output the mark. Pass it through \safewhatsit, to take care of
  6244. % the preceding space.
  6245. \safewhatsit\domark
  6246. %
  6247. % Insert space above the heading.
  6248. \csname #2headingbreak\endcsname
  6249. %
  6250. % Now the second mark, after the heading break. No break points
  6251. % between here and the heading.
  6252. \global\let\prevsectiondefs=\lastsectiondefs
  6253. \domark
  6254. %
  6255. % Only insert the space after the number if we have a section number.
  6256. \ifx\temptype\Ynothingkeyword
  6257. \setbox0 = \hbox{}%
  6258. \def\toctype{unn}%
  6259. \gdef\lastsection{#1}%
  6260. \else\ifx\temptype\Yomitfromtockeyword
  6261. % for @headings -- no section number, don't include in toc,
  6262. % and don't redefine \lastsection.
  6263. \setbox0 = \hbox{}%
  6264. \def\toctype{omit}%
  6265. \let\sectionlevel=\empty
  6266. \else\ifx\temptype\Yappendixkeyword
  6267. \setbox0 = \hbox{#4\enspace}%
  6268. \def\toctype{app}%
  6269. \gdef\lastsection{#1}%
  6270. \else
  6271. \setbox0 = \hbox{#4\enspace}%
  6272. \def\toctype{num}%
  6273. \gdef\lastsection{#1}%
  6274. \fi\fi\fi
  6275. %
  6276. % Write the toc entry (before \donoderef). See comments in \chapmacro.
  6277. \writetocentry{\toctype\sectionlevel}{#1}{#4}%
  6278. %
  6279. % Write the node reference (= pdf destination for pdftex).
  6280. % Again, see comments in \chapmacro.
  6281. \donoderef{#3}%
  6282. %
  6283. % Interline glue will be inserted when the vbox is completed.
  6284. % That glue will be a valid breakpoint for the page, since it'll be
  6285. % preceded by a whatsit (usually from the \donoderef, or from the
  6286. % \writetocentry if there was no node). We don't want to allow that
  6287. % break, since then the whatsits could end up on page n while the
  6288. % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
  6289. \nobreak
  6290. %
  6291. % Output the actual section heading.
  6292. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
  6293. \hangindent=\wd0 % zero if no section number
  6294. \unhbox0 #1}%
  6295. }%
  6296. % Add extra space after the heading -- half of whatever came above it.
  6297. % Don't allow stretch, though.
  6298. \kern .5 \csname #2headingskip\endcsname
  6299. %
  6300. % Do not let the kern be a potential breakpoint, as it would be if it
  6301. % was followed by glue.
  6302. \nobreak
  6303. %
  6304. % We'll almost certainly start a paragraph next, so don't let that
  6305. % glue accumulate. (Not a breakpoint because it's preceded by a
  6306. % discardable item.) However, when a paragraph is not started next
  6307. % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
  6308. % or the negative glue will cause weirdly wrong output, typically
  6309. % obscuring the section heading with something else.
  6310. \vskip-\parskip
  6311. %
  6312. % This is so the last item on the main vertical list is a known
  6313. % \penalty > 10000, so \startdefun, etc., can recognize the situation
  6314. % and do the needful.
  6315. \penalty 10001
  6316. }
  6317. \message{toc,}
  6318. % Table of contents.
  6319. \newwrite\tocfile
  6320. % Write an entry to the toc file, opening it if necessary.
  6321. % Called from @chapter, etc.
  6322. %
  6323. % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
  6324. % We append the current node name (if any) and page number as additional
  6325. % arguments for the \{chap,sec,...}entry macros which will eventually
  6326. % read this. The node name is used in the pdf outlines as the
  6327. % destination to jump to.
  6328. %
  6329. % We open the .toc file for writing here instead of at @setfilename (or
  6330. % any other fixed time) so that @contents can be anywhere in the document.
  6331. % But if #1 is `omit', then we don't do anything. This is used for the
  6332. % table of contents chapter openings themselves.
  6333. %
  6334. \newif\iftocfileopened
  6335. \def\omitkeyword{omit}%
  6336. %
  6337. \def\writetocentry#1#2#3{%
  6338. \edef\writetoctype{#1}%
  6339. \ifx\writetoctype\omitkeyword \else
  6340. \iftocfileopened\else
  6341. \immediate\openout\tocfile = \jobname.toc
  6342. \global\tocfileopenedtrue
  6343. \fi
  6344. %
  6345. \iflinks
  6346. {\atdummies
  6347. \edef\temp{%
  6348. \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
  6349. \temp
  6350. }%
  6351. \fi
  6352. \fi
  6353. %
  6354. % Tell \shipout to create a pdf destination on each page, if we're
  6355. % writing pdf. These are used in the table of contents. We can't
  6356. % just write one on every page because the title pages are numbered
  6357. % 1 and 2 (the page numbers aren't printed), and so are the first
  6358. % two pages of the document. Thus, we'd have two destinations named
  6359. % `1', and two named `2'.
  6360. \ifpdf
  6361. \global\pdfmakepagedesttrue
  6362. \else
  6363. \ifx\XeTeXrevision\thisisundefined
  6364. \else
  6365. \global\pdfmakepagedesttrue
  6366. \fi
  6367. \fi
  6368. }
  6369. % These characters do not print properly in the Computer Modern roman
  6370. % fonts, so we must take special care. This is more or less redundant
  6371. % with the Texinfo input format setup at the end of this file.
  6372. %
  6373. \def\activecatcodes{%
  6374. \catcode`\"=\active
  6375. \catcode`\$=\active
  6376. \catcode`\<=\active
  6377. \catcode`\>=\active
  6378. \catcode`\\=\active
  6379. \catcode`\^=\active
  6380. \catcode`\_=\active
  6381. \catcode`\|=\active
  6382. \catcode`\~=\active
  6383. }
  6384. % Read the toc file, which is essentially Texinfo input.
  6385. \def\readtocfile{%
  6386. \setupdatafile
  6387. \activecatcodes
  6388. \input \tocreadfilename
  6389. }
  6390. \newskip\contentsrightmargin \contentsrightmargin=1in
  6391. \newcount\savepageno
  6392. \newcount\lastnegativepageno \lastnegativepageno = -1
  6393. % Prepare to read what we've written to \tocfile.
  6394. %
  6395. \def\startcontents#1{%
  6396. % If @setchapternewpage on, and @headings double, the contents should
  6397. % start on an odd page, unlike chapters. Thus, we maintain
  6398. % \contentsalignmacro in parallel with \pagealignmacro.
  6399. % From: Torbjorn Granlund <tege@matematik.su.se>
  6400. \contentsalignmacro
  6401. \immediate\closeout\tocfile
  6402. %
  6403. % Don't need to put `Contents' or `Short Contents' in the headline.
  6404. % It is abundantly clear what they are.
  6405. \chapmacro{#1}{Yomitfromtoc}{}%
  6406. %
  6407. \savepageno = \pageno
  6408. \begingroup % Set up to handle contents files properly.
  6409. \raggedbottom % Worry more about breakpoints than the bottom.
  6410. \entryrightmargin=\contentsrightmargin % Don't use the full line length.
  6411. %
  6412. % Roman numerals for page numbers.
  6413. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  6414. }
  6415. % redefined for the two-volume lispref. We always output on
  6416. % \jobname.toc even if this is redefined.
  6417. %
  6418. \def\tocreadfilename{\jobname.toc}
  6419. % Normal (long) toc.
  6420. %
  6421. \def\contents{%
  6422. \startcontents{\putwordTOC}%
  6423. \openin 1 \tocreadfilename\space
  6424. \ifeof 1 \else
  6425. \readtocfile
  6426. \fi
  6427. \vfill \eject
  6428. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6429. \ifeof 1 \else
  6430. \pdfmakeoutlines
  6431. \fi
  6432. \closein 1
  6433. \endgroup
  6434. \lastnegativepageno = \pageno
  6435. \global\pageno = \savepageno
  6436. }
  6437. % And just the chapters.
  6438. \def\summarycontents{%
  6439. \startcontents{\putwordShortTOC}%
  6440. %
  6441. \let\partentry = \shortpartentry
  6442. \let\numchapentry = \shortchapentry
  6443. \let\appentry = \shortchapentry
  6444. \let\unnchapentry = \shortunnchapentry
  6445. % We want a true roman here for the page numbers.
  6446. \secfonts
  6447. \let\rm=\shortcontrm \let\bf=\shortcontbf
  6448. \let\sl=\shortcontsl \let\tt=\shortconttt
  6449. \rm
  6450. \hyphenpenalty = 10000
  6451. \advance\baselineskip by 1pt % Open it up a little.
  6452. \def\numsecentry##1##2##3##4{}
  6453. \let\appsecentry = \numsecentry
  6454. \let\unnsecentry = \numsecentry
  6455. \let\numsubsecentry = \numsecentry
  6456. \let\appsubsecentry = \numsecentry
  6457. \let\unnsubsecentry = \numsecentry
  6458. \let\numsubsubsecentry = \numsecentry
  6459. \let\appsubsubsecentry = \numsecentry
  6460. \let\unnsubsubsecentry = \numsecentry
  6461. \openin 1 \tocreadfilename\space
  6462. \ifeof 1 \else
  6463. \readtocfile
  6464. \fi
  6465. \closein 1
  6466. \vfill \eject
  6467. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6468. \endgroup
  6469. \lastnegativepageno = \pageno
  6470. \global\pageno = \savepageno
  6471. }
  6472. \let\shortcontents = \summarycontents
  6473. % Typeset the label for a chapter or appendix for the short contents.
  6474. % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
  6475. %
  6476. \def\shortchaplabel#1{%
  6477. % This space should be enough, since a single number is .5em, and the
  6478. % widest letter (M) is 1em, at least in the Computer Modern fonts.
  6479. % But use \hss just in case.
  6480. % (This space doesn't include the extra space that gets added after
  6481. % the label; that gets put in by \shortchapentry above.)
  6482. %
  6483. % We'd like to right-justify chapter numbers, but that looks strange
  6484. % with appendix letters. And right-justifying numbers and
  6485. % left-justifying letters looks strange when there is less than 10
  6486. % chapters. Have to read the whole toc once to know how many chapters
  6487. % there are before deciding ...
  6488. \hbox to 1em{#1\hss}%
  6489. }
  6490. % These macros generate individual entries in the table of contents.
  6491. % The first argument is the chapter or section name.
  6492. % The last argument is the page number.
  6493. % The arguments in between are the chapter number, section number, ...
  6494. % Parts, in the main contents. Replace the part number, which doesn't
  6495. % exist, with an empty box. Let's hope all the numbers have the same width.
  6496. % Also ignore the page number, which is conventionally not printed.
  6497. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
  6498. \def\partentry#1#2#3#4{%
  6499. % Add stretch and a bonus for breaking the page before the part heading.
  6500. % This reduces the chance of the page being broken immediately after the
  6501. % part heading, before a following chapter heading.
  6502. \vskip 0pt plus 5\baselineskip
  6503. \penalty-300
  6504. \vskip 0pt plus -5\baselineskip
  6505. \dochapentry{\numeralbox\labelspace#1}{}%
  6506. }
  6507. %
  6508. % Parts, in the short toc.
  6509. \def\shortpartentry#1#2#3#4{%
  6510. \penalty-300
  6511. \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
  6512. \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
  6513. }
  6514. % Chapters, in the main contents.
  6515. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
  6516. % Chapters, in the short toc.
  6517. % See comments in \dochapentry re vbox and related settings.
  6518. \def\shortchapentry#1#2#3#4{%
  6519. \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
  6520. }
  6521. % Appendices, in the main contents.
  6522. % Need the word Appendix, and a fixed-size box.
  6523. %
  6524. \def\appendixbox#1{%
  6525. % We use M since it's probably the widest letter.
  6526. \setbox0 = \hbox{\putwordAppendix{} M}%
  6527. \hbox to \wd0{\putwordAppendix{} #1\hss}}
  6528. %
  6529. \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
  6530. % Unnumbered chapters.
  6531. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
  6532. \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
  6533. % Sections.
  6534. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
  6535. \let\appsecentry=\numsecentry
  6536. \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
  6537. % Subsections.
  6538. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
  6539. \let\appsubsecentry=\numsubsecentry
  6540. \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
  6541. % And subsubsections.
  6542. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
  6543. \let\appsubsubsecentry=\numsubsubsecentry
  6544. \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
  6545. % This parameter controls the indentation of the various levels.
  6546. % Same as \defaultparindent.
  6547. \newdimen\tocindent \tocindent = 15pt
  6548. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  6549. % page number.
  6550. %
  6551. % If the toc has to be broken over pages, we want it to be at chapters
  6552. % if at all possible; hence the \penalty.
  6553. \def\dochapentry#1#2{%
  6554. \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  6555. \begingroup
  6556. % Move the page numbers slightly to the right
  6557. \advance\entryrightmargin by -0.05em
  6558. \chapentryfonts
  6559. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6560. \endgroup
  6561. \nobreak\vskip .25\baselineskip plus.1\baselineskip
  6562. }
  6563. \def\dosecentry#1#2{\begingroup
  6564. \secentryfonts \leftskip=\tocindent
  6565. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6566. \endgroup}
  6567. \def\dosubsecentry#1#2{\begingroup
  6568. \subsecentryfonts \leftskip=2\tocindent
  6569. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6570. \endgroup}
  6571. \def\dosubsubsecentry#1#2{\begingroup
  6572. \subsubsecentryfonts \leftskip=3\tocindent
  6573. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6574. \endgroup}
  6575. % We use the same \entry macro as for the index entries.
  6576. \let\tocentry = \entry
  6577. % Space between chapter (or whatever) number and the title.
  6578. \def\labelspace{\hskip1em \relax}
  6579. \def\dopageno#1{{\rm #1}}
  6580. \def\doshortpageno#1{{\rm #1}}
  6581. \def\chapentryfonts{\secfonts \rm}
  6582. \def\secentryfonts{\textfonts}
  6583. \def\subsecentryfonts{\textfonts}
  6584. \def\subsubsecentryfonts{\textfonts}
  6585. \message{environments,}
  6586. % @foo ... @end foo.
  6587. % @tex ... @end tex escapes into raw TeX temporarily.
  6588. % One exception: @ is still an escape character, so that @end tex works.
  6589. % But \@ or @@ will get a plain @ character.
  6590. \envdef\tex{%
  6591. \setupmarkupstyle{tex}%
  6592. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  6593. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  6594. \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  6595. \catcode `\%=14
  6596. \catcode `\+=\other
  6597. \catcode `\"=\other
  6598. \catcode `\|=\other
  6599. \catcode `\<=\other
  6600. \catcode `\>=\other
  6601. \catcode `\`=\other
  6602. \catcode `\'=\other
  6603. %
  6604. % ' is active in math mode (mathcode"8000). So reset it, and all our
  6605. % other math active characters (just in case), to plain's definitions.
  6606. \mathactive
  6607. %
  6608. % Inverse of the list at the beginning of the file.
  6609. \let\b=\ptexb
  6610. \let\bullet=\ptexbullet
  6611. \let\c=\ptexc
  6612. \let\,=\ptexcomma
  6613. \let\.=\ptexdot
  6614. \let\dots=\ptexdots
  6615. \let\equiv=\ptexequiv
  6616. \let\!=\ptexexclam
  6617. \let\i=\ptexi
  6618. \let\indent=\ptexindent
  6619. \let\noindent=\ptexnoindent
  6620. \let\{=\ptexlbrace
  6621. \let\+=\tabalign
  6622. \let\}=\ptexrbrace
  6623. \let\/=\ptexslash
  6624. \let\sp=\ptexsp
  6625. \let\*=\ptexstar
  6626. %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
  6627. \let\t=\ptext
  6628. \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
  6629. \let\frenchspacing=\plainfrenchspacing
  6630. %
  6631. \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  6632. \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  6633. \def\@{@}%
  6634. }
  6635. % There is no need to define \Etex.
  6636. % Define @lisp ... @end lisp.
  6637. % @lisp environment forms a group so it can rebind things,
  6638. % including the definition of @end lisp (which normally is erroneous).
  6639. % Amount to narrow the margins by for @lisp.
  6640. \newskip\lispnarrowing \lispnarrowing=0.4in
  6641. % This is the definition that ^^M gets inside @lisp, @example, and other
  6642. % such environments. \null is better than a space, since it doesn't
  6643. % have any width.
  6644. \def\lisppar{\null\endgraf}
  6645. % This space is always present above and below environments.
  6646. \newskip\envskipamount \envskipamount = 0pt
  6647. % Make spacing and below environment symmetrical. We use \parskip here
  6648. % to help in doing that, since in @example-like environments \parskip
  6649. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  6650. % start of the next paragraph will insert \parskip.
  6651. %
  6652. \def\aboveenvbreak{{%
  6653. % =10000 instead of <10000 because of a special case in \itemzzz and
  6654. % \sectionheading, q.v.
  6655. \ifnum \lastpenalty=10000 \else
  6656. \advance\envskipamount by \parskip
  6657. \endgraf
  6658. \ifdim\lastskip<\envskipamount
  6659. \removelastskip
  6660. \ifnum\lastpenalty<10000
  6661. % Penalize breaking before the environment, because preceding text
  6662. % often leads into it.
  6663. \penalty100
  6664. \fi
  6665. \vskip\envskipamount
  6666. \fi
  6667. \fi
  6668. }}
  6669. \def\afterenvbreak{{%
  6670. % =10000 instead of <10000 because of a special case in \itemzzz and
  6671. % \sectionheading, q.v.
  6672. \ifnum \lastpenalty=10000 \else
  6673. \advance\envskipamount by \parskip
  6674. \endgraf
  6675. \ifdim\lastskip<\envskipamount
  6676. \removelastskip
  6677. % it's not a good place to break if the last penalty was \nobreak
  6678. % or better ...
  6679. \ifnum\lastpenalty<10000 \penalty-50 \fi
  6680. \vskip\envskipamount
  6681. \fi
  6682. \fi
  6683. }}
  6684. % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
  6685. % also clear it, so that its embedded environments do the narrowing again.
  6686. \let\nonarrowing=\relax
  6687. % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  6688. % environment contents.
  6689. \font\circle=lcircle10
  6690. \newdimen\circthick
  6691. \newdimen\cartouter\newdimen\cartinner
  6692. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  6693. \circthick=\fontdimen8\circle
  6694. %
  6695. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  6696. \def\ctr{{\hskip 6pt\circle\char'010}}
  6697. \def\cbl{{\circle\char'012\hskip -6pt}}
  6698. \def\cbr{{\hskip 6pt\circle\char'011}}
  6699. \def\carttop{\hbox to \cartouter{\hskip\lskip
  6700. \ctl\leaders\hrule height\circthick\hfil\ctr
  6701. \hskip\rskip}}
  6702. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  6703. \cbl\leaders\hrule height\circthick\hfil\cbr
  6704. \hskip\rskip}}
  6705. %
  6706. \newskip\lskip\newskip\rskip
  6707. \envdef\cartouche{%
  6708. \ifhmode\par\fi % can't be in the midst of a paragraph.
  6709. \startsavinginserts
  6710. \lskip=\leftskip \rskip=\rightskip
  6711. \leftskip=0pt\rightskip=0pt % we want these *outside*.
  6712. \cartinner=\hsize \advance\cartinner by-\lskip
  6713. \advance\cartinner by-\rskip
  6714. \cartouter=\hsize
  6715. \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  6716. % side, and for 6pt waste from
  6717. % each corner char, and rule thickness
  6718. \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  6719. %
  6720. % If this cartouche directly follows a sectioning command, we need the
  6721. % \parskip glue (backspaced over by default) or the cartouche can
  6722. % collide with the section heading.
  6723. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
  6724. %
  6725. \setbox\groupbox=\vbox\bgroup
  6726. \baselineskip=0pt\parskip=0pt\lineskip=0pt
  6727. \carttop
  6728. \hbox\bgroup
  6729. \hskip\lskip
  6730. \vrule\kern3pt
  6731. \vbox\bgroup
  6732. \kern3pt
  6733. \hsize=\cartinner
  6734. \baselineskip=\normbskip
  6735. \lineskip=\normlskip
  6736. \parskip=\normpskip
  6737. \vskip -\parskip
  6738. \comment % For explanation, see the end of def\group.
  6739. }
  6740. \def\Ecartouche{%
  6741. \ifhmode\par\fi
  6742. \kern3pt
  6743. \egroup
  6744. \kern3pt\vrule
  6745. \hskip\rskip
  6746. \egroup
  6747. \cartbot
  6748. \egroup
  6749. \addgroupbox
  6750. \checkinserts
  6751. }
  6752. % This macro is called at the beginning of all the @example variants,
  6753. % inside a group.
  6754. \newdimen\nonfillparindent
  6755. \def\nonfillstart{%
  6756. \aboveenvbreak
  6757. \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
  6758. \sepspaces % Make spaces be word-separators rather than space tokens.
  6759. \let\par = \lisppar % don't ignore blank lines
  6760. \obeylines % each line of input is a line of output
  6761. \parskip = 0pt
  6762. % Turn off paragraph indentation but redefine \indent to emulate
  6763. % the normal \indent.
  6764. \nonfillparindent=\parindent
  6765. \parindent = 0pt
  6766. \let\indent\nonfillindent
  6767. %
  6768. \emergencystretch = 0pt % don't try to avoid overfull boxes
  6769. \ifx\nonarrowing\relax
  6770. \advance \leftskip by \lispnarrowing
  6771. \exdentamount=\lispnarrowing
  6772. \else
  6773. \let\nonarrowing = \relax
  6774. \fi
  6775. \let\exdent=\nofillexdent
  6776. }
  6777. \begingroup
  6778. \obeyspaces
  6779. % We want to swallow spaces (but not other tokens) after the fake
  6780. % @indent in our nonfill-environments, where spaces are normally
  6781. % active and set to @tie, resulting in them not being ignored after
  6782. % @indent.
  6783. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
  6784. \gdef\nonfillindentcheck{%
  6785. \ifx\temp %
  6786. \expandafter\nonfillindentgobble%
  6787. \else%
  6788. \leavevmode\nonfillindentbox%
  6789. \fi%
  6790. }%
  6791. \endgroup
  6792. \def\nonfillindentgobble#1{\nonfillindent}
  6793. \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
  6794. % If you want all examples etc. small: @set dispenvsize small.
  6795. % If you want even small examples the full size: @set dispenvsize nosmall.
  6796. % This affects the following displayed environments:
  6797. % @example, @display, @format, @lisp
  6798. %
  6799. \def\smallword{small}
  6800. \def\nosmallword{nosmall}
  6801. \let\SETdispenvsize\relax
  6802. \def\setnormaldispenv{%
  6803. \ifx\SETdispenvsize\smallword
  6804. % end paragraph for sake of leading, in case document has no blank
  6805. % line. This is redundant with what happens in \aboveenvbreak, but
  6806. % we need to do it before changing the fonts, and it's inconvenient
  6807. % to change the fonts afterward.
  6808. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6809. \smallexamplefonts \rm
  6810. \fi
  6811. }
  6812. \def\setsmalldispenv{%
  6813. \ifx\SETdispenvsize\nosmallword
  6814. \else
  6815. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6816. \smallexamplefonts \rm
  6817. \fi
  6818. }
  6819. % We often define two environments, @foo and @smallfoo.
  6820. % Let's do it in one command. #1 is the env name, #2 the definition.
  6821. \def\makedispenvdef#1#2{%
  6822. \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
  6823. \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
  6824. \expandafter\let\csname E#1\endcsname \afterenvbreak
  6825. \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
  6826. }
  6827. % Define two environment synonyms (#1 and #2) for an environment.
  6828. \def\maketwodispenvdef#1#2#3{%
  6829. \makedispenvdef{#1}{#3}%
  6830. \makedispenvdef{#2}{#3}%
  6831. }
  6832. %
  6833. % @lisp: indented, narrowed, typewriter font;
  6834. % @example: same as @lisp.
  6835. %
  6836. % @smallexample and @smalllisp: use smaller fonts.
  6837. % Originally contributed by Pavel@xerox.
  6838. %
  6839. \maketwodispenvdef{lisp}{example}{%
  6840. \nonfillstart
  6841. \tt\setupmarkupstyle{example}%
  6842. \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  6843. \gobble % eat return
  6844. }
  6845. % @display/@smalldisplay: same as @lisp except keep current font.
  6846. %
  6847. \makedispenvdef{display}{%
  6848. \nonfillstart
  6849. \gobble
  6850. }
  6851. % @format/@smallformat: same as @display except don't narrow margins.
  6852. %
  6853. \makedispenvdef{format}{%
  6854. \let\nonarrowing = t%
  6855. \nonfillstart
  6856. \gobble
  6857. }
  6858. % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
  6859. \envdef\flushleft{%
  6860. \let\nonarrowing = t%
  6861. \nonfillstart
  6862. \gobble
  6863. }
  6864. \let\Eflushleft = \afterenvbreak
  6865. % @flushright.
  6866. %
  6867. \envdef\flushright{%
  6868. \let\nonarrowing = t%
  6869. \nonfillstart
  6870. \advance\leftskip by 0pt plus 1fill\relax
  6871. \gobble
  6872. }
  6873. \let\Eflushright = \afterenvbreak
  6874. % @raggedright does more-or-less normal line breaking but no right
  6875. % justification. From plain.tex. Don't stretch around special
  6876. % characters in urls in this environment, since the stretch at the right
  6877. % should be enough.
  6878. \envdef\raggedright{%
  6879. \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
  6880. \def\urefprestretchamount{0pt}%
  6881. \def\urefpoststretchamount{0pt}%
  6882. }
  6883. \let\Eraggedright\par
  6884. \envdef\raggedleft{%
  6885. \parindent=0pt \leftskip0pt plus2em
  6886. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6887. \hbadness=10000 % Last line will usually be underfull, so turn off
  6888. % badness reporting.
  6889. }
  6890. \let\Eraggedleft\par
  6891. \envdef\raggedcenter{%
  6892. \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
  6893. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6894. \hbadness=10000 % Last line will usually be underfull, so turn off
  6895. % badness reporting.
  6896. }
  6897. \let\Eraggedcenter\par
  6898. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  6899. % and narrows the margins. We keep \parskip nonzero in general, since
  6900. % we're doing normal filling. So, when using \aboveenvbreak and
  6901. % \afterenvbreak, temporarily make \parskip 0.
  6902. %
  6903. \makedispenvdef{quotation}{\quotationstart}
  6904. %
  6905. \def\quotationstart{%
  6906. \indentedblockstart % same as \indentedblock, but increase right margin too.
  6907. \ifx\nonarrowing\relax
  6908. \advance\rightskip by \lispnarrowing
  6909. \fi
  6910. \parsearg\quotationlabel
  6911. }
  6912. % We have retained a nonzero parskip for the environment, since we're
  6913. % doing normal filling.
  6914. %
  6915. \def\Equotation{%
  6916. \par
  6917. \ifx\quotationauthor\thisisundefined\else
  6918. % indent a bit.
  6919. \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
  6920. \fi
  6921. {\parskip=0pt \afterenvbreak}%
  6922. }
  6923. \def\Esmallquotation{\Equotation}
  6924. % If we're given an argument, typeset it in bold with a colon after.
  6925. \def\quotationlabel#1{%
  6926. \def\temp{#1}%
  6927. \ifx\temp\empty \else
  6928. {\bf #1: }%
  6929. \fi
  6930. }
  6931. % @indentedblock is like @quotation, but indents only on the left and
  6932. % has no optional argument.
  6933. %
  6934. \makedispenvdef{indentedblock}{\indentedblockstart}
  6935. %
  6936. \def\indentedblockstart{%
  6937. {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  6938. \parindent=0pt
  6939. %
  6940. % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  6941. \ifx\nonarrowing\relax
  6942. \advance\leftskip by \lispnarrowing
  6943. \exdentamount = \lispnarrowing
  6944. \else
  6945. \let\nonarrowing = \relax
  6946. \fi
  6947. }
  6948. % Keep a nonzero parskip for the environment, since we're doing normal filling.
  6949. %
  6950. \def\Eindentedblock{%
  6951. \par
  6952. {\parskip=0pt \afterenvbreak}%
  6953. }
  6954. \def\Esmallindentedblock{\Eindentedblock}
  6955. % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
  6956. % If we want to allow any <char> as delimiter,
  6957. % we need the curly braces so that makeinfo sees the @verb command, eg:
  6958. % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
  6959. %
  6960. % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
  6961. %
  6962. % [Knuth] p.344; only we need to do the other characters Texinfo sets
  6963. % active too. Otherwise, they get lost as the first character on a
  6964. % verbatim line.
  6965. \def\dospecials{%
  6966. \do\ \do\\\do\{\do\}\do\$\do\&%
  6967. \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  6968. \do\<\do\>\do\|\do\@\do+\do\"%
  6969. % Don't do the quotes -- if we do, @set txicodequoteundirected and
  6970. % @set txicodequotebacktick will not have effect on @verb and
  6971. % @verbatim, and ?` and !` ligatures won't get disabled.
  6972. %\do\`\do\'%
  6973. }
  6974. %
  6975. % [Knuth] p. 380
  6976. \def\uncatcodespecials{%
  6977. \def\do##1{\catcode`##1=\other}\dospecials}
  6978. %
  6979. % Setup for the @verb command.
  6980. %
  6981. % Eight spaces for a tab
  6982. \begingroup
  6983. \catcode`\^^I=\active
  6984. \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
  6985. \endgroup
  6986. %
  6987. \def\setupverb{%
  6988. \tt % easiest (and conventionally used) font for verbatim
  6989. \def\par{\leavevmode\endgraf}%
  6990. \setupmarkupstyle{verb}%
  6991. \tabeightspaces
  6992. % Respect line breaks,
  6993. % print special symbols as themselves, and
  6994. % make each space count
  6995. % must do in this order:
  6996. \obeylines \uncatcodespecials \sepspaces
  6997. }
  6998. % Setup for the @verbatim environment
  6999. %
  7000. % Real tab expansion.
  7001. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
  7002. %
  7003. % We typeset each line of the verbatim in an \hbox, so we can handle
  7004. % tabs. The \global is in case the verbatim line starts with an accent,
  7005. % or some other command that starts with a begin-group. Otherwise, the
  7006. % entire \verbbox would disappear at the corresponding end-group, before
  7007. % it is typeset. Meanwhile, we can't have nested verbatim commands
  7008. % (can we?), so the \global won't be overwriting itself.
  7009. \newbox\verbbox
  7010. \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
  7011. %
  7012. \begingroup
  7013. \catcode`\^^I=\active
  7014. \gdef\tabexpand{%
  7015. \catcode`\^^I=\active
  7016. \def^^I{\leavevmode\egroup
  7017. \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
  7018. \divide\dimen\verbbox by\tabw
  7019. \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
  7020. \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
  7021. \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
  7022. }%
  7023. }
  7024. \endgroup
  7025. % start the verbatim environment.
  7026. \def\setupverbatim{%
  7027. \let\nonarrowing = t%
  7028. \nonfillstart
  7029. \tt % easiest (and conventionally used) font for verbatim
  7030. % The \leavevmode here is for blank lines. Otherwise, we would
  7031. % never \starttabox and the \egroup would end verbatim mode.
  7032. \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
  7033. \tabexpand
  7034. \setupmarkupstyle{verbatim}%
  7035. % Respect line breaks,
  7036. % print special symbols as themselves, and
  7037. % make each space count.
  7038. % Must do in this order:
  7039. \obeylines \uncatcodespecials \sepspaces
  7040. \everypar{\starttabbox}%
  7041. }
  7042. % Do the @verb magic: verbatim text is quoted by unique
  7043. % delimiter characters. Before first delimiter expect a
  7044. % right brace, after last delimiter expect closing brace:
  7045. %
  7046. % \def\doverb'{'<char>#1<char>'}'{#1}
  7047. %
  7048. % [Knuth] p. 382; only eat outer {}
  7049. \begingroup
  7050. \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
  7051. \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
  7052. \endgroup
  7053. %
  7054. \def\verb{\begingroup\setupverb\doverb}
  7055. %
  7056. %
  7057. % Do the @verbatim magic: define the macro \doverbatim so that
  7058. % the (first) argument ends when '@end verbatim' is reached, ie:
  7059. %
  7060. % \def\doverbatim#1@end verbatim{#1}
  7061. %
  7062. % For Texinfo it's a lot easier than for LaTeX,
  7063. % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
  7064. % we need not redefine '\', '{' and '}'.
  7065. %
  7066. % Inspired by LaTeX's verbatim command set [latex.ltx]
  7067. %
  7068. \begingroup
  7069. \catcode`\ =\active
  7070. \obeylines %
  7071. % ignore everything up to the first ^^M, that's the newline at the end
  7072. % of the @verbatim input line itself. Otherwise we get an extra blank
  7073. % line in the output.
  7074. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
  7075. % We really want {...\end verbatim} in the body of the macro, but
  7076. % without the active space; thus we have to use \xdef and \gobble.
  7077. \endgroup
  7078. %
  7079. \envdef\verbatim{%
  7080. \setupverbatim\doverbatim
  7081. }
  7082. \let\Everbatim = \afterenvbreak
  7083. % @verbatiminclude FILE - insert text of file in verbatim environment.
  7084. %
  7085. \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
  7086. %
  7087. \def\doverbatiminclude#1{%
  7088. {%
  7089. \makevalueexpandable
  7090. \setupverbatim
  7091. \indexnofonts % Allow `@@' and other weird things in file names.
  7092. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
  7093. \input #1
  7094. \afterenvbreak
  7095. }%
  7096. }
  7097. % @copying ... @end copying.
  7098. % Save the text away for @insertcopying later.
  7099. %
  7100. % We save the uninterpreted tokens, rather than creating a box.
  7101. % Saving the text in a box would be much easier, but then all the
  7102. % typesetting commands (@smallbook, font changes, etc.) have to be done
  7103. % beforehand -- and a) we want @copying to be done first in the source
  7104. % file; b) letting users define the frontmatter in as flexible order as
  7105. % possible is desirable.
  7106. %
  7107. \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
  7108. \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
  7109. %
  7110. \def\insertcopying{%
  7111. \begingroup
  7112. \parindent = 0pt % paragraph indentation looks wrong on title page
  7113. \scanexp\copyingtext
  7114. \endgroup
  7115. }
  7116. \message{defuns,}
  7117. % @defun etc.
  7118. \newskip\defbodyindent \defbodyindent=.4in
  7119. \newskip\defargsindent \defargsindent=50pt
  7120. \newskip\deflastargmargin \deflastargmargin=18pt
  7121. \newcount\defunpenalty
  7122. % Start the processing of @deffn:
  7123. \def\startdefun{%
  7124. \ifnum\lastpenalty<10000
  7125. \medbreak
  7126. \defunpenalty=10003 % Will keep this @deffn together with the
  7127. % following @def command, see below.
  7128. \else
  7129. % If there are two @def commands in a row, we'll have a \nobreak,
  7130. % which is there to keep the function description together with its
  7131. % header. But if there's nothing but headers, we need to allow a
  7132. % break somewhere. Check specifically for penalty 10002, inserted
  7133. % by \printdefunline, instead of 10000, since the sectioning
  7134. % commands also insert a nobreak penalty, and we don't want to allow
  7135. % a break between a section heading and a defun.
  7136. %
  7137. % As a further refinement, we avoid "club" headers by signalling
  7138. % with penalty of 10003 after the very first @deffn in the
  7139. % sequence (see above), and penalty of 10002 after any following
  7140. % @def command.
  7141. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
  7142. %
  7143. % Similarly, after a section heading, do not allow a break.
  7144. % But do insert the glue.
  7145. \medskip % preceded by discardable penalty, so not a breakpoint
  7146. \fi
  7147. %
  7148. \parindent=0in
  7149. \advance\leftskip by \defbodyindent
  7150. \exdentamount=\defbodyindent
  7151. }
  7152. \def\dodefunx#1{%
  7153. % First, check whether we are in the right environment:
  7154. \checkenv#1%
  7155. %
  7156. % As above, allow line break if we have multiple x headers in a row.
  7157. % It's not a great place, though.
  7158. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
  7159. %
  7160. % And now, it's time to reuse the body of the original defun:
  7161. \expandafter\gobbledefun#1%
  7162. }
  7163. \def\gobbledefun#1\startdefun{}
  7164. % \printdefunline \deffnheader{text}
  7165. %
  7166. \def\printdefunline#1#2{%
  7167. \begingroup
  7168. % call \deffnheader:
  7169. #1#2 \endheader
  7170. % common ending:
  7171. \interlinepenalty = 10000
  7172. \advance\rightskip by 0pt plus 1fil\relax
  7173. \endgraf
  7174. \nobreak\vskip -\parskip
  7175. \penalty\defunpenalty % signal to \startdefun and \dodefunx
  7176. % Some of the @defun-type tags do not enable magic parentheses,
  7177. % rendering the following check redundant. But we don't optimize.
  7178. \checkparencounts
  7179. \endgroup
  7180. }
  7181. \def\Edefun{\endgraf\medbreak}
  7182. % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
  7183. % the only thing remaining is to define \deffnheader.
  7184. %
  7185. \def\makedefun#1{%
  7186. \expandafter\let\csname E#1\endcsname = \Edefun
  7187. \edef\temp{\noexpand\domakedefun
  7188. \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
  7189. \temp
  7190. }
  7191. % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
  7192. %
  7193. % Define \deffn and \deffnx, without parameters.
  7194. % \deffnheader has to be defined explicitly.
  7195. %
  7196. \def\domakedefun#1#2#3{%
  7197. \envdef#1{%
  7198. \startdefun
  7199. \doingtypefnfalse % distinguish typed functions from all else
  7200. \parseargusing\activeparens{\printdefunline#3}%
  7201. }%
  7202. \def#2{\dodefunx#1}%
  7203. \def#3%
  7204. }
  7205. \newif\ifdoingtypefn % doing typed function?
  7206. \newif\ifrettypeownline % typeset return type on its own line?
  7207. % @deftypefnnewline on|off says whether the return type of typed functions
  7208. % are printed on their own line. This affects @deftypefn, @deftypefun,
  7209. % @deftypeop, and @deftypemethod.
  7210. %
  7211. \parseargdef\deftypefnnewline{%
  7212. \def\temp{#1}%
  7213. \ifx\temp\onword
  7214. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7215. = \empty
  7216. \else\ifx\temp\offword
  7217. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7218. = \relax
  7219. \else
  7220. \errhelp = \EMsimple
  7221. \errmessage{Unknown @txideftypefnnl value `\temp',
  7222. must be on|off}%
  7223. \fi\fi
  7224. }
  7225. % Untyped functions:
  7226. % @deffn category name args
  7227. \makedefun{deffn}{\deffngeneral{}}
  7228. % @deffn category class name args
  7229. \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
  7230. % \defopon {category on}class name args
  7231. \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7232. % \deffngeneral {subind}category name args
  7233. %
  7234. \def\deffngeneral#1#2 #3 #4\endheader{%
  7235. % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
  7236. \dosubind{fn}{\code{#3}}{#1}%
  7237. \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
  7238. }
  7239. % Typed functions:
  7240. % @deftypefn category type name args
  7241. \makedefun{deftypefn}{\deftypefngeneral{}}
  7242. % @deftypeop category class type name args
  7243. \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
  7244. % \deftypeopon {category on}class type name args
  7245. \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7246. % \deftypefngeneral {subind}category type name args
  7247. %
  7248. \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
  7249. \dosubind{fn}{\code{#4}}{#1}%
  7250. \doingtypefntrue
  7251. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7252. }
  7253. % Typed variables:
  7254. % @deftypevr category type var args
  7255. \makedefun{deftypevr}{\deftypecvgeneral{}}
  7256. % @deftypecv category class type var args
  7257. \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
  7258. % \deftypecvof {category of}class type var args
  7259. \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
  7260. % \deftypecvgeneral {subind}category type var args
  7261. %
  7262. \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
  7263. \dosubind{vr}{\code{#4}}{#1}%
  7264. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7265. }
  7266. % Untyped variables:
  7267. % @defvr category var args
  7268. \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
  7269. % @defcv category class var args
  7270. \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
  7271. % \defcvof {category of}class var args
  7272. \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
  7273. % Types:
  7274. % @deftp category name args
  7275. \makedefun{deftp}#1 #2 #3\endheader{%
  7276. \doind{tp}{\code{#2}}%
  7277. \defname{#1}{}{#2}\defunargs{#3\unskip}%
  7278. }
  7279. % Remaining @defun-like shortcuts:
  7280. \makedefun{defun}{\deffnheader{\putwordDeffunc} }
  7281. \makedefun{defmac}{\deffnheader{\putwordDefmac} }
  7282. \makedefun{defspec}{\deffnheader{\putwordDefspec} }
  7283. \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
  7284. \makedefun{defvar}{\defvrheader{\putwordDefvar} }
  7285. \makedefun{defopt}{\defvrheader{\putwordDefopt} }
  7286. \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
  7287. \makedefun{defmethod}{\defopon\putwordMethodon}
  7288. \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
  7289. \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
  7290. \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
  7291. % \defname, which formats the name of the @def (not the args).
  7292. % #1 is the category, such as "Function".
  7293. % #2 is the return type, if any.
  7294. % #3 is the function name.
  7295. %
  7296. % We are followed by (but not passed) the arguments, if any.
  7297. %
  7298. \def\defname#1#2#3{%
  7299. \par
  7300. % Get the values of \leftskip and \rightskip as they were outside the @def...
  7301. \advance\leftskip by -\defbodyindent
  7302. %
  7303. % Determine if we are typesetting the return type of a typed function
  7304. % on a line by itself.
  7305. \rettypeownlinefalse
  7306. \ifdoingtypefn % doing a typed function specifically?
  7307. % then check user option for putting return type on its own line:
  7308. \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
  7309. \rettypeownlinetrue
  7310. \fi
  7311. \fi
  7312. %
  7313. % How we'll format the category name. Putting it in brackets helps
  7314. % distinguish it from the body text that may end up on the next line
  7315. % just below it.
  7316. \def\temp{#1}%
  7317. \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
  7318. %
  7319. % Figure out line sizes for the paragraph shape. We'll always have at
  7320. % least two.
  7321. \tempnum = 2
  7322. %
  7323. % The first line needs space for \box0; but if \rightskip is nonzero,
  7324. % we need only space for the part of \box0 which exceeds it:
  7325. \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
  7326. %
  7327. % If doing a return type on its own line, we'll have another line.
  7328. \ifrettypeownline
  7329. \advance\tempnum by 1
  7330. \def\maybeshapeline{0in \hsize}%
  7331. \else
  7332. \def\maybeshapeline{}%
  7333. \fi
  7334. %
  7335. % The continuations:
  7336. \dimen2=\hsize \advance\dimen2 by -\defargsindent
  7337. %
  7338. % The final paragraph shape:
  7339. \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
  7340. %
  7341. % Put the category name at the right margin.
  7342. \noindent
  7343. \hbox to 0pt{%
  7344. \hfil\box0 \kern-\hsize
  7345. % \hsize has to be shortened this way:
  7346. \kern\leftskip
  7347. % Intentionally do not respect \rightskip, since we need the space.
  7348. }%
  7349. %
  7350. % Allow all lines to be underfull without complaint:
  7351. \tolerance=10000 \hbadness=10000
  7352. \exdentamount=\defbodyindent
  7353. {%
  7354. % defun fonts. We use typewriter by default (used to be bold) because:
  7355. % . we're printing identifiers, they should be in tt in principle.
  7356. % . in languages with many accents, such as Czech or French, it's
  7357. % common to leave accents off identifiers. The result looks ok in
  7358. % tt, but exceedingly strange in rm.
  7359. % . we don't want -- and --- to be treated as ligatures.
  7360. % . this still does not fix the ?` and !` ligatures, but so far no
  7361. % one has made identifiers using them :).
  7362. \df \tt
  7363. \def\temp{#2}% text of the return type
  7364. \ifx\temp\empty\else
  7365. \tclose{\temp}% typeset the return type
  7366. \ifrettypeownline
  7367. % put return type on its own line; prohibit line break following:
  7368. \hfil\vadjust{\nobreak}\break
  7369. \else
  7370. \space % type on same line, so just followed by a space
  7371. \fi
  7372. \fi % no return type
  7373. #3% output function name
  7374. }%
  7375. {\rm\enskip}% hskip 0.5 em of \rmfont
  7376. %
  7377. \boldbrax
  7378. % arguments will be output next, if any.
  7379. }
  7380. % Print arguments in slanted roman (not ttsl), inconsistently with using
  7381. % tt for the name. This is because literal text is sometimes needed in
  7382. % the argument list (groff manual), and ttsl and tt are not very
  7383. % distinguishable. Prevent hyphenation at `-' chars.
  7384. %
  7385. \def\defunargs#1{%
  7386. % use sl by default (not ttsl),
  7387. % tt for the names.
  7388. \df \sl \hyphenchar\font=0
  7389. %
  7390. % On the other hand, if an argument has two dashes (for instance), we
  7391. % want a way to get ttsl. We used to recommend @var for that, so
  7392. % leave the code in, but it's strange for @var to lead to typewriter.
  7393. % Nowadays we recommend @code, since the difference between a ttsl hyphen
  7394. % and a tt hyphen is pretty tiny. @code also disables ?` !`.
  7395. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
  7396. #1%
  7397. \sl\hyphenchar\font=45
  7398. }
  7399. % We want ()&[] to print specially on the defun line.
  7400. %
  7401. \def\activeparens{%
  7402. \catcode`\(=\active \catcode`\)=\active
  7403. \catcode`\[=\active \catcode`\]=\active
  7404. \catcode`\&=\active
  7405. }
  7406. % Make control sequences which act like normal parenthesis chars.
  7407. \let\lparen = ( \let\rparen = )
  7408. % Be sure that we always have a definition for `(', etc. For example,
  7409. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  7410. % so TeX would otherwise complain about undefined control sequence.
  7411. {
  7412. \activeparens
  7413. \global\let(=\lparen \global\let)=\rparen
  7414. \global\let[=\lbrack \global\let]=\rbrack
  7415. \global\let& = \&
  7416. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  7417. \gdef\magicamp{\let&=\amprm}
  7418. }
  7419. \newcount\parencount
  7420. % If we encounter &foo, then turn on ()-hacking afterwards
  7421. \newif\ifampseen
  7422. \def\amprm#1 {\ampseentrue{\bf\&#1 }}
  7423. \def\parenfont{%
  7424. \ifampseen
  7425. % At the first level, print parens in roman,
  7426. % otherwise use the default font.
  7427. \ifnum \parencount=1 \rm \fi
  7428. \else
  7429. % The \sf parens (in \boldbrax) actually are a little bolder than
  7430. % the contained text. This is especially needed for [ and ] .
  7431. \sf
  7432. \fi
  7433. }
  7434. \def\infirstlevel#1{%
  7435. \ifampseen
  7436. \ifnum\parencount=1
  7437. #1%
  7438. \fi
  7439. \fi
  7440. }
  7441. \def\bfafterword#1 {#1 \bf}
  7442. \def\opnr{%
  7443. \global\advance\parencount by 1
  7444. {\parenfont(}%
  7445. \infirstlevel \bfafterword
  7446. }
  7447. \def\clnr{%
  7448. {\parenfont)}%
  7449. \infirstlevel \sl
  7450. \global\advance\parencount by -1
  7451. }
  7452. \newcount\brackcount
  7453. \def\lbrb{%
  7454. \global\advance\brackcount by 1
  7455. {\bf[}%
  7456. }
  7457. \def\rbrb{%
  7458. {\bf]}%
  7459. \global\advance\brackcount by -1
  7460. }
  7461. \def\checkparencounts{%
  7462. \ifnum\parencount=0 \else \badparencount \fi
  7463. \ifnum\brackcount=0 \else \badbrackcount \fi
  7464. }
  7465. % these should not use \errmessage; the glibc manual, at least, actually
  7466. % has such constructs (when documenting function pointers).
  7467. \def\badparencount{%
  7468. \message{Warning: unbalanced parentheses in @def...}%
  7469. \global\parencount=0
  7470. }
  7471. \def\badbrackcount{%
  7472. \message{Warning: unbalanced square brackets in @def...}%
  7473. \global\brackcount=0
  7474. }
  7475. \message{macros,}
  7476. % @macro.
  7477. % To do this right we need a feature of e-TeX, \scantokens,
  7478. % which we arrange to emulate with a temporary file in ordinary TeX.
  7479. \ifx\eTeXversion\thisisundefined
  7480. \newwrite\macscribble
  7481. \def\scantokens#1{%
  7482. \toks0={#1}%
  7483. \immediate\openout\macscribble=\jobname.tmp
  7484. \immediate\write\macscribble{\the\toks0}%
  7485. \immediate\closeout\macscribble
  7486. \input \jobname.tmp
  7487. }
  7488. \fi
  7489. % alias because \c means cedilla in @tex or @math
  7490. \let\texinfoc=\c
  7491. \newcount\savedcatcodeone
  7492. \newcount\savedcatcodetwo
  7493. % Used at the time of macro expansion.
  7494. % Argument is macro body with arguments substituted
  7495. \def\scanmacro#1{%
  7496. \newlinechar`\^^M
  7497. \def\xeatspaces{\eatspaces}%
  7498. %
  7499. % Temporarily undo catcode changes of \printindex. Set catcode of @ to
  7500. % 0 so that @-commands in macro expansions aren't printed literally when
  7501. % formatting an index file, where \ is used as the escape character.
  7502. \savedcatcodeone=\catcode`\@
  7503. \savedcatcodetwo=\catcode`\\
  7504. \catcode`\@=0
  7505. \catcode`\\=\active
  7506. %
  7507. % Process the macro body under the current catcode regime.
  7508. \scantokens{#1@texinfoc}%
  7509. %
  7510. \catcode`\@=\savedcatcodeone
  7511. \catcode`\\=\savedcatcodetwo
  7512. %
  7513. % The \texinfoc is to remove the \newlinechar added by \scantokens, and
  7514. % can be noticed by \parsearg.
  7515. % We avoid surrounding the call to \scantokens with \bgroup and \egroup
  7516. % to allow macros to open or close groups themselves.
  7517. }
  7518. % Used for copying and captions
  7519. \def\scanexp#1{%
  7520. \expandafter\scanmacro\expandafter{#1}%
  7521. }
  7522. \newcount\paramno % Count of parameters
  7523. \newtoks\macname % Macro name
  7524. \newif\ifrecursive % Is it recursive?
  7525. % List of all defined macros in the form
  7526. % \commondummyword\macro1\commondummyword\macro2...
  7527. % Currently is also contains all @aliases; the list can be split
  7528. % if there is a need.
  7529. \def\macrolist{}
  7530. % Add the macro to \macrolist
  7531. \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
  7532. \def\addtomacrolistxxx#1{%
  7533. \toks0 = \expandafter{\macrolist\commondummyword#1}%
  7534. \xdef\macrolist{\the\toks0}%
  7535. }
  7536. % Utility routines.
  7537. % This does \let #1 = #2, with \csnames; that is,
  7538. % \let \csname#1\endcsname = \csname#2\endcsname
  7539. % (except of course we have to play expansion games).
  7540. %
  7541. \def\cslet#1#2{%
  7542. \expandafter\let
  7543. \csname#1\expandafter\endcsname
  7544. \csname#2\endcsname
  7545. }
  7546. % Trim leading and trailing spaces off a string.
  7547. % Concepts from aro-bend problem 15 (see CTAN).
  7548. {\catcode`\@=11
  7549. \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  7550. \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  7551. \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  7552. \def\unbrace#1{#1}
  7553. \unbrace{\gdef\trim@@@ #1 } #2@{#1}
  7554. }
  7555. % Trim a single trailing ^^M off a string.
  7556. {\catcode`\^^M=\other \catcode`\Q=3%
  7557. \gdef\eatcr #1{\eatcra #1Q^^MQ}%
  7558. \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  7559. \gdef\eatcrb#1Q#2Q{#1}%
  7560. }
  7561. % Macro bodies are absorbed as an argument in a context where
  7562. % all characters are catcode 10, 11 or 12, except \ which is active
  7563. % (as in normal texinfo). It is necessary to change the definition of \
  7564. % to recognize macro arguments; this is the job of \mbodybackslash.
  7565. %
  7566. % Non-ASCII encodings make 8-bit characters active, so un-activate
  7567. % them to avoid their expansion. Must do this non-globally, to
  7568. % confine the change to the current group.
  7569. %
  7570. % It's necessary to have hard CRs when the macro is executed. This is
  7571. % done by making ^^M (\endlinechar) catcode 12 when reading the macro
  7572. % body, and then making it the \newlinechar in \scanmacro.
  7573. %
  7574. \def\scanctxt{% used as subroutine
  7575. \catcode`\"=\other
  7576. \catcode`\+=\other
  7577. \catcode`\<=\other
  7578. \catcode`\>=\other
  7579. \catcode`\^=\other
  7580. \catcode`\_=\other
  7581. \catcode`\|=\other
  7582. \catcode`\~=\other
  7583. \passthroughcharstrue
  7584. }
  7585. \def\scanargctxt{% used for copying and captions, not macros.
  7586. \scanctxt
  7587. \catcode`\@=\other
  7588. \catcode`\\=\other
  7589. \catcode`\^^M=\other
  7590. }
  7591. \def\macrobodyctxt{% used for @macro definitions
  7592. \scanctxt
  7593. \catcode`\ =\other
  7594. \catcode`\@=\other
  7595. \catcode`\{=\other
  7596. \catcode`\}=\other
  7597. \catcode`\^^M=\other
  7598. \usembodybackslash
  7599. }
  7600. % Used when scanning braced macro arguments. Note, however, that catcode
  7601. % changes here are ineffectual if the macro invocation was nested inside
  7602. % an argument to another Texinfo command.
  7603. \def\macroargctxt{%
  7604. \scanctxt
  7605. \catcode`\ =\active
  7606. \catcode`\^^M=\other
  7607. \catcode`\\=\active
  7608. }
  7609. \def\macrolineargctxt{% used for whole-line arguments without braces
  7610. \scanctxt
  7611. \catcode`\{=\other
  7612. \catcode`\}=\other
  7613. }
  7614. % \mbodybackslash is the definition of \ in @macro bodies.
  7615. % It maps \foo\ => \csname macarg.foo\endcsname => #N
  7616. % where N is the macro parameter number.
  7617. % We define \csname macarg.\endcsname to be \realbackslash, so
  7618. % \\ in macro replacement text gets you a backslash.
  7619. %
  7620. {\catcode`@=0 @catcode`@\=@active
  7621. @gdef@usembodybackslash{@let\=@mbodybackslash}
  7622. @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  7623. }
  7624. \expandafter\def\csname macarg.\endcsname{\realbackslash}
  7625. \def\margbackslash#1{\char`\#1 }
  7626. \def\macro{\recursivefalse\parsearg\macroxxx}
  7627. \def\rmacro{\recursivetrue\parsearg\macroxxx}
  7628. \def\macroxxx#1{%
  7629. \getargs{#1}% now \macname is the macname and \argl the arglist
  7630. \ifx\argl\empty % no arguments
  7631. \paramno=0\relax
  7632. \else
  7633. \expandafter\parsemargdef \argl;%
  7634. \if\paramno>256\relax
  7635. \ifx\eTeXversion\thisisundefined
  7636. \errhelp = \EMsimple
  7637. \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
  7638. \fi
  7639. \fi
  7640. \fi
  7641. \if1\csname ismacro.\the\macname\endcsname
  7642. \message{Warning: redefining \the\macname}%
  7643. \else
  7644. \expandafter\ifx\csname \the\macname\endcsname \relax
  7645. \else \errmessage{Macro name \the\macname\space already defined}\fi
  7646. \global\cslet{macsave.\the\macname}{\the\macname}%
  7647. \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  7648. \addtomacrolist{\the\macname}%
  7649. \fi
  7650. \begingroup \macrobodyctxt
  7651. \ifrecursive \expandafter\parsermacbody
  7652. \else \expandafter\parsemacbody
  7653. \fi}
  7654. \parseargdef\unmacro{%
  7655. \if1\csname ismacro.#1\endcsname
  7656. \global\cslet{#1}{macsave.#1}%
  7657. \global\expandafter\let \csname ismacro.#1\endcsname=0%
  7658. % Remove the macro name from \macrolist:
  7659. \begingroup
  7660. \expandafter\let\csname#1\endcsname \relax
  7661. \let\commondummyword\unmacrodo
  7662. \xdef\macrolist{\macrolist}%
  7663. \endgroup
  7664. \else
  7665. \errmessage{Macro #1 not defined}%
  7666. \fi
  7667. }
  7668. % Called by \do from \dounmacro on each macro. The idea is to omit any
  7669. % macro definitions that have been changed to \relax.
  7670. %
  7671. \def\unmacrodo#1{%
  7672. \ifx #1\relax
  7673. % remove this
  7674. \else
  7675. \noexpand\commondummyword \noexpand#1%
  7676. \fi
  7677. }
  7678. % \getargs -- Parse the arguments to a @macro line. Set \macname to
  7679. % the name of the macro, and \argl to the braced argument list.
  7680. \def\getargs#1{\getargsxxx#1{}}
  7681. \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  7682. \def\getmacname#1 #2\relax{\macname={#1}}
  7683. \def\getmacargs#1{\def\argl{#1}}
  7684. % This made use of the feature that if the last token of a
  7685. % <parameter list> is #, then the preceding argument is delimited by
  7686. % an opening brace, and that opening brace is not consumed.
  7687. % Parse the optional {params} list to @macro or @rmacro.
  7688. % Set \paramno to the number of arguments,
  7689. % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
  7690. % three-param macro.) Define \macarg.BLAH for each BLAH in the params
  7691. % list to some hook where the argument is to be expanded. If there are
  7692. % less than 10 arguments that hook is to be replaced by ##N where N
  7693. % is the position in that list, that is to say the macro arguments are to be
  7694. % defined `a la TeX in the macro body.
  7695. %
  7696. % That gets used by \mbodybackslash (above).
  7697. %
  7698. % If there are 10 or more arguments, a different technique is used: see
  7699. % \parsemmanyargdef.
  7700. %
  7701. \def\parsemargdef#1;{%
  7702. \paramno=0\def\paramlist{}%
  7703. \let\hash\relax
  7704. % \hash is redefined to `#' later to get it into definitions
  7705. \let\xeatspaces\relax
  7706. \parsemargdefxxx#1,;,%
  7707. \ifnum\paramno<10\relax\else
  7708. \paramno0\relax
  7709. \parsemmanyargdef@@#1,;,% 10 or more arguments
  7710. \fi
  7711. }
  7712. \def\parsemargdefxxx#1,{%
  7713. \if#1;\let\next=\relax
  7714. \else \let\next=\parsemargdefxxx
  7715. \advance\paramno by 1
  7716. \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  7717. {\xeatspaces{\hash\the\paramno}}%
  7718. \edef\paramlist{\paramlist\hash\the\paramno,}%
  7719. \fi\next}
  7720. % \parsemacbody, \parsermacbody
  7721. %
  7722. % Read recursive and nonrecursive macro bodies. (They're different since
  7723. % rec and nonrec macros end differently.)
  7724. %
  7725. % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
  7726. % body to be transformed.
  7727. % Set \macrobody to the body of the macro, and call \defmacro.
  7728. %
  7729. {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
  7730. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7731. {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
  7732. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7733. % Make @ a letter, so that we can make private-to-Texinfo macro names.
  7734. \edef\texiatcatcode{\the\catcode`\@}
  7735. \catcode `@=11\relax
  7736. %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
  7737. % If there are 10 or more arguments, a different technique is used, where the
  7738. % hook remains in the body, and when macro is to be expanded the body is
  7739. % processed again to replace the arguments.
  7740. %
  7741. % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
  7742. % argument N value and then \edef the body (nothing else will expand because of
  7743. % the catcode regime under which the body was input).
  7744. %
  7745. % If you compile with TeX (not eTeX), and you have macros with 10 or more
  7746. % arguments, no macro can have more than 256 arguments (else error).
  7747. %
  7748. % In case that there are 10 or more arguments we parse again the arguments
  7749. % list to set new definitions for the \macarg.BLAH macros corresponding to
  7750. % each BLAH argument. It was anyhow needed to parse already once this list
  7751. % in order to count the arguments, and as macros with at most 9 arguments
  7752. % are by far more frequent than macro with 10 or more arguments, defining
  7753. % twice the \macarg.BLAH macros does not cost too much processing power.
  7754. \def\parsemmanyargdef@@#1,{%
  7755. \if#1;\let\next=\relax
  7756. \else
  7757. \let\next=\parsemmanyargdef@@
  7758. \edef\tempb{\eatspaces{#1}}%
  7759. \expandafter\def\expandafter\tempa
  7760. \expandafter{\csname macarg.\tempb\endcsname}%
  7761. % Note that we need some extra \noexpand\noexpand, this is because we
  7762. % don't want \the to be expanded in the \parsermacbody as it uses an
  7763. % \xdef .
  7764. \expandafter\edef\tempa
  7765. {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
  7766. \advance\paramno by 1\relax
  7767. \fi\next}
  7768. \let\endargs@\relax
  7769. \let\nil@\relax
  7770. \def\nilm@{\nil@}%
  7771. \long\def\nillm@{\nil@}%
  7772. % This macro is expanded during the Texinfo macro expansion, not during its
  7773. % definition. It gets all the arguments' values and assigns them to macros
  7774. % macarg.ARGNAME
  7775. %
  7776. % #1 is the macro name
  7777. % #2 is the list of argument names
  7778. % #3 is the list of argument values
  7779. \def\getargvals@#1#2#3{%
  7780. \def\macargdeflist@{}%
  7781. \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
  7782. \def\paramlist{#2,\nil@}%
  7783. \def\macroname{#1}%
  7784. \begingroup
  7785. \macroargctxt
  7786. \def\argvaluelist{#3,\nil@}%
  7787. \def\@tempa{#3}%
  7788. \ifx\@tempa\empty
  7789. \setemptyargvalues@
  7790. \else
  7791. \getargvals@@
  7792. \fi
  7793. }
  7794. \def\getargvals@@{%
  7795. \ifx\paramlist\nilm@
  7796. % Some sanity check needed here that \argvaluelist is also empty.
  7797. \ifx\argvaluelist\nillm@
  7798. \else
  7799. \errhelp = \EMsimple
  7800. \errmessage{Too many arguments in macro `\macroname'!}%
  7801. \fi
  7802. \let\next\macargexpandinbody@
  7803. \else
  7804. \ifx\argvaluelist\nillm@
  7805. % No more arguments values passed to macro. Set remaining named-arg
  7806. % macros to empty.
  7807. \let\next\setemptyargvalues@
  7808. \else
  7809. % pop current arg name into \@tempb
  7810. \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
  7811. \expandafter\@tempa\expandafter{\paramlist}%
  7812. % pop current argument value into \@tempc
  7813. \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
  7814. \expandafter\@tempa\expandafter{\argvaluelist}%
  7815. % Here \@tempb is the current arg name and \@tempc is the current arg value.
  7816. % First place the new argument macro definition into \@tempd
  7817. \expandafter\macname\expandafter{\@tempc}%
  7818. \expandafter\let\csname macarg.\@tempb\endcsname\relax
  7819. \expandafter\def\expandafter\@tempe\expandafter{%
  7820. \csname macarg.\@tempb\endcsname}%
  7821. \edef\@tempd{\long\def\@tempe{\the\macname}}%
  7822. \push@\@tempd\macargdeflist@
  7823. \let\next\getargvals@@
  7824. \fi
  7825. \fi
  7826. \next
  7827. }
  7828. \def\push@#1#2{%
  7829. \expandafter\expandafter\expandafter\def
  7830. \expandafter\expandafter\expandafter#2%
  7831. \expandafter\expandafter\expandafter{%
  7832. \expandafter#1#2}%
  7833. }
  7834. % Replace arguments by their values in the macro body, and place the result
  7835. % in macro \@tempa.
  7836. %
  7837. \def\macvalstoargs@{%
  7838. % To do this we use the property that token registers that are \the'ed
  7839. % within an \edef expand only once. So we are going to place all argument
  7840. % values into respective token registers.
  7841. %
  7842. % First we save the token context, and initialize argument numbering.
  7843. \begingroup
  7844. \paramno0\relax
  7845. % Then, for each argument number #N, we place the corresponding argument
  7846. % value into a new token list register \toks#N
  7847. \expandafter\putargsintokens@\saveparamlist@,;,%
  7848. % Then, we expand the body so that argument are replaced by their
  7849. % values. The trick for values not to be expanded themselves is that they
  7850. % are within tokens and that tokens expand only once in an \edef .
  7851. \edef\@tempc{\csname mac.\macroname .body\endcsname}%
  7852. % Now we restore the token stack pointer to free the token list registers
  7853. % which we have used, but we make sure that expanded body is saved after
  7854. % group.
  7855. \expandafter
  7856. \endgroup
  7857. \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
  7858. }
  7859. % Define the named-macro outside of this group and then close this group.
  7860. %
  7861. \def\macargexpandinbody@{%
  7862. \expandafter
  7863. \endgroup
  7864. \macargdeflist@
  7865. % First the replace in body the macro arguments by their values, the result
  7866. % is in \@tempa .
  7867. \macvalstoargs@
  7868. % Then we point at the \norecurse or \gobble (for recursive) macro value
  7869. % with \@tempb .
  7870. \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
  7871. % Depending on whether it is recursive or not, we need some tailing
  7872. % \egroup .
  7873. \ifx\@tempb\gobble
  7874. \let\@tempc\relax
  7875. \else
  7876. \let\@tempc\egroup
  7877. \fi
  7878. % And now we do the real job:
  7879. \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
  7880. \@tempd
  7881. }
  7882. \def\putargsintokens@#1,{%
  7883. \if#1;\let\next\relax
  7884. \else
  7885. \let\next\putargsintokens@
  7886. % First we allocate the new token list register, and give it a temporary
  7887. % alias \@tempb .
  7888. \toksdef\@tempb\the\paramno
  7889. % Then we place the argument value into that token list register.
  7890. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
  7891. \expandafter\@tempb\expandafter{\@tempa}%
  7892. \advance\paramno by 1\relax
  7893. \fi
  7894. \next
  7895. }
  7896. % Trailing missing arguments are set to empty.
  7897. %
  7898. \def\setemptyargvalues@{%
  7899. \ifx\paramlist\nilm@
  7900. \let\next\macargexpandinbody@
  7901. \else
  7902. \expandafter\setemptyargvaluesparser@\paramlist\endargs@
  7903. \let\next\setemptyargvalues@
  7904. \fi
  7905. \next
  7906. }
  7907. \def\setemptyargvaluesparser@#1,#2\endargs@{%
  7908. \expandafter\def\expandafter\@tempa\expandafter{%
  7909. \expandafter\def\csname macarg.#1\endcsname{}}%
  7910. \push@\@tempa\macargdeflist@
  7911. \def\paramlist{#2}%
  7912. }
  7913. % #1 is the element target macro
  7914. % #2 is the list macro
  7915. % #3,#4\endargs@ is the list value
  7916. \def\pop@#1#2#3,#4\endargs@{%
  7917. \def#1{#3}%
  7918. \def#2{#4}%
  7919. }
  7920. \long\def\longpop@#1#2#3,#4\endargs@{%
  7921. \long\def#1{#3}%
  7922. \long\def#2{#4}%
  7923. }
  7924. %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
  7925. % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
  7926. % \macrobody has the body of the macro in it, with placeholders for
  7927. % its parameters, looking like "\xeatspaces{\hash 1}".
  7928. % \paramno is the number of parameters
  7929. % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
  7930. % There are four cases: macros of zero, one, up to nine, and many arguments.
  7931. % \xdef is used so that macro definitions will survive the file
  7932. % they're defined in: @include reads the file inside a group.
  7933. %
  7934. \def\defmacro{%
  7935. \let\hash=##% convert placeholders to macro parameter chars
  7936. \ifnum\paramno=1
  7937. \def\xeatspaces##1{##1}%
  7938. % This removes the pair of braces around the argument. We don't
  7939. % use \eatspaces, because this can cause ends of lines to be lost
  7940. % when the argument to \eatspaces is read, leading to line-based
  7941. % commands like "@itemize" not being read correctly.
  7942. \else
  7943. \let\xeatspaces\relax % suppress expansion
  7944. \fi
  7945. \ifcase\paramno
  7946. % 0
  7947. \expandafter\xdef\csname\the\macname\endcsname{%
  7948. \bgroup
  7949. \noexpand\spaceisspace
  7950. \noexpand\endlineisspace
  7951. \noexpand\expandafter % skip any whitespace after the macro name.
  7952. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7953. \expandafter\xdef\csname\the\macname @@@\endcsname{%
  7954. \egroup
  7955. \noexpand\scanmacro{\macrobody}}%
  7956. \or % 1
  7957. \expandafter\xdef\csname\the\macname\endcsname{%
  7958. \bgroup
  7959. \noexpand\braceorline
  7960. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7961. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7962. \egroup
  7963. \noexpand\scanmacro{\macrobody}%
  7964. }%
  7965. \else % at most 9
  7966. \ifnum\paramno<10\relax
  7967. % @MACNAME sets the context for reading the macro argument
  7968. % @MACNAME@@ gets the argument, processes backslashes and appends a
  7969. % comma.
  7970. % @MACNAME@@@ removes braces surrounding the argument list.
  7971. % @MACNAME@@@@ scans the macro body with arguments substituted.
  7972. \expandafter\xdef\csname\the\macname\endcsname{%
  7973. \bgroup
  7974. \noexpand\expandafter % This \expandafter skip any spaces after the
  7975. \noexpand\macroargctxt % macro before we change the catcode of space.
  7976. \noexpand\expandafter
  7977. \expandafter\noexpand\csname\the\macname @@\endcsname}%
  7978. \expandafter\xdef\csname\the\macname @@\endcsname##1{%
  7979. \noexpand\passargtomacro
  7980. \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
  7981. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7982. \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
  7983. \expandafter\expandafter
  7984. \expandafter\xdef
  7985. \expandafter\expandafter
  7986. \csname\the\macname @@@@\endcsname\paramlist{%
  7987. \egroup\noexpand\scanmacro{\macrobody}}%
  7988. \else % 10 or more:
  7989. \expandafter\xdef\csname\the\macname\endcsname{%
  7990. \noexpand\getargvals@{\the\macname}{\argl}%
  7991. }%
  7992. \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
  7993. \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
  7994. \fi
  7995. \fi}
  7996. \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
  7997. \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  7998. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7999. %
  8000. {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
  8001. @catcode`@_=11 % private names
  8002. @catcode`@!=11 % used as argument separator
  8003. % \passargtomacro#1#2 -
  8004. % Call #1 with a list of tokens #2, with any doubled backslashes in #2
  8005. % compressed to one.
  8006. %
  8007. % This implementation works by expansion, and not execution (so we cannot use
  8008. % \def or similar). This reduces the risk of this failing in contexts where
  8009. % complete expansion is done with no execution (for example, in writing out to
  8010. % an auxiliary file for an index entry).
  8011. %
  8012. % State is kept in the input stream: the argument passed to
  8013. % @look_ahead, @gobble_and_check_finish and @add_segment is
  8014. %
  8015. % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
  8016. %
  8017. % where:
  8018. % THE_MACRO - name of the macro we want to call
  8019. % ARG_RESULT - argument list we build to pass to that macro
  8020. % PENDING_BS - either a backslash or nothing
  8021. % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
  8022. @gdef@passargtomacro#1#2{%
  8023. @add_segment #1!{}@relax#2\@_finish\%
  8024. }
  8025. @gdef@_finish{@_finishx} @global@let@_finishx@relax
  8026. % #1 - THE_MACRO ARG_RESULT
  8027. % #2 - PENDING_BS
  8028. % #3 - NEXT_TOKEN
  8029. % #4 used to look ahead
  8030. %
  8031. % If the next token is not a backslash, process the rest of the argument;
  8032. % otherwise, remove the next token.
  8033. @gdef@look_ahead#1!#2#3#4{%
  8034. @ifx#4\%
  8035. @expandafter@gobble_and_check_finish
  8036. @else
  8037. @expandafter@add_segment
  8038. @fi#1!{#2}#4#4%
  8039. }
  8040. % #1 - THE_MACRO ARG_RESULT
  8041. % #2 - PENDING_BS
  8042. % #3 - NEXT_TOKEN
  8043. % #4 should be a backslash, which is gobbled.
  8044. % #5 looks ahead
  8045. %
  8046. % Double backslash found. Add a single backslash, and look ahead.
  8047. @gdef@gobble_and_check_finish#1!#2#3#4#5{%
  8048. @add_segment#1\!{}#5#5%
  8049. }
  8050. @gdef@is_fi{@fi}
  8051. % #1 - THE_MACRO ARG_RESULT
  8052. % #2 - PENDING_BS
  8053. % #3 - NEXT_TOKEN
  8054. % #4 is input stream until next backslash
  8055. %
  8056. % Input stream is either at the start of the argument, or just after a
  8057. % backslash sequence, either a lone backslash, or a doubled backslash.
  8058. % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
  8059. % finish; otherwise, append to ARG_RESULT the segment of the argument up until
  8060. % the next backslash. PENDING_BACKSLASH contains a backslash to represent
  8061. % a backslash just before the start of the input stream that has not been
  8062. % added to ARG_RESULT.
  8063. @gdef@add_segment#1!#2#3#4\{%
  8064. @ifx#3@_finish
  8065. @call_the_macro#1!%
  8066. @else
  8067. % append the pending backslash to the result, followed by the next segment
  8068. @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
  8069. % this @fi is discarded by @look_ahead.
  8070. % we can't get rid of it with \expandafter because we don't know how
  8071. % long #4 is.
  8072. }
  8073. % #1 - THE_MACRO
  8074. % #2 - ARG_RESULT
  8075. % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
  8076. % conditional.
  8077. @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
  8078. }
  8079. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8080. % \braceorline MAC is used for a one-argument macro MAC. It checks
  8081. % whether the next non-whitespace character is a {. It sets the context
  8082. % for reading the argument (slightly different in the two cases). Then,
  8083. % to read the argument, in the whole-line case, it then calls the regular
  8084. % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
  8085. %
  8086. \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
  8087. \def\braceorlinexxx{%
  8088. \ifx\nchar\bgroup
  8089. \macroargctxt
  8090. \expandafter\passargtomacro
  8091. \else
  8092. \macrolineargctxt\expandafter\parsearg
  8093. \fi \macnamexxx}
  8094. % @alias.
  8095. % We need some trickery to remove the optional spaces around the equal
  8096. % sign. Make them active and then expand them all to nothing.
  8097. %
  8098. \def\alias{\parseargusing\obeyspaces\aliasxxx}
  8099. \def\aliasxxx #1{\aliasyyy#1\relax}
  8100. \def\aliasyyy #1=#2\relax{%
  8101. {%
  8102. \expandafter\let\obeyedspace=\empty
  8103. \addtomacrolist{#1}%
  8104. \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
  8105. }%
  8106. \next
  8107. }
  8108. \message{cross references,}
  8109. \newwrite\auxfile
  8110. \newif\ifhavexrefs % True if xref values are known.
  8111. \newif\ifwarnedxrefs % True if we warned once that they aren't known.
  8112. % @inforef is relatively simple.
  8113. \def\inforef #1{\inforefzzz #1,,,,**}
  8114. \def\inforefzzz #1,#2,#3,#4**{%
  8115. \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  8116. node \samp{\ignorespaces#1{}}}
  8117. % @node's only job in TeX is to define \lastnode, which is used in
  8118. % cross-references. The @node line might or might not have commas, and
  8119. % might or might not have spaces before the first comma, like:
  8120. % @node foo , bar , ...
  8121. % We don't want such trailing spaces in the node name.
  8122. %
  8123. \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
  8124. %
  8125. % also remove a trailing comma, in case of something like this:
  8126. % @node Help-Cross, , , Cross-refs
  8127. \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
  8128. \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
  8129. \let\nwnode=\node
  8130. \let\lastnode=\empty
  8131. % Write a cross-reference definition for the current node. #1 is the
  8132. % type (Ynumbered, Yappendix, Ynothing).
  8133. %
  8134. \def\donoderef#1{%
  8135. \ifx\lastnode\empty\else
  8136. \setref{\lastnode}{#1}%
  8137. \global\let\lastnode=\empty
  8138. \fi
  8139. }
  8140. % @anchor{NAME} -- define xref target at arbitrary point.
  8141. %
  8142. \newcount\savesfregister
  8143. %
  8144. \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
  8145. \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
  8146. \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
  8147. % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
  8148. % anchor), which consists of three parts:
  8149. % 1) NAME-title - the current sectioning name taken from \lastsection,
  8150. % or the anchor name.
  8151. % 2) NAME-snt - section number and type, passed as the SNT arg, or
  8152. % empty for anchors.
  8153. % 3) NAME-pg - the page number.
  8154. %
  8155. % This is called from \donoderef, \anchor, and \dofloat. In the case of
  8156. % floats, there is an additional part, which is not written here:
  8157. % 4) NAME-lof - the text as it should appear in a @listoffloats.
  8158. %
  8159. \def\setref#1#2{%
  8160. \pdfmkdest{#1}%
  8161. \iflinks
  8162. {%
  8163. \requireauxfile
  8164. \atdummies % preserve commands, but don't expand them
  8165. % match definition in \xrdef, \refx, \xrefX.
  8166. \def\value##1{##1}%
  8167. \edef\writexrdef##1##2{%
  8168. \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
  8169. ##1}{##2}}% these are parameters of \writexrdef
  8170. }%
  8171. \toks0 = \expandafter{\lastsection}%
  8172. \immediate \writexrdef{title}{\the\toks0 }%
  8173. \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
  8174. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
  8175. }%
  8176. \fi
  8177. }
  8178. % @xrefautosectiontitle on|off says whether @section(ing) names are used
  8179. % automatically in xrefs, if the third arg is not explicitly specified.
  8180. % This was provided as a "secret" @set xref-automatic-section-title
  8181. % variable, now it's official.
  8182. %
  8183. \parseargdef\xrefautomaticsectiontitle{%
  8184. \def\temp{#1}%
  8185. \ifx\temp\onword
  8186. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8187. = \empty
  8188. \else\ifx\temp\offword
  8189. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8190. = \relax
  8191. \else
  8192. \errhelp = \EMsimple
  8193. \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
  8194. must be on|off}%
  8195. \fi\fi
  8196. }
  8197. %
  8198. % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
  8199. % the node name, #2 the name of the Info cross-reference, #3 the printed
  8200. % node name, #4 the name of the Info file, #5 the name of the printed
  8201. % manual. All but the node name can be omitted.
  8202. %
  8203. \def\pxref{\putwordsee{} \xrefXX}
  8204. \def\xref{\putwordSee{} \xrefXX}
  8205. \def\ref{\xrefXX}
  8206. \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
  8207. \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
  8208. %
  8209. \newbox\toprefbox
  8210. \newbox\printedrefnamebox
  8211. \newbox\infofilenamebox
  8212. \newbox\printedmanualbox
  8213. %
  8214. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  8215. \unsepspaces
  8216. %
  8217. % Get args without leading/trailing spaces.
  8218. \def\printedrefname{\ignorespaces #3}%
  8219. \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
  8220. %
  8221. \def\infofilename{\ignorespaces #4}%
  8222. \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
  8223. %
  8224. \def\printedmanual{\ignorespaces #5}%
  8225. \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
  8226. %
  8227. % If the printed reference name (arg #3) was not explicitly given in
  8228. % the @xref, figure out what we want to use.
  8229. \ifdim \wd\printedrefnamebox = 0pt
  8230. % No printed node name was explicitly given.
  8231. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
  8232. % Not auto section-title: use node name inside the square brackets.
  8233. \def\printedrefname{\ignorespaces #1}%
  8234. \else
  8235. % Auto section-title: use chapter/section title inside
  8236. % the square brackets if we have it.
  8237. \ifdim \wd\printedmanualbox > 0pt
  8238. % It is in another manual, so we don't have it; use node name.
  8239. \def\printedrefname{\ignorespaces #1}%
  8240. \else
  8241. \ifhavexrefs
  8242. % We (should) know the real title if we have the xref values.
  8243. \def\printedrefname{\refx{#1-title}{}}%
  8244. \else
  8245. % Otherwise just copy the Info node name.
  8246. \def\printedrefname{\ignorespaces #1}%
  8247. \fi%
  8248. \fi
  8249. \fi
  8250. \fi
  8251. %
  8252. % Make link in pdf output.
  8253. \ifpdf
  8254. % For pdfTeX and LuaTeX
  8255. {\indexnofonts
  8256. \makevalueexpandable
  8257. \turnoffactive
  8258. % This expands tokens, so do it after making catcode changes, so _
  8259. % etc. don't get their TeX definitions. This ignores all spaces in
  8260. % #4, including (wrongly) those in the middle of the filename.
  8261. \getfilename{#4}%
  8262. %
  8263. % This (wrongly) does not take account of leading or trailing
  8264. % spaces in #1, which should be ignored.
  8265. \setpdfdestname{#1}%
  8266. %
  8267. \ifx\pdfdestname\empty
  8268. \def\pdfdestname{Top}% no empty targets
  8269. \fi
  8270. %
  8271. \leavevmode
  8272. \startlink attr{/Border [0 0 0]}%
  8273. \ifnum\filenamelength>0
  8274. goto file{\the\filename.pdf} name{\pdfdestname}%
  8275. \else
  8276. goto name{\pdfmkpgn{\pdfdestname}}%
  8277. \fi
  8278. }%
  8279. \setcolor{\linkcolor}%
  8280. \else
  8281. \ifx\XeTeXrevision\thisisundefined
  8282. \else
  8283. % For XeTeX
  8284. {\indexnofonts
  8285. \makevalueexpandable
  8286. \turnoffactive
  8287. % This expands tokens, so do it after making catcode changes, so _
  8288. % etc. don't get their TeX definitions. This ignores all spaces in
  8289. % #4, including (wrongly) those in the middle of the filename.
  8290. \getfilename{#4}%
  8291. %
  8292. % This (wrongly) does not take account of leading or trailing
  8293. % spaces in #1, which should be ignored.
  8294. \setpdfdestname{#1}%
  8295. %
  8296. \ifx\pdfdestname\empty
  8297. \def\pdfdestname{Top}% no empty targets
  8298. \fi
  8299. %
  8300. \leavevmode
  8301. \ifnum\filenamelength>0
  8302. % With default settings,
  8303. % XeTeX (xdvipdfmx) replaces link destination names with integers.
  8304. % In this case, the replaced destination names of
  8305. % remote PDFs are no longer known. In order to avoid a replacement,
  8306. % you can use xdvipdfmx's command line option `-C 0x0010'.
  8307. % If you use XeTeX 0.99996+ (TeX Live 2016+),
  8308. % this command line option is no longer necessary
  8309. % because we can use the `dvipdfmx:config' special.
  8310. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8311. << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
  8312. \else
  8313. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8314. << /S /GoTo /D (\pdfdestname) >> >>}%
  8315. \fi
  8316. }%
  8317. \setcolor{\linkcolor}%
  8318. \fi
  8319. \fi
  8320. {%
  8321. % Have to otherify everything special to allow the \csname to
  8322. % include an _ in the xref name, etc.
  8323. \indexnofonts
  8324. \turnoffactive
  8325. \def\value##1{##1}%
  8326. \expandafter\global\expandafter\let\expandafter\Xthisreftitle
  8327. \csname XR#1-title\endcsname
  8328. }%
  8329. %
  8330. % Float references are printed completely differently: "Figure 1.2"
  8331. % instead of "[somenode], p.3". \iffloat distinguishes them by
  8332. % \Xthisreftitle being set to a magic string.
  8333. \iffloat\Xthisreftitle
  8334. % If the user specified the print name (third arg) to the ref,
  8335. % print it instead of our usual "Figure 1.2".
  8336. \ifdim\wd\printedrefnamebox = 0pt
  8337. \refx{#1-snt}{}%
  8338. \else
  8339. \printedrefname
  8340. \fi
  8341. %
  8342. % If the user also gave the printed manual name (fifth arg), append
  8343. % "in MANUALNAME".
  8344. \ifdim \wd\printedmanualbox > 0pt
  8345. \space \putwordin{} \cite{\printedmanual}%
  8346. \fi
  8347. \else
  8348. % node/anchor (non-float) references.
  8349. %
  8350. % If we use \unhbox to print the node names, TeX does not insert
  8351. % empty discretionaries after hyphens, which means that it will not
  8352. % find a line break at a hyphen in a node names. Since some manuals
  8353. % are best written with fairly long node names, containing hyphens,
  8354. % this is a loss. Therefore, we give the text of the node name
  8355. % again, so it is as if TeX is seeing it for the first time.
  8356. %
  8357. \ifdim \wd\printedmanualbox > 0pt
  8358. % Cross-manual reference with a printed manual name.
  8359. %
  8360. \crossmanualxref{\cite{\printedmanual\unskip}}%
  8361. %
  8362. \else\ifdim \wd\infofilenamebox > 0pt
  8363. % Cross-manual reference with only an info filename (arg 4), no
  8364. % printed manual name (arg 5). This is essentially the same as
  8365. % the case above; we output the filename, since we have nothing else.
  8366. %
  8367. \crossmanualxref{\code{\infofilename\unskip}}%
  8368. %
  8369. \else
  8370. % Reference within this manual.
  8371. %
  8372. % _ (for example) has to be the character _ for the purposes of the
  8373. % control sequence corresponding to the node, but it has to expand
  8374. % into the usual \leavevmode...\vrule stuff for purposes of
  8375. % printing. So we \turnoffactive for the \refx-snt, back on for the
  8376. % printing, back off for the \refx-pg.
  8377. {\turnoffactive
  8378. % Only output a following space if the -snt ref is nonempty; for
  8379. % @unnumbered and @anchor, it won't be.
  8380. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  8381. \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  8382. }%
  8383. % output the `[mynode]' via the macro below so it can be overridden.
  8384. \xrefprintnodename\printedrefname
  8385. %
  8386. % But we always want a comma and a space:
  8387. ,\space
  8388. %
  8389. % output the `page 3'.
  8390. \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
  8391. % Add a , if xref followed by a space
  8392. \if\space\noexpand\tokenafterxref ,%
  8393. \else\ifx\ \tokenafterxref ,% @TAB
  8394. \else\ifx\*\tokenafterxref ,% @*
  8395. \else\ifx\ \tokenafterxref ,% @SPACE
  8396. \else\ifx\
  8397. \tokenafterxref ,% @NL
  8398. \else\ifx\tie\tokenafterxref ,% @tie
  8399. \fi\fi\fi\fi\fi\fi
  8400. \fi\fi
  8401. \fi
  8402. \endlink
  8403. \endgroup}
  8404. % Output a cross-manual xref to #1. Used just above (twice).
  8405. %
  8406. % Only include the text "Section ``foo'' in" if the foo is neither
  8407. % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
  8408. % "see The Foo Manual", the idea being to refer to the whole manual.
  8409. %
  8410. % But, this being TeX, we can't easily compare our node name against the
  8411. % string "Top" while ignoring the possible spaces before and after in
  8412. % the input. By adding the arbitrary 7sp below, we make it much less
  8413. % likely that a real node name would have the same width as "Top" (e.g.,
  8414. % in a monospaced font). Hopefully it will never happen in practice.
  8415. %
  8416. % For the same basic reason, we retypeset the "Top" at every
  8417. % reference, since the current font is indeterminate.
  8418. %
  8419. \def\crossmanualxref#1{%
  8420. \setbox\toprefbox = \hbox{Top\kern7sp}%
  8421. \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
  8422. \ifdim \wd2 > 7sp % nonempty?
  8423. \ifdim \wd2 = \wd\toprefbox \else % same as Top?
  8424. \putwordSection{} ``\printedrefname'' \putwordin{}\space
  8425. \fi
  8426. \fi
  8427. #1%
  8428. }
  8429. % This macro is called from \xrefX for the `[nodename]' part of xref
  8430. % output. It's a separate macro only so it can be changed more easily,
  8431. % since square brackets don't work well in some documents. Particularly
  8432. % one that Bob is working on :).
  8433. %
  8434. \def\xrefprintnodename#1{[#1]}
  8435. % Things referred to by \setref.
  8436. %
  8437. \def\Ynothing{}
  8438. \def\Yomitfromtoc{}
  8439. \def\Ynumbered{%
  8440. \ifnum\secno=0
  8441. \putwordChapter@tie \the\chapno
  8442. \else \ifnum\subsecno=0
  8443. \putwordSection@tie \the\chapno.\the\secno
  8444. \else \ifnum\subsubsecno=0
  8445. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  8446. \else
  8447. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  8448. \fi\fi\fi
  8449. }
  8450. \def\Yappendix{%
  8451. \ifnum\secno=0
  8452. \putwordAppendix@tie @char\the\appendixno{}%
  8453. \else \ifnum\subsecno=0
  8454. \putwordSection@tie @char\the\appendixno.\the\secno
  8455. \else \ifnum\subsubsecno=0
  8456. \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  8457. \else
  8458. \putwordSection@tie
  8459. @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  8460. \fi\fi\fi
  8461. }
  8462. % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
  8463. % is output afterwards if non-empty.
  8464. \def\refx#1#2{%
  8465. \requireauxfile
  8466. {%
  8467. \indexnofonts
  8468. \otherbackslash
  8469. \def\value##1{##1}%
  8470. \expandafter\global\expandafter\let\expandafter\thisrefX
  8471. \csname XR#1\endcsname
  8472. }%
  8473. \ifx\thisrefX\relax
  8474. % If not defined, say something at least.
  8475. \angleleft un\-de\-fined\angleright
  8476. \iflinks
  8477. \ifhavexrefs
  8478. {\toks0 = {#1}% avoid expansion of possibly-complex value
  8479. \message{\linenumber Undefined cross reference `\the\toks0'.}}%
  8480. \else
  8481. \ifwarnedxrefs\else
  8482. \global\warnedxrefstrue
  8483. \message{Cross reference values unknown; you must run TeX again.}%
  8484. \fi
  8485. \fi
  8486. \fi
  8487. \else
  8488. % It's defined, so just use it.
  8489. \thisrefX
  8490. \fi
  8491. #2% Output the suffix in any case.
  8492. }
  8493. % This is the macro invoked by entries in the aux file. Define a control
  8494. % sequence for a cross-reference target (we prepend XR to the control sequence
  8495. % name to avoid collisions). The value is the page number. If this is a float
  8496. % type, we have more work to do.
  8497. %
  8498. \def\xrdef#1#2{%
  8499. {% Expand the node or anchor name to remove control sequences.
  8500. % \turnoffactive stops 8-bit characters being changed to commands
  8501. % like @'e. \refx does the same to retrieve the value in the definition.
  8502. \indexnofonts
  8503. \turnoffactive
  8504. \def\value##1{##1}%
  8505. \xdef\safexrefname{#1}%
  8506. }%
  8507. %
  8508. \bgroup
  8509. \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
  8510. \egroup
  8511. % We put the \gdef inside a group to avoid the definitions building up on
  8512. % TeX's save stack, which can cause it to run out of space for aux files with
  8513. % thousands of lines. \gdef doesn't use the save stack, but \csname does
  8514. % when it defines an unknown control sequence as \relax.
  8515. %
  8516. % Was that xref control sequence that we just defined for a float?
  8517. \expandafter\iffloat\csname XR\safexrefname\endcsname
  8518. % it was a float, and we have the (safe) float type in \iffloattype.
  8519. \expandafter\let\expandafter\floatlist
  8520. \csname floatlist\iffloattype\endcsname
  8521. %
  8522. % Is this the first time we've seen this float type?
  8523. \expandafter\ifx\floatlist\relax
  8524. \toks0 = {\do}% yes, so just \do
  8525. \else
  8526. % had it before, so preserve previous elements in list.
  8527. \toks0 = \expandafter{\floatlist\do}%
  8528. \fi
  8529. %
  8530. % Remember this xref in the control sequence \floatlistFLOATTYPE,
  8531. % for later use in \listoffloats.
  8532. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
  8533. {\safexrefname}}%
  8534. \fi
  8535. }
  8536. % If working on a large document in chapters, it is convenient to
  8537. % be able to disable indexing, cross-referencing, and contents, for test runs.
  8538. % This is done with @novalidate at the beginning of the file.
  8539. %
  8540. \newif\iflinks \linkstrue % by default we want the aux files.
  8541. \let\novalidate = \linksfalse
  8542. % Used when writing to the aux file, or when using data from it.
  8543. \def\requireauxfile{%
  8544. \iflinks
  8545. \tryauxfile
  8546. % Open the new aux file. TeX will close it automatically at exit.
  8547. \immediate\openout\auxfile=\jobname.aux
  8548. \fi
  8549. \global\let\requireauxfile=\relax % Only do this once.
  8550. }
  8551. % Read the last existing aux file, if any. No error if none exists.
  8552. %
  8553. \def\tryauxfile{%
  8554. \openin 1 \jobname.aux
  8555. \ifeof 1 \else
  8556. \readdatafile{aux}%
  8557. \global\havexrefstrue
  8558. \fi
  8559. \closein 1
  8560. }
  8561. \def\setupdatafile{%
  8562. \catcode`\^^@=\other
  8563. \catcode`\^^A=\other
  8564. \catcode`\^^B=\other
  8565. \catcode`\^^C=\other
  8566. \catcode`\^^D=\other
  8567. \catcode`\^^E=\other
  8568. \catcode`\^^F=\other
  8569. \catcode`\^^G=\other
  8570. \catcode`\^^H=\other
  8571. \catcode`\^^K=\other
  8572. \catcode`\^^L=\other
  8573. \catcode`\^^N=\other
  8574. \catcode`\^^P=\other
  8575. \catcode`\^^Q=\other
  8576. \catcode`\^^R=\other
  8577. \catcode`\^^S=\other
  8578. \catcode`\^^T=\other
  8579. \catcode`\^^U=\other
  8580. \catcode`\^^V=\other
  8581. \catcode`\^^W=\other
  8582. \catcode`\^^X=\other
  8583. \catcode`\^^Z=\other
  8584. \catcode`\^^[=\other
  8585. \catcode`\^^\=\other
  8586. \catcode`\^^]=\other
  8587. \catcode`\^^^=\other
  8588. \catcode`\^^_=\other
  8589. % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  8590. % in xref tags, i.e., node names. But since ^^e4 notation isn't
  8591. % supported in the main text, it doesn't seem desirable. Furthermore,
  8592. % that is not enough: for node names that actually contain a ^
  8593. % character, we would end up writing a line like this: 'xrdef {'hat
  8594. % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  8595. % argument, and \hat is not an expandable control sequence. It could
  8596. % all be worked out, but why? Either we support ^^ or we don't.
  8597. %
  8598. % The other change necessary for this was to define \auxhat:
  8599. % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  8600. % and then to call \auxhat in \setq.
  8601. %
  8602. \catcode`\^=\other
  8603. %
  8604. % Special characters. Should be turned off anyway, but...
  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
  8615. \catcode`\&=\other
  8616. \catcode`\%=\other
  8617. \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  8618. %
  8619. % This is to support \ in node names and titles, since the \
  8620. % characters end up in a \csname. It's easier than
  8621. % leaving it active and making its active definition an actual \
  8622. % character. What I don't understand is why it works in the *value*
  8623. % of the xrdef. Seems like it should be a catcode12 \, and that
  8624. % should not typeset properly. But it works, so I'm moving on for
  8625. % now. --karl, 15jan04.
  8626. \catcode`\\=\other
  8627. %
  8628. % @ is our escape character in .aux files, and we need braces.
  8629. \catcode`\{=1
  8630. \catcode`\}=2
  8631. \catcode`\@=0
  8632. }
  8633. \def\readdatafile#1{%
  8634. \begingroup
  8635. \setupdatafile
  8636. \input\jobname.#1
  8637. \endgroup}
  8638. \message{insertions,}
  8639. % including footnotes.
  8640. \newcount \footnoteno
  8641. % The trailing space in the following definition for supereject is
  8642. % vital for proper filling; pages come out unaligned when you do a
  8643. % pagealignmacro call if that space before the closing brace is
  8644. % removed. (Generally, numeric constants should always be followed by a
  8645. % space to prevent strange expansion errors.)
  8646. \def\supereject{\par\penalty -20000\footnoteno =0 }
  8647. % @footnotestyle is meaningful for Info output only.
  8648. \let\footnotestyle=\comment
  8649. {\catcode `\@=11
  8650. %
  8651. % Auto-number footnotes. Otherwise like plain.
  8652. \gdef\footnote{%
  8653. \global\advance\footnoteno by \@ne
  8654. \edef\thisfootno{$^{\the\footnoteno}$}%
  8655. %
  8656. % In case the footnote comes at the end of a sentence, preserve the
  8657. % extra spacing after we do the footnote number.
  8658. \let\@sf\empty
  8659. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
  8660. %
  8661. % Remove inadvertent blank space before typesetting the footnote number.
  8662. \unskip
  8663. \thisfootno\@sf
  8664. \dofootnote
  8665. }%
  8666. % Don't bother with the trickery in plain.tex to not require the
  8667. % footnote text as a parameter. Our footnotes don't need to be so general.
  8668. %
  8669. % Oh yes, they do; otherwise, @ifset (and anything else that uses
  8670. % \parseargline) fails inside footnotes because the tokens are fixed when
  8671. % the footnote is read. --karl, 16nov96.
  8672. %
  8673. \gdef\dofootnote{%
  8674. \insert\footins\bgroup
  8675. %
  8676. % Nested footnotes are not supported in TeX, that would take a lot
  8677. % more work. (\startsavinginserts does not suffice.)
  8678. \let\footnote=\errfootnotenest
  8679. %
  8680. % We want to typeset this text as a normal paragraph, even if the
  8681. % footnote reference occurs in (for example) a display environment.
  8682. % So reset some parameters.
  8683. \hsize=\txipagewidth
  8684. \interlinepenalty\interfootnotelinepenalty
  8685. \splittopskip\ht\strutbox % top baseline for broken footnotes
  8686. \splitmaxdepth\dp\strutbox
  8687. \floatingpenalty\@MM
  8688. \leftskip\z@skip
  8689. \rightskip\z@skip
  8690. \spaceskip\z@skip
  8691. \xspaceskip\z@skip
  8692. \parindent\defaultparindent
  8693. %
  8694. \smallfonts \rm
  8695. %
  8696. % Because we use hanging indentation in footnotes, a @noindent appears
  8697. % to exdent this text, so make it be a no-op. makeinfo does not use
  8698. % hanging indentation so @noindent can still be needed within footnote
  8699. % text after an @example or the like (not that this is good style).
  8700. \let\noindent = \relax
  8701. %
  8702. % Hang the footnote text off the number. Use \everypar in case the
  8703. % footnote extends for more than one paragraph.
  8704. \everypar = {\hang}%
  8705. \textindent{\thisfootno}%
  8706. %
  8707. % Don't crash into the line above the footnote text. Since this
  8708. % expands into a box, it must come within the paragraph, lest it
  8709. % provide a place where TeX can split the footnote.
  8710. \footstrut
  8711. %
  8712. % Invoke rest of plain TeX footnote routine.
  8713. \futurelet\next\fo@t
  8714. }
  8715. }%end \catcode `\@=11
  8716. \def\errfootnotenest{%
  8717. \errhelp=\EMsimple
  8718. \errmessage{Nested footnotes not supported in texinfo.tex,
  8719. even though they work in makeinfo; sorry}
  8720. }
  8721. \def\errfootnoteheading{%
  8722. \errhelp=\EMsimple
  8723. \errmessage{Footnotes in chapters, sections, etc., are not supported}
  8724. }
  8725. % In case a @footnote appears in a vbox, save the footnote text and create
  8726. % the real \insert just after the vbox finished. Otherwise, the insertion
  8727. % would be lost.
  8728. % Similarly, if a @footnote appears inside an alignment, save the footnote
  8729. % text to a box and make the \insert when a row of the table is finished.
  8730. % And the same can be done for other insert classes. --kasal, 16nov03.
  8731. %
  8732. % Replace the \insert primitive by a cheating macro.
  8733. % Deeper inside, just make sure that the saved insertions are not spilled
  8734. % out prematurely.
  8735. %
  8736. \def\startsavinginserts{%
  8737. \ifx \insert\ptexinsert
  8738. \let\insert\saveinsert
  8739. \else
  8740. \let\checkinserts\relax
  8741. \fi
  8742. }
  8743. % This \insert replacement works for both \insert\footins{foo} and
  8744. % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
  8745. %
  8746. \def\saveinsert#1{%
  8747. \edef\next{\noexpand\savetobox \makeSAVEname#1}%
  8748. \afterassignment\next
  8749. % swallow the left brace
  8750. \let\temp =
  8751. }
  8752. \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
  8753. \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
  8754. \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
  8755. \def\placesaveins#1{%
  8756. \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
  8757. {\box#1}%
  8758. }
  8759. % eat @SAVE -- beware, all of them have catcode \other:
  8760. {
  8761. \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
  8762. \gdef\gobblesave @SAVE{}
  8763. }
  8764. % initialization:
  8765. \def\newsaveins #1{%
  8766. \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
  8767. \next
  8768. }
  8769. \def\newsaveinsX #1{%
  8770. \csname newbox\endcsname #1%
  8771. \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
  8772. \checksaveins #1}%
  8773. }
  8774. % initialize:
  8775. \let\checkinserts\empty
  8776. \newsaveins\footins
  8777. \newsaveins\margin
  8778. % @image. We use the macros from epsf.tex to support this.
  8779. % If epsf.tex is not installed and @image is used, we complain.
  8780. %
  8781. % Check for and read epsf.tex up front. If we read it only at @image
  8782. % time, we might be inside a group, and then its definitions would get
  8783. % undone and the next image would fail.
  8784. \openin 1 = epsf.tex
  8785. \ifeof 1 \else
  8786. % Do not bother showing banner with epsf.tex v2.7k (available in
  8787. % doc/epsf.tex and on ctan).
  8788. \def\epsfannounce{\toks0 = }%
  8789. \input epsf.tex
  8790. \fi
  8791. \closein 1
  8792. %
  8793. % We will only complain once about lack of epsf.tex.
  8794. \newif\ifwarnednoepsf
  8795. \newhelp\noepsfhelp{epsf.tex must be installed for images to
  8796. work. It is also included in the Texinfo distribution, or you can get
  8797. it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
  8798. %
  8799. \def\image#1{%
  8800. \ifx\epsfbox\thisisundefined
  8801. \ifwarnednoepsf \else
  8802. \errhelp = \noepsfhelp
  8803. \errmessage{epsf.tex not found, images will be ignored}%
  8804. \global\warnednoepsftrue
  8805. \fi
  8806. \else
  8807. \imagexxx #1,,,,,\finish
  8808. \fi
  8809. }
  8810. %
  8811. % Arguments to @image:
  8812. % #1 is (mandatory) image filename; we tack on .eps extension.
  8813. % #2 is (optional) width, #3 is (optional) height.
  8814. % #4 is (ignored optional) html alt text.
  8815. % #5 is (ignored optional) extension.
  8816. % #6 is just the usual extra ignored arg for parsing stuff.
  8817. \newif\ifimagevmode
  8818. \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  8819. \catcode`\^^M = 5 % in case we're inside an example
  8820. \normalturnoffactive % allow _ et al. in names
  8821. \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
  8822. % If the image is by itself, center it.
  8823. \ifvmode
  8824. \imagevmodetrue
  8825. \else \ifx\centersub\centerV
  8826. % for @center @image, we need a vbox so we can have our vertical space
  8827. \imagevmodetrue
  8828. \vbox\bgroup % vbox has better behavior than vtop herev
  8829. \fi\fi
  8830. %
  8831. \ifimagevmode
  8832. \nobreak\medskip
  8833. % Usually we'll have text after the image which will insert
  8834. % \parskip glue, so insert it here too to equalize the space
  8835. % above and below.
  8836. \nobreak\vskip\parskip
  8837. \nobreak
  8838. \fi
  8839. %
  8840. % Leave vertical mode so that indentation from an enclosing
  8841. % environment such as @quotation is respected.
  8842. % However, if we're at the top level, we don't want the
  8843. % normal paragraph indentation.
  8844. % On the other hand, if we are in the case of @center @image, we don't
  8845. % want to start a paragraph, which will create a hsize-width box and
  8846. % eradicate the centering.
  8847. \ifx\centersub\centerV\else \noindent \fi
  8848. %
  8849. % Output the image.
  8850. \ifpdf
  8851. % For pdfTeX and LuaTeX <= 0.80
  8852. \dopdfimage{#1}{#2}{#3}%
  8853. \else
  8854. \ifx\XeTeXrevision\thisisundefined
  8855. % For epsf.tex
  8856. % \epsfbox itself resets \epsf?size at each figure.
  8857. \setbox0 = \hbox{\ignorespaces #2}%
  8858. \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  8859. \setbox0 = \hbox{\ignorespaces #3}%
  8860. \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  8861. \epsfbox{#1.eps}%
  8862. \else
  8863. % For XeTeX
  8864. \doxeteximage{#1}{#2}{#3}%
  8865. \fi
  8866. \fi
  8867. %
  8868. \ifimagevmode
  8869. \medskip % space after a standalone image
  8870. \fi
  8871. \ifx\centersub\centerV \egroup \fi
  8872. \endgroup}
  8873. % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
  8874. % etc. We don't actually implement floating yet, we always include the
  8875. % float "here". But it seemed the best name for the future.
  8876. %
  8877. \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
  8878. % There may be a space before second and/or third parameter; delete it.
  8879. \def\eatcommaspace#1, {#1,}
  8880. % #1 is the optional FLOATTYPE, the text label for this float, typically
  8881. % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
  8882. % this float will not be numbered and cannot be referred to.
  8883. %
  8884. % #2 is the optional xref label. Also must be present for the float to
  8885. % be referable.
  8886. %
  8887. % #3 is the optional positioning argument; for now, it is ignored. It
  8888. % will somehow specify the positions allowed to float to (here, top, bottom).
  8889. %
  8890. % We keep a separate counter for each FLOATTYPE, which we reset at each
  8891. % chapter-level command.
  8892. \let\resetallfloatnos=\empty
  8893. %
  8894. \def\dofloat#1,#2,#3,#4\finish{%
  8895. \let\thiscaption=\empty
  8896. \let\thisshortcaption=\empty
  8897. %
  8898. % don't lose footnotes inside @float.
  8899. %
  8900. % BEWARE: when the floats start float, we have to issue warning whenever an
  8901. % insert appears inside a float which could possibly float. --kasal, 26may04
  8902. %
  8903. \startsavinginserts
  8904. %
  8905. % We can't be used inside a paragraph.
  8906. \par
  8907. %
  8908. \vtop\bgroup
  8909. \def\floattype{#1}%
  8910. \def\floatlabel{#2}%
  8911. \def\floatloc{#3}% we do nothing with this yet.
  8912. %
  8913. \ifx\floattype\empty
  8914. \let\safefloattype=\empty
  8915. \else
  8916. {%
  8917. % the floattype might have accents or other special characters,
  8918. % but we need to use it in a control sequence name.
  8919. \indexnofonts
  8920. \turnoffactive
  8921. \xdef\safefloattype{\floattype}%
  8922. }%
  8923. \fi
  8924. %
  8925. % If label is given but no type, we handle that as the empty type.
  8926. \ifx\floatlabel\empty \else
  8927. % We want each FLOATTYPE to be numbered separately (Figure 1,
  8928. % Table 1, Figure 2, ...). (And if no label, no number.)
  8929. %
  8930. \expandafter\getfloatno\csname\safefloattype floatno\endcsname
  8931. \global\advance\floatno by 1
  8932. %
  8933. {%
  8934. % This magic value for \lastsection is output by \setref as the
  8935. % XREFLABEL-title value. \xrefX uses it to distinguish float
  8936. % labels (which have a completely different output format) from
  8937. % node and anchor labels. And \xrdef uses it to construct the
  8938. % lists of floats.
  8939. %
  8940. \edef\lastsection{\floatmagic=\safefloattype}%
  8941. \setref{\floatlabel}{Yfloat}%
  8942. }%
  8943. \fi
  8944. %
  8945. % start with \parskip glue, I guess.
  8946. \vskip\parskip
  8947. %
  8948. % Don't suppress indentation if a float happens to start a section.
  8949. \restorefirstparagraphindent
  8950. }
  8951. % we have these possibilities:
  8952. % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
  8953. % @float Foo,lbl & no caption: Foo 1.1
  8954. % @float Foo & @caption{Cap}: Foo: Cap
  8955. % @float Foo & no caption: Foo
  8956. % @float ,lbl & Caption{Cap}: 1.1: Cap
  8957. % @float ,lbl & no caption: 1.1
  8958. % @float & @caption{Cap}: Cap
  8959. % @float & no caption:
  8960. %
  8961. \def\Efloat{%
  8962. \let\floatident = \empty
  8963. %
  8964. % In all cases, if we have a float type, it comes first.
  8965. \ifx\floattype\empty \else \def\floatident{\floattype}\fi
  8966. %
  8967. % If we have an xref label, the number comes next.
  8968. \ifx\floatlabel\empty \else
  8969. \ifx\floattype\empty \else % if also had float type, need tie first.
  8970. \appendtomacro\floatident{\tie}%
  8971. \fi
  8972. % the number.
  8973. \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
  8974. \fi
  8975. %
  8976. % Start the printed caption with what we've constructed in
  8977. % \floatident, but keep it separate; we need \floatident again.
  8978. \let\captionline = \floatident
  8979. %
  8980. \ifx\thiscaption\empty \else
  8981. \ifx\floatident\empty \else
  8982. \appendtomacro\captionline{: }% had ident, so need a colon between
  8983. \fi
  8984. %
  8985. % caption text.
  8986. \appendtomacro\captionline{\scanexp\thiscaption}%
  8987. \fi
  8988. %
  8989. % If we have anything to print, print it, with space before.
  8990. % Eventually this needs to become an \insert.
  8991. \ifx\captionline\empty \else
  8992. \vskip.5\parskip
  8993. \captionline
  8994. %
  8995. % Space below caption.
  8996. \vskip\parskip
  8997. \fi
  8998. %
  8999. % If have an xref label, write the list of floats info. Do this
  9000. % after the caption, to avoid chance of it being a breakpoint.
  9001. \ifx\floatlabel\empty \else
  9002. % Write the text that goes in the lof to the aux file as
  9003. % \floatlabel-lof. Besides \floatident, we include the short
  9004. % caption if specified, else the full caption if specified, else nothing.
  9005. {%
  9006. \requireauxfile
  9007. \atdummies
  9008. %
  9009. \ifx\thisshortcaption\empty
  9010. \def\gtemp{\thiscaption}%
  9011. \else
  9012. \def\gtemp{\thisshortcaption}%
  9013. \fi
  9014. \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
  9015. \ifx\gtemp\empty \else : \gtemp \fi}}%
  9016. }%
  9017. \fi
  9018. \egroup % end of \vtop
  9019. %
  9020. \checkinserts
  9021. }
  9022. % Append the tokens #2 to the definition of macro #1, not expanding either.
  9023. %
  9024. \def\appendtomacro#1#2{%
  9025. \expandafter\def\expandafter#1\expandafter{#1#2}%
  9026. }
  9027. % @caption, @shortcaption
  9028. %
  9029. \def\caption{\docaption\thiscaption}
  9030. \def\shortcaption{\docaption\thisshortcaption}
  9031. \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
  9032. \def\defcaption#1#2{\egroup \def#1{#2}}
  9033. % The parameter is the control sequence identifying the counter we are
  9034. % going to use. Create it if it doesn't exist and assign it to \floatno.
  9035. \def\getfloatno#1{%
  9036. \ifx#1\relax
  9037. % Haven't seen this figure type before.
  9038. \csname newcount\endcsname #1%
  9039. %
  9040. % Remember to reset this floatno at the next chap.
  9041. \expandafter\gdef\expandafter\resetallfloatnos
  9042. \expandafter{\resetallfloatnos #1=0 }%
  9043. \fi
  9044. \let\floatno#1%
  9045. }
  9046. % \setref calls this to get the XREFLABEL-snt value. We want an @xref
  9047. % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
  9048. % first read the @float command.
  9049. %
  9050. \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
  9051. % Magic string used for the XREFLABEL-title value, so \xrefX can
  9052. % distinguish floats from other xref types.
  9053. \def\floatmagic{!!float!!}
  9054. % #1 is the control sequence we are passed; we expand into a conditional
  9055. % which is true if #1 represents a float ref. That is, the magic
  9056. % \lastsection value which we \setref above.
  9057. %
  9058. \def\iffloat#1{\expandafter\doiffloat#1==\finish}
  9059. %
  9060. % #1 is (maybe) the \floatmagic string. If so, #2 will be the
  9061. % (safe) float type for this float. We set \iffloattype to #2.
  9062. %
  9063. \def\doiffloat#1=#2=#3\finish{%
  9064. \def\temp{#1}%
  9065. \def\iffloattype{#2}%
  9066. \ifx\temp\floatmagic
  9067. }
  9068. % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
  9069. %
  9070. \parseargdef\listoffloats{%
  9071. \def\floattype{#1}% floattype
  9072. {%
  9073. % the floattype might have accents or other special characters,
  9074. % but we need to use it in a control sequence name.
  9075. \indexnofonts
  9076. \turnoffactive
  9077. \xdef\safefloattype{\floattype}%
  9078. }%
  9079. %
  9080. % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
  9081. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
  9082. \ifhavexrefs
  9083. % if the user said @listoffloats foo but never @float foo.
  9084. \message{\linenumber No `\safefloattype' floats to list.}%
  9085. \fi
  9086. \else
  9087. \begingroup
  9088. \leftskip=\tocindent % indent these entries like a toc
  9089. \let\do=\listoffloatsdo
  9090. \csname floatlist\safefloattype\endcsname
  9091. \endgroup
  9092. \fi
  9093. }
  9094. % This is called on each entry in a list of floats. We're passed the
  9095. % xref label, in the form LABEL-title, which is how we save it in the
  9096. % aux file. We strip off the -title and look up \XRLABEL-lof, which
  9097. % has the text we're supposed to typeset here.
  9098. %
  9099. % Figures without xref labels will not be included in the list (since
  9100. % they won't appear in the aux file).
  9101. %
  9102. \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
  9103. \def\listoffloatsdoentry#1-title\finish{{%
  9104. % Can't fully expand XR#1-lof because it can contain anything. Just
  9105. % pass the control sequence. On the other hand, XR#1-pg is just the
  9106. % page number, and we want to fully expand that so we can get a link
  9107. % in pdf output.
  9108. \toksA = \expandafter{\csname XR#1-lof\endcsname}%
  9109. %
  9110. % use the same \entry macro we use to generate the TOC and index.
  9111. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
  9112. \writeentry
  9113. }}
  9114. \message{localization,}
  9115. % For single-language documents, @documentlanguage is usually given very
  9116. % early, just after @documentencoding. Single argument is the language
  9117. % (de) or locale (de_DE) abbreviation.
  9118. %
  9119. {
  9120. \catcode`\_ = \active
  9121. \globaldefs=1
  9122. \parseargdef\documentlanguage{%
  9123. \tex % read txi-??.tex file in plain TeX.
  9124. % Read the file by the name they passed if it exists.
  9125. \let_ = \normalunderscore % normal _ character for filename test
  9126. \openin 1 txi-#1.tex
  9127. \ifeof 1
  9128. \documentlanguagetrywithoutunderscore #1_\finish
  9129. \else
  9130. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9131. \input txi-#1.tex
  9132. \fi
  9133. \closein 1
  9134. \endgroup % end raw TeX
  9135. }
  9136. %
  9137. % If they passed de_DE, and txi-de_DE.tex doesn't exist,
  9138. % try txi-de.tex.
  9139. %
  9140. \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
  9141. \openin 1 txi-#1.tex
  9142. \ifeof 1
  9143. \errhelp = \nolanghelp
  9144. \errmessage{Cannot read language file txi-#1.tex}%
  9145. \else
  9146. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9147. \input txi-#1.tex
  9148. \fi
  9149. \closein 1
  9150. }
  9151. }% end of special _ catcode
  9152. %
  9153. \newhelp\nolanghelp{The given language definition file cannot be found or
  9154. is empty. Maybe you need to install it? Putting it in the current
  9155. directory should work if nowhere else does.}
  9156. % This macro is called from txi-??.tex files; the first argument is the
  9157. % \language name to set (without the "\lang@" prefix), the second and
  9158. % third args are \{left,right}hyphenmin.
  9159. %
  9160. % The language names to pass are determined when the format is built.
  9161. % See the etex.log file created at that time, e.g.,
  9162. % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
  9163. %
  9164. % With TeX Live 2008, etex now includes hyphenation patterns for all
  9165. % available languages. This means we can support hyphenation in
  9166. % Texinfo, at least to some extent. (This still doesn't solve the
  9167. % accented characters problem.)
  9168. %
  9169. \catcode`@=11
  9170. \def\txisetlanguage#1#2#3{%
  9171. % do not set the language if the name is undefined in the current TeX.
  9172. \expandafter\ifx\csname lang@#1\endcsname \relax
  9173. \message{no patterns for #1}%
  9174. \else
  9175. \global\language = \csname lang@#1\endcsname
  9176. \fi
  9177. % but there is no harm in adjusting the hyphenmin values regardless.
  9178. \global\lefthyphenmin = #2\relax
  9179. \global\righthyphenmin = #3\relax
  9180. }
  9181. % XeTeX and LuaTeX can handle Unicode natively.
  9182. % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
  9183. % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
  9184. %
  9185. \newif\iftxinativeunicodecapable
  9186. \newif\iftxiusebytewiseio
  9187. \ifx\XeTeXrevision\thisisundefined
  9188. \ifx\luatexversion\thisisundefined
  9189. \txinativeunicodecapablefalse
  9190. \txiusebytewiseiotrue
  9191. \else
  9192. \txinativeunicodecapabletrue
  9193. \txiusebytewiseiofalse
  9194. \fi
  9195. \else
  9196. \txinativeunicodecapabletrue
  9197. \txiusebytewiseiofalse
  9198. \fi
  9199. % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
  9200. % for non-UTF-8 (byte-wise) encodings.
  9201. %
  9202. \def\setbytewiseio{%
  9203. \ifx\XeTeXrevision\thisisundefined
  9204. \else
  9205. \XeTeXdefaultencoding "bytes" % For subsequent files to be read
  9206. \XeTeXinputencoding "bytes" % For document root file
  9207. % Unfortunately, there seems to be no corresponding XeTeX command for
  9208. % output encoding. This is a problem for auxiliary index and TOC files.
  9209. % The only solution would be perhaps to write out @U{...} sequences in
  9210. % place of non-ASCII characters.
  9211. \fi
  9212. \ifx\luatexversion\thisisundefined
  9213. \else
  9214. \directlua{
  9215. local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
  9216. local function convert_char (char)
  9217. return utf8_char(byte(char))
  9218. end
  9219. local function convert_line (line)
  9220. return gsub(line, ".", convert_char)
  9221. end
  9222. callback.register("process_input_buffer", convert_line)
  9223. local function convert_line_out (line)
  9224. local line_out = ""
  9225. for c in string.utfvalues(line) do
  9226. line_out = line_out .. string.char(c)
  9227. end
  9228. return line_out
  9229. end
  9230. callback.register("process_output_buffer", convert_line_out)
  9231. }
  9232. \fi
  9233. \txiusebytewiseiotrue
  9234. }
  9235. % Helpers for encodings.
  9236. % Set the catcode of characters 128 through 255 to the specified number.
  9237. %
  9238. \def\setnonasciicharscatcode#1{%
  9239. \count255=128
  9240. \loop\ifnum\count255<256
  9241. \global\catcode\count255=#1\relax
  9242. \advance\count255 by 1
  9243. \repeat
  9244. }
  9245. \def\setnonasciicharscatcodenonglobal#1{%
  9246. \count255=128
  9247. \loop\ifnum\count255<256
  9248. \catcode\count255=#1\relax
  9249. \advance\count255 by 1
  9250. \repeat
  9251. }
  9252. % @documentencoding sets the definition of non-ASCII characters
  9253. % according to the specified encoding.
  9254. %
  9255. \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
  9256. \def\documentencodingzzz#1{%
  9257. %
  9258. % Encoding being declared for the document.
  9259. \def\declaredencoding{\csname #1.enc\endcsname}%
  9260. %
  9261. % Supported encodings: names converted to tokens in order to be able
  9262. % to compare them with \ifx.
  9263. \def\ascii{\csname US-ASCII.enc\endcsname}%
  9264. \def\latnine{\csname ISO-8859-15.enc\endcsname}%
  9265. \def\latone{\csname ISO-8859-1.enc\endcsname}%
  9266. \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
  9267. \def\utfeight{\csname UTF-8.enc\endcsname}%
  9268. %
  9269. \ifx \declaredencoding \ascii
  9270. \asciichardefs
  9271. %
  9272. \else \ifx \declaredencoding \lattwo
  9273. \iftxinativeunicodecapable
  9274. \setbytewiseio
  9275. \fi
  9276. \setnonasciicharscatcode\active
  9277. \lattwochardefs
  9278. %
  9279. \else \ifx \declaredencoding \latone
  9280. \iftxinativeunicodecapable
  9281. \setbytewiseio
  9282. \fi
  9283. \setnonasciicharscatcode\active
  9284. \latonechardefs
  9285. %
  9286. \else \ifx \declaredencoding \latnine
  9287. \iftxinativeunicodecapable
  9288. \setbytewiseio
  9289. \fi
  9290. \setnonasciicharscatcode\active
  9291. \latninechardefs
  9292. %
  9293. \else \ifx \declaredencoding \utfeight
  9294. \iftxinativeunicodecapable
  9295. % For native Unicode handling (XeTeX and LuaTeX)
  9296. \nativeunicodechardefs
  9297. \else
  9298. % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
  9299. \setnonasciicharscatcode\active
  9300. % since we already invoked \utfeightchardefs at the top level
  9301. % (below), do not re-invoke it, otherwise our check for duplicated
  9302. % definitions gets triggered. Making non-ascii chars active is
  9303. % sufficient.
  9304. \fi
  9305. %
  9306. \else
  9307. \message{Ignoring unknown document encoding: #1.}%
  9308. %
  9309. \fi % utfeight
  9310. \fi % latnine
  9311. \fi % latone
  9312. \fi % lattwo
  9313. \fi % ascii
  9314. %
  9315. \ifx\XeTeXrevision\thisisundefined
  9316. \else
  9317. \ifx \declaredencoding \utfeight
  9318. \else
  9319. \ifx \declaredencoding \ascii
  9320. \else
  9321. \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
  9322. non-ASCII characters in auxiliary files.}%
  9323. \fi
  9324. \fi
  9325. \fi
  9326. }
  9327. % emacs-page
  9328. % A message to be logged when using a character that isn't available
  9329. % the default font encoding (OT1).
  9330. %
  9331. \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
  9332. % Take account of \c (plain) vs. \, (Texinfo) difference.
  9333. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
  9334. % First, make active non-ASCII characters in order for them to be
  9335. % correctly categorized when TeX reads the replacement text of
  9336. % macros containing the character definitions.
  9337. \setnonasciicharscatcode\active
  9338. %
  9339. \def\gdefchar#1#2{%
  9340. \gdef#1{%
  9341. \ifpassthroughchars
  9342. \string#1%
  9343. \else
  9344. #2%
  9345. \fi
  9346. }}
  9347. % Latin1 (ISO-8859-1) character definitions.
  9348. \def\latonechardefs{%
  9349. \gdefchar^^a0{\tie}
  9350. \gdefchar^^a1{\exclamdown}
  9351. \gdefchar^^a2{{\tcfont \char162}} % cent
  9352. \gdefchar^^a3{\pounds{}}
  9353. \gdefchar^^a4{{\tcfont \char164}} % currency
  9354. \gdefchar^^a5{{\tcfont \char165}} % yen
  9355. \gdefchar^^a6{{\tcfont \char166}} % broken bar
  9356. \gdefchar^^a7{\S}
  9357. \gdefchar^^a8{\"{}}
  9358. \gdefchar^^a9{\copyright{}}
  9359. \gdefchar^^aa{\ordf}
  9360. \gdefchar^^ab{\guillemetleft{}}
  9361. \gdefchar^^ac{\ensuremath\lnot}
  9362. \gdefchar^^ad{\-}
  9363. \gdefchar^^ae{\registeredsymbol{}}
  9364. \gdefchar^^af{\={}}
  9365. %
  9366. \gdefchar^^b0{\textdegree}
  9367. \gdefchar^^b1{$\pm$}
  9368. \gdefchar^^b2{$^2$}
  9369. \gdefchar^^b3{$^3$}
  9370. \gdefchar^^b4{\'{}}
  9371. \gdefchar^^b5{$\mu$}
  9372. \gdefchar^^b6{\P}
  9373. \gdefchar^^b7{\ensuremath\cdot}
  9374. \gdefchar^^b8{\cedilla\ }
  9375. \gdefchar^^b9{$^1$}
  9376. \gdefchar^^ba{\ordm}
  9377. \gdefchar^^bb{\guillemetright{}}
  9378. \gdefchar^^bc{$1\over4$}
  9379. \gdefchar^^bd{$1\over2$}
  9380. \gdefchar^^be{$3\over4$}
  9381. \gdefchar^^bf{\questiondown}
  9382. %
  9383. \gdefchar^^c0{\`A}
  9384. \gdefchar^^c1{\'A}
  9385. \gdefchar^^c2{\^A}
  9386. \gdefchar^^c3{\~A}
  9387. \gdefchar^^c4{\"A}
  9388. \gdefchar^^c5{\ringaccent A}
  9389. \gdefchar^^c6{\AE}
  9390. \gdefchar^^c7{\cedilla C}
  9391. \gdefchar^^c8{\`E}
  9392. \gdefchar^^c9{\'E}
  9393. \gdefchar^^ca{\^E}
  9394. \gdefchar^^cb{\"E}
  9395. \gdefchar^^cc{\`I}
  9396. \gdefchar^^cd{\'I}
  9397. \gdefchar^^ce{\^I}
  9398. \gdefchar^^cf{\"I}
  9399. %
  9400. \gdefchar^^d0{\DH}
  9401. \gdefchar^^d1{\~N}
  9402. \gdefchar^^d2{\`O}
  9403. \gdefchar^^d3{\'O}
  9404. \gdefchar^^d4{\^O}
  9405. \gdefchar^^d5{\~O}
  9406. \gdefchar^^d6{\"O}
  9407. \gdefchar^^d7{$\times$}
  9408. \gdefchar^^d8{\O}
  9409. \gdefchar^^d9{\`U}
  9410. \gdefchar^^da{\'U}
  9411. \gdefchar^^db{\^U}
  9412. \gdefchar^^dc{\"U}
  9413. \gdefchar^^dd{\'Y}
  9414. \gdefchar^^de{\TH}
  9415. \gdefchar^^df{\ss}
  9416. %
  9417. \gdefchar^^e0{\`a}
  9418. \gdefchar^^e1{\'a}
  9419. \gdefchar^^e2{\^a}
  9420. \gdefchar^^e3{\~a}
  9421. \gdefchar^^e4{\"a}
  9422. \gdefchar^^e5{\ringaccent a}
  9423. \gdefchar^^e6{\ae}
  9424. \gdefchar^^e7{\cedilla c}
  9425. \gdefchar^^e8{\`e}
  9426. \gdefchar^^e9{\'e}
  9427. \gdefchar^^ea{\^e}
  9428. \gdefchar^^eb{\"e}
  9429. \gdefchar^^ec{\`{\dotless i}}
  9430. \gdefchar^^ed{\'{\dotless i}}
  9431. \gdefchar^^ee{\^{\dotless i}}
  9432. \gdefchar^^ef{\"{\dotless i}}
  9433. %
  9434. \gdefchar^^f0{\dh}
  9435. \gdefchar^^f1{\~n}
  9436. \gdefchar^^f2{\`o}
  9437. \gdefchar^^f3{\'o}
  9438. \gdefchar^^f4{\^o}
  9439. \gdefchar^^f5{\~o}
  9440. \gdefchar^^f6{\"o}
  9441. \gdefchar^^f7{$\div$}
  9442. \gdefchar^^f8{\o}
  9443. \gdefchar^^f9{\`u}
  9444. \gdefchar^^fa{\'u}
  9445. \gdefchar^^fb{\^u}
  9446. \gdefchar^^fc{\"u}
  9447. \gdefchar^^fd{\'y}
  9448. \gdefchar^^fe{\th}
  9449. \gdefchar^^ff{\"y}
  9450. }
  9451. % Latin9 (ISO-8859-15) encoding character definitions.
  9452. \def\latninechardefs{%
  9453. % Encoding is almost identical to Latin1.
  9454. \latonechardefs
  9455. %
  9456. \gdefchar^^a4{\euro{}}
  9457. \gdefchar^^a6{\v S}
  9458. \gdefchar^^a8{\v s}
  9459. \gdefchar^^b4{\v Z}
  9460. \gdefchar^^b8{\v z}
  9461. \gdefchar^^bc{\OE}
  9462. \gdefchar^^bd{\oe}
  9463. \gdefchar^^be{\"Y}
  9464. }
  9465. % Latin2 (ISO-8859-2) character definitions.
  9466. \def\lattwochardefs{%
  9467. \gdefchar^^a0{\tie}
  9468. \gdefchar^^a1{\ogonek{A}}
  9469. \gdefchar^^a2{\u{}}
  9470. \gdefchar^^a3{\L}
  9471. \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
  9472. \gdefchar^^a5{\v L}
  9473. \gdefchar^^a6{\'S}
  9474. \gdefchar^^a7{\S}
  9475. \gdefchar^^a8{\"{}}
  9476. \gdefchar^^a9{\v S}
  9477. \gdefchar^^aa{\cedilla S}
  9478. \gdefchar^^ab{\v T}
  9479. \gdefchar^^ac{\'Z}
  9480. \gdefchar^^ad{\-}
  9481. \gdefchar^^ae{\v Z}
  9482. \gdefchar^^af{\dotaccent Z}
  9483. %
  9484. \gdefchar^^b0{\textdegree{}}
  9485. \gdefchar^^b1{\ogonek{a}}
  9486. \gdefchar^^b2{\ogonek{ }}
  9487. \gdefchar^^b3{\l}
  9488. \gdefchar^^b4{\'{}}
  9489. \gdefchar^^b5{\v l}
  9490. \gdefchar^^b6{\'s}
  9491. \gdefchar^^b7{\v{}}
  9492. \gdefchar^^b8{\cedilla\ }
  9493. \gdefchar^^b9{\v s}
  9494. \gdefchar^^ba{\cedilla s}
  9495. \gdefchar^^bb{\v t}
  9496. \gdefchar^^bc{\'z}
  9497. \gdefchar^^bd{\H{}}
  9498. \gdefchar^^be{\v z}
  9499. \gdefchar^^bf{\dotaccent z}
  9500. %
  9501. \gdefchar^^c0{\'R}
  9502. \gdefchar^^c1{\'A}
  9503. \gdefchar^^c2{\^A}
  9504. \gdefchar^^c3{\u A}
  9505. \gdefchar^^c4{\"A}
  9506. \gdefchar^^c5{\'L}
  9507. \gdefchar^^c6{\'C}
  9508. \gdefchar^^c7{\cedilla C}
  9509. \gdefchar^^c8{\v C}
  9510. \gdefchar^^c9{\'E}
  9511. \gdefchar^^ca{\ogonek{E}}
  9512. \gdefchar^^cb{\"E}
  9513. \gdefchar^^cc{\v E}
  9514. \gdefchar^^cd{\'I}
  9515. \gdefchar^^ce{\^I}
  9516. \gdefchar^^cf{\v D}
  9517. %
  9518. \gdefchar^^d0{\DH}
  9519. \gdefchar^^d1{\'N}
  9520. \gdefchar^^d2{\v N}
  9521. \gdefchar^^d3{\'O}
  9522. \gdefchar^^d4{\^O}
  9523. \gdefchar^^d5{\H O}
  9524. \gdefchar^^d6{\"O}
  9525. \gdefchar^^d7{$\times$}
  9526. \gdefchar^^d8{\v R}
  9527. \gdefchar^^d9{\ringaccent U}
  9528. \gdefchar^^da{\'U}
  9529. \gdefchar^^db{\H U}
  9530. \gdefchar^^dc{\"U}
  9531. \gdefchar^^dd{\'Y}
  9532. \gdefchar^^de{\cedilla T}
  9533. \gdefchar^^df{\ss}
  9534. %
  9535. \gdefchar^^e0{\'r}
  9536. \gdefchar^^e1{\'a}
  9537. \gdefchar^^e2{\^a}
  9538. \gdefchar^^e3{\u a}
  9539. \gdefchar^^e4{\"a}
  9540. \gdefchar^^e5{\'l}
  9541. \gdefchar^^e6{\'c}
  9542. \gdefchar^^e7{\cedilla c}
  9543. \gdefchar^^e8{\v c}
  9544. \gdefchar^^e9{\'e}
  9545. \gdefchar^^ea{\ogonek{e}}
  9546. \gdefchar^^eb{\"e}
  9547. \gdefchar^^ec{\v e}
  9548. \gdefchar^^ed{\'{\dotless{i}}}
  9549. \gdefchar^^ee{\^{\dotless{i}}}
  9550. \gdefchar^^ef{\v d}
  9551. %
  9552. \gdefchar^^f0{\dh}
  9553. \gdefchar^^f1{\'n}
  9554. \gdefchar^^f2{\v n}
  9555. \gdefchar^^f3{\'o}
  9556. \gdefchar^^f4{\^o}
  9557. \gdefchar^^f5{\H o}
  9558. \gdefchar^^f6{\"o}
  9559. \gdefchar^^f7{$\div$}
  9560. \gdefchar^^f8{\v r}
  9561. \gdefchar^^f9{\ringaccent u}
  9562. \gdefchar^^fa{\'u}
  9563. \gdefchar^^fb{\H u}
  9564. \gdefchar^^fc{\"u}
  9565. \gdefchar^^fd{\'y}
  9566. \gdefchar^^fe{\cedilla t}
  9567. \gdefchar^^ff{\dotaccent{}}
  9568. }
  9569. % UTF-8 character definitions.
  9570. %
  9571. % This code to support UTF-8 is based on LaTeX's utf8.def, with some
  9572. % changes for Texinfo conventions. It is included here under the GPL by
  9573. % permission from Frank Mittelbach and the LaTeX team.
  9574. %
  9575. \newcount\countUTFx
  9576. \newcount\countUTFy
  9577. \newcount\countUTFz
  9578. \gdef\UTFviiiTwoOctets#1#2{\expandafter
  9579. \UTFviiiDefined\csname u8:#1\string #2\endcsname}
  9580. %
  9581. \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
  9582. \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
  9583. %
  9584. \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
  9585. \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
  9586. \gdef\UTFviiiDefined#1{%
  9587. \ifx #1\relax
  9588. \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
  9589. \else
  9590. \expandafter #1%
  9591. \fi
  9592. }
  9593. % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
  9594. \begingroup
  9595. \catcode`\~13
  9596. \catcode`\$12
  9597. \catcode`\"12
  9598. % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
  9599. % substituting ~ and $ with a character token of that value.
  9600. \def\UTFviiiLoop{%
  9601. \global\catcode\countUTFx\active
  9602. \uccode`\~\countUTFx
  9603. \uccode`\$\countUTFx
  9604. \uppercase\expandafter{\UTFviiiTmp}%
  9605. \advance\countUTFx by 1
  9606. \ifnum\countUTFx < \countUTFy
  9607. \expandafter\UTFviiiLoop
  9608. \fi}
  9609. % For bytes other than the first in a UTF-8 sequence. Not expected to
  9610. % be expanded except when writing to auxiliary files.
  9611. \countUTFx = "80
  9612. \countUTFy = "C2
  9613. \def\UTFviiiTmp{%
  9614. \gdef~{%
  9615. \ifpassthroughchars $\fi}}%
  9616. \UTFviiiLoop
  9617. \countUTFx = "C2
  9618. \countUTFy = "E0
  9619. \def\UTFviiiTmp{%
  9620. \gdef~{%
  9621. \ifpassthroughchars $%
  9622. \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
  9623. \UTFviiiLoop
  9624. \countUTFx = "E0
  9625. \countUTFy = "F0
  9626. \def\UTFviiiTmp{%
  9627. \gdef~{%
  9628. \ifpassthroughchars $%
  9629. \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
  9630. \UTFviiiLoop
  9631. \countUTFx = "F0
  9632. \countUTFy = "F4
  9633. \def\UTFviiiTmp{%
  9634. \gdef~{%
  9635. \ifpassthroughchars $%
  9636. \else\expandafter\UTFviiiFourOctets\expandafter$\fi
  9637. }}%
  9638. \UTFviiiLoop
  9639. \endgroup
  9640. \def\globallet{\global\let} % save some \expandafter's below
  9641. % @U{xxxx} to produce U+xxxx, if we support it.
  9642. \def\U#1{%
  9643. \expandafter\ifx\csname uni:#1\endcsname \relax
  9644. \iftxinativeunicodecapable
  9645. % All Unicode characters can be used if native Unicode handling is
  9646. % active. However, if the font does not have the glyph,
  9647. % letters are missing.
  9648. \begingroup
  9649. \uccode`\.="#1\relax
  9650. \uppercase{.}
  9651. \endgroup
  9652. \else
  9653. \errhelp = \EMsimple
  9654. \errmessage{Unicode character U+#1 not supported, sorry}%
  9655. \fi
  9656. \else
  9657. \csname uni:#1\endcsname
  9658. \fi
  9659. }
  9660. % These macros are used here to construct the name of a control
  9661. % sequence to be defined.
  9662. \def\UTFviiiTwoOctetsName#1#2{%
  9663. \csname u8:#1\string #2\endcsname}%
  9664. \def\UTFviiiThreeOctetsName#1#2#3{%
  9665. \csname u8:#1\string #2\string #3\endcsname}%
  9666. \def\UTFviiiFourOctetsName#1#2#3#4{%
  9667. \csname u8:#1\string #2\string #3\string #4\endcsname}%
  9668. % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
  9669. % provide a definition macro to replace a Unicode character;
  9670. % this gets used by the @U command
  9671. %
  9672. \begingroup
  9673. \catcode`\"=12
  9674. \catcode`\<=12
  9675. \catcode`\.=12
  9676. \catcode`\,=12
  9677. \catcode`\;=12
  9678. \catcode`\!=12
  9679. \catcode`\~=13
  9680. \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
  9681. \countUTFz = "#1\relax
  9682. \begingroup
  9683. \parseXMLCharref
  9684. % Give \u8:... its definition. The sequence of seven \expandafter's
  9685. % expands after the \gdef three times, e.g.
  9686. %
  9687. % 1. \UTFviiTwoOctetsName B1 B2
  9688. % 2. \csname u8:B1 \string B2 \endcsname
  9689. % 3. \u8: B1 B2 (a single control sequence token)
  9690. %
  9691. \expandafter\expandafter
  9692. \expandafter\expandafter
  9693. \expandafter\expandafter
  9694. \expandafter\gdef \UTFviiiTmp{#2}%
  9695. %
  9696. \expandafter\ifx\csname uni:#1\endcsname \relax \else
  9697. \message{Internal error, already defined: #1}%
  9698. \fi
  9699. %
  9700. % define an additional control sequence for this code point.
  9701. \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
  9702. \endgroup}
  9703. %
  9704. % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
  9705. % to the corresponding UTF-8 sequence.
  9706. \gdef\parseXMLCharref{%
  9707. \ifnum\countUTFz < "A0\relax
  9708. \errhelp = \EMsimple
  9709. \errmessage{Cannot define Unicode char value < 00A0}%
  9710. \else\ifnum\countUTFz < "800\relax
  9711. \parseUTFviiiA,%
  9712. \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
  9713. \else\ifnum\countUTFz < "10000\relax
  9714. \parseUTFviiiA;%
  9715. \parseUTFviiiA,%
  9716. \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
  9717. \else
  9718. \parseUTFviiiA;%
  9719. \parseUTFviiiA,%
  9720. \parseUTFviiiA!%
  9721. \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
  9722. \fi\fi\fi
  9723. }
  9724. % Extract a byte from the end of the UTF-8 representation of \countUTFx.
  9725. % It must be a non-initial byte in the sequence.
  9726. % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
  9727. % of the bytes.
  9728. \gdef\parseUTFviiiA#1{%
  9729. \countUTFx = \countUTFz
  9730. \divide\countUTFz by 64
  9731. \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
  9732. \multiply\countUTFz by 64
  9733. % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
  9734. % in order to get the last five bits.
  9735. \advance\countUTFx by -\countUTFz
  9736. % Convert this to the byte in the UTF-8 sequence.
  9737. \advance\countUTFx by 128
  9738. \uccode `#1\countUTFx
  9739. \countUTFz = \countUTFy}
  9740. % Used to put a UTF-8 byte sequence into \UTFviiiTmp
  9741. % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
  9742. % sequence.
  9743. % #2 is one of the \UTFviii*OctetsName macros.
  9744. % #3 is always a full stop (.)
  9745. % #4 is a template for the other bytes in the sequence. The values for these
  9746. % bytes is substituted in here with \uppercase using the \uccode's.
  9747. \gdef\parseUTFviiiB#1#2#3#4{%
  9748. \advance\countUTFz by "#10\relax
  9749. \uccode `#3\countUTFz
  9750. \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
  9751. \endgroup
  9752. % For native Unicode handling (XeTeX and LuaTeX),
  9753. % provide a definition macro that sets a catcode to `other' non-globally
  9754. %
  9755. \def\DeclareUnicodeCharacterNativeOther#1#2{%
  9756. \catcode"#1=\other
  9757. }
  9758. % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
  9759. % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
  9760. % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
  9761. % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
  9762. % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
  9763. %
  9764. % Many of our renditions are less than wonderful, and all the missing
  9765. % characters are available somewhere. Loading the necessary fonts
  9766. % awaits user request. We can't truly support Unicode without
  9767. % reimplementing everything that's been done in LaTeX for many years,
  9768. % plus probably using luatex or xetex, and who knows what else.
  9769. % We won't be doing that here in this simple file. But we can try to at
  9770. % least make most of the characters not bomb out.
  9771. %
  9772. \def\unicodechardefs{%
  9773. \DeclareUnicodeCharacter{00A0}{\tie}%
  9774. \DeclareUnicodeCharacter{00A1}{\exclamdown}%
  9775. \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
  9776. \DeclareUnicodeCharacter{00A3}{\pounds{}}%
  9777. \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
  9778. \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
  9779. \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
  9780. \DeclareUnicodeCharacter{00A7}{\S}%
  9781. \DeclareUnicodeCharacter{00A8}{\"{ }}%
  9782. \DeclareUnicodeCharacter{00A9}{\copyright{}}%
  9783. \DeclareUnicodeCharacter{00AA}{\ordf}%
  9784. \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
  9785. \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
  9786. \DeclareUnicodeCharacter{00AD}{\-}%
  9787. \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
  9788. \DeclareUnicodeCharacter{00AF}{\={ }}%
  9789. %
  9790. \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
  9791. \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
  9792. \DeclareUnicodeCharacter{00B2}{$^2$}%
  9793. \DeclareUnicodeCharacter{00B3}{$^3$}%
  9794. \DeclareUnicodeCharacter{00B4}{\'{ }}%
  9795. \DeclareUnicodeCharacter{00B5}{$\mu$}%
  9796. \DeclareUnicodeCharacter{00B6}{\P}%
  9797. \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
  9798. \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
  9799. \DeclareUnicodeCharacter{00B9}{$^1$}%
  9800. \DeclareUnicodeCharacter{00BA}{\ordm}%
  9801. \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
  9802. \DeclareUnicodeCharacter{00BC}{$1\over4$}%
  9803. \DeclareUnicodeCharacter{00BD}{$1\over2$}%
  9804. \DeclareUnicodeCharacter{00BE}{$3\over4$}%
  9805. \DeclareUnicodeCharacter{00BF}{\questiondown}%
  9806. %
  9807. \DeclareUnicodeCharacter{00C0}{\`A}%
  9808. \DeclareUnicodeCharacter{00C1}{\'A}%
  9809. \DeclareUnicodeCharacter{00C2}{\^A}%
  9810. \DeclareUnicodeCharacter{00C3}{\~A}%
  9811. \DeclareUnicodeCharacter{00C4}{\"A}%
  9812. \DeclareUnicodeCharacter{00C5}{\AA}%
  9813. \DeclareUnicodeCharacter{00C6}{\AE}%
  9814. \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
  9815. \DeclareUnicodeCharacter{00C8}{\`E}%
  9816. \DeclareUnicodeCharacter{00C9}{\'E}%
  9817. \DeclareUnicodeCharacter{00CA}{\^E}%
  9818. \DeclareUnicodeCharacter{00CB}{\"E}%
  9819. \DeclareUnicodeCharacter{00CC}{\`I}%
  9820. \DeclareUnicodeCharacter{00CD}{\'I}%
  9821. \DeclareUnicodeCharacter{00CE}{\^I}%
  9822. \DeclareUnicodeCharacter{00CF}{\"I}%
  9823. %
  9824. \DeclareUnicodeCharacter{00D0}{\DH}%
  9825. \DeclareUnicodeCharacter{00D1}{\~N}%
  9826. \DeclareUnicodeCharacter{00D2}{\`O}%
  9827. \DeclareUnicodeCharacter{00D3}{\'O}%
  9828. \DeclareUnicodeCharacter{00D4}{\^O}%
  9829. \DeclareUnicodeCharacter{00D5}{\~O}%
  9830. \DeclareUnicodeCharacter{00D6}{\"O}%
  9831. \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
  9832. \DeclareUnicodeCharacter{00D8}{\O}%
  9833. \DeclareUnicodeCharacter{00D9}{\`U}%
  9834. \DeclareUnicodeCharacter{00DA}{\'U}%
  9835. \DeclareUnicodeCharacter{00DB}{\^U}%
  9836. \DeclareUnicodeCharacter{00DC}{\"U}%
  9837. \DeclareUnicodeCharacter{00DD}{\'Y}%
  9838. \DeclareUnicodeCharacter{00DE}{\TH}%
  9839. \DeclareUnicodeCharacter{00DF}{\ss}%
  9840. %
  9841. \DeclareUnicodeCharacter{00E0}{\`a}%
  9842. \DeclareUnicodeCharacter{00E1}{\'a}%
  9843. \DeclareUnicodeCharacter{00E2}{\^a}%
  9844. \DeclareUnicodeCharacter{00E3}{\~a}%
  9845. \DeclareUnicodeCharacter{00E4}{\"a}%
  9846. \DeclareUnicodeCharacter{00E5}{\aa}%
  9847. \DeclareUnicodeCharacter{00E6}{\ae}%
  9848. \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
  9849. \DeclareUnicodeCharacter{00E8}{\`e}%
  9850. \DeclareUnicodeCharacter{00E9}{\'e}%
  9851. \DeclareUnicodeCharacter{00EA}{\^e}%
  9852. \DeclareUnicodeCharacter{00EB}{\"e}%
  9853. \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
  9854. \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
  9855. \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
  9856. \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
  9857. %
  9858. \DeclareUnicodeCharacter{00F0}{\dh}%
  9859. \DeclareUnicodeCharacter{00F1}{\~n}%
  9860. \DeclareUnicodeCharacter{00F2}{\`o}%
  9861. \DeclareUnicodeCharacter{00F3}{\'o}%
  9862. \DeclareUnicodeCharacter{00F4}{\^o}%
  9863. \DeclareUnicodeCharacter{00F5}{\~o}%
  9864. \DeclareUnicodeCharacter{00F6}{\"o}%
  9865. \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
  9866. \DeclareUnicodeCharacter{00F8}{\o}%
  9867. \DeclareUnicodeCharacter{00F9}{\`u}%
  9868. \DeclareUnicodeCharacter{00FA}{\'u}%
  9869. \DeclareUnicodeCharacter{00FB}{\^u}%
  9870. \DeclareUnicodeCharacter{00FC}{\"u}%
  9871. \DeclareUnicodeCharacter{00FD}{\'y}%
  9872. \DeclareUnicodeCharacter{00FE}{\th}%
  9873. \DeclareUnicodeCharacter{00FF}{\"y}%
  9874. %
  9875. \DeclareUnicodeCharacter{0100}{\=A}%
  9876. \DeclareUnicodeCharacter{0101}{\=a}%
  9877. \DeclareUnicodeCharacter{0102}{\u{A}}%
  9878. \DeclareUnicodeCharacter{0103}{\u{a}}%
  9879. \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
  9880. \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
  9881. \DeclareUnicodeCharacter{0106}{\'C}%
  9882. \DeclareUnicodeCharacter{0107}{\'c}%
  9883. \DeclareUnicodeCharacter{0108}{\^C}%
  9884. \DeclareUnicodeCharacter{0109}{\^c}%
  9885. \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
  9886. \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
  9887. \DeclareUnicodeCharacter{010C}{\v{C}}%
  9888. \DeclareUnicodeCharacter{010D}{\v{c}}%
  9889. \DeclareUnicodeCharacter{010E}{\v{D}}%
  9890. \DeclareUnicodeCharacter{010F}{d'}%
  9891. %
  9892. \DeclareUnicodeCharacter{0110}{\DH}%
  9893. \DeclareUnicodeCharacter{0111}{\dh}%
  9894. \DeclareUnicodeCharacter{0112}{\=E}%
  9895. \DeclareUnicodeCharacter{0113}{\=e}%
  9896. \DeclareUnicodeCharacter{0114}{\u{E}}%
  9897. \DeclareUnicodeCharacter{0115}{\u{e}}%
  9898. \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
  9899. \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
  9900. \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
  9901. \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
  9902. \DeclareUnicodeCharacter{011A}{\v{E}}%
  9903. \DeclareUnicodeCharacter{011B}{\v{e}}%
  9904. \DeclareUnicodeCharacter{011C}{\^G}%
  9905. \DeclareUnicodeCharacter{011D}{\^g}%
  9906. \DeclareUnicodeCharacter{011E}{\u{G}}%
  9907. \DeclareUnicodeCharacter{011F}{\u{g}}%
  9908. %
  9909. \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
  9910. \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
  9911. \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
  9912. \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
  9913. \DeclareUnicodeCharacter{0124}{\^H}%
  9914. \DeclareUnicodeCharacter{0125}{\^h}%
  9915. \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
  9916. \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
  9917. \DeclareUnicodeCharacter{0128}{\~I}%
  9918. \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
  9919. \DeclareUnicodeCharacter{012A}{\=I}%
  9920. \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
  9921. \DeclareUnicodeCharacter{012C}{\u{I}}%
  9922. \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
  9923. \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
  9924. \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
  9925. %
  9926. \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
  9927. \DeclareUnicodeCharacter{0131}{\dotless{i}}%
  9928. \DeclareUnicodeCharacter{0132}{IJ}%
  9929. \DeclareUnicodeCharacter{0133}{ij}%
  9930. \DeclareUnicodeCharacter{0134}{\^J}%
  9931. \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
  9932. \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
  9933. \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
  9934. \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
  9935. \DeclareUnicodeCharacter{0139}{\'L}%
  9936. \DeclareUnicodeCharacter{013A}{\'l}%
  9937. \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
  9938. \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
  9939. \DeclareUnicodeCharacter{013D}{L'}% should kern
  9940. \DeclareUnicodeCharacter{013E}{l'}% should kern
  9941. \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
  9942. %
  9943. \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
  9944. \DeclareUnicodeCharacter{0141}{\L}%
  9945. \DeclareUnicodeCharacter{0142}{\l}%
  9946. \DeclareUnicodeCharacter{0143}{\'N}%
  9947. \DeclareUnicodeCharacter{0144}{\'n}%
  9948. \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
  9949. \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
  9950. \DeclareUnicodeCharacter{0147}{\v{N}}%
  9951. \DeclareUnicodeCharacter{0148}{\v{n}}%
  9952. \DeclareUnicodeCharacter{0149}{'n}%
  9953. \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
  9954. \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
  9955. \DeclareUnicodeCharacter{014C}{\=O}%
  9956. \DeclareUnicodeCharacter{014D}{\=o}%
  9957. \DeclareUnicodeCharacter{014E}{\u{O}}%
  9958. \DeclareUnicodeCharacter{014F}{\u{o}}%
  9959. %
  9960. \DeclareUnicodeCharacter{0150}{\H{O}}%
  9961. \DeclareUnicodeCharacter{0151}{\H{o}}%
  9962. \DeclareUnicodeCharacter{0152}{\OE}%
  9963. \DeclareUnicodeCharacter{0153}{\oe}%
  9964. \DeclareUnicodeCharacter{0154}{\'R}%
  9965. \DeclareUnicodeCharacter{0155}{\'r}%
  9966. \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
  9967. \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
  9968. \DeclareUnicodeCharacter{0158}{\v{R}}%
  9969. \DeclareUnicodeCharacter{0159}{\v{r}}%
  9970. \DeclareUnicodeCharacter{015A}{\'S}%
  9971. \DeclareUnicodeCharacter{015B}{\'s}%
  9972. \DeclareUnicodeCharacter{015C}{\^S}%
  9973. \DeclareUnicodeCharacter{015D}{\^s}%
  9974. \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
  9975. \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
  9976. %
  9977. \DeclareUnicodeCharacter{0160}{\v{S}}%
  9978. \DeclareUnicodeCharacter{0161}{\v{s}}%
  9979. \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
  9980. \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
  9981. \DeclareUnicodeCharacter{0164}{\v{T}}%
  9982. \DeclareUnicodeCharacter{0165}{\v{t}}%
  9983. \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
  9984. \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
  9985. \DeclareUnicodeCharacter{0168}{\~U}%
  9986. \DeclareUnicodeCharacter{0169}{\~u}%
  9987. \DeclareUnicodeCharacter{016A}{\=U}%
  9988. \DeclareUnicodeCharacter{016B}{\=u}%
  9989. \DeclareUnicodeCharacter{016C}{\u{U}}%
  9990. \DeclareUnicodeCharacter{016D}{\u{u}}%
  9991. \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
  9992. \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
  9993. %
  9994. \DeclareUnicodeCharacter{0170}{\H{U}}%
  9995. \DeclareUnicodeCharacter{0171}{\H{u}}%
  9996. \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
  9997. \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
  9998. \DeclareUnicodeCharacter{0174}{\^W}%
  9999. \DeclareUnicodeCharacter{0175}{\^w}%
  10000. \DeclareUnicodeCharacter{0176}{\^Y}%
  10001. \DeclareUnicodeCharacter{0177}{\^y}%
  10002. \DeclareUnicodeCharacter{0178}{\"Y}%
  10003. \DeclareUnicodeCharacter{0179}{\'Z}%
  10004. \DeclareUnicodeCharacter{017A}{\'z}%
  10005. \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
  10006. \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
  10007. \DeclareUnicodeCharacter{017D}{\v{Z}}%
  10008. \DeclareUnicodeCharacter{017E}{\v{z}}%
  10009. \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
  10010. %
  10011. \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
  10012. \DeclareUnicodeCharacter{01C5}{D\v{z}}%
  10013. \DeclareUnicodeCharacter{01C6}{d\v{z}}%
  10014. \DeclareUnicodeCharacter{01C7}{LJ}%
  10015. \DeclareUnicodeCharacter{01C8}{Lj}%
  10016. \DeclareUnicodeCharacter{01C9}{lj}%
  10017. \DeclareUnicodeCharacter{01CA}{NJ}%
  10018. \DeclareUnicodeCharacter{01CB}{Nj}%
  10019. \DeclareUnicodeCharacter{01CC}{nj}%
  10020. \DeclareUnicodeCharacter{01CD}{\v{A}}%
  10021. \DeclareUnicodeCharacter{01CE}{\v{a}}%
  10022. \DeclareUnicodeCharacter{01CF}{\v{I}}%
  10023. %
  10024. \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
  10025. \DeclareUnicodeCharacter{01D1}{\v{O}}%
  10026. \DeclareUnicodeCharacter{01D2}{\v{o}}%
  10027. \DeclareUnicodeCharacter{01D3}{\v{U}}%
  10028. \DeclareUnicodeCharacter{01D4}{\v{u}}%
  10029. %
  10030. \DeclareUnicodeCharacter{01E2}{\={\AE}}%
  10031. \DeclareUnicodeCharacter{01E3}{\={\ae}}%
  10032. \DeclareUnicodeCharacter{01E6}{\v{G}}%
  10033. \DeclareUnicodeCharacter{01E7}{\v{g}}%
  10034. \DeclareUnicodeCharacter{01E8}{\v{K}}%
  10035. \DeclareUnicodeCharacter{01E9}{\v{k}}%
  10036. %
  10037. \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
  10038. \DeclareUnicodeCharacter{01F1}{DZ}%
  10039. \DeclareUnicodeCharacter{01F2}{Dz}%
  10040. \DeclareUnicodeCharacter{01F3}{dz}%
  10041. \DeclareUnicodeCharacter{01F4}{\'G}%
  10042. \DeclareUnicodeCharacter{01F5}{\'g}%
  10043. \DeclareUnicodeCharacter{01F8}{\`N}%
  10044. \DeclareUnicodeCharacter{01F9}{\`n}%
  10045. \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
  10046. \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
  10047. \DeclareUnicodeCharacter{01FE}{\'{\O}}%
  10048. \DeclareUnicodeCharacter{01FF}{\'{\o}}%
  10049. %
  10050. \DeclareUnicodeCharacter{021E}{\v{H}}%
  10051. \DeclareUnicodeCharacter{021F}{\v{h}}%
  10052. %
  10053. \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
  10054. \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
  10055. \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
  10056. \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
  10057. \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
  10058. \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
  10059. %
  10060. \DeclareUnicodeCharacter{0232}{\=Y}%
  10061. \DeclareUnicodeCharacter{0233}{\=y}%
  10062. \DeclareUnicodeCharacter{0237}{\dotless{j}}%
  10063. %
  10064. \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
  10065. %
  10066. % Greek letters upper case
  10067. \DeclareUnicodeCharacter{0391}{{\it A}}%
  10068. \DeclareUnicodeCharacter{0392}{{\it B}}%
  10069. \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
  10070. \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
  10071. \DeclareUnicodeCharacter{0395}{{\it E}}%
  10072. \DeclareUnicodeCharacter{0396}{{\it Z}}%
  10073. \DeclareUnicodeCharacter{0397}{{\it H}}%
  10074. \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
  10075. \DeclareUnicodeCharacter{0399}{{\it I}}%
  10076. \DeclareUnicodeCharacter{039A}{{\it K}}%
  10077. \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
  10078. \DeclareUnicodeCharacter{039C}{{\it M}}%
  10079. \DeclareUnicodeCharacter{039D}{{\it N}}%
  10080. \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
  10081. \DeclareUnicodeCharacter{039F}{{\it O}}%
  10082. \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
  10083. \DeclareUnicodeCharacter{03A1}{{\it P}}%
  10084. %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
  10085. \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
  10086. \DeclareUnicodeCharacter{03A4}{{\it T}}%
  10087. \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
  10088. \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
  10089. \DeclareUnicodeCharacter{03A7}{{\it X}}%
  10090. \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
  10091. \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
  10092. %
  10093. % Vowels with accents
  10094. \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
  10095. \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
  10096. \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
  10097. \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
  10098. \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
  10099. \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
  10100. %
  10101. % Standalone accent
  10102. \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
  10103. %
  10104. % Greek letters lower case
  10105. \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
  10106. \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
  10107. \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
  10108. \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
  10109. \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
  10110. \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
  10111. \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
  10112. \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
  10113. \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
  10114. \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
  10115. \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
  10116. \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
  10117. \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
  10118. \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
  10119. \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
  10120. \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
  10121. \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
  10122. \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
  10123. \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
  10124. \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
  10125. \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
  10126. \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
  10127. \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
  10128. \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
  10129. \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
  10130. %
  10131. % More Greek vowels with accents
  10132. \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
  10133. \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
  10134. \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
  10135. \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
  10136. \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
  10137. %
  10138. % Variant Greek letters
  10139. \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
  10140. \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
  10141. \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
  10142. %
  10143. \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
  10144. \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
  10145. \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
  10146. \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
  10147. \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
  10148. \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
  10149. \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
  10150. \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
  10151. \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
  10152. \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
  10153. \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
  10154. \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
  10155. %
  10156. \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
  10157. \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
  10158. %
  10159. \DeclareUnicodeCharacter{1E20}{\=G}%
  10160. \DeclareUnicodeCharacter{1E21}{\=g}%
  10161. \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
  10162. \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
  10163. \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
  10164. \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
  10165. \DeclareUnicodeCharacter{1E26}{\"H}%
  10166. \DeclareUnicodeCharacter{1E27}{\"h}%
  10167. %
  10168. \DeclareUnicodeCharacter{1E30}{\'K}%
  10169. \DeclareUnicodeCharacter{1E31}{\'k}%
  10170. \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
  10171. \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
  10172. \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
  10173. \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
  10174. \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
  10175. \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
  10176. \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
  10177. \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
  10178. \DeclareUnicodeCharacter{1E3E}{\'M}%
  10179. \DeclareUnicodeCharacter{1E3F}{\'m}%
  10180. %
  10181. \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
  10182. \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
  10183. \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
  10184. \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
  10185. \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
  10186. \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
  10187. \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
  10188. \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
  10189. \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
  10190. \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
  10191. %
  10192. \DeclareUnicodeCharacter{1E54}{\'P}%
  10193. \DeclareUnicodeCharacter{1E55}{\'p}%
  10194. \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
  10195. \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
  10196. \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
  10197. \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
  10198. \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
  10199. \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
  10200. \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
  10201. \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
  10202. %
  10203. \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
  10204. \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
  10205. \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
  10206. \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
  10207. \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
  10208. \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
  10209. \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
  10210. \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
  10211. \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
  10212. \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
  10213. %
  10214. \DeclareUnicodeCharacter{1E7C}{\~V}%
  10215. \DeclareUnicodeCharacter{1E7D}{\~v}%
  10216. \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
  10217. \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
  10218. %
  10219. \DeclareUnicodeCharacter{1E80}{\`W}%
  10220. \DeclareUnicodeCharacter{1E81}{\`w}%
  10221. \DeclareUnicodeCharacter{1E82}{\'W}%
  10222. \DeclareUnicodeCharacter{1E83}{\'w}%
  10223. \DeclareUnicodeCharacter{1E84}{\"W}%
  10224. \DeclareUnicodeCharacter{1E85}{\"w}%
  10225. \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
  10226. \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
  10227. \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
  10228. \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
  10229. \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
  10230. \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
  10231. \DeclareUnicodeCharacter{1E8C}{\"X}%
  10232. \DeclareUnicodeCharacter{1E8D}{\"x}%
  10233. \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
  10234. \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
  10235. %
  10236. \DeclareUnicodeCharacter{1E90}{\^Z}%
  10237. \DeclareUnicodeCharacter{1E91}{\^z}%
  10238. \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
  10239. \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
  10240. \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
  10241. \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
  10242. \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
  10243. \DeclareUnicodeCharacter{1E97}{\"t}%
  10244. \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
  10245. \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
  10246. %
  10247. \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
  10248. \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
  10249. %
  10250. \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
  10251. \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
  10252. \DeclareUnicodeCharacter{1EBC}{\~E}%
  10253. \DeclareUnicodeCharacter{1EBD}{\~e}%
  10254. %
  10255. \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
  10256. \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
  10257. \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
  10258. \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
  10259. %
  10260. \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
  10261. \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
  10262. %
  10263. \DeclareUnicodeCharacter{1EF2}{\`Y}%
  10264. \DeclareUnicodeCharacter{1EF3}{\`y}%
  10265. \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
  10266. %
  10267. \DeclareUnicodeCharacter{1EF8}{\~Y}%
  10268. \DeclareUnicodeCharacter{1EF9}{\~y}%
  10269. %
  10270. % Punctuation
  10271. \DeclareUnicodeCharacter{2013}{--}%
  10272. \DeclareUnicodeCharacter{2014}{---}%
  10273. \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
  10274. \DeclareUnicodeCharacter{2019}{\quoteright{}}%
  10275. \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
  10276. \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
  10277. \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
  10278. \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
  10279. \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
  10280. \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
  10281. \DeclareUnicodeCharacter{2022}{\bullet{}}%
  10282. \DeclareUnicodeCharacter{202F}{\thinspace}%
  10283. \DeclareUnicodeCharacter{2026}{\dots{}}%
  10284. \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
  10285. \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
  10286. %
  10287. \DeclareUnicodeCharacter{20AC}{\euro{}}%
  10288. %
  10289. \DeclareUnicodeCharacter{2192}{\expansion{}}%
  10290. \DeclareUnicodeCharacter{21D2}{\result{}}%
  10291. %
  10292. % Mathematical symbols
  10293. \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
  10294. \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
  10295. \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
  10296. \DeclareUnicodeCharacter{2212}{\minus{}}%
  10297. \DeclareUnicodeCharacter{2217}{\ast}%
  10298. \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
  10299. \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
  10300. \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
  10301. \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
  10302. \DeclareUnicodeCharacter{2261}{\equiv{}}%
  10303. \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
  10304. \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
  10305. \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
  10306. \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
  10307. %
  10308. \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
  10309. \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
  10310. \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
  10311. \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
  10312. \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
  10313. \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
  10314. \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
  10315. \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
  10316. \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
  10317. \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
  10318. \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
  10319. \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
  10320. \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
  10321. \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
  10322. \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
  10323. \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
  10324. \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
  10325. \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
  10326. \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
  10327. \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
  10328. \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
  10329. \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
  10330. \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
  10331. \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
  10332. \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
  10333. \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
  10334. \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
  10335. \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
  10336. \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
  10337. \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
  10338. \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
  10339. \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
  10340. \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
  10341. \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
  10342. \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
  10343. \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
  10344. \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
  10345. \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
  10346. \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
  10347. \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
  10348. \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
  10349. \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
  10350. \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
  10351. \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
  10352. \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
  10353. \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
  10354. \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
  10355. \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
  10356. \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
  10357. \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
  10358. \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
  10359. \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
  10360. \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
  10361. \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
  10362. \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
  10363. \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
  10364. \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
  10365. \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
  10366. \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
  10367. \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
  10368. \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
  10369. \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
  10370. \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
  10371. \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
  10372. \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
  10373. \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
  10374. \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
  10375. \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
  10376. \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
  10377. \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
  10378. \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
  10379. \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
  10380. \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
  10381. \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
  10382. \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
  10383. \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
  10384. \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
  10385. \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
  10386. \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
  10387. \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
  10388. \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
  10389. \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
  10390. \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
  10391. \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
  10392. \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
  10393. \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
  10394. \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
  10395. \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
  10396. \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
  10397. \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
  10398. \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
  10399. %
  10400. \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
  10401. \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
  10402. \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
  10403. \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
  10404. \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
  10405. \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
  10406. \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
  10407. \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
  10408. \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
  10409. \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
  10410. \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
  10411. \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
  10412. \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
  10413. \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
  10414. \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
  10415. \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
  10416. \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
  10417. \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
  10418. \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
  10419. \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
  10420. \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
  10421. \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
  10422. \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
  10423. \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
  10424. \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
  10425. \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
  10426. \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
  10427. \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
  10428. \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
  10429. %
  10430. \global\mathchardef\checkmark="1370% actually the square root sign
  10431. \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
  10432. }% end of \unicodechardefs
  10433. % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
  10434. % It makes the setting that replace UTF-8 byte sequence.
  10435. \def\utfeightchardefs{%
  10436. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
  10437. \unicodechardefs
  10438. }
  10439. % Whether the active definitions of non-ASCII characters expand to
  10440. % non-active tokens with the same character code. This is used to
  10441. % write characters literally, instead of using active definitions for
  10442. % printing the correct glyphs.
  10443. \newif\ifpassthroughchars
  10444. \passthroughcharsfalse
  10445. % For native Unicode handling (XeTeX and LuaTeX),
  10446. % provide a definition macro to replace/pass-through a Unicode character
  10447. %
  10448. \def\DeclareUnicodeCharacterNative#1#2{%
  10449. \catcode"#1=\active
  10450. \def\dodeclareunicodecharacternative##1##2##3{%
  10451. \begingroup
  10452. \uccode`\~="##2\relax
  10453. \uppercase{\gdef~}{%
  10454. \ifpassthroughchars
  10455. ##1%
  10456. \else
  10457. ##3%
  10458. \fi
  10459. }
  10460. \endgroup
  10461. }
  10462. \begingroup
  10463. \uccode`\.="#1\relax
  10464. \uppercase{\def\UTFNativeTmp{.}}%
  10465. \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
  10466. \endgroup
  10467. }
  10468. % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
  10469. % It activates the setting that replaces Unicode characters.
  10470. \def\nativeunicodechardefs{%
  10471. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
  10472. \unicodechardefs
  10473. }
  10474. % For native Unicode handling (XeTeX and LuaTeX),
  10475. % make the character token expand
  10476. % to the sequences given in \unicodechardefs for printing.
  10477. \def\DeclareUnicodeCharacterNativeAtU#1#2{%
  10478. \def\UTFAtUTmp{#2}
  10479. \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
  10480. }
  10481. % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
  10482. \def\nativeunicodechardefsatu{%
  10483. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
  10484. \unicodechardefs
  10485. }
  10486. % US-ASCII character definitions.
  10487. \def\asciichardefs{% nothing need be done
  10488. \relax
  10489. }
  10490. % define all Unicode characters we know about, for the sake of @U.
  10491. \iftxinativeunicodecapable
  10492. \nativeunicodechardefsatu
  10493. \else
  10494. \utfeightchardefs
  10495. \fi
  10496. % Make non-ASCII characters printable again for compatibility with
  10497. % existing Texinfo documents that may use them, even without declaring a
  10498. % document encoding.
  10499. %
  10500. \setnonasciicharscatcode \other
  10501. \message{formatting,}
  10502. \newdimen\defaultparindent \defaultparindent = 15pt
  10503. \chapheadingskip = 15pt plus 4pt minus 2pt
  10504. \secheadingskip = 12pt plus 3pt minus 2pt
  10505. \subsecheadingskip = 9pt plus 2pt minus 2pt
  10506. % Prevent underfull vbox error messages.
  10507. \vbadness = 10000
  10508. % Don't be very finicky about underfull hboxes, either.
  10509. \hbadness = 6666
  10510. % Following George Bush, get rid of widows and orphans.
  10511. \widowpenalty=10000
  10512. \clubpenalty=10000
  10513. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  10514. % using an old version of TeX, don't do anything. We want the amount of
  10515. % stretch added to depend on the line length, hence the dependence on
  10516. % \hsize. We call this whenever the paper size is set.
  10517. %
  10518. \def\setemergencystretch{%
  10519. \ifx\emergencystretch\thisisundefined
  10520. % Allow us to assign to \emergencystretch anyway.
  10521. \def\emergencystretch{\dimen0}%
  10522. \else
  10523. \emergencystretch = .15\hsize
  10524. \fi
  10525. }
  10526. % Parameters in order: 1) textheight; 2) textwidth;
  10527. % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
  10528. % 7) physical page height; 8) physical page width.
  10529. %
  10530. % We also call \setleading{\textleading}, so the caller should define
  10531. % \textleading. The caller should also set \parskip.
  10532. %
  10533. \def\internalpagesizes#1#2#3#4#5#6#7#8{%
  10534. \voffset = #3\relax
  10535. \topskip = #6\relax
  10536. \splittopskip = \topskip
  10537. %
  10538. \vsize = #1\relax
  10539. \advance\vsize by \topskip
  10540. \outervsize = \vsize
  10541. \advance\outervsize by 2\topandbottommargin
  10542. \txipageheight = \vsize
  10543. %
  10544. \hsize = #2\relax
  10545. \outerhsize = \hsize
  10546. \advance\outerhsize by 0.5in
  10547. \txipagewidth = \hsize
  10548. %
  10549. \normaloffset = #4\relax
  10550. \bindingoffset = #5\relax
  10551. %
  10552. \ifpdf
  10553. \pdfpageheight #7\relax
  10554. \pdfpagewidth #8\relax
  10555. % if we don't reset these, they will remain at "1 true in" of
  10556. % whatever layout pdftex was dumped with.
  10557. \pdfhorigin = 1 true in
  10558. \pdfvorigin = 1 true in
  10559. \else
  10560. \ifx\XeTeXrevision\thisisundefined
  10561. \special{papersize=#8,#7}%
  10562. \else
  10563. \pdfpageheight #7\relax
  10564. \pdfpagewidth #8\relax
  10565. % XeTeX does not have \pdfhorigin and \pdfvorigin.
  10566. \fi
  10567. \fi
  10568. %
  10569. \setleading{\textleading}
  10570. %
  10571. \parindent = \defaultparindent
  10572. \setemergencystretch
  10573. }
  10574. % @letterpaper (the default).
  10575. \def\letterpaper{{\globaldefs = 1
  10576. \parskip = 3pt plus 2pt minus 1pt
  10577. \textleading = 13.2pt
  10578. %
  10579. % If page is nothing but text, make it come out even.
  10580. \internalpagesizes{607.2pt}{6in}% that's 46 lines
  10581. {\voffset}{.25in}%
  10582. {\bindingoffset}{36pt}%
  10583. {11in}{8.5in}%
  10584. }}
  10585. % Use @smallbook to reset parameters for 7x9.25 trim size.
  10586. \def\smallbook{{\globaldefs = 1
  10587. \parskip = 2pt plus 1pt
  10588. \textleading = 12pt
  10589. %
  10590. \internalpagesizes{7.5in}{5in}%
  10591. {-.2in}{0in}%
  10592. {\bindingoffset}{16pt}%
  10593. {9.25in}{7in}%
  10594. %
  10595. \lispnarrowing = 0.3in
  10596. \tolerance = 700
  10597. \contentsrightmargin = 0pt
  10598. \defbodyindent = .5cm
  10599. }}
  10600. % Use @smallerbook to reset parameters for 6x9 trim size.
  10601. % (Just testing, parameters still in flux.)
  10602. \def\smallerbook{{\globaldefs = 1
  10603. \parskip = 1.5pt plus 1pt
  10604. \textleading = 12pt
  10605. %
  10606. \internalpagesizes{7.4in}{4.8in}%
  10607. {-.2in}{-.4in}%
  10608. {0pt}{14pt}%
  10609. {9in}{6in}%
  10610. %
  10611. \lispnarrowing = 0.25in
  10612. \tolerance = 700
  10613. \contentsrightmargin = 0pt
  10614. \defbodyindent = .4cm
  10615. }}
  10616. % Use @afourpaper to print on European A4 paper.
  10617. \def\afourpaper{{\globaldefs = 1
  10618. \parskip = 3pt plus 2pt minus 1pt
  10619. \textleading = 13.2pt
  10620. %
  10621. % Double-side printing via postscript on Laserjet 4050
  10622. % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  10623. % To change the settings for a different printer or situation, adjust
  10624. % \normaloffset until the front-side and back-side texts align. Then
  10625. % do the same for \bindingoffset. You can set these for testing in
  10626. % your texinfo source file like this:
  10627. % @tex
  10628. % \global\normaloffset = -6mm
  10629. % \global\bindingoffset = 10mm
  10630. % @end tex
  10631. \internalpagesizes{673.2pt}{160mm}% that's 51 lines
  10632. {\voffset}{\hoffset}%
  10633. {\bindingoffset}{44pt}%
  10634. {297mm}{210mm}%
  10635. %
  10636. \tolerance = 700
  10637. \contentsrightmargin = 0pt
  10638. \defbodyindent = 5mm
  10639. }}
  10640. % Use @afivepaper to print on European A5 paper.
  10641. % From romildo@urano.iceb.ufop.br, 2 July 2000.
  10642. % He also recommends making @example and @lisp be small.
  10643. \def\afivepaper{{\globaldefs = 1
  10644. \parskip = 2pt plus 1pt minus 0.1pt
  10645. \textleading = 12.5pt
  10646. %
  10647. \internalpagesizes{160mm}{120mm}%
  10648. {\voffset}{\hoffset}%
  10649. {\bindingoffset}{8pt}%
  10650. {210mm}{148mm}%
  10651. %
  10652. \lispnarrowing = 0.2in
  10653. \tolerance = 800
  10654. \contentsrightmargin = 0pt
  10655. \defbodyindent = 2mm
  10656. \tableindent = 12mm
  10657. }}
  10658. % A specific text layout, 24x15cm overall, intended for A4 paper.
  10659. \def\afourlatex{{\globaldefs = 1
  10660. \afourpaper
  10661. \internalpagesizes{237mm}{150mm}%
  10662. {\voffset}{4.6mm}%
  10663. {\bindingoffset}{7mm}%
  10664. {297mm}{210mm}%
  10665. %
  10666. % Must explicitly reset to 0 because we call \afourpaper.
  10667. \globaldefs = 0
  10668. }}
  10669. % Use @afourwide to print on A4 paper in landscape format.
  10670. \def\afourwide{{\globaldefs = 1
  10671. \afourpaper
  10672. \internalpagesizes{241mm}{165mm}%
  10673. {\voffset}{-2.95mm}%
  10674. {\bindingoffset}{7mm}%
  10675. {297mm}{210mm}%
  10676. \globaldefs = 0
  10677. }}
  10678. % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  10679. % Perhaps we should allow setting the margins, \topskip, \parskip,
  10680. % and/or leading, also. Or perhaps we should compute them somehow.
  10681. %
  10682. \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
  10683. \def\pagesizesyyy#1,#2,#3\finish{{%
  10684. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  10685. \globaldefs = 1
  10686. %
  10687. \parskip = 3pt plus 2pt minus 1pt
  10688. \setleading{\textleading}%
  10689. %
  10690. \dimen0 = #1\relax
  10691. \advance\dimen0 by \voffset
  10692. \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
  10693. %
  10694. \dimen2 = \hsize
  10695. \advance\dimen2 by \normaloffset
  10696. \advance\dimen2 by 1in % reference point is 1 inch from left edge of page
  10697. %
  10698. \internalpagesizes{#1}{\hsize}%
  10699. {\voffset}{\normaloffset}%
  10700. {\bindingoffset}{44pt}%
  10701. {\dimen0}{\dimen2}%
  10702. }}
  10703. % Set default to letter.
  10704. %
  10705. \letterpaper
  10706. % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
  10707. \hfuzz = 1pt
  10708. \message{and turning on texinfo input format.}
  10709. \def^^L{\par} % remove \outer, so ^L can appear in an @comment
  10710. % DEL is a comment character, in case @c does not suffice.
  10711. \catcode`\^^? = 14
  10712. % Define macros to output various characters with catcode for normal text.
  10713. \catcode`\"=\other \def\normaldoublequote{"}
  10714. \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
  10715. \catcode`\+=\other \def\normalplus{+}
  10716. \catcode`\<=\other \def\normalless{<}
  10717. \catcode`\>=\other \def\normalgreater{>}
  10718. \catcode`\^=\other \def\normalcaret{^}
  10719. \catcode`\_=\other \def\normalunderscore{_}
  10720. \catcode`\|=\other \def\normalverticalbar{|}
  10721. \catcode`\~=\other \def\normaltilde{~}
  10722. % This macro is used to make a character print one way in \tt
  10723. % (where it can probably be output as-is), and another way in other fonts,
  10724. % where something hairier probably needs to be done.
  10725. %
  10726. % #1 is what to print if we are indeed using \tt; #2 is what to print
  10727. % otherwise. Since all the Computer Modern typewriter fonts have zero
  10728. % interword stretch (and shrink), and it is reasonable to expect all
  10729. % typewriter fonts to have this, we can check that font parameter.
  10730. %
  10731. \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
  10732. % Same as above, but check for italic font. Actually this also catches
  10733. % non-italic slanted fonts since it is impossible to distinguish them from
  10734. % italic fonts. But since this is only used by $ and it uses \sl anyway
  10735. % this is not a problem.
  10736. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
  10737. % Set catcodes for Texinfo file
  10738. % Active characters for printing the wanted glyph.
  10739. % Most of these we simply print from the \tt font, but for some, we can
  10740. % use math or other variants that look better in normal text.
  10741. %
  10742. \catcode`\"=\active
  10743. \def\activedoublequote{{\tt\char34}}
  10744. \let"=\activedoublequote
  10745. \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
  10746. \chardef\hatchar=`\^
  10747. \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
  10748. \catcode`\_=\active
  10749. \def_{\ifusingtt\normalunderscore\_}
  10750. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
  10751. \let\realunder=_
  10752. \catcode`\|=\active \def|{{\tt\char124}}
  10753. \chardef \less=`\<
  10754. \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
  10755. \chardef \gtr=`\>
  10756. \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
  10757. \catcode`\+=\active \def+{{\tt \char 43}}
  10758. \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  10759. \catcode`\-=\active \let-=\normaldash
  10760. % used for headline/footline in the output routine, in case the page
  10761. % breaks in the middle of an @tex block.
  10762. \def\texinfochars{%
  10763. \let< = \activeless
  10764. \let> = \activegtr
  10765. \let~ = \activetilde
  10766. \let^ = \activehat
  10767. \markupsetuplqdefault \markupsetuprqdefault
  10768. \let\b = \strong
  10769. \let\i = \smartitalic
  10770. % in principle, all other definitions in \tex have to be undone too.
  10771. }
  10772. % Used sometimes to turn off (effectively) the active characters even after
  10773. % parsing them.
  10774. \def\turnoffactive{%
  10775. \normalturnoffactive
  10776. \otherbackslash
  10777. }
  10778. \catcode`\@=0
  10779. % \backslashcurfont outputs one backslash character in current font,
  10780. % as in \char`\\.
  10781. \global\chardef\backslashcurfont=`\\
  10782. \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
  10783. % \realbackslash is an actual character `\' with catcode other, and
  10784. % \doublebackslash is two of them (for the pdf outlines).
  10785. {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
  10786. % In Texinfo, backslash is an active character; it prints the backslash
  10787. % in fixed width font.
  10788. \catcode`\\=\active % @ for escape char from now on.
  10789. % Print a typewriter backslash. For math mode, we can't simply use
  10790. % \backslashcurfont: the story here is that in math mode, the \char
  10791. % of \backslashcurfont ends up printing the roman \ from the math symbol
  10792. % font (because \char in math mode uses the \mathcode, and plain.tex
  10793. % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
  10794. % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
  10795. % ignored family value; char position "5C). We can't use " for the
  10796. % usual hex value because it has already been made active.
  10797. @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
  10798. @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
  10799. % \rawbackslash defines an active \ to do \backslashcurfont.
  10800. % \otherbackslash defines an active \ to be a literal `\' character with
  10801. % catcode other. We switch back and forth between these.
  10802. @gdef@rawbackslash{@let\=@backslashcurfont}
  10803. @gdef@otherbackslash{@let\=@realbackslash}
  10804. % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  10805. % the literal character `\'.
  10806. %
  10807. {@catcode`- = @active
  10808. @gdef@normalturnoffactive{%
  10809. @passthroughcharstrue
  10810. @let-=@normaldash
  10811. @let"=@normaldoublequote
  10812. @let$=@normaldollar %$ font-lock fix
  10813. @let+=@normalplus
  10814. @let<=@normalless
  10815. @let>=@normalgreater
  10816. @let^=@normalcaret
  10817. @let_=@normalunderscore
  10818. @let|=@normalverticalbar
  10819. @let~=@normaltilde
  10820. @let\=@ttbackslash
  10821. @markupsetuplqdefault
  10822. @markupsetuprqdefault
  10823. @unsepspaces
  10824. }
  10825. }
  10826. % If a .fmt file is being used, characters that might appear in a file
  10827. % name cannot be active until we have parsed the command line.
  10828. % So turn them off again, and have @fixbackslash turn them back on.
  10829. @catcode`+=@other @catcode`@_=@other
  10830. % \enablebackslashhack - allow file to begin `\input texinfo'
  10831. %
  10832. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  10833. % That is what \eatinput is for; after that, the `\' should revert to printing
  10834. % a backslash.
  10835. % If the file did not have a `\input texinfo', then it is turned off after
  10836. % the first line; otherwise the first `\' in the file would cause an error.
  10837. % This is used on the very last line of this file, texinfo.tex.
  10838. % We also use @c to call @fixbackslash, in case ends of lines are hidden.
  10839. {
  10840. @catcode`@^=7
  10841. @catcode`@^^M=13@gdef@enablebackslashhack{%
  10842. @global@let\ = @eatinput%
  10843. @catcode`@^^M=13%
  10844. @def@c{@fixbackslash@c}%
  10845. % Definition for the newline at the end of this file.
  10846. @def ^^M{@let^^M@secondlinenl}%
  10847. % Definition for a newline in the main Texinfo file.
  10848. @gdef @secondlinenl{@fixbackslash}%
  10849. % In case the first line has a whole-line command on it
  10850. @let@originalparsearg@parsearg
  10851. @def@parsearg{@fixbackslash@originalparsearg}
  10852. }}
  10853. {@catcode`@^=7 @catcode`@^^M=13%
  10854. @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
  10855. % Emergency active definition of newline, in case an active newline token
  10856. % appears by mistake.
  10857. {@catcode`@^=7 @catcode13=13%
  10858. @gdef@enableemergencynewline{%
  10859. @gdef^^M{%
  10860. @par%
  10861. %<warning: active newline>@par%
  10862. }}}
  10863. @gdef@fixbackslash{%
  10864. @ifx\@eatinput @let\ = @ttbackslash @fi
  10865. @catcode13=5 % regular end of line
  10866. @enableemergencynewline
  10867. @let@c=@texinfoc
  10868. @let@parsearg@originalparsearg
  10869. % Also turn back on active characters that might appear in the input
  10870. % file name, in case not using a pre-dumped format.
  10871. @catcode`+=@active
  10872. @catcode`@_=@active
  10873. %
  10874. % If texinfo.cnf is present on the system, read it.
  10875. % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
  10876. % called at the beginning of every Texinfo file. Not opening texinfo.cnf
  10877. % directly in this file, texinfo.tex, makes it possible to make a format
  10878. % file for Texinfo.
  10879. %
  10880. @openin 1 texinfo.cnf
  10881. @ifeof 1 @else @input texinfo.cnf @fi
  10882. @closein 1
  10883. }
  10884. % Say @foo, not \foo, in error messages.
  10885. @escapechar = `@@
  10886. % These (along with & and #) are made active for url-breaking, so need
  10887. % active definitions as the normal characters.
  10888. @def@normaldot{.}
  10889. @def@normalquest{?}
  10890. @def@normalslash{/}
  10891. % These look ok in all fonts, so just make them not special.
  10892. % @hashchar{} gets its own user-level command, because of #line.
  10893. @catcode`@& = @other @def@normalamp{&}
  10894. @catcode`@# = @other @def@normalhash{#}
  10895. @catcode`@% = @other @def@normalpercent{%}
  10896. @let @hashchar = @normalhash
  10897. @c Finally, make ` and ' active, so that txicodequoteundirected and
  10898. @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
  10899. @c don't make ` and ' active, @code will not get them as active chars.
  10900. @c Do this last of all since we use ` in the previous @catcode assignments.
  10901. @catcode`@'=@active
  10902. @catcode`@`=@active
  10903. @markupsetuplqdefault
  10904. @markupsetuprqdefault
  10905. @c Local variables:
  10906. @c eval: (add-hook 'write-file-hooks 'time-stamp)
  10907. @c page-delimiter: "^\\\\message\\|emacs-page"
  10908. @c time-stamp-start: "def\\\\texinfoversion{"
  10909. @c time-stamp-format: "%:y-%02m-%02d.%02H"
  10910. @c time-stamp-end: "}"
  10911. @c End:
  10912. @c vim:sw=2:
  10913. @enablebackslashhack