texinfo.tex 372 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685
  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-06-04.19}
  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\dotheinsertentrybox\dotheinsertentryboxwithpenalty
  5099. %
  5100. % Read input from the index file line by line.
  5101. \loopdo
  5102. \ifeof1 \else
  5103. \read 1 to \nextline
  5104. \fi
  5105. %
  5106. \indexinputprocessing
  5107. \thisline
  5108. %
  5109. \ifeof1\else
  5110. \let\thisline\nextline
  5111. \repeat
  5112. %%
  5113. \enddoublecolumns
  5114. \fi
  5115. \fi
  5116. \closein 1
  5117. \endgroup}
  5118. \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
  5119. \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
  5120. \def\indexinputprocessing{%
  5121. \ifeof1
  5122. \let\firsttoken\relax
  5123. \else
  5124. \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
  5125. \act
  5126. \fi
  5127. }
  5128. \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
  5129. \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
  5130. % These macros are used by the sorted index file itself.
  5131. % Change them to control the appearance of the index.
  5132. {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
  5133. \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
  5134. \catcode`\$=3
  5135. \gdef\initialglyphs{%
  5136. % Some changes for non-alphabetic characters. Using the glyphs from the
  5137. % math fonts looks more consistent than the typewriter font used elsewhere
  5138. % for these characters.
  5139. \def\indexbackslash{\math{\backslash}}%
  5140. \let\\=\indexbackslash
  5141. %
  5142. % Can't get bold backslash so don't use bold forward slash
  5143. \catcode`\/=13
  5144. \def/{{\secrmnotbold \normalslash}}%
  5145. \def-{{\normaldash\normaldash}}% en dash `--'
  5146. \def^{{\chapbf \normalcaret}}%
  5147. \def~{{\chapbf \normaltilde}}%
  5148. \def\_{%
  5149. \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
  5150. \def|{$\vert$}%
  5151. \def<{$\less$}%
  5152. \def>{$\gtr$}%
  5153. \def+{$\normalplus$}%
  5154. }}
  5155. \def\initial{%
  5156. \bgroup
  5157. \initialglyphs
  5158. \initialx
  5159. }
  5160. \def\initialx#1{%
  5161. % Remove any glue we may have, we'll be inserting our own.
  5162. \removelastskip
  5163. %
  5164. % We like breaks before the index initials, so insert a bonus.
  5165. % The glue before the bonus allows a little bit of space at the
  5166. % bottom of a column to reduce an increase in inter-line spacing.
  5167. \nobreak
  5168. \vskip 0pt plus 5\baselineskip
  5169. \penalty -300
  5170. \vskip 0pt plus -5\baselineskip
  5171. %
  5172. % Typeset the initial. Making this add up to a whole number of
  5173. % baselineskips increases the chance of the dots lining up from column
  5174. % to column. It still won't often be perfect, because of the stretch
  5175. % we need before each entry, but it's better.
  5176. %
  5177. % No shrink because it confuses \balancecolumns.
  5178. \vskip 1.67\baselineskip plus 1\baselineskip
  5179. \leftline{\secfonts \kern-0.05em \secbf #1}%
  5180. % \secfonts is inside the argument of \leftline so that the change of
  5181. % \baselineskip will not affect any glue inserted before the vbox that
  5182. % \leftline creates.
  5183. % Do our best not to break after the initial.
  5184. \nobreak
  5185. \vskip .33\baselineskip plus .1\baselineskip
  5186. \egroup % \initialglyphs
  5187. }
  5188. \newdimen\entryrightmargin
  5189. \entryrightmargin=0pt
  5190. % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
  5191. % then page number (#2) flushed to the right margin. It is used for index
  5192. % and table of contents entries. The paragraph is indented by \leftskip.
  5193. %
  5194. \def\entry{%
  5195. \begingroup
  5196. %
  5197. % For pdfTeX and XeTeX.
  5198. % The redefinition of \domark stops marks being added in \pdflink to
  5199. % preserve coloured links across page boundaries. Otherwise the marks
  5200. % would get in the way of \lastbox in \insertentrybox.
  5201. \let\domark\relax
  5202. %
  5203. % Start a new paragraph if necessary, so our assignments below can't
  5204. % affect previous text.
  5205. \par
  5206. %
  5207. % No extra space above this paragraph.
  5208. \parskip = 0in
  5209. %
  5210. % When reading the text of entry, convert explicit line breaks
  5211. % from @* into spaces. The user might give these in long section
  5212. % titles, for instance.
  5213. \def\*{\unskip\space\ignorespaces}%
  5214. \def\entrybreak{\hfil\break}% An undocumented command
  5215. %
  5216. % Swallow the left brace of the text (first parameter):
  5217. \afterassignment\doentry
  5218. \let\temp =
  5219. }
  5220. \def\entrybreak{\unskip\space\ignorespaces}%
  5221. \def\doentry{%
  5222. % Save the text of the entry
  5223. \global\setbox\boxA=\hbox\bgroup
  5224. \bgroup % Instead of the swallowed brace.
  5225. \noindent
  5226. \aftergroup\finishentry
  5227. % And now comes the text of the entry.
  5228. % Not absorbing as a macro argument reduces the chance of problems
  5229. % with catcodes occurring.
  5230. }
  5231. {\catcode`\@=11
  5232. \gdef\finishentry#1{%
  5233. \egroup % end box A
  5234. \dimen@ = \wd\boxA % Length of text of entry
  5235. \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
  5236. % #1 is the page number.
  5237. %
  5238. % Get the width of the page numbers, and only use
  5239. % leaders if they are present.
  5240. \global\setbox\boxB = \hbox{#1}%
  5241. \ifdim\wd\boxB = 0pt
  5242. \null\nobreak\hfill\ %
  5243. \else
  5244. %
  5245. \null\nobreak\indexdotfill % Have leaders before the page number.
  5246. %
  5247. \ifpdf
  5248. \pdfgettoks#1.%
  5249. \hskip\skip\thinshrinkable\the\toksA
  5250. \else
  5251. \ifx\XeTeXrevision\thisisundefined
  5252. \hskip\skip\thinshrinkable #1%
  5253. \else
  5254. \pdfgettoks#1.%
  5255. \hskip\skip\thinshrinkable\the\toksA
  5256. \fi
  5257. \fi
  5258. \fi
  5259. \egroup % end \boxA
  5260. \ifdim\wd\boxB = 0pt
  5261. \global\setbox\entrybox=\vbox{\unhbox\boxA}%
  5262. \else
  5263. \global\setbox\entrybox=\vbox\bgroup
  5264. % We want the text of the entries to be aligned to the left, and the
  5265. % page numbers to be aligned to the right.
  5266. %
  5267. \parindent = 0pt
  5268. \advance\leftskip by 0pt plus 1fil
  5269. \advance\leftskip by 0pt plus -1fill
  5270. \rightskip = 0pt plus -1fil
  5271. \advance\rightskip by 0pt plus 1fill
  5272. % Cause last line, which could consist of page numbers on their own
  5273. % if the list of page numbers is long, to be aligned to the right.
  5274. \parfillskip=0pt plus -1fill
  5275. %
  5276. \advance\rightskip by \entryrightmargin
  5277. % Determine how far we can stretch into the margin.
  5278. % This allows, e.g., "Appendix H GNU Free Documentation License" to
  5279. % fit on one line in @letterpaper format.
  5280. \ifdim\entryrightmargin>2.1em
  5281. \dimen@i=2.1em
  5282. \else
  5283. \dimen@i=0em
  5284. \fi
  5285. \advance \parfillskip by 0pt minus 1\dimen@i
  5286. %
  5287. \dimen@ii = \hsize
  5288. \advance\dimen@ii by -1\leftskip
  5289. \advance\dimen@ii by -1\entryrightmargin
  5290. \advance\dimen@ii by 1\dimen@i
  5291. \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
  5292. \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
  5293. \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
  5294. \dimen@ii = \hsize
  5295. \ifnum\dimen@>\dimen@ii
  5296. % If the entry is too long, use the whole line
  5297. \dimen@ = \dimen@ii
  5298. \fi
  5299. \advance\leftskip by 0pt plus 1fill % ragged right
  5300. \advance \dimen@ by 1\rightskip
  5301. \parshape = 2 0pt \dimen@ 0em \dimen@ii
  5302. % Ideally we'd add a finite glue at the end of the first line only,
  5303. % instead of using \parshape with explicit line lengths, but TeX
  5304. % doesn't seem to provide a way to do such a thing.
  5305. %
  5306. \leftskip = 1em
  5307. \parindent = -1em
  5308. \fi\fi
  5309. \indent % start paragraph
  5310. \unhbox\boxA
  5311. %
  5312. % Do not prefer a separate line ending with a hyphen to fewer lines.
  5313. \finalhyphendemerits = 0
  5314. %
  5315. % Word spacing - no stretch
  5316. \spaceskip=\fontdimen2\font minus \fontdimen4\font
  5317. %
  5318. \linepenalty=1000 % Discourage line breaks.
  5319. \hyphenpenalty=5000 % Discourage hyphenation.
  5320. %
  5321. \par % format the paragraph
  5322. \egroup % The \vbox
  5323. \fi
  5324. \endgroup
  5325. \dotheinsertentrybox
  5326. }}
  5327. \newskip\thinshrinkable
  5328. \skip\thinshrinkable=.15em minus .15em
  5329. \newbox\entrybox
  5330. \def\insertentrybox{%
  5331. \ourunvbox\entrybox
  5332. }
  5333. % default definition
  5334. \let\dotheinsertentrybox\insertentrybox
  5335. % Use \lastbox to take apart vbox box by box, and add each sub-box
  5336. % to the current vertical list.
  5337. \def\ourunvbox#1{%
  5338. \bgroup % for local binding of \delayedbox
  5339. % Remove the last box from box #1
  5340. \global\setbox#1=\vbox{%
  5341. \unvbox#1%
  5342. \unskip % remove any glue
  5343. \unpenalty
  5344. \global\setbox\interbox=\lastbox
  5345. }%
  5346. \setbox\delayedbox=\box\interbox
  5347. \ifdim\ht#1=0pt\else
  5348. \ourunvbox#1 % Repeat on what's left of the box
  5349. \nobreak
  5350. \fi
  5351. \box\delayedbox
  5352. \egroup
  5353. }
  5354. \newbox\delayedbox
  5355. \newbox\interbox
  5356. % Used from \printindex. \firsttoken should be the first token
  5357. % after the \entry. If it's not another \entry, we are at the last
  5358. % line of a group of index entries, so insert a penalty to discourage
  5359. % widowed index entries.
  5360. \def\dotheinsertentryboxwithpenalty{%
  5361. \ifx\firsttoken\isentry
  5362. \else
  5363. \penalty 9000
  5364. \fi
  5365. \insertentrybox
  5366. }
  5367. \def\isentry{\entry}%
  5368. % Like plain.tex's \dotfill, except uses up at least 1 em.
  5369. % The filll stretch here overpowers both the fil and fill stretch to push
  5370. % the page number to the right.
  5371. \def\indexdotfill{\cleaders
  5372. \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
  5373. \def\primary #1{\line{#1\hfil}}
  5374. \newskip\secondaryindent \secondaryindent=0.5cm
  5375. \def\secondary#1#2{{%
  5376. \parfillskip=0in
  5377. \parskip=0in
  5378. \hangindent=1in
  5379. \hangafter=1
  5380. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  5381. \ifpdf
  5382. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5383. \else
  5384. \ifx\XeTeXrevision\thisisundefined
  5385. #2
  5386. \else
  5387. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5388. \fi
  5389. \fi
  5390. \par
  5391. }}
  5392. % Define two-column mode, which we use to typeset indexes.
  5393. % Adapted from the TeXbook, page 416, which is to say,
  5394. % the manmac.tex format used to print the TeXbook itself.
  5395. \catcode`\@=11 % private names
  5396. \newbox\partialpage
  5397. \newdimen\doublecolumnhsize
  5398. % Use inside an output routine to save \topmark and \firstmark
  5399. \def\savemarks{%
  5400. \global\savedtopmark=\expandafter{\topmark }%
  5401. \global\savedfirstmark=\expandafter{\firstmark }%
  5402. }
  5403. \newtoks\savedtopmark
  5404. \newtoks\savedfirstmark
  5405. % Set \topmark and \firstmark for next time \output runs.
  5406. % Can't be run from withinside \output (because any material
  5407. % added while an output routine is active, including
  5408. % penalties, is saved for after it finishes). The page so far
  5409. % should be empty, otherwise what's on it will be thrown away.
  5410. \def\restoremarks{%
  5411. \mark{\the\savedtopmark}%
  5412. \bgroup\output = {%
  5413. \setbox\dummybox=\box\PAGE
  5414. }abc\eject\egroup
  5415. % "abc" because output routine doesn't fire for a completely empty page.
  5416. \mark{\the\savedfirstmark}%
  5417. }
  5418. \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  5419. % If not much space left on page, start a new page.
  5420. \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
  5421. %
  5422. % Grab any single-column material above us.
  5423. \output = {%
  5424. %
  5425. % Here is a possibility not foreseen in manmac: if we accumulate a
  5426. % whole lot of material, we might end up calling this \output
  5427. % routine twice in a row (see the doublecol-lose test, which is
  5428. % essentially a couple of indexes with @setchapternewpage off). In
  5429. % that case we just ship out what is in \partialpage with the normal
  5430. % output routine. Generally, \partialpage will be empty when this
  5431. % runs and this will be a no-op. See the indexspread.tex test case.
  5432. \ifvoid\partialpage \else
  5433. \onepageout{\pagecontents\partialpage}%
  5434. \fi
  5435. %
  5436. \global\setbox\partialpage = \vbox{%
  5437. % Unvbox the main output page.
  5438. \unvbox\PAGE
  5439. \kern-\topskip \kern\baselineskip
  5440. }%
  5441. \savemarks
  5442. }%
  5443. \eject % run that output routine to set \partialpage
  5444. \restoremarks
  5445. %
  5446. % We recover the two marks that the last output routine saved in order
  5447. % to propagate the information in marks added around a chapter heading,
  5448. % which could be otherwise be lost by the time the final page is output.
  5449. %
  5450. %
  5451. % Use the double-column output routine for subsequent pages.
  5452. \output = {\doublecolumnout}%
  5453. %
  5454. % Change the page size parameters. We could do this once outside this
  5455. % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  5456. % format, but then we repeat the same computation. Repeating a couple
  5457. % of assignments once per index is clearly meaningless for the
  5458. % execution time, so we may as well do it in one place.
  5459. %
  5460. % First we halve the line length, less a little for the gutter between
  5461. % the columns. We compute the gutter based on the line length, so it
  5462. % changes automatically with the paper format. The magic constant
  5463. % below is chosen so that the gutter has the same value (well, +-<1pt)
  5464. % as it did when we hard-coded it.
  5465. %
  5466. % We put the result in a separate register, \doublecolumhsize, so we
  5467. % can restore it in \pagesofar, after \hsize itself has (potentially)
  5468. % been clobbered.
  5469. %
  5470. \doublecolumnhsize = \hsize
  5471. \advance\doublecolumnhsize by -.04154\hsize
  5472. \divide\doublecolumnhsize by 2
  5473. \hsize = \doublecolumnhsize
  5474. %
  5475. % Double the \vsize as well.
  5476. \advance\vsize by -\ht\partialpage
  5477. \vsize = 2\vsize
  5478. %
  5479. % For the benefit of balancing columns
  5480. \advance\baselineskip by 0pt plus 0.5pt
  5481. }
  5482. % The double-column output routine for all double-column pages except
  5483. % the last, which is done by \balancecolumns.
  5484. %
  5485. \def\doublecolumnout{%
  5486. %
  5487. \splittopskip=\topskip \splitmaxdepth=\maxdepth
  5488. % Get the available space for the double columns -- the normal
  5489. % (undoubled) page height minus any material left over from the
  5490. % previous page.
  5491. \dimen@ = \vsize
  5492. \divide\dimen@ by 2
  5493. %
  5494. % box0 will be the left-hand column, box2 the right.
  5495. \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
  5496. \global\advance\vsize by 2\ht\partialpage
  5497. \onepageout\pagesofar
  5498. \unvbox\PAGE
  5499. \penalty\outputpenalty
  5500. }
  5501. %
  5502. % Re-output the contents of the output page -- any previous material,
  5503. % followed by the two boxes we just split, in box0 and box2.
  5504. \def\pagesofar{%
  5505. \unvbox\partialpage
  5506. %
  5507. \hsize = \doublecolumnhsize
  5508. \wd0=\hsize \wd2=\hsize
  5509. \hbox to\txipagewidth{\box0\hfil\box2}%
  5510. }
  5511. % Finished with with double columns.
  5512. \def\enddoublecolumns{%
  5513. % The following penalty ensures that the page builder is exercised
  5514. % _before_ we change the output routine. This is necessary in the
  5515. % following situation:
  5516. %
  5517. % The last section of the index consists only of a single entry.
  5518. % Before this section, \pagetotal is less than \pagegoal, so no
  5519. % break occurs before the last section starts. However, the last
  5520. % section, consisting of \initial and the single \entry, does not
  5521. % fit on the page and has to be broken off. Without the following
  5522. % penalty the page builder will not be exercised until \eject
  5523. % below, and by that time we'll already have changed the output
  5524. % routine to the \balancecolumns version, so the next-to-last
  5525. % double-column page will be processed with \balancecolumns, which
  5526. % is wrong: The two columns will go to the main vertical list, with
  5527. % the broken-off section in the recent contributions. As soon as
  5528. % the output routine finishes, TeX starts reconsidering the page
  5529. % break. The two columns and the broken-off section both fit on the
  5530. % page, because the two columns now take up only half of the page
  5531. % goal. When TeX sees \eject from below which follows the final
  5532. % section, it invokes the new output routine that we've set after
  5533. % \balancecolumns below; \onepageout will try to fit the two columns
  5534. % and the final section into the vbox of \txipageheight (see
  5535. % \pagebody), causing an overfull box.
  5536. %
  5537. % Note that glue won't work here, because glue does not exercise the
  5538. % page builder, unlike penalties (see The TeXbook, pp. 280-281).
  5539. \penalty0
  5540. %
  5541. \output = {%
  5542. % Split the last of the double-column material.
  5543. \savemarks
  5544. \balancecolumns
  5545. %
  5546. % Having called \balancecolumns once, we do not
  5547. % want to call it again. Therefore, reset \output to its normal
  5548. % definition right away.
  5549. \global\output = {\onepageout{\pagecontents\PAGE}}%
  5550. }%
  5551. \eject
  5552. \endgroup % started in \begindoublecolumns
  5553. \restoremarks
  5554. % Leave the double-column material on the current page, no automatic
  5555. % page break.
  5556. \box\balancedcolumns
  5557. %
  5558. % \pagegoal was set to the doubled \vsize above, since we restarted
  5559. % the current page. We're now back to normal single-column
  5560. % typesetting, so reset \pagegoal to the normal \vsize.
  5561. \global\vsize = \txipageheight %
  5562. \pagegoal = \txipageheight %
  5563. }
  5564. \newbox\balancedcolumns
  5565. \setbox\balancedcolumns=\vbox{shouldnt see this}%
  5566. %
  5567. % Only called for the last of the double column material. \doublecolumnout
  5568. % does the others.
  5569. \def\balancecolumns{%
  5570. \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
  5571. \dimen@ = \ht0
  5572. \advance\dimen@ by \topskip
  5573. \advance\dimen@ by-\baselineskip
  5574. \ifdim\dimen@<5\baselineskip
  5575. % Don't split a short final column in two.
  5576. \setbox2=\vbox{}%
  5577. \else
  5578. \divide\dimen@ by 2 % target to split to
  5579. \dimen@ii = \dimen@
  5580. \splittopskip = \topskip
  5581. % Loop until left column is at least as high as the right column.
  5582. {%
  5583. \vbadness = 10000
  5584. \loop
  5585. \global\setbox3 = \copy0
  5586. \global\setbox1 = \vsplit3 to \dimen@
  5587. \ifdim\ht1<\ht3
  5588. \global\advance\dimen@ by 1pt
  5589. \repeat
  5590. }%
  5591. % Now the left column is in box 1, and the right column in box 3.
  5592. % Check whether the left column has come out higher than the page itself.
  5593. % (Note that we have doubled \vsize for the double columns, so
  5594. % the actual height of the page is 0.5\vsize).
  5595. \ifdim2\ht1>\vsize
  5596. % Just split the last of the double column material roughly in half.
  5597. \setbox2=\box0
  5598. \setbox0 = \vsplit2 to \dimen@ii
  5599. \setbox0=\vbox to \dimen@ii {\unvbox0\vfill}%
  5600. \setbox2=\vbox to \dimen@ii {\unvbox2\vfill}%
  5601. \else
  5602. % Compare the heights of the two columns.
  5603. \ifdim4\ht1>5\ht3
  5604. % Column heights are too different, so don't make their bottoms
  5605. % flush with each other.
  5606. \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
  5607. \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
  5608. \else
  5609. % Make column bottoms flush with each other.
  5610. \setbox2=\vbox to\ht1{\unvbox3\unskip}%
  5611. \setbox0=\vbox to\ht1{\unvbox1\unskip}%
  5612. \fi
  5613. \fi
  5614. \fi
  5615. %
  5616. \global\setbox\balancedcolumns=\vbox{\pagesofar}%
  5617. }
  5618. \catcode`\@ = \other
  5619. \message{sectioning,}
  5620. % Chapters, sections, etc.
  5621. % Let's start with @part.
  5622. \outer\parseargdef\part{\partzzz{#1}}
  5623. \def\partzzz#1{%
  5624. \chapoddpage
  5625. \null
  5626. \vskip.3\vsize % move it down on the page a bit
  5627. \begingroup
  5628. \noindent \titlefonts\rm #1\par % the text
  5629. \let\lastnode=\empty % no node to associate with
  5630. \writetocentry{part}{#1}{}% but put it in the toc
  5631. \headingsoff % no headline or footline on the part page
  5632. % This outputs a mark at the end of the page that clears \thischapter
  5633. % and \thissection, as is done in \startcontents.
  5634. \let\pchapsepmacro\relax
  5635. \chapmacro{}{Yomitfromtoc}{}%
  5636. \chapoddpage
  5637. \endgroup
  5638. }
  5639. % \unnumberedno is an oxymoron. But we count the unnumbered
  5640. % sections so that we can refer to them unambiguously in the pdf
  5641. % outlines by their "section number". We avoid collisions with chapter
  5642. % numbers by starting them at 10000. (If a document ever has 10000
  5643. % chapters, we're in trouble anyway, I'm sure.)
  5644. \newcount\unnumberedno \unnumberedno = 10000
  5645. \newcount\chapno
  5646. \newcount\secno \secno=0
  5647. \newcount\subsecno \subsecno=0
  5648. \newcount\subsubsecno \subsubsecno=0
  5649. % This counter is funny since it counts through charcodes of letters A, B, ...
  5650. \newcount\appendixno \appendixno = `\@
  5651. %
  5652. % \def\appendixletter{\char\the\appendixno}
  5653. % We do the following ugly conditional instead of the above simple
  5654. % construct for the sake of pdftex, which needs the actual
  5655. % letter in the expansion, not just typeset.
  5656. %
  5657. \def\appendixletter{%
  5658. \ifnum\appendixno=`A A%
  5659. \else\ifnum\appendixno=`B B%
  5660. \else\ifnum\appendixno=`C C%
  5661. \else\ifnum\appendixno=`D D%
  5662. \else\ifnum\appendixno=`E E%
  5663. \else\ifnum\appendixno=`F F%
  5664. \else\ifnum\appendixno=`G G%
  5665. \else\ifnum\appendixno=`H H%
  5666. \else\ifnum\appendixno=`I I%
  5667. \else\ifnum\appendixno=`J J%
  5668. \else\ifnum\appendixno=`K K%
  5669. \else\ifnum\appendixno=`L L%
  5670. \else\ifnum\appendixno=`M M%
  5671. \else\ifnum\appendixno=`N N%
  5672. \else\ifnum\appendixno=`O O%
  5673. \else\ifnum\appendixno=`P P%
  5674. \else\ifnum\appendixno=`Q Q%
  5675. \else\ifnum\appendixno=`R R%
  5676. \else\ifnum\appendixno=`S S%
  5677. \else\ifnum\appendixno=`T T%
  5678. \else\ifnum\appendixno=`U U%
  5679. \else\ifnum\appendixno=`V V%
  5680. \else\ifnum\appendixno=`W W%
  5681. \else\ifnum\appendixno=`X X%
  5682. \else\ifnum\appendixno=`Y Y%
  5683. \else\ifnum\appendixno=`Z Z%
  5684. % The \the is necessary, despite appearances, because \appendixletter is
  5685. % expanded while writing the .toc file. \char\appendixno is not
  5686. % expandable, thus it is written literally, thus all appendixes come out
  5687. % with the same letter (or @) in the toc without it.
  5688. \else\char\the\appendixno
  5689. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  5690. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  5691. % Each @chapter defines these (using marks) as the number+name, number
  5692. % and name of the chapter. Page headings and footings can use
  5693. % these. @section does likewise.
  5694. \def\thischapter{}
  5695. \def\thischapternum{}
  5696. \def\thischaptername{}
  5697. \def\thissection{}
  5698. \def\thissectionnum{}
  5699. \def\thissectionname{}
  5700. \newcount\absseclevel % used to calculate proper heading level
  5701. \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
  5702. % @raisesections: treat @section as chapter, @subsection as section, etc.
  5703. \def\raisesections{\global\advance\secbase by -1}
  5704. \let\up=\raisesections % original BFox name
  5705. % @lowersections: treat @chapter as section, @section as subsection, etc.
  5706. \def\lowersections{\global\advance\secbase by 1}
  5707. \let\down=\lowersections % original BFox name
  5708. % we only have subsub.
  5709. \chardef\maxseclevel = 3
  5710. %
  5711. % A numbered section within an unnumbered changes to unnumbered too.
  5712. % To achieve this, remember the "biggest" unnum. sec. we are currently in:
  5713. \chardef\unnlevel = \maxseclevel
  5714. %
  5715. % Trace whether the current chapter is an appendix or not:
  5716. % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
  5717. \def\chapheadtype{N}
  5718. % Choose a heading macro
  5719. % #1 is heading type
  5720. % #2 is heading level
  5721. % #3 is text for heading
  5722. \def\genhead#1#2#3{%
  5723. % Compute the abs. sec. level:
  5724. \absseclevel=#2
  5725. \advance\absseclevel by \secbase
  5726. % Make sure \absseclevel doesn't fall outside the range:
  5727. \ifnum \absseclevel < 0
  5728. \absseclevel = 0
  5729. \else
  5730. \ifnum \absseclevel > 3
  5731. \absseclevel = 3
  5732. \fi
  5733. \fi
  5734. % The heading type:
  5735. \def\headtype{#1}%
  5736. \if \headtype U%
  5737. \ifnum \absseclevel < \unnlevel
  5738. \chardef\unnlevel = \absseclevel
  5739. \fi
  5740. \else
  5741. % Check for appendix sections:
  5742. \ifnum \absseclevel = 0
  5743. \edef\chapheadtype{\headtype}%
  5744. \else
  5745. \if \headtype A\if \chapheadtype N%
  5746. \errmessage{@appendix... within a non-appendix chapter}%
  5747. \fi\fi
  5748. \fi
  5749. % Check for numbered within unnumbered:
  5750. \ifnum \absseclevel > \unnlevel
  5751. \def\headtype{U}%
  5752. \else
  5753. \chardef\unnlevel = 3
  5754. \fi
  5755. \fi
  5756. % Now print the heading:
  5757. \if \headtype U%
  5758. \ifcase\absseclevel
  5759. \unnumberedzzz{#3}%
  5760. \or \unnumberedseczzz{#3}%
  5761. \or \unnumberedsubseczzz{#3}%
  5762. \or \unnumberedsubsubseczzz{#3}%
  5763. \fi
  5764. \else
  5765. \if \headtype A%
  5766. \ifcase\absseclevel
  5767. \appendixzzz{#3}%
  5768. \or \appendixsectionzzz{#3}%
  5769. \or \appendixsubseczzz{#3}%
  5770. \or \appendixsubsubseczzz{#3}%
  5771. \fi
  5772. \else
  5773. \ifcase\absseclevel
  5774. \chapterzzz{#3}%
  5775. \or \seczzz{#3}%
  5776. \or \numberedsubseczzz{#3}%
  5777. \or \numberedsubsubseczzz{#3}%
  5778. \fi
  5779. \fi
  5780. \fi
  5781. \suppressfirstparagraphindent
  5782. }
  5783. % an interface:
  5784. \def\numhead{\genhead N}
  5785. \def\apphead{\genhead A}
  5786. \def\unnmhead{\genhead U}
  5787. % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
  5788. % all lower-level sectioning counters to zero.
  5789. %
  5790. % Also set \chaplevelprefix, which we prepend to @float sequence numbers
  5791. % (e.g., figures), q.v. By default (before any chapter), that is empty.
  5792. \let\chaplevelprefix = \empty
  5793. %
  5794. \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
  5795. \def\chapterzzz#1{%
  5796. % section resetting is \global in case the chapter is in a group, such
  5797. % as an @include file.
  5798. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5799. \global\advance\chapno by 1
  5800. %
  5801. % Used for \float.
  5802. \gdef\chaplevelprefix{\the\chapno.}%
  5803. \resetallfloatnos
  5804. %
  5805. % \putwordChapter can contain complex things in translations.
  5806. \toks0=\expandafter{\putwordChapter}%
  5807. \message{\the\toks0 \space \the\chapno}%
  5808. %
  5809. % Write the actual heading.
  5810. \chapmacro{#1}{Ynumbered}{\the\chapno}%
  5811. %
  5812. % So @section and the like are numbered underneath this chapter.
  5813. \global\let\section = \numberedsec
  5814. \global\let\subsection = \numberedsubsec
  5815. \global\let\subsubsection = \numberedsubsubsec
  5816. }
  5817. \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
  5818. %
  5819. \def\appendixzzz#1{%
  5820. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5821. \global\advance\appendixno by 1
  5822. \gdef\chaplevelprefix{\appendixletter.}%
  5823. \resetallfloatnos
  5824. %
  5825. % \putwordAppendix can contain complex things in translations.
  5826. \toks0=\expandafter{\putwordAppendix}%
  5827. \message{\the\toks0 \space \appendixletter}%
  5828. %
  5829. \chapmacro{#1}{Yappendix}{\appendixletter}%
  5830. %
  5831. \global\let\section = \appendixsec
  5832. \global\let\subsection = \appendixsubsec
  5833. \global\let\subsubsection = \appendixsubsubsec
  5834. }
  5835. % normally unnmhead0 calls unnumberedzzz:
  5836. \outer\parseargdef\unnumbered{\unnmhead0{#1}}
  5837. \def\unnumberedzzz#1{%
  5838. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5839. \global\advance\unnumberedno by 1
  5840. %
  5841. % Since an unnumbered has no number, no prefix for figures.
  5842. \global\let\chaplevelprefix = \empty
  5843. \resetallfloatnos
  5844. %
  5845. % This used to be simply \message{#1}, but TeX fully expands the
  5846. % argument to \message. Therefore, if #1 contained @-commands, TeX
  5847. % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
  5848. % expanded @cite (which turns out to cause errors because \cite is meant
  5849. % to be executed, not expanded).
  5850. %
  5851. % Anyway, we don't want the fully-expanded definition of @cite to appear
  5852. % as a result of the \message, we just want `@cite' itself. We use
  5853. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  5854. % simply yielding the contents of <toks register>. (We also do this for
  5855. % the toc entries.)
  5856. \toks0 = {#1}%
  5857. \message{(\the\toks0)}%
  5858. %
  5859. \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
  5860. %
  5861. \global\let\section = \unnumberedsec
  5862. \global\let\subsection = \unnumberedsubsec
  5863. \global\let\subsubsection = \unnumberedsubsubsec
  5864. }
  5865. % @centerchap is like @unnumbered, but the heading is centered.
  5866. \outer\parseargdef\centerchap{%
  5867. \let\centerparametersmaybe = \centerparameters
  5868. \unnmhead0{#1}%
  5869. \let\centerparametersmaybe = \relax
  5870. }
  5871. % @top is like @unnumbered.
  5872. \let\top\unnumbered
  5873. % Sections.
  5874. %
  5875. \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
  5876. \def\seczzz#1{%
  5877. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5878. \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
  5879. }
  5880. % normally calls appendixsectionzzz:
  5881. \outer\parseargdef\appendixsection{\apphead1{#1}}
  5882. \def\appendixsectionzzz#1{%
  5883. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5884. \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
  5885. }
  5886. \let\appendixsec\appendixsection
  5887. % normally calls unnumberedseczzz:
  5888. \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
  5889. \def\unnumberedseczzz#1{%
  5890. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5891. \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
  5892. }
  5893. % Subsections.
  5894. %
  5895. % normally calls numberedsubseczzz:
  5896. \outer\parseargdef\numberedsubsec{\numhead2{#1}}
  5897. \def\numberedsubseczzz#1{%
  5898. \global\subsubsecno=0 \global\advance\subsecno by 1
  5899. \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
  5900. }
  5901. % normally calls appendixsubseczzz:
  5902. \outer\parseargdef\appendixsubsec{\apphead2{#1}}
  5903. \def\appendixsubseczzz#1{%
  5904. \global\subsubsecno=0 \global\advance\subsecno by 1
  5905. \sectionheading{#1}{subsec}{Yappendix}%
  5906. {\appendixletter.\the\secno.\the\subsecno}%
  5907. }
  5908. % normally calls unnumberedsubseczzz:
  5909. \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
  5910. \def\unnumberedsubseczzz#1{%
  5911. \global\subsubsecno=0 \global\advance\subsecno by 1
  5912. \sectionheading{#1}{subsec}{Ynothing}%
  5913. {\the\unnumberedno.\the\secno.\the\subsecno}%
  5914. }
  5915. % Subsubsections.
  5916. %
  5917. % normally numberedsubsubseczzz:
  5918. \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
  5919. \def\numberedsubsubseczzz#1{%
  5920. \global\advance\subsubsecno by 1
  5921. \sectionheading{#1}{subsubsec}{Ynumbered}%
  5922. {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5923. }
  5924. % normally appendixsubsubseczzz:
  5925. \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
  5926. \def\appendixsubsubseczzz#1{%
  5927. \global\advance\subsubsecno by 1
  5928. \sectionheading{#1}{subsubsec}{Yappendix}%
  5929. {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
  5930. }
  5931. % normally unnumberedsubsubseczzz:
  5932. \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
  5933. \def\unnumberedsubsubseczzz#1{%
  5934. \global\advance\subsubsecno by 1
  5935. \sectionheading{#1}{subsubsec}{Ynothing}%
  5936. {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5937. }
  5938. % These macros control what the section commands do, according
  5939. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  5940. % Define them by default for a numbered chapter.
  5941. \let\section = \numberedsec
  5942. \let\subsection = \numberedsubsec
  5943. \let\subsubsection = \numberedsubsubsec
  5944. % Define @majorheading, @heading and @subheading
  5945. \def\majorheading{%
  5946. {\advance\chapheadingskip by 10pt \chapbreak }%
  5947. \parsearg\chapheadingzzz
  5948. }
  5949. \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
  5950. \def\chapheadingzzz#1{%
  5951. \vbox{\chapfonts \raggedtitlesettings #1\par}%
  5952. \nobreak\bigskip \nobreak
  5953. \suppressfirstparagraphindent
  5954. }
  5955. % @heading, @subheading, @subsubheading.
  5956. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
  5957. \suppressfirstparagraphindent}
  5958. \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
  5959. \suppressfirstparagraphindent}
  5960. \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
  5961. \suppressfirstparagraphindent}
  5962. % These macros generate a chapter, section, etc. heading only
  5963. % (including whitespace, linebreaking, etc. around it),
  5964. % given all the information in convenient, parsed form.
  5965. % Args are the skip and penalty (usually negative)
  5966. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  5967. % Parameter controlling skip before chapter headings (if needed)
  5968. \newskip\chapheadingskip
  5969. % Define plain chapter starts, and page on/off switching for it.
  5970. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  5971. % Start a new page
  5972. \def\chappager{\par\vfill\supereject}
  5973. % \chapoddpage - start on an odd page for a new chapter
  5974. % Because \domark is called before \chapoddpage, the filler page will
  5975. % get the headings for the next chapter, which is wrong. But we don't
  5976. % care -- we just disable all headings on the filler page.
  5977. \def\chapoddpage{%
  5978. \chappager
  5979. \ifodd\pageno \else
  5980. \begingroup
  5981. \headingsoff
  5982. \null
  5983. \chappager
  5984. \endgroup
  5985. \fi
  5986. }
  5987. \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
  5988. \def\CHAPPAGoff{%
  5989. \global\let\contentsalignmacro = \chappager
  5990. \global\let\pchapsepmacro=\chapbreak
  5991. \global\let\pagealignmacro=\chappager}
  5992. \def\CHAPPAGon{%
  5993. \global\let\contentsalignmacro = \chappager
  5994. \global\let\pchapsepmacro=\chappager
  5995. \global\let\pagealignmacro=\chappager
  5996. \global\def\HEADINGSon{\HEADINGSsingle}}
  5997. \def\CHAPPAGodd{%
  5998. \global\let\contentsalignmacro = \chapoddpage
  5999. \global\let\pchapsepmacro=\chapoddpage
  6000. \global\let\pagealignmacro=\chapoddpage
  6001. \global\def\HEADINGSon{\HEADINGSdouble}}
  6002. \CHAPPAGon
  6003. % \chapmacro - Chapter opening.
  6004. %
  6005. % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
  6006. % Yappendix, Yomitfromtoc), #3 the chapter number.
  6007. % Not used for @heading series.
  6008. %
  6009. % To test against our argument.
  6010. \def\Ynothingkeyword{Ynothing}
  6011. \def\Yappendixkeyword{Yappendix}
  6012. \def\Yomitfromtockeyword{Yomitfromtoc}
  6013. %
  6014. \def\chapmacro#1#2#3{%
  6015. \expandafter\ifx\thisenv\titlepage\else
  6016. \checkenv{}% chapters, etc., should not start inside an environment.
  6017. \fi
  6018. % FIXME: \chapmacro is currently called from inside \titlepage when
  6019. % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
  6020. % this should probably be done by \sectionheading with an option to print
  6021. % in chapter size.
  6022. %
  6023. % Insert the first mark before the heading break (see notes for \domark).
  6024. \let\prevchapterdefs=\lastchapterdefs
  6025. \let\prevsectiondefs=\lastsectiondefs
  6026. \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
  6027. \gdef\thissection{}}%
  6028. %
  6029. \def\temptype{#2}%
  6030. \ifx\temptype\Ynothingkeyword
  6031. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6032. \gdef\thischapter{\thischaptername}}%
  6033. \else\ifx\temptype\Yomitfromtockeyword
  6034. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6035. \gdef\thischapter{}}%
  6036. \else\ifx\temptype\Yappendixkeyword
  6037. \toks0={#1}%
  6038. \xdef\lastchapterdefs{%
  6039. \gdef\noexpand\thischaptername{\the\toks0}%
  6040. \gdef\noexpand\thischapternum{\appendixletter}%
  6041. % \noexpand\putwordAppendix avoids expanding indigestible
  6042. % commands in some of the translations.
  6043. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
  6044. \noexpand\thischapternum:
  6045. \noexpand\thischaptername}%
  6046. }%
  6047. \else
  6048. \toks0={#1}%
  6049. \xdef\lastchapterdefs{%
  6050. \gdef\noexpand\thischaptername{\the\toks0}%
  6051. \gdef\noexpand\thischapternum{\the\chapno}%
  6052. % \noexpand\putwordChapter avoids expanding indigestible
  6053. % commands in some of the translations.
  6054. \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
  6055. \noexpand\thischapternum:
  6056. \noexpand\thischaptername}%
  6057. }%
  6058. \fi\fi\fi
  6059. %
  6060. % Output the mark. Pass it through \safewhatsit, to take care of
  6061. % the preceding space.
  6062. \safewhatsit\domark
  6063. %
  6064. % Insert the chapter heading break.
  6065. \pchapsepmacro
  6066. %
  6067. % Now the second mark, after the heading break. No break points
  6068. % between here and the heading.
  6069. \let\prevchapterdefs=\lastchapterdefs
  6070. \let\prevsectiondefs=\lastsectiondefs
  6071. \domark
  6072. %
  6073. {%
  6074. \chapfonts \rm
  6075. \let\footnote=\errfootnoteheading % give better error message
  6076. %
  6077. % Have to define \lastsection before calling \donoderef, because the
  6078. % xref code eventually uses it. On the other hand, it has to be called
  6079. % after \pchapsepmacro, or the headline will change too soon.
  6080. \gdef\lastsection{#1}%
  6081. %
  6082. % Only insert the separating space if we have a chapter/appendix
  6083. % number, and don't print the unnumbered ``number''.
  6084. \ifx\temptype\Ynothingkeyword
  6085. \setbox0 = \hbox{}%
  6086. \def\toctype{unnchap}%
  6087. \else\ifx\temptype\Yomitfromtockeyword
  6088. \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
  6089. \def\toctype{omit}%
  6090. \else\ifx\temptype\Yappendixkeyword
  6091. \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
  6092. \def\toctype{app}%
  6093. \else
  6094. \setbox0 = \hbox{#3\enspace}%
  6095. \def\toctype{numchap}%
  6096. \fi\fi\fi
  6097. %
  6098. % Write the toc entry for this chapter. Must come before the
  6099. % \donoderef, because we include the current node name in the toc
  6100. % entry, and \donoderef resets it to empty.
  6101. \writetocentry{\toctype}{#1}{#3}%
  6102. %
  6103. % For pdftex, we have to write out the node definition (aka, make
  6104. % the pdfdest) after any page break, but before the actual text has
  6105. % been typeset. If the destination for the pdf outline is after the
  6106. % text, then jumping from the outline may wind up with the text not
  6107. % being visible, for instance under high magnification.
  6108. \donoderef{#2}%
  6109. %
  6110. % Typeset the actual heading.
  6111. \nobreak % Avoid page breaks at the interline glue.
  6112. \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
  6113. \unhbox0 #1\par}%
  6114. }%
  6115. \nobreak\bigskip % no page break after a chapter title
  6116. \nobreak
  6117. }
  6118. % @centerchap -- centered and unnumbered.
  6119. \let\centerparametersmaybe = \relax
  6120. \def\centerparameters{%
  6121. \advance\rightskip by 3\rightskip
  6122. \leftskip = \rightskip
  6123. \parfillskip = 0pt
  6124. }
  6125. % Section titles. These macros combine the section number parts and
  6126. % call the generic \sectionheading to do the printing.
  6127. %
  6128. \newskip\secheadingskip
  6129. \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
  6130. % Subsection titles.
  6131. \newskip\subsecheadingskip
  6132. \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
  6133. % Subsubsection titles.
  6134. \def\subsubsecheadingskip{\subsecheadingskip}
  6135. \def\subsubsecheadingbreak{\subsecheadingbreak}
  6136. % Print any size, any type, section title.
  6137. %
  6138. % #1 is the text of the title,
  6139. % #2 is the section level (sec/subsec/subsubsec),
  6140. % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
  6141. % #4 is the section number.
  6142. %
  6143. \def\seckeyword{sec}
  6144. %
  6145. \def\sectionheading#1#2#3#4{%
  6146. {%
  6147. \def\sectionlevel{#2}%
  6148. \def\temptype{#3}%
  6149. %
  6150. % It is ok for the @heading series commands to appear inside an
  6151. % environment (it's been historically allowed, though the logic is
  6152. % dubious), but not the others.
  6153. \ifx\temptype\Yomitfromtockeyword\else
  6154. \checkenv{}% non-@*heading should not be in an environment.
  6155. \fi
  6156. \let\footnote=\errfootnoteheading
  6157. %
  6158. % Switch to the right set of fonts.
  6159. \csname #2fonts\endcsname \rm
  6160. %
  6161. % Insert first mark before the heading break (see notes for \domark).
  6162. \let\prevsectiondefs=\lastsectiondefs
  6163. \ifx\temptype\Ynothingkeyword
  6164. \ifx\sectionlevel\seckeyword
  6165. \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
  6166. \gdef\thissection{\thissectionname}}%
  6167. \fi
  6168. \else\ifx\temptype\Yomitfromtockeyword
  6169. % Don't redefine \thissection.
  6170. \else\ifx\temptype\Yappendixkeyword
  6171. \ifx\sectionlevel\seckeyword
  6172. \toks0={#1}%
  6173. \xdef\lastsectiondefs{%
  6174. \gdef\noexpand\thissectionname{\the\toks0}%
  6175. \gdef\noexpand\thissectionnum{#4}%
  6176. % \noexpand\putwordSection avoids expanding indigestible
  6177. % commands in some of the translations.
  6178. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6179. \noexpand\thissectionnum:
  6180. \noexpand\thissectionname}%
  6181. }%
  6182. \fi
  6183. \else
  6184. \ifx\sectionlevel\seckeyword
  6185. \toks0={#1}%
  6186. \xdef\lastsectiondefs{%
  6187. \gdef\noexpand\thissectionname{\the\toks0}%
  6188. \gdef\noexpand\thissectionnum{#4}%
  6189. % \noexpand\putwordSection avoids expanding indigestible
  6190. % commands in some of the translations.
  6191. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6192. \noexpand\thissectionnum:
  6193. \noexpand\thissectionname}%
  6194. }%
  6195. \fi
  6196. \fi\fi\fi
  6197. %
  6198. % Go into vertical mode. Usually we'll already be there, but we
  6199. % don't want the following whatsit to end up in a preceding paragraph
  6200. % if the document didn't happen to have a blank line.
  6201. \par
  6202. %
  6203. % Output the mark. Pass it through \safewhatsit, to take care of
  6204. % the preceding space.
  6205. \safewhatsit\domark
  6206. %
  6207. % Insert space above the heading.
  6208. \csname #2headingbreak\endcsname
  6209. %
  6210. % Now the second mark, after the heading break. No break points
  6211. % between here and the heading.
  6212. \global\let\prevsectiondefs=\lastsectiondefs
  6213. \domark
  6214. %
  6215. % Only insert the space after the number if we have a section number.
  6216. \ifx\temptype\Ynothingkeyword
  6217. \setbox0 = \hbox{}%
  6218. \def\toctype{unn}%
  6219. \gdef\lastsection{#1}%
  6220. \else\ifx\temptype\Yomitfromtockeyword
  6221. % for @headings -- no section number, don't include in toc,
  6222. % and don't redefine \lastsection.
  6223. \setbox0 = \hbox{}%
  6224. \def\toctype{omit}%
  6225. \let\sectionlevel=\empty
  6226. \else\ifx\temptype\Yappendixkeyword
  6227. \setbox0 = \hbox{#4\enspace}%
  6228. \def\toctype{app}%
  6229. \gdef\lastsection{#1}%
  6230. \else
  6231. \setbox0 = \hbox{#4\enspace}%
  6232. \def\toctype{num}%
  6233. \gdef\lastsection{#1}%
  6234. \fi\fi\fi
  6235. %
  6236. % Write the toc entry (before \donoderef). See comments in \chapmacro.
  6237. \writetocentry{\toctype\sectionlevel}{#1}{#4}%
  6238. %
  6239. % Write the node reference (= pdf destination for pdftex).
  6240. % Again, see comments in \chapmacro.
  6241. \donoderef{#3}%
  6242. %
  6243. % Interline glue will be inserted when the vbox is completed.
  6244. % That glue will be a valid breakpoint for the page, since it'll be
  6245. % preceded by a whatsit (usually from the \donoderef, or from the
  6246. % \writetocentry if there was no node). We don't want to allow that
  6247. % break, since then the whatsits could end up on page n while the
  6248. % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
  6249. \nobreak
  6250. %
  6251. % Output the actual section heading.
  6252. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
  6253. \hangindent=\wd0 % zero if no section number
  6254. \unhbox0 #1}%
  6255. }%
  6256. % Add extra space after the heading -- half of whatever came above it.
  6257. % Don't allow stretch, though.
  6258. \kern .5 \csname #2headingskip\endcsname
  6259. %
  6260. % Do not let the kern be a potential breakpoint, as it would be if it
  6261. % was followed by glue.
  6262. \nobreak
  6263. %
  6264. % We'll almost certainly start a paragraph next, so don't let that
  6265. % glue accumulate. (Not a breakpoint because it's preceded by a
  6266. % discardable item.) However, when a paragraph is not started next
  6267. % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
  6268. % or the negative glue will cause weirdly wrong output, typically
  6269. % obscuring the section heading with something else.
  6270. \vskip-\parskip
  6271. %
  6272. % This is so the last item on the main vertical list is a known
  6273. % \penalty > 10000, so \startdefun, etc., can recognize the situation
  6274. % and do the needful.
  6275. \penalty 10001
  6276. }
  6277. \message{toc,}
  6278. % Table of contents.
  6279. \newwrite\tocfile
  6280. % Write an entry to the toc file, opening it if necessary.
  6281. % Called from @chapter, etc.
  6282. %
  6283. % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
  6284. % We append the current node name (if any) and page number as additional
  6285. % arguments for the \{chap,sec,...}entry macros which will eventually
  6286. % read this. The node name is used in the pdf outlines as the
  6287. % destination to jump to.
  6288. %
  6289. % We open the .toc file for writing here instead of at @setfilename (or
  6290. % any other fixed time) so that @contents can be anywhere in the document.
  6291. % But if #1 is `omit', then we don't do anything. This is used for the
  6292. % table of contents chapter openings themselves.
  6293. %
  6294. \newif\iftocfileopened
  6295. \def\omitkeyword{omit}%
  6296. %
  6297. \def\writetocentry#1#2#3{%
  6298. \edef\writetoctype{#1}%
  6299. \ifx\writetoctype\omitkeyword \else
  6300. \iftocfileopened\else
  6301. \immediate\openout\tocfile = \jobname.toc
  6302. \global\tocfileopenedtrue
  6303. \fi
  6304. %
  6305. \iflinks
  6306. {\atdummies
  6307. \edef\temp{%
  6308. \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
  6309. \temp
  6310. }%
  6311. \fi
  6312. \fi
  6313. %
  6314. % Tell \shipout to create a pdf destination on each page, if we're
  6315. % writing pdf. These are used in the table of contents. We can't
  6316. % just write one on every page because the title pages are numbered
  6317. % 1 and 2 (the page numbers aren't printed), and so are the first
  6318. % two pages of the document. Thus, we'd have two destinations named
  6319. % `1', and two named `2'.
  6320. \ifpdf
  6321. \global\pdfmakepagedesttrue
  6322. \else
  6323. \ifx\XeTeXrevision\thisisundefined
  6324. \else
  6325. \global\pdfmakepagedesttrue
  6326. \fi
  6327. \fi
  6328. }
  6329. % These characters do not print properly in the Computer Modern roman
  6330. % fonts, so we must take special care. This is more or less redundant
  6331. % with the Texinfo input format setup at the end of this file.
  6332. %
  6333. \def\activecatcodes{%
  6334. \catcode`\"=\active
  6335. \catcode`\$=\active
  6336. \catcode`\<=\active
  6337. \catcode`\>=\active
  6338. \catcode`\\=\active
  6339. \catcode`\^=\active
  6340. \catcode`\_=\active
  6341. \catcode`\|=\active
  6342. \catcode`\~=\active
  6343. }
  6344. % Read the toc file, which is essentially Texinfo input.
  6345. \def\readtocfile{%
  6346. \setupdatafile
  6347. \activecatcodes
  6348. \input \tocreadfilename
  6349. }
  6350. \newskip\contentsrightmargin \contentsrightmargin=1in
  6351. \newcount\savepageno
  6352. \newcount\lastnegativepageno \lastnegativepageno = -1
  6353. % Prepare to read what we've written to \tocfile.
  6354. %
  6355. \def\startcontents#1{%
  6356. % If @setchapternewpage on, and @headings double, the contents should
  6357. % start on an odd page, unlike chapters. Thus, we maintain
  6358. % \contentsalignmacro in parallel with \pagealignmacro.
  6359. % From: Torbjorn Granlund <tege@matematik.su.se>
  6360. \contentsalignmacro
  6361. \immediate\closeout\tocfile
  6362. %
  6363. % Don't need to put `Contents' or `Short Contents' in the headline.
  6364. % It is abundantly clear what they are.
  6365. \chapmacro{#1}{Yomitfromtoc}{}%
  6366. %
  6367. \savepageno = \pageno
  6368. \begingroup % Set up to handle contents files properly.
  6369. \raggedbottom % Worry more about breakpoints than the bottom.
  6370. \entryrightmargin=\contentsrightmargin % Don't use the full line length.
  6371. %
  6372. % Roman numerals for page numbers.
  6373. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  6374. }
  6375. % redefined for the two-volume lispref. We always output on
  6376. % \jobname.toc even if this is redefined.
  6377. %
  6378. \def\tocreadfilename{\jobname.toc}
  6379. % Normal (long) toc.
  6380. %
  6381. \def\contents{%
  6382. \startcontents{\putwordTOC}%
  6383. \openin 1 \tocreadfilename\space
  6384. \ifeof 1 \else
  6385. \readtocfile
  6386. \fi
  6387. \vfill \eject
  6388. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6389. \ifeof 1 \else
  6390. \pdfmakeoutlines
  6391. \fi
  6392. \closein 1
  6393. \endgroup
  6394. \lastnegativepageno = \pageno
  6395. \global\pageno = \savepageno
  6396. }
  6397. % And just the chapters.
  6398. \def\summarycontents{%
  6399. \startcontents{\putwordShortTOC}%
  6400. %
  6401. \let\partentry = \shortpartentry
  6402. \let\numchapentry = \shortchapentry
  6403. \let\appentry = \shortchapentry
  6404. \let\unnchapentry = \shortunnchapentry
  6405. % We want a true roman here for the page numbers.
  6406. \secfonts
  6407. \let\rm=\shortcontrm \let\bf=\shortcontbf
  6408. \let\sl=\shortcontsl \let\tt=\shortconttt
  6409. \rm
  6410. \hyphenpenalty = 10000
  6411. \advance\baselineskip by 1pt % Open it up a little.
  6412. \def\numsecentry##1##2##3##4{}
  6413. \let\appsecentry = \numsecentry
  6414. \let\unnsecentry = \numsecentry
  6415. \let\numsubsecentry = \numsecentry
  6416. \let\appsubsecentry = \numsecentry
  6417. \let\unnsubsecentry = \numsecentry
  6418. \let\numsubsubsecentry = \numsecentry
  6419. \let\appsubsubsecentry = \numsecentry
  6420. \let\unnsubsubsecentry = \numsecentry
  6421. \openin 1 \tocreadfilename\space
  6422. \ifeof 1 \else
  6423. \readtocfile
  6424. \fi
  6425. \closein 1
  6426. \vfill \eject
  6427. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6428. \endgroup
  6429. \lastnegativepageno = \pageno
  6430. \global\pageno = \savepageno
  6431. }
  6432. \let\shortcontents = \summarycontents
  6433. % Typeset the label for a chapter or appendix for the short contents.
  6434. % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
  6435. %
  6436. \def\shortchaplabel#1{%
  6437. % This space should be enough, since a single number is .5em, and the
  6438. % widest letter (M) is 1em, at least in the Computer Modern fonts.
  6439. % But use \hss just in case.
  6440. % (This space doesn't include the extra space that gets added after
  6441. % the label; that gets put in by \shortchapentry above.)
  6442. %
  6443. % We'd like to right-justify chapter numbers, but that looks strange
  6444. % with appendix letters. And right-justifying numbers and
  6445. % left-justifying letters looks strange when there is less than 10
  6446. % chapters. Have to read the whole toc once to know how many chapters
  6447. % there are before deciding ...
  6448. \hbox to 1em{#1\hss}%
  6449. }
  6450. % These macros generate individual entries in the table of contents.
  6451. % The first argument is the chapter or section name.
  6452. % The last argument is the page number.
  6453. % The arguments in between are the chapter number, section number, ...
  6454. % Parts, in the main contents. Replace the part number, which doesn't
  6455. % exist, with an empty box. Let's hope all the numbers have the same width.
  6456. % Also ignore the page number, which is conventionally not printed.
  6457. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
  6458. \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
  6459. %
  6460. % Parts, in the short toc.
  6461. \def\shortpartentry#1#2#3#4{%
  6462. \penalty-300
  6463. \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
  6464. \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
  6465. }
  6466. % Chapters, in the main contents.
  6467. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
  6468. % Chapters, in the short toc.
  6469. % See comments in \dochapentry re vbox and related settings.
  6470. \def\shortchapentry#1#2#3#4{%
  6471. \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
  6472. }
  6473. % Appendices, in the main contents.
  6474. % Need the word Appendix, and a fixed-size box.
  6475. %
  6476. \def\appendixbox#1{%
  6477. % We use M since it's probably the widest letter.
  6478. \setbox0 = \hbox{\putwordAppendix{} M}%
  6479. \hbox to \wd0{\putwordAppendix{} #1\hss}}
  6480. %
  6481. \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
  6482. % Unnumbered chapters.
  6483. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
  6484. \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
  6485. % Sections.
  6486. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
  6487. \let\appsecentry=\numsecentry
  6488. \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
  6489. % Subsections.
  6490. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
  6491. \let\appsubsecentry=\numsubsecentry
  6492. \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
  6493. % And subsubsections.
  6494. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
  6495. \let\appsubsubsecentry=\numsubsubsecentry
  6496. \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
  6497. % This parameter controls the indentation of the various levels.
  6498. % Same as \defaultparindent.
  6499. \newdimen\tocindent \tocindent = 15pt
  6500. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  6501. % page number.
  6502. %
  6503. % If the toc has to be broken over pages, we want it to be at chapters
  6504. % if at all possible; hence the \penalty.
  6505. \def\dochapentry#1#2{%
  6506. \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  6507. \begingroup
  6508. % Move the page numbers slightly to the right
  6509. \advance\entryrightmargin by -0.05em
  6510. \chapentryfonts
  6511. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6512. \endgroup
  6513. \nobreak\vskip .25\baselineskip plus.1\baselineskip
  6514. }
  6515. \def\dosecentry#1#2{\begingroup
  6516. \secentryfonts \leftskip=\tocindent
  6517. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6518. \endgroup}
  6519. \def\dosubsecentry#1#2{\begingroup
  6520. \subsecentryfonts \leftskip=2\tocindent
  6521. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6522. \endgroup}
  6523. \def\dosubsubsecentry#1#2{\begingroup
  6524. \subsubsecentryfonts \leftskip=3\tocindent
  6525. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6526. \endgroup}
  6527. % We use the same \entry macro as for the index entries.
  6528. \let\tocentry = \entry
  6529. % Space between chapter (or whatever) number and the title.
  6530. \def\labelspace{\hskip1em \relax}
  6531. \def\dopageno#1{{\rm #1}}
  6532. \def\doshortpageno#1{{\rm #1}}
  6533. \def\chapentryfonts{\secfonts \rm}
  6534. \def\secentryfonts{\textfonts}
  6535. \def\subsecentryfonts{\textfonts}
  6536. \def\subsubsecentryfonts{\textfonts}
  6537. \message{environments,}
  6538. % @foo ... @end foo.
  6539. % @tex ... @end tex escapes into raw TeX temporarily.
  6540. % One exception: @ is still an escape character, so that @end tex works.
  6541. % But \@ or @@ will get a plain @ character.
  6542. \envdef\tex{%
  6543. \setupmarkupstyle{tex}%
  6544. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  6545. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  6546. \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  6547. \catcode `\%=14
  6548. \catcode `\+=\other
  6549. \catcode `\"=\other
  6550. \catcode `\|=\other
  6551. \catcode `\<=\other
  6552. \catcode `\>=\other
  6553. \catcode `\`=\other
  6554. \catcode `\'=\other
  6555. %
  6556. % ' is active in math mode (mathcode"8000). So reset it, and all our
  6557. % other math active characters (just in case), to plain's definitions.
  6558. \mathactive
  6559. %
  6560. % Inverse of the list at the beginning of the file.
  6561. \let\b=\ptexb
  6562. \let\bullet=\ptexbullet
  6563. \let\c=\ptexc
  6564. \let\,=\ptexcomma
  6565. \let\.=\ptexdot
  6566. \let\dots=\ptexdots
  6567. \let\equiv=\ptexequiv
  6568. \let\!=\ptexexclam
  6569. \let\i=\ptexi
  6570. \let\indent=\ptexindent
  6571. \let\noindent=\ptexnoindent
  6572. \let\{=\ptexlbrace
  6573. \let\+=\tabalign
  6574. \let\}=\ptexrbrace
  6575. \let\/=\ptexslash
  6576. \let\sp=\ptexsp
  6577. \let\*=\ptexstar
  6578. %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
  6579. \let\t=\ptext
  6580. \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
  6581. \let\frenchspacing=\plainfrenchspacing
  6582. %
  6583. \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  6584. \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  6585. \def\@{@}%
  6586. }
  6587. % There is no need to define \Etex.
  6588. % Define @lisp ... @end lisp.
  6589. % @lisp environment forms a group so it can rebind things,
  6590. % including the definition of @end lisp (which normally is erroneous).
  6591. % Amount to narrow the margins by for @lisp.
  6592. \newskip\lispnarrowing \lispnarrowing=0.4in
  6593. % This is the definition that ^^M gets inside @lisp, @example, and other
  6594. % such environments. \null is better than a space, since it doesn't
  6595. % have any width.
  6596. \def\lisppar{\null\endgraf}
  6597. % This space is always present above and below environments.
  6598. \newskip\envskipamount \envskipamount = 0pt
  6599. % Make spacing and below environment symmetrical. We use \parskip here
  6600. % to help in doing that, since in @example-like environments \parskip
  6601. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  6602. % start of the next paragraph will insert \parskip.
  6603. %
  6604. \def\aboveenvbreak{{%
  6605. % =10000 instead of <10000 because of a special case in \itemzzz and
  6606. % \sectionheading, q.v.
  6607. \ifnum \lastpenalty=10000 \else
  6608. \advance\envskipamount by \parskip
  6609. \endgraf
  6610. \ifdim\lastskip<\envskipamount
  6611. \removelastskip
  6612. \ifnum\lastpenalty<10000
  6613. % Penalize breaking before the environment, because preceding text
  6614. % often leads into it.
  6615. \penalty100
  6616. \fi
  6617. \vskip\envskipamount
  6618. \fi
  6619. \fi
  6620. }}
  6621. \def\afterenvbreak{{%
  6622. % =10000 instead of <10000 because of a special case in \itemzzz and
  6623. % \sectionheading, q.v.
  6624. \ifnum \lastpenalty=10000 \else
  6625. \advance\envskipamount by \parskip
  6626. \endgraf
  6627. \ifdim\lastskip<\envskipamount
  6628. \removelastskip
  6629. % it's not a good place to break if the last penalty was \nobreak
  6630. % or better ...
  6631. \ifnum\lastpenalty<10000 \penalty-50 \fi
  6632. \vskip\envskipamount
  6633. \fi
  6634. \fi
  6635. }}
  6636. % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
  6637. % also clear it, so that its embedded environments do the narrowing again.
  6638. \let\nonarrowing=\relax
  6639. % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  6640. % environment contents.
  6641. \font\circle=lcircle10
  6642. \newdimen\circthick
  6643. \newdimen\cartouter\newdimen\cartinner
  6644. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  6645. \circthick=\fontdimen8\circle
  6646. %
  6647. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  6648. \def\ctr{{\hskip 6pt\circle\char'010}}
  6649. \def\cbl{{\circle\char'012\hskip -6pt}}
  6650. \def\cbr{{\hskip 6pt\circle\char'011}}
  6651. \def\carttop{\hbox to \cartouter{\hskip\lskip
  6652. \ctl\leaders\hrule height\circthick\hfil\ctr
  6653. \hskip\rskip}}
  6654. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  6655. \cbl\leaders\hrule height\circthick\hfil\cbr
  6656. \hskip\rskip}}
  6657. %
  6658. \newskip\lskip\newskip\rskip
  6659. \envdef\cartouche{%
  6660. \ifhmode\par\fi % can't be in the midst of a paragraph.
  6661. \startsavinginserts
  6662. \lskip=\leftskip \rskip=\rightskip
  6663. \leftskip=0pt\rightskip=0pt % we want these *outside*.
  6664. \cartinner=\hsize \advance\cartinner by-\lskip
  6665. \advance\cartinner by-\rskip
  6666. \cartouter=\hsize
  6667. \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  6668. % side, and for 6pt waste from
  6669. % each corner char, and rule thickness
  6670. \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  6671. %
  6672. % If this cartouche directly follows a sectioning command, we need the
  6673. % \parskip glue (backspaced over by default) or the cartouche can
  6674. % collide with the section heading.
  6675. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
  6676. %
  6677. \setbox\groupbox=\vbox\bgroup
  6678. \baselineskip=0pt\parskip=0pt\lineskip=0pt
  6679. \carttop
  6680. \hbox\bgroup
  6681. \hskip\lskip
  6682. \vrule\kern3pt
  6683. \vbox\bgroup
  6684. \kern3pt
  6685. \hsize=\cartinner
  6686. \baselineskip=\normbskip
  6687. \lineskip=\normlskip
  6688. \parskip=\normpskip
  6689. \vskip -\parskip
  6690. \comment % For explanation, see the end of def\group.
  6691. }
  6692. \def\Ecartouche{%
  6693. \ifhmode\par\fi
  6694. \kern3pt
  6695. \egroup
  6696. \kern3pt\vrule
  6697. \hskip\rskip
  6698. \egroup
  6699. \cartbot
  6700. \egroup
  6701. \addgroupbox
  6702. \checkinserts
  6703. }
  6704. % This macro is called at the beginning of all the @example variants,
  6705. % inside a group.
  6706. \newdimen\nonfillparindent
  6707. \def\nonfillstart{%
  6708. \aboveenvbreak
  6709. \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
  6710. \sepspaces % Make spaces be word-separators rather than space tokens.
  6711. \let\par = \lisppar % don't ignore blank lines
  6712. \obeylines % each line of input is a line of output
  6713. \parskip = 0pt
  6714. % Turn off paragraph indentation but redefine \indent to emulate
  6715. % the normal \indent.
  6716. \nonfillparindent=\parindent
  6717. \parindent = 0pt
  6718. \let\indent\nonfillindent
  6719. %
  6720. \emergencystretch = 0pt % don't try to avoid overfull boxes
  6721. \ifx\nonarrowing\relax
  6722. \advance \leftskip by \lispnarrowing
  6723. \exdentamount=\lispnarrowing
  6724. \else
  6725. \let\nonarrowing = \relax
  6726. \fi
  6727. \let\exdent=\nofillexdent
  6728. }
  6729. \begingroup
  6730. \obeyspaces
  6731. % We want to swallow spaces (but not other tokens) after the fake
  6732. % @indent in our nonfill-environments, where spaces are normally
  6733. % active and set to @tie, resulting in them not being ignored after
  6734. % @indent.
  6735. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
  6736. \gdef\nonfillindentcheck{%
  6737. \ifx\temp %
  6738. \expandafter\nonfillindentgobble%
  6739. \else%
  6740. \leavevmode\nonfillindentbox%
  6741. \fi%
  6742. }%
  6743. \endgroup
  6744. \def\nonfillindentgobble#1{\nonfillindent}
  6745. \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
  6746. % If you want all examples etc. small: @set dispenvsize small.
  6747. % If you want even small examples the full size: @set dispenvsize nosmall.
  6748. % This affects the following displayed environments:
  6749. % @example, @display, @format, @lisp
  6750. %
  6751. \def\smallword{small}
  6752. \def\nosmallword{nosmall}
  6753. \let\SETdispenvsize\relax
  6754. \def\setnormaldispenv{%
  6755. \ifx\SETdispenvsize\smallword
  6756. % end paragraph for sake of leading, in case document has no blank
  6757. % line. This is redundant with what happens in \aboveenvbreak, but
  6758. % we need to do it before changing the fonts, and it's inconvenient
  6759. % to change the fonts afterward.
  6760. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6761. \smallexamplefonts \rm
  6762. \fi
  6763. }
  6764. \def\setsmalldispenv{%
  6765. \ifx\SETdispenvsize\nosmallword
  6766. \else
  6767. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6768. \smallexamplefonts \rm
  6769. \fi
  6770. }
  6771. % We often define two environments, @foo and @smallfoo.
  6772. % Let's do it in one command. #1 is the env name, #2 the definition.
  6773. \def\makedispenvdef#1#2{%
  6774. \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
  6775. \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
  6776. \expandafter\let\csname E#1\endcsname \afterenvbreak
  6777. \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
  6778. }
  6779. % Define two environment synonyms (#1 and #2) for an environment.
  6780. \def\maketwodispenvdef#1#2#3{%
  6781. \makedispenvdef{#1}{#3}%
  6782. \makedispenvdef{#2}{#3}%
  6783. }
  6784. %
  6785. % @lisp: indented, narrowed, typewriter font;
  6786. % @example: same as @lisp.
  6787. %
  6788. % @smallexample and @smalllisp: use smaller fonts.
  6789. % Originally contributed by Pavel@xerox.
  6790. %
  6791. \maketwodispenvdef{lisp}{example}{%
  6792. \nonfillstart
  6793. \tt\setupmarkupstyle{example}%
  6794. \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  6795. \gobble % eat return
  6796. }
  6797. % @display/@smalldisplay: same as @lisp except keep current font.
  6798. %
  6799. \makedispenvdef{display}{%
  6800. \nonfillstart
  6801. \gobble
  6802. }
  6803. % @format/@smallformat: same as @display except don't narrow margins.
  6804. %
  6805. \makedispenvdef{format}{%
  6806. \let\nonarrowing = t%
  6807. \nonfillstart
  6808. \gobble
  6809. }
  6810. % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
  6811. \envdef\flushleft{%
  6812. \let\nonarrowing = t%
  6813. \nonfillstart
  6814. \gobble
  6815. }
  6816. \let\Eflushleft = \afterenvbreak
  6817. % @flushright.
  6818. %
  6819. \envdef\flushright{%
  6820. \let\nonarrowing = t%
  6821. \nonfillstart
  6822. \advance\leftskip by 0pt plus 1fill\relax
  6823. \gobble
  6824. }
  6825. \let\Eflushright = \afterenvbreak
  6826. % @raggedright does more-or-less normal line breaking but no right
  6827. % justification. From plain.tex. Don't stretch around special
  6828. % characters in urls in this environment, since the stretch at the right
  6829. % should be enough.
  6830. \envdef\raggedright{%
  6831. \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
  6832. \def\urefprestretchamount{0pt}%
  6833. \def\urefpoststretchamount{0pt}%
  6834. }
  6835. \let\Eraggedright\par
  6836. \envdef\raggedleft{%
  6837. \parindent=0pt \leftskip0pt plus2em
  6838. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6839. \hbadness=10000 % Last line will usually be underfull, so turn off
  6840. % badness reporting.
  6841. }
  6842. \let\Eraggedleft\par
  6843. \envdef\raggedcenter{%
  6844. \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
  6845. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6846. \hbadness=10000 % Last line will usually be underfull, so turn off
  6847. % badness reporting.
  6848. }
  6849. \let\Eraggedcenter\par
  6850. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  6851. % and narrows the margins. We keep \parskip nonzero in general, since
  6852. % we're doing normal filling. So, when using \aboveenvbreak and
  6853. % \afterenvbreak, temporarily make \parskip 0.
  6854. %
  6855. \makedispenvdef{quotation}{\quotationstart}
  6856. %
  6857. \def\quotationstart{%
  6858. \indentedblockstart % same as \indentedblock, but increase right margin too.
  6859. \ifx\nonarrowing\relax
  6860. \advance\rightskip by \lispnarrowing
  6861. \fi
  6862. \parsearg\quotationlabel
  6863. }
  6864. % We have retained a nonzero parskip for the environment, since we're
  6865. % doing normal filling.
  6866. %
  6867. \def\Equotation{%
  6868. \par
  6869. \ifx\quotationauthor\thisisundefined\else
  6870. % indent a bit.
  6871. \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
  6872. \fi
  6873. {\parskip=0pt \afterenvbreak}%
  6874. }
  6875. \def\Esmallquotation{\Equotation}
  6876. % If we're given an argument, typeset it in bold with a colon after.
  6877. \def\quotationlabel#1{%
  6878. \def\temp{#1}%
  6879. \ifx\temp\empty \else
  6880. {\bf #1: }%
  6881. \fi
  6882. }
  6883. % @indentedblock is like @quotation, but indents only on the left and
  6884. % has no optional argument.
  6885. %
  6886. \makedispenvdef{indentedblock}{\indentedblockstart}
  6887. %
  6888. \def\indentedblockstart{%
  6889. {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  6890. \parindent=0pt
  6891. %
  6892. % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  6893. \ifx\nonarrowing\relax
  6894. \advance\leftskip by \lispnarrowing
  6895. \exdentamount = \lispnarrowing
  6896. \else
  6897. \let\nonarrowing = \relax
  6898. \fi
  6899. }
  6900. % Keep a nonzero parskip for the environment, since we're doing normal filling.
  6901. %
  6902. \def\Eindentedblock{%
  6903. \par
  6904. {\parskip=0pt \afterenvbreak}%
  6905. }
  6906. \def\Esmallindentedblock{\Eindentedblock}
  6907. % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
  6908. % If we want to allow any <char> as delimiter,
  6909. % we need the curly braces so that makeinfo sees the @verb command, eg:
  6910. % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
  6911. %
  6912. % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
  6913. %
  6914. % [Knuth] p.344; only we need to do the other characters Texinfo sets
  6915. % active too. Otherwise, they get lost as the first character on a
  6916. % verbatim line.
  6917. \def\dospecials{%
  6918. \do\ \do\\\do\{\do\}\do\$\do\&%
  6919. \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  6920. \do\<\do\>\do\|\do\@\do+\do\"%
  6921. % Don't do the quotes -- if we do, @set txicodequoteundirected and
  6922. % @set txicodequotebacktick will not have effect on @verb and
  6923. % @verbatim, and ?` and !` ligatures won't get disabled.
  6924. %\do\`\do\'%
  6925. }
  6926. %
  6927. % [Knuth] p. 380
  6928. \def\uncatcodespecials{%
  6929. \def\do##1{\catcode`##1=\other}\dospecials}
  6930. %
  6931. % Setup for the @verb command.
  6932. %
  6933. % Eight spaces for a tab
  6934. \begingroup
  6935. \catcode`\^^I=\active
  6936. \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
  6937. \endgroup
  6938. %
  6939. \def\setupverb{%
  6940. \tt % easiest (and conventionally used) font for verbatim
  6941. \def\par{\leavevmode\endgraf}%
  6942. \setupmarkupstyle{verb}%
  6943. \tabeightspaces
  6944. % Respect line breaks,
  6945. % print special symbols as themselves, and
  6946. % make each space count
  6947. % must do in this order:
  6948. \obeylines \uncatcodespecials \sepspaces
  6949. }
  6950. % Setup for the @verbatim environment
  6951. %
  6952. % Real tab expansion.
  6953. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
  6954. %
  6955. % We typeset each line of the verbatim in an \hbox, so we can handle
  6956. % tabs. The \global is in case the verbatim line starts with an accent,
  6957. % or some other command that starts with a begin-group. Otherwise, the
  6958. % entire \verbbox would disappear at the corresponding end-group, before
  6959. % it is typeset. Meanwhile, we can't have nested verbatim commands
  6960. % (can we?), so the \global won't be overwriting itself.
  6961. \newbox\verbbox
  6962. \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
  6963. %
  6964. \begingroup
  6965. \catcode`\^^I=\active
  6966. \gdef\tabexpand{%
  6967. \catcode`\^^I=\active
  6968. \def^^I{\leavevmode\egroup
  6969. \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
  6970. \divide\dimen\verbbox by\tabw
  6971. \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
  6972. \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
  6973. \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
  6974. }%
  6975. }
  6976. \endgroup
  6977. % start the verbatim environment.
  6978. \def\setupverbatim{%
  6979. \let\nonarrowing = t%
  6980. \nonfillstart
  6981. \tt % easiest (and conventionally used) font for verbatim
  6982. % The \leavevmode here is for blank lines. Otherwise, we would
  6983. % never \starttabox and the \egroup would end verbatim mode.
  6984. \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
  6985. \tabexpand
  6986. \setupmarkupstyle{verbatim}%
  6987. % Respect line breaks,
  6988. % print special symbols as themselves, and
  6989. % make each space count.
  6990. % Must do in this order:
  6991. \obeylines \uncatcodespecials \sepspaces
  6992. \everypar{\starttabbox}%
  6993. }
  6994. % Do the @verb magic: verbatim text is quoted by unique
  6995. % delimiter characters. Before first delimiter expect a
  6996. % right brace, after last delimiter expect closing brace:
  6997. %
  6998. % \def\doverb'{'<char>#1<char>'}'{#1}
  6999. %
  7000. % [Knuth] p. 382; only eat outer {}
  7001. \begingroup
  7002. \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
  7003. \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
  7004. \endgroup
  7005. %
  7006. \def\verb{\begingroup\setupverb\doverb}
  7007. %
  7008. %
  7009. % Do the @verbatim magic: define the macro \doverbatim so that
  7010. % the (first) argument ends when '@end verbatim' is reached, ie:
  7011. %
  7012. % \def\doverbatim#1@end verbatim{#1}
  7013. %
  7014. % For Texinfo it's a lot easier than for LaTeX,
  7015. % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
  7016. % we need not redefine '\', '{' and '}'.
  7017. %
  7018. % Inspired by LaTeX's verbatim command set [latex.ltx]
  7019. %
  7020. \begingroup
  7021. \catcode`\ =\active
  7022. \obeylines %
  7023. % ignore everything up to the first ^^M, that's the newline at the end
  7024. % of the @verbatim input line itself. Otherwise we get an extra blank
  7025. % line in the output.
  7026. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
  7027. % We really want {...\end verbatim} in the body of the macro, but
  7028. % without the active space; thus we have to use \xdef and \gobble.
  7029. \endgroup
  7030. %
  7031. \envdef\verbatim{%
  7032. \setupverbatim\doverbatim
  7033. }
  7034. \let\Everbatim = \afterenvbreak
  7035. % @verbatiminclude FILE - insert text of file in verbatim environment.
  7036. %
  7037. \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
  7038. %
  7039. \def\doverbatiminclude#1{%
  7040. {%
  7041. \makevalueexpandable
  7042. \setupverbatim
  7043. \indexnofonts % Allow `@@' and other weird things in file names.
  7044. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
  7045. \input #1
  7046. \afterenvbreak
  7047. }%
  7048. }
  7049. % @copying ... @end copying.
  7050. % Save the text away for @insertcopying later.
  7051. %
  7052. % We save the uninterpreted tokens, rather than creating a box.
  7053. % Saving the text in a box would be much easier, but then all the
  7054. % typesetting commands (@smallbook, font changes, etc.) have to be done
  7055. % beforehand -- and a) we want @copying to be done first in the source
  7056. % file; b) letting users define the frontmatter in as flexible order as
  7057. % possible is desirable.
  7058. %
  7059. \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
  7060. \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
  7061. %
  7062. \def\insertcopying{%
  7063. \begingroup
  7064. \parindent = 0pt % paragraph indentation looks wrong on title page
  7065. \scanexp\copyingtext
  7066. \endgroup
  7067. }
  7068. \message{defuns,}
  7069. % @defun etc.
  7070. \newskip\defbodyindent \defbodyindent=.4in
  7071. \newskip\defargsindent \defargsindent=50pt
  7072. \newskip\deflastargmargin \deflastargmargin=18pt
  7073. \newcount\defunpenalty
  7074. % Start the processing of @deffn:
  7075. \def\startdefun{%
  7076. \ifnum\lastpenalty<10000
  7077. \medbreak
  7078. \defunpenalty=10003 % Will keep this @deffn together with the
  7079. % following @def command, see below.
  7080. \else
  7081. % If there are two @def commands in a row, we'll have a \nobreak,
  7082. % which is there to keep the function description together with its
  7083. % header. But if there's nothing but headers, we need to allow a
  7084. % break somewhere. Check specifically for penalty 10002, inserted
  7085. % by \printdefunline, instead of 10000, since the sectioning
  7086. % commands also insert a nobreak penalty, and we don't want to allow
  7087. % a break between a section heading and a defun.
  7088. %
  7089. % As a further refinement, we avoid "club" headers by signalling
  7090. % with penalty of 10003 after the very first @deffn in the
  7091. % sequence (see above), and penalty of 10002 after any following
  7092. % @def command.
  7093. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
  7094. %
  7095. % Similarly, after a section heading, do not allow a break.
  7096. % But do insert the glue.
  7097. \medskip % preceded by discardable penalty, so not a breakpoint
  7098. \fi
  7099. %
  7100. \parindent=0in
  7101. \advance\leftskip by \defbodyindent
  7102. \exdentamount=\defbodyindent
  7103. }
  7104. \def\dodefunx#1{%
  7105. % First, check whether we are in the right environment:
  7106. \checkenv#1%
  7107. %
  7108. % As above, allow line break if we have multiple x headers in a row.
  7109. % It's not a great place, though.
  7110. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
  7111. %
  7112. % And now, it's time to reuse the body of the original defun:
  7113. \expandafter\gobbledefun#1%
  7114. }
  7115. \def\gobbledefun#1\startdefun{}
  7116. % \printdefunline \deffnheader{text}
  7117. %
  7118. \def\printdefunline#1#2{%
  7119. \begingroup
  7120. % call \deffnheader:
  7121. #1#2 \endheader
  7122. % common ending:
  7123. \interlinepenalty = 10000
  7124. \advance\rightskip by 0pt plus 1fil\relax
  7125. \endgraf
  7126. \nobreak\vskip -\parskip
  7127. \penalty\defunpenalty % signal to \startdefun and \dodefunx
  7128. % Some of the @defun-type tags do not enable magic parentheses,
  7129. % rendering the following check redundant. But we don't optimize.
  7130. \checkparencounts
  7131. \endgroup
  7132. }
  7133. \def\Edefun{\endgraf\medbreak}
  7134. % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
  7135. % the only thing remaining is to define \deffnheader.
  7136. %
  7137. \def\makedefun#1{%
  7138. \expandafter\let\csname E#1\endcsname = \Edefun
  7139. \edef\temp{\noexpand\domakedefun
  7140. \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
  7141. \temp
  7142. }
  7143. % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
  7144. %
  7145. % Define \deffn and \deffnx, without parameters.
  7146. % \deffnheader has to be defined explicitly.
  7147. %
  7148. \def\domakedefun#1#2#3{%
  7149. \envdef#1{%
  7150. \startdefun
  7151. \doingtypefnfalse % distinguish typed functions from all else
  7152. \parseargusing\activeparens{\printdefunline#3}%
  7153. }%
  7154. \def#2{\dodefunx#1}%
  7155. \def#3%
  7156. }
  7157. \newif\ifdoingtypefn % doing typed function?
  7158. \newif\ifrettypeownline % typeset return type on its own line?
  7159. % @deftypefnnewline on|off says whether the return type of typed functions
  7160. % are printed on their own line. This affects @deftypefn, @deftypefun,
  7161. % @deftypeop, and @deftypemethod.
  7162. %
  7163. \parseargdef\deftypefnnewline{%
  7164. \def\temp{#1}%
  7165. \ifx\temp\onword
  7166. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7167. = \empty
  7168. \else\ifx\temp\offword
  7169. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7170. = \relax
  7171. \else
  7172. \errhelp = \EMsimple
  7173. \errmessage{Unknown @txideftypefnnl value `\temp',
  7174. must be on|off}%
  7175. \fi\fi
  7176. }
  7177. % Untyped functions:
  7178. % @deffn category name args
  7179. \makedefun{deffn}{\deffngeneral{}}
  7180. % @deffn category class name args
  7181. \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
  7182. % \defopon {category on}class name args
  7183. \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7184. % \deffngeneral {subind}category name args
  7185. %
  7186. \def\deffngeneral#1#2 #3 #4\endheader{%
  7187. % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
  7188. \dosubind{fn}{\code{#3}}{#1}%
  7189. \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
  7190. }
  7191. % Typed functions:
  7192. % @deftypefn category type name args
  7193. \makedefun{deftypefn}{\deftypefngeneral{}}
  7194. % @deftypeop category class type name args
  7195. \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
  7196. % \deftypeopon {category on}class type name args
  7197. \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7198. % \deftypefngeneral {subind}category type name args
  7199. %
  7200. \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
  7201. \dosubind{fn}{\code{#4}}{#1}%
  7202. \doingtypefntrue
  7203. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7204. }
  7205. % Typed variables:
  7206. % @deftypevr category type var args
  7207. \makedefun{deftypevr}{\deftypecvgeneral{}}
  7208. % @deftypecv category class type var args
  7209. \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
  7210. % \deftypecvof {category of}class type var args
  7211. \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
  7212. % \deftypecvgeneral {subind}category type var args
  7213. %
  7214. \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
  7215. \dosubind{vr}{\code{#4}}{#1}%
  7216. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7217. }
  7218. % Untyped variables:
  7219. % @defvr category var args
  7220. \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
  7221. % @defcv category class var args
  7222. \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
  7223. % \defcvof {category of}class var args
  7224. \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
  7225. % Types:
  7226. % @deftp category name args
  7227. \makedefun{deftp}#1 #2 #3\endheader{%
  7228. \doind{tp}{\code{#2}}%
  7229. \defname{#1}{}{#2}\defunargs{#3\unskip}%
  7230. }
  7231. % Remaining @defun-like shortcuts:
  7232. \makedefun{defun}{\deffnheader{\putwordDeffunc} }
  7233. \makedefun{defmac}{\deffnheader{\putwordDefmac} }
  7234. \makedefun{defspec}{\deffnheader{\putwordDefspec} }
  7235. \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
  7236. \makedefun{defvar}{\defvrheader{\putwordDefvar} }
  7237. \makedefun{defopt}{\defvrheader{\putwordDefopt} }
  7238. \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
  7239. \makedefun{defmethod}{\defopon\putwordMethodon}
  7240. \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
  7241. \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
  7242. \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
  7243. % \defname, which formats the name of the @def (not the args).
  7244. % #1 is the category, such as "Function".
  7245. % #2 is the return type, if any.
  7246. % #3 is the function name.
  7247. %
  7248. % We are followed by (but not passed) the arguments, if any.
  7249. %
  7250. \def\defname#1#2#3{%
  7251. \par
  7252. % Get the values of \leftskip and \rightskip as they were outside the @def...
  7253. \advance\leftskip by -\defbodyindent
  7254. %
  7255. % Determine if we are typesetting the return type of a typed function
  7256. % on a line by itself.
  7257. \rettypeownlinefalse
  7258. \ifdoingtypefn % doing a typed function specifically?
  7259. % then check user option for putting return type on its own line:
  7260. \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
  7261. \rettypeownlinetrue
  7262. \fi
  7263. \fi
  7264. %
  7265. % How we'll format the category name. Putting it in brackets helps
  7266. % distinguish it from the body text that may end up on the next line
  7267. % just below it.
  7268. \def\temp{#1}%
  7269. \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
  7270. %
  7271. % Figure out line sizes for the paragraph shape. We'll always have at
  7272. % least two.
  7273. \tempnum = 2
  7274. %
  7275. % The first line needs space for \box0; but if \rightskip is nonzero,
  7276. % we need only space for the part of \box0 which exceeds it:
  7277. \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
  7278. %
  7279. % If doing a return type on its own line, we'll have another line.
  7280. \ifrettypeownline
  7281. \advance\tempnum by 1
  7282. \def\maybeshapeline{0in \hsize}%
  7283. \else
  7284. \def\maybeshapeline{}%
  7285. \fi
  7286. %
  7287. % The continuations:
  7288. \dimen2=\hsize \advance\dimen2 by -\defargsindent
  7289. %
  7290. % The final paragraph shape:
  7291. \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
  7292. %
  7293. % Put the category name at the right margin.
  7294. \noindent
  7295. \hbox to 0pt{%
  7296. \hfil\box0 \kern-\hsize
  7297. % \hsize has to be shortened this way:
  7298. \kern\leftskip
  7299. % Intentionally do not respect \rightskip, since we need the space.
  7300. }%
  7301. %
  7302. % Allow all lines to be underfull without complaint:
  7303. \tolerance=10000 \hbadness=10000
  7304. \exdentamount=\defbodyindent
  7305. {%
  7306. % defun fonts. We use typewriter by default (used to be bold) because:
  7307. % . we're printing identifiers, they should be in tt in principle.
  7308. % . in languages with many accents, such as Czech or French, it's
  7309. % common to leave accents off identifiers. The result looks ok in
  7310. % tt, but exceedingly strange in rm.
  7311. % . we don't want -- and --- to be treated as ligatures.
  7312. % . this still does not fix the ?` and !` ligatures, but so far no
  7313. % one has made identifiers using them :).
  7314. \df \tt
  7315. \def\temp{#2}% text of the return type
  7316. \ifx\temp\empty\else
  7317. \tclose{\temp}% typeset the return type
  7318. \ifrettypeownline
  7319. % put return type on its own line; prohibit line break following:
  7320. \hfil\vadjust{\nobreak}\break
  7321. \else
  7322. \space % type on same line, so just followed by a space
  7323. \fi
  7324. \fi % no return type
  7325. #3% output function name
  7326. }%
  7327. {\rm\enskip}% hskip 0.5 em of \rmfont
  7328. %
  7329. \boldbrax
  7330. % arguments will be output next, if any.
  7331. }
  7332. % Print arguments in slanted roman (not ttsl), inconsistently with using
  7333. % tt for the name. This is because literal text is sometimes needed in
  7334. % the argument list (groff manual), and ttsl and tt are not very
  7335. % distinguishable. Prevent hyphenation at `-' chars.
  7336. %
  7337. \def\defunargs#1{%
  7338. % use sl by default (not ttsl),
  7339. % tt for the names.
  7340. \df \sl \hyphenchar\font=0
  7341. %
  7342. % On the other hand, if an argument has two dashes (for instance), we
  7343. % want a way to get ttsl. We used to recommend @var for that, so
  7344. % leave the code in, but it's strange for @var to lead to typewriter.
  7345. % Nowadays we recommend @code, since the difference between a ttsl hyphen
  7346. % and a tt hyphen is pretty tiny. @code also disables ?` !`.
  7347. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
  7348. #1%
  7349. \sl\hyphenchar\font=45
  7350. }
  7351. % We want ()&[] to print specially on the defun line.
  7352. %
  7353. \def\activeparens{%
  7354. \catcode`\(=\active \catcode`\)=\active
  7355. \catcode`\[=\active \catcode`\]=\active
  7356. \catcode`\&=\active
  7357. }
  7358. % Make control sequences which act like normal parenthesis chars.
  7359. \let\lparen = ( \let\rparen = )
  7360. % Be sure that we always have a definition for `(', etc. For example,
  7361. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  7362. % so TeX would otherwise complain about undefined control sequence.
  7363. {
  7364. \activeparens
  7365. \global\let(=\lparen \global\let)=\rparen
  7366. \global\let[=\lbrack \global\let]=\rbrack
  7367. \global\let& = \&
  7368. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  7369. \gdef\magicamp{\let&=\amprm}
  7370. }
  7371. \newcount\parencount
  7372. % If we encounter &foo, then turn on ()-hacking afterwards
  7373. \newif\ifampseen
  7374. \def\amprm#1 {\ampseentrue{\bf\&#1 }}
  7375. \def\parenfont{%
  7376. \ifampseen
  7377. % At the first level, print parens in roman,
  7378. % otherwise use the default font.
  7379. \ifnum \parencount=1 \rm \fi
  7380. \else
  7381. % The \sf parens (in \boldbrax) actually are a little bolder than
  7382. % the contained text. This is especially needed for [ and ] .
  7383. \sf
  7384. \fi
  7385. }
  7386. \def\infirstlevel#1{%
  7387. \ifampseen
  7388. \ifnum\parencount=1
  7389. #1%
  7390. \fi
  7391. \fi
  7392. }
  7393. \def\bfafterword#1 {#1 \bf}
  7394. \def\opnr{%
  7395. \global\advance\parencount by 1
  7396. {\parenfont(}%
  7397. \infirstlevel \bfafterword
  7398. }
  7399. \def\clnr{%
  7400. {\parenfont)}%
  7401. \infirstlevel \sl
  7402. \global\advance\parencount by -1
  7403. }
  7404. \newcount\brackcount
  7405. \def\lbrb{%
  7406. \global\advance\brackcount by 1
  7407. {\bf[}%
  7408. }
  7409. \def\rbrb{%
  7410. {\bf]}%
  7411. \global\advance\brackcount by -1
  7412. }
  7413. \def\checkparencounts{%
  7414. \ifnum\parencount=0 \else \badparencount \fi
  7415. \ifnum\brackcount=0 \else \badbrackcount \fi
  7416. }
  7417. % these should not use \errmessage; the glibc manual, at least, actually
  7418. % has such constructs (when documenting function pointers).
  7419. \def\badparencount{%
  7420. \message{Warning: unbalanced parentheses in @def...}%
  7421. \global\parencount=0
  7422. }
  7423. \def\badbrackcount{%
  7424. \message{Warning: unbalanced square brackets in @def...}%
  7425. \global\brackcount=0
  7426. }
  7427. \message{macros,}
  7428. % @macro.
  7429. % To do this right we need a feature of e-TeX, \scantokens,
  7430. % which we arrange to emulate with a temporary file in ordinary TeX.
  7431. \ifx\eTeXversion\thisisundefined
  7432. \newwrite\macscribble
  7433. \def\scantokens#1{%
  7434. \toks0={#1}%
  7435. \immediate\openout\macscribble=\jobname.tmp
  7436. \immediate\write\macscribble{\the\toks0}%
  7437. \immediate\closeout\macscribble
  7438. \input \jobname.tmp
  7439. }
  7440. \fi
  7441. % alias because \c means cedilla in @tex or @math
  7442. \let\texinfoc=\c
  7443. \newcount\savedcatcodeone
  7444. \newcount\savedcatcodetwo
  7445. % Used at the time of macro expansion.
  7446. % Argument is macro body with arguments substituted
  7447. \def\scanmacro#1{%
  7448. \newlinechar`\^^M
  7449. \def\xeatspaces{\eatspaces}%
  7450. %
  7451. % Temporarily undo catcode changes of \printindex. Set catcode of @ to
  7452. % 0 so that @-commands in macro expansions aren't printed literally when
  7453. % formatting an index file, where \ is used as the escape character.
  7454. \savedcatcodeone=\catcode`\@
  7455. \savedcatcodetwo=\catcode`\\
  7456. \catcode`\@=0
  7457. \catcode`\\=\active
  7458. %
  7459. % Process the macro body under the current catcode regime.
  7460. \scantokens{#1@texinfoc}%
  7461. %
  7462. \catcode`\@=\savedcatcodeone
  7463. \catcode`\\=\savedcatcodetwo
  7464. %
  7465. % The \texinfoc is to remove the \newlinechar added by \scantokens, and
  7466. % can be noticed by \parsearg.
  7467. % We avoid surrounding the call to \scantokens with \bgroup and \egroup
  7468. % to allow macros to open or close groups themselves.
  7469. }
  7470. % Used for copying and captions
  7471. \def\scanexp#1{%
  7472. \expandafter\scanmacro\expandafter{#1}%
  7473. }
  7474. \newcount\paramno % Count of parameters
  7475. \newtoks\macname % Macro name
  7476. \newif\ifrecursive % Is it recursive?
  7477. % List of all defined macros in the form
  7478. % \commondummyword\macro1\commondummyword\macro2...
  7479. % Currently is also contains all @aliases; the list can be split
  7480. % if there is a need.
  7481. \def\macrolist{}
  7482. % Add the macro to \macrolist
  7483. \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
  7484. \def\addtomacrolistxxx#1{%
  7485. \toks0 = \expandafter{\macrolist\commondummyword#1}%
  7486. \xdef\macrolist{\the\toks0}%
  7487. }
  7488. % Utility routines.
  7489. % This does \let #1 = #2, with \csnames; that is,
  7490. % \let \csname#1\endcsname = \csname#2\endcsname
  7491. % (except of course we have to play expansion games).
  7492. %
  7493. \def\cslet#1#2{%
  7494. \expandafter\let
  7495. \csname#1\expandafter\endcsname
  7496. \csname#2\endcsname
  7497. }
  7498. % Trim leading and trailing spaces off a string.
  7499. % Concepts from aro-bend problem 15 (see CTAN).
  7500. {\catcode`\@=11
  7501. \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  7502. \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  7503. \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  7504. \def\unbrace#1{#1}
  7505. \unbrace{\gdef\trim@@@ #1 } #2@{#1}
  7506. }
  7507. % Trim a single trailing ^^M off a string.
  7508. {\catcode`\^^M=\other \catcode`\Q=3%
  7509. \gdef\eatcr #1{\eatcra #1Q^^MQ}%
  7510. \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  7511. \gdef\eatcrb#1Q#2Q{#1}%
  7512. }
  7513. % Macro bodies are absorbed as an argument in a context where
  7514. % all characters are catcode 10, 11 or 12, except \ which is active
  7515. % (as in normal texinfo). It is necessary to change the definition of \
  7516. % to recognize macro arguments; this is the job of \mbodybackslash.
  7517. %
  7518. % Non-ASCII encodings make 8-bit characters active, so un-activate
  7519. % them to avoid their expansion. Must do this non-globally, to
  7520. % confine the change to the current group.
  7521. %
  7522. % It's necessary to have hard CRs when the macro is executed. This is
  7523. % done by making ^^M (\endlinechar) catcode 12 when reading the macro
  7524. % body, and then making it the \newlinechar in \scanmacro.
  7525. %
  7526. \def\scanctxt{% used as subroutine
  7527. \catcode`\"=\other
  7528. \catcode`\+=\other
  7529. \catcode`\<=\other
  7530. \catcode`\>=\other
  7531. \catcode`\^=\other
  7532. \catcode`\_=\other
  7533. \catcode`\|=\other
  7534. \catcode`\~=\other
  7535. \passthroughcharstrue
  7536. }
  7537. \def\scanargctxt{% used for copying and captions, not macros.
  7538. \scanctxt
  7539. \catcode`\@=\other
  7540. \catcode`\\=\other
  7541. \catcode`\^^M=\other
  7542. }
  7543. \def\macrobodyctxt{% used for @macro definitions
  7544. \scanctxt
  7545. \catcode`\ =\other
  7546. \catcode`\@=\other
  7547. \catcode`\{=\other
  7548. \catcode`\}=\other
  7549. \catcode`\^^M=\other
  7550. \usembodybackslash
  7551. }
  7552. % Used when scanning braced macro arguments. Note, however, that catcode
  7553. % changes here are ineffectual if the macro invocation was nested inside
  7554. % an argument to another Texinfo command.
  7555. \def\macroargctxt{%
  7556. \scanctxt
  7557. \catcode`\ =\active
  7558. \catcode`\^^M=\other
  7559. \catcode`\\=\active
  7560. }
  7561. \def\macrolineargctxt{% used for whole-line arguments without braces
  7562. \scanctxt
  7563. \catcode`\{=\other
  7564. \catcode`\}=\other
  7565. }
  7566. % \mbodybackslash is the definition of \ in @macro bodies.
  7567. % It maps \foo\ => \csname macarg.foo\endcsname => #N
  7568. % where N is the macro parameter number.
  7569. % We define \csname macarg.\endcsname to be \realbackslash, so
  7570. % \\ in macro replacement text gets you a backslash.
  7571. %
  7572. {\catcode`@=0 @catcode`@\=@active
  7573. @gdef@usembodybackslash{@let\=@mbodybackslash}
  7574. @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  7575. }
  7576. \expandafter\def\csname macarg.\endcsname{\realbackslash}
  7577. \def\margbackslash#1{\char`\#1 }
  7578. \def\macro{\recursivefalse\parsearg\macroxxx}
  7579. \def\rmacro{\recursivetrue\parsearg\macroxxx}
  7580. \def\macroxxx#1{%
  7581. \getargs{#1}% now \macname is the macname and \argl the arglist
  7582. \ifx\argl\empty % no arguments
  7583. \paramno=0\relax
  7584. \else
  7585. \expandafter\parsemargdef \argl;%
  7586. \if\paramno>256\relax
  7587. \ifx\eTeXversion\thisisundefined
  7588. \errhelp = \EMsimple
  7589. \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
  7590. \fi
  7591. \fi
  7592. \fi
  7593. \if1\csname ismacro.\the\macname\endcsname
  7594. \message{Warning: redefining \the\macname}%
  7595. \else
  7596. \expandafter\ifx\csname \the\macname\endcsname \relax
  7597. \else \errmessage{Macro name \the\macname\space already defined}\fi
  7598. \global\cslet{macsave.\the\macname}{\the\macname}%
  7599. \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  7600. \addtomacrolist{\the\macname}%
  7601. \fi
  7602. \begingroup \macrobodyctxt
  7603. \ifrecursive \expandafter\parsermacbody
  7604. \else \expandafter\parsemacbody
  7605. \fi}
  7606. \parseargdef\unmacro{%
  7607. \if1\csname ismacro.#1\endcsname
  7608. \global\cslet{#1}{macsave.#1}%
  7609. \global\expandafter\let \csname ismacro.#1\endcsname=0%
  7610. % Remove the macro name from \macrolist:
  7611. \begingroup
  7612. \expandafter\let\csname#1\endcsname \relax
  7613. \let\commondummyword\unmacrodo
  7614. \xdef\macrolist{\macrolist}%
  7615. \endgroup
  7616. \else
  7617. \errmessage{Macro #1 not defined}%
  7618. \fi
  7619. }
  7620. % Called by \do from \dounmacro on each macro. The idea is to omit any
  7621. % macro definitions that have been changed to \relax.
  7622. %
  7623. \def\unmacrodo#1{%
  7624. \ifx #1\relax
  7625. % remove this
  7626. \else
  7627. \noexpand\commondummyword \noexpand#1%
  7628. \fi
  7629. }
  7630. % \getargs -- Parse the arguments to a @macro line. Set \macname to
  7631. % the name of the macro, and \argl to the braced argument list.
  7632. \def\getargs#1{\getargsxxx#1{}}
  7633. \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  7634. \def\getmacname#1 #2\relax{\macname={#1}}
  7635. \def\getmacargs#1{\def\argl{#1}}
  7636. % This made use of the feature that if the last token of a
  7637. % <parameter list> is #, then the preceding argument is delimited by
  7638. % an opening brace, and that opening brace is not consumed.
  7639. % Parse the optional {params} list to @macro or @rmacro.
  7640. % Set \paramno to the number of arguments,
  7641. % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
  7642. % three-param macro.) Define \macarg.BLAH for each BLAH in the params
  7643. % list to some hook where the argument is to be expanded. If there are
  7644. % less than 10 arguments that hook is to be replaced by ##N where N
  7645. % is the position in that list, that is to say the macro arguments are to be
  7646. % defined `a la TeX in the macro body.
  7647. %
  7648. % That gets used by \mbodybackslash (above).
  7649. %
  7650. % If there are 10 or more arguments, a different technique is used: see
  7651. % \parsemmanyargdef.
  7652. %
  7653. \def\parsemargdef#1;{%
  7654. \paramno=0\def\paramlist{}%
  7655. \let\hash\relax
  7656. % \hash is redefined to `#' later to get it into definitions
  7657. \let\xeatspaces\relax
  7658. \parsemargdefxxx#1,;,%
  7659. \ifnum\paramno<10\relax\else
  7660. \paramno0\relax
  7661. \parsemmanyargdef@@#1,;,% 10 or more arguments
  7662. \fi
  7663. }
  7664. \def\parsemargdefxxx#1,{%
  7665. \if#1;\let\next=\relax
  7666. \else \let\next=\parsemargdefxxx
  7667. \advance\paramno by 1
  7668. \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  7669. {\xeatspaces{\hash\the\paramno}}%
  7670. \edef\paramlist{\paramlist\hash\the\paramno,}%
  7671. \fi\next}
  7672. % \parsemacbody, \parsermacbody
  7673. %
  7674. % Read recursive and nonrecursive macro bodies. (They're different since
  7675. % rec and nonrec macros end differently.)
  7676. %
  7677. % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
  7678. % body to be transformed.
  7679. % Set \macrobody to the body of the macro, and call \defmacro.
  7680. %
  7681. {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
  7682. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7683. {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
  7684. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7685. % Make @ a letter, so that we can make private-to-Texinfo macro names.
  7686. \edef\texiatcatcode{\the\catcode`\@}
  7687. \catcode `@=11\relax
  7688. %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
  7689. % If there are 10 or more arguments, a different technique is used, where the
  7690. % hook remains in the body, and when macro is to be expanded the body is
  7691. % processed again to replace the arguments.
  7692. %
  7693. % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
  7694. % argument N value and then \edef the body (nothing else will expand because of
  7695. % the catcode regime under which the body was input).
  7696. %
  7697. % If you compile with TeX (not eTeX), and you have macros with 10 or more
  7698. % arguments, no macro can have more than 256 arguments (else error).
  7699. %
  7700. % In case that there are 10 or more arguments we parse again the arguments
  7701. % list to set new definitions for the \macarg.BLAH macros corresponding to
  7702. % each BLAH argument. It was anyhow needed to parse already once this list
  7703. % in order to count the arguments, and as macros with at most 9 arguments
  7704. % are by far more frequent than macro with 10 or more arguments, defining
  7705. % twice the \macarg.BLAH macros does not cost too much processing power.
  7706. \def\parsemmanyargdef@@#1,{%
  7707. \if#1;\let\next=\relax
  7708. \else
  7709. \let\next=\parsemmanyargdef@@
  7710. \edef\tempb{\eatspaces{#1}}%
  7711. \expandafter\def\expandafter\tempa
  7712. \expandafter{\csname macarg.\tempb\endcsname}%
  7713. % Note that we need some extra \noexpand\noexpand, this is because we
  7714. % don't want \the to be expanded in the \parsermacbody as it uses an
  7715. % \xdef .
  7716. \expandafter\edef\tempa
  7717. {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
  7718. \advance\paramno by 1\relax
  7719. \fi\next}
  7720. \let\endargs@\relax
  7721. \let\nil@\relax
  7722. \def\nilm@{\nil@}%
  7723. \long\def\nillm@{\nil@}%
  7724. % This macro is expanded during the Texinfo macro expansion, not during its
  7725. % definition. It gets all the arguments' values and assigns them to macros
  7726. % macarg.ARGNAME
  7727. %
  7728. % #1 is the macro name
  7729. % #2 is the list of argument names
  7730. % #3 is the list of argument values
  7731. \def\getargvals@#1#2#3{%
  7732. \def\macargdeflist@{}%
  7733. \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
  7734. \def\paramlist{#2,\nil@}%
  7735. \def\macroname{#1}%
  7736. \begingroup
  7737. \macroargctxt
  7738. \def\argvaluelist{#3,\nil@}%
  7739. \def\@tempa{#3}%
  7740. \ifx\@tempa\empty
  7741. \setemptyargvalues@
  7742. \else
  7743. \getargvals@@
  7744. \fi
  7745. }
  7746. \def\getargvals@@{%
  7747. \ifx\paramlist\nilm@
  7748. % Some sanity check needed here that \argvaluelist is also empty.
  7749. \ifx\argvaluelist\nillm@
  7750. \else
  7751. \errhelp = \EMsimple
  7752. \errmessage{Too many arguments in macro `\macroname'!}%
  7753. \fi
  7754. \let\next\macargexpandinbody@
  7755. \else
  7756. \ifx\argvaluelist\nillm@
  7757. % No more arguments values passed to macro. Set remaining named-arg
  7758. % macros to empty.
  7759. \let\next\setemptyargvalues@
  7760. \else
  7761. % pop current arg name into \@tempb
  7762. \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
  7763. \expandafter\@tempa\expandafter{\paramlist}%
  7764. % pop current argument value into \@tempc
  7765. \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
  7766. \expandafter\@tempa\expandafter{\argvaluelist}%
  7767. % Here \@tempb is the current arg name and \@tempc is the current arg value.
  7768. % First place the new argument macro definition into \@tempd
  7769. \expandafter\macname\expandafter{\@tempc}%
  7770. \expandafter\let\csname macarg.\@tempb\endcsname\relax
  7771. \expandafter\def\expandafter\@tempe\expandafter{%
  7772. \csname macarg.\@tempb\endcsname}%
  7773. \edef\@tempd{\long\def\@tempe{\the\macname}}%
  7774. \push@\@tempd\macargdeflist@
  7775. \let\next\getargvals@@
  7776. \fi
  7777. \fi
  7778. \next
  7779. }
  7780. \def\push@#1#2{%
  7781. \expandafter\expandafter\expandafter\def
  7782. \expandafter\expandafter\expandafter#2%
  7783. \expandafter\expandafter\expandafter{%
  7784. \expandafter#1#2}%
  7785. }
  7786. % Replace arguments by their values in the macro body, and place the result
  7787. % in macro \@tempa.
  7788. %
  7789. \def\macvalstoargs@{%
  7790. % To do this we use the property that token registers that are \the'ed
  7791. % within an \edef expand only once. So we are going to place all argument
  7792. % values into respective token registers.
  7793. %
  7794. % First we save the token context, and initialize argument numbering.
  7795. \begingroup
  7796. \paramno0\relax
  7797. % Then, for each argument number #N, we place the corresponding argument
  7798. % value into a new token list register \toks#N
  7799. \expandafter\putargsintokens@\saveparamlist@,;,%
  7800. % Then, we expand the body so that argument are replaced by their
  7801. % values. The trick for values not to be expanded themselves is that they
  7802. % are within tokens and that tokens expand only once in an \edef .
  7803. \edef\@tempc{\csname mac.\macroname .body\endcsname}%
  7804. % Now we restore the token stack pointer to free the token list registers
  7805. % which we have used, but we make sure that expanded body is saved after
  7806. % group.
  7807. \expandafter
  7808. \endgroup
  7809. \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
  7810. }
  7811. % Define the named-macro outside of this group and then close this group.
  7812. %
  7813. \def\macargexpandinbody@{%
  7814. \expandafter
  7815. \endgroup
  7816. \macargdeflist@
  7817. % First the replace in body the macro arguments by their values, the result
  7818. % is in \@tempa .
  7819. \macvalstoargs@
  7820. % Then we point at the \norecurse or \gobble (for recursive) macro value
  7821. % with \@tempb .
  7822. \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
  7823. % Depending on whether it is recursive or not, we need some tailing
  7824. % \egroup .
  7825. \ifx\@tempb\gobble
  7826. \let\@tempc\relax
  7827. \else
  7828. \let\@tempc\egroup
  7829. \fi
  7830. % And now we do the real job:
  7831. \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
  7832. \@tempd
  7833. }
  7834. \def\putargsintokens@#1,{%
  7835. \if#1;\let\next\relax
  7836. \else
  7837. \let\next\putargsintokens@
  7838. % First we allocate the new token list register, and give it a temporary
  7839. % alias \@tempb .
  7840. \toksdef\@tempb\the\paramno
  7841. % Then we place the argument value into that token list register.
  7842. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
  7843. \expandafter\@tempb\expandafter{\@tempa}%
  7844. \advance\paramno by 1\relax
  7845. \fi
  7846. \next
  7847. }
  7848. % Trailing missing arguments are set to empty.
  7849. %
  7850. \def\setemptyargvalues@{%
  7851. \ifx\paramlist\nilm@
  7852. \let\next\macargexpandinbody@
  7853. \else
  7854. \expandafter\setemptyargvaluesparser@\paramlist\endargs@
  7855. \let\next\setemptyargvalues@
  7856. \fi
  7857. \next
  7858. }
  7859. \def\setemptyargvaluesparser@#1,#2\endargs@{%
  7860. \expandafter\def\expandafter\@tempa\expandafter{%
  7861. \expandafter\def\csname macarg.#1\endcsname{}}%
  7862. \push@\@tempa\macargdeflist@
  7863. \def\paramlist{#2}%
  7864. }
  7865. % #1 is the element target macro
  7866. % #2 is the list macro
  7867. % #3,#4\endargs@ is the list value
  7868. \def\pop@#1#2#3,#4\endargs@{%
  7869. \def#1{#3}%
  7870. \def#2{#4}%
  7871. }
  7872. \long\def\longpop@#1#2#3,#4\endargs@{%
  7873. \long\def#1{#3}%
  7874. \long\def#2{#4}%
  7875. }
  7876. %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
  7877. % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
  7878. % \macrobody has the body of the macro in it, with placeholders for
  7879. % its parameters, looking like "\xeatspaces{\hash 1}".
  7880. % \paramno is the number of parameters
  7881. % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
  7882. % There are four cases: macros of zero, one, up to nine, and many arguments.
  7883. % \xdef is used so that macro definitions will survive the file
  7884. % they're defined in: @include reads the file inside a group.
  7885. %
  7886. \def\defmacro{%
  7887. \let\hash=##% convert placeholders to macro parameter chars
  7888. \ifnum\paramno=1
  7889. \def\xeatspaces##1{##1}%
  7890. % This removes the pair of braces around the argument. We don't
  7891. % use \eatspaces, because this can cause ends of lines to be lost
  7892. % when the argument to \eatspaces is read, leading to line-based
  7893. % commands like "@itemize" not being read correctly.
  7894. \else
  7895. \let\xeatspaces\relax % suppress expansion
  7896. \fi
  7897. \ifcase\paramno
  7898. % 0
  7899. \expandafter\xdef\csname\the\macname\endcsname{%
  7900. \bgroup
  7901. \noexpand\spaceisspace
  7902. \noexpand\endlineisspace
  7903. \noexpand\expandafter % skip any whitespace after the macro name.
  7904. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7905. \expandafter\xdef\csname\the\macname @@@\endcsname{%
  7906. \egroup
  7907. \noexpand\scanmacro{\macrobody}}%
  7908. \or % 1
  7909. \expandafter\xdef\csname\the\macname\endcsname{%
  7910. \bgroup
  7911. \noexpand\braceorline
  7912. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7913. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7914. \egroup
  7915. \noexpand\scanmacro{\macrobody}%
  7916. }%
  7917. \else % at most 9
  7918. \ifnum\paramno<10\relax
  7919. % @MACNAME sets the context for reading the macro argument
  7920. % @MACNAME@@ gets the argument, processes backslashes and appends a
  7921. % comma.
  7922. % @MACNAME@@@ removes braces surrounding the argument list.
  7923. % @MACNAME@@@@ scans the macro body with arguments substituted.
  7924. \expandafter\xdef\csname\the\macname\endcsname{%
  7925. \bgroup
  7926. \noexpand\expandafter % This \expandafter skip any spaces after the
  7927. \noexpand\macroargctxt % macro before we change the catcode of space.
  7928. \noexpand\expandafter
  7929. \expandafter\noexpand\csname\the\macname @@\endcsname}%
  7930. \expandafter\xdef\csname\the\macname @@\endcsname##1{%
  7931. \noexpand\passargtomacro
  7932. \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
  7933. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7934. \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
  7935. \expandafter\expandafter
  7936. \expandafter\xdef
  7937. \expandafter\expandafter
  7938. \csname\the\macname @@@@\endcsname\paramlist{%
  7939. \egroup\noexpand\scanmacro{\macrobody}}%
  7940. \else % 10 or more:
  7941. \expandafter\xdef\csname\the\macname\endcsname{%
  7942. \noexpand\getargvals@{\the\macname}{\argl}%
  7943. }%
  7944. \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
  7945. \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
  7946. \fi
  7947. \fi}
  7948. \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
  7949. \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  7950. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7951. %
  7952. {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
  7953. @catcode`@_=11 % private names
  7954. @catcode`@!=11 % used as argument separator
  7955. % \passargtomacro#1#2 -
  7956. % Call #1 with a list of tokens #2, with any doubled backslashes in #2
  7957. % compressed to one.
  7958. %
  7959. % This implementation works by expansion, and not execution (so we cannot use
  7960. % \def or similar). This reduces the risk of this failing in contexts where
  7961. % complete expansion is done with no execution (for example, in writing out to
  7962. % an auxiliary file for an index entry).
  7963. %
  7964. % State is kept in the input stream: the argument passed to
  7965. % @look_ahead, @gobble_and_check_finish and @add_segment is
  7966. %
  7967. % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
  7968. %
  7969. % where:
  7970. % THE_MACRO - name of the macro we want to call
  7971. % ARG_RESULT - argument list we build to pass to that macro
  7972. % PENDING_BS - either a backslash or nothing
  7973. % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
  7974. @gdef@passargtomacro#1#2{%
  7975. @add_segment #1!{}@relax#2\@_finish\%
  7976. }
  7977. @gdef@_finish{@_finishx} @global@let@_finishx@relax
  7978. % #1 - THE_MACRO ARG_RESULT
  7979. % #2 - PENDING_BS
  7980. % #3 - NEXT_TOKEN
  7981. % #4 used to look ahead
  7982. %
  7983. % If the next token is not a backslash, process the rest of the argument;
  7984. % otherwise, remove the next token.
  7985. @gdef@look_ahead#1!#2#3#4{%
  7986. @ifx#4\%
  7987. @expandafter@gobble_and_check_finish
  7988. @else
  7989. @expandafter@add_segment
  7990. @fi#1!{#2}#4#4%
  7991. }
  7992. % #1 - THE_MACRO ARG_RESULT
  7993. % #2 - PENDING_BS
  7994. % #3 - NEXT_TOKEN
  7995. % #4 should be a backslash, which is gobbled.
  7996. % #5 looks ahead
  7997. %
  7998. % Double backslash found. Add a single backslash, and look ahead.
  7999. @gdef@gobble_and_check_finish#1!#2#3#4#5{%
  8000. @add_segment#1\!{}#5#5%
  8001. }
  8002. @gdef@is_fi{@fi}
  8003. % #1 - THE_MACRO ARG_RESULT
  8004. % #2 - PENDING_BS
  8005. % #3 - NEXT_TOKEN
  8006. % #4 is input stream until next backslash
  8007. %
  8008. % Input stream is either at the start of the argument, or just after a
  8009. % backslash sequence, either a lone backslash, or a doubled backslash.
  8010. % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
  8011. % finish; otherwise, append to ARG_RESULT the segment of the argument up until
  8012. % the next backslash. PENDING_BACKSLASH contains a backslash to represent
  8013. % a backslash just before the start of the input stream that has not been
  8014. % added to ARG_RESULT.
  8015. @gdef@add_segment#1!#2#3#4\{%
  8016. @ifx#3@_finish
  8017. @call_the_macro#1!%
  8018. @else
  8019. % append the pending backslash to the result, followed by the next segment
  8020. @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
  8021. % this @fi is discarded by @look_ahead.
  8022. % we can't get rid of it with \expandafter because we don't know how
  8023. % long #4 is.
  8024. }
  8025. % #1 - THE_MACRO
  8026. % #2 - ARG_RESULT
  8027. % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
  8028. % conditional.
  8029. @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
  8030. }
  8031. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8032. % \braceorline MAC is used for a one-argument macro MAC. It checks
  8033. % whether the next non-whitespace character is a {. It sets the context
  8034. % for reading the argument (slightly different in the two cases). Then,
  8035. % to read the argument, in the whole-line case, it then calls the regular
  8036. % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
  8037. %
  8038. \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
  8039. \def\braceorlinexxx{%
  8040. \ifx\nchar\bgroup
  8041. \macroargctxt
  8042. \expandafter\passargtomacro
  8043. \else
  8044. \macrolineargctxt\expandafter\parsearg
  8045. \fi \macnamexxx}
  8046. % @alias.
  8047. % We need some trickery to remove the optional spaces around the equal
  8048. % sign. Make them active and then expand them all to nothing.
  8049. %
  8050. \def\alias{\parseargusing\obeyspaces\aliasxxx}
  8051. \def\aliasxxx #1{\aliasyyy#1\relax}
  8052. \def\aliasyyy #1=#2\relax{%
  8053. {%
  8054. \expandafter\let\obeyedspace=\empty
  8055. \addtomacrolist{#1}%
  8056. \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
  8057. }%
  8058. \next
  8059. }
  8060. \message{cross references,}
  8061. \newwrite\auxfile
  8062. \newif\ifhavexrefs % True if xref values are known.
  8063. \newif\ifwarnedxrefs % True if we warned once that they aren't known.
  8064. % @inforef is relatively simple.
  8065. \def\inforef #1{\inforefzzz #1,,,,**}
  8066. \def\inforefzzz #1,#2,#3,#4**{%
  8067. \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  8068. node \samp{\ignorespaces#1{}}}
  8069. % @node's only job in TeX is to define \lastnode, which is used in
  8070. % cross-references. The @node line might or might not have commas, and
  8071. % might or might not have spaces before the first comma, like:
  8072. % @node foo , bar , ...
  8073. % We don't want such trailing spaces in the node name.
  8074. %
  8075. \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
  8076. %
  8077. % also remove a trailing comma, in case of something like this:
  8078. % @node Help-Cross, , , Cross-refs
  8079. \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
  8080. \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
  8081. \let\nwnode=\node
  8082. \let\lastnode=\empty
  8083. % Write a cross-reference definition for the current node. #1 is the
  8084. % type (Ynumbered, Yappendix, Ynothing).
  8085. %
  8086. \def\donoderef#1{%
  8087. \ifx\lastnode\empty\else
  8088. \setref{\lastnode}{#1}%
  8089. \global\let\lastnode=\empty
  8090. \fi
  8091. }
  8092. % @anchor{NAME} -- define xref target at arbitrary point.
  8093. %
  8094. \newcount\savesfregister
  8095. %
  8096. \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
  8097. \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
  8098. \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
  8099. % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
  8100. % anchor), which consists of three parts:
  8101. % 1) NAME-title - the current sectioning name taken from \lastsection,
  8102. % or the anchor name.
  8103. % 2) NAME-snt - section number and type, passed as the SNT arg, or
  8104. % empty for anchors.
  8105. % 3) NAME-pg - the page number.
  8106. %
  8107. % This is called from \donoderef, \anchor, and \dofloat. In the case of
  8108. % floats, there is an additional part, which is not written here:
  8109. % 4) NAME-lof - the text as it should appear in a @listoffloats.
  8110. %
  8111. \def\setref#1#2{%
  8112. \pdfmkdest{#1}%
  8113. \iflinks
  8114. {%
  8115. \requireauxfile
  8116. \atdummies % preserve commands, but don't expand them
  8117. % match definition in \xrdef, \refx, \xrefX.
  8118. \def\value##1{##1}%
  8119. \edef\writexrdef##1##2{%
  8120. \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
  8121. ##1}{##2}}% these are parameters of \writexrdef
  8122. }%
  8123. \toks0 = \expandafter{\lastsection}%
  8124. \immediate \writexrdef{title}{\the\toks0 }%
  8125. \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
  8126. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
  8127. }%
  8128. \fi
  8129. }
  8130. % @xrefautosectiontitle on|off says whether @section(ing) names are used
  8131. % automatically in xrefs, if the third arg is not explicitly specified.
  8132. % This was provided as a "secret" @set xref-automatic-section-title
  8133. % variable, now it's official.
  8134. %
  8135. \parseargdef\xrefautomaticsectiontitle{%
  8136. \def\temp{#1}%
  8137. \ifx\temp\onword
  8138. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8139. = \empty
  8140. \else\ifx\temp\offword
  8141. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8142. = \relax
  8143. \else
  8144. \errhelp = \EMsimple
  8145. \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
  8146. must be on|off}%
  8147. \fi\fi
  8148. }
  8149. %
  8150. % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
  8151. % the node name, #2 the name of the Info cross-reference, #3 the printed
  8152. % node name, #4 the name of the Info file, #5 the name of the printed
  8153. % manual. All but the node name can be omitted.
  8154. %
  8155. \def\pxref{\putwordsee{} \xrefXX}
  8156. \def\xref{\putwordSee{} \xrefXX}
  8157. \def\ref{\xrefXX}
  8158. \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
  8159. \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
  8160. %
  8161. \newbox\toprefbox
  8162. \newbox\printedrefnamebox
  8163. \newbox\infofilenamebox
  8164. \newbox\printedmanualbox
  8165. %
  8166. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  8167. \unsepspaces
  8168. %
  8169. % Get args without leading/trailing spaces.
  8170. \def\printedrefname{\ignorespaces #3}%
  8171. \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
  8172. %
  8173. \def\infofilename{\ignorespaces #4}%
  8174. \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
  8175. %
  8176. \def\printedmanual{\ignorespaces #5}%
  8177. \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
  8178. %
  8179. % If the printed reference name (arg #3) was not explicitly given in
  8180. % the @xref, figure out what we want to use.
  8181. \ifdim \wd\printedrefnamebox = 0pt
  8182. % No printed node name was explicitly given.
  8183. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
  8184. % Not auto section-title: use node name inside the square brackets.
  8185. \def\printedrefname{\ignorespaces #1}%
  8186. \else
  8187. % Auto section-title: use chapter/section title inside
  8188. % the square brackets if we have it.
  8189. \ifdim \wd\printedmanualbox > 0pt
  8190. % It is in another manual, so we don't have it; use node name.
  8191. \def\printedrefname{\ignorespaces #1}%
  8192. \else
  8193. \ifhavexrefs
  8194. % We (should) know the real title if we have the xref values.
  8195. \def\printedrefname{\refx{#1-title}{}}%
  8196. \else
  8197. % Otherwise just copy the Info node name.
  8198. \def\printedrefname{\ignorespaces #1}%
  8199. \fi%
  8200. \fi
  8201. \fi
  8202. \fi
  8203. %
  8204. % Make link in pdf output.
  8205. \ifpdf
  8206. % For pdfTeX and LuaTeX
  8207. {\indexnofonts
  8208. \makevalueexpandable
  8209. \turnoffactive
  8210. % This expands tokens, so do it after making catcode changes, so _
  8211. % etc. don't get their TeX definitions. This ignores all spaces in
  8212. % #4, including (wrongly) those in the middle of the filename.
  8213. \getfilename{#4}%
  8214. %
  8215. % This (wrongly) does not take account of leading or trailing
  8216. % spaces in #1, which should be ignored.
  8217. \setpdfdestname{#1}%
  8218. %
  8219. \ifx\pdfdestname\empty
  8220. \def\pdfdestname{Top}% no empty targets
  8221. \fi
  8222. %
  8223. \leavevmode
  8224. \startlink attr{/Border [0 0 0]}%
  8225. \ifnum\filenamelength>0
  8226. goto file{\the\filename.pdf} name{\pdfdestname}%
  8227. \else
  8228. goto name{\pdfmkpgn{\pdfdestname}}%
  8229. \fi
  8230. }%
  8231. \setcolor{\linkcolor}%
  8232. \else
  8233. \ifx\XeTeXrevision\thisisundefined
  8234. \else
  8235. % For XeTeX
  8236. {\indexnofonts
  8237. \makevalueexpandable
  8238. \turnoffactive
  8239. % This expands tokens, so do it after making catcode changes, so _
  8240. % etc. don't get their TeX definitions. This ignores all spaces in
  8241. % #4, including (wrongly) those in the middle of the filename.
  8242. \getfilename{#4}%
  8243. %
  8244. % This (wrongly) does not take account of leading or trailing
  8245. % spaces in #1, which should be ignored.
  8246. \setpdfdestname{#1}%
  8247. %
  8248. \ifx\pdfdestname\empty
  8249. \def\pdfdestname{Top}% no empty targets
  8250. \fi
  8251. %
  8252. \leavevmode
  8253. \ifnum\filenamelength>0
  8254. % With default settings,
  8255. % XeTeX (xdvipdfmx) replaces link destination names with integers.
  8256. % In this case, the replaced destination names of
  8257. % remote PDFs are no longer known. In order to avoid a replacement,
  8258. % you can use xdvipdfmx's command line option `-C 0x0010'.
  8259. % If you use XeTeX 0.99996+ (TeX Live 2016+),
  8260. % this command line option is no longer necessary
  8261. % because we can use the `dvipdfmx:config' special.
  8262. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8263. << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
  8264. \else
  8265. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8266. << /S /GoTo /D (\pdfdestname) >> >>}%
  8267. \fi
  8268. }%
  8269. \setcolor{\linkcolor}%
  8270. \fi
  8271. \fi
  8272. {%
  8273. % Have to otherify everything special to allow the \csname to
  8274. % include an _ in the xref name, etc.
  8275. \indexnofonts
  8276. \turnoffactive
  8277. \def\value##1{##1}%
  8278. \expandafter\global\expandafter\let\expandafter\Xthisreftitle
  8279. \csname XR#1-title\endcsname
  8280. }%
  8281. %
  8282. % Float references are printed completely differently: "Figure 1.2"
  8283. % instead of "[somenode], p.3". \iffloat distinguishes them by
  8284. % \Xthisreftitle being set to a magic string.
  8285. \iffloat\Xthisreftitle
  8286. % If the user specified the print name (third arg) to the ref,
  8287. % print it instead of our usual "Figure 1.2".
  8288. \ifdim\wd\printedrefnamebox = 0pt
  8289. \refx{#1-snt}{}%
  8290. \else
  8291. \printedrefname
  8292. \fi
  8293. %
  8294. % If the user also gave the printed manual name (fifth arg), append
  8295. % "in MANUALNAME".
  8296. \ifdim \wd\printedmanualbox > 0pt
  8297. \space \putwordin{} \cite{\printedmanual}%
  8298. \fi
  8299. \else
  8300. % node/anchor (non-float) references.
  8301. %
  8302. % If we use \unhbox to print the node names, TeX does not insert
  8303. % empty discretionaries after hyphens, which means that it will not
  8304. % find a line break at a hyphen in a node names. Since some manuals
  8305. % are best written with fairly long node names, containing hyphens,
  8306. % this is a loss. Therefore, we give the text of the node name
  8307. % again, so it is as if TeX is seeing it for the first time.
  8308. %
  8309. \ifdim \wd\printedmanualbox > 0pt
  8310. % Cross-manual reference with a printed manual name.
  8311. %
  8312. \crossmanualxref{\cite{\printedmanual\unskip}}%
  8313. %
  8314. \else\ifdim \wd\infofilenamebox > 0pt
  8315. % Cross-manual reference with only an info filename (arg 4), no
  8316. % printed manual name (arg 5). This is essentially the same as
  8317. % the case above; we output the filename, since we have nothing else.
  8318. %
  8319. \crossmanualxref{\code{\infofilename\unskip}}%
  8320. %
  8321. \else
  8322. % Reference within this manual.
  8323. %
  8324. % _ (for example) has to be the character _ for the purposes of the
  8325. % control sequence corresponding to the node, but it has to expand
  8326. % into the usual \leavevmode...\vrule stuff for purposes of
  8327. % printing. So we \turnoffactive for the \refx-snt, back on for the
  8328. % printing, back off for the \refx-pg.
  8329. {\turnoffactive
  8330. % Only output a following space if the -snt ref is nonempty; for
  8331. % @unnumbered and @anchor, it won't be.
  8332. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  8333. \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  8334. }%
  8335. % output the `[mynode]' via the macro below so it can be overridden.
  8336. \xrefprintnodename\printedrefname
  8337. %
  8338. % But we always want a comma and a space:
  8339. ,\space
  8340. %
  8341. % output the `page 3'.
  8342. \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
  8343. % Add a , if xref followed by a space
  8344. \if\space\noexpand\tokenafterxref ,%
  8345. \else\ifx\ \tokenafterxref ,% @TAB
  8346. \else\ifx\*\tokenafterxref ,% @*
  8347. \else\ifx\ \tokenafterxref ,% @SPACE
  8348. \else\ifx\
  8349. \tokenafterxref ,% @NL
  8350. \else\ifx\tie\tokenafterxref ,% @tie
  8351. \fi\fi\fi\fi\fi\fi
  8352. \fi\fi
  8353. \fi
  8354. \endlink
  8355. \endgroup}
  8356. % Output a cross-manual xref to #1. Used just above (twice).
  8357. %
  8358. % Only include the text "Section ``foo'' in" if the foo is neither
  8359. % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
  8360. % "see The Foo Manual", the idea being to refer to the whole manual.
  8361. %
  8362. % But, this being TeX, we can't easily compare our node name against the
  8363. % string "Top" while ignoring the possible spaces before and after in
  8364. % the input. By adding the arbitrary 7sp below, we make it much less
  8365. % likely that a real node name would have the same width as "Top" (e.g.,
  8366. % in a monospaced font). Hopefully it will never happen in practice.
  8367. %
  8368. % For the same basic reason, we retypeset the "Top" at every
  8369. % reference, since the current font is indeterminate.
  8370. %
  8371. \def\crossmanualxref#1{%
  8372. \setbox\toprefbox = \hbox{Top\kern7sp}%
  8373. \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
  8374. \ifdim \wd2 > 7sp % nonempty?
  8375. \ifdim \wd2 = \wd\toprefbox \else % same as Top?
  8376. \putwordSection{} ``\printedrefname'' \putwordin{}\space
  8377. \fi
  8378. \fi
  8379. #1%
  8380. }
  8381. % This macro is called from \xrefX for the `[nodename]' part of xref
  8382. % output. It's a separate macro only so it can be changed more easily,
  8383. % since square brackets don't work well in some documents. Particularly
  8384. % one that Bob is working on :).
  8385. %
  8386. \def\xrefprintnodename#1{[#1]}
  8387. % Things referred to by \setref.
  8388. %
  8389. \def\Ynothing{}
  8390. \def\Yomitfromtoc{}
  8391. \def\Ynumbered{%
  8392. \ifnum\secno=0
  8393. \putwordChapter@tie \the\chapno
  8394. \else \ifnum\subsecno=0
  8395. \putwordSection@tie \the\chapno.\the\secno
  8396. \else \ifnum\subsubsecno=0
  8397. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  8398. \else
  8399. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  8400. \fi\fi\fi
  8401. }
  8402. \def\Yappendix{%
  8403. \ifnum\secno=0
  8404. \putwordAppendix@tie @char\the\appendixno{}%
  8405. \else \ifnum\subsecno=0
  8406. \putwordSection@tie @char\the\appendixno.\the\secno
  8407. \else \ifnum\subsubsecno=0
  8408. \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  8409. \else
  8410. \putwordSection@tie
  8411. @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  8412. \fi\fi\fi
  8413. }
  8414. % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
  8415. % is output afterwards if non-empty.
  8416. \def\refx#1#2{%
  8417. \requireauxfile
  8418. {%
  8419. \indexnofonts
  8420. \otherbackslash
  8421. \def\value##1{##1}%
  8422. \expandafter\global\expandafter\let\expandafter\thisrefX
  8423. \csname XR#1\endcsname
  8424. }%
  8425. \ifx\thisrefX\relax
  8426. % If not defined, say something at least.
  8427. \angleleft un\-de\-fined\angleright
  8428. \iflinks
  8429. \ifhavexrefs
  8430. {\toks0 = {#1}% avoid expansion of possibly-complex value
  8431. \message{\linenumber Undefined cross reference `\the\toks0'.}}%
  8432. \else
  8433. \ifwarnedxrefs\else
  8434. \global\warnedxrefstrue
  8435. \message{Cross reference values unknown; you must run TeX again.}%
  8436. \fi
  8437. \fi
  8438. \fi
  8439. \else
  8440. % It's defined, so just use it.
  8441. \thisrefX
  8442. \fi
  8443. #2% Output the suffix in any case.
  8444. }
  8445. % This is the macro invoked by entries in the aux file. Define a control
  8446. % sequence for a cross-reference target (we prepend XR to the control sequence
  8447. % name to avoid collisions). The value is the page number. If this is a float
  8448. % type, we have more work to do.
  8449. %
  8450. \def\xrdef#1#2{%
  8451. {% Expand the node or anchor name to remove control sequences.
  8452. % \turnoffactive stops 8-bit characters being changed to commands
  8453. % like @'e. \refx does the same to retrieve the value in the definition.
  8454. \indexnofonts
  8455. \turnoffactive
  8456. \def\value##1{##1}%
  8457. \xdef\safexrefname{#1}%
  8458. }%
  8459. %
  8460. \bgroup
  8461. \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
  8462. \egroup
  8463. % We put the \gdef inside a group to avoid the definitions building up on
  8464. % TeX's save stack, which can cause it to run out of space for aux files with
  8465. % thousands of lines. \gdef doesn't use the save stack, but \csname does
  8466. % when it defines an unknown control sequence as \relax.
  8467. %
  8468. % Was that xref control sequence that we just defined for a float?
  8469. \expandafter\iffloat\csname XR\safexrefname\endcsname
  8470. % it was a float, and we have the (safe) float type in \iffloattype.
  8471. \expandafter\let\expandafter\floatlist
  8472. \csname floatlist\iffloattype\endcsname
  8473. %
  8474. % Is this the first time we've seen this float type?
  8475. \expandafter\ifx\floatlist\relax
  8476. \toks0 = {\do}% yes, so just \do
  8477. \else
  8478. % had it before, so preserve previous elements in list.
  8479. \toks0 = \expandafter{\floatlist\do}%
  8480. \fi
  8481. %
  8482. % Remember this xref in the control sequence \floatlistFLOATTYPE,
  8483. % for later use in \listoffloats.
  8484. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
  8485. {\safexrefname}}%
  8486. \fi
  8487. }
  8488. % If working on a large document in chapters, it is convenient to
  8489. % be able to disable indexing, cross-referencing, and contents, for test runs.
  8490. % This is done with @novalidate at the beginning of the file.
  8491. %
  8492. \newif\iflinks \linkstrue % by default we want the aux files.
  8493. \let\novalidate = \linksfalse
  8494. % Used when writing to the aux file, or when using data from it.
  8495. \def\requireauxfile{%
  8496. \iflinks
  8497. \tryauxfile
  8498. % Open the new aux file. TeX will close it automatically at exit.
  8499. \immediate\openout\auxfile=\jobname.aux
  8500. \fi
  8501. \global\let\requireauxfile=\relax % Only do this once.
  8502. }
  8503. % Read the last existing aux file, if any. No error if none exists.
  8504. %
  8505. \def\tryauxfile{%
  8506. \openin 1 \jobname.aux
  8507. \ifeof 1 \else
  8508. \readdatafile{aux}%
  8509. \global\havexrefstrue
  8510. \fi
  8511. \closein 1
  8512. }
  8513. \def\setupdatafile{%
  8514. \catcode`\^^@=\other
  8515. \catcode`\^^A=\other
  8516. \catcode`\^^B=\other
  8517. \catcode`\^^C=\other
  8518. \catcode`\^^D=\other
  8519. \catcode`\^^E=\other
  8520. \catcode`\^^F=\other
  8521. \catcode`\^^G=\other
  8522. \catcode`\^^H=\other
  8523. \catcode`\^^K=\other
  8524. \catcode`\^^L=\other
  8525. \catcode`\^^N=\other
  8526. \catcode`\^^P=\other
  8527. \catcode`\^^Q=\other
  8528. \catcode`\^^R=\other
  8529. \catcode`\^^S=\other
  8530. \catcode`\^^T=\other
  8531. \catcode`\^^U=\other
  8532. \catcode`\^^V=\other
  8533. \catcode`\^^W=\other
  8534. \catcode`\^^X=\other
  8535. \catcode`\^^Z=\other
  8536. \catcode`\^^[=\other
  8537. \catcode`\^^\=\other
  8538. \catcode`\^^]=\other
  8539. \catcode`\^^^=\other
  8540. \catcode`\^^_=\other
  8541. % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  8542. % in xref tags, i.e., node names. But since ^^e4 notation isn't
  8543. % supported in the main text, it doesn't seem desirable. Furthermore,
  8544. % that is not enough: for node names that actually contain a ^
  8545. % character, we would end up writing a line like this: 'xrdef {'hat
  8546. % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  8547. % argument, and \hat is not an expandable control sequence. It could
  8548. % all be worked out, but why? Either we support ^^ or we don't.
  8549. %
  8550. % The other change necessary for this was to define \auxhat:
  8551. % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  8552. % and then to call \auxhat in \setq.
  8553. %
  8554. \catcode`\^=\other
  8555. %
  8556. % Special characters. Should be turned off anyway, but...
  8557. \catcode`\~=\other
  8558. \catcode`\[=\other
  8559. \catcode`\]=\other
  8560. \catcode`\"=\other
  8561. \catcode`\_=\other
  8562. \catcode`\|=\other
  8563. \catcode`\<=\other
  8564. \catcode`\>=\other
  8565. \catcode`\$=\other
  8566. \catcode`\#=\other
  8567. \catcode`\&=\other
  8568. \catcode`\%=\other
  8569. \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  8570. %
  8571. % This is to support \ in node names and titles, since the \
  8572. % characters end up in a \csname. It's easier than
  8573. % leaving it active and making its active definition an actual \
  8574. % character. What I don't understand is why it works in the *value*
  8575. % of the xrdef. Seems like it should be a catcode12 \, and that
  8576. % should not typeset properly. But it works, so I'm moving on for
  8577. % now. --karl, 15jan04.
  8578. \catcode`\\=\other
  8579. %
  8580. % @ is our escape character in .aux files, and we need braces.
  8581. \catcode`\{=1
  8582. \catcode`\}=2
  8583. \catcode`\@=0
  8584. }
  8585. \def\readdatafile#1{%
  8586. \begingroup
  8587. \setupdatafile
  8588. \input\jobname.#1
  8589. \endgroup}
  8590. \message{insertions,}
  8591. % including footnotes.
  8592. \newcount \footnoteno
  8593. % The trailing space in the following definition for supereject is
  8594. % vital for proper filling; pages come out unaligned when you do a
  8595. % pagealignmacro call if that space before the closing brace is
  8596. % removed. (Generally, numeric constants should always be followed by a
  8597. % space to prevent strange expansion errors.)
  8598. \def\supereject{\par\penalty -20000\footnoteno =0 }
  8599. % @footnotestyle is meaningful for Info output only.
  8600. \let\footnotestyle=\comment
  8601. {\catcode `\@=11
  8602. %
  8603. % Auto-number footnotes. Otherwise like plain.
  8604. \gdef\footnote{%
  8605. \global\advance\footnoteno by \@ne
  8606. \edef\thisfootno{$^{\the\footnoteno}$}%
  8607. %
  8608. % In case the footnote comes at the end of a sentence, preserve the
  8609. % extra spacing after we do the footnote number.
  8610. \let\@sf\empty
  8611. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
  8612. %
  8613. % Remove inadvertent blank space before typesetting the footnote number.
  8614. \unskip
  8615. \thisfootno\@sf
  8616. \dofootnote
  8617. }%
  8618. % Don't bother with the trickery in plain.tex to not require the
  8619. % footnote text as a parameter. Our footnotes don't need to be so general.
  8620. %
  8621. % Oh yes, they do; otherwise, @ifset (and anything else that uses
  8622. % \parseargline) fails inside footnotes because the tokens are fixed when
  8623. % the footnote is read. --karl, 16nov96.
  8624. %
  8625. \gdef\dofootnote{%
  8626. \insert\footins\bgroup
  8627. %
  8628. % Nested footnotes are not supported in TeX, that would take a lot
  8629. % more work. (\startsavinginserts does not suffice.)
  8630. \let\footnote=\errfootnotenest
  8631. %
  8632. % We want to typeset this text as a normal paragraph, even if the
  8633. % footnote reference occurs in (for example) a display environment.
  8634. % So reset some parameters.
  8635. \hsize=\txipagewidth
  8636. \interlinepenalty\interfootnotelinepenalty
  8637. \splittopskip\ht\strutbox % top baseline for broken footnotes
  8638. \splitmaxdepth\dp\strutbox
  8639. \floatingpenalty\@MM
  8640. \leftskip\z@skip
  8641. \rightskip\z@skip
  8642. \spaceskip\z@skip
  8643. \xspaceskip\z@skip
  8644. \parindent\defaultparindent
  8645. %
  8646. \smallfonts \rm
  8647. %
  8648. % Because we use hanging indentation in footnotes, a @noindent appears
  8649. % to exdent this text, so make it be a no-op. makeinfo does not use
  8650. % hanging indentation so @noindent can still be needed within footnote
  8651. % text after an @example or the like (not that this is good style).
  8652. \let\noindent = \relax
  8653. %
  8654. % Hang the footnote text off the number. Use \everypar in case the
  8655. % footnote extends for more than one paragraph.
  8656. \everypar = {\hang}%
  8657. \textindent{\thisfootno}%
  8658. %
  8659. % Don't crash into the line above the footnote text. Since this
  8660. % expands into a box, it must come within the paragraph, lest it
  8661. % provide a place where TeX can split the footnote.
  8662. \footstrut
  8663. %
  8664. % Invoke rest of plain TeX footnote routine.
  8665. \futurelet\next\fo@t
  8666. }
  8667. }%end \catcode `\@=11
  8668. \def\errfootnotenest{%
  8669. \errhelp=\EMsimple
  8670. \errmessage{Nested footnotes not supported in texinfo.tex,
  8671. even though they work in makeinfo; sorry}
  8672. }
  8673. \def\errfootnoteheading{%
  8674. \errhelp=\EMsimple
  8675. \errmessage{Footnotes in chapters, sections, etc., are not supported}
  8676. }
  8677. % In case a @footnote appears in a vbox, save the footnote text and create
  8678. % the real \insert just after the vbox finished. Otherwise, the insertion
  8679. % would be lost.
  8680. % Similarly, if a @footnote appears inside an alignment, save the footnote
  8681. % text to a box and make the \insert when a row of the table is finished.
  8682. % And the same can be done for other insert classes. --kasal, 16nov03.
  8683. %
  8684. % Replace the \insert primitive by a cheating macro.
  8685. % Deeper inside, just make sure that the saved insertions are not spilled
  8686. % out prematurely.
  8687. %
  8688. \def\startsavinginserts{%
  8689. \ifx \insert\ptexinsert
  8690. \let\insert\saveinsert
  8691. \else
  8692. \let\checkinserts\relax
  8693. \fi
  8694. }
  8695. % This \insert replacement works for both \insert\footins{foo} and
  8696. % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
  8697. %
  8698. \def\saveinsert#1{%
  8699. \edef\next{\noexpand\savetobox \makeSAVEname#1}%
  8700. \afterassignment\next
  8701. % swallow the left brace
  8702. \let\temp =
  8703. }
  8704. \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
  8705. \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
  8706. \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
  8707. \def\placesaveins#1{%
  8708. \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
  8709. {\box#1}%
  8710. }
  8711. % eat @SAVE -- beware, all of them have catcode \other:
  8712. {
  8713. \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
  8714. \gdef\gobblesave @SAVE{}
  8715. }
  8716. % initialization:
  8717. \def\newsaveins #1{%
  8718. \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
  8719. \next
  8720. }
  8721. \def\newsaveinsX #1{%
  8722. \csname newbox\endcsname #1%
  8723. \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
  8724. \checksaveins #1}%
  8725. }
  8726. % initialize:
  8727. \let\checkinserts\empty
  8728. \newsaveins\footins
  8729. \newsaveins\margin
  8730. % @image. We use the macros from epsf.tex to support this.
  8731. % If epsf.tex is not installed and @image is used, we complain.
  8732. %
  8733. % Check for and read epsf.tex up front. If we read it only at @image
  8734. % time, we might be inside a group, and then its definitions would get
  8735. % undone and the next image would fail.
  8736. \openin 1 = epsf.tex
  8737. \ifeof 1 \else
  8738. % Do not bother showing banner with epsf.tex v2.7k (available in
  8739. % doc/epsf.tex and on ctan).
  8740. \def\epsfannounce{\toks0 = }%
  8741. \input epsf.tex
  8742. \fi
  8743. \closein 1
  8744. %
  8745. % We will only complain once about lack of epsf.tex.
  8746. \newif\ifwarnednoepsf
  8747. \newhelp\noepsfhelp{epsf.tex must be installed for images to
  8748. work. It is also included in the Texinfo distribution, or you can get
  8749. it from ftp://tug.org/tex/epsf.tex.}
  8750. %
  8751. \def\image#1{%
  8752. \ifx\epsfbox\thisisundefined
  8753. \ifwarnednoepsf \else
  8754. \errhelp = \noepsfhelp
  8755. \errmessage{epsf.tex not found, images will be ignored}%
  8756. \global\warnednoepsftrue
  8757. \fi
  8758. \else
  8759. \imagexxx #1,,,,,\finish
  8760. \fi
  8761. }
  8762. %
  8763. % Arguments to @image:
  8764. % #1 is (mandatory) image filename; we tack on .eps extension.
  8765. % #2 is (optional) width, #3 is (optional) height.
  8766. % #4 is (ignored optional) html alt text.
  8767. % #5 is (ignored optional) extension.
  8768. % #6 is just the usual extra ignored arg for parsing stuff.
  8769. \newif\ifimagevmode
  8770. \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  8771. \catcode`\^^M = 5 % in case we're inside an example
  8772. \normalturnoffactive % allow _ et al. in names
  8773. \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
  8774. % If the image is by itself, center it.
  8775. \ifvmode
  8776. \imagevmodetrue
  8777. \else \ifx\centersub\centerV
  8778. % for @center @image, we need a vbox so we can have our vertical space
  8779. \imagevmodetrue
  8780. \vbox\bgroup % vbox has better behavior than vtop herev
  8781. \fi\fi
  8782. %
  8783. \ifimagevmode
  8784. \nobreak\medskip
  8785. % Usually we'll have text after the image which will insert
  8786. % \parskip glue, so insert it here too to equalize the space
  8787. % above and below.
  8788. \nobreak\vskip\parskip
  8789. \nobreak
  8790. \fi
  8791. %
  8792. % Leave vertical mode so that indentation from an enclosing
  8793. % environment such as @quotation is respected.
  8794. % However, if we're at the top level, we don't want the
  8795. % normal paragraph indentation.
  8796. % On the other hand, if we are in the case of @center @image, we don't
  8797. % want to start a paragraph, which will create a hsize-width box and
  8798. % eradicate the centering.
  8799. \ifx\centersub\centerV\else \noindent \fi
  8800. %
  8801. % Output the image.
  8802. \ifpdf
  8803. % For pdfTeX and LuaTeX <= 0.80
  8804. \dopdfimage{#1}{#2}{#3}%
  8805. \else
  8806. \ifx\XeTeXrevision\thisisundefined
  8807. % For epsf.tex
  8808. % \epsfbox itself resets \epsf?size at each figure.
  8809. \setbox0 = \hbox{\ignorespaces #2}%
  8810. \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  8811. \setbox0 = \hbox{\ignorespaces #3}%
  8812. \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  8813. \epsfbox{#1.eps}%
  8814. \else
  8815. % For XeTeX
  8816. \doxeteximage{#1}{#2}{#3}%
  8817. \fi
  8818. \fi
  8819. %
  8820. \ifimagevmode
  8821. \medskip % space after a standalone image
  8822. \fi
  8823. \ifx\centersub\centerV \egroup \fi
  8824. \endgroup}
  8825. % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
  8826. % etc. We don't actually implement floating yet, we always include the
  8827. % float "here". But it seemed the best name for the future.
  8828. %
  8829. \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
  8830. % There may be a space before second and/or third parameter; delete it.
  8831. \def\eatcommaspace#1, {#1,}
  8832. % #1 is the optional FLOATTYPE, the text label for this float, typically
  8833. % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
  8834. % this float will not be numbered and cannot be referred to.
  8835. %
  8836. % #2 is the optional xref label. Also must be present for the float to
  8837. % be referable.
  8838. %
  8839. % #3 is the optional positioning argument; for now, it is ignored. It
  8840. % will somehow specify the positions allowed to float to (here, top, bottom).
  8841. %
  8842. % We keep a separate counter for each FLOATTYPE, which we reset at each
  8843. % chapter-level command.
  8844. \let\resetallfloatnos=\empty
  8845. %
  8846. \def\dofloat#1,#2,#3,#4\finish{%
  8847. \let\thiscaption=\empty
  8848. \let\thisshortcaption=\empty
  8849. %
  8850. % don't lose footnotes inside @float.
  8851. %
  8852. % BEWARE: when the floats start float, we have to issue warning whenever an
  8853. % insert appears inside a float which could possibly float. --kasal, 26may04
  8854. %
  8855. \startsavinginserts
  8856. %
  8857. % We can't be used inside a paragraph.
  8858. \par
  8859. %
  8860. \vtop\bgroup
  8861. \def\floattype{#1}%
  8862. \def\floatlabel{#2}%
  8863. \def\floatloc{#3}% we do nothing with this yet.
  8864. %
  8865. \ifx\floattype\empty
  8866. \let\safefloattype=\empty
  8867. \else
  8868. {%
  8869. % the floattype might have accents or other special characters,
  8870. % but we need to use it in a control sequence name.
  8871. \indexnofonts
  8872. \turnoffactive
  8873. \xdef\safefloattype{\floattype}%
  8874. }%
  8875. \fi
  8876. %
  8877. % If label is given but no type, we handle that as the empty type.
  8878. \ifx\floatlabel\empty \else
  8879. % We want each FLOATTYPE to be numbered separately (Figure 1,
  8880. % Table 1, Figure 2, ...). (And if no label, no number.)
  8881. %
  8882. \expandafter\getfloatno\csname\safefloattype floatno\endcsname
  8883. \global\advance\floatno by 1
  8884. %
  8885. {%
  8886. % This magic value for \lastsection is output by \setref as the
  8887. % XREFLABEL-title value. \xrefX uses it to distinguish float
  8888. % labels (which have a completely different output format) from
  8889. % node and anchor labels. And \xrdef uses it to construct the
  8890. % lists of floats.
  8891. %
  8892. \edef\lastsection{\floatmagic=\safefloattype}%
  8893. \setref{\floatlabel}{Yfloat}%
  8894. }%
  8895. \fi
  8896. %
  8897. % start with \parskip glue, I guess.
  8898. \vskip\parskip
  8899. %
  8900. % Don't suppress indentation if a float happens to start a section.
  8901. \restorefirstparagraphindent
  8902. }
  8903. % we have these possibilities:
  8904. % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
  8905. % @float Foo,lbl & no caption: Foo 1.1
  8906. % @float Foo & @caption{Cap}: Foo: Cap
  8907. % @float Foo & no caption: Foo
  8908. % @float ,lbl & Caption{Cap}: 1.1: Cap
  8909. % @float ,lbl & no caption: 1.1
  8910. % @float & @caption{Cap}: Cap
  8911. % @float & no caption:
  8912. %
  8913. \def\Efloat{%
  8914. \let\floatident = \empty
  8915. %
  8916. % In all cases, if we have a float type, it comes first.
  8917. \ifx\floattype\empty \else \def\floatident{\floattype}\fi
  8918. %
  8919. % If we have an xref label, the number comes next.
  8920. \ifx\floatlabel\empty \else
  8921. \ifx\floattype\empty \else % if also had float type, need tie first.
  8922. \appendtomacro\floatident{\tie}%
  8923. \fi
  8924. % the number.
  8925. \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
  8926. \fi
  8927. %
  8928. % Start the printed caption with what we've constructed in
  8929. % \floatident, but keep it separate; we need \floatident again.
  8930. \let\captionline = \floatident
  8931. %
  8932. \ifx\thiscaption\empty \else
  8933. \ifx\floatident\empty \else
  8934. \appendtomacro\captionline{: }% had ident, so need a colon between
  8935. \fi
  8936. %
  8937. % caption text.
  8938. \appendtomacro\captionline{\scanexp\thiscaption}%
  8939. \fi
  8940. %
  8941. % If we have anything to print, print it, with space before.
  8942. % Eventually this needs to become an \insert.
  8943. \ifx\captionline\empty \else
  8944. \vskip.5\parskip
  8945. \captionline
  8946. %
  8947. % Space below caption.
  8948. \vskip\parskip
  8949. \fi
  8950. %
  8951. % If have an xref label, write the list of floats info. Do this
  8952. % after the caption, to avoid chance of it being a breakpoint.
  8953. \ifx\floatlabel\empty \else
  8954. % Write the text that goes in the lof to the aux file as
  8955. % \floatlabel-lof. Besides \floatident, we include the short
  8956. % caption if specified, else the full caption if specified, else nothing.
  8957. {%
  8958. \requireauxfile
  8959. \atdummies
  8960. %
  8961. \ifx\thisshortcaption\empty
  8962. \def\gtemp{\thiscaption}%
  8963. \else
  8964. \def\gtemp{\thisshortcaption}%
  8965. \fi
  8966. \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
  8967. \ifx\gtemp\empty \else : \gtemp \fi}}%
  8968. }%
  8969. \fi
  8970. \egroup % end of \vtop
  8971. %
  8972. \checkinserts
  8973. }
  8974. % Append the tokens #2 to the definition of macro #1, not expanding either.
  8975. %
  8976. \def\appendtomacro#1#2{%
  8977. \expandafter\def\expandafter#1\expandafter{#1#2}%
  8978. }
  8979. % @caption, @shortcaption
  8980. %
  8981. \def\caption{\docaption\thiscaption}
  8982. \def\shortcaption{\docaption\thisshortcaption}
  8983. \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
  8984. \def\defcaption#1#2{\egroup \def#1{#2}}
  8985. % The parameter is the control sequence identifying the counter we are
  8986. % going to use. Create it if it doesn't exist and assign it to \floatno.
  8987. \def\getfloatno#1{%
  8988. \ifx#1\relax
  8989. % Haven't seen this figure type before.
  8990. \csname newcount\endcsname #1%
  8991. %
  8992. % Remember to reset this floatno at the next chap.
  8993. \expandafter\gdef\expandafter\resetallfloatnos
  8994. \expandafter{\resetallfloatnos #1=0 }%
  8995. \fi
  8996. \let\floatno#1%
  8997. }
  8998. % \setref calls this to get the XREFLABEL-snt value. We want an @xref
  8999. % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
  9000. % first read the @float command.
  9001. %
  9002. \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
  9003. % Magic string used for the XREFLABEL-title value, so \xrefX can
  9004. % distinguish floats from other xref types.
  9005. \def\floatmagic{!!float!!}
  9006. % #1 is the control sequence we are passed; we expand into a conditional
  9007. % which is true if #1 represents a float ref. That is, the magic
  9008. % \lastsection value which we \setref above.
  9009. %
  9010. \def\iffloat#1{\expandafter\doiffloat#1==\finish}
  9011. %
  9012. % #1 is (maybe) the \floatmagic string. If so, #2 will be the
  9013. % (safe) float type for this float. We set \iffloattype to #2.
  9014. %
  9015. \def\doiffloat#1=#2=#3\finish{%
  9016. \def\temp{#1}%
  9017. \def\iffloattype{#2}%
  9018. \ifx\temp\floatmagic
  9019. }
  9020. % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
  9021. %
  9022. \parseargdef\listoffloats{%
  9023. \def\floattype{#1}% floattype
  9024. {%
  9025. % the floattype might have accents or other special characters,
  9026. % but we need to use it in a control sequence name.
  9027. \indexnofonts
  9028. \turnoffactive
  9029. \xdef\safefloattype{\floattype}%
  9030. }%
  9031. %
  9032. % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
  9033. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
  9034. \ifhavexrefs
  9035. % if the user said @listoffloats foo but never @float foo.
  9036. \message{\linenumber No `\safefloattype' floats to list.}%
  9037. \fi
  9038. \else
  9039. \begingroup
  9040. \leftskip=\tocindent % indent these entries like a toc
  9041. \let\do=\listoffloatsdo
  9042. \csname floatlist\safefloattype\endcsname
  9043. \endgroup
  9044. \fi
  9045. }
  9046. % This is called on each entry in a list of floats. We're passed the
  9047. % xref label, in the form LABEL-title, which is how we save it in the
  9048. % aux file. We strip off the -title and look up \XRLABEL-lof, which
  9049. % has the text we're supposed to typeset here.
  9050. %
  9051. % Figures without xref labels will not be included in the list (since
  9052. % they won't appear in the aux file).
  9053. %
  9054. \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
  9055. \def\listoffloatsdoentry#1-title\finish{{%
  9056. % Can't fully expand XR#1-lof because it can contain anything. Just
  9057. % pass the control sequence. On the other hand, XR#1-pg is just the
  9058. % page number, and we want to fully expand that so we can get a link
  9059. % in pdf output.
  9060. \toksA = \expandafter{\csname XR#1-lof\endcsname}%
  9061. %
  9062. % use the same \entry macro we use to generate the TOC and index.
  9063. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
  9064. \writeentry
  9065. }}
  9066. \message{localization,}
  9067. % For single-language documents, @documentlanguage is usually given very
  9068. % early, just after @documentencoding. Single argument is the language
  9069. % (de) or locale (de_DE) abbreviation.
  9070. %
  9071. {
  9072. \catcode`\_ = \active
  9073. \globaldefs=1
  9074. \parseargdef\documentlanguage{%
  9075. \tex % read txi-??.tex file in plain TeX.
  9076. % Read the file by the name they passed if it exists.
  9077. \let_ = \normalunderscore % normal _ character for filename test
  9078. \openin 1 txi-#1.tex
  9079. \ifeof 1
  9080. \documentlanguagetrywithoutunderscore #1_\finish
  9081. \else
  9082. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9083. \input txi-#1.tex
  9084. \fi
  9085. \closein 1
  9086. \endgroup % end raw TeX
  9087. }
  9088. %
  9089. % If they passed de_DE, and txi-de_DE.tex doesn't exist,
  9090. % try txi-de.tex.
  9091. %
  9092. \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
  9093. \openin 1 txi-#1.tex
  9094. \ifeof 1
  9095. \errhelp = \nolanghelp
  9096. \errmessage{Cannot read language file txi-#1.tex}%
  9097. \else
  9098. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9099. \input txi-#1.tex
  9100. \fi
  9101. \closein 1
  9102. }
  9103. }% end of special _ catcode
  9104. %
  9105. \newhelp\nolanghelp{The given language definition file cannot be found or
  9106. is empty. Maybe you need to install it? Putting it in the current
  9107. directory should work if nowhere else does.}
  9108. % This macro is called from txi-??.tex files; the first argument is the
  9109. % \language name to set (without the "\lang@" prefix), the second and
  9110. % third args are \{left,right}hyphenmin.
  9111. %
  9112. % The language names to pass are determined when the format is built.
  9113. % See the etex.log file created at that time, e.g.,
  9114. % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
  9115. %
  9116. % With TeX Live 2008, etex now includes hyphenation patterns for all
  9117. % available languages. This means we can support hyphenation in
  9118. % Texinfo, at least to some extent. (This still doesn't solve the
  9119. % accented characters problem.)
  9120. %
  9121. \catcode`@=11
  9122. \def\txisetlanguage#1#2#3{%
  9123. % do not set the language if the name is undefined in the current TeX.
  9124. \expandafter\ifx\csname lang@#1\endcsname \relax
  9125. \message{no patterns for #1}%
  9126. \else
  9127. \global\language = \csname lang@#1\endcsname
  9128. \fi
  9129. % but there is no harm in adjusting the hyphenmin values regardless.
  9130. \global\lefthyphenmin = #2\relax
  9131. \global\righthyphenmin = #3\relax
  9132. }
  9133. % XeTeX and LuaTeX can handle Unicode natively.
  9134. % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
  9135. % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
  9136. %
  9137. \newif\iftxinativeunicodecapable
  9138. \newif\iftxiusebytewiseio
  9139. \ifx\XeTeXrevision\thisisundefined
  9140. \ifx\luatexversion\thisisundefined
  9141. \txinativeunicodecapablefalse
  9142. \txiusebytewiseiotrue
  9143. \else
  9144. \txinativeunicodecapabletrue
  9145. \txiusebytewiseiofalse
  9146. \fi
  9147. \else
  9148. \txinativeunicodecapabletrue
  9149. \txiusebytewiseiofalse
  9150. \fi
  9151. % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
  9152. % for non-UTF-8 (byte-wise) encodings.
  9153. %
  9154. \def\setbytewiseio{%
  9155. \ifx\XeTeXrevision\thisisundefined
  9156. \else
  9157. \XeTeXdefaultencoding "bytes" % For subsequent files to be read
  9158. \XeTeXinputencoding "bytes" % For document root file
  9159. % Unfortunately, there seems to be no corresponding XeTeX command for
  9160. % output encoding. This is a problem for auxiliary index and TOC files.
  9161. % The only solution would be perhaps to write out @U{...} sequences in
  9162. % place of non-ASCII characters.
  9163. \fi
  9164. \ifx\luatexversion\thisisundefined
  9165. \else
  9166. \directlua{
  9167. local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
  9168. local function convert_char (char)
  9169. return utf8_char(byte(char))
  9170. end
  9171. local function convert_line (line)
  9172. return gsub(line, ".", convert_char)
  9173. end
  9174. callback.register("process_input_buffer", convert_line)
  9175. local function convert_line_out (line)
  9176. local line_out = ""
  9177. for c in string.utfvalues(line) do
  9178. line_out = line_out .. string.char(c)
  9179. end
  9180. return line_out
  9181. end
  9182. callback.register("process_output_buffer", convert_line_out)
  9183. }
  9184. \fi
  9185. \txiusebytewiseiotrue
  9186. }
  9187. % Helpers for encodings.
  9188. % Set the catcode of characters 128 through 255 to the specified number.
  9189. %
  9190. \def\setnonasciicharscatcode#1{%
  9191. \count255=128
  9192. \loop\ifnum\count255<256
  9193. \global\catcode\count255=#1\relax
  9194. \advance\count255 by 1
  9195. \repeat
  9196. }
  9197. \def\setnonasciicharscatcodenonglobal#1{%
  9198. \count255=128
  9199. \loop\ifnum\count255<256
  9200. \catcode\count255=#1\relax
  9201. \advance\count255 by 1
  9202. \repeat
  9203. }
  9204. % @documentencoding sets the definition of non-ASCII characters
  9205. % according to the specified encoding.
  9206. %
  9207. \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
  9208. \def\documentencodingzzz#1{%
  9209. %
  9210. % Encoding being declared for the document.
  9211. \def\declaredencoding{\csname #1.enc\endcsname}%
  9212. %
  9213. % Supported encodings: names converted to tokens in order to be able
  9214. % to compare them with \ifx.
  9215. \def\ascii{\csname US-ASCII.enc\endcsname}%
  9216. \def\latnine{\csname ISO-8859-15.enc\endcsname}%
  9217. \def\latone{\csname ISO-8859-1.enc\endcsname}%
  9218. \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
  9219. \def\utfeight{\csname UTF-8.enc\endcsname}%
  9220. %
  9221. \ifx \declaredencoding \ascii
  9222. \asciichardefs
  9223. %
  9224. \else \ifx \declaredencoding \lattwo
  9225. \iftxinativeunicodecapable
  9226. \setbytewiseio
  9227. \fi
  9228. \setnonasciicharscatcode\active
  9229. \lattwochardefs
  9230. %
  9231. \else \ifx \declaredencoding \latone
  9232. \iftxinativeunicodecapable
  9233. \setbytewiseio
  9234. \fi
  9235. \setnonasciicharscatcode\active
  9236. \latonechardefs
  9237. %
  9238. \else \ifx \declaredencoding \latnine
  9239. \iftxinativeunicodecapable
  9240. \setbytewiseio
  9241. \fi
  9242. \setnonasciicharscatcode\active
  9243. \latninechardefs
  9244. %
  9245. \else \ifx \declaredencoding \utfeight
  9246. \iftxinativeunicodecapable
  9247. % For native Unicode handling (XeTeX and LuaTeX)
  9248. \nativeunicodechardefs
  9249. \else
  9250. % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
  9251. \setnonasciicharscatcode\active
  9252. % since we already invoked \utfeightchardefs at the top level
  9253. % (below), do not re-invoke it, otherwise our check for duplicated
  9254. % definitions gets triggered. Making non-ascii chars active is
  9255. % sufficient.
  9256. \fi
  9257. %
  9258. \else
  9259. \message{Ignoring unknown document encoding: #1.}%
  9260. %
  9261. \fi % utfeight
  9262. \fi % latnine
  9263. \fi % latone
  9264. \fi % lattwo
  9265. \fi % ascii
  9266. %
  9267. \ifx\XeTeXrevision\thisisundefined
  9268. \else
  9269. \ifx \declaredencoding \utfeight
  9270. \else
  9271. \ifx \declaredencoding \ascii
  9272. \else
  9273. \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
  9274. non-ASCII characters in auxiliary files.}%
  9275. \fi
  9276. \fi
  9277. \fi
  9278. }
  9279. % emacs-page
  9280. % A message to be logged when using a character that isn't available
  9281. % the default font encoding (OT1).
  9282. %
  9283. \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
  9284. % Take account of \c (plain) vs. \, (Texinfo) difference.
  9285. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
  9286. % First, make active non-ASCII characters in order for them to be
  9287. % correctly categorized when TeX reads the replacement text of
  9288. % macros containing the character definitions.
  9289. \setnonasciicharscatcode\active
  9290. %
  9291. \def\gdefchar#1#2{%
  9292. \gdef#1{%
  9293. \ifpassthroughchars
  9294. \string#1%
  9295. \else
  9296. #2%
  9297. \fi
  9298. }}
  9299. % Latin1 (ISO-8859-1) character definitions.
  9300. \def\latonechardefs{%
  9301. \gdefchar^^a0{\tie}
  9302. \gdefchar^^a1{\exclamdown}
  9303. \gdefchar^^a2{{\tcfont \char162}} % cent
  9304. \gdefchar^^a3{\pounds{}}
  9305. \gdefchar^^a4{{\tcfont \char164}} % currency
  9306. \gdefchar^^a5{{\tcfont \char165}} % yen
  9307. \gdefchar^^a6{{\tcfont \char166}} % broken bar
  9308. \gdefchar^^a7{\S}
  9309. \gdefchar^^a8{\"{}}
  9310. \gdefchar^^a9{\copyright{}}
  9311. \gdefchar^^aa{\ordf}
  9312. \gdefchar^^ab{\guillemetleft{}}
  9313. \gdefchar^^ac{\ensuremath\lnot}
  9314. \gdefchar^^ad{\-}
  9315. \gdefchar^^ae{\registeredsymbol{}}
  9316. \gdefchar^^af{\={}}
  9317. %
  9318. \gdefchar^^b0{\textdegree}
  9319. \gdefchar^^b1{$\pm$}
  9320. \gdefchar^^b2{$^2$}
  9321. \gdefchar^^b3{$^3$}
  9322. \gdefchar^^b4{\'{}}
  9323. \gdefchar^^b5{$\mu$}
  9324. \gdefchar^^b6{\P}
  9325. \gdefchar^^b7{\ensuremath\cdot}
  9326. \gdefchar^^b8{\cedilla\ }
  9327. \gdefchar^^b9{$^1$}
  9328. \gdefchar^^ba{\ordm}
  9329. \gdefchar^^bb{\guillemetright{}}
  9330. \gdefchar^^bc{$1\over4$}
  9331. \gdefchar^^bd{$1\over2$}
  9332. \gdefchar^^be{$3\over4$}
  9333. \gdefchar^^bf{\questiondown}
  9334. %
  9335. \gdefchar^^c0{\`A}
  9336. \gdefchar^^c1{\'A}
  9337. \gdefchar^^c2{\^A}
  9338. \gdefchar^^c3{\~A}
  9339. \gdefchar^^c4{\"A}
  9340. \gdefchar^^c5{\ringaccent A}
  9341. \gdefchar^^c6{\AE}
  9342. \gdefchar^^c7{\cedilla C}
  9343. \gdefchar^^c8{\`E}
  9344. \gdefchar^^c9{\'E}
  9345. \gdefchar^^ca{\^E}
  9346. \gdefchar^^cb{\"E}
  9347. \gdefchar^^cc{\`I}
  9348. \gdefchar^^cd{\'I}
  9349. \gdefchar^^ce{\^I}
  9350. \gdefchar^^cf{\"I}
  9351. %
  9352. \gdefchar^^d0{\DH}
  9353. \gdefchar^^d1{\~N}
  9354. \gdefchar^^d2{\`O}
  9355. \gdefchar^^d3{\'O}
  9356. \gdefchar^^d4{\^O}
  9357. \gdefchar^^d5{\~O}
  9358. \gdefchar^^d6{\"O}
  9359. \gdefchar^^d7{$\times$}
  9360. \gdefchar^^d8{\O}
  9361. \gdefchar^^d9{\`U}
  9362. \gdefchar^^da{\'U}
  9363. \gdefchar^^db{\^U}
  9364. \gdefchar^^dc{\"U}
  9365. \gdefchar^^dd{\'Y}
  9366. \gdefchar^^de{\TH}
  9367. \gdefchar^^df{\ss}
  9368. %
  9369. \gdefchar^^e0{\`a}
  9370. \gdefchar^^e1{\'a}
  9371. \gdefchar^^e2{\^a}
  9372. \gdefchar^^e3{\~a}
  9373. \gdefchar^^e4{\"a}
  9374. \gdefchar^^e5{\ringaccent a}
  9375. \gdefchar^^e6{\ae}
  9376. \gdefchar^^e7{\cedilla c}
  9377. \gdefchar^^e8{\`e}
  9378. \gdefchar^^e9{\'e}
  9379. \gdefchar^^ea{\^e}
  9380. \gdefchar^^eb{\"e}
  9381. \gdefchar^^ec{\`{\dotless i}}
  9382. \gdefchar^^ed{\'{\dotless i}}
  9383. \gdefchar^^ee{\^{\dotless i}}
  9384. \gdefchar^^ef{\"{\dotless i}}
  9385. %
  9386. \gdefchar^^f0{\dh}
  9387. \gdefchar^^f1{\~n}
  9388. \gdefchar^^f2{\`o}
  9389. \gdefchar^^f3{\'o}
  9390. \gdefchar^^f4{\^o}
  9391. \gdefchar^^f5{\~o}
  9392. \gdefchar^^f6{\"o}
  9393. \gdefchar^^f7{$\div$}
  9394. \gdefchar^^f8{\o}
  9395. \gdefchar^^f9{\`u}
  9396. \gdefchar^^fa{\'u}
  9397. \gdefchar^^fb{\^u}
  9398. \gdefchar^^fc{\"u}
  9399. \gdefchar^^fd{\'y}
  9400. \gdefchar^^fe{\th}
  9401. \gdefchar^^ff{\"y}
  9402. }
  9403. % Latin9 (ISO-8859-15) encoding character definitions.
  9404. \def\latninechardefs{%
  9405. % Encoding is almost identical to Latin1.
  9406. \latonechardefs
  9407. %
  9408. \gdefchar^^a4{\euro{}}
  9409. \gdefchar^^a6{\v S}
  9410. \gdefchar^^a8{\v s}
  9411. \gdefchar^^b4{\v Z}
  9412. \gdefchar^^b8{\v z}
  9413. \gdefchar^^bc{\OE}
  9414. \gdefchar^^bd{\oe}
  9415. \gdefchar^^be{\"Y}
  9416. }
  9417. % Latin2 (ISO-8859-2) character definitions.
  9418. \def\lattwochardefs{%
  9419. \gdefchar^^a0{\tie}
  9420. \gdefchar^^a1{\ogonek{A}}
  9421. \gdefchar^^a2{\u{}}
  9422. \gdefchar^^a3{\L}
  9423. \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
  9424. \gdefchar^^a5{\v L}
  9425. \gdefchar^^a6{\'S}
  9426. \gdefchar^^a7{\S}
  9427. \gdefchar^^a8{\"{}}
  9428. \gdefchar^^a9{\v S}
  9429. \gdefchar^^aa{\cedilla S}
  9430. \gdefchar^^ab{\v T}
  9431. \gdefchar^^ac{\'Z}
  9432. \gdefchar^^ad{\-}
  9433. \gdefchar^^ae{\v Z}
  9434. \gdefchar^^af{\dotaccent Z}
  9435. %
  9436. \gdefchar^^b0{\textdegree{}}
  9437. \gdefchar^^b1{\ogonek{a}}
  9438. \gdefchar^^b2{\ogonek{ }}
  9439. \gdefchar^^b3{\l}
  9440. \gdefchar^^b4{\'{}}
  9441. \gdefchar^^b5{\v l}
  9442. \gdefchar^^b6{\'s}
  9443. \gdefchar^^b7{\v{}}
  9444. \gdefchar^^b8{\cedilla\ }
  9445. \gdefchar^^b9{\v s}
  9446. \gdefchar^^ba{\cedilla s}
  9447. \gdefchar^^bb{\v t}
  9448. \gdefchar^^bc{\'z}
  9449. \gdefchar^^bd{\H{}}
  9450. \gdefchar^^be{\v z}
  9451. \gdefchar^^bf{\dotaccent z}
  9452. %
  9453. \gdefchar^^c0{\'R}
  9454. \gdefchar^^c1{\'A}
  9455. \gdefchar^^c2{\^A}
  9456. \gdefchar^^c3{\u A}
  9457. \gdefchar^^c4{\"A}
  9458. \gdefchar^^c5{\'L}
  9459. \gdefchar^^c6{\'C}
  9460. \gdefchar^^c7{\cedilla C}
  9461. \gdefchar^^c8{\v C}
  9462. \gdefchar^^c9{\'E}
  9463. \gdefchar^^ca{\ogonek{E}}
  9464. \gdefchar^^cb{\"E}
  9465. \gdefchar^^cc{\v E}
  9466. \gdefchar^^cd{\'I}
  9467. \gdefchar^^ce{\^I}
  9468. \gdefchar^^cf{\v D}
  9469. %
  9470. \gdefchar^^d0{\DH}
  9471. \gdefchar^^d1{\'N}
  9472. \gdefchar^^d2{\v N}
  9473. \gdefchar^^d3{\'O}
  9474. \gdefchar^^d4{\^O}
  9475. \gdefchar^^d5{\H O}
  9476. \gdefchar^^d6{\"O}
  9477. \gdefchar^^d7{$\times$}
  9478. \gdefchar^^d8{\v R}
  9479. \gdefchar^^d9{\ringaccent U}
  9480. \gdefchar^^da{\'U}
  9481. \gdefchar^^db{\H U}
  9482. \gdefchar^^dc{\"U}
  9483. \gdefchar^^dd{\'Y}
  9484. \gdefchar^^de{\cedilla T}
  9485. \gdefchar^^df{\ss}
  9486. %
  9487. \gdefchar^^e0{\'r}
  9488. \gdefchar^^e1{\'a}
  9489. \gdefchar^^e2{\^a}
  9490. \gdefchar^^e3{\u a}
  9491. \gdefchar^^e4{\"a}
  9492. \gdefchar^^e5{\'l}
  9493. \gdefchar^^e6{\'c}
  9494. \gdefchar^^e7{\cedilla c}
  9495. \gdefchar^^e8{\v c}
  9496. \gdefchar^^e9{\'e}
  9497. \gdefchar^^ea{\ogonek{e}}
  9498. \gdefchar^^eb{\"e}
  9499. \gdefchar^^ec{\v e}
  9500. \gdefchar^^ed{\'{\dotless{i}}}
  9501. \gdefchar^^ee{\^{\dotless{i}}}
  9502. \gdefchar^^ef{\v d}
  9503. %
  9504. \gdefchar^^f0{\dh}
  9505. \gdefchar^^f1{\'n}
  9506. \gdefchar^^f2{\v n}
  9507. \gdefchar^^f3{\'o}
  9508. \gdefchar^^f4{\^o}
  9509. \gdefchar^^f5{\H o}
  9510. \gdefchar^^f6{\"o}
  9511. \gdefchar^^f7{$\div$}
  9512. \gdefchar^^f8{\v r}
  9513. \gdefchar^^f9{\ringaccent u}
  9514. \gdefchar^^fa{\'u}
  9515. \gdefchar^^fb{\H u}
  9516. \gdefchar^^fc{\"u}
  9517. \gdefchar^^fd{\'y}
  9518. \gdefchar^^fe{\cedilla t}
  9519. \gdefchar^^ff{\dotaccent{}}
  9520. }
  9521. % UTF-8 character definitions.
  9522. %
  9523. % This code to support UTF-8 is based on LaTeX's utf8.def, with some
  9524. % changes for Texinfo conventions. It is included here under the GPL by
  9525. % permission from Frank Mittelbach and the LaTeX team.
  9526. %
  9527. \newcount\countUTFx
  9528. \newcount\countUTFy
  9529. \newcount\countUTFz
  9530. \gdef\UTFviiiTwoOctets#1#2{\expandafter
  9531. \UTFviiiDefined\csname u8:#1\string #2\endcsname}
  9532. %
  9533. \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
  9534. \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
  9535. %
  9536. \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
  9537. \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
  9538. \gdef\UTFviiiDefined#1{%
  9539. \ifx #1\relax
  9540. \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
  9541. \else
  9542. \expandafter #1%
  9543. \fi
  9544. }
  9545. % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
  9546. \begingroup
  9547. \catcode`\~13
  9548. \catcode`\$12
  9549. \catcode`\"12
  9550. % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
  9551. % substituting ~ and $ with a character token of that value.
  9552. \def\UTFviiiLoop{%
  9553. \global\catcode\countUTFx\active
  9554. \uccode`\~\countUTFx
  9555. \uccode`\$\countUTFx
  9556. \uppercase\expandafter{\UTFviiiTmp}%
  9557. \advance\countUTFx by 1
  9558. \ifnum\countUTFx < \countUTFy
  9559. \expandafter\UTFviiiLoop
  9560. \fi}
  9561. % For bytes other than the first in a UTF-8 sequence. Not expected to
  9562. % be expanded except when writing to auxiliary files.
  9563. \countUTFx = "80
  9564. \countUTFy = "C2
  9565. \def\UTFviiiTmp{%
  9566. \gdef~{%
  9567. \ifpassthroughchars $\fi}}%
  9568. \UTFviiiLoop
  9569. \countUTFx = "C2
  9570. \countUTFy = "E0
  9571. \def\UTFviiiTmp{%
  9572. \gdef~{%
  9573. \ifpassthroughchars $%
  9574. \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
  9575. \UTFviiiLoop
  9576. \countUTFx = "E0
  9577. \countUTFy = "F0
  9578. \def\UTFviiiTmp{%
  9579. \gdef~{%
  9580. \ifpassthroughchars $%
  9581. \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
  9582. \UTFviiiLoop
  9583. \countUTFx = "F0
  9584. \countUTFy = "F4
  9585. \def\UTFviiiTmp{%
  9586. \gdef~{%
  9587. \ifpassthroughchars $%
  9588. \else\expandafter\UTFviiiFourOctets\expandafter$\fi
  9589. }}%
  9590. \UTFviiiLoop
  9591. \endgroup
  9592. \def\globallet{\global\let} % save some \expandafter's below
  9593. % @U{xxxx} to produce U+xxxx, if we support it.
  9594. \def\U#1{%
  9595. \expandafter\ifx\csname uni:#1\endcsname \relax
  9596. \iftxinativeunicodecapable
  9597. % All Unicode characters can be used if native Unicode handling is
  9598. % active. However, if the font does not have the glyph,
  9599. % letters are missing.
  9600. \begingroup
  9601. \uccode`\.="#1\relax
  9602. \uppercase{.}
  9603. \endgroup
  9604. \else
  9605. \errhelp = \EMsimple
  9606. \errmessage{Unicode character U+#1 not supported, sorry}%
  9607. \fi
  9608. \else
  9609. \csname uni:#1\endcsname
  9610. \fi
  9611. }
  9612. % These macros are used here to construct the name of a control
  9613. % sequence to be defined.
  9614. \def\UTFviiiTwoOctetsName#1#2{%
  9615. \csname u8:#1\string #2\endcsname}%
  9616. \def\UTFviiiThreeOctetsName#1#2#3{%
  9617. \csname u8:#1\string #2\string #3\endcsname}%
  9618. \def\UTFviiiFourOctetsName#1#2#3#4{%
  9619. \csname u8:#1\string #2\string #3\string #4\endcsname}%
  9620. % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
  9621. % provide a definition macro to replace a Unicode character;
  9622. % this gets used by the @U command
  9623. %
  9624. \begingroup
  9625. \catcode`\"=12
  9626. \catcode`\<=12
  9627. \catcode`\.=12
  9628. \catcode`\,=12
  9629. \catcode`\;=12
  9630. \catcode`\!=12
  9631. \catcode`\~=13
  9632. \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
  9633. \countUTFz = "#1\relax
  9634. \begingroup
  9635. \parseXMLCharref
  9636. % Give \u8:... its definition. The sequence of seven \expandafter's
  9637. % expands after the \gdef three times, e.g.
  9638. %
  9639. % 1. \UTFviiTwoOctetsName B1 B2
  9640. % 2. \csname u8:B1 \string B2 \endcsname
  9641. % 3. \u8: B1 B2 (a single control sequence token)
  9642. %
  9643. \expandafter\expandafter
  9644. \expandafter\expandafter
  9645. \expandafter\expandafter
  9646. \expandafter\gdef \UTFviiiTmp{#2}%
  9647. %
  9648. \expandafter\ifx\csname uni:#1\endcsname \relax \else
  9649. \message{Internal error, already defined: #1}%
  9650. \fi
  9651. %
  9652. % define an additional control sequence for this code point.
  9653. \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
  9654. \endgroup}
  9655. %
  9656. % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
  9657. % to the corresponding UTF-8 sequence.
  9658. \gdef\parseXMLCharref{%
  9659. \ifnum\countUTFz < "A0\relax
  9660. \errhelp = \EMsimple
  9661. \errmessage{Cannot define Unicode char value < 00A0}%
  9662. \else\ifnum\countUTFz < "800\relax
  9663. \parseUTFviiiA,%
  9664. \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
  9665. \else\ifnum\countUTFz < "10000\relax
  9666. \parseUTFviiiA;%
  9667. \parseUTFviiiA,%
  9668. \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
  9669. \else
  9670. \parseUTFviiiA;%
  9671. \parseUTFviiiA,%
  9672. \parseUTFviiiA!%
  9673. \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
  9674. \fi\fi\fi
  9675. }
  9676. % Extract a byte from the end of the UTF-8 representation of \countUTFx.
  9677. % It must be a non-initial byte in the sequence.
  9678. % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
  9679. % of the bytes.
  9680. \gdef\parseUTFviiiA#1{%
  9681. \countUTFx = \countUTFz
  9682. \divide\countUTFz by 64
  9683. \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
  9684. \multiply\countUTFz by 64
  9685. % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
  9686. % in order to get the last five bits.
  9687. \advance\countUTFx by -\countUTFz
  9688. % Convert this to the byte in the UTF-8 sequence.
  9689. \advance\countUTFx by 128
  9690. \uccode `#1\countUTFx
  9691. \countUTFz = \countUTFy}
  9692. % Used to put a UTF-8 byte sequence into \UTFviiiTmp
  9693. % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
  9694. % sequence.
  9695. % #2 is one of the \UTFviii*OctetsName macros.
  9696. % #3 is always a full stop (.)
  9697. % #4 is a template for the other bytes in the sequence. The values for these
  9698. % bytes is substituted in here with \uppercase using the \uccode's.
  9699. \gdef\parseUTFviiiB#1#2#3#4{%
  9700. \advance\countUTFz by "#10\relax
  9701. \uccode `#3\countUTFz
  9702. \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
  9703. \endgroup
  9704. % For native Unicode handling (XeTeX and LuaTeX),
  9705. % provide a definition macro that sets a catcode to `other' non-globally
  9706. %
  9707. \def\DeclareUnicodeCharacterNativeOther#1#2{%
  9708. \catcode"#1=\other
  9709. }
  9710. % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
  9711. % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
  9712. % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
  9713. % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
  9714. % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
  9715. %
  9716. % Many of our renditions are less than wonderful, and all the missing
  9717. % characters are available somewhere. Loading the necessary fonts
  9718. % awaits user request. We can't truly support Unicode without
  9719. % reimplementing everything that's been done in LaTeX for many years,
  9720. % plus probably using luatex or xetex, and who knows what else.
  9721. % We won't be doing that here in this simple file. But we can try to at
  9722. % least make most of the characters not bomb out.
  9723. %
  9724. \def\unicodechardefs{%
  9725. \DeclareUnicodeCharacter{00A0}{\tie}%
  9726. \DeclareUnicodeCharacter{00A1}{\exclamdown}%
  9727. \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
  9728. \DeclareUnicodeCharacter{00A3}{\pounds{}}%
  9729. \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
  9730. \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
  9731. \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
  9732. \DeclareUnicodeCharacter{00A7}{\S}%
  9733. \DeclareUnicodeCharacter{00A8}{\"{ }}%
  9734. \DeclareUnicodeCharacter{00A9}{\copyright{}}%
  9735. \DeclareUnicodeCharacter{00AA}{\ordf}%
  9736. \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
  9737. \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
  9738. \DeclareUnicodeCharacter{00AD}{\-}%
  9739. \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
  9740. \DeclareUnicodeCharacter{00AF}{\={ }}%
  9741. %
  9742. \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
  9743. \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
  9744. \DeclareUnicodeCharacter{00B2}{$^2$}%
  9745. \DeclareUnicodeCharacter{00B3}{$^3$}%
  9746. \DeclareUnicodeCharacter{00B4}{\'{ }}%
  9747. \DeclareUnicodeCharacter{00B5}{$\mu$}%
  9748. \DeclareUnicodeCharacter{00B6}{\P}%
  9749. \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
  9750. \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
  9751. \DeclareUnicodeCharacter{00B9}{$^1$}%
  9752. \DeclareUnicodeCharacter{00BA}{\ordm}%
  9753. \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
  9754. \DeclareUnicodeCharacter{00BC}{$1\over4$}%
  9755. \DeclareUnicodeCharacter{00BD}{$1\over2$}%
  9756. \DeclareUnicodeCharacter{00BE}{$3\over4$}%
  9757. \DeclareUnicodeCharacter{00BF}{\questiondown}%
  9758. %
  9759. \DeclareUnicodeCharacter{00C0}{\`A}%
  9760. \DeclareUnicodeCharacter{00C1}{\'A}%
  9761. \DeclareUnicodeCharacter{00C2}{\^A}%
  9762. \DeclareUnicodeCharacter{00C3}{\~A}%
  9763. \DeclareUnicodeCharacter{00C4}{\"A}%
  9764. \DeclareUnicodeCharacter{00C5}{\AA}%
  9765. \DeclareUnicodeCharacter{00C6}{\AE}%
  9766. \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
  9767. \DeclareUnicodeCharacter{00C8}{\`E}%
  9768. \DeclareUnicodeCharacter{00C9}{\'E}%
  9769. \DeclareUnicodeCharacter{00CA}{\^E}%
  9770. \DeclareUnicodeCharacter{00CB}{\"E}%
  9771. \DeclareUnicodeCharacter{00CC}{\`I}%
  9772. \DeclareUnicodeCharacter{00CD}{\'I}%
  9773. \DeclareUnicodeCharacter{00CE}{\^I}%
  9774. \DeclareUnicodeCharacter{00CF}{\"I}%
  9775. %
  9776. \DeclareUnicodeCharacter{00D0}{\DH}%
  9777. \DeclareUnicodeCharacter{00D1}{\~N}%
  9778. \DeclareUnicodeCharacter{00D2}{\`O}%
  9779. \DeclareUnicodeCharacter{00D3}{\'O}%
  9780. \DeclareUnicodeCharacter{00D4}{\^O}%
  9781. \DeclareUnicodeCharacter{00D5}{\~O}%
  9782. \DeclareUnicodeCharacter{00D6}{\"O}%
  9783. \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
  9784. \DeclareUnicodeCharacter{00D8}{\O}%
  9785. \DeclareUnicodeCharacter{00D9}{\`U}%
  9786. \DeclareUnicodeCharacter{00DA}{\'U}%
  9787. \DeclareUnicodeCharacter{00DB}{\^U}%
  9788. \DeclareUnicodeCharacter{00DC}{\"U}%
  9789. \DeclareUnicodeCharacter{00DD}{\'Y}%
  9790. \DeclareUnicodeCharacter{00DE}{\TH}%
  9791. \DeclareUnicodeCharacter{00DF}{\ss}%
  9792. %
  9793. \DeclareUnicodeCharacter{00E0}{\`a}%
  9794. \DeclareUnicodeCharacter{00E1}{\'a}%
  9795. \DeclareUnicodeCharacter{00E2}{\^a}%
  9796. \DeclareUnicodeCharacter{00E3}{\~a}%
  9797. \DeclareUnicodeCharacter{00E4}{\"a}%
  9798. \DeclareUnicodeCharacter{00E5}{\aa}%
  9799. \DeclareUnicodeCharacter{00E6}{\ae}%
  9800. \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
  9801. \DeclareUnicodeCharacter{00E8}{\`e}%
  9802. \DeclareUnicodeCharacter{00E9}{\'e}%
  9803. \DeclareUnicodeCharacter{00EA}{\^e}%
  9804. \DeclareUnicodeCharacter{00EB}{\"e}%
  9805. \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
  9806. \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
  9807. \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
  9808. \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
  9809. %
  9810. \DeclareUnicodeCharacter{00F0}{\dh}%
  9811. \DeclareUnicodeCharacter{00F1}{\~n}%
  9812. \DeclareUnicodeCharacter{00F2}{\`o}%
  9813. \DeclareUnicodeCharacter{00F3}{\'o}%
  9814. \DeclareUnicodeCharacter{00F4}{\^o}%
  9815. \DeclareUnicodeCharacter{00F5}{\~o}%
  9816. \DeclareUnicodeCharacter{00F6}{\"o}%
  9817. \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
  9818. \DeclareUnicodeCharacter{00F8}{\o}%
  9819. \DeclareUnicodeCharacter{00F9}{\`u}%
  9820. \DeclareUnicodeCharacter{00FA}{\'u}%
  9821. \DeclareUnicodeCharacter{00FB}{\^u}%
  9822. \DeclareUnicodeCharacter{00FC}{\"u}%
  9823. \DeclareUnicodeCharacter{00FD}{\'y}%
  9824. \DeclareUnicodeCharacter{00FE}{\th}%
  9825. \DeclareUnicodeCharacter{00FF}{\"y}%
  9826. %
  9827. \DeclareUnicodeCharacter{0100}{\=A}%
  9828. \DeclareUnicodeCharacter{0101}{\=a}%
  9829. \DeclareUnicodeCharacter{0102}{\u{A}}%
  9830. \DeclareUnicodeCharacter{0103}{\u{a}}%
  9831. \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
  9832. \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
  9833. \DeclareUnicodeCharacter{0106}{\'C}%
  9834. \DeclareUnicodeCharacter{0107}{\'c}%
  9835. \DeclareUnicodeCharacter{0108}{\^C}%
  9836. \DeclareUnicodeCharacter{0109}{\^c}%
  9837. \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
  9838. \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
  9839. \DeclareUnicodeCharacter{010C}{\v{C}}%
  9840. \DeclareUnicodeCharacter{010D}{\v{c}}%
  9841. \DeclareUnicodeCharacter{010E}{\v{D}}%
  9842. \DeclareUnicodeCharacter{010F}{d'}%
  9843. %
  9844. \DeclareUnicodeCharacter{0110}{\DH}%
  9845. \DeclareUnicodeCharacter{0111}{\dh}%
  9846. \DeclareUnicodeCharacter{0112}{\=E}%
  9847. \DeclareUnicodeCharacter{0113}{\=e}%
  9848. \DeclareUnicodeCharacter{0114}{\u{E}}%
  9849. \DeclareUnicodeCharacter{0115}{\u{e}}%
  9850. \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
  9851. \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
  9852. \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
  9853. \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
  9854. \DeclareUnicodeCharacter{011A}{\v{E}}%
  9855. \DeclareUnicodeCharacter{011B}{\v{e}}%
  9856. \DeclareUnicodeCharacter{011C}{\^G}%
  9857. \DeclareUnicodeCharacter{011D}{\^g}%
  9858. \DeclareUnicodeCharacter{011E}{\u{G}}%
  9859. \DeclareUnicodeCharacter{011F}{\u{g}}%
  9860. %
  9861. \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
  9862. \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
  9863. \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
  9864. \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
  9865. \DeclareUnicodeCharacter{0124}{\^H}%
  9866. \DeclareUnicodeCharacter{0125}{\^h}%
  9867. \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
  9868. \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
  9869. \DeclareUnicodeCharacter{0128}{\~I}%
  9870. \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
  9871. \DeclareUnicodeCharacter{012A}{\=I}%
  9872. \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
  9873. \DeclareUnicodeCharacter{012C}{\u{I}}%
  9874. \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
  9875. \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
  9876. \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
  9877. %
  9878. \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
  9879. \DeclareUnicodeCharacter{0131}{\dotless{i}}%
  9880. \DeclareUnicodeCharacter{0132}{IJ}%
  9881. \DeclareUnicodeCharacter{0133}{ij}%
  9882. \DeclareUnicodeCharacter{0134}{\^J}%
  9883. \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
  9884. \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
  9885. \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
  9886. \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
  9887. \DeclareUnicodeCharacter{0139}{\'L}%
  9888. \DeclareUnicodeCharacter{013A}{\'l}%
  9889. \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
  9890. \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
  9891. \DeclareUnicodeCharacter{013D}{L'}% should kern
  9892. \DeclareUnicodeCharacter{013E}{l'}% should kern
  9893. \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
  9894. %
  9895. \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
  9896. \DeclareUnicodeCharacter{0141}{\L}%
  9897. \DeclareUnicodeCharacter{0142}{\l}%
  9898. \DeclareUnicodeCharacter{0143}{\'N}%
  9899. \DeclareUnicodeCharacter{0144}{\'n}%
  9900. \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
  9901. \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
  9902. \DeclareUnicodeCharacter{0147}{\v{N}}%
  9903. \DeclareUnicodeCharacter{0148}{\v{n}}%
  9904. \DeclareUnicodeCharacter{0149}{'n}%
  9905. \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
  9906. \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
  9907. \DeclareUnicodeCharacter{014C}{\=O}%
  9908. \DeclareUnicodeCharacter{014D}{\=o}%
  9909. \DeclareUnicodeCharacter{014E}{\u{O}}%
  9910. \DeclareUnicodeCharacter{014F}{\u{o}}%
  9911. %
  9912. \DeclareUnicodeCharacter{0150}{\H{O}}%
  9913. \DeclareUnicodeCharacter{0151}{\H{o}}%
  9914. \DeclareUnicodeCharacter{0152}{\OE}%
  9915. \DeclareUnicodeCharacter{0153}{\oe}%
  9916. \DeclareUnicodeCharacter{0154}{\'R}%
  9917. \DeclareUnicodeCharacter{0155}{\'r}%
  9918. \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
  9919. \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
  9920. \DeclareUnicodeCharacter{0158}{\v{R}}%
  9921. \DeclareUnicodeCharacter{0159}{\v{r}}%
  9922. \DeclareUnicodeCharacter{015A}{\'S}%
  9923. \DeclareUnicodeCharacter{015B}{\'s}%
  9924. \DeclareUnicodeCharacter{015C}{\^S}%
  9925. \DeclareUnicodeCharacter{015D}{\^s}%
  9926. \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
  9927. \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
  9928. %
  9929. \DeclareUnicodeCharacter{0160}{\v{S}}%
  9930. \DeclareUnicodeCharacter{0161}{\v{s}}%
  9931. \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
  9932. \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
  9933. \DeclareUnicodeCharacter{0164}{\v{T}}%
  9934. \DeclareUnicodeCharacter{0165}{\v{t}}%
  9935. \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
  9936. \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
  9937. \DeclareUnicodeCharacter{0168}{\~U}%
  9938. \DeclareUnicodeCharacter{0169}{\~u}%
  9939. \DeclareUnicodeCharacter{016A}{\=U}%
  9940. \DeclareUnicodeCharacter{016B}{\=u}%
  9941. \DeclareUnicodeCharacter{016C}{\u{U}}%
  9942. \DeclareUnicodeCharacter{016D}{\u{u}}%
  9943. \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
  9944. \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
  9945. %
  9946. \DeclareUnicodeCharacter{0170}{\H{U}}%
  9947. \DeclareUnicodeCharacter{0171}{\H{u}}%
  9948. \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
  9949. \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
  9950. \DeclareUnicodeCharacter{0174}{\^W}%
  9951. \DeclareUnicodeCharacter{0175}{\^w}%
  9952. \DeclareUnicodeCharacter{0176}{\^Y}%
  9953. \DeclareUnicodeCharacter{0177}{\^y}%
  9954. \DeclareUnicodeCharacter{0178}{\"Y}%
  9955. \DeclareUnicodeCharacter{0179}{\'Z}%
  9956. \DeclareUnicodeCharacter{017A}{\'z}%
  9957. \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
  9958. \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
  9959. \DeclareUnicodeCharacter{017D}{\v{Z}}%
  9960. \DeclareUnicodeCharacter{017E}{\v{z}}%
  9961. \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
  9962. %
  9963. \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
  9964. \DeclareUnicodeCharacter{01C5}{D\v{z}}%
  9965. \DeclareUnicodeCharacter{01C6}{d\v{z}}%
  9966. \DeclareUnicodeCharacter{01C7}{LJ}%
  9967. \DeclareUnicodeCharacter{01C8}{Lj}%
  9968. \DeclareUnicodeCharacter{01C9}{lj}%
  9969. \DeclareUnicodeCharacter{01CA}{NJ}%
  9970. \DeclareUnicodeCharacter{01CB}{Nj}%
  9971. \DeclareUnicodeCharacter{01CC}{nj}%
  9972. \DeclareUnicodeCharacter{01CD}{\v{A}}%
  9973. \DeclareUnicodeCharacter{01CE}{\v{a}}%
  9974. \DeclareUnicodeCharacter{01CF}{\v{I}}%
  9975. %
  9976. \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
  9977. \DeclareUnicodeCharacter{01D1}{\v{O}}%
  9978. \DeclareUnicodeCharacter{01D2}{\v{o}}%
  9979. \DeclareUnicodeCharacter{01D3}{\v{U}}%
  9980. \DeclareUnicodeCharacter{01D4}{\v{u}}%
  9981. %
  9982. \DeclareUnicodeCharacter{01E2}{\={\AE}}%
  9983. \DeclareUnicodeCharacter{01E3}{\={\ae}}%
  9984. \DeclareUnicodeCharacter{01E6}{\v{G}}%
  9985. \DeclareUnicodeCharacter{01E7}{\v{g}}%
  9986. \DeclareUnicodeCharacter{01E8}{\v{K}}%
  9987. \DeclareUnicodeCharacter{01E9}{\v{k}}%
  9988. %
  9989. \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
  9990. \DeclareUnicodeCharacter{01F1}{DZ}%
  9991. \DeclareUnicodeCharacter{01F2}{Dz}%
  9992. \DeclareUnicodeCharacter{01F3}{dz}%
  9993. \DeclareUnicodeCharacter{01F4}{\'G}%
  9994. \DeclareUnicodeCharacter{01F5}{\'g}%
  9995. \DeclareUnicodeCharacter{01F8}{\`N}%
  9996. \DeclareUnicodeCharacter{01F9}{\`n}%
  9997. \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
  9998. \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
  9999. \DeclareUnicodeCharacter{01FE}{\'{\O}}%
  10000. \DeclareUnicodeCharacter{01FF}{\'{\o}}%
  10001. %
  10002. \DeclareUnicodeCharacter{021E}{\v{H}}%
  10003. \DeclareUnicodeCharacter{021F}{\v{h}}%
  10004. %
  10005. \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
  10006. \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
  10007. \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
  10008. \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
  10009. \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
  10010. \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
  10011. %
  10012. \DeclareUnicodeCharacter{0232}{\=Y}%
  10013. \DeclareUnicodeCharacter{0233}{\=y}%
  10014. \DeclareUnicodeCharacter{0237}{\dotless{j}}%
  10015. %
  10016. \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
  10017. %
  10018. % Greek letters upper case
  10019. \DeclareUnicodeCharacter{0391}{{\it A}}%
  10020. \DeclareUnicodeCharacter{0392}{{\it B}}%
  10021. \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
  10022. \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
  10023. \DeclareUnicodeCharacter{0395}{{\it E}}%
  10024. \DeclareUnicodeCharacter{0396}{{\it Z}}%
  10025. \DeclareUnicodeCharacter{0397}{{\it H}}%
  10026. \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
  10027. \DeclareUnicodeCharacter{0399}{{\it I}}%
  10028. \DeclareUnicodeCharacter{039A}{{\it K}}%
  10029. \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
  10030. \DeclareUnicodeCharacter{039C}{{\it M}}%
  10031. \DeclareUnicodeCharacter{039D}{{\it N}}%
  10032. \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
  10033. \DeclareUnicodeCharacter{039F}{{\it O}}%
  10034. \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
  10035. \DeclareUnicodeCharacter{03A1}{{\it P}}%
  10036. %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
  10037. \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
  10038. \DeclareUnicodeCharacter{03A4}{{\it T}}%
  10039. \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
  10040. \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
  10041. \DeclareUnicodeCharacter{03A7}{{\it X}}%
  10042. \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
  10043. \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
  10044. %
  10045. % Vowels with accents
  10046. \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
  10047. \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
  10048. \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
  10049. \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
  10050. \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
  10051. \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
  10052. %
  10053. % Standalone accent
  10054. \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
  10055. %
  10056. % Greek letters lower case
  10057. \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
  10058. \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
  10059. \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
  10060. \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
  10061. \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
  10062. \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
  10063. \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
  10064. \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
  10065. \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
  10066. \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
  10067. \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
  10068. \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
  10069. \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
  10070. \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
  10071. \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
  10072. \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
  10073. \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
  10074. \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
  10075. \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
  10076. \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
  10077. \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
  10078. \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
  10079. \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
  10080. \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
  10081. \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
  10082. %
  10083. % More Greek vowels with accents
  10084. \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
  10085. \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
  10086. \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
  10087. \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
  10088. \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
  10089. %
  10090. % Variant Greek letters
  10091. \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
  10092. \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
  10093. \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
  10094. %
  10095. \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
  10096. \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
  10097. \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
  10098. \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
  10099. \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
  10100. \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
  10101. \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
  10102. \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
  10103. \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
  10104. \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
  10105. \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
  10106. \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
  10107. %
  10108. \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
  10109. \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
  10110. %
  10111. \DeclareUnicodeCharacter{1E20}{\=G}%
  10112. \DeclareUnicodeCharacter{1E21}{\=g}%
  10113. \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
  10114. \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
  10115. \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
  10116. \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
  10117. \DeclareUnicodeCharacter{1E26}{\"H}%
  10118. \DeclareUnicodeCharacter{1E27}{\"h}%
  10119. %
  10120. \DeclareUnicodeCharacter{1E30}{\'K}%
  10121. \DeclareUnicodeCharacter{1E31}{\'k}%
  10122. \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
  10123. \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
  10124. \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
  10125. \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
  10126. \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
  10127. \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
  10128. \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
  10129. \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
  10130. \DeclareUnicodeCharacter{1E3E}{\'M}%
  10131. \DeclareUnicodeCharacter{1E3F}{\'m}%
  10132. %
  10133. \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
  10134. \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
  10135. \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
  10136. \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
  10137. \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
  10138. \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
  10139. \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
  10140. \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
  10141. \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
  10142. \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
  10143. %
  10144. \DeclareUnicodeCharacter{1E54}{\'P}%
  10145. \DeclareUnicodeCharacter{1E55}{\'p}%
  10146. \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
  10147. \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
  10148. \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
  10149. \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
  10150. \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
  10151. \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
  10152. \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
  10153. \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
  10154. %
  10155. \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
  10156. \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
  10157. \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
  10158. \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
  10159. \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
  10160. \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
  10161. \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
  10162. \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
  10163. \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
  10164. \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
  10165. %
  10166. \DeclareUnicodeCharacter{1E7C}{\~V}%
  10167. \DeclareUnicodeCharacter{1E7D}{\~v}%
  10168. \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
  10169. \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
  10170. %
  10171. \DeclareUnicodeCharacter{1E80}{\`W}%
  10172. \DeclareUnicodeCharacter{1E81}{\`w}%
  10173. \DeclareUnicodeCharacter{1E82}{\'W}%
  10174. \DeclareUnicodeCharacter{1E83}{\'w}%
  10175. \DeclareUnicodeCharacter{1E84}{\"W}%
  10176. \DeclareUnicodeCharacter{1E85}{\"w}%
  10177. \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
  10178. \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
  10179. \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
  10180. \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
  10181. \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
  10182. \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
  10183. \DeclareUnicodeCharacter{1E8C}{\"X}%
  10184. \DeclareUnicodeCharacter{1E8D}{\"x}%
  10185. \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
  10186. \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
  10187. %
  10188. \DeclareUnicodeCharacter{1E90}{\^Z}%
  10189. \DeclareUnicodeCharacter{1E91}{\^z}%
  10190. \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
  10191. \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
  10192. \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
  10193. \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
  10194. \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
  10195. \DeclareUnicodeCharacter{1E97}{\"t}%
  10196. \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
  10197. \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
  10198. %
  10199. \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
  10200. \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
  10201. %
  10202. \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
  10203. \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
  10204. \DeclareUnicodeCharacter{1EBC}{\~E}%
  10205. \DeclareUnicodeCharacter{1EBD}{\~e}%
  10206. %
  10207. \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
  10208. \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
  10209. \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
  10210. \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
  10211. %
  10212. \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
  10213. \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
  10214. %
  10215. \DeclareUnicodeCharacter{1EF2}{\`Y}%
  10216. \DeclareUnicodeCharacter{1EF3}{\`y}%
  10217. \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
  10218. %
  10219. \DeclareUnicodeCharacter{1EF8}{\~Y}%
  10220. \DeclareUnicodeCharacter{1EF9}{\~y}%
  10221. %
  10222. % Punctuation
  10223. \DeclareUnicodeCharacter{2013}{--}%
  10224. \DeclareUnicodeCharacter{2014}{---}%
  10225. \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
  10226. \DeclareUnicodeCharacter{2019}{\quoteright{}}%
  10227. \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
  10228. \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
  10229. \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
  10230. \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
  10231. \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
  10232. \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
  10233. \DeclareUnicodeCharacter{2022}{\bullet{}}%
  10234. \DeclareUnicodeCharacter{202F}{\thinspace}%
  10235. \DeclareUnicodeCharacter{2026}{\dots{}}%
  10236. \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
  10237. \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
  10238. %
  10239. \DeclareUnicodeCharacter{20AC}{\euro{}}%
  10240. %
  10241. \DeclareUnicodeCharacter{2192}{\expansion{}}%
  10242. \DeclareUnicodeCharacter{21D2}{\result{}}%
  10243. %
  10244. % Mathematical symbols
  10245. \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
  10246. \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
  10247. \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
  10248. \DeclareUnicodeCharacter{2212}{\minus{}}%
  10249. \DeclareUnicodeCharacter{2217}{\ast}%
  10250. \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
  10251. \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
  10252. \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
  10253. \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
  10254. \DeclareUnicodeCharacter{2261}{\equiv{}}%
  10255. \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
  10256. \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
  10257. \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
  10258. \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
  10259. %
  10260. \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
  10261. \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
  10262. \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
  10263. \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
  10264. \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
  10265. \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
  10266. \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
  10267. \DeclareUnicodeCharacter{2127}{\ensuremath\mho}%
  10268. \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
  10269. \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
  10270. \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
  10271. \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
  10272. \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
  10273. \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
  10274. \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
  10275. \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
  10276. \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
  10277. \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
  10278. \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
  10279. \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
  10280. \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
  10281. \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
  10282. \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
  10283. \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}%
  10284. \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
  10285. \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
  10286. \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
  10287. \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
  10288. \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
  10289. \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
  10290. \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
  10291. \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
  10292. \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}%
  10293. \DeclareUnicodeCharacter{2201}{\ensuremath\complement}%
  10294. \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
  10295. \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
  10296. \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
  10297. \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
  10298. \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
  10299. \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
  10300. \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
  10301. \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
  10302. \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
  10303. \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
  10304. \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
  10305. \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
  10306. \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
  10307. \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
  10308. \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
  10309. \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
  10310. \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
  10311. \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
  10312. \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
  10313. \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
  10314. \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
  10315. \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
  10316. \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
  10317. \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
  10318. \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
  10319. \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
  10320. \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
  10321. \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
  10322. \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
  10323. \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
  10324. \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
  10325. \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
  10326. \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
  10327. \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}%
  10328. \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}%
  10329. \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
  10330. \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
  10331. \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
  10332. \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
  10333. \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
  10334. \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
  10335. \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
  10336. \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
  10337. \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
  10338. \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
  10339. \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
  10340. \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
  10341. \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
  10342. \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
  10343. \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}%
  10344. \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}%
  10345. \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
  10346. \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
  10347. \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
  10348. \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
  10349. \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
  10350. \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
  10351. \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
  10352. \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
  10353. \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
  10354. \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
  10355. \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
  10356. \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
  10357. \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
  10358. \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
  10359. %
  10360. \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}%
  10361. \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
  10362. \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
  10363. \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
  10364. \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
  10365. \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}%
  10366. \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
  10367. \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
  10368. \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
  10369. \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
  10370. \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
  10371. \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
  10372. \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
  10373. \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
  10374. \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
  10375. \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
  10376. \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
  10377. \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
  10378. \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
  10379. \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
  10380. \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
  10381. \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
  10382. \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
  10383. \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
  10384. \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
  10385. \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
  10386. \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
  10387. \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}%
  10388. \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
  10389. \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
  10390. \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
  10391. %
  10392. \global\mathchardef\checkmark="1370% actually the square root sign
  10393. \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
  10394. }% end of \unicodechardefs
  10395. % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
  10396. % It makes the setting that replace UTF-8 byte sequence.
  10397. \def\utfeightchardefs{%
  10398. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
  10399. \unicodechardefs
  10400. }
  10401. % Whether the active definitions of non-ASCII characters expand to
  10402. % non-active tokens with the same character code. This is used to
  10403. % write characters literally, instead of using active definitions for
  10404. % printing the correct glyphs.
  10405. \newif\ifpassthroughchars
  10406. \passthroughcharsfalse
  10407. % For native Unicode handling (XeTeX and LuaTeX),
  10408. % provide a definition macro to replace/pass-through a Unicode character
  10409. %
  10410. \def\DeclareUnicodeCharacterNative#1#2{%
  10411. \catcode"#1=\active
  10412. \def\dodeclareunicodecharacternative##1##2##3{%
  10413. \begingroup
  10414. \uccode`\~="##2\relax
  10415. \uppercase{\gdef~}{%
  10416. \ifpassthroughchars
  10417. ##1%
  10418. \else
  10419. ##3%
  10420. \fi
  10421. }
  10422. \endgroup
  10423. }
  10424. \begingroup
  10425. \uccode`\.="#1\relax
  10426. \uppercase{\def\UTFNativeTmp{.}}%
  10427. \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
  10428. \endgroup
  10429. }
  10430. % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
  10431. % It activates the setting that replaces Unicode characters.
  10432. \def\nativeunicodechardefs{%
  10433. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
  10434. \unicodechardefs
  10435. }
  10436. % For native Unicode handling (XeTeX and LuaTeX),
  10437. % make the character token expand
  10438. % to the sequences given in \unicodechardefs for printing.
  10439. \def\DeclareUnicodeCharacterNativeAtU#1#2{%
  10440. \def\UTFAtUTmp{#2}
  10441. \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
  10442. }
  10443. % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
  10444. \def\nativeunicodechardefsatu{%
  10445. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
  10446. \unicodechardefs
  10447. }
  10448. % US-ASCII character definitions.
  10449. \def\asciichardefs{% nothing need be done
  10450. \relax
  10451. }
  10452. % define all Unicode characters we know about, for the sake of @U.
  10453. \iftxinativeunicodecapable
  10454. \nativeunicodechardefsatu
  10455. \else
  10456. \utfeightchardefs
  10457. \fi
  10458. % Make non-ASCII characters printable again for compatibility with
  10459. % existing Texinfo documents that may use them, even without declaring a
  10460. % document encoding.
  10461. %
  10462. \setnonasciicharscatcode \other
  10463. \message{formatting,}
  10464. \newdimen\defaultparindent \defaultparindent = 15pt
  10465. \chapheadingskip = 15pt plus 4pt minus 2pt
  10466. \secheadingskip = 12pt plus 3pt minus 2pt
  10467. \subsecheadingskip = 9pt plus 2pt minus 2pt
  10468. % Prevent underfull vbox error messages.
  10469. \vbadness = 10000
  10470. % Don't be very finicky about underfull hboxes, either.
  10471. \hbadness = 6666
  10472. % Following George Bush, get rid of widows and orphans.
  10473. \widowpenalty=10000
  10474. \clubpenalty=10000
  10475. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  10476. % using an old version of TeX, don't do anything. We want the amount of
  10477. % stretch added to depend on the line length, hence the dependence on
  10478. % \hsize. We call this whenever the paper size is set.
  10479. %
  10480. \def\setemergencystretch{%
  10481. \ifx\emergencystretch\thisisundefined
  10482. % Allow us to assign to \emergencystretch anyway.
  10483. \def\emergencystretch{\dimen0}%
  10484. \else
  10485. \emergencystretch = .15\hsize
  10486. \fi
  10487. }
  10488. % Parameters in order: 1) textheight; 2) textwidth;
  10489. % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
  10490. % 7) physical page height; 8) physical page width.
  10491. %
  10492. % We also call \setleading{\textleading}, so the caller should define
  10493. % \textleading. The caller should also set \parskip.
  10494. %
  10495. \def\internalpagesizes#1#2#3#4#5#6#7#8{%
  10496. \voffset = #3\relax
  10497. \topskip = #6\relax
  10498. \splittopskip = \topskip
  10499. %
  10500. \vsize = #1\relax
  10501. \advance\vsize by \topskip
  10502. \outervsize = \vsize
  10503. \advance\outervsize by 2\topandbottommargin
  10504. \txipageheight = \vsize
  10505. %
  10506. \hsize = #2\relax
  10507. \outerhsize = \hsize
  10508. \advance\outerhsize by 0.5in
  10509. \txipagewidth = \hsize
  10510. %
  10511. \normaloffset = #4\relax
  10512. \bindingoffset = #5\relax
  10513. %
  10514. \ifpdf
  10515. \pdfpageheight #7\relax
  10516. \pdfpagewidth #8\relax
  10517. % if we don't reset these, they will remain at "1 true in" of
  10518. % whatever layout pdftex was dumped with.
  10519. \pdfhorigin = 1 true in
  10520. \pdfvorigin = 1 true in
  10521. \else
  10522. \ifx\XeTeXrevision\thisisundefined
  10523. \special{papersize=#8,#7}%
  10524. \else
  10525. \pdfpageheight #7\relax
  10526. \pdfpagewidth #8\relax
  10527. % XeTeX does not have \pdfhorigin and \pdfvorigin.
  10528. \fi
  10529. \fi
  10530. %
  10531. \setleading{\textleading}
  10532. %
  10533. \parindent = \defaultparindent
  10534. \setemergencystretch
  10535. }
  10536. % @letterpaper (the default).
  10537. \def\letterpaper{{\globaldefs = 1
  10538. \parskip = 3pt plus 2pt minus 1pt
  10539. \textleading = 13.2pt
  10540. %
  10541. % If page is nothing but text, make it come out even.
  10542. \internalpagesizes{607.2pt}{6in}% that's 46 lines
  10543. {\voffset}{.25in}%
  10544. {\bindingoffset}{36pt}%
  10545. {11in}{8.5in}%
  10546. }}
  10547. % Use @smallbook to reset parameters for 7x9.25 trim size.
  10548. \def\smallbook{{\globaldefs = 1
  10549. \parskip = 2pt plus 1pt
  10550. \textleading = 12pt
  10551. %
  10552. \internalpagesizes{7.5in}{5in}%
  10553. {-.2in}{0in}%
  10554. {\bindingoffset}{16pt}%
  10555. {9.25in}{7in}%
  10556. %
  10557. \lispnarrowing = 0.3in
  10558. \tolerance = 700
  10559. \contentsrightmargin = 0pt
  10560. \defbodyindent = .5cm
  10561. }}
  10562. % Use @smallerbook to reset parameters for 6x9 trim size.
  10563. % (Just testing, parameters still in flux.)
  10564. \def\smallerbook{{\globaldefs = 1
  10565. \parskip = 1.5pt plus 1pt
  10566. \textleading = 12pt
  10567. %
  10568. \internalpagesizes{7.4in}{4.8in}%
  10569. {-.2in}{-.4in}%
  10570. {0pt}{14pt}%
  10571. {9in}{6in}%
  10572. %
  10573. \lispnarrowing = 0.25in
  10574. \tolerance = 700
  10575. \contentsrightmargin = 0pt
  10576. \defbodyindent = .4cm
  10577. }}
  10578. % Use @afourpaper to print on European A4 paper.
  10579. \def\afourpaper{{\globaldefs = 1
  10580. \parskip = 3pt plus 2pt minus 1pt
  10581. \textleading = 13.2pt
  10582. %
  10583. % Double-side printing via postscript on Laserjet 4050
  10584. % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  10585. % To change the settings for a different printer or situation, adjust
  10586. % \normaloffset until the front-side and back-side texts align. Then
  10587. % do the same for \bindingoffset. You can set these for testing in
  10588. % your texinfo source file like this:
  10589. % @tex
  10590. % \global\normaloffset = -6mm
  10591. % \global\bindingoffset = 10mm
  10592. % @end tex
  10593. \internalpagesizes{673.2pt}{160mm}% that's 51 lines
  10594. {\voffset}{\hoffset}%
  10595. {\bindingoffset}{44pt}%
  10596. {297mm}{210mm}%
  10597. %
  10598. \tolerance = 700
  10599. \contentsrightmargin = 0pt
  10600. \defbodyindent = 5mm
  10601. }}
  10602. % Use @afivepaper to print on European A5 paper.
  10603. % From romildo@urano.iceb.ufop.br, 2 July 2000.
  10604. % He also recommends making @example and @lisp be small.
  10605. \def\afivepaper{{\globaldefs = 1
  10606. \parskip = 2pt plus 1pt minus 0.1pt
  10607. \textleading = 12.5pt
  10608. %
  10609. \internalpagesizes{160mm}{120mm}%
  10610. {\voffset}{\hoffset}%
  10611. {\bindingoffset}{8pt}%
  10612. {210mm}{148mm}%
  10613. %
  10614. \lispnarrowing = 0.2in
  10615. \tolerance = 800
  10616. \contentsrightmargin = 0pt
  10617. \defbodyindent = 2mm
  10618. \tableindent = 12mm
  10619. }}
  10620. % A specific text layout, 24x15cm overall, intended for A4 paper.
  10621. \def\afourlatex{{\globaldefs = 1
  10622. \afourpaper
  10623. \internalpagesizes{237mm}{150mm}%
  10624. {\voffset}{4.6mm}%
  10625. {\bindingoffset}{7mm}%
  10626. {297mm}{210mm}%
  10627. %
  10628. % Must explicitly reset to 0 because we call \afourpaper.
  10629. \globaldefs = 0
  10630. }}
  10631. % Use @afourwide to print on A4 paper in landscape format.
  10632. \def\afourwide{{\globaldefs = 1
  10633. \afourpaper
  10634. \internalpagesizes{241mm}{165mm}%
  10635. {\voffset}{-2.95mm}%
  10636. {\bindingoffset}{7mm}%
  10637. {297mm}{210mm}%
  10638. \globaldefs = 0
  10639. }}
  10640. % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  10641. % Perhaps we should allow setting the margins, \topskip, \parskip,
  10642. % and/or leading, also. Or perhaps we should compute them somehow.
  10643. %
  10644. \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
  10645. \def\pagesizesyyy#1,#2,#3\finish{{%
  10646. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  10647. \globaldefs = 1
  10648. %
  10649. \parskip = 3pt plus 2pt minus 1pt
  10650. \setleading{\textleading}%
  10651. %
  10652. \dimen0 = #1\relax
  10653. \advance\dimen0 by \voffset
  10654. %
  10655. \dimen2 = \hsize
  10656. \advance\dimen2 by \normaloffset
  10657. %
  10658. \internalpagesizes{#1}{\hsize}%
  10659. {\voffset}{\normaloffset}%
  10660. {\bindingoffset}{44pt}%
  10661. {\dimen0}{\dimen2}%
  10662. }}
  10663. % Set default to letter.
  10664. %
  10665. \letterpaper
  10666. % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
  10667. \hfuzz = 1pt
  10668. \message{and turning on texinfo input format.}
  10669. \def^^L{\par} % remove \outer, so ^L can appear in an @comment
  10670. % DEL is a comment character, in case @c does not suffice.
  10671. \catcode`\^^? = 14
  10672. % Define macros to output various characters with catcode for normal text.
  10673. \catcode`\"=\other \def\normaldoublequote{"}
  10674. \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
  10675. \catcode`\+=\other \def\normalplus{+}
  10676. \catcode`\<=\other \def\normalless{<}
  10677. \catcode`\>=\other \def\normalgreater{>}
  10678. \catcode`\^=\other \def\normalcaret{^}
  10679. \catcode`\_=\other \def\normalunderscore{_}
  10680. \catcode`\|=\other \def\normalverticalbar{|}
  10681. \catcode`\~=\other \def\normaltilde{~}
  10682. % This macro is used to make a character print one way in \tt
  10683. % (where it can probably be output as-is), and another way in other fonts,
  10684. % where something hairier probably needs to be done.
  10685. %
  10686. % #1 is what to print if we are indeed using \tt; #2 is what to print
  10687. % otherwise. Since all the Computer Modern typewriter fonts have zero
  10688. % interword stretch (and shrink), and it is reasonable to expect all
  10689. % typewriter fonts to have this, we can check that font parameter.
  10690. %
  10691. \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
  10692. % Same as above, but check for italic font. Actually this also catches
  10693. % non-italic slanted fonts since it is impossible to distinguish them from
  10694. % italic fonts. But since this is only used by $ and it uses \sl anyway
  10695. % this is not a problem.
  10696. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
  10697. % Set catcodes for Texinfo file
  10698. % Active characters for printing the wanted glyph.
  10699. % Most of these we simply print from the \tt font, but for some, we can
  10700. % use math or other variants that look better in normal text.
  10701. %
  10702. \catcode`\"=\active
  10703. \def\activedoublequote{{\tt\char34}}
  10704. \let"=\activedoublequote
  10705. \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
  10706. \chardef\hatchar=`\^
  10707. \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
  10708. \catcode`\_=\active
  10709. \def_{\ifusingtt\normalunderscore\_}
  10710. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
  10711. \let\realunder=_
  10712. \catcode`\|=\active \def|{{\tt\char124}}
  10713. \chardef \less=`\<
  10714. \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
  10715. \chardef \gtr=`\>
  10716. \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
  10717. \catcode`\+=\active \def+{{\tt \char 43}}
  10718. \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  10719. \catcode`\-=\active \let-=\normaldash
  10720. % used for headline/footline in the output routine, in case the page
  10721. % breaks in the middle of an @tex block.
  10722. \def\texinfochars{%
  10723. \let< = \activeless
  10724. \let> = \activegtr
  10725. \let~ = \activetilde
  10726. \let^ = \activehat
  10727. \markupsetuplqdefault \markupsetuprqdefault
  10728. \let\b = \strong
  10729. \let\i = \smartitalic
  10730. % in principle, all other definitions in \tex have to be undone too.
  10731. }
  10732. % Used sometimes to turn off (effectively) the active characters even after
  10733. % parsing them.
  10734. \def\turnoffactive{%
  10735. \normalturnoffactive
  10736. \otherbackslash
  10737. }
  10738. \catcode`\@=0
  10739. % \backslashcurfont outputs one backslash character in current font,
  10740. % as in \char`\\.
  10741. \global\chardef\backslashcurfont=`\\
  10742. \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
  10743. % \realbackslash is an actual character `\' with catcode other, and
  10744. % \doublebackslash is two of them (for the pdf outlines).
  10745. {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
  10746. % In Texinfo, backslash is an active character; it prints the backslash
  10747. % in fixed width font.
  10748. \catcode`\\=\active % @ for escape char from now on.
  10749. % Print a typewriter backslash. For math mode, we can't simply use
  10750. % \backslashcurfont: the story here is that in math mode, the \char
  10751. % of \backslashcurfont ends up printing the roman \ from the math symbol
  10752. % font (because \char in math mode uses the \mathcode, and plain.tex
  10753. % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
  10754. % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
  10755. % ignored family value; char position "5C). We can't use " for the
  10756. % usual hex value because it has already been made active.
  10757. @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
  10758. @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
  10759. % \rawbackslash defines an active \ to do \backslashcurfont.
  10760. % \otherbackslash defines an active \ to be a literal `\' character with
  10761. % catcode other. We switch back and forth between these.
  10762. @gdef@rawbackslash{@let\=@backslashcurfont}
  10763. @gdef@otherbackslash{@let\=@realbackslash}
  10764. % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  10765. % the literal character `\'.
  10766. %
  10767. {@catcode`- = @active
  10768. @gdef@normalturnoffactive{%
  10769. @passthroughcharstrue
  10770. @let-=@normaldash
  10771. @let"=@normaldoublequote
  10772. @let$=@normaldollar %$ font-lock fix
  10773. @let+=@normalplus
  10774. @let<=@normalless
  10775. @let>=@normalgreater
  10776. @let^=@normalcaret
  10777. @let_=@normalunderscore
  10778. @let|=@normalverticalbar
  10779. @let~=@normaltilde
  10780. @let\=@ttbackslash
  10781. @markupsetuplqdefault
  10782. @markupsetuprqdefault
  10783. @unsepspaces
  10784. }
  10785. }
  10786. % If a .fmt file is being used, characters that might appear in a file
  10787. % name cannot be active until we have parsed the command line.
  10788. % So turn them off again, and have @fixbackslash turn them back on.
  10789. @catcode`+=@other @catcode`@_=@other
  10790. % \enablebackslashhack - allow file to begin `\input texinfo'
  10791. %
  10792. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  10793. % That is what \eatinput is for; after that, the `\' should revert to printing
  10794. % a backslash.
  10795. % If the file did not have a `\input texinfo', then it is turned off after
  10796. % the first line; otherwise the first `\' in the file would cause an error.
  10797. % This is used on the very last line of this file, texinfo.tex.
  10798. % We also use @c to call @fixbackslash, in case ends of lines are hidden.
  10799. {
  10800. @catcode`@^=7
  10801. @catcode`@^^M=13@gdef@enablebackslashhack{%
  10802. @global@let\ = @eatinput%
  10803. @catcode`@^^M=13%
  10804. @def@c{@fixbackslash@c}%
  10805. % Definition for the newline at the end of this file.
  10806. @def ^^M{@let^^M@secondlinenl}%
  10807. % Definition for a newline in the main Texinfo file.
  10808. @gdef @secondlinenl{@fixbackslash}%
  10809. % In case the first line has a whole-line command on it
  10810. @let@originalparsearg@parsearg
  10811. @def@parsearg{@fixbackslash@originalparsearg}
  10812. }}
  10813. {@catcode`@^=7 @catcode`@^^M=13%
  10814. @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
  10815. % Emergency active definition of newline, in case an active newline token
  10816. % appears by mistake.
  10817. {@catcode`@^=7 @catcode13=13%
  10818. @gdef@enableemergencynewline{%
  10819. @gdef^^M{%
  10820. @par%
  10821. %<warning: active newline>@par%
  10822. }}}
  10823. @gdef@fixbackslash{%
  10824. @ifx\@eatinput @let\ = @ttbackslash @fi
  10825. @catcode13=5 % regular end of line
  10826. @enableemergencynewline
  10827. @let@c=@texinfoc
  10828. @let@parsearg@originalparsearg
  10829. % Also turn back on active characters that might appear in the input
  10830. % file name, in case not using a pre-dumped format.
  10831. @catcode`+=@active
  10832. @catcode`@_=@active
  10833. %
  10834. % If texinfo.cnf is present on the system, read it.
  10835. % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
  10836. % called at the beginning of every Texinfo file. Not opening texinfo.cnf
  10837. % directly in this file, texinfo.tex, makes it possible to make a format
  10838. % file for Texinfo.
  10839. %
  10840. @openin 1 texinfo.cnf
  10841. @ifeof 1 @else @input texinfo.cnf @fi
  10842. @closein 1
  10843. }
  10844. % Say @foo, not \foo, in error messages.
  10845. @escapechar = `@@
  10846. % These (along with & and #) are made active for url-breaking, so need
  10847. % active definitions as the normal characters.
  10848. @def@normaldot{.}
  10849. @def@normalquest{?}
  10850. @def@normalslash{/}
  10851. % These look ok in all fonts, so just make them not special.
  10852. % @hashchar{} gets its own user-level command, because of #line.
  10853. @catcode`@& = @other @def@normalamp{&}
  10854. @catcode`@# = @other @def@normalhash{#}
  10855. @catcode`@% = @other @def@normalpercent{%}
  10856. @let @hashchar = @normalhash
  10857. @c Finally, make ` and ' active, so that txicodequoteundirected and
  10858. @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
  10859. @c don't make ` and ' active, @code will not get them as active chars.
  10860. @c Do this last of all since we use ` in the previous @catcode assignments.
  10861. @catcode`@'=@active
  10862. @catcode`@`=@active
  10863. @markupsetuplqdefault
  10864. @markupsetuprqdefault
  10865. @c Local variables:
  10866. @c eval: (add-hook 'write-file-hooks 'time-stamp)
  10867. @c page-delimiter: "^\\\\message\\|emacs-page"
  10868. @c time-stamp-start: "def\\\\texinfoversion{"
  10869. @c time-stamp-format: "%:y-%02m-%02d.%02H"
  10870. @c time-stamp-end: "}"
  10871. @c End:
  10872. @c vim:sw=2:
  10873. @enablebackslashhack