texinfo.tex 277 KB

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