texinfo.tex 372 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676
  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{2017-04-14.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
  11. % Free Software Foundation, Inc.
  12. %
  13. % This texinfo.tex file is free software: you can redistribute it and/or
  14. % modify it under the terms of the GNU General Public License as
  15. % published by the Free Software Foundation, either version 3 of the
  16. % License, or (at your option) any later version.
  17. %
  18. % This texinfo.tex file is distributed in the hope that it will be
  19. % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  20. % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. % General Public License for more details.
  22. %
  23. % You should have received a copy of the GNU General Public License
  24. % along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. %
  26. % As a special exception, when this file is read by TeX when processing
  27. % a Texinfo source document, you may use the result without
  28. % restriction. This Exception is an additional permission under section 7
  29. % of the GNU General Public License, version 3 ("GPLv3").
  30. %
  31. % Please try the latest version of texinfo.tex before submitting bug
  32. % reports; you can get the latest version from:
  33. % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
  34. % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
  35. % http://www.gnu.org/software/texinfo/ (the Texinfo home page)
  36. % The texinfo.tex in any given distribution could well be out
  37. % of date, so if that's what you're using, please check.
  38. %
  39. % Send bug reports to bug-texinfo@gnu.org. Please include including a
  40. % complete document in each bug report with which we can reproduce the
  41. % problem. Patches are, of course, greatly appreciated.
  42. %
  43. % To process a Texinfo manual with TeX, it's most reliable to use the
  44. % texi2dvi shell script that comes with the distribution. For a simple
  45. % manual foo.texi, however, you can get away with this:
  46. % tex foo.texi
  47. % texindex foo.??
  48. % tex foo.texi
  49. % tex foo.texi
  50. % dvips foo.dvi -o # or whatever; this makes foo.ps.
  51. % The extra TeX runs get the cross-reference information correct.
  52. % Sometimes one run after texindex suffices, and sometimes you need more
  53. % than two; texi2dvi does it as many times as necessary.
  54. %
  55. % It is possible to adapt texinfo.tex for other languages, to some
  56. % extent. You can get the existing language-specific files from the
  57. % full Texinfo distribution.
  58. %
  59. % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
  60. \message{Loading texinfo [version \texinfoversion]:}
  61. % If in a .fmt file, print the version number
  62. % and turn on active characters that we couldn't do earlier because
  63. % they might have appeared in the input file name.
  64. \everyjob{\message{[Texinfo version \texinfoversion]}%
  65. \catcode`+=\active \catcode`\_=\active}
  66. % LaTeX's \typeout. This ensures that the messages it is used for
  67. % are identical in format to the corresponding ones from latex/pdflatex.
  68. \def\typeout{\immediate\write17}%
  69. \chardef\other=12
  70. % We never want plain's \outer definition of \+ in Texinfo.
  71. % For @tex, we can use \tabalign.
  72. \let\+ = \relax
  73. % Save some plain tex macros whose names we will redefine.
  74. \let\ptexb=\b
  75. \let\ptexbullet=\bullet
  76. \let\ptexc=\c
  77. \let\ptexcomma=\,
  78. \let\ptexdot=\.
  79. \let\ptexdots=\dots
  80. \let\ptexend=\end
  81. \let\ptexequiv=\equiv
  82. \let\ptexexclam=\!
  83. \let\ptexfootnote=\footnote
  84. \let\ptexgtr=>
  85. \let\ptexhat=^
  86. \let\ptexi=\i
  87. \let\ptexindent=\indent
  88. \let\ptexinsert=\insert
  89. \let\ptexlbrace=\{
  90. \let\ptexless=<
  91. \let\ptexnewwrite\newwrite
  92. \let\ptexnoindent=\noindent
  93. \let\ptexplus=+
  94. \let\ptexraggedright=\raggedright
  95. \let\ptexrbrace=\}
  96. \let\ptexslash=\/
  97. \let\ptexsp=\sp
  98. \let\ptexstar=\*
  99. \let\ptexsup=\sup
  100. \let\ptext=\t
  101. \let\ptextop=\top
  102. {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
  103. % If this character appears in an error message or help string, it
  104. % starts a new line in the output.
  105. \newlinechar = `^^J
  106. % Use TeX 3.0's \inputlineno to get the line number, for better error
  107. % messages, but if we're using an old version of TeX, don't do anything.
  108. %
  109. \ifx\inputlineno\thisisundefined
  110. \let\linenumber = \empty % Pre-3.0.
  111. \else
  112. \def\linenumber{l.\the\inputlineno:\space}
  113. \fi
  114. % Set up fixed words for English if not already set.
  115. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
  116. \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
  117. \ifx\putworderror\undefined \gdef\putworderror{error}\fi
  118. \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
  119. \ifx\putwordin\undefined \gdef\putwordin{in}\fi
  120. \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
  121. \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
  122. \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
  123. \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
  124. \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
  125. \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
  126. \ifx\putwordof\undefined \gdef\putwordof{of}\fi
  127. \ifx\putwordon\undefined \gdef\putwordon{on}\fi
  128. \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
  129. \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
  130. \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
  131. \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
  132. \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
  133. \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
  134. \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
  135. %
  136. \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
  137. \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
  138. \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
  139. \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
  140. \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
  141. \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
  142. \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
  143. \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
  144. \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
  145. \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
  146. \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
  147. \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
  148. %
  149. \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
  150. \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
  151. \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
  152. \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
  153. \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
  154. % Give the space character the catcode for a space.
  155. \def\spaceisspace{\catcode`\ =10\relax}
  156. % 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 title page (20.4pt):
  2119. \def\titlenominalsize{20pt}
  2120. \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
  2121. \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
  2122. \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
  2123. \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
  2124. \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
  2125. \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
  2126. \let\titlebf=\titlerm
  2127. \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
  2128. \font\titlei=cmmi12 scaled \magstep3
  2129. \font\titlesy=cmsy10 scaled \magstep4
  2130. \def\titleecsize{2074}
  2131. % Chapter (and unnumbered) fonts (17.28pt).
  2132. \def\chapnominalsize{17pt}
  2133. \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
  2134. \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
  2135. \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
  2136. \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
  2137. \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
  2138. \setfont\chapsf\sfbshape{17}{1000}{OT1}
  2139. \let\chapbf=\chaprm
  2140. \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
  2141. \font\chapi=cmmi12 scaled \magstep2
  2142. \font\chapsy=cmsy10 scaled \magstep3
  2143. \def\chapecsize{1728}
  2144. % Section fonts (14.4pt).
  2145. \def\secnominalsize{14pt}
  2146. \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
  2147. \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
  2148. \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
  2149. \setfont\secsl\slbshape{10}{\magstep2}{OT1}
  2150. \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
  2151. \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
  2152. \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
  2153. \let\secbf\secrm
  2154. \setfont\secsc\scbshape{10}{\magstep2}{OT1}
  2155. \font\seci=cmmi12 scaled \magstep1
  2156. \font\secsy=cmsy10 scaled \magstep2
  2157. \def\sececsize{1440}
  2158. % Subsection fonts (13.15pt).
  2159. \def\ssecnominalsize{13pt}
  2160. \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
  2161. \setfont\ssecit\itbshape{10}{1315}{OT1IT}
  2162. \setfont\ssecsl\slbshape{10}{1315}{OT1}
  2163. \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
  2164. \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
  2165. \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
  2166. \let\ssecbf\ssecrm
  2167. \setfont\ssecsc\scbshape{10}{1315}{OT1}
  2168. \font\sseci=cmmi12 scaled \magstephalf
  2169. \font\ssecsy=cmsy10 scaled 1315
  2170. \def\ssececsize{1200}
  2171. % Reduced fonts for @acronym in text (10pt).
  2172. \def\reducednominalsize{10pt}
  2173. \setfont\reducedrm\rmshape{10}{1000}{OT1}
  2174. \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
  2175. \setfont\reducedbf\bfshape{10}{1000}{OT1}
  2176. \setfont\reducedit\itshape{10}{1000}{OT1IT}
  2177. \setfont\reducedsl\slshape{10}{1000}{OT1}
  2178. \setfont\reducedsf\sfshape{10}{1000}{OT1}
  2179. \setfont\reducedsc\scshape{10}{1000}{OT1}
  2180. \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
  2181. \font\reducedi=cmmi10
  2182. \font\reducedsy=cmsy10
  2183. \def\reducedecsize{1000}
  2184. \textleading = 13.2pt % line spacing for 11pt CM
  2185. \textfonts % reset the current fonts
  2186. \rm
  2187. } % end of 11pt text font size definitions, \definetextfontsizexi
  2188. % Definitions to make the main text be 10pt Computer Modern, with
  2189. % section, chapter, etc., sizes following suit. This is for the GNU
  2190. % Press printing of the Emacs 22 manual. Maybe other manuals in the
  2191. % future. Used with @smallbook, which sets the leading to 12pt.
  2192. %
  2193. \def\definetextfontsizex{%
  2194. % Text fonts (10pt).
  2195. \def\textnominalsize{10pt}
  2196. \edef\mainmagstep{1000}
  2197. \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
  2198. \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
  2199. \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
  2200. \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
  2201. \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
  2202. \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
  2203. \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
  2204. \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
  2205. \font\texti=cmmi10 scaled \mainmagstep
  2206. \font\textsy=cmsy10 scaled \mainmagstep
  2207. \def\textecsize{1000}
  2208. % A few fonts for @defun names and args.
  2209. \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
  2210. \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
  2211. \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
  2212. \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
  2213. \def\df{\let\ttfont=\deftt \let\bffont = \defbf
  2214. \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
  2215. % Fonts for indices, footnotes, small examples (9pt).
  2216. \def\smallnominalsize{9pt}
  2217. \setfont\smallrm\rmshape{9}{1000}{OT1}
  2218. \setfont\smalltt\ttshape{9}{1000}{OT1TT}
  2219. \setfont\smallbf\bfshape{10}{900}{OT1}
  2220. \setfont\smallit\itshape{9}{1000}{OT1IT}
  2221. \setfont\smallsl\slshape{9}{1000}{OT1}
  2222. \setfont\smallsf\sfshape{9}{1000}{OT1}
  2223. \setfont\smallsc\scshape{10}{900}{OT1}
  2224. \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
  2225. \font\smalli=cmmi9
  2226. \font\smallsy=cmsy9
  2227. \def\smallecsize{0900}
  2228. % Fonts for small examples (8pt).
  2229. \def\smallernominalsize{8pt}
  2230. \setfont\smallerrm\rmshape{8}{1000}{OT1}
  2231. \setfont\smallertt\ttshape{8}{1000}{OT1TT}
  2232. \setfont\smallerbf\bfshape{10}{800}{OT1}
  2233. \setfont\smallerit\itshape{8}{1000}{OT1IT}
  2234. \setfont\smallersl\slshape{8}{1000}{OT1}
  2235. \setfont\smallersf\sfshape{8}{1000}{OT1}
  2236. \setfont\smallersc\scshape{10}{800}{OT1}
  2237. \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
  2238. \font\smalleri=cmmi8
  2239. \font\smallersy=cmsy8
  2240. \def\smallerecsize{0800}
  2241. % Fonts for title page (20.4pt):
  2242. \def\titlenominalsize{20pt}
  2243. \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
  2244. \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
  2245. \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
  2246. \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
  2247. \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
  2248. \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
  2249. \let\titlebf=\titlerm
  2250. \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
  2251. \font\titlei=cmmi12 scaled \magstep3
  2252. \font\titlesy=cmsy10 scaled \magstep4
  2253. \def\titleecsize{2074}
  2254. % Chapter fonts (14.4pt).
  2255. \def\chapnominalsize{14pt}
  2256. \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
  2257. \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
  2258. \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
  2259. \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
  2260. \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
  2261. \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
  2262. \let\chapbf\chaprm
  2263. \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
  2264. \font\chapi=cmmi12 scaled \magstep1
  2265. \font\chapsy=cmsy10 scaled \magstep2
  2266. \def\chapecsize{1440}
  2267. % Section fonts (12pt).
  2268. \def\secnominalsize{12pt}
  2269. \setfont\secrm\rmbshape{12}{1000}{OT1}
  2270. \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
  2271. \setfont\secsl\slbshape{10}{\magstep1}{OT1}
  2272. \setfont\sectt\ttbshape{12}{1000}{OT1TT}
  2273. \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
  2274. \setfont\secsf\sfbshape{12}{1000}{OT1}
  2275. \let\secbf\secrm
  2276. \setfont\secsc\scbshape{10}{\magstep1}{OT1}
  2277. \font\seci=cmmi12
  2278. \font\secsy=cmsy10 scaled \magstep1
  2279. \def\sececsize{1200}
  2280. % Subsection fonts (10pt).
  2281. \def\ssecnominalsize{10pt}
  2282. \setfont\ssecrm\rmbshape{10}{1000}{OT1}
  2283. \setfont\ssecit\itbshape{10}{1000}{OT1IT}
  2284. \setfont\ssecsl\slbshape{10}{1000}{OT1}
  2285. \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
  2286. \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
  2287. \setfont\ssecsf\sfbshape{10}{1000}{OT1}
  2288. \let\ssecbf\ssecrm
  2289. \setfont\ssecsc\scbshape{10}{1000}{OT1}
  2290. \font\sseci=cmmi10
  2291. \font\ssecsy=cmsy10
  2292. \def\ssececsize{1000}
  2293. % Reduced fonts for @acronym in text (9pt).
  2294. \def\reducednominalsize{9pt}
  2295. \setfont\reducedrm\rmshape{9}{1000}{OT1}
  2296. \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
  2297. \setfont\reducedbf\bfshape{10}{900}{OT1}
  2298. \setfont\reducedit\itshape{9}{1000}{OT1IT}
  2299. \setfont\reducedsl\slshape{9}{1000}{OT1}
  2300. \setfont\reducedsf\sfshape{9}{1000}{OT1}
  2301. \setfont\reducedsc\scshape{10}{900}{OT1}
  2302. \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
  2303. \font\reducedi=cmmi9
  2304. \font\reducedsy=cmsy9
  2305. \def\reducedecsize{0900}
  2306. \divide\parskip by 2 % reduce space between paragraphs
  2307. \textleading = 12pt % line spacing for 10pt CM
  2308. \textfonts % reset the current fonts
  2309. \rm
  2310. } % end of 10pt text font size definitions, \definetextfontsizex
  2311. % Fonts for short table of contents.
  2312. \setfont\shortcontrm\rmshape{12}{1000}{OT1}
  2313. \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
  2314. \setfont\shortcontsl\slshape{12}{1000}{OT1}
  2315. \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
  2316. % We provide the user-level command
  2317. % @fonttextsize 10
  2318. % (or 11) to redefine the text font size. pt is assumed.
  2319. %
  2320. \def\xiword{11}
  2321. \def\xword{10}
  2322. \def\xwordpt{10pt}
  2323. %
  2324. \parseargdef\fonttextsize{%
  2325. \def\textsizearg{#1}%
  2326. %\wlog{doing @fonttextsize \textsizearg}%
  2327. %
  2328. % Set \globaldefs so that documents can use this inside @tex, since
  2329. % makeinfo 4.8 does not support it, but we need it nonetheless.
  2330. %
  2331. \begingroup \globaldefs=1
  2332. \ifx\textsizearg\xword \definetextfontsizex
  2333. \else \ifx\textsizearg\xiword \definetextfontsizexi
  2334. \else
  2335. \errhelp=\EMsimple
  2336. \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
  2337. \fi\fi
  2338. \endgroup
  2339. }
  2340. %
  2341. % Change the current font style to #1, remembering it in \curfontstyle.
  2342. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
  2343. % italics, not bold italics.
  2344. %
  2345. \def\setfontstyle#1{%
  2346. \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
  2347. \csname #1font\endcsname % change the current font
  2348. }
  2349. \def\rm{\fam=0 \setfontstyle{rm}}
  2350. \def\it{\fam=\itfam \setfontstyle{it}}
  2351. \def\sl{\fam=\slfam \setfontstyle{sl}}
  2352. \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
  2353. \def\tt{\fam=\ttfam \setfontstyle{tt}}
  2354. % Texinfo sort of supports the sans serif font style, which plain TeX does not.
  2355. % So we set up a \sf.
  2356. \newfam\sffam
  2357. \def\sf{\fam=\sffam \setfontstyle{sf}}
  2358. % We don't need math for this font style.
  2359. \def\ttsl{\setfontstyle{ttsl}}
  2360. % In order for the font changes to affect most math symbols and letters,
  2361. % we have to define the \textfont of the standard families. We don't
  2362. % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
  2363. %
  2364. \def\resetmathfonts{%
  2365. \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
  2366. \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
  2367. \textfont\ttfam=\ttfont \textfont\sffam=\sffont
  2368. }
  2369. %
  2370. % The font-changing commands (all called \...fonts) redefine the meanings
  2371. % of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
  2372. % to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
  2373. % commands hardwire \STYLEfont to set the current font.
  2374. %
  2375. % Each font-changing command also sets the names \lsize (one size lower)
  2376. % and \lllsize (three sizes lower). These relative commands are used
  2377. % in, e.g., the LaTeX logo and acronyms.
  2378. %
  2379. % This all needs generalizing, badly.
  2380. %
  2381. \def\assignfonts#1{%
  2382. \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
  2383. \expandafter\let\expandafter\itfont\csname #1it\endcsname
  2384. \expandafter\let\expandafter\slfont\csname #1sl\endcsname
  2385. \expandafter\let\expandafter\bffont\csname #1bf\endcsname
  2386. \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
  2387. \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
  2388. \expandafter\let\expandafter\sffont \csname #1sf\endcsname
  2389. \expandafter\let\expandafter\ifont \csname #1i\endcsname
  2390. \expandafter\let\expandafter\syfont \csname #1sy\endcsname
  2391. \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
  2392. }
  2393. \newif\ifrmisbold
  2394. % Select smaller font size with the current style. Used to change font size
  2395. % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
  2396. % normal roman text, also use bold fonts for roman text in the smaller size.
  2397. \def\switchtolllsize{%
  2398. \expandafter\assignfonts\expandafter{\lllsize}%
  2399. \ifrmisbold
  2400. \let\rmfont\bffont
  2401. \fi
  2402. \csname\curfontstyle\endcsname
  2403. }%
  2404. \def\switchtolsize{%
  2405. \expandafter\assignfonts\expandafter{\lsize}%
  2406. \ifrmisbold
  2407. \let\rmfont\bffont
  2408. \fi
  2409. \csname\curfontstyle\endcsname
  2410. }%
  2411. \def\definefontsetatsize#1#2#3#4#5{%
  2412. \expandafter\def\csname #1fonts\endcsname{%
  2413. \def\curfontsize{#1}%
  2414. \def\lsize{#2}\def\lllsize{#3}%
  2415. \csname rmisbold#5\endcsname
  2416. \assignfonts{#1}%
  2417. \resetmathfonts
  2418. \setleading{#4}%
  2419. }}
  2420. \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
  2421. \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
  2422. \definefontsetatsize{chap} {sec} {text} {19pt} {true}
  2423. \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
  2424. \definefontsetatsize{ssec} {text} {small} {15pt} {true}
  2425. \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
  2426. \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
  2427. \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
  2428. \def\titlefont#1{{\titlefonts\rm #1}}
  2429. \let\subsecfonts = \ssecfonts
  2430. \let\subsubsecfonts = \ssecfonts
  2431. % Define these just so they can be easily changed for other fonts.
  2432. \def\angleleft{$\langle$}
  2433. \def\angleright{$\rangle$}
  2434. % Set the fonts to use with the @small... environments.
  2435. \let\smallexamplefonts = \smallfonts
  2436. % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
  2437. % can fit this many characters:
  2438. % 8.5x11=86 smallbook=72 a4=90 a5=69
  2439. % If we use \scriptfonts (8pt), then we can fit this many characters:
  2440. % 8.5x11=90+ smallbook=80 a4=90+ a5=77
  2441. % For me, subjectively, the few extra characters that fit aren't worth
  2442. % the additional smallness of 8pt. So I'm making the default 9pt.
  2443. %
  2444. % By the way, for comparison, here's what fits with @example (10pt):
  2445. % 8.5x11=71 smallbook=60 a4=75 a5=58
  2446. % --karl, 24jan03.
  2447. % Set up the default fonts, so we can use them for creating boxes.
  2448. %
  2449. \definetextfontsizexi
  2450. \message{markup,}
  2451. % Check if we are currently using a typewriter font. Since all the
  2452. % Computer Modern typewriter fonts have zero interword stretch (and
  2453. % shrink), and it is reasonable to expect all typewriter fonts to have
  2454. % this property, we can check that font parameter.
  2455. %
  2456. \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
  2457. % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
  2458. % define and register \INITMACRO to be called on markup style changes.
  2459. % \INITMACRO can check \currentmarkupstyle for the innermost
  2460. % style and the set of \ifmarkupSTYLE switches for all styles
  2461. % currently in effect.
  2462. \newif\ifmarkupvar
  2463. \newif\ifmarkupsamp
  2464. \newif\ifmarkupkey
  2465. %\newif\ifmarkupfile % @file == @samp.
  2466. %\newif\ifmarkupoption % @option == @samp.
  2467. \newif\ifmarkupcode
  2468. \newif\ifmarkupkbd
  2469. %\newif\ifmarkupenv % @env == @code.
  2470. %\newif\ifmarkupcommand % @command == @code.
  2471. \newif\ifmarkuptex % @tex (and part of @math, for now).
  2472. \newif\ifmarkupexample
  2473. \newif\ifmarkupverb
  2474. \newif\ifmarkupverbatim
  2475. \let\currentmarkupstyle\empty
  2476. \def\setupmarkupstyle#1{%
  2477. \csname markup#1true\endcsname
  2478. \def\currentmarkupstyle{#1}%
  2479. \markupstylesetup
  2480. }
  2481. \let\markupstylesetup\empty
  2482. \def\defmarkupstylesetup#1{%
  2483. \expandafter\def\expandafter\markupstylesetup
  2484. \expandafter{\markupstylesetup #1}%
  2485. \def#1%
  2486. }
  2487. % Markup style setup for left and right quotes.
  2488. \defmarkupstylesetup\markupsetuplq{%
  2489. \expandafter\let\expandafter \temp
  2490. \csname markupsetuplq\currentmarkupstyle\endcsname
  2491. \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
  2492. }
  2493. \defmarkupstylesetup\markupsetuprq{%
  2494. \expandafter\let\expandafter \temp
  2495. \csname markupsetuprq\currentmarkupstyle\endcsname
  2496. \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
  2497. }
  2498. {
  2499. \catcode`\'=\active
  2500. \catcode`\`=\active
  2501. \gdef\markupsetuplqdefault{\let`\lq}
  2502. \gdef\markupsetuprqdefault{\let'\rq}
  2503. \gdef\markupsetcodequoteleft{\let`\codequoteleft}
  2504. \gdef\markupsetcodequoteright{\let'\codequoteright}
  2505. }
  2506. \let\markupsetuplqcode \markupsetcodequoteleft
  2507. \let\markupsetuprqcode \markupsetcodequoteright
  2508. %
  2509. \let\markupsetuplqexample \markupsetcodequoteleft
  2510. \let\markupsetuprqexample \markupsetcodequoteright
  2511. %
  2512. \let\markupsetuplqkbd \markupsetcodequoteleft
  2513. \let\markupsetuprqkbd \markupsetcodequoteright
  2514. %
  2515. \let\markupsetuplqsamp \markupsetcodequoteleft
  2516. \let\markupsetuprqsamp \markupsetcodequoteright
  2517. %
  2518. \let\markupsetuplqverb \markupsetcodequoteleft
  2519. \let\markupsetuprqverb \markupsetcodequoteright
  2520. %
  2521. \let\markupsetuplqverbatim \markupsetcodequoteleft
  2522. \let\markupsetuprqverbatim \markupsetcodequoteright
  2523. % Allow an option to not use regular directed right quote/apostrophe
  2524. % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
  2525. % The undirected quote is ugly, so don't make it the default, but it
  2526. % works for pasting with more pdf viewers (at least evince), the
  2527. % lilypond developers report. xpdf does work with the regular 0x27.
  2528. %
  2529. \def\codequoteright{%
  2530. \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
  2531. \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
  2532. '%
  2533. \else \char'15 \fi
  2534. \else \char'15 \fi
  2535. }
  2536. %
  2537. % and a similar option for the left quote char vs. a grave accent.
  2538. % Modern fonts display ASCII 0x60 as a grave accent, so some people like
  2539. % the code environments to do likewise.
  2540. %
  2541. \def\codequoteleft{%
  2542. \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
  2543. \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
  2544. % [Knuth] pp. 380,381,391
  2545. % \relax disables Spanish ligatures ?` and !` of \tt font.
  2546. \relax`%
  2547. \else \char'22 \fi
  2548. \else \char'22 \fi
  2549. }
  2550. % Commands to set the quote options.
  2551. %
  2552. \parseargdef\codequoteundirected{%
  2553. \def\temp{#1}%
  2554. \ifx\temp\onword
  2555. \expandafter\let\csname SETtxicodequoteundirected\endcsname
  2556. = t%
  2557. \else\ifx\temp\offword
  2558. \expandafter\let\csname SETtxicodequoteundirected\endcsname
  2559. = \relax
  2560. \else
  2561. \errhelp = \EMsimple
  2562. \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
  2563. \fi\fi
  2564. }
  2565. %
  2566. \parseargdef\codequotebacktick{%
  2567. \def\temp{#1}%
  2568. \ifx\temp\onword
  2569. \expandafter\let\csname SETtxicodequotebacktick\endcsname
  2570. = t%
  2571. \else\ifx\temp\offword
  2572. \expandafter\let\csname SETtxicodequotebacktick\endcsname
  2573. = \relax
  2574. \else
  2575. \errhelp = \EMsimple
  2576. \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
  2577. \fi\fi
  2578. }
  2579. % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
  2580. \def\noligaturesquoteleft{\relax\lq}
  2581. % Count depth in font-changes, for error checks
  2582. \newcount\fontdepth \fontdepth=0
  2583. % Font commands.
  2584. % #1 is the font command (\sl or \it), #2 is the text to slant.
  2585. % If we are in a monospaced environment, however, 1) always use \ttsl,
  2586. % and 2) do not add an italic correction.
  2587. \def\dosmartslant#1#2{%
  2588. \ifusingtt
  2589. {{\ttsl #2}\let\next=\relax}%
  2590. {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
  2591. \next
  2592. }
  2593. \def\smartslanted{\dosmartslant\sl}
  2594. \def\smartitalic{\dosmartslant\it}
  2595. % Output an italic correction unless \next (presumed to be the following
  2596. % character) is such as not to need one.
  2597. \def\smartitaliccorrection{%
  2598. \ifx\next,%
  2599. \else\ifx\next-%
  2600. \else\ifx\next.%
  2601. \else\ifx\next\.%
  2602. \else\ifx\next\comma%
  2603. \else\ptexslash
  2604. \fi\fi\fi\fi\fi
  2605. \aftersmartic
  2606. }
  2607. % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
  2608. \def\ttslanted#1{{\ttsl #1}}
  2609. % @cite is like \smartslanted except unconditionally use \sl. We never want
  2610. % ttsl for book titles, do we?
  2611. \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
  2612. \def\aftersmartic{}
  2613. \def\var#1{%
  2614. \let\saveaftersmartic = \aftersmartic
  2615. \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
  2616. \smartslanted{#1}%
  2617. }
  2618. \let\i=\smartitalic
  2619. \let\slanted=\smartslanted
  2620. \let\dfn=\smartslanted
  2621. \let\emph=\smartitalic
  2622. % Explicit font changes: @r, @sc, undocumented @ii.
  2623. \def\r#1{{\rm #1}} % roman font
  2624. \def\sc#1{{\smallcaps#1}} % smallcaps font
  2625. \def\ii#1{{\it #1}} % italic font
  2626. % @b, explicit bold. Also @strong.
  2627. \def\b#1{{\bf #1}}
  2628. \let\strong=\b
  2629. % @sansserif, explicit sans.
  2630. \def\sansserif#1{{\sf #1}}
  2631. % We can't just use \exhyphenpenalty, because that only has effect at
  2632. % the end of a paragraph. Restore normal hyphenation at the end of the
  2633. % group within which \nohyphenation is presumably called.
  2634. %
  2635. \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
  2636. \def\restorehyphenation{\hyphenchar\font = `- }
  2637. % Set sfcode to normal for the chars that usually have another value.
  2638. % Can't use plain's \frenchspacing because it uses the `\x notation, and
  2639. % sometimes \x has an active definition that messes things up.
  2640. %
  2641. \catcode`@=11
  2642. \def\plainfrenchspacing{%
  2643. \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
  2644. \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
  2645. \def\endofsentencespacefactor{1000}% for @. and friends
  2646. }
  2647. \def\plainnonfrenchspacing{%
  2648. \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
  2649. \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
  2650. \def\endofsentencespacefactor{3000}% for @. and friends
  2651. }
  2652. \catcode`@=\other
  2653. \def\endofsentencespacefactor{3000}% default
  2654. % @t, explicit typewriter.
  2655. \def\t#1{%
  2656. {\tt \rawbackslash \plainfrenchspacing #1}%
  2657. \null
  2658. }
  2659. % @samp.
  2660. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
  2661. % @indicateurl is \samp, that is, with quotes.
  2662. \let\indicateurl=\samp
  2663. % @code (and similar) prints in typewriter, but with spaces the same
  2664. % size as normal in the surrounding text, without hyphenation, etc.
  2665. % This is a subroutine for that.
  2666. \def\tclose#1{%
  2667. {%
  2668. % Change normal interword space to be same as for the current font.
  2669. \spaceskip = \fontdimen2\font
  2670. %
  2671. % Switch to typewriter.
  2672. \tt
  2673. %
  2674. % But `\ ' produces the large typewriter interword space.
  2675. \def\ {{\spaceskip = 0pt{} }}%
  2676. %
  2677. % Turn off hyphenation.
  2678. \nohyphenation
  2679. %
  2680. \rawbackslash
  2681. \plainfrenchspacing
  2682. #1%
  2683. }%
  2684. \null % reset spacefactor to 1000
  2685. }
  2686. % We *must* turn on hyphenation at `-' and `_' in @code.
  2687. % (But see \codedashfinish below.)
  2688. % Otherwise, it is too hard to avoid overfull hboxes
  2689. % in the Emacs manual, the Library manual, etc.
  2690. %
  2691. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  2692. % both hyphenation at - and hyphenation within words.
  2693. % We must therefore turn them both off (\tclose does that)
  2694. % and arrange explicitly to hyphenate at a dash. -- rms.
  2695. {
  2696. \catcode`\-=\active \catcode`\_=\active
  2697. \catcode`\'=\active \catcode`\`=\active
  2698. \global\let'=\rq \global\let`=\lq % default definitions
  2699. %
  2700. \global\def\code{\begingroup
  2701. \setupmarkupstyle{code}%
  2702. % The following should really be moved into \setupmarkupstyle handlers.
  2703. \catcode\dashChar=\active \catcode\underChar=\active
  2704. \ifallowcodebreaks
  2705. \let-\codedash
  2706. \let_\codeunder
  2707. \else
  2708. \let-\normaldash
  2709. \let_\realunder
  2710. \fi
  2711. % Given -foo (with a single dash), we do not want to allow a break
  2712. % after the hyphen.
  2713. \global\let\codedashprev=\codedash
  2714. %
  2715. \codex
  2716. }
  2717. %
  2718. \gdef\codedash{\futurelet\next\codedashfinish}
  2719. \gdef\codedashfinish{%
  2720. \normaldash % always output the dash character itself.
  2721. %
  2722. % Now, output a discretionary to allow a line break, unless
  2723. % (a) the next character is a -, or
  2724. % (b) the preceding character is a -.
  2725. % E.g., given --posix, we do not want to allow a break after either -.
  2726. % Given --foo-bar, we do want to allow a break between the - and the b.
  2727. \ifx\next\codedash \else
  2728. \ifx\codedashprev\codedash
  2729. \else \discretionary{}{}{}\fi
  2730. \fi
  2731. % we need the space after the = for the case when \next itself is a
  2732. % space token; it would get swallowed otherwise. As in @code{- a}.
  2733. \global\let\codedashprev= \next
  2734. }
  2735. }
  2736. \def\normaldash{-}
  2737. %
  2738. \def\codex #1{\tclose{#1}\endgroup}
  2739. \def\codeunder{%
  2740. % this is all so @math{@code{var_name}+1} can work. In math mode, _
  2741. % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  2742. % will therefore expand the active definition of _, which is us
  2743. % (inside @code that is), therefore an endless loop.
  2744. \ifusingtt{\ifmmode
  2745. \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
  2746. \else\normalunderscore \fi
  2747. \discretionary{}{}{}}%
  2748. {\_}%
  2749. }
  2750. % An additional complication: the above will allow breaks after, e.g.,
  2751. % each of the four underscores in __typeof__. This is bad.
  2752. % @allowcodebreaks provides a document-level way to turn breaking at -
  2753. % and _ on and off.
  2754. %
  2755. \newif\ifallowcodebreaks \allowcodebreakstrue
  2756. \def\keywordtrue{true}
  2757. \def\keywordfalse{false}
  2758. \parseargdef\allowcodebreaks{%
  2759. \def\txiarg{#1}%
  2760. \ifx\txiarg\keywordtrue
  2761. \allowcodebreakstrue
  2762. \else\ifx\txiarg\keywordfalse
  2763. \allowcodebreaksfalse
  2764. \else
  2765. \errhelp = \EMsimple
  2766. \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
  2767. \fi\fi
  2768. }
  2769. % For @command, @env, @file, @option quotes seem unnecessary,
  2770. % so use \code rather than \samp.
  2771. \let\command=\code
  2772. \let\env=\code
  2773. \let\file=\code
  2774. \let\option=\code
  2775. % @uref (abbreviation for `urlref') aka @url takes an optional
  2776. % (comma-separated) second argument specifying the text to display and
  2777. % an optional third arg as text to display instead of (rather than in
  2778. % addition to) the url itself. First (mandatory) arg is the url.
  2779. % TeX-only option to allow changing PDF output to show only the second
  2780. % arg (if given), and not the url (which is then just the link target).
  2781. \newif\ifurefurlonlylink
  2782. % The main macro is \urefbreak, which allows breaking at expected
  2783. % places within the url. (There used to be another version, which
  2784. % didn't support automatic breaking.)
  2785. \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
  2786. \let\uref=\urefbreak
  2787. %
  2788. \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
  2789. \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
  2790. \unsepspaces
  2791. \pdfurl{#1}%
  2792. \setbox0 = \hbox{\ignorespaces #3}%
  2793. \ifdim\wd0 > 0pt
  2794. \unhbox0 % third arg given, show only that
  2795. \else
  2796. \setbox0 = \hbox{\ignorespaces #2}% look for second arg
  2797. \ifdim\wd0 > 0pt
  2798. \ifpdf
  2799. % For pdfTeX and LuaTeX
  2800. \ifurefurlonlylink
  2801. % PDF plus option to not display url, show just arg
  2802. \unhbox0
  2803. \else
  2804. % PDF, normally display both arg and url for consistency,
  2805. % visibility, if the pdf is eventually used to print, etc.
  2806. \unhbox0\ (\urefcode{#1})%
  2807. \fi
  2808. \else
  2809. \ifx\XeTeXrevision\thisisundefined
  2810. \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
  2811. \else
  2812. % For XeTeX
  2813. \ifurefurlonlylink
  2814. % PDF plus option to not display url, show just arg
  2815. \unhbox0
  2816. \else
  2817. % PDF, normally display both arg and url for consistency,
  2818. % visibility, if the pdf is eventually used to print, etc.
  2819. \unhbox0\ (\urefcode{#1})%
  2820. \fi
  2821. \fi
  2822. \fi
  2823. \else
  2824. \urefcode{#1}% only url given, so show it
  2825. \fi
  2826. \fi
  2827. \endlink
  2828. \endgroup}
  2829. % Allow line breaks around only a few characters (only).
  2830. \def\urefcatcodes{%
  2831. \catcode`\&=\active \catcode`\.=\active
  2832. \catcode`\#=\active \catcode`\?=\active
  2833. \catcode`\/=\active
  2834. }
  2835. {
  2836. \urefcatcodes
  2837. %
  2838. \global\def\urefcode{\begingroup
  2839. \setupmarkupstyle{code}%
  2840. \urefcatcodes
  2841. \let&\urefcodeamp
  2842. \let.\urefcodedot
  2843. \let#\urefcodehash
  2844. \let?\urefcodequest
  2845. \let/\urefcodeslash
  2846. \codex
  2847. }
  2848. %
  2849. % By default, they are just regular characters.
  2850. \global\def&{\normalamp}
  2851. \global\def.{\normaldot}
  2852. \global\def#{\normalhash}
  2853. \global\def?{\normalquest}
  2854. \global\def/{\normalslash}
  2855. }
  2856. % we put a little stretch before and after the breakable chars, to help
  2857. % line breaking of long url's. The unequal skips make look better in
  2858. % cmtt at least, especially for dots.
  2859. \def\urefprestretchamount{.13em}
  2860. \def\urefpoststretchamount{.1em}
  2861. \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
  2862. \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
  2863. %
  2864. \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
  2865. \def\urefcodedot{\urefprestretch .\urefpoststretch}
  2866. \def\urefcodehash{\urefprestretch \#\urefpoststretch}
  2867. \def\urefcodequest{\urefprestretch ?\urefpoststretch}
  2868. \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
  2869. {
  2870. \catcode`\/=\active
  2871. \global\def\urefcodeslashfinish{%
  2872. \urefprestretch \slashChar
  2873. % Allow line break only after the final / in a sequence of
  2874. % slashes, to avoid line break between the slashes in http://.
  2875. \ifx\next/\else \urefpoststretch \fi
  2876. }
  2877. }
  2878. % One more complication: by default we'll break after the special
  2879. % characters, but some people like to break before the special chars, so
  2880. % allow that. Also allow no breaking at all, for manual control.
  2881. %
  2882. \parseargdef\urefbreakstyle{%
  2883. \def\txiarg{#1}%
  2884. \ifx\txiarg\wordnone
  2885. \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
  2886. \else\ifx\txiarg\wordbefore
  2887. \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
  2888. \else\ifx\txiarg\wordafter
  2889. \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
  2890. \else
  2891. \errhelp = \EMsimple
  2892. \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
  2893. \fi\fi\fi
  2894. }
  2895. \def\wordafter{after}
  2896. \def\wordbefore{before}
  2897. \def\wordnone{none}
  2898. \urefbreakstyle after
  2899. % @url synonym for @uref, since that's how everyone uses it.
  2900. %
  2901. \let\url=\uref
  2902. % rms does not like angle brackets --karl, 17may97.
  2903. % So now @email is just like @uref, unless we are pdf.
  2904. %
  2905. %\def\email#1{\angleleft{\tt #1}\angleright}
  2906. \ifpdf
  2907. \def\email#1{\doemail#1,,\finish}
  2908. \def\doemail#1,#2,#3\finish{\begingroup
  2909. \unsepspaces
  2910. \pdfurl{mailto:#1}%
  2911. \setbox0 = \hbox{\ignorespaces #2}%
  2912. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  2913. \endlink
  2914. \endgroup}
  2915. \else
  2916. \ifx\XeTeXrevision\thisisundefined
  2917. \let\email=\uref
  2918. \else
  2919. \def\email#1{\doemail#1,,\finish}
  2920. \def\doemail#1,#2,#3\finish{\begingroup
  2921. \unsepspaces
  2922. \pdfurl{mailto:#1}%
  2923. \setbox0 = \hbox{\ignorespaces #2}%
  2924. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  2925. \endlink
  2926. \endgroup}
  2927. \fi
  2928. \fi
  2929. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  2930. % `example' (@kbd uses ttsl only inside of @example and friends),
  2931. % or `code' (@kbd uses normal tty font always).
  2932. \parseargdef\kbdinputstyle{%
  2933. \def\txiarg{#1}%
  2934. \ifx\txiarg\worddistinct
  2935. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  2936. \else\ifx\txiarg\wordexample
  2937. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  2938. \else\ifx\txiarg\wordcode
  2939. \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  2940. \else
  2941. \errhelp = \EMsimple
  2942. \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
  2943. \fi\fi\fi
  2944. }
  2945. \def\worddistinct{distinct}
  2946. \def\wordexample{example}
  2947. \def\wordcode{code}
  2948. % Default is `distinct'.
  2949. \kbdinputstyle distinct
  2950. % @kbd is like @code, except that if the argument is just one @key command,
  2951. % then @kbd has no effect.
  2952. \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
  2953. \def\xkey{\key}
  2954. \def\kbdsub#1#2#3\par{%
  2955. \def\one{#1}\def\three{#3}\def\threex{??}%
  2956. \ifx\one\xkey\ifx\threex\three \key{#2}%
  2957. \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  2958. \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  2959. }
  2960. % definition of @key that produces a lozenge. Doesn't adjust to text size.
  2961. %\setfont\keyrm\rmshape{8}{1000}{OT1}
  2962. %\font\keysy=cmsy9
  2963. %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
  2964. % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
  2965. % \vbox{\hrule\kern-0.4pt
  2966. % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
  2967. % \kern-0.4pt\hrule}%
  2968. % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
  2969. % definition of @key with no lozenge. If the current font is already
  2970. % monospace, don't change it; that way, we respect @kbdinputstyle. But
  2971. % if it isn't monospace, then use \tt.
  2972. %
  2973. \def\key#1{{\setupmarkupstyle{key}%
  2974. \nohyphenation
  2975. \ifmonospace\else\tt\fi
  2976. #1}\null}
  2977. % @clicksequence{File @click{} Open ...}
  2978. \def\clicksequence#1{\begingroup #1\endgroup}
  2979. % @clickstyle @arrow (by default)
  2980. \parseargdef\clickstyle{\def\click{#1}}
  2981. \def\click{\arrow}
  2982. % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
  2983. % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
  2984. %
  2985. \def\dmn#1{\thinspace #1}
  2986. % @acronym for "FBI", "NATO", and the like.
  2987. % We print this one point size smaller, since it's intended for
  2988. % all-uppercase.
  2989. %
  2990. \def\acronym#1{\doacronym #1,,\finish}
  2991. \def\doacronym#1,#2,#3\finish{%
  2992. {\switchtolsize #1}%
  2993. \def\temp{#2}%
  2994. \ifx\temp\empty \else
  2995. \space ({\unsepspaces \ignorespaces \temp \unskip})%
  2996. \fi
  2997. \null % reset \spacefactor=1000
  2998. }
  2999. % @abbr for "Comput. J." and the like.
  3000. % No font change, but don't do end-of-sentence spacing.
  3001. %
  3002. \def\abbr#1{\doabbr #1,,\finish}
  3003. \def\doabbr#1,#2,#3\finish{%
  3004. {\plainfrenchspacing #1}%
  3005. \def\temp{#2}%
  3006. \ifx\temp\empty \else
  3007. \space ({\unsepspaces \ignorespaces \temp \unskip})%
  3008. \fi
  3009. \null % reset \spacefactor=1000
  3010. }
  3011. % @asis just yields its argument. Used with @table, for example.
  3012. %
  3013. \def\asis#1{#1}
  3014. % @math outputs its argument in math mode.
  3015. %
  3016. % One complication: _ usually means subscripts, but it could also mean
  3017. % an actual _ character, as in @math{@var{some_variable} + 1}. So make
  3018. % _ active, and distinguish by seeing if the current family is \slfam,
  3019. % which is what @var uses.
  3020. {
  3021. \catcode`\_ = \active
  3022. \gdef\mathunderscore{%
  3023. \catcode`\_=\active
  3024. \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
  3025. }
  3026. }
  3027. % Another complication: we want \\ (and @\) to output a math (or tt) \.
  3028. % FYI, plain.tex uses \\ as a temporary control sequence (for no
  3029. % particular reason), but this is not advertised and we don't care.
  3030. %
  3031. % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
  3032. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
  3033. %
  3034. \def\math{%
  3035. \ifmmode\else % only go into math if not in math mode already
  3036. \tex
  3037. \mathunderscore
  3038. \let\\ = \mathbackslash
  3039. \mathactive
  3040. % make the texinfo accent commands work in math mode
  3041. \let\"=\ddot
  3042. \let\'=\acute
  3043. \let\==\bar
  3044. \let\^=\hat
  3045. \let\`=\grave
  3046. \let\u=\breve
  3047. \let\v=\check
  3048. \let\~=\tilde
  3049. \let\dotaccent=\dot
  3050. % have to provide another name for sup operator
  3051. \let\mathopsup=\sup
  3052. $\expandafter\finishmath\fi
  3053. }
  3054. \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
  3055. % Some active characters (such as <) are spaced differently in math.
  3056. % We have to reset their definitions in case the @math was an argument
  3057. % to a command which sets the catcodes (such as @item or @section).
  3058. %
  3059. {
  3060. \catcode`^ = \active
  3061. \catcode`< = \active
  3062. \catcode`> = \active
  3063. \catcode`+ = \active
  3064. \catcode`' = \active
  3065. \gdef\mathactive{%
  3066. \let^ = \ptexhat
  3067. \let< = \ptexless
  3068. \let> = \ptexgtr
  3069. \let+ = \ptexplus
  3070. \let' = \ptexquoteright
  3071. }
  3072. }
  3073. % for @sub and @sup, if in math mode, just do a normal sub/superscript.
  3074. % If in text, use math to place as sub/superscript, but switch
  3075. % into text mode, with smaller fonts. This is a different font than the
  3076. % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
  3077. % fix it (significant additions to font machinery) until someone notices.
  3078. %
  3079. \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
  3080. \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
  3081. %
  3082. \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
  3083. \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
  3084. % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
  3085. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
  3086. % except specified as a normal braced arg, so no newlines to worry about.
  3087. %
  3088. \def\outfmtnametex{tex}
  3089. %
  3090. \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
  3091. \long\def\doinlinefmt#1,#2,\finish{%
  3092. \def\inlinefmtname{#1}%
  3093. \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
  3094. }
  3095. %
  3096. % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
  3097. % FMTNAME is tex, else ELSE-TEXT.
  3098. \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
  3099. \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
  3100. \def\inlinefmtname{#1}%
  3101. \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
  3102. }
  3103. %
  3104. % For raw, must switch into @tex before parsing the argument, to avoid
  3105. % setting catcodes prematurely. Doing it this way means that, for
  3106. % example, @inlineraw{html, foo{bar} gets a parse error instead of being
  3107. % ignored. But this isn't important because if people want a literal
  3108. % *right* brace they would have to use a command anyway, so they may as
  3109. % well use a command to get a left brace too. We could re-use the
  3110. % delimiter character idea from \verb, but it seems like overkill.
  3111. %
  3112. \long\def\inlineraw{\tex \doinlineraw}
  3113. \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
  3114. \def\doinlinerawtwo#1,#2,\finish{%
  3115. \def\inlinerawname{#1}%
  3116. \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
  3117. \endgroup % close group opened by \tex.
  3118. }
  3119. % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
  3120. %
  3121. \long\def\inlineifset#1{\doinlineifset #1,\finish}
  3122. \long\def\doinlineifset#1,#2,\finish{%
  3123. \def\inlinevarname{#1}%
  3124. \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
  3125. \else\ignorespaces#2\fi
  3126. }
  3127. % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
  3128. %
  3129. \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
  3130. \long\def\doinlineifclear#1,#2,\finish{%
  3131. \def\inlinevarname{#1}%
  3132. \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
  3133. }
  3134. \message{glyphs,}
  3135. % and logos.
  3136. % @@ prints an @, as does @atchar{}.
  3137. \def\@{\char64 }
  3138. \let\atchar=\@
  3139. % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
  3140. \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
  3141. \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
  3142. \let\{=\lbracechar
  3143. \let\}=\rbracechar
  3144. % @comma{} to avoid , parsing problems.
  3145. \let\comma = ,
  3146. % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  3147. % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
  3148. \let\, = \ptexc
  3149. \let\dotaccent = \ptexdot
  3150. \def\ringaccent#1{{\accent23 #1}}
  3151. \let\tieaccent = \ptext
  3152. \let\ubaraccent = \ptexb
  3153. \let\udotaccent = \d
  3154. % Other special characters: @questiondown @exclamdown @ordf @ordm
  3155. % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
  3156. \def\questiondown{?`}
  3157. \def\exclamdown{!`}
  3158. \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
  3159. \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
  3160. % Dotless i and dotless j, used for accents.
  3161. \def\imacro{i}
  3162. \def\jmacro{j}
  3163. \def\dotless#1{%
  3164. \def\temp{#1}%
  3165. \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
  3166. \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
  3167. \else \errmessage{@dotless can be used only with i or j}%
  3168. \fi\fi
  3169. }
  3170. % The \TeX{} logo, as in plain, but resetting the spacing so that a
  3171. % period following counts as ending a sentence. (Idea found in latex.)
  3172. %
  3173. \edef\TeX{\TeX \spacefactor=1000 }
  3174. % @LaTeX{} logo. Not quite the same results as the definition in
  3175. % latex.ltx, since we use a different font for the raised A; it's most
  3176. % convenient for us to use an explicitly smaller font, rather than using
  3177. % the \scriptstyle font (since we don't reset \scriptstyle and
  3178. % \scriptscriptstyle).
  3179. %
  3180. \def\LaTeX{%
  3181. L\kern-.36em
  3182. {\setbox0=\hbox{T}%
  3183. \vbox to \ht0{\hbox{%
  3184. \ifx\textnominalsize\xwordpt
  3185. % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
  3186. % Revert to plain's \scriptsize, which is 7pt.
  3187. \count255=\the\fam $\fam\count255 \scriptstyle A$%
  3188. \else
  3189. % For 11pt, we can use our lllsize.
  3190. \switchtolllsize A%
  3191. \fi
  3192. }%
  3193. \vss
  3194. }}%
  3195. \kern-.15em
  3196. \TeX
  3197. }
  3198. % Some math mode symbols. Define \ensuremath to switch into math mode
  3199. % unless we are already there. Expansion tricks may not be needed here,
  3200. % but safer, and can't hurt.
  3201. \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
  3202. \def\ensuredmath#1{$\relax#1$}
  3203. %
  3204. \def\bullet{\ensuremath\ptexbullet}
  3205. \def\geq{\ensuremath\ge}
  3206. \def\leq{\ensuremath\le}
  3207. \def\minus{\ensuremath-}
  3208. % @dots{} outputs an ellipsis using the current font.
  3209. % We do .5em per period so that it has the same spacing in the cm
  3210. % typewriter fonts as three actual period characters; on the other hand,
  3211. % in other typewriter fonts three periods are wider than 1.5em. So do
  3212. % whichever is larger.
  3213. %
  3214. \def\dots{%
  3215. \leavevmode
  3216. \setbox0=\hbox{...}% get width of three periods
  3217. \ifdim\wd0 > 1.5em
  3218. \dimen0 = \wd0
  3219. \else
  3220. \dimen0 = 1.5em
  3221. \fi
  3222. \hbox to \dimen0{%
  3223. \hskip 0pt plus.25fil
  3224. .\hskip 0pt plus1fil
  3225. .\hskip 0pt plus1fil
  3226. .\hskip 0pt plus.5fil
  3227. }%
  3228. }
  3229. % @enddots{} is an end-of-sentence ellipsis.
  3230. %
  3231. \def\enddots{%
  3232. \dots
  3233. \spacefactor=\endofsentencespacefactor
  3234. }
  3235. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
  3236. %
  3237. % Since these characters are used in examples, they should be an even number of
  3238. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  3239. %
  3240. \def\point{$\star$}
  3241. \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
  3242. \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  3243. \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
  3244. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  3245. \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  3246. % The @error{} command.
  3247. % Adapted from the TeXbook's \boxit.
  3248. %
  3249. \newbox\errorbox
  3250. %
  3251. {\ttfont \global\dimen0 = 3em}% Width of the box.
  3252. \dimen2 = .55pt % Thickness of rules
  3253. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  3254. \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
  3255. %
  3256. \setbox\errorbox=\hbox to \dimen0{\hfil
  3257. \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  3258. \advance\hsize by -2\dimen2 % Rules.
  3259. \vbox{%
  3260. \hrule height\dimen2
  3261. \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
  3262. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  3263. \kern3pt\vrule width\dimen2}% Space to right.
  3264. \hrule height\dimen2}
  3265. \hfil}
  3266. %
  3267. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  3268. % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
  3269. %
  3270. \def\pounds{{\it\$}}
  3271. % @euro{} comes from a separate font, depending on the current style.
  3272. % We use the free feym* fonts from the eurosym package by Henrik
  3273. % Theiling, which support regular, slanted, bold and bold slanted (and
  3274. % "outlined" (blackboard board, sort of) versions, which we don't need).
  3275. % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
  3276. %
  3277. % Although only regular is the truly official Euro symbol, we ignore
  3278. % that. The Euro is designed to be slightly taller than the regular
  3279. % font height.
  3280. %
  3281. % feymr - regular
  3282. % feymo - slanted
  3283. % feybr - bold
  3284. % feybo - bold slanted
  3285. %
  3286. % There is no good (free) typewriter version, to my knowledge.
  3287. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
  3288. % Hmm.
  3289. %
  3290. % Also doesn't work in math. Do we need to do math with euro symbols?
  3291. % Hope not.
  3292. %
  3293. %
  3294. \def\euro{{\eurofont e}}
  3295. \def\eurofont{%
  3296. % We set the font at each command, rather than predefining it in
  3297. % \textfonts and the other font-switching commands, so that
  3298. % installations which never need the symbol don't have to have the
  3299. % font installed.
  3300. %
  3301. % There is only one designed size (nominal 10pt), so we always scale
  3302. % that to the current nominal size.
  3303. %
  3304. % By the way, simply using "at 1em" works for cmr10 and the like, but
  3305. % does not work for cmbx10 and other extended/shrunken fonts.
  3306. %
  3307. \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
  3308. %
  3309. \ifx\curfontstyle\bfstylename
  3310. % bold:
  3311. \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
  3312. \else
  3313. % regular:
  3314. \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
  3315. \fi
  3316. \thiseurofont
  3317. }
  3318. % Glyphs from the EC fonts. We don't use \let for the aliases, because
  3319. % sometimes we redefine the original macro, and the alias should reflect
  3320. % the redefinition.
  3321. %
  3322. % Use LaTeX names for the Icelandic letters.
  3323. \def\DH{{\ecfont \char"D0}} % Eth
  3324. \def\dh{{\ecfont \char"F0}} % eth
  3325. \def\TH{{\ecfont \char"DE}} % Thorn
  3326. \def\th{{\ecfont \char"FE}} % thorn
  3327. %
  3328. \def\guillemetleft{{\ecfont \char"13}}
  3329. \def\guillemotleft{\guillemetleft}
  3330. \def\guillemetright{{\ecfont \char"14}}
  3331. \def\guillemotright{\guillemetright}
  3332. \def\guilsinglleft{{\ecfont \char"0E}}
  3333. \def\guilsinglright{{\ecfont \char"0F}}
  3334. \def\quotedblbase{{\ecfont \char"12}}
  3335. \def\quotesinglbase{{\ecfont \char"0D}}
  3336. %
  3337. % This positioning is not perfect (see the ogonek LaTeX package), but
  3338. % we have the precomposed glyphs for the most common cases. We put the
  3339. % tests to use those glyphs in the single \ogonek macro so we have fewer
  3340. % dummy definitions to worry about for index entries, etc.
  3341. %
  3342. % ogonek is also used with other letters in Lithuanian (IOU), but using
  3343. % the precomposed glyphs for those is not so easy since they aren't in
  3344. % the same EC font.
  3345. \def\ogonek#1{{%
  3346. \def\temp{#1}%
  3347. \ifx\temp\macrocharA\Aogonek
  3348. \else\ifx\temp\macrochara\aogonek
  3349. \else\ifx\temp\macrocharE\Eogonek
  3350. \else\ifx\temp\macrochare\eogonek
  3351. \else
  3352. \ecfont \setbox0=\hbox{#1}%
  3353. \ifdim\ht0=1ex\accent"0C #1%
  3354. \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
  3355. \fi
  3356. \fi\fi\fi\fi
  3357. }%
  3358. }
  3359. \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
  3360. \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
  3361. \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
  3362. \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
  3363. %
  3364. % Use the European Computer Modern fonts (cm-super in outline format)
  3365. % for non-CM glyphs. That is ec* for regular text and tc* for the text
  3366. % companion symbols (LaTeX TS1 encoding). Both are part of the ec
  3367. % package and follow the same conventions.
  3368. %
  3369. \def\ecfont{\etcfont{e}}
  3370. \def\tcfont{\etcfont{t}}
  3371. %
  3372. \def\etcfont#1{%
  3373. % We can't distinguish serif/sans and italic/slanted, but this
  3374. % is used for crude hacks anyway (like adding French and German
  3375. % quotes to documents typeset with CM, where we lose kerning), so
  3376. % hopefully nobody will notice/care.
  3377. \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
  3378. \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
  3379. \ifmonospace
  3380. % typewriter:
  3381. \font\thisecfont = #1ctt\ecsize \space at \nominalsize
  3382. \else
  3383. \ifx\curfontstyle\bfstylename
  3384. % bold:
  3385. \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
  3386. \else
  3387. % regular:
  3388. \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
  3389. \fi
  3390. \fi
  3391. \thisecfont
  3392. }
  3393. % @registeredsymbol - R in a circle. The font for the R should really
  3394. % be smaller yet, but lllsize is the best we can do for now.
  3395. % Adapted from the plain.tex definition of \copyright.
  3396. %
  3397. \def\registeredsymbol{%
  3398. $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
  3399. \hfil\crcr\Orb}}%
  3400. }$%
  3401. }
  3402. % @textdegree - the normal degrees sign.
  3403. %
  3404. \def\textdegree{$^\circ$}
  3405. % Laurent Siebenmann reports \Orb undefined with:
  3406. % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
  3407. % so we'll define it if necessary.
  3408. %
  3409. \ifx\Orb\thisisundefined
  3410. \def\Orb{\mathhexbox20D}
  3411. \fi
  3412. % Quotes.
  3413. \chardef\quotedblleft="5C
  3414. \chardef\quotedblright=`\"
  3415. \chardef\quoteleft=`\`
  3416. \chardef\quoteright=`\'
  3417. \message{page headings,}
  3418. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  3419. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  3420. % First the title page. Must do @settitle before @titlepage.
  3421. \newif\ifseenauthor
  3422. \newif\iffinishedtitlepage
  3423. % @setcontentsaftertitlepage used to do an implicit @contents or
  3424. % @shortcontents after @end titlepage, but it is now obsolete.
  3425. \def\setcontentsaftertitlepage{%
  3426. \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
  3427. command; move your @contents command if you want the contents
  3428. after the title page.}}%
  3429. \def\setshortcontentsaftertitlepage{%
  3430. \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
  3431. command; move your @shortcontents and @contents commands if you
  3432. want the contents after the title page.}}%
  3433. \parseargdef\shorttitlepage{%
  3434. \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  3435. \endgroup\page\hbox{}\page}
  3436. \envdef\titlepage{%
  3437. % Open one extra group, as we want to close it in the middle of \Etitlepage.
  3438. \begingroup
  3439. \parindent=0pt \textfonts
  3440. % Leave some space at the very top of the page.
  3441. \vglue\titlepagetopglue
  3442. % No rule at page bottom unless we print one at the top with @title.
  3443. \finishedtitlepagetrue
  3444. %
  3445. % Most title ``pages'' are actually two pages long, with space
  3446. % at the top of the second. We don't want the ragged left on the second.
  3447. \let\oldpage = \page
  3448. \def\page{%
  3449. \iffinishedtitlepage\else
  3450. \finishtitlepage
  3451. \fi
  3452. \let\page = \oldpage
  3453. \page
  3454. \null
  3455. }%
  3456. }
  3457. \def\Etitlepage{%
  3458. \iffinishedtitlepage\else
  3459. \finishtitlepage
  3460. \fi
  3461. % It is important to do the page break before ending the group,
  3462. % because the headline and footline are only empty inside the group.
  3463. % If we use the new definition of \page, we always get a blank page
  3464. % after the title page, which we certainly don't want.
  3465. \oldpage
  3466. \endgroup
  3467. %
  3468. % Need this before the \...aftertitlepage checks so that if they are
  3469. % in effect the toc pages will come out with page numbers.
  3470. \HEADINGSon
  3471. }
  3472. \def\finishtitlepage{%
  3473. \vskip4pt \hrule height 2pt width \hsize
  3474. \vskip\titlepagebottomglue
  3475. \finishedtitlepagetrue
  3476. }
  3477. % Settings used for typesetting titles: no hyphenation, no indentation,
  3478. % don't worry much about spacing, ragged right. This should be used
  3479. % inside a \vbox, and fonts need to be set appropriately first. \par should
  3480. % be specified before the end of the \vbox, since a vbox is a group.
  3481. %
  3482. \def\raggedtitlesettings{%
  3483. \rm
  3484. \hyphenpenalty=10000
  3485. \parindent=0pt
  3486. \tolerance=5000
  3487. \ptexraggedright
  3488. }
  3489. % Macros to be used within @titlepage:
  3490. \let\subtitlerm=\rmfont
  3491. \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
  3492. \parseargdef\title{%
  3493. \checkenv\titlepage
  3494. \vbox{\titlefonts \raggedtitlesettings #1\par}%
  3495. % print a rule at the page bottom also.
  3496. \finishedtitlepagefalse
  3497. \vskip4pt \hrule height 4pt width \hsize \vskip4pt
  3498. }
  3499. \parseargdef\subtitle{%
  3500. \checkenv\titlepage
  3501. {\subtitlefont \rightline{#1}}%
  3502. }
  3503. % @author should come last, but may come many times.
  3504. % It can also be used inside @quotation.
  3505. %
  3506. \parseargdef\author{%
  3507. \def\temp{\quotation}%
  3508. \ifx\thisenv\temp
  3509. \def\quotationauthor{#1}% printed in \Equotation.
  3510. \else
  3511. \checkenv\titlepage
  3512. \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
  3513. {\secfonts\rm \leftline{#1}}%
  3514. \fi
  3515. }
  3516. % Set up page headings and footings.
  3517. \let\thispage=\folio
  3518. \newtoks\evenheadline % headline on even pages
  3519. \newtoks\oddheadline % headline on odd pages
  3520. \newtoks\evenfootline % footline on even pages
  3521. \newtoks\oddfootline % footline on odd pages
  3522. % Now make \makeheadline and \makefootline in Plain TeX use those variables
  3523. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  3524. \else \the\evenheadline \fi}}
  3525. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  3526. \else \the\evenfootline \fi}\HEADINGShook}
  3527. \let\HEADINGShook=\relax
  3528. % Commands to set those variables.
  3529. % For example, this is what @headings on does
  3530. % @evenheading @thistitle|@thispage|@thischapter
  3531. % @oddheading @thischapter|@thispage|@thistitle
  3532. % @evenfooting @thisfile||
  3533. % @oddfooting ||@thisfile
  3534. \def\evenheading{\parsearg\evenheadingxxx}
  3535. \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
  3536. \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
  3537. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3538. \def\oddheading{\parsearg\oddheadingxxx}
  3539. \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
  3540. \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
  3541. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3542. \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
  3543. \def\evenfooting{\parsearg\evenfootingxxx}
  3544. \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
  3545. \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
  3546. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3547. \def\oddfooting{\parsearg\oddfootingxxx}
  3548. \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
  3549. \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
  3550. \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  3551. %
  3552. % Leave some space for the footline. Hopefully ok to assume
  3553. % @evenfooting will not be used by itself.
  3554. \global\advance\txipageheight by -12pt
  3555. \global\advance\vsize by -12pt
  3556. }
  3557. \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
  3558. % @evenheadingmarks top \thischapter <- chapter at the top of a page
  3559. % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
  3560. %
  3561. % The same set of arguments for:
  3562. %
  3563. % @oddheadingmarks
  3564. % @evenfootingmarks
  3565. % @oddfootingmarks
  3566. % @everyheadingmarks
  3567. % @everyfootingmarks
  3568. % These define \getoddheadingmarks, \getevenheadingmarks,
  3569. % \getoddfootingmarks, and \getevenfootingmarks, each to one of
  3570. % \gettopheadingmarks, \getbottomheadingmarks.
  3571. %
  3572. \def\evenheadingmarks{\headingmarks{even}{heading}}
  3573. \def\oddheadingmarks{\headingmarks{odd}{heading}}
  3574. \def\evenfootingmarks{\headingmarks{even}{footing}}
  3575. \def\oddfootingmarks{\headingmarks{odd}{footing}}
  3576. \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
  3577. \headingmarks{odd}{heading}{#1} }
  3578. \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
  3579. \headingmarks{odd}{footing}{#1} }
  3580. % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
  3581. \def\headingmarks#1#2#3 {%
  3582. \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
  3583. \global\expandafter\let\csname get#1#2marks\endcsname \temp
  3584. }
  3585. \everyheadingmarks bottom
  3586. \everyfootingmarks bottom
  3587. % @headings double turns headings on for double-sided printing.
  3588. % @headings single turns headings on for single-sided printing.
  3589. % @headings off turns them off.
  3590. % @headings on same as @headings double, retained for compatibility.
  3591. % @headings after turns on double-sided headings after this page.
  3592. % @headings doubleafter turns on double-sided headings after this page.
  3593. % @headings singleafter turns on single-sided headings after this page.
  3594. % By default, they are off at the start of a document,
  3595. % and turned `on' after @end titlepage.
  3596. \parseargdef\headings{\csname HEADINGS#1\endcsname}
  3597. \def\headingsoff{% non-global headings elimination
  3598. \evenheadline={\hfil}\evenfootline={\hfil}%
  3599. \oddheadline={\hfil}\oddfootline={\hfil}%
  3600. }
  3601. \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
  3602. \HEADINGSoff % it's the default
  3603. % When we turn headings on, set the page number to 1.
  3604. % For double-sided printing, put current file name in lower left corner,
  3605. % chapter name on inside top of right hand pages, document
  3606. % title on inside top of left hand pages, and page numbers on outside top
  3607. % edge of all pages.
  3608. \def\HEADINGSdouble{%
  3609. \global\pageno=1
  3610. \global\evenfootline={\hfil}
  3611. \global\oddfootline={\hfil}
  3612. \global\evenheadline={\line{\folio\hfil\thistitle}}
  3613. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3614. \global\let\contentsalignmacro = \chapoddpage
  3615. }
  3616. \let\contentsalignmacro = \chappager
  3617. % For single-sided printing, chapter title goes across top left of page,
  3618. % page number on top right.
  3619. \def\HEADINGSsingle{%
  3620. \global\pageno=1
  3621. \global\evenfootline={\hfil}
  3622. \global\oddfootline={\hfil}
  3623. \global\evenheadline={\line{\thischapterheading\hfil\folio}}
  3624. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3625. \global\let\contentsalignmacro = \chappager
  3626. }
  3627. \def\HEADINGSon{\HEADINGSdouble}
  3628. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  3629. \let\HEADINGSdoubleafter=\HEADINGSafter
  3630. \def\HEADINGSdoublex{%
  3631. \global\evenfootline={\hfil}
  3632. \global\oddfootline={\hfil}
  3633. \global\evenheadline={\line{\folio\hfil\thistitle}}
  3634. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3635. \global\let\contentsalignmacro = \chapoddpage
  3636. }
  3637. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  3638. \def\HEADINGSsinglex{%
  3639. \global\evenfootline={\hfil}
  3640. \global\oddfootline={\hfil}
  3641. \global\evenheadline={\line{\thischapterheading\hfil\folio}}
  3642. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3643. \global\let\contentsalignmacro = \chappager
  3644. }
  3645. % Subroutines used in generating headings
  3646. % This produces Day Month Year style of output.
  3647. % Only define if not already defined, in case a txi-??.tex file has set
  3648. % up a different format (e.g., txi-cs.tex does this).
  3649. \ifx\today\thisisundefined
  3650. \def\today{%
  3651. \number\day\space
  3652. \ifcase\month
  3653. \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  3654. \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  3655. \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  3656. \fi
  3657. \space\number\year}
  3658. \fi
  3659. % @settitle line... specifies the title of the document, for headings.
  3660. % It generates no output of its own.
  3661. \def\thistitle{\putwordNoTitle}
  3662. \def\settitle{\parsearg{\gdef\thistitle}}
  3663. \message{tables,}
  3664. % Tables -- @table, @ftable, @vtable, @item(x).
  3665. % default indentation of table text
  3666. \newdimen\tableindent \tableindent=.8in
  3667. % default indentation of @itemize and @enumerate text
  3668. \newdimen\itemindent \itemindent=.3in
  3669. % margin between end of table item and start of table text.
  3670. \newdimen\itemmargin \itemmargin=.1in
  3671. % used internally for \itemindent minus \itemmargin
  3672. \newdimen\itemmax
  3673. % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
  3674. % these defs.
  3675. % They also define \itemindex
  3676. % to index the item name in whatever manner is desired (perhaps none).
  3677. \newif\ifitemxneedsnegativevskip
  3678. \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
  3679. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  3680. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  3681. \def\itemzzz #1{\begingroup %
  3682. \advance\hsize by -\rightskip
  3683. \advance\hsize by -\tableindent
  3684. \setbox0=\hbox{\itemindicate{#1}}%
  3685. \itemindex{#1}%
  3686. \nobreak % This prevents a break before @itemx.
  3687. %
  3688. % If the item text does not fit in the space we have, put it on a line
  3689. % by itself, and do not allow a page break either before or after that
  3690. % line. We do not start a paragraph here because then if the next
  3691. % command is, e.g., @kindex, the whatsit would get put into the
  3692. % horizontal list on a line by itself, resulting in extra blank space.
  3693. \ifdim \wd0>\itemmax
  3694. %
  3695. % Make this a paragraph so we get the \parskip glue and wrapping,
  3696. % but leave it ragged-right.
  3697. \begingroup
  3698. \advance\leftskip by-\tableindent
  3699. \advance\hsize by\tableindent
  3700. \advance\rightskip by0pt plus1fil\relax
  3701. \leavevmode\unhbox0\par
  3702. \endgroup
  3703. %
  3704. % We're going to be starting a paragraph, but we don't want the
  3705. % \parskip glue -- logically it's part of the @item we just started.
  3706. \nobreak \vskip-\parskip
  3707. %
  3708. % Stop a page break at the \parskip glue coming up. However, if
  3709. % what follows is an environment such as @example, there will be no
  3710. % \parskip glue; then the negative vskip we just inserted would
  3711. % cause the example and the item to crash together. So we use this
  3712. % bizarre value of 10001 as a signal to \aboveenvbreak to insert
  3713. % \parskip glue after all. Section titles are handled this way also.
  3714. %
  3715. \penalty 10001
  3716. \endgroup
  3717. \itemxneedsnegativevskipfalse
  3718. \else
  3719. % The item text fits into the space. Start a paragraph, so that the
  3720. % following text (if any) will end up on the same line.
  3721. \noindent
  3722. % Do this with kerns and \unhbox so that if there is a footnote in
  3723. % the item text, it can migrate to the main vertical list and
  3724. % eventually be printed.
  3725. \nobreak\kern-\tableindent
  3726. \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  3727. \unhbox0
  3728. \nobreak\kern\dimen0
  3729. \endgroup
  3730. \itemxneedsnegativevskiptrue
  3731. \fi
  3732. }
  3733. \def\item{\errmessage{@item while not in a list environment}}
  3734. \def\itemx{\errmessage{@itemx while not in a list environment}}
  3735. % @table, @ftable, @vtable.
  3736. \envdef\table{%
  3737. \let\itemindex\gobble
  3738. \tablecheck{table}%
  3739. }
  3740. \envdef\ftable{%
  3741. \def\itemindex ##1{\doind {fn}{\code{##1}}}%
  3742. \tablecheck{ftable}%
  3743. }
  3744. \envdef\vtable{%
  3745. \def\itemindex ##1{\doind {vr}{\code{##1}}}%
  3746. \tablecheck{vtable}%
  3747. }
  3748. \def\tablecheck#1{%
  3749. \ifnum \the\catcode`\^^M=\active
  3750. \endgroup
  3751. \errmessage{This command won't work in this context; perhaps the problem is
  3752. that we are \inenvironment\thisenv}%
  3753. \def\next{\doignore{#1}}%
  3754. \else
  3755. \let\next\tablex
  3756. \fi
  3757. \next
  3758. }
  3759. \def\tablex#1{%
  3760. \def\itemindicate{#1}%
  3761. \parsearg\tabley
  3762. }
  3763. \def\tabley#1{%
  3764. {%
  3765. \makevalueexpandable
  3766. \edef\temp{\noexpand\tablez #1\space\space\space}%
  3767. \expandafter
  3768. }\temp \endtablez
  3769. }
  3770. \def\tablez #1 #2 #3 #4\endtablez{%
  3771. \aboveenvbreak
  3772. \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
  3773. \ifnum 0#2>0 \tableindent=#2\mil \fi
  3774. \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
  3775. \itemmax=\tableindent
  3776. \advance \itemmax by -\itemmargin
  3777. \advance \leftskip by \tableindent
  3778. \exdentamount=\tableindent
  3779. \parindent = 0pt
  3780. \parskip = \smallskipamount
  3781. \ifdim \parskip=0pt \parskip=2pt \fi
  3782. \let\item = \internalBitem
  3783. \let\itemx = \internalBitemx
  3784. }
  3785. \def\Etable{\endgraf\afterenvbreak}
  3786. \let\Eftable\Etable
  3787. \let\Evtable\Etable
  3788. \let\Eitemize\Etable
  3789. \let\Eenumerate\Etable
  3790. % This is the counter used by @enumerate, which is really @itemize
  3791. \newcount \itemno
  3792. \envdef\itemize{\parsearg\doitemize}
  3793. \def\doitemize#1{%
  3794. \aboveenvbreak
  3795. \itemmax=\itemindent
  3796. \advance\itemmax by -\itemmargin
  3797. \advance\leftskip by \itemindent
  3798. \exdentamount=\itemindent
  3799. \parindent=0pt
  3800. \parskip=\smallskipamount
  3801. \ifdim\parskip=0pt \parskip=2pt \fi
  3802. %
  3803. % Try typesetting the item mark so that if the document erroneously says
  3804. % something like @itemize @samp (intending @table), there's an error
  3805. % right away at the @itemize. It's not the best error message in the
  3806. % world, but it's better than leaving it to the @item. This means if
  3807. % the user wants an empty mark, they have to say @w{} not just @w.
  3808. \def\itemcontents{#1}%
  3809. \setbox0 = \hbox{\itemcontents}%
  3810. %
  3811. % @itemize with no arg is equivalent to @itemize @bullet.
  3812. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
  3813. %
  3814. \let\item=\itemizeitem
  3815. }
  3816. % Definition of @item while inside @itemize and @enumerate.
  3817. %
  3818. \def\itemizeitem{%
  3819. \advance\itemno by 1 % for enumerations
  3820. {\let\par=\endgraf \smallbreak}% reasonable place to break
  3821. {%
  3822. % If the document has an @itemize directly after a section title, a
  3823. % \nobreak will be last on the list, and \sectionheading will have
  3824. % done a \vskip-\parskip. In that case, we don't want to zero
  3825. % parskip, or the item text will crash with the heading. On the
  3826. % other hand, when there is normal text preceding the item (as there
  3827. % usually is), we do want to zero parskip, or there would be too much
  3828. % space. In that case, we won't have a \nobreak before. At least
  3829. % that's the theory.
  3830. \ifnum\lastpenalty<10000 \parskip=0in \fi
  3831. \noindent
  3832. \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
  3833. %
  3834. \ifinner\else
  3835. \vadjust{\penalty 1200}% not good to break after first line of item.
  3836. \fi
  3837. % We can be in inner vertical mode in a footnote, although an
  3838. % @itemize looks awful there.
  3839. }%
  3840. \flushcr
  3841. }
  3842. % \splitoff TOKENS\endmark defines \first to be the first token in
  3843. % TOKENS, and \rest to be the remainder.
  3844. %
  3845. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  3846. % Allow an optional argument of an uppercase letter, lowercase letter,
  3847. % or number, to specify the first label in the enumerated list. No
  3848. % argument is the same as `1'.
  3849. %
  3850. \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
  3851. \def\enumeratey #1 #2\endenumeratey{%
  3852. % If we were given no argument, pretend we were given `1'.
  3853. \def\thearg{#1}%
  3854. \ifx\thearg\empty \def\thearg{1}\fi
  3855. %
  3856. % Detect if the argument is a single token. If so, it might be a
  3857. % letter. Otherwise, the only valid thing it can be is a number.
  3858. % (We will always have one token, because of the test we just made.
  3859. % This is a good thing, since \splitoff doesn't work given nothing at
  3860. % all -- the first parameter is undelimited.)
  3861. \expandafter\splitoff\thearg\endmark
  3862. \ifx\rest\empty
  3863. % Only one token in the argument. It could still be anything.
  3864. % A ``lowercase letter'' is one whose \lccode is nonzero.
  3865. % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  3866. % not equal to itself.
  3867. % Otherwise, we assume it's a number.
  3868. %
  3869. % We need the \relax at the end of the \ifnum lines to stop TeX from
  3870. % continuing to look for a <number>.
  3871. %
  3872. \ifnum\lccode\expandafter`\thearg=0\relax
  3873. \numericenumerate % a number (we hope)
  3874. \else
  3875. % It's a letter.
  3876. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  3877. \lowercaseenumerate % lowercase letter
  3878. \else
  3879. \uppercaseenumerate % uppercase letter
  3880. \fi
  3881. \fi
  3882. \else
  3883. % Multiple tokens in the argument. We hope it's a number.
  3884. \numericenumerate
  3885. \fi
  3886. }
  3887. % An @enumerate whose labels are integers. The starting integer is
  3888. % given in \thearg.
  3889. %
  3890. \def\numericenumerate{%
  3891. \itemno = \thearg
  3892. \startenumeration{\the\itemno}%
  3893. }
  3894. % The starting (lowercase) letter is in \thearg.
  3895. \def\lowercaseenumerate{%
  3896. \itemno = \expandafter`\thearg
  3897. \startenumeration{%
  3898. % Be sure we're not beyond the end of the alphabet.
  3899. \ifnum\itemno=0
  3900. \errmessage{No more lowercase letters in @enumerate; get a bigger
  3901. alphabet}%
  3902. \fi
  3903. \char\lccode\itemno
  3904. }%
  3905. }
  3906. % The starting (uppercase) letter is in \thearg.
  3907. \def\uppercaseenumerate{%
  3908. \itemno = \expandafter`\thearg
  3909. \startenumeration{%
  3910. % Be sure we're not beyond the end of the alphabet.
  3911. \ifnum\itemno=0
  3912. \errmessage{No more uppercase letters in @enumerate; get a bigger
  3913. alphabet}
  3914. \fi
  3915. \char\uccode\itemno
  3916. }%
  3917. }
  3918. % Call \doitemize, adding a period to the first argument and supplying the
  3919. % common last two arguments. Also subtract one from the initial value in
  3920. % \itemno, since @item increments \itemno.
  3921. %
  3922. \def\startenumeration#1{%
  3923. \advance\itemno by -1
  3924. \doitemize{#1.}\flushcr
  3925. }
  3926. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  3927. % to @enumerate.
  3928. %
  3929. \def\alphaenumerate{\enumerate{a}}
  3930. \def\capsenumerate{\enumerate{A}}
  3931. \def\Ealphaenumerate{\Eenumerate}
  3932. \def\Ecapsenumerate{\Eenumerate}
  3933. % @multitable macros
  3934. % Amy Hendrickson, 8/18/94, 3/6/96
  3935. %
  3936. % @multitable ... @end multitable will make as many columns as desired.
  3937. % Contents of each column will wrap at width given in preamble. Width
  3938. % can be specified either with sample text given in a template line,
  3939. % or in percent of \hsize, the current width of text on page.
  3940. % Table can continue over pages but will only break between lines.
  3941. % To make preamble:
  3942. %
  3943. % Either define widths of columns in terms of percent of \hsize:
  3944. % @multitable @columnfractions .25 .3 .45
  3945. % @item ...
  3946. %
  3947. % Numbers following @columnfractions are the percent of the total
  3948. % current hsize to be used for each column. You may use as many
  3949. % columns as desired.
  3950. % Or use a template:
  3951. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  3952. % @item ...
  3953. % using the widest term desired in each column.
  3954. % Each new table line starts with @item, each subsequent new column
  3955. % starts with @tab. Empty columns may be produced by supplying @tab's
  3956. % with nothing between them for as many times as empty columns are needed,
  3957. % ie, @tab@tab@tab will produce two empty columns.
  3958. % @item, @tab do not need to be on their own lines, but it will not hurt
  3959. % if they are.
  3960. % Sample multitable:
  3961. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  3962. % @item first col stuff @tab second col stuff @tab third col
  3963. % @item
  3964. % first col stuff
  3965. % @tab
  3966. % second col stuff
  3967. % @tab
  3968. % third col
  3969. % @item first col stuff @tab second col stuff
  3970. % @tab Many paragraphs of text may be used in any column.
  3971. %
  3972. % They will wrap at the width determined by the template.
  3973. % @item@tab@tab This will be in third column.
  3974. % @end multitable
  3975. % Default dimensions may be reset by user.
  3976. % @multitableparskip is vertical space between paragraphs in table.
  3977. % @multitableparindent is paragraph indent in table.
  3978. % @multitablecolmargin is horizontal space to be left between columns.
  3979. % @multitablelinespace is space to leave between table items, baseline
  3980. % to baseline.
  3981. % 0pt means it depends on current normal line spacing.
  3982. %
  3983. \newskip\multitableparskip
  3984. \newskip\multitableparindent
  3985. \newdimen\multitablecolspace
  3986. \newskip\multitablelinespace
  3987. \multitableparskip=0pt
  3988. \multitableparindent=6pt
  3989. \multitablecolspace=12pt
  3990. \multitablelinespace=0pt
  3991. % Macros used to set up halign preamble:
  3992. %
  3993. \let\endsetuptable\relax
  3994. \def\xendsetuptable{\endsetuptable}
  3995. \let\columnfractions\relax
  3996. \def\xcolumnfractions{\columnfractions}
  3997. \newif\ifsetpercent
  3998. % #1 is the @columnfraction, usually a decimal number like .5, but might
  3999. % be just 1. We just use it, whatever it is.
  4000. %
  4001. \def\pickupwholefraction#1 {%
  4002. \global\advance\colcount by 1
  4003. \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
  4004. \setuptable
  4005. }
  4006. \newcount\colcount
  4007. \def\setuptable#1{%
  4008. \def\firstarg{#1}%
  4009. \ifx\firstarg\xendsetuptable
  4010. \let\go = \relax
  4011. \else
  4012. \ifx\firstarg\xcolumnfractions
  4013. \global\setpercenttrue
  4014. \else
  4015. \ifsetpercent
  4016. \let\go\pickupwholefraction
  4017. \else
  4018. \global\advance\colcount by 1
  4019. \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
  4020. % separator; typically that is always in the input, anyway.
  4021. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  4022. \fi
  4023. \fi
  4024. \ifx\go\pickupwholefraction
  4025. % Put the argument back for the \pickupwholefraction call, so
  4026. % we'll always have a period there to be parsed.
  4027. \def\go{\pickupwholefraction#1}%
  4028. \else
  4029. \let\go = \setuptable
  4030. \fi%
  4031. \fi
  4032. \go
  4033. }
  4034. % multitable-only commands.
  4035. %
  4036. % @headitem starts a heading row, which we typeset in bold. Assignments
  4037. % have to be global since we are inside the implicit group of an
  4038. % alignment entry. \everycr below resets \everytab so we don't have to
  4039. % undo it ourselves.
  4040. \def\headitemfont{\b}% for people to use in the template row; not changeable
  4041. \def\headitem{%
  4042. \checkenv\multitable
  4043. \crcr
  4044. \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
  4045. \global\everytab={\bf}% can't use \headitemfont since the parsing differs
  4046. \the\everytab % for the first item
  4047. }%
  4048. %
  4049. % default for tables with no headings.
  4050. \let\headitemcrhook=\relax
  4051. %
  4052. % A \tab used to include \hskip1sp. But then the space in a template
  4053. % line is not enough. That is bad. So let's go back to just `&' until
  4054. % we again encounter the problem the 1sp was intended to solve.
  4055. % --karl, nathan@acm.org, 20apr99.
  4056. \def\tab{\checkenv\multitable &\the\everytab}%
  4057. % @multitable ... @end multitable definitions:
  4058. %
  4059. \newtoks\everytab % insert after every tab.
  4060. %
  4061. \envdef\multitable{%
  4062. \vskip\parskip
  4063. \startsavinginserts
  4064. %
  4065. % @item within a multitable starts a normal row.
  4066. % We use \def instead of \let so that if one of the multitable entries
  4067. % contains an @itemize, we don't choke on the \item (seen as \crcr aka
  4068. % \endtemplate) expanding \doitemize.
  4069. \def\item{\crcr}%
  4070. %
  4071. \tolerance=9500
  4072. \hbadness=9500
  4073. \setmultitablespacing
  4074. \parskip=\multitableparskip
  4075. \parindent=\multitableparindent
  4076. \overfullrule=0pt
  4077. \global\colcount=0
  4078. %
  4079. \everycr = {%
  4080. \noalign{%
  4081. \global\everytab={}% Reset from possible headitem.
  4082. \global\colcount=0 % Reset the column counter.
  4083. %
  4084. % Check for saved footnotes, etc.:
  4085. \checkinserts
  4086. %
  4087. % Perhaps a \nobreak, then reset:
  4088. \headitemcrhook
  4089. \global\let\headitemcrhook=\relax
  4090. }%
  4091. }%
  4092. %
  4093. \parsearg\domultitable
  4094. }
  4095. \def\domultitable#1{%
  4096. % To parse everything between @multitable and @item:
  4097. \setuptable#1 \endsetuptable
  4098. %
  4099. % This preamble sets up a generic column definition, which will
  4100. % be used as many times as user calls for columns.
  4101. % \vtop will set a single line and will also let text wrap and
  4102. % continue for many paragraphs if desired.
  4103. \halign\bgroup &%
  4104. \global\advance\colcount by 1
  4105. \multistrut
  4106. \vtop{%
  4107. % Use the current \colcount to find the correct column width:
  4108. \hsize=\expandafter\csname col\the\colcount\endcsname
  4109. %
  4110. % In order to keep entries from bumping into each other
  4111. % we will add a \leftskip of \multitablecolspace to all columns after
  4112. % the first one.
  4113. %
  4114. % If a template has been used, we will add \multitablecolspace
  4115. % to the width of each template entry.
  4116. %
  4117. % If the user has set preamble in terms of percent of \hsize we will
  4118. % use that dimension as the width of the column, and the \leftskip
  4119. % will keep entries from bumping into each other. Table will start at
  4120. % left margin and final column will justify at right margin.
  4121. %
  4122. % Make sure we don't inherit \rightskip from the outer environment.
  4123. \rightskip=0pt
  4124. \ifnum\colcount=1
  4125. % The first column will be indented with the surrounding text.
  4126. \advance\hsize by\leftskip
  4127. \else
  4128. \ifsetpercent \else
  4129. % If user has not set preamble in terms of percent of \hsize
  4130. % we will advance \hsize by \multitablecolspace.
  4131. \advance\hsize by \multitablecolspace
  4132. \fi
  4133. % In either case we will make \leftskip=\multitablecolspace:
  4134. \leftskip=\multitablecolspace
  4135. \fi
  4136. % Ignoring space at the beginning and end avoids an occasional spurious
  4137. % blank line, when TeX decides to break the line at the space before the
  4138. % box from the multistrut, so the strut ends up on a line by itself.
  4139. % For example:
  4140. % @multitable @columnfractions .11 .89
  4141. % @item @code{#}
  4142. % @tab Legal holiday which is valid in major parts of the whole country.
  4143. % Is automatically provided with highlighting sequences respectively
  4144. % marking characters.
  4145. \noindent\ignorespaces##\unskip\multistrut
  4146. }\cr
  4147. }
  4148. \def\Emultitable{%
  4149. \crcr
  4150. \egroup % end the \halign
  4151. \global\setpercentfalse
  4152. }
  4153. \def\setmultitablespacing{%
  4154. \def\multistrut{\strut}% just use the standard line spacing
  4155. %
  4156. % Compute \multitablelinespace (if not defined by user) for use in
  4157. % \multitableparskip calculation. We used define \multistrut based on
  4158. % this, but (ironically) that caused the spacing to be off.
  4159. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
  4160. \ifdim\multitablelinespace=0pt
  4161. \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
  4162. \global\advance\multitablelinespace by-\ht0
  4163. \fi
  4164. % Test to see if parskip is larger than space between lines of
  4165. % table. If not, do nothing.
  4166. % If so, set to same dimension as multitablelinespace.
  4167. \ifdim\multitableparskip>\multitablelinespace
  4168. \global\multitableparskip=\multitablelinespace
  4169. \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
  4170. % than skip between lines in the table.
  4171. \fi%
  4172. \ifdim\multitableparskip=0pt
  4173. \global\multitableparskip=\multitablelinespace
  4174. \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
  4175. % than skip between lines in the table.
  4176. \fi}
  4177. \message{conditionals,}
  4178. % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
  4179. % @ifnotxml always succeed. They currently do nothing; we don't
  4180. % attempt to check whether the conditionals are properly nested. But we
  4181. % have to remember that they are conditionals, so that @end doesn't
  4182. % attempt to close an environment group.
  4183. %
  4184. \def\makecond#1{%
  4185. \expandafter\let\csname #1\endcsname = \relax
  4186. \expandafter\let\csname iscond.#1\endcsname = 1
  4187. }
  4188. \makecond{iftex}
  4189. \makecond{ifnotdocbook}
  4190. \makecond{ifnothtml}
  4191. \makecond{ifnotinfo}
  4192. \makecond{ifnotplaintext}
  4193. \makecond{ifnotxml}
  4194. % Ignore @ignore, @ifhtml, @ifinfo, and the like.
  4195. %
  4196. \def\direntry{\doignore{direntry}}
  4197. \def\documentdescription{\doignore{documentdescription}}
  4198. \def\docbook{\doignore{docbook}}
  4199. \def\html{\doignore{html}}
  4200. \def\ifdocbook{\doignore{ifdocbook}}
  4201. \def\ifhtml{\doignore{ifhtml}}
  4202. \def\ifinfo{\doignore{ifinfo}}
  4203. \def\ifnottex{\doignore{ifnottex}}
  4204. \def\ifplaintext{\doignore{ifplaintext}}
  4205. \def\ifxml{\doignore{ifxml}}
  4206. \def\ignore{\doignore{ignore}}
  4207. \def\menu{\doignore{menu}}
  4208. \def\xml{\doignore{xml}}
  4209. % Ignore text until a line `@end #1', keeping track of nested conditionals.
  4210. %
  4211. % A count to remember the depth of nesting.
  4212. \newcount\doignorecount
  4213. \def\doignore#1{\begingroup
  4214. % Scan in ``verbatim'' mode:
  4215. \obeylines
  4216. \catcode`\@ = \other
  4217. \catcode`\{ = \other
  4218. \catcode`\} = \other
  4219. %
  4220. % Make sure that spaces turn into tokens that match what \doignoretext wants.
  4221. \spaceisspace
  4222. %
  4223. % Count number of #1's that we've seen.
  4224. \doignorecount = 0
  4225. %
  4226. % Swallow text until we reach the matching `@end #1'.
  4227. \dodoignore{#1}%
  4228. }
  4229. { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
  4230. \obeylines %
  4231. %
  4232. \gdef\dodoignore#1{%
  4233. % #1 contains the command name as a string, e.g., `ifinfo'.
  4234. %
  4235. % Define a command to find the next `@end #1'.
  4236. \long\def\doignoretext##1^^M@end #1{%
  4237. \doignoretextyyy##1^^M@#1\_STOP_}%
  4238. %
  4239. % And this command to find another #1 command, at the beginning of a
  4240. % line. (Otherwise, we would consider a line `@c @ifset', for
  4241. % example, to count as an @ifset for nesting.)
  4242. \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
  4243. %
  4244. % And now expand that command.
  4245. \doignoretext ^^M%
  4246. }%
  4247. }
  4248. \def\doignoreyyy#1{%
  4249. \def\temp{#1}%
  4250. \ifx\temp\empty % Nothing found.
  4251. \let\next\doignoretextzzz
  4252. \else % Found a nested condition, ...
  4253. \advance\doignorecount by 1
  4254. \let\next\doignoretextyyy % ..., look for another.
  4255. % If we're here, #1 ends with ^^M\ifinfo (for example).
  4256. \fi
  4257. \next #1% the token \_STOP_ is present just after this macro.
  4258. }
  4259. % We have to swallow the remaining "\_STOP_".
  4260. %
  4261. \def\doignoretextzzz#1{%
  4262. \ifnum\doignorecount = 0 % We have just found the outermost @end.
  4263. \let\next\enddoignore
  4264. \else % Still inside a nested condition.
  4265. \advance\doignorecount by -1
  4266. \let\next\doignoretext % Look for the next @end.
  4267. \fi
  4268. \next
  4269. }
  4270. % Finish off ignored text.
  4271. { \obeylines%
  4272. % Ignore anything after the last `@end #1'; this matters in verbatim
  4273. % environments, where otherwise the newline after an ignored conditional
  4274. % would result in a blank line in the output.
  4275. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
  4276. }
  4277. % @set VAR sets the variable VAR to an empty value.
  4278. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  4279. %
  4280. % Since we want to separate VAR from REST-OF-LINE (which might be
  4281. % empty), we can't just use \parsearg; we have to insert a space of our
  4282. % own to delimit the rest of the line, and then take it out again if we
  4283. % didn't need it.
  4284. % We rely on the fact that \parsearg sets \catcode`\ =10.
  4285. %
  4286. \parseargdef\set{\setyyy#1 \endsetyyy}
  4287. \def\setyyy#1 #2\endsetyyy{%
  4288. {%
  4289. \makevalueexpandable
  4290. \def\temp{#2}%
  4291. \edef\next{\gdef\makecsname{SET#1}}%
  4292. \ifx\temp\empty
  4293. \next{}%
  4294. \else
  4295. \setzzz#2\endsetzzz
  4296. \fi
  4297. }%
  4298. }
  4299. % Remove the trailing space \setxxx inserted.
  4300. \def\setzzz#1 \endsetzzz{\next{#1}}
  4301. % @clear VAR clears (i.e., unsets) the variable VAR.
  4302. %
  4303. \parseargdef\clear{%
  4304. {%
  4305. \makevalueexpandable
  4306. \global\expandafter\let\csname SET#1\endcsname=\relax
  4307. }%
  4308. }
  4309. % @value{foo} gets the text saved in variable foo.
  4310. \def\value{\begingroup\makevalueexpandable\valuexxx}
  4311. \def\valuexxx#1{\expandablevalue{#1}\endgroup}
  4312. {
  4313. \catcode`\-=\active \catcode`\_=\active
  4314. %
  4315. \gdef\makevalueexpandable{%
  4316. \let\value = \expandablevalue
  4317. % We don't want these characters active, ...
  4318. \catcode`\-=\other \catcode`\_=\other
  4319. % ..., but we might end up with active ones in the argument if
  4320. % we're called from @code, as @code{@value{foo-bar_}}, though.
  4321. % So \let them to their normal equivalents.
  4322. \let-\normaldash \let_\normalunderscore
  4323. }
  4324. }
  4325. % We have this subroutine so that we can handle at least some @value's
  4326. % properly in indexes (we call \makevalueexpandable in \indexdummies).
  4327. % The command has to be fully expandable (if the variable is set), since
  4328. % the result winds up in the index file. This means that if the
  4329. % variable's value contains other Texinfo commands, it's almost certain
  4330. % it will fail (although perhaps we could fix that with sufficient work
  4331. % to do a one-level expansion on the result, instead of complete).
  4332. %
  4333. % Unfortunately, this has the consequence that when _ is in the *value*
  4334. % of an @set, it does not print properly in the roman fonts (get the cmr
  4335. % dot accent at position 126 instead). No fix comes to mind, and it's
  4336. % been this way since 2003 or earlier, so just ignore it.
  4337. %
  4338. \def\expandablevalue#1{%
  4339. \expandafter\ifx\csname SET#1\endcsname\relax
  4340. {[No value for ``#1'']}%
  4341. \message{Variable `#1', used in @value, is not set.}%
  4342. \else
  4343. \csname SET#1\endcsname
  4344. \fi
  4345. }
  4346. % Like \expandablevalue, but completely expandable (the \message in the
  4347. % definition above operates at the execution level of TeX). Used when
  4348. % writing to auxiliary files, due to the expansion that \write does.
  4349. % If flag is undefined, pass through an unexpanded @value command: maybe it
  4350. % will be set by the time it is read back in.
  4351. %
  4352. % NB flag names containing - or _ may not work here.
  4353. \def\dummyvalue#1{%
  4354. \expandafter\ifx\csname SET#1\endcsname\relax
  4355. \noexpand\value{#1}%
  4356. \else
  4357. \csname SET#1\endcsname
  4358. \fi
  4359. }
  4360. % Used for @value's in index entries to form the sort key: expand the @value
  4361. % if possible, otherwise sort late.
  4362. \def\indexnofontsvalue#1{%
  4363. \expandafter\ifx\csname SET#1\endcsname\relax
  4364. ZZZZZZZ
  4365. \else
  4366. \csname SET#1\endcsname
  4367. \fi
  4368. }
  4369. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  4370. % with @set.
  4371. %
  4372. % To get the special treatment we need for `@end ifset,' we call
  4373. % \makecond and then redefine.
  4374. %
  4375. \makecond{ifset}
  4376. \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
  4377. \def\doifset#1#2{%
  4378. {%
  4379. \makevalueexpandable
  4380. \let\next=\empty
  4381. \expandafter\ifx\csname SET#2\endcsname\relax
  4382. #1% If not set, redefine \next.
  4383. \fi
  4384. \expandafter
  4385. }\next
  4386. }
  4387. \def\ifsetfail{\doignore{ifset}}
  4388. % @ifclear VAR ... @end executes the `...' iff VAR has never been
  4389. % defined with @set, or has been undefined with @clear.
  4390. %
  4391. % The `\else' inside the `\doifset' parameter is a trick to reuse the
  4392. % above code: if the variable is not set, do nothing, if it is set,
  4393. % then redefine \next to \ifclearfail.
  4394. %
  4395. \makecond{ifclear}
  4396. \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
  4397. \def\ifclearfail{\doignore{ifclear}}
  4398. % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
  4399. % without the @) is in fact defined. We can only feasibly check at the
  4400. % TeX level, so something like `mathcode' is going to considered
  4401. % defined even though it is not a Texinfo command.
  4402. %
  4403. \makecond{ifcommanddefined}
  4404. \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
  4405. %
  4406. \def\doifcmddefined#1#2{{%
  4407. \makevalueexpandable
  4408. \let\next=\empty
  4409. \expandafter\ifx\csname #2\endcsname\relax
  4410. #1% If not defined, \let\next as above.
  4411. \fi
  4412. \expandafter
  4413. }\next
  4414. }
  4415. \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
  4416. % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
  4417. \makecond{ifcommandnotdefined}
  4418. \def\ifcommandnotdefined{%
  4419. \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
  4420. \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
  4421. % Set the `txicommandconditionals' variable, so documents have a way to
  4422. % test if the @ifcommand...defined conditionals are available.
  4423. \set txicommandconditionals
  4424. % @dircategory CATEGORY -- specify a category of the dir file
  4425. % which this file should belong to. Ignore this in TeX.
  4426. \let\dircategory=\comment
  4427. % @defininfoenclose.
  4428. \let\definfoenclose=\comment
  4429. \message{indexing,}
  4430. % Index generation facilities
  4431. % Define \newwrite to be identical to plain tex's \newwrite
  4432. % except not \outer, so it can be used within macros and \if's.
  4433. \edef\newwrite{\makecsname{ptexnewwrite}}
  4434. % \newindex {foo} defines an index named IX.
  4435. % It automatically defines \IXindex such that
  4436. % \IXindex ...rest of line... puts an entry in the index IX.
  4437. % It also defines \IXindfile to be the number of the output channel for
  4438. % the file that accumulates this index. The file's extension is IX.
  4439. % The name of an index should be no more than 2 characters long
  4440. % for the sake of vms.
  4441. %
  4442. \def\newindex#1{%
  4443. \expandafter\chardef\csname#1indfile\endcsname=0
  4444. \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
  4445. \noexpand\doindex{#1}}
  4446. }
  4447. % @defindex foo == \newindex{foo}
  4448. %
  4449. \def\defindex{\parsearg\newindex}
  4450. % Define @defcodeindex, like @defindex except put all entries in @code.
  4451. %
  4452. \def\defcodeindex{\parsearg\newcodeindex}
  4453. %
  4454. \def\newcodeindex#1{%
  4455. \expandafter\chardef\csname#1indfile\endcsname=0
  4456. \expandafter\xdef\csname#1index\endcsname{%
  4457. \noexpand\docodeindex{#1}}%
  4458. }
  4459. % The default indices:
  4460. \newindex{cp}% concepts,
  4461. \newcodeindex{fn}% functions,
  4462. \newcodeindex{vr}% variables,
  4463. \newcodeindex{tp}% types,
  4464. \newcodeindex{ky}% keys
  4465. \newcodeindex{pg}% and programs.
  4466. % @synindex foo bar makes index foo feed into index bar.
  4467. % Do this instead of @defindex foo if you don't want it as a separate index.
  4468. %
  4469. % @syncodeindex foo bar similar, but put all entries made for index foo
  4470. % inside @code.
  4471. %
  4472. \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
  4473. \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
  4474. % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
  4475. % #3 the target index (bar).
  4476. \def\dosynindex#1#2#3{%
  4477. \requireopenindexfile{#3}%
  4478. % redefine \fooindfile:
  4479. \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  4480. \expandafter\let\csname#2indfile\endcsname=\temp
  4481. % redefine \fooindex:
  4482. \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
  4483. }
  4484. % Define \doindex, the driver for all index macros.
  4485. % Argument #1 is generated by the calling \fooindex macro,
  4486. % and it is the two-letter name of the index.
  4487. \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
  4488. \def\doindexxxx #1{\doind{\indexname}{#1}}
  4489. % like the previous two, but they put @code around the argument.
  4490. \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
  4491. \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
  4492. % Used when writing an index entry out to an index file to prevent
  4493. % expansion of Texinfo commands that can appear in an index entry.
  4494. %
  4495. \def\indexdummies{%
  4496. \escapechar = `\\ % use backslash in output files.
  4497. \definedummyletter\@%
  4498. \definedummyletter\ %
  4499. %
  4500. % For texindex which always views { and } as separators.
  4501. \def\{{\lbracechar{}}%
  4502. \def\}{\rbracechar{}}%
  4503. %
  4504. % Do the redefinitions.
  4505. \definedummies
  4506. }
  4507. % Used for the aux and toc files, where @ is the escape character.
  4508. %
  4509. \def\atdummies{%
  4510. \definedummyletter\@%
  4511. \definedummyletter\ %
  4512. \definedummyletter\{%
  4513. \definedummyletter\}%
  4514. %
  4515. % Do the redefinitions.
  4516. \definedummies
  4517. \otherbackslash
  4518. }
  4519. % \definedummyword defines \#1 as \string\#1\space, thus effectively
  4520. % preventing its expansion. This is used only for control words,
  4521. % not control letters, because the \space would be incorrect for
  4522. % control characters, but is needed to separate the control word
  4523. % from whatever follows.
  4524. %
  4525. % These can be used both for control words that take an argument and
  4526. % those that do not. If it is followed by {arg} in the input, then
  4527. % that will dutifully get written to the index (or wherever).
  4528. %
  4529. % For control letters, we have \definedummyletter, which omits the
  4530. % space.
  4531. %
  4532. \def\definedummyword #1{\def#1{\string#1\space}}%
  4533. \def\definedummyletter#1{\def#1{\string#1}}%
  4534. \let\definedummyaccent\definedummyletter
  4535. % Called from \indexdummies and \atdummies, to effectively prevent
  4536. % the expansion of commands.
  4537. %
  4538. \def\definedummies{%
  4539. %
  4540. \let\commondummyword\definedummyword
  4541. \let\commondummyletter\definedummyletter
  4542. \let\commondummyaccent\definedummyaccent
  4543. \commondummiesnofonts
  4544. %
  4545. \definedummyletter\_%
  4546. \definedummyletter\-%
  4547. %
  4548. % Non-English letters.
  4549. \definedummyword\AA
  4550. \definedummyword\AE
  4551. \definedummyword\DH
  4552. \definedummyword\L
  4553. \definedummyword\O
  4554. \definedummyword\OE
  4555. \definedummyword\TH
  4556. \definedummyword\aa
  4557. \definedummyword\ae
  4558. \definedummyword\dh
  4559. \definedummyword\exclamdown
  4560. \definedummyword\l
  4561. \definedummyword\o
  4562. \definedummyword\oe
  4563. \definedummyword\ordf
  4564. \definedummyword\ordm
  4565. \definedummyword\questiondown
  4566. \definedummyword\ss
  4567. \definedummyword\th
  4568. %
  4569. % Although these internal commands shouldn't show up, sometimes they do.
  4570. \definedummyword\bf
  4571. \definedummyword\gtr
  4572. \definedummyword\hat
  4573. \definedummyword\less
  4574. \definedummyword\sf
  4575. \definedummyword\sl
  4576. \definedummyword\tclose
  4577. \definedummyword\tt
  4578. %
  4579. \definedummyword\LaTeX
  4580. \definedummyword\TeX
  4581. %
  4582. % Assorted special characters.
  4583. \definedummyword\atchar
  4584. \definedummyword\arrow
  4585. \definedummyword\bullet
  4586. \definedummyword\comma
  4587. \definedummyword\copyright
  4588. \definedummyword\registeredsymbol
  4589. \definedummyword\dots
  4590. \definedummyword\enddots
  4591. \definedummyword\entrybreak
  4592. \definedummyword\equiv
  4593. \definedummyword\error
  4594. \definedummyword\euro
  4595. \definedummyword\expansion
  4596. \definedummyword\geq
  4597. \definedummyword\guillemetleft
  4598. \definedummyword\guillemetright
  4599. \definedummyword\guilsinglleft
  4600. \definedummyword\guilsinglright
  4601. \definedummyword\lbracechar
  4602. \definedummyword\leq
  4603. \definedummyword\mathopsup
  4604. \definedummyword\minus
  4605. \definedummyword\ogonek
  4606. \definedummyword\pounds
  4607. \definedummyword\point
  4608. \definedummyword\print
  4609. \definedummyword\quotedblbase
  4610. \definedummyword\quotedblleft
  4611. \definedummyword\quotedblright
  4612. \definedummyword\quoteleft
  4613. \definedummyword\quoteright
  4614. \definedummyword\quotesinglbase
  4615. \definedummyword\rbracechar
  4616. \definedummyword\result
  4617. \definedummyword\sub
  4618. \definedummyword\sup
  4619. \definedummyword\textdegree
  4620. %
  4621. % We want to disable all macros so that they are not expanded by \write.
  4622. \macrolist
  4623. \let\value\dummyvalue
  4624. %
  4625. \normalturnoffactive
  4626. }
  4627. % \commondummiesnofonts: common to \definedummies and \indexnofonts.
  4628. % Define \commondummyletter, \commondummyaccent and \commondummyword before
  4629. % using. Used for accents, font commands, and various control letters.
  4630. %
  4631. \def\commondummiesnofonts{%
  4632. % Control letters and accents.
  4633. \commondummyletter\!%
  4634. \commondummyaccent\"%
  4635. \commondummyaccent\'%
  4636. \commondummyletter\*%
  4637. \commondummyaccent\,%
  4638. \commondummyletter\.%
  4639. \commondummyletter\/%
  4640. \commondummyletter\:%
  4641. \commondummyaccent\=%
  4642. \commondummyletter\?%
  4643. \commondummyaccent\^%
  4644. \commondummyaccent\`%
  4645. \commondummyaccent\~%
  4646. \commondummyword\u
  4647. \commondummyword\v
  4648. \commondummyword\H
  4649. \commondummyword\dotaccent
  4650. \commondummyword\ogonek
  4651. \commondummyword\ringaccent
  4652. \commondummyword\tieaccent
  4653. \commondummyword\ubaraccent
  4654. \commondummyword\udotaccent
  4655. \commondummyword\dotless
  4656. %
  4657. % Texinfo font commands.
  4658. \commondummyword\b
  4659. \commondummyword\i
  4660. \commondummyword\r
  4661. \commondummyword\sansserif
  4662. \commondummyword\sc
  4663. \commondummyword\slanted
  4664. \commondummyword\t
  4665. %
  4666. % Commands that take arguments.
  4667. \commondummyword\abbr
  4668. \commondummyword\acronym
  4669. \commondummyword\anchor
  4670. \commondummyword\cite
  4671. \commondummyword\code
  4672. \commondummyword\command
  4673. \commondummyword\dfn
  4674. \commondummyword\dmn
  4675. \commondummyword\email
  4676. \commondummyword\emph
  4677. \commondummyword\env
  4678. \commondummyword\file
  4679. \commondummyword\image
  4680. \commondummyword\indicateurl
  4681. \commondummyword\inforef
  4682. \commondummyword\kbd
  4683. \commondummyword\key
  4684. \commondummyword\math
  4685. \commondummyword\option
  4686. \commondummyword\pxref
  4687. \commondummyword\ref
  4688. \commondummyword\samp
  4689. \commondummyword\strong
  4690. \commondummyword\tie
  4691. \commondummyword\U
  4692. \commondummyword\uref
  4693. \commondummyword\url
  4694. \commondummyword\var
  4695. \commondummyword\verb
  4696. \commondummyword\w
  4697. \commondummyword\xref
  4698. }
  4699. % For testing: output @{ and @} in index sort strings as \{ and \}.
  4700. \newif\ifusebracesinindexes
  4701. \let\indexlbrace\relax
  4702. \let\indexrbrace\relax
  4703. {\catcode`\@=0
  4704. \catcode`\\=13
  4705. @gdef@backslashdisappear{@def\{}}
  4706. }
  4707. {
  4708. \catcode`\<=13
  4709. \catcode`\-=13
  4710. \catcode`\`=13
  4711. \gdef\indexnonalnumdisappear{%
  4712. \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
  4713. % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
  4714. % (Introduced for FSFS 2nd ed.)
  4715. \let`=\empty
  4716. \fi
  4717. %
  4718. \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
  4719. \backslashdisappear
  4720. \fi
  4721. %
  4722. \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
  4723. \def-{}%
  4724. \fi
  4725. \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
  4726. \def<{}%
  4727. \fi
  4728. \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
  4729. \def\@{}%
  4730. \fi
  4731. }
  4732. \gdef\indexnonalnumreappear{%
  4733. \useindexbackslash
  4734. \let-\normaldash
  4735. \let<\normalless
  4736. \def\@{@}%
  4737. }
  4738. }
  4739. % \indexnofonts is used when outputting the strings to sort the index
  4740. % by, and when constructing control sequence names. It eliminates all
  4741. % control sequences and just writes whatever the best ASCII sort string
  4742. % would be for a given command (usually its argument).
  4743. %
  4744. \def\indexnofonts{%
  4745. % Accent commands should become @asis.
  4746. \def\commondummyaccent##1{\let##1\asis}%
  4747. % We can just ignore other control letters.
  4748. \def\commondummyletter##1{\let##1\empty}%
  4749. % All control words become @asis by default; overrides below.
  4750. \let\commondummyword\commondummyaccent
  4751. \commondummiesnofonts
  4752. %
  4753. % Don't no-op \tt, since it isn't a user-level command
  4754. % and is used in the definitions of the active chars like <, >, |, etc.
  4755. % Likewise with the other plain tex font commands.
  4756. %\let\tt=\asis
  4757. %
  4758. \def\ { }%
  4759. \def\@{@}%
  4760. \def\_{\normalunderscore}%
  4761. \def\-{}% @- shouldn't affect sorting
  4762. %
  4763. \uccode`\1=`\{ \uppercase{\def\{{1}}%
  4764. \uccode`\1=`\} \uppercase{\def\}{1}}%
  4765. \let\lbracechar\{%
  4766. \let\rbracechar\}%
  4767. %
  4768. % Non-English letters.
  4769. \def\AA{AA}%
  4770. \def\AE{AE}%
  4771. \def\DH{DZZ}%
  4772. \def\L{L}%
  4773. \def\OE{OE}%
  4774. \def\O{O}%
  4775. \def\TH{TH}%
  4776. \def\aa{aa}%
  4777. \def\ae{ae}%
  4778. \def\dh{dzz}%
  4779. \def\exclamdown{!}%
  4780. \def\l{l}%
  4781. \def\oe{oe}%
  4782. \def\ordf{a}%
  4783. \def\ordm{o}%
  4784. \def\o{o}%
  4785. \def\questiondown{?}%
  4786. \def\ss{ss}%
  4787. \def\th{th}%
  4788. %
  4789. \def\LaTeX{LaTeX}%
  4790. \def\TeX{TeX}%
  4791. %
  4792. % Assorted special characters. \defglyph gives the control sequence a
  4793. % definition that removes the {} that follows its use.
  4794. \defglyph\atchar{@}%
  4795. \defglyph\arrow{->}%
  4796. \defglyph\bullet{bullet}%
  4797. \defglyph\comma{,}%
  4798. \defglyph\copyright{copyright}%
  4799. \defglyph\dots{...}%
  4800. \defglyph\enddots{...}%
  4801. \defglyph\equiv{==}%
  4802. \defglyph\error{error}%
  4803. \defglyph\euro{euro}%
  4804. \defglyph\expansion{==>}%
  4805. \defglyph\geq{>=}%
  4806. \defglyph\guillemetleft{<<}%
  4807. \defglyph\guillemetright{>>}%
  4808. \defglyph\guilsinglleft{<}%
  4809. \defglyph\guilsinglright{>}%
  4810. \defglyph\leq{<=}%
  4811. \defglyph\lbracechar{\{}%
  4812. \defglyph\minus{-}%
  4813. \defglyph\point{.}%
  4814. \defglyph\pounds{pounds}%
  4815. \defglyph\print{-|}%
  4816. \defglyph\quotedblbase{"}%
  4817. \defglyph\quotedblleft{"}%
  4818. \defglyph\quotedblright{"}%
  4819. \defglyph\quoteleft{`}%
  4820. \defglyph\quoteright{'}%
  4821. \defglyph\quotesinglbase{,}%
  4822. \defglyph\rbracechar{\}}%
  4823. \defglyph\registeredsymbol{R}%
  4824. \defglyph\result{=>}%
  4825. \defglyph\textdegree{o}%
  4826. %
  4827. % We need to get rid of all macros, leaving only the arguments (if present).
  4828. % Of course this is not nearly correct, but it is the best we can do for now.
  4829. % makeinfo does not expand macros in the argument to @deffn, which ends up
  4830. % writing an index entry, and texindex isn't prepared for an index sort entry
  4831. % that starts with \.
  4832. %
  4833. % Since macro invocations are followed by braces, we can just redefine them
  4834. % to take a single TeX argument. The case of a macro invocation that
  4835. % goes to end-of-line is not handled.
  4836. %
  4837. \macrolist
  4838. \let\value\indexnofontsvalue
  4839. }
  4840. \def\defglyph#1#2{\def#1##1{#2}} % see above
  4841. \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  4842. % Most index entries go through here, but \dosubind is the general case.
  4843. % #1 is the index name, #2 is the entry text.
  4844. \def\doind#1#2{\dosubind{#1}{#2}{}}
  4845. % There is also \dosubind {index}{topic}{subtopic}
  4846. % which makes an entry in a two-level index such as the operation index.
  4847. % TODO: Two-level index? Operation index?
  4848. % Workhorse for all indexes.
  4849. % #1 is name of index, #2 is stuff to put there, #3 is subentry --
  4850. % empty if called from \doind, as we usually are (the main exception
  4851. % is with most defuns, which call us directly).
  4852. %
  4853. \def\dosubind#1#2#3{%
  4854. \iflinks
  4855. {%
  4856. \requireopenindexfile{#1}%
  4857. % Store the main index entry text (including the third arg).
  4858. \toks0 = {#2}%
  4859. % If third arg is present, precede it with a space.
  4860. \def\thirdarg{#3}%
  4861. \ifx\thirdarg\empty \else
  4862. \toks0 = \expandafter{\the\toks0 \space #3}%
  4863. \fi
  4864. %
  4865. \edef\writeto{\csname#1indfile\endcsname}%
  4866. %
  4867. \safewhatsit\dosubindwrite
  4868. }%
  4869. \fi
  4870. }
  4871. % Check if an index file has been opened, and if not, open it.
  4872. \def\requireopenindexfile#1{%
  4873. \ifnum\csname #1indfile\endcsname=0
  4874. \expandafter\newwrite \csname#1indfile\endcsname
  4875. \edef\suffix{#1}%
  4876. % A .fls suffix would conflict with the file extension for the output
  4877. % of -recorder, so use .f1s instead.
  4878. \ifx\suffix\indexisfl\def\suffix{f1}\fi
  4879. % Open the file
  4880. \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
  4881. % Using \immediate above here prevents an object entering into the current
  4882. % box, which could confound checks such as those in \safewhatsit for
  4883. % preceding skips.
  4884. \typeout{Writing index file \jobname.\suffix}%
  4885. \fi}
  4886. \def\indexisfl{fl}
  4887. % Output \ as {\indexbackslash}, because \ is an escape character in
  4888. % the index files.
  4889. \let\indexbackslash=\relax
  4890. {\catcode`\@=0 \catcode`\\=\active
  4891. @gdef@useindexbackslash{@def\{{@indexbackslash}}}
  4892. }
  4893. % Definition for writing index entry text.
  4894. \def\sortas#1{\ignorespaces}%
  4895. % Definition for writing index entry sort key. Should occur at the at
  4896. % the beginning of the index entry, like
  4897. % @cindex @sortas{september} \september
  4898. % The \ignorespaces takes care of following space, but there's no way
  4899. % to remove space before it.
  4900. {
  4901. \catcode`\-=13
  4902. \gdef\indexwritesortas{%
  4903. \begingroup
  4904. \indexnonalnumreappear
  4905. \indexwritesortasxxx}
  4906. \gdef\indexwritesortasxxx#1{%
  4907. \xdef\indexsortkey{#1}\endgroup}
  4908. }
  4909. % Write the entry in \toks0 to the index file.
  4910. %
  4911. \def\dosubindwrite{%
  4912. % Put the index entry in the margin if desired.
  4913. \ifx\SETmarginindex\relax\else
  4914. \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
  4915. \fi
  4916. %
  4917. % Remember, we are within a group.
  4918. \indexdummies % Must do this here, since \bf, etc expand at this stage
  4919. \useindexbackslash % \indexbackslash isn't defined now so it will be output
  4920. % as is; and it will print as backslash.
  4921. % The braces around \indexbrace are recognized by texindex.
  4922. %
  4923. % Get the string to sort by, by processing the index entry with all
  4924. % font commands turned off.
  4925. {\indexnofonts
  4926. \def\lbracechar{{\indexlbrace}}%
  4927. \def\rbracechar{{\indexrbrace}}%
  4928. \let\{=\lbracechar
  4929. \let\}=\rbracechar
  4930. \indexnonalnumdisappear
  4931. \xdef\indexsortkey{}%
  4932. \let\sortas=\indexwritesortas
  4933. \edef\temp{\the\toks0}%
  4934. \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
  4935. \ifx\indexsortkey\empty
  4936. \xdef\indexsortkey{\temp}%
  4937. \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
  4938. \fi
  4939. }%
  4940. %
  4941. % Set up the complete index entry, with both the sort key and
  4942. % the original text, including any font commands. We write
  4943. % three arguments to \entry to the .?? file (four in the
  4944. % subentry case), texindex reduces to two when writing the .??s
  4945. % sorted result.
  4946. \edef\temp{%
  4947. \write\writeto{%
  4948. \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
  4949. }%
  4950. \temp
  4951. }
  4952. \newbox\dummybox % used above
  4953. % Take care of unwanted page breaks/skips around a whatsit:
  4954. %
  4955. % If a skip is the last thing on the list now, preserve it
  4956. % by backing up by \lastskip, doing the \write, then inserting
  4957. % the skip again. Otherwise, the whatsit generated by the
  4958. % \write or \pdfdest will make \lastskip zero. The result is that
  4959. % sequences like this:
  4960. % @end defun
  4961. % @tindex whatever
  4962. % @defun ...
  4963. % will have extra space inserted, because the \medbreak in the
  4964. % start of the @defun won't see the skip inserted by the @end of
  4965. % the previous defun.
  4966. %
  4967. % But don't do any of this if we're not in vertical mode. We
  4968. % don't want to do a \vskip and prematurely end a paragraph.
  4969. %
  4970. % Avoid page breaks due to these extra skips, too.
  4971. %
  4972. % But wait, there is a catch there:
  4973. % We'll have to check whether \lastskip is zero skip. \ifdim is not
  4974. % sufficient for this purpose, as it ignores stretch and shrink parts
  4975. % of the skip. The only way seems to be to check the textual
  4976. % representation of the skip.
  4977. %
  4978. % The following is almost like \def\zeroskipmacro{0.0pt} except that
  4979. % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
  4980. %
  4981. \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
  4982. %
  4983. \newskip\whatsitskip
  4984. \newcount\whatsitpenalty
  4985. %
  4986. % ..., ready, GO:
  4987. %
  4988. \def\safewhatsit#1{\ifhmode
  4989. #1%
  4990. \else
  4991. % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
  4992. \whatsitskip = \lastskip
  4993. \edef\lastskipmacro{\the\lastskip}%
  4994. \whatsitpenalty = \lastpenalty
  4995. %
  4996. % If \lastskip is nonzero, that means the last item was a
  4997. % skip. And since a skip is discardable, that means this
  4998. % -\whatsitskip glue we're inserting is preceded by a
  4999. % non-discardable item, therefore it is not a potential
  5000. % breakpoint, therefore no \nobreak needed.
  5001. \ifx\lastskipmacro\zeroskipmacro
  5002. \else
  5003. \vskip-\whatsitskip
  5004. \fi
  5005. %
  5006. #1%
  5007. %
  5008. \ifx\lastskipmacro\zeroskipmacro
  5009. % If \lastskip was zero, perhaps the last item was a penalty, and
  5010. % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
  5011. % to re-insert the same penalty (values >10000 are used for various
  5012. % signals); since we just inserted a non-discardable item, any
  5013. % following glue (such as a \parskip) would be a breakpoint. For example:
  5014. % @deffn deffn-whatever
  5015. % @vindex index-whatever
  5016. % Description.
  5017. % would allow a break between the index-whatever whatsit
  5018. % and the "Description." paragraph.
  5019. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
  5020. \else
  5021. % On the other hand, if we had a nonzero \lastskip,
  5022. % this make-up glue would be preceded by a non-discardable item
  5023. % (the whatsit from the \write), so we must insert a \nobreak.
  5024. \nobreak\vskip\whatsitskip
  5025. \fi
  5026. \fi}
  5027. % The index entry written in the file actually looks like
  5028. % \entry {sortstring}{page}{topic}
  5029. % or
  5030. % \entry {sortstring}{page}{topic}{subtopic}
  5031. % The texindex program reads in these files and writes files
  5032. % containing these kinds of lines:
  5033. % \initial {c}
  5034. % before the first topic whose initial is c
  5035. % \entry {topic}{pagelist}
  5036. % for a topic that is used without subtopics
  5037. % \primary {topic}
  5038. % for the beginning of a topic that is used with subtopics
  5039. % \secondary {subtopic}{pagelist}
  5040. % for each subtopic.
  5041. % Define the user-accessible indexing commands
  5042. % @findex, @vindex, @kindex, @cindex.
  5043. \def\findex {\fnindex}
  5044. \def\kindex {\kyindex}
  5045. \def\cindex {\cpindex}
  5046. \def\vindex {\vrindex}
  5047. \def\tindex {\tpindex}
  5048. \def\pindex {\pgindex}
  5049. \def\cindexsub {\begingroup\obeylines\cindexsub}
  5050. {\obeylines %
  5051. \gdef\cindexsub "#1" #2^^M{\endgroup %
  5052. \dosubind{cp}{#2}{#1}}}
  5053. % Define the macros used in formatting output of the sorted index material.
  5054. % @printindex causes a particular index (the ??s file) to get printed.
  5055. % It does not print any chapter heading (usually an @unnumbered).
  5056. %
  5057. \parseargdef\printindex{\begingroup
  5058. \dobreak \chapheadingskip{10000}%
  5059. %
  5060. \smallfonts \rm
  5061. \tolerance = 9500
  5062. \plainfrenchspacing
  5063. \everypar = {}% don't want the \kern\-parindent from indentation suppression.
  5064. %
  5065. % See if the index file exists and is nonempty.
  5066. % Change catcode of @ here so that if the index file contains
  5067. % \initial {@}
  5068. % as its first line, TeX doesn't complain about mismatched braces
  5069. % (because it thinks @} is a control sequence).
  5070. \catcode`\@ = 12
  5071. % See comment in \requireopenindexfile.
  5072. \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
  5073. \openin 1 \jobname.\indexname s
  5074. \ifeof 1
  5075. % \enddoublecolumns gets confused if there is no text in the index,
  5076. % and it loses the chapter title and the aux file entries for the
  5077. % index. The easiest way to prevent this problem is to make sure
  5078. % there is some text.
  5079. \putwordIndexNonexistent
  5080. \typeout{No file \jobname.\indexname s.}%
  5081. \else
  5082. \catcode`\\ = 0
  5083. %
  5084. % If the index file exists but is empty, then \openin leaves \ifeof
  5085. % false. We have to make TeX try to read something from the file, so
  5086. % it can discover if there is anything in it.
  5087. \read 1 to \thisline
  5088. \ifeof 1
  5089. \putwordIndexIsEmpty
  5090. \else
  5091. % Index files are almost Texinfo source, but we use \ as the escape
  5092. % character. It would be better to use @, but that's too big a change
  5093. % to make right now.
  5094. \def\indexbackslash{\ttbackslash}%
  5095. \let\indexlbrace\{ % Likewise, set these sequences for braces
  5096. \let\indexrbrace\} % used in the sort key.
  5097. \begindoublecolumns
  5098. \let\entrywidowpenalty=\indexwidowpenalty
  5099. %
  5100. % Read input from the index file line by line.
  5101. \loopdo
  5102. \ifeof1
  5103. \let\firsttoken\relax
  5104. \else
  5105. \read 1 to \nextline
  5106. \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
  5107. \act
  5108. \fi
  5109. \thisline
  5110. %
  5111. \ifeof1\else
  5112. \let\thisline\nextline
  5113. \repeat
  5114. %%
  5115. \enddoublecolumns
  5116. \fi
  5117. \fi
  5118. \closein 1
  5119. \endgroup}
  5120. \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
  5121. \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
  5122. \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
  5123. \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
  5124. % These macros are used by the sorted index file itself.
  5125. % Change them to control the appearance of the index.
  5126. {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
  5127. \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
  5128. \catcode`\$=3
  5129. \gdef\initialglyphs{%
  5130. % Some changes for non-alphabetic characters. Using the glyphs from the
  5131. % math fonts looks more consistent than the typewriter font used elsewhere
  5132. % for these characters.
  5133. \def\indexbackslash{\math{\backslash}}%
  5134. \let\\=\indexbackslash
  5135. %
  5136. % Can't get bold backslash so don't use bold forward slash
  5137. \catcode`\/=13
  5138. \def/{{\secrmnotbold \normalslash}}%
  5139. \def-{{\normaldash\normaldash}}% en dash `--'
  5140. \def^{{\chapbf \normalcaret}}%
  5141. \def~{{\chapbf \normaltilde}}%
  5142. \def\_{%
  5143. \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
  5144. \def|{$\vert$}%
  5145. \def<{$\less$}%
  5146. \def>{$\gtr$}%
  5147. \def+{$\normalplus$}%
  5148. }}
  5149. \def\initial{%
  5150. \bgroup
  5151. \initialglyphs
  5152. \initialx
  5153. }
  5154. \def\initialx#1{%
  5155. % Remove any glue we may have, we'll be inserting our own.
  5156. \removelastskip
  5157. %
  5158. % We like breaks before the index initials, so insert a bonus.
  5159. % The glue before the bonus allows a little bit of space at the
  5160. % bottom of a column to reduce an increase in inter-line spacing.
  5161. \nobreak
  5162. \vskip 0pt plus 5\baselineskip
  5163. \penalty -300
  5164. \vskip 0pt plus -5\baselineskip
  5165. %
  5166. % Typeset the initial. Making this add up to a whole number of
  5167. % baselineskips increases the chance of the dots lining up from column
  5168. % to column. It still won't often be perfect, because of the stretch
  5169. % we need before each entry, but it's better.
  5170. %
  5171. % No shrink because it confuses \balancecolumns.
  5172. \vskip 1.67\baselineskip plus 1\baselineskip
  5173. \leftline{\secfonts \kern-0.05em \secbf #1}%
  5174. % \secfonts is inside the argument of \leftline so that the change of
  5175. % \baselineskip will not affect any glue inserted before the vbox that
  5176. % \leftline creates.
  5177. % Do our best not to break after the initial.
  5178. \nobreak
  5179. \vskip .33\baselineskip plus .1\baselineskip
  5180. \egroup % \initialglyphs
  5181. }
  5182. \newdimen\entryrightmargin
  5183. \entryrightmargin=0pt
  5184. % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
  5185. % then page number (#2) flushed to the right margin. It is used for index
  5186. % and table of contents entries. The paragraph is indented by \leftskip.
  5187. %
  5188. \def\entry{%
  5189. \begingroup
  5190. %
  5191. % For pdfTeX and XeTeX.
  5192. % The redefinition of \domark stops marks being added in \pdflink to
  5193. % preserve coloured links across page boundaries. Otherwise the marks
  5194. % would get in the way of \lastbox in \insertindexentrybox.
  5195. \let\domark\relax
  5196. %
  5197. % Start a new paragraph if necessary, so our assignments below can't
  5198. % affect previous text.
  5199. \par
  5200. %
  5201. % No extra space above this paragraph.
  5202. \parskip = 0in
  5203. %
  5204. % When reading the text of entry, convert explicit line breaks
  5205. % from @* into spaces. The user might give these in long section
  5206. % titles, for instance.
  5207. \def\*{\unskip\space\ignorespaces}%
  5208. \def\entrybreak{\hfil\break}% An undocumented command
  5209. %
  5210. % Swallow the left brace of the text (first parameter):
  5211. \afterassignment\doentry
  5212. \let\temp =
  5213. }
  5214. \def\entrybreak{\unskip\space\ignorespaces}%
  5215. \def\doentry{%
  5216. % Save the text of the entry
  5217. \global\setbox\boxA=\hbox\bgroup
  5218. \bgroup % Instead of the swallowed brace.
  5219. \noindent
  5220. \aftergroup\finishentry
  5221. % And now comes the text of the entry.
  5222. % Not absorbing as a macro argument reduces the chance of problems
  5223. % with catcodes occurring.
  5224. }
  5225. {\catcode`\@=11
  5226. \gdef\finishentry#1{%
  5227. \egroup % end box A
  5228. \dimen@ = \wd\boxA % Length of text of entry
  5229. \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
  5230. % #1 is the page number.
  5231. %
  5232. % Get the width of the page numbers, and only use
  5233. % leaders if they are present.
  5234. \global\setbox\boxB = \hbox{#1}%
  5235. \ifdim\wd\boxB = 0pt
  5236. \null\nobreak\hfill\ %
  5237. \else
  5238. %
  5239. \null\nobreak\indexdotfill % Have leaders before the page number.
  5240. %
  5241. \ifpdf
  5242. \pdfgettoks#1.%
  5243. \hskip\skip\thinshrinkable\the\toksA
  5244. \else
  5245. \ifx\XeTeXrevision\thisisundefined
  5246. \hskip\skip\thinshrinkable #1%
  5247. \else
  5248. \pdfgettoks#1.%
  5249. \hskip\skip\thinshrinkable\the\toksA
  5250. \fi
  5251. \fi
  5252. \fi
  5253. \egroup % end \boxA
  5254. \ifdim\wd\boxB = 0pt
  5255. \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
  5256. \else
  5257. \global\setbox\entryindexbox=\vbox\bgroup
  5258. % We want the text of the entries to be aligned to the left, and the
  5259. % page numbers to be aligned to the right.
  5260. %
  5261. \parindent = 0pt
  5262. \advance\leftskip by 0pt plus 1fil
  5263. \advance\leftskip by 0pt plus -1fill
  5264. \rightskip = 0pt plus -1fil
  5265. \advance\rightskip by 0pt plus 1fill
  5266. % Cause last line, which could consist of page numbers on their own
  5267. % if the list of page numbers is long, to be aligned to the right.
  5268. \parfillskip=0pt plus -1fill
  5269. %
  5270. \advance\rightskip by \entryrightmargin
  5271. % Determine how far we can stretch into the margin.
  5272. % This allows, e.g., "Appendix H GNU Free Documentation License" to
  5273. % fit on one line in @letterpaper format.
  5274. \ifdim\entryrightmargin>2.1em
  5275. \dimen@i=2.1em
  5276. \else
  5277. \dimen@i=0em
  5278. \fi
  5279. \advance \parfillskip by 0pt minus 1\dimen@i
  5280. %
  5281. \dimen@ii = \hsize
  5282. \advance\dimen@ii by -1\leftskip
  5283. \advance\dimen@ii by -1\entryrightmargin
  5284. \advance\dimen@ii by 1\dimen@i
  5285. \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
  5286. \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
  5287. \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
  5288. \dimen@ii = \hsize
  5289. \ifnum\dimen@>\dimen@ii
  5290. % If the entry is too long, use the whole line
  5291. \dimen@ = \dimen@ii
  5292. \fi
  5293. \advance\leftskip by 0pt plus 1fill % ragged right
  5294. \advance \dimen@ by 1\rightskip
  5295. \parshape = 2 0pt \dimen@ 0em \dimen@ii
  5296. % Ideally we'd add a finite glue at the end of the first line only,
  5297. % instead of using \parshape with explicit line lengths, but TeX
  5298. % doesn't seem to provide a way to do such a thing.
  5299. %
  5300. \leftskip = 1em
  5301. \parindent = -1em
  5302. \fi\fi
  5303. \indent % start paragraph
  5304. \unhbox\boxA
  5305. %
  5306. % Do not prefer a separate line ending with a hyphen to fewer lines.
  5307. \finalhyphendemerits = 0
  5308. %
  5309. % Word spacing - no stretch
  5310. \spaceskip=\fontdimen2\font minus \fontdimen4\font
  5311. %
  5312. \linepenalty=1000 % Discourage line breaks.
  5313. \hyphenpenalty=5000 % Discourage hyphenation.
  5314. %
  5315. \par % format the paragraph
  5316. \egroup % The \vbox
  5317. \fi
  5318. \endgroup
  5319. % delay text of entry until after penalty
  5320. \bgroup\aftergroup\insertindexentrybox
  5321. \entrywidowpenalty
  5322. }}
  5323. \newskip\thinshrinkable
  5324. \skip\thinshrinkable=.15em minus .15em
  5325. \newbox\entryindexbox
  5326. \def\insertindexentrybox{%
  5327. \ourunvbox\entryindexbox
  5328. }
  5329. % Use \lastbox to take apart vbox box by box, and add each sub-box
  5330. % to the current vertical list.
  5331. \def\ourunvbox#1{%
  5332. \bgroup % for local binding of \delayedbox
  5333. % Remove the last box from box #1
  5334. \global\setbox#1=\vbox{%
  5335. \unvbox#1%
  5336. \unskip % remove any glue
  5337. \unpenalty
  5338. \global\setbox\interbox=\lastbox
  5339. }%
  5340. \setbox\delayedbox=\box\interbox
  5341. \ifdim\ht#1=0pt\else
  5342. \ourunvbox#1 % Repeat on what's left of the box
  5343. \nobreak
  5344. \fi
  5345. \box\delayedbox
  5346. \egroup
  5347. }
  5348. \newbox\delayedbox
  5349. \newbox\interbox
  5350. % Default is no penalty
  5351. \let\entrywidowpenalty\egroup
  5352. % Used from \printindex. \firsttoken should be the first token
  5353. % after the \entry. If it's not another \entry, we are at the last
  5354. % line of a group of index entries, so insert a penalty to discourage
  5355. % widowed index entries.
  5356. \long\def\indexwidowpenalty{%
  5357. \def\isentry{\entry}%
  5358. \ifx\firsttoken\isentry
  5359. \else
  5360. \penalty 9000
  5361. \fi
  5362. \egroup % now comes the box added with \aftergroup
  5363. }
  5364. % Like plain.tex's \dotfill, except uses up at least 1 em.
  5365. % The filll stretch here overpowers both the fil and fill stretch to push
  5366. % the page number to the right.
  5367. \def\indexdotfill{\cleaders
  5368. \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
  5369. \def\primary #1{\line{#1\hfil}}
  5370. \newskip\secondaryindent \secondaryindent=0.5cm
  5371. \def\secondary#1#2{{%
  5372. \parfillskip=0in
  5373. \parskip=0in
  5374. \hangindent=1in
  5375. \hangafter=1
  5376. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  5377. \ifpdf
  5378. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5379. \else
  5380. \ifx\XeTeXrevision\thisisundefined
  5381. #2
  5382. \else
  5383. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5384. \fi
  5385. \fi
  5386. \par
  5387. }}
  5388. % Define two-column mode, which we use to typeset indexes.
  5389. % Adapted from the TeXbook, page 416, which is to say,
  5390. % the manmac.tex format used to print the TeXbook itself.
  5391. \catcode`\@=11 % private names
  5392. \newbox\partialpage
  5393. \newdimen\doublecolumnhsize
  5394. % Use inside an output routine to save \topmark and \firstmark
  5395. \def\savemarks{%
  5396. \global\savedtopmark=\expandafter{\topmark }%
  5397. \global\savedfirstmark=\expandafter{\firstmark }%
  5398. }
  5399. \newtoks\savedtopmark
  5400. \newtoks\savedfirstmark
  5401. % Set \topmark and \firstmark for next time \output runs.
  5402. % Can't be run from withinside \output (because any material
  5403. % added while an output routine is active, including
  5404. % penalties, is saved for after it finishes). The page so far
  5405. % should be empty, otherwise what's on it will be thrown away.
  5406. \def\restoremarks{%
  5407. \mark{\the\savedtopmark}%
  5408. \bgroup\output = {%
  5409. \setbox\dummybox=\box\PAGE
  5410. }abc\eject\egroup
  5411. % "abc" because output routine doesn't fire for a completely empty page.
  5412. \mark{\the\savedfirstmark}%
  5413. }
  5414. \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  5415. % If not much space left on page, start a new page.
  5416. \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
  5417. %
  5418. % Grab any single-column material above us.
  5419. \output = {%
  5420. %
  5421. % Here is a possibility not foreseen in manmac: if we accumulate a
  5422. % whole lot of material, we might end up calling this \output
  5423. % routine twice in a row (see the doublecol-lose test, which is
  5424. % essentially a couple of indexes with @setchapternewpage off). In
  5425. % that case we just ship out what is in \partialpage with the normal
  5426. % output routine. Generally, \partialpage will be empty when this
  5427. % runs and this will be a no-op. See the indexspread.tex test case.
  5428. \ifvoid\partialpage \else
  5429. \onepageout{\pagecontents\partialpage}%
  5430. \fi
  5431. %
  5432. \global\setbox\partialpage = \vbox{%
  5433. % Unvbox the main output page.
  5434. \unvbox\PAGE
  5435. \kern-\topskip \kern\baselineskip
  5436. }%
  5437. \savemarks
  5438. }%
  5439. \eject % run that output routine to set \partialpage
  5440. \restoremarks
  5441. %
  5442. % We recover the two marks that the last output routine saved in order
  5443. % to propagate the information in marks added around a chapter heading,
  5444. % which could be otherwise be lost by the time the final page is output.
  5445. %
  5446. %
  5447. % Use the double-column output routine for subsequent pages.
  5448. \output = {\doublecolumnout}%
  5449. %
  5450. % Change the page size parameters. We could do this once outside this
  5451. % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  5452. % format, but then we repeat the same computation. Repeating a couple
  5453. % of assignments once per index is clearly meaningless for the
  5454. % execution time, so we may as well do it in one place.
  5455. %
  5456. % First we halve the line length, less a little for the gutter between
  5457. % the columns. We compute the gutter based on the line length, so it
  5458. % changes automatically with the paper format. The magic constant
  5459. % below is chosen so that the gutter has the same value (well, +-<1pt)
  5460. % as it did when we hard-coded it.
  5461. %
  5462. % We put the result in a separate register, \doublecolumhsize, so we
  5463. % can restore it in \pagesofar, after \hsize itself has (potentially)
  5464. % been clobbered.
  5465. %
  5466. \doublecolumnhsize = \hsize
  5467. \advance\doublecolumnhsize by -.04154\hsize
  5468. \divide\doublecolumnhsize by 2
  5469. \hsize = \doublecolumnhsize
  5470. %
  5471. % Double the \vsize as well.
  5472. \advance\vsize by -\ht\partialpage
  5473. \vsize = 2\vsize
  5474. %
  5475. % For the benefit of balancing columns
  5476. \advance\baselineskip by 0pt plus 0.5pt
  5477. }
  5478. % The double-column output routine for all double-column pages except
  5479. % the last, which is done by \balancecolumns.
  5480. %
  5481. \def\doublecolumnout{%
  5482. %
  5483. \splittopskip=\topskip \splitmaxdepth=\maxdepth
  5484. % Get the available space for the double columns -- the normal
  5485. % (undoubled) page height minus any material left over from the
  5486. % previous page.
  5487. \dimen@ = \vsize
  5488. \divide\dimen@ by 2
  5489. %
  5490. % box0 will be the left-hand column, box2 the right.
  5491. \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
  5492. \global\advance\vsize by 2\ht\partialpage
  5493. \onepageout\pagesofar
  5494. \unvbox\PAGE
  5495. \penalty\outputpenalty
  5496. }
  5497. %
  5498. % Re-output the contents of the output page -- any previous material,
  5499. % followed by the two boxes we just split, in box0 and box2.
  5500. \def\pagesofar{%
  5501. \unvbox\partialpage
  5502. %
  5503. \hsize = \doublecolumnhsize
  5504. \wd0=\hsize \wd2=\hsize
  5505. \hbox to\txipagewidth{\box0\hfil\box2}%
  5506. }
  5507. % Finished with with double columns.
  5508. \def\enddoublecolumns{%
  5509. % The following penalty ensures that the page builder is exercised
  5510. % _before_ we change the output routine. This is necessary in the
  5511. % following situation:
  5512. %
  5513. % The last section of the index consists only of a single entry.
  5514. % Before this section, \pagetotal is less than \pagegoal, so no
  5515. % break occurs before the last section starts. However, the last
  5516. % section, consisting of \initial and the single \entry, does not
  5517. % fit on the page and has to be broken off. Without the following
  5518. % penalty the page builder will not be exercised until \eject
  5519. % below, and by that time we'll already have changed the output
  5520. % routine to the \balancecolumns version, so the next-to-last
  5521. % double-column page will be processed with \balancecolumns, which
  5522. % is wrong: The two columns will go to the main vertical list, with
  5523. % the broken-off section in the recent contributions. As soon as
  5524. % the output routine finishes, TeX starts reconsidering the page
  5525. % break. The two columns and the broken-off section both fit on the
  5526. % page, because the two columns now take up only half of the page
  5527. % goal. When TeX sees \eject from below which follows the final
  5528. % section, it invokes the new output routine that we've set after
  5529. % \balancecolumns below; \onepageout will try to fit the two columns
  5530. % and the final section into the vbox of \txipageheight (see
  5531. % \pagebody), causing an overfull box.
  5532. %
  5533. % Note that glue won't work here, because glue does not exercise the
  5534. % page builder, unlike penalties (see The TeXbook, pp. 280-281).
  5535. \penalty0
  5536. %
  5537. \output = {%
  5538. % Split the last of the double-column material.
  5539. \savemarks
  5540. \balancecolumns
  5541. %
  5542. % Having called \balancecolumns once, we do not
  5543. % want to call it again. Therefore, reset \output to its normal
  5544. % definition right away.
  5545. \global\output = {\onepageout{\pagecontents\PAGE}}%
  5546. }%
  5547. \eject
  5548. \endgroup % started in \begindoublecolumns
  5549. \restoremarks
  5550. % Leave the double-column material on the current page, no automatic
  5551. % page break.
  5552. \box\balancedcolumns
  5553. %
  5554. % \pagegoal was set to the doubled \vsize above, since we restarted
  5555. % the current page. We're now back to normal single-column
  5556. % typesetting, so reset \pagegoal to the normal \vsize.
  5557. \global\vsize = \txipageheight %
  5558. \pagegoal = \txipageheight %
  5559. }
  5560. \newbox\balancedcolumns
  5561. \setbox\balancedcolumns=\vbox{shouldnt see this}%
  5562. %
  5563. % Only called for the last of the double column material. \doublecolumnout
  5564. % does the others.
  5565. \def\balancecolumns{%
  5566. \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
  5567. \dimen@ = \ht0
  5568. \advance\dimen@ by \topskip
  5569. \advance\dimen@ by-\baselineskip
  5570. \ifdim\dimen@<5\baselineskip
  5571. % Don't split a short final column in two.
  5572. \setbox2=\vbox{}%
  5573. \else
  5574. \divide\dimen@ by 2 % target to split to
  5575. \dimen@ii = \dimen@
  5576. \splittopskip = \topskip
  5577. % Loop until left column is at least as high as the right column.
  5578. {%
  5579. \vbadness = 10000
  5580. \loop
  5581. \global\setbox3 = \copy0
  5582. \global\setbox1 = \vsplit3 to \dimen@
  5583. \ifdim\ht1<\ht3
  5584. \global\advance\dimen@ by 1pt
  5585. \repeat
  5586. }%
  5587. % Now the left column is in box 1, and the right column in box 3.
  5588. % Check whether the left column has come out higher than the page itself.
  5589. % (Note that we have doubled \vsize for the double columns, so
  5590. % the actual height of the page is 0.5\vsize).
  5591. \ifdim2\ht1>\vsize
  5592. % Just split the last of the double column material roughly in half.
  5593. \setbox2=\box0
  5594. \setbox0 = \vsplit2 to \dimen@ii
  5595. \setbox0=\vbox to \dimen@ii {\unvbox0\vfill}%
  5596. \setbox2=\vbox to \dimen@ii {\unvbox2\vfill}%
  5597. \else
  5598. % Compare the heights of the two columns.
  5599. \ifdim4\ht1>5\ht3
  5600. % Column heights are too different, so don't make their bottoms
  5601. % flush with each other.
  5602. \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
  5603. \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
  5604. \else
  5605. % Make column bottoms flush with each other.
  5606. \setbox2=\vbox to\ht1{\unvbox3\unskip}%
  5607. \setbox0=\vbox to\ht1{\unvbox1\unskip}%
  5608. \fi
  5609. \fi
  5610. \fi
  5611. %
  5612. \global\setbox\balancedcolumns=\vbox{\pagesofar}%
  5613. }
  5614. \catcode`\@ = \other
  5615. \message{sectioning,}
  5616. % Chapters, sections, etc.
  5617. % Let's start with @part.
  5618. \outer\parseargdef\part{\partzzz{#1}}
  5619. \def\partzzz#1{%
  5620. \chapoddpage
  5621. \null
  5622. \vskip.3\vsize % move it down on the page a bit
  5623. \begingroup
  5624. \noindent \titlefonts\rm #1\par % the text
  5625. \let\lastnode=\empty % no node to associate with
  5626. \writetocentry{part}{#1}{}% but put it in the toc
  5627. \headingsoff % no headline or footline on the part page
  5628. % This outputs a mark at the end of the page that clears \thischapter
  5629. % and \thissection, as is done in \startcontents.
  5630. \let\pchapsepmacro\relax
  5631. \chapmacro{}{Yomitfromtoc}{}%
  5632. \chapoddpage
  5633. \endgroup
  5634. }
  5635. % \unnumberedno is an oxymoron. But we count the unnumbered
  5636. % sections so that we can refer to them unambiguously in the pdf
  5637. % outlines by their "section number". We avoid collisions with chapter
  5638. % numbers by starting them at 10000. (If a document ever has 10000
  5639. % chapters, we're in trouble anyway, I'm sure.)
  5640. \newcount\unnumberedno \unnumberedno = 10000
  5641. \newcount\chapno
  5642. \newcount\secno \secno=0
  5643. \newcount\subsecno \subsecno=0
  5644. \newcount\subsubsecno \subsubsecno=0
  5645. % This counter is funny since it counts through charcodes of letters A, B, ...
  5646. \newcount\appendixno \appendixno = `\@
  5647. %
  5648. % \def\appendixletter{\char\the\appendixno}
  5649. % We do the following ugly conditional instead of the above simple
  5650. % construct for the sake of pdftex, which needs the actual
  5651. % letter in the expansion, not just typeset.
  5652. %
  5653. \def\appendixletter{%
  5654. \ifnum\appendixno=`A A%
  5655. \else\ifnum\appendixno=`B B%
  5656. \else\ifnum\appendixno=`C C%
  5657. \else\ifnum\appendixno=`D D%
  5658. \else\ifnum\appendixno=`E E%
  5659. \else\ifnum\appendixno=`F F%
  5660. \else\ifnum\appendixno=`G G%
  5661. \else\ifnum\appendixno=`H H%
  5662. \else\ifnum\appendixno=`I I%
  5663. \else\ifnum\appendixno=`J J%
  5664. \else\ifnum\appendixno=`K K%
  5665. \else\ifnum\appendixno=`L L%
  5666. \else\ifnum\appendixno=`M M%
  5667. \else\ifnum\appendixno=`N N%
  5668. \else\ifnum\appendixno=`O O%
  5669. \else\ifnum\appendixno=`P P%
  5670. \else\ifnum\appendixno=`Q Q%
  5671. \else\ifnum\appendixno=`R R%
  5672. \else\ifnum\appendixno=`S S%
  5673. \else\ifnum\appendixno=`T T%
  5674. \else\ifnum\appendixno=`U U%
  5675. \else\ifnum\appendixno=`V V%
  5676. \else\ifnum\appendixno=`W W%
  5677. \else\ifnum\appendixno=`X X%
  5678. \else\ifnum\appendixno=`Y Y%
  5679. \else\ifnum\appendixno=`Z Z%
  5680. % The \the is necessary, despite appearances, because \appendixletter is
  5681. % expanded while writing the .toc file. \char\appendixno is not
  5682. % expandable, thus it is written literally, thus all appendixes come out
  5683. % with the same letter (or @) in the toc without it.
  5684. \else\char\the\appendixno
  5685. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  5686. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  5687. % Each @chapter defines these (using marks) as the number+name, number
  5688. % and name of the chapter. Page headings and footings can use
  5689. % these. @section does likewise.
  5690. \def\thischapter{}
  5691. \def\thischapternum{}
  5692. \def\thischaptername{}
  5693. \def\thissection{}
  5694. \def\thissectionnum{}
  5695. \def\thissectionname{}
  5696. \newcount\absseclevel % used to calculate proper heading level
  5697. \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
  5698. % @raisesections: treat @section as chapter, @subsection as section, etc.
  5699. \def\raisesections{\global\advance\secbase by -1}
  5700. \let\up=\raisesections % original BFox name
  5701. % @lowersections: treat @chapter as section, @section as subsection, etc.
  5702. \def\lowersections{\global\advance\secbase by 1}
  5703. \let\down=\lowersections % original BFox name
  5704. % we only have subsub.
  5705. \chardef\maxseclevel = 3
  5706. %
  5707. % A numbered section within an unnumbered changes to unnumbered too.
  5708. % To achieve this, remember the "biggest" unnum. sec. we are currently in:
  5709. \chardef\unnlevel = \maxseclevel
  5710. %
  5711. % Trace whether the current chapter is an appendix or not:
  5712. % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
  5713. \def\chapheadtype{N}
  5714. % Choose a heading macro
  5715. % #1 is heading type
  5716. % #2 is heading level
  5717. % #3 is text for heading
  5718. \def\genhead#1#2#3{%
  5719. % Compute the abs. sec. level:
  5720. \absseclevel=#2
  5721. \advance\absseclevel by \secbase
  5722. % Make sure \absseclevel doesn't fall outside the range:
  5723. \ifnum \absseclevel < 0
  5724. \absseclevel = 0
  5725. \else
  5726. \ifnum \absseclevel > 3
  5727. \absseclevel = 3
  5728. \fi
  5729. \fi
  5730. % The heading type:
  5731. \def\headtype{#1}%
  5732. \if \headtype U%
  5733. \ifnum \absseclevel < \unnlevel
  5734. \chardef\unnlevel = \absseclevel
  5735. \fi
  5736. \else
  5737. % Check for appendix sections:
  5738. \ifnum \absseclevel = 0
  5739. \edef\chapheadtype{\headtype}%
  5740. \else
  5741. \if \headtype A\if \chapheadtype N%
  5742. \errmessage{@appendix... within a non-appendix chapter}%
  5743. \fi\fi
  5744. \fi
  5745. % Check for numbered within unnumbered:
  5746. \ifnum \absseclevel > \unnlevel
  5747. \def\headtype{U}%
  5748. \else
  5749. \chardef\unnlevel = 3
  5750. \fi
  5751. \fi
  5752. % Now print the heading:
  5753. \if \headtype U%
  5754. \ifcase\absseclevel
  5755. \unnumberedzzz{#3}%
  5756. \or \unnumberedseczzz{#3}%
  5757. \or \unnumberedsubseczzz{#3}%
  5758. \or \unnumberedsubsubseczzz{#3}%
  5759. \fi
  5760. \else
  5761. \if \headtype A%
  5762. \ifcase\absseclevel
  5763. \appendixzzz{#3}%
  5764. \or \appendixsectionzzz{#3}%
  5765. \or \appendixsubseczzz{#3}%
  5766. \or \appendixsubsubseczzz{#3}%
  5767. \fi
  5768. \else
  5769. \ifcase\absseclevel
  5770. \chapterzzz{#3}%
  5771. \or \seczzz{#3}%
  5772. \or \numberedsubseczzz{#3}%
  5773. \or \numberedsubsubseczzz{#3}%
  5774. \fi
  5775. \fi
  5776. \fi
  5777. \suppressfirstparagraphindent
  5778. }
  5779. % an interface:
  5780. \def\numhead{\genhead N}
  5781. \def\apphead{\genhead A}
  5782. \def\unnmhead{\genhead U}
  5783. % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
  5784. % all lower-level sectioning counters to zero.
  5785. %
  5786. % Also set \chaplevelprefix, which we prepend to @float sequence numbers
  5787. % (e.g., figures), q.v. By default (before any chapter), that is empty.
  5788. \let\chaplevelprefix = \empty
  5789. %
  5790. \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
  5791. \def\chapterzzz#1{%
  5792. % section resetting is \global in case the chapter is in a group, such
  5793. % as an @include file.
  5794. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5795. \global\advance\chapno by 1
  5796. %
  5797. % Used for \float.
  5798. \gdef\chaplevelprefix{\the\chapno.}%
  5799. \resetallfloatnos
  5800. %
  5801. % \putwordChapter can contain complex things in translations.
  5802. \toks0=\expandafter{\putwordChapter}%
  5803. \message{\the\toks0 \space \the\chapno}%
  5804. %
  5805. % Write the actual heading.
  5806. \chapmacro{#1}{Ynumbered}{\the\chapno}%
  5807. %
  5808. % So @section and the like are numbered underneath this chapter.
  5809. \global\let\section = \numberedsec
  5810. \global\let\subsection = \numberedsubsec
  5811. \global\let\subsubsection = \numberedsubsubsec
  5812. }
  5813. \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
  5814. %
  5815. \def\appendixzzz#1{%
  5816. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5817. \global\advance\appendixno by 1
  5818. \gdef\chaplevelprefix{\appendixletter.}%
  5819. \resetallfloatnos
  5820. %
  5821. % \putwordAppendix can contain complex things in translations.
  5822. \toks0=\expandafter{\putwordAppendix}%
  5823. \message{\the\toks0 \space \appendixletter}%
  5824. %
  5825. \chapmacro{#1}{Yappendix}{\appendixletter}%
  5826. %
  5827. \global\let\section = \appendixsec
  5828. \global\let\subsection = \appendixsubsec
  5829. \global\let\subsubsection = \appendixsubsubsec
  5830. }
  5831. % normally unnmhead0 calls unnumberedzzz:
  5832. \outer\parseargdef\unnumbered{\unnmhead0{#1}}
  5833. \def\unnumberedzzz#1{%
  5834. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5835. \global\advance\unnumberedno by 1
  5836. %
  5837. % Since an unnumbered has no number, no prefix for figures.
  5838. \global\let\chaplevelprefix = \empty
  5839. \resetallfloatnos
  5840. %
  5841. % This used to be simply \message{#1}, but TeX fully expands the
  5842. % argument to \message. Therefore, if #1 contained @-commands, TeX
  5843. % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
  5844. % expanded @cite (which turns out to cause errors because \cite is meant
  5845. % to be executed, not expanded).
  5846. %
  5847. % Anyway, we don't want the fully-expanded definition of @cite to appear
  5848. % as a result of the \message, we just want `@cite' itself. We use
  5849. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  5850. % simply yielding the contents of <toks register>. (We also do this for
  5851. % the toc entries.)
  5852. \toks0 = {#1}%
  5853. \message{(\the\toks0)}%
  5854. %
  5855. \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
  5856. %
  5857. \global\let\section = \unnumberedsec
  5858. \global\let\subsection = \unnumberedsubsec
  5859. \global\let\subsubsection = \unnumberedsubsubsec
  5860. }
  5861. % @centerchap is like @unnumbered, but the heading is centered.
  5862. \outer\parseargdef\centerchap{%
  5863. \let\centerparametersmaybe = \centerparameters
  5864. \unnmhead0{#1}%
  5865. \let\centerparametersmaybe = \relax
  5866. }
  5867. % @top is like @unnumbered.
  5868. \let\top\unnumbered
  5869. % Sections.
  5870. %
  5871. \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
  5872. \def\seczzz#1{%
  5873. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5874. \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
  5875. }
  5876. % normally calls appendixsectionzzz:
  5877. \outer\parseargdef\appendixsection{\apphead1{#1}}
  5878. \def\appendixsectionzzz#1{%
  5879. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5880. \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
  5881. }
  5882. \let\appendixsec\appendixsection
  5883. % normally calls unnumberedseczzz:
  5884. \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
  5885. \def\unnumberedseczzz#1{%
  5886. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5887. \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
  5888. }
  5889. % Subsections.
  5890. %
  5891. % normally calls numberedsubseczzz:
  5892. \outer\parseargdef\numberedsubsec{\numhead2{#1}}
  5893. \def\numberedsubseczzz#1{%
  5894. \global\subsubsecno=0 \global\advance\subsecno by 1
  5895. \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
  5896. }
  5897. % normally calls appendixsubseczzz:
  5898. \outer\parseargdef\appendixsubsec{\apphead2{#1}}
  5899. \def\appendixsubseczzz#1{%
  5900. \global\subsubsecno=0 \global\advance\subsecno by 1
  5901. \sectionheading{#1}{subsec}{Yappendix}%
  5902. {\appendixletter.\the\secno.\the\subsecno}%
  5903. }
  5904. % normally calls unnumberedsubseczzz:
  5905. \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
  5906. \def\unnumberedsubseczzz#1{%
  5907. \global\subsubsecno=0 \global\advance\subsecno by 1
  5908. \sectionheading{#1}{subsec}{Ynothing}%
  5909. {\the\unnumberedno.\the\secno.\the\subsecno}%
  5910. }
  5911. % Subsubsections.
  5912. %
  5913. % normally numberedsubsubseczzz:
  5914. \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
  5915. \def\numberedsubsubseczzz#1{%
  5916. \global\advance\subsubsecno by 1
  5917. \sectionheading{#1}{subsubsec}{Ynumbered}%
  5918. {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5919. }
  5920. % normally appendixsubsubseczzz:
  5921. \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
  5922. \def\appendixsubsubseczzz#1{%
  5923. \global\advance\subsubsecno by 1
  5924. \sectionheading{#1}{subsubsec}{Yappendix}%
  5925. {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
  5926. }
  5927. % normally unnumberedsubsubseczzz:
  5928. \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
  5929. \def\unnumberedsubsubseczzz#1{%
  5930. \global\advance\subsubsecno by 1
  5931. \sectionheading{#1}{subsubsec}{Ynothing}%
  5932. {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5933. }
  5934. % These macros control what the section commands do, according
  5935. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  5936. % Define them by default for a numbered chapter.
  5937. \let\section = \numberedsec
  5938. \let\subsection = \numberedsubsec
  5939. \let\subsubsection = \numberedsubsubsec
  5940. % Define @majorheading, @heading and @subheading
  5941. \def\majorheading{%
  5942. {\advance\chapheadingskip by 10pt \chapbreak }%
  5943. \parsearg\chapheadingzzz
  5944. }
  5945. \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
  5946. \def\chapheadingzzz#1{%
  5947. \vbox{\chapfonts \raggedtitlesettings #1\par}%
  5948. \nobreak\bigskip \nobreak
  5949. \suppressfirstparagraphindent
  5950. }
  5951. % @heading, @subheading, @subsubheading.
  5952. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
  5953. \suppressfirstparagraphindent}
  5954. \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
  5955. \suppressfirstparagraphindent}
  5956. \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
  5957. \suppressfirstparagraphindent}
  5958. % These macros generate a chapter, section, etc. heading only
  5959. % (including whitespace, linebreaking, etc. around it),
  5960. % given all the information in convenient, parsed form.
  5961. % Args are the skip and penalty (usually negative)
  5962. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  5963. % Parameter controlling skip before chapter headings (if needed)
  5964. \newskip\chapheadingskip
  5965. % Define plain chapter starts, and page on/off switching for it.
  5966. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  5967. % Start a new page
  5968. \def\chappager{\par\vfill\supereject}
  5969. % \chapoddpage - start on an odd page for a new chapter
  5970. % Because \domark is called before \chapoddpage, the filler page will
  5971. % get the headings for the next chapter, which is wrong. But we don't
  5972. % care -- we just disable all headings on the filler page.
  5973. \def\chapoddpage{%
  5974. \chappager
  5975. \ifodd\pageno \else
  5976. \begingroup
  5977. \headingsoff
  5978. \null
  5979. \chappager
  5980. \endgroup
  5981. \fi
  5982. }
  5983. \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
  5984. \def\CHAPPAGoff{%
  5985. \global\let\contentsalignmacro = \chappager
  5986. \global\let\pchapsepmacro=\chapbreak
  5987. \global\let\pagealignmacro=\chappager}
  5988. \def\CHAPPAGon{%
  5989. \global\let\contentsalignmacro = \chappager
  5990. \global\let\pchapsepmacro=\chappager
  5991. \global\let\pagealignmacro=\chappager
  5992. \global\def\HEADINGSon{\HEADINGSsingle}}
  5993. \def\CHAPPAGodd{%
  5994. \global\let\contentsalignmacro = \chapoddpage
  5995. \global\let\pchapsepmacro=\chapoddpage
  5996. \global\let\pagealignmacro=\chapoddpage
  5997. \global\def\HEADINGSon{\HEADINGSdouble}}
  5998. \CHAPPAGon
  5999. % \chapmacro - Chapter opening.
  6000. %
  6001. % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
  6002. % Yappendix, Yomitfromtoc), #3 the chapter number.
  6003. % Not used for @heading series.
  6004. %
  6005. % To test against our argument.
  6006. \def\Ynothingkeyword{Ynothing}
  6007. \def\Yappendixkeyword{Yappendix}
  6008. \def\Yomitfromtockeyword{Yomitfromtoc}
  6009. %
  6010. \def\chapmacro#1#2#3{%
  6011. \expandafter\ifx\thisenv\titlepage\else
  6012. \checkenv{}% chapters, etc., should not start inside an environment.
  6013. \fi
  6014. % FIXME: \chapmacro is currently called from inside \titlepage when
  6015. % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
  6016. % this should probably be done by \sectionheading with an option to print
  6017. % in chapter size.
  6018. %
  6019. % Insert the first mark before the heading break (see notes for \domark).
  6020. \let\prevchapterdefs=\lastchapterdefs
  6021. \let\prevsectiondefs=\lastsectiondefs
  6022. \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
  6023. \gdef\thissection{}}%
  6024. %
  6025. \def\temptype{#2}%
  6026. \ifx\temptype\Ynothingkeyword
  6027. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6028. \gdef\thischapter{\thischaptername}}%
  6029. \else\ifx\temptype\Yomitfromtockeyword
  6030. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6031. \gdef\thischapter{}}%
  6032. \else\ifx\temptype\Yappendixkeyword
  6033. \toks0={#1}%
  6034. \xdef\lastchapterdefs{%
  6035. \gdef\noexpand\thischaptername{\the\toks0}%
  6036. \gdef\noexpand\thischapternum{\appendixletter}%
  6037. % \noexpand\putwordAppendix avoids expanding indigestible
  6038. % commands in some of the translations.
  6039. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
  6040. \noexpand\thischapternum:
  6041. \noexpand\thischaptername}%
  6042. }%
  6043. \else
  6044. \toks0={#1}%
  6045. \xdef\lastchapterdefs{%
  6046. \gdef\noexpand\thischaptername{\the\toks0}%
  6047. \gdef\noexpand\thischapternum{\the\chapno}%
  6048. % \noexpand\putwordChapter avoids expanding indigestible
  6049. % commands in some of the translations.
  6050. \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
  6051. \noexpand\thischapternum:
  6052. \noexpand\thischaptername}%
  6053. }%
  6054. \fi\fi\fi
  6055. %
  6056. % Output the mark. Pass it through \safewhatsit, to take care of
  6057. % the preceding space.
  6058. \safewhatsit\domark
  6059. %
  6060. % Insert the chapter heading break.
  6061. \pchapsepmacro
  6062. %
  6063. % Now the second mark, after the heading break. No break points
  6064. % between here and the heading.
  6065. \let\prevchapterdefs=\lastchapterdefs
  6066. \let\prevsectiondefs=\lastsectiondefs
  6067. \domark
  6068. %
  6069. {%
  6070. \chapfonts \rm
  6071. \let\footnote=\errfootnoteheading % give better error message
  6072. %
  6073. % Have to define \lastsection before calling \donoderef, because the
  6074. % xref code eventually uses it. On the other hand, it has to be called
  6075. % after \pchapsepmacro, or the headline will change too soon.
  6076. \gdef\lastsection{#1}%
  6077. %
  6078. % Only insert the separating space if we have a chapter/appendix
  6079. % number, and don't print the unnumbered ``number''.
  6080. \ifx\temptype\Ynothingkeyword
  6081. \setbox0 = \hbox{}%
  6082. \def\toctype{unnchap}%
  6083. \else\ifx\temptype\Yomitfromtockeyword
  6084. \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
  6085. \def\toctype{omit}%
  6086. \else\ifx\temptype\Yappendixkeyword
  6087. \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
  6088. \def\toctype{app}%
  6089. \else
  6090. \setbox0 = \hbox{#3\enspace}%
  6091. \def\toctype{numchap}%
  6092. \fi\fi\fi
  6093. %
  6094. % Write the toc entry for this chapter. Must come before the
  6095. % \donoderef, because we include the current node name in the toc
  6096. % entry, and \donoderef resets it to empty.
  6097. \writetocentry{\toctype}{#1}{#3}%
  6098. %
  6099. % For pdftex, we have to write out the node definition (aka, make
  6100. % the pdfdest) after any page break, but before the actual text has
  6101. % been typeset. If the destination for the pdf outline is after the
  6102. % text, then jumping from the outline may wind up with the text not
  6103. % being visible, for instance under high magnification.
  6104. \donoderef{#2}%
  6105. %
  6106. % Typeset the actual heading.
  6107. \nobreak % Avoid page breaks at the interline glue.
  6108. \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
  6109. \unhbox0 #1\par}%
  6110. }%
  6111. \nobreak\bigskip % no page break after a chapter title
  6112. \nobreak
  6113. }
  6114. % @centerchap -- centered and unnumbered.
  6115. \let\centerparametersmaybe = \relax
  6116. \def\centerparameters{%
  6117. \advance\rightskip by 3\rightskip
  6118. \leftskip = \rightskip
  6119. \parfillskip = 0pt
  6120. }
  6121. % Section titles. These macros combine the section number parts and
  6122. % call the generic \sectionheading to do the printing.
  6123. %
  6124. \newskip\secheadingskip
  6125. \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
  6126. % Subsection titles.
  6127. \newskip\subsecheadingskip
  6128. \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
  6129. % Subsubsection titles.
  6130. \def\subsubsecheadingskip{\subsecheadingskip}
  6131. \def\subsubsecheadingbreak{\subsecheadingbreak}
  6132. % Print any size, any type, section title.
  6133. %
  6134. % #1 is the text of the title,
  6135. % #2 is the section level (sec/subsec/subsubsec),
  6136. % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
  6137. % #4 is the section number.
  6138. %
  6139. \def\seckeyword{sec}
  6140. %
  6141. \def\sectionheading#1#2#3#4{%
  6142. {%
  6143. \def\sectionlevel{#2}%
  6144. \def\temptype{#3}%
  6145. %
  6146. % It is ok for the @heading series commands to appear inside an
  6147. % environment (it's been historically allowed, though the logic is
  6148. % dubious), but not the others.
  6149. \ifx\temptype\Yomitfromtockeyword\else
  6150. \checkenv{}% non-@*heading should not be in an environment.
  6151. \fi
  6152. \let\footnote=\errfootnoteheading
  6153. %
  6154. % Switch to the right set of fonts.
  6155. \csname #2fonts\endcsname \rm
  6156. %
  6157. % Insert first mark before the heading break (see notes for \domark).
  6158. \let\prevsectiondefs=\lastsectiondefs
  6159. \ifx\temptype\Ynothingkeyword
  6160. \ifx\sectionlevel\seckeyword
  6161. \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
  6162. \gdef\thissection{\thissectionname}}%
  6163. \fi
  6164. \else\ifx\temptype\Yomitfromtockeyword
  6165. % Don't redefine \thissection.
  6166. \else\ifx\temptype\Yappendixkeyword
  6167. \ifx\sectionlevel\seckeyword
  6168. \toks0={#1}%
  6169. \xdef\lastsectiondefs{%
  6170. \gdef\noexpand\thissectionname{\the\toks0}%
  6171. \gdef\noexpand\thissectionnum{#4}%
  6172. % \noexpand\putwordSection avoids expanding indigestible
  6173. % commands in some of the translations.
  6174. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6175. \noexpand\thissectionnum:
  6176. \noexpand\thissectionname}%
  6177. }%
  6178. \fi
  6179. \else
  6180. \ifx\sectionlevel\seckeyword
  6181. \toks0={#1}%
  6182. \xdef\lastsectiondefs{%
  6183. \gdef\noexpand\thissectionname{\the\toks0}%
  6184. \gdef\noexpand\thissectionnum{#4}%
  6185. % \noexpand\putwordSection avoids expanding indigestible
  6186. % commands in some of the translations.
  6187. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6188. \noexpand\thissectionnum:
  6189. \noexpand\thissectionname}%
  6190. }%
  6191. \fi
  6192. \fi\fi\fi
  6193. %
  6194. % Go into vertical mode. Usually we'll already be there, but we
  6195. % don't want the following whatsit to end up in a preceding paragraph
  6196. % if the document didn't happen to have a blank line.
  6197. \par
  6198. %
  6199. % Output the mark. Pass it through \safewhatsit, to take care of
  6200. % the preceding space.
  6201. \safewhatsit\domark
  6202. %
  6203. % Insert space above the heading.
  6204. \csname #2headingbreak\endcsname
  6205. %
  6206. % Now the second mark, after the heading break. No break points
  6207. % between here and the heading.
  6208. \global\let\prevsectiondefs=\lastsectiondefs
  6209. \domark
  6210. %
  6211. % Only insert the space after the number if we have a section number.
  6212. \ifx\temptype\Ynothingkeyword
  6213. \setbox0 = \hbox{}%
  6214. \def\toctype{unn}%
  6215. \gdef\lastsection{#1}%
  6216. \else\ifx\temptype\Yomitfromtockeyword
  6217. % for @headings -- no section number, don't include in toc,
  6218. % and don't redefine \lastsection.
  6219. \setbox0 = \hbox{}%
  6220. \def\toctype{omit}%
  6221. \let\sectionlevel=\empty
  6222. \else\ifx\temptype\Yappendixkeyword
  6223. \setbox0 = \hbox{#4\enspace}%
  6224. \def\toctype{app}%
  6225. \gdef\lastsection{#1}%
  6226. \else
  6227. \setbox0 = \hbox{#4\enspace}%
  6228. \def\toctype{num}%
  6229. \gdef\lastsection{#1}%
  6230. \fi\fi\fi
  6231. %
  6232. % Write the toc entry (before \donoderef). See comments in \chapmacro.
  6233. \writetocentry{\toctype\sectionlevel}{#1}{#4}%
  6234. %
  6235. % Write the node reference (= pdf destination for pdftex).
  6236. % Again, see comments in \chapmacro.
  6237. \donoderef{#3}%
  6238. %
  6239. % Interline glue will be inserted when the vbox is completed.
  6240. % That glue will be a valid breakpoint for the page, since it'll be
  6241. % preceded by a whatsit (usually from the \donoderef, or from the
  6242. % \writetocentry if there was no node). We don't want to allow that
  6243. % break, since then the whatsits could end up on page n while the
  6244. % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
  6245. \nobreak
  6246. %
  6247. % Output the actual section heading.
  6248. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
  6249. \hangindent=\wd0 % zero if no section number
  6250. \unhbox0 #1}%
  6251. }%
  6252. % Add extra space after the heading -- half of whatever came above it.
  6253. % Don't allow stretch, though.
  6254. \kern .5 \csname #2headingskip\endcsname
  6255. %
  6256. % Do not let the kern be a potential breakpoint, as it would be if it
  6257. % was followed by glue.
  6258. \nobreak
  6259. %
  6260. % We'll almost certainly start a paragraph next, so don't let that
  6261. % glue accumulate. (Not a breakpoint because it's preceded by a
  6262. % discardable item.) However, when a paragraph is not started next
  6263. % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
  6264. % or the negative glue will cause weirdly wrong output, typically
  6265. % obscuring the section heading with something else.
  6266. \vskip-\parskip
  6267. %
  6268. % This is so the last item on the main vertical list is a known
  6269. % \penalty > 10000, so \startdefun, etc., can recognize the situation
  6270. % and do the needful.
  6271. \penalty 10001
  6272. }
  6273. \message{toc,}
  6274. % Table of contents.
  6275. \newwrite\tocfile
  6276. % Write an entry to the toc file, opening it if necessary.
  6277. % Called from @chapter, etc.
  6278. %
  6279. % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
  6280. % We append the current node name (if any) and page number as additional
  6281. % arguments for the \{chap,sec,...}entry macros which will eventually
  6282. % read this. The node name is used in the pdf outlines as the
  6283. % destination to jump to.
  6284. %
  6285. % We open the .toc file for writing here instead of at @setfilename (or
  6286. % any other fixed time) so that @contents can be anywhere in the document.
  6287. % But if #1 is `omit', then we don't do anything. This is used for the
  6288. % table of contents chapter openings themselves.
  6289. %
  6290. \newif\iftocfileopened
  6291. \def\omitkeyword{omit}%
  6292. %
  6293. \def\writetocentry#1#2#3{%
  6294. \edef\writetoctype{#1}%
  6295. \ifx\writetoctype\omitkeyword \else
  6296. \iftocfileopened\else
  6297. \immediate\openout\tocfile = \jobname.toc
  6298. \global\tocfileopenedtrue
  6299. \fi
  6300. %
  6301. \iflinks
  6302. {\atdummies
  6303. \edef\temp{%
  6304. \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
  6305. \temp
  6306. }%
  6307. \fi
  6308. \fi
  6309. %
  6310. % Tell \shipout to create a pdf destination on each page, if we're
  6311. % writing pdf. These are used in the table of contents. We can't
  6312. % just write one on every page because the title pages are numbered
  6313. % 1 and 2 (the page numbers aren't printed), and so are the first
  6314. % two pages of the document. Thus, we'd have two destinations named
  6315. % `1', and two named `2'.
  6316. \ifpdf
  6317. \global\pdfmakepagedesttrue
  6318. \else
  6319. \ifx\XeTeXrevision\thisisundefined
  6320. \else
  6321. \global\pdfmakepagedesttrue
  6322. \fi
  6323. \fi
  6324. }
  6325. % These characters do not print properly in the Computer Modern roman
  6326. % fonts, so we must take special care. This is more or less redundant
  6327. % with the Texinfo input format setup at the end of this file.
  6328. %
  6329. \def\activecatcodes{%
  6330. \catcode`\"=\active
  6331. \catcode`\$=\active
  6332. \catcode`\<=\active
  6333. \catcode`\>=\active
  6334. \catcode`\\=\active
  6335. \catcode`\^=\active
  6336. \catcode`\_=\active
  6337. \catcode`\|=\active
  6338. \catcode`\~=\active
  6339. }
  6340. % Read the toc file, which is essentially Texinfo input.
  6341. \def\readtocfile{%
  6342. \setupdatafile
  6343. \activecatcodes
  6344. \input \tocreadfilename
  6345. }
  6346. \newskip\contentsrightmargin \contentsrightmargin=1in
  6347. \newcount\savepageno
  6348. \newcount\lastnegativepageno \lastnegativepageno = -1
  6349. % Prepare to read what we've written to \tocfile.
  6350. %
  6351. \def\startcontents#1{%
  6352. % If @setchapternewpage on, and @headings double, the contents should
  6353. % start on an odd page, unlike chapters. Thus, we maintain
  6354. % \contentsalignmacro in parallel with \pagealignmacro.
  6355. % From: Torbjorn Granlund <tege@matematik.su.se>
  6356. \contentsalignmacro
  6357. \immediate\closeout\tocfile
  6358. %
  6359. % Don't need to put `Contents' or `Short Contents' in the headline.
  6360. % It is abundantly clear what they are.
  6361. \chapmacro{#1}{Yomitfromtoc}{}%
  6362. %
  6363. \savepageno = \pageno
  6364. \begingroup % Set up to handle contents files properly.
  6365. \raggedbottom % Worry more about breakpoints than the bottom.
  6366. \entryrightmargin=\contentsrightmargin % Don't use the full line length.
  6367. %
  6368. % Roman numerals for page numbers.
  6369. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  6370. }
  6371. % redefined for the two-volume lispref. We always output on
  6372. % \jobname.toc even if this is redefined.
  6373. %
  6374. \def\tocreadfilename{\jobname.toc}
  6375. % Normal (long) toc.
  6376. %
  6377. \def\contents{%
  6378. \startcontents{\putwordTOC}%
  6379. \openin 1 \tocreadfilename\space
  6380. \ifeof 1 \else
  6381. \readtocfile
  6382. \fi
  6383. \vfill \eject
  6384. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6385. \ifeof 1 \else
  6386. \pdfmakeoutlines
  6387. \fi
  6388. \closein 1
  6389. \endgroup
  6390. \lastnegativepageno = \pageno
  6391. \global\pageno = \savepageno
  6392. }
  6393. % And just the chapters.
  6394. \def\summarycontents{%
  6395. \startcontents{\putwordShortTOC}%
  6396. %
  6397. \let\partentry = \shortpartentry
  6398. \let\numchapentry = \shortchapentry
  6399. \let\appentry = \shortchapentry
  6400. \let\unnchapentry = \shortunnchapentry
  6401. % We want a true roman here for the page numbers.
  6402. \secfonts
  6403. \let\rm=\shortcontrm \let\bf=\shortcontbf
  6404. \let\sl=\shortcontsl \let\tt=\shortconttt
  6405. \rm
  6406. \hyphenpenalty = 10000
  6407. \advance\baselineskip by 1pt % Open it up a little.
  6408. \def\numsecentry##1##2##3##4{}
  6409. \let\appsecentry = \numsecentry
  6410. \let\unnsecentry = \numsecentry
  6411. \let\numsubsecentry = \numsecentry
  6412. \let\appsubsecentry = \numsecentry
  6413. \let\unnsubsecentry = \numsecentry
  6414. \let\numsubsubsecentry = \numsecentry
  6415. \let\appsubsubsecentry = \numsecentry
  6416. \let\unnsubsubsecentry = \numsecentry
  6417. \openin 1 \tocreadfilename\space
  6418. \ifeof 1 \else
  6419. \readtocfile
  6420. \fi
  6421. \closein 1
  6422. \vfill \eject
  6423. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6424. \endgroup
  6425. \lastnegativepageno = \pageno
  6426. \global\pageno = \savepageno
  6427. }
  6428. \let\shortcontents = \summarycontents
  6429. % Typeset the label for a chapter or appendix for the short contents.
  6430. % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
  6431. %
  6432. \def\shortchaplabel#1{%
  6433. % This space should be enough, since a single number is .5em, and the
  6434. % widest letter (M) is 1em, at least in the Computer Modern fonts.
  6435. % But use \hss just in case.
  6436. % (This space doesn't include the extra space that gets added after
  6437. % the label; that gets put in by \shortchapentry above.)
  6438. %
  6439. % We'd like to right-justify chapter numbers, but that looks strange
  6440. % with appendix letters. And right-justifying numbers and
  6441. % left-justifying letters looks strange when there is less than 10
  6442. % chapters. Have to read the whole toc once to know how many chapters
  6443. % there are before deciding ...
  6444. \hbox to 1em{#1\hss}%
  6445. }
  6446. % These macros generate individual entries in the table of contents.
  6447. % The first argument is the chapter or section name.
  6448. % The last argument is the page number.
  6449. % The arguments in between are the chapter number, section number, ...
  6450. % Parts, in the main contents. Replace the part number, which doesn't
  6451. % exist, with an empty box. Let's hope all the numbers have the same width.
  6452. % Also ignore the page number, which is conventionally not printed.
  6453. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
  6454. \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
  6455. %
  6456. % Parts, in the short toc.
  6457. \def\shortpartentry#1#2#3#4{%
  6458. \penalty-300
  6459. \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
  6460. \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
  6461. }
  6462. % Chapters, in the main contents.
  6463. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
  6464. % Chapters, in the short toc.
  6465. % See comments in \dochapentry re vbox and related settings.
  6466. \def\shortchapentry#1#2#3#4{%
  6467. \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
  6468. }
  6469. % Appendices, in the main contents.
  6470. % Need the word Appendix, and a fixed-size box.
  6471. %
  6472. \def\appendixbox#1{%
  6473. % We use M since it's probably the widest letter.
  6474. \setbox0 = \hbox{\putwordAppendix{} M}%
  6475. \hbox to \wd0{\putwordAppendix{} #1\hss}}
  6476. %
  6477. \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
  6478. % Unnumbered chapters.
  6479. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
  6480. \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
  6481. % Sections.
  6482. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
  6483. \let\appsecentry=\numsecentry
  6484. \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
  6485. % Subsections.
  6486. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
  6487. \let\appsubsecentry=\numsubsecentry
  6488. \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
  6489. % And subsubsections.
  6490. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
  6491. \let\appsubsubsecentry=\numsubsubsecentry
  6492. \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
  6493. % This parameter controls the indentation of the various levels.
  6494. % Same as \defaultparindent.
  6495. \newdimen\tocindent \tocindent = 15pt
  6496. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  6497. % page number.
  6498. %
  6499. % If the toc has to be broken over pages, we want it to be at chapters
  6500. % if at all possible; hence the \penalty.
  6501. \def\dochapentry#1#2{%
  6502. \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  6503. \begingroup
  6504. % Move the page numbers slightly to the right
  6505. \advance\entryrightmargin by -0.05em
  6506. \chapentryfonts
  6507. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6508. \endgroup
  6509. \nobreak\vskip .25\baselineskip plus.1\baselineskip
  6510. }
  6511. \def\dosecentry#1#2{\begingroup
  6512. \secentryfonts \leftskip=\tocindent
  6513. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6514. \endgroup}
  6515. \def\dosubsecentry#1#2{\begingroup
  6516. \subsecentryfonts \leftskip=2\tocindent
  6517. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6518. \endgroup}
  6519. \def\dosubsubsecentry#1#2{\begingroup
  6520. \subsubsecentryfonts \leftskip=3\tocindent
  6521. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6522. \endgroup}
  6523. % We use the same \entry macro as for the index entries.
  6524. \let\tocentry = \entry
  6525. % Space between chapter (or whatever) number and the title.
  6526. \def\labelspace{\hskip1em \relax}
  6527. \def\dopageno#1{{\rm #1}}
  6528. \def\doshortpageno#1{{\rm #1}}
  6529. \def\chapentryfonts{\secfonts \rm}
  6530. \def\secentryfonts{\textfonts}
  6531. \def\subsecentryfonts{\textfonts}
  6532. \def\subsubsecentryfonts{\textfonts}
  6533. \message{environments,}
  6534. % @foo ... @end foo.
  6535. % @tex ... @end tex escapes into raw TeX temporarily.
  6536. % One exception: @ is still an escape character, so that @end tex works.
  6537. % But \@ or @@ will get a plain @ character.
  6538. \envdef\tex{%
  6539. \setupmarkupstyle{tex}%
  6540. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  6541. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  6542. \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  6543. \catcode `\%=14
  6544. \catcode `\+=\other
  6545. \catcode `\"=\other
  6546. \catcode `\|=\other
  6547. \catcode `\<=\other
  6548. \catcode `\>=\other
  6549. \catcode `\`=\other
  6550. \catcode `\'=\other
  6551. %
  6552. % ' is active in math mode (mathcode"8000). So reset it, and all our
  6553. % other math active characters (just in case), to plain's definitions.
  6554. \mathactive
  6555. %
  6556. % Inverse of the list at the beginning of the file.
  6557. \let\b=\ptexb
  6558. \let\bullet=\ptexbullet
  6559. \let\c=\ptexc
  6560. \let\,=\ptexcomma
  6561. \let\.=\ptexdot
  6562. \let\dots=\ptexdots
  6563. \let\equiv=\ptexequiv
  6564. \let\!=\ptexexclam
  6565. \let\i=\ptexi
  6566. \let\indent=\ptexindent
  6567. \let\noindent=\ptexnoindent
  6568. \let\{=\ptexlbrace
  6569. \let\+=\tabalign
  6570. \let\}=\ptexrbrace
  6571. \let\/=\ptexslash
  6572. \let\sp=\ptexsp
  6573. \let\*=\ptexstar
  6574. %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
  6575. \let\t=\ptext
  6576. \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
  6577. \let\frenchspacing=\plainfrenchspacing
  6578. %
  6579. \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  6580. \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  6581. \def\@{@}%
  6582. }
  6583. % There is no need to define \Etex.
  6584. % Define @lisp ... @end lisp.
  6585. % @lisp environment forms a group so it can rebind things,
  6586. % including the definition of @end lisp (which normally is erroneous).
  6587. % Amount to narrow the margins by for @lisp.
  6588. \newskip\lispnarrowing \lispnarrowing=0.4in
  6589. % This is the definition that ^^M gets inside @lisp, @example, and other
  6590. % such environments. \null is better than a space, since it doesn't
  6591. % have any width.
  6592. \def\lisppar{\null\endgraf}
  6593. % This space is always present above and below environments.
  6594. \newskip\envskipamount \envskipamount = 0pt
  6595. % Make spacing and below environment symmetrical. We use \parskip here
  6596. % to help in doing that, since in @example-like environments \parskip
  6597. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  6598. % start of the next paragraph will insert \parskip.
  6599. %
  6600. \def\aboveenvbreak{{%
  6601. % =10000 instead of <10000 because of a special case in \itemzzz and
  6602. % \sectionheading, q.v.
  6603. \ifnum \lastpenalty=10000 \else
  6604. \advance\envskipamount by \parskip
  6605. \endgraf
  6606. \ifdim\lastskip<\envskipamount
  6607. \removelastskip
  6608. \ifnum\lastpenalty<10000
  6609. % Penalize breaking before the environment, because preceding text
  6610. % often leads into it.
  6611. \penalty100
  6612. \fi
  6613. \vskip\envskipamount
  6614. \fi
  6615. \fi
  6616. }}
  6617. \def\afterenvbreak{{%
  6618. % =10000 instead of <10000 because of a special case in \itemzzz and
  6619. % \sectionheading, q.v.
  6620. \ifnum \lastpenalty=10000 \else
  6621. \advance\envskipamount by \parskip
  6622. \endgraf
  6623. \ifdim\lastskip<\envskipamount
  6624. \removelastskip
  6625. % it's not a good place to break if the last penalty was \nobreak
  6626. % or better ...
  6627. \ifnum\lastpenalty<10000 \penalty-50 \fi
  6628. \vskip\envskipamount
  6629. \fi
  6630. \fi
  6631. }}
  6632. % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
  6633. % also clear it, so that its embedded environments do the narrowing again.
  6634. \let\nonarrowing=\relax
  6635. % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  6636. % environment contents.
  6637. \font\circle=lcircle10
  6638. \newdimen\circthick
  6639. \newdimen\cartouter\newdimen\cartinner
  6640. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  6641. \circthick=\fontdimen8\circle
  6642. %
  6643. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  6644. \def\ctr{{\hskip 6pt\circle\char'010}}
  6645. \def\cbl{{\circle\char'012\hskip -6pt}}
  6646. \def\cbr{{\hskip 6pt\circle\char'011}}
  6647. \def\carttop{\hbox to \cartouter{\hskip\lskip
  6648. \ctl\leaders\hrule height\circthick\hfil\ctr
  6649. \hskip\rskip}}
  6650. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  6651. \cbl\leaders\hrule height\circthick\hfil\cbr
  6652. \hskip\rskip}}
  6653. %
  6654. \newskip\lskip\newskip\rskip
  6655. \envdef\cartouche{%
  6656. \ifhmode\par\fi % can't be in the midst of a paragraph.
  6657. \startsavinginserts
  6658. \lskip=\leftskip \rskip=\rightskip
  6659. \leftskip=0pt\rightskip=0pt % we want these *outside*.
  6660. \cartinner=\hsize \advance\cartinner by-\lskip
  6661. \advance\cartinner by-\rskip
  6662. \cartouter=\hsize
  6663. \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  6664. % side, and for 6pt waste from
  6665. % each corner char, and rule thickness
  6666. \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  6667. %
  6668. % If this cartouche directly follows a sectioning command, we need the
  6669. % \parskip glue (backspaced over by default) or the cartouche can
  6670. % collide with the section heading.
  6671. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
  6672. %
  6673. \setbox\groupbox=\vbox\bgroup
  6674. \baselineskip=0pt\parskip=0pt\lineskip=0pt
  6675. \carttop
  6676. \hbox\bgroup
  6677. \hskip\lskip
  6678. \vrule\kern3pt
  6679. \vbox\bgroup
  6680. \kern3pt
  6681. \hsize=\cartinner
  6682. \baselineskip=\normbskip
  6683. \lineskip=\normlskip
  6684. \parskip=\normpskip
  6685. \vskip -\parskip
  6686. \comment % For explanation, see the end of def\group.
  6687. }
  6688. \def\Ecartouche{%
  6689. \ifhmode\par\fi
  6690. \kern3pt
  6691. \egroup
  6692. \kern3pt\vrule
  6693. \hskip\rskip
  6694. \egroup
  6695. \cartbot
  6696. \egroup
  6697. \addgroupbox
  6698. \checkinserts
  6699. }
  6700. % This macro is called at the beginning of all the @example variants,
  6701. % inside a group.
  6702. \newdimen\nonfillparindent
  6703. \def\nonfillstart{%
  6704. \aboveenvbreak
  6705. \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
  6706. \sepspaces % Make spaces be word-separators rather than space tokens.
  6707. \let\par = \lisppar % don't ignore blank lines
  6708. \obeylines % each line of input is a line of output
  6709. \parskip = 0pt
  6710. % Turn off paragraph indentation but redefine \indent to emulate
  6711. % the normal \indent.
  6712. \nonfillparindent=\parindent
  6713. \parindent = 0pt
  6714. \let\indent\nonfillindent
  6715. %
  6716. \emergencystretch = 0pt % don't try to avoid overfull boxes
  6717. \ifx\nonarrowing\relax
  6718. \advance \leftskip by \lispnarrowing
  6719. \exdentamount=\lispnarrowing
  6720. \else
  6721. \let\nonarrowing = \relax
  6722. \fi
  6723. \let\exdent=\nofillexdent
  6724. }
  6725. \begingroup
  6726. \obeyspaces
  6727. % We want to swallow spaces (but not other tokens) after the fake
  6728. % @indent in our nonfill-environments, where spaces are normally
  6729. % active and set to @tie, resulting in them not being ignored after
  6730. % @indent.
  6731. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
  6732. \gdef\nonfillindentcheck{%
  6733. \ifx\temp %
  6734. \expandafter\nonfillindentgobble%
  6735. \else%
  6736. \leavevmode\nonfillindentbox%
  6737. \fi%
  6738. }%
  6739. \endgroup
  6740. \def\nonfillindentgobble#1{\nonfillindent}
  6741. \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
  6742. % If you want all examples etc. small: @set dispenvsize small.
  6743. % If you want even small examples the full size: @set dispenvsize nosmall.
  6744. % This affects the following displayed environments:
  6745. % @example, @display, @format, @lisp
  6746. %
  6747. \def\smallword{small}
  6748. \def\nosmallword{nosmall}
  6749. \let\SETdispenvsize\relax
  6750. \def\setnormaldispenv{%
  6751. \ifx\SETdispenvsize\smallword
  6752. % end paragraph for sake of leading, in case document has no blank
  6753. % line. This is redundant with what happens in \aboveenvbreak, but
  6754. % we need to do it before changing the fonts, and it's inconvenient
  6755. % to change the fonts afterward.
  6756. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6757. \smallexamplefonts \rm
  6758. \fi
  6759. }
  6760. \def\setsmalldispenv{%
  6761. \ifx\SETdispenvsize\nosmallword
  6762. \else
  6763. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6764. \smallexamplefonts \rm
  6765. \fi
  6766. }
  6767. % We often define two environments, @foo and @smallfoo.
  6768. % Let's do it in one command. #1 is the env name, #2 the definition.
  6769. \def\makedispenvdef#1#2{%
  6770. \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
  6771. \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
  6772. \expandafter\let\csname E#1\endcsname \afterenvbreak
  6773. \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
  6774. }
  6775. % Define two environment synonyms (#1 and #2) for an environment.
  6776. \def\maketwodispenvdef#1#2#3{%
  6777. \makedispenvdef{#1}{#3}%
  6778. \makedispenvdef{#2}{#3}%
  6779. }
  6780. %
  6781. % @lisp: indented, narrowed, typewriter font;
  6782. % @example: same as @lisp.
  6783. %
  6784. % @smallexample and @smalllisp: use smaller fonts.
  6785. % Originally contributed by Pavel@xerox.
  6786. %
  6787. \maketwodispenvdef{lisp}{example}{%
  6788. \nonfillstart
  6789. \tt\setupmarkupstyle{example}%
  6790. \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  6791. \gobble % eat return
  6792. }
  6793. % @display/@smalldisplay: same as @lisp except keep current font.
  6794. %
  6795. \makedispenvdef{display}{%
  6796. \nonfillstart
  6797. \gobble
  6798. }
  6799. % @format/@smallformat: same as @display except don't narrow margins.
  6800. %
  6801. \makedispenvdef{format}{%
  6802. \let\nonarrowing = t%
  6803. \nonfillstart
  6804. \gobble
  6805. }
  6806. % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
  6807. \envdef\flushleft{%
  6808. \let\nonarrowing = t%
  6809. \nonfillstart
  6810. \gobble
  6811. }
  6812. \let\Eflushleft = \afterenvbreak
  6813. % @flushright.
  6814. %
  6815. \envdef\flushright{%
  6816. \let\nonarrowing = t%
  6817. \nonfillstart
  6818. \advance\leftskip by 0pt plus 1fill\relax
  6819. \gobble
  6820. }
  6821. \let\Eflushright = \afterenvbreak
  6822. % @raggedright does more-or-less normal line breaking but no right
  6823. % justification. From plain.tex. Don't stretch around special
  6824. % characters in urls in this environment, since the stretch at the right
  6825. % should be enough.
  6826. \envdef\raggedright{%
  6827. \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
  6828. \def\urefprestretchamount{0pt}%
  6829. \def\urefpoststretchamount{0pt}%
  6830. }
  6831. \let\Eraggedright\par
  6832. \envdef\raggedleft{%
  6833. \parindent=0pt \leftskip0pt plus2em
  6834. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6835. \hbadness=10000 % Last line will usually be underfull, so turn off
  6836. % badness reporting.
  6837. }
  6838. \let\Eraggedleft\par
  6839. \envdef\raggedcenter{%
  6840. \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
  6841. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6842. \hbadness=10000 % Last line will usually be underfull, so turn off
  6843. % badness reporting.
  6844. }
  6845. \let\Eraggedcenter\par
  6846. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  6847. % and narrows the margins. We keep \parskip nonzero in general, since
  6848. % we're doing normal filling. So, when using \aboveenvbreak and
  6849. % \afterenvbreak, temporarily make \parskip 0.
  6850. %
  6851. \makedispenvdef{quotation}{\quotationstart}
  6852. %
  6853. \def\quotationstart{%
  6854. \indentedblockstart % same as \indentedblock, but increase right margin too.
  6855. \ifx\nonarrowing\relax
  6856. \advance\rightskip by \lispnarrowing
  6857. \fi
  6858. \parsearg\quotationlabel
  6859. }
  6860. % We have retained a nonzero parskip for the environment, since we're
  6861. % doing normal filling.
  6862. %
  6863. \def\Equotation{%
  6864. \par
  6865. \ifx\quotationauthor\thisisundefined\else
  6866. % indent a bit.
  6867. \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
  6868. \fi
  6869. {\parskip=0pt \afterenvbreak}%
  6870. }
  6871. \def\Esmallquotation{\Equotation}
  6872. % If we're given an argument, typeset it in bold with a colon after.
  6873. \def\quotationlabel#1{%
  6874. \def\temp{#1}%
  6875. \ifx\temp\empty \else
  6876. {\bf #1: }%
  6877. \fi
  6878. }
  6879. % @indentedblock is like @quotation, but indents only on the left and
  6880. % has no optional argument.
  6881. %
  6882. \makedispenvdef{indentedblock}{\indentedblockstart}
  6883. %
  6884. \def\indentedblockstart{%
  6885. {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  6886. \parindent=0pt
  6887. %
  6888. % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  6889. \ifx\nonarrowing\relax
  6890. \advance\leftskip by \lispnarrowing
  6891. \exdentamount = \lispnarrowing
  6892. \else
  6893. \let\nonarrowing = \relax
  6894. \fi
  6895. }
  6896. % Keep a nonzero parskip for the environment, since we're doing normal filling.
  6897. %
  6898. \def\Eindentedblock{%
  6899. \par
  6900. {\parskip=0pt \afterenvbreak}%
  6901. }
  6902. \def\Esmallindentedblock{\Eindentedblock}
  6903. % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
  6904. % If we want to allow any <char> as delimiter,
  6905. % we need the curly braces so that makeinfo sees the @verb command, eg:
  6906. % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
  6907. %
  6908. % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
  6909. %
  6910. % [Knuth] p.344; only we need to do the other characters Texinfo sets
  6911. % active too. Otherwise, they get lost as the first character on a
  6912. % verbatim line.
  6913. \def\dospecials{%
  6914. \do\ \do\\\do\{\do\}\do\$\do\&%
  6915. \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  6916. \do\<\do\>\do\|\do\@\do+\do\"%
  6917. % Don't do the quotes -- if we do, @set txicodequoteundirected and
  6918. % @set txicodequotebacktick will not have effect on @verb and
  6919. % @verbatim, and ?` and !` ligatures won't get disabled.
  6920. %\do\`\do\'%
  6921. }
  6922. %
  6923. % [Knuth] p. 380
  6924. \def\uncatcodespecials{%
  6925. \def\do##1{\catcode`##1=\other}\dospecials}
  6926. %
  6927. % Setup for the @verb command.
  6928. %
  6929. % Eight spaces for a tab
  6930. \begingroup
  6931. \catcode`\^^I=\active
  6932. \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
  6933. \endgroup
  6934. %
  6935. \def\setupverb{%
  6936. \tt % easiest (and conventionally used) font for verbatim
  6937. \def\par{\leavevmode\endgraf}%
  6938. \setupmarkupstyle{verb}%
  6939. \tabeightspaces
  6940. % Respect line breaks,
  6941. % print special symbols as themselves, and
  6942. % make each space count
  6943. % must do in this order:
  6944. \obeylines \uncatcodespecials \sepspaces
  6945. }
  6946. % Setup for the @verbatim environment
  6947. %
  6948. % Real tab expansion.
  6949. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
  6950. %
  6951. % We typeset each line of the verbatim in an \hbox, so we can handle
  6952. % tabs. The \global is in case the verbatim line starts with an accent,
  6953. % or some other command that starts with a begin-group. Otherwise, the
  6954. % entire \verbbox would disappear at the corresponding end-group, before
  6955. % it is typeset. Meanwhile, we can't have nested verbatim commands
  6956. % (can we?), so the \global won't be overwriting itself.
  6957. \newbox\verbbox
  6958. \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
  6959. %
  6960. \begingroup
  6961. \catcode`\^^I=\active
  6962. \gdef\tabexpand{%
  6963. \catcode`\^^I=\active
  6964. \def^^I{\leavevmode\egroup
  6965. \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
  6966. \divide\dimen\verbbox by\tabw
  6967. \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
  6968. \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
  6969. \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
  6970. }%
  6971. }
  6972. \endgroup
  6973. % start the verbatim environment.
  6974. \def\setupverbatim{%
  6975. \let\nonarrowing = t%
  6976. \nonfillstart
  6977. \tt % easiest (and conventionally used) font for verbatim
  6978. % The \leavevmode here is for blank lines. Otherwise, we would
  6979. % never \starttabox and the \egroup would end verbatim mode.
  6980. \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
  6981. \tabexpand
  6982. \setupmarkupstyle{verbatim}%
  6983. % Respect line breaks,
  6984. % print special symbols as themselves, and
  6985. % make each space count.
  6986. % Must do in this order:
  6987. \obeylines \uncatcodespecials \sepspaces
  6988. \everypar{\starttabbox}%
  6989. }
  6990. % Do the @verb magic: verbatim text is quoted by unique
  6991. % delimiter characters. Before first delimiter expect a
  6992. % right brace, after last delimiter expect closing brace:
  6993. %
  6994. % \def\doverb'{'<char>#1<char>'}'{#1}
  6995. %
  6996. % [Knuth] p. 382; only eat outer {}
  6997. \begingroup
  6998. \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
  6999. \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
  7000. \endgroup
  7001. %
  7002. \def\verb{\begingroup\setupverb\doverb}
  7003. %
  7004. %
  7005. % Do the @verbatim magic: define the macro \doverbatim so that
  7006. % the (first) argument ends when '@end verbatim' is reached, ie:
  7007. %
  7008. % \def\doverbatim#1@end verbatim{#1}
  7009. %
  7010. % For Texinfo it's a lot easier than for LaTeX,
  7011. % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
  7012. % we need not redefine '\', '{' and '}'.
  7013. %
  7014. % Inspired by LaTeX's verbatim command set [latex.ltx]
  7015. %
  7016. \begingroup
  7017. \catcode`\ =\active
  7018. \obeylines %
  7019. % ignore everything up to the first ^^M, that's the newline at the end
  7020. % of the @verbatim input line itself. Otherwise we get an extra blank
  7021. % line in the output.
  7022. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
  7023. % We really want {...\end verbatim} in the body of the macro, but
  7024. % without the active space; thus we have to use \xdef and \gobble.
  7025. \endgroup
  7026. %
  7027. \envdef\verbatim{%
  7028. \setupverbatim\doverbatim
  7029. }
  7030. \let\Everbatim = \afterenvbreak
  7031. % @verbatiminclude FILE - insert text of file in verbatim environment.
  7032. %
  7033. \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
  7034. %
  7035. \def\doverbatiminclude#1{%
  7036. {%
  7037. \makevalueexpandable
  7038. \setupverbatim
  7039. \indexnofonts % Allow `@@' and other weird things in file names.
  7040. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
  7041. \input #1
  7042. \afterenvbreak
  7043. }%
  7044. }
  7045. % @copying ... @end copying.
  7046. % Save the text away for @insertcopying later.
  7047. %
  7048. % We save the uninterpreted tokens, rather than creating a box.
  7049. % Saving the text in a box would be much easier, but then all the
  7050. % typesetting commands (@smallbook, font changes, etc.) have to be done
  7051. % beforehand -- and a) we want @copying to be done first in the source
  7052. % file; b) letting users define the frontmatter in as flexible order as
  7053. % possible is desirable.
  7054. %
  7055. \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
  7056. \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
  7057. %
  7058. \def\insertcopying{%
  7059. \begingroup
  7060. \parindent = 0pt % paragraph indentation looks wrong on title page
  7061. \scanexp\copyingtext
  7062. \endgroup
  7063. }
  7064. \message{defuns,}
  7065. % @defun etc.
  7066. \newskip\defbodyindent \defbodyindent=.4in
  7067. \newskip\defargsindent \defargsindent=50pt
  7068. \newskip\deflastargmargin \deflastargmargin=18pt
  7069. \newcount\defunpenalty
  7070. % Start the processing of @deffn:
  7071. \def\startdefun{%
  7072. \ifnum\lastpenalty<10000
  7073. \medbreak
  7074. \defunpenalty=10003 % Will keep this @deffn together with the
  7075. % following @def command, see below.
  7076. \else
  7077. % If there are two @def commands in a row, we'll have a \nobreak,
  7078. % which is there to keep the function description together with its
  7079. % header. But if there's nothing but headers, we need to allow a
  7080. % break somewhere. Check specifically for penalty 10002, inserted
  7081. % by \printdefunline, instead of 10000, since the sectioning
  7082. % commands also insert a nobreak penalty, and we don't want to allow
  7083. % a break between a section heading and a defun.
  7084. %
  7085. % As a further refinement, we avoid "club" headers by signalling
  7086. % with penalty of 10003 after the very first @deffn in the
  7087. % sequence (see above), and penalty of 10002 after any following
  7088. % @def command.
  7089. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
  7090. %
  7091. % Similarly, after a section heading, do not allow a break.
  7092. % But do insert the glue.
  7093. \medskip % preceded by discardable penalty, so not a breakpoint
  7094. \fi
  7095. %
  7096. \parindent=0in
  7097. \advance\leftskip by \defbodyindent
  7098. \exdentamount=\defbodyindent
  7099. }
  7100. \def\dodefunx#1{%
  7101. % First, check whether we are in the right environment:
  7102. \checkenv#1%
  7103. %
  7104. % As above, allow line break if we have multiple x headers in a row.
  7105. % It's not a great place, though.
  7106. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
  7107. %
  7108. % And now, it's time to reuse the body of the original defun:
  7109. \expandafter\gobbledefun#1%
  7110. }
  7111. \def\gobbledefun#1\startdefun{}
  7112. % \printdefunline \deffnheader{text}
  7113. %
  7114. \def\printdefunline#1#2{%
  7115. \begingroup
  7116. % call \deffnheader:
  7117. #1#2 \endheader
  7118. % common ending:
  7119. \interlinepenalty = 10000
  7120. \advance\rightskip by 0pt plus 1fil\relax
  7121. \endgraf
  7122. \nobreak\vskip -\parskip
  7123. \penalty\defunpenalty % signal to \startdefun and \dodefunx
  7124. % Some of the @defun-type tags do not enable magic parentheses,
  7125. % rendering the following check redundant. But we don't optimize.
  7126. \checkparencounts
  7127. \endgroup
  7128. }
  7129. \def\Edefun{\endgraf\medbreak}
  7130. % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
  7131. % the only thing remaining is to define \deffnheader.
  7132. %
  7133. \def\makedefun#1{%
  7134. \expandafter\let\csname E#1\endcsname = \Edefun
  7135. \edef\temp{\noexpand\domakedefun
  7136. \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
  7137. \temp
  7138. }
  7139. % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
  7140. %
  7141. % Define \deffn and \deffnx, without parameters.
  7142. % \deffnheader has to be defined explicitly.
  7143. %
  7144. \def\domakedefun#1#2#3{%
  7145. \envdef#1{%
  7146. \startdefun
  7147. \doingtypefnfalse % distinguish typed functions from all else
  7148. \parseargusing\activeparens{\printdefunline#3}%
  7149. }%
  7150. \def#2{\dodefunx#1}%
  7151. \def#3%
  7152. }
  7153. \newif\ifdoingtypefn % doing typed function?
  7154. \newif\ifrettypeownline % typeset return type on its own line?
  7155. % @deftypefnnewline on|off says whether the return type of typed functions
  7156. % are printed on their own line. This affects @deftypefn, @deftypefun,
  7157. % @deftypeop, and @deftypemethod.
  7158. %
  7159. \parseargdef\deftypefnnewline{%
  7160. \def\temp{#1}%
  7161. \ifx\temp\onword
  7162. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7163. = \empty
  7164. \else\ifx\temp\offword
  7165. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7166. = \relax
  7167. \else
  7168. \errhelp = \EMsimple
  7169. \errmessage{Unknown @txideftypefnnl value `\temp',
  7170. must be on|off}%
  7171. \fi\fi
  7172. }
  7173. % Untyped functions:
  7174. % @deffn category name args
  7175. \makedefun{deffn}{\deffngeneral{}}
  7176. % @deffn category class name args
  7177. \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
  7178. % \defopon {category on}class name args
  7179. \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7180. % \deffngeneral {subind}category name args
  7181. %
  7182. \def\deffngeneral#1#2 #3 #4\endheader{%
  7183. % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
  7184. \dosubind{fn}{\code{#3}}{#1}%
  7185. \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
  7186. }
  7187. % Typed functions:
  7188. % @deftypefn category type name args
  7189. \makedefun{deftypefn}{\deftypefngeneral{}}
  7190. % @deftypeop category class type name args
  7191. \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
  7192. % \deftypeopon {category on}class type name args
  7193. \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7194. % \deftypefngeneral {subind}category type name args
  7195. %
  7196. \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
  7197. \dosubind{fn}{\code{#4}}{#1}%
  7198. \doingtypefntrue
  7199. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7200. }
  7201. % Typed variables:
  7202. % @deftypevr category type var args
  7203. \makedefun{deftypevr}{\deftypecvgeneral{}}
  7204. % @deftypecv category class type var args
  7205. \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
  7206. % \deftypecvof {category of}class type var args
  7207. \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
  7208. % \deftypecvgeneral {subind}category type var args
  7209. %
  7210. \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
  7211. \dosubind{vr}{\code{#4}}{#1}%
  7212. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7213. }
  7214. % Untyped variables:
  7215. % @defvr category var args
  7216. \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
  7217. % @defcv category class var args
  7218. \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
  7219. % \defcvof {category of}class var args
  7220. \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
  7221. % Types:
  7222. % @deftp category name args
  7223. \makedefun{deftp}#1 #2 #3\endheader{%
  7224. \doind{tp}{\code{#2}}%
  7225. \defname{#1}{}{#2}\defunargs{#3\unskip}%
  7226. }
  7227. % Remaining @defun-like shortcuts:
  7228. \makedefun{defun}{\deffnheader{\putwordDeffunc} }
  7229. \makedefun{defmac}{\deffnheader{\putwordDefmac} }
  7230. \makedefun{defspec}{\deffnheader{\putwordDefspec} }
  7231. \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
  7232. \makedefun{defvar}{\defvrheader{\putwordDefvar} }
  7233. \makedefun{defopt}{\defvrheader{\putwordDefopt} }
  7234. \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
  7235. \makedefun{defmethod}{\defopon\putwordMethodon}
  7236. \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
  7237. \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
  7238. \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
  7239. % \defname, which formats the name of the @def (not the args).
  7240. % #1 is the category, such as "Function".
  7241. % #2 is the return type, if any.
  7242. % #3 is the function name.
  7243. %
  7244. % We are followed by (but not passed) the arguments, if any.
  7245. %
  7246. \def\defname#1#2#3{%
  7247. \par
  7248. % Get the values of \leftskip and \rightskip as they were outside the @def...
  7249. \advance\leftskip by -\defbodyindent
  7250. %
  7251. % Determine if we are typesetting the return type of a typed function
  7252. % on a line by itself.
  7253. \rettypeownlinefalse
  7254. \ifdoingtypefn % doing a typed function specifically?
  7255. % then check user option for putting return type on its own line:
  7256. \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
  7257. \rettypeownlinetrue
  7258. \fi
  7259. \fi
  7260. %
  7261. % How we'll format the category name. Putting it in brackets helps
  7262. % distinguish it from the body text that may end up on the next line
  7263. % just below it.
  7264. \def\temp{#1}%
  7265. \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
  7266. %
  7267. % Figure out line sizes for the paragraph shape. We'll always have at
  7268. % least two.
  7269. \tempnum = 2
  7270. %
  7271. % The first line needs space for \box0; but if \rightskip is nonzero,
  7272. % we need only space for the part of \box0 which exceeds it:
  7273. \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
  7274. %
  7275. % If doing a return type on its own line, we'll have another line.
  7276. \ifrettypeownline
  7277. \advance\tempnum by 1
  7278. \def\maybeshapeline{0in \hsize}%
  7279. \else
  7280. \def\maybeshapeline{}%
  7281. \fi
  7282. %
  7283. % The continuations:
  7284. \dimen2=\hsize \advance\dimen2 by -\defargsindent
  7285. %
  7286. % The final paragraph shape:
  7287. \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
  7288. %
  7289. % Put the category name at the right margin.
  7290. \noindent
  7291. \hbox to 0pt{%
  7292. \hfil\box0 \kern-\hsize
  7293. % \hsize has to be shortened this way:
  7294. \kern\leftskip
  7295. % Intentionally do not respect \rightskip, since we need the space.
  7296. }%
  7297. %
  7298. % Allow all lines to be underfull without complaint:
  7299. \tolerance=10000 \hbadness=10000
  7300. \exdentamount=\defbodyindent
  7301. {%
  7302. % defun fonts. We use typewriter by default (used to be bold) because:
  7303. % . we're printing identifiers, they should be in tt in principle.
  7304. % . in languages with many accents, such as Czech or French, it's
  7305. % common to leave accents off identifiers. The result looks ok in
  7306. % tt, but exceedingly strange in rm.
  7307. % . we don't want -- and --- to be treated as ligatures.
  7308. % . this still does not fix the ?` and !` ligatures, but so far no
  7309. % one has made identifiers using them :).
  7310. \df \tt
  7311. \def\temp{#2}% text of the return type
  7312. \ifx\temp\empty\else
  7313. \tclose{\temp}% typeset the return type
  7314. \ifrettypeownline
  7315. % put return type on its own line; prohibit line break following:
  7316. \hfil\vadjust{\nobreak}\break
  7317. \else
  7318. \space % type on same line, so just followed by a space
  7319. \fi
  7320. \fi % no return type
  7321. #3% output function name
  7322. }%
  7323. {\rm\enskip}% hskip 0.5 em of \rmfont
  7324. %
  7325. \boldbrax
  7326. % arguments will be output next, if any.
  7327. }
  7328. % Print arguments in slanted roman (not ttsl), inconsistently with using
  7329. % tt for the name. This is because literal text is sometimes needed in
  7330. % the argument list (groff manual), and ttsl and tt are not very
  7331. % distinguishable. Prevent hyphenation at `-' chars.
  7332. %
  7333. \def\defunargs#1{%
  7334. % use sl by default (not ttsl),
  7335. % tt for the names.
  7336. \df \sl \hyphenchar\font=0
  7337. %
  7338. % On the other hand, if an argument has two dashes (for instance), we
  7339. % want a way to get ttsl. We used to recommend @var for that, so
  7340. % leave the code in, but it's strange for @var to lead to typewriter.
  7341. % Nowadays we recommend @code, since the difference between a ttsl hyphen
  7342. % and a tt hyphen is pretty tiny. @code also disables ?` !`.
  7343. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
  7344. #1%
  7345. \sl\hyphenchar\font=45
  7346. }
  7347. % We want ()&[] to print specially on the defun line.
  7348. %
  7349. \def\activeparens{%
  7350. \catcode`\(=\active \catcode`\)=\active
  7351. \catcode`\[=\active \catcode`\]=\active
  7352. \catcode`\&=\active
  7353. }
  7354. % Make control sequences which act like normal parenthesis chars.
  7355. \let\lparen = ( \let\rparen = )
  7356. % Be sure that we always have a definition for `(', etc. For example,
  7357. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  7358. % so TeX would otherwise complain about undefined control sequence.
  7359. {
  7360. \activeparens
  7361. \global\let(=\lparen \global\let)=\rparen
  7362. \global\let[=\lbrack \global\let]=\rbrack
  7363. \global\let& = \&
  7364. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  7365. \gdef\magicamp{\let&=\amprm}
  7366. }
  7367. \newcount\parencount
  7368. % If we encounter &foo, then turn on ()-hacking afterwards
  7369. \newif\ifampseen
  7370. \def\amprm#1 {\ampseentrue{\bf\&#1 }}
  7371. \def\parenfont{%
  7372. \ifampseen
  7373. % At the first level, print parens in roman,
  7374. % otherwise use the default font.
  7375. \ifnum \parencount=1 \rm \fi
  7376. \else
  7377. % The \sf parens (in \boldbrax) actually are a little bolder than
  7378. % the contained text. This is especially needed for [ and ] .
  7379. \sf
  7380. \fi
  7381. }
  7382. \def\infirstlevel#1{%
  7383. \ifampseen
  7384. \ifnum\parencount=1
  7385. #1%
  7386. \fi
  7387. \fi
  7388. }
  7389. \def\bfafterword#1 {#1 \bf}
  7390. \def\opnr{%
  7391. \global\advance\parencount by 1
  7392. {\parenfont(}%
  7393. \infirstlevel \bfafterword
  7394. }
  7395. \def\clnr{%
  7396. {\parenfont)}%
  7397. \infirstlevel \sl
  7398. \global\advance\parencount by -1
  7399. }
  7400. \newcount\brackcount
  7401. \def\lbrb{%
  7402. \global\advance\brackcount by 1
  7403. {\bf[}%
  7404. }
  7405. \def\rbrb{%
  7406. {\bf]}%
  7407. \global\advance\brackcount by -1
  7408. }
  7409. \def\checkparencounts{%
  7410. \ifnum\parencount=0 \else \badparencount \fi
  7411. \ifnum\brackcount=0 \else \badbrackcount \fi
  7412. }
  7413. % these should not use \errmessage; the glibc manual, at least, actually
  7414. % has such constructs (when documenting function pointers).
  7415. \def\badparencount{%
  7416. \message{Warning: unbalanced parentheses in @def...}%
  7417. \global\parencount=0
  7418. }
  7419. \def\badbrackcount{%
  7420. \message{Warning: unbalanced square brackets in @def...}%
  7421. \global\brackcount=0
  7422. }
  7423. \message{macros,}
  7424. % @macro.
  7425. % To do this right we need a feature of e-TeX, \scantokens,
  7426. % which we arrange to emulate with a temporary file in ordinary TeX.
  7427. \ifx\eTeXversion\thisisundefined
  7428. \newwrite\macscribble
  7429. \def\scantokens#1{%
  7430. \toks0={#1}%
  7431. \immediate\openout\macscribble=\jobname.tmp
  7432. \immediate\write\macscribble{\the\toks0}%
  7433. \immediate\closeout\macscribble
  7434. \input \jobname.tmp
  7435. }
  7436. \fi
  7437. % alias because \c means cedilla in @tex or @math
  7438. \let\texinfoc=\c
  7439. \newcount\savedcatcodeone
  7440. \newcount\savedcatcodetwo
  7441. % Used at the time of macro expansion.
  7442. % Argument is macro body with arguments substituted
  7443. \def\scanmacro#1{%
  7444. \newlinechar`\^^M
  7445. \def\xeatspaces{\eatspaces}%
  7446. %
  7447. % Temporarily undo catcode changes of \printindex. Set catcode of @ to
  7448. % 0 so that @-commands in macro expansions aren't printed literally when
  7449. % formatting an index file, where \ is used as the escape character.
  7450. \savedcatcodeone=\catcode`\@
  7451. \savedcatcodetwo=\catcode`\\
  7452. \catcode`\@=0
  7453. \catcode`\\=\active
  7454. %
  7455. % Process the macro body under the current catcode regime.
  7456. \scantokens{#1@texinfoc}%
  7457. %
  7458. \catcode`\@=\savedcatcodeone
  7459. \catcode`\\=\savedcatcodetwo
  7460. %
  7461. % The \texinfoc is to remove the \newlinechar added by \scantokens, and
  7462. % can be noticed by \parsearg.
  7463. % We avoid surrounding the call to \scantokens with \bgroup and \egroup
  7464. % to allow macros to open or close groups themselves.
  7465. }
  7466. % Used for copying and captions
  7467. \def\scanexp#1{%
  7468. \expandafter\scanmacro\expandafter{#1}%
  7469. }
  7470. \newcount\paramno % Count of parameters
  7471. \newtoks\macname % Macro name
  7472. \newif\ifrecursive % Is it recursive?
  7473. % List of all defined macros in the form
  7474. % \commondummyword\macro1\commondummyword\macro2...
  7475. % Currently is also contains all @aliases; the list can be split
  7476. % if there is a need.
  7477. \def\macrolist{}
  7478. % Add the macro to \macrolist
  7479. \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
  7480. \def\addtomacrolistxxx#1{%
  7481. \toks0 = \expandafter{\macrolist\commondummyword#1}%
  7482. \xdef\macrolist{\the\toks0}%
  7483. }
  7484. % Utility routines.
  7485. % This does \let #1 = #2, with \csnames; that is,
  7486. % \let \csname#1\endcsname = \csname#2\endcsname
  7487. % (except of course we have to play expansion games).
  7488. %
  7489. \def\cslet#1#2{%
  7490. \expandafter\let
  7491. \csname#1\expandafter\endcsname
  7492. \csname#2\endcsname
  7493. }
  7494. % Trim leading and trailing spaces off a string.
  7495. % Concepts from aro-bend problem 15 (see CTAN).
  7496. {\catcode`\@=11
  7497. \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  7498. \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  7499. \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  7500. \def\unbrace#1{#1}
  7501. \unbrace{\gdef\trim@@@ #1 } #2@{#1}
  7502. }
  7503. % Trim a single trailing ^^M off a string.
  7504. {\catcode`\^^M=\other \catcode`\Q=3%
  7505. \gdef\eatcr #1{\eatcra #1Q^^MQ}%
  7506. \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  7507. \gdef\eatcrb#1Q#2Q{#1}%
  7508. }
  7509. % Macro bodies are absorbed as an argument in a context where
  7510. % all characters are catcode 10, 11 or 12, except \ which is active
  7511. % (as in normal texinfo). It is necessary to change the definition of \
  7512. % to recognize macro arguments; this is the job of \mbodybackslash.
  7513. %
  7514. % Non-ASCII encodings make 8-bit characters active, so un-activate
  7515. % them to avoid their expansion. Must do this non-globally, to
  7516. % confine the change to the current group.
  7517. %
  7518. % It's necessary to have hard CRs when the macro is executed. This is
  7519. % done by making ^^M (\endlinechar) catcode 12 when reading the macro
  7520. % body, and then making it the \newlinechar in \scanmacro.
  7521. %
  7522. \def\scanctxt{% used as subroutine
  7523. \catcode`\"=\other
  7524. \catcode`\+=\other
  7525. \catcode`\<=\other
  7526. \catcode`\>=\other
  7527. \catcode`\^=\other
  7528. \catcode`\_=\other
  7529. \catcode`\|=\other
  7530. \catcode`\~=\other
  7531. \passthroughcharstrue
  7532. }
  7533. \def\scanargctxt{% used for copying and captions, not macros.
  7534. \scanctxt
  7535. \catcode`\@=\other
  7536. \catcode`\\=\other
  7537. \catcode`\^^M=\other
  7538. }
  7539. \def\macrobodyctxt{% used for @macro definitions
  7540. \scanctxt
  7541. \catcode`\ =\other
  7542. \catcode`\@=\other
  7543. \catcode`\{=\other
  7544. \catcode`\}=\other
  7545. \catcode`\^^M=\other
  7546. \usembodybackslash
  7547. }
  7548. % Used when scanning braced macro arguments. Note, however, that catcode
  7549. % changes here are ineffectual if the macro invocation was nested inside
  7550. % an argument to another Texinfo command.
  7551. \def\macroargctxt{%
  7552. \scanctxt
  7553. \catcode`\ =\active
  7554. \catcode`\^^M=\other
  7555. \catcode`\\=\active
  7556. }
  7557. \def\macrolineargctxt{% used for whole-line arguments without braces
  7558. \scanctxt
  7559. \catcode`\{=\other
  7560. \catcode`\}=\other
  7561. }
  7562. % \mbodybackslash is the definition of \ in @macro bodies.
  7563. % It maps \foo\ => \csname macarg.foo\endcsname => #N
  7564. % where N is the macro parameter number.
  7565. % We define \csname macarg.\endcsname to be \realbackslash, so
  7566. % \\ in macro replacement text gets you a backslash.
  7567. %
  7568. {\catcode`@=0 @catcode`@\=@active
  7569. @gdef@usembodybackslash{@let\=@mbodybackslash}
  7570. @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  7571. }
  7572. \expandafter\def\csname macarg.\endcsname{\realbackslash}
  7573. \def\margbackslash#1{\char`\#1 }
  7574. \def\macro{\recursivefalse\parsearg\macroxxx}
  7575. \def\rmacro{\recursivetrue\parsearg\macroxxx}
  7576. \def\macroxxx#1{%
  7577. \getargs{#1}% now \macname is the macname and \argl the arglist
  7578. \ifx\argl\empty % no arguments
  7579. \paramno=0\relax
  7580. \else
  7581. \expandafter\parsemargdef \argl;%
  7582. \if\paramno>256\relax
  7583. \ifx\eTeXversion\thisisundefined
  7584. \errhelp = \EMsimple
  7585. \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
  7586. \fi
  7587. \fi
  7588. \fi
  7589. \if1\csname ismacro.\the\macname\endcsname
  7590. \message{Warning: redefining \the\macname}%
  7591. \else
  7592. \expandafter\ifx\csname \the\macname\endcsname \relax
  7593. \else \errmessage{Macro name \the\macname\space already defined}\fi
  7594. \global\cslet{macsave.\the\macname}{\the\macname}%
  7595. \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  7596. \addtomacrolist{\the\macname}%
  7597. \fi
  7598. \begingroup \macrobodyctxt
  7599. \ifrecursive \expandafter\parsermacbody
  7600. \else \expandafter\parsemacbody
  7601. \fi}
  7602. \parseargdef\unmacro{%
  7603. \if1\csname ismacro.#1\endcsname
  7604. \global\cslet{#1}{macsave.#1}%
  7605. \global\expandafter\let \csname ismacro.#1\endcsname=0%
  7606. % Remove the macro name from \macrolist:
  7607. \begingroup
  7608. \expandafter\let\csname#1\endcsname \relax
  7609. \let\commondummyword\unmacrodo
  7610. \xdef\macrolist{\macrolist}%
  7611. \endgroup
  7612. \else
  7613. \errmessage{Macro #1 not defined}%
  7614. \fi
  7615. }
  7616. % Called by \do from \dounmacro on each macro. The idea is to omit any
  7617. % macro definitions that have been changed to \relax.
  7618. %
  7619. \def\unmacrodo#1{%
  7620. \ifx #1\relax
  7621. % remove this
  7622. \else
  7623. \noexpand\commondummyword \noexpand#1%
  7624. \fi
  7625. }
  7626. % \getargs -- Parse the arguments to a @macro line. Set \macname to
  7627. % the name of the macro, and \argl to the braced argument list.
  7628. \def\getargs#1{\getargsxxx#1{}}
  7629. \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  7630. \def\getmacname#1 #2\relax{\macname={#1}}
  7631. \def\getmacargs#1{\def\argl{#1}}
  7632. % This made use of the feature that if the last token of a
  7633. % <parameter list> is #, then the preceding argument is delimited by
  7634. % an opening brace, and that opening brace is not consumed.
  7635. % Parse the optional {params} list to @macro or @rmacro.
  7636. % Set \paramno to the number of arguments,
  7637. % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
  7638. % three-param macro.) Define \macarg.BLAH for each BLAH in the params
  7639. % list to some hook where the argument is to be expanded. If there are
  7640. % less than 10 arguments that hook is to be replaced by ##N where N
  7641. % is the position in that list, that is to say the macro arguments are to be
  7642. % defined `a la TeX in the macro body.
  7643. %
  7644. % That gets used by \mbodybackslash (above).
  7645. %
  7646. % If there are 10 or more arguments, a different technique is used: see
  7647. % \parsemmanyargdef.
  7648. %
  7649. \def\parsemargdef#1;{%
  7650. \paramno=0\def\paramlist{}%
  7651. \let\hash\relax
  7652. % \hash is redefined to `#' later to get it into definitions
  7653. \let\xeatspaces\relax
  7654. \parsemargdefxxx#1,;,%
  7655. \ifnum\paramno<10\relax\else
  7656. \paramno0\relax
  7657. \parsemmanyargdef@@#1,;,% 10 or more arguments
  7658. \fi
  7659. }
  7660. \def\parsemargdefxxx#1,{%
  7661. \if#1;\let\next=\relax
  7662. \else \let\next=\parsemargdefxxx
  7663. \advance\paramno by 1
  7664. \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  7665. {\xeatspaces{\hash\the\paramno}}%
  7666. \edef\paramlist{\paramlist\hash\the\paramno,}%
  7667. \fi\next}
  7668. % \parsemacbody, \parsermacbody
  7669. %
  7670. % Read recursive and nonrecursive macro bodies. (They're different since
  7671. % rec and nonrec macros end differently.)
  7672. %
  7673. % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
  7674. % body to be transformed.
  7675. % Set \macrobody to the body of the macro, and call \defmacro.
  7676. %
  7677. {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
  7678. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7679. {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
  7680. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7681. % Make @ a letter, so that we can make private-to-Texinfo macro names.
  7682. \edef\texiatcatcode{\the\catcode`\@}
  7683. \catcode `@=11\relax
  7684. %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
  7685. % If there are 10 or more arguments, a different technique is used, where the
  7686. % hook remains in the body, and when macro is to be expanded the body is
  7687. % processed again to replace the arguments.
  7688. %
  7689. % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
  7690. % argument N value and then \edef the body (nothing else will expand because of
  7691. % the catcode regime under which the body was input).
  7692. %
  7693. % If you compile with TeX (not eTeX), and you have macros with 10 or more
  7694. % arguments, no macro can have more than 256 arguments (else error).
  7695. %
  7696. % In case that there are 10 or more arguments we parse again the arguments
  7697. % list to set new definitions for the \macarg.BLAH macros corresponding to
  7698. % each BLAH argument. It was anyhow needed to parse already once this list
  7699. % in order to count the arguments, and as macros with at most 9 arguments
  7700. % are by far more frequent than macro with 10 or more arguments, defining
  7701. % twice the \macarg.BLAH macros does not cost too much processing power.
  7702. \def\parsemmanyargdef@@#1,{%
  7703. \if#1;\let\next=\relax
  7704. \else
  7705. \let\next=\parsemmanyargdef@@
  7706. \edef\tempb{\eatspaces{#1}}%
  7707. \expandafter\def\expandafter\tempa
  7708. \expandafter{\csname macarg.\tempb\endcsname}%
  7709. % Note that we need some extra \noexpand\noexpand, this is because we
  7710. % don't want \the to be expanded in the \parsermacbody as it uses an
  7711. % \xdef .
  7712. \expandafter\edef\tempa
  7713. {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
  7714. \advance\paramno by 1\relax
  7715. \fi\next}
  7716. \let\endargs@\relax
  7717. \let\nil@\relax
  7718. \def\nilm@{\nil@}%
  7719. \long\def\nillm@{\nil@}%
  7720. % This macro is expanded during the Texinfo macro expansion, not during its
  7721. % definition. It gets all the arguments' values and assigns them to macros
  7722. % macarg.ARGNAME
  7723. %
  7724. % #1 is the macro name
  7725. % #2 is the list of argument names
  7726. % #3 is the list of argument values
  7727. \def\getargvals@#1#2#3{%
  7728. \def\macargdeflist@{}%
  7729. \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
  7730. \def\paramlist{#2,\nil@}%
  7731. \def\macroname{#1}%
  7732. \begingroup
  7733. \macroargctxt
  7734. \def\argvaluelist{#3,\nil@}%
  7735. \def\@tempa{#3}%
  7736. \ifx\@tempa\empty
  7737. \setemptyargvalues@
  7738. \else
  7739. \getargvals@@
  7740. \fi
  7741. }
  7742. \def\getargvals@@{%
  7743. \ifx\paramlist\nilm@
  7744. % Some sanity check needed here that \argvaluelist is also empty.
  7745. \ifx\argvaluelist\nillm@
  7746. \else
  7747. \errhelp = \EMsimple
  7748. \errmessage{Too many arguments in macro `\macroname'!}%
  7749. \fi
  7750. \let\next\macargexpandinbody@
  7751. \else
  7752. \ifx\argvaluelist\nillm@
  7753. % No more arguments values passed to macro. Set remaining named-arg
  7754. % macros to empty.
  7755. \let\next\setemptyargvalues@
  7756. \else
  7757. % pop current arg name into \@tempb
  7758. \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
  7759. \expandafter\@tempa\expandafter{\paramlist}%
  7760. % pop current argument value into \@tempc
  7761. \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
  7762. \expandafter\@tempa\expandafter{\argvaluelist}%
  7763. % Here \@tempb is the current arg name and \@tempc is the current arg value.
  7764. % First place the new argument macro definition into \@tempd
  7765. \expandafter\macname\expandafter{\@tempc}%
  7766. \expandafter\let\csname macarg.\@tempb\endcsname\relax
  7767. \expandafter\def\expandafter\@tempe\expandafter{%
  7768. \csname macarg.\@tempb\endcsname}%
  7769. \edef\@tempd{\long\def\@tempe{\the\macname}}%
  7770. \push@\@tempd\macargdeflist@
  7771. \let\next\getargvals@@
  7772. \fi
  7773. \fi
  7774. \next
  7775. }
  7776. \def\push@#1#2{%
  7777. \expandafter\expandafter\expandafter\def
  7778. \expandafter\expandafter\expandafter#2%
  7779. \expandafter\expandafter\expandafter{%
  7780. \expandafter#1#2}%
  7781. }
  7782. % Replace arguments by their values in the macro body, and place the result
  7783. % in macro \@tempa.
  7784. %
  7785. \def\macvalstoargs@{%
  7786. % To do this we use the property that token registers that are \the'ed
  7787. % within an \edef expand only once. So we are going to place all argument
  7788. % values into respective token registers.
  7789. %
  7790. % First we save the token context, and initialize argument numbering.
  7791. \begingroup
  7792. \paramno0\relax
  7793. % Then, for each argument number #N, we place the corresponding argument
  7794. % value into a new token list register \toks#N
  7795. \expandafter\putargsintokens@\saveparamlist@,;,%
  7796. % Then, we expand the body so that argument are replaced by their
  7797. % values. The trick for values not to be expanded themselves is that they
  7798. % are within tokens and that tokens expand only once in an \edef .
  7799. \edef\@tempc{\csname mac.\macroname .body\endcsname}%
  7800. % Now we restore the token stack pointer to free the token list registers
  7801. % which we have used, but we make sure that expanded body is saved after
  7802. % group.
  7803. \expandafter
  7804. \endgroup
  7805. \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
  7806. }
  7807. % Define the named-macro outside of this group and then close this group.
  7808. %
  7809. \def\macargexpandinbody@{%
  7810. \expandafter
  7811. \endgroup
  7812. \macargdeflist@
  7813. % First the replace in body the macro arguments by their values, the result
  7814. % is in \@tempa .
  7815. \macvalstoargs@
  7816. % Then we point at the \norecurse or \gobble (for recursive) macro value
  7817. % with \@tempb .
  7818. \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
  7819. % Depending on whether it is recursive or not, we need some tailing
  7820. % \egroup .
  7821. \ifx\@tempb\gobble
  7822. \let\@tempc\relax
  7823. \else
  7824. \let\@tempc\egroup
  7825. \fi
  7826. % And now we do the real job:
  7827. \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
  7828. \@tempd
  7829. }
  7830. \def\putargsintokens@#1,{%
  7831. \if#1;\let\next\relax
  7832. \else
  7833. \let\next\putargsintokens@
  7834. % First we allocate the new token list register, and give it a temporary
  7835. % alias \@tempb .
  7836. \toksdef\@tempb\the\paramno
  7837. % Then we place the argument value into that token list register.
  7838. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
  7839. \expandafter\@tempb\expandafter{\@tempa}%
  7840. \advance\paramno by 1\relax
  7841. \fi
  7842. \next
  7843. }
  7844. % Trailing missing arguments are set to empty.
  7845. %
  7846. \def\setemptyargvalues@{%
  7847. \ifx\paramlist\nilm@
  7848. \let\next\macargexpandinbody@
  7849. \else
  7850. \expandafter\setemptyargvaluesparser@\paramlist\endargs@
  7851. \let\next\setemptyargvalues@
  7852. \fi
  7853. \next
  7854. }
  7855. \def\setemptyargvaluesparser@#1,#2\endargs@{%
  7856. \expandafter\def\expandafter\@tempa\expandafter{%
  7857. \expandafter\def\csname macarg.#1\endcsname{}}%
  7858. \push@\@tempa\macargdeflist@
  7859. \def\paramlist{#2}%
  7860. }
  7861. % #1 is the element target macro
  7862. % #2 is the list macro
  7863. % #3,#4\endargs@ is the list value
  7864. \def\pop@#1#2#3,#4\endargs@{%
  7865. \def#1{#3}%
  7866. \def#2{#4}%
  7867. }
  7868. \long\def\longpop@#1#2#3,#4\endargs@{%
  7869. \long\def#1{#3}%
  7870. \long\def#2{#4}%
  7871. }
  7872. %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
  7873. % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
  7874. % \macrobody has the body of the macro in it, with placeholders for
  7875. % its parameters, looking like "\xeatspaces{\hash 1}".
  7876. % \paramno is the number of parameters
  7877. % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
  7878. % There are four cases: macros of zero, one, up to nine, and many arguments.
  7879. % \xdef is used so that macro definitions will survive the file
  7880. % they're defined in: @include reads the file inside a group.
  7881. %
  7882. \def\defmacro{%
  7883. \let\hash=##% convert placeholders to macro parameter chars
  7884. \ifnum\paramno=1
  7885. \def\xeatspaces##1{##1}%
  7886. % This removes the pair of braces around the argument. We don't
  7887. % use \eatspaces, because this can cause ends of lines to be lost
  7888. % when the argument to \eatspaces is read, leading to line-based
  7889. % commands like "@itemize" not being read correctly.
  7890. \else
  7891. \let\xeatspaces\relax % suppress expansion
  7892. \fi
  7893. \ifcase\paramno
  7894. % 0
  7895. \expandafter\xdef\csname\the\macname\endcsname{%
  7896. \bgroup
  7897. \noexpand\spaceisspace
  7898. \noexpand\endlineisspace
  7899. \noexpand\expandafter % skip any whitespace after the macro name.
  7900. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7901. \expandafter\xdef\csname\the\macname @@@\endcsname{%
  7902. \egroup
  7903. \noexpand\scanmacro{\macrobody}}%
  7904. \or % 1
  7905. \expandafter\xdef\csname\the\macname\endcsname{%
  7906. \bgroup
  7907. \noexpand\braceorline
  7908. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7909. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7910. \egroup
  7911. \noexpand\scanmacro{\macrobody}%
  7912. }%
  7913. \else % at most 9
  7914. \ifnum\paramno<10\relax
  7915. % @MACNAME sets the context for reading the macro argument
  7916. % @MACNAME@@ gets the argument, processes backslashes and appends a
  7917. % comma.
  7918. % @MACNAME@@@ removes braces surrounding the argument list.
  7919. % @MACNAME@@@@ scans the macro body with arguments substituted.
  7920. \expandafter\xdef\csname\the\macname\endcsname{%
  7921. \bgroup
  7922. \noexpand\expandafter % This \expandafter skip any spaces after the
  7923. \noexpand\macroargctxt % macro before we change the catcode of space.
  7924. \noexpand\expandafter
  7925. \expandafter\noexpand\csname\the\macname @@\endcsname}%
  7926. \expandafter\xdef\csname\the\macname @@\endcsname##1{%
  7927. \noexpand\passargtomacro
  7928. \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
  7929. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7930. \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
  7931. \expandafter\expandafter
  7932. \expandafter\xdef
  7933. \expandafter\expandafter
  7934. \csname\the\macname @@@@\endcsname\paramlist{%
  7935. \egroup\noexpand\scanmacro{\macrobody}}%
  7936. \else % 10 or more:
  7937. \expandafter\xdef\csname\the\macname\endcsname{%
  7938. \noexpand\getargvals@{\the\macname}{\argl}%
  7939. }%
  7940. \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
  7941. \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
  7942. \fi
  7943. \fi}
  7944. \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
  7945. \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  7946. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7947. %
  7948. {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
  7949. @catcode`@_=11 % private names
  7950. @catcode`@!=11 % used as argument separator
  7951. % \passargtomacro#1#2 -
  7952. % Call #1 with a list of tokens #2, with any doubled backslashes in #2
  7953. % compressed to one.
  7954. %
  7955. % This implementation works by expansion, and not execution (so we cannot use
  7956. % \def or similar). This reduces the risk of this failing in contexts where
  7957. % complete expansion is done with no execution (for example, in writing out to
  7958. % an auxiliary file for an index entry).
  7959. %
  7960. % State is kept in the input stream: the argument passed to
  7961. % @look_ahead, @gobble_and_check_finish and @add_segment is
  7962. %
  7963. % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
  7964. %
  7965. % where:
  7966. % THE_MACRO - name of the macro we want to call
  7967. % ARG_RESULT - argument list we build to pass to that macro
  7968. % PENDING_BS - either a backslash or nothing
  7969. % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
  7970. @gdef@passargtomacro#1#2{%
  7971. @add_segment #1!{}@relax#2\@_finish\%
  7972. }
  7973. @gdef@_finish{@_finishx} @global@let@_finishx@relax
  7974. % #1 - THE_MACRO ARG_RESULT
  7975. % #2 - PENDING_BS
  7976. % #3 - NEXT_TOKEN
  7977. % #4 used to look ahead
  7978. %
  7979. % If the next token is not a backslash, process the rest of the argument;
  7980. % otherwise, remove the next token.
  7981. @gdef@look_ahead#1!#2#3#4{%
  7982. @ifx#4\%
  7983. @expandafter@gobble_and_check_finish
  7984. @else
  7985. @expandafter@add_segment
  7986. @fi#1!{#2}#4#4%
  7987. }
  7988. % #1 - THE_MACRO ARG_RESULT
  7989. % #2 - PENDING_BS
  7990. % #3 - NEXT_TOKEN
  7991. % #4 should be a backslash, which is gobbled.
  7992. % #5 looks ahead
  7993. %
  7994. % Double backslash found. Add a single backslash, and look ahead.
  7995. @gdef@gobble_and_check_finish#1!#2#3#4#5{%
  7996. @add_segment#1\!{}#5#5%
  7997. }
  7998. @gdef@is_fi{@fi}
  7999. % #1 - THE_MACRO ARG_RESULT
  8000. % #2 - PENDING_BS
  8001. % #3 - NEXT_TOKEN
  8002. % #4 is input stream until next backslash
  8003. %
  8004. % Input stream is either at the start of the argument, or just after a
  8005. % backslash sequence, either a lone backslash, or a doubled backslash.
  8006. % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
  8007. % finish; otherwise, append to ARG_RESULT the segment of the argument up until
  8008. % the next backslash. PENDING_BACKSLASH contains a backslash to represent
  8009. % a backslash just before the start of the input stream that has not been
  8010. % added to ARG_RESULT.
  8011. @gdef@add_segment#1!#2#3#4\{%
  8012. @ifx#3@_finish
  8013. @call_the_macro#1!%
  8014. @else
  8015. % append the pending backslash to the result, followed by the next segment
  8016. @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
  8017. % this @fi is discarded by @look_ahead.
  8018. % we can't get rid of it with \expandafter because we don't know how
  8019. % long #4 is.
  8020. }
  8021. % #1 - THE_MACRO
  8022. % #2 - ARG_RESULT
  8023. % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
  8024. % conditional.
  8025. @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
  8026. }
  8027. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8028. % \braceorline MAC is used for a one-argument macro MAC. It checks
  8029. % whether the next non-whitespace character is a {. It sets the context
  8030. % for reading the argument (slightly different in the two cases). Then,
  8031. % to read the argument, in the whole-line case, it then calls the regular
  8032. % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
  8033. %
  8034. \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
  8035. \def\braceorlinexxx{%
  8036. \ifx\nchar\bgroup
  8037. \macroargctxt
  8038. \expandafter\passargtomacro
  8039. \else
  8040. \macrolineargctxt\expandafter\parsearg
  8041. \fi \macnamexxx}
  8042. % @alias.
  8043. % We need some trickery to remove the optional spaces around the equal
  8044. % sign. Make them active and then expand them all to nothing.
  8045. %
  8046. \def\alias{\parseargusing\obeyspaces\aliasxxx}
  8047. \def\aliasxxx #1{\aliasyyy#1\relax}
  8048. \def\aliasyyy #1=#2\relax{%
  8049. {%
  8050. \expandafter\let\obeyedspace=\empty
  8051. \addtomacrolist{#1}%
  8052. \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
  8053. }%
  8054. \next
  8055. }
  8056. \message{cross references,}
  8057. \newwrite\auxfile
  8058. \newif\ifhavexrefs % True if xref values are known.
  8059. \newif\ifwarnedxrefs % True if we warned once that they aren't known.
  8060. % @inforef is relatively simple.
  8061. \def\inforef #1{\inforefzzz #1,,,,**}
  8062. \def\inforefzzz #1,#2,#3,#4**{%
  8063. \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  8064. node \samp{\ignorespaces#1{}}}
  8065. % @node's only job in TeX is to define \lastnode, which is used in
  8066. % cross-references. The @node line might or might not have commas, and
  8067. % might or might not have spaces before the first comma, like:
  8068. % @node foo , bar , ...
  8069. % We don't want such trailing spaces in the node name.
  8070. %
  8071. \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
  8072. %
  8073. % also remove a trailing comma, in case of something like this:
  8074. % @node Help-Cross, , , Cross-refs
  8075. \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
  8076. \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
  8077. \let\nwnode=\node
  8078. \let\lastnode=\empty
  8079. % Write a cross-reference definition for the current node. #1 is the
  8080. % type (Ynumbered, Yappendix, Ynothing).
  8081. %
  8082. \def\donoderef#1{%
  8083. \ifx\lastnode\empty\else
  8084. \setref{\lastnode}{#1}%
  8085. \global\let\lastnode=\empty
  8086. \fi
  8087. }
  8088. % @anchor{NAME} -- define xref target at arbitrary point.
  8089. %
  8090. \newcount\savesfregister
  8091. %
  8092. \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
  8093. \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
  8094. \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
  8095. % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
  8096. % anchor), which consists of three parts:
  8097. % 1) NAME-title - the current sectioning name taken from \lastsection,
  8098. % or the anchor name.
  8099. % 2) NAME-snt - section number and type, passed as the SNT arg, or
  8100. % empty for anchors.
  8101. % 3) NAME-pg - the page number.
  8102. %
  8103. % This is called from \donoderef, \anchor, and \dofloat. In the case of
  8104. % floats, there is an additional part, which is not written here:
  8105. % 4) NAME-lof - the text as it should appear in a @listoffloats.
  8106. %
  8107. \def\setref#1#2{%
  8108. \pdfmkdest{#1}%
  8109. \iflinks
  8110. {%
  8111. \requireauxfile
  8112. \atdummies % preserve commands, but don't expand them
  8113. % match definition in \xrdef, \refx, \xrefX.
  8114. \def\value##1{##1}%
  8115. \edef\writexrdef##1##2{%
  8116. \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
  8117. ##1}{##2}}% these are parameters of \writexrdef
  8118. }%
  8119. \toks0 = \expandafter{\lastsection}%
  8120. \immediate \writexrdef{title}{\the\toks0 }%
  8121. \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
  8122. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
  8123. }%
  8124. \fi
  8125. }
  8126. % @xrefautosectiontitle on|off says whether @section(ing) names are used
  8127. % automatically in xrefs, if the third arg is not explicitly specified.
  8128. % This was provided as a "secret" @set xref-automatic-section-title
  8129. % variable, now it's official.
  8130. %
  8131. \parseargdef\xrefautomaticsectiontitle{%
  8132. \def\temp{#1}%
  8133. \ifx\temp\onword
  8134. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8135. = \empty
  8136. \else\ifx\temp\offword
  8137. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8138. = \relax
  8139. \else
  8140. \errhelp = \EMsimple
  8141. \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
  8142. must be on|off}%
  8143. \fi\fi
  8144. }
  8145. %
  8146. % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
  8147. % the node name, #2 the name of the Info cross-reference, #3 the printed
  8148. % node name, #4 the name of the Info file, #5 the name of the printed
  8149. % manual. All but the node name can be omitted.
  8150. %
  8151. \def\pxref{\putwordsee{} \xrefXX}
  8152. \def\xref{\putwordSee{} \xrefXX}
  8153. \def\ref{\xrefXX}
  8154. \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
  8155. \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
  8156. %
  8157. \newbox\toprefbox
  8158. \newbox\printedrefnamebox
  8159. \newbox\infofilenamebox
  8160. \newbox\printedmanualbox
  8161. %
  8162. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  8163. \unsepspaces
  8164. %
  8165. % Get args without leading/trailing spaces.
  8166. \def\printedrefname{\ignorespaces #3}%
  8167. \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
  8168. %
  8169. \def\infofilename{\ignorespaces #4}%
  8170. \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
  8171. %
  8172. \def\printedmanual{\ignorespaces #5}%
  8173. \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
  8174. %
  8175. % If the printed reference name (arg #3) was not explicitly given in
  8176. % the @xref, figure out what we want to use.
  8177. \ifdim \wd\printedrefnamebox = 0pt
  8178. % No printed node name was explicitly given.
  8179. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
  8180. % Not auto section-title: use node name inside the square brackets.
  8181. \def\printedrefname{\ignorespaces #1}%
  8182. \else
  8183. % Auto section-title: use chapter/section title inside
  8184. % the square brackets if we have it.
  8185. \ifdim \wd\printedmanualbox > 0pt
  8186. % It is in another manual, so we don't have it; use node name.
  8187. \def\printedrefname{\ignorespaces #1}%
  8188. \else
  8189. \ifhavexrefs
  8190. % We (should) know the real title if we have the xref values.
  8191. \def\printedrefname{\refx{#1-title}{}}%
  8192. \else
  8193. % Otherwise just copy the Info node name.
  8194. \def\printedrefname{\ignorespaces #1}%
  8195. \fi%
  8196. \fi
  8197. \fi
  8198. \fi
  8199. %
  8200. % Make link in pdf output.
  8201. \ifpdf
  8202. % For pdfTeX and LuaTeX
  8203. {\indexnofonts
  8204. \makevalueexpandable
  8205. \turnoffactive
  8206. % This expands tokens, so do it after making catcode changes, so _
  8207. % etc. don't get their TeX definitions. This ignores all spaces in
  8208. % #4, including (wrongly) those in the middle of the filename.
  8209. \getfilename{#4}%
  8210. %
  8211. % This (wrongly) does not take account of leading or trailing
  8212. % spaces in #1, which should be ignored.
  8213. \setpdfdestname{#1}%
  8214. %
  8215. \ifx\pdfdestname\empty
  8216. \def\pdfdestname{Top}% no empty targets
  8217. \fi
  8218. %
  8219. \leavevmode
  8220. \startlink attr{/Border [0 0 0]}%
  8221. \ifnum\filenamelength>0
  8222. goto file{\the\filename.pdf} name{\pdfdestname}%
  8223. \else
  8224. goto name{\pdfmkpgn{\pdfdestname}}%
  8225. \fi
  8226. }%
  8227. \setcolor{\linkcolor}%
  8228. \else
  8229. \ifx\XeTeXrevision\thisisundefined
  8230. \else
  8231. % For XeTeX
  8232. {\indexnofonts
  8233. \makevalueexpandable
  8234. \turnoffactive
  8235. % This expands tokens, so do it after making catcode changes, so _
  8236. % etc. don't get their TeX definitions. This ignores all spaces in
  8237. % #4, including (wrongly) those in the middle of the filename.
  8238. \getfilename{#4}%
  8239. %
  8240. % This (wrongly) does not take account of leading or trailing
  8241. % spaces in #1, which should be ignored.
  8242. \setpdfdestname{#1}%
  8243. %
  8244. \ifx\pdfdestname\empty
  8245. \def\pdfdestname{Top}% no empty targets
  8246. \fi
  8247. %
  8248. \leavevmode
  8249. \ifnum\filenamelength>0
  8250. % With default settings,
  8251. % XeTeX (xdvipdfmx) replaces link destination names with integers.
  8252. % In this case, the replaced destination names of
  8253. % remote PDFs are no longer known. In order to avoid a replacement,
  8254. % you can use xdvipdfmx's command line option `-C 0x0010'.
  8255. % If you use XeTeX 0.99996+ (TeX Live 2016+),
  8256. % this command line option is no longer necessary
  8257. % because we can use the `dvipdfmx:config' special.
  8258. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8259. << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
  8260. \else
  8261. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8262. << /S /GoTo /D (\pdfdestname) >> >>}%
  8263. \fi
  8264. }%
  8265. \setcolor{\linkcolor}%
  8266. \fi
  8267. \fi
  8268. {%
  8269. % Have to otherify everything special to allow the \csname to
  8270. % include an _ in the xref name, etc.
  8271. \indexnofonts
  8272. \turnoffactive
  8273. \def\value##1{##1}%
  8274. \expandafter\global\expandafter\let\expandafter\Xthisreftitle
  8275. \csname XR#1-title\endcsname
  8276. }%
  8277. %
  8278. % Float references are printed completely differently: "Figure 1.2"
  8279. % instead of "[somenode], p.3". \iffloat distinguishes them by
  8280. % \Xthisreftitle being set to a magic string.
  8281. \iffloat\Xthisreftitle
  8282. % If the user specified the print name (third arg) to the ref,
  8283. % print it instead of our usual "Figure 1.2".
  8284. \ifdim\wd\printedrefnamebox = 0pt
  8285. \refx{#1-snt}{}%
  8286. \else
  8287. \printedrefname
  8288. \fi
  8289. %
  8290. % If the user also gave the printed manual name (fifth arg), append
  8291. % "in MANUALNAME".
  8292. \ifdim \wd\printedmanualbox > 0pt
  8293. \space \putwordin{} \cite{\printedmanual}%
  8294. \fi
  8295. \else
  8296. % node/anchor (non-float) references.
  8297. %
  8298. % If we use \unhbox to print the node names, TeX does not insert
  8299. % empty discretionaries after hyphens, which means that it will not
  8300. % find a line break at a hyphen in a node names. Since some manuals
  8301. % are best written with fairly long node names, containing hyphens,
  8302. % this is a loss. Therefore, we give the text of the node name
  8303. % again, so it is as if TeX is seeing it for the first time.
  8304. %
  8305. \ifdim \wd\printedmanualbox > 0pt
  8306. % Cross-manual reference with a printed manual name.
  8307. %
  8308. \crossmanualxref{\cite{\printedmanual\unskip}}%
  8309. %
  8310. \else\ifdim \wd\infofilenamebox > 0pt
  8311. % Cross-manual reference with only an info filename (arg 4), no
  8312. % printed manual name (arg 5). This is essentially the same as
  8313. % the case above; we output the filename, since we have nothing else.
  8314. %
  8315. \crossmanualxref{\code{\infofilename\unskip}}%
  8316. %
  8317. \else
  8318. % Reference within this manual.
  8319. %
  8320. % _ (for example) has to be the character _ for the purposes of the
  8321. % control sequence corresponding to the node, but it has to expand
  8322. % into the usual \leavevmode...\vrule stuff for purposes of
  8323. % printing. So we \turnoffactive for the \refx-snt, back on for the
  8324. % printing, back off for the \refx-pg.
  8325. {\turnoffactive
  8326. % Only output a following space if the -snt ref is nonempty; for
  8327. % @unnumbered and @anchor, it won't be.
  8328. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  8329. \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  8330. }%
  8331. % output the `[mynode]' via the macro below so it can be overridden.
  8332. \xrefprintnodename\printedrefname
  8333. %
  8334. % But we always want a comma and a space:
  8335. ,\space
  8336. %
  8337. % output the `page 3'.
  8338. \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
  8339. % Add a , if xref followed by a space
  8340. \if\space\noexpand\tokenafterxref ,%
  8341. \else\ifx\ \tokenafterxref ,% @TAB
  8342. \else\ifx\*\tokenafterxref ,% @*
  8343. \else\ifx\ \tokenafterxref ,% @SPACE
  8344. \else\ifx\
  8345. \tokenafterxref ,% @NL
  8346. \else\ifx\tie\tokenafterxref ,% @tie
  8347. \fi\fi\fi\fi\fi\fi
  8348. \fi\fi
  8349. \fi
  8350. \endlink
  8351. \endgroup}
  8352. % Output a cross-manual xref to #1. Used just above (twice).
  8353. %
  8354. % Only include the text "Section ``foo'' in" if the foo is neither
  8355. % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
  8356. % "see The Foo Manual", the idea being to refer to the whole manual.
  8357. %
  8358. % But, this being TeX, we can't easily compare our node name against the
  8359. % string "Top" while ignoring the possible spaces before and after in
  8360. % the input. By adding the arbitrary 7sp below, we make it much less
  8361. % likely that a real node name would have the same width as "Top" (e.g.,
  8362. % in a monospaced font). Hopefully it will never happen in practice.
  8363. %
  8364. % For the same basic reason, we retypeset the "Top" at every
  8365. % reference, since the current font is indeterminate.
  8366. %
  8367. \def\crossmanualxref#1{%
  8368. \setbox\toprefbox = \hbox{Top\kern7sp}%
  8369. \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
  8370. \ifdim \wd2 > 7sp % nonempty?
  8371. \ifdim \wd2 = \wd\toprefbox \else % same as Top?
  8372. \putwordSection{} ``\printedrefname'' \putwordin{}\space
  8373. \fi
  8374. \fi
  8375. #1%
  8376. }
  8377. % This macro is called from \xrefX for the `[nodename]' part of xref
  8378. % output. It's a separate macro only so it can be changed more easily,
  8379. % since square brackets don't work well in some documents. Particularly
  8380. % one that Bob is working on :).
  8381. %
  8382. \def\xrefprintnodename#1{[#1]}
  8383. % Things referred to by \setref.
  8384. %
  8385. \def\Ynothing{}
  8386. \def\Yomitfromtoc{}
  8387. \def\Ynumbered{%
  8388. \ifnum\secno=0
  8389. \putwordChapter@tie \the\chapno
  8390. \else \ifnum\subsecno=0
  8391. \putwordSection@tie \the\chapno.\the\secno
  8392. \else \ifnum\subsubsecno=0
  8393. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  8394. \else
  8395. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  8396. \fi\fi\fi
  8397. }
  8398. \def\Yappendix{%
  8399. \ifnum\secno=0
  8400. \putwordAppendix@tie @char\the\appendixno{}%
  8401. \else \ifnum\subsecno=0
  8402. \putwordSection@tie @char\the\appendixno.\the\secno
  8403. \else \ifnum\subsubsecno=0
  8404. \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  8405. \else
  8406. \putwordSection@tie
  8407. @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  8408. \fi\fi\fi
  8409. }
  8410. % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
  8411. % is output afterwards if non-empty.
  8412. \def\refx#1#2{%
  8413. \requireauxfile
  8414. {%
  8415. \indexnofonts
  8416. \otherbackslash
  8417. \def\value##1{##1}%
  8418. \expandafter\global\expandafter\let\expandafter\thisrefX
  8419. \csname XR#1\endcsname
  8420. }%
  8421. \ifx\thisrefX\relax
  8422. % If not defined, say something at least.
  8423. \angleleft un\-de\-fined\angleright
  8424. \iflinks
  8425. \ifhavexrefs
  8426. {\toks0 = {#1}% avoid expansion of possibly-complex value
  8427. \message{\linenumber Undefined cross reference `\the\toks0'.}}%
  8428. \else
  8429. \ifwarnedxrefs\else
  8430. \global\warnedxrefstrue
  8431. \message{Cross reference values unknown; you must run TeX again.}%
  8432. \fi
  8433. \fi
  8434. \fi
  8435. \else
  8436. % It's defined, so just use it.
  8437. \thisrefX
  8438. \fi
  8439. #2% Output the suffix in any case.
  8440. }
  8441. % This is the macro invoked by entries in the aux file. Define a control
  8442. % sequence for a cross-reference target (we prepend XR to the control sequence
  8443. % name to avoid collisions). The value is the page number. If this is a float
  8444. % type, we have more work to do.
  8445. %
  8446. \def\xrdef#1#2{%
  8447. {% Expand the node or anchor name to remove control sequences.
  8448. % \turnoffactive stops 8-bit characters being changed to commands
  8449. % like @'e. \refx does the same to retrieve the value in the definition.
  8450. \indexnofonts
  8451. \turnoffactive
  8452. \def\value##1{##1}%
  8453. \xdef\safexrefname{#1}%
  8454. }%
  8455. %
  8456. \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
  8457. %
  8458. % Was that xref control sequence that we just defined for a float?
  8459. \expandafter\iffloat\csname XR\safexrefname\endcsname
  8460. % it was a float, and we have the (safe) float type in \iffloattype.
  8461. \expandafter\let\expandafter\floatlist
  8462. \csname floatlist\iffloattype\endcsname
  8463. %
  8464. % Is this the first time we've seen this float type?
  8465. \expandafter\ifx\floatlist\relax
  8466. \toks0 = {\do}% yes, so just \do
  8467. \else
  8468. % had it before, so preserve previous elements in list.
  8469. \toks0 = \expandafter{\floatlist\do}%
  8470. \fi
  8471. %
  8472. % Remember this xref in the control sequence \floatlistFLOATTYPE,
  8473. % for later use in \listoffloats.
  8474. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
  8475. {\safexrefname}}%
  8476. \fi
  8477. }
  8478. % If working on a large document in chapters, it is convenient to
  8479. % be able to disable indexing, cross-referencing, and contents, for test runs.
  8480. % This is done with @novalidate at the beginning of the file.
  8481. %
  8482. \newif\iflinks \linkstrue % by default we want the aux files.
  8483. \let\novalidate = \linksfalse
  8484. % Used when writing to the aux file, or when using data from it.
  8485. \def\requireauxfile{%
  8486. \iflinks
  8487. \tryauxfile
  8488. % Open the new aux file. TeX will close it automatically at exit.
  8489. \immediate\openout\auxfile=\jobname.aux
  8490. \fi
  8491. \global\let\requireauxfile=\relax % Only do this once.
  8492. }
  8493. % Read the last existing aux file, if any. No error if none exists.
  8494. %
  8495. \def\tryauxfile{%
  8496. \openin 1 \jobname.aux
  8497. \ifeof 1 \else
  8498. \readdatafile{aux}%
  8499. \global\havexrefstrue
  8500. \fi
  8501. \closein 1
  8502. }
  8503. \def\setupdatafile{%
  8504. \catcode`\^^@=\other
  8505. \catcode`\^^A=\other
  8506. \catcode`\^^B=\other
  8507. \catcode`\^^C=\other
  8508. \catcode`\^^D=\other
  8509. \catcode`\^^E=\other
  8510. \catcode`\^^F=\other
  8511. \catcode`\^^G=\other
  8512. \catcode`\^^H=\other
  8513. \catcode`\^^K=\other
  8514. \catcode`\^^L=\other
  8515. \catcode`\^^N=\other
  8516. \catcode`\^^P=\other
  8517. \catcode`\^^Q=\other
  8518. \catcode`\^^R=\other
  8519. \catcode`\^^S=\other
  8520. \catcode`\^^T=\other
  8521. \catcode`\^^U=\other
  8522. \catcode`\^^V=\other
  8523. \catcode`\^^W=\other
  8524. \catcode`\^^X=\other
  8525. \catcode`\^^Z=\other
  8526. \catcode`\^^[=\other
  8527. \catcode`\^^\=\other
  8528. \catcode`\^^]=\other
  8529. \catcode`\^^^=\other
  8530. \catcode`\^^_=\other
  8531. % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  8532. % in xref tags, i.e., node names. But since ^^e4 notation isn't
  8533. % supported in the main text, it doesn't seem desirable. Furthermore,
  8534. % that is not enough: for node names that actually contain a ^
  8535. % character, we would end up writing a line like this: 'xrdef {'hat
  8536. % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  8537. % argument, and \hat is not an expandable control sequence. It could
  8538. % all be worked out, but why? Either we support ^^ or we don't.
  8539. %
  8540. % The other change necessary for this was to define \auxhat:
  8541. % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  8542. % and then to call \auxhat in \setq.
  8543. %
  8544. \catcode`\^=\other
  8545. %
  8546. % Special characters. Should be turned off anyway, but...
  8547. \catcode`\~=\other
  8548. \catcode`\[=\other
  8549. \catcode`\]=\other
  8550. \catcode`\"=\other
  8551. \catcode`\_=\other
  8552. \catcode`\|=\other
  8553. \catcode`\<=\other
  8554. \catcode`\>=\other
  8555. \catcode`\$=\other
  8556. \catcode`\#=\other
  8557. \catcode`\&=\other
  8558. \catcode`\%=\other
  8559. \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  8560. %
  8561. % This is to support \ in node names and titles, since the \
  8562. % characters end up in a \csname. It's easier than
  8563. % leaving it active and making its active definition an actual \
  8564. % character. What I don't understand is why it works in the *value*
  8565. % of the xrdef. Seems like it should be a catcode12 \, and that
  8566. % should not typeset properly. But it works, so I'm moving on for
  8567. % now. --karl, 15jan04.
  8568. \catcode`\\=\other
  8569. %
  8570. % @ is our escape character in .aux files, and we need braces.
  8571. \catcode`\{=1
  8572. \catcode`\}=2
  8573. \catcode`\@=0
  8574. }
  8575. \def\readdatafile#1{%
  8576. \begingroup
  8577. \setupdatafile
  8578. \input\jobname.#1
  8579. \endgroup}
  8580. \message{insertions,}
  8581. % including footnotes.
  8582. \newcount \footnoteno
  8583. % The trailing space in the following definition for supereject is
  8584. % vital for proper filling; pages come out unaligned when you do a
  8585. % pagealignmacro call if that space before the closing brace is
  8586. % removed. (Generally, numeric constants should always be followed by a
  8587. % space to prevent strange expansion errors.)
  8588. \def\supereject{\par\penalty -20000\footnoteno =0 }
  8589. % @footnotestyle is meaningful for Info output only.
  8590. \let\footnotestyle=\comment
  8591. {\catcode `\@=11
  8592. %
  8593. % Auto-number footnotes. Otherwise like plain.
  8594. \gdef\footnote{%
  8595. \global\advance\footnoteno by \@ne
  8596. \edef\thisfootno{$^{\the\footnoteno}$}%
  8597. %
  8598. % In case the footnote comes at the end of a sentence, preserve the
  8599. % extra spacing after we do the footnote number.
  8600. \let\@sf\empty
  8601. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
  8602. %
  8603. % Remove inadvertent blank space before typesetting the footnote number.
  8604. \unskip
  8605. \thisfootno\@sf
  8606. \dofootnote
  8607. }%
  8608. % Don't bother with the trickery in plain.tex to not require the
  8609. % footnote text as a parameter. Our footnotes don't need to be so general.
  8610. %
  8611. % Oh yes, they do; otherwise, @ifset (and anything else that uses
  8612. % \parseargline) fails inside footnotes because the tokens are fixed when
  8613. % the footnote is read. --karl, 16nov96.
  8614. %
  8615. \gdef\dofootnote{%
  8616. \insert\footins\bgroup
  8617. %
  8618. % Nested footnotes are not supported in TeX, that would take a lot
  8619. % more work. (\startsavinginserts does not suffice.)
  8620. \let\footnote=\errfootnotenest
  8621. %
  8622. % We want to typeset this text as a normal paragraph, even if the
  8623. % footnote reference occurs in (for example) a display environment.
  8624. % So reset some parameters.
  8625. \hsize=\txipagewidth
  8626. \interlinepenalty\interfootnotelinepenalty
  8627. \splittopskip\ht\strutbox % top baseline for broken footnotes
  8628. \splitmaxdepth\dp\strutbox
  8629. \floatingpenalty\@MM
  8630. \leftskip\z@skip
  8631. \rightskip\z@skip
  8632. \spaceskip\z@skip
  8633. \xspaceskip\z@skip
  8634. \parindent\defaultparindent
  8635. %
  8636. \smallfonts \rm
  8637. %
  8638. % Because we use hanging indentation in footnotes, a @noindent appears
  8639. % to exdent this text, so make it be a no-op. makeinfo does not use
  8640. % hanging indentation so @noindent can still be needed within footnote
  8641. % text after an @example or the like (not that this is good style).
  8642. \let\noindent = \relax
  8643. %
  8644. % Hang the footnote text off the number. Use \everypar in case the
  8645. % footnote extends for more than one paragraph.
  8646. \everypar = {\hang}%
  8647. \textindent{\thisfootno}%
  8648. %
  8649. % Don't crash into the line above the footnote text. Since this
  8650. % expands into a box, it must come within the paragraph, lest it
  8651. % provide a place where TeX can split the footnote.
  8652. \footstrut
  8653. %
  8654. % Invoke rest of plain TeX footnote routine.
  8655. \futurelet\next\fo@t
  8656. }
  8657. }%end \catcode `\@=11
  8658. \def\errfootnotenest{%
  8659. \errhelp=\EMsimple
  8660. \errmessage{Nested footnotes not supported in texinfo.tex,
  8661. even though they work in makeinfo; sorry}
  8662. }
  8663. \def\errfootnoteheading{%
  8664. \errhelp=\EMsimple
  8665. \errmessage{Footnotes in chapters, sections, etc., are not supported}
  8666. }
  8667. % In case a @footnote appears in a vbox, save the footnote text and create
  8668. % the real \insert just after the vbox finished. Otherwise, the insertion
  8669. % would be lost.
  8670. % Similarly, if a @footnote appears inside an alignment, save the footnote
  8671. % text to a box and make the \insert when a row of the table is finished.
  8672. % And the same can be done for other insert classes. --kasal, 16nov03.
  8673. %
  8674. % Replace the \insert primitive by a cheating macro.
  8675. % Deeper inside, just make sure that the saved insertions are not spilled
  8676. % out prematurely.
  8677. %
  8678. \def\startsavinginserts{%
  8679. \ifx \insert\ptexinsert
  8680. \let\insert\saveinsert
  8681. \else
  8682. \let\checkinserts\relax
  8683. \fi
  8684. }
  8685. % This \insert replacement works for both \insert\footins{foo} and
  8686. % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
  8687. %
  8688. \def\saveinsert#1{%
  8689. \edef\next{\noexpand\savetobox \makeSAVEname#1}%
  8690. \afterassignment\next
  8691. % swallow the left brace
  8692. \let\temp =
  8693. }
  8694. \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
  8695. \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
  8696. \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
  8697. \def\placesaveins#1{%
  8698. \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
  8699. {\box#1}%
  8700. }
  8701. % eat @SAVE -- beware, all of them have catcode \other:
  8702. {
  8703. \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
  8704. \gdef\gobblesave @SAVE{}
  8705. }
  8706. % initialization:
  8707. \def\newsaveins #1{%
  8708. \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
  8709. \next
  8710. }
  8711. \def\newsaveinsX #1{%
  8712. \csname newbox\endcsname #1%
  8713. \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
  8714. \checksaveins #1}%
  8715. }
  8716. % initialize:
  8717. \let\checkinserts\empty
  8718. \newsaveins\footins
  8719. \newsaveins\margin
  8720. % @image. We use the macros from epsf.tex to support this.
  8721. % If epsf.tex is not installed and @image is used, we complain.
  8722. %
  8723. % Check for and read epsf.tex up front. If we read it only at @image
  8724. % time, we might be inside a group, and then its definitions would get
  8725. % undone and the next image would fail.
  8726. \openin 1 = epsf.tex
  8727. \ifeof 1 \else
  8728. % Do not bother showing banner with epsf.tex v2.7k (available in
  8729. % doc/epsf.tex and on ctan).
  8730. \def\epsfannounce{\toks0 = }%
  8731. \input epsf.tex
  8732. \fi
  8733. \closein 1
  8734. %
  8735. % We will only complain once about lack of epsf.tex.
  8736. \newif\ifwarnednoepsf
  8737. \newhelp\noepsfhelp{epsf.tex must be installed for images to
  8738. work. It is also included in the Texinfo distribution, or you can get
  8739. it from ftp://tug.org/tex/epsf.tex.}
  8740. %
  8741. \def\image#1{%
  8742. \ifx\epsfbox\thisisundefined
  8743. \ifwarnednoepsf \else
  8744. \errhelp = \noepsfhelp
  8745. \errmessage{epsf.tex not found, images will be ignored}%
  8746. \global\warnednoepsftrue
  8747. \fi
  8748. \else
  8749. \imagexxx #1,,,,,\finish
  8750. \fi
  8751. }
  8752. %
  8753. % Arguments to @image:
  8754. % #1 is (mandatory) image filename; we tack on .eps extension.
  8755. % #2 is (optional) width, #3 is (optional) height.
  8756. % #4 is (ignored optional) html alt text.
  8757. % #5 is (ignored optional) extension.
  8758. % #6 is just the usual extra ignored arg for parsing stuff.
  8759. \newif\ifimagevmode
  8760. \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  8761. \catcode`\^^M = 5 % in case we're inside an example
  8762. \normalturnoffactive % allow _ et al. in names
  8763. \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
  8764. % If the image is by itself, center it.
  8765. \ifvmode
  8766. \imagevmodetrue
  8767. \else \ifx\centersub\centerV
  8768. % for @center @image, we need a vbox so we can have our vertical space
  8769. \imagevmodetrue
  8770. \vbox\bgroup % vbox has better behavior than vtop herev
  8771. \fi\fi
  8772. %
  8773. \ifimagevmode
  8774. \nobreak\medskip
  8775. % Usually we'll have text after the image which will insert
  8776. % \parskip glue, so insert it here too to equalize the space
  8777. % above and below.
  8778. \nobreak\vskip\parskip
  8779. \nobreak
  8780. \fi
  8781. %
  8782. % Leave vertical mode so that indentation from an enclosing
  8783. % environment such as @quotation is respected.
  8784. % However, if we're at the top level, we don't want the
  8785. % normal paragraph indentation.
  8786. % On the other hand, if we are in the case of @center @image, we don't
  8787. % want to start a paragraph, which will create a hsize-width box and
  8788. % eradicate the centering.
  8789. \ifx\centersub\centerV\else \noindent \fi
  8790. %
  8791. % Output the image.
  8792. \ifpdf
  8793. % For pdfTeX and LuaTeX <= 0.80
  8794. \dopdfimage{#1}{#2}{#3}%
  8795. \else
  8796. \ifx\XeTeXrevision\thisisundefined
  8797. % For epsf.tex
  8798. % \epsfbox itself resets \epsf?size at each figure.
  8799. \setbox0 = \hbox{\ignorespaces #2}%
  8800. \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  8801. \setbox0 = \hbox{\ignorespaces #3}%
  8802. \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  8803. \epsfbox{#1.eps}%
  8804. \else
  8805. % For XeTeX
  8806. \doxeteximage{#1}{#2}{#3}%
  8807. \fi
  8808. \fi
  8809. %
  8810. \ifimagevmode
  8811. \medskip % space after a standalone image
  8812. \fi
  8813. \ifx\centersub\centerV \egroup \fi
  8814. \endgroup}
  8815. % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
  8816. % etc. We don't actually implement floating yet, we always include the
  8817. % float "here". But it seemed the best name for the future.
  8818. %
  8819. \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
  8820. % There may be a space before second and/or third parameter; delete it.
  8821. \def\eatcommaspace#1, {#1,}
  8822. % #1 is the optional FLOATTYPE, the text label for this float, typically
  8823. % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
  8824. % this float will not be numbered and cannot be referred to.
  8825. %
  8826. % #2 is the optional xref label. Also must be present for the float to
  8827. % be referable.
  8828. %
  8829. % #3 is the optional positioning argument; for now, it is ignored. It
  8830. % will somehow specify the positions allowed to float to (here, top, bottom).
  8831. %
  8832. % We keep a separate counter for each FLOATTYPE, which we reset at each
  8833. % chapter-level command.
  8834. \let\resetallfloatnos=\empty
  8835. %
  8836. \def\dofloat#1,#2,#3,#4\finish{%
  8837. \let\thiscaption=\empty
  8838. \let\thisshortcaption=\empty
  8839. %
  8840. % don't lose footnotes inside @float.
  8841. %
  8842. % BEWARE: when the floats start float, we have to issue warning whenever an
  8843. % insert appears inside a float which could possibly float. --kasal, 26may04
  8844. %
  8845. \startsavinginserts
  8846. %
  8847. % We can't be used inside a paragraph.
  8848. \par
  8849. %
  8850. \vtop\bgroup
  8851. \def\floattype{#1}%
  8852. \def\floatlabel{#2}%
  8853. \def\floatloc{#3}% we do nothing with this yet.
  8854. %
  8855. \ifx\floattype\empty
  8856. \let\safefloattype=\empty
  8857. \else
  8858. {%
  8859. % the floattype might have accents or other special characters,
  8860. % but we need to use it in a control sequence name.
  8861. \indexnofonts
  8862. \turnoffactive
  8863. \xdef\safefloattype{\floattype}%
  8864. }%
  8865. \fi
  8866. %
  8867. % If label is given but no type, we handle that as the empty type.
  8868. \ifx\floatlabel\empty \else
  8869. % We want each FLOATTYPE to be numbered separately (Figure 1,
  8870. % Table 1, Figure 2, ...). (And if no label, no number.)
  8871. %
  8872. \expandafter\getfloatno\csname\safefloattype floatno\endcsname
  8873. \global\advance\floatno by 1
  8874. %
  8875. {%
  8876. % This magic value for \lastsection is output by \setref as the
  8877. % XREFLABEL-title value. \xrefX uses it to distinguish float
  8878. % labels (which have a completely different output format) from
  8879. % node and anchor labels. And \xrdef uses it to construct the
  8880. % lists of floats.
  8881. %
  8882. \edef\lastsection{\floatmagic=\safefloattype}%
  8883. \setref{\floatlabel}{Yfloat}%
  8884. }%
  8885. \fi
  8886. %
  8887. % start with \parskip glue, I guess.
  8888. \vskip\parskip
  8889. %
  8890. % Don't suppress indentation if a float happens to start a section.
  8891. \restorefirstparagraphindent
  8892. }
  8893. % we have these possibilities:
  8894. % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
  8895. % @float Foo,lbl & no caption: Foo 1.1
  8896. % @float Foo & @caption{Cap}: Foo: Cap
  8897. % @float Foo & no caption: Foo
  8898. % @float ,lbl & Caption{Cap}: 1.1: Cap
  8899. % @float ,lbl & no caption: 1.1
  8900. % @float & @caption{Cap}: Cap
  8901. % @float & no caption:
  8902. %
  8903. \def\Efloat{%
  8904. \let\floatident = \empty
  8905. %
  8906. % In all cases, if we have a float type, it comes first.
  8907. \ifx\floattype\empty \else \def\floatident{\floattype}\fi
  8908. %
  8909. % If we have an xref label, the number comes next.
  8910. \ifx\floatlabel\empty \else
  8911. \ifx\floattype\empty \else % if also had float type, need tie first.
  8912. \appendtomacro\floatident{\tie}%
  8913. \fi
  8914. % the number.
  8915. \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
  8916. \fi
  8917. %
  8918. % Start the printed caption with what we've constructed in
  8919. % \floatident, but keep it separate; we need \floatident again.
  8920. \let\captionline = \floatident
  8921. %
  8922. \ifx\thiscaption\empty \else
  8923. \ifx\floatident\empty \else
  8924. \appendtomacro\captionline{: }% had ident, so need a colon between
  8925. \fi
  8926. %
  8927. % caption text.
  8928. \appendtomacro\captionline{\scanexp\thiscaption}%
  8929. \fi
  8930. %
  8931. % If we have anything to print, print it, with space before.
  8932. % Eventually this needs to become an \insert.
  8933. \ifx\captionline\empty \else
  8934. \vskip.5\parskip
  8935. \captionline
  8936. %
  8937. % Space below caption.
  8938. \vskip\parskip
  8939. \fi
  8940. %
  8941. % If have an xref label, write the list of floats info. Do this
  8942. % after the caption, to avoid chance of it being a breakpoint.
  8943. \ifx\floatlabel\empty \else
  8944. % Write the text that goes in the lof to the aux file as
  8945. % \floatlabel-lof. Besides \floatident, we include the short
  8946. % caption if specified, else the full caption if specified, else nothing.
  8947. {%
  8948. \requireauxfile
  8949. \atdummies
  8950. %
  8951. \ifx\thisshortcaption\empty
  8952. \def\gtemp{\thiscaption}%
  8953. \else
  8954. \def\gtemp{\thisshortcaption}%
  8955. \fi
  8956. \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
  8957. \ifx\gtemp\empty \else : \gtemp \fi}}%
  8958. }%
  8959. \fi
  8960. \egroup % end of \vtop
  8961. %
  8962. \checkinserts
  8963. }
  8964. % Append the tokens #2 to the definition of macro #1, not expanding either.
  8965. %
  8966. \def\appendtomacro#1#2{%
  8967. \expandafter\def\expandafter#1\expandafter{#1#2}%
  8968. }
  8969. % @caption, @shortcaption
  8970. %
  8971. \def\caption{\docaption\thiscaption}
  8972. \def\shortcaption{\docaption\thisshortcaption}
  8973. \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
  8974. \def\defcaption#1#2{\egroup \def#1{#2}}
  8975. % The parameter is the control sequence identifying the counter we are
  8976. % going to use. Create it if it doesn't exist and assign it to \floatno.
  8977. \def\getfloatno#1{%
  8978. \ifx#1\relax
  8979. % Haven't seen this figure type before.
  8980. \csname newcount\endcsname #1%
  8981. %
  8982. % Remember to reset this floatno at the next chap.
  8983. \expandafter\gdef\expandafter\resetallfloatnos
  8984. \expandafter{\resetallfloatnos #1=0 }%
  8985. \fi
  8986. \let\floatno#1%
  8987. }
  8988. % \setref calls this to get the XREFLABEL-snt value. We want an @xref
  8989. % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
  8990. % first read the @float command.
  8991. %
  8992. \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
  8993. % Magic string used for the XREFLABEL-title value, so \xrefX can
  8994. % distinguish floats from other xref types.
  8995. \def\floatmagic{!!float!!}
  8996. % #1 is the control sequence we are passed; we expand into a conditional
  8997. % which is true if #1 represents a float ref. That is, the magic
  8998. % \lastsection value which we \setref above.
  8999. %
  9000. \def\iffloat#1{\expandafter\doiffloat#1==\finish}
  9001. %
  9002. % #1 is (maybe) the \floatmagic string. If so, #2 will be the
  9003. % (safe) float type for this float. We set \iffloattype to #2.
  9004. %
  9005. \def\doiffloat#1=#2=#3\finish{%
  9006. \def\temp{#1}%
  9007. \def\iffloattype{#2}%
  9008. \ifx\temp\floatmagic
  9009. }
  9010. % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
  9011. %
  9012. \parseargdef\listoffloats{%
  9013. \def\floattype{#1}% floattype
  9014. {%
  9015. % the floattype might have accents or other special characters,
  9016. % but we need to use it in a control sequence name.
  9017. \indexnofonts
  9018. \turnoffactive
  9019. \xdef\safefloattype{\floattype}%
  9020. }%
  9021. %
  9022. % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
  9023. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
  9024. \ifhavexrefs
  9025. % if the user said @listoffloats foo but never @float foo.
  9026. \message{\linenumber No `\safefloattype' floats to list.}%
  9027. \fi
  9028. \else
  9029. \begingroup
  9030. \leftskip=\tocindent % indent these entries like a toc
  9031. \let\do=\listoffloatsdo
  9032. \csname floatlist\safefloattype\endcsname
  9033. \endgroup
  9034. \fi
  9035. }
  9036. % This is called on each entry in a list of floats. We're passed the
  9037. % xref label, in the form LABEL-title, which is how we save it in the
  9038. % aux file. We strip off the -title and look up \XRLABEL-lof, which
  9039. % has the text we're supposed to typeset here.
  9040. %
  9041. % Figures without xref labels will not be included in the list (since
  9042. % they won't appear in the aux file).
  9043. %
  9044. \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
  9045. \def\listoffloatsdoentry#1-title\finish{{%
  9046. % Can't fully expand XR#1-lof because it can contain anything. Just
  9047. % pass the control sequence. On the other hand, XR#1-pg is just the
  9048. % page number, and we want to fully expand that so we can get a link
  9049. % in pdf output.
  9050. \toksA = \expandafter{\csname XR#1-lof\endcsname}%
  9051. %
  9052. % use the same \entry macro we use to generate the TOC and index.
  9053. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
  9054. \writeentry
  9055. }}
  9056. \message{localization,}
  9057. % For single-language documents, @documentlanguage is usually given very
  9058. % early, just after @documentencoding. Single argument is the language
  9059. % (de) or locale (de_DE) abbreviation.
  9060. %
  9061. {
  9062. \catcode`\_ = \active
  9063. \globaldefs=1
  9064. \parseargdef\documentlanguage{%
  9065. \tex % read txi-??.tex file in plain TeX.
  9066. % Read the file by the name they passed if it exists.
  9067. \let_ = \normalunderscore % normal _ character for filename test
  9068. \openin 1 txi-#1.tex
  9069. \ifeof 1
  9070. \documentlanguagetrywithoutunderscore #1_\finish
  9071. \else
  9072. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9073. \input txi-#1.tex
  9074. \fi
  9075. \closein 1
  9076. \endgroup % end raw TeX
  9077. }
  9078. %
  9079. % If they passed de_DE, and txi-de_DE.tex doesn't exist,
  9080. % try txi-de.tex.
  9081. %
  9082. \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
  9083. \openin 1 txi-#1.tex
  9084. \ifeof 1
  9085. \errhelp = \nolanghelp
  9086. \errmessage{Cannot read language file txi-#1.tex}%
  9087. \else
  9088. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9089. \input txi-#1.tex
  9090. \fi
  9091. \closein 1
  9092. }
  9093. }% end of special _ catcode
  9094. %
  9095. \newhelp\nolanghelp{The given language definition file cannot be found or
  9096. is empty. Maybe you need to install it? Putting it in the current
  9097. directory should work if nowhere else does.}
  9098. % This macro is called from txi-??.tex files; the first argument is the
  9099. % \language name to set (without the "\lang@" prefix), the second and
  9100. % third args are \{left,right}hyphenmin.
  9101. %
  9102. % The language names to pass are determined when the format is built.
  9103. % See the etex.log file created at that time, e.g.,
  9104. % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
  9105. %
  9106. % With TeX Live 2008, etex now includes hyphenation patterns for all
  9107. % available languages. This means we can support hyphenation in
  9108. % Texinfo, at least to some extent. (This still doesn't solve the
  9109. % accented characters problem.)
  9110. %
  9111. \catcode`@=11
  9112. \def\txisetlanguage#1#2#3{%
  9113. % do not set the language if the name is undefined in the current TeX.
  9114. \expandafter\ifx\csname lang@#1\endcsname \relax
  9115. \message{no patterns for #1}%
  9116. \else
  9117. \global\language = \csname lang@#1\endcsname
  9118. \fi
  9119. % but there is no harm in adjusting the hyphenmin values regardless.
  9120. \global\lefthyphenmin = #2\relax
  9121. \global\righthyphenmin = #3\relax
  9122. }
  9123. % XeTeX and LuaTeX can handle Unicode natively.
  9124. % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
  9125. % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
  9126. %
  9127. \newif\iftxinativeunicodecapable
  9128. \newif\iftxiusebytewiseio
  9129. \ifx\XeTeXrevision\thisisundefined
  9130. \ifx\luatexversion\thisisundefined
  9131. \txinativeunicodecapablefalse
  9132. \txiusebytewiseiotrue
  9133. \else
  9134. \txinativeunicodecapabletrue
  9135. \txiusebytewiseiofalse
  9136. \fi
  9137. \else
  9138. \txinativeunicodecapabletrue
  9139. \txiusebytewiseiofalse
  9140. \fi
  9141. % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
  9142. % for non-UTF-8 (byte-wise) encodings.
  9143. %
  9144. \def\setbytewiseio{%
  9145. \ifx\XeTeXrevision\thisisundefined
  9146. \else
  9147. \XeTeXdefaultencoding "bytes" % For subsequent files to be read
  9148. \XeTeXinputencoding "bytes" % For document root file
  9149. % Unfortunately, there seems to be no corresponding XeTeX command for
  9150. % output encoding. This is a problem for auxiliary index and TOC files.
  9151. % The only solution would be perhaps to write out @U{...} sequences in
  9152. % place of non-ASCII characters.
  9153. \fi
  9154. \ifx\luatexversion\thisisundefined
  9155. \else
  9156. \directlua{
  9157. local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
  9158. local function convert_char (char)
  9159. return utf8_char(byte(char))
  9160. end
  9161. local function convert_line (line)
  9162. return gsub(line, ".", convert_char)
  9163. end
  9164. callback.register("process_input_buffer", convert_line)
  9165. local function convert_line_out (line)
  9166. local line_out = ""
  9167. for c in string.utfvalues(line) do
  9168. line_out = line_out .. string.char(c)
  9169. end
  9170. return line_out
  9171. end
  9172. callback.register("process_output_buffer", convert_line_out)
  9173. }
  9174. \fi
  9175. \txiusebytewiseiotrue
  9176. }
  9177. % Helpers for encodings.
  9178. % Set the catcode of characters 128 through 255 to the specified number.
  9179. %
  9180. \def\setnonasciicharscatcode#1{%
  9181. \count255=128
  9182. \loop\ifnum\count255<256
  9183. \global\catcode\count255=#1\relax
  9184. \advance\count255 by 1
  9185. \repeat
  9186. }
  9187. \def\setnonasciicharscatcodenonglobal#1{%
  9188. \count255=128
  9189. \loop\ifnum\count255<256
  9190. \catcode\count255=#1\relax
  9191. \advance\count255 by 1
  9192. \repeat
  9193. }
  9194. % @documentencoding sets the definition of non-ASCII characters
  9195. % according to the specified encoding.
  9196. %
  9197. \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
  9198. \def\documentencodingzzz#1{%
  9199. %
  9200. % Encoding being declared for the document.
  9201. \def\declaredencoding{\csname #1.enc\endcsname}%
  9202. %
  9203. % Supported encodings: names converted to tokens in order to be able
  9204. % to compare them with \ifx.
  9205. \def\ascii{\csname US-ASCII.enc\endcsname}%
  9206. \def\latnine{\csname ISO-8859-15.enc\endcsname}%
  9207. \def\latone{\csname ISO-8859-1.enc\endcsname}%
  9208. \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
  9209. \def\utfeight{\csname UTF-8.enc\endcsname}%
  9210. %
  9211. \ifx \declaredencoding \ascii
  9212. \asciichardefs
  9213. %
  9214. \else \ifx \declaredencoding \lattwo
  9215. \iftxinativeunicodecapable
  9216. \setbytewiseio
  9217. \fi
  9218. \setnonasciicharscatcode\active
  9219. \lattwochardefs
  9220. %
  9221. \else \ifx \declaredencoding \latone
  9222. \iftxinativeunicodecapable
  9223. \setbytewiseio
  9224. \fi
  9225. \setnonasciicharscatcode\active
  9226. \latonechardefs
  9227. %
  9228. \else \ifx \declaredencoding \latnine
  9229. \iftxinativeunicodecapable
  9230. \setbytewiseio
  9231. \fi
  9232. \setnonasciicharscatcode\active
  9233. \latninechardefs
  9234. %
  9235. \else \ifx \declaredencoding \utfeight
  9236. \iftxinativeunicodecapable
  9237. % For native Unicode handling (XeTeX and LuaTeX)
  9238. \nativeunicodechardefs
  9239. \else
  9240. % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
  9241. \setnonasciicharscatcode\active
  9242. % since we already invoked \utfeightchardefs at the top level
  9243. % (below), do not re-invoke it, otherwise our check for duplicated
  9244. % definitions gets triggered. Making non-ascii chars active is
  9245. % sufficient.
  9246. \fi
  9247. %
  9248. \else
  9249. \message{Ignoring unknown document encoding: #1.}%
  9250. %
  9251. \fi % utfeight
  9252. \fi % latnine
  9253. \fi % latone
  9254. \fi % lattwo
  9255. \fi % ascii
  9256. %
  9257. \ifx\XeTeXrevision\thisisundefined
  9258. \else
  9259. \ifx \declaredencoding \utfeight
  9260. \else
  9261. \ifx \declaredencoding \ascii
  9262. \else
  9263. \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
  9264. non-ASCII characters in auxiliary files.}%
  9265. \fi
  9266. \fi
  9267. \fi
  9268. }
  9269. % emacs-page
  9270. % A message to be logged when using a character that isn't available
  9271. % the default font encoding (OT1).
  9272. %
  9273. \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
  9274. % Take account of \c (plain) vs. \, (Texinfo) difference.
  9275. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
  9276. % First, make active non-ASCII characters in order for them to be
  9277. % correctly categorized when TeX reads the replacement text of
  9278. % macros containing the character definitions.
  9279. \setnonasciicharscatcode\active
  9280. %
  9281. \def\gdefchar#1#2{%
  9282. \gdef#1{%
  9283. \ifpassthroughchars
  9284. \string#1%
  9285. \else
  9286. #2%
  9287. \fi
  9288. }}
  9289. % Latin1 (ISO-8859-1) character definitions.
  9290. \def\latonechardefs{%
  9291. \gdefchar^^a0{\tie}
  9292. \gdefchar^^a1{\exclamdown}
  9293. \gdefchar^^a2{{\tcfont \char162}} % cent
  9294. \gdefchar^^a3{\pounds{}}
  9295. \gdefchar^^a4{{\tcfont \char164}} % currency
  9296. \gdefchar^^a5{{\tcfont \char165}} % yen
  9297. \gdefchar^^a6{{\tcfont \char166}} % broken bar
  9298. \gdefchar^^a7{\S}
  9299. \gdefchar^^a8{\"{}}
  9300. \gdefchar^^a9{\copyright{}}
  9301. \gdefchar^^aa{\ordf}
  9302. \gdefchar^^ab{\guillemetleft{}}
  9303. \gdefchar^^ac{\ensuremath\lnot}
  9304. \gdefchar^^ad{\-}
  9305. \gdefchar^^ae{\registeredsymbol{}}
  9306. \gdefchar^^af{\={}}
  9307. %
  9308. \gdefchar^^b0{\textdegree}
  9309. \gdefchar^^b1{$\pm$}
  9310. \gdefchar^^b2{$^2$}
  9311. \gdefchar^^b3{$^3$}
  9312. \gdefchar^^b4{\'{}}
  9313. \gdefchar^^b5{$\mu$}
  9314. \gdefchar^^b6{\P}
  9315. \gdefchar^^b7{\ensuremath\cdot}
  9316. \gdefchar^^b8{\cedilla\ }
  9317. \gdefchar^^b9{$^1$}
  9318. \gdefchar^^ba{\ordm}
  9319. \gdefchar^^bb{\guillemetright{}}
  9320. \gdefchar^^bc{$1\over4$}
  9321. \gdefchar^^bd{$1\over2$}
  9322. \gdefchar^^be{$3\over4$}
  9323. \gdefchar^^bf{\questiondown}
  9324. %
  9325. \gdefchar^^c0{\`A}
  9326. \gdefchar^^c1{\'A}
  9327. \gdefchar^^c2{\^A}
  9328. \gdefchar^^c3{\~A}
  9329. \gdefchar^^c4{\"A}
  9330. \gdefchar^^c5{\ringaccent A}
  9331. \gdefchar^^c6{\AE}
  9332. \gdefchar^^c7{\cedilla C}
  9333. \gdefchar^^c8{\`E}
  9334. \gdefchar^^c9{\'E}
  9335. \gdefchar^^ca{\^E}
  9336. \gdefchar^^cb{\"E}
  9337. \gdefchar^^cc{\`I}
  9338. \gdefchar^^cd{\'I}
  9339. \gdefchar^^ce{\^I}
  9340. \gdefchar^^cf{\"I}
  9341. %
  9342. \gdefchar^^d0{\DH}
  9343. \gdefchar^^d1{\~N}
  9344. \gdefchar^^d2{\`O}
  9345. \gdefchar^^d3{\'O}
  9346. \gdefchar^^d4{\^O}
  9347. \gdefchar^^d5{\~O}
  9348. \gdefchar^^d6{\"O}
  9349. \gdefchar^^d7{$\times$}
  9350. \gdefchar^^d8{\O}
  9351. \gdefchar^^d9{\`U}
  9352. \gdefchar^^da{\'U}
  9353. \gdefchar^^db{\^U}
  9354. \gdefchar^^dc{\"U}
  9355. \gdefchar^^dd{\'Y}
  9356. \gdefchar^^de{\TH}
  9357. \gdefchar^^df{\ss}
  9358. %
  9359. \gdefchar^^e0{\`a}
  9360. \gdefchar^^e1{\'a}
  9361. \gdefchar^^e2{\^a}
  9362. \gdefchar^^e3{\~a}
  9363. \gdefchar^^e4{\"a}
  9364. \gdefchar^^e5{\ringaccent a}
  9365. \gdefchar^^e6{\ae}
  9366. \gdefchar^^e7{\cedilla c}
  9367. \gdefchar^^e8{\`e}
  9368. \gdefchar^^e9{\'e}
  9369. \gdefchar^^ea{\^e}
  9370. \gdefchar^^eb{\"e}
  9371. \gdefchar^^ec{\`{\dotless i}}
  9372. \gdefchar^^ed{\'{\dotless i}}
  9373. \gdefchar^^ee{\^{\dotless i}}
  9374. \gdefchar^^ef{\"{\dotless i}}
  9375. %
  9376. \gdefchar^^f0{\dh}
  9377. \gdefchar^^f1{\~n}
  9378. \gdefchar^^f2{\`o}
  9379. \gdefchar^^f3{\'o}
  9380. \gdefchar^^f4{\^o}
  9381. \gdefchar^^f5{\~o}
  9382. \gdefchar^^f6{\"o}
  9383. \gdefchar^^f7{$\div$}
  9384. \gdefchar^^f8{\o}
  9385. \gdefchar^^f9{\`u}
  9386. \gdefchar^^fa{\'u}
  9387. \gdefchar^^fb{\^u}
  9388. \gdefchar^^fc{\"u}
  9389. \gdefchar^^fd{\'y}
  9390. \gdefchar^^fe{\th}
  9391. \gdefchar^^ff{\"y}
  9392. }
  9393. % Latin9 (ISO-8859-15) encoding character definitions.
  9394. \def\latninechardefs{%
  9395. % Encoding is almost identical to Latin1.
  9396. \latonechardefs
  9397. %
  9398. \gdefchar^^a4{\euro{}}
  9399. \gdefchar^^a6{\v S}
  9400. \gdefchar^^a8{\v s}
  9401. \gdefchar^^b4{\v Z}
  9402. \gdefchar^^b8{\v z}
  9403. \gdefchar^^bc{\OE}
  9404. \gdefchar^^bd{\oe}
  9405. \gdefchar^^be{\"Y}
  9406. }
  9407. % Latin2 (ISO-8859-2) character definitions.
  9408. \def\lattwochardefs{%
  9409. \gdefchar^^a0{\tie}
  9410. \gdefchar^^a1{\ogonek{A}}
  9411. \gdefchar^^a2{\u{}}
  9412. \gdefchar^^a3{\L}
  9413. \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
  9414. \gdefchar^^a5{\v L}
  9415. \gdefchar^^a6{\'S}
  9416. \gdefchar^^a7{\S}
  9417. \gdefchar^^a8{\"{}}
  9418. \gdefchar^^a9{\v S}
  9419. \gdefchar^^aa{\cedilla S}
  9420. \gdefchar^^ab{\v T}
  9421. \gdefchar^^ac{\'Z}
  9422. \gdefchar^^ad{\-}
  9423. \gdefchar^^ae{\v Z}
  9424. \gdefchar^^af{\dotaccent Z}
  9425. %
  9426. \gdefchar^^b0{\textdegree{}}
  9427. \gdefchar^^b1{\ogonek{a}}
  9428. \gdefchar^^b2{\ogonek{ }}
  9429. \gdefchar^^b3{\l}
  9430. \gdefchar^^b4{\'{}}
  9431. \gdefchar^^b5{\v l}
  9432. \gdefchar^^b6{\'s}
  9433. \gdefchar^^b7{\v{}}
  9434. \gdefchar^^b8{\cedilla\ }
  9435. \gdefchar^^b9{\v s}
  9436. \gdefchar^^ba{\cedilla s}
  9437. \gdefchar^^bb{\v t}
  9438. \gdefchar^^bc{\'z}
  9439. \gdefchar^^bd{\H{}}
  9440. \gdefchar^^be{\v z}
  9441. \gdefchar^^bf{\dotaccent z}
  9442. %
  9443. \gdefchar^^c0{\'R}
  9444. \gdefchar^^c1{\'A}
  9445. \gdefchar^^c2{\^A}
  9446. \gdefchar^^c3{\u A}
  9447. \gdefchar^^c4{\"A}
  9448. \gdefchar^^c5{\'L}
  9449. \gdefchar^^c6{\'C}
  9450. \gdefchar^^c7{\cedilla C}
  9451. \gdefchar^^c8{\v C}
  9452. \gdefchar^^c9{\'E}
  9453. \gdefchar^^ca{\ogonek{E}}
  9454. \gdefchar^^cb{\"E}
  9455. \gdefchar^^cc{\v E}
  9456. \gdefchar^^cd{\'I}
  9457. \gdefchar^^ce{\^I}
  9458. \gdefchar^^cf{\v D}
  9459. %
  9460. \gdefchar^^d0{\DH}
  9461. \gdefchar^^d1{\'N}
  9462. \gdefchar^^d2{\v N}
  9463. \gdefchar^^d3{\'O}
  9464. \gdefchar^^d4{\^O}
  9465. \gdefchar^^d5{\H O}
  9466. \gdefchar^^d6{\"O}
  9467. \gdefchar^^d7{$\times$}
  9468. \gdefchar^^d8{\v R}
  9469. \gdefchar^^d9{\ringaccent U}
  9470. \gdefchar^^da{\'U}
  9471. \gdefchar^^db{\H U}
  9472. \gdefchar^^dc{\"U}
  9473. \gdefchar^^dd{\'Y}
  9474. \gdefchar^^de{\cedilla T}
  9475. \gdefchar^^df{\ss}
  9476. %
  9477. \gdefchar^^e0{\'r}
  9478. \gdefchar^^e1{\'a}
  9479. \gdefchar^^e2{\^a}
  9480. \gdefchar^^e3{\u a}
  9481. \gdefchar^^e4{\"a}
  9482. \gdefchar^^e5{\'l}
  9483. \gdefchar^^e6{\'c}
  9484. \gdefchar^^e7{\cedilla c}
  9485. \gdefchar^^e8{\v c}
  9486. \gdefchar^^e9{\'e}
  9487. \gdefchar^^ea{\ogonek{e}}
  9488. \gdefchar^^eb{\"e}
  9489. \gdefchar^^ec{\v e}
  9490. \gdefchar^^ed{\'{\dotless{i}}}
  9491. \gdefchar^^ee{\^{\dotless{i}}}
  9492. \gdefchar^^ef{\v d}
  9493. %
  9494. \gdefchar^^f0{\dh}
  9495. \gdefchar^^f1{\'n}
  9496. \gdefchar^^f2{\v n}
  9497. \gdefchar^^f3{\'o}
  9498. \gdefchar^^f4{\^o}
  9499. \gdefchar^^f5{\H o}
  9500. \gdefchar^^f6{\"o}
  9501. \gdefchar^^f7{$\div$}
  9502. \gdefchar^^f8{\v r}
  9503. \gdefchar^^f9{\ringaccent u}
  9504. \gdefchar^^fa{\'u}
  9505. \gdefchar^^fb{\H u}
  9506. \gdefchar^^fc{\"u}
  9507. \gdefchar^^fd{\'y}
  9508. \gdefchar^^fe{\cedilla t}
  9509. \gdefchar^^ff{\dotaccent{}}
  9510. }
  9511. % UTF-8 character definitions.
  9512. %
  9513. % This code to support UTF-8 is based on LaTeX's utf8.def, with some
  9514. % changes for Texinfo conventions. It is included here under the GPL by
  9515. % permission from Frank Mittelbach and the LaTeX team.
  9516. %
  9517. \newcount\countUTFx
  9518. \newcount\countUTFy
  9519. \newcount\countUTFz
  9520. \gdef\UTFviiiTwoOctets#1#2{\expandafter
  9521. \UTFviiiDefined\csname u8:#1\string #2\endcsname}
  9522. %
  9523. \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
  9524. \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
  9525. %
  9526. \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
  9527. \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
  9528. \gdef\UTFviiiDefined#1{%
  9529. \ifx #1\relax
  9530. \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
  9531. \else
  9532. \expandafter #1%
  9533. \fi
  9534. }
  9535. % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
  9536. \begingroup
  9537. \catcode`\~13
  9538. \catcode`\$12
  9539. \catcode`\"12
  9540. % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
  9541. % substituting ~ and $ with a character token of that value.
  9542. \def\UTFviiiLoop{%
  9543. \global\catcode\countUTFx\active
  9544. \uccode`\~\countUTFx
  9545. \uccode`\$\countUTFx
  9546. \uppercase\expandafter{\UTFviiiTmp}%
  9547. \advance\countUTFx by 1
  9548. \ifnum\countUTFx < \countUTFy
  9549. \expandafter\UTFviiiLoop
  9550. \fi}
  9551. % For bytes other than the first in a UTF-8 sequence. Not expected to
  9552. % be expanded except when writing to auxiliary files.
  9553. \countUTFx = "80
  9554. \countUTFy = "C2
  9555. \def\UTFviiiTmp{%
  9556. \gdef~{%
  9557. \ifpassthroughchars $\fi}}%
  9558. \UTFviiiLoop
  9559. \countUTFx = "C2
  9560. \countUTFy = "E0
  9561. \def\UTFviiiTmp{%
  9562. \gdef~{%
  9563. \ifpassthroughchars $%
  9564. \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
  9565. \UTFviiiLoop
  9566. \countUTFx = "E0
  9567. \countUTFy = "F0
  9568. \def\UTFviiiTmp{%
  9569. \gdef~{%
  9570. \ifpassthroughchars $%
  9571. \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
  9572. \UTFviiiLoop
  9573. \countUTFx = "F0
  9574. \countUTFy = "F4
  9575. \def\UTFviiiTmp{%
  9576. \gdef~{%
  9577. \ifpassthroughchars $%
  9578. \else\expandafter\UTFviiiFourOctets\expandafter$\fi
  9579. }}%
  9580. \UTFviiiLoop
  9581. \endgroup
  9582. \def\globallet{\global\let} % save some \expandafter's below
  9583. % @U{xxxx} to produce U+xxxx, if we support it.
  9584. \def\U#1{%
  9585. \expandafter\ifx\csname uni:#1\endcsname \relax
  9586. \iftxinativeunicodecapable
  9587. % All Unicode characters can be used if native Unicode handling is
  9588. % active. However, if the font does not have the glyph,
  9589. % letters are missing.
  9590. \begingroup
  9591. \uccode`\.="#1\relax
  9592. \uppercase{.}
  9593. \endgroup
  9594. \else
  9595. \errhelp = \EMsimple
  9596. \errmessage{Unicode character U+#1 not supported, sorry}%
  9597. \fi
  9598. \else
  9599. \csname uni:#1\endcsname
  9600. \fi
  9601. }
  9602. % These macros are used here to construct the name of a control
  9603. % sequence to be defined.
  9604. \def\UTFviiiTwoOctetsName#1#2{%
  9605. \csname u8:#1\string #2\endcsname}%
  9606. \def\UTFviiiThreeOctetsName#1#2#3{%
  9607. \csname u8:#1\string #2\string #3\endcsname}%
  9608. \def\UTFviiiFourOctetsName#1#2#3#4{%
  9609. \csname u8:#1\string #2\string #3\string #4\endcsname}%
  9610. % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
  9611. % provide a definition macro to replace a Unicode character;
  9612. % this gets used by the @U command
  9613. %
  9614. \begingroup
  9615. \catcode`\"=12
  9616. \catcode`\<=12
  9617. \catcode`\.=12
  9618. \catcode`\,=12
  9619. \catcode`\;=12
  9620. \catcode`\!=12
  9621. \catcode`\~=13
  9622. \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
  9623. \countUTFz = "#1\relax
  9624. \begingroup
  9625. \parseXMLCharref
  9626. % Give \u8:... its definition. The sequence of seven \expandafter's
  9627. % expands after the \gdef three times, e.g.
  9628. %
  9629. % 1. \UTFviiTwoOctetsName B1 B2
  9630. % 2. \csname u8:B1 \string B2 \endcsname
  9631. % 3. \u8: B1 B2 (a single control sequence token)
  9632. %
  9633. \expandafter\expandafter
  9634. \expandafter\expandafter
  9635. \expandafter\expandafter
  9636. \expandafter\gdef \UTFviiiTmp{#2}%
  9637. %
  9638. \expandafter\ifx\csname uni:#1\endcsname \relax \else
  9639. \message{Internal error, already defined: #1}%
  9640. \fi
  9641. %
  9642. % define an additional control sequence for this code point.
  9643. \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
  9644. \endgroup}
  9645. %
  9646. % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
  9647. % to the corresponding UTF-8 sequence.
  9648. \gdef\parseXMLCharref{%
  9649. \ifnum\countUTFz < "A0\relax
  9650. \errhelp = \EMsimple
  9651. \errmessage{Cannot define Unicode char value < 00A0}%
  9652. \else\ifnum\countUTFz < "800\relax
  9653. \parseUTFviiiA,%
  9654. \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
  9655. \else\ifnum\countUTFz < "10000\relax
  9656. \parseUTFviiiA;%
  9657. \parseUTFviiiA,%
  9658. \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
  9659. \else
  9660. \parseUTFviiiA;%
  9661. \parseUTFviiiA,%
  9662. \parseUTFviiiA!%
  9663. \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
  9664. \fi\fi\fi
  9665. }
  9666. % Extract a byte from the end of the UTF-8 representation of \countUTFx.
  9667. % It must be a non-initial byte in the sequence.
  9668. % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
  9669. % of the bytes.
  9670. \gdef\parseUTFviiiA#1{%
  9671. \countUTFx = \countUTFz
  9672. \divide\countUTFz by 64
  9673. \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
  9674. \multiply\countUTFz by 64
  9675. % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
  9676. % in order to get the last five bits.
  9677. \advance\countUTFx by -\countUTFz
  9678. % Convert this to the byte in the UTF-8 sequence.
  9679. \advance\countUTFx by 128
  9680. \uccode `#1\countUTFx
  9681. \countUTFz = \countUTFy}
  9682. % Used to put a UTF-8 byte sequence into \UTFviiiTmp
  9683. % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
  9684. % sequence.
  9685. % #2 is one of the \UTFviii*OctetsName macros.
  9686. % #3 is always a full stop (.)
  9687. % #4 is a template for the other bytes in the sequence. The values for these
  9688. % bytes is substituted in here with \uppercase using the \uccode's.
  9689. \gdef\parseUTFviiiB#1#2#3#4{%
  9690. \advance\countUTFz by "#10\relax
  9691. \uccode `#3\countUTFz
  9692. \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
  9693. \endgroup
  9694. % For native Unicode handling (XeTeX and LuaTeX),
  9695. % provide a definition macro that sets a catcode to `other' non-globally
  9696. %
  9697. \def\DeclareUnicodeCharacterNativeOther#1#2{%
  9698. \catcode"#1=\other
  9699. }
  9700. % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
  9701. % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
  9702. % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
  9703. % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
  9704. % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
  9705. %
  9706. % Many of our renditions are less than wonderful, and all the missing
  9707. % characters are available somewhere. Loading the necessary fonts
  9708. % awaits user request. We can't truly support Unicode without
  9709. % reimplementing everything that's been done in LaTeX for many years,
  9710. % plus probably using luatex or xetex, and who knows what else.
  9711. % We won't be doing that here in this simple file. But we can try to at
  9712. % least make most of the characters not bomb out.
  9713. %
  9714. \def\unicodechardefs{%
  9715. \DeclareUnicodeCharacter{00A0}{\tie}%
  9716. \DeclareUnicodeCharacter{00A1}{\exclamdown}%
  9717. \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
  9718. \DeclareUnicodeCharacter{00A3}{\pounds{}}%
  9719. \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
  9720. \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
  9721. \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
  9722. \DeclareUnicodeCharacter{00A7}{\S}%
  9723. \DeclareUnicodeCharacter{00A8}{\"{ }}%
  9724. \DeclareUnicodeCharacter{00A9}{\copyright{}}%
  9725. \DeclareUnicodeCharacter{00AA}{\ordf}%
  9726. \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
  9727. \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
  9728. \DeclareUnicodeCharacter{00AD}{\-}%
  9729. \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
  9730. \DeclareUnicodeCharacter{00AF}{\={ }}%
  9731. %
  9732. \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
  9733. \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
  9734. \DeclareUnicodeCharacter{00B2}{$^2$}%
  9735. \DeclareUnicodeCharacter{00B3}{$^3$}%
  9736. \DeclareUnicodeCharacter{00B4}{\'{ }}%
  9737. \DeclareUnicodeCharacter{00B5}{$\mu$}%
  9738. \DeclareUnicodeCharacter{00B6}{\P}%
  9739. \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
  9740. \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
  9741. \DeclareUnicodeCharacter{00B9}{$^1$}%
  9742. \DeclareUnicodeCharacter{00BA}{\ordm}%
  9743. \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
  9744. \DeclareUnicodeCharacter{00BC}{$1\over4$}%
  9745. \DeclareUnicodeCharacter{00BD}{$1\over2$}%
  9746. \DeclareUnicodeCharacter{00BE}{$3\over4$}%
  9747. \DeclareUnicodeCharacter{00BF}{\questiondown}%
  9748. %
  9749. \DeclareUnicodeCharacter{00C0}{\`A}%
  9750. \DeclareUnicodeCharacter{00C1}{\'A}%
  9751. \DeclareUnicodeCharacter{00C2}{\^A}%
  9752. \DeclareUnicodeCharacter{00C3}{\~A}%
  9753. \DeclareUnicodeCharacter{00C4}{\"A}%
  9754. \DeclareUnicodeCharacter{00C5}{\AA}%
  9755. \DeclareUnicodeCharacter{00C6}{\AE}%
  9756. \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
  9757. \DeclareUnicodeCharacter{00C8}{\`E}%
  9758. \DeclareUnicodeCharacter{00C9}{\'E}%
  9759. \DeclareUnicodeCharacter{00CA}{\^E}%
  9760. \DeclareUnicodeCharacter{00CB}{\"E}%
  9761. \DeclareUnicodeCharacter{00CC}{\`I}%
  9762. \DeclareUnicodeCharacter{00CD}{\'I}%
  9763. \DeclareUnicodeCharacter{00CE}{\^I}%
  9764. \DeclareUnicodeCharacter{00CF}{\"I}%
  9765. %
  9766. \DeclareUnicodeCharacter{00D0}{\DH}%
  9767. \DeclareUnicodeCharacter{00D1}{\~N}%
  9768. \DeclareUnicodeCharacter{00D2}{\`O}%
  9769. \DeclareUnicodeCharacter{00D3}{\'O}%
  9770. \DeclareUnicodeCharacter{00D4}{\^O}%
  9771. \DeclareUnicodeCharacter{00D5}{\~O}%
  9772. \DeclareUnicodeCharacter{00D6}{\"O}%
  9773. \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
  9774. \DeclareUnicodeCharacter{00D8}{\O}%
  9775. \DeclareUnicodeCharacter{00D9}{\`U}%
  9776. \DeclareUnicodeCharacter{00DA}{\'U}%
  9777. \DeclareUnicodeCharacter{00DB}{\^U}%
  9778. \DeclareUnicodeCharacter{00DC}{\"U}%
  9779. \DeclareUnicodeCharacter{00DD}{\'Y}%
  9780. \DeclareUnicodeCharacter{00DE}{\TH}%
  9781. \DeclareUnicodeCharacter{00DF}{\ss}%
  9782. %
  9783. \DeclareUnicodeCharacter{00E0}{\`a}%
  9784. \DeclareUnicodeCharacter{00E1}{\'a}%
  9785. \DeclareUnicodeCharacter{00E2}{\^a}%
  9786. \DeclareUnicodeCharacter{00E3}{\~a}%
  9787. \DeclareUnicodeCharacter{00E4}{\"a}%
  9788. \DeclareUnicodeCharacter{00E5}{\aa}%
  9789. \DeclareUnicodeCharacter{00E6}{\ae}%
  9790. \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
  9791. \DeclareUnicodeCharacter{00E8}{\`e}%
  9792. \DeclareUnicodeCharacter{00E9}{\'e}%
  9793. \DeclareUnicodeCharacter{00EA}{\^e}%
  9794. \DeclareUnicodeCharacter{00EB}{\"e}%
  9795. \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
  9796. \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
  9797. \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
  9798. \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
  9799. %
  9800. \DeclareUnicodeCharacter{00F0}{\dh}%
  9801. \DeclareUnicodeCharacter{00F1}{\~n}%
  9802. \DeclareUnicodeCharacter{00F2}{\`o}%
  9803. \DeclareUnicodeCharacter{00F3}{\'o}%
  9804. \DeclareUnicodeCharacter{00F4}{\^o}%
  9805. \DeclareUnicodeCharacter{00F5}{\~o}%
  9806. \DeclareUnicodeCharacter{00F6}{\"o}%
  9807. \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
  9808. \DeclareUnicodeCharacter{00F8}{\o}%
  9809. \DeclareUnicodeCharacter{00F9}{\`u}%
  9810. \DeclareUnicodeCharacter{00FA}{\'u}%
  9811. \DeclareUnicodeCharacter{00FB}{\^u}%
  9812. \DeclareUnicodeCharacter{00FC}{\"u}%
  9813. \DeclareUnicodeCharacter{00FD}{\'y}%
  9814. \DeclareUnicodeCharacter{00FE}{\th}%
  9815. \DeclareUnicodeCharacter{00FF}{\"y}%
  9816. %
  9817. \DeclareUnicodeCharacter{0100}{\=A}%
  9818. \DeclareUnicodeCharacter{0101}{\=a}%
  9819. \DeclareUnicodeCharacter{0102}{\u{A}}%
  9820. \DeclareUnicodeCharacter{0103}{\u{a}}%
  9821. \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
  9822. \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
  9823. \DeclareUnicodeCharacter{0106}{\'C}%
  9824. \DeclareUnicodeCharacter{0107}{\'c}%
  9825. \DeclareUnicodeCharacter{0108}{\^C}%
  9826. \DeclareUnicodeCharacter{0109}{\^c}%
  9827. \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
  9828. \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
  9829. \DeclareUnicodeCharacter{010C}{\v{C}}%
  9830. \DeclareUnicodeCharacter{010D}{\v{c}}%
  9831. \DeclareUnicodeCharacter{010E}{\v{D}}%
  9832. \DeclareUnicodeCharacter{010F}{d'}%
  9833. %
  9834. \DeclareUnicodeCharacter{0110}{\DH}%
  9835. \DeclareUnicodeCharacter{0111}{\dh}%
  9836. \DeclareUnicodeCharacter{0112}{\=E}%
  9837. \DeclareUnicodeCharacter{0113}{\=e}%
  9838. \DeclareUnicodeCharacter{0114}{\u{E}}%
  9839. \DeclareUnicodeCharacter{0115}{\u{e}}%
  9840. \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
  9841. \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
  9842. \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
  9843. \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
  9844. \DeclareUnicodeCharacter{011A}{\v{E}}%
  9845. \DeclareUnicodeCharacter{011B}{\v{e}}%
  9846. \DeclareUnicodeCharacter{011C}{\^G}%
  9847. \DeclareUnicodeCharacter{011D}{\^g}%
  9848. \DeclareUnicodeCharacter{011E}{\u{G}}%
  9849. \DeclareUnicodeCharacter{011F}{\u{g}}%
  9850. %
  9851. \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
  9852. \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
  9853. \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
  9854. \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
  9855. \DeclareUnicodeCharacter{0124}{\^H}%
  9856. \DeclareUnicodeCharacter{0125}{\^h}%
  9857. \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
  9858. \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
  9859. \DeclareUnicodeCharacter{0128}{\~I}%
  9860. \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
  9861. \DeclareUnicodeCharacter{012A}{\=I}%
  9862. \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
  9863. \DeclareUnicodeCharacter{012C}{\u{I}}%
  9864. \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
  9865. \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
  9866. \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
  9867. %
  9868. \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
  9869. \DeclareUnicodeCharacter{0131}{\dotless{i}}%
  9870. \DeclareUnicodeCharacter{0132}{IJ}%
  9871. \DeclareUnicodeCharacter{0133}{ij}%
  9872. \DeclareUnicodeCharacter{0134}{\^J}%
  9873. \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
  9874. \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
  9875. \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
  9876. \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
  9877. \DeclareUnicodeCharacter{0139}{\'L}%
  9878. \DeclareUnicodeCharacter{013A}{\'l}%
  9879. \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
  9880. \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
  9881. \DeclareUnicodeCharacter{013D}{L'}% should kern
  9882. \DeclareUnicodeCharacter{013E}{l'}% should kern
  9883. \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
  9884. %
  9885. \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
  9886. \DeclareUnicodeCharacter{0141}{\L}%
  9887. \DeclareUnicodeCharacter{0142}{\l}%
  9888. \DeclareUnicodeCharacter{0143}{\'N}%
  9889. \DeclareUnicodeCharacter{0144}{\'n}%
  9890. \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
  9891. \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
  9892. \DeclareUnicodeCharacter{0147}{\v{N}}%
  9893. \DeclareUnicodeCharacter{0148}{\v{n}}%
  9894. \DeclareUnicodeCharacter{0149}{'n}%
  9895. \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
  9896. \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
  9897. \DeclareUnicodeCharacter{014C}{\=O}%
  9898. \DeclareUnicodeCharacter{014D}{\=o}%
  9899. \DeclareUnicodeCharacter{014E}{\u{O}}%
  9900. \DeclareUnicodeCharacter{014F}{\u{o}}%
  9901. %
  9902. \DeclareUnicodeCharacter{0150}{\H{O}}%
  9903. \DeclareUnicodeCharacter{0151}{\H{o}}%
  9904. \DeclareUnicodeCharacter{0152}{\OE}%
  9905. \DeclareUnicodeCharacter{0153}{\oe}%
  9906. \DeclareUnicodeCharacter{0154}{\'R}%
  9907. \DeclareUnicodeCharacter{0155}{\'r}%
  9908. \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
  9909. \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
  9910. \DeclareUnicodeCharacter{0158}{\v{R}}%
  9911. \DeclareUnicodeCharacter{0159}{\v{r}}%
  9912. \DeclareUnicodeCharacter{015A}{\'S}%
  9913. \DeclareUnicodeCharacter{015B}{\'s}%
  9914. \DeclareUnicodeCharacter{015C}{\^S}%
  9915. \DeclareUnicodeCharacter{015D}{\^s}%
  9916. \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
  9917. \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
  9918. %
  9919. \DeclareUnicodeCharacter{0160}{\v{S}}%
  9920. \DeclareUnicodeCharacter{0161}{\v{s}}%
  9921. \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
  9922. \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
  9923. \DeclareUnicodeCharacter{0164}{\v{T}}%
  9924. \DeclareUnicodeCharacter{0165}{\v{t}}%
  9925. \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
  9926. \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
  9927. \DeclareUnicodeCharacter{0168}{\~U}%
  9928. \DeclareUnicodeCharacter{0169}{\~u}%
  9929. \DeclareUnicodeCharacter{016A}{\=U}%
  9930. \DeclareUnicodeCharacter{016B}{\=u}%
  9931. \DeclareUnicodeCharacter{016C}{\u{U}}%
  9932. \DeclareUnicodeCharacter{016D}{\u{u}}%
  9933. \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
  9934. \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
  9935. %
  9936. \DeclareUnicodeCharacter{0170}{\H{U}}%
  9937. \DeclareUnicodeCharacter{0171}{\H{u}}%
  9938. \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
  9939. \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
  9940. \DeclareUnicodeCharacter{0174}{\^W}%
  9941. \DeclareUnicodeCharacter{0175}{\^w}%
  9942. \DeclareUnicodeCharacter{0176}{\^Y}%
  9943. \DeclareUnicodeCharacter{0177}{\^y}%
  9944. \DeclareUnicodeCharacter{0178}{\"Y}%
  9945. \DeclareUnicodeCharacter{0179}{\'Z}%
  9946. \DeclareUnicodeCharacter{017A}{\'z}%
  9947. \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
  9948. \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
  9949. \DeclareUnicodeCharacter{017D}{\v{Z}}%
  9950. \DeclareUnicodeCharacter{017E}{\v{z}}%
  9951. \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
  9952. %
  9953. \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
  9954. \DeclareUnicodeCharacter{01C5}{D\v{z}}%
  9955. \DeclareUnicodeCharacter{01C6}{d\v{z}}%
  9956. \DeclareUnicodeCharacter{01C7}{LJ}%
  9957. \DeclareUnicodeCharacter{01C8}{Lj}%
  9958. \DeclareUnicodeCharacter{01C9}{lj}%
  9959. \DeclareUnicodeCharacter{01CA}{NJ}%
  9960. \DeclareUnicodeCharacter{01CB}{Nj}%
  9961. \DeclareUnicodeCharacter{01CC}{nj}%
  9962. \DeclareUnicodeCharacter{01CD}{\v{A}}%
  9963. \DeclareUnicodeCharacter{01CE}{\v{a}}%
  9964. \DeclareUnicodeCharacter{01CF}{\v{I}}%
  9965. %
  9966. \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
  9967. \DeclareUnicodeCharacter{01D1}{\v{O}}%
  9968. \DeclareUnicodeCharacter{01D2}{\v{o}}%
  9969. \DeclareUnicodeCharacter{01D3}{\v{U}}%
  9970. \DeclareUnicodeCharacter{01D4}{\v{u}}%
  9971. %
  9972. \DeclareUnicodeCharacter{01E2}{\={\AE}}%
  9973. \DeclareUnicodeCharacter{01E3}{\={\ae}}%
  9974. \DeclareUnicodeCharacter{01E6}{\v{G}}%
  9975. \DeclareUnicodeCharacter{01E7}{\v{g}}%
  9976. \DeclareUnicodeCharacter{01E8}{\v{K}}%
  9977. \DeclareUnicodeCharacter{01E9}{\v{k}}%
  9978. %
  9979. \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
  9980. \DeclareUnicodeCharacter{01F1}{DZ}%
  9981. \DeclareUnicodeCharacter{01F2}{Dz}%
  9982. \DeclareUnicodeCharacter{01F3}{dz}%
  9983. \DeclareUnicodeCharacter{01F4}{\'G}%
  9984. \DeclareUnicodeCharacter{01F5}{\'g}%
  9985. \DeclareUnicodeCharacter{01F8}{\`N}%
  9986. \DeclareUnicodeCharacter{01F9}{\`n}%
  9987. \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
  9988. \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
  9989. \DeclareUnicodeCharacter{01FE}{\'{\O}}%
  9990. \DeclareUnicodeCharacter{01FF}{\'{\o}}%
  9991. %
  9992. \DeclareUnicodeCharacter{021E}{\v{H}}%
  9993. \DeclareUnicodeCharacter{021F}{\v{h}}%
  9994. %
  9995. \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
  9996. \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
  9997. \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
  9998. \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
  9999. \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
  10000. \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
  10001. %
  10002. \DeclareUnicodeCharacter{0232}{\=Y}%
  10003. \DeclareUnicodeCharacter{0233}{\=y}%
  10004. \DeclareUnicodeCharacter{0237}{\dotless{j}}%
  10005. %
  10006. \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
  10007. %
  10008. % Greek letters upper case
  10009. \DeclareUnicodeCharacter{0391}{{\it A}}%
  10010. \DeclareUnicodeCharacter{0392}{{\it B}}%
  10011. \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
  10012. \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
  10013. \DeclareUnicodeCharacter{0395}{{\it E}}%
  10014. \DeclareUnicodeCharacter{0396}{{\it Z}}%
  10015. \DeclareUnicodeCharacter{0397}{{\it H}}%
  10016. \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
  10017. \DeclareUnicodeCharacter{0399}{{\it I}}%
  10018. \DeclareUnicodeCharacter{039A}{{\it K}}%
  10019. \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
  10020. \DeclareUnicodeCharacter{039C}{{\it M}}%
  10021. \DeclareUnicodeCharacter{039D}{{\it N}}%
  10022. \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
  10023. \DeclareUnicodeCharacter{039F}{{\it O}}%
  10024. \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
  10025. \DeclareUnicodeCharacter{03A1}{{\it P}}%
  10026. %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
  10027. \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
  10028. \DeclareUnicodeCharacter{03A4}{{\it T}}%
  10029. \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
  10030. \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
  10031. \DeclareUnicodeCharacter{03A7}{{\it X}}%
  10032. \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
  10033. \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
  10034. %
  10035. % Vowels with accents
  10036. \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
  10037. \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
  10038. \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
  10039. \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
  10040. \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
  10041. \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
  10042. %
  10043. % Standalone accent
  10044. \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
  10045. %
  10046. % Greek letters lower case
  10047. \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
  10048. \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
  10049. \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
  10050. \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
  10051. \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
  10052. \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
  10053. \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
  10054. \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
  10055. \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
  10056. \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
  10057. \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
  10058. \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
  10059. \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
  10060. \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
  10061. \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
  10062. \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
  10063. \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
  10064. \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
  10065. \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
  10066. \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
  10067. \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
  10068. \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
  10069. \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
  10070. \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
  10071. \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
  10072. %
  10073. % More Greek vowels with accents
  10074. \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
  10075. \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
  10076. \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
  10077. \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
  10078. \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
  10079. %
  10080. % Variant Greek letters
  10081. \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
  10082. \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
  10083. \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
  10084. %
  10085. \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
  10086. \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
  10087. \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
  10088. \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
  10089. \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
  10090. \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
  10091. \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
  10092. \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
  10093. \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
  10094. \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
  10095. \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
  10096. \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
  10097. %
  10098. \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
  10099. \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
  10100. %
  10101. \DeclareUnicodeCharacter{1E20}{\=G}%
  10102. \DeclareUnicodeCharacter{1E21}{\=g}%
  10103. \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
  10104. \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
  10105. \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
  10106. \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
  10107. \DeclareUnicodeCharacter{1E26}{\"H}%
  10108. \DeclareUnicodeCharacter{1E27}{\"h}%
  10109. %
  10110. \DeclareUnicodeCharacter{1E30}{\'K}%
  10111. \DeclareUnicodeCharacter{1E31}{\'k}%
  10112. \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
  10113. \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
  10114. \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
  10115. \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
  10116. \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
  10117. \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
  10118. \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
  10119. \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
  10120. \DeclareUnicodeCharacter{1E3E}{\'M}%
  10121. \DeclareUnicodeCharacter{1E3F}{\'m}%
  10122. %
  10123. \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
  10124. \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
  10125. \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
  10126. \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
  10127. \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
  10128. \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
  10129. \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
  10130. \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
  10131. \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
  10132. \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
  10133. %
  10134. \DeclareUnicodeCharacter{1E54}{\'P}%
  10135. \DeclareUnicodeCharacter{1E55}{\'p}%
  10136. \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
  10137. \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
  10138. \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
  10139. \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
  10140. \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
  10141. \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
  10142. \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
  10143. \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
  10144. %
  10145. \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
  10146. \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
  10147. \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
  10148. \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
  10149. \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
  10150. \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
  10151. \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
  10152. \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
  10153. \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
  10154. \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
  10155. %
  10156. \DeclareUnicodeCharacter{1E7C}{\~V}%
  10157. \DeclareUnicodeCharacter{1E7D}{\~v}%
  10158. \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
  10159. \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
  10160. %
  10161. \DeclareUnicodeCharacter{1E80}{\`W}%
  10162. \DeclareUnicodeCharacter{1E81}{\`w}%
  10163. \DeclareUnicodeCharacter{1E82}{\'W}%
  10164. \DeclareUnicodeCharacter{1E83}{\'w}%
  10165. \DeclareUnicodeCharacter{1E84}{\"W}%
  10166. \DeclareUnicodeCharacter{1E85}{\"w}%
  10167. \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
  10168. \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
  10169. \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
  10170. \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
  10171. \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
  10172. \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
  10173. \DeclareUnicodeCharacter{1E8C}{\"X}%
  10174. \DeclareUnicodeCharacter{1E8D}{\"x}%
  10175. \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
  10176. \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
  10177. %
  10178. \DeclareUnicodeCharacter{1E90}{\^Z}%
  10179. \DeclareUnicodeCharacter{1E91}{\^z}%
  10180. \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
  10181. \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
  10182. \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
  10183. \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
  10184. \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
  10185. \DeclareUnicodeCharacter{1E97}{\"t}%
  10186. \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
  10187. \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
  10188. %
  10189. \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
  10190. \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
  10191. %
  10192. \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
  10193. \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
  10194. \DeclareUnicodeCharacter{1EBC}{\~E}%
  10195. \DeclareUnicodeCharacter{1EBD}{\~e}%
  10196. %
  10197. \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
  10198. \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
  10199. \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
  10200. \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
  10201. %
  10202. \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
  10203. \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
  10204. %
  10205. \DeclareUnicodeCharacter{1EF2}{\`Y}%
  10206. \DeclareUnicodeCharacter{1EF3}{\`y}%
  10207. \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
  10208. %
  10209. \DeclareUnicodeCharacter{1EF8}{\~Y}%
  10210. \DeclareUnicodeCharacter{1EF9}{\~y}%
  10211. %
  10212. % Punctuation
  10213. \DeclareUnicodeCharacter{2013}{--}%
  10214. \DeclareUnicodeCharacter{2014}{---}%
  10215. \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
  10216. \DeclareUnicodeCharacter{2019}{\quoteright{}}%
  10217. \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
  10218. \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
  10219. \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
  10220. \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
  10221. \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
  10222. \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
  10223. \DeclareUnicodeCharacter{2022}{\bullet{}}%
  10224. \DeclareUnicodeCharacter{202F}{\thinspace}%
  10225. \DeclareUnicodeCharacter{2026}{\dots{}}%
  10226. \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
  10227. \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
  10228. %
  10229. \DeclareUnicodeCharacter{20AC}{\euro{}}%
  10230. %
  10231. \DeclareUnicodeCharacter{2192}{\expansion{}}%
  10232. \DeclareUnicodeCharacter{21D2}{\result{}}%
  10233. %
  10234. % Mathematical symbols
  10235. \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
  10236. \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
  10237. \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
  10238. \DeclareUnicodeCharacter{2212}{\minus{}}%
  10239. \DeclareUnicodeCharacter{2217}{\ast}%
  10240. \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
  10241. \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
  10242. \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
  10243. \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
  10244. \DeclareUnicodeCharacter{2261}{\equiv{}}%
  10245. \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
  10246. \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
  10247. \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
  10248. \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
  10249. %
  10250. \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
  10251. \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
  10252. \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
  10253. \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
  10254. \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
  10255. \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
  10256. \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
  10257. \DeclareUnicodeCharacter{2127}{\ensuremath\mho}%
  10258. \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
  10259. \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
  10260. \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
  10261. \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
  10262. \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
  10263. \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
  10264. \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
  10265. \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
  10266. \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
  10267. \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
  10268. \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
  10269. \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
  10270. \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
  10271. \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
  10272. \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
  10273. \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}%
  10274. \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
  10275. \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
  10276. \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
  10277. \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
  10278. \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
  10279. \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
  10280. \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
  10281. \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
  10282. \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}%
  10283. \DeclareUnicodeCharacter{2201}{\ensuremath\complement}%
  10284. \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
  10285. \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
  10286. \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
  10287. \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
  10288. \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
  10289. \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
  10290. \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
  10291. \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
  10292. \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
  10293. \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
  10294. \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
  10295. \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
  10296. \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
  10297. \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
  10298. \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
  10299. \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
  10300. \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
  10301. \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
  10302. \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
  10303. \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
  10304. \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
  10305. \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
  10306. \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
  10307. \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
  10308. \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
  10309. \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
  10310. \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
  10311. \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
  10312. \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
  10313. \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
  10314. \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
  10315. \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
  10316. \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
  10317. \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}%
  10318. \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}%
  10319. \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
  10320. \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
  10321. \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
  10322. \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
  10323. \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
  10324. \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
  10325. \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
  10326. \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
  10327. \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
  10328. \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
  10329. \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
  10330. \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
  10331. \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
  10332. \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
  10333. \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}%
  10334. \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}%
  10335. \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
  10336. \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
  10337. \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
  10338. \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
  10339. \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
  10340. \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
  10341. \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
  10342. \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
  10343. \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
  10344. \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
  10345. \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
  10346. \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
  10347. \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
  10348. \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
  10349. %
  10350. \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}%
  10351. \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
  10352. \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
  10353. \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
  10354. \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
  10355. \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}%
  10356. \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
  10357. \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
  10358. \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
  10359. \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
  10360. \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
  10361. \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
  10362. \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
  10363. \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
  10364. \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
  10365. \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
  10366. \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
  10367. \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
  10368. \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
  10369. \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
  10370. \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
  10371. \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
  10372. \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
  10373. \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
  10374. \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
  10375. \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
  10376. \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
  10377. \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}%
  10378. \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
  10379. \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
  10380. \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
  10381. %
  10382. \global\mathchardef\checkmark="1370% actually the square root sign
  10383. \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
  10384. }% end of \unicodechardefs
  10385. % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
  10386. % It makes the setting that replace UTF-8 byte sequence.
  10387. \def\utfeightchardefs{%
  10388. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
  10389. \unicodechardefs
  10390. }
  10391. % Whether the active definitions of non-ASCII characters expand to
  10392. % non-active tokens with the same character code. This is used to
  10393. % write characters literally, instead of using active definitions for
  10394. % printing the correct glyphs.
  10395. \newif\ifpassthroughchars
  10396. \passthroughcharsfalse
  10397. % For native Unicode handling (XeTeX and LuaTeX),
  10398. % provide a definition macro to replace/pass-through a Unicode character
  10399. %
  10400. \def\DeclareUnicodeCharacterNative#1#2{%
  10401. \catcode"#1=\active
  10402. \def\dodeclareunicodecharacternative##1##2##3{%
  10403. \begingroup
  10404. \uccode`\~="##2\relax
  10405. \uppercase{\gdef~}{%
  10406. \ifpassthroughchars
  10407. ##1%
  10408. \else
  10409. ##3%
  10410. \fi
  10411. }
  10412. \endgroup
  10413. }
  10414. \begingroup
  10415. \uccode`\.="#1\relax
  10416. \uppercase{\def\UTFNativeTmp{.}}%
  10417. \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
  10418. \endgroup
  10419. }
  10420. % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
  10421. % It activates the setting that replaces Unicode characters.
  10422. \def\nativeunicodechardefs{%
  10423. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
  10424. \unicodechardefs
  10425. }
  10426. % For native Unicode handling (XeTeX and LuaTeX),
  10427. % make the character token expand
  10428. % to the sequences given in \unicodechardefs for printing.
  10429. \def\DeclareUnicodeCharacterNativeAtU#1#2{%
  10430. \def\UTFAtUTmp{#2}
  10431. \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
  10432. }
  10433. % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
  10434. \def\nativeunicodechardefsatu{%
  10435. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
  10436. \unicodechardefs
  10437. }
  10438. % US-ASCII character definitions.
  10439. \def\asciichardefs{% nothing need be done
  10440. \relax
  10441. }
  10442. % define all Unicode characters we know about, for the sake of @U.
  10443. \iftxinativeunicodecapable
  10444. \nativeunicodechardefsatu
  10445. \else
  10446. \utfeightchardefs
  10447. \fi
  10448. % Make non-ASCII characters printable again for compatibility with
  10449. % existing Texinfo documents that may use them, even without declaring a
  10450. % document encoding.
  10451. %
  10452. \setnonasciicharscatcode \other
  10453. \message{formatting,}
  10454. \newdimen\defaultparindent \defaultparindent = 15pt
  10455. \chapheadingskip = 15pt plus 4pt minus 2pt
  10456. \secheadingskip = 12pt plus 3pt minus 2pt
  10457. \subsecheadingskip = 9pt plus 2pt minus 2pt
  10458. % Prevent underfull vbox error messages.
  10459. \vbadness = 10000
  10460. % Don't be very finicky about underfull hboxes, either.
  10461. \hbadness = 6666
  10462. % Following George Bush, get rid of widows and orphans.
  10463. \widowpenalty=10000
  10464. \clubpenalty=10000
  10465. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  10466. % using an old version of TeX, don't do anything. We want the amount of
  10467. % stretch added to depend on the line length, hence the dependence on
  10468. % \hsize. We call this whenever the paper size is set.
  10469. %
  10470. \def\setemergencystretch{%
  10471. \ifx\emergencystretch\thisisundefined
  10472. % Allow us to assign to \emergencystretch anyway.
  10473. \def\emergencystretch{\dimen0}%
  10474. \else
  10475. \emergencystretch = .15\hsize
  10476. \fi
  10477. }
  10478. % Parameters in order: 1) textheight; 2) textwidth;
  10479. % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
  10480. % 7) physical page height; 8) physical page width.
  10481. %
  10482. % We also call \setleading{\textleading}, so the caller should define
  10483. % \textleading. The caller should also set \parskip.
  10484. %
  10485. \def\internalpagesizes#1#2#3#4#5#6#7#8{%
  10486. \voffset = #3\relax
  10487. \topskip = #6\relax
  10488. \splittopskip = \topskip
  10489. %
  10490. \vsize = #1\relax
  10491. \advance\vsize by \topskip
  10492. \outervsize = \vsize
  10493. \advance\outervsize by 2\topandbottommargin
  10494. \txipageheight = \vsize
  10495. %
  10496. \hsize = #2\relax
  10497. \outerhsize = \hsize
  10498. \advance\outerhsize by 0.5in
  10499. \txipagewidth = \hsize
  10500. %
  10501. \normaloffset = #4\relax
  10502. \bindingoffset = #5\relax
  10503. %
  10504. \ifpdf
  10505. \pdfpageheight #7\relax
  10506. \pdfpagewidth #8\relax
  10507. % if we don't reset these, they will remain at "1 true in" of
  10508. % whatever layout pdftex was dumped with.
  10509. \pdfhorigin = 1 true in
  10510. \pdfvorigin = 1 true in
  10511. \else
  10512. \ifx\XeTeXrevision\thisisundefined
  10513. \special{papersize=#8,#7}%
  10514. \else
  10515. \pdfpageheight #7\relax
  10516. \pdfpagewidth #8\relax
  10517. % XeTeX does not have \pdfhorigin and \pdfvorigin.
  10518. \fi
  10519. \fi
  10520. %
  10521. \setleading{\textleading}
  10522. %
  10523. \parindent = \defaultparindent
  10524. \setemergencystretch
  10525. }
  10526. % @letterpaper (the default).
  10527. \def\letterpaper{{\globaldefs = 1
  10528. \parskip = 3pt plus 2pt minus 1pt
  10529. \textleading = 13.2pt
  10530. %
  10531. % If page is nothing but text, make it come out even.
  10532. \internalpagesizes{607.2pt}{6in}% that's 46 lines
  10533. {\voffset}{.25in}%
  10534. {\bindingoffset}{36pt}%
  10535. {11in}{8.5in}%
  10536. }}
  10537. % Use @smallbook to reset parameters for 7x9.25 trim size.
  10538. \def\smallbook{{\globaldefs = 1
  10539. \parskip = 2pt plus 1pt
  10540. \textleading = 12pt
  10541. %
  10542. \internalpagesizes{7.5in}{5in}%
  10543. {-.2in}{0in}%
  10544. {\bindingoffset}{16pt}%
  10545. {9.25in}{7in}%
  10546. %
  10547. \lispnarrowing = 0.3in
  10548. \tolerance = 700
  10549. \contentsrightmargin = 0pt
  10550. \defbodyindent = .5cm
  10551. }}
  10552. % Use @smallerbook to reset parameters for 6x9 trim size.
  10553. % (Just testing, parameters still in flux.)
  10554. \def\smallerbook{{\globaldefs = 1
  10555. \parskip = 1.5pt plus 1pt
  10556. \textleading = 12pt
  10557. %
  10558. \internalpagesizes{7.4in}{4.8in}%
  10559. {-.2in}{-.4in}%
  10560. {0pt}{14pt}%
  10561. {9in}{6in}%
  10562. %
  10563. \lispnarrowing = 0.25in
  10564. \tolerance = 700
  10565. \contentsrightmargin = 0pt
  10566. \defbodyindent = .4cm
  10567. }}
  10568. % Use @afourpaper to print on European A4 paper.
  10569. \def\afourpaper{{\globaldefs = 1
  10570. \parskip = 3pt plus 2pt minus 1pt
  10571. \textleading = 13.2pt
  10572. %
  10573. % Double-side printing via postscript on Laserjet 4050
  10574. % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  10575. % To change the settings for a different printer or situation, adjust
  10576. % \normaloffset until the front-side and back-side texts align. Then
  10577. % do the same for \bindingoffset. You can set these for testing in
  10578. % your texinfo source file like this:
  10579. % @tex
  10580. % \global\normaloffset = -6mm
  10581. % \global\bindingoffset = 10mm
  10582. % @end tex
  10583. \internalpagesizes{673.2pt}{160mm}% that's 51 lines
  10584. {\voffset}{\hoffset}%
  10585. {\bindingoffset}{44pt}%
  10586. {297mm}{210mm}%
  10587. %
  10588. \tolerance = 700
  10589. \contentsrightmargin = 0pt
  10590. \defbodyindent = 5mm
  10591. }}
  10592. % Use @afivepaper to print on European A5 paper.
  10593. % From romildo@urano.iceb.ufop.br, 2 July 2000.
  10594. % He also recommends making @example and @lisp be small.
  10595. \def\afivepaper{{\globaldefs = 1
  10596. \parskip = 2pt plus 1pt minus 0.1pt
  10597. \textleading = 12.5pt
  10598. %
  10599. \internalpagesizes{160mm}{120mm}%
  10600. {\voffset}{\hoffset}%
  10601. {\bindingoffset}{8pt}%
  10602. {210mm}{148mm}%
  10603. %
  10604. \lispnarrowing = 0.2in
  10605. \tolerance = 800
  10606. \contentsrightmargin = 0pt
  10607. \defbodyindent = 2mm
  10608. \tableindent = 12mm
  10609. }}
  10610. % A specific text layout, 24x15cm overall, intended for A4 paper.
  10611. \def\afourlatex{{\globaldefs = 1
  10612. \afourpaper
  10613. \internalpagesizes{237mm}{150mm}%
  10614. {\voffset}{4.6mm}%
  10615. {\bindingoffset}{7mm}%
  10616. {297mm}{210mm}%
  10617. %
  10618. % Must explicitly reset to 0 because we call \afourpaper.
  10619. \globaldefs = 0
  10620. }}
  10621. % Use @afourwide to print on A4 paper in landscape format.
  10622. \def\afourwide{{\globaldefs = 1
  10623. \afourpaper
  10624. \internalpagesizes{241mm}{165mm}%
  10625. {\voffset}{-2.95mm}%
  10626. {\bindingoffset}{7mm}%
  10627. {297mm}{210mm}%
  10628. \globaldefs = 0
  10629. }}
  10630. % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  10631. % Perhaps we should allow setting the margins, \topskip, \parskip,
  10632. % and/or leading, also. Or perhaps we should compute them somehow.
  10633. %
  10634. \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
  10635. \def\pagesizesyyy#1,#2,#3\finish{{%
  10636. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  10637. \globaldefs = 1
  10638. %
  10639. \parskip = 3pt plus 2pt minus 1pt
  10640. \setleading{\textleading}%
  10641. %
  10642. \dimen0 = #1\relax
  10643. \advance\dimen0 by \voffset
  10644. %
  10645. \dimen2 = \hsize
  10646. \advance\dimen2 by \normaloffset
  10647. %
  10648. \internalpagesizes{#1}{\hsize}%
  10649. {\voffset}{\normaloffset}%
  10650. {\bindingoffset}{44pt}%
  10651. {\dimen0}{\dimen2}%
  10652. }}
  10653. % Set default to letter.
  10654. %
  10655. \letterpaper
  10656. % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
  10657. \hfuzz = 1pt
  10658. \message{and turning on texinfo input format.}
  10659. \def^^L{\par} % remove \outer, so ^L can appear in an @comment
  10660. % DEL is a comment character, in case @c does not suffice.
  10661. \catcode`\^^? = 14
  10662. % Define macros to output various characters with catcode for normal text.
  10663. \catcode`\"=\other \def\normaldoublequote{"}
  10664. \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
  10665. \catcode`\+=\other \def\normalplus{+}
  10666. \catcode`\<=\other \def\normalless{<}
  10667. \catcode`\>=\other \def\normalgreater{>}
  10668. \catcode`\^=\other \def\normalcaret{^}
  10669. \catcode`\_=\other \def\normalunderscore{_}
  10670. \catcode`\|=\other \def\normalverticalbar{|}
  10671. \catcode`\~=\other \def\normaltilde{~}
  10672. % This macro is used to make a character print one way in \tt
  10673. % (where it can probably be output as-is), and another way in other fonts,
  10674. % where something hairier probably needs to be done.
  10675. %
  10676. % #1 is what to print if we are indeed using \tt; #2 is what to print
  10677. % otherwise. Since all the Computer Modern typewriter fonts have zero
  10678. % interword stretch (and shrink), and it is reasonable to expect all
  10679. % typewriter fonts to have this, we can check that font parameter.
  10680. %
  10681. \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
  10682. % Same as above, but check for italic font. Actually this also catches
  10683. % non-italic slanted fonts since it is impossible to distinguish them from
  10684. % italic fonts. But since this is only used by $ and it uses \sl anyway
  10685. % this is not a problem.
  10686. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
  10687. % Set catcodes for Texinfo file
  10688. % Active characters for printing the wanted glyph.
  10689. % Most of these we simply print from the \tt font, but for some, we can
  10690. % use math or other variants that look better in normal text.
  10691. %
  10692. \catcode`\"=\active
  10693. \def\activedoublequote{{\tt\char34}}
  10694. \let"=\activedoublequote
  10695. \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
  10696. \chardef\hatchar=`\^
  10697. \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
  10698. \catcode`\_=\active
  10699. \def_{\ifusingtt\normalunderscore\_}
  10700. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
  10701. \let\realunder=_
  10702. \catcode`\|=\active \def|{{\tt\char124}}
  10703. \chardef \less=`\<
  10704. \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
  10705. \chardef \gtr=`\>
  10706. \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
  10707. \catcode`\+=\active \def+{{\tt \char 43}}
  10708. \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  10709. \catcode`\-=\active \let-=\normaldash
  10710. % used for headline/footline in the output routine, in case the page
  10711. % breaks in the middle of an @tex block.
  10712. \def\texinfochars{%
  10713. \let< = \activeless
  10714. \let> = \activegtr
  10715. \let~ = \activetilde
  10716. \let^ = \activehat
  10717. \markupsetuplqdefault \markupsetuprqdefault
  10718. \let\b = \strong
  10719. \let\i = \smartitalic
  10720. % in principle, all other definitions in \tex have to be undone too.
  10721. }
  10722. % Used sometimes to turn off (effectively) the active characters even after
  10723. % parsing them.
  10724. \def\turnoffactive{%
  10725. \normalturnoffactive
  10726. \otherbackslash
  10727. }
  10728. \catcode`\@=0
  10729. % \backslashcurfont outputs one backslash character in current font,
  10730. % as in \char`\\.
  10731. \global\chardef\backslashcurfont=`\\
  10732. \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
  10733. % \realbackslash is an actual character `\' with catcode other, and
  10734. % \doublebackslash is two of them (for the pdf outlines).
  10735. {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
  10736. % In Texinfo, backslash is an active character; it prints the backslash
  10737. % in fixed width font.
  10738. \catcode`\\=\active % @ for escape char from now on.
  10739. % Print a typewriter backslash. For math mode, we can't simply use
  10740. % \backslashcurfont: the story here is that in math mode, the \char
  10741. % of \backslashcurfont ends up printing the roman \ from the math symbol
  10742. % font (because \char in math mode uses the \mathcode, and plain.tex
  10743. % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
  10744. % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
  10745. % ignored family value; char position "5C). We can't use " for the
  10746. % usual hex value because it has already been made active.
  10747. @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
  10748. @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
  10749. % \rawbackslash defines an active \ to do \backslashcurfont.
  10750. % \otherbackslash defines an active \ to be a literal `\' character with
  10751. % catcode other. We switch back and forth between these.
  10752. @gdef@rawbackslash{@let\=@backslashcurfont}
  10753. @gdef@otherbackslash{@let\=@realbackslash}
  10754. % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  10755. % the literal character `\'.
  10756. %
  10757. {@catcode`- = @active
  10758. @gdef@normalturnoffactive{%
  10759. @passthroughcharstrue
  10760. @let-=@normaldash
  10761. @let"=@normaldoublequote
  10762. @let$=@normaldollar %$ font-lock fix
  10763. @let+=@normalplus
  10764. @let<=@normalless
  10765. @let>=@normalgreater
  10766. @let^=@normalcaret
  10767. @let_=@normalunderscore
  10768. @let|=@normalverticalbar
  10769. @let~=@normaltilde
  10770. @let\=@ttbackslash
  10771. @markupsetuplqdefault
  10772. @markupsetuprqdefault
  10773. @unsepspaces
  10774. }
  10775. }
  10776. % If a .fmt file is being used, characters that might appear in a file
  10777. % name cannot be active until we have parsed the command line.
  10778. % So turn them off again, and have @fixbackslash turn them back on.
  10779. @catcode`+=@other @catcode`@_=@other
  10780. % \enablebackslashhack - allow file to begin `\input texinfo'
  10781. %
  10782. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  10783. % That is what \eatinput is for; after that, the `\' should revert to printing
  10784. % a backslash.
  10785. % If the file did not have a `\input texinfo', then it is turned off after
  10786. % the first line; otherwise the first `\' in the file would cause an error.
  10787. % This is used on the very last line of this file, texinfo.tex.
  10788. % We also use @c to call @fixbackslash, in case ends of lines are hidden.
  10789. {
  10790. @catcode`@^=7
  10791. @catcode`@^^M=13@gdef@enablebackslashhack{%
  10792. @global@let\ = @eatinput%
  10793. @catcode`@^^M=13%
  10794. @def@c{@fixbackslash@c}%
  10795. % Definition for the newline at the end of this file.
  10796. @def ^^M{@let^^M@secondlinenl}%
  10797. % Definition for a newline in the main Texinfo file.
  10798. @gdef @secondlinenl{@fixbackslash}%
  10799. % In case the first line has a whole-line command on it
  10800. @let@originalparsearg@parsearg
  10801. @def@parsearg{@fixbackslash@originalparsearg}
  10802. }}
  10803. {@catcode`@^=7 @catcode`@^^M=13%
  10804. @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
  10805. % Emergency active definition of newline, in case an active newline token
  10806. % appears by mistake.
  10807. {@catcode`@^=7 @catcode13=13%
  10808. @gdef@enableemergencynewline{%
  10809. @gdef^^M{%
  10810. @par%
  10811. %<warning: active newline>@par%
  10812. }}}
  10813. @gdef@fixbackslash{%
  10814. @ifx\@eatinput @let\ = @ttbackslash @fi
  10815. @catcode13=5 % regular end of line
  10816. @enableemergencynewline
  10817. @let@c=@texinfoc
  10818. @let@parsearg@originalparsearg
  10819. % Also turn back on active characters that might appear in the input
  10820. % file name, in case not using a pre-dumped format.
  10821. @catcode`+=@active
  10822. @catcode`@_=@active
  10823. %
  10824. % If texinfo.cnf is present on the system, read it.
  10825. % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
  10826. % called at the beginning of every Texinfo file. Not opening texinfo.cnf
  10827. % directly in this file, texinfo.tex, makes it possible to make a format
  10828. % file for Texinfo.
  10829. %
  10830. @openin 1 texinfo.cnf
  10831. @ifeof 1 @else @input texinfo.cnf @fi
  10832. @closein 1
  10833. }
  10834. % Say @foo, not \foo, in error messages.
  10835. @escapechar = `@@
  10836. % These (along with & and #) are made active for url-breaking, so need
  10837. % active definitions as the normal characters.
  10838. @def@normaldot{.}
  10839. @def@normalquest{?}
  10840. @def@normalslash{/}
  10841. % These look ok in all fonts, so just make them not special.
  10842. % @hashchar{} gets its own user-level command, because of #line.
  10843. @catcode`@& = @other @def@normalamp{&}
  10844. @catcode`@# = @other @def@normalhash{#}
  10845. @catcode`@% = @other @def@normalpercent{%}
  10846. @let @hashchar = @normalhash
  10847. @c Finally, make ` and ' active, so that txicodequoteundirected and
  10848. @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
  10849. @c don't make ` and ' active, @code will not get them as active chars.
  10850. @c Do this last of all since we use ` in the previous @catcode assignments.
  10851. @catcode`@'=@active
  10852. @catcode`@`=@active
  10853. @markupsetuplqdefault
  10854. @markupsetuprqdefault
  10855. @c Local variables:
  10856. @c eval: (add-hook 'write-file-hooks 'time-stamp)
  10857. @c page-delimiter: "^\\\\message\\|emacs-page"
  10858. @c time-stamp-start: "def\\\\texinfoversion{"
  10859. @c time-stamp-format: "%:y-%02m-%02d.%02H"
  10860. @c time-stamp-end: "}"
  10861. @c End:
  10862. @c vim:sw=2:
  10863. @enablebackslashhack